How do you:
-Pixel on/ off
-draw a line?

Thanks!
You can turn pixels on and off by either using a sprite routine like iPutSprite, or by using the set and res opcodes.
A better way to turn pixels on and off is to use iGetPixel, like this:

Code:
;Turn pixel on
    ld a,[x coord]
    ld e,[y coord]
    call iGetPixel
    or (hl)
    ld (hl),a

;Turn pixel off
    ld a,[x coord]
    ld e,[y coord]
    call iGetPixel
    cpl
    and (hl)
    ld (hl),a

;Invert pixel
    ld a,[x coord]
    ld e,[y coord]
    call iGetPixel
    xor (hl)
    ld (hl),a
There's also a DCS routine for lines, Fastline:


Code:
    ld a,1 ;for a black line; other colors are possible (see url)
    ld h,[x1]
    ld l,[y1]
    ld d,[x2]
    ld e,[y2]
    call FastLine

(or)
    ld a,1
    ld hl,(256*[x1])+[y1]
    ld de,(256*[x2])+[y2]
    call FastLine


Be aware that you'll need iFastCopy too.
Thanks, this will help me out much in the future (I think xD)
aeTIos wrote:
Thanks, this will help me out much in the future (I think xD)
I certainly hope so! Note that the TI-OS has routines to do similar things, but they are much, much slower.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement