BIOS RAM locations: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(44 intermediate revisions by 5 users not shown)
Line 1: Line 1:
The locations are (?) guaranteed to be identical accross all [[system ROM]] versions so that games can use them regardless of the system type.
=Game Related=
{| class="regdef"
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|$10FD84~$10FD93
|BIOS_GAME_DIP
|16 bytes
|BIOS
|[[Software DIPs]] values (game configuration)
|-
|$10FDAE
|BIOS_USER_REQUEST
|byte
|BIOS
|Request code for the [[USER subroutine]]. 0:Init, 1:Boot animation, 2:Demo, 3:Title
|-
|$10FDAF
|BIOS_USER_MODE
|byte
|BIOS/Game
|Used by the game to tell what it's doing: 0:Init/Boot animation, 1:Title/Demo, 2:Game
[[Game selection]] can only be done on MVS systems when this byte is < 2
|-
|$10FDB0
|BIOS_CREDIT_DEC
|4 bytes
|Game
|Credit decrement value for each player (1, 2, 3, 4) when calling [[CREDIT DOWN]].
|-
|$10FDB4
|BIOS_START_FLAG
|byte
|BIOS
|Used when calling the [[PLAYER START subroutine]]. The 4 LSBs correspond to the player who pushed start.
|-
|$10FDB6
|BIOS_PLAYER_MOD1
|byte
|Game
|rowspan="4|Sets player status. 0:Never played, 1:Playing, 2:Continue option being displayed, 3:Game over
|-
|$10FDB7
|BIOS_PLAYER_MOD2
|byte
|Game
|-
|$10FDB8
|BIOS_PLAYER_MOD3
|byte
|Game
|-
|$10FDB9
|BIOS_PLAYER_MOD4
|byte
|Game
|-
|$10FEC5
|BIOS_TITLE_MODE
|byte
|BIOS/Game
|Newer games set this to 1 in their command 3 [[USER subroutine]]. It prevents the system ROM from calling command 3 twice after game over if credits are already in the system.
|}
=System Related=
{| class="regdef"
{| class="regdef"
| '''Address'''
| '''Address'''
Line 10: Line 82:
|byte
|byte
|BIOS
|BIOS
|0:system mode, 1:game mode
|0:BIOS wants vblank (system mode), $80:Ok to use vblank (game mode)
|-
|$10FD81
|BIOS_SYSRET_STATUS
|byte
|BIOS
|Internal value which stores the function code that [[SYSTEM_RETURN]] will call.
*0 : Init bram/select valid game for eye-catcher
*1 : Set the EL-LED to the correct value
*2 : Switch to the next slot, relaunch eye-catcher
*3 : After a gameover, save the playtime for bookeeping, switch to DEMO mode, reset the workbackup ram
*4 : Switch next slot (select p1 pressed)
*5 : Switch to previous slot (select p2 pressed)
*6 : Called after a coin deposit, does nothing
|-
|-
|$10FD82
|$10FD82
Line 16: Line 101:
|byte
|byte
|BIOS
|BIOS
|0:AES, 1:MVS
|System type. 0:AES, 1:MVS
|-
|-
|$10FD83
|$10FD83
Line 24: Line 109:
|0:Japan, 1:USA, 2:Europe
|0:Japan, 1:USA, 2:Europe
|-
|-
|$10FD84~$10FD93
|$10FE80
|BIOS_GAME_DIP
|BIOS_DEVMODE
|16 bytes
|8 bytes
|BIOS
|BIOS
|[[Software DIPs]] values
|All set to 0x00 in normal mode. Set to "1streset" string in developer mode
|}
 
=Joypad Related=
 
These values are updated by calling [[SYSTEM_IO]].
 
{| class="regdef"
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|-
|$10FD94
|$10FD94
Line 34: Line 131:
|byte
|byte
|BIOS
|BIOS
|0:no connection, 1:normal joypad, 2:expanded joypad, 3:Mahjong controller, 4:Keyboard
|0:No connection, 1:Normal joypad, 2:Expanded joypad, 3:Mahjong controller, 4:Keyboard
|-
|-
|$10FD95
|$10FD95
Line 40: Line 137:
|byte
|byte
|BIOS
|BIOS
|DCBA Right Left Bottom Top (positive logic)
|Inputs on previous frame [DCBA Right Left Down Up] (positive logic).
|-
|-
|$10FD96
|$10FD96
Line 46: Line 143:
|byte
|byte
|BIOS
|BIOS
|DCBA Right Left Bottom Top (positive logic)
|Inputs on current frame [DCBA Right Left Down Up] (positive logic).
|-
|-
|$10FD97
|$10FD97
Line 52: Line 149:
|byte
|byte
|BIOS
|BIOS
|Active edge DCBA Right Left Bottom Top (positive logic)
|Buttons just pressed, active edge [DCBA Right Left Down Up] (positive logic).
|-
|-
|$10FD98
|$10FD98
Line 58: Line 155:
|byte
|byte
|BIOS
|BIOS
|Active edge + repeat every 8 frames after 16 frames. DCBA Right Left Bottom Top (positive logic)
|Active edge + repeat every 8 frames after 16 frames. [DCBA Right Left Down Up] (positive logic).
|-
|-
|$10FD99
|$10FD99
Line 64: Line 161:
|byte
|byte
|BIOS
|BIOS
|Countdown ?
|Repeat timer (counts down from 8 to 0).
|-
|-
|$10FD9A~$10FD9F
|$10FD9A~$10FD9F
|Same for P2
|Same for P2
|5 bytes
|6 bytes
|BIOS
|BIOS
|See above
|See above
Line 74: Line 171:
|$10FDA0~$10FDA6
|$10FDA0~$10FDA6
|Same for P3
|Same for P3
|5 bytes
|6 bytes
|BIOS
|BIOS
|See above
|See above
Line 80: Line 177:
|$10FDA7~$10FDAB
|$10FDA7~$10FDAB
|Same for P4
|Same for P4
|5 bytes
|6 bytes
|BIOS
|BIOS
|See above
|See above
Line 89: Line 186:
|BIOS
|BIOS
|Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)
|Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)
On AES systems the select bits are always read as 0 ?
|-
|-
|$10FDAD
|$10FDAD
Line 95: Line 194:
|BIOS
|BIOS
|Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)
|Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)
On AES systems the select bits are always read as 0 ?
|-
|-
|$10FDAE
|$10FEDC
|BIOS_USER_REQUEST
|BIOS_STATCURNT_RAW
|byte
|BIOS
|Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)
|-
|$10FEDD
|BIOS_STATCHANGE_RAW
|byte
|byte
|BIOS
|BIOS
|Set by the [[USER subroutine]]. 0:Init, 1:Boot animation, 2:Demo, 3:Title
|Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)
|}
 
