home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / MODEMS / ZMODEM / ZMO-MH05.ZZ0 / ZMO-MH05.Z80
Text File  |  2000-06-30  |  14KB  |  710 lines

  1. ;  PROGRAM: ZMO-MH05.Z80
  2. ;  AUTHOR:  Lindsay Allen
  3. ;  VERSION: 1.5
  4. ;  DATE:  19 Sept, 1988          
  5. ;-----------------------------------------------------------------------
  6. ;    This overlay is set up for a Morrow MD11.
  7. ;    Uses a Z80SIO and an 8253 CTC
  8. ;-----------------------------------------------------------------------
  9. ; 89/04/12 - Modified to ZMP v1.5        - George Conover
  10. ; 89/03/15 - Removed the beginning remarks to make the file
  11. ;            smaller. If you need the remarks there are in the
  12. ;            file ZMP-BLNK.Z80             - George Conover
  13. ; 89/03/14 - Modified to ZMP v1.4        - George Conover
  14. ; 88/10/12 - Modified to ZMP v1.3        - Ron Murray
  15. ; 88/09/15 - Modified to ZMP v1.2        - Ron Murray
  16. ; 88/09/14 - First version of this file        - Lindsay Allen
  17. ;
  18. ;    Written by -
  19. ;      Ron Murray, c/o Z-Node 62, 061-9-450-0200, Perth, Western Australia.
  20. ;-----------------------------------------------------------------------
  21. NO    EQU    0
  22. YES    EQU    NOT NO
  23. ;
  24. ; User-set variables
  25. ;
  26. CLKSPD    EQU    4        ; Processor clock speed in MHz
  27. ;
  28. DEBUG    EQU    NO
  29.  
  30. ;Set the following two equates to the drive and user area which will contain
  31. ;   ZMP's .OVR files, .CFG file, .FON file and .HLP file. Set both to zero
  32. ;   (null) to locate them on the drive from which ZMP was invoked.
  33.  
  34. OVERDRIVE    EQU    'A'    ; Drive to find overlay files on ('A'-'P')
  35. OVERUSER    EQU    0    ; User area to find files
  36.  
  37. ;------------------------------------------------------------------------------
  38. ;
  39. ; NOT user-set variables
  40. ;
  41. USERDEF    EQU    0145H        ; Origin of this overlay.  This address
  42. ;                ;   may change with subsequent revisions
  43. MSPEED    EQU    05CH        ; Location of current baud rate.
  44. OVSIZE    EQU    0400H        ; Max size of this overlay
  45. ;
  46.     .Z80            ; Use z80 code
  47.     ASEG            ; Absolute
  48. ;
  49.      IF    DEBUG
  50.     ORG    100H        ; So you can debug it with CEBUG, ZSID,
  51. ;                ;   etc.
  52.      ELSE
  53.     ORG    USERDEF
  54.      ENDIF            ; DEBUG
  55. ;
  56. ESC    EQU    1BH
  57. CTRLQ    EQU    11H
  58. CR    EQU    0DH
  59. LF    EQU    0AH
  60. BDOS    EQU    5
  61. ;
  62. ;    Ports:
  63. ;        Console data    60
  64. ;            stat    61
  65. ;
  66. ;        Modem    data    62
  67. ;            Rx bit     2
  68. ;            stat    63
  69. ;            Tx     0
  70. ;
  71. ;        SIO    data    70
  72. ;            stat    71
  73. ;
  74. ;                      mode 3        BNKBIOS3
  75. ;    CTC    SIO    50    CH 0    3E    PORT 3    (BAUD2)
  76. ;        MODEM    51    CH 1    7E    PORT 2    (BAUD1)
  77. ;        CONSOLE 52    CH 2    BE    PORT 1    (BAUD0)
  78. ;        SELECT    53
  79. ;
  80. ;
  81. ; MDII specific equates
  82. ;
  83. SIO    EQU    YES        ; YES to use the SIO, NO to use the DART
  84. ;
  85.      IF    SIO
  86. MDATA    EQU    070H        ; Use RS232 socket at other end from
  87. ;                ;   Terminal
  88. MSTAT    EQU    MDATA+1
  89. CTC    EQU    50H
  90. MODE    EQU    3EH
  91. ;
  92.      ELSE
  93. MDATA    EQU    62H        ; Use RSs232 socket adjacent to Terminal
  94. MSTAT    EQU    MDATA+1
  95. CTC    EQU    51H
  96. MODE    EQU    7EH
  97.      ENDIF            ; SIO
  98. ;
  99. RDA    EQU    0
  100. TBE    EQU    2
  101. CTCSEL    EQU    53H
  102. ONHOOK    EQU    7FH
  103. ONLINE    EQU    80H
  104. ERROR    EQU    70H
  105. BREAK    EQU    0F8H
  106. RESET    EQU    30H
  107. ;
  108. ;-----------------------------------------------------------------------
  109. ;
  110. ; Main code starts here
  111. ;
  112. ; Jump table for the overlay: do NOT change this
  113. ;
  114. CODEBGN    EQU    $
  115. ;
  116. JUMPTAB:
  117.     JP    SCRNPR        ; Screen print
  118.     JP    MRD        ; Modem read with timeout
  119.     JP    MCHIN        ; Get a character from modem
  120.     JP    MCHOUT        ; Send a character to the modem
  121.     JP    MORDY        ; Test for tx buffer empty
  122.     JP    MIRDY        ; Test for character received
  123.     JP    SNDBRK        ; Send break
  124.     JP    CURSADD        ; Cursor addressing
  125.     JP    CLS        ; Clear screen
  126.     JP    INVON        ; Inverse video on
  127.     JP    INVOFF        ; Inverse video off
  128.     JP    HIDE        ; Hide cursor
  129.     JP    SHOW        ; Show cursor
  130.     JP    SAVECU        ; Save cursor position
  131.     JP    RESCU        ; Restore cursor position
  132.     JP    MINT        ; Service modem interrupt
  133.     JP    INVEC        ; Initialise interrupt vectors
  134.     JP    DINVEC        ; De-initialise interrupt vectors
  135.     JP    MDMERR        ; Test uart flags for error
  136.     JP    DTRON        ; Turn DTR on
  137.     JP    DTROFF        ; Turn DTR OFF
  138.     JP    INIT        ; Initialise uart
  139.     JP    WAIT        ; Wait seconds
  140.     JP    MSWAIT        ; Wait milliseconds
  141.     JP    USERIN        ; User-defined entry routine
  142.     JP    USEROUT        ; User-defined exit routine
  143.     JP    GETVARS        ; get system variables
  144.       JP    SETPORT        ; Set port (0 or 1)
  145. ;
  146. ; Spare jumps for compatibility with future versions
  147. ;
  148.     JP    SPARE        ; Spares for later use
  149.     JP    SPARE        ; Spares for later use
  150.     JP    SPARE        ; Spares for later use
  151.     JP    SPARE        ; Spares for later use
  152.     JP    SPARE        ; Spares for later use
  153.     JP    SPARE        ; Spares for later use
  154. ;
  155. SPARE:    RET
  156. ;
  157. ;-----------------------------------------------------------------------
  158. ;
  159. ; Screen print function
  160. ;
  161. SCRNPR:    DS    0
  162. ;
  163. ; <== Insert your own code here
  164. ;
  165.     CALL    PRINT
  166.     DB    'This function not supported.',CR,LF,0
  167. ;
  168. ; <== End of your own code
  169. ;
  170.     RET
  171. ;
  172. ;
  173. ; Get a character from the modem: return in HL
  174. ;
  175. MCHIN:    PUSH    BC
  176. ;
  177. ; <== Insert your own code here
  178. ;
  179. MCHIN2:    IN    A,(MSTAT)    ; Check for char waiting
  180.     BIT    RDA,A
  181.     JR    Z,MCHIN2
  182.     IN    A,(MDATA)    ; Read the char
  183. ;
  184. ; <== End of your own code
  185. ;
  186.     LD    L,A        ; Put in HL
  187.     LD    H,0
  188.     OR    A        ; Set/clear Z
  189.     POP    BC
  190.     RET
  191. ;
  192. ; Send a character to the modem
  193. ;
  194. MCHOUT:    LD    HL,2        ; Get the character
  195.     ADD    HL,SP
  196.     LD    A,(HL)
  197. ;
  198. ; <== Insert your own code here
  199. ;
  200.     PUSH    BC
  201.     LD    B,A        ; Save the character
  202. ;
  203. MCHOUT2:IN    A,(MSTAT)    ; Check for uart ready
  204.     BIT    TBE,A
  205.     JR    Z,MCHOUT2
  206.     LD    A,B        ; Char in a
  207.     OUT    (MDATA),A    ; Send it
  208.     POP    BC
  209. ;
  210. ; <== End of your own code
  211. ;
  212.     RET            ; Done
  213. ;
  214. ; Test for output ready: return TRUE (1) in HL if ok
  215. ;
  216. MORDY:    DS    0
  217. ;'
  218. ; <== Insert your own code here
  219. ;
  220.     LD    HL,0
  221.     IN    A,(MSTAT)
  222.     BIT    TBE,A        ; Transmit buffer empty
  223.     JR    Z,MORDY1
  224.     INC    HL
  225. ;
  226. MORDY1:    DS    0
  227. ;
  228. ; <== End of your own code
  229. ;
  230.     LD    A,L        ; Set/clear Z
  231.     OR    A
  232.     RET
  233. ;
  234. ; Test for character at modem: return TRUE (1) in HL if so
  235.  
  236. MIRDY:    DS    0
  237. ;
  238. ; <== Insert your own code here
  239. ;
  240.     LD    HL,0
  241.     IN    A,(MSTAT)
  242.     BIT    RDA,A        ; Received data available
  243.     JR    Z,MIRDY1
  244.     INC    HL
  245. ;
  246. MIRDY1:    DS    0
  247. ;
  248. ; <== End of your own code
  249. ;
  250.     LD    A,L        ; Set/clear Z
  251.     OR    A
  252.     RET
  253. ;
  254. ; Send a break to the modem: leave empty if your system can't do it
  255. ;
  256. SNDBRK:    DS    0
  257. ;
  258. ; <== Insert your own code here
  259. ;
  260.     LD    A,5
  261.     OUT    (MSTAT),A
  262.     LD    A,BREAK        ; F8
  263.     OUT    (MSTAT),A
  264.     LD    HL,300        ; A 300 mS break
  265.     CALL    WAITHLMS
  266.     LD    A,5
  267.     OUT    (MSTAT),A
  268.     LD    A,ONLINE    ; 68
  269.     OUT    (MSTAT),A
  270.     LD    A,3
  271.     OUT    (MSTAT),A
  272.     LD    A,0E1H
  273.     OUT    (MSTAT),A    ; E1
  274. ;
  275. ; <== End of your own code
  276. ;
  277.     RET
  278. ;
  279. ; Test UART flags for error: return TRUE (1) in HL if error
  280. ;
  281. MDMERR:    DS    0
  282. ;
  283. ; <== Insert your own code here
  284. ;
  285.     LD    HL,0
  286.     IN    A,(MSTAT)
  287.     AND    ERROR
  288.     JR    Z,MDMER2
  289.     INC    HL
  290. ;
  291. MDMER2:    DS    0
  292. ;
  293. ; <== End of your own code
  294. ;
  295.     LD    A,L        ; Set/clear Z
  296.     OR    A
  297.     RET
  298. ;
  299. ; Turn DTR ON
  300. ;
  301. DTRON:    DS    0
  302. ;
  303. ; <== Insert your own code here
  304. ;
  305.     LD    A,5
  306.     OUT    (MSTAT),A
  307.     LD    A,(COMBYT)    ; Get the one we used last time
  308.     OR    ONLINE        ; 80h - set bit 7 high
  309.     LD    (COMBYT),A    ; Save it for next time
  310.     OUT    (MSTAT),A    ; Go
  311. ;
  312. ; <== End of your own code
  313. ;
  314.     RET
  315. ;
  316. ; Turn DTR OFF
  317. ;
  318. DTROFF:    DS    0
  319. ;
  320. ; <== Insert your own code here
  321. ;
  322.     LD    A,5
  323.     OUT    (MSTAT),A
  324.     LD    A,(COMBYT)    ; Get the one we used last time
  325.     AND    ONHOOK        ; 7Fh - clear bit 7
  326.     LD    (COMBYT),A    ; Save it for next time
  327.     OUT    (MSTAT),A    ; Go
  328. ;
  329. ; <== End of your own code
  330. ;
  331.     RET
  332. ;
  333. ; Initialise the SIO +++
  334. ; The SIO is set up in four steps:
  335. ;    1)  Reset
  336. ;    2)  Reg 4 - clock, stop bits, parity
  337. ;    3)  Reg 5 - dtr, Tx bits, Brk, TxEn, rts
  338. ;    4)  Reg 3 - Rx bits, RxEn
  339. ;
  340. INIT:    LD    HL,2        ; Get parameters
  341.     ADD    HL,SP
  342.     EX    DE,HL
  343.     CALL    GETPARM        ; In HL
  344.     LD    (BRATE),HL    ; Baud rate
  345.     LD    A,L
  346.     LD    (003CH),A    ; Save the baud rate in 3C for later
  347. ;                ;   as per IMP
  348.     CALL    GETPARM
  349.     LD    (PARITY),HL    ; Parity
  350.     CALL    GETPARM
  351.     LD    (DATA),HL    ; Data bits
  352.     CALL    GETPARM
  353.     LD    (STOP),HL    ; Stop bits
  354. ;
  355. ; <== Insert your own code here, using values below
  356. ;
  357.     PUSH    BC
  358.     LD    A,0
  359.     OUT    (MSTAT),A    ; Point to reg 0
  360.     LD    A,18H        ; Reset
  361.     OUT    (MSTAT),A    ; *** step 1
  362.     LD    A,4        ; Point to wrt reg 4
  363.     OUT    (MSTAT),A
  364.     LD    E,44H        ; Assume  x16, 1 stop, No parity
  365.     LD    A,(STOP)    ; Set stop bits
  366.     CP    2        ; Set 2 if required
  367.     JR    NZ,SETPAR
  368.     SET    3,E
  369. ;
  370. SETPAR:    LD    A,(PARITY)    ; Set parity bits
  371.     CP    'O'
  372.     JR    NZ,SETPA2
  373.     SET    0,E        ; ODD
  374.     JR    SETPA3
  375. ;
  376. SETPA2:    CP    'E'
  377.     JR    NZ,SETPA3
  378.     SET    0,E
  379.     SET    1,E        ; EVEN
  380. ;
  381. SETPA3:    LD    A,E
  382.     OUT    (MSTAT),A    ; *** step 2
  383.     LD    A,5        ; Point to wrt reg 5 - dtr, Tx bits, etc
  384.     OUT    (MSTAT),A
  385.     LD    E,0EAH        ; Assume dtr, TX 8 bits, TxEn, rts
  386.     LD    A,(DATA)
  387.     CP    7
  388.     JR    NZ,SETBI2
  389.     RES    6,E        ; 7 bits
  390. ;
  391. SETBI2:    LD    A,E
  392.     OUT    (MSTAT),A    ; *** step 3
  393.     LD    A,3        ; Point to wrt reg 3
  394.     OUT    (MSTAT),A
  395.     LD    E,0C1H        ; Assume 8 bits
  396.     LD    A,(DATA)
  397.     CP    7
  398.     JR    NZ,SETBI3
  399.     RES    7,E        ; 7 bits
  400. ;
  401. SETBI3:    LD    A,E
  402.     OUT    (MSTAT),A    ; *** step 4
  403. ;
  404. SETBRATE:
  405.     PUSH    IX
  406.     LD    DE,(BRATE)    ; Get baud rate value (0-10)
  407.     LD    HL,BRVAL
  408.     ADD    HL,DE
  409.     ADD    HL,DE        ; Hl now points to the divisor dw
  410.     PUSH    HL        ; Look at it
  411.     POP    IX
  412.     LD    A,(IX)
  413.     OR    (IX+1)
  414.     JR    Z,SETBRX    ; Zero = invalid
  415.     LD    C,CTCSEL    ; 053h
  416.     LD    A,MODE        ; 03Eh or 7Eh
  417.     OUT    (C),A        ; Select the correct timer and mode
  418. ;                ;   of the 8253
  419.     LD    C,CTC        ; 050h or 51h
  420.     OUTI            ; Lo byte
  421.     OUTI            ; Hi byte
  422.     LD    A,(BRATE)    ; Tell zmp it's ok
  423.     LD    (MSPEED),A
  424. ;
  425. SETBRX:    POP    IX
  426.     POP    BC
  427. ;
  428. ; <== End of your own code
  429. ;
  430.     RET
  431. ;
  432. ;-----------------------------------------------------------------------
  433. ;
  434. STOP:    DW    1        ; Stop bits
  435. PARITY:    DW    'N'        ; Parity
  436. DATA:    DW    8        ; Data bits
  437. BRATE:    DW    7        ; Baud rate:
  438. COMBYT:    DB    0EAH        ; For now
  439. ;
  440. ;-----------------------------------------------------------------------
  441. ;
  442. ;Values for 8253 control reg for each baud rate
  443. ;
  444. BRVAL:    DW    2273        ; 110         0
  445.     DW    833        ; 300         1
  446.     DW    555        ; 450         2
  447.     DW    417        ; 600         3
  448.     DW    352        ; 710         4
  449.     DW    208        ; 1200         5
  450.     DW    104        ; 2400         6
  451.     DW    52        ; 4800         7
  452.     DW    26        ; 9600         8
  453.     DW    13        ; 19200      9
  454.     DW    0        ; 38400     10
  455.     DW    0        ; 57600     11
  456.     DW    0        ; 76800     12
  457.     DW    0        ; 115200    13
  458. ;
  459. ; Set the port. ZMP supplies either 0 or 1 as a parameter.
  460. ;
  461. setport:
  462.     ld    hl,2        ; get port number
  463.     add    hl,sp
  464.     ex    de,hl
  465.     call    getparm        ; in HL (values are 0 and 1)
  466.  
  467.                 ; <== Insert your own code here
  468.  
  469.                 ; <== End of your own code
  470.     ret
  471. ;
  472. ;-----------------------------------------------------------------------
  473. ;
  474. ; Video terminal sequences: these are for ADM-3A: Modify as you wish
  475. ;
  476. ; Cursor addressing
  477. ;
  478. CURSADD:LD    HL,2        ; Get parameters
  479.     ADD    HL,SP
  480.     EX    DE,HL
  481.     CALL    GETPARM        ; In HL
  482.     LD    (ROW),HL    ; Row
  483.     CALL    GETPARM
  484.     LD    (COL),HL    ; Column
  485. ;
  486. ; <== Insert your own code here, using values in row and column
  487. ;
  488.     CALL    PRINT
  489.     DB    ESC,'=',0    ; ADM-3A leadin
  490.     LD    A,(ROW)        ; Row first
  491.     ADD    A,' '        ; Add offset
  492.     CALL    COUT
  493.     LD    A,(COL)        ; Sane for column
  494.     ADD    A,' '
  495.     CALL    COUT
  496. ;
  497. ; <== end of your own code
  498. ;
  499.     RET
  500. ;
  501. ROW:    DS    2        ; Row
  502. COL:    DS    2        ; Column
  503. ;
  504. ; Clear screen
  505. ;
  506. CLS:    CALL    PRINT
  507.     DB    ESC,'*',0
  508.     RET
  509. ;
  510. ; Inverse video on
  511. ;
  512. INVON:    CALL    PRINT
  513.     DB    ESC,'G4',0
  514.     RET
  515. ;
  516. ; Inverse video off
  517. ;
  518. INVOFF:    CALL    PRINT
  519.     DB    ESC,'G0',0
  520.     RET
  521. ;
  522. ; Turn off cursor
  523. ;
  524. HIDE:    CALL    PRINT
  525.     DB    ESC,'.1',0
  526.     RET
  527. ;
  528. ; Turn on cursor
  529. ;
  530. SHOW:
  531.     CALL    PRINT
  532.     DB    ESC,'.3',0
  533.     RET
  534. ;
  535. ; Save cursor position
  536. ;
  537. SAVECU:    RET
  538. ;
  539. ; Restore cursor position
  540. ;
  541. RESCU:    RET
  542. ;
  543. ;-----------------------------------------------------------------------
  544. ;
  545. ; Service modem interrupt
  546. ;
  547. MINT:    RET            ; My system doesn't need this
  548. ;
  549. ; Initialise interrupt vectors
  550. ;
  551. INVEC:    RET            ; Ditto
  552. ;
  553. ; De-initialise interrupt vectors
  554. ;
  555. DINVEC:    RET            ; Ditto
  556. ;
  557. ; User-defined entry routine: leave empty if not used
  558. ;
  559. USERIN:    RET
  560. ;
  561. ; User-defined exit routine: leave empty if not used
  562. ;
  563. USEROUT:RET
  564. ;
  565. ;------------------- End of user-defined code --------------------------
  566. ;         Do not change anything below here
  567. ;
  568. ; Modem character test for 100 ms
  569. ;
  570. MRD:    PUSH    BC        ; Save BC
  571.     LD    BC,100        ; Set limit
  572. ;
  573. MRD1:    CALL    MIRDY        ; Char at modem?
  574.     JR    NZ,MRD2        ; Yes, exit
  575.     LD    HL,1        ; Else wait 1 ms
  576.     CALL    WAITHLMS
  577.     DEC    BC        ; Loop till done
  578.     LD    A,B
  579.     OR    C
  580.     JR    NZ,MRD1
  581.     LD    HL,0        ; None there, result=0
  582.     XOR    A
  583. ;
  584. MRD2:    POP    BC
  585.     RET
  586. ;
  587. ; Inline print routine: destroys A and HL
  588. ;
  589. PRINT:    EX    (SP),HL        ; Get address of string
  590. ;
  591. PLOOP:    LD    A,(HL)        ; Get next
  592.     INC    HL        ; Bump pointer
  593.     OR    A        ; Done if zero
  594.     JR    Z,PDONE
  595.     CALL    COUT        ; Else print
  596.     JR    PLOOP        ; And loop
  597. ;
  598. PDONE:    EX    (SP),HL        ; Restore return address
  599.     RET            ; And quit
  600. ;
  601. ; Output a character in A to the console
  602. ;
  603. COUT:    PUSH    BC        ; Save registers
  604.     PUSH    DE
  605.     PUSH    HL
  606.     LD    E,A        ; Character to E
  607.     LD    C,2
  608.     CALL    BDOS        ; Print it
  609.     POP    HL
  610.     POP    DE
  611.     POP    BC
  612.     RET
  613. ;
  614. ; Wait(seconds)
  615. ;
  616. WAIT:    LD    HL,2
  617.     ADD    HL,SP
  618.     EX    DE,HL        ; Get delay size
  619.     CALL    GETPARM
  620. ;                ; Fall thru to...
  621. ; Wait seconds in HL
  622. ;
  623. WAITHLS:PUSH    BC        ; Save BC
  624.     PUSH    DE        ; DE
  625.     PUSH    IX        ; And IX
  626.     LD    IX,0        ; Then point IX to 0
  627. ;                ;   so we don't upset memory-mapped I/O
  628. ;
  629. ; Calculate values for loop constants. Need to have two loops to avoid
  630. ; 16-bit overflow with clock speeds above 9 MHz.
  631. ;
  632. OUTERVAL EQU    (CLKSPD    / 10) +    1
  633. ;
  634. INNERVAL EQU    (6667 /    OUTERVAL) * CLKSPD
  635. ;
  636. WAIT10:    LD    B,OUTERVAL
  637. ;
  638. WAIT11:    LD    DE,INNERVAL
  639. ;
  640. WAIT12:    BIT    0,(IX)        ; Time-wasters
  641.     BIT    0,(IX)
  642.     BIT    0,(IX)        ; 20 T-states each
  643.     BIT    0,(IX)
  644.     BIT    0,(IX)
  645.     BIT    0,(IX)
  646.     DEC    DE
  647.     LD    A,E
  648.     LD    A,D
  649.     OR    E
  650.     JR    NZ,WAIT12    ; 150 T-states per inner loop
  651.     DJNZ    WAIT11        ; Decrement outer loop
  652.     DEC    HL        ; Ok, decrement count in HL
  653.     LD    A,H
  654.     OR    L
  655.     JR    NZ,WAIT10
  656.     POP    IX        ; Done -- restore IX
  657.     POP    DE        ; DE
  658.     POP    BC        ; And BC
  659.     RET
  660. ;
  661. ; Wait milliseconds
  662. ;
  663. MSWAIT:    LD    HL,2
  664.     ADD    HL,SP
  665.     EX    DE,HL        ; Get delay size
  666.     CALL    GETPARM
  667. ;
  668. ; Wait milliseconds in HL
  669. ;
  670. WAITHLMS:
  671.     PUSH    DE
  672. ;
  673. W1MS0:    LD    DE,39 *    CLKSPD
  674. ;
  675. W1MS1:    DEC    DE
  676.     LD    A,D
  677.     OR    E
  678.     JR    NZ,W1MS1
  679.     DEC    HL
  680.     LD    A,H
  681.     OR    L
  682.     JR    NZ,W1MS0
  683.     POP    DE
  684.     RET
  685. ;
  686. ; Get next parameter from (DE) into HL
  687. ;
  688. GETPARM:EX    DE,HL        ; Get address into HL
  689.     LD    E,(HL)        ; Get low
  690.     INC    HL
  691.     LD    D,(HL)        ; Then hihi
  692.     INC    HL        ; Bump for next
  693.     EX    DE,HL        ; Result in HL, address still in DE
  694.     RET
  695. ;
  696. ;Get address of user-defined variables
  697. ;
  698. GETVARS:
  699.     LD    HL,USERVARS
  700.     RET
  701. USERVARS:
  702.     DW    OVERDRIVE    ; .OVR etc. drive/user
  703.     DW    OVERUSER
  704. ;
  705.      IF    ($ - CODEBGN) GT OVSIZE
  706. TOOBIG:    JP    ERRVAL        ; Overlay is too large
  707.      ENDIF
  708. ;
  709.     END
  710.