; Routine for drawing at (x, y) coordinates #zeroflag 1 ; *** Set your desired (x, y) here: *** #input_x 2 #input_y 2 ; Set up some handy shortcuts #x $FA #y $FB #return_addr_ptr $FE ; Main: LDA #input_x STO #x LDA #input_y STO #y LDA * 6 ; acc = current address + 6 (LDA, STO, JMP = 6) STO #return_addr_ptr JMP @getxy LDA $FF STO ($FD) END ;; Convert a pair of (x, y) coords ;; to the address of a pixel on the display ;; ;; Call with: ;; - x in #x ;; - y in #y ;; - return address in #return_addr_ptr ;; ;; Returns: pixel address in $FD @getxy #gxy_px $FD ; stash x... LDA (#x) STO #gxy_px ; check if this is row 0... LDA (#y) FHP #zeroflag JMP @getxy_loop JMP (#return_addr_ptr) ; if row 0, we're done @getxy_loop LDA (#gxy_px) ADD 5 ; add 5 to get to the next row STO #gxy_px LDA (#y) ; decrement y (it's acting as a loop counter)... SUB 1 STO #y FHP #zeroflag JMP @getxy_loop JMP (#return_addr_ptr) ;; Main variables: ;; F8 ;; F9 ;; FA - x coord ;; FB - y coord ;; FC - gxy temp ;; FD - gxy temp ;; FE - Return address for subroutine