diff options
author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2020-07-07 19:48:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 19:48:22 -0400 |
commit | 9571c550b6a0dcb3a4f54513c881661a87271024 (patch) | |
tree | d73507228a57e4f3cece2fb93fe7df3a9439553f /engine/gfx | |
parent | c480632d5494d04f7f5f0298a31877a2293b564e (diff) | |
parent | bbf2f51a02b2544f1bef32a5868503b474ae2fef (diff) |
Merge pull request #263 from Rangi42/master
Syncing style with pokecrystal
Diffstat (limited to 'engine/gfx')
-rwxr-xr-x | engine/gfx/hp_bar.asm | 14 | ||||
-rwxr-xr-x | engine/gfx/load_pokedex_tiles.asm | 6 | ||||
-rwxr-xr-x | engine/gfx/mon_icons.asm | 12 | ||||
-rw-r--r-- | engine/gfx/oam_dma.asm | 6 | ||||
-rwxr-xr-x | engine/gfx/palettes.asm | 62 | ||||
-rwxr-xr-x | engine/gfx/screen_effects.asm | 26 | ||||
-rw-r--r-- | engine/gfx/sprite_oam.asm | 54 |
7 files changed, 90 insertions, 90 deletions
diff --git a/engine/gfx/hp_bar.asm b/engine/gfx/hp_bar.asm index 4b91da58..b7bd97f2 100755 --- a/engine/gfx/hp_bar.asm +++ b/engine/gfx/hp_bar.asm @@ -21,22 +21,22 @@ GetHPBarLength: rr e srl d rr e - ld a, [hMultiplicand+1] + ldh a, [hMultiplicand+1] ld b, a - ld a, [hMultiplicand+2] + ldh a, [hMultiplicand+2] srl b ; divide multiplication result as well rr a srl b rr a - ld [hMultiplicand+2], a + ldh [hMultiplicand+2], a ld a, b - ld [hMultiplicand+1], a + ldh [hMultiplicand+1], a .maxHPSmaller256 ld a, e - ld [hDivisor], a + ldh [hDivisor], a ld b, $4 call Divide - ld a, [hMultiplicand+2] + ldh a, [hMultiplicand+2] ld e, a ; e = bc * 48 / de (num of pixels of HP bar) pop hl and a @@ -213,7 +213,7 @@ UpdateHPBar_PrintHPNumber: ld a, [wHPBarOldHP + 1] ld [wHPBarTempHP], a push hl - ld a, [hFlagsFFF6] + ldh a, [hFlagsFFF6] bit 0, a jr z, .asm_fb15 ld de, $9 diff --git a/engine/gfx/load_pokedex_tiles.asm b/engine/gfx/load_pokedex_tiles.asm index 70bcf04d..a3f69171 100755 --- a/engine/gfx/load_pokedex_tiles.asm +++ b/engine/gfx/load_pokedex_tiles.asm @@ -2,10 +2,10 @@ LoadPokedexTilePatterns: call LoadHpBarAndStatusTilePatterns ld de, PokedexTileGraphics - ld hl, vChars2 + $600 + ld hl, vChars2 tile $60 lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10 call CopyVideoData ld de, PokeballTileGraphics - ld hl, vChars2 + $720 - lb bc, BANK(PokeballTileGraphics), $01 + ld hl, vChars2 tile $72 + lb bc, BANK(PokeballTileGraphics), 1 jp CopyVideoData ; load pokeball tile for marking caught mons diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 7a96b36c..8dd6fe75 100755 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -169,7 +169,7 @@ WriteMonPartySpriteOAMByPartyIndex: push hl push de push bc - ld a, [hPartyMonIndex] + ldh a, [hPartyMonIndex] ld hl, wPartySpecies ld e, a ld d, 0 @@ -187,7 +187,7 @@ WriteMonPartySpriteOAMBySpecies: ; Write OAM blocks for the party sprite of the species in ; [wMonPartySpriteSpecies]. xor a - ld [hPartyMonIndex], a + ldh [hPartyMonIndex], a ld a, [wMonPartySpriteSpecies] call GetPartyMonSpriteID ld [wOAMBaseTile], a @@ -201,11 +201,11 @@ UnusedPartyMonSpriteFunction: ld a, [wcf91] call GetPartyMonSpriteID push af - ld hl, vSprites + ld hl, vSprites tile $00 call .LoadTilePatterns pop af add $54 - ld hl, vSprites + $40 + ld hl, vSprites tile $04 call .LoadTilePatterns xor a ld [wMonPartySpriteSpecies], a @@ -236,8 +236,8 @@ WriteMonPartySpriteOAM: ; make a copy at wMonPartySpritesSavedOAM. push af ld c, $10 - ld h, wOAMBuffer / $100 - ld a, [hPartyMonIndex] + ld h, HIGH(wOAMBuffer) + ldh a, [hPartyMonIndex] swap a ld l, a add $10 diff --git a/engine/gfx/oam_dma.asm b/engine/gfx/oam_dma.asm index aeea4c01..84bb4b5c 100644 --- a/engine/gfx/oam_dma.asm +++ b/engine/gfx/oam_dma.asm @@ -1,7 +1,7 @@ WriteDMACodeToHRAM:: ; Since no other memory is available during OAM DMA, ; DMARoutine is copied to HRAM and executed there. - ld c, hDMARoutine % $100 + ld c, LOW(hDMARoutine) ld b, DMARoutineEnd - DMARoutine ld hl, DMARoutine .copy @@ -14,8 +14,8 @@ WriteDMACodeToHRAM:: DMARoutine: ; initiate DMA - ld a, wOAMBuffer / $100 - ld [rDMA], a + ld a, HIGH(wOAMBuffer) + ldh [rDMA], a ; wait for DMA to finish ld a, $28 diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index 58e08e86..23203374 100755 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -335,13 +335,13 @@ SendSGBPacket: push bc ; disable ReadJoypad to prevent it from interfering with sending the packet ld a, 1 - ld [hDisableJoypadPolling], a + ldh [hDisableJoypadPolling], a ; send RESET signal (P14=LOW, P15=LOW) xor a - ld [rJOYP], a + ldh [rJOYP], a ; set P14=HIGH, P15=HIGH ld a, $30 - ld [rJOYP], a + ldh [rJOYP], a ;load length of packets (16 bytes) ld b, $10 .nextByte @@ -358,10 +358,10 @@ SendSGBPacket: ; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0) ld a, $20 .next0 - ld [rJOYP], a + ldh [rJOYP], a ; must set P14=HIGH,P15=HIGH between each "pulse" ld a, $30 - ld [rJOYP], a + ldh [rJOYP], a ; rotation will put next bit in 0th position (so we can always use command ; "bit 0,d" to fetch the bit that has to be sent) rr d @@ -372,12 +372,12 @@ SendSGBPacket: jr nz, .nextByte ; send bit 1 as a "stop bit" (end of parameter data) ld a, $20 - ld [rJOYP], a + ldh [rJOYP], a ; set P14=HIGH,P15=HIGH ld a, $30 - ld [rJOYP], a + ldh [rJOYP], a xor a - ld [hDisableJoypadPolling], a + ldh [hDisableJoypadPolling], a ; wait for about 70000 cycles call Wait7000 ; restore (previously pushed) number of packets @@ -457,41 +457,41 @@ CheckSGB: di call SendSGBPacket ld a, 1 - ld [hDisableJoypadPolling], a + ldh [hDisableJoypadPolling], a ei call Wait7000 - ld a, [rJOYP] + ldh a, [rJOYP] and $3 cp $3 jr nz, .isSGB ld a, $20 - ld [rJOYP], a - ld a, [rJOYP] - ld a, [rJOYP] + ldh [rJOYP], a + ldh a, [rJOYP] + ldh a, [rJOYP] call Wait7000 call Wait7000 ld a, $30 - ld [rJOYP], a + ldh [rJOYP], a call Wait7000 call Wait7000 ld a, $10 - ld [rJOYP], a - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] + ldh [rJOYP], a + ldh a, [rJOYP] + ldh a, [rJOYP] + ldh a, [rJOYP] + ldh a, [rJOYP] + ldh a, [rJOYP] + ldh a, [rJOYP] call Wait7000 call Wait7000 ld a, $30 - ld [rJOYP], a - ld a, [rJOYP] - ld a, [rJOYP] - ld a, [rJOYP] + ldh [rJOYP], a + ldh a, [rJOYP] + ldh a, [rJOYP] + ldh a, [rJOYP] call Wait7000 call Wait7000 - ld a, [rJOYP] + ldh a, [rJOYP] and $3 cp $3 jr nz, .isSGB @@ -513,7 +513,7 @@ CopyGfxToSuperNintendoVRAM: push de call DisableLCD ld a, $e4 - ld [rBGP], a + ldh [rBGP], a ld de, vChars1 ld a, [wCopyingSGBTileData] and a @@ -539,11 +539,11 @@ CopyGfxToSuperNintendoVRAM: dec c jr nz, .loop ld a, $e3 - ld [rLCDC], a + ldh [rLCDC], a pop hl call SendSGBPacket xor a - ld [rBGP], a + ldh [rBGP], a ei ret @@ -577,7 +577,7 @@ SendSGBPackets: InitGBCPalettes: ld a, $80 ; index 0 with auto-increment - ld [rBGPI], a + ldh [rBGPI], a inc hl ld c, $20 .loop @@ -592,7 +592,7 @@ InitGBCPalettes: inc d .noCarry ld a, [de] - ld [rBGPD], a + ldh [rBGPD], a dec c jr nz, .loop ret diff --git a/engine/gfx/screen_effects.asm b/engine/gfx/screen_effects.asm index 0d3806c1..e8648901 100755 --- a/engine/gfx/screen_effects.asm +++ b/engine/gfx/screen_effects.asm @@ -1,14 +1,14 @@ ; b = new colour for BG colour 0 (usually white) for 4 frames ChangeBGPalColor0_4Frames: call GetPredefRegisters - ld a, [rBGP] + ldh a, [rBGP] or b - ld [rBGP], a + ldh [rBGP], a ld c, 4 call DelayFrames - ld a, [rBGP] + ldh a, [rBGP] and %11111100 - ld [rBGP], a + ldh [rBGP], a ret PredefShakeScreenVertically: @@ -19,7 +19,7 @@ PredefShakeScreenVertically: ld [wDisableVBlankWYUpdate], a xor a .loop - ld [hMutateWY], a + ldh [hMutateWY], a call .MutateWY call .MutateWY dec b @@ -30,10 +30,10 @@ PredefShakeScreenVertically: ret .MutateWY - ld a, [hMutateWY] + ldh a, [hMutateWY] xor b - ld [hMutateWY], a - ld [rWY], a + ldh [hMutateWY], a + ldh [rWY], a ld c, 3 jp DelayFrames @@ -43,7 +43,7 @@ PredefShakeScreenHorizontally: call GetPredefRegisters xor a .loop - ld [hMutateWX], a + ldh [hMutateWX], a call .MutateWX ld c, 1 call DelayFrames @@ -54,18 +54,18 @@ PredefShakeScreenHorizontally: ; restore normal WX ld a, 7 - ld [rWX], a + ldh [rWX], a ret .MutateWX - ld a, [hMutateWX] + ldh a, [hMutateWX] xor b - ld [hMutateWX], a + ldh [hMutateWX], a bit 7, a jr z, .skipZeroing xor a ; zero a if it's negative .skipZeroing add 7 - ld [rWX], a + ldh [rWX], a ld c, 4 jp DelayFrames diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 68128413..b3c07ecd 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -13,21 +13,21 @@ PrepareOAMData:: .updateEnabled xor a - ld [hOAMBufferOffset], a + ldh [hOAMBufferOffset], a .spriteLoop - ld [hSpriteOffset2], a + ldh [hSpriteOffset2], a - ld d, wSpriteStateData1 / $100 - ld a, [hSpriteOffset2] + ld d, HIGH(wSpriteStateData1) + ldh a, [hSpriteOffset2] ld e, a - ld a, [de] ; c1x0 + ld a, [de] ; [x#SPRITESTATEDATA1_PICTUREID] and a jp z, .nextSprite inc e inc e - ld a, [de] ; c1x2 (facing/anim) + ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX] ld [wd5cd], a cp $ff ; off-screen (don't draw) jr nz, .visible @@ -56,9 +56,9 @@ PrepareOAMData:: ld a, e add $5 ld e, a - ld a, [de] ; c2x7 + ld a, [de] ; [x#SPRITESTATEDATA2_GRASSPRIORITY] and $80 - ld [hSpritePriority], a ; temp store sprite priority + ldh [hSpritePriority], a ; temp store sprite priority pop de ; read the entry from the table @@ -77,17 +77,17 @@ PrepareOAMData:: call GetSpriteScreenXY - ld a, [hOAMBufferOffset] + ldh a, [hOAMBufferOffset] ld e, a - ld d, wOAMBuffer / $100 + ld d, HIGH(wOAMBuffer) .tileLoop - ld a, [hSpriteScreenY] ; temp for sprite Y position + ldh a, [hSpriteScreenY] ; temp for sprite Y position add $10 ; Y=16 is top of screen (Y=0 is invisible) add [hl] ; add Y offset from table ld [de], a ; write new sprite OAM Y position inc hl - ld a, [hSpriteScreenX] ; temp for sprite X position + ldh a, [hSpriteScreenX] ; temp for sprite X position add $8 ; X=8 is left of screen (X=0 is invisible) add [hl] ; add X offset from table inc e @@ -98,7 +98,7 @@ PrepareOAMData:: push bc ld b, a - ld a, [wd5cd] ; temp copy of c1x2 + ld a, [wd5cd] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX] swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) and $f @@ -126,7 +126,7 @@ PrepareOAMData:: ld a, [hl] bit 1, a ; is the tile allowed to set the sprite priority bit? jr z, .skipPriority - ld a, [hSpritePriority] + ldh a, [hSpritePriority] or [hl] .skipPriority inc hl @@ -136,18 +136,18 @@ PrepareOAMData:: jr z, .tileLoop ld a, e - ld [hOAMBufferOffset], a + ldh [hOAMBufferOffset], a .nextSprite - ld a, [hSpriteOffset2] + ldh a, [hSpriteOffset2] add $10 - cp $100 % $100 + cp LOW($100) jp nz, .spriteLoop ; Clear unused OAM. - ld a, [hOAMBufferOffset] + ldh a, [hOAMBufferOffset] ld l, a - ld h, wOAMBuffer / $100 + ld h, HIGH(wOAMBuffer) ld de, $4 ld b, $a0 ld a, [wd736] @@ -169,21 +169,21 @@ PrepareOAMData:: GetSpriteScreenXY: inc e inc e - ld a, [de] ; c1x4 - ld [hSpriteScreenY], a + ld a, [de] ; [x#SPRITESTATEDATA1_YPIXELS] + ldh [hSpriteScreenY], a inc e inc e - ld a, [de] ; c1x6 - ld [hSpriteScreenX], a + ld a, [de] ; [x#SPRITESTATEDATA1_XPIXELS] + ldh [hSpriteScreenX], a ld a, 4 add e ld e, a - ld a, [hSpriteScreenY] + ldh a, [hSpriteScreenY] add 4 and $f0 - ld [de], a ; c1xa (y) + ld [de], a ; [x#SPRITESTATEDATA1_YADJUSTED] inc e - ld a, [hSpriteScreenX] + ldh a, [hSpriteScreenX] and $f0 - ld [de], a ; c1xb (x) + ld [de], a ; [x#SPRITESTATEDATA1_XADJUSTED] ret |