=Memory Card Related=
 
See [[CARD]] for more details on those variables.
 
{| class="regdef"
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|-
|$10FDAF
|$10FDC4
|BIOS_USER_MODE
|BIOS_CARD_COMMAND
|byte
|byte
|Game
|BIOS or Game
|0:Init/Boot animation, 1:Title/Demo, 3:Game
|Command to execute
|-
|-
|$10FDB0
|$10FDC5
|BIOS_CREDIT_DEC
|BIOS_CARD_MODE
|4 bytes
|byte
|Game
|BIOS?
|Credit decrement value for each player when calling [[CREDIT DOWN]].
|Internal use?
|-
|-
|$10FDB4
|$10FDC6
|BIOS_START_FLAG
|BIOS_CARD_ANSWER
|byte
|byte
|BIOS
|BIOS
|Used when calling the [[PLAYER START subroutine]]. Last 4 bits correspond to the player who pushed start.
|Answer code for the command
|-
|$10FDC8
|BIOS_CARD_START
|longword
|BIOS or Game
|Pointer to data
|-
|-
|$10FDB6
|$10FDCC
|BIOS_PLAYER_MOD
|BIOS_CARD_SIZE
|4 bytes
|word
|Game
|BIOS or Game
|Sets player status. 0:Never played, 1:Playing, 2:Continue option being displayed, 3:Game over
|Size of data
|-
|$10FDCE
|BIOS_CARD_FCB
|word
|BIOS or Game
|Game NGH number
|-
|$10FDD0
|BIOS_CARD_SUB
|byte or word
|BIOS or Game
|Game Subnumber
|}
 
