; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
; add your code here
mov ax, cs
mov ds, ax
mov ss, ax
mov sp, stack + 256 - 1
mov si, 0
push 0x105e
call write_bin
pop ax
call write_space2
push 0x0002
push 0x78fd
call write_num
pop ax
pop ax
call write_space2
push 0x0008
push 0x78fd
call write_num
pop ax
pop ax
call write_space2
push 0x000A
push 0x78fd
call write_num
pop ax
pop ax
call write_space2
push 0x0010
push 0x78fd
call write_num
pop ax
pop ax
ret
write_space2:
mov cx, 2
loop_write_char:
call write_space
loop loop_write_char
ret
write_space:
push 0x0000
call write_char
pop ax
ret
write_char:
push ax
push bx
push cx
push dx
mov bp, sp
mov ah, 0x0e
mov bx, ss:[bp+10] ; parameter 1
mov al, bl
mov bx, 0x000c
int 0x10
pop dx
pop cx
pop bx
pop ax
ret
write_bin:
mov bp, sp
mov ax, ss:[bp+2] ; parameter 1
mov cx, 16
s:
xor dx, dx
rcl ax, 1
adc dl, 0x30
push dx
call write_char
pop dx
loop s
ret
write_num:
mov bp, sp
mov ax, ss:[bp+2] ; parameter 1
mov bx, ss:[bp+4] ; parameter 2
mov cx, 0
loop_num_div:
mov dx, 0
div bx
push dx
inc cx
cmp ax, 0
jne loop_num_div
loop_num_disp:
pop dx
add dl, 0x30
cmp dl, 0x3A
jl disp_char
add dl, 0x07
disp_char:
push dx
call write_char
pop dx
loop loop_num_disp
ret
stack:
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
end_flag: db 0x11