BS-X BIOS/Tutorials

From Data Crystal
< BS-X BIOS
Revision as of 15:25, 9 March 2017 by Lytron (talk | contribs)
Jump to navigation Jump to search

Chip tiny.png The following article is a Tutorial for BS-X BIOS.

General Notes

Basic Program Flow: $062F/$0637

One part of the NMI handler is designated to jump to a subroutine whose address is stored in $0637-9 (and gets transfered to $62F-31 before jumping there). The subroutines that are executed this way are the ones that handle the general flow of the program, so if you want to change bigger parts of the "game", go there.

One of these Subroutine generally sets up the addresss for the next one in $0637-9, so it is executed during the next NMI. Here is a flow chart for the program start.

(I don't know how far I will expand this)

First column contains the address of the Subroutine that gets executed ("Destination Address"), the second column is for a short explanation of it's purpose, the third column contains which next Subroutine it sets up and the fourth column contains the address of the first byte where the next subroutine is set up (go there for changing).

| Destntn.| Purpose of the Subroutine                                           |  Next   | Address | 
| Address |                                                                     | Subrout.|  Setup  |
|---------+---------------------------------------------------------------------+---------+---------|
|(80/8F7D)|(ROM START - NOT EXECUTED VIA NMI)                                   | 94/8000 | 80/907B |
| 94/8000 | Title Screen: Setup Graphics and Music                              | 94/8111 | 94/80BE |
| 94/8111 | Title Screen: Wait between fade in and Nintendo Logo                | 94/8131 | 94/8121 |
| 94/8131 | Title Screen: Nintendo Logo Appearance                              | 94/81A0 | 94/8190 |
| 94/81A0 | Title Screen: Nintendo Logo Bling-Bling                             | 94/821E | 94/8210 |
| 94/821E | Title Screen: Wait between Bling-Bling and Logo turns gray          | 94/8237 | 94/8229 |
| 94/8237 | Title Screen: Nintendo Logo turns gray                              | 94/828A | 94/827B |
| 94/828A | Title Screen: ?                                                     | 94/82CA | 94/82BC |
| 94/82CA | Title Screen: ?                                                     | 94/8366 | 94/82EC |
| 94/8366 | Title Screen: ?                                                     | 94/83E4 | 94/83D6 |
| 94/83E4 | Title Screen: ? (Here the program checks if a button is pushed)     |         |         |

Music

Typical Code to play a Music:

LDA #$00xx
LDY #$0000
JSL $105C1C

xx can stand for:

03 - Title Screen Music

Sound Effects

Typical Code to play a Sound Effect:

LDA #$03xx
LDY #$0001
JSL $105C1C

xx can stand for:

53 - (Sound when leaving the title screen)
84 - Clear SRAM sound
C1 - Nintendo Logo Bling sound

Textbox Content Buffer in $7E/7E00

$7E/7E00 is the buffer for the contents of the textbox. As in many games, the Tilemap in the Textbox always stays the same (a number of adjacent tiles), the corresponding tiles are changed. These tiles are buffered at $7E/7E00.

As far as I can tell:

The even bytes ($7E/7Ex0, x2, x4...) are always #$FF. The odd bytes represent one row of pixels of a 8x8 tile. Bit set: blue (textbox background), Bit cleared: white (scripture color).

One Byte Hacks

If you want to change the world with just one byte. Here are the addresses where to change and the result. If you want to look up the things in a log file or in the ROM Map here, use "Address in ROM" for orientation. "Address in Hex" helps when you look into the ROM with a Hex Editor.

| Address | Address | Stndd.| Effect                                                                   |
| in ROM  | in Hex  | value |                                                                          |
|---------+---------+-------+--------------------------------------------------------------------------|
| 80/9024 |  001024 |   84  | Change the sound effect when clearing the SRAM                           |
| 94/8090 |  0A0090 |   03  | Change the music during nintendo logo                                    |
| 94/811C |  0A011C |   20  | The number of frames until the Nintendo logo appears                     |
| 94/8138 |  0A0138 |   10  | Change how far the line extends until nintendo logo unfolds              |
| 94/813D |  0A013D |   04  | Change the speed the nintendo logo expends to the left                   |
| 94/8146 |  0A0146 |   04  | Change the speed the nintendo logo expends to the right                  |
| 94/81E3 |  0A01E3 |   C1  | Change the sound effect when Nintendo logo appears                       |
| 94/820B |  0A020B |   20  | The number of frames between Nintendo logo reflection and fade to white  |
| 94/8245 |  0A0245 |   03  | Change the speed the nintendo logo turns gray                            |
| 94/8402 |  0A0402 |   53  | Change the sound effect when leaving the title screen                    |
| 94/85FB |  0A05FB |   01  | Make Title Screen City scroll slower. VALID VALUES: 03 07 0F 1F 3F 7F FF |
| 94/8602 |  0A0602 |   1A  | REPLACE WITH 3A: Title Screen City Backdrop scrolls in the other directn.|
| 94/860D |  0A060D |   07  | Change Speed of Title Scr.Color Cycle VALID VALUES: 01 03 0F 1F 3F 7F FF |