=MESS OUT Related=
 
See [[MESS_OUT]] to know how to use this routine.
 
{| class="regdef"
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|-
|$10FDBE
|$10FDBE
Line 130: Line 279:
|longword
|longword
|Game
|Game
|[[MESS_OUT]] buffer pointer
|Buffer pointer
|-
|-
|$10FDC2
|$10FDC2
Line 137: Line 286:
|Game
|Game
|0:Allow MESS_OUT, 1:Skip MESS_OUT
|0:Allow MESS_OUT, 1:Skip MESS_OUT
|}
=Calendar Related=
Those value are updated when [[READ_CALENDAR]] is called
{| class="regdef"
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|$10FDD2
|BIOS_YEAR
|byte
|BIOS
|Current year
|-
|$10FDD3
|BIOS_MONTH
|byte
|BIOS
|Current month
|-
|$10FDD4
|BIOS_DAY
|byte
|BIOS
|Current day
|-
|$10FDD5
|BIOS_WEEKDAY
|byte
|BIOS
|Current weekday (Sunday = 00, Monday = 01 ... Saturday = 06)
|-
|$10FDD6
|BIOS_HOUR
|byte
|BIOS
|Current hour (24h format)
|-
|$10FDD7
|BIOS_MINUTE
|byte
|BIOS
|Current minute
|-
|$10FDD8
|BIOS_SECOND
|byte
|BIOS
|Current minute
|}
=Internal=
{| class="regdef"
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|$10FCEF
|BIOS_SLOTCHECK
|byte
|BIOS
|[[Slot check]] passed if non-zero
|-
|$10FDDA
|BIOS_COMPULSION_TIMER
|byte
|BIOS
|Timer for the game compulsion start feature, in seconds. BCD format.
|-
|$10FDDB
|BIOS_COMPULSION_FRAME_TIMER
|byte
|BIOS
|Frame-based timer for the game compulsion start feature.
When it underflows, the timer is reset to 59 and START_COMPULSION_TIMER is decremented.
|-
|$10FE88
|BIOS_FRAME_COUNTER
|longword
|BIOS
|Frame counter, updated by SYSTEM_IO.
|-
|$10FEBF
|BIOS_BRAM_USED
|byte
|BIOS
|0:[[Backup RAM]] not currently used, 1:Currently used
|-
|$10FEE1
|BIOS_FRAME_SKIP
|byte
|BIOS
|Number of frames to skip in the routine which checks demo_end or if the player has pressed start.
Decremented in [[SYSTEM_IO]].
|-
|$10FEE3
|BIOS_INT1_SKIP
|byte
|BIOS
|Only used in [[SYSTEM_INT1]]. If non-zero, will only do the [[RTC]] check during INT1.
|-
|-
|$10FEE4
|$10FEE4
|
|BIOS_INT1_FRAME_COUNTER
|byte
|BIOS
|Frame counter, only used in [[SYSTEM_INT1]]
|}
 
=4P mode related=
 
Thoses will be valid on a 4P compatible bios only
 
