aboutsummaryrefslogtreecommitdiffstats
path: root/engine/gfx
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2025-09-06 16:54:17 -0500
committerdannye <33dannye@gmail.com>2025-09-06 16:54:17 -0500
commit377749ca4efac05b6c57dfed049899891af6c35a (patch)
tree4b429403935c4a7c2de710a6cbf7310246874539 /engine/gfx
parentFix .tilemap file extension, fix some typos (#138) (diff)
parentDocument visual glitch with Pewter City Gym guy (#526) (diff)
downloadpokeyellow-377749ca4efac05b6c57dfed049899891af6c35a.tar.gz
pokeyellow-377749ca4efac05b6c57dfed049899891af6c35a.tar.xz
pokeyellow-377749ca4efac05b6c57dfed049899891af6c35a.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine/gfx')
-rw-r--r--engine/gfx/palettes.asm46
1 files changed, 23 insertions, 23 deletions
diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm
index e2924c91..e46c6715 100644
--- a/engine/gfx/palettes.asm
+++ b/engine/gfx/palettes.asm
@@ -491,30 +491,30 @@ _SendSGBPacket:
; save B for later use
push bc
; send RESET signal (P14=LOW, P15=LOW)
- xor a
+ xor a ; JOYP_SGB_START
ldh [rJOYP], a
; set P14=HIGH, P15=HIGH
- ld a, $30
+ ld a, JOYP_SGB_FINISH
ldh [rJOYP], a
;load length of packets (16 bytes)
- ld b, $10
+ ld b, 16
.nextByte
;set bit counter (8 bits per byte)
- ld e, $08
+ ld e, 8
; get next byte in the packet
ld a, [hli]
ld d, a
.nextBit0
bit 0, d
; if 0th bit is not zero set P14=HIGH, P15=LOW (send bit 1)
- ld a, $10
+ ld a, JOYP_SGB_ONE
jr nz, .next0
; else (if 0th bit is zero) set P14=LOW, P15=HIGH (send bit 0)
- ld a, $20
+ ld a, JOYP_SGB_ZERO
.next0
ldh [rJOYP], a
; must set P14=HIGH,P15=HIGH between each "pulse"
- ld a, $30
+ ld a, JOYP_SGB_FINISH
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)
@@ -524,11 +524,11 @@ _SendSGBPacket:
jr nz, .nextBit0
dec b
jr nz, .nextByte
-; send bit 1 as a "stop bit" (end of parameter data)
- ld a, $20
+; send bit 0 as a "stop bit" (end of parameter data)
+ ld a, JOYP_SGB_ZERO
ldh [rJOYP], a
; set P14=HIGH,P15=HIGH
- ld a, $30
+ ld a, JOYP_SGB_FINISH
ldh [rJOYP], a
; wait for about 70000 cycles
call Wait7000
@@ -612,20 +612,20 @@ CheckSGB:
call SendSGBPacket
call Wait7000
ldh a, [rJOYP]
- and $3
- cp $3
+ and JOYP_SGB_MLT_REQ
+ cp JOYP_SGB_MLT_REQ
jr nz, .isSGB
- ld a, $20
+ ld a, JOYP_SGB_ZERO
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
call Wait7000
call Wait7000
- ld a, $30
+ ld a, JOYP_SGB_FINISH
ldh [rJOYP], a
call Wait7000
call Wait7000
- ld a, $10
+ ld a, JOYP_SGB_ONE
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
@@ -635,7 +635,7 @@ CheckSGB:
ldh a, [rJOYP]
call Wait7000
call Wait7000
- ld a, $30
+ ld a, JOYP_SGB_FINISH
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
@@ -643,8 +643,8 @@ CheckSGB:
call Wait7000
call Wait7000
ldh a, [rJOYP]
- and $3
- cp $3
+ and JOYP_SGB_MLT_REQ
+ cp JOYP_SGB_MLT_REQ
jr nz, .isSGB
call SendMltReq1Packet
and a
@@ -674,15 +674,15 @@ CopyGfxToSuperNintendoVRAM:
call CopySGBBorderTiles
jr .next
.notCopyingTileData
- ld bc, $1000
+ ld bc, 256 tiles
call CopyData
.next
ld hl, vBGMap0
- ld de, $c
+ ld de, TILEMAP_WIDTH - SCREEN_WIDTH
ld a, $80
- ld c, $d
+ ld c, (256 + SCREEN_WIDTH - 1) / SCREEN_WIDTH ; enough rows to fit 256 tiles
.loop
- ld b, $14
+ ld b, SCREEN_WIDTH
.innerLoop
ld [hli], a
inc a
@@ -691,7 +691,7 @@ CopyGfxToSuperNintendoVRAM:
add hl, de
dec c
jr nz, .loop
- ld a, $e3
+ ld a, LCDC_DEFAULT
ldh [rLCDC], a
pop hl
call SendSGBPacket