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 / I2OA-2.AZM / I2OA-2.ASM
Assembly Source File  |  2000-06-30  |  12KB  |  437 lines

  1.  
  2. ; I2OA-1.ASM - Otrona Attache overlay file for IMP - 06/01/87
  3. ;
  4. ;               Z80 SIO
  5. ;
  6. ; You will want to look this file over carefully. There are a number of
  7. ; options that you can use to configure the program to suit your taste.
  8. ; This file adapts Otrona Attache computers to IMP.COM.
  9. ;
  10. ; Edit this file for your preferences then follow the "TO USE:" example
  11. ; shown below.
  12. ;
  13. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  14. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  15. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  16. ; (The ESC will automatically be typed with no CTL-character present.)
  17. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  18. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  19. ; looking at the function key table, typing CTL-Z in command mode, etc.
  20. ;
  21. ; Use the "SET" command to change the baudrate when desired.  The value
  22. ; at MSPEED controls the baudrate when the program is first called up.
  23. ;
  24. ;    TO USE: First edit this file filling in answers for your own
  25. ;        equipment.  Then assemble with ASM.COM or equivalent
  26. ;        assembler.  Then use MLOAD to merge into the main file:
  27. ;
  28. ;        MLOAD IMP.COM=IMP.COM,I2KP-x.HEX
  29. ;
  30. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  31. ;
  32. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  33. ;        IMP245 to use it.        - Irv Hoff
  34. ;
  35. ; 10/15/85 - Written to work with IMP - used parts from M7OA-x verions.
  36. ;                    - Irv Hoff
  37. ;
  38. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  39. ;
  40. ;
  41. YES    EQU    0FFH
  42. NO    EQU    0
  43. ;
  44. ;
  45. PORT    EQU    0F0H    ; Your base port (data or status)
  46. MDCTL1    EQU    PORT+1    ; Modem control port
  47. MDDATP    EQU    PORT    ; Modem data port
  48. MDRCV    EQU    01H    ; Modem receive ready
  49. MDSND    EQU    04H    ; Modem send ready bit
  50. MDTXE    EQU    01H    ; Modem send buffer empty, holding buffer empty
  51. ;
  52. ;
  53. ;-----------------------------------------------------------------------
  54. ;
  55. BDOS    EQU    0005H
  56. ESC    EQU    '['-40H    ; ^[ = Escape
  57. BELL    EQU    'G'-40H    ; ^G = Bell character
  58. LF    EQU    'J'-40H    ; ^J = Linefeed
  59. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  60. CR    EQU    'M'-40H    ; ^M = Carriage return
  61. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  62. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  63. ;
  64. ;
  65. ;-----------------------------------------------------------------------
  66. ;
  67. ;
  68.     ORG    0100H
  69. ;
  70. ;
  71.     DS    3    ; Skip the data area below
  72. ;
  73. ;
  74. ; These routines and equates are at the beginning of the program so
  75. ; they can be patched by a monitor or overlay file without re-assembling
  76. ; the program.
  77. ;
  78. MSPEED:     DB    6    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  79.             ; 6=2400 7=4800 8=9600 9=19200 default
  80. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  81. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  82. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  83. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  84. RESVD1:     DB    NO    ; Reserved for special modems            108H
  85. RESVD2:     DB    NO    ; Reserved for special modems            109H
  86. ;
  87. ;
  88. CLEAR:     DB    'K'    ; Clear screen character (ESC not needed)    10AH
  89. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  90.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  91. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  92.             ;   default time to send character in ter-
  93.             ;   minal mode file transfer for slow BBS
  94. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  95.             ;   default time for extra wait after CRLF
  96.             ;   in terminal mode file transfer
  97. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  98. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  99. ;.....
  100. ;
  101. ;
  102. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  103.             ;   mode (normally added by remote echo)
  104. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  105. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  106. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  107. ;.....
  108. ;
  109. ;
  110. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  111. EXITCHR: DB    'E'    ; Exit character                115H
  112. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  113. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  114. LOGCHR:     DB    'L'    ; Send logon                    118H
  115. LSTCHR:     DB    'P'    ; Toggle printer                119H
  116. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  117. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  118. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  119. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  120. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  121. ;.....
  122. ;
  123. ;
  124. ; Handles in/out ports for data and status
  125. ;
  126. I$MDCTL1: MVI    A,10H        ; Register 0, reset interrupts        11FH
  127.       OUT    MDCTL1        ;                    121H
  128.       IN    MDCTL1        ; Get the status            123H
  129.       RET            ;                    125H
  130.       DB    0,0,0        ; Spares if needed            126H
  131. ;
  132. I$MDTXE:  MVI    A,11H        ; For read register 1            129H
  133.       OUT    MDCTL1        ;                    12BH
  134.       IN    MDCTL1        ; Get status of read register 1     12DH
  135.       RET            ;                    12FH
  136.       DB    0,0,0        ;                    130H
  137. ;
  138. I$MDDATP: IN    MDDATP        ;                    133H
  139.       RET            ;                    135H
  140.       DB    0,0,0,0,0,0,0    ; Spares if needed            136H
  141. ;
  142. O$MDDATP: OUT    MDDATP        ;                    13DH
  143.       RET            ; OUT modem data port            13FH
  144.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  145. ;.....
  146. ;
  147. ;
  148. A$MDRCV:  ANI    MDRCV        ;                    147H
  149.       RET            ;                    149H
  150. ;
  151. C$MDRCV:  CPI    MDRCV        ;                    14AH
  152.       RET            ;                    14CH
  153. ;
  154. A$MDSND:  ANI    MDSND        ;                    14DH
  155.       RET            ;                    14FH
  156. ;
  157. C$MDSND:  CPI    MDSND        ;                    150H
  158.       RET            ;                    152H
  159. ;
  160. A$MDTXE:  ANI    MDTXE        ;                    153H
  161.       RET            ;                    155H
  162. ;
  163. C$MDTXE:  CPI    MDTXE        ;                    156H
  164.       RET            ;                    158H
  165. ;.....
  166. ;
  167. ;
  168. ; Special exit vector, used by some computers to reset interrupt vectors
  169. ;
  170. J$EXITVEC:RET            ;                    159H
  171.       DB    0,0        ;                    15AH
  172. ;.....
  173. ;
  174. ;
  175. ; Jump vectors needed by each overlay
  176. ;
  177. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  178. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  179. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  180. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  181. ;.....
  182. ;
  183. ;
  184. ; "AT" command strings, can be replaced in individual overlay if needed
  185. ;
  186. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  187. J$STRNG1: DS    3        ; 2400 bps "AT" string            16B:IMP
  188. ;
  189. ;
  190. ; Next fourteen lines should not be changed by user overlay as these go
  191. ; to specific locations in the main program, not in the overlay.
  192. ;
  193. ;
  194. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  195. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  196. J$DIAL:      DS    3        ; Start of dialing routine        174H
  197. J$DSCONT: DS    3        ; Terminates modem use            177H
  198. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  199. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  200. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  201. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  202. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  203. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  204. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  205. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  206. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  207. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  208. J$NEW2:      DB    0,0,0        ; For future needs            198H
  209. ;.....
  210. ;
  211. ;
  212. ; For 2400 bps auto-stepdown units
  213. ;
  214. MANUAL:      DB    0        ; For manual selection flag        19BH
  215. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  216. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  217. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  218. ;.....
  219. ;
  220. ;
  221. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  222. ;
  223. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  224.       DB    'Version for Otrona Attache computers' ;        1AAH
  225.       DB    CR,LF,0
  226.       RET
  227. ;.....
  228. ;
  229. ;
  230. ;-----------------------------------------------------------------------
  231. ;
  232. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  233. ;     end of your last routine should terminate by 0400H (601 bytes
  234. ;     available after start of SYSVER).
  235. ;
  236. ;-----------------------------------------------------------------------
  237. ;
  238. ; You can put in a message at this location which can be called up with
  239. ; (special character-L).  You can put in several lines.  End with a 0.
  240. ;
  241. LOGON:    DB    'This is an Otrona Attache computer',CR,LF,0
  242. ;
  243. ;-----------------------------------------------------------------------
  244. ;
  245. ; This routine sets a 300 ms break tone
  246. ;
  247. SENDBRK:
  248.     MVI    A,5
  249.     OUT    MDCTL1        ; Send to the status port
  250.     MVI    A,0F8H        ; DTR normal, send break tone
  251.     JMP    GOODBYE1    ; Go send the break tone
  252. ;.....
  253. ;
  254. ;
  255. ; This routine sets DTR low for 300 ms to disconnect the modem.
  256. ;
  257. GOODBYE:
  258.     MVI    A,5
  259.     OUT    MDCTL1        ; Send to the status port
  260.     MVI    A,78H        ; Turn off DTR and send break tone
  261. ;
  262. GOODBYE1:
  263.     OUT    MDCTL1
  264.     MVI    B,3        ; Delay 300 ms
  265.     CALL    J$TIMER
  266.     MVI    A,5
  267.     OUT    MDCTL1
  268.     MVI    A,0E8H        ; Restore normal, 8 bits, DTR on, etc.
  269.     OUT    MDCTL1
  270.     RET
  271. ;.....
  272. ;
  273. ;
  274. ; BIOS patch to correct a problem with the LISTST routine for versions
  275. ; 2.2.3 and 2.2.4, not required by 2.2.5.
  276. ;
  277. INITMOD:
  278.     LHLD    00000H+1    ; Get BIOS warm boot vector
  279.     LXI    D,02AH+1    ; Offset to listst
  280.     DAD    D        ; Add offset to vector
  281.     SHLD    INITMOD1    ; Self-modifying code
  282. ;
  283. INITMOD1:
  284.     LHLD    0D000H        ; 'HL' now has pointer to LISTST
  285.     XCHG            ; Move it to 'DE'
  286.     LXI    B,NEWCODE    ; Point to new code with 'BC'
  287. ;
  288. INITMOD2:
  289.     LDAX    B        ; Get next byte of new code
  290.     ORA    A        ; Done?
  291.     JZ    INITMOD3    ; Yes, go finish init...
  292.     STAX    D        ; No, so put in the byte
  293.     INX    B        ; Update the pointers
  294.     INX    D
  295.     JMP    INITMOD2    ; And go do next byte
  296. ;
  297. INITMOD3:
  298.     LDA    MSPEED        ; Get the selected value
  299.     CPI    1        ; 300 bps
  300.     JZ    OK300
  301.     CPI    5        ; 1200 bps
  302.     JZ    OK1200
  303.     CPI    6        ; 2400 bps
  304.     JZ    OK2400
  305.     CPI    8        ; 9600 bps
  306.     JZ    OK9600
  307.     CPI    9
  308.     JZ    OK19200
  309.     JMP    STUPR1        ; Else ask what is wanted
  310. ;.....
  311. ;
  312. ;
  313. ; New code for LISTST
  314. ;
  315. NEWCODE:MVI    A,010H
  316.     OUT    0F3H
  317.     IN    0F3H
  318.     ORI    0DBH        ; Turn on all bits except cts & txre
  319.     CPI    0FFH        ; Check for both cts & txre true
  320.     RZ            ; If so, printer ready, return a=0ffh
  321.     XRA    A        ; Else not ready so return with a=0
  322.     RET
  323. ;
  324.     DB    0        ; Sentinel for end of patch
  325. ;
  326. ;
  327. ; Sets the modem speed via the SET command.
  328. ;
  329. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  330.     JNC    STUPR2
  331. ;
  332. STUPR1:    CALL    J$ILPRT
  333.     DB    'Input Baud Rate (300, 1200, 2400, 9600, 19200): ',0
  334.     LXI    D,BAUDBUF    ; Point to new input buffer
  335.     CALL    J$INBUF
  336.     CALL    J$CRLF
  337.     LXI    D,BAUDBUF+2
  338. ;
  339. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  340.     DB    '300',0
  341.     JNC    OK300        ; Go if got match
  342.     CALL    J$INLNCP
  343.     DB    '1200',0
  344.     JNC    OK1200
  345.     CALL    J$INLNCP
  346.     DB    '2400',0
  347.     JNC    OK2400
  348.     CALL    J$INLNCP
  349.     DB    '9600',0
  350.     JNC    OK9600
  351.     CALL    J$INLNCP
  352.     DB    '19200',0
  353.     JNC    OK19200
  354.     CALL    J$ILPRT        ; All matches failed, tell operator
  355.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  356.     JMP    STUPR1        ; Try again
  357. ;
  358. OK300:    MVI    A,1        ; Mspeed 300 baud value
  359.     MVI    B,BD300
  360.     JMP    SETBDEXIT
  361. ;
  362. OK1200:    MVI    A,5
  363.     MVI    B,BD1200
  364.     JMP    SETBDEXIT
  365. ;
  366. OK2400:    XRA    A
  367.     STA    MANUAL        ; Reset to maximum auto-speed
  368.     MVI    A,6
  369.     MVI    B,BD2400
  370.     JMP    SETBDEXIT
  371. ;
  372. OK9600:    MVI    A,8
  373.     MVI    B,BD9600
  374.     JMP    SETBDEXIT
  375. ;
  376. OK19200:MVI    A,9
  377.     MVI    B,BD19200
  378. ;
  379. SETBDEXIT:
  380.     STA    MSPEED        ; Set the file transfer speed
  381.     MVI    C,9        ; BDOS string output request
  382.     LXI    D,SETBDMSG
  383.     PUSH    B
  384.     CALL    BDOS
  385.     POP    B
  386.     MVI    C,6        ; BDOS direct console I/O request
  387.     MOV    E,B        ; Move char to 'E' reg. for output
  388.     CALL    BDOS        ; Direct I/O to prevent tab expansion
  389.     CALL    J$ILPRT        ; Set new baud from CMOS ram parameter
  390.     DB    ESC,'<'
  391.     DB    0
  392.     RET
  393. ;.....
  394. ;
  395. ;
  396. ; Table of Otrona baud parameters
  397. ;
  398. BD75    EQU    0
  399. BD110    EQU    1
  400. BD1345    EQU    2
  401. BDB150    EQU    3
  402. BD300    EQU    4
  403. BD600    EQU    5
  404. BD1200    EQU    6
  405. BD2400    EQU    7
  406. BD4800    EQU    8
  407. BD9600    EQU    9
  408. BD19200    EQU    10
  409. ;.....
  410. ;
  411. ;
  412. ; Control message to set new baud
  413. ;
  414. SETBDMSG:
  415.     DB    ESC,'@',8    ; Write communications baud
  416.     DB    '$'
  417. ;.....
  418. ;
  419. ;
  420. ; Control message to enable new baud
  421. ;
  422. NEWBDMSG: DB    ESC,'<'        ; Set communications baud from cmos ram
  423.     DB    '$'
  424. ;.....
  425. ;
  426. ;
  427. ; Input buffer for baud specification
  428. ;
  429. BAUDBUF:DB    10,0
  430.     DS    10
  431. ;
  432. ;-----------------------------------------------------------------------
  433. ;
  434. ; NOTE: Must terminate priot to 0400H
  435. ;
  436.     END
  437.