Re: A83: Re: Many Pixels... Routine? =P
[Prev][Next][Index][Thread]
Re: A83: Re: Many Pixels... Routine? =P
It would be much better to store the coords in X,Y form, instead of two
separate lists. Two lists would require pointer addition for each pixel or
two separate pointers. Not good. It would be better to do it like this...
Points:
.db 4 ; number of points
.db 14,63 ; the pixel locations
.db 28,25 ; in X,Y format
.db 29,78
.db 32,79
After you have that, you just want to run through the list and plot all the
points:
ld hl,Points ; point to list
ld b,(hl) ; get number of points
inc hl ; move to start of list
PixelLoop:
ld d,(hl) ; get x coord
inc hl ; next byte
ld e,(hl) ; get y coord
inc hl ; next byte
push hl ; save pointer
call FindPixel ; hmm...
or (hl) ; plot it
ld (hl),a ; save the new pixel
pop hl ; restore pointer
djnz PixelLoop ; plot all of them
I'm sure there is a good FindPixel already for the 83, either in the rom or
elsewhere, so I won't spend time "re-inventing the wheel". But for the
example assume that this one accepts coords in DE and returns the address in
HL and the mask in A. I will also assume that it preserves all registers
(except AF and HL, of course), so if it doesn't, add some pushes/pops.
-----Original Message-----
From: Jkhum98@aol.com <Jkhum98@aol.com>
To: assembly-83@lists.ticalc.org <assembly-83@lists.ticalc.org>
Date: Monday, November 02, 1998 9:24 PM
Subject: Re: A83: Re: Many Pixels... Routine? =P
>
>In a message dated 11/02/98 9:57:27 PM, electrum@tfs.net writes:
>
>>What exactly are you trying to do?
>
>I want to be able to list the coordinates somewhere in the program like
so...
>
>X_Data: .db 14, 28, 29, 32, 96, 4, 35, etc.
>Y_Data: .db 63, 25, 78, 79, 22, 12, 61, etc. (Just examples)
>
>...and then load the labels into registers to point to that data, then
specify
>how many pixels for it to plot... 'ld b, 7' since there's seven values in
that
>example.
>
>These are all various points that I know I want to plot throughout the
screen,
>and have no order to use a large sprite routine for, so I want to be able
to
>just let it plot anything I list. Since it will be Many pixels, it should
>write them to the Graph Buffer, and then I can copy the buffer to the
>display...
>
>>You can use or write your own FindPixel function, which is a
>>function that you pass the X,Y coords (usually in BC or DE) that
>>returns the address in the video buffer of the pixel and the
>
>>bitmask of the pixel in A. It would look like this:
>
>
>
>>ld bc,(19<<8)+37 ; draw pixel at (19, 37)
>
>>call FindPixel
>
>>or (hl) ; set the pixel in the video buffer
>
>>ld (hl),a ; and save it, because "or (hl)" saves it in A
>
>Ok, I'm not quite familiar with all that yet, like using bitmasks and such,
so
>it would be very helpful if I could have a routine that carries out this
>function, and I can learn off of that... I see your example will write this
>individual point, but I need a routine that will go down this array of
>coordinate data, looking up each point, then incrementing to the next
location
>of data in the series of '.db's...
> --Jason K.