sms_metasprites.s (1587B)
1 .include "global.s" 2 3 .title "Metasprites" 4 .module Metasprites 5 6 .area _DATA 7 8___current_metasprite:: 9 .ds 0x02 10___current_base_tile:: 11 .ds 0x01 12 13 .area _INITIALIZED 14___render_shadow_OAM:: 15 .ds 0x01 16 17 .area _INITIALIZER 18 .db #>_shadow_OAM 19 20 .area _CODE 21 22; uint8_t __move_metasprite(uint8_t id, uint8_t x, uint8_t y) __z88dk_callee __preserves_regs(iyh,iyl); 23 24___move_metasprite:: 25 ld hl, #4 26 add hl, sp 27 28 ld b, (hl) 29 dec hl 30 ld c, (hl) 31 dec hl 32 ld e, (hl) 33 34 ld hl, (___current_metasprite) 35 36 ld a, (___render_shadow_OAM) 37 ld d, a 381$: 39 ld a, (hl) ; dy 40 inc hl 41 cp #0x80 42 jp z, 2$ 43 add b 44 ld b, a 45 cp #0xD0 46 jp nz, 3$ 47 ld a, #0xC0 483$: 49 ld (de), a 50 51 push de 52 53 ld a, e 54 add a 55 add #0x40 56 ld e, a 57 58 ld a, (hl) ; dx 59 inc hl 60 add c 61 ld c, a 62 ld (de), a 63 inc e 64 65 ld a, (___current_base_tile) 66 add (hl) ; tile 67 inc hl 68 ld (de), a 69 70 pop de 71 inc e 72 73 jp 1$ 742$: 75 pop hl 76 pop bc 77 inc sp 78 push hl 79 ld a, e 80 sub c 81 ld l, a 82 ret