public  _gm56
;様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様�
Horizontal_Total                        = 00095;00095
Horizontal_Display_End                  = 00079;00079
Start_Horizontal_Blanking               = 00080;00080
End_Horizontal_Blanking                 = 00034;00000
Start_Horizontal_Retrace                = 00084;00084
End_Horizontal_Retrace                  = 00000;00000

Vertical_Total                          = 00559;00540;00541;00447;00541
Vertical_Display_End                    = 00399;00399;00399;00399;00431
Start_Vertical_Blanking                 = 00407;00443;00400;00406;00439
End_Vertical_Blanking                   = 00039;00021;00001;00185;00029
Start_Vertical_Retrace                  = 00465;00461;00454;00412;00482
End_Vertical_Retrace                    = 00010;00014;00000;00014;00014

Line_Compare                            = 01023
Display_Enable_Skew                     = 00000
Horizontal_Retrace_Delay                = 00000

Byte_Panning                            = 00000
Preset_Row_Scan                         = 00000
Maximum_Scan_Line                       = 00001
Start_Address                           = 00000
Offset_Register                         = 00040

Two_2_Four                              = 00000
Bandwidth                               = 00000
Count_By_Four                           = 00000
Double_Word_Mode                        = 00000
Hardware_Reset                          = 00001
Word_Byte_Mode                          = 00001
Address_Wrap                            = 00001
Count_By_Two                            = 00000
Horizontal_Retrace_Select               = 00000
Select_Row_Scan_Counter                 = 00001
Compatibility_Mode_Support              = 00001

gm56regs:
DataByte = (End_Vertical_Retrace AND 1111b)
DataByte = DataByte + ((Bandwidth AND 1) SHL 6)
                db      11h, DataByte
                db      00h, Horizontal_Total
                db      01h, Horizontal_Display_End
                db      02h, Start_Horizontal_Blanking
DataByte = End_Horizontal_Blanking AND 11111b
DataByte = DataByte + ((Display_Enable_Skew AND 11b) SHL 5)
DataByte = DataByte + 128
                db      03h, DataByte
                db      04h, Start_Horizontal_Retrace
DataByte = End_Horizontal_Retrace AND 11111b
DataByte = DataByte + ((Horizontal_Retrace_Delay AND 11b) SHL 5)
DataByte = DataByte + ((End_Horizontal_Blanking AND 100000b) SHL 2)
                db      05h, DataByte
                db      06h, (Vertical_Total AND 255)
DataByte = ((Start_Vertical_Retrace AND 512) SHR 2) + ((Start_Vertical_Retrace AND 256) SHR 6)
DataByte = DataByte + ((Vertical_Display_End AND 512) SHR 3) + ((Vertical_Display_End AND 256) SHR 7)
DataByte = DataByte + ((Vertical_Total AND 512) SHR 4) + ((Vertical_Total AND 256) SHR 8)
DataByte = DataByte + ((Line_Compare AND 256) SHR 4)
DataByte = DataByte + ((Start_Vertical_Blanking AND 256) SHR 5)
                db      07h, DataByte
DataByte = (Preset_Row_Scan AND 11111b)
DataByte = DataByte + ((Byte_Panning) SHL 5)
                db      08h, DataByte
DataByte = (Maximum_Scan_Line AND 11111b)
DataByte = DataByte + ((Start_Vertical_Blanking AND 512) SHR 4)
DataByte = DataByte + ((Line_Compare AND 512) SHR 3)
DataByte = DataByte + ((Two_2_Four AND 1) SHL 7)
                db      09h, DataByte
                db      0Ch, (Start_Address SHR 8)
                db      0Dh, (Start_Address AND 255)
                db      10h, (Start_Vertical_Retrace AND 255)
                db      12h, (Vertical_Display_End AND 255)
                db      13h, Offset_Register
DataByte = ((Count_By_Four AND 1) SHL 5)
DataByte = DataByte + ((Double_Word_Mode AND 1) SHL 6)
                db      14h, DataByte
                db      15h, (Start_Vertical_Blanking AND 255)
                db      16h, (End_Vertical_Blanking AND 255)
DataByte = ((Hardware_Reset AND 1) SHL 7)
DataByte = DataByte + ((Word_Byte_Mode AND 1) SHL 6)
DataByte = DataByte + ((Address_Wrap AND 1) SHL 5)
DataByte = DataByte + ((Count_By_Two AND 1) SHL 3)
DataByte = DataByte + ((Horizontal_Retrace_Select AND 1) SHL 2)
DataByte = DataByte + ((Select_Row_Scan_Counter AND 1) SHL 1)
DataByte = DataByte + (Compatibility_Mode_Support AND 1)
                db      17h, DataByte
                db      18h, (Line_Compare AND 255)

;旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭�
; Init 56Hz tweaked mode at 320x200
;旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭旭�
_gm56:
        push ax ecx dx esi
        mov al,10h
        mov v86r_ax,12h
        int 33h
        mov v86r_ax,13h
        int 33h
        mov dx,3c4h
        mov ax,00604h
        out dx,ax
        mov al,2
        out dx,al
        mov dl,0ceh
        mov ax,04005h
        out dx,ax
        mov dl,0d4h
        mov ax,00014h
        out dx,ax
        mov ax,0e317h
        out dx,ax
        mov dx,3d4h
        mov esi,offset gm56regs
        mov ecx,21
        rep outsw
        pop esi ecx dx ax
        ret

