Skip to content

Commit 107653e

Browse files
ZERICO2005mateoconlechuga
authored andcommitted
fixed stack pointer bug in gfx_Polygon
1 parent 570f85d commit 107653e

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/graphx/graphx.asm

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4430,13 +4430,12 @@ _Polygon:
44304430
ld (.line0),hl
44314431
ld (.line1),hl
44324432
push ix
4433-
ld ix,0
4433+
ld ix,-3
44344434
add ix,sp
4435-
ld sp,hl
4436-
ld iy,(ix+6)
4435+
ld iy,(ix+9)
44374436
jr .startloop
44384437
.loop:
4439-
push iy
4438+
pea iy + 6
44404439
ld bc,(iy+9)
44414440
push bc
44424441
ld bc,(iy+6)
@@ -4447,16 +4446,12 @@ _Polygon:
44474446
push bc
44484447
call 0
44494448
.line0 := $-3
4450-
pop bc
4451-
pop bc
4452-
pop bc
4453-
pop bc
4454-
pop iy
4455-
lea iy,iy+6
4449+
ld sp, ix
4450+
pop iy ; iy += 6
44564451
.startloop:
4457-
ld hl,(ix+9)
4452+
ld hl,(ix+12)
44584453
dec hl
4459-
ld (ix+9),hl
4454+
ld (ix+12),hl
44604455
add hl,bc
44614456
or a,a
44624457
sbc hl,bc
@@ -4465,14 +4460,15 @@ _Polygon:
44654460
push bc
44664461
ld bc,(iy+0)
44674462
push bc
4468-
ld iy,(ix+6)
4463+
ld iy,(ix+9)
44694464
ld bc,(iy+3)
44704465
push bc
44714466
ld bc,(iy+0)
44724467
push bc
44734468
call 0
44744469
.line1 := $-3
4475-
ld sp,ix
4470+
lea hl, ix + 3
4471+
ld sp, hl
44764472
pop ix
44774473
ret
44784474

0 commit comments

Comments
 (0)