Posted By
bubis on 2012-11-23 05:19:22
| Re: Draw a single pixel in assembler
If performance is not critical, you can simply use ROM routines. Like you can use JSR $C1A5 that reads the x coordinate from $02ad-$02ae and y from $02af. You can find plenty of examples using this ROM routine in http://plus4world.powweb.com/software/Your_Daily_128_Byte_Intro
faster routines work like this:
XR: x coord lo $d0: x coord hi YR: y coord
lda row_addr_lo,y sta $d2 clc lda $d0 adc row_addr_hi,y sta $d3 txa and #$f8 tay lda ($d2),y ora bits,x sta ($d2),y rts You have to prepare three tables for this to work: * row_addr_lo/row_addr_hi needs to point to the first byte on the bitmap for the respective y coordinate, so it's like (bitmap_base+(y/8)*320+y&7). * bits is a 256 bytes long periodic sequence of 128,64,32,16,8,4,2,1, 128, ....
|