Re: A82: image size and location


[Prev][Next][Index][Thread]

Re: A82: image size and location



Woops. Two things: When calculating how many bytes to add to GRAPH_MEM,
remember to divide by 8 to get bytes not pixels. And, the pic at the bottom
won't come out like a pyramid, because I didn't add padding. The correct code
is as follows:

 ld hl,PyramidPic
 ld de,GRAPH_MEM+351
 ld bc,60
 ldir
 ROM_CALL(DISP_GRAPH)

Loop:
 call GET_KEY
 and a
 jr z, Loop
 ret

PyramidPic:
.db    $0F, $F0,0,0,0,0,0,0,0,0,0,0
  .db    $1F,$F8,0,0,0,0,0,0,0,0,0,0
  .db    $3F,$FC,0,0,0,0,0,0,0,0,0,0
  .db    $7F,$FE,0,0,0,0,0,0,0,0,0,0
  .db    $FF,$FF,0,0,0,0,0,0,0,0,0,0

Matt Maurano wrote:

> ilya winham wrote:
>
> > When you want to display a TitlePic most programmers usually do this:
> >
> > ld hl,title    ; hl points to teh location to copy from
> > ld de,$88B8    ; de points to GRAPH_MEM, to location to copy to
> > ld bc,132   ;Copy 132 bytes
> > ldir       ; Do it
> > ROM_CALL(DISP_GRPH)    ; Copy GRAPH_MEM to the display controller
>
> > #1 How do you know where it will be displayed?
>
> The offset. If you want a pic to start 16 pixels into the first line,
> load de with GRAPHMEM+2. If you want it to start halfway down the screen,
> do GRAPH_MEM+(96[Width of the screen]*31[Halfway down])/8
>
> > #2 How do you calculate the size in the ld bc,??? command?
>
> The size of your picture. The example you showed is 25 bytes, I think
>
> > #3 How can you make titlepics?
>
> Draw the picture. IF you want a pixel on, do a 1. Of not, do a 0. Then,
> convert to hex (For simplicity- in hex each byte is two characters.)
>
> So, this is the picture
> 0000111111110000
> 0001111111111000
> 0011111111111100
> 0111111111111110
> 1111111111111111
>
> %00001111 = $0F
> %11110000 = $f8




References: