Question for the dos EGA 0E mode port programming

26 views Asked by At

I have a function call DrawPixel5, reverse engineered from dos debug.exe. It's a game code snipset, worked at EGA 640*200 mode (AL=0E), I know it should draw a pixel in A000:[di]. I want to re-write this function by using INT 10 instead of directly operating EGA controller and sequencer registers. So, what's the final pixel color I should draw?

Thanks!

DrawPixel5 proc near

mov ax, 0A000h

            mov     es, ax
            xchg    bx, dx
            mov     dx, 3C5h       
            mov     al, 1
            out     dx, al          
            mov     dx, 3CFh
            shr     al, 1
            out     dx, al         
            xchg    bx, dx
            mov     ah, es:[di]
            and     ah, 0F0h
            mov     al, dl
            and     al, 0Fh
            or      al, ah
            mov     es:[di], al
            xchg    bx, dx

            mov     dx, 3C5h
            mov     al, 4
            out     dx, al         
            mov     dx, 3CFh
            shr     al, 1
            out     dx, al          
            xchg    bx, dx
            mov     ah, es:[di]
            and     ah, 0F0h        
            mov     al, dl
            shr     al, 1
            shr     al, 1
            shr     al, 1
            shr     al, 1
            and     al, 0Fh
            or      al, ah
            mov     es:[di], al
            xchg    bx, dx

            mov     dx, 3C5h
            mov     al, 2
            out     dx, al         
            mov     dx, 3CFh
            shr     al, 1
            out     dx, al          
            xchg    bx, dx
            mov     ah, es:[di]
            and     ah, 0F0h
            mov     al, dh
            and     al, 0Fh
            or      al, ah
            mov     es:[di], al

            ret

DrawPixel5 endp

I have no knowledge on ega card port operation/

0

There are 0 answers