This is an attempt at writing a kind of standard library for working with Fire Emblem: Thracia 776.
Get it here.
It has a few goals:
Consolidated RAM Maps
aSRAM .block
aSaveDataHeader .dstruct structSaveDataHeader ; $700000
aSaveSlot1 .dstruct structSaveDataEntry ; $700008
aSaveSlot2 .dstruct structSaveDataEntry ; $702000
aSaveSlot3 .dstruct structSaveDataEntry ; $703FF8
aSaveSlotSuspend .dstruct structSaveDataEntry ; $705FF0
.fill ($708000 - *), ?
.bend
Volt Edge provides (as of version 0.01) a full SRAM map and a WIP WRAM map that documents the location and use of different variables and structures. The objective here is to avoid having to define these yourself and to keep names consistent throughout projects.
It’s much clearer to use these named memory locations within code:
...
lda aSRAM.aSaveDataHeader.CompletionFlag
and #$00FF
beq +
; Foo some bars if this isn't
; your first rodeo.
lda aSRAM.aSaveDataHeader.CompletionCount
and #$00FF
sta wR0
jsl rlYeeHaw
+
...
as opposed to
...
lda $700003
and #$00FF
beq +
; Foo some bars if this isn't
; your first rodeo.
lda $700002
and #$00FF
sta $0B
jsl rlYeeHaw
+
...
Labels are given a short prefix to make identifying their size easier:
-
a
-Array
- although really this is just some variable or stucture of a nonstandard size. -
b
-Byte
- 8 bits -
w
-Word
- 16 bits -
l
-Long
- 24 bits
Vanilla Definitions
Leif = $0001
Finn = $0002
Orsin = $0003
Halvan = $0004
Eyvel = $0005
...
Similar to the EA Standard Library, Volt Edge defines vanilla character, class, and item definitions (along with a couple miscellaneous constants). These can be toggled off if not desired.
Volt Edge also defines many vanilla structures in order to make writing assembly, tables, etc. easier:
...
lda structCharacterDataRAM.X,b,y
and #$00FF
sta wR0
lda structCharacterDataRAM.Y,b,y
and #$00FF
sta wR1
...
Hardware and I/O Register Definitions
As above but with things common to the SNES.
lda #INIDISP_Setting(false, 15)
sta bBufferINIDISP
sta INIDISP,b
...
lda bBufferINIDISP
and #INIDISP_Brightness
cmp #15
bne +
...
Misc. Helpers
I don’t like having to figure out where in the memory map some address is. I don’t like having to write format strings to print the current offset. Volt Edge includes a set of macros, definitions, and functions that make things easier, clearer, and with less repetition.
* := $012345
.logical mapped($012345)
rlFrobulator
.autsiz
.databank ?
asl a
tax
lda aFooTable,x
sta wR0
jsl rlFoo
rtl
.databank 0
aFooTable
.word pack([1, 2])
.word pack([3, 4])
.warnhere
.here
I guess that’s enough rambling for now.
Bonus
Why is this called “Volt Edge”?
I was originally going to call it the FE5 Standard Library, but I felt like that’s a bit arrogant. After that, I figured “Reinhardt” would’ve been a fun name, trying to follow Stan’s name things after characters
shtick, but I can only copy Stan so much.
So, instead I chose the most contentious thing included in my menu translation. Anyone using this is now forced to .include "VoltEdge.h"
in their project. I love it.