assemblyvideographicsx86-16dosbox

Switch text mode to video mode in assembly


I have a project I am doing in assembly. I am making a kahoot style quiz game in x86 assembly, running it in DOSBox.
I made the entire thing with no graphics but I need to make it with graphics so I created a screen of the place I want to display the question but i can't switch from video mode to text mode and keep my video mode.

Does anyone have any ideas to what I can do?
I am trying to keep it as simple as possible.

I tried moving screens and printing but it didn't work.


Solution

  • i can't switch from video mode to text mode and keep my video mode

    You don't have to switch from graphic mode to the text mode in order to write a text. BIOS can use the built-in English fonts in graphic modes, too:

    yali PROGRAM Format=com
         MOV AX,0x0013     ; Graphic mode 320*200 and text 40*25.
         INT 0x10          ; Set graphic videomode.
         MOV SI,Question   ; Text string to write.
         CLD               ; Ascending.
         SUB BX,BX         ; BH=videopage number.
         MOV DH,5          ; Row.
         MOV DL,4          ; Starting column of the text.
         MOV CX,1          ; How many times to write each character.
    Next:MOV AH,0x02       ; Function SET CURSOR POSITION.
         INT 0x10          ; Set cursor position DH,DL.
         LODSB             ; Get a next character to AL.
         CMP AL,0          ; Text end of text. 
         JE End            ; End of string.
         MOV AH,0x0A       ; Function WRITE CHARACTER.
         MOV BX,0x0007     ; BH=Videopage number,BL=color.
         INT 0x10          ; Write character.
         INC DL            ; The next column.
         JMP Next
    End: RET
    Question  DB "My question:",0    
         ENDPROGRAM