, , -, - , , - puts, printf. -, , , Borland cprintf, cputs .. - DOS, , .
, -, . - :
void myputc(char ch) {
union REGS in, out;
in.h.ah = 2;
in.h.dl = ch;
intdos(&in, &out);
}
void myputs(char huge *s) {
while (*s) {
if (*s == '\n')
myputc('\r');
myputc(*s++);
}
}
, :
; Again: not tested and I haven't done this in a while, so use with care.
;
.model large, c
.code
LF = 10
CR = 13
putc proc
mov dl, al
mov ah, 2
int 21h
ret
putc endp
puts proc string: ptr char
mov si, string
lodsb
next:
cmp al, LF
jnz printit
mov dl, CR
mov ah, 2
int 21h
printit:
mov dl, al
mov ah, 2
int 21h
lodsb
test al, al
jnz next
ret
puts endp
end
source
share