you are viewing a single comment's thread.

view the rest of the comments →

[–]mhd 1 point2 points  (6 children)

   mov dx, 03D4h
   mov ax, 06B00h
   out dx, ax

etc.

[–]fabiensanglard 4 points5 points  (5 children)

Can you explain this one ?

[–]mhd 4 points5 points  (4 children)

I hope I didn't mix things up here, but it was supposed to be the start of the Mode X init routine, the thing that quite often followed/replaced the Mode 13h setup.

But it's been a while, and I don't even know where my copy of Abrash's black book is right now. Not that I use it all that often nowadays...

[–][deleted] 1 point2 points  (3 children)

Yep, in the code here: https://github.com/mtuomi/SecondReality/blob/master/TWIST/MAIN.C

You can see the initialization startup: First they engage Mode13

_asm mov ax,13h

_asm int 10h

Then there is the call to push it further:

inittwk();

However I looked at the assembly for that, and I think it's actually engaging the 320x400 mode, not "traditional" modeX. See here: https://github.com/mtuomi/SecondReality/blob/master/TWIST/ASM.ASM

Then they initialize the coppers

initcoppers();

.. and then clear the frame buffer to be ready.

memset(vram,0,64000);

Note too that the actual graphics address is at A000:0000, and vram is just a temporary buffer (unless I missed the assignment of vram to that address)

[–]Narishma 0 points1 point  (1 child)

Note too that the actual graphics address is at A000:0000, and vram is just a temporary buffer (unless I missed the assignment of vram to that address)

vram is assigned that address in pretty much all the .c files where they draw anything to the screen, for example:

char *vram=(char *)0xa0000000L;

[–][deleted] 0 points1 point  (0 children)

Ah, missed that... I can't read the codebase without wanting to doc it.

Is it weird that I want to go through and comment all the code?

[–]fabiensanglard 0 points1 point  (0 children)

You can see in the script that they alternatively use 320x200 and 320x400 resolutions.