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 / STARTKIT / PIPMODEM.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  2KB  |  64 lines

  1. ;
  2. ;            PIPMODEM.ASM
  3. ;
  4. ;10/29/82  Written by P. L. Kelley
  5. ;
  6. ;Carefully read the file PIPMODEM.DOC for further information on the
  7. ;use of this file.
  8. ;
  9. ;The following four equates will probably be the only changes that need
  10. ;to be made. Currently set up for Heath H89.
  11. MDAT    EQU    0D8H    ;MODEM PORT FOR SENDING AND RECEIVING DATA
  12. MSTAT    EQU    0DDH    ;MODEM STATUS PORT
  13. RCV    EQU    1    ;STATUS PORT BIT TO TEST FOR A CHARACTER WAITING
  14. RCVT    EQU    RCV    ;THE OTHER POSSIBILITY FOR THIS IS 0
  15. ;
  16. OLDSTRT    EQU    04CEH    ;PIP's normal start
  17. CTLO    EQU    0FH    ;Control-O to open memory buffer
  18. CTLZ    EQU    1AH    ;Control-Z to write the file to disk
  19. NOPAR    EQU    7FH    ;no parity mask
  20. ;
  21.     ORG    100H
  22. ;
  23.     JMP    NEWSTRT    ;go put BIOS vectors in the right places
  24.     JMP    KSTAT    ;go run the modem routine
  25.     DS    3    ;skip over the OUT: vector
  26. BYTE    DB    0    ;this is where the byte for the memory buffer goes
  27. KSTAT    CALL    $-$    ;get the status of the keyboard
  28.     ORA    A    ;A will be zero if you have not typed a key
  29.     JZ    MODIN    ;if no keypress check the modem for input
  30. KEYIN    CALL    $-$    ;OK, there is a keypress, go get it
  31.     CPI    CTLO    ;do you want to open the buffer?
  32.     JNZ    NOO    ;go if you do not
  33.     STA    OFLAG    ;save flag if you want buffer open
  34.     JMP    KSTAT    ;don't output control-O
  35. NOO    CPI    CTLZ    ;end of file?
  36.     JNZ    MODOUT    ;no, then output character
  37.     STA    BYTE    ;tells PIP to write the memory buffer to disk file
  38.     RET        ;and PIP will go do it
  39. MODOUT    OUT    MDAT    ;send the character to the remote
  40. MODIN    IN    MSTAT    ;get the modem status
  41.     ANI    RCV    ;mask off all but the receive bit
  42.     CPI    RCVT    ;test the receive bit
  43.     JNZ    KSTAT    ;go if nothing received
  44.     IN    MDAT    ;OK, there is modem input, go get it
  45.     ANI    NOPAR    ;mask off parity
  46.     STA    BYTE    ;save for possible entry into file buffer
  47.     MOV    C,A    ;the BIOS display routine wants the character in C
  48. CONOUT    CALL    $-$    ;display input
  49.     LDA    OFLAG    ;check whether input should be in memory buffer
  50.     ORA    A    ;zero flag will be reset if character goes in buffer
  51.     JZ    KSTAT    ;go if the character does not go in buffer
  52.     RET        ;PIP will put character in buffer and call 103H again
  53. OFLAG    DB    0    ;flag for memory buffer open
  54. NEWSTRT    LHLD    1    ;get wboote to determine BIOS vectors
  55.     LXI    D,3    ;load DE with 3
  56.     DAD    D    ;put console status vector in HL
  57.     SHLD    KSTAT+1        ;store
  58.     DAD    D    ;put console input vector in HL
  59.     SHLD    KEYIN+1        ;store
  60.     DAD    D    ;put console output vector in HL
  61.     SHLD    CONOUT+1    ;store
  62.     JMP    OLDSTRT        ;go to normal PIP start
  63.     END
  64.