我用纯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