Skip to content

Instantly share code, notes, and snippets.

@dicene
Last active April 14, 2023 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dicene/d11ca4c60edfc05912f3b3b391f1e768 to your computer and use it in GitHub Desktop.
Save dicene/d11ca4c60edfc05912f3b3b391f1e768 to your computer and use it in GitHub Desktop.
MapRando RoomName ASM
'A' = $C0
'B' = $C1
'C' = $C2
'D' = $C3
'E' = $C4
'F' = $C5
'G' = $C6
'H' = $C7
'I' = $C8
'J' = $C9
'K' = $CA
'L' = $CB
'M' = $CC
'N' = $CD
'O' = $CE
'P' = $CF
'Q' = $D0
'R' = $D1
'S' = $D2
'T' = $D3
'U' = $D4
'V' = $D5
'W' = $D6
'X' = $D7
'Y' = $D8
'Z' = $D9
'0' = $00
'1' = $01
'2' = $02
'3' = $03
'4' = $04
'5' = $05
'6' = $06
'7' = $07
'8' = $08
'9' = $09
'_' = $0A
; room names ASM. This patch allows you to give every room in your hack a unique name, displayed at the top of the hud, like super metroid: ascent
;in order to do this, you do lose the top part of the upgrade icons, meaning you wil have to redraw them yourself to something else
;made by Tundain
;don't forget to credit
;make sure to include the roomnamesgrammar.tbl in the ASM folder, and set up the path accordingly (line 135)
lorom
;freespace pointers
!Universalbank = $B300 ; set the high byte to the universal bank you chose
!UniversalbankFreespace = $B3ED80 ; place this in any bank, if you have many rooms in your hack, make sure there's a lot of space
!Bank80Freespace = $80D010 ; freespace in $80, doesn't need much
!Bank82Freespace = $82F880 ; freespace in $82, doesn't need much
;hijacks
org $82E38A
JSR gofurther
org $809ADB
JSR gofurtherHudinit
;super missiles tilemap
org $8099AF
DW #$3434,#$3435
;missiles tilemap
org $8099A3
DW #$FFFF,#$FFFF,#$FFFF,#$344C,#$344A,#$344B
;powerbomb tilemap
org $8099B7
DW #$3436,#$3437
;grapple tilemap
org $8099BF
DW #$3439,#$3438
;xray tilemap
org $8099C7
DW #$343B,#$343A
;draw 2x2 routine draws2x1
org $809A4C
LDA $7EC648,x
AND #$03FF
CMP #$000F
BNE $1C
JMP $9A66
org $809A66
LDA $0000,y
STA $7EC648,x
LDA $0002,y
STA $7EC64A,x
org $809B61
JMP $9B6F ;skip writing top row of reserve tilemap, in-game
org $82AF08
JMP $AF16;same thing, but when in equipment screen
org $82AF36
JMP $AF3E
;---------------
;missiles draws only bottom row
org $8099D5
LDA $7EC65C
AND #$03FF
CMP #$000F
BNE $2A
JMP $99F6
;highlighting routine for selected item skips top row
org $809CF5
JMP $9D1B
org $809D47
JMP $9D5A
; these routines jump to the name drawing routine, which is in another bank
org !Bank82Freespace
gofurther:
print "gorfurther: ",pc
STA $099C
PHX
PHY
LDX #$0000
clearhud:
LDA #$1C0F
STA $7EC618,x
INX
INX
CPX #$0024
BMI clearhud
PHB
PEA !Universalbank : PLB : PLB
JSL drawtoprow
PLB
PLY
PLX
RTS
org !Bank80Freespace
gofurtherHudinit:
PHX
PHY
PHB
PEA !Universalbank : PLB : PLB
JSL drawtoprow
PLB
PLY
PLX
LDA $09D0
RTS
; -----------generic room name drawing routine------------
org !UniversalbankFreespace
drawtoprow:
print "draw: ",pc
LDA $7E079F
ASL
TAY
LDA Areatables,y
STA $7E0012
LDA $7E079D
ASL : TAY
LDA ($12),y
STA $7E0012
LDA ($12)
AND #$00FF
STA $7E0014
LDY #$0001
draw:
AND #$00FF
SEP #$20
TYA
ASL
TAX
LDA ($12),y
REP #$20
ORA #$1C00
STA $7EC616,x
INY
CPY $14
BMI draw
RTL
;-------All the room name data----------
Areatables:
DW Area0Table,Area1Table,Area2Table,Area3Table,Area4Table,Area5Table
; you get 18 characters maximally per room name
; this version has a length value in front of each name to save space, so make sure to set it correctly for each name
; expand these tables as you go, as you can see Area0table has landing site and gauntlet entrance. in the vanilla ROM, these are the rooms with index
; $00 and $01 in crateria, the area with index 00
; copy and paste the room names in the same format as here, and edit them by changing the letters as you go
; the first value you see, before the name itself, must be set to the length of your name +1
;for example, landing site is 12 characters long ($0C), so we set it to $0D
Area0Table:
DW Area0Room0,Area0Room1,Area0Room2
Area0Room0:
DB $0D,"LANDING_SITE"
Area0Room1:
DB $12,"GAUNTLET_ENTRANCE"
Area0Room2:
DB $12,"PARL_AND_ALCATRAZ"
Area1Table:
DW Area1Room0,Area1Room1
Area1Room0:
DB $0F,"BRIN_MAIN_SHAFT"
Area1Room1:
DB $0C,"FIRST_SUPER"
Area2Table:
DW Area2Room0,Area2Room1
Area2Room0:
DB $0D,"ACID_PARCOUR"
Area2Room1:
DB $13,"CATHEDRAL_ENTRANCE"
Area3Table:
DW Area3Room0,Area3Room1
Area3Room0:
DB $0F,"BOWLING_ALLEY"
Area3Room1:
DB $0C,"WS_ENTRANCE"
Area4Table:
DW Area4Room0,Area4Room1
Area4Room0:
DB $0A,"SAVE_ROOM"
Area4Room1:
DB $0B,"GLASS_TUBE"
Area5Table:
DW Area5Room0,Area5Room1
Area5Room0:
DB $11,"TOURIAN_ELEVATOR"
Area5Room1:
DB $11,"1ST_METROID_ROOM"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment