Difference between revisions of "HOW TO PLAY"

From NeoGeo Development Wiki
Jump to: navigation, search
(Created page with "= HOW_TO_PLAY ($C00474) = The HOW_TO_PLAY routines build a "how to play" screen. It execute the commands buffer at $10F300. == Command list == Each command is always 4 byt...")
 
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= HOW_TO_PLAY ($C00474) =
+
[[File:howtoplay_nam.png|thumb|A "scripted" how-to-play screen.]]
  
The HOW_TO_PLAY routines build a "how to play" screen.
+
The HOW_TO_PLAY ($C00474) [[system ROM]] call builds and animates an "how to play" screen from a command list. Only a few games use this call.
  
It execute the commands buffer at $10F300.
+
The graphics are set up using the [[fix layer]] with hardcoded tile numbers (todo: get tilemaps).
  
== Command list ==
+
=Command list=
  
Each command is always 4 bytes.
+
The command list must be loaded at $10F300 (how many bytes reserved ?).
  
The command list end with a null command ($00000000).
+
Each command is a longword (4 bytes):
  
=== Loop control ($0-$FF) ===
+
* The rightmost byte is the command parameter
 +
* The next byte is the command type (0~3)
 +
* If the command type isn't recognized, the longword is processed as being a pointer to a [[MESS OUT]] data buffer
 +
* The end command is $00000000
  
Setup loop counter value or decrement current loop counter.
+
<pre>
 +
00000000 00000000 000000TT PPPPPPPP
 +
</pre>
  
Every between a counter setup and a counter decrement is looped until the counter reaches $00.
+
==Type 0: Loop control==
  
$FF decrement the current counter, other value setup the counter.
+
* If the parameter byte is less than $FF: Set a loop counter to that value
 +
* If the parameter byte is equal to $FF: Decrement the loop counter and loop back to the previous setup command until it reaches 0
  
=== Arrow data ($100-$1FF) ===
+
==Type 1: Joystick state==
  
Set the color of each arrow.
+
Sets the color of each joystick direction arrow.
  
1 = light blue (pressed)
+
* 1 is light blue (pressed)
 
+
* 0 is dark blue (released)
0 = dark blue (released)
 
  
 
{{8BitRegister
 
{{8BitRegister
Line 46: Line 51:
 
}}
 
}}
  
If followed by a null command ($0.l) the next word contain a number of frame to wait before executing new commands.
+
If followed by a null command ($0.l) the next 16-bit word specifies a number of frames to wait before executing the next command.
 
 
=== Buttons data ($200-$2FF) ===
 
  
Set the state of each buttons.
+
==Type 2: Buttons state==
  
1 = pressed
+
Sets the state of each button.
  
0 = released
+
* 1 is pressed
 +
* 0 is released
  
 
{{8BitRegister
 
{{8BitRegister
|0
+
| -
 
|4
 
|4
|A
+
|D
 +
|1
 +
|C
 
|1
 
|1
 
|B
 
|B
 
|1
 
|1
|C
+
|A
|1
 
|D
 
 
|1
 
|1
 
}}
 
}}
  
If followed by a null command ($0.l) the next word contain a number of frame to wait before executing new commands.
+
If followed by a null command ($0.l) the next 16-bit word specifies a number of frames to wait before executing the next command.
 +
 
 +
==Any other type: Text update==
 +
 
 +
The longword value is a pointer to a [[MESS_OUT]] data buffer.
 +
 
 +
This command is '''always''' followed by a 16-bit word value which specifies a number of frames to wait before executing the next command.
 +
 
 +
=Example=
 +
 
 +
[[NAM-1975]] sets up the following command list:
  
=== Text ===
+
<pre>
 +
0000 0200    All buttons released
 +
0000 01FF    All arrows highlighted
 +
0010 F3E2    MESS_OUT write "NAM 1975" "CONTROL HERO AND CURSOR"
 +
0004        Wait 4 frames
 +
0000 000C    Init loop counter to 12
 +
0000 0100    All arrows cleared      <--------------,
 +
0000 0000    Wait...                                |
 +
0008        ...8 frames                            |
 +
