Untitled
unknown
assembly_x86
3 years ago
1.4 kB
11
Indexable
.model tiny
.486
.data
filen db "monc2.txt", 0
handle dw ?
char db ?
buf db 765 dup (' ')
attr db ?
prev db ?
row db 0
col db 1
cnt dw 764
.code
.startup
mov ah, 01h ;al = 08h for input without echo
int 21h
mov char, al
mov ah, 01h ;al = 08h for input without echo
int 21h
cmp al, char
je xe
and al, 0fh
mov cl, 4
rol al, cl
and char, 0fh
or al, char
or al, 00001000b
mov attr, al
mov ah, 3dh
mov al, 2h
lea dx, filen
int 21h
mov handle, ax
mov ah, 42h
mov al, 0
mov bx, handle
mov cx, 0
mov dx, 0
int 21h
mov ah, 3fh
mov bx, handle
mov cx, 765
lea dx, buf
int 21h
mov ah, 0fh
int 10h
mov prev, al
mov ah, 00h
mov al, 03h ;put display mode in al
int 10h
mov cnt, 765
lea si, buf
x2: mov al, [si]
inc si
mov ah, 09h
mov bh, 0;page number
mov bl, attr;attribute
mov cx, 1;number of times to write the character, moving 13*80 (in disp mode 3) will fill upper 13 rows (0-12)
int 10h
mov ah, 02h
mov dh, row ;row
mov dl, col ;column
mov bh, 0 ;this is page unmber, usually 0
int 10h
inc col
cmp col, 79
je x3
dec cnt
jnz x2
jmp x4
x3: mov col, 0
inc row
cmp row, 24
je x4
dec cnt
jnz x2
x4:
mov ah, 07h
x1: int 21h
cmp al, '?'
jnz x1
mov ah, 00h
mov al, prev;put display mode in al
int 10h
xe:
.exit
endEditor is loading...