|

楼主 |
发表于 2014-9-19 12:31:00
|
显示全部楼层
- assume cs:code,ds:date,ss:stack
- date segment
- dw 0,0
- date ends
- stack segment
- dw 128 dup(0)
- stack ends
- code segment
- start:
- mov ax,date
- mov ds,ax
- mov ax,stack
- mov ss,ax
- mov sp,128
-
- mov ax,0
- mov es,ax
-
- push es:[9*4]
- pop ds:[0]
- push es:[9*4+2]
- pop ds:[2]
-
-
- mov word ptr es:[9*4],offset int9
- mov word ptr es:[9*4+2],cx
-
- mov ax,0b800h
- mov es,ax
- mov ah,'a'
-
- s: mov es:[160*12+40*2],ah
- inc ah
-
-
- call stop
-
- cmp ah,'z'
- jna s
-
-
-
- mov ax,0
- mov es,ax
-
- push ds:[0]
- pop es:[9*4]
- push ds:[2]
- pop es:[9*4+2]
-
-
-
- mov ax,4c00h
- int 21h
-
-
- stop: push ax
- push bx
-
- mov bx,2000h
- mov ax,0
-
- s1: sub ax,1
- sbb bx,0
- cmp ax,0
-
- jne s1
- cmp bx,0
- jne s1
-
- pop bx
- pop ax
-
- ret
-
-
- int9:
- push ax
- push es
- push bx
- in al,60h
-
- pushf
-
- pushf
- pop bx
- and bh,11111100b
- push bx
- popf
-
- call dword ptr ds:[0]
-
-
- cmp al,1
- jne ok
-
- mov ax,0b800h
- mov es,ax
- inc byte ptr es:[160*12+40*2+1]
-
-
-
- ok: pop bx
- pop es
- pop ax
-
- iret
-
-
-
-
-
- code ends
- end start
-
-
-
复制代码 |
|