0000 01FF    All arrows highlighted                  |
 +
0000 0000    Wait...                                |
 +
0008        ...8 frames                            |
 +
0000 00FF    Loop back (blink all arrows 12 times) --'
 +
0000 0201    A button is pressed
 +
0000 0100    All arrows cleared
 +
0010 F418    MESS_OUT write "MACHINE GUN"
 +
0004        Wait 4 frames
 +
0000 000C    Init loop counter to 12
 +
0000 0200    All buttons released    <--------------,
 +
0000 0000    Wait...                                |
 +
0008        ...8 frames                            |
 +
0000 0201    A button is pressed                    |
 +
0000 0000    Wait...                                |
 +
0008        ...8 frames                            |
 +
0000 00FF    Loop back (blink A button 12 times) ----'
 +
...
 +
</pre>
  
Pointer to a [[MESS_OUT]] data buffer.
+
=List of games known to use HOW_TO_PLAY=
  
Always followed by a word value which specify the number of frame to wait before executing new commands.
+
* [[NAM-1975]]
 +
* [[Baseball Stars Professional]]
 +
* [[Mahjong Kyo Retsuden]]
 +
* ...
  
 +
[[Category:Code]]
 
[[Category:BIOS calls]]
 
[[Category:BIOS calls]]

Latest revision as of 00:06, 13 June 2017

A "scripted" how-to-play screen.

The HOW_TO_PLAY ($C00474) system ROM call builds and animates an "how to play" screen from a command list. Only a few games use this call.

The graphics are set up using the fix layer with hardcoded tile numbers (todo: get tilemaps).

Command list

The command list must be loaded at $10F300 (how many bytes reserved ?).

Each command is a longword (4 bytes):

  • The rightmost byte is the command parameter
  • The next byte is the command type (0~3)
  • If the command type isn't recognized, the longword is processed as being a pointer to a MESS OUT data buffer
  • The end command is $00000000
00000000 00000000 000000TT PPPPPPPP

Type 0: Loop control

  • If the parameter byte is less than $FF: Set a loop counter to that value
  • If the parameter byte is equal to $FF: Decrement the loop counter and loop back to the previous setup command until it reaches 0

Type 1: Joystick state

Sets the color of each joystick direction arrow.

  • 1 is light blue (pressed)
  • 0 is dark blue (released)
Bit 7 6 5 4 3 2 1 0
Def Up-Right Right Down-Right Down Down-Left Left Up-Left Up

If followed by a null command ($0.l) the next 16-bit word specifies a number of frames to wait before executing the next command.

Type 2: Buttons state

Sets the state of each button.

  • 1 is pressed
  • 0 is released
Bit 7 6 5 4 3 2 1 0
Def - D C B A

If followed by a null command ($0.l) the next 16-bit word specifies a number of frames to wait before executing the next command.

Any other type: Text update

The longword value is a pointer to a MESS_OUT data buffer.

This command is always followed by a 16-bit word value which specifies a number of frames to wait before executing the next command.

Example

NAM-1975 sets up the following command list:

0000 0200    All buttons released
0000 01FF    All arrows highlighted
0010 F3E2    MESS_OUT write "NAM 1975" "CONTROL HERO AND CURSOR"
0004         Wait 4 frames
0000 000C    Init loop counter to 12
0000 0100    All arrows cleared       <--------------,
0000 0000    Wait...                                 |
0008         ...8 frames                             |
0000 01FF    All arrows highlighted                  |
0000 0000    Wait...                                 |
0008         ...8 frames                             |
0000 00FF    Loop back (blink all arrows 12 times) --'
0000 0201    A button is pressed
0000 0100    All arrows cleared
0010 F418    MESS_OUT write "MACHINE GUN"
0004         Wait 4 frames
0000 000C    Init loop counter to 12
0000 0200    All buttons released     <--------------,
0000 0000    Wait...                                 |
0008         ...8 frames                             |
0000 0201    A button is pressed                     |
0000 0000    Wait...                                 |
0008         ...8 frames                             |
0000 00FF    Loop back (blink A button 12 times) ----'
...

List of games known to use HOW_TO_PLAY