main.asm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. include "hardware.inc/hardware.inc"
  2. include "charmap.asm"
  3. ; These variables should be used by the modified gb-vwf code, but all except the first one actually are
  4. DEF STAMP_STARTING_POINT = $8C00
  5. DEF IMPRINT_STARTING_POINT = $9822
  6. DEF TEXT_WIDTH_TILES = 16
  7. DEF TEXT_HEIGHT_TILES = 4
  8. EXPORT STAMP_STARTING_POINT
  9. EXPORT IMPRINT_STARTING_POINT
  10. EXPORT TEXT_WIDTH_TILES
  11. EXPORT TEXT_HEIGHT_TILES
  12. ; Things for simplified script editing
  13. DEF CG_REDRAW_DELAY = 80
  14. DEF TEXT_PAUSE_DELAY = 50
  15. ; General macro for loading tiles
  16. ; @param 1: Current tiles' start address
  17. ; @param 2: End address
  18. MACRO tile_loader
  19. ld de, \1
  20. ld bc, \2 - \1
  21. ld hl, $8000
  22. call LCDMemcpy;CopyToVRAM
  23. ld a, [hli]
  24. ld [wLastImageTile], a
  25. endm
  26. ; General macro for loading maps
  27. ; @param 1: Current map's start address
  28. ; @param 2: End address
  29. MACRO map_loader
  30. ld de, \1
  31. ld bc, \2 - \1
  32. ld hl, $9800
  33. call LCDMemcpy;CopyToVRAM
  34. endm
  35. MACRO hl_setup
  36. ld l, low(\1)
  37. ld h, high(\1)
  38. endm
  39. ;mostly code copied from the tutorial and gb-vwf example
  40. SECTION "Header", ROM0[$100]
  41. di
  42. jp EntryPoint
  43. ds $150 - @, 0
  44. EntryPoint:
  45. ; Shut down audio circuitry
  46. ld a, 0
  47. ld [rNR52], a
  48. ; Do not turn the LCD off outside of VBlank
  49. Wait4VBlank:
  50. ld a, [rLY]
  51. cp 144
  52. jp c, Wait4VBlank
  53. ; Turn the LCD off
  54. ld a, 0
  55. ld [rLCDC], a
  56. ; During the first (blank) frame, initialize display registers
  57. ld a, %11100100
  58. ld [rBGP], a
  59. ; Init interrupt handler vars
  60. xor a
  61. ldh [hVBlankFlag], a
  62. dec a ; ld a, $FF
  63. ldh [hHeldButtons], a
  64. ; more vblank stuff, nothing works without it
  65. ld a, IEF_VBLANK
  66. ldh [rIE], a
  67. xor a
  68. ei
  69. ldh [rIF], a
  70. ld a, BANK(Main)
  71. ldh [hCurROMBank], a
  72. ld [rROMB0], a
  73. jp Main
  74. SECTION "Main game loop", ROM0
  75. Main:
  76. ld l, low(cgBLA)
  77. ld h, high(cgBLA)
  78. call LabelPointer
  79. ; no more screen redrawing until CGOK flag turns into 1 again
  80. ld a, 0
  81. ld [hCGOKFlag], a
  82. ; Turn LCD on with proper vram options
  83. ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BG8000 | LCDCF_BG9800
  84. ld [rLCDC], a
  85. ;;;;;;;;;;;;;;;; TEXT ENGINE GLOBAL INIT ;;;;;;;;;;;;;;;;;;;;
  86. ; You need to write these on game startup (ok boss)
  87. ld a, 0
  88. ld [wTextCurPixel], a
  89. ld [wTextCharset], a
  90. ld c, $10*4
  91. ld hl, wTextTileBuffer
  92. rst MemsetSmall
  93. ;;;;;;;;;;;;;;; This is "local" initialization for printing the "main" text ;;;;;;;;;;;;;;;;;
  94. ld a, TEXT_WIDTH_TILES*8 + 1
  95. ld [wTextLineLength], a
  96. ld a, LOW(wLastImageTile)
  97. ld [wTextCurTile], a
  98. ld [wWrapTileID], a
  99. ld a, LOW(wLastImageTile+65)-1
  100. ld [wLastTextTile], a
  101. ld a, TEXT_HEIGHT_TILES
  102. ld [wTextNbLines], a
  103. ld [wTextRemainingLines], a
  104. ld [wNewlinesUntilFull], a
  105. ld a, 2
  106. ld [wTextLetterDelay], a
  107. ld a, 0
  108. ld [wTextStackSize], a
  109. ld [wTextFlags], a
  110. ld a, $80
  111. ld [wTextTileBlock], a
  112. .textReset
  113. ld a, TEXT_NEW_STR
  114. ld hl, Scenario
  115. ld b, BANK(Scenario)
  116. call PrintVWFText
  117. ;todo: figure out how to change this on the fly
  118. ld hl, IMPRINT_STARTING_POINT
  119. call SetPenPosition
  120. ld a, [hCGOKFlag]
  121. cp 1
  122. jr z, .screenRedrawLoop
  123. jp .textRedrawLoop
  124. .screenRedrawLoop
  125. ld a, [hCG2Flag]
  126. cp $01
  127. jr z, .cg2
  128. jp .textRedrawLoop
  129. .cg2
  130. di
  131. ;rst VBlankWaitLoop
  132. tile_loader cgs2.VieTiles, cgs2.VieTilesEnd
  133. map_loader cgs2.VieMap, cgs2.VieMapEnd
  134. ; no more screen redrawing until CGOK flag turns into 1 again
  135. ld a, 0
  136. ld [hCGOKFlag], a
  137. ei
  138. .textRedrawLoop
  139. rst VBlankWaitLoop
  140. call PrintVWFChar
  141. call DrawVWFChars
  142. ld a, [wTextSrcPtr + 1]
  143. inc a ; cp $FF
  144. jr nz, .textRedrawLoop
  145. .waitRestart
  146. rst VBlankWaitLoop
  147. ldh a, [hPressedButtons]
  148. and PADF_START
  149. jr z, .waitRestart
  150. jr .textReset
  151. ; This is where all CGs reside
  152. SECTION "Cutscene CGs 1", ROMX, BANK[1]
  153. cgs1::
  154. .Ao1Tiles
  155. INCBIN "gfx/aomi1.2bpp"
  156. .Ao1TilesEnd
  157. .Ao1Map
  158. INCBIN "gfx/aomi1.tilemap"
  159. .Ao1MapEnd
  160. .Ao2Tiles
  161. INCBIN "gfx/aomi2.2bpp"
  162. .Ao2TilesEnd
  163. .Ao2Map
  164. INCBIN "gfx/aomi2.tilemap"
  165. .Ao2MapEnd
  166. .BlaTiles
  167. INCBIN "gfx/blank.2bpp"
  168. .BlaTilesEnd
  169. .BlaMap
  170. INCBIN "gfx/blank.tilemap"
  171. .BlaMapEnd
  172. .CarTiles
  173. INCBIN "gfx/car.2bpp"
  174. .CarTilesEnd
  175. .CarMap
  176. INCBIN "gfx/car.tilemap"
  177. .CarMapEnd
  178. .CupTiles
  179. INCBIN "gfx/cup.2bpp"
  180. .CupTilesEnd
  181. .CupMap
  182. INCBIN "gfx/cup.tilemap"
  183. .CupMapEnd
  184. ; I can't believe I couldn't fit this in one section (and bank)
  185. SECTION "Cutscene CGs 2", ROMX, BANK[2]
  186. cgs2::
  187. .HugTiles
  188. INCBIN "gfx/hug.2bpp"
  189. .HugTilesEnd
  190. .HugMap
  191. INCBIN "gfx/hug.tilemap"
  192. .HugMapEnd
  193. .Si1Tiles
  194. INCBIN "gfx/silh1.2bpp"
  195. .Si1TilesEnd
  196. .Si1Map
  197. INCBIN "gfx/silh1.tilemap"
  198. .Si1MapEnd
  199. .Si2Tiles
  200. INCBIN "gfx/silh2.2bpp"
  201. .Si2TilesEnd
  202. .Si2Map
  203. INCBIN "gfx/silh2.tilemap"
  204. .Si2MapEnd
  205. .VieTiles
  206. INCBIN "gfx/view.2bpp"
  207. .VieTilesEnd
  208. .VieMap
  209. INCBIN "gfx/view.tilemap"
  210. .VieMapEnd
  211. ; todo: rename to script? also check how everything is displayed and make appropriate edits
  212. SECTION "Scenario", ROMX, BANK[3]
  213. Scenario:
  214. db "<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "The crunch of the snow's surface that got frozen overnight is exceptionally satisfying to hear today. <WAITBTN>"
  215. db "I've always enjoyed walks after snowfalls early in the morning, when there's little traffic and coffee-chugging pedestrians sprawling around, but doing it today feels greater than ever and for a good reason. <WAITBTN><CLEAR><CG>"
  216. db "<DELAY>", CG_REDRAW_DELAY, "I stop to stand by the lamppost, the usual waiting spot, hands in my pockets, left palm clutching a tiny box with a golden engagement ring inside. <WAITBTN>"
  217. db "Saying \"let's date\" to my girlfriend was already a mentally taxing challenge, but proposing to her, despite us hanging out for quite some time now and loving each other and being on extremely good terms, feels on a whole new level of anxiety.<WAITBTN>"
  218. db "<CLEAR>Yet no amount of weird feelings piling up could persuade me that this day won't go well. <WAITBTN>Unless the weather does a one-eighty or the cars decide to fill up the streets all of a sudden, nothing should go wrong.<WAITBTN>"
  219. db "<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "Still, thinking about early morning coffee enthusiasts reminds me I haven't eaten anything at all today, and my stomach lets out a mournful churn in agreement.<WAITBTN>"
  220. db "<CLEAR>The nearby coffee shop seems to be open and boasting about their new \"winter holiday specials\" on a chalkboard sign near the entrance, and my feet immediately decide to set me on my way to try some of those. <WAITBTN>"
  221. db "And maybe go for seconds with her if those specials are any good.<WAITBTN>"
  222. db "<CLEAR><DELAY>", CG_REDRAW_DELAY, "Having exchanged a couple of words on today's weather with the barista, I return with a thick paper cup of hot cocoa topped with tiny star-shaped marshmallows.<WAITBTN>"
  223. db "<CLEAR>With every crunchy step I take through the snowy path back to the waiting spot, the white chewy stars continue slowly whirling around in the drink, like as if they're traveling across the mocha-colored sky. <WAITBTN>"
  224. db "Floating and twirling and melting into a sweet and fluffy beige cloud.<WAITBTN>"
  225. db "<CLEAR>A sight so serene mixed with an aroma so cozy and a quiet town ambiance so comforting it eases my anxieties a tiny bit and makes me sleepy. <WAITBTN>I quickly blink several times in an attempt to stay awake.<WAITBTN>"
  226. db "<CLEAR>She is sure taking her sweet time driving here, but somehow I don't mind at all. <WAITBTN>I want to savor these moments, I want to imprint these sights and smells onto my brain and create an everlasting memory. <WAITBTN>"
  227. db "After all, this may probably be the best day of my life. <DELAY>", 30, "I wholeheartedly hope it will.<WAITBTN>"
  228. db "<CLEAR>.<DELAY>", 20, ".<DELAY>", 20, ".<DELAY>", 20, "Somehow I'm reminded of the day we first met. <WAITBTN>"
  229. db "It happened around January, I think. Several months after I started college. <WAITBTN>"
  230. db "Back then, I was a completely different person - timid, shy, unable to express myself. A total loser, simply to say. <WAITBTN>Always being an object of ridicule for my peers for various reasons. <WAITBTN>"
  231. db "At some point even the closest of friends turned their back on me and I was left completely alone in this world. <WAITBTN>"
  232. db "<CLEAR>During my high school years I felt like I was going insane. <WAITBTN>I talked to walls, I made up imaginary friends, I spent a lot of time crying by myself in my bathroom. <WAITBTN>"
  233. db "<CLEAR>Then came the graduation, followed by the dreaded college my parents applied me to, and taking a plunge inside an unfamiliar environment made the matters even worse. <WAITBTN>"
  234. db "I spent several months without any human interactions. <WAITBTN>I thought that by default I'd get the same treatment that I've gotten used to. <WAITBTN>"
  235. db "<CLEAR>And at some point on a snowy day in January, something inside me just snapped. <WAITBTN>Just... broke in two. <WAITBTN><CLEAR>And then I just got up, hastily put on my coat and... ran. <WAITBTN>"
  236. db "Ran without thinking of an exact place I want to go to. <WAITBTN>"
  237. db "My vision was made blurry by falling chunks of snow, but I continued running, not minding anything around. <WAITBTN>"
  238. db "I can't remember when and where I ended up, but I do remember almost getting run over by her car that was passing by me then. "
  239. db "<WAITBTN>In a state of brake screech-induced panic, I fell down to my knees on the wet asphalt, hands covering my face. <WAITBTN>"
  240. db "And after she jumped off and ran up to me asking if I was alright, I snapped and outright told her every thought and every problem that plagued my darkened mind. <WAITBTN>"
  241. db"<CLEAR><DELAY>", CG_REDRAW_DELAY, "Then she laughed the worst laugh I've ever heard in my life, brushed the freshly fallen snow off my back, and asked me if I'd be interested in helping with a research for her PhD in Psychology. <WAITBTN>"
  242. db "And thus began our three-year researcher-subject relationship that, oddly enough, slowly blossomed into romance and affection. <WAITBTN>"
  243. db"<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "It seemed as if her presence alone was enough for me to heal and leave everything behind. <WAITBTN>"
  244. db "Somehow filling my head with all the good memories we shared together wiped all the bad ones from the past completely, as it turns out I cannot even remember neither what exactly was I bullied for, nor the faces of those kids that did so. <WAITBTN>"
  245. db "Sometimes I question myself, was this depression even real or was it just all in my head?..<WAITBTN>"
  246. db "<CLEAR>\"[*0+=#$!\"<WAITBTN>"
  247. db "<CLEAR>My pondering gets interrupted by a loud voice in the distance. <WAITBTN>Is that my name that just got called by someone? <WAITBTN>"
  248. db "I turn around to find a familiar face but don't recognize any of the passerbys. <WAITBTN>Whoever that was, they weren't calling me for sure.<WAITBTN>"
  249. db "<CLEAR>\"\}]\\_\{+!! Helloooo!!\"<WAITBTN>"
  250. db "<CLEAR>I look around once more just to be sure and see a silhouette of someone waving in my direction.<WAITBTN><NEWLINE>I probably shouldn't mind that.<WAITBTN>"
  251. db "<CLEAR>Suddenly I take notice of the waving person. Haven't I seen them somewhere before? <WAITBTN>"
  252. db "They continue moving towards me, and upon closer look, I see a girl with short pink hair, dressed in nothing but a sleeveless purple dress, cheerfully looking back at me and flailing her right hand. <WAITBTN>"
  253. db "A get-up that's surely not suited for a cold weather like today's. <WAITBTN>"
  254. db "<CLEAR><SET_VARIANT>",2,"no <WAITBTN>"
  255. db "<NEWLINE>no no no no no no <RESTORE_VARIAN>"
  256. db "<CLEAR>\"I said %>@|^<!! Don't you recognize me??\"<WAITBTN>"
  257. db "<CLEAR>As she moves closer to me, a disgustingly chill sensation forms in my stomach, piercing its outsides. <WAITBTN>"
  258. db "My hands grow limb, and the moment the strange girl runs up to me and stretches out her hands, I drop my cocoa cup on the ground, right where she stands. <WAITBTN>"
  259. db "<CLEAR><SET_VARIANT>",2,"no no no no no no no no no no no no no no <RESTORE_VARIAN>"
  260. db "<CLEAR><DELAY>", CG_REDRAW_DELAY, "The girl proceeds to tightly wrap her arms around my frozen body and lets out a heartily laugh, as if her bare feet haven't just been splashed with a hot gooey drink. <WAITBTN>"
  261. db "More chills start forming inside me. I feel nauseous. <WAITBTN>"
  262. db "<CLEAR>\"I'm so glad I'm finally here with you! I've been waiting soooo long for this day!\" she says as she tightens the grip on her hug and buries her face in my jacket.<WAITBTN>It's getting hard to breathe. <WAITBTN>"
  263. db "<CLEAR>After a moment and a couple of caught stares from wondering strangers, I part my lips slightly and whisper:"
  264. db "<NEWLINE>\"Who... are you?\" <WAITBTN>"
  265. db "<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "The girl loosens her grip and gives me a surprised look. <WAITBTN>"
  266. db "<NEWLINE>\"You... don't remember me? You really-really don't remember me?\" <WAITBTN>"
  267. db "<NEWLINE>I timidly shake my head. <WAITBTN>"
  268. db "<CLEAR>\"I guess I should've expected that. Allow me to reintroduce myself!\" <WAITBTN>"
  269. db "<NEWLINE>She takes two steps back, waits for a second and strikes a pose. <WAITBTN><NEWLINE>\"My name's Aomi! I'm your most important person in the world... at least, according to you, Master!\" <WAITBTN>"
  270. db "<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "Master?.. <WAITBTN>I cast a quick glance down. <WAITBTN>Her cocoa-drenched feet have left a long trail of pale red footprints in the snow behind her.<WAITBTN>"
  271. db "<CLEAR><SET_VARIANT>",2,"no no no no no no no no no no no no no no no no no no no no <RESTORE_VARIAN>"
  272. db "<CLEAR>Something clicks inside my head. <WAITBTN>Something that shouldn't ever have. <WAITBTN>"
  273. db "Something I was sure I erased from my memory like a bad dream.<WAITBTN><NEWLINE>Aomi?.. <WAITBTN>"
  274. db "CLEAR>The girl comes back and pulls me into an asphyxiating embrace again. <WAITBTN>"
  275. db "<NEWLINE>\"Don't worry,\" she says softly, \"I'll always be by your side from now on. I'll never abandon you. Ever.\" <WAITBTN>"
  276. db "<NEWLINE><DELAY>", TEXT_PAUSE_DELAY, "The clicking inside my head gets even more intense. I feel like I'm on the verge of losing consciousness. <WAITBTN>"
  277. db "<CLEAR>This can't be... can it? <WAITBTN>Among a chaotic ocean of thoughts rising up like a tide in my mind, one swims to the surface in the form of a sudden question to ask the girl. <WAITBTN>"
  278. db "<CLEAR>\"Y- you know what \"Aomi\" stands for?..\" <WAITBTN>"
  279. db "<CLEAR><DELAY>", CG_REDRAW_DELAY, "She turns her head to the side and pouts her lips in thought. <WAITBTN>As she does so, I begin slowly raising my hands. <WAITBTN>"
  280. db "<CLEAR>\"Let's see... Ability of my imagination,\" she confidently replies and then beams at me. <WAITBTN><CLEAR>\"wasn't it?\" <WAITBTN>"
  281. db "<CLEAR><DELAY>", CG_REDRAW_DELAY, "I hear ringing in my ears. The migraine gets even more intense. <WAITBTN>With my palms raised above her shoulders, I intertwine my fingers around her neck. <WAITBTN>"
  282. db "This feeling of tender human flesh and fast beats of her pulse against my skin... <WAITBTN>"
  283. db "Why does it feel so uncanny and horrifying?.. <WAITBTN>Why do I want to squeeze it tightly and make it stop?.. <WAITBTN>"
  284. db "<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "...It's her. <WAITBTN>Aomi. <WAITBTN>My imaginary friend from high school years. <WAITBTN>Except she is not imaginary anymore. <WAITBTN>She is real. "
  285. db "<WAITBTN>She is a real physical being. <WAITBTN>A being I can see and hear and touch. <WAITBTN>And now she's here."
  286. db "<WAITBTN> She's with me now. <WAITBTN>Me, her \"master\", as I liked to call myself then. <WAITBTN>She's materialized for me. <WAITBTN><CLEAR>..Except she's seven years too soon. <WAITBTN>"
  287. db "<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "Is this what they mean when they say... beware what you wish for?.. <WAITBTN>"
  288. db "<CLEAR><DELAY>", TEXT_PAUSE_DELAY, "<DELAY>", TEXT_PAUSE_DELAY, "The end (no really)<END>"
  289. ; copied from the example, no need to use CopyToVRAM for now
  290. SECTION "LCDMemcpy", ROM0
  291. LCDMemcpy::
  292. ; Increment B if C is nonzero
  293. dec bc
  294. inc b
  295. inc c
  296. .loop
  297. ldh a, [rSTAT]
  298. and STATF_BUSY
  299. jr nz, .loop
  300. ld a, [de]
  301. ld [hli], a
  302. inc de
  303. ld a, [de]
  304. ld [hli], a
  305. inc de
  306. dec c
  307. jr nz, .loop
  308. dec b
  309. jr nz, .loop
  310. ret
  311. LCDMemsetSmall::
  312. ld b, a
  313. LCDMemsetSmallFromB::
  314. ldh a, [rSTAT]
  315. and STATF_BUSY
  316. jr nz, LCDMemsetSmallFromB
  317. ld a, b
  318. ld [hli], a
  319. dec c
  320. jr nz, LCDMemsetSmallFromB
  321. ret
  322. SECTION "Functions", ROM0[0]
  323. ; Waiting for vblank except it's scattered throughout the code
  324. VBlankWaitLoop::
  325. ld a, 1
  326. ldh [hVBlankFlag], a
  327. .wait
  328. halt
  329. jr .wait
  330. ds $8 - @
  331. ; Reserve memory for stuff? Reading assembly is my passion
  332. ; @param hl: Destination
  333. MemsetSmall::
  334. ld [hli], a
  335. dec c
  336. jr nz, MemsetSmall
  337. ret
  338. ds $12 - @
  339. LabelPointer::
  340. jp hl
  341. ret
  342. SetCGOKFlag::
  343. ; we can draw backgrounds now! the code section
  344. ld a, 1
  345. ld [hCGOKFlag], a
  346. ; code section end
  347. ret
  348. ;ds $16 - @
  349. ; this padding is very important for some reason
  350. ds $40 - @
  351. :
  352. ; VBlank handler
  353. push af
  354. ldh a, [hVBlankFlag]
  355. and a
  356. jr z, .noVBlank
  357. ld c, LOW(rP1)
  358. ld a, P1F_GET_DPAD
  359. ldh [c], a
  360. REPT 4
  361. ldh a, [c]
  362. ENDR
  363. or $F0
  364. ld b, a
  365. swap b
  366. ld a, P1F_GET_BTN
  367. ldh [c], a
  368. REPT 4
  369. ldh a, [c]
  370. ENDR
  371. or $F0
  372. xor b
  373. ld b, a
  374. ld a, P1F_GET_NONE
  375. ldh [c], a
  376. ldh a, [hHeldButtons]
  377. cpl
  378. and b
  379. ldh [hPressedButtons], a
  380. ld a, b
  381. ldh [hHeldButtons], a
  382. pop af ; Pop return address to exit `VBlankWaitLoop`
  383. xor a
  384. ldh [hVBlankFlag], a
  385. .noVBlank
  386. pop af
  387. reti
  388. SECTION "CG code-based macros", ROMX
  389. ; setting up macros for drawing cgs
  390. cgAO1::
  391. tile_loader cgs1.Ao1Tiles, cgs1.Ao1TilesEnd
  392. map_loader cgs1.Ao1Map, cgs1.Ao1MapEnd
  393. ret
  394. ; This CG should be loaded partially due to similar tiles with AO1, as well as its immediate appearance after AO1, but as of now this requires counting and subtracting bytes by hand and I am a very lazy person
  395. cgAO2::
  396. tile_loader cgs1.Ao2Tiles, cgs1.Ao2TilesEnd
  397. map_loader cgs1.Ao2Map, cgs1.Ao2MapEnd
  398. ret
  399. cgBLA::
  400. tile_loader cgs1.BlaTiles, cgs1.BlaTilesEnd
  401. map_loader cgs1.BlaMap, cgs1.BlaMapEnd
  402. ret
  403. cgCAR::
  404. tile_loader cgs1.CarTiles, cgs1.CarTilesEnd
  405. map_loader cgs1.CarMap, cgs1.CarMapEnd
  406. ret
  407. cgCUP::
  408. tile_loader cgs1.CupTiles, cgs1.CupTilesEnd
  409. map_loader cgs1.CupMap, cgs1.CupMapEnd
  410. ret
  411. cgHUG::
  412. tile_loader cgs2.HugTiles, cgs2.HugTilesEnd
  413. map_loader cgs2.HugMap, cgs2.HugMapEnd
  414. ret
  415. cgSI1::
  416. tile_loader cgs2.Si1Tiles, cgs2.Si1TilesEnd
  417. map_loader cgs2.Si1Map, cgs2.Si1MapEnd
  418. ret
  419. cgSI2::
  420. tile_loader cgs2.Si2Tiles, cgs2.Si2TilesEnd
  421. map_loader cgs2.Si2Map, cgs2.Si2MapEnd
  422. ret
  423. cgVIE::
  424. tile_loader cgs2.VieTiles, cgs2.VieTilesEnd
  425. map_loader cgs2.VieMap, cgs2.VieMapEnd
  426. ret
  427. ;gb-vwf won't work without these unions for now
  428. SECTION UNION "8c00", VRAM[$8c00]
  429. vBlankTile:
  430. vTextTiles::
  431. .end
  432. ; ughghghhhhh
  433. SECTION "CG Asset Addresses", ROMX
  434. SetCG1Addr::
  435. ld a, 1
  436. ld [hCG1Flag], a
  437. ret
  438. SetCG2Addr::
  439. ld a, 1
  440. ld [hCG2Flag], a
  441. ret
  442. SetCG3Addr::
  443. SetCG4Addr::
  444. SECTION "WorkVariables", WRAM0
  445. wLastImageTile:: dw
  446. SECTION "HighRAMVariables", HRAM
  447. hCurROMBank::
  448. db
  449. hVBlankFlag:
  450. db
  451. hHeldButtons::
  452. db
  453. hPressedButtons::
  454. db
  455. hCurrentCGLabel:: dw
  456. hCGOKFlag:: db
  457. hCG1Flag:: ds 1
  458. hCG2Flag:: ds 1
  459. hCG3Flag:: ds 1
  460. hCG4Flag:: ds 1
  461. hFlipPaletteFlag: ds 1