22' https://pdos.csail.mit.edu/6.828/2007/readings/hardware/vgadoc/VGABIOS.TXT
33' http://stanislavs.org/helppc/ports.html
44
5- Imports System.Runtime.InteropServices
6-
75Public MustInherit Class VGAAdapter
86 Inherits CGAAdapter
97
@@ -626,7 +624,7 @@ Public MustInherit Class VGAAdapter
626624 mCPU.TryAttachHook( &H10 , New X8086.IntHandler( Function () As Boolean
627625 Select Case mCPU.Registers.AH
628626 Case &H0
629- VideoMode = mCPU.Registers.AL
627+ VideoMode = mCPU.Registers.AL And &H7F
630628 VGA_SC( 4 ) = 0
631629 Return useROM ' When using ROM, prevent the BIOS from handling this function
632630 Case &H10
@@ -647,7 +645,7 @@ Public MustInherit Class VGAAdapter
647645 Case &H1A
648646 mCPU.Registers.AL = &H1A ' http://stanislavs.org/helppc/int_10-1a.html
649647 mCPU.Registers.BL = &H8
650- Return True
648+ Return False
651649 End Select
652650
653651 Return False
@@ -752,11 +750,11 @@ Public MustInherit Class VGAAdapter
752750 portRAM( &H3D9 ) = 0
753751 End If
754752
755- Case 6 ' 640x200 2 Colors
753+ Case 6 ' 640x400 2 Colors
756754 mStartTextVideoAddress = &HB8000
757755 mStartGraphicsVideoAddress = &HB8000
758756 mTextResolution = New Size( 80 , 25 )
759- mVideoResolution = New Size( 640 , 200 )
757+ mVideoResolution = New Size( 640 , 400 )
760758 mCellSize = New Size( 8 , 8 )
761759 mMainMode = MainModes.Graphics
762760 mPixelsPerByte = 2
@@ -784,11 +782,11 @@ Public MustInherit Class VGAAdapter
784782 mUseVRAM = False
785783 portRAM( &H3D8 ) = portRAM( &H3D8 ) And &HFE
786784
787- Case &HD ' 320x200 16 Colors
785+ Case &HD ' 640x400 16 Colors
788786 mStartTextVideoAddress = &HA0000
789787 mStartGraphicsVideoAddress = &HA0000
790788 mTextResolution = New Size( 40 , 25 )
791- mVideoResolution = New Size( 320 , 200 )
789+ mVideoResolution = New Size( 640 , 400 )
792790 mCellSize = New Size( 8 , 8 )
793791 mMainMode = MainModes.Graphics
794792 mPixelsPerByte = 4
@@ -815,7 +813,7 @@ Public MustInherit Class VGAAdapter
815813 mPixelsPerByte = 4
816814 mUseVRAM = True
817815
818- Case &H12
816+ Case &H12 ' 640x480 16-color
819817 mStartTextVideoAddress = &HA0000
820818 mStartGraphicsVideoAddress = &HA0000
821819 mTextResolution = New Size( 80 , 30 )
@@ -826,7 +824,7 @@ Public MustInherit Class VGAAdapter
826824 mUseVRAM = True
827825 portRAM( &H3D8 ) = portRAM( &H3D8 ) And &HFE
828826
829- Case &H13
827+ Case &H13 ' 320x200 256-color
830828 mStartTextVideoAddress = &HA0000
831829 mStartGraphicsVideoAddress = &HA0000
832830 mTextResolution = New Size( 40 , 25 )
@@ -952,11 +950,13 @@ Public MustInherit Class VGAAdapter
952950 Dim cv As UInt32 = value And &H3F
953951 Select Case latchWriteRGB
954952 Case 0 ' R
955- tmpRGB = cv << 18
953+ tmpRGB = cv << 2
956954 Case 1 ' G
957955 tmpRGB = tmpRGB Or (cv << 10 )
958956 Case 2 ' B
959- vgaPalette(latchWritePal) = Color.FromArgb(tmpRGB Or (cv << 2 ))
957+ tmpRGB = tmpRGB Or (cv << 18 )
958+ vgaPalette(latchWritePal) = Color.FromArgb(tmpRGB)
959+ vgaPalette(latchWritePal) = Color.FromArgb( 255 , vgaPalette(latchWritePal))
960960 latchWritePal += 1
961961 End Select
962962 latchWriteRGB = (latchWriteRGB + 1 ) Mod 3
@@ -975,12 +975,9 @@ Public MustInherit Class VGAAdapter
975975 Case &H3CF
976976 VGA_GC(portRAM( &H3CE )) = value
977977
978- 'Case &H3B8
979- ' portRAM(port) = value
980- ' MyBase.Out(port, value)
981-
982978 Case Else
983979 portRAM(port) = value
980+ MyBase .Out(port, value)
984981
985982 End Select
986983 End Sub
0 commit comments