]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/DOS/PRINT.ASM
1 ; SCCSID = @(#)print.asm 1.1 85/04/10
3 ; PFMT - formatted output. Calling sequence:
12 ; The format string contains format directives and normal output characters
13 ; much like the PRINTF for C. We utilize NO format widths. Special chars
16 ; $x output a hex number
17 ; $s output an offset string
18 ; $c output a character
19 ; $S output a segmented string
20 ; $p output userid/processid
24 ; The format string must be addressable via CS
55 RestoreReg <SI,DS,BX,AX>
58 ; \ leads in a special character. See what the next char is.
61 OR AL,AL ; end of string
74 ; $ leads in a format specifier.
77 CMP AL,'x
' ; hex number
79 CMP AL,'c
' ; single character
81 CMP AL,'s
' ; offset string
83 CMP AL,'S
' ; segmented string
130 Procedure FMTGetArg,NEAR
136 Procedure FmtSOut,NEAR
145 ; MOut - output a message via INT 29h
146 ; Inputs: BX points to bytes to output relative to CS
148 ; Registers modified: BX
150 ASSUME DS:NOTHING,SS:NOTHING,ES:NOTHING
157 RestoreReg <AX,SI,DS>
162 ; MNum - output a number in BX
163 ; Inputs: BX contains a number
164 ; Outputs: number in hex appears on screen
165 ; Registers modified: BX
168 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
170 SaveReg <ES,DI,AX,BX,CX,SI,DS>
174 MOV DI,SP ; p = MNumBuf;
176 MOV CX,4 ; for (i=0; i < 4; i++)
178 MOV CX,4 ; rotate(n, 4);
187 Nok: STOSB ; *p++ = "0123456789ABCDEF"[n];
194 CALL FMTSOUT ; mout (mNumBuf);
196 RestoreReg <DS,SI,CX,BX,AX,DI,ES>