当前位置: 代码迷 >> 汇编语言 >> dos 下用MASM5怎么直接写屏
  详细解决方案

dos 下用MASM5怎么直接写屏

热度:6099   发布时间:2013-02-26 00:00:00.0
dos 下用MASM5如何直接写屏
我用纯DOS+MASM5作为练习环境,请问在源代码中如何直接写屏?
定义了一个2个元素的结构,代表显存中的字符字节与属性字节,
然后在ES段中预留了80*25个这样的结构,代表屏幕,请问如何办?
如何使它映射到B800:0000H的地址去?



------解决方案--------------------------------------------------------
assume cs:code
data segment
db "welcome to masm!",0
data ends
code segment
start:
mov ax,cs
mov ds,ax
mov si,offset no7c
mov ax,0
mov es,ax
mov di,200h
mov cx,offset no7cend-offset no7c
cld
rep movsb
mov word ptr es:[7ch*4],200h
mov word ptr es:[7ch*4+2],0
mov dh,10
mov dl,10
mov cl,2
mov ax,data
mov ds,ax
mov si,0
int 7ch
mov ax,4c00h
int 21h
no7c: push ax
push bx
push di
mov bx,0b800h
mov es,bx
mov al,160d
mul dh
mov di,ax
mov al,2
mul dl
add di,ax
mov bl,cl
again: mov cx,[si]
jcxz no7cret
mov es:[di],cl
mov es:[di+1],bl
inc si
add di,2
jmp short again
no7cret: pop di
pop bx
pop ax
iret
no7cend: nop
code ends
end start
  相关解决方案