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 / XMODEM / XM82OSCP.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  254 lines

  1. ;XM82OSCP.ASM - XMODEMxx PATCH FILE FOR Osborne MODEM  01/16/84
  2. ;
  3. ; This is adapted from Irv Hoff's XMEX-1.ASM dated 11/17/83
  4. ;
  5. ;        by John Riehl 1-713-644-7070 days
  6. ;                  1-713-488-1257 evenings    
  7. ;
  8. ; This file adapts XMODEMxx to the Osborne 01 with the
  9. ; Osborne COMM-PAC modem. To use, first edit any options desired into
  10. ; XMODEMxx.ASM, then assemble (can use ASM.COM) and load which supplies
  11. ; XMODEMxx.COM.  Then edit this file as needed (check the CONOUT routine
  12. ; if you want to locally see file transfer time and the record count
  13. ; while programs are being sent).  Then assemble (can use ASM.COM) and
  14. ; merge via DDT or SID:
  15. ;
  16. ;    B>DDT XMODEMxx.COM
  17. ;    DDT VERS 2.2
  18. ;    NEXT  PC
  19. ;    1180 0100
  20. ;    -IXM82OSCP.HEX        (note the 'I' command)
  21. ;    -R            ('R' loads in the .HEX file)
  22. ;    NEXT  PC
  23. ;    1180 0000
  24. ;    -G0            (return to CP/M)
  25. ;    B>SAVE 17 XMODEMxx.COM  (now have a modified .COM file)
  26. ;
  27. ; NOTE: Save 22 (rather than 17) if LOGCAL is YES
  28. ;
  29. ;=======================================================================
  30. ;
  31. ; 01/16/84 - Original version adapted from XMEX-1.ASM by Irv Hoff
  32. ;                    John Riehl    
  33. ;
  34. ;=======================================================================
  35. YES:    EQU    0FFH
  36. NO:    EQU    0
  37. ;
  38. ;=======================================================================
  39. ;
  40. ; The following options must be set as shown in XMODEM82:
  41. ;
  42. ; LARGEIO:    EQU    YES
  43. ; LARSIZE:    EQU    0B0H
  44. ;
  45. ; USECON:    EQU    NO    ;if you are using this XMODEM with BYE3
  46. ;
  47. ; Only one of the following can be yes and the others no
  48. ;
  49. BIOS13:    EQU    NO    ;yes = Osborne uses BIOS 1.3
  50. BIOS14: EQU    YES    ;yes = Osborne uses BIOS 1.4 or 1.41
  51. BIOS144:EQU    NO    ;yes = Osborne uses BIOS 1.44+ 
  52.             ;      (Nuevos Electronics 80 column mod.)
  53. ;
  54. ; If you have none of the above you have to use DDT to find out
  55. ; where the 5th JMP instruction in your BIOS jumps to and use it
  56. ; for the JMP at 103H. Set all three equates above to NO
  57. ;
  58. ;=======================================================================
  59. ;
  60. MODDATP: EQU    2A01H        ;data in port
  61. MODDATO: EQU    MODDATP        ;data out port
  62. MODCTLP: EQU    MODDATP-1    ;control/status port
  63. MODSNDB: EQU    2        ;bit to test for send
  64. MODSNDR: EQU    2        ;value when ready
  65. MODRCVB: EQU    1        ;bit to test for receive
  66. MODRCVR: EQU    1        ;value when ready
  67. MODDCDB: EQU    4        ;carrier detect bit
  68. MODDCDA: EQU    4        ;value when active
  69. MODPARE: EQU    40H        ;value for parity error
  70. MODOVRE: EQU    10H        ;value for overrun error
  71. MODFRME: EQU    20H        ;value for framing error
  72. ;
  73.  
  74. LSPEED:    EQU    YES        ;yes if using 'BYE' with speed selection
  75.                 ;no if using 'SPEED' manual selection
  76. MSPEED:    EQU    3CH        ;location of baud rate factor (set by
  77.                 ;'BYE')  set location in 'BYE' to agree.
  78.                 ;3dh and 3eh often used by newer ver-
  79.                 ;sions of 'ZCPR'.
  80. XSPEED:    EQU    1        ;speed for file time transfer without
  81.                 ;auto-set.  use one of the following:
  82.                 ;0=110 1=300 2=450 3=600 4=710 5=1200
  83. BASE:    EQU    100H        ;start of cp/m normal program area
  84. ;
  85. ;-------------------------------------------------------------------
  86. ;
  87. ; Jump table: The jump table must be in exactly the same sequence as the
  88. ; one in XMODEM.  Note the ORG of 103H - This jump table has no jump to
  89. ; 'BEGIN'.
  90. ;
  91. ;
  92.      ORG    BASE+3        ;start after 'JMP BEGIN'
  93. ;
  94. CONOUT:      IF    BIOS13
  95.      JMP    0E915H        ;BIOS 1.3 console output routine
  96.       ENDIF            ;BIOS13
  97. ;
  98.       IF    BIOS14
  99.      JMP    0E738CH        ;BIOS 1.4 console output routine
  100.       ENDIF            ;BIOS14
  101. ;
  102.       IF    BIOS144        ;BIOS 1.44+ console output routine
  103.      JMP    0E749H
  104.       ENDIF            ;BIOS144
  105. ;
  106.       IF (NOT BIOS13) AND (NOT BIOS14) AND (NOT BIOS144)
  107.      JMP    0000H        ;put your BIOS console out jump address here
  108.       ENDIF        ;(NOT BIOS13) AND (NOT BIOS14) AND (NOT BIOS144)
  109. ;
  110. ;
  111. PMINIT:     JMP    MINIT        ;initialization routine (if needed)
  112. PUNINIT: RET ! NOP ! NOP    ;not required
  113. PSENDR:     JMP    SENDR        ;send character (via pop psw)
  114. PCAROK:     JMP    CAROK        ;test for carrier
  115. PMDIN:     JMP    MDIN        ;receive data byte
  116. PGETCHR: JMP    GETCHR        ;get character from modem
  117. PRCVRDY: JMP    RCVRDY        ;check receive ready
  118. PSNDRDY: JMP    SNDRDY        ;check send ready
  119. PSPEED:     JMP    SPEED        ;get speed value for file transfer time
  120. POSTAT:  JMP    OSTAT        ;get I/O status
  121. PEXTRA1: RET ! NOP ! NOP    ;extra for custom routine
  122. PEXTRA2: RET ! NOP ! NOP    ;extra for custom routine
  123. ;
  124. ;=======================================================================
  125. ;
  126. ; ---> CAROK - check for presence of carrier.  RET with Z = carrier on
  127. ;
  128. CAROK:    CALL    POSTAT        ;get status
  129.     ANI    MODDCDB        ;get carrier detect bit
  130.     PUSH    PSW
  131.     CNZ    MDIN
  132.     POP    PSW
  133.     RET
  134. ;
  135. ;=======================================================================
  136. ;
  137. ; ---> GETCHR - - initialize if not already done, then get character
  138. ; ---> MDIN - - get a character
  139. ;
  140. GETCHR:    CALL    MINIT
  141. MDIN:    JMP    OSIN        ;get character from data in port
  142. ;
  143. ;=======================================================================
  144. ;
  145. ; This is the Osborne initialization routine which is required
  146. ; to relocate the memory mapped above 4000H.
  147. ;
  148. INITFLG:  DB    0        ;initialization flag
  149. ;    
  150. MINIT:      LDA    INITFLG        ;have we been here before?
  151.       ORA    A
  152.       RNZ            ;if yes, exit
  153.       INR    A
  154.       STA    INITFLG
  155.       PUSH    B
  156.       PUSH    D
  157.       PUSH    H
  158.       LXI    H,OSIN        ;get address of first byte to move
  159.       LXI    D,0A000H    ;get place to put first byte
  160.       LXI    B,RCVRDY-OSIN    ;get length of code to move
  161.       DB    0EDH,0B0H    ;Z80 LDIR
  162. ;
  163.       LXI    H,0A000H    ;get new address of OSIN
  164.       SHLD    MDIN+1        ;PATCH CALL FOR "GET CHAR." ROUTINE
  165.       LXI    H,0A000H+OSOUT-OSIN
  166.       SHLD    SENDR+2        ;PATCH CALL FOR "SEND CHAR." ROUTINE
  167.       LXI    H,0A000H+OSTAT-OSIN
  168.       SHLD    POSTAT+1    ;PATCH CALL FOR "GET STATUS" ROUTINE
  169.       POP    H
  170.       POP    D
  171.       POP    B
  172.       RET
  173. ;
  174. ;
  175. ; --- Routines that get placed just under 'BYE' ---
  176. ;
  177. OSIN:    DI            ;DISABLE INTERRUPTS
  178.     OUT    0        ;SWITCH TO ALTERNATE PAGE
  179.     LDA    MODDATP        ;GET DATA BYTE
  180.     OUT    1        ;SWITCH PAGES BACK
  181.     EI            ;RE-ENABLE INTERRUPTS
  182.     RET
  183. ;.....
  184. ;
  185. ;
  186. OSOUT:    DI            ;DISABLE INTERRUPTS
  187.     OUT    0        ;SWITDH TO ALTERNATE PAGE
  188.     STA    MODDATO        ;SEND DATA BYTE
  189.     OUT    1        ;SWITCH PAGES BACK
  190.     EI            ;RE-ENABLE INTERRUPTS
  191.     RET
  192. ;.....
  193. ;
  194. ;
  195. OSTAT:    DI            ;DISABLE INTERRUPTS
  196.     OUT    0        ;SWITCH TO ALTERNATE PAGE
  197.     LDA    MODCTLP        ;GET STATUS BYTE
  198.     OUT    1        ;SWITCH PAGES BACK
  199.     EI            ;RE-ENABLE INTERRUPTS
  200.     RET
  201. ;
  202. ;
  203. ;=======================================================================
  204. ;
  205. ; ---> RCVRDY - check receive ready.  RET with Z = character available.
  206. ;            Return with error code in A-reg.
  207. ;
  208. RCVRDY:    CALL    POSTAT        ;get modem status
  209.     PUSH    B        ;save scratch register
  210.     PUSH    PSW        ;check error status
  211.     ANI    MODFRME+MODOVRE
  212.     MOV    B,A        ;save it for a moment
  213.     POP    PSW
  214.     ANI    MODRCVB        ;isolate ready bit
  215.     CPI    MODRCVR        ;test it
  216.     MOV    A,B        ;get the error code char. back
  217.     POP    B
  218.     RET
  219. ;
  220. ;=======================================================================
  221. ;
  222. ; ---> SENDR - send character
  223. ;
  224. SENDR:    POP    PSW        ;get the character back
  225.     JMP    OSOUT        ;send it to the modem output
  226. ;
  227. ;=======================================================================
  228. ;
  229. ; ---> SNDRDY - check if ready to send.
  230. ;
  231. SNDRDY:    CALL    POSTAT        ;get status byte
  232.     ANI    MODSNDB        ;isolate ready bit
  233.     CPI    MODSNDR        ;ready to send?
  234.     RET
  235. ;
  236. ;=======================================================================
  237. ;
  238. ; ---> SPEED - sets the time shown for program transfer.
  239. ;
  240. SPEED:     IF    LSPEED
  241.     LDA    MSPEED        ;get index for baud rate from 'BYE'
  242.      ENDIF
  243. ;
  244.      IF     NOT LSPEED
  245.     MVI    A,XSPEED    ;get index for baud rate from 'XSPEED'
  246.      ENDIF
  247. ;
  248.     RET
  249. ;
  250. ;=======================================================================
  251. ;
  252.     END
  253.