📄 de.asm
字号:
pagenum equ 20h
bufferline equ 8h
buffercol equ 0ah
buffercol2 equ 3eh
inputline equ 6h
inputcol equ 06h
KEY_UP equ 4800h
KEY_DOWN equ 5000h
KEY_LEFT equ 4b00h
KEY_RIGHT equ 4d00h
KEY_PageUp equ 4900h
KEY_PageDown equ 5100h
code segment
assume cs:code,ds:code
start: jmp go
buffer db 100h dup(?)
db 100h dup(?)
state db 0h
regch db 0
regcl db 1
regdh db 0
regdl db 0
regposition db 0h
bufferposition db 00h
lastposition dw ?
lastattrib db 1fh
hextable db '0','1','2','3','4','5','6','7'
db '8','9','A','B','C','D','E','F'
caption db 'CH: CL: DH: DL: ',0
ASCTOHEX proc near
push si
push cx
push bx
push ax
xchg ah,al
cmp ah,'a'
jc asctohex_skip
sub ah,20h
asctohex_skip:
lea si,hextable
mov cx,10h
asctohex_next:
lodsb
cmp ah,al
jz asctohex_bingo
loop asctohex_next
stc
pop ax
jmp asctohex_over
asctohex_bingo:
mov al,10h
sub al,cl
clc
pop bx
xchg ah,bh
asctohex_over:
pop bx
pop cx
pop si
ret
ASCTOHEX endp
LOCATECURSOR proc near
push ax
push bx
push cx
push dx
mov dx,lastposition
call setcursor
mov ah,8
xor bh,bh
int 10h
mov bl,lastattrib
mov cx,1
call dispcharx
mov al,state
test al,80h
jz locatecursor_inbuffer
mov dx,inputline*100h+inputcol
mov al,regposition
shr al,1
mov bl,6
mul bl
add dl,al
mov al,regposition
test al,1h
jz locatecursor_skip_2
inc dl
locatecursor_skip_2:
call setcursor
jmp locatecursor_over
locatecursor_inbuffer:
mov dh,bufferline
test al,40h
jz locatecursor_hex
mov dl,buffercol2
mov bx,101h
jmp locatecursor_skip_1
locatecursor_hex:
mov dl,buffercol
mov bx,302h
locatecursor_skip_1:
mov al,bufferposition
mov cl,4
shr al,cl
add dh,al
mov al,bufferposition
and al,0fh
mul bh
add dl,al
mov al,bufferposition
test al,08h
jz locatecursor_skip_4
add dl,bl
locatecursor_skip_4:
mov al,state
test al,1
jz locatecursor_skip_3
test al,40h
jnz locatecursor_skip_3
inc dl
locatecursor_skip_3:
call setcursor
locatecursor_over:
mov lastposition,dx
mov ah,8
xor bh,bh
int 10h
mov lastattrib,ah
mov bl,1fh
mov cx,1
call dispcharx
pop dx
pop cx
pop bx
pop ax
ret
LOCATECURSOR endp
SETCURSOR proc near
push ax
push bx
mov ah,2
xor bh,bh
int 10h
pop bx
pop ax
ret
SETCURSOR endp
GETCURSOR proc near
push ax
push bx
mov ah,3
xor bh,bh
int 10h
pop bx
pop ax
ret
GETCURSOR endp
DISPCHAR proc near
push ax
push bx
push cx
mov ah,9
xor bh,bh
int 10h
pop cx
pop bx
pop ax
ret
DISPCHAR endp
DISPCHARX proc near ; display chars in the appointed position
push ax ; and the appointed attribute.
push bx
push cx
push dx
call setcursor
call dispchar
pop dx
pop cx
pop bx
pop ax
ret
DISPCHARX endp
SHOWBAR proc near
push ax
push bx
push cx
push dx
push si
mov bl,1fh ; attribute.
mov al,' ' ; set the backcolor.
mov cx,80*25
mov dx,0
call dispcharx
mov al,201 ; display '
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -