Posted on 2014-12-18 17:10
jacky_zz 阅读(546)
评论(0) 编辑 收藏 引用 所属分类:
ASM
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
jmp start
data:
dw 32 dup(0)
stack:
dw 256 dup(0)
start:
; add your code here
mov ax, cs
mov ds, ax
mov bx, data
mov ss, ax
mov sp, stack+31
push 0x0001
push 0x0002
push 0x0003
call test_proc
hlt
test_proc:
push bp
mov bp, sp
mov ax, [bp+8]
push ax
call write_char
mov ax, [bp+6]
push ax
call write_char
mov ax, [bp+4]
push ax
call write_char
pop bp
ret 6
write_char:
push bp
mov bp, sp
mov ax, [bp+4]
mov dl, al
add dl, 0x30
cmp dl, 0x3a
jl printit
add dl, 0x07
printit:
mov ah, 0x02
int 0x21
pop bp
ret 2