1 ; SCCSID = @(#)cpmio2.asm 1.1 85/04/11
2 TITLE CPMIO2
- device IO for MSDOS
12 ; Old style CP/M 1-12 system calls to talk to reserved devices
22 ; $Std_Con_Input_Status
23 ; $Std_Con_Input_Flush
27 ; AN000 version 4.00 - Jan. 1988
30 CODE SEGMENT BYTE PUBLIC 'CODE'
31 ASSUME
SS:DOSGROUP
,CS:DOSGROUP
40 ; The following routines form the console I/O group (funcs 1,2,6,7,8,9,10,11).
41 ; They assume ES and DS NOTHING, while not strictly correct, this forces data
42 ; references to be SS or CS relative which is desired.
47 i_need CurrentPDB
,WORD ;AN000;
48 i_need InterCon
,BYTE ;AN000;
49 i_need SaveCurFlg
,BYTE ;AN000;
57 ; Input character from console, echo
61 procedure $STD_CON_INPUT
,NEAR ;System call 1
62 ASSUME
DS:NOTHING
,ES:NOTHING
65 push word ptr [InterCon
] ;AN000;
66 mov [InterCon
],01H ;AN000;
67 invoke INTER_CON_INPUT_NO_ECHO
;AN000;
68 pop word ptr [InterCon
] ;AN000;
71 mov [SaveCurFlg
],0 ;AN000;
73 mov [SaveCurFlg
],1 ;AN000;
76 mov [SaveCurFLg
],0 ;AN000;
79 jz $STD_CON_INPUT
;AN000;
81 invoke $STD_CON_INPUT_NO_ECHO
87 EndProc $STD_CON_INPUT
94 ; Output character to console
98 procedure $STD_CON_OUTPUT
,NEAR ;System call 2
100 ASSUME
DS:NOTHING
,ES:NOTHING
110 INC BYTE PTR [CARPOS
]
114 INC BYTE PTR [CHARCO
] ;invoke statchk...
115 AND BYTE PTR [CHARCO
],00111111B ;AN000; every 64th char
121 invoke RAWOUT
;output the character
125 TEST [SaveCurFlg
],01H ;AN000;print but no cursor adv? 2/13/KK
126 retnz
;AN000;if so then do not send to prt2/13/KK
128 TEST BYTE PTR [PFLAG
],-1
137 TEST BX,sf_isnet
; output to NET?
138 JNZ TRIPOPJ
; if so, no echo
139 TEST BX,devid_device
; output to file?
140 JZ TRIPOPJ
; if so, no echo
144 TEST [SI.sf_flags
],sf_net_spool
; StdPrn redirected?
145 JZ LISSTRT2J
; No, OK to echo
146 MOV BYTE PTR [PFLAG
],0 ; If a spool, NEVER echo
179 MOV BYTE PTR [CARPOS
],0
184 DEC BYTE PTR [CARPOS
]
189 JAE OUTJ
;Normal char
191 JZ OUTJ
;OUT knows how to expand tabs
194 CMP AL,"U"-"@" ; turn ^U to section symbol
196 CMP AL,"T"-"@" ; turn ^T to paragraph symbol
203 invoke OUTT
;Print '^' before control chars
205 OR AL,40H
;Turn it into Upper case mate
209 EndProc $STD_CON_OUTPUT
216 ; Returns character from aux input
220 procedure $STD_AUX_INPUT
,NEAR ;System call 3
221 ASSUME
DS:NOTHING
,ES:NOTHING
237 EndProc $STD_AUX_INPUT
244 ; Output character to aux output
248 procedure $STD_AUX_OUTPUT
,NEAR ;System call 4
249 ASSUME
DS:NOTHING
,ES:NOTHING
255 EndProc $STD_AUX_OUTPUT
262 ; Output the character to the list device
266 procedure $STD_PRINTER_OUTPUT
,NEAR ;System call 5
267 ASSUME
DS:NOTHING
,ES:NOTHING
286 EndProc $STD_PRINTER_OUTPUT
293 ; Check console input status
295 ; AL = -1 character available, = 0 no character
297 procedure $STD_CON_INPUT_STATUS
,NEAR ;System call 11
298 ASSUME
DS:NOTHING
,ES:NOTHING
305 EndProc $STD_CON_INPUT_STATUS
310 ; AL = DOS function to be called after flush (1,6,7,8,10)
312 ; Flush console input buffer and perform call in AL
314 ; Whatever call in AL returns or AL=0 if AL was not 1,6,7,8 or 10
316 procedure $STD_CON_INPUT_FLUSH
,NEAR ;System call 12
317 ASSUME
DS:NOTHING
,ES:NOTHING
346 mov ds,[CurrentPDB
] ;AN000;
347 ;AN000; set DS same as one from COMMAND entry
351 EndProc $STD_CON_INPUT_FLUSH