home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
pcpursut
/
pisrc.ark
/
A.ASM
next >
Wrap
Assembly Source File
|
1988-07-14
|
2KB
|
152 lines
;***********************************************************************
;* A.ASM - linkage to IMP *
;***********************************************************************
;
PUBLIC TIMER_, J_CRLF_, J_INMDM_, J_ILPRT_, J_SNDCHR, J_SNDSTR
FUNC DELAY_
FUNC PRINTF_
;
I$MDCTL1 EQU 011FH ; In modem control port
I$MDDATP EQU 0133H ; In modem data port
O$MDDATP EQU 013DH ; Outmodem data port
;
A$MDRCV EQU 0147H
C$MDRCV EQU 014AH
A$MDSND EQU 014DH
C$MDSND EQU 0150H
;
NULL EQU 0
CR EQU 'M'-40H
;
TIMER_: LXI H,0 ; Put 0 into HL
MOV A,B ; Get time into A in hundreths of a second
MOV L,A ; And put it into hl
DAD H ; X2
DAD H ; X4
DAD H ; X8
DAD H ; X16
DAD H ; X32
PUSH H ; Put into de
POP D
DAD H ; X64
DAD D ; *96 which is close to 100
PUSH H ; Put on stack for call
CALL DELAY_ ; Call 'c' routine
POP D
RET
;
; Send character in (B) to the modem
;
J_SNDCHR:
CALL WAITRDY ; Wait for output to be ready
MOV A,B
JMP O$MDDATP ; Send character
;
WAITRDY:CALL I$MDCTL1
CALL A$MDSND ; Get status
CALL C$MDSND
JNZ WAITRDY ; Loop until uart is clear
RET
;
; Send string pointed to by hl to modem, string ends with $
;
J_SNDSTR:
MOV A,M ; Get character
CPI '$' ; Is it a $ sign
RZ
;
MOV B,A
CALL J_SNDCHR ; Output character
INX H
JMP J_SNDSTR
;
; Print an inline string
;
J_ILPRT_:
XTHL
;
LP: MOV A,M
ORA A ; End of string?
JZ DONE
;
CALL SENDOUT
INX H
JMP LP
;
DONE: XTHL
RET
;
SENDOUT:PUSH B
PUSH D
PUSH H
MOV E,A
MVI C,02
CALL 0005
POP H
POP D
POP B
RET
;
; Max 0.1 sec. wait for modem character
;
J_INMDM_:
PUSH H
LXI H,003FH
CALL TIMECALC ; Get timeot time
MOV B,H
MOV C,L
POP H
;
TRYAGAIN:
CALL TRYRECV
JNZ NOCHAR
;
CALL I$MDDATP
ANI 7FH
RET
;
NOCHAR: DCX B
MOV A,B
ORA C
JNZ TRYAGAIN
;
STC
RET
;
TIMECALC:
LDA 010B
PUSH D
PUSH H
POP D
;
LP2: DAD D
DCR A
JNZ LP2
'
POP D
RET
'
TRYRECV:CALL I$MDCTL1
CALL A$MDRCV
JMP C$MDRCV
;
; Send newline to display
;
J_CRLF_:
PUSH B
PUSH D
PUSH H
LXI H,NEWLINE
PUSH H
CALL PRINTF_
POP H
POP H
POP D
POP B
RET
;
NEWLINE:DB CR
DB 00
;