Skip to content

Commit a175e57

Browse files
authored
Revert "Optimized _TilePtrMapped" (#45)
This doesn't actually work. I totally blanked on the fact that the function arguments need to be kept on the stack.
1 parent c590385 commit a175e57

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

CEdev/lib/src/graphics/graphx/graphics_lib.asm

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,16 +2511,20 @@ _TilePtrMapped:
25112511
; arg2 : Y Map Offset
25122512
; Returns:
25132513
; A pointer to the indexed tile in the tilemap (so it can be looked at or changed)
2514-
pop hl ; return vector
2515-
pop iy ; tilemap struct
2516-
pop de ; x offset
2517-
ex (sp),hl ; y offset
2518-
ld h,(iy+13) ; tilemap width
2514+
push ix
2515+
ld ix,0 ; setup frame
2516+
add ix,sp
2517+
ld iy,(ix+6) ; tilemap struct pointer
2518+
ld h,(ix+12) ; y offset
2519+
ld l,(iy+13) ; height
25192520
mlt hl
2520-
ld d,0
2521-
add.s hl,de
2522-
ld de,(iy+0) ; tilemap data
2521+
ex de,hl
2522+
sbc hl,hl
2523+
ld l,(ix+9) ; x offset
2524+
ld bc,(iy+0) ; pointer to map
25232525
add hl,de
2526+
add hl,bc
2527+
pop ix ; end frame
25242528
ret
25252529

25262530
;-------------------------------------------------------------------------------

0 commit comments

Comments
 (0)