I have read How to write directly to video memory using "debug.exe" in MS-DOS? and I know how to write text to video memory in mode 0x3 but I can't figure out how to write text to video memory in mode 0x13. First let me show how I write text in mode 0x3.
All steps given below are reproducible at https://copy.sh/v86/?profile=msdos.
C:\>debug
-a
1165:0100 mov ax, b800 ; video memory address
1165:0103 mov ds, ax ; copy video memory address to ds
1165:0105 xor di, di ; zero di
1165:0107 mov ah, f ; bright white color
1165:0109 mov al, 41 ; the letter 'A'
1165:010B mov [di], ax ; copy letter and color to video memory
1165:010D int 20
1165:010F
-g
Program terminated normally
-
The above debug session prints A
in bright white color in the first row first column of the screen.
C:\>debug
-a
1165:0100 mov ah, 0 ; select 'set video mode' function of int 10
1165:0102 mov al, 13 ; select video mode 0x13
1165:0104 int 10 ; set the video mode now
1165:0106 mov ax, b800 ; THIS IS PROBABLY WRONG! NEED HELP WITH THIS.
1165:0109 mov ds, ax ; copy the address to ds
1165:010B xor di, di ; zero di
1165:010D mov ah, f ; bright white color
1165:010F mov al, 41 ; the letter 'A'
1165:0111 mov [di], ax ; copy letter and color to video memory
1165:0113 int 20
1165:0115
-g
After I execute g
, mode 0x13 with 320x200 resolution is displayed and the following output is displayed.
Program terminated normally
-
But there is no text output. Is it possible to write text output by writing ASCII codes to some video memory address in mode 0x13?
Now I continue in this mode to run INT 10
(AH = F
) to get current video state.
-a
1165:0115 mov ah, f
1165:0117 int 10
1165:0119 int 20
-g =115 119
AX=2813 BX=0000 CX=0000 DX=0000 SP=F
FEE BP=0000 SI=0000 DI=0000
DS=1165 ES=1165 SS=1165 CS=1165 IP=0
119 NV UP EI PL NZ NA PO NC
1165:0119 CD20
The value 28 (hex) in AH tells that there are 40 screen columns which is correct. Yes, there are 40 columns of text in mode 13. You can see evidence of this in the above debug session output too where the output wraps after 40 columns (see SP=FFEE
wrapped into two lines).
The value 13 (hex) in AL tells that we are in mode 0x13.
So this video mode does acknowledge that it is possible to write 40 columns of text per row but how do we write that text? Is there some video memory address for mode 0x13 where I can write the ASCII codes to make the text output appear?
10h
function11h
where the user can define the character bitmapped fonts.a000
, notb800
, like said in the question's code comment.