Reply 1280 of 1280, by rasz_pl
- Rank
- l33t++
Darmok wrote on 2026-11-02, 06:46:Many SVGA cards feature an automatic detection mechanism that determines the ISA bus bit-width upon computer startup.
I was hesitant of this claim so grabbed first random VGA bios - Paradise PVGA1 https://theretroweb.com/expansioncards/s/west … paradise-vga-16 and disassembled it as best I could (never did video bioses before so its not great compared to pc bioses) with datasheet in hand https://theretroweb.com/chip/documentation/19 … 53475369434.pdf and indeed
PR1 • MEMORY SIZE REGISTER· READIWRITE PORT =3CF & INDEX REGISTER=OB
bit 2 controls Video ram bus width and is initialized to 0 on reset 😮 Yay Im learning something new here! 😀
Bios does a funny dance and song of copying a routine (changing BIOS chip 8/16b bus width and that bit 2) into its own video memory to call it safely from there. I havent backtracked to the part where it decides if its safe to do this yet.
All in all im not happy about decompiling this bios. I didnt really learn conclusively how it handles turning 16b mem bus yet, but I learned that Paradise had messy coders 😐 and that theretroweb 24KB bios dump is not complete. Option rom header defines size as 30h x 512 = 24KB, and theretroweb dump is indeed 24KB, but code itself refers to addresses way past it! This dump https://theretroweb.com/expansioncards/s/west … ise-vga-plus-16 has whole 32KB rom and is complete. Oh I hate sloppy coding. Like when setting DAC it tests if its in mono to mix colors ... and then calls special method that again tests if its in mono to mix colors. Or how it will pretend to do CGA snow fix on a chipset that doesnt require it ... but only if its connected to BW monitor for some reason. Tons of redundant routines copying half the code of neighboring routines. Someone even made a typo on a special Paradise unlocking IO 0x46E8 port and code references non existent 0x4AE8 instead 😮 - 'A' instead of '6', looks like OCR/reading datasheet without glasses error!
Reading this BIOS actually upset me 🙁
TLDR: I learned at least Paradise PVGA1A chip does indeed start in 8b mode, but not how it decides if its safe to switch into 16b yet.
Darmok wrote on 2026-11-02, 06:46:During the VGA BIOS initialization process, the BIOS code checks for the presence of an MDA or Hercules adapter
I really wanted to debunk this one, alas:
01DB Legacy_adapter_detect_initialize proc near01DB mov cx, 101DE push cx01DF mov dx, IO_Port_3CCh_VGA_Misc_Output_read01E2 call IO_read_AL01E5 and al, not (IO_Port_3CCh_VGA_Misc_b0_CRTC_CGA_3Dx)01E7 mov dl, 0C2h01E9 call IO_write_AL01EC mov dx, IO_Port_3D4h_CRTC_Index_EGAVGA01EF call CRTC_Cursor_Addr_L_readback_test01F2 jnz short set_color_CRTC_test_MDA01F4 call MONOCHROME_flag_set01F7 call MONOCHROME_flag_toggle01FA mov ax, BDA_49h_mode_3_80x25_Color_Text01FD jmp short set_mode01FF ; ---------------------------------------------------------------------------01FF01FF set_color_CRTC_test_MDA:01FF mov dx, IO_Port_3CCh_VGA_Misc_Output_read0202 call IO_read_AL0205 or al, IO_Port_3CCh_VGA_Misc_b0_CRTC_CGA_3Dx0207 mov dl, 0C2h0209 call IO_write_AL020C mov dx, IO_Port_3B4h_CRTC_Index_Mono020F call CRTC_Cursor_Addr_L_readback_test0212 jnz short end0214 call MONOCHROME_flag_set0217 mov ax, BDA_49h_mode_7_80x25_MDA_Text021A021A set_mode:021A and byte ptr ds:BDA_89h_VGA_flags_1, not (BDA_89h_VGA_flags1_b0_Active)021F int 42h ; - EGA/VGA/PS - Relocated (original INT 10h)0221 call MONOCHROME_flag_toggle02240224 end:0224 pop cx0225 retn0225 Legacy_adapter_detect_initialize endp
this (all names my guesses) is executed very early on and does indeed try to check if there is another CGA/MDA card in the system. The way I read it is
- if it detects CGA concurrently plugged in PVGA will switch itself into MDA mode 😮 and initialize CGA mode 3.
- if it detects MDA it will initialize it in mode 7.
Fascinating!
https://github.com/raszpl/sigrok-disk FM/MFM/RLL decoder
https://github.com/raszpl/FIC-486-GAC-2-Cache-Module (AT&T Globalyst)
https://github.com/raszpl/386RC-16 ram board
https://github.com/raszpl/Zenith_ZBIOS Zenith Z-386 MFM-300 ZBIOS disassembly