与dos相比,全屏模式下颜色不一样

Colors are not the same in fullscreen mode compared in dos

我想在汇编中使用全屏模式。我在 DOS 中将颜色设置为浅蓝色,但每当我尝试将其与我的全屏模式结合使用时,颜色都会发生变化。它变成绿色之类的东西。

有没有办法让它们相互兼容。我正在使用 Tasm;文本板; windows。谢谢

这是我的宏

drawSquare MACRO color,cy,cx,dy,dx
    mov ah,06
    mov al, 0
    mov bh,color
    mov ch,cy
    mov cl,cx
    mov dh,dy
    mov dl,dx
    int 10h
endm
-------------------------------------------------
include macros.txt
.model small
.stack
.data  
    saveMode db ?

.code
main proc
    mov ax, @data
    mov ds, ax

    call SetVideoMode

    drawSquare 90h, 0h, 49h, 18h, 4fh

    call RestoreVideoMode

    mov ax, 4c00h
    int 21h
main endp
SetVideoMode proc
    mov ah, 0fh
    int 10h
    mov saveMode, al


    mov ah, 0
    mov al, 13h
    int 10h

    push 0A000h
    pop es
    ret
SetVideoMode endp
RestoreVideoMode proc
    mov ah, 10h
    int 16h

    mov ah, 0
    mov al, saveMode
    int 10h
    ret
RestoreVideoMode endp
end main

您设置了256色视频模式13h。稍后你用颜色 90h 画一个盒子。
这与 DOS 屏幕(文本模式)的颜色不匹配,因为只有前 16 个颜色数字匹配!

如果您的 DOS 屏幕使用 BLUE=1,那么 select 颜色 1 作为您宏调用的第一个参数。
如果您的 DOS 屏幕使用 GREEN=2,那么 select 颜色 2 作为您的宏调用的第一个参数。