;curfntsv.asm
;Сохраняет текущий шрифт в файле
.model tiny
.code
.386
org 100h
h = 16
start:
mov ax, 12h
int 10h
mov cx, 256
lpc:
push cx
inc byte ptr k
call putchar
xor ax, ax
mov word ptr y, ax
new_y:
mov word ptr x, ax
mov byte ptr b, al
new_x:
call getpixel
test al, al
je next_b
mov cl, byte ptr x
mov bl, 128
shr bl, cl
or byte ptr b, bl
inc byte ptr color
mov ax, word ptr x
mov word ptr xx, ax
mov ax, word ptr y
mov word ptr yy, ax
call putpixel
dec byte ptr color
mov ax, word ptr x0
add word ptr xx, ax
mov ax, word ptr y0
add word ptr yy, ax
call putpixel
next_b:
movzx ax, byte ptr k
mov cl, h
mul cl
mov bx, word ptr y
add bx, ax
mov al, byte ptr b
mov byte ptr buffer[bx], al
xor ax, ax
inc byte ptr x
cmp byte ptr x, 8
jne new_x
inc byte ptr y
cmp byte ptr y, h
jne new_y
add word ptr x0, 10
cmp word ptr x0, 620
jnge nextloop
mov word ptr x0, 0
add word ptr y0, 20
nextloop:
pop cx
dec cx
jz its_all
jmp lpc
its_all:
mov ah, 5Bh
mov cx, 000100000b
mov dx, offset filename
int 21h
jc exitprg
push ax
mov bx, ax
mov ah, 40h
mov cx, h*256
mov dx, offset buffer
int 21h
pop bx
mov ah, 3Eh
int 21h
exitprg:
xor ax, ax
int 16h
mov ax, 3h
int 10h
ret
putchar proc near
mov ah, 0Ah
mov al, byte ptr k
xor bh, bh
mov cx, 1
int 10h
ret
putchar endp
putpixel proc near
mov ah, 0Ch
xor bh, bh
mov dx, word ptr yy
mov cx, word ptr xx
mov al, byte ptr Color
int 10h
ret
putpixel endp
getpixel proc near
mov ah, 0Dh
xor bh, bh
mov dx, word ptr y
mov cx, word ptr x
int 10h
ret
getpixel endp
filename db "curfont.fnt", 0
x0 dw 0
y0 dw 20
k db -1
color db -1
x dw ?
y dw ?
xx dw ?
yy dw ?
b db ?
buffer:
end start