home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / tel / fltcom.do < prev    next >
Text File  |  2006-10-19  |  12KB  |  362 lines

  1. Club 100 Library - 415/939-1246 BBS,    937-5039 NEWSLETTER, 932-8856 VOICE
  2.  
  3. How to Get FLTKP.COM
  4. --------------------
  5.  
  6. For doing Kaypro <--> 100/102/200 fast ASCII file transfers, 
  7. FLTKP.COM (DL1) should work for you.  You need to download it into
  8. your Kaypro with Xmodem protocol comm program with 8-bit, no 
  9. parity CIS DEFALT settings.
  10.  
  11. If you can't do that, get FLTIBM.UPD, rename it as FLTIBM.ASM, and
  12. assemble it with ASM.COM (the assembler provided with the computer
  13. as a CP/M utility) and convert the resulting hex file to binary 
  14. with LOAD.COM (another utility provided with CP/M).
  15.  
  16. With FLTKP.ASM and ASM.COM both on the the same disk drive, at the
  17. CP/M prompt, type:
  18.  
  19.   ASM FLTKP
  20.  
  21. After you get an End of Assembly message and the prompt comes 
  22. back, type:
  23.  
  24.   LOAD FLTKP
  25.  
  26. You should then have a functional copy of FLTKP.COM on your Kaypro
  27. disk.  The files FLTKP.HEX and FLTKP.PRN can then be ERAsed.
  28.  
  29. FLTKP is the ancestor of FLTIBM, with a subset of its 
  30. capabilities.  For some usage hints, read FLTIBM.DOC (DL1).  Note 
  31. the information there about use with the Tandy 200, if that is 
  32. what you are using, and the null modem cable information.  And 
  33. remember that the '88' is replaced with a '98' for all lap 
  34. computer 'save' and 'load' commands with FLTKP.
  35.  
  36. Phil Wheeler
  37.  
  38. ;TRS-80 Model 100 -- Kaypro File Transfer Utility
  39. ;
  40. ;Transfers ASCII files to/from Model 100 at
  41. ;19200 baud.  Use setting 98N1E and Save & Load on Model 100
  42. ;Examples are:
  43. ;   In TEXT: Save to:com:98n1e
  44. ;   in BASIC: Save"com:98n1e"
  45. ;
  46. ;Requires RS-232 cable with "Null Modem Adapter"
  47. ;for computer interconnect.
  48. ;
  49. ;Written by Don Corbitt, Feb 1984
  50. ;
  51. ;Modified by Phil Wheeler, 7/8/84
  52. ;Changes include
  53. ;  1) made compatible with DR's standard assembler, ASM.COM
  54. ;  2) Okidata-peculiar printer control functions removed
  55. ;  3) menu at sign-on made more user friendly
  56. ;  4) uart-initiation string modified per Gary Berkheiser suggestion.
  57. ;
  58. ;This file should be adaptable to most CP/M machines by changing the
  59. ;uart data port address, the uart status port address,
  60. ;the baud rate port address, and the uart initiation string (initcom:)
  61. ;
  62. ;
  63.         ORG     100H
  64. BOOT    EQU     0
  65. BDOS    EQU     5
  66. FCBL    equ     5ch
  67. dbuff   equ     80h             ;disk i/o buffer
  68. conin   equ     1               ;get char from console - wait
  69. printf  equ     9               ;print buffer function (DE) until '$'
  70. inlinf  equ     10              ;read buffer from console
  71. openf   equ     15              ;open file, 
  72. closef  equ     16              ;close file after write
  73. search  equ     17              ;look for file - ff if not found
  74. readf   equ     20              ;read block from file
  75. writef  equ     21              ;write block to file
  76. makef   equ     22              ;make a file entry
  77. baud    equ     0               ;port to set baud rate
  78. uartd   equ     4               ;uart data port
  79. uarts   equ     6               ;uart status port
  80. bell    equ     7
  81. cr      equ     13
  82. lf      equ     10
  83. nul     equ     0
  84. eof     equ     1ah             ;end of file signal
  85. xoff    equ     19              ;stop transmission
  86. xon     equ     17              ;start transmission
  87.  
  88. start:
  89.         mvi     a,15            ;19200 baud
  90.         out     baud
  91.         mvi     b,9
  92.         lxi     h,initcom       ;string of chars to initialize uart
  93.         mvi     c,uarts         ;set stat for 98n1e
  94.         db      0edh,0b3h       ;otir
  95. loop1:
  96.         lxi     d,menu
  97.         mvi     c,printf
  98.         call    bdos
  99.         mvi     c,conin
  100.         call    bdos
  101.         call    touppr          ;get upper case letters
  102.         cpi     'Q'             ;return to CP/M
  103.         rz
  104.         cpi     'S'             ;send file to M100
  105.         jz      send
  106.         cpi     'R'             ;receive file from M100
  107.         jz      receive
  108.         jmp     loop1           ;try again
  109. send:
  110.         lxi     d,sndmsg        ;'Enter file to send'
  111.         mvi     c,printf
  112.         call    bdos
  113.         call    gfspec          ;get the file name, and see if it exists
  114.         jnz     sendit          ;it exists, so send it
  115.         lxi     d,nfmsg         ;'File doesn't exist'
  116.         mvi     c,printf
  117.         call    bdos
  118.         jmp     loop1           ;try again
  119. sendit:
  120.         lxi     h,stbuff        ;end of program - start of buffer
  121.         push    h
  122.         lxi     d,fcbl
  123.         mvi     c,openf         ;open file and read contents
  124.         call    bdos
  125. sloop:  mvi     c,readf
  126.         lxi     d,fcbl
  127.         call    bdos
  128.         ana     a               ;nz = EOF
  129.         jnz     sendfil
  130.         pop     d               ;current end of data
  131.         lxi     h,dbuff         ;dma buffer - disk buffer
  132.         lxi     b,80h           ;size of buffer
  133.         db      0edh,0b0h       ;ldir (hl)->(de)
  134.         push    d               ;new end of data
  135.         jmp     sloop
  136.  
  137. sendfil:
  138.         call    motoff
  139. ;       in      28              ; get contents of disk select port
  140. ;       ani     252             ; de-select both drives
  141. ;       ori     64              ; turn off motor
  142. ;       out     28              ; rewrite port
  143. ;       mvi     c,closef        ;close file now
  144. ;       lxi     d,fcbl          ;set params
  145. ;       call    bdos
  146.         pop     h               ;arrange stack - discard this value
  147.         lxi     h,stbuff        ;buffer ended with EOF, OK?
  148. sloop1: mov     c,m             ;get first char
  149.         inx     h
  150.         call    rsout           ;send char
  151.         cpi     eof
  152.         jz      send            ;end of file - send new file??
  153.         call    rsist           ;char waiting??
  154.         jz      sloop1
  155.         call    rsin            ;get char
  156.         cpi     xoff            ;if xoff, then wait.....
  157.         jnz     sloop1          ;else ignore it
  158. sloop2: call    RSin
  159.         cpi     xon
  160.         jnz     sloop2
  161.         jmp     sloop1
  162.  
  163.  
  164. ;rs output status. Z if uart busy, NZ otherwise.  A modified.
  165.  
  166. rsost:
  167.         in      uarts
  168.         ani     4
  169.         ret
  170.  
  171. ;RS character out, character in C
  172.  
  173. rsout:                          ;send byte in C to uart
  174.         call    rsost
  175.         jz      rsout
  176.         mov     a,c
  177.         out     uartd
  178.         ret
  179.  
  180. ;rs input status.  Z if no char waiting, NZ if char ready.
  181.  
  182. rsist:
  183.         in      uarts
  184.         ani     1               ;char waiting?
  185.         ret
  186.  
  187. ;get char from uart and return in A.
  188.  
  189. rsin:
  190.         call    rsist
  191.         jz      rsin            ;try again if one not waiting
  192.         in      uartd
  193.         ret
  194.  
  195. receive:
  196.         lxi     d,recmsg
  197.         MVI     C,printf
  198.         call    bdos
  199.         call    gfspec
  200.         jz      rcvit           ;doesn't exist, so get it
  201.         lxi     d,fexmsg
  202.         mvi     c,printf
  203.         CALL    BDOS
  204.         JMP     LOOP1
  205. RCVIT:
  206.         lxi     d,fcbl
  207.         mvi     c,makef
  208.         call    bdos
  209.         lxi     h,stbuff
  210. rloop:  call    rsin            ;get a char
  211.         mov     m,a             ;and put in buffer
  212.         inx     h
  213.         cpi     eof             ;if not last
  214.         jnz     rloop           ;then get another
  215.         lxi     h,stbuff
  216. secloop:
  217.         lxi     d,dbuff
  218.         mvi     b,80h
  219. byteloop:
  220.         mov     a,m
  221.         stax    d
  222.         cpi     eof
  223.         jz      lastone
  224.         inx     h
  225.         inx     d
  226.         dcr     b
  227.         jnz     byteloop        
  228.         call    wsect
  229.         jmp     secloop
  230.  
  231. lastloop:
  232.         stax    d
  233. lastone:
  234.         inx     d
  235.         dcr     b
  236.         jnz     lastloop
  237.         call    wsect
  238.         lxi     d,fcbl
  239.         mvi     c,closef
  240.         call    bdos
  241.         jmp     receive         ;end of file - get another one??
  242. wsect:
  243.         push    h               ;save position in buffer
  244.         lxi     d,fcbl
  245.         mvi     c,writef
  246.         call    bdos
  247.         pop     h
  248.         ret
  249. touppr:
  250.         cpi     'a'
  251.         rc
  252.         cpi     'z'+1
  253.         rnc
  254.         ani     5fh
  255.         ret
  256.  
  257. gfspec:
  258.         lxi     h,fcbl
  259.         mvi     b,33            ;33 bytes to erase
  260.         xra     a
  261. erase:  mov     m,a
  262.         inx     h               ;next byte in fcbl
  263.         dcr     b
  264.         jnz     erase
  265.         lxi     h,fcbl+1
  266.         mvi     b,11            ;file name block - default spaces
  267.         mvi     a,32            ;space
  268. erase1: mov     m,a
  269.         inx     h
  270.         dcr     b
  271.         jnz     erase1
  272.         lxi     d,fbuff         ;buffer to hold file name
  273.         push    d               ;save start of buffer
  274.         mvi     c,inlinf        ;read line from keyboard
  275.         call    bdos            ;get line
  276.         pop     h               ;start of buffer (max count)
  277.         inx     h               ;actual value returned
  278.         mov     a,m
  279.         ana     a               ;no chars in queue??
  280.         mov     b,a             ;count in b
  281.         jnz     congsp          ;if chars, continue get file spec
  282.         pop     h               ;remove one level of subroutines
  283.         jmp     loop1           ;start over with menu
  284. congsp:
  285.         inx     h               ;first char of fspec
  286.         inx     h               ;second char of fspec
  287.         mov     a,m             ;get ':' if in fspec
  288.         dcx     h               ;first char of fspec
  289.         cpi     ':'
  290.         mvi     a,0             ;zero (A) without affecting flags
  291.         jnz     noprefix
  292.         dcr     b
  293.         dcr     b               ;skipping first two chars of buffer
  294.         mov     a,m
  295.         call    touppr
  296.         sbi     '@'             ;get value from 1 to 17 (A to P)
  297.         sta     fcbl            ;set drive number
  298.         inx     h               ;point to ':'
  299.         inx     h               ;point to first char of name
  300. noprefix:
  301.         lxi     d,fcbl+1        ;start of name section of fcbl
  302. nprloop:
  303.         mov     a,m
  304.         call    touppr
  305.         cpi     '.'
  306.         jz      stext           ;start extension
  307.         stax    d               ;put in fcbl
  308.         inx     h
  309.         inx     d
  310.         dcr     b
  311.         jnz     nprloop
  312. exist:
  313.         mvi     c,search
  314.         lxi     d,fcbl
  315.         call    bdos
  316.         inr     a
  317.         push    psw
  318.         call    motoff
  319.         pop     psw
  320.         ret
  321. motoff: in      28
  322.         ori     64
  323.         out     28
  324.         ret
  325. stext:
  326.         inx     h               ;skip '.'
  327.         lxi     d,fcbl+9        ;start of extension
  328.         dcr     b
  329.         jz      exist           ;done
  330. extloop:
  331.         mov     a,m
  332.         call    touppr
  333.         stax    d
  334.         inx     h
  335.         inx     d
  336.         dcr     b
  337.         jnz     extloop
  338.         jmp     exist   
  339.  
  340.  
  341. fbuff:  db      18
  342.         ds      18
  343.  
  344.  
  345. fexmsg: db      bell,cr,lf,'File already exists',cr,lf,'$'
  346. recmsg: db      cr,lf,'File to recieve: $'
  347. sndmsg: db      cr,lf,'File to send: $'
  348. nfmsg:  db      bell,cr,lf,'File doesn''t exist!!',cr,lf,'$'
  349. menu:   db      cr,lf,lf
  350.         db      'Use with COM:98N1E & Save or Load on Model 100'
  351.         db      cr,lf,'Works with TEXT or BASIC',cr,lf,lf
  352.         db      'Selections are:',cr,lf,lf
  353.         db      '  [Q] Return to CP/M',cr,lf,'  [S] Send file to M100'
  354.         db      cr,lf,'  [R] Receive file from M100',cr,lf
  355.         db      cr,lf,'Enter your selection: $'
  356. initcom:
  357.         db      00h,18h,04h,44h,03h,0c1h,05h,0eah
  358. endbuff:
  359.         dw      0
  360. stbuff  equ     $               ;start of free space
  361.         end     start
  362.