diff --git a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_1.asm b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_1.asm index 591e39001..253699e89 100644 --- a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_1.asm +++ b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_1.asm @@ -2,8 +2,6 @@ clc lda {m2} adc #1 sta {m1} -bcc !+ lda {m2}+1 adc #0 -sta {m1}+1 -!: +sta {m1}+1 \ No newline at end of file diff --git a/src/test/kc/examples/mega65/linedrawing.c b/src/test/kc/examples/mega65/linedrawing.c index ffd43c073..3960313b0 100644 --- a/src/test/kc/examples/mega65/linedrawing.c +++ b/src/test/kc/examples/mega65/linedrawing.c @@ -1,7 +1,7 @@ // Test hardware line drawing // Based on https://github.com/MEGA65/mega65-tools/blob/master/src/tests/test_290.c -#pragma target(mega65) +#pragma target(mega65_remote) #include #include #include <6502.h> @@ -79,9 +79,8 @@ void main() { } - // Performs division on two 16 bit unsigned ints -// Returns the fractional part top 16 bit of the result +// Returns the 16 bit fractional part of the result // Uses the MEGA65 hardware math unit unsigned int m65_div16u_frac(unsigned int dividend, unsigned int divisor) { // Use hardware divider to get the slope @@ -89,7 +88,7 @@ unsigned int m65_div16u_frac(unsigned int dividend, unsigned int divisor) { *MATH_MULTINB_INT0 = (signed int)divisor; *MATH_MULTINA_INT1 = 0; *MATH_MULTINB_INT1 = 0; - // Wait 16 cycles + // Wait 16 cycles (only neeeded for some values) asm { lda MATH_DIVOUT_FRAC_INT1 @nooptimize lda MATH_DIVOUT_FRAC_INT1 @nooptimize @@ -194,7 +193,7 @@ void draw_line(int x1, int y1, int x2, int y2, unsigned char colour) { unsigned int count = (unsigned int)dy; char is_slope_negative = ((x2 - x1) < 0) ? 1 : 0; char is_direction_y = 1; - line_dma_execute(addr, slope, count, colour, is_slope_negative, is_direction_y); + line_dma_execute(addr, slope, count, colour, is_direction_y, is_slope_negative); } else { // X is major axis if (x2 < x1) { @@ -207,11 +206,10 @@ void draw_line(int x1, int y1, int x2, int y2, unsigned char colour) { unsigned int count = (unsigned int)dx; char is_slope_negative = ((y2 - y1) < 0) ? 1 : 0; char is_direction_y = 0; - line_dma_execute(addr, slope, count, colour, is_slope_negative, is_direction_y); + line_dma_execute(addr, slope, count, colour, is_direction_y, is_slope_negative); } } - // Address of the screen unsigned char * const SCREEN = 0xc000; // // Absolute address of the graphics