{| class="regdef"
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|$10FEF8
|BIOS_4P_REQUESTED
|byte
|BIOS
|Keeps a local copy of hard dip 2 status on bootup.
 
0: dip2 wasn't set
 
$2: dip 2 was on.
|-
|$10FEFA
|BIOS_4P_MODE
|byte
|byte
|BIOS
|BIOS
|Frame counter (internal)
|Main 4P flag, is set when hard dip 2 is on and 4P board is found.
 
0: regular play
 
$FF: 4P mode game
|-
|$10FEFB
|BIOS_4P_PLUGGED
|byte
|BIOS
|0: 4P board not found
 
$FF: 4P board plugged
 
4P compatible bios will check for 4P board regardless of dip2 switch status.
|}
|}


; Memory card related:
=CD only=
*BIOS_CRDF      equ $10FDC4 ;byte: function to perform when calling BIOSF_CRDACCESS, see below table
 
*BIOS_CRDRESULT  equ $10FDC6 ;byte: 00 on success, else 80+ and encodes the error, see below table
{| class="regdef"
*BIOS_CRDPTR    equ $10FDC8 ;longword: pointer to read from/write to
| '''Address'''
*BIOS_CRDSIZE    equ $10FDCC ;word: how much data to read/write from/to card
| '''DEF name'''
*BIOS_CRDNGH    equ $10FDCE ;word: usually game NGH. Unique identifier for the game that 'owns' the save file
| '''Size'''
*BIOS_CRDFILE    equ $10FDD0 ;word: each NGH has up to 16 save 'files' associated with
| '''Set by'''
| '''Description'''
|-
|$10FEF4
|BIOS_UPDEST
|Long
|Game
|Copy destination address
|-
|$10FEF8
|BIOS_UPSRC
|Long
|Game
|Copy source address
|-
|$10FEFC
|BIOS_UPSIZE
|Long
|Game
|Copy data size
|-
|$10FEDA
|BIOS_UPZONE
|Byte
|Game
|Copy zone (0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT, 7=OBJ, 8=A** files)
|-
|$10FEDB
|BIOS_UPBANK
|Byte
|Game
|Copy bank
|}


; Calendar, only on MVS (in BCD)
=Others=
*BIOS_YEAR      equ $10FDD2 ;last 2 digits of year
*BIOS_MONTH      equ $10FDD3
*BIOS_DAY        equ $10FDD4
*BIOS_WEEKDAY    equ $10FDD5 ;Sunday = 00, Monday = 01 ... Saturday = 06
*BIOS_HOUR      equ $10FDD6 ;24 hour time
*BIOS_MINUTE    equ $10FDD7
*BIOS_SECOND    equ $10FDD8


*BIOS_SELECT_TIMER equ $10FDDA ;Byte: game start countdown
{| class="regdef"
*BIOS_DEVMODE      equ $10FE80 ;Byte: non-zero for developer mode
| '''Address'''
| '''DEF name'''
| '''Size'''
| '''Set by'''
| '''Description'''
|-
|$10FCEE
|?
|byte
|GAME
|Z80/M ROM check pass


; Upload to DRAM
|}
*BIOS_UPDEST    equ $10FEF4 ;longword: destination address (!)
*BIOS_UPSRC      equ $10FEF8 ;longword: source address
*BIOS_UPSIZE    equ $10FEFC ;longword: size
*BIOS_UPZONE    equ $10FEDA ;byte: zone (0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT)
*BIOS_UPBANK    equ $10FEDB ;byte: bank


[[Category:Base system]]
[[Category:Base system]]

Latest revision as of 00:05, 20 August 2018

The locations are (?) guaranteed to be identical accross all system ROM versions so that games can use them regardless of the system type.

Game Related

Address DEF name Size Set by Description
$10FD84~$10FD93 BIOS_GAME_DIP 16 bytes BIOS Software DIPs values (game configuration)
$10FDAE BIOS_USER_REQUEST byte BIOS Request code for the USER subroutine. 0:Init, 1:Boot animation, 2:Demo, 3:Title
$10FDAF BIOS_USER_MODE byte BIOS/Game Used by the game to tell what it's doing: 0:Init/Boot animation, 1:Title/Demo, 2:Game

