Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

How to detect the text mode? (Developers)

posted by tkchia Homepage, 15.11.2020, 08:01

Hello Laaca, hello Japheth,

> > So the question is, how to easily distinguish between text mode and
> graphic
> > mode.

> If the graphics card is VGA compatible, there are at least 2 options:
> 1. graphics controller, port 3CEh, index 6: if bit 0=1, graphics mode
> active
> 2. attribute controller, port 3C0h, index 10h: if bit 0=1, graphics mode.

Is there anything that will also work with MDA or CGA graphics cards? :-)

I think a good way to test specifically whether one can directly peek and poke 0xb800:0 or 0xb000:0, etc., would be to query the mode number. To do this, what my libi86 project currently does is to call int 0x10, ax = 0x4f03, and if that fails, fall back on int 0x10, ah = 0x0f.

I expect that most if not all tweaked 80×__ modes will have a mode number of 0x0003, except with differing numbers of text rows.

(To spot for text modes in general, for my libi86, I currently use bit 1 of 0x40:0x65 (see Ralf Brown's Interrupt List). I am not sure how reliable that is though.)

Thank you!

---
https://gitlab.com/tkchia · https://codeberg.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI"

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 227 users online (0 registered, 227 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum