From 17620f3fe1bb75e2910fe082c09495d36d2542c9 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 6 Jan 2021 14:21:51 -0500 Subject: [PATCH] roto: almost there --- graphics/gr/rotozoom/gr_plot.s | 7 +++-- graphics/gr/rotozoom/gr_scrn.s | 45 ++++++++++++--------------------- graphics/gr/rotozoom/roto.s | 3 +++ graphics/gr/rotozoom/rotozoom.s | 40 ++++++++++++++++++++--------- 4 files changed, 50 insertions(+), 45 deletions(-) diff --git a/graphics/gr/rotozoom/gr_plot.s b/graphics/gr/rotozoom/gr_plot.s index 1ad15895..73154207 100644 --- a/graphics/gr/rotozoom/gr_plot.s +++ b/graphics/gr/rotozoom/gr_plot.s @@ -5,7 +5,7 @@ ; Ycoord in YPOS ; color in COLOR plot: - lda YPOS ; 2 + lda YPOS ; 3 lsr ; shift bottom bit into carry ; 2 @@ -19,15 +19,14 @@ plot_c_done: stx MASK ; 3 asl ; shift back (now even) ; 2 - tay + tay ; 2 lda gr_offsets,Y ; lookup low-res memory address ; 4 clc ; 2 adc XPOS ; 3 sta GBASL ; 3 - iny ; 2 - lda gr_offsets,Y ; 4 + lda gr_offsets+1,Y ; 4 adc DRAW_PAGE ; add in draw page offset ; 3 sta GBASH ; 3 diff --git a/graphics/gr/rotozoom/gr_scrn.s b/graphics/gr/rotozoom/gr_scrn.s index c28f7fce..07de0a73 100644 --- a/graphics/gr/rotozoom/gr_scrn.s +++ b/graphics/gr/rotozoom/gr_scrn.s @@ -7,23 +7,10 @@ ; assume reading from $c00 scrn: - lda YPOS ; 2 + lda YPOS ; 3 -; lsr ; shift bottom bit into carry ; 2 - -; bcc scrn_even ; 2nt/3 -;scrn_odd: -; ldx #$f0 ; 2 -; bcs scrn_c_done ; 2nt/3 -;scrn_even: -; ldx #$0f ; 2 -;scrn_c_done: -; stx MASK ; 3 - -; asl ; shift back (now even) ; 2 - - and #$fe ; make even - tay + and #$fe ; make even ; 2 + tay ; 2 lda gr_offsets,Y ; lookup low-res memory address ; 4 clc ; 2 @@ -34,26 +21,26 @@ scrn: adc #$8 ; assume reading from $c0 ; 3 sta GBASH ; 3 - ldy #0 + ldy #0 ; 2 - lda YPOS - lsr - bcs scrn_adjust_even + lda YPOS ; 3 + lsr ; 2 + bcs scrn_adjust_even ;2nt/3t scrn_adjust_odd: - lda (GBASL),Y ; top/bottom color - jmp scrn_done + lda (GBASL),Y ; top/bottom color ; 5+ + jmp scrn_done ; 3 scrn_adjust_even: - lda (GBASL),Y ; top/bottom color + lda (GBASL),Y ; top/bottom color ; 5+ - lsr - lsr - lsr - lsr + lsr ; 2 + lsr ; 2 + lsr ; 2 + lsr ; 2 scrn_done: - and #$f + and #$f ; 2 - rts + rts ; 6 diff --git a/graphics/gr/rotozoom/roto.s b/graphics/gr/rotozoom/roto.s index 4f7eec4a..32de8fc5 100644 --- a/graphics/gr/rotozoom/roto.s +++ b/graphics/gr/rotozoom/roto.s @@ -75,6 +75,9 @@ wait_for_keypress: bit KEYRESET inc ANGLE + lda ANGLE + and #$f + sta ANGLE jmp main_loop diff --git a/graphics/gr/rotozoom/rotozoom.s b/graphics/gr/rotozoom/rotozoom.s index abd0fd8c..9c31b0d4 100644 --- a/graphics/gr/rotozoom/rotozoom.s +++ b/graphics/gr/rotozoom/rotozoom.s @@ -49,6 +49,22 @@ rotozoom: ; cca = -20*ca; ; csa = -20*sa; + lda #0 + sta CCAL + sta CCAH + sta CSAL + sta CSAH + + + ldx #20 +mul20_loop: + + + + dex + bne mul20_loop + + ; yca=cca+ycenter; lda CCAL @@ -101,21 +117,21 @@ rotozoom_xloop: ; else if ((yp<0) || (yp>39)) color=0; ; else color=scrn_page(xp,yp,PAGE2); -; lda #0 -; ldx XPH -; bmi rotozoom_set_color -; cpx #40 -; bcs rotozoom_set_color -; ldx YPH -; bmi rotozoom_set_color -; cpx #40 -; bcs rotozoom_set_color + lda #0 + ldx XPH + bmi rotozoom_set_color + cpx #40 + bcs rotozoom_set_color + ldx YPH + bmi rotozoom_set_color + cpx #40 + bcs rotozoom_set_color - ; scrn() + ; scrn(xp,yp) - lda XX + lda XPH sta XPOS - lda YY + lda YPH sta YPOS jsr scrn