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 / XMTD-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  3KB  |  146 lines

  1.     TITLE    'XMODEM PATCH FILE FOR TURBODOS'
  2. ;
  3. ; TDPAT - patch file for TurboDOS / XMODEM
  4. ; uses COMM port
  5. ;
  6. ; EDITED: 07/14/84    SFK
  7. ;
  8. BASE    EQU    100H        ;start of TPA
  9. ;
  10. PORT    EQU    0        ;0=modem port, 1=console port
  11. ;
  12. ;-------------------------------------------------------------------
  13. ;
  14. ; Jump table: The jump table must be in exactly the same sequence
  15. ; as the one in XMODEM. Note the ORG of 103H - This jump table has
  16. ; no jump to BEGIN.
  17. ;
  18.     ORG    BASE+3    ;start after JMP BEGIN
  19. ;
  20. CONOUT:    JMP    COUT
  21. PMINIT:    JMP    MINIT    ;initialize whatever has to be (or do RET)
  22. PUNINIT:JMP    UNINIT    ;undo whatever MINIT did (or RET)
  23. PSENDR:    JMP    SENDR    ;send data byte on stack (POP PSW / OUT)
  24. PCAROK:    JMP    CAROK    ;test for carrier. RET Z=ok, NZ=no carrier
  25. PMDIN:    JMP    MDIN    ;receive data byte
  26. PGETCHR:JMP    GETCHR    ;must point to a RET
  27. PRCVRDY:JMP    RCVRDY    ;check receive ready RET Z=ready
  28. PSNDRDY:JMP    SNDRDY    ;check send ready RET Z=ready
  29. PSPEED:    JMP    SPEED    ;get speed factor in ACC
  30. PSPARE1:JMP    SPARE    ;3 jumps for custom routines
  31. PSPARE2:JMP    SPARE
  32. PSPARE3:JMP    SPARE
  33. ;
  34. ;-----------------------------------------------------------------------
  35. ;
  36. GETCHR:            ;no garbage collection done
  37. SPARE:            ;for later use
  38. MINIT:          ; No Init
  39. UNINIT:         ; No Init so no Un-init!
  40.     RET
  41. ;
  42. ; SNDRDY - check if ready to send
  43. ;
  44. SNDRDY:    xra    a    ;assume always ready
  45.     ret
  46. ;
  47.     if    not port
  48. COUT:    push    b
  49.     push    d
  50.     push    h
  51.     mvi    d,1
  52.     jmp    go
  53.     endif
  54. ;
  55. ; SENDR - send character
  56. ;
  57. SENDR:    pop    psw
  58.     push    b
  59.     push    d
  60.     push    h
  61.     mov    e,a
  62.     mvi    d,port
  63. go:    mvi    c,36
  64.     call    50h
  65.     pop    h
  66.     pop    d
  67.     pop    b
  68.     ret
  69. ;
  70. ; RCVRDY - check receive ready
  71. ; RET with Z = character available.
  72. ; return error code in A
  73. ;
  74. RCVRDY:    push    b
  75.     push    d
  76.     push    h
  77.     mvi    c,34
  78.     mvi    d,port
  79.     call    50h
  80.     pop    h
  81.     pop    d
  82.     pop    b
  83.     ora    a
  84.     jnz    rdy
  85.     mvi    a,0afh
  86. rdy    equ    $-1
  87.     ora    a
  88.     ret
  89. ;
  90. ; MDIN - receive a character (GETCHR is identical)
  91. ;
  92. MDIN:    push    b
  93.     push    d
  94.     push    h
  95.         mvi    c,34
  96.     mvi    d,0
  97.     call    50h
  98.     ora    a
  99.     jnz     nochar
  100.     mvi    c,35
  101.     mvi    d,port
  102.     call    50h
  103. nochar:
  104.     pop    h
  105.     pop    d
  106.     pop    b
  107.     ret
  108. ;
  109. ; SPEED - This routine returns the speed code.
  110. ; 0=110, 1=300, 2=450, 3=600, 4=710, 5=1200
  111. ; Load your speed byte from low memory, or
  112. ; simply MVI A,n and RET for default speed only
  113. ;
  114. ; the following will work correctly for 300 and 1200:
  115. ;
  116. SPEED:    push    b
  117.     push    d
  118.     push    h
  119.     mvi    c,38
  120.     mvi    d,port
  121.     call    50h
  122.     lxi    h,table
  123.     ani    0fh
  124.     add    l
  125.     mov    l,a
  126.     mvi    a,0
  127.     adc    h
  128.     mov    h,a
  129.     mov    a,m
  130.     pop    h
  131.     pop    d
  132.     pop    b
  133.     ret
  134. ;
  135. ; table for baud rates (110,300,600,1200,2400,4800,9600,19200)
  136. ; invalid entries return 110 baud
  137. ;
  138. table:    db    0,0,0,0,0,1,3,5,0,0,6,0,7,0,8,9
  139. ;
  140. ; CAROK - check for presence of carrier.
  141. ; RET with Z = carrier on
  142. ;
  143. CAROK:    xra    a
  144.     RET
  145.     END
  146.