HOW TO PLAY: Difference between revisions
(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 (→Tilemap: minor clarification) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[File:howtoplay_nam.png|thumb|A "scripted" how-to-play screen.]] | |||
The HOW_TO_PLAY | 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. | |||
=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 | |||
<pre> | |||
00000000 00000000 000000TT PPPPPPPP | |||
</pre> | |||
==Type 0: Loop control== | |||
$FF | * 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 | * 1 is light blue (pressed) | ||
* 0 is dark blue (released) | |||
0 | |||
{{8BitRegister | {{8BitRegister | ||
Line 46: | Line 51: | ||
}} | }} | ||
If followed by a null command ($0.l) the next word | 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 | * 1 is pressed | ||
* 0 is released | |||
0 | |||
{{8BitRegister | {{8BitRegister | ||
| | | - | ||
|4 | |4 | ||
| | |D | ||
|1 | |||
|C | |||
|1 | |1 | ||
|B | |B | ||
|1 | |1 | ||
| | |A | ||
|1 | |1 | ||
}} | }} | ||
If followed by a null command ($0.l) the next word | 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: | |||
<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> | |||
=List of games known to use HOW_TO_PLAY= | |||
* [[NAM-1975]] | |||
* [[Baseball Stars Professional]] | |||
* [[Mahjong Kyo Retsuden]] | |||
* ... | |||
== | =Tilemap= | ||
[[File:howtoplay_tilemap.png|thumb|how-to-play tilemap, with each 8x16 block turned into the low-byte of it's hex address]] | |||
The tiles that make up the HOW_TO_PLAY screen are found in pages 7 and 8 of the Fix rom. Much like how MESS OUT handles 8x16 text, each tile in page 7 has a counterpart at the same position on page 8, which gets displayed immediately below. (The exception to this is the black tiles around the edges, which are all 0x07FF.)<br \> | |||
Given this unifom layout of adjacent rows, the below table combines each pair and lists only the low byte. | |||
The interior of the lower text area is initialized with rows of 0x9920 and 0x9A20; the 8x16 spaces from fontset 9, in palette 9. | |||
{|class="wikitable" | |||
|+Overall Layout | |||
|- | |||
|FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF||FF | |||
|- | |||
|FF||00||01||04||05||05||05||05||05||05||05||05||05||05||05||05||05||05||05||06||07||07||07||07||07||07||07||07||07||07||07||07||07||07||07||07||07||07 | |||
|- | |||
|FF||02||03||08||09||09||09||09||09||09||09||09||09||09||09||09||09||09||09||0A||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B||0B | |||
|- | |||
|FF||03||03||0C||0D||0E||0F||10||11||12||13||14||15||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||0F||63||64||65 | |||
|- | |||
|FF||03||03||0C||5C||5D||5D||16||17||18||19||1A||1B||5D||5D||5D||5D||5D||5D||5D||5D||2C||2D||2E||2F||30||31||32||33||34||35||36||37||5D||5D||5D||5D||5D | |||
|- | |||
|FF||03||03||0C||5D||5D||5D||1C||1D||1E||1F||20||21||5D||5D||5D||5D||5D||38||39||3A||3B||3C||3D||3E||3F||40||41||42||43||44||45||46||5D||5D||5D||5D||5D | |||
|- | |||
|FF||03||03||0C||5E||5D||5D||22||23||24||25||26||27||5D||5D||5D||5D||5D||47||48||49||4A||4B||4C||4D||4E||4F||50||51||52||53||54||55||5D||5D||5D||5D||5D | |||
|- | |||
|FF||03||03||0C||5F||5D||5D||5D||28||29||2A||2B||5D||5D||5D||5D||5D||5D||56||57||58||59||59||59||59||59||59||59||59||59||59||5A||5B||5D||5D||5D||5D||5D | |||
|- | |||
|FF||68||69||0C||60||61||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||62||66||67 | |||
|- | |||
|FF||6A||6B||6C||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||6D||76||77||77||77 | |||
|- | |||
|FF||03||03||6F||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||78||79||79||79 | |||
|- | |||
|FF||6E||03||70||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||7A||7B||7B||7B | |||
|- | |||
|FF||72||73||71||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||20||7C||7D||7D||7D | |||
|- | |||
|FF||FF||FF||74||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||75||7E||FF||FF||FF | |||
|} | |||
* The joystick (10-2B) uses palette 0x0, which changes to highlight the directions. | |||
** Within palette 0x0, colors 5-C map to the joystick directions, starting at Up and rotating anticlockwise. | |||
** Note: the top-halves of tiles 10-15 are in palette 0xD instead. | |||
* The buttons (2C-5B) use palette 0xA when dim, and 0xB when illuminated. | |||
** A tiles: 38-3B, 47-4B, 56-58 | |||
** B tiles: 2C-2F, 3C-3E, 4C-4D | |||
** C tiles: 30-33, 3F-42, 4E-51 | |||
** D tiles: 34-37, 43-46, 52-55 | |||
** tiles 59-5B are drawn in the dim palette and never turn bright | |||
* The text-boxes frames (04-06, 08-0A, 6C-6D, 6F-71, 74-76, 78, 7A, 7C, 7E) have palette 0xC. | |||
* The rest of the control panel uses palette 0xD. | |||
[[Category:Code]] | |||
[[Category:BIOS calls]] | [[Category:BIOS calls]] |
Latest revision as of 04:39, 3 March 2021
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.
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
Tilemap
The tiles that make up the HOW_TO_PLAY screen are found in pages 7 and 8 of the Fix rom. Much like how MESS OUT handles 8x16 text, each tile in page 7 has a counterpart at the same position on page 8, which gets displayed immediately below. (The exception to this is the black tiles around the edges, which are all 0x07FF.)
Given this unifom layout of adjacent rows, the below table combines each pair and lists only the low byte.
The interior of the lower text area is initialized with rows of 0x9920 and 0x9A20; the 8x16 spaces from fontset 9, in palette 9.
FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF | FF |
FF | 00 | 01 | 04 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 05 | 06 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 | 07 |
FF | 02 | 03 | 08 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 09 | 0A | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B | 0B |
FF | 03 | 03 | 0C | 0D | 0E | 0F | 10 | 11 | 12 | 13 | 14 | 15 | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 0F | 63 | 64 | 65 |
FF | 03 | 03 | 0C | 5C | 5D | 5D | 16 | 17 | 18 | 19 | 1A | 1B | 5D | 5D | 5D | 5D | 5D | 5D | 5D | 5D | 2C | 2D | 2E | 2F | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 5D | 5D | 5D | 5D | 5D |
FF | 03 | 03 | 0C | 5D | 5D | 5D | 1C | 1D | 1E | 1F | 20 | 21 | 5D | 5D | 5D | 5D | 5D | 38 | 39 | 3A | 3B | 3C | 3D | 3E | 3F | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 5D | 5D | 5D | 5D | 5D |
FF | 03 | 03 | 0C | 5E | 5D | 5D | 22 | 23 | 24 | 25 | 26 | 27 | 5D | 5D | 5D | 5D | 5D | 47 | 48 | 49 | 4A | 4B | 4C | 4D | 4E | 4F | 50 | 51 | 52 | 53 | 54 | 55 | 5D | 5D | 5D | 5D | 5D |
FF | 03 | 03 | 0C | 5F | 5D | 5D | 5D | 28 | 29 | 2A | 2B | 5D | 5D | 5D | 5D | 5D | 5D | 56 | 57 | 58 | 59 | 59 | 59 | 59 | 59 | 59 | 59 | 59 | 59 | 59 | 5A | 5B | 5D | 5D | 5D | 5D | 5D |
FF | 68 | 69 | 0C | 60 | 61 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 62 | 66 | 67 |
FF | 6A | 6B | 6C | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 6D | 76 | 77 | 77 | 77 |
FF | 03 | 03 | 6F | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 78 | 79 | 79 | 79 |
FF | 6E | 03 | 70 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 7A | 7B | 7B | 7B |
FF | 72 | 73 | 71 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 7C | 7D | 7D | 7D |
FF | FF | FF | 74 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 75 | 7E | FF | FF | FF |
- The joystick (10-2B) uses palette 0x0, which changes to highlight the directions.
- Within palette 0x0, colors 5-C map to the joystick directions, starting at Up and rotating anticlockwise.
- Note: the top-halves of tiles 10-15 are in palette 0xD instead.
- The buttons (2C-5B) use palette 0xA when dim, and 0xB when illuminated.
- A tiles: 38-3B, 47-4B, 56-58
- B tiles: 2C-2F, 3C-3E, 4C-4D
- C tiles: 30-33, 3F-42, 4E-51
- D tiles: 34-37, 43-46, 52-55
- tiles 59-5B are drawn in the dim palette and never turn bright
- The text-boxes frames (04-06, 08-0A, 6C-6D, 6F-71, 74-76, 78, 7A, 7C, 7E) have palette 0xC.
- The rest of the control panel uses palette 0xD.