o cleanup
This commit is contained in:
935
tools/zsnes/src/dos/dosintrf.asm
Normal file
935
tools/zsnes/src/dos/dosintrf.asm
Normal file
@@ -0,0 +1,935 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM selcA000,selcB800,selc0040,previdmode,DosExit,
|
||||
EXTSYM V8Mode,getblaster,Force8b,SBHDMA
|
||||
EXTSYM oldhand9s,oldhand9o,interror,oldhand8s,oldhand8o,oldhandSBs,oldhandSBo
|
||||
EXTSYM NoSoundReinit,soundon,DSPDisable,SBInt,PICMaskP,SBIrq,SBHandler,InitSB
|
||||
EXTSYM handler8h,handler9h,init60hz,Interror,init18_2hz,DeInitSPC,GUIinit36_4hz
|
||||
EXTSYM GUIoldhand9s,GUIoldhand9o,GUIoldhand8s,GUIoldhand8o,GUIhandler9h
|
||||
EXTSYM GUIhandler8h,GUIinit18_2hz,dosinitvideo
|
||||
EXTSYM DosDrawScreen,cvidmode,vidbuffer,GUICPC,DosDrawScreenB
|
||||
EXTSYM DosUpdateDevices,DOSJoyRead,pl1contrl,pl2contrl,pl3contrl,pl4contrl
|
||||
EXTSYM pl5contrl,GrayscaleMode
|
||||
EXTSYM pl1upk,pl1downk,pl1leftk,pl1rightk,pl1startk,pl1selk
|
||||
EXTSYM pl1Ak,pl1Bk,pl1Xk,pl1Yk,pl1Lk,pl1Rk
|
||||
EXTSYM pl2upk,pl2downk,pl2leftk,pl2rightk,pl2startk,pl2selk
|
||||
EXTSYM pl2Ak,pl2Bk,pl2Xk,pl2Yk,pl2Lk,pl2Rk
|
||||
EXTSYM pl3upk,pl3downk,pl3leftk,pl3rightk,pl3startk,pl3selk
|
||||
EXTSYM pl3Ak,pl3Bk,pl3Xk,pl3Yk,pl3Lk,pl3Rk
|
||||
EXTSYM pl4upk,pl4downk,pl4leftk,pl4rightk,pl4startk,pl4selk
|
||||
EXTSYM pl4Ak,pl4Bk,pl4Xk,pl4Yk,pl4Lk,pl4Rk
|
||||
EXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5startk,pl5selk
|
||||
EXTSYM pl5Ak,pl5Bk,pl5Xk,pl5Yk,pl5Lk,pl5Rk
|
||||
|
||||
; NOTE: For timing, Game60hzcall should be called at 50hz or 60hz (depending
|
||||
; on romispal) after a call to InitPreGame and before DeInitPostGame are
|
||||
; made. GUI36hzcall should be called at 36hz after a call GUIInit and
|
||||
; before GUIDeInit.
|
||||
|
||||
SECTION .data
|
||||
NEWSYM dssel, dw 0
|
||||
SECTION .text
|
||||
|
||||
NEWSYM StartUp
|
||||
mov ax,901h ;enable interrupts
|
||||
int 31h
|
||||
mov ax,ds
|
||||
mov [dssel],ax
|
||||
mov bx,0A000h
|
||||
call findselec
|
||||
mov [selcA000],ax
|
||||
mov bx,0B800h
|
||||
call findselec
|
||||
mov [selcB800],ax
|
||||
mov bx,0040h
|
||||
call findselec
|
||||
mov [selc0040],ax
|
||||
; get previous video mode
|
||||
xor ecx,ecx
|
||||
push es
|
||||
mov ax,[selc0040]
|
||||
mov es,ax
|
||||
mov al,[es:49h]
|
||||
mov [previdmode],al
|
||||
pop es
|
||||
|
||||
; Get base address
|
||||
mov ax,ds
|
||||
mov bx,ax
|
||||
mov eax,0006h
|
||||
int 31h
|
||||
jc .FatalError
|
||||
mov [ZSNESBase+2],cx ; These variables are used for
|
||||
mov [ZSNESBase],dx ; memory allocation so they can be
|
||||
.FatalError ; ignored for non-DOS ports
|
||||
ret
|
||||
|
||||
; SystemInit - Initialize all Joystick stuff, load in all configuration data,
|
||||
; parse commandline data, obtain current directory (One time initialization)
|
||||
NEWSYM SystemInit
|
||||
; Be sure to set SBHDMA to a value other than 0 if 16bit sound exists
|
||||
push es
|
||||
|
||||
call getblaster ; get set blaster environment
|
||||
cmp byte[Force8b],1
|
||||
jne .noforce8b
|
||||
mov byte[SBHDMA],0
|
||||
.noforce8b
|
||||
pop es
|
||||
ret
|
||||
|
||||
; Find Selector - DOS only
|
||||
findselec:
|
||||
mov ax, 2
|
||||
int 31h
|
||||
jnc .proceed
|
||||
mov edx, .noselector
|
||||
call PrintStr
|
||||
jmp DosExit
|
||||
.proceed
|
||||
ret
|
||||
SECTION .data
|
||||
.noselector db 'Cannot find selector!',10,13,0
|
||||
SECTION .text
|
||||
|
||||
NEWSYM PrintChar
|
||||
; print character at dl, push all modified registers
|
||||
push eax
|
||||
mov ah,02h
|
||||
int 21h
|
||||
pop eax
|
||||
ret
|
||||
|
||||
NEWSYM PrintStr ; Print ASCIIZ string
|
||||
.next
|
||||
mov al,[edx]
|
||||
or al,al
|
||||
jz .finish
|
||||
push edx
|
||||
mov dl,al
|
||||
mov ah,02h
|
||||
int 21h
|
||||
pop edx
|
||||
inc edx
|
||||
jmp .next
|
||||
.finish
|
||||
ret
|
||||
|
||||
NEWSYM WaitForKey ; Wait for a key to be pressed
|
||||
mov ah,7
|
||||
int 21h
|
||||
; return key in al
|
||||
ret
|
||||
|
||||
%macro PressConv 3
|
||||
cmp byte[pressed+%1],0
|
||||
je %%nopr
|
||||
test byte[prval],%2
|
||||
jnz %%prskip
|
||||
or byte[prval],%2
|
||||
mov byte[prres],%3
|
||||
; mov al,0FFh
|
||||
jmp .done
|
||||
jmp %%prskip
|
||||
%%nopr
|
||||
and byte[prval],%2^0FFh
|
||||
%%prskip
|
||||
%endmacro
|
||||
|
||||
NEWSYM Check_Key
|
||||
; xor al,al
|
||||
; PressConv 75,01h,75
|
||||
; PressConv 77,02h,77
|
||||
; PressConv 80,04h,80
|
||||
; PressConv 72,08h,72
|
||||
; PressConv 1,80h,27
|
||||
;.done
|
||||
; ret
|
||||
; returns 0 if there are no keys in the keyboard buffer, 0xFF otherwise
|
||||
mov ah,0Bh
|
||||
int 21h
|
||||
ret
|
||||
|
||||
NEWSYM Get_Key
|
||||
; mov al,[prres]
|
||||
; ret
|
||||
; wait if there are no keys in buffer, then return key in al
|
||||
; for extended keys, return a 0, then the extended key afterwards
|
||||
mov ah,07h
|
||||
int 21h
|
||||
ret
|
||||
|
||||
NEWSYM Get_Memfree
|
||||
mov ax,0500h
|
||||
mov edi,edx
|
||||
int 31h
|
||||
ret
|
||||
|
||||
NEWSYM Output_Text ; Output character (ah=02h) or string (ah=09h)
|
||||
; This function usually displays an error message on-screen
|
||||
cmp ah,02h
|
||||
je .char
|
||||
cmp ah,09h
|
||||
je .string
|
||||
ret
|
||||
.char
|
||||
int 21h ; print dl
|
||||
ret
|
||||
.string
|
||||
pushad
|
||||
call PrintStr ; print edx
|
||||
popad
|
||||
ret
|
||||
|
||||
; Delay for CX/65536 of a second
|
||||
|
||||
NEWSYM delay
|
||||
in al,61h
|
||||
and al,10h
|
||||
mov ah,al
|
||||
.loopa
|
||||
in al,61h
|
||||
and al,10h
|
||||
cmp al,ah
|
||||
jz .loopa
|
||||
mov ah,al
|
||||
dec cx
|
||||
jnz .loopa
|
||||
ret
|
||||
|
||||
NEWSYM InitPreGame ; Executes before starting/continuing a game
|
||||
; set up interrupt handler
|
||||
; get old handler pmode mode address
|
||||
; Process stuff such as sound init, interrupt initialization
|
||||
cli
|
||||
mov ax,204h
|
||||
mov bl,09h
|
||||
int 31h
|
||||
jc near interror
|
||||
mov [oldhand9s],cx
|
||||
mov [oldhand9o],edx
|
||||
mov ax,204h
|
||||
mov bl,08h
|
||||
int 31h
|
||||
jc near interror
|
||||
mov [oldhand8s],cx
|
||||
mov [oldhand8o],edx
|
||||
|
||||
mov al,[GrayscaleMode]
|
||||
cmp al,[V8Mode]
|
||||
je .nochangemode
|
||||
xor byte[V8Mode],1
|
||||
xor al,al
|
||||
.nochangemode
|
||||
|
||||
.nofs
|
||||
cmp byte[NoSoundReinit],1
|
||||
je .nosound
|
||||
cmp byte[soundon],0
|
||||
je .nosound
|
||||
cmp byte[DSPDisable],1
|
||||
je .nosound
|
||||
mov ax,204h
|
||||
mov bl,[SBInt]
|
||||
int 31h
|
||||
jc near Interror
|
||||
mov [oldhandSBs],cx
|
||||
mov [oldhandSBo],edx
|
||||
.nosound
|
||||
sti
|
||||
ret
|
||||
|
||||
NEWSYM SetupPreGame ; Executes after pre-game init, can execute multiple
|
||||
; times after a single InitPreGame
|
||||
; set new handler
|
||||
cmp byte[soundon],0
|
||||
je near .nosound2
|
||||
cmp byte[DSPDisable],1
|
||||
je near .nosound2
|
||||
|
||||
; Turn off IRQ through controller
|
||||
cli
|
||||
xor dh,dh
|
||||
mov dl,[PICMaskP]
|
||||
mov cl,[SBIrq]
|
||||
and cl,07h
|
||||
mov al,01h
|
||||
shl al,cl
|
||||
mov bl,al
|
||||
in al,dx
|
||||
or al,bl
|
||||
out dx,al
|
||||
|
||||
mov ax,205h
|
||||
mov bl,[SBInt]
|
||||
mov cx,cs
|
||||
mov edx,SBHandler
|
||||
int 31h
|
||||
jc near interror
|
||||
|
||||
; Turn on IRQ through controller
|
||||
xor dh,dh
|
||||
mov dl,[PICMaskP]
|
||||
mov cl,[SBIrq]
|
||||
and cl,07h
|
||||
mov al,01h
|
||||
shl al,cl
|
||||
not al
|
||||
mov bl,al
|
||||
in al,dx
|
||||
and al,bl
|
||||
out dx,al
|
||||
|
||||
call InitSB
|
||||
sti
|
||||
.nosound2
|
||||
cli
|
||||
mov ax,205h
|
||||
mov bl,09h
|
||||
mov cx,cs ; Requires CS rather than DS
|
||||
mov edx,handler9h
|
||||
int 31h
|
||||
jc near interror
|
||||
|
||||
mov ax,205h
|
||||
mov bl,08h
|
||||
mov cx,cs ; Requires CS rather than DS
|
||||
mov edx,handler8h
|
||||
int 31h
|
||||
jc near interror
|
||||
call init60hz ; Set timer to 60/50Hz
|
||||
.nofs2
|
||||
sti
|
||||
ret
|
||||
|
||||
NEWSYM DeInitPostGame ; Called after game is ended
|
||||
; de-init interrupt handler
|
||||
cli
|
||||
mov cx,[oldhand9s]
|
||||
mov edx,[oldhand9o]
|
||||
mov ax,205h
|
||||
mov bl,09h
|
||||
int 31h
|
||||
jc near interror
|
||||
|
||||
mov cx,[oldhand8s]
|
||||
mov edx,[oldhand8o]
|
||||
mov ax,205h
|
||||
mov bl,08h
|
||||
int 31h
|
||||
jc near interror
|
||||
call init18_2hz ; Set timer to 18.2Hz
|
||||
.nofs3
|
||||
sti
|
||||
|
||||
; DeINITSPC
|
||||
cmp byte[soundon],0
|
||||
je .nosoundb
|
||||
cmp byte[DSPDisable],1
|
||||
je .nosoundb
|
||||
call DeInitSPC
|
||||
mov cx,[oldhandSBs]
|
||||
mov edx,[oldhandSBo]
|
||||
mov ax,205h
|
||||
mov bl,[SBInt]
|
||||
int 31h
|
||||
jc near interror
|
||||
.nosoundb
|
||||
ret
|
||||
|
||||
NEWSYM GUIInit
|
||||
mov ax,204h
|
||||
mov bl,09h
|
||||
int 31h
|
||||
mov [GUIoldhand9s],cx
|
||||
mov [GUIoldhand9o],edx
|
||||
mov ax,204h
|
||||
mov bl,08h
|
||||
int 31h
|
||||
mov [GUIoldhand8s],cx
|
||||
mov [GUIoldhand8o],edx
|
||||
mov ax,205h
|
||||
mov bl,09h
|
||||
mov cx,cs
|
||||
mov edx,GUIhandler9h
|
||||
int 31h
|
||||
mov ax,205h
|
||||
mov bl,08h
|
||||
mov cx,cs
|
||||
mov edx,GUIhandler8h
|
||||
int 31h
|
||||
call GUIinit36_4hz
|
||||
ret
|
||||
|
||||
NEWSYM GUIDeInit
|
||||
mov cx,[GUIoldhand9s]
|
||||
mov edx,[GUIoldhand9o]
|
||||
mov ax,205h
|
||||
mov bl,09h
|
||||
int 31h
|
||||
mov cx,[GUIoldhand8s]
|
||||
mov edx,[GUIoldhand8o]
|
||||
mov ax,205h
|
||||
mov bl,08h
|
||||
int 31h
|
||||
call GUIinit18_2hz
|
||||
ret
|
||||
|
||||
; ****************************
|
||||
; Video Stuff
|
||||
; ****************************
|
||||
|
||||
; ** Palette Functions **
|
||||
NEWSYM displayfpspal
|
||||
mov al,128
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,63
|
||||
out dx,al
|
||||
out dx,al
|
||||
out dx,al
|
||||
mov al,128+64
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,0
|
||||
out dx,al
|
||||
out dx,al
|
||||
out dx,al
|
||||
ret
|
||||
NEWSYM superscopepal
|
||||
mov al,128+16
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,63
|
||||
out dx,al
|
||||
xor al,al
|
||||
out dx,al
|
||||
out dx,al
|
||||
ret
|
||||
NEWSYM saveselectpal
|
||||
; set palette of colors 128,144, and 160 to white, blue, and red
|
||||
mov al,128
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,63
|
||||
out dx,al
|
||||
out dx,al
|
||||
out dx,al
|
||||
mov al,144
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
xor al,al
|
||||
out dx,al
|
||||
out dx,al
|
||||
mov al,50
|
||||
out dx,al
|
||||
mov al,160
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,45
|
||||
out dx,al
|
||||
xor al,al
|
||||
out dx,al
|
||||
out dx,al
|
||||
mov al,176
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,47
|
||||
out dx,al
|
||||
xor al,al
|
||||
out dx,al
|
||||
out dx,al
|
||||
mov al,208
|
||||
mov dx,03C8h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,50
|
||||
out dx,al
|
||||
mov al,25
|
||||
out dx,al
|
||||
xor al,al
|
||||
out dx,al
|
||||
ret
|
||||
|
||||
; ** init video mode functions **
|
||||
NEWSYM initvideo ; Returns 1 in videotroub if trouble occurs
|
||||
jmp dosinitvideo
|
||||
|
||||
NEWSYM deinitvideo
|
||||
mov al,[previdmode]
|
||||
mov ah,0
|
||||
int 10h
|
||||
ret
|
||||
|
||||
; ** copy video mode functions **
|
||||
NEWSYM DrawScreen ; In-game screen render w/ triple buffer check
|
||||
jmp DosDrawScreen
|
||||
|
||||
NEWSYM vidpastecopyscr ; GUI screen render
|
||||
; jmp dosvidpastecopyscr
|
||||
pushad
|
||||
movzx eax,byte[cvidmode]
|
||||
cmp byte[GUI16VID+eax],1
|
||||
jne .no16bconv
|
||||
mov eax,[vidbuffer]
|
||||
mov ecx,224*288
|
||||
mov edx,ecx
|
||||
sub ecx,288
|
||||
dec edx
|
||||
.loop
|
||||
movzx ebx,byte[eax+edx]
|
||||
mov bx,[GUICPC+ebx*2]
|
||||
mov [eax+edx*2],bx
|
||||
dec edx
|
||||
dec ecx
|
||||
jnz .loop
|
||||
.no16bconv
|
||||
popad
|
||||
jmp DosDrawScreenB
|
||||
|
||||
; ** Video Mode Variables **
|
||||
SECTION .data
|
||||
|
||||
; Total Number of Video Modes
|
||||
NEWSYM NumVideoModes, dd 19
|
||||
|
||||
; GUI Video Mode Names - Make sure that all names are of the same length
|
||||
; and end with a NULL terminator
|
||||
NEWSYM GUIVideoModeNames
|
||||
db '256x224x8B MODEQ',0 ; 0
|
||||
db '256x240x8B MODEQ',0 ; 1
|
||||
db '256x256x8B MODEQ',0 ; 2
|
||||
db '320x224x8B MODEX',0 ; 3
|
||||
db '320x240x8B MODEX',0 ; 4
|
||||
db '320x256x8B MODEX',0 ; 5
|
||||
db '640x480x16B VESA1',0 ; 6
|
||||
db '320x240x8B VESA2',0 ; 7
|
||||
db '320x240x16B VESA2',0 ; 8
|
||||
db '320x480x8B VESA2',0 ; 9
|
||||
db '320x480x16B VESA2',0 ; 10
|
||||
db '512x384x8B VESA2',0 ; 11
|
||||
db '512x384x16B VESA2',0 ; 12
|
||||
db '640x400x8B VESA2',0 ; 13
|
||||
db '640x400x16B VESA2',0 ; 14
|
||||
db '640x480x8B VESA2',0 ; 15
|
||||
db '640x480x16B VESA2',0 ; 16
|
||||
db '800x600x8B VESA2',0 ; 17
|
||||
db '800x600x16B VESA2',0 ; 18
|
||||
|
||||
; Video Mode Feature Availability (1 = Available, 0 = Not Available)
|
||||
; Left side starts with Video Mode 0
|
||||
; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
|
||||
NEWSYM GUI16VID, db 0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1 ; 16-bit mode
|
||||
NEWSYM GUISLVID, db 0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,1,1 ; Scanlines
|
||||
NEWSYM GUIHSVID, db 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0 ; Half/Quarter Scanlines
|
||||
NEWSYM GUII2VID, db 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1 ; DOS Interpolation
|
||||
NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 ; DOS Eagle
|
||||
NEWSYM GUITBVID, db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1 ; DOS Triple Buffering
|
||||
NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0 ; DOS Fullscreen
|
||||
NEWSYM GUIWSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0 ; DOS Widescreen
|
||||
NEWSYM GUISSVID, db 0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1 ; DOS Smallscreen
|
||||
NEWSYM GUI2xVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 ; 2xSaI/Super Engines
|
||||
NEWSYM GUIM7VID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 ; Hires Mode 7
|
||||
NEWSYM GUIHQ2X, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Hq2x Filter)
|
||||
NEWSYM GUINTVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (NTSC Filter)
|
||||
|
||||
SECTION .text
|
||||
|
||||
; ****************************
|
||||
; Input Device Stuff
|
||||
; ****************************
|
||||
|
||||
; Variables related to Input Device Routines:
|
||||
; pl1selk,pl1startk,pl1upk,pl1downk,pl1leftk,pl1rightk,pl1Xk,
|
||||
; pl1Ak,pl1Lk,pl1Yk,pl1Bk,pl1Rk
|
||||
; (Change 1 to 2,3,4 for other players)
|
||||
; Each of these variables contains the corresponding key pressed value
|
||||
; for the key data
|
||||
; pressed[]
|
||||
; - This is an array of pressed/released data (bytes) where the
|
||||
; corresponding key pressed value is used as the index. The value
|
||||
; for each entry is 0 for released and 1 for pressed. Also, when
|
||||
; writing keyboard data to this array, be sure to first check if
|
||||
; the value of the array entry is 2 or not. If it is 2, do not write 1
|
||||
; to that array entry. (however, you can write 0 to it)
|
||||
; As an example, to access Player 1 L button press data, it is
|
||||
; done like : pressed[pl1Lk]
|
||||
; The 3 character key description of that array entry is accessed by the
|
||||
; GUI through ScanCodeListing[pl1Lk*3]
|
||||
|
||||
; Note: When storing the input device configuration of a dynamic input
|
||||
; device system (ie. Win9x) rather than a static system (ie. Dos), it
|
||||
; is best to store in the name of the device and relative button
|
||||
; assignments in the configuration file, then convert it to ZSNES'
|
||||
; numerical corresponding key format after reading from it. And then
|
||||
; convert it back when writing to it back.
|
||||
|
||||
NEWSYM UpdateDevices ; One-time input device init
|
||||
call DosUpdateDevices
|
||||
ret
|
||||
|
||||
NEWSYM JoyRead
|
||||
call DOSJoyRead
|
||||
ret
|
||||
|
||||
%macro SetDefaultKey2 13
|
||||
mov dword[%1upk],%4 ; Up
|
||||
mov dword[%1downk],%5 ; Down
|
||||
mov dword[%1leftk],%6 ; Left
|
||||
mov dword[%1rightk],%7 ; Right
|
||||
mov dword[%1startk],%3 ; Start
|
||||
mov dword[%1selk],%2 ; Select
|
||||
mov dword[%1Ak],%9 ; A
|
||||
mov dword[%1Bk],%12 ; B
|
||||
mov dword[%1Xk],%8 ; X
|
||||
mov dword[%1Yk],%11 ; Y
|
||||
mov dword[%1Lk],%10 ; L
|
||||
mov dword[%1Rk],%13 ; R
|
||||
%endmacro
|
||||
|
||||
%macro SetDefaultKey 12
|
||||
cmp bh,0
|
||||
jne %%nopl1
|
||||
SetDefaultKey2 pl1,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12
|
||||
%%nopl1
|
||||
cmp bh,1
|
||||
jne %%nopl2
|
||||
SetDefaultKey2 pl2,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12
|
||||
%%nopl2
|
||||
cmp bh,2
|
||||
jne %%nopl3
|
||||
SetDefaultKey2 pl3,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12
|
||||
%%nopl3
|
||||
cmp bh,3
|
||||
jne %%nopl4
|
||||
SetDefaultKey2 pl4,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12
|
||||
%%nopl4
|
||||
cmp bh,4
|
||||
jne %%nopl5
|
||||
SetDefaultKey2 pl5,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12
|
||||
%%nopl5
|
||||
%endmacro
|
||||
|
||||
NEWSYM SetInputDevice
|
||||
; bl = device #, bh = player # (0-4)
|
||||
; Sets keys according to input device selected
|
||||
cmp bl,0
|
||||
jne near .nozero
|
||||
SetDefaultKey 0,0,0,0,0,0,0,0,0,0,0,0
|
||||
ret
|
||||
.nozero
|
||||
cmp bl,1
|
||||
jne near .nokeyb
|
||||
cmp bh,1
|
||||
ja near .exit
|
||||
cmp bh,1
|
||||
je near .input2
|
||||
SetDefaultKey 54,28,72,80,75,77,31,45,32,30,44,46
|
||||
ret
|
||||
.input2
|
||||
SetDefaultKey 56,29,36,50,49,51,82,71,73,83,79,81
|
||||
ret
|
||||
.nokeyb
|
||||
cmp bl,2
|
||||
jne near .no2buttons
|
||||
xor bl,bl
|
||||
cmp byte[pl1contrl],2
|
||||
jne .nopl2a
|
||||
inc bl
|
||||
.nopl2a
|
||||
cmp byte[pl2contrl],2
|
||||
jne .nopl2b
|
||||
inc bl
|
||||
.nopl2b
|
||||
cmp byte[pl3contrl],2
|
||||
jne .nopl2c
|
||||
inc bl
|
||||
.nopl2c
|
||||
cmp byte[pl4contrl],2
|
||||
jne .nopl2d
|
||||
inc bl
|
||||
.nopl2d
|
||||
cmp byte[pl5contrl],2
|
||||
jne .nopl2e
|
||||
inc bl
|
||||
.nopl2e
|
||||
cmp bl,2
|
||||
jae .2ndjoyst
|
||||
SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,0,0,0,82h,83h,0
|
||||
ret
|
||||
.2ndjoyst
|
||||
SetDefaultKey 0,0,0E8h,0E9h,0EAh,0EBh,0,0,0,84h,85h,0
|
||||
ret
|
||||
.no2buttons
|
||||
cmp bl,3
|
||||
jne near .no4buttons
|
||||
SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,84h,85h,0,82h,83h,0
|
||||
ret
|
||||
.no4buttons
|
||||
cmp bl,4
|
||||
jne near .no6buttons
|
||||
SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,84h,85h,86h,82h,83h,87h
|
||||
ret
|
||||
.no6buttons
|
||||
cmp bl,5
|
||||
jne near .skip8b
|
||||
SetDefaultKey 081h,080h,0CCh,0CDh,0CEh,0CFh,84h,85h,87h,82h,83h,86h
|
||||
ret
|
||||
.skip8b
|
||||
cmp bl,6
|
||||
jne near .nosw1
|
||||
SetDefaultKey 0C9h,0C8h,0D4h,0D5h,0D6h,0D7h,08Ch,089h,08Eh,08Bh,088h,08Fh
|
||||
ret
|
||||
.nosw1
|
||||
cmp bl,7
|
||||
jne near .nosw2
|
||||
SetDefaultKey 0C9h+8,0C8h+8,0D4h+8,0D5h+8,0D6h+8,0D7h+8,08Ch+8,089h+8,08Eh+8,08Bh+8,088h+8,08Fh+8
|
||||
ret
|
||||
.nosw2
|
||||
cmp bl,8
|
||||
jne near .nosw3
|
||||
SetDefaultKey 0C9h+8*2,0C8h+8*2,0D4h+8*2,0D5h+8*2,0D6h+8*2,0D7h+8*2,08Ch+8*2,089h+8*2,08Eh+8*2,08Bh+8*2,088h+8*2,08Fh+8*2
|
||||
ret
|
||||
.nosw3
|
||||
cmp bl,9
|
||||
jne near .nosw4
|
||||
SetDefaultKey 0C9h+8*3,0C8h+8*3,0D4h+8*3,0D5h+8*3,0D6h+8*3,0D7h+8*3,08Ch+8*3,089h+8*3,08Eh+8*3,08Bh+8*3,088h+8*3,08Fh+8*3
|
||||
ret
|
||||
.nosw4
|
||||
cmp bl,10
|
||||
jne near .nogrip0
|
||||
SetDefaultKey 0CAh,0CBh,0F0h,0F1h,0F2h,0F3h,0A9h,0ABh,0ACh,0A8h,0AAh,0AEh
|
||||
ret
|
||||
.nogrip0
|
||||
cmp bl,11
|
||||
jne near .nogrip1
|
||||
SetDefaultKey 0CAh+8,0CBh+8,0F0h+4,0F1h+4,0F2h+4,0F3h+4,0A9h+8,0ABh+8,0ACh+8,0A8h+8,0AAh+8,0AEh+8
|
||||
ret
|
||||
.nogrip1
|
||||
cmp bl,12
|
||||
jne near .nopp1
|
||||
SetDefaultKey 182h,183h,184h,185h,186h,187h,189h,188h,18Ah,181h,180h,18Bh
|
||||
ret
|
||||
.nopp1
|
||||
cmp bl,13
|
||||
jne near .nopp2
|
||||
SetDefaultKey 192h,193h,194h,195h,196h,197h,199h,198h,19Ah,191h,190h,19Bh
|
||||
ret
|
||||
.nopp2
|
||||
cmp bl,14
|
||||
jne near .nopp3
|
||||
SetDefaultKey 1A2h,1A3h,1A4h,1A5h,1A6h,1A7h,1A9h,1A8h,1AAh,1A1h,1A0h,1ABh
|
||||
ret
|
||||
.nopp3
|
||||
cmp bl,15
|
||||
jne near .nopp4
|
||||
SetDefaultKey 1B2h,1B3h,1B4h,1B5h,1B6h,1B7h,1B9h,1B8h,1BAh,1B1h,1B0h,1BBh
|
||||
ret
|
||||
.nopp4
|
||||
cmp bl,16
|
||||
jne near .nopp5
|
||||
SetDefaultKey 1C2h,1C3h,1C4h,1C5h,1C6h,1C7h,1C9h,1C8h,1CAh,1C1h,1C0h,1CBh
|
||||
ret
|
||||
.nopp5
|
||||
.exit
|
||||
ret
|
||||
|
||||
SECTION .data
|
||||
|
||||
; Total Number of Input Devices
|
||||
NEWSYM NumInputDevices, dd 17
|
||||
|
||||
; Input Device Names
|
||||
NEWSYM GUIInputNames
|
||||
db 'NONE ',0
|
||||
db 'KEYBOARD ',0
|
||||
db '2BUTTONJOYSTICK ',0
|
||||
db '4BUTTONJOYSTICK ',0
|
||||
db '6BUTTONJOYSTICK ',0
|
||||
db '8BUTTONJOYSTICK ',0
|
||||
db 'SIDEWINDERPAD1 ',0
|
||||
db 'SIDEWINDERPAD2 ',0
|
||||
db 'SIDEWINDERPAD3 ',0
|
||||
db 'SIDEWINDERPAD4 ',0
|
||||
db 'GAMEPAD PRO P0 ',0
|
||||
db 'GAMEPAD PRO P1 ',0
|
||||
db 'PARALLEL LPT1 P1',0
|
||||
db 'PARALLEL LPT1 P2',0
|
||||
db 'PARALLEL LPT1 P3',0
|
||||
db 'PARALLEL LPT1 P4',0
|
||||
db 'PARALLEL LPT1 P5',0
|
||||
|
||||
; GUI Description codes for each corresponding key pressed value
|
||||
NEWSYM ScanCodeListing
|
||||
db '---','ESC',' 1 ',' 2 ',' 3 ',' 4 ',' 5 ',' 6 '
|
||||
db ' 7 ',' 8 ',' 9 ',' 0 ',' - ',' = ','BKS','TAB'
|
||||
db ' Q ',' W ',' E ',' R ',' T ',' Y ',' U ',' I '
|
||||
db ' O ',' P ',' [ ',' ] ','RET','CTL',' A ',' S '
|
||||
db ' D ',' F ',' G ',' H ',' J ',' K ',' L ',' : '
|
||||
db ' " ',' ~ ','LSH',' \ ',' Z ',' X ',' C ',' V '
|
||||
db ' B ',' N ',' M ',' , ',' . ',' / ','RSH',' * '
|
||||
db 'ALT','SPC','CAP','F1 ','F2 ','F3 ','F4 ','F5 '
|
||||
db 'F6 ','F7 ','F8 ','F9 ','F10','NUM','SCR','HOM'
|
||||
db 'UP ','PGU',' - ','LFT',' 5 ','RGT',' + ','END'
|
||||
db 'DWN','PGD','INS','DEL',' ',' ',' ','F11'
|
||||
db 'F12',' ',' ',' ',' ',' ',' ',' '
|
||||
db ' ',' ',' ',' ',' ',' ',' ',' '
|
||||
db ' ',' ',' ',' ',' ',' ',' ',' '
|
||||
db ' ',' ',' ',' ',' ',' ',' ',' '
|
||||
db ' ',' ',' ',' ',' ',' ',' ',' '
|
||||
; Joystick Stuff, Port 201h (80h)
|
||||
db 'JB7','JB8','JB1','JB2','JB3','JB4','JB5','JB6'
|
||||
db 'SWA','SWB','SWC','SWX','SWY','SWZ','SWL','SWR'
|
||||
db 'S2A','S2B','S2C','S2X','S2Y','S2Z','S2L','S2R'
|
||||
db 'S3A','S3B','S3C','S3X','S3Y','S3Z','S3L','S3R'
|
||||
db 'S4A','S4B','S4C','S4X','S4Y','S4Z','S4L','S4R'
|
||||
db 'GRR','GRB','GRY','GRG','GL1','GL2','GR1','GR2'
|
||||
db 'G2R','G2B','G2Y','G2G','2L1','2L2','2R1','2R2'
|
||||
db 'G3R','G3B','G3Y','G3G','3L1','3L2','3R1','3R2'
|
||||
db 'G4R','G4B','G4Y','G4G','4L1','4L2','4R1','4R2'
|
||||
db 'SWS','SWM','GSL','GST','JUP','JDN','JLF','JRG'
|
||||
db 'S2S','S2M','2SL','2ST','SWU','SWD','SWL','SWR'
|
||||
db 'S3S','S3M','3SL','3ST','S2U','S2D','S2L','S2R'
|
||||
db 'S4S','S4M','4SL','4ST','S3U','S3D','S3L','S3R'
|
||||
db 'J2U','J2D','J2L','J2R','S4U','S4D','S4L','S4R'
|
||||
db 'GRU','GRD','GRL','GRR','G2U','G2D','G2L','G2R'
|
||||
db 'G3U','G3D','G3L','G3R','G4U','G4D','G4L','G4R'
|
||||
; Joystick Stuff, Port 209h (100h)
|
||||
db 'JB7','JB8','JB1','JB2','JB3','JB4','JB5','JB6'
|
||||
db 'SWA','SWB','SWC','SWX','SWY','SWZ','SWL','SWR'
|
||||
db 'S2A','S2B','S2C','S2X','S2Y','S2Z','S2L','S2R'
|
||||
db 'S3A','S3B','S3C','S3X','S3Y','S3Z','S3L','S3R'
|
||||
db 'S4A','S4B','S4C','S4X','S4Y','S4Z','S4L','S4R'
|
||||
db 'GRR','GRB','GRY','GRG','GL1','GL2','GR1','GR2'
|
||||
db 'G2R','G2B','G2Y','G2G','2L1','2L2','2R1','2R2'
|
||||
db 'G3R','G3B','G3Y','G3G','3L1','3L2','3R1','3R2'
|
||||
db 'G4R','G4B','G4Y','G4G','4L1','4L2','4R1','4R2'
|
||||
db 'SWS','SWM','GSL','GST','JUP','JDN','JLF','JRG'
|
||||
db 'S2S','S2M','2SL','2ST','SWU','SWD','SWL','SWR'
|
||||
db 'S3S','S3M','3SL','3ST','S2U','S2D','S2L','S2R'
|
||||
db 'S4S','S4M','4SL','4ST','S3U','S3D','S3L','S3R'
|
||||
db 'J2U','J2D','J2L','J2R','S4U','S4D','S4L','S4R'
|
||||
db 'GRU','GRD','GRL','GRR','G2U','G2D','G2L','G2R'
|
||||
db 'G3U','G3D','G3L','G3R','G4U','G4D','G4L','G4R'
|
||||
; Extra Stuff (180h) (Parallel Port)
|
||||
db 'PPB','PPY','PSL','PST','PUP','PDN','PLT','PRT'
|
||||
db 'PPA','PPX','PPL','PPR',' ',' ',' ',' '
|
||||
db 'P2B','P2Y','P2S','P2T','P2U','P2D','P2L','P2R'
|
||||
db 'P2A','P2X','P2L','P2R',' ',' ',' ',' '
|
||||
db 'P3B','P3Y','P3S','P3T','P3U','P3D','P3L','P3R'
|
||||
db 'P3A','P3X','P3L','P3R',' ',' ',' ',' '
|
||||
db 'P4B','P4Y','P4S','P4T','P4U','P4D','P4L','P4R'
|
||||
db 'P4A','P4X','P4L','P4R',' ',' ',' ',' '
|
||||
db 'P5B','P5Y','P5S','P5T','P5U','P5D','P5L','P5R'
|
||||
db 'P5A','P5X','P5L','P5R',' ',' ',' ',' '
|
||||
|
||||
SECTION .bss
|
||||
|
||||
NEWSYM ZSNESBase, resd 1
|
||||
TempVarSeek resd 1
|
||||
|
||||
|
||||
SECTION .text
|
||||
|
||||
; ****************************
|
||||
; Mouse Stuff
|
||||
; ****************************
|
||||
|
||||
NEWSYM Init_Mouse
|
||||
; return non-zero if successful
|
||||
mov eax,00h
|
||||
int 33h
|
||||
cmp ax,0
|
||||
je .nomouse
|
||||
mov eax,07h
|
||||
mov ecx,0
|
||||
mov edx,255
|
||||
int 33h
|
||||
mov eax,08h
|
||||
mov ecx,0
|
||||
mov edx,223
|
||||
int 33h
|
||||
mov eax,0Fh
|
||||
mov ecx,8
|
||||
mov edx,8
|
||||
int 33h
|
||||
mov eax,04h
|
||||
mov ecx,0
|
||||
mov edx,0
|
||||
int 33h
|
||||
mov ax,1
|
||||
.nomouse
|
||||
ret
|
||||
|
||||
NEWSYM Get_MouseData ; Returns both pressed and coordinates
|
||||
mov eax,03h
|
||||
int 33h
|
||||
; bx : bit 0 = left button, bit 1 = right button
|
||||
; cx = Mouse X Position, dx = Mouse Y Position
|
||||
ret
|
||||
|
||||
NEWSYM Set_MouseXMax ; Sets the X boundaries (ecx = left, edx = right)
|
||||
mov eax,07h
|
||||
int 33h
|
||||
ret
|
||||
|
||||
NEWSYM Set_MouseYMax ; Sets the Y boundaries (ecx = left, edx = right)
|
||||
mov eax,08h
|
||||
int 33h
|
||||
ret
|
||||
|
||||
NEWSYM Set_MousePosition ; Sets Mouse Position (x:cx,y:dx)
|
||||
mov eax,04h
|
||||
int 33h
|
||||
ret
|
||||
|
||||
NEWSYM Get_MousePositionDisplacement
|
||||
; returns x,y displacement in pixel in cx,dx
|
||||
mov eax,0Bh
|
||||
int 33h
|
||||
ret
|
||||
|
||||
NEWSYM MouseWindow
|
||||
ret
|
||||
|
||||
; ****************************
|
||||
; Sound Stuff
|
||||
; ****************************
|
||||
|
||||
NEWSYM StopSound
|
||||
ret
|
||||
|
||||
NEWSYM StartSound
|
||||
ret
|
||||
|
||||
NEWSYM Check60hz
|
||||
; Call the timer update function here
|
||||
ret
|
||||
159
tools/zsnes/src/dos/gppro.asm
Normal file
159
tools/zsnes/src/dos/gppro.asm
Normal file
@@ -0,0 +1,159 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
section .data
|
||||
sample times 60 db 0
|
||||
clock_mask db 0
|
||||
data_mask db 0
|
||||
|
||||
section .text
|
||||
|
||||
NEWSYM read_gpp
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push edi
|
||||
push esi
|
||||
|
||||
cmp al,0
|
||||
jne GPP_L14
|
||||
mov byte[clock_mask],0x10
|
||||
mov byte[data_mask],0x20
|
||||
jmp GPP_L15
|
||||
GPP_L14:
|
||||
mov byte[clock_mask],0x40
|
||||
mov byte[data_mask],0x80
|
||||
GPP_L15:
|
||||
|
||||
|
||||
xor ebx,ebx
|
||||
xor edi,edi
|
||||
|
||||
cli
|
||||
in al,dx
|
||||
mov ah,al
|
||||
|
||||
GPP_L4:
|
||||
xor ecx,ecx
|
||||
GPP_L0:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
in al,dx
|
||||
cmp al,ah
|
||||
jne GPP_L1
|
||||
inc ecx
|
||||
cmp ecx,255
|
||||
jl GPP_L0
|
||||
GPP_L1:
|
||||
cmp ecx,255
|
||||
je near GPP_ERR
|
||||
|
||||
test [clock_mask],ah
|
||||
jz GPP_L2
|
||||
test [clock_mask],al
|
||||
jnz GPP_L2
|
||||
|
||||
test [data_mask],al
|
||||
jz GPP_L3
|
||||
mov byte[sample+edi],1
|
||||
jmp GPP_L12
|
||||
GPP_L3:
|
||||
mov byte[sample+edi],0
|
||||
GPP_L12:
|
||||
inc edi
|
||||
|
||||
GPP_L2:
|
||||
mov ah,al
|
||||
cmp ebx,200
|
||||
je GPP_L13
|
||||
inc ebx
|
||||
cmp edi,50
|
||||
jl GPP_L4
|
||||
|
||||
GPP_L13:
|
||||
sti
|
||||
xor ecx,ecx
|
||||
mov esi,1
|
||||
GPP_L7:
|
||||
cmp byte[sample+esi],1
|
||||
jg GPP_ERR
|
||||
jne GPP_L6
|
||||
inc ecx
|
||||
jmp GPP_L5
|
||||
GPP_L6:
|
||||
xor ecx,ecx
|
||||
|
||||
GPP_L5:
|
||||
cmp ecx,5
|
||||
je GPP_L8
|
||||
cmp esi,edi
|
||||
je GPP_L8
|
||||
inc esi
|
||||
jmp GPP_L7
|
||||
|
||||
GPP_L8:
|
||||
cmp ecx,5
|
||||
jne GPP_ERR
|
||||
add esi,2
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
|
||||
GPP_L10:
|
||||
inc ecx
|
||||
cmp ecx,5
|
||||
jne GPP_L11
|
||||
mov ecx,1
|
||||
inc esi
|
||||
GPP_L11:
|
||||
mov dl,[sample+esi]
|
||||
or eax,edx
|
||||
shl eax,1
|
||||
cmp ebx,13
|
||||
je GPP_L9
|
||||
inc ebx
|
||||
inc esi
|
||||
jmp GPP_L10
|
||||
|
||||
GPP_L9:
|
||||
pop esi
|
||||
pop edi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
GPP_ERR:
|
||||
sti
|
||||
pop esi
|
||||
pop edi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
mov eax,1
|
||||
ret
|
||||
|
||||
|
||||
551
tools/zsnes/src/dos/initvid.asm
Normal file
551
tools/zsnes/src/dos/initvid.asm
Normal file
@@ -0,0 +1,551 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM InitVesa2,cbitmode,cvidmode,dosmakepal,scanlines,selcA000,vesa2_bits
|
||||
EXTSYM vesa2_x,vesa2_y,vesa2selec,InitVesa12,videotroub,cscopymodeq,cscopymodex
|
||||
EXTSYM res640,res480
|
||||
|
||||
|
||||
SECTION .text
|
||||
NEWSYM initvideo2
|
||||
cmp byte[cvidmode],2
|
||||
jne .nomodeq
|
||||
jmp dosinitvideo.initmodeq256
|
||||
.nomodeq
|
||||
cmp byte[cvidmode],5
|
||||
jne .nomodex
|
||||
jmp dosinitvideo.initmodex256
|
||||
.nomodex
|
||||
|
||||
;*******************************************************
|
||||
; InitVideo
|
||||
;*******************************************************
|
||||
NEWSYM dosinitvideo
|
||||
mov byte[cbitmode],0
|
||||
mov byte[res640],0
|
||||
mov byte[res480],0
|
||||
cmp byte[cvidmode],0
|
||||
je near .initmodeq224
|
||||
cmp byte[cvidmode],1
|
||||
je near .initmodeq240
|
||||
cmp byte[cvidmode],2
|
||||
je near .initmodeq256
|
||||
cmp byte[cvidmode],3
|
||||
je near .initmodex224
|
||||
cmp byte[cvidmode],4
|
||||
je near .initmodex240
|
||||
cmp byte[cvidmode],5
|
||||
je near .initmodex256
|
||||
cmp byte[cvidmode],6
|
||||
je near .initvesa12640x480x16
|
||||
cmp byte[cvidmode],7
|
||||
je near .initvesa2320x240x8
|
||||
cmp byte[cvidmode],8
|
||||
je near .initvesa2320x240x16
|
||||
cmp byte[cvidmode],9
|
||||
je near .initvesa2320x480x8
|
||||
cmp byte[cvidmode],10
|
||||
je near .initvesa2320x480x16
|
||||
cmp byte[cvidmode],11
|
||||
je near .initvesa2512x384x8
|
||||
cmp byte[cvidmode],12
|
||||
je near .initvesa2512x384x16
|
||||
cmp byte[cvidmode],13
|
||||
je near .initvesa2640x400x8
|
||||
cmp byte[cvidmode],14
|
||||
je near .initvesa2640x400x16
|
||||
cmp byte[cvidmode],15
|
||||
je near .initvesa2640x480x8
|
||||
cmp byte[cvidmode],16
|
||||
je near .initvesa2640x480x16
|
||||
cmp byte[cvidmode],17
|
||||
je near .initvesa2800x600x8
|
||||
cmp byte[cvidmode],18
|
||||
je near .initvesa2800x600x16
|
||||
ret
|
||||
|
||||
%include "dos/vga.inc"
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; InitModeQ 224 Sets up 256x224 chained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodeq224
|
||||
SetVGAMode .Mode256x224c
|
||||
call cscopymodeq
|
||||
call dosmakepal
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitModeQ 240 Sets up 256x240 chained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodeq240
|
||||
SetVGAMode .Mode256x240c
|
||||
call cscopymodeq
|
||||
call dosmakepal
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitModeQ 256 Sets up 256x256 chained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodeq256
|
||||
cmp byte[scanlines],1
|
||||
je near .scanlines
|
||||
SetVGAMode .Mode256x256c
|
||||
jmp .done
|
||||
.scanlines
|
||||
SetVGAMode .Mode256x256cs
|
||||
jmp .done
|
||||
.done
|
||||
call cscopymodeq
|
||||
call dosmakepal
|
||||
ret
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; InitModeX 224 Sets up 320x224 unchained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodex224
|
||||
SetVGAMode .Mode320x224
|
||||
call cscopymodex
|
||||
call dosmakepal
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitModeX 240 Sets up 320x240 unchained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodex240
|
||||
SetVGAMode .Mode320x240
|
||||
call cscopymodex
|
||||
call dosmakepal
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitModeX 256 Sets up 320x256 unchained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodex256
|
||||
cmp byte[scanlines],1
|
||||
je near .scanlines2
|
||||
SetVGAMode .Mode320x256
|
||||
jmp .done2
|
||||
.scanlines2
|
||||
SetVGAMode .Mode320x256s
|
||||
jmp .done2
|
||||
.done2
|
||||
call cscopymodex
|
||||
call dosmakepal
|
||||
ret
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x240x8 Set up Linear 320x240x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x240x8
|
||||
mov byte[cbitmode],0
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],240
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble
|
||||
ret
|
||||
.notrouble
|
||||
call dosmakepal
|
||||
; clear screen (320*240 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*240
|
||||
.loop
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loop
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x240x16 Set up Linear 320x240x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x240x16
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],240
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble2
|
||||
ret
|
||||
.notrouble2
|
||||
; clear screen (320*240*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*240*2
|
||||
.loopb
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopb
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 640x480x8 Set up Linear 640x480x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2640x480x8
|
||||
mov byte[res640],1
|
||||
mov byte[res480],1
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble3
|
||||
ret
|
||||
.notrouble3
|
||||
call dosmakepal
|
||||
; clear screen (640*480 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,640*480
|
||||
.loopc3
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopc3
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 640x480x16 Set up Linear 640x480x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2640x480x16
|
||||
mov byte[res640],1
|
||||
mov byte[res480],1
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble4
|
||||
ret
|
||||
.notrouble4
|
||||
; clear screen (640*480*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,640*480*2
|
||||
.loopd3
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopd3
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 800x600x8 Set up Linear 800x600x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2800x600x8
|
||||
mov byte[res640],1
|
||||
mov byte[res480],1
|
||||
mov word[vesa2_x],800
|
||||
mov word[vesa2_y],600
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble11
|
||||
ret
|
||||
.notrouble11
|
||||
call dosmakepal
|
||||
; clear screen (800*600 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,800*600
|
||||
.looph2
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .looph2
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 800x600x16 Set up Linear 800x600x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2800x600x16
|
||||
mov byte[res640],1
|
||||
mov byte[res480],1
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],800
|
||||
mov word[vesa2_y],600
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble12
|
||||
ret
|
||||
.notrouble12
|
||||
; clear screen (800*600*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,800*600*2
|
||||
.looph3
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .looph3
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x480x8 Set up Linear 320x480x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x480x8
|
||||
mov byte[res480],1
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble5
|
||||
ret
|
||||
.notrouble5
|
||||
call dosmakepal
|
||||
; clear screen (320*480 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*480
|
||||
.loopc
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopc
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x480x16 Set up Linear 320x480x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x480x16
|
||||
mov byte[res480],1
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble6
|
||||
ret
|
||||
.notrouble6
|
||||
; clear screen (320*480*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*480*2
|
||||
.loopd
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopd
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 512x384x8 Set up Linear 512x384x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2512x384x8
|
||||
mov byte[res640],2
|
||||
mov byte[cbitmode],0
|
||||
mov word[vesa2_x],512
|
||||
mov word[vesa2_y],384
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble7
|
||||
ret
|
||||
.notrouble7
|
||||
call dosmakepal
|
||||
; clear screen (512*384 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,512*384
|
||||
.loope
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loope
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 512x384x16 Set up Linear 512x384x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2512x384x16
|
||||
mov byte[res640],2
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],512
|
||||
mov word[vesa2_y],384
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble8
|
||||
ret
|
||||
.notrouble8
|
||||
; clear screen (512*384*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,512*384*2
|
||||
.loopf
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopf
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 640x400x8 Set up Linear 640x400x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2640x400x8
|
||||
mov byte[res640],2
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],400
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble9
|
||||
ret
|
||||
.notrouble9
|
||||
call dosmakepal
|
||||
; clear screen (640*400 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,640*400
|
||||
.loopg
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopg
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 640x400x16 Set up Linear 640x400x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2640x400x16
|
||||
mov byte[res640],2
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],400
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble10
|
||||
ret
|
||||
.notrouble10
|
||||
; clear screen (640*400*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,640*400*2
|
||||
.looph
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .looph
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA1.2 640x480x16 Set up 640x480x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa12640x480x16
|
||||
mov byte[res640],1
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa12
|
||||
ret
|
||||
|
||||
; clear screen (640*480*2 bytes)
|
||||
push es
|
||||
mov ax,[selcA000]
|
||||
mov es,ax
|
||||
mov ebx,9
|
||||
xor edx,edx
|
||||
.loopbanks
|
||||
|
||||
xor edi,edi
|
||||
mov ecx,16384
|
||||
.loopi
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopi
|
||||
dec ebx
|
||||
jnz .loopbanks
|
||||
|
||||
mov ecx,6144
|
||||
pop es
|
||||
ret
|
||||
1417
tools/zsnes/src/dos/joy.asm
Normal file
1417
tools/zsnes/src/dos/joy.asm
Normal file
File diff suppressed because it is too large
Load Diff
185
tools/zsnes/src/dos/lib.c
Normal file
185
tools/zsnes/src/dos/lib.c
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
|
||||
http://www.zsnes.com
|
||||
http://sourceforge.net/projects/zsnes
|
||||
https://zsnes.bountysource.com
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <libc/stubs.h>
|
||||
#include <libc/dosio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <go32.h>
|
||||
#include <dpmi.h>
|
||||
#include <dos.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dir.h>
|
||||
|
||||
//C++ style code in C
|
||||
#define bool unsigned char
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define BIT(X) (1 << (X))
|
||||
|
||||
|
||||
//This file contains library functions that can be found on other OSs
|
||||
|
||||
|
||||
//Return realpath in 8.3 or LFN format for any given filename
|
||||
//Based on code from DJGPP website, here was the notice for that code:
|
||||
|
||||
/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
/*
|
||||
* This is file TRUENAME.C
|
||||
*
|
||||
* Copyright (c) 1994, 1995 Eli Zaretskii <eliz@is.elta.co.il>
|
||||
*
|
||||
* This software may be used freely so long as this copyright notice is
|
||||
* left intact. There is no warranty on this software.
|
||||
*
|
||||
*/
|
||||
|
||||
static char *realpath_internal(const char *file, char *buf, bool LFN)
|
||||
{
|
||||
__dpmi_regs regs;
|
||||
unsigned short dos_mem_selector = _dos_ds;
|
||||
unsigned short our_mem_selector = _my_ds();
|
||||
char true_name[FILENAME_MAX];
|
||||
char file_name[FILENAME_MAX], *name_end;
|
||||
|
||||
if (!file || !*file)
|
||||
{
|
||||
errno = EINVAL;
|
||||
buf = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(file_name, file, FILENAME_MAX);
|
||||
file_name[FILENAME_MAX - 1] = 0;
|
||||
|
||||
for (name_end = file_name + strlen(file_name) - 1; name_end >= file_name && isspace((unsigned char)*name_end); )
|
||||
{
|
||||
*name_end-- = 0;
|
||||
}
|
||||
|
||||
if ((strlen(file_name) == 2) && (file_name[1] == ':'))
|
||||
{
|
||||
strcat(name_end, "\\.");
|
||||
}
|
||||
else if ((*name_end == '\\') && (name_end-file_name < FILENAME_MAX-2))
|
||||
{
|
||||
strcat(name_end, ".");
|
||||
}
|
||||
|
||||
_put_path(file_name);
|
||||
|
||||
regs.x.ax = _USE_LFN ? 0x7160 : 0x6000;
|
||||
regs.x.cx = LFN+1;
|
||||
regs.x.ds = regs.x.es = __tb_segment;
|
||||
regs.x.si = __tb_offset;
|
||||
regs.x.di = __tb_offset + FILENAME_MAX;
|
||||
__dpmi_int(0x21, ®s);
|
||||
|
||||
movedata(dos_mem_selector, __tb + FILENAME_MAX, our_mem_selector, (unsigned int)true_name, FILENAME_MAX);
|
||||
|
||||
if (regs.x.flags & 1)
|
||||
{
|
||||
errno = __doserr_to_errno(regs.x.ax);
|
||||
buf = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!buf)
|
||||
{
|
||||
buf = (char *)malloc(strlen(true_name)+1);
|
||||
}
|
||||
|
||||
if (buf)
|
||||
{
|
||||
strcpy(buf, true_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(buf);
|
||||
}
|
||||
|
||||
char *realpath_sfn(const char *file, char *buf)
|
||||
{
|
||||
return(realpath_internal(file, buf, false));
|
||||
}
|
||||
|
||||
char *realpath_lfn(const char *file, char *buf)
|
||||
{
|
||||
return(realpath_internal(file, buf, true));
|
||||
}
|
||||
|
||||
//We tested this with Hard Disks, Floppies, CD/DVD-ROM, Network drives, no issues.
|
||||
//It should also be tested with RAM drives and on more versions of DOS (DR-DOS, MS-DOS 5.0, etc...)
|
||||
static bool _is_drive(unsigned char drive) //A == 1, B == 2, etc...
|
||||
{
|
||||
__dpmi_regs regs;
|
||||
|
||||
regs.x.ax = 0x4409;
|
||||
regs.x.bx = drive;
|
||||
__dpmi_int(0x21, ®s);
|
||||
|
||||
if (regs.x.flags & 1)
|
||||
{
|
||||
errno = __doserr_to_errno(regs.x.ax);
|
||||
}
|
||||
else if (((regs.x.dx & (BIT(9)|BIT(12))) == BIT(12)) || (regs.x.dx == 0x800))
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
regs.x.ax = 0x4408;
|
||||
regs.x.bx = drive;
|
||||
__dpmi_int(0x21, ®s);
|
||||
|
||||
if (regs.x.flags & 1)
|
||||
{
|
||||
errno = __doserr_to_errno(regs.x.ax);
|
||||
return(false);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
//Return bitmask of available drives, A = BIT(0), B = BIT(1), etc...
|
||||
unsigned int GetLogicalDrives()
|
||||
{
|
||||
unsigned int drives = 0;
|
||||
int i;
|
||||
for (i = 0; i < 26; i++)
|
||||
{
|
||||
if (_is_drive(i+1))
|
||||
{
|
||||
drives |= BIT(i);
|
||||
}
|
||||
}
|
||||
return(drives);
|
||||
}
|
||||
35
tools/zsnes/src/dos/lib.h
Normal file
35
tools/zsnes/src/dos/lib.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
|
||||
http://www.zsnes.com
|
||||
http://sourceforge.net/projects/zsnes
|
||||
https://zsnes.bountysource.com
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef LIB_H
|
||||
#define LIB_H
|
||||
|
||||
char *realpath_sfn(const char *file, char *buf);
|
||||
char *realpath_lfn(const char *file, char *buf);
|
||||
|
||||
//Only beta versions of DJGPP currently have this function
|
||||
#if (__DJGPP__ < 3) && (__DJGPP_MINOR__ < 4)
|
||||
#define realpath(path, resolved_path) realpath_sfn(path, resolved_path)
|
||||
#endif
|
||||
|
||||
unsigned int GetLogicalDrives();
|
||||
|
||||
#endif
|
||||
1421
tools/zsnes/src/dos/sound.asm
Normal file
1421
tools/zsnes/src/dos/sound.asm
Normal file
File diff suppressed because it is too large
Load Diff
224
tools/zsnes/src/dos/sw.asm
Normal file
224
tools/zsnes/src/dos/sw.asm
Normal file
@@ -0,0 +1,224 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM SidewinderFix
|
||||
|
||||
%macro ParityCheckSW 1
|
||||
mov ecx,ebx
|
||||
xor cl,ch
|
||||
jpe %%ParChkSW
|
||||
mov [%1],ebx
|
||||
%%ParChkSW:
|
||||
%endmacro
|
||||
|
||||
section .data
|
||||
gDump times 256 db 0
|
||||
bDump times 128 db 0
|
||||
NEWSYM _SW1, dd 0
|
||||
NEWSYM _SW2, dd 0
|
||||
NEWSYM _SW3, dd 0
|
||||
NEWSYM _SW4, dd 0
|
||||
NEWSYM _SWCount, dd 0
|
||||
|
||||
section .text
|
||||
NEWSYM _readSideWinder
|
||||
pushad
|
||||
|
||||
mov ecx,200
|
||||
mov ebx,gDump
|
||||
|
||||
cli
|
||||
cmp byte[SidewinderFix],0
|
||||
je .write
|
||||
out dx,al
|
||||
.write
|
||||
GetSWDataLoop:
|
||||
cmp byte[SidewinderFix],0
|
||||
jne .nowrite
|
||||
out dx,al
|
||||
.nowrite
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
in al,dx
|
||||
mov [ebx],al
|
||||
inc ebx
|
||||
dec ecx
|
||||
jnz GetSWDataLoop
|
||||
sti
|
||||
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edi,edi
|
||||
mov esi,1
|
||||
|
||||
FindCycle:
|
||||
mov al,[gDump+edi]
|
||||
inc edi
|
||||
cmp edi,200
|
||||
je SMWError
|
||||
test al,00010000b
|
||||
jnz WMFCS1
|
||||
xor ecx,ecx
|
||||
jmp FindCycle
|
||||
WMFCS1:
|
||||
inc ecx
|
||||
cmp ecx,15
|
||||
jne FindCycle
|
||||
|
||||
xor ebp,ebp
|
||||
|
||||
FindStrobeLow:
|
||||
mov al,[gDump+edi]
|
||||
inc edi
|
||||
cmp edi,200
|
||||
je SMWError
|
||||
test al,00010000b
|
||||
jnz FindStrobeLow
|
||||
xor ecx,ecx
|
||||
|
||||
FindStrobeHigh:
|
||||
inc ecx
|
||||
cmp ecx,15
|
||||
je SWModeCheck
|
||||
mov al,[gDump+edi]
|
||||
inc edi
|
||||
cmp edi,200
|
||||
je SMWError
|
||||
test al,00010000b
|
||||
jz FindStrobeHigh
|
||||
|
||||
mov [bDump+ebp],al
|
||||
inc ebp
|
||||
jmp FindStrobeLow
|
||||
|
||||
SMWDone:
|
||||
popad
|
||||
mov eax,0
|
||||
ret
|
||||
|
||||
SMWError:
|
||||
popad
|
||||
mov eax,1
|
||||
ret
|
||||
|
||||
SWModeCheck:
|
||||
cmp ebp,5
|
||||
je near ModeB1
|
||||
cmp ebp,15
|
||||
je near ModeA1
|
||||
cmp ebp,10
|
||||
je near ModeB2
|
||||
cmp ebp,30
|
||||
je near ModeA2
|
||||
cmp ebp,45
|
||||
je near ModeA3
|
||||
cmp ebp,20
|
||||
je near ModeB4
|
||||
cmp ebp,60
|
||||
je near ModeA4
|
||||
jmp short SMWError
|
||||
|
||||
ModeA1:
|
||||
cmp dword[_SWCount],3
|
||||
je near ModeB3
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW _SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeA4:
|
||||
mov ebp,45
|
||||
call DoModeA
|
||||
ParityCheckSW _SW4
|
||||
ModeA3:
|
||||
mov ebp,30
|
||||
call DoModeA
|
||||
ParityCheckSW _SW3
|
||||
ModeA2:
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW _SW2
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW _SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeB4:
|
||||
mov ebp,15
|
||||
call DoModeB
|
||||
ParityCheckSW _SW4
|
||||
ModeB3:
|
||||
mov ebp,10
|
||||
call DoModeB
|
||||
ParityCheckSW _SW3
|
||||
ModeB2:
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW _SW2
|
||||
ModeB1:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW _SW1
|
||||
jmp SMWDone
|
||||
|
||||
DoModeB:
|
||||
xor ebx,ebx
|
||||
mov eax,2
|
||||
mov ecx,5
|
||||
add ebp,bDump
|
||||
ModeBLoop:
|
||||
test byte[ebp],00100000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
test byte[ebp],01000000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
test byte[ebp],10000000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
inc ebp
|
||||
dec ecx
|
||||
jnz ModeBLoop
|
||||
ret
|
||||
|
||||
DoModeA:
|
||||
xor ebx,ebx
|
||||
mov eax,2
|
||||
mov ecx,15
|
||||
add ebp,bDump
|
||||
ModeALoop:
|
||||
test byte[ebp],00100000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
inc ebp
|
||||
dec ecx
|
||||
jnz ModeALoop
|
||||
ret
|
||||
|
||||
|
||||
334
tools/zsnes/src/dos/sw32.asm
Normal file
334
tools/zsnes/src/dos/sw32.asm
Normal file
@@ -0,0 +1,334 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;32-bit DOS-Mode driver for the Microsoft Sidewinder Gamepad
|
||||
;Multi-SW Version 1.5
|
||||
;(C) 1997, 1998 Robert William Grubbs, All Rights Reserved
|
||||
;Latest revision 1/20/98
|
||||
; Driver Source code Include file
|
||||
|
||||
;C-linkable, rewrote decoder -sardu
|
||||
|
||||
;Flat memory mode (Protected mode extender required! Tested with DOS32)
|
||||
;Tested with TASM 4.0+
|
||||
|
||||
SECTION .data
|
||||
SW1 dd 0 ;SW #1's button status
|
||||
SW2 dd 0 ;SW #2's button status
|
||||
SW3 dd 0 ;SW #3's button status
|
||||
SW4 dd 0 ;SW #4's button status
|
||||
SWCount dd 1 ;Tell the driver how many sidewinders are present
|
||||
SWSetup dd 0 ;Tell the driver what polling mode to use
|
||||
; 0=Interrupts disabled, Multiple OUT statements
|
||||
; 1=Interrupts disabled, Single OUT statement
|
||||
; 2=Interrupts enabled, Multiple OUT statements
|
||||
; 3=Interrupts enabled, Single OUT statement
|
||||
|
||||
gDump times 100h db 0 ;SW Status dump buffer (space for 256 bytes, uses 200)
|
||||
bDump times 80h db 0 ;buffer to hold button data (Modes A and B, all SW)
|
||||
SECTION .text
|
||||
|
||||
;This macro calculates parity for the buttons and compares it to the SW's
|
||||
; parity bit. If they don't match, the button data is discarded.
|
||||
%macro ParityCheckSW 1
|
||||
mov ecx,ebx ;duplicate button status
|
||||
xor cl,ch ;
|
||||
jpe %%ParChkSW
|
||||
mov [%1],ebx ;update button status for SW #n
|
||||
%%ParChkSW ;done
|
||||
%endmacro
|
||||
|
||||
;The main subroutine; this is the important one; bow down before it
|
||||
;IN: None
|
||||
;Out: SWx=buttons (bit 0=null 1=up 2=dn 3=rt 4=lt 5=A 6=B 7=C 8=X)
|
||||
; (9=Y 10=Z 11=L 12=R 13=St 14=M 15=Parity)
|
||||
;No registers destroyed
|
||||
|
||||
readSideWinder:
|
||||
pushad
|
||||
|
||||
mov ecx,200 ;dump buffer fill size
|
||||
mov ebx,gDump ;initial dump pointer
|
||||
mov edx,0201h ;joystick port
|
||||
|
||||
cmp dword[SWSetup],0
|
||||
jne NotSW0
|
||||
cli ;Disable interrupts (required to avoid jitter)
|
||||
GetSWDataLoop: ;
|
||||
out dx,al ;trigger joystick port
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop
|
||||
sti ;Re-enable interrupts
|
||||
jmp SWPollDone
|
||||
|
||||
NotSW0:
|
||||
cmp dword[SWSetup],1
|
||||
jne NotSW1
|
||||
cli ;Disable interrupts (required to avoid jitter)
|
||||
out dx,al ;trigger joystick port
|
||||
GetSWDataLoop1: ;
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop1
|
||||
sti ;Re-enable interrupts
|
||||
jmp SWPollDone
|
||||
|
||||
NotSW1:
|
||||
cmp dword[SWSetup],2
|
||||
jne NotSW2
|
||||
GetSWDataLoop2: ;
|
||||
out dx,al ;trigger joystick port
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop2
|
||||
jmp SWPollDone
|
||||
|
||||
NotSW2:
|
||||
;default all others to SWStatus=3
|
||||
out dx,al ;trigger joystick port
|
||||
GetSWDataLoop3: ;
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop3
|
||||
|
||||
SWPollDone:
|
||||
|
||||
mov ecx,0 ;tick count
|
||||
mov esi,1 ;initialize output mask
|
||||
mov ebx,0 ;initialize output
|
||||
mov edi,0 ;initialize input pointer
|
||||
|
||||
;My current method of cycle detection is to look for 15 highs in a row on
|
||||
; the strobe line. Cycle ends is detected by 15 lows in a row.
|
||||
;Mode A has 15 strobes in a cycle, Mode B has 5.
|
||||
; Note that the 15 highs/lows for cycle detection may be too high for slow
|
||||
; machines. I havn't seen a problem yet, but it may exist...
|
||||
;Multiple Sidewinder data complicates things. Each additional SW tags
|
||||
; another set of strobes to the cycle, 5 more in mode B, 15 more in mode A.
|
||||
; Detecting extra SW gamepad data is fairly simple: count the number of
|
||||
; strobes. If it is a multiple of 5, you're in mode B and can divide by 5
|
||||
; to get the total number of gamepads. If it's divisible by 15, use mode A.
|
||||
; However, this method cannot distinguish between mode A for one SW and mode
|
||||
; B for three SW. In that case, the SWCount variable must be set correctly.
|
||||
|
||||
FindCycle:
|
||||
mov al,[gDump+edi] ;get next status byte
|
||||
inc edi ;increment input pointer
|
||||
cmp edi,200 ;test for end of status block
|
||||
je SWNoFind ;if it's the end, quit sub with error
|
||||
test al,00010000b ;Check for nonzero bits
|
||||
jnz WMFCS1 ;
|
||||
xor ecx,ecx ;if zero, reset tick count
|
||||
jmp FindCycle ;can't be pre-cycle
|
||||
WMFCS1: ;Possibly pre-cycle
|
||||
inc ecx ;increment tick count
|
||||
cmp ecx,15 ;test for sufficient ticks for cycle start
|
||||
jne FindCycle ;if insufficient, get next status byte
|
||||
;Yippie! it found a (probable) cycle!
|
||||
|
||||
mov ebp,0 ;initialize bDump index (strobe count)
|
||||
|
||||
FindStrobeLow: ;Search for leading edge of data strobe
|
||||
mov al,[gDump+edi] ;get next status byte
|
||||
inc edi ;increment input pointer
|
||||
cmp edi,200 ;test for end of status block
|
||||
je SWNoFind ;if it's the end, quit sub with error
|
||||
test al,00010000b ;get "strobe" bit
|
||||
jnz SHORT FindStrobeLow ;if it isn't zero, we're not there yet
|
||||
xor ecx,ecx ;initialize cycle end test count
|
||||
|
||||
FindStrobeHigh:
|
||||
inc ecx ;increment zero count
|
||||
cmp ecx,0fh ;is it 15?
|
||||
je SWModeCheck ;if so, goto mode check
|
||||
mov al,[gDump+edi] ;get next status byte
|
||||
inc edi ;increment input pointer
|
||||
cmp edi,200 ;test for end of status block
|
||||
je SWNoFind ;if it's the end, quit sub with error
|
||||
test al,00010000b ;get "strobe" bit
|
||||
jz FindStrobeHigh ;if it is zero, we're not there yet
|
||||
;if not, we're there! data bit is valid (probably)
|
||||
mov [bDump+ebp],al ;preserve data for button decoding
|
||||
inc ebp ;increment strobe count/bDump index
|
||||
jmp FindStrobeLow ;wait for the next button
|
||||
|
||||
SMWDone:
|
||||
SWNoFind:
|
||||
popad
|
||||
ret ;return to calling procedure
|
||||
|
||||
SWModeCheck: ;Check strobe count to identify mode and # of SW
|
||||
cmp ebp,15 ;Is it Mode A with 1 Sidewinder or B with 3?
|
||||
je ModeA1
|
||||
cmp ebp,5 ;Is it Mode B with 1 Sidewinders?
|
||||
je ModeB1
|
||||
cmp ebp,30 ;Is it Mode A with 2 Sidewinders?
|
||||
je ModeA2
|
||||
cmp ebp,10 ;Is it Mode B with 2 Sidewinders?
|
||||
je near ModeB2
|
||||
cmp ebp,45 ;Is it Mode A with 3 Sidewinders?
|
||||
je near ModeA3
|
||||
cmp ebp,60 ;Is it Mode A with 4 Sidewinders?
|
||||
je near ModeA4
|
||||
cmp ebp,20 ;Is it Mode B with 4 Sidewinders?
|
||||
je near ModeB4
|
||||
jmp SHORT SWNoFind ;Any other # of strobes is invalid data
|
||||
|
||||
ModeB1:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeA1:
|
||||
cmp dword[SWCount],3
|
||||
je near ModeB3
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeA2:
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW SW2
|
||||
jmp SMWDone
|
||||
|
||||
ModeA3:
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW SW2
|
||||
mov ebp,30
|
||||
call DoModeA
|
||||
ParityCheckSW SW3
|
||||
jmp SMWDone
|
||||
|
||||
ModeA4:
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW SW2
|
||||
mov ebp,30
|
||||
call DoModeA
|
||||
ParityCheckSW SW3
|
||||
mov ebp,45
|
||||
call DoModeA
|
||||
ParityCheckSW SW4
|
||||
jmp SMWDone
|
||||
|
||||
ModeB2:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW SW2
|
||||
jmp SMWDone
|
||||
|
||||
ModeB3:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW SW2
|
||||
mov ebp,10
|
||||
call DoModeB
|
||||
ParityCheckSW SW3
|
||||
jmp SMWDone
|
||||
|
||||
ModeB4:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW SW2
|
||||
mov ebp,10
|
||||
call DoModeB
|
||||
ParityCheckSW SW3
|
||||
mov ebp,15
|
||||
call DoModeB
|
||||
ParityCheckSW SW4
|
||||
jmp SMWDone
|
||||
ENDP
|
||||
|
||||
%macro SWRepeat 1
|
||||
mov al,[bDump+ebp+%1]
|
||||
shr al,5 ;get upper 3 bits
|
||||
shl eax,1+3*%1 ;shift into place
|
||||
or ebx,eax ;or into output
|
||||
%endmacro
|
||||
|
||||
DoModeB:
|
||||
xor ebx,ebx ;Initialize output
|
||||
xor eax,eax
|
||||
|
||||
SWRepeat 0
|
||||
SWRepeat 1
|
||||
SWRepeat 2
|
||||
SWRepeat 3
|
||||
SWRepeat 4
|
||||
|
||||
xor ebx,0FFFEh
|
||||
ret
|
||||
|
||||
DoModeA:
|
||||
xor ebx,ebx ;Clear output
|
||||
mov ecx,15 ;bit count
|
||||
|
||||
ALP:
|
||||
mov al,[bDump+ebp]
|
||||
inc ebp
|
||||
shl al,3
|
||||
rcr ebx,1
|
||||
dec ecx
|
||||
jg ALP
|
||||
|
||||
shr ebx,16
|
||||
xor ebx,0FFFEh
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
532
tools/zsnes/src/dos/vesa12.asm
Normal file
532
tools/zsnes/src/dos/vesa12.asm
Normal file
@@ -0,0 +1,532 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM vesa2_usbit,vesa2_clbit,vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3
|
||||
EXTSYM vesa2_x,vesa2_y,vesa2_bits,vesa2_rpos,vesa2_gpos,vesa2_bpos,vesa2_rposng
|
||||
EXTSYM vesa2_gposng,vesa2_bposng,vesa2_rtrcl,vesa2_rtrcla,vesa2_rfull
|
||||
EXTSYM vesa2_gtrcl,vesa2_gtrcla,vesa2_gfull,vesa2_btrcl,vesa2_btrcla,vesa2_bfull
|
||||
EXTSYM vesa2red10,videotroub,genfulladdtab,DosExit,noblocks
|
||||
EXTSYM bytesperscanline,vesamode,VESAmodelist
|
||||
|
||||
; add 0214h video mode
|
||||
|
||||
SECTION .bss
|
||||
NEWSYM granularity, resw 1
|
||||
NEWSYM granadd, resd 1
|
||||
SECTION .text
|
||||
|
||||
NEWSYM VESA12EXITTODOS
|
||||
mov ax,0003h
|
||||
int 10h
|
||||
push edx
|
||||
mov edx,.exitfromvesa12
|
||||
mov ah,9
|
||||
int 21h
|
||||
pop edx
|
||||
mov ah,9
|
||||
int 21h
|
||||
mov edx,.return
|
||||
mov ah,9
|
||||
int 21h
|
||||
|
||||
mov byte[videotroub],1
|
||||
jmp DosExit
|
||||
|
||||
|
||||
SECTION .data
|
||||
.exitfromvesa12 db 'Unable to Initialize VESA1.2 $'
|
||||
.return db 10,13,'$'
|
||||
SECTION .text
|
||||
|
||||
;*******************************************************
|
||||
; Set up Vesa 2
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM InitVesa12
|
||||
;-------------------------------------------------;
|
||||
; First - allocate some bytes in DOS memory for ;
|
||||
; communication with VBE ;
|
||||
;-------------------------------------------------;
|
||||
|
||||
mov eax,0100h
|
||||
mov ebx,512/16 ; 512 bytes
|
||||
int 31h ; Function 31h,100h - Allocate DOS memory (512 bytes)
|
||||
jnc .gotmem
|
||||
mov edx,.nomemmessage
|
||||
jmp VESA12EXITTODOS
|
||||
.gotmem
|
||||
mov fs,dx ; FS now points to the DOS buffer
|
||||
|
||||
|
||||
;--------------------------------------------------;
|
||||
; Now, get information about the video card into ;
|
||||
; a data structure ;
|
||||
;--------------------------------------------------;
|
||||
|
||||
mov edi,RMREGS
|
||||
mov dword[fs:0],'VBE1' ; Request VBE 2.0 info
|
||||
mov dword[RMREGS.eax],4f00h
|
||||
mov [RMREGS.es],ax ; Real mode segment of DOS buffer
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
|
||||
jnc .int1ok
|
||||
mov edx,.noint1message
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
.int1ok ; Real mode int successful!!!
|
||||
mov eax,[RMREGS.eax]
|
||||
cmp al,4fh ; Check vbe interrupt went OK
|
||||
jz .vbedetected
|
||||
mov edx,.novbemessage
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
.vbedetected
|
||||
cmp dword[fs:0000],'VESA'
|
||||
jz .vesadetected ; Check for presence of vesa
|
||||
mov edx,.novesamessage
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
|
||||
.vesadetected
|
||||
cmp word[fs:0004],102h
|
||||
jae .vesa12detected ; Check we've got VESA 1.2 or greater
|
||||
mov edx,.novesa2message
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
|
||||
;-----------------------------------------------------;
|
||||
; OK - vesa 2.0 or greater has been detected. Copy ;
|
||||
; mode information into VESAmodelist ;
|
||||
;-----------------------------------------------------;
|
||||
|
||||
.vesa12detected
|
||||
mov ax,[fs:12h] ; Get no. of 64k blocks
|
||||
mov [noblocks],ax
|
||||
mov ax, 2
|
||||
mov bx,[fs:10h]
|
||||
int 31h
|
||||
|
||||
jnc .wegottheselector
|
||||
mov edx, .oopsnoselector
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
.wegottheselector
|
||||
|
||||
mov gs,ax
|
||||
xor eax,eax
|
||||
mov ebp,VESAmodelist
|
||||
mov ecx,512
|
||||
mov ax,[fs:0eh]
|
||||
|
||||
.loopcopymodes
|
||||
mov bx,[gs:eax]
|
||||
mov [ebp],bx
|
||||
cmp bx,0ffffh
|
||||
jz .copiedmodes
|
||||
add ebp,2
|
||||
add eax,2
|
||||
dec ecx
|
||||
jz .outofmodelistspace
|
||||
jmp .loopcopymodes
|
||||
|
||||
.outofmodelistspace
|
||||
mov edx,.outofmodelistspacemessage
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
;----------------------------------------------;
|
||||
; OK - Scan the mode list to find a matching ;
|
||||
; mode for vesa2_x, vesa2_y and vesa2_depth ;
|
||||
;----------------------------------------------;
|
||||
|
||||
.copiedmodes
|
||||
|
||||
mov ebp,VESAmodelist
|
||||
xor ecx,ecx
|
||||
|
||||
.loopcheckmodes
|
||||
mov cx, [ebp]
|
||||
cmp cx, 0ffffh
|
||||
jnz .notendoflist
|
||||
|
||||
mov edx,.endoflist
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
.notendoflist
|
||||
|
||||
mov edi, RMREGS
|
||||
mov dword[RMREGS.eax],4f01h
|
||||
mov dword[RMREGS.ebx],0
|
||||
mov [RMREGS.ecx],ecx
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
jnc .modecheckok
|
||||
mov edx,.modecheckfail
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
.modecheckok
|
||||
add ebp,2
|
||||
|
||||
test word[fs:0000h],1b
|
||||
jz near .loopcheckmodes ; If mode is not available
|
||||
|
||||
;
|
||||
; xor eax,eax
|
||||
; mov ax,[fs:12h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,'x'
|
||||
; int 21h
|
||||
; mov ax,[fs:14h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,'x'
|
||||
; int 21h
|
||||
; xor ah,ah
|
||||
; mov al,[fs:19h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,13
|
||||
; int 21h
|
||||
; mov dl,10
|
||||
; int 21h
|
||||
|
||||
mov eax,[vesa2_x]
|
||||
cmp [fs:12h],ax ; Check that the height matches
|
||||
jnz near .loopcheckmodes
|
||||
mov eax,[vesa2_y]
|
||||
cmp [fs:14h],ax ; Check that the width matches
|
||||
jnz near .loopcheckmodes
|
||||
mov al,[vesa2_bits]
|
||||
cmp [fs:19h],al ; Check bits/pixel for match
|
||||
jnz near .loopcheckmodes
|
||||
|
||||
; mov ah,07h
|
||||
; int 21h
|
||||
|
||||
; D0 = Window supported
|
||||
; 0 = Window is not supported
|
||||
; 1 = Window is supported
|
||||
; D1 = Window readable
|
||||
; 0 = Window is not readable
|
||||
; 1 = Window is readable
|
||||
; D2 = Window writeable
|
||||
; 0 = Window is not writeable
|
||||
; 1 = Window is writeable
|
||||
; D3-D7 = Reserved
|
||||
|
||||
mov byte[.whichwin],0
|
||||
mov al,[fs:2] ; Get window A attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
je .foundwin ; Mode supported
|
||||
mov al,[fs:3] ; Get window B attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
jne .foundwin ; Mode not supported
|
||||
mov byte[.whichwin],1
|
||||
.foundwin
|
||||
|
||||
; Success - a match has been found!!
|
||||
|
||||
sub ebp,2
|
||||
mov ax,[ebp]
|
||||
mov [vesamode],ax ; Store vesa 1.2 mode number
|
||||
; and eax,0FFFFh
|
||||
; push eax
|
||||
; mov ax,0003h
|
||||
; int 10h
|
||||
; pop eax
|
||||
; call printnum
|
||||
; jmp DosExit
|
||||
|
||||
mov ax,[fs:10h]
|
||||
mov byte[vesa2red10],0
|
||||
mov byte[vesa2_rposng],11
|
||||
mov byte[vesa2_gposng],6
|
||||
mov byte[vesa2_bposng],0
|
||||
mov dword[vesa2_clbitng],1111011111011110b
|
||||
mov dword[vesa2_clbitng2],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng3],0111101111101111b
|
||||
mov [bytesperscanline],ax ; Store bytes per scan line
|
||||
cmp byte[fs:20h],10
|
||||
jne .nored10
|
||||
mov byte[fs:20h],11
|
||||
mov byte[vesa2red10],1
|
||||
mov byte[vesa2_rposng],10
|
||||
mov byte[vesa2_gposng],5
|
||||
mov dword[vesa2_clbitng],0111101111011110b
|
||||
mov dword[vesa2_clbitng2],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng2+4],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng3],0011110111101111b
|
||||
.nored10
|
||||
; fix up bit lengths
|
||||
mov al,16
|
||||
sub al,[fs:20h]
|
||||
mov ah,[fs:22h]
|
||||
sub ah,[fs:20h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:20h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1
|
||||
mov bh,ah
|
||||
.scheck1
|
||||
cmp bh,bl
|
||||
jb .scheck2
|
||||
mov bh,bl
|
||||
.scheck2
|
||||
mov byte[fs:19h],5
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:22h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:22h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:22h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1b
|
||||
mov bh,ah
|
||||
.scheck1b
|
||||
cmp bh,bl
|
||||
jb .scheck2b
|
||||
mov bh,bl
|
||||
.scheck2b
|
||||
mov [fs:21h],bh
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:24h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:24h]
|
||||
mov bl,[fs:22h]
|
||||
sub bl,[fs:24h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1c
|
||||
mov bh,ah
|
||||
.scheck1c
|
||||
cmp bh,bl
|
||||
jb .scheck2c
|
||||
mov bh,bl
|
||||
.scheck2c
|
||||
mov [fs:23h],bh
|
||||
|
||||
mov word[vesa2_clbit],0
|
||||
|
||||
cmp byte[fs:20h],10
|
||||
jne .nottopbit
|
||||
mov word[vesa2_usbit],8000h
|
||||
.nottopbit
|
||||
|
||||
; Process Red Stuff
|
||||
mov al,[fs:20h] ; bit sizes = [fs:19h,21h,23h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:19h],6
|
||||
jne .no6bit
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bit
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_rpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrr
|
||||
shl bx,cl
|
||||
jmp .shlr
|
||||
.shrr
|
||||
shr bx,1
|
||||
.shlr
|
||||
mov [vesa2_rfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov [vesa2_rtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov [vesa2_rtrcla],bx
|
||||
|
||||
; Process Green Stuff
|
||||
mov al,[fs:22h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:21h],6
|
||||
jne .no6bitb
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitb
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_gpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrg
|
||||
shl bx,cl
|
||||
jmp .shlg
|
||||
.shrg
|
||||
shr bx,1
|
||||
.shlg
|
||||
mov [vesa2_gfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov [vesa2_gtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov [vesa2_gtrcla],bx
|
||||
|
||||
; Process Blue Stuff
|
||||
mov al,[fs:24h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:23h],6
|
||||
jne .no6bitc
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitc
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_bpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrb
|
||||
shl bx,cl
|
||||
jmp .shlb
|
||||
.shrb
|
||||
shr bx,1
|
||||
.shlb
|
||||
mov [vesa2_bfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov [vesa2_btrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov [vesa2_btrcla],bx
|
||||
|
||||
xor word[vesa2_clbit],0FFFFh
|
||||
|
||||
mov ax,[fs:4]
|
||||
mov [granularity],ax
|
||||
xor edx,edx
|
||||
mov ax,64
|
||||
mov bx,[granularity]
|
||||
div bx
|
||||
mov [granadd],ax
|
||||
|
||||
call genfulladdtab
|
||||
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov eax,4f02h
|
||||
movzx ebx,word[vesamode]
|
||||
int 10h ; Set the vesa mode
|
||||
cmp ax,004fh
|
||||
jz .modesetok
|
||||
mov edx,.unableset
|
||||
jmp VESA12EXITTODOS ; Failure!!!
|
||||
|
||||
.modesetok
|
||||
;******************************* EXTRA BIT ****************************
|
||||
|
||||
ret
|
||||
|
||||
; Check logical scanline length
|
||||
mov eax,4f06h
|
||||
mov ebx,1
|
||||
int 10h
|
||||
cmp cx,[vesa2_x]
|
||||
je .correctwidth
|
||||
|
||||
mov eax,4f06h ; VBE Set/Get logical scan line length
|
||||
mov ebx,0 ; Set scan line length in pixels
|
||||
mov ecx, [vesa2_x] ; Desired screen width
|
||||
int 10h
|
||||
cmp ax,04fh
|
||||
jz .correctwidth
|
||||
mov edx, .unablescan
|
||||
jmp VESA12EXITTODOS ; Failure!!!
|
||||
|
||||
.correctwidth
|
||||
|
||||
ret
|
||||
|
||||
SECTION .data
|
||||
.nomemmessage db ': Unable to locate DOS memory.$'
|
||||
.noint1message db ': Simulated real mode interrupt failed.$'
|
||||
.oopsnoselector db ': Failed to allocate vesa display selector!$'
|
||||
.novesa2message db ': VESA 1.2 or greater required!$'
|
||||
.novbemessage db ': VBE not detected!!$'
|
||||
.novesamessage db ': VESA not detected!$'
|
||||
.outofmodelistspacemessage db ': Out of VESA mode list space!$'
|
||||
.endoflist db ': VESA 1.2 mode does not work on your video card/driver.$'
|
||||
.whichwin db 0
|
||||
.modecheckfail db ': Real mode interrupt failure while checking vesa mode$'
|
||||
.unableset db 'Unable to initialize video mode.$'
|
||||
.unablescan db 'Unable to set scan line length.$'
|
||||
SECTION .bss
|
||||
|
||||
RMREGS
|
||||
.edi resd 1
|
||||
.esi resd 1
|
||||
.ebp resd 1
|
||||
.esp resd 1
|
||||
.ebx resd 1
|
||||
.edx resd 1
|
||||
.ecx resd 1
|
||||
.eax resd 1
|
||||
.flags resw 1
|
||||
.es resw 1
|
||||
.ds resw 1
|
||||
.fs resw 1
|
||||
.gs resw 1
|
||||
.ip resw 1
|
||||
.cs resw 1
|
||||
.sp resw 1
|
||||
.ss resw 1
|
||||
.spare times 20 resd 1
|
||||
654
tools/zsnes/src/dos/vesa2.asm
Normal file
654
tools/zsnes/src/dos/vesa2.asm
Normal file
@@ -0,0 +1,654 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM DosExit,PrintStr,HalfTransB,HalfTransC,Init_2xSaIMMX,ZSNESBase
|
||||
EXTSYM UnusedBit,HalfTrans,UnusedBitXor,ngrposng,nggposng,ngbposng
|
||||
EXTSYM videotroub,ExitFromGUI,ErrorPointer,vesa2_x,vesa2_y,vesa2_bits,TripBufAvail,vesa2red10
|
||||
EXTSYM vesa2_rposng,vesa2_gposng,vesa2_bposng,vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3
|
||||
EXTSYM vesa2_clbit,vesa2_usbit,vesa2_rpos,vesa2_rfull,vesa2_rtrcl,vesa2_rtrcla,genfulladdtab
|
||||
EXTSYM vesa2_gpos,vesa2_gfull,vesa2_gtrcl,vesa2_gtrcla,vesa2_bpos,vesa2_bfull,vesa2_btrcl,vesa2_btrcla
|
||||
|
||||
SECTION .data
|
||||
; add 0214h video mode
|
||||
anticrash times 10 db 0
|
||||
|
||||
ALIGN32
|
||||
NEWSYM vesa2selec, dd 0 ; VESA2 Selector Location
|
||||
NEWSYM vesa3en, dd 0
|
||||
NEWSYM VESAAddr, dd 0
|
||||
|
||||
SECTION .bss
|
||||
|
||||
SECTION .text
|
||||
|
||||
NEWSYM VESA2EXITTODOS
|
||||
mov byte[videotroub],1
|
||||
cmp byte[ExitFromGUI],0
|
||||
je .nogui
|
||||
mov [ErrorPointer],edx
|
||||
ret
|
||||
.nogui
|
||||
mov ax,0003h
|
||||
int 10h
|
||||
push edx
|
||||
mov edx,.exitfromvesa2
|
||||
call PrintStr
|
||||
pop edx
|
||||
call PrintStr
|
||||
mov edx,.return
|
||||
call PrintStr
|
||||
|
||||
jmp DosExit
|
||||
|
||||
SECTION .data
|
||||
.exitfromvesa2 db 'Unable to Initialize VESA2 : ',0
|
||||
.return db 10,13,0
|
||||
SECTION .text
|
||||
|
||||
;*******************************************************
|
||||
; Set up Vesa 2
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM InitVesa2
|
||||
;-------------------------------------------------;
|
||||
; First - allocate some bytes in DOS memory for ;
|
||||
; communication with VBE ;
|
||||
;-------------------------------------------------;
|
||||
|
||||
mov eax,0100h
|
||||
mov ebx,512/16 ; 512 bytes
|
||||
int 31h ; Function 31h,100h - Allocate
|
||||
; DOS memory (512 bytes)
|
||||
jnc .gotmem
|
||||
mov edx,.nomemmessage
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
.gotmem
|
||||
mov fs,dx ; FS now points to the DOS buffer
|
||||
|
||||
;--------------------------------------------------;
|
||||
; Now, get information about the video card into ;
|
||||
; a data structure ;
|
||||
;--------------------------------------------------;
|
||||
|
||||
mov edi,RMREGS
|
||||
mov dword[fs:0],'VBE2' ; Request VBE 2.0 info
|
||||
mov dword[RMREGS.eax],4f00h
|
||||
mov [RMREGS.es],ax ; Real mode segment of DOS buffer
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
|
||||
jnc .int1ok
|
||||
mov edx,.noint1message
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
|
||||
.int1ok ; Real mode int successful!!!
|
||||
mov eax,[RMREGS.eax]
|
||||
cmp al,4fh ; Check vbe interrupt went OK
|
||||
jz .vbedetected
|
||||
mov edx,.novbemessage
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
.vbedetected
|
||||
cmp dword[fs:0000],'VESA'
|
||||
jz .vesadetected ; Check for presence of vesa
|
||||
mov edx,.novesamessage
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
|
||||
.vesadetected
|
||||
cmp word[fs:0004],200h
|
||||
jae .vesa2detected ; Check we've got VESA 2.0 or greater
|
||||
mov edx,.novesa2message
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
|
||||
;-----------------------------------------------------;
|
||||
; OK - vesa 2.0 or greater has been detected. Copy ;
|
||||
; mode information into VESAmodelist ;
|
||||
;-----------------------------------------------------;
|
||||
|
||||
.vesa2detected
|
||||
mov dword[vesa3en],0
|
||||
cmp word[fs:004],300h
|
||||
jb .notvbe3
|
||||
mov dword[vesa3en],1
|
||||
.notvbe3
|
||||
mov ax,[fs:12h] ; Get no. of 64k blocks
|
||||
mov [noblocks],ax
|
||||
mov ax, 2
|
||||
mov bx,[fs:10h]
|
||||
int 31h
|
||||
|
||||
jnc .wegottheselector
|
||||
mov edx, .oopsnoselector
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
.wegottheselector
|
||||
|
||||
mov gs,ax
|
||||
xor eax,eax
|
||||
mov ebp,VESAmodelist
|
||||
mov ecx,512
|
||||
mov ax,[fs:0eh]
|
||||
|
||||
.loopcopymodes
|
||||
mov bx,[gs:eax]
|
||||
mov [ebp],bx
|
||||
cmp bx,0ffffh
|
||||
jz .copiedmodes
|
||||
add ebp,2
|
||||
add eax,2
|
||||
dec ecx
|
||||
jz .outofmodelistspace
|
||||
jmp .loopcopymodes
|
||||
|
||||
.outofmodelistspace
|
||||
mov edx,.outofmodelistspacemessage
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
;----------------------------------------------;
|
||||
; OK - Scan the mode list to find a matching ;
|
||||
; mode for vesa2_x, vesa2_y and vesa2_depth ;
|
||||
;----------------------------------------------;
|
||||
|
||||
.copiedmodes
|
||||
|
||||
mov ebp,VESAmodelist
|
||||
xor ecx,ecx
|
||||
|
||||
.loopcheckmodes
|
||||
mov cx, [ebp]
|
||||
cmp cx, 0ffffh
|
||||
jnz .notendoflist
|
||||
|
||||
mov edx,.endoflist
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
.notendoflist
|
||||
|
||||
mov edi, RMREGS
|
||||
mov dword[RMREGS.eax],4f01h
|
||||
mov dword[RMREGS.ebx],0
|
||||
mov [RMREGS.ecx],ecx
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
jnc .modecheckok
|
||||
mov edx,.modecheckfail
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
.modecheckok
|
||||
add ebp,2
|
||||
|
||||
test word[fs:0000h],1b
|
||||
jz near .loopcheckmodes ; If mode is not available
|
||||
|
||||
mov eax,[vesa2_x]
|
||||
cmp [fs:12h],ax ; Check that the height matches
|
||||
jnz near .loopcheckmodes
|
||||
mov eax,[vesa2_y]
|
||||
cmp [fs:14h],ax ; Check that the width matches
|
||||
jnz near .loopcheckmodes
|
||||
mov al,[vesa2_bits]
|
||||
cmp [fs:19h],al ; Check bits/pixel for match
|
||||
jnz near .loopcheckmodes
|
||||
|
||||
mov byte[TripBufAvail],1
|
||||
test word[fs:0000h],400h
|
||||
jz .notbuf
|
||||
mov byte[TripBufAvail],1
|
||||
.notbuf
|
||||
.notvesa3
|
||||
|
||||
; D0 = Window supported
|
||||
; 0 = Window is not supported
|
||||
; 1 = Window is supported
|
||||
; D1 = Window readable
|
||||
; 0 = Window is not readable
|
||||
; 1 = Window is readable
|
||||
; D2 = Window writeable
|
||||
; 0 = Window is not writeable
|
||||
; 1 = Window is writeable
|
||||
; D3-D7 = Reserved
|
||||
|
||||
mov byte[.whichwin],0
|
||||
mov al,[fs:2] ; Get window A attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
je .foundwin ; Mode supported
|
||||
mov al,[fs:3] ; Get window B attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
jne .foundwin ; Mode not supported
|
||||
mov byte[.whichwin],1
|
||||
.foundwin
|
||||
|
||||
; Success - a match has been found!!
|
||||
|
||||
sub ebp,2
|
||||
mov ax,[ebp]
|
||||
mov [vesamode],ax ; Store vesa 2 mode number
|
||||
|
||||
mov ax,[fs:10h]
|
||||
mov byte[vesa2red10],0
|
||||
mov byte[vesa2_rposng],11
|
||||
mov byte[vesa2_gposng],6
|
||||
mov byte[vesa2_bposng],0
|
||||
mov dword[vesa2_clbitng],1111011111011110b
|
||||
mov dword[vesa2_clbitng2],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng3],0111101111101111b
|
||||
mov [bytesperscanline],ax ; Store bytes per scan line
|
||||
cmp byte[fs:20h],10
|
||||
jne near .nored10
|
||||
mov byte[fs:20h],11
|
||||
mov byte[vesa2red10],1
|
||||
mov byte[vesa2_rposng],10
|
||||
mov byte[vesa2_gposng],5
|
||||
mov dword[vesa2_clbitng],0111101111011110b
|
||||
mov dword[vesa2_clbitng2],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng2+4],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng3],0011110111101111b
|
||||
mov dword[UnusedBit], 10000000000000001000000000000000b
|
||||
mov dword[HalfTrans], 01111011110111100111101111011110b
|
||||
mov dword[UnusedBitXor], 01111111111111110111111111111111b
|
||||
mov dword[UnusedBit+4], 10000000000000001000000000000000b
|
||||
mov dword[HalfTrans+4], 01111011110111100111101111011110b
|
||||
mov dword[UnusedBitXor+4],01111111111111110111111111111111b
|
||||
mov dword[HalfTransB], 00000100001000010000010000100001b
|
||||
mov dword[HalfTransB+4], 00000100001000010000010000100001b
|
||||
mov dword[HalfTransC], 01111011110111100111101111011110b
|
||||
mov dword[HalfTransC+4], 01111011110111100111101111011110b
|
||||
mov dword[ngrposng],10
|
||||
mov dword[nggposng],5
|
||||
mov dword[ngbposng],0
|
||||
|
||||
.nored10
|
||||
; fix up bit lengths
|
||||
mov al,16
|
||||
sub al,[fs:20h]
|
||||
mov ah,[fs:22h]
|
||||
sub ah,[fs:20h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:20h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1
|
||||
mov bh,ah
|
||||
.scheck1
|
||||
cmp bh,bl
|
||||
jb .scheck2
|
||||
mov bh,bl
|
||||
.scheck2
|
||||
mov byte[fs:19h],5
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:22h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:22h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:22h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1b
|
||||
mov bh,ah
|
||||
.scheck1b
|
||||
cmp bh,bl
|
||||
jb .scheck2b
|
||||
mov bh,bl
|
||||
.scheck2b
|
||||
mov [fs:21h],bh
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:24h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:24h]
|
||||
mov bl,[fs:22h]
|
||||
sub bl,[fs:24h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1c
|
||||
mov bh,ah
|
||||
.scheck1c
|
||||
cmp bh,bl
|
||||
jb .scheck2c
|
||||
mov bh,bl
|
||||
.scheck2c
|
||||
mov [fs:23h],bh
|
||||
|
||||
mov word[vesa2_clbit],0
|
||||
|
||||
cmp byte[fs:20h],10
|
||||
jne .nottopbit
|
||||
mov word[vesa2_usbit],8000h
|
||||
.nottopbit
|
||||
|
||||
; Process Red Stuff
|
||||
mov al,[fs:20h] ; bit sizes = [fs:19h,21h,23h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:19h],6
|
||||
jne .no6bit
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bit
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_rpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrr
|
||||
shl bx,cl
|
||||
jmp .shlr
|
||||
.shrr
|
||||
shr bx,1
|
||||
.shlr
|
||||
mov [vesa2_rfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov [vesa2_rtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov [vesa2_rtrcla],bx
|
||||
|
||||
; mov ax,03h
|
||||
; int 10h
|
||||
; mov ax,[vesa2_rfull]
|
||||
; call printhex
|
||||
; jmp DosExit
|
||||
|
||||
; Process Green Stuff
|
||||
mov al,[fs:22h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:21h],6
|
||||
jne .no6bitb
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitb
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_gpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrg
|
||||
shl bx,cl
|
||||
jmp .shlg
|
||||
.shrg
|
||||
shr bx,1
|
||||
.shlg
|
||||
mov [vesa2_gfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov [vesa2_gtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov [vesa2_gtrcla],bx
|
||||
|
||||
; Process Blue Stuff
|
||||
mov al,[fs:24h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:23h],6
|
||||
jne .no6bitc
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitc
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_bpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrb
|
||||
shl bx,cl
|
||||
jmp .shlb
|
||||
.shrb
|
||||
shr bx,1
|
||||
.shlb
|
||||
mov [vesa2_bfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov [vesa2_btrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov [vesa2_btrcla],bx
|
||||
|
||||
xor word[vesa2_clbit],0FFFFh
|
||||
|
||||
call genfulladdtab
|
||||
|
||||
test word[fs:0h],10000000b ; Check if linear available
|
||||
jnz .linearavailable
|
||||
mov edx,.nolframebuffer
|
||||
jmp VESA2EXITTODOS ; None available
|
||||
|
||||
;---------------------------------------------;
|
||||
; OK - now set the vesa 2 mode based on the ;
|
||||
; information gleaned... ;
|
||||
;---------------------------------------------;
|
||||
|
||||
.linearavailable
|
||||
or word[vesamode],4000h ; Convert mode to its LFB equivalent
|
||||
mov ebx,[fs:28h] ; Read in physical base ptr
|
||||
|
||||
mov cx,bx
|
||||
shr ebx,16
|
||||
mov si,[noblocks]
|
||||
xor edi,edi ; Since noblocks = number of 64k blocks,
|
||||
; these lines leave si:di holding byte size
|
||||
mov eax,800h
|
||||
int 31h
|
||||
jnc .mappedphysicalarea
|
||||
mov edx,.unablemap
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
|
||||
.mappedphysicalarea
|
||||
shl ebx,16
|
||||
mov bx,cx
|
||||
mov [LFBpointer],ebx
|
||||
mov eax,ebx
|
||||
sub eax,[ZSNESBase]
|
||||
mov [VESAAddr],eax
|
||||
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov eax,4f02h
|
||||
movzx ebx,word[vesamode]
|
||||
int 10h ; Set the vesa mode
|
||||
cmp ax,004fh
|
||||
jz .modesetok
|
||||
mov edx,.unableset
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
|
||||
.modesetok
|
||||
;******************************* EXTRA BIT ****************************
|
||||
|
||||
; cmp byte[.whichwin],1 ; Check if Write is at Window B
|
||||
; jne .nowinB
|
||||
;
|
||||
; mov ax,4F05h
|
||||
; mov bx,1
|
||||
; mov dx,0
|
||||
; int 10h
|
||||
;
|
||||
;.nowinB
|
||||
|
||||
; Check logical scanline length
|
||||
mov eax,4f06h
|
||||
mov ebx,1
|
||||
int 10h
|
||||
cmp cx,[vesa2_x]
|
||||
je .correctwidth
|
||||
|
||||
mov eax,4f06h ; VBE Set/Get logical scan line length
|
||||
mov ebx,0 ; Set scan line length in pixels
|
||||
mov ecx, [vesa2_x] ; Desired screen width
|
||||
int 10h
|
||||
cmp ax,04fh
|
||||
jz .correctwidth
|
||||
mov edx, .unablescan
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
|
||||
.correctwidth
|
||||
|
||||
;*************************** END OF EXTRA BIT *************************
|
||||
|
||||
xor eax,eax
|
||||
mov ecx,1
|
||||
int 31h ; Allocate a descriptor
|
||||
|
||||
mov bx,ax ; Move our selector into bx
|
||||
|
||||
mov ecx,[LFBpointer]
|
||||
mov dx,cx
|
||||
shr ecx,16
|
||||
mov eax,7
|
||||
int 31h ; Set our selector to LFB
|
||||
jnc .selectornowset
|
||||
mov edx,.unablelfb
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
|
||||
.selectornowset
|
||||
|
||||
movzx ecx,word[noblocks]
|
||||
shl ecx,16 ; Multiply by 65536
|
||||
dec ecx ; Necessary!!!
|
||||
mov dx,cx
|
||||
shr ecx,16 ; CX:DX size of screen
|
||||
mov eax,8
|
||||
int 31h ; Set size of selector
|
||||
jnc .ok
|
||||
mov edx,.unablesets
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
|
||||
.ok
|
||||
lar ecx,ebx
|
||||
shr ecx,8
|
||||
and cl,60h
|
||||
or cl,93h
|
||||
and ch,0c0h ; Keep granularity bit
|
||||
mov ax,9
|
||||
int 31h ; Set selector access rights
|
||||
jnc .accessrightsset
|
||||
mov edx,.unablesetar
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
.accessrightsset
|
||||
mov [vesa2selec],bx
|
||||
|
||||
cmp byte[vesa2red10],1
|
||||
je .red10
|
||||
mov eax,565
|
||||
jmp .red11
|
||||
.red10
|
||||
mov eax,555
|
||||
.red11
|
||||
push eax
|
||||
call Init_2xSaIMMX
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
SECTION .data
|
||||
.nomemmessage db 'Unable to locate DOS memory.',0
|
||||
.noint1message db 'Simulated real mode interrupt failed.',0
|
||||
.novbemessage db 'VBE not detected!!',0
|
||||
.novesamessage db 'VESA not detected!',0
|
||||
.novesa2message db 'VESA 2.0 or greater required!',0
|
||||
.oopsnoselector db 'Failed to allocate vesa display selector!',0
|
||||
.outofmodelistspacemessage db 'Out of VESA2 mode list space!',0
|
||||
.endoflist db 'This VESA2 mode does not work on your video card / driver.',0
|
||||
.whichwin db 0
|
||||
.modecheckfail db 'Real mode interrupt failure while checking vesa mode',0
|
||||
.nolframebuffer db 'Linear Frame Buffer not Detected.',0
|
||||
.unablemap db 'Unable to map physical area.',0
|
||||
.unableset db 'Unable to initialize video mode.',0
|
||||
.unablescan db 'Unable to set scan line length.',0
|
||||
.unablelfb db 'Unable to set selector to LFB.',0
|
||||
.unablesets db 'Unable to set size of selector.',0
|
||||
.unablesetar db 'Unable to set selector access rights.',0
|
||||
|
||||
NEWSYM LFBpointer
|
||||
dd 0
|
||||
NEWSYM noblocks
|
||||
dw 0
|
||||
NEWSYM bytesperscanline
|
||||
dw 0
|
||||
NEWSYM vesamode
|
||||
dw 0
|
||||
;----------------------------------------------------------------------
|
||||
;NEWSYM VESAmodelist
|
||||
; times 512 dw 0
|
||||
;----------------------------------------------------------------------
|
||||
|
||||
|
||||
SECTION .bss
|
||||
|
||||
NEWSYM VESAmodelist, times 512 resw 1
|
||||
NEWSYM RMREGS
|
||||
.edi resd 1
|
||||
.esi resd 1
|
||||
.ebp resd 1
|
||||
.esp resd 1
|
||||
.ebx resd 1
|
||||
.edx resd 1
|
||||
.ecx resd 1
|
||||
.eax resd 1
|
||||
|
||||
.flags resw 1
|
||||
.es resw 1
|
||||
.ds resw 1
|
||||
.fs resw 1
|
||||
.gs resw 1
|
||||
.ip resw 1
|
||||
.cs resw 1
|
||||
.sp resw 1
|
||||
.ss resw 1
|
||||
.spare times 20 resd 1
|
||||
;----------------------------------------------------------------------
|
||||
152
tools/zsnes/src/dos/vga.inc
Normal file
152
tools/zsnes/src/dos/vga.inc
Normal file
@@ -0,0 +1,152 @@
|
||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||
;
|
||||
;http://www.zsnes.com
|
||||
;http://sourceforge.net/projects/zsnes
|
||||
;https://zsnes.bountysource.com
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;version 2 as published by the Free Software Foundation.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
; by kode54, stainless
|
||||
|
||||
%macro SetVGAMode 1
|
||||
mov byte[cbitmode],0
|
||||
|
||||
mov ax,0013h
|
||||
int 10h
|
||||
|
||||
mov dx,03d4h
|
||||
mov ax,0011h
|
||||
out dx,ax
|
||||
inc edx
|
||||
in al,dx
|
||||
and al,07fh
|
||||
mov ah,al
|
||||
mov al,11h
|
||||
dec edx
|
||||
out dx,ax
|
||||
|
||||
xor ecx,ecx
|
||||
jmp %%start
|
||||
|
||||
%%loop
|
||||
add ecx,4
|
||||
|
||||
%%start
|
||||
mov eax,[%1+ecx]
|
||||
or eax,eax
|
||||
jz %%end
|
||||
|
||||
cmp ax,03c0h
|
||||
je %%3c0
|
||||
cmp ax,03c2h
|
||||
je %%3c2
|
||||
cmp ax,03c3h
|
||||
je %%3c2
|
||||
jmp %%default
|
||||
|
||||
%%3c0
|
||||
mov dx,03dah
|
||||
in al,dx
|
||||
mov dl,0c0h
|
||||
shr eax,16
|
||||
or al,20h
|
||||
out dx,al
|
||||
shr eax,8
|
||||
out dx,al
|
||||
jmp %%loop
|
||||
|
||||
%%3c2
|
||||
mov dx,ax
|
||||
rol eax,8
|
||||
out dx,al
|
||||
jmp %%loop
|
||||
|
||||
%%default
|
||||
mov dx,ax
|
||||
shr eax,16
|
||||
out dx,ax
|
||||
jmp %%loop
|
||||
|
||||
%%end
|
||||
%endmacro
|
||||
|
||||
|
||||
SECTION .data
|
||||
|
||||
.Mode256x224c:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h
|
||||
dw 03d4h,04a04h,03d4h,09a05h,03d4h,00b06h,03d4h,03e07h,03d4h,00008h
|
||||
dw 03d4h,06109h,03d4h,0da10h,03d4h,0ac11h,03d4h,0bf12h,03d4h,02013h
|
||||
dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h
|
||||
dw 03c4h,00e04h,03cEh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
.Mode256x240c:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h
|
||||
dw 03d4h,04a04h,03d4h,09a05h,03d4h,00d06h,03d4h,03e07h,03d4h,00008h
|
||||
dw 03d4h,04109h,03d4h,0ea10h,03d4h,0ac11h,03d4h,0df12h,03d4h,02013h
|
||||
dw 03d4h,04014h,03d4h,0e715h,03d4h,00616h,03d4h,0a317h,03c4h,00101h
|
||||
dw 03c4h,00e04h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
.Mode256x256c:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h
|
||||
dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,0b207h,03d4h,00008h
|
||||
dw 03d4h,06109h,03d4h,00a10h,03d4h,0ac11h,03d4h,0FF12h,03d4h,02013h
|
||||
dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h
|
||||
dw 03c4h,00e04h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
.Mode256x256cs:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h
|
||||
dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,01d07h,03d4h,00008h
|
||||
dw 03d4h,06009h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02013h
|
||||
dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h
|
||||
dw 03c4h,00e04h,03ceh,04005h,03cEh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
.Mode320x224:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h
|
||||
dw 03d4h,05404h,03d4h,08005h,03d4h,00b06h,03d4h,03e07h,03d4h,00008h
|
||||
dw 03d4h,04109h,03d4h,0da10h,03d4h,09c11h,03d4h,0c012h,03d4h,02813h
|
||||
dw 03d4h,00014h,03d4h,0c715h,03d4h,00416h,03d4h,0e317h,03c4h,00101h
|
||||
dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
.Mode320x240:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h
|
||||
dw 03d4h,05404h,03d4h,08005h,03d4h,00d06h,03d4h,03e07h,03d4h,00008h
|
||||
dw 03d4h,04109h,03d4h,0ea10h,03d4h,0ac11h,03d4h,0df12h,03d4h,02813h
|
||||
dw 03d4h,00014h,03d4h,0e715h,03d4h,00616h,03d4h,0e317h,03c4h,00101h
|
||||
dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
.Mode320x256:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h
|
||||
dw 03d4h,05404h,03d4h,08005h,03d4h,02306h,03d4h,0b207h,03d4h,00008h
|
||||
dw 03d4h,06109h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02813h
|
||||
dw 03d4h,00014h,03d4h,00715h,03d4h,01a16h,03d4h,0e317h,03c4h,00101h
|
||||
dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
.Mode320x256s:
|
||||
dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h
|
||||
dw 03d4h,05404h,03d4h,08005h,03d4h,02306h,03d4h,01d07h,03d4h,00008h
|
||||
dw 03d4h,06009h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02813h
|
||||
dw 03d4h,00014h,03d4h,00715h,03d4h,01a16h,03d4h,0e317h,03c4h,00101h
|
||||
dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
|
||||
dd 0
|
||||
|
||||
|
||||
SECTION .text
|
||||
Reference in New Issue
Block a user