Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 汇编x86-菜单';s的颜色在传输页面时消失_Assembly - Fatal编程技术网

Assembly 汇编x86-菜单';s的颜色在传输页面时消失

Assembly 汇编x86-菜单';s的颜色在传输页面时消失,assembly,Assembly,这是我代码的一部分: start: mov ax,@data mov ds,ax ;Set graphics mode 320x200 & 256 colors mov ax,13h int 10h mov al,00h mov ah,0 int 10h mov ah,09h mov bl, 0c3h ; 3 = light blue , c = lightning (for unknown

这是我代码的一部分:

start:
    mov ax,@data
    mov ds,ax

    ;Set graphics mode 320x200 & 256 colors
     mov ax,13h
     int 10h

     mov al,00h
     mov ah,0
     int 10h
     mov ah,09h
     mov bl, 0c3h ; 3 = light blue , c = lightning (for unknown reason) & red line
     mov cx, 40   ; numbers of characters to color
     int 10h
     mov dx, offset menu    
     int 21h    
    ;set cursor location(dh,dl) (I'm hiding the cursor)
     mov dl, 16  ; column. 
     mov dh, 30  ; row. 
     mov ah, 02h
     int 10h         
     call Beep  
    jmp start   
我在末尾添加了jmp start,就是为了让你们意识到,即使我跳到开头,即使没有转移到另一页,颜色仍然消失,光标位置也没有设置到我告诉他的位置,但菜单显示出来了,我做错了什么


注意:在我再次跳回到起始位置之前,颜色和光标位置正在工作。

首先移除
jmp start
,并将其替换为
mov ah、0
int 16h
。这将给你一个机会,让你真正看到屏幕上的内容

mov ax,13h
int 10h

mov al,00h
mov ah,0
int 10h
在这段代码中,您将屏幕设置了2次!第二次也是最后一次,它被设置为40列25行的16色文本屏幕


您使用的BIOS“写入字符和属性”功能的参数太少。您还应该定义:

mov al, " "  ;Space character
mov bh, 0    ;Display page 0
mov bl, 0C3h ;This chooses a cyan foreground on a red background

第一个
int10h
调用将图形模式设置为模式13h(320x200&256色),但第二个调用将其设置为模式
00h
,这是CGA/EGA上的灰度。看见
mov al, " "  ;Space character
mov bh, 0    ;Display page 0
mov bl, 0C3h ;This chooses a cyan foreground on a red background