1111#include once <plot.asm>
1212#include once <stackf.asm>
1313#include once <draw.asm>
14+ #include once <sysvars.asm>
1415
1516; Ripped from the ZX Spectrum ROM
1617
2021 PROC
2122 LOCAL STACK_TO_BC
2223 LOCAL STACK_TO_A
23- LOCAL COORDS
2424 LOCAL L2477
2525 LOCAL L2420
2626 LOCAL L2439
3030 LOCAL SUM_C , SUM_B
3131
3232L2D28 EQU 02D28h
33- COORDS EQU 5C7Dh
3433STACK_TO_BC EQU 2307h
3534STACK_TO_A EQU 2314h
3635
@@ -262,7 +261,7 @@ L23C1: CALL 247Dh ; routine CD-PRMS1
262261 POP BC ; Balance the machine stack
263262
264263 JP C , L2477 ; forward, if the coordinates of first line
265- ; don't add up to more than 1, to LINE-DRAW
264+ ; don't add up to more than 1, to LINE-DRAW
266265
267266; Continue when the arc will have a discernable shape.
268267
@@ -319,7 +318,8 @@ L23C1: CALL 247Dh ; routine CD-PRMS1
319318; the jump will always be made to ARC-START.
320319
321320;; DRW-STEPS
322- L2420: DEC B ; decrement the arc count (4,8,12,16...).
321+ L2420:
322+ DEC B ; decrement the arc count (4,8,12,16...).
323323
324324 ;JR Z,L245F ; forward, if zero (not possible), to ARC-END
325325
@@ -353,7 +353,8 @@ L2420: DEC B ; decrement the arc count (4,8,12,16...).
353353; the formula returns the next relative coordinates to use.
354354
355355;; ARC-LOOP
356- L2425: RST 28H ;; FP-CALC
356+ L2425:
357+ RST 28H ;; FP-CALC
357358 DEFB $ E1 ;;get-mem-1 rx.
358359 DEFB $ 31 ;;duplicate rx, rx.
359360 DEFB $ E3 ;;get-mem-3 cos(a)
@@ -394,7 +395,8 @@ L2425: RST 28H ;; FP-CALC
394395; The mid entry point.
395396
396397;; ARC-START
397- L2439: PUSH BC ; Preserve the arc counter on the machine stack.
398+ L2439:
399+ PUSH BC ; Preserve the arc counter on the machine stack.
398400
399401; Store the absolute ay in temporary variable mem-0 for the moment.
400402
@@ -456,15 +458,16 @@ L2439: PUSH BC ; Preserve the arc counter on the machine stack.
456458; can be deleted to expose the closing coordinates.
457459
458460;; ARC-END
459- L245F: RST 28H ;; FP-CALC tx, ty, ax, ay.
461+ L245F:
462+ RST 28H ;; FP-CALC tx, ty, ax, ay.
460463 DEFB $ 02 ;;delete tx, ty, ax.
461464 DEFB $ 02 ;;delete tx, ty.
462465 DEFB $ 01 ;;exchange ty, tx.
463466 DEFB $ 38 ;;end-calc ty, tx.
464467
465468; First calculate the relative x coordinate to the end-point.
466469
467- LD A , ( $ 5C7D ) ; COORDS-x
470+ LD A , (COORDS ) ; COORDS-x
468471 CALL L2D28 ; routine STACK-A
469472
470473 RST 28H ;; FP-CALC ty, tx, coords_x.
@@ -475,7 +478,7 @@ L245F: RST 28H ;; FP-CALC tx, ty, ax, ay.
475478 DEFB $ 01 ;;exchange rx, ty.
476479 DEFB $ 38 ;;end-calc rx, ty.
477480
478- LD A , ( $ 5C7E ) ; COORDS-y
481+ LD A , (COORDS + 1 ) ; COORDS-y
479482 CALL L2D28 ; routine STACK-A
480483
481484 RST 28H ;; FP-CALC rx, ty, coords_y
0 commit comments