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 / IMP / I2AV-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  15KB  |  507 lines

  1.  
  2. ; I2AV-1.ASM  -  Apple ][ overlay file for IMP  -  06/01/87
  3. ;
  4. ;         PCPI Z80 adapter with VERSAcard MC6850 ACIA
  5. ;
  6. ;                 VERSAcard
  7. ;
  8. ; To use SET with the Prometheus VERSAcard a small hardware change must
  9. ; be made, since the VERSAcard only supports baud rate selection via DIP
  10. ; switches.  This change will allow the VERSAcard to be switched between
  11. ; 300 and 1200 baud via software.  A wire should be attached from Pin
  12. ; #12 on U16 (IC marked 8126) on the VERSAcard into Annunciator #3 (Pin
  13. ; #12) on the Apple game port.    This will allow switch #4 on s2 of the
  14. ; VERSAcard to be toggled by setting or clearing annunciator #3. The de-
  15. ; fault baud rate is set at MSPEED Below either (300 or 1200).
  16. ;
  17. ; Note: This method could be extended to all other VERSAcard baud rates
  18. ;    and by using Annunciators 0,1,2 but 300 and 1200 are really
  19. ;    needed for a modem program. The DIP switches on the VERSAcard
  20. ;    should be set as follows:
  21. ;
  22. ; On switch bank #2:
  23. ;            S2 - ON
  24. ;            S3 - OFF
  25. ;            S4 - OFF
  26. ;            S5 - OFF
  27. ;
  28. ;
  29. ;     NOTE:    If you have trouble disonnecting from the
  30. ;        phone line, you may not have a normal DTR
  31. ;        setup to turn off the modem.  In that case,
  32. ;        set the NODTR: option at 011E to YES, to
  33. ;        provide ATH0 to disonnect.  (This assumes
  34. ;        you have a Hayes-compatible type modem with
  35. ;        "AT" command set.)
  36. ;
  37. ;
  38. ;     _________________
  39. ;    |          |
  40. ;    | 7 6 5 4 3 2 1 0 |   6850 ACIA for serial I/O
  41. ;    |_________________|
  42. ;
  43. ;      CR1 CR0     Function
  44. ;       0   0     1
  45. ;    *  0   1    16    (for 1200 bps)
  46. ;    +  1   0    64    (changes to 300 baud)
  47. ;       1   1    Master reset
  48. ;
  49. ;    CR4 CR3 CR2
  50. ;     0   0     0     7 bits, even parity, 2 stop bits
  51. ;     0   0     1     7 bits,    odd parity, 2 stop bits
  52. ;     0   1     0     7 bits, even parity, 1 stop bit
  53. ;     0   1     1     7 bits,    odd parity, 1 stop bit
  54. ;     1   0     0     8 bits,     no parity, 2 stop bits
  55. ;      * 1   0     1     8 bits,     no parity, 1 stop bit
  56. ;     1   1     0     8 bits, even parity, 1 stop bit
  57. ;     1   1     1     8 bits,    odd parity, 1 stop bit
  58. ;
  59. ;      CR6 CR5
  60. ;       0   0     RTS low,  Xmit interrupt disabled
  61. ;       0   1     RTS low,  Xmit interrupt enabled
  62. ;    *  1   0     RTS high, Xmit interrupt disabled
  63. ;       1   1     RTS low,  Xmit interrupt disabled, break sent
  64. ;
  65. ;        CR7
  66. ;         0         Interrupts disabled
  67. ;    *    1         Enables recieve buffer full, overrun, low-to-high
  68. ;               transition on the data carrier detect.
  69. ;
  70. ;                    - Notes by Irv Hoff W6FFC
  71. ;
  72. ;-----------------------------------------------------------------------
  73. ;
  74. ; You will want to look this file over carefully.  There are a number of
  75. ; options that you can use to configure the program to suit your taste.
  76. ;
  77. ; Edit this file for your preferences then follow the "TO USE:" example
  78. ; shown below.
  79. ;
  80. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  81. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  82. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  83. ; (The ESC will automatically be typed with no CTL-character present.)
  84. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  85. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  86. ; looking at the function key table, typing CTL-Z in command mode, etc.
  87. ;
  88. ; Use the "SET" command to change the baudrate when desired.  The value
  89. ; at MSPEED controls the baudrate when the program is first called up.
  90. ;
  91. ;    TO USE: First edit this file filling in answers for your own
  92. ;        equipment.  Then assemble with ASM.COM or equivalent
  93. ;        assembler.  Then use MLOAD to merge into the main file:
  94. ;
  95. ;        MLOAD IMP.COM=IMP.COM,I2AP-x.HEX
  96. ;
  97. ;                    - Notes by Irv Hoff W6FFC
  98. ;
  99. ; =   =  =   =     =   =     =   =     =   =     =   =     =   =     =   =     =   =
  100. ;
  101. ; 06/01/87  First version for IMP     - Irv Hoff
  102. ;
  103. ; =   =  =   =     =   =     =   =     =   =     =   =     =   =     =   =     =   =
  104. ;
  105. YES    EQU    0FFH
  106. NO    EQU    0
  107. ;
  108. ;====================== CUSTOMIZATION EQUATES ==========================
  109. ;
  110. SLOT    EQU    2        ; Slot of serial interface
  111. SLOTOFF    EQU    16*SLOT        ; Serial card slot offset
  112. ;
  113. ;
  114. ; CP/M adapter cards for Apple ][
  115. ;
  116. PCPI       EQU    YES        ; Yes if using PCPI Applicard CP/M card
  117. ;
  118. ;
  119. ; Serial I/O cards for Apple ][
  120. ;
  121. VERSA    EQU    YES        ; Yes for Prometheus VERSAcard
  122. ;
  123. ;
  124. ;-----------------------------------------------------------------------
  125. ;
  126. MAPOFF    EQU    0        ; No memory remapping for either
  127. ;
  128. ;-----------------------------------------------------------------------
  129. ;
  130. MDRCV    EQU    1        ; Bit to test for receive
  131. MDSND    EQU    2        ; Bit to test for send
  132. MDTXE    EQU    2        ; Modem send buffer empty
  133. ;
  134. ;-----------------------------------------------------------------------
  135. ;
  136. MDCTL1    EQU    0C08EH+SLOTOFF+MAPOFF ; Status port of VERSAcard
  137. MDDATP    EQU    0C08FH+SLOTOFF+MAPOFF ; Data port of VERSAcard
  138. ;
  139. ;-----------------------------------------------------------------------
  140. ;
  141. AN3CLR    EQU    0C05EH+MAPOFF    ; Clear annunciator #3
  142. AN3SET    EQU    0C05FH+MAPOFF    ; Set        "        #3
  143. ;
  144. ;-----------------------------------------------------------------------
  145. ;
  146. ; We have software control over the VERSAcard (if the hardware mod is
  147. ; made.)
  148. ;
  149. ;-----------------------------------------------------------------------
  150. ;
  151. ; General equates
  152. ;
  153. ESC    EQU    '['-40H        ; ^[ = Escape
  154. BELL    EQU    'G'-40H        ; ^G = Bell character
  155. LF    EQU    'J'-40H        ; ^J = Linefeed
  156. NEXTRY    EQU    'K'-40H        ; ^K = Try next phone number now
  157. CR    EQU    'M'-40H        ; ^M = Carriage return
  158. CLEARSC    EQU    'Z'-40H        ; ^Z = Clear screen, command mode only
  159. EOFCHAR    EQU    'Z'-40H        ; ^Z = End of file
  160. ;
  161. ;-----------------------------------------------------------------------
  162. ;
  163. ;
  164.     ORG    0100H
  165. ;
  166.     DS    3    ; Skip the data area below
  167. ;
  168. ;
  169. ; These routines and equates are at the beginning of the program so
  170. ; they can be patched by a monitor or overlay file without re-assembling
  171. ; the program.
  172. ;
  173. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  174.             ; 6=2400 7=4800 8=9600 9=19200 default
  175. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  176. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  177. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  178. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  179. RESVD1:     DB    NO    ; Reserved for special modems            108H
  180. RESVD2:     DB    NO    ; Reserved for special modems            109H
  181. ;
  182. CLEAR:     DB    '*'    ; Clear screen character (ESC not needed)    10AH
  183. ;
  184. CLOCK:     DB    6    ; Clock speed in MHz, 25.5 MHz max.        10BH
  185.             ; NOTE:  DO NOT MULTIPLY BY 10 FOR APPLICARD
  186.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  187. BYTDLY:     DB    9    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  188.             ;   default time to send character in ter-
  189.             ;   minal mode file transfer for slow BBS
  190. CRDLY:     DB    9    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  191.             ;   default time for extra wait after CRLF
  192.             ;   in terminal mode file transfer
  193. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  194. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  195. ;.....
  196. ;
  197. ;
  198. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  199.             ;   mode (normally added by remote echo)
  200. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  201. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  202. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  203. ;.....
  204. ;
  205. ;
  206. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  207. EXITCHR: DB    'E'    ; Exit character                115H
  208. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  209. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  210. LOGCHR:     DB    'L'    ; Send logon                    118H
  211. LSTCHR:     DB    'P'    ; Toggle printer                119H
  212. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  213. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  214. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  215. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  216. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  217. ;.....
  218. ;
  219. ;
  220. ; Handles in/out ports for data and status
  221. ;
  222. I$MDCTL1: JMP    RCVCTL1        ; In modem control port         11FH
  223.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  224. ;
  225. I$MDTXE:  JMP    RCVCTL1        ;                    129H
  226.       DB    0,0,0,0,0,0,0    ;                    12CH
  227. ;
  228. I$MDDATP: JMP    RCVDATP        ;in modem data port            133H
  229.       DB    0,0,0,0,0,0,0    ;                    146H
  230. ;
  231. O$MDDATP: JMP    SNDDATP        ; Out modem data port            13DH
  232.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  233. ;.....
  234. ;
  235. ;
  236. A$MDRCV:  ANI    MDRCV        ;                    147H
  237.       RET            ;                    149H
  238. ;
  239. C$MDRCV:  CPI    MDRCV        ;                    14AH
  240.       RET            ;                    14CH
  241. ;
  242. A$MDSND:  ANI    MDSND        ;                    14DH
  243.       RET            ;                    14FH
  244. ;
  245. C$MDSND:  CPI    MDSND        ;                    150H
  246.       RET            ;                    152H
  247. ;
  248. A$MDTXE:  ANI    MDTXE        ;                    153H
  249.       RET            ;                    155H
  250. ;
  251. C$MDTXE:  CPI    MDTXE        ;                    156H
  252.       RET            ;                    158H
  253. ;.....
  254. ;
  255. ;
  256. ; Special exit vector, used by some computers to reset interrupt vectors
  257. ;
  258. J$EXITVEC:RET            ;                    159H
  259.       DB    0,0        ;                    15AH
  260. ;.....
  261. ;
  262. ;
  263. ; Jump vectors needed by each overlay
  264. ;
  265. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  266. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  267. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  268. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  269. ;.....
  270. ;
  271. ;
  272. ; "AT" command strings, can be replaced in individual overlay if needed
  273. ;
  274. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  275. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  276. ;
  277. ;
  278. ; Next fourteen lines should not be changed by user overlay as these go
  279. ; to specific locations in the main program, not in the overlay.
  280. ;
  281. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  282. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  283. J$DIAL:      DS    3        ; Start of dialing routine        174H
  284. J$DSCONT: DS    3        ; Terminates modem use            177H
  285. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  286. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  287. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  288. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  289. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  290. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  291. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  292. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  293. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  294. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  295. J$NEW2:      DB    0,0,0        ; For future needs            198H
  296. ;.....
  297. ;
  298. ;
  299. ; For 2400 bps auto-stepdown units
  300. ;
  301. MANUAL:      DB    0        ; For manual selection flag        19BH
  302. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  303. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  304. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  305. ;.....
  306. ;
  307. ;
  308. LOGPTR:    DW    LOGON        ; Pointer to display LOGON message    1A5H
  309. ;
  310. SYSVR:    CALL    J$ILPRT        ; Display the following line        1A7H
  311.     DB    'Apple ][ with '
  312.     DB    'PCPI Applicard'
  313.     DB    CR,LF,'  and '
  314.     DB    'VERSAcard'
  315.     DB    ' in slot ',SLOT+30H,CR,LF,0
  316.     RET
  317. ;.....
  318. ;
  319. ;
  320. ;-----------------------------------------------------------------------
  321. ;
  322. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  323. ;     end of your last routine should terminate by 0400H (601 bytes
  324. ;     available after start of SYSVER).
  325. ;
  326. ;-----------------------------------------------------------------------
  327. ;
  328. ; You can put in a message at this location which can be called up with
  329. ; (special character-L).  You can put in several lines.  End with a 0.
  330. ;
  331. LOGON:    DB    'Hello from a happy computer user',CR,0
  332. ;
  333. ;-----------------------------------------------------------------------
  334. ;
  335. ; This routine sends a break tone for 300 ms
  336. ;
  337. SENDBRK:
  338.     CALL    RCVCTL1        ; Get the current status and speed
  339.     STA    SBTEMP        ; Store it for now
  340.     MVI    A,0F5H        ; Set for a break
  341.     JMP    GOODBYE1    ; Go send it
  342. ;.....
  343. ;
  344. ;
  345. SBTEMP:    DB    0        ; Temporary storage to remember speed
  346. ;.....
  347. ;
  348. ;
  349. ; This routine sets DTR low for 300 ms to disconnect the phone
  350. ;
  351. ;
  352. GOODBYE:
  353.     CALL    RCVCTL1        ; Get the current status and speed
  354.     STA    SBTEMP        ; Store it for now
  355.     MVI    A,0D5H        ; Turn off DTR
  356. ;
  357. GOODBYE1:
  358.     CALL    SNDCTL1        ; Send to the Modem
  359.     MVI    B,3        ; Delay 300 ms to hang up phone
  360.     CALL    J$TIMER
  361.     LDA    SBTEMP        ; Get original status and speed back
  362.     CALL    SNDCTL1
  363.     MVI    A,0B5H        ; Turn everything back on
  364.     CALL    SNDCTL1
  365.     XTHL            ; Short delay to complete command
  366.     XTHL
  367.     RET
  368. ;.....
  369. ;
  370. ;
  371. ;=========================== INITMOD ===================================
  372. ;
  373. ;
  374. INITMOD    EQU    $
  375. ;
  376. INITMOD1:
  377.     LDA    MSPEED        ; Set annunciators to known state
  378.     CPI    1        ; Is it 300 ?
  379.     JZ    OK300
  380.     CPI    5        ; Is it 1200 ?
  381.     JZ    OK1200
  382.     RET
  383. ;.....
  384. ;
  385. ;
  386. ; The following routine initializes the VERSAcard to the default baud
  387. ; rate which is set at MSPEED above.  If MSPEED is set to something
  388. ; other than 300 or 1200 this routine does not alter the annunciator
  389. ; settings.
  390. ;
  391. ;
  392. ;========================== APPLE I/O ==================================
  393. ;
  394. RDBYTE     EQU    0FFE0H        ; Read 1 byte from Apple (A = byte)
  395. WRBYTE     EQU    0FFE3H        ; Write 1 byte to Apple (C = byte)
  396. RDWORD     EQU    0FFE6H        ; Read 2 bytes from Apple (DE = word)
  397. WRWORD     EQU    0FFE9H        ; Write 2 bytes to Apple (DE = word)
  398. PEEK1     EQU    6        ; Command
  399. POKE1     EQU    7        ; Command
  400. ;
  401. SNDCTL1: PUSH    D
  402.      LXI    D,MDCTL1
  403.      JMP    POKE
  404. ;
  405. SNDDATP: PUSH    D
  406.      LXI    D,MDDATP
  407. ;
  408. POKE:     PUSH    B
  409.      MOV    B,A
  410.      MVI    C,POKE1
  411.      CALL    WRBYTE
  412.      CALL    WRWORD
  413.      MOV    C,B
  414.      CALL    WRBYTE
  415.      POP    B
  416.      POP    D
  417.      RET
  418. ;...
  419. ;
  420. ;
  421. RCVCTL1: PUSH    D
  422.      LXI    D,MDCTL1
  423.      JMP    PEEK
  424. ;
  425. RCVDATP: PUSH    D
  426.      LXI    D,MDDATP
  427. ;
  428. PEEK:     PUSH    B
  429.      MVI    C,PEEK1
  430.      CALL    WRBYTE
  431.      CALL    WRWORD
  432.      CALL    RDBYTE
  433.      POP    B
  434.      POP    D
  435.      RET
  436. ;.....
  437. ;
  438. ;
  439. RCVAN3C: PUSH    D
  440.      LXI    H,AN3CLR
  441.      JMP    PEEK
  442. ;
  443. RCVAN3S: PUSH    D
  444.      LXI    H,AN3SET
  445.      JMP    PEEK
  446. ;.....
  447. ;
  448. ;
  449. ;-----------------------------------------------------------------------
  450. ;
  451. ; Use the 'SET' command to select a desired baud rate
  452. ;
  453. STUPR    EQU    $
  454. ;
  455.     CALL    J$CMDSPL    ; Gives us CMDBUF+6
  456.     JNC    STUPR2
  457. ;
  458. STUPR1:    CALL    J$ILPRT
  459.     DB    'Input Baud Rate (300, 1200, 2400, 9600): ',0
  460.     LXI    D,BAUDBUF    ; Point to new input buffer
  461.     CALL    J$INBUF
  462.     CALL    J$CRLF
  463.     LXI    D,BAUDBUF+2
  464. ;
  465. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  466.     DB    '300',0
  467.     JNC    OK300        ; Go if got match
  468.     CALL    J$INLNCP
  469.     DB    '1200',0
  470.     JNC    OK1200
  471.     CALL    J$INLNCP
  472.     DB    '2400',0
  473.     JNC    OK2400
  474.     CALL    J$INLNCP
  475.     DB    '9600',0
  476.     JNC    OK9600
  477.     CALL    J$ILPRT        ; All matches failed, tell operator
  478.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  479.     JMP    STUPR1        ; Try again
  480. ;
  481. OK300:    CALL    RCVAN3C        ; Clear Annunciator #3 for 300 baud
  482.     MVI    A,1        ; Set MSPEED for 300 baud
  483.     STA    MSPEED        ; For 300 baud
  484.     RET
  485. ;
  486. OK1200:    CALL    RCVAN3S        ; Set Annunciator #3 for 1200 baud
  487.     MVI    A,5        ; Set MSPEED for 1200 bps
  488.     STA    MSPEED        ; For 1200 baud
  489.     RET
  490. ;
  491. OK2400:    JMP    OK1200        ; Does not support 2400 bps
  492. ;
  493. OK9600:    JMP    OK1200        ; Does not support 9600 bps
  494. ;.....
  495. ;
  496. ;
  497. BAUDBUF:DB    10,0,0,0,0,0
  498.     DB    0,0,0,0,0,0
  499. ;
  500. ;.....
  501. ;
  502. ;
  503. ;-----------------------------------------------------------------------
  504. ; NOTE: Must terminate prior to 0400H
  505. ;
  506.     END
  507.