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 / I2BW-3.AZM / I2BW-3.ASM
Assembly Source File  |  2000-06-30  |  12KB  |  417 lines

  1.  
  2. ;I2BW-3.ASM - Bondwell computer overlay file for IMP2 - 06/01/87
  3. ;
  4. ;        Z80 SIO and 8253 baudrate generator
  5. ;
  6. ; This overlay adapts the IMP modem program to the Bondwell 12/14 com-
  7. ; computer with the Z80 SIO serial port "A" or serial port "B" depending
  8. ; (depending on the PORTA EQUate) and the 8253 baudrate generator.  Di-
  9. ; rect any questions or suggestions to Gary Inman, Sysop WLA RCP/M (213)
  10. ; 838-9229.
  11. ;
  12. ; Edit this file for your preferences then follow the "TO USE:" example
  13. ; shown below.
  14. ;
  15. ; Use the "SET" command to change the baudrate when desired.  The value
  16. ; at MSPEED controls the baudrate when the program is first called up.
  17. ;
  18. ;    TO USE: First edit this file filling in answers for your own
  19. ;        equipment.  Then assemble with ASM.COM or equivalent
  20. ;        assembler.  Then use MLOAD to merge into the main file:
  21. ;
  22. ;        MLOAD IMP.COM=IMP.COM,I2BW-2.HEX
  23. ;
  24. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  25. ;
  26. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  27. ;        IMP245 to use it.            - Irv Hoff
  28. ;
  29. ; 01/16/86  Set equates for 2400 bps        - Gary Inman
  30. ; 01/14/86  Adapted I2EP-1.ASM for Bondwell Computers
  31. ;                        - Gary Inman
  32. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  33. ;
  34. ;
  35. YES    EQU    0FFH
  36. NO    EQU    0
  37. ;
  38. ;
  39. ; The Bondwell has 2 serial ports. Use the next equate to select the
  40. ; port to use for communications.
  41. ;
  42. PORTA    EQU    NO    ; yes - serial port A
  43.             ; no  - serial port B
  44. ;
  45.      IF    PORTA
  46. PORT    EQU    40H    ; Your base data port
  47. BRPORT    EQU    60H
  48.      ENDIF
  49. ;
  50.      IF    NOT PORTA
  51. PORT    EQU    42H
  52. BRPORT    EQU    61H
  53.      ENDIF
  54. ;
  55. MDCTL1    EQU    PORT+1    ; Modem control port
  56. MDDATP    EQU    PORT    ; Modem data port
  57. MDRCV    EQU    01H    ; Modem receive ready
  58. MDSND    EQU    04H    ; Modem send ready bit
  59. MDTXE    EQU    01H    ; Modem send buffer empty, holding buffer empty
  60. ;
  61. CTPORT    EQU    63H    ; Control port
  62. ;
  63. ;
  64. ;-----------------------------------------------------------------------
  65. ;
  66. ESC    EQU    '['-40H    ; ^[ = Escape
  67. BELL    EQU    'G'-40H    ; ^G = Bell character
  68. LF    EQU    'J'-40H    ; ^J = Linefeed
  69. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  70. CR    EQU    'M'-40H    ; ^M = Carriage return
  71. CLEARSC    EQU    'Z'-40H    ; ^Z = Clear screen, command mode only
  72. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  73. ;
  74. ;
  75. ;-----------------------------------------------------------------------
  76. ;
  77. ;
  78.     ORG    0100H
  79. ;
  80. ;
  81.     DS    3    ; Skip the data area below
  82. ;
  83. ;
  84. ; These routines and equates are at the beginning of the program so
  85. ; they can be patched by a monitor or overlay file without re-assembling
  86. ; the program.
  87. ;
  88. MSPEED:     DB    6    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  89.             ; 6=2400 7=4800 8=9600 9=19200 default
  90. HS2400:     DB    YES    ; Yes=2400 bps highest speed            104H
  91. HS1200:     DB    NO    ; Yes=1200 bps highest speed            105H
  92. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  93. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  94. RESVD1:     DB    NO    ; Reserved for special modems            108H
  95. RESVD2:     DB    NO    ; Reserved for special modems            109H
  96. ;
  97. ;
  98. CLEAR:     DB    'Z'-40H    ; Clear screen character (ESC not needed)    10AH
  99. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  100.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  101. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  102.             ;   default time to send character in ter-
  103.             ;   minal mode file transfer for slow BBS
  104. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  105.             ;   default time for extra wait after CRLF
  106.             ;   in terminal mode file transfer
  107. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  108. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  109. ;.....
  110. ;
  111. ;
  112. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  113.             ;   mode (normally added by remote echo)
  114. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  115. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  116. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  117. ;.....
  118. ;
  119. ;
  120. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  121. EXITCHR: DB    'E'    ; Exit character                115H
  122. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  123. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  124. LOGCHR:     DB    'L'    ; Send logon                    118H
  125. LSTCHR:     DB    'P'    ; Toggle printer                119H
  126. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  127. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  128. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  129. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  130. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  131. ;.....
  132. ;
  133. ;
  134. ; Handles in/out ports for data and status
  135. ;
  136. I$MDCTL1: MVI    A,10H        ; Register 0, reset interrupts        11FH
  137.       OUT    MDCTL1        ;                    121H
  138.       IN    MDCTL1        ;                    123H
  139.       RET            ; IN modem control port         125H
  140.       DB    0,0,0        ; Spares if needed            126H
  141. ;
  142. I$MDTXE:  MVI    A,11H        ; Select read register 1        129H
  143.       OUT    MDCTL1        ;                    12BH
  144.       IN    MDCTL1        ;                    12DH
  145.       RET            ;                    12FH
  146.       DB    0,0,0        ;                    130H
  147. ;
  148. I$MDDATP: MVI    A,37H        ;                    133H
  149.       OUT    MDCTL1        ;                    135H
  150.       IN    MDDATP        ;                    137H
  151.       RET            ;                    139H
  152.       DB    0,0,0        ; Spares if needed            13AH
  153. ;
  154. O$MDDATP: OUT    MDDATP        ;                    13DH
  155.       RET            ; OUT modem data port            13FH
  156.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  157. ;.....
  158.  
  159. ;
  160. A$MDRCV:  ANI    MDRCV        ;                    147H
  161.       RET            ;                    149H
  162. ;
  163. C$MDRCV:  CPI    MDRCV        ;                    14AH
  164.       RET            ;                    14CH
  165. ;
  166. A$MDSND:  ANI    MDSND        ;                    14DH
  167.       RET            ;                    14FH
  168. ;
  169. C$MDSND:  CPI    MDSND        ;                    150H
  170.       RET            ;                    152H
  171. ;
  172. A$MDTXE:  ANI    MDTXE        ;                    153H
  173.       RET            ;                    155H
  174. ;
  175. C$MDTXE:  CPI    MDTXE        ;                    156H
  176.       RET            ;                    158H
  177. ;.....
  178. ;
  179. ;
  180. ; Special exit vector, used by some computers to reset interrupt vectors
  181. ;
  182. J$EXITVEC:RET            ;                    159H
  183.       DB    0,0        ;                    15AH
  184. ;.....
  185. ;
  186. ;
  187. ; Jump vectors needed by each overlay
  188. ;
  189. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  190. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  191. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  192. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  193. ;.....
  194. ;
  195. ;
  196. ; "AT" command strings, can be replaced in individual overlay if needed
  197. ;
  198. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  199. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  200. ;
  201. ;
  202. ; Next fourteen lines should not be changed by user overlay as these go
  203. ; to specific locations in the main program, not in the overlay.
  204. ;
  205. ;
  206. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  207. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  208. J$DIAL:      DS    3        ; Start of dialing routine        174H
  209. J$DSCONT: DS    3        ; Terminates modem use            177H
  210. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  211. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  212. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  213. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  214. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  215. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  216. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  217. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  218. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  219. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  220. J$NEW2:      DB    0,0,0        ; For future needs            198H
  221. ;.....
  222. ;
  223. ;
  224. ; For 2400 bps auto-stepdown units
  225. ;
  226. MANUAL:      DB    0        ; For manual selection flag        19BH
  227. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  228. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  229. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  230. ;.....
  231. ;
  232. ;
  233. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  234. ;
  235. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  236.       DB    'Bondwell 12/14 - Serial Port '
  237. ;
  238.      IF    PORTA
  239.       DB    'A'
  240.      ENDIF
  241. ;
  242.      IF    NOT PORTA
  243.       DB    'B'
  244.      ENDIF
  245. ;
  246.       DB    CR,LF,0
  247.       RET
  248. ;.....
  249. ;
  250. ;
  251. ;-----------------------------------------------------------------------
  252. ;
  253. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  254. ;     end of your last routine should terminate by 0400H (601 bytes
  255. ;     available after start of SYSVER).
  256. ;
  257. ;-----------------------------------------------------------------------
  258. ;
  259. ; You can put in a message at this location which can be called up with
  260. ; (special character-L).  You can put in several lines.  End with a 0.
  261. ;
  262. LOGON:    DB    'This is a Bondwell Portable Computer',CR,LF,0
  263. ;
  264. ;-----------------------------------------------------------------------
  265. ;
  266. ; This routine sets a 300 ms break tone
  267. ;
  268. SENDBRK:
  269.     MVI    A,5
  270.     OUT    MDCTL1        ; Send to the status port
  271.     MVI    A,0F8H        ; DTR normal, send break tone
  272.     JMP    GOODBYE1    ; Go send the break tone
  273. ;.....
  274. ;
  275. ;
  276. ; This routine sets DTR low for 300 ms to disconnect the modem.
  277. ;
  278. GOODBYE:
  279.     MVI    A,5
  280.     OUT    MDCTL1        ; Send to the status port
  281.     MVI    A,78H        ; Turn off DTR and send break tone
  282. ;
  283. GOODBYE1:
  284.     OUT    MDCTL1
  285.     MVI    B,3        ; Delay 300 ms
  286.     CALL    J$TIMER
  287.     MVI    A,5
  288.     OUT    MDCTL1
  289.     MVI    A,0E8H        ; Restore normal, 8 bits, DTR on, etc.
  290.     OUT    MDCTL1
  291.     RET
  292. ;.....
  293. ;
  294. ;
  295. ; Initialize Z80 SIO A port
  296. ;
  297. INITMOD:
  298.     MVI    A,0        ; Select register
  299.     OUT    MDCTL1        ; Send to the status port
  300.     MVI    A,18H        ; Reset the Z8SIO chip
  301.     OUT    MDCTL1        ; Send to the status port
  302.     MVI    A,4        ; Select register
  303.     OUT    MDCTL1        ; Send to the status port
  304.     MVI    A,44H        ;*32x, 2-stop, no parity  (84=1, 8C=2)
  305.     OUT    MDCTL1        ; Send to the status port
  306.     MVI    A,3        ; Select register
  307.     OUT    MDCTL1        ; Send to the status port
  308.     MVI    A,0C1H        ; Enable receive section
  309.     OUT    MDCTL1        ; Send to the status port
  310.     MVI    A,5        ; Select register
  311.     OUT    MDCTL1        ; Send to the status port
  312.     MVI    A,0EAH        ; DTR, RTS, 8-bits, enable send section
  313.     OUT    MDCTL1        ; Send to the status port
  314. ;
  315.     LDA    MSPEED        ; Get the selected value
  316.     CPI    1        ; 300 bps
  317.     JZ    OK300
  318.     CPI    5        ; 1200 bps
  319.     JZ    OK1200
  320.     CPI    6        ; 2400 bps
  321.     JZ    OK2400
  322.     CPI    8        ; 9600 bps
  323.     JZ    OK9600
  324.     CPI    9        ; 19200 bps
  325.     JZ    OK19200
  326.     JMP    STUPR1        ; Else ask what is wanted
  327. ;.....
  328. ;
  329. ;
  330. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  331.     JNC    STUPR2
  332. ;
  333. STUPR1:    CALL    J$ILPRT
  334.     DB    'Input Baud Rate (300, 1200, 2400, 9600, 19200): ',0
  335.     LXI    D,BAUDBUF    ; Point to new input buffer
  336.     CALL    J$INBUF
  337.     CALL    J$CRLF
  338.     LXI    D,BAUDBUF+2
  339. ;
  340. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  341.     DB    '300',0
  342.     JNC    OK300        ; Go if got match
  343.     CALL    J$INLNCP
  344.     DB    '1200',0
  345.     JNC    OK1200
  346.     CALL    J$INLNCP
  347.     DB    '2400',0
  348.     JNC    OK2400
  349.     CALL    J$INLNCP
  350.     DB    '9600',0
  351.     JNC    OK9600
  352.     CALL    J$INLNCP
  353.     DB    '19200',0
  354.     JNC    OK19200
  355.     CALL    J$ILPRT        ; All matches failed, tell operator
  356.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  357.     JMP    STUPR1        ; Try again
  358. ;
  359. OK300:    MVI    A,1        ; MSPEED 300 baud value
  360.     LXI    H,BD300        ; Get 300 bps parameters in 'HL'
  361.     JMP    LOADBD        ; Go load them
  362. ;
  363. OK1200:    MVI    A,5
  364.     LXI    H,BD1200
  365.     JMP    LOADBD
  366. ;
  367. OK2400:    XRA    A
  368.     STA    MANUAL        ; Reset to maximum auto-speed
  369.     MVI    A,6
  370.     LXI    H,BD2400
  371.     JMP    LOADBD
  372. ;
  373. OK9600:    MVI    A,8
  374.     LXI    H,BD9600
  375.     JMP    LOADBD
  376. ;
  377. OK19200:MVI    A,9
  378.     LXI    H,BD19200
  379. ;
  380. LOADBD:    STA    MSPEED        ; Change time-to-send to match baud rate
  381. ;
  382.      IF    PORTA
  383.     MVI    A,076H        ; Set up square wave response, etc
  384.      ENDIF
  385. ;
  386.      IF    NOT PORTA
  387.     MVI    A,036H
  388.      ENDIF
  389. ;
  390.     OUT    CTPORT        ; Send to CTC timer
  391.     MOV    A,L        ; MSB of baudrate
  392.     OUT    BRPORT
  393.     MOV    A,H        ; LSB baudrate
  394.     OUT    BRPORT
  395.     RET
  396. ;.....
  397. ;
  398. ;
  399. ; TABLE OF BAUD RATE PARAMETERS
  400. ;
  401. BD300    EQU    0180H        ;   300 bps
  402. BD1200    EQU    0060H        ;  1200 bps
  403. BD2400    EQU    0030H        ;  2400 bps
  404. BD4800    EQU    0018H        ;  4800 bps
  405. BD9600    EQU    000CH        ;  9600 bps
  406. BD19200    EQU    0006H        ; 19200 bps
  407. ;
  408. BAUDBUF:DB    10,0,0,0,0,0
  409.     DB    0,0,0,0,0,0
  410. ;
  411. ;                   end
  412. ;-----------------------------------------------------------------------
  413. ;
  414. ; NOTE: Must terminate prior to 0400H
  415. ;
  416.     END
  417.