diff options
-rw-r--r-- | constants/misc_constants.asm | 48 | ||||
-rw-r--r-- | home.asm | 23 | ||||
-rw-r--r-- | home/init.asm | 72 | ||||
-rw-r--r-- | home/map.asm | 4 | ||||
-rw-r--r-- | home/serial.asm | 263 | ||||
-rw-r--r-- | home/video.asm | 8 | ||||
-rwxr-xr-x | hram.asm | 12 | ||||
-rw-r--r-- | macros.asm | 1 | ||||
-rwxr-xr-x | macros/wram.asm | 145 | ||||
-rw-r--r-- | main.asm | 11 | ||||
-rw-r--r-- | wram.asm | 584 |
11 files changed, 507 insertions, 664 deletions
diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 4787f97e..56f57fef 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -212,3 +212,51 @@ NUM_JOHTO_BADGES EQU const_value NUM_KANTO_BADGES EQU const_value NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES NUM_KANA EQU $2d + +SWARM_DUNSPARCE EQU 0 +SWARM_YANMA EQU 1 + +FISHSWARM_QWILFISH EQU 1 +FISHSWARM_REMORAID EQU 2 + + const_def + const FISHGROUP_NONE + const FISHGROUP_SHORE + const FISHGROUP_OCEAN + const FISHGROUP_LAKE + const FISHGROUP_POND + const FISHGROUP_DRATINI + const FISHGROUP_QWILFISH_SWARM + const FISHGROUP_REMORAID_SWARM + const FISHGROUP_GYARADOS + const FISHGROUP_DRATINI_2 + const FISHGROUP_WHIRL_ISLANDS + const FISHGROUP_QWILFISH + const FISHGROUP_REMORAID + const FISHGROUP_QWILFISH_NO_SWARM + +INIT_ENEMYOT_LIST EQU 1 +INIT_BAG_ITEM_LIST EQU 2 +INIT_OTHER_ITEM_LIST EQU 3 +INIT_PLAYEROT_LIST EQU 4 +INIT_MON_LIST EQU 5 + + +; serial + +ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 +ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK EQU $02 + +USING_EXTERNAL_CLOCK EQU $01 +USING_INTERNAL_CLOCK EQU $02 +CONNECTION_NOT_ESTABLISHED EQU $ff + +; signals the start of an array of bytes transferred over the link cable +SERIAL_PREAMBLE_BYTE EQU $FD + +; this byte is used when there is no data to send +SERIAL_NO_DATA_BYTE EQU $FE + +; signals the end of one part of a patch list (there are two parts) for player/enemy party data +SERIAL_PATCH_LIST_PART_TERMINATOR EQU $FF + @@ -17,9 +17,7 @@ INCLUDE "home/fade.asm" INCLUDE "home/lcd.asm" INCLUDE "home/time.asm" INCLUDE "home/init.asm" - -Serial:: - dr $6aa, $8df +INCLUDE "home/serial.asm" JoypadInt:: dr $8df, $8e6 @@ -56,7 +54,10 @@ Function162b:: dr $162b, $1642 Function1642:: - dr $1642, $1ebf + dr $1642, $1eb3 + +PrinterReceive:: + dr $1eb3, $1ebf AskSerial:: dr $1ebf, $1efa @@ -67,7 +68,7 @@ Function1efa:: FarCall_hl:: dr $2e27, $2e49 -Function2e49:: +Predef:: dr $2e49, $30e1 OpenSRAM:: @@ -79,11 +80,17 @@ CloseSRAM:: Function30ff:: dr $30ff, $314c -Function314c:: - dr $314c, $3564 +ByteFill:: + dr $314c, $3158 + +BackUpTilesToBuffer:: + dr $3158, $3164 + +ReloadTilesFromBuffer:: + dr $3164, $3564 Function3564:: dr $3564, $3d4f -Function3d4f:: +DisableAudio:: dr $3d4f, $3fee diff --git a/home/init.asm b/home/init.asm index 0dc19063..a91f941c 100644 --- a/home/init.asm +++ b/home/init.asm @@ -1,5 +1,5 @@ Reset:: ; 5b0 (0:05b0) - call Function3d4f + call DisableAudio xor a ld [hMapAnims], a call Function3564 @@ -42,6 +42,7 @@ Init:: ; 5d1 (0:05d1) ld a, [rLY] cp 145 jr nz, .wait + xor a ld [rLCDC], a @@ -64,75 +65,94 @@ Init:: ; 5d1 (0:05d1) xor a ld hl, HRAM_START ld bc, HRAM_END - HRAM_START - call Function314c + call ByteFill pop af ld [hCGB], a + call Function30ff - ld a, $1 + + ld a, BANK(LoadPushOAM) rst Bankswitch - call Function4032 + + call LoadPushOAM + xor a ld [hMapAnims], a ld [hSCX], a ld [hSCY], a ld [rJOYP], a - ld a, $8 + + ld a, $8 ; HBlank int enable ld [rSTAT], a + ld a, $90 ld [hWY], a ld [rWY], a + ld a, $7 ld [hWX], a ld [rWX], a - ld a, $ff + + ld a, -1 ld [hLinkPlayerNumber], a + ld h, $98 - call Function699 + call BlankBGMap ld h, $9c - call Function699 + call BlankBGMap - callab Function9cfd - ld a, $9c + callab InitCGBPals + ld a, $9c ld [hBGMapAddress + 1], a xor a ld [hBGMapAddress], a - callba Function14089 - ld a, $a + + callba StartClock + + ld a, SRAM_ENABLE ld [MBC3SRamEnable], a - ld a, $0 + ld a, SRAM_DISABLE ld [MBC3LatchClock], a ld [MBC3SRamEnable], a - ld a, $e3 + + ld a, %11100011 + ; LCD on + ; Win tilemap 1 + ; Win on + ; BG/Win tiledata 0 + ; BG Tilemap 0 + ; OBJ 8x8 + ; OBJ on + ; BG on ld [rLCDC], a + ld a, $1f ld [rIE], a ei + call DelayFrame + ld a, $30 - call Function2e49 - call Function3d4f + call Predef + + call DisableAudio xor a - ld [wc1c0], a -IF DEF(GOLD) - jp Function6545 -ENDC -IF DEF(SILVER) - jp Function650b -ENDC + ld [wMapMusic], a + jp GameInit ClearVRAM:: ; 68e (0:068e) ld hl, $8000 ld bc, $2000 xor a - call Function314c + call ByteFill ret -Function699:: ; 699 (0:0699) +BlankBGMap:: ; 699 (0:0699) ld a, $7f jr asm_69e -Function69d:: ; 69d +FillBGMap:: ; 69d ld a, l asm_69e ld de, $400 diff --git a/home/map.asm b/home/map.asm index c51f9c48..b5b0d8c8 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1349,7 +1349,7 @@ UpdateBGMapRow:: ; 27d3 dec c jr nz, .loop ld a, SCREEN_WIDTH - ld [hFFDC], a + ld [hFFDE], a ret ; 27f8 @@ -1376,7 +1376,7 @@ UpdateBGMapColumn:: ; 27f8 dec c jr nz, .loop ld a, SCREEN_HEIGHT - ld [hFFDC], a + ld [hFFDE], a ret ; 2816 diff --git a/home/serial.asm b/home/serial.asm index ad7d9610..02474ed7 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -1,43 +1,29 @@ -Serial:: ; 6ef -; The serial interrupt. - +Serial:: ; 6aa (0:06aa) push af push bc push de push hl - ld a, [hMobileReceive] - and a - jr nz, .mobile - - ld a, [wc2d4] + ld a, [wPrinterConnectionOpen] bit 0, a jr nz, .printer ld a, [hLinkPlayerNumber] - inc a ; is it equal to -1? + inc a jr z, .init_player_number - ld a, [rSB] ld [hSerialReceive], a - ld a, [hSerialSend] ld [rSB], a - ld a, [hLinkPlayerNumber] cp $2 jr z, .player2 - - ld a, 0 << rSC_ON + ld a, $0 ld [rSC], a - ld a, 1 << rSC_ON + ld a, $80 ld [rSC], a jr .player2 -.mobile - call MobileReceive - jr .end - .printer call PrinterReceive jr .end @@ -65,6 +51,7 @@ Serial:: ; 6ef bit 7, a jr nz, .wait_bit_7 + ; cycle the serial controller ld a, 0 << rSC_ON ld [rSC], a ld a, 1 << rSC_ON @@ -74,11 +61,10 @@ Serial:: ; 6ef ._player2 xor a ld [rSB], a - .player2 ld a, $1 - ld [hFFCA], a - ld a, -2 + ld [hFFCC], a + ld a, SERIAL_NO_DATA_BYTE ld [hSerialSend], a .end @@ -87,15 +73,14 @@ Serial:: ; 6ef pop bc pop af reti -; 75f -Function75f:: ; 75f +Function710:: ; 710 ld a, $1 - ld [hFFCC], a + ld [hFFCE], a .loop ld a, [hl] ld [hSerialSend], a - call Function78a + call Function73b push bc ld b, a inc hl @@ -103,16 +88,16 @@ Function75f:: ; 75f .wait dec a jr nz, .wait - ld a, [hFFCC] + ld a, [hFFCE] and a ld a, b pop bc jr z, .load dec hl - cp $fd + cp SERIAL_PREAMBLE_BYTE jr nz, .loop xor a - ld [hFFCC], a + ld [hFFCE], a jr .loop .load @@ -123,95 +108,96 @@ Function75f:: ; 75f or c jr nz, .loop ret -; 78a -Function78a:: ; 78a +Function73b:: ; 73b (0:073b) +.loop xor a - ld [hFFCA], a + ld [hFFCC], a ld a, [hLinkPlayerNumber] cp $2 - jr nz, .asm_79b - ld a, $1 + jr nz, .loop2 + ld a, (1 << rSC_CLOCK) | (0 << rSC_ON) ld [rSC], a - ld a, $81 + ld a, (1 << rSC_CLOCK) | (1 << rSC_ON) ld [rSC], a - -.asm_79b - ld a, [hFFCA] +.loop2 + ld a, [hFFCC] and a - jr nz, .asm_7e5 + jr nz, .reset_ffcc ld a, [hLinkPlayerNumber] cp $1 - jr nz, .asm_7c0 - call Function82b - jr z, .asm_7c0 - call .asm_825 + jr nz, .not_player_1_or_wLinkTimeoutFrames_zero + call CheckLinkTimeout + jr z, .not_player_1_or_wLinkTimeoutFrames_zero + call Serial15CycleDelay push hl - ld hl, wcf5c + ld hl, wLinkTimeoutFrames + 1 inc [hl] - jr nz, .asm_7b7 + jr nz, .no_rollover_up dec hl inc [hl] -.asm_7b7 +.no_rollover_up pop hl - call Function82b - jr nz, .asm_79b - jp Function833 + call CheckLinkTimeout + jr nz, .loop2 + jp SerialDisconnected -.asm_7c0 +.not_player_1_or_wLinkTimeoutFrames_zero ld a, [rIE] and $f cp $8 - jr nz, .asm_79b - ld a, [wcf5d] + jr nz, .loop2 + ld a, [wce5d] dec a - ld [wcf5d], a - jr nz, .asm_79b - ld a, [wcf5d + 1] + ld [wce5d], a + jr nz, .loop2 + ld a, [wce5d + 1] dec a - ld [wcf5d + 1], a - jr nz, .asm_79b + ld [wce5d + 1], a + jr nz, .loop2 ld a, [hLinkPlayerNumber] cp $1 - jr z, .asm_7e5 + jr z, .reset_ffcc + ld a, $ff -.asm_7e2 +.delay_255_cycles dec a - jr nz, .asm_7e2 + jr nz, .delay_255_cycles -.asm_7e5 +.reset_ffcc xor a - ld [hFFCA], a + ld [hFFCC], a ld a, [rIE] and $f sub $8 - jr nz, .asm_7f8 - ld [wcf5d], a + jr nz, .rIE_not_equal_8 + + ld [wce5d], a ld a, $50 - ld [wcf5d + 1], a + ld [wce5d + 1], a -.asm_7f8 +.rIE_not_equal_8 ld a, [hSerialReceive] - cp $fe + cp SERIAL_NO_DATA_BYTE ret nz - call Function82b - jr z, .asm_813 + call CheckLinkTimeout + jr z, .link_timed_out push hl - ld hl, wcf5c + ld hl, wLinkTimeoutFrames + 1 ld a, [hl] dec a ld [hld], a inc a - jr nz, .asm_80d + jr nz, .no_rollover dec [hl] -.asm_80d +.no_rollover pop hl - call Function82b - jr z, Function833 + call CheckLinkTimeout + jr z, SerialDisconnected -.asm_813 +.link_timed_out ld a, [rIE] and $f cp $8 @@ -220,84 +206,77 @@ Function78a:: ; 78a ld a, [hl] ld [hSerialSend], a call DelayFrame - jp Function78a + jp .loop -.asm_825 +Serial15CycleDelay:: ; 7d6 (0:07d6) ld a, $f -.asm_827 +.loop dec a - jr nz, .asm_827 + jr nz, .loop ret -; 82b -Function82b:: ; 82b +CheckLinkTimeout:: ; 7dc (0:07dc) push hl - ld hl, wcf5b + ld hl, wLinkTimeoutFrames ld a, [hli] or [hl] pop hl ret -; 833 -Function833:: ; 833 +SerialDisconnected:: ; 7e4 (0:07e4) dec a - ld [wcf5b], a - ld [wcf5c], a + ld [wLinkTimeoutFrames], a + ld [wLinkTimeoutFrames + 1], a ret -; 83b -Function83b:: ; 83b - ld hl, wPlayerLinkAction - ld de, wOtherPlayerLinkMode +Function7ec:: ; 7ec + ld hl, wce56 + ld de, wce51 ld c, $2 ld a, $1 - ld [hFFCC], a -.asm_847 + ld [hFFCE], a +.asm_7f8 call DelayFrame ld a, [hl] ld [hSerialSend], a - call Function78a + call Function73b ld b, a inc hl - ld a, [hFFCC] + ld a, [hFFCE] and a ld a, $0 - ld [hFFCC], a - jr nz, .asm_847 + ld [hFFCE], a + jr nz, .asm_7f8 ld a, b ld [de], a inc de dec c - jr nz, .asm_847 + jr nz, .asm_7f8 ret -; 862 -Function862:: ; 862 - call LoadTileMapToTempTileMap +Function813:: ; 813 + call BackUpTilesToBuffer callab PlaceWaitingText - call Function87d - jp Call_LoadTempTileMapToTileMap -; 871 - + call WaitLinkTransfer + jp ReloadTilesFromBuffer -Function871:: ; 871 - call LoadTileMapToTempTileMap +Function822:: ; 822 + call BackUpTilesToBuffer callab PlaceWaitingText - jp Function87d -; 87d + jp WaitLinkTransfer ; One "giant" leap for machinekind -Function87d:: ; 87d +WaitLinkTransfer:: ; 82e (0:082e) ld a, $ff - ld [wOtherPlayerLinkAction], a + ld [wce52], a .loop call LinkTransfer call DelayFrame - call Function82b + call CheckLinkTimeout jr z, .check push hl - ld hl, wcf5c + ld hl, wLinkTimeoutFrames + 1 dec [hl] jr nz, .skip dec hl @@ -305,13 +284,13 @@ Function87d:: ; 87d jr nz, .skip pop hl xor a - jp Function833 + jp SerialDisconnected .skip pop hl .check - ld a, [wOtherPlayerLinkAction] + ld a, [wce52] inc a jr z, .loop @@ -329,59 +308,53 @@ Function87d:: ; 87d dec b jr nz, .acknowledge - ld a, [wOtherPlayerLinkAction] - ld [wOtherPlayerLinkMode], a + ld a, [wce52] + ld [wce51], a ret -; 8c1 -LinkTransfer:: ; 8c1 +LinkTransfer:: ; 872 (0:0872) push bc - ld b, SERIAL_TIMECAPSULE + ld b, $60 ld a, [wLinkMode] - cp LINK_TIMECAPSULE - jr z, .got_high_nybble - ld b, SERIAL_TIMECAPSULE - jr c, .got_high_nybble - cp LINK_TRADECENTER - ld b, SERIAL_TRADECENTER - jr z, .got_high_nybble - ld b, SERIAL_BATTLE - -.got_high_nybble - call .Receive - ld a, [wPlayerLinkAction] + cp $1 + jr z, .asm_888 + ld b, $60 + jr c, .asm_888 + cp $2 + ld b, $70 + jr z, .asm_888 + ld b, $80 +.asm_888 + call LinkTransferReceive + ld a, [wce56] add b ld [hSerialSend], a ld a, [hLinkPlayerNumber] cp $2 - jr nz, .player_1 + jr nz, .asm_89f ld a, $1 ld [rSC], a ld a, $81 ld [rSC], a - -.player_1 - call .Receive +.asm_89f + call LinkTransferReceive pop bc ret -; 8f3 -.Receive ; 8f3 +LinkTransferReceive:: ; 8a4 (0:08a4) ld a, [hSerialReceive] - ld [wOtherPlayerLinkMode], a + ld [wce51], a and $f0 cp b ret nz xor a ld [hSerialReceive], a - ld a, [wOtherPlayerLinkMode] + ld a, [wce51] and $f - ld [wOtherPlayerLinkAction], a + ld [wce52], a ret -; 908 -LinkDataReceived:: ; 908 -; Let the other system know that the data has been received. +LinkDataReceived:: ; 8b9 (0:08b9) xor a ld [hSerialSend], a ld a, [hLinkPlayerNumber] @@ -392,9 +365,8 @@ LinkDataReceived:: ; 908 ld a, $81 ld [rSC], a ret -; 919 -Function919:: ; 919 +Function8ca:: ; 8ca ld a, [wLinkMode] and a ret nz @@ -407,4 +379,3 @@ Function919:: ; 919 ld a, $80 ld [rSC], a ret -; 92e diff --git a/home/video.asm b/home/video.asm index c88e0e55..85de6a1e 100644 --- a/home/video.asm +++ b/home/video.asm @@ -20,10 +20,10 @@ DMATransfer:: ; 15d8 UpdateBGMapBuffer:: ; 15e3 -; Copy [hFFDC] 16x8 tiles from BGMapBuffer +; Copy [hFFDE] 16x8 tiles from BGMapBuffer ; to bg map addresses in BGMapBufferPtrs. -; [hFFDC] must be even since this is done in pairs. +; [hFFDE] must be even since this is done in pairs. ; Return carry on success. @@ -76,10 +76,10 @@ rept 2 endr ; We've done 2 16x8 blocks - ld a, [hFFDC] + ld a, [hFFDE] dec a dec a - ld [hFFDC], a + ld [hFFDE], a jr nz, .next @@ -3,7 +3,7 @@ hPushOAM EQU $ff80 ; 10 bytes hROMBankBackup EQU $ff8c hBuffer EQU $ff8d -hFF8C EQU $ff8e +hFF8E EQU $ff8e hRTCDayHi EQU $ff8f hRTCDayLo EQU $ff90 hRTCHours EQU $ff91 @@ -73,7 +73,7 @@ hMGStatusFlags EQU $ffbe hUsedSpriteIndex EQU $ffbf hUsedSpriteTile EQU $ffc0 -hFFBF EQU $ffc1 +hFFC1 EQU $ffc1 hFFC2 EQU $ffc2 hFFC3 EQU $ffc3 hFFC4 EQU $ffc4 @@ -86,9 +86,9 @@ hLCDCPointer EQU $ffc8 hLYOverrideStart EQU $ffc9 hLYOverrideEnd EQU $ffca hMobileReceive EQU $ffcb -hFFCA EQU $ffcc +hFFCC EQU $ffcc hLinkPlayerNumber EQU $ffcd -hFFCC EQU $ffce +hFFCE EQU $ffce hSerialSend EQU $ffcf hSerialReceive EQU $ffd0 @@ -105,7 +105,7 @@ hOAMUpdate EQU $ffda hSPBuffer EQU $ffdb hBGMapUpdate EQU $ffdd -hFFDC EQU $ffde +hFFDE EQU $ffde hMapAnims EQU $ffe0 hTileAnimFrame EQU $ffe1 @@ -122,7 +122,7 @@ hCGB EQU $ffe8 hSGB EQU $ffe9 hDMATransfer EQU $ffea hMobile EQU $ffeb -hFFEA EQU $ffec +hFFEC EQU $ffec hClockResetTrigger EQU $ffed HRAM_END EQU $ffff @@ -15,6 +15,7 @@ INCLUDE "macros/rst.asm" INCLUDE "macros/mobile.asm" INCLUDE "macros/trainer.asm" INCLUDE "macros/trade_anim.asm" +INCLUDE "macros/wram.asm" dr: MACRO IF DEF(GOLD) diff --git a/macros/wram.asm b/macros/wram.asm index 175fc4de..1a44f0f1 100755 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -141,15 +141,14 @@ channel_struct: MACRO \1LoopCount:: db \1Tempo:: dw \1Tracks:: db ; hi:left lo:right -\1Field0x1c:: ds 1 ; c11d +\1SFXDutyLoop:: ds 1 ; c11d \1VibratoDelayCount:: db ; initialized by \1VibratoDelay \1VibratoDelay:: db ; number of frames a note plays until vibrato starts \1VibratoExtent:: db \1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt -\1Field0x21:: ds 1 ; c122 -\1Field0x22:: ds 1 ; c123 -\1Field0x23:: ds 1 ; c124 -\1Field0x24:: ds 1 ; c125 +\1PitchWheelTarget:: dw ; frequency endpoint for pitch wheel +\1PitchWheelAmount:: db ; c124 +\1PitchWheelAmountFraction:: db ; c125 \1Field0x25:: ds 1 ; c126 ds 1 ; c127 \1CryPitch:: dw @@ -199,14 +198,29 @@ hof_mon: MACRO \1End:: endm +roam_struct: MACRO +\1Species:: db +\1Level:: db +\1MapGroup:: db +\1MapNumber:: db +\1HP:: ds 1 +\1DVs:: ds 2 +ENDM + +bugcontestwinner: macro +\1PersonID:: ds 1 +\1Mon:: ds 1 +\1Score:: ds 2 +endm + hall_of_fame: MACRO \1:: \1WinCount:: ds 1 -\1Mon1:: hof_mon \1Mon1 -\1Mon2:: hof_mon \1Mon2 -\1Mon3:: hof_mon \1Mon3 -\1Mon4:: hof_mon \1Mon4 -\1Mon5:: hof_mon \1Mon5 +\1Mon1:: hof_mon \1Mon1 +\1Mon2:: hof_mon \1Mon2 +\1Mon3:: hof_mon \1Mon3 +\1Mon4:: hof_mon \1Mon4 +\1Mon5:: hof_mon \1Mon5 \1Mon6:: hof_mon \1Mon6 \1End:: ds 1 ENDM @@ -248,4 +262,113 @@ slot_reel: MACRO \1Slot0d:: ds 1 \1Slot0e:: ds 1 \1Slot0f:: ds 1 -endm
\ No newline at end of file +endm + +object_struct: MACRO +\1Struct:: +\1Sprite:: ds 1 +\1MapObjectIndex:: ds 1 +\1SpriteTile:: ds 1 +\1MovementType:: ds 1 +\1Flags:: ds 2 +\1Palette:: ds 1 +\1Walking:: ds 1 +\1Direction:: ds 1 +\1StepType:: ds 1 +\1StepDuration:: ds 1 +\1Action:: ds 1 +\1ObjectStepFrame:: ds 1 +\1Facing:: ds 1 +\1StandingTile:: ds 1 ; collision +\1LastTile:: ds 1 ; collision +\1StandingMapX:: ds 1 +\1StandingMapY:: ds 1 +\1LastMapX:: ds 1 +\1LastMapY:: ds 1 +\1ObjectInitX:: ds 1 +\1ObjectInitY:: ds 1 +\1Radius:: ds 1 +\1SpriteX:: ds 1 +\1SpriteY:: ds 1 +\1SpriteXOffset:: ds 1 +\1SpriteYOffset:: ds 1 +\1MovementByteIndex:: ds 1 +\1Object28:: ds 1 +\1Object29:: ds 1 +\1Object30:: ds 1 +\1Object31:: ds 1 +\1Range:: ds 1 + ds 7 +\1StructEnd:: +ENDM + +map_object: MACRO +\1Object:: +\1ObjectStructID:: ds 1 +\1ObjectSprite:: ds 1 +\1ObjectYCoord:: ds 1 +\1ObjectXCoord:: ds 1 +\1ObjectMovement:: ds 1 +\1ObjectRadius:: ds 1 +\1ObjectHour:: ds 1 +\1ObjectTimeOfDay:: ds 1 +\1ObjectColor:: ds 1 +\1ObjectRange:: ds 1 +\1ObjectScript:: ds 2 +\1ObjectEventFlag:: ds 2 + ds 2 +endm + +sprite_anim_struct: MACRO +\1Index:: ds 1 ; 0 +\1FramesetID:: ds 1 ; 1 +\1AnimSeqID:: ds 1 ; 2 +\1TileID:: ds 1 ; 3 +\1XCoord:: ds 1 ; 4 +\1YCoord:: ds 1 ; 5 +\1XOffset:: ds 1 ; 6 +\1YOffset:: ds 1 ; 7 +\1Duration:: ds 1 ; 8 +\1DurationOffset:: ds 1 ; 9 +\1FrameIndex:: ds 1 ; a +\1Sprite0b:: ds 1 +\1Sprite0c:: ds 1 +\1Sprite0d:: ds 1 +\1Sprite0e:: ds 1 +\1Sprite0f:: ds 1 +ENDM + +battle_anim_struct: MACRO +; Placeholder until we can figure out what it all means +\1_Index:: ds 1 +\1_Anim01:: ds 1 +\1_Anim02:: ds 1 +\1_FramesetIndex:: ds 1 +\1_FunctionIndex:: ds 1 +\1_Anim05:: ds 1 +\1_TileID:: ds 1 +\1_XCoord:: ds 1 +\1_YCoord:: ds 1 +\1_XOffset:: ds 1 +\1_YOffset:: ds 1 +\1_Anim0b:: ds 1 +\1_Anim0c:: ds 1 +\1_Anim0d:: ds 1 +\1_AnonJumptableIndex:: ds 1 +\1_Anim0f:: ds 1 +\1_Anim10:: ds 1 +\1_Anim11:: ds 1 +\1_Anim12:: ds 1 +\1_Anim13:: ds 1 +\1_Anim14:: ds 1 +\1_Anim15:: ds 1 +\1_Anim16:: ds 1 +\1_Anim17:: ds 1 +endm + +battle_bg_effect: MACRO +\1_Function:: ds 1 +\1_01:: ds 1 +\1_02:: ds 1 +\1_03:: ds 1 +endm @@ -1,24 +1,25 @@ INCLUDE "constants.asm" SECTION "bank1", DATA, BANK[$1] +PlaceWaitingText:: dr $4000, $4032 -Function4032:: +LoadPushOAM:: IF DEF(GOLD) dr $4032, $6545 -Function6545:: +GameInit:: dr $6545, $8000 ENDC IF DEF(SILVER) dr $4032, $650b -Function650b:: +GameInit:: dr $650b, $8000 ENDC SECTION "bank2", DATA, BANK[$2] dr $8000, $9cfd -Function9cfd:: ; 9cfd +InitCGBPals:: ; 9cfd dr $9cfd, $c000 SECTION "bank3", DATA, BANK[$3] @@ -31,7 +32,7 @@ SECTION "bank5", DATA, BANK[$5] dr $14000, $14032 Function14032:: ; 14032 dr $14032, $14089 -Function14089:: ; 14089 +StartClock:: ; 14089 dr $14089, $140ff Function140ff:: ; 140ff dr $140ff, $18000 @@ -1,456 +1,130 @@ INCLUDE "constants.asm" -SECTION "WRAM0", WRAM0 -wc000:: ds 1 -wc001:: ds 1 -wc002:: ds 1 -wc003:: ds 1 -wc004:: ds 1 -wc005:: ds 1 -wc006:: ds 1 -wc007:: ds 1 -wc008:: ds 1 -wc009:: ds 1 -wc00a:: ds 1 -wc00b:: ds 1 -wc00c:: ds 1 -wc00d:: ds 1 -wc00e:: ds 1 -wc00f:: ds 1 -wc010:: ds 1 -wc011:: ds 1 -wc012:: ds 1 -wc013:: ds 1 -wc014:: ds 1 -wc015:: ds 1 -wc016:: ds 1 -wc017:: ds 1 -wc018:: ds 1 -wc019:: ds 1 -wc01a:: ds 1 -wc01b:: ds 1 -wc01c:: ds 1 -wc01d:: ds 1 -wc01e:: ds 1 -wc01f:: ds 1 -wc020:: ds 1 -wc021:: ds 1 -wc022:: ds 1 -wc023:: ds 1 -wc024:: ds 1 -wc025:: ds 1 -wc026:: ds 1 -wc027:: ds 1 -wc028:: ds 1 -wc029:: ds 1 -wc02a:: ds 1 -wc02b:: ds 1 -wc02c:: ds 1 -wc02d:: ds 1 -wc02e:: ds 1 -wc02f:: ds 1 -wc030:: ds 1 -wc031:: ds 1 -wc032:: ds 1 -wc033:: ds 1 -wc034:: ds 1 -wc035:: ds 1 -wc036:: ds 1 -wc037:: ds 1 -wc038:: ds 1 -wc039:: ds 1 -wc03a:: ds 1 -wc03b:: ds 1 -wc03c:: ds 1 -wc03d:: ds 1 -wc03e:: ds 1 -wc03f:: ds 1 -wc040:: ds 1 -wc041:: ds 1 -wc042:: ds 1 -wc043:: ds 1 -wc044:: ds 1 -wc045:: ds 1 -wc046:: ds 1 -wc047:: ds 1 -wc048:: ds 1 -wc049:: ds 1 -wc04a:: ds 1 -wc04b:: ds 1 -wc04c:: ds 1 -wc04d:: ds 1 -wc04e:: ds 1 -wc04f:: ds 1 -wc050:: ds 1 -wc051:: ds 1 -wc052:: ds 1 -wc053:: ds 1 -wc054:: ds 1 -wc055:: ds 1 -wc056:: ds 1 -wc057:: ds 1 -wc058:: ds 1 -wc059:: ds 1 -wc05a:: ds 1 -wc05b:: ds 1 -wc05c:: ds 1 -wc05d:: ds 1 -wc05e:: ds 1 -wc05f:: ds 1 -wc060:: ds 1 -wc061:: ds 1 -wc062:: ds 1 -wc063:: ds 1 -wc064:: ds 1 -wc065:: ds 1 -wc066:: ds 1 -wc067:: ds 1 -wc068:: ds 1 -wc069:: ds 1 -wc06a:: ds 1 -wc06b:: ds 1 -wc06c:: ds 1 -wc06d:: ds 1 -wc06e:: ds 1 -wc06f:: ds 1 -wc070:: ds 1 -wc071:: ds 1 -wc072:: ds 1 -wc073:: ds 1 -wc074:: ds 1 -wc075:: ds 1 -wc076:: ds 1 -wc077:: ds 1 -wc078:: ds 1 -wc079:: ds 1 -wc07a:: ds 1 -wc07b:: ds 1 -wc07c:: ds 1 -wc07d:: ds 1 -wc07e:: ds 1 -wc07f:: ds 1 -wc080:: ds 1 -wc081:: ds 1 -wc082:: ds 1 -wc083:: ds 1 -wc084:: ds 1 -wc085:: ds 1 -wc086:: ds 1 -wc087:: ds 1 -wc088:: ds 1 -wc089:: ds 1 -wc08a:: ds 1 -wc08b:: ds 1 -wc08c:: ds 1 -wc08d:: ds 1 -wc08e:: ds 1 -wc08f:: ds 1 -wc090:: ds 1 -wc091:: ds 1 -wc092:: ds 1 -wc093:: ds 1 -wc094:: ds 1 -wc095:: ds 1 -wc096:: ds 1 -wc097:: ds 1 -wc098:: ds 1 -wc099:: ds 1 -wc09a:: ds 1 -wc09b:: ds 1 -wc09c:: ds 1 -wc09d:: ds 1 -wc09e:: ds 1 -wc09f:: ds 1 -wc0a0:: ds 1 -wc0a1:: ds 1 -wc0a2:: ds 1 -wc0a3:: ds 1 -wc0a4:: ds 1 -wc0a5:: ds 1 -wc0a6:: ds 1 -wc0a7:: ds 1 -wc0a8:: ds 1 -wc0a9:: ds 1 -wc0aa:: ds 1 -wc0ab:: ds 1 -wc0ac:: ds 1 -wc0ad:: ds 1 -wc0ae:: ds 1 -wc0af:: ds 1 -wc0b0:: ds 1 -wc0b1:: ds 1 -wc0b2:: ds 1 -wc0b3:: ds 1 -wc0b4:: ds 1 -wc0b5:: ds 1 -wc0b6:: ds 1 -wc0b7:: ds 1 -wc0b8:: ds 1 -wc0b9:: ds 1 -wc0ba:: ds 1 -wc0bb:: ds 1 -wc0bc:: ds 1 -wc0bd:: ds 1 -wc0be:: ds 1 -wc0bf:: ds 1 -wc0c0:: ds 1 -wc0c1:: ds 1 -wc0c2:: ds 1 -wc0c3:: ds 1 -wc0c4:: ds 1 -wc0c5:: ds 1 -wc0c6:: ds 1 -wc0c7:: ds 1 -wc0c8:: ds 1 -wc0c9:: ds 1 -wc0ca:: ds 1 -wc0cb:: ds 1 -wc0cc:: ds 1 -wc0cd:: ds 1 -wc0ce:: ds 1 -wc0cf:: ds 1 -wc0d0:: ds 1 -wc0d1:: ds 1 -wc0d2:: ds 1 -wc0d3:: ds 1 -wc0d4:: ds 1 -wc0d5:: ds 1 -wc0d6:: ds 1 -wc0d7:: ds 1 -wc0d8:: ds 1 -wc0d9:: ds 1 -wc0da:: ds 1 -wc0db:: ds 1 -wc0dc:: ds 1 -wc0dd:: ds 1 -wc0de:: ds 1 -wc0df:: ds 1 -wc0e0:: ds 1 -wc0e1:: ds 1 -wc0e2:: ds 1 -wc0e3:: ds 1 -wc0e4:: ds 1 -wc0e5:: ds 1 -wc0e6:: ds 1 -wc0e7:: ds 1 -wc0e8:: ds 1 -wc0e9:: ds 1 -wc0ea:: ds 1 -wc0eb:: ds 1 -wc0ec:: ds 1 -wc0ed:: ds 1 -wc0ee:: ds 1 -wc0ef:: ds 1 -wc0f0:: ds 1 -wc0f1:: ds 1 -wc0f2:: ds 1 -wc0f3:: ds 1 -wc0f4:: ds 1 -wc0f5:: ds 1 -wc0f6:: ds 1 -wc0f7:: ds 1 -wc0f8:: ds 1 -wc0f9:: ds 1 -wc0fa:: ds 1 -wc0fb:: ds 1 -wc0fc:: ds 1 -wc0fd:: ds 1 -wc0fe:: ds 1 -wc0ff:: ds 1 -wc100:: ds 1 -wc101:: ds 1 -wc102:: ds 1 -wc103:: ds 1 -wc104:: ds 1 -wc105:: ds 1 -wc106:: ds 1 -wc107:: ds 1 -wc108:: ds 1 -wc109:: ds 1 -wc10a:: ds 1 -wc10b:: ds 1 -wc10c:: ds 1 -wc10d:: ds 1 -wc10e:: ds 1 -wc10f:: ds 1 -wc110:: ds 1 -wc111:: ds 1 -wc112:: ds 1 -wc113:: ds 1 -wc114:: ds 1 -wc115:: ds 1 -wc116:: ds 1 -wc117:: ds 1 -wc118:: ds 1 -wc119:: ds 1 -wc11a:: ds 1 -wc11b:: ds 1 -wc11c:: ds 1 -wc11d:: ds 1 -wc11e:: ds 1 -wc11f:: ds 1 -wc120:: ds 1 -wc121:: ds 1 -wc122:: ds 1 -wc123:: ds 1 -wc124:: ds 1 -wc125:: ds 1 -wc126:: ds 1 -wc127:: ds 1 -wc128:: ds 1 -wc129:: ds 1 -wc12a:: ds 1 -wc12b:: ds 1 -wc12c:: ds 1 -wc12d:: ds 1 -wc12e:: ds 1 -wc12f:: ds 1 -wc130:: ds 1 -wc131:: ds 1 -wc132:: ds 1 -wc133:: ds 1 -wc134:: ds 1 -wc135:: ds 1 -wc136:: ds 1 -wc137:: ds 1 -wc138:: ds 1 -wc139:: ds 1 -wc13a:: ds 1 -wc13b:: ds 1 -wc13c:: ds 1 -wc13d:: ds 1 -wc13e:: ds 1 -wc13f:: ds 1 -wc140:: ds 1 -wc141:: ds 1 -wc142:: ds 1 -wc143:: ds 1 -wc144:: ds 1 -wc145:: ds 1 -wc146:: ds 1 -wc147:: ds 1 -wc148:: ds 1 -wc149:: ds 1 -wc14a:: ds 1 -wc14b:: ds 1 -wc14c:: ds 1 -wc14d:: ds 1 -wc14e:: ds 1 -wc14f:: ds 1 -wc150:: ds 1 -wc151:: ds 1 -wc152:: ds 1 -wc153:: ds 1 -wc154:: ds 1 -wc155:: ds 1 -wc156:: ds 1 -wc157:: ds 1 -wc158:: ds 1 -wc159:: ds 1 -wc15a:: ds 1 -wc15b:: ds 1 -wc15c:: ds 1 -wc15d:: ds 1 -wc15e:: ds 1 -wc15f:: ds 1 -wc160:: ds 1 -wc161:: ds 1 -wc162:: ds 1 -wc163:: ds 1 -wc164:: ds 1 -wc165:: ds 1 -wc166:: ds 1 -wc167:: ds 1 -wc168:: ds 1 -wc169:: ds 1 -wc16a:: ds 1 -wc16b:: ds 1 -wc16c:: ds 1 -wc16d:: ds 1 -wc16e:: ds 1 -wc16f:: ds 1 -wc170:: ds 1 -wc171:: ds 1 -wc172:: ds 1 -wc173:: ds 1 -wc174:: ds 1 -wc175:: ds 1 -wc176:: ds 1 -wc177:: ds 1 -wc178:: ds 1 -wc179:: ds 1 -wc17a:: ds 1 -wc17b:: ds 1 -wc17c:: ds 1 -wc17d:: ds 1 -wc17e:: ds 1 -wc17f:: ds 1 -wc180:: ds 1 -wc181:: ds 1 -wc182:: ds 1 -wc183:: ds 1 -wc184:: ds 1 -wc185:: ds 1 -wc186:: ds 1 -wc187:: ds 1 -wc188:: ds 1 -wc189:: ds 1 -wc18a:: ds 1 -wc18b:: ds 1 -wc18c:: ds 1 -wc18d:: ds 1 -wc18e:: ds 1 -wc18f:: ds 1 -wc190:: ds 1 -wc191:: ds 1 -wc192:: ds 1 -wc193:: ds 1 -wc194:: ds 1 -wc195:: ds 1 -wc196:: ds 1 -wc197:: ds 1 -wc198:: ds 1 -wc199:: ds 1 -wc19a:: ds 1 -wc19b:: ds 1 -wc19c:: ds 1 -wc19d:: ds 1 -wc19e:: ds 1 -wc19f:: ds 1 -wc1a0:: ds 1 -wc1a1:: ds 1 -wc1a2:: ds 1 -wc1a3:: ds 1 -wc1a4:: ds 1 -wc1a5:: ds 1 -wc1a6:: ds 1 -wc1a7:: ds 1 -wc1a8:: ds 1 -wc1a9:: ds 1 -wc1aa:: ds 1 -wc1ab:: ds 1 -wc1ac:: ds 1 -wc1ad:: ds 1 -wc1ae:: ds 1 -wc1af:: ds 1 -wc1b0:: ds 1 -wc1b1:: ds 1 -wc1b2:: ds 1 -wc1b3:: ds 1 -wc1b4:: ds 1 +SECTION "Audio", WRAM0 +wc000:: +wMusic:: +wMusicPlaying:: ; c000 +; nonzero if playing + ds 1 + +Channels:: +wChannel1:: channel_struct Channel1 ; c101 +wChannel2:: channel_struct Channel2 ; c133 +wChannel3:: channel_struct Channel3 ; c165 +wChannel4:: channel_struct Channel4 ; c197 + +SFXChannels:: +wChannel5:: channel_struct Channel5 ; c1c9 +wChannel6:: channel_struct Channel6 ; c1fb +wChannel7:: channel_struct Channel7 ; c12d +wChannel8:: channel_struct Channel8 ; c15f + + ds 1 ; c191 +wCurTrackDuty:: ds 1 +wCurTrackIntensity:: ds 1 +wCurTrackFrequency:: dw +wc196:: ds 1 ; BCD value, dummied out +wCurNoteDuration:: ds 1 ; used in MusicE0 and LoadNote + +CurMusicByte:: ; c198 + ds 1 +wCurChannel:: ; c199 + ds 1 +wVolume:: ; c19a +; corresponds to $ff24 +; Channel control / ON-OFF / Volume (R/W) +; bit 7 - Vin->SO2 ON/OFF +; bit 6-4 - SO2 output level (volume) (# 0-7) +; bit 3 - Vin->SO1 ON/OFF +; bit 2-0 - SO1 output level (volume) (# 0-7) + ds 1 +wSoundOutput:: ; c19b +; corresponds to $ff25 +; bit 4-7: ch1-4 so2 on/off +; bit 0-3: ch1-4 so1 on/off + ds 1 +wSoundInput:: ; c19c +; corresponds to $ff26 +; bit 7: global on/off +; bit 0: ch1 on/off +; bit 1: ch2 on/off +; bit 2: ch3 on/off +; bit 3: ch4 on/off + ds 1 + +MusicID:: +wMusicIDLo:: ; c19d + ds 1 +wMusicIDHi:: ; c19e + ds 1 +wMusicBank:: ; c19f + ds 1 +wNoiseSampleAddress:: +wNoiseSampleAddressLo:: ; c1a0 + ds 1 +wNoiseSampleAddressHi:: ; c1a1 + ds 1 +wNoiseSampleDelay:: ; noise delay? ; c1a2 + ds 1 +; c1a3 + ds 1 +wMusicNoiseSampleSet:: ; c1a4 + ds 1 +wSFXNoiseSampleSet:: ; c1a5 + ds 1 +wDanger:: ; c1a6 +; bit 7: on/off +; bit 4: pitch +; bit 0-3: counter + ds 1 +wMusicFade:: ; c1a7 +; fades volume over x frames +; bit 7: fade in/out +; bit 0-5: number of frames for each volume level +; $00 = none (default) + ds 1 +wMusicFadeCount:: ; c1a8 + ds 1 +wMusicFadeID:: +wc1a9:: +wMusicFadeIDLo:: ; c1a9 + ds 1 +wc1aa:: +wMusicFadeIDHi:: ; c1aa + ds 1 + ds 5 +wCryPitch:: ; c1b0 + ds 2 +wCryLength:: ; c1b2 + ds 2 +wLastVolume:: ; c1b4 + ds 1 wc1b5:: ds 1 -wc1b6:: ds 1 -wc1b7:: ds 1 -wc1b8:: ds 1 -wc1b9:: ds 1 -wc1ba:: ds 1 -wc1bb:: ds 1 -wc1bc:: ds 1 -wc1bd:: ds 1 -wc1be:: ds 1 -wc1bf:: ds 1 -wc1c0:: ds 1 -wc1c1:: ds 1 +wSFXPriority:: ; c1b6 +; if nonzero, turn off music when playing sfx + ds 1 + ds 1 +wChannel1JumpCondition:: ds 1 +wChannel2JumpCondition:: ds 1 +wChannel3JumpCondition:: ds 1 +wChannel4JumpCondition:: ds 1 +wStereoPanningMask:: ds 1 ; c1bc +wCryTracks:: ; c1bd +; plays only in left or right track depending on what side the monster is on +; both tracks active outside of battle + ds 1 +wSFXDuration:: ds 1 +wCurSFX:: ; c1bf +; id of sfx currently playing + ds 1 +wChannelsEnd:: +wMapMusic:: ; c1c0 + ds 1 + +wDontPlayMapMusicOnReload:: ds 1 +wMusicEnd:: + +SECTION "WRAM", WRAM0 wc1c2:: ds 1 wc1c3:: ds 1 wc1c4:: ds 1 @@ -468,7 +142,7 @@ wc1cf:: ds 1 wc1d0:: ds 1 wc1d1:: ds 1 wc1d2:: ds 1 -wc1d3:: ds 1 +wPrinterConnectionOpen:: ds 1 wc1d4:: ds 1 wc1d5:: ds 1 wc1d6:: ds 1 @@ -3678,10 +3352,8 @@ wce57:: ds 1 wce58:: ds 1 wce59:: ds 1 wce5a:: ds 1 -wce5b:: ds 1 -wce5c:: ds 1 -wce5d:: ds 1 -wce5e:: ds 1 +wLinkTimeoutFrames:: ds 2 +wce5d:: ds 2 wce5f:: ds 1 wce60:: ds 1 wce61:: ds 1 @@ -4081,7 +3753,7 @@ wd03e:: ds 1 wd03f:: ds 1 wd040:: ds 1 wd041:: ds 1 -wd042:: ds 1 +wLinkMode:: ds 1 wd043:: ds 1 wd044:: ds 1 wd045:: ds 1 |