Files
BRC/draw_out.asm

89 lines
1.8 KiB
NASM

; draw_out — область вывода ответа
draw_out:
push eax ebx ecx edx esi edi ebp
mov eax, 13
mov ebx, (OX shl 16) or OW
mov ecx, (OY shl 16) or OH
mov edx, CE_BG
int 0x40
mov eax, 38
mov edx, CE_BOR
mov ebx, (OX shl 16) or (OX+OW)
mov ecx, (OY shl 16) or OY
int 0x40
mov ecx, ((OY+OH) shl 16) or (OY+OH)
int 0x40
mov ebx, (OX shl 16) or OX
mov ecx, (OY shl 16) or (OY+OH)
int 0x40
mov ebx, ((OX+OW) shl 16) or (OX+OW)
int 0x40
cmp byte [outBuf], 0
je .done
mov esi, outBuf
mov ebp, OY + 5
.line:
cmp byte [esi], 0
je .done
mov eax, ebp
cmp eax, OY + OH - 14
jge .done
mov edi, lineBuf
mov ecx, 254
.copy:
dec ecx
jz .copy_end
mov al, [esi]
test al, al
jz .copy_end
cmp al, 13
je .copy_end
cmp al, 10
je .copy_end
mov [edi], al
inc esi
inc edi
jmp .copy
.copy_end:
mov byte [edi], 0
cmp byte [lineBuf], 0
je .skip
mov eax, 4
mov ebx, (OX+5) shl 16
add ebx, ebp
mov ecx, CT_BLACK
mov edx, lineBuf
call txt_draw
.skip:
cmp byte [esi], 0
je .done
cmp byte [esi], 13
jne .ck10
inc esi
cmp byte [esi], 10
jne .next
inc esi
jmp .next
.ck10:
cmp byte [esi], 10
jne .next
inc esi
.next:
add ebp, 13
jmp .line
.done:
pop ebp edi esi edx ecx ebx eax
ret