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 / I2B3-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  12KB  |  396 lines

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