mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Merge branch 'yenatch/split-predefs-specials-stds' into fix-split-predefs-specials-stds
https://github.com/kanzure/pokecrystal/pull/198
This commit is contained in:
commit
37e1aa4e8e
113
common/flag.asm
Normal file
113
common/flag.asm
Normal file
@ -0,0 +1,113 @@
|
||||
Function2e50: ; 2e50
|
||||
xor a
|
||||
ld hl, EventFlags
|
||||
ld [hli], a
|
||||
ret
|
||||
; 2e56
|
||||
|
||||
Function2e56: ; 2e56
|
||||
xor a
|
||||
ld hl, BikeFlags
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ret
|
||||
; 2e5d
|
||||
|
||||
Function2e5d: ; 2e5d
|
||||
ld a, [$d19a]
|
||||
cp $2
|
||||
jr z, .asm_2e69
|
||||
cp $1
|
||||
jr z, .asm_2e69
|
||||
ret
|
||||
|
||||
.asm_2e69
|
||||
ld hl, StatusFlags
|
||||
res 2, [hl]
|
||||
ret
|
||||
; 2e6f
|
||||
|
||||
|
||||
EventFlagAction: ; 0x2e6f
|
||||
ld hl, EventFlags
|
||||
call FlagAction
|
||||
ret
|
||||
|
||||
FlagAction: ; 0x2e76
|
||||
; Perform action b on bit de in flag array hl.
|
||||
|
||||
; inputs:
|
||||
; b: function
|
||||
; 0 clear bit
|
||||
; 1 set bit
|
||||
; 2 check bit
|
||||
; de: bit number
|
||||
; hl: index within bit table
|
||||
|
||||
; get index within the byte
|
||||
ld a, e
|
||||
and 7
|
||||
|
||||
; shift de right by three bits (get the index within memory)
|
||||
srl d
|
||||
rr e
|
||||
srl d
|
||||
rr e
|
||||
srl d
|
||||
rr e
|
||||
add hl, de
|
||||
|
||||
; implement a decoder
|
||||
ld c, 1
|
||||
rrca
|
||||
jr nc, .one
|
||||
rlc c
|
||||
.one
|
||||
rrca
|
||||
jr nc, .two
|
||||
rlc c
|
||||
rlc c
|
||||
.two
|
||||
rrca
|
||||
jr nc, .three
|
||||
swap c
|
||||
.three
|
||||
|
||||
; check b's value: 0, 1, 2
|
||||
ld a, b
|
||||
cp 1
|
||||
jr c, .clearbit ; 0
|
||||
jr z, .setbit ; 1
|
||||
|
||||
; check bit
|
||||
ld a, [hl]
|
||||
and c
|
||||
ld c, a
|
||||
ret
|
||||
|
||||
.setbit
|
||||
; set bit
|
||||
ld a, [hl]
|
||||
or c
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
.clearbit
|
||||
; clear bit
|
||||
ld a, c
|
||||
cpl
|
||||
and [hl]
|
||||
ld [hl], a
|
||||
ret
|
||||
; 0x2ead
|
||||
|
||||
|
||||
Function2ead: ; 2ead
|
||||
ld de, ENGINE_POKEDEX
|
||||
ld b, CHECK_FLAG
|
||||
callba EngineFlagAction
|
||||
ld a, c
|
||||
and a
|
||||
ret
|
||||
; 2ebb
|
||||
|
@ -101,8 +101,8 @@ Joypad: ; 935
|
||||
; Now that we have the input, we can do stuff with it.
|
||||
|
||||
; For example, soft reset:
|
||||
and BUTTON_A | BUTTON_B | SELECT | START
|
||||
cp BUTTON_A | BUTTON_B | SELECT | START
|
||||
and A_BUTTON | B_BUTTON | SELECT | START
|
||||
cp A_BUTTON | B_BUTTON | SELECT | START
|
||||
jp z, Reset
|
||||
|
||||
ret
|
||||
@ -283,11 +283,11 @@ Functiona1b: ; a1b
|
||||
pop bc
|
||||
|
||||
ld a, [hJoyDown]
|
||||
cp D_UP | SELECT | BUTTON_B
|
||||
cp D_UP | SELECT | B_BUTTON
|
||||
jr z, .asm_a34
|
||||
|
||||
ld a, [$ffa9]
|
||||
and START | BUTTON_A
|
||||
and START | A_BUTTON
|
||||
jr nz, .asm_a34
|
||||
|
||||
dec c
|
||||
@ -306,7 +306,7 @@ Functiona36: ; a36
|
||||
call DelayFrame
|
||||
call GetJoypadPublic
|
||||
ld a, [hJoyPressed]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
ret nz
|
||||
call RTC
|
||||
jr Functiona36
|
||||
@ -382,7 +382,7 @@ Functiona80: ; a80
|
||||
Functionaa5: ; aa5
|
||||
call Functiona57
|
||||
ld a, [$ffa9]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr z, Functionaa5
|
||||
ret
|
||||
; aaf
|
2369
common/map.asm
Normal file
2369
common/map.asm
Normal file
File diff suppressed because it is too large
Load Diff
39
common/string.asm
Normal file
39
common/string.asm
Normal file
@ -0,0 +1,39 @@
|
||||
InitString: ; 2ef6
|
||||
; Init a string of length c.
|
||||
push hl
|
||||
jr _InitString
|
||||
; 2ef9
|
||||
|
||||
InitName: ; 2ef9
|
||||
; Intended for names, so this function is limited to ten characters.
|
||||
push hl
|
||||
ld c, 10
|
||||
; 2efc
|
||||
|
||||
_InitString: ; 2efc
|
||||
; if the string pointed to by hl is empty (defined as "zero or more spaces
|
||||
; followed by a null"), then initialize it to the string pointed to by de.
|
||||
push bc
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp "@"
|
||||
jr z, .blank
|
||||
cp " "
|
||||
jr nz, .notblank
|
||||
dec c
|
||||
jr nz, .loop
|
||||
.blank
|
||||
pop bc
|
||||
ld l, e
|
||||
ld h, d
|
||||
pop de
|
||||
ld b, 0
|
||||
inc c
|
||||
call CopyBytes
|
||||
ret
|
||||
.notblank
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
; 2f17
|
||||
|
@ -1054,7 +1054,7 @@ Text_0A: ; 14ed
|
||||
push bc
|
||||
call GetJoypadPublic
|
||||
ld a, [hJoyDown]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr nz, .asm_14fd
|
||||
ld c, 30
|
||||
call DelayFrames
|
||||
@ -1136,7 +1136,7 @@ Text_0C: ; 1543
|
||||
ld [hli], a
|
||||
call GetJoypadPublic
|
||||
ld a, [hJoyDown]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr nz, .asm_155a
|
||||
ld c, 10
|
||||
call DelayFrames
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user