Game selection can only be done on MVS systems when this byte is < 2

$10FDB0 BIOS_CREDIT_DEC 4 bytes Game Credit decrement value for each player (1, 2, 3, 4) when calling CREDIT DOWN.
$10FDB4 BIOS_START_FLAG byte BIOS Used when calling the PLAYER START subroutine. The 4 LSBs correspond to the player who pushed start.
$10FDB6 BIOS_PLAYER_MOD1 byte Game Sets player status. 0:Never played, 1:Playing, 2:Continue option being displayed, 3:Game over
$10FDB7 BIOS_PLAYER_MOD2 byte Game
$10FDB8 BIOS_PLAYER_MOD3 byte Game
$10FDB9 BIOS_PLAYER_MOD4 byte Game
$10FEC5 BIOS_TITLE_MODE byte BIOS/Game Newer games set this to 1 in their command 3 USER subroutine. It prevents the system ROM from calling command 3 twice after game over if credits are already in the system.

System Related

Address DEF name Size Set by Description
$10FD80 BIOS_SYSTEM_MODE byte BIOS 0:BIOS wants vblank (system mode), $80:Ok to use vblank (game mode)
$10FD81 BIOS_SYSRET_STATUS byte BIOS Internal value which stores the function code that SYSTEM_RETURN will call.
  • 0 : Init bram/select valid game for eye-catcher
  • 1 : Set the EL-LED to the correct value
  • 2 : Switch to the next slot, relaunch eye-catcher
  • 3 : After a gameover, save the playtime for bookeeping, switch to DEMO mode, reset the workbackup ram
  • 4 : Switch next slot (select p1 pressed)
  • 5 : Switch to previous slot (select p2 pressed)
  • 6 : Called after a coin deposit, does nothing
$10FD82 BIOS_MVS_FLAG byte BIOS System type. 0:AES, 1:MVS
$10FD83 BIOS_COUNTRY_CODE byte BIOS 0:Japan, 1:USA, 2:Europe
$10FE80 BIOS_DEVMODE 8 bytes BIOS All set to 0x00 in normal mode. Set to "1streset" string in developer mode

Joypad Related

These values are updated by calling SYSTEM_IO.

Address DEF name Size Set by Description
$10FD94 BIOS_P1STATUS byte BIOS 0:No connection, 1:Normal joypad, 2:Expanded joypad, 3:Mahjong controller, 4:Keyboard
$10FD95 BIOS_P1PREVIOUS byte BIOS Inputs on previous frame [DCBA Right Left Down Up] (positive logic).
$10FD96 BIOS_P1CURRENT byte BIOS Inputs on current frame [DCBA Right Left Down Up] (positive logic).
$10FD97 BIOS_P1CHANGE byte BIOS Buttons just pressed, active edge [DCBA Right Left Down Up] (positive logic).
$10FD98 BIOS_P1REPEAT byte BIOS Active edge + repeat every 8 frames after 16 frames. [DCBA Right Left Down Up] (positive logic).
$10FD99 BIOS_P1TIMER byte BIOS Repeat timer (counts down from 8 to 0).
$10FD9A~$10FD9F Same for P2 6 bytes BIOS See above
$10FDA0~$10FDA6 Same for P3 6 bytes BIOS See above
$10FDA7~$10FDAB Same for P4 6 bytes BIOS See above
$10FDAC BIOS_STATCURNT byte BIOS Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)

On AES systems the select bits are always read as 0 ?

$10FDAD BIOS_STATCHANGE byte BIOS Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)

On AES systems the select bits are always read as 0 ?

$10FEDC BIOS_STATCURNT_RAW byte BIOS Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)
$10FEDD BIOS_STATCHANGE_RAW byte BIOS Select P4, Start P4, Select P3, Start P3, Select P2, Start P2, Select P1, Start P1 (positive logic)

Memory Card Related

See CARD for more details on those variables.

