update address syntax again

This commit is contained in:
Bryan Bishop 2012-12-26 20:18:12 -06:00
parent 9ed07bd3a9
commit 0eb28d0e67

118
main.asm
View File

@ -141,40 +141,40 @@ INCBIN "baserom.gbc",$547,$568 - $547
DisableLCD: ; 568 DisableLCD: ; 568
; don't need to do anything if lcd is already off ; don't need to do anything if lcd is already off
ld a, [$ff00+$40] ; LCDC ld a, [$ff40] ; LCDC
bit 7, a ; lcd enable bit 7, a ; lcd enable
ret z ret z
; reset ints ; reset ints
xor a xor a
ld [$ff00+$f], a ; IF ld [$ff0f], a ; IF
; save enabled ints ; save enabled ints
ld a, [$ff00+$ff] ; IE ld a, [$ffff] ; IE
ld b, a ld b, a
; disable vblank ; disable vblank
res 0, a ; vblank res 0, a ; vblank
ld [$ff00+$ff], a ; IE ld [$ffff], a ; IE
.wait .wait
; wait until vblank ; wait until vblank
ld a, [$ff00+$44] ; LY ld a, [$ff44] ; LY
cp 145 ; >144 (ensure beginning of vblank) cp 145 ; >144 (ensure beginning of vblank)
jr nz, .wait jr nz, .wait
; turn lcd off ; turn lcd off
ld a, [$ff00+$40] ; LCDC ld a, [$ff40] ; LCDC
and %01111111 ; lcd enable off and %01111111 ; lcd enable off
ld [$ff00+$40], a ; LCDC ld [$ff40], a ; LCDC
; reset ints ; reset ints
xor a xor a
ld [$ff00+$f], a ; IF ld [$ff0f], a ; IF
; restore enabled ints ; restore enabled ints
ld a, b ld a, b
ld [$ff00+$ff], a ; IE ld [$ffff], a ; IE
ret ret
; 58a ; 58a
@ -228,25 +228,25 @@ GetClock: ; 5b7
ld [hl], $8 ; S ld [hl], $8 ; S
ld a, [de] ld a, [de]
and $3f and $3f
ld [$ff00+$91], a ld [$ff91], a
; minutes ; minutes
ld [hl], $9 ; M ld [hl], $9 ; M
ld a, [de] ld a, [de]
and $3f and $3f
ld [$ff00+$90], a ld [$ff90], a
; hours ; hours
ld [hl], $a ; H ld [hl], $a ; H
ld a, [de] ld a, [de]
and $1f and $1f
ld [$ff00+$8f], a ld [$ff8f], a
; day lo ; day lo
ld [hl], $b ; DL ld [hl], $b ; DL
ld a, [de] ld a, [de]
ld [$ff00+$8e], a ld [$ff8e], a
; day hi ; day hi
ld [hl], $c ; DH ld [hl], $c ; DH
ld a, [de] ld a, [de]
ld [$ff00+$8d], a ld [$ff8d], a
; cleanup ; cleanup
call CloseSRAM ; unlatch clock, disable clock r/w call CloseSRAM ; unlatch clock, disable clock r/w
@ -259,16 +259,16 @@ FixDays: ; 5e8
; mod by 140 ; mod by 140
; check if day count > 255 (bit 8 set) ; check if day count > 255 (bit 8 set)
ld a, [$ff00+$8d] ; DH ld a, [$ff8d] ; DH
bit 0, a bit 0, a
jr z, .daylo jr z, .daylo
; reset dh (bit 8) ; reset dh (bit 8)
res 0, a res 0, a
ld [$ff00+$8d], a ; DH ld [$ff8d], a ; DH
; mod 140 ; mod 140
; mod twice since bit 8 (DH) was set ; mod twice since bit 8 (DH) was set
ld a, [$ff00+$8e] ; DL ld a, [$ff8e] ; DL
.modh .modh
sub 140 sub 140
jr nc, .modh jr nc, .modh
@ -278,7 +278,7 @@ FixDays: ; 5e8
add 140 add 140
; update dl ; update dl
ld [$ff00+$8e], a ; DL ld [$ff8e], a ; DL
; unknown output ; unknown output
ld a, $40 ; %1000000 ld a, $40 ; %1000000
@ -286,7 +286,7 @@ FixDays: ; 5e8
.daylo .daylo
; quit if fewer than 140 days have passed ; quit if fewer than 140 days have passed
ld a, [$ff00+$8e] ; DL ld a, [$ff8e] ; DL
cp 140 cp 140
jr c, .quit jr c, .quit
@ -297,7 +297,7 @@ FixDays: ; 5e8
add 140 add 140
; update dl ; update dl
ld [$ff00+$8e], a ; DL ld [$ff8e], a ; DL
; unknown output ; unknown output
ld a, $20 ; %100000 ld a, $20 ; %100000
@ -322,7 +322,7 @@ FixTime: ; 61d
; store time in CurDay, $ff94, $ff96, $ff98 ; store time in CurDay, $ff94, $ff96, $ff98
; second ; second
ld a, [$ff00+$91] ; S ld a, [$ff91] ; S
ld c, a ld c, a
ld a, [StartSecond] ld a, [StartSecond]
add c add c
@ -330,11 +330,11 @@ FixTime: ; 61d
jr nc, .updatesec jr nc, .updatesec
add 60 add 60
.updatesec .updatesec
ld [$ff00+$98], a ld [$ff98], a
; minute ; minute
ccf ; carry is set, so turn it off ccf ; carry is set, so turn it off
ld a, [$ff00+$90] ; M ld a, [$ff90] ; M
ld c, a ld c, a
ld a, [StartMinute] ld a, [StartMinute]
adc c adc c
@ -342,11 +342,11 @@ FixTime: ; 61d
jr nc, .updatemin jr nc, .updatemin
add 60 add 60
.updatemin .updatemin
ld [$ff00+$96], a ld [$ff96], a
; hour ; hour
ccf ; carry is set, so turn it off ccf ; carry is set, so turn it off
ld a, [$ff00+$8f] ; H ld a, [$ff8f] ; H
ld c, a ld c, a
ld a, [StartHour] ld a, [StartHour]
adc c adc c
@ -354,11 +354,11 @@ FixTime: ; 61d
jr nc, .updatehr jr nc, .updatehr
add 24 add 24
.updatehr .updatehr
ld [$ff00+$94], a ld [$ff94], a
; day ; day
ccf ; carry is set, so turn it off ccf ; carry is set, so turn it off
ld a, [$ff00+$8e] ; DL ld a, [$ff8e] ; DL
ld c, a ld c, a
ld a, [StartDay] ld a, [StartDay]
adc c adc c
@ -393,23 +393,23 @@ SetClock: ; 691
; seconds ; seconds
ld [hl], $8 ; S ld [hl], $8 ; S
ld a, [$ff00+$91] ld a, [$ff91]
ld [de], a ld [de], a
; minutes ; minutes
ld [hl], $9 ; M ld [hl], $9 ; M
ld a, [$ff00+$90] ld a, [$ff90]
ld [de], a ld [de], a
; hours ; hours
ld [hl], $a ; H ld [hl], $a ; H
ld a, [$ff00+$8f] ld a, [$ff8f]
ld [de], a ld [de], a
; day lo ; day lo
ld [hl], $b ; DL ld [hl], $b ; DL
ld a, [$ff00+$8e] ld a, [$ff8e]
ld [de], a ld [de], a
; day hi ; day hi
ld [hl], $c ; DH ld [hl], $c ; DH
ld a, [$ff00+$8d] ld a, [$ff8d]
res 6, a ; make sure timer is active res 6, a ; make sure timer is active
ld [de], a ld [de], a
@ -481,7 +481,7 @@ GetJoypadPublic: ; 984
; struct: [input][duration] ; struct: [input][duration]
; save bank ; save bank
ld a, [$ff00+$9d] ld a, [$ff9d]
push af push af
; ;
ld a, [AutoInputBank] ld a, [AutoInputBank]
@ -591,11 +591,11 @@ DmgToCgbBGPals: ; c9f
; exists to forego reinserting cgb-converted image data ; exists to forego reinserting cgb-converted image data
; input: a -> bgp ; input: a -> bgp
ld [$ff00+$47], a ; bgp ld [$ff47], a ; bgp
push af push af
; check cgb ; check cgb
ld a, [$ff00+$e6] ld a, [$ffe6]
and a and a
jr z, .end jr z, .end
@ -603,27 +603,27 @@ DmgToCgbBGPals: ; c9f
push de push de
push bc push bc
; save wram bank ; save wram bank
ld a, [$ff00+$70] ld a, [$ff70]
push af push af
; wram bank 5 ; wram bank 5
ld a, 5 ld a, 5
ld [$ff00+$70], a ld [$ff70], a
; copy & reorder bg pal buffer ; copy & reorder bg pal buffer
ld hl, BGPals ; to ld hl, BGPals ; to
ld de, Unkn1Pals ; from ld de, Unkn1Pals ; from
; order ; order
ld a, [$ff00+$47] ; bgp ld a, [$ff47] ; bgp
ld b, a ld b, a
; # pals ; # pals
ld c, 8 ; all pals ld c, 8 ; all pals
call CopyPals call CopyPals
; request pal update ; request pal update
ld a, $1 ld a, $1
ld [$ff00+$e5], a ld [$ffe5], a
; restore wram bank ; restore wram bank
pop af pop af
ld [$ff00+$70], a ld [$ff70], a
pop bc pop bc
pop de pop de
pop hl pop hl
@ -639,12 +639,12 @@ DmgToCgbObjPals: ; ccb
; input: d -> obp1 ; input: d -> obp1
; e -> obp2 ; e -> obp2
ld a, e ld a, e
ld [$ff00+$48], a ; obp0 ld [$ff48], a ; obp0
ld a, d ld a, d
ld [$ff00+$49], a ; obp1 ld [$ff49], a ; obp1
; check cgb ; check cgb
ld a, [$ff00+$e6] ld a, [$ffe6]
and a and a
ret z ret z
@ -652,11 +652,11 @@ DmgToCgbObjPals: ; ccb
push de push de
push bc push bc
; save wram bank ; save wram bank
ld a, [$ff00+$70] ld a, [$ff70]
push af push af
; wram bank 5 ; wram bank 5
ld a, $5 ld a, $5
ld [$ff00+$70], a ld [$ff70], a
; copy & reorder obj pal buffer ; copy & reorder obj pal buffer
; to ; to
@ -664,17 +664,17 @@ DmgToCgbObjPals: ; ccb
; from ; from
ld de, Unkn2Pals ld de, Unkn2Pals
; order ; order
ld a, [$ff00+$48] ; obp0 ld a, [$ff48] ; obp0
ld b, a ld b, a
; # pals ; # pals
ld c, 8 ; all pals ld c, 8 ; all pals
call CopyPals call CopyPals
; request pal update ; request pal update
ld a, $1 ld a, $1
ld [$ff00+$e5], a ld [$ffe5], a
; restore wram bank ; restore wram bank
pop af pop af
ld [$ff00+$70], a ld [$ff70], a
pop bc pop bc
pop de pop de
pop hl pop hl
@ -1240,7 +1240,7 @@ Predef: ; 2d83
ld [$cfb4], a ld [$cfb4], a
; save bank ; save bank
ld a, [$ff00+$9d] ; current bank ld a, [$ff9d] ; current bank
push af push af
; get Predef function to call ; get Predef function to call
@ -1733,12 +1733,12 @@ GetSGBLayout: ; 3340
; load sgb packets unless gb ; load sgb packets unless gb
; check cgb ; check cgb
ld a, [$ff00+$e6] ld a, [$ffe6]
and a and a
jr nz, .dosgb jr nz, .dosgb
; check sgb ; check sgb
ld a, [$ff00+$e7] ld a, [$ffe7]
and a and a
ret z ret z
@ -3063,7 +3063,7 @@ INCBIN "baserom.gbc",$14000,$14032 - $14000
GetTimeOfDay: ; 14032 GetTimeOfDay: ; 14032
; get time of day based on the current hour ; get time of day based on the current hour
ld a, [$ff00+$94] ; hour ld a, [$ff94] ; hour
ld hl, TimeOfDayTable ld hl, TimeOfDayTable
.check .check
@ -54369,11 +54369,11 @@ TimeOfDayPals: ; 8c011
ld hl, $d038 ; Unkn1Pals + 7 pals ld hl, $d038 ; Unkn1Pals + 7 pals
; save wram bank ; save wram bank
ld a, [$ff00+$70] ; wram bank ld a, [$ff70] ; wram bank
ld b, a ld b, a
; wram bank 5 ; wram bank 5
ld a, 5 ld a, 5
ld [$ff00+$70], a ; wram bank ld [$ff70], a ; wram bank
; push palette ; push palette
ld c, 4 ; NUM_PAL_COLORS ld c, 4 ; NUM_PAL_COLORS
@ -54388,7 +54388,7 @@ TimeOfDayPals: ; 8c011
; restore wram bank ; restore wram bank
ld a, b ld a, b
ld [$ff00+$70], a ; wram bank ld [$ff70], a ; wram bank
; update sgb pals ; update sgb pals
@ -54400,11 +54400,11 @@ TimeOfDayPals: ; 8c011
ld hl, $d03f ; last byte in Unkn1Pals ld hl, $d03f ; last byte in Unkn1Pals
; save wram bank ; save wram bank
ld a, [$ff00+$70] ; wram bank ld a, [$ff70] ; wram bank
ld d, a ld d, a
; wram bank 5 ; wram bank 5
ld a, 5 ld a, 5
ld [$ff00+$70], a ; wram bank ld [$ff70], a ; wram bank
; pop palette ; pop palette
ld e, 4 ; NUM_PAL_COLORS ld e, 4 ; NUM_PAL_COLORS
@ -54419,7 +54419,7 @@ TimeOfDayPals: ; 8c011
; restore wram bank ; restore wram bank
ld a, d ld a, d
ld [$ff00+$70], a ; wram bank ld [$ff70], a ; wram bank
; update palettes ; update palettes
call UpdateTimePals call UpdateTimePals
@ -54516,7 +54516,7 @@ INCBIN "baserom.gbc",$8c15e,$8c17c - $8c15e
GetTimePalFade: ; 8c17c GetTimePalFade: ; 8c17c
; check cgb ; check cgb
ld a, [$ff00+$e6] ld a, [$ffe6]
and a and a
jr nz, .cgb jr nz, .cgb