BIOS calls: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
No edit summary
(25 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Please see [[ASM Defines]] or [[C Defines]] for the hex addresses.
Please see [[68k ASM defines]] or [[C Defines]] for the hex addresses.


Simplify hierarchy and tell on which system each call works ?
= Jump tables =


= Universal BIOS calls =
{| class="regdef" style="text-align:center;"
|'''Call address'''
|'''[[NEO-EP0]] AES BIOS'''
|'''"SP-E" MVS BIOS'''
|'''"TOP-SP1-1" CDM3-2 BIOS''' & '''"FRONT-SP1" BIOS'''
|'''"NEOCD.BIN" CDZ BIOS'''
|-
|$C00402 to $C00432
|colspan="4"|Entry point
|-
|$C00438
|colspan="4"|[[SYSTEM_INT1]]
|-
|$C0043E
|colspan="2"|[[SYSTEM_INT2]]
|colspan="2"|RTS
|-
|$C00444
|colspan="4"|[[SYSTEM_RETURN]]
|-
|$C0044A
|colspan="4"|[[SYSTEM_IO]]
|-
|$C00450
|colspan="4"|[[CREDIT_CHECK]]
|-
|$C00456
|colspan="4"|[[CREDIT_DOWN]]
|-
|$C0045C
|RTS
|[[READ_CALENDAR]]
|colspan="2"|RTS
|-
|$C00462
|RTS
|[[SETUP_CALENDAR]]
|colspan="2"|RTS
|-
|$C00468
|colspan="4"|[[CARD]]
|-
|$C0046E
|colspan="4"|[[CARD_ERROR]]
|-
|$C00474
|colspan="2"|[[HOW_TO_PLAY]]
|colspan="2"|RTS
|-
|$C0047A
|colspan="2"|Calc a checksum and loop forever
|colspan="2"|RTS
|-
|$C00480 to $C004BC
|colspan="4"|RTS
|-
|$C004C2
|colspan="4"|[[FIX_CLEAR]]
|-
|$C004C8
|colspan="4"|[[LSP_1st]]
|-
|$C004CE
|colspan="4"|[[MESS_OUT]]
|-
|$C004D4
|colspan="4"|[[CONTROLLER_SETUP]]
|-
|$C004DA
|colspan="2"|RTS
|colspan="2"|HBlank handler
|-
|$C004E0 to $C004F2
|colspan="2"|Invalid
|colspan="2"|$FF0000 range register operations and RTEs
|-
|$C004F8 to $C0051C
|colspan="2"|Invalid
|colspan="2"|RTS
|-
|$C00522 to $C00540
|colspan="2"|Invalid
|colspan="2"|?
|-
|$C00546
|colspan="2"|Invalid
|colspan="2"|[[BIOSF_UPLOAD]]
|-
|$C0054C
|colspan="2"|Invalid
|colspan="2"|?
|-
|$C00552
|colspan="2"|Invalid
|colspan="2"|[[BIOSF_LOADFILE]]
|-
|$C00558
|colspan="2"|Invalid
|colspan="2"|?
|-
|$C0055E
|colspan="2"|Invalid
|colspan="2"|BIOSF_CDPLAYER
|-
|$C00564
|colspan="2"|Invalid
|colspan="2"|BIOSF_LOADFILEX (?)
|-
|$C0056A
|colspan="2"|Invalid
|colspan="2"|[[BIOSF_CDDACMD]]
|-
|$C00570
|colspan="2"|Invalid
|colspan="2"|[[BIOSF_VIDEOEN]]
|-
|$C00576 to $C00582
|colspan="2"|Invalid
|colspan="2"|?
|-
|$C00588 to $C00594
|colspan="2"|Invalid
|RTS
|?
|-
|$C0059A to $C006FC
|colspan="2"|Invalid
|colspan="2"|RTS
|}


= Generic BIOS calls =
BIOS calls common to every system.
BIOS calls common to every system.


== BIOSF_CLEARFIX: Clear fix layer ==
*[[FIX_CLEAR]]: Clear fix layer
*[[LSP_1st]]: Clear sprites
*[[SYSTEM_INT1]]: Multiple purpose VBL routine
*[[CARD]]: Perform memory card operation


== BIOSF_CLEARSPR: Clear sprites ==
= MVS only BIOS calls =
* [[READ_CALENDAR]]: Read the current calendar values and update the relevant BIOS RAM locations
* [[SETUP_CALENDAR]]: Set the calendar values to the data from the relevant BIOS RAM locations


== BIOSF_? ($C0044A):  (Called every frame) ==
= CD only BIOS calls =


Sets values in RAM according to buttons states. Often called each frame.
*[[BIOSF_VIDEOEN]]: Enable/disable video layers
*[[BIOSF_UPLOAD]]: Upload data to [[DRAM]]
*[[BIOSF_LOADFILE]]: Load file from CD (with animation)
*BIOSF_CDPLAYER ($C0055E): Reset to CD player
*BIOSF_LOADFILEX (?) ($C00564): Load file from CD (no animation)
*[[BIOSF_CDDACMD]]: Issue CDDA command


Memory locations set:
= CDZ only BIOS calls =
<pre>
BIOS_P1CURRENT    $10FD95 Joystick 1 state
BIOS_P1PREVIOUS    $10FD96 Previous joystick 1 state
BIOS_P1CHANGE      $10FD97 Joystick 1 state change (edges)
BIOS_P1REPEAT      $10FD98 Joystick 1 repeat (edge, and strobe if held more than ? calls)


BIOS_P2CURRENT    $10FD9B Joystick 2 state
Check track 0 ? [[Copy protection]]
BIOS_P2PREVIOUS    $10FD9C Previous joystick 2 state
BIOS_P2CHANGE      $10FD9D Joystick 2 state change (edges)
BIOS_P2REPEAT      $10FD9E Joystick 2 repeat (edge, and strobe if held more than ? calls)


BIOS_STATCURNT    Joystick 1/2 start/select state
[[Category:BIOS calls]]
BIOS_STATCHANGE    Previous Joystick 1/2 start/select state
</pre>
 
Bit definitions: see [[Joypads]]
 
= AES/MVS BIOS calls =
 
AES/MVS specific calls.
 
== BIOSF_CRDACCESS: Perform memory card operation ==
(Informations provided by [[User:Smkdan]])
 
Memory locations used (all 8bit):
 
<pre>
BIOS_CRDF      (8bit): function to perform when calling BIOSF_CRDACCESS, see below table
BIOS_CRDRESULT  (8bit): 00 on success, else 80+ and encodes the error, see below table
BIOS_CRDPTR    (32bit): pointer to read from/write to
BIOS_CRDSIZE    (16bit): how much data to read/write from/to card
BIOS_CRDNGH    (16bit): usually game NGH.  Unique identifier for the game that 'owns' the save file
BIOS_CRDFILE    (16bit): each NGH has up to 16 save 'files' associated with
</pre>
 
To access memory card, the RAM addresses above must be set depending on the function being attempted
BIOS_CRDF values:
 
;$00 (Format)
:No extra parameters
 
;$01 (Find)
:'''In''': BIOS_CRDNGH: NGH to find save files for
:'''Out''': BIOS_CRDFILE: 16bit mask containing 1 bits for each one of the 16 save files if present.
:0 bits mean the save file is not present. i.e. FFFF = all 16 saves used, 8000 = only save file 15 is used
 
;$02 (Load)
:'''In''':
:CRDPTR: pointer to store loaded data to
:CRDSIZE: the max size of data to load (automatically stops when entire file is loaded)
:CRDNGH: NGH of file
:CRDFILE: the file # of the given NGH to load from
 
;$03 (Save)
:'''In''':
:CRDPTR: pointer to read data to store to the card
:CRDSIZE: size of data to save
:CRDNGH: NGH of file
:CRDFILE: the file # of the given NGH to save as
 
;$04 (Delete)
:'''In''':
:CRDNGH: NGH of file
:CRDFILE: the file # of the given NGH to delete
 
;$05 (GETNAME)
:Gets name of a save file, forgot how these work...
 
;$06 (SETUSER) (the username of the card)
;$07 (GETUSER)
 
Errors may occur and the BIOS will store a value in BIOS_CRDRESULT depending on what went wrong:
*$00: no errors
*$80: no card inserted
*$81: card inserted, but not formatted
*$82: attempted to load a file that doesn't exist on the card
*$83: checksum error?
*$84: attempted to save to a full card
*$85: card write protect switch is active
 
= CD BIOS calls =
 
* Same ones as the AES/MVS ?
 
== BIOSF_UPLOAD ($C00546): Upload data to DRAM ==
 
Arguments:
*$10FEF8: Source (Long)
*$10FEF4: Destination (Long)
*$10FEDA: Zone (Byte, 0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT)
*$10FEFC: Size (Long)
*$10FEDB: Bank (Byte)
 
For FIX, Z80 (, PAT ?) and PCM upload, Destination has to be multiplied by 2 (8 bit busses).
SPR bank size is 1MiB (4 banks), PCM bank size is 512KiB (4 banks).
 
$10FEF4 is auto-incremented by the size upon completion, which allows to do multiple consecutive uploads.
 
== BIOSF_LOADFILE ($C00552): Load file from CD (with animation) ==
 
A0 points to a file information block made of:
*File name, ends with 0 (32 chars buffer ?)
*Bank (byte)
*Eventual padding bytes to align Offset
*Offset (long)
 
For FIX, Z80 and PCM files, Offset is multiplied by 2 (8 bit busses).
 
The destination memory is automatically chosen according to the file's extension.
 
== BIOSF_CDPLAYER ($C0055E): Reset to CD player ==
 
== BIOSF_CDDACMD ($C0056A): Issue CDDA command ==
 
Word in D0, command/track ?
 
= CDZ BIOS calls =
 
* Check track 0 ? [[Copy protection]]
 
[[Category:Code]]
[[Category:CPUs]]

Revision as of 01:42, 20 February 2020

Please see 68k ASM defines or C Defines for the hex addresses.

Jump tables

Call address NEO-EP0 AES BIOS "SP-E" MVS BIOS "TOP-SP1-1" CDM3-2 BIOS & "FRONT-SP1" BIOS "NEOCD.BIN" CDZ BIOS
$C00402 to $C00432 Entry point
$C00438 SYSTEM_INT1
$C0043E SYSTEM_INT2 RTS
$C00444 SYSTEM_RETURN
$C0044A SYSTEM_IO
$C00450 CREDIT_CHECK
$C00456 CREDIT_DOWN
$C0045C RTS READ_CALENDAR RTS
$C00462 RTS SETUP_CALENDAR RTS
$C00468 CARD
$C0046E CARD_ERROR
$C00474 HOW_TO_PLAY RTS
$C0047A Calc a checksum and loop forever RTS
$C00480 to $C004BC RTS
$C004C2 FIX_CLEAR
$C004C8 LSP_1st
$C004CE MESS_OUT
$C004D4 CONTROLLER_SETUP
$C004DA RTS HBlank handler
$C004E0 to $C004F2 Invalid $FF0000 range register operations and RTEs
$C004F8 to $C0051C Invalid RTS
$C00522 to $C00540 Invalid ?
$C00546 Invalid BIOSF_UPLOAD
$C0054C Invalid ?
$C00552 Invalid BIOSF_LOADFILE
$C00558 Invalid ?
$C0055E Invalid BIOSF_CDPLAYER
$C00564 Invalid BIOSF_LOADFILEX (?)
$C0056A Invalid BIOSF_CDDACMD
$C00570 Invalid BIOSF_VIDEOEN
$C00576 to $C00582 Invalid ?
$C00588 to $C00594 Invalid RTS ?
$C0059A to $C006FC Invalid RTS

Generic BIOS calls

BIOS calls common to every system.

MVS only BIOS calls

  • READ_CALENDAR: Read the current calendar values and update the relevant BIOS RAM locations
  • SETUP_CALENDAR: Set the calendar values to the data from the relevant BIOS RAM locations

CD only BIOS calls

CDZ only BIOS calls

Check track 0 ? Copy protection