Address DEF name Size Set by Description
$10FDC4 BIOS_CARD_COMMAND byte BIOS or Game Command to execute
$10FDC5 BIOS_CARD_MODE byte BIOS? Internal use?
$10FDC6 BIOS_CARD_ANSWER byte BIOS Answer code for the command
$10FDC8 BIOS_CARD_START longword BIOS or Game Pointer to data
$10FDCC BIOS_CARD_SIZE word BIOS or Game Size of data
$10FDCE BIOS_CARD_FCB word BIOS or Game Game NGH number
$10FDD0 BIOS_CARD_SUB byte or word BIOS or Game Game Subnumber

MESS OUT Related

See MESS_OUT to know how to use this routine.

Address DEF name Size Set by Description
$10FDBE BIOS_MESS_POINT longword Game Buffer pointer
$10FDC2 BIOS_MESS_BUSY byte Game 0:Allow MESS_OUT, 1:Skip MESS_OUT

Calendar Related

Those value are updated when READ_CALENDAR is called

Address DEF name Size Set by Description
$10FDD2 BIOS_YEAR byte BIOS Current year
$10FDD3 BIOS_MONTH byte BIOS Current month
$10FDD4 BIOS_DAY byte BIOS Current day
$10FDD5 BIOS_WEEKDAY byte BIOS Current weekday (Sunday = 00, Monday = 01 ... Saturday = 06)
$10FDD6 BIOS_HOUR byte BIOS Current hour (24h format)
$10FDD7 BIOS_MINUTE byte BIOS Current minute
$10FDD8 BIOS_SECOND byte BIOS Current minute

Internal

Address DEF name Size Set by Description
$10FCEF BIOS_SLOTCHECK byte BIOS Slot check passed if non-zero
$10FDDA BIOS_COMPULSION_TIMER byte BIOS Timer for the game compulsion start feature, in seconds. BCD format.
$10FDDB BIOS_COMPULSION_FRAME_TIMER byte BIOS Frame-based timer for the game compulsion start feature.

When it underflows, the timer is reset to 59 and START_COMPULSION_TIMER is decremented.

$10FE88 BIOS_FRAME_COUNTER longword BIOS Frame counter, updated by SYSTEM_IO.
$10FEBF BIOS_BRAM_USED byte BIOS 0:Backup RAM not currently used, 1:Currently used
$10FEE1 BIOS_FRAME_SKIP byte BIOS Number of frames to skip in the routine which checks demo_end or if the player has pressed start.

Decremented in SYSTEM_IO.

$10FEE3 BIOS_INT1_SKIP byte BIOS Only used in SYSTEM_INT1. If non-zero, will only do the RTC check during INT1.
$10FEE4 BIOS_INT1_FRAME_COUNTER byte BIOS Frame counter, only used in SYSTEM_INT1

4P mode related

Thoses will be valid on a 4P compatible bios only

Address DEF name Size Set by Description
$10FEF8 BIOS_4P_REQUESTED byte BIOS Keeps a local copy of hard dip 2 status on bootup.

0: dip2 wasn't set

$2: dip 2 was on.

$10FEFA BIOS_4P_MODE byte BIOS Main 4P flag, is set when hard dip 2 is on and 4P board is found.

0: regular play

$FF: 4P mode game

$10FEFB BIOS_4P_PLUGGED byte BIOS 0: 4P board not found

$FF: 4P board plugged

4P compatible bios will check for 4P board regardless of dip2 switch status.

CD only

Address DEF name Size Set by Description
$10FEF4 BIOS_UPDEST Long Game Copy destination address
$10FEF8 BIOS_UPSRC Long Game Copy source address
$10FEFC BIOS_UPSIZE Long Game Copy data size
$10FEDA BIOS_UPZONE Byte Game Copy zone (0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT, 7=OBJ, 8=A** files)
$10FEDB BIOS_UPBANK Byte Game Copy bank

Others

Address DEF name Size Set by Description
$10FCEE ? byte GAME Z80/M ROM check pass