Ok, in an effort to (re)learn z80, i've decided to recode instcirc in z80 (it was in C). I got it to work, but i'm curious as to ways to make this smaller...
Code:
FastCirc.inc contains the routine on ticalc.org, so i didn't copy its contents here as I didn't code that part FastCircle takes 3 arguments, D = center_x, E = center_y, C = radius
Code:
.module Program
.export
Main
; Program entry point
bcall(_rclans)
ld a, (hl)
cp ListObj
ret nz
ld a, (de)
cp $03
ret nz
ex de, hl
inc hl
inc hl
push hl
bcall(_mov9toop1)
bcall(_convop1)
ld (circ_x), a
;restore HL and add 9
pop hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
push hl
bcall(_mov9toop1)
bcall(_convop1)
ld (circ_y), a
;restore HL and add 9
pop hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
bcall(_mov9toop1)
bcall(_convop1)
ld c, a
ld a, (circ_x)
ld d, a
ld a, (circ_y)
ld e, a
call FastCircle
bcall(_grbufcpy)
ret
circ_x
.db 0
circ_y
.db 0
.endmodule
.include "FastCirc.inc"
FastCirc.inc contains the routine on ticalc.org, so i didn't copy its contents here as I didn't code that part FastCircle takes 3 arguments, D = center_x, E = center_y, C = radius