Crystal Beans from Dungeon Explorer/Cutscene Script

From Data Crystal
Jump to navigation Jump to search

Overview

A Cutscene script is a sequence of commands to load data and control different aspects of a cutscene. The command have not been all completely reverse-engineered but the command number and the number and size of their arguments is known. In the table below long refers to a 24-bits integer.

Command reference

Command Description
0x00
0x01
Decompress data to VRAM

Arguments:

long: pointer to the source address of the data to be decompressed
word: VRAM destination address (as given to IO port $2116)
word: number of words to decompress
0x02
0x03
Decompress and set palette ($7FEE00)

Arguments:

long: pointer to the source address of the data to be decompressed
word: destination palette index (only the low byte is used)
word: number of words to decompress
0x04 Decompress data (tilemap?) to WRAM ($7F8000) and send it to VRAM?

Arguments:

long: pointer to source address of the data to be decompressed
word: number of words to decompress
word: VRAM destination address (as given to IO port $2116) (note: the VRAM address will increment by $20 between each item)
word: size in words of the items to send
word: number of items to send
word: number of bytes between items to send
0x05 Send data (tilemap?) to VRAM?

Arguments:

word: source data index from $7F8000
word: VRAM destination address (as given to IO port $2116) (note: the VRAM address will increment by $20 between each item)
word: size in words of the items to send
word: number of items to send
word: number of bytes between items to send
0x06 ?

No arguments

0x07 Same as 0x06 but pause execution
0x08 ?

No arguments

0x09 Same as 0x08 but pause execution
0x0A Set OAM data?

Arguments:

word: pointer to OAM data struct (copied to [$1C5D])
word: pointer to sprite control commands (copied to [$1B11])
word: copied to [$1BE9]
0x0B Same as 0x0A but pause execution
0x0C
0x0D
Init tilemap?

Arguments:

word: VRAM destination address (as given to IO port $2116)
byte: number of VRAM words to set
byte: copied to [$3B]
0x0E
0x0F
?

Arguments:

word: some index (copied to register X)
word: copied to [$1A08+index]
word: copied to [$1A0E+index]
0x10 ?

Arguments:

word: copied to [$1B59]
word: copied to [$1A14]
word: copied to [$1A18]
word: copied to [$1B11]
0x11 Same as 0x10 but pause execution
0x12 ?

Arguments:

word: copied to [$1B11]
0x13 Same as 0x12 but pause execution
0x14 Delay
word: number of time units to delay (copied to [$1B11])
0x15 Same as 0x14 but pause execution
0x16
0x17
?

No arguments

0x18 ?

Arguments:

word: ?
word: function pointer (copied to [$1B11])
word: copied to [$1B35]
0x19 Same as 0x18 but pause execution
0x1A ?

Arguments:

word: index from $7F8000 (source data)
word: copied to [$32]
word: copied to [$38]
word: copied to [$3B]
word: copied to [$38]
word: copied to [$41]
0x1B Same as 0x1A but pause execution
0x1C
0x1D
Execute function

Arguments:

word: function pointer
word: function argument (copied to [$38])
0x1E
0x1F
?

Arguments:

byte: byte to send to APUIO0 (note: sent two times. The first time it's ORed with 0x80, the second time it's sent as-is)
0x20
0x21
End of script

No arguments