projects
/
gbrg
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ccd488e
)
update: oam now only clears the unused objects each frame
author
Lukas Krickl
<lukas@krickl.dev>
Sat, 4 Oct 2025 18:51:19 +0000
(20:51 +0200)
committer
Lukas Krickl
<lukas@krickl.dev>
Sat, 4 Oct 2025 18:51:19 +0000
(20:51 +0200)
src/mem.s
patch
|
blob
|
history
src/update.s
patch
|
blob
|
history
diff --git
a/src/mem.s
b/src/mem.s
index ae06a618175c983540f2d54f225b5135eb595572..07c063e1894fcbf0fc8a9b64efb1e9c53c78544d 100644
(file)
--- a/
src/mem.s
+++ b/
src/mem.s
@@
-100,7
+100,30
@@
shadow_oam_clear:
ld hl, shadow_oam
ld d, 0
jp memset
-
+
+ ; clears the remaining shadow oam
+ ; entries
+shadow_oam_clear_rest:
+ ld hl, shadow_oam
+ ld d, 0
+ ld a, [current_oam_obj]
+ ld e, a
+ add hl, de ; hl = soam obj offset
+ xor a, a
+
+ sra e
+ sra e ; / 4 for loop coutner
+
+@clear_loop:
+ ld [hl+], a
+ ld [hl+], a
+ ld [hl+], a
+ ld [hl+], a
+ dec e
+ jr nz, @clear_loop REL
+
+ ret
+
; dma shadow oam to oam
; registers:
diff --git
a/src/update.s
b/src/update.s
index 010c83a4c63cd6ae57fe20f41e29be8338d61709..9ae0149a711acb8c83f00fa0f87f5726990c44bf 100644
(file)
--- a/
src/update.s
+++ b/
src/update.s
@@
-5,8
+5,6
@@
update_game:
; tick rng every frame
call rand
- ; clear oam
- call shadow_oam_clear
call video_map_adjust_scroll
@@
-16,6
+14,9
@@
update_game:
call actor_update_all
+ ; clear oam
+ call shadow_oam_clear_rest
+
ret
new_game: