;drawing line from 2 cordinates .proc line testing: ;# (X_pos, Y_pos) # ;# * # ;# * # ;# * # ;# (X_end, Y_end) # ; ; NOTE THAT X_pos <= X_end and line is going downwords max 45deg! ;Not values but register position in memory X_end = $04 Y_end = $05 X_pos = $FC Y_pos = $FB dy = $06 dx = $07 D = $08 ;Set values LDA #$00 STA $FD ; for pixel_draw ;example values ~~~~~ SHOULD BE PRECOMPILED LDA #$00 STA X_pos STA Y_pos LDA #$50 STA X_end STA dx LDA #$40 STA Y_end STA dy LDA #($40 + $40 - $50 ) STA D ; = 2*dy - dx ; ~~~~~~~ for_x: jsr pixel_draw LDY D ; FOR DEBUG ; If D <= 0 then: skipp LDX D; DEX BMI case_2 case_1: INC Y_pos ;D = D_before -2*dx LDA dx ROL A TAX LDA D STX D ; D = -2*dx, A = D_before SEC SBC D ; A = D_before -2*dx STA D; jmp last case_2: ;D = D + 2*dx LDA dx ROL CLC ADC D STA D last: CMP #$00 ; increment x untill x == large INC X_pos LDA X_pos CMP #199 BEQ end JMP for_x end: jmp testing .endproc