Re: A82: image size and location


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

Re: A82: image size and location



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])

> #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

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

Now, to display it in about the center of the screen,
ld hl,PyramidPic
ld de,GRAPG_MEM+((29*96)+45)
d bc,10
ldir       ; Do it
ROM_CALL(DISP_GRPH)    ; Copy GRAPH_MEM to the display controller

This ought to work fine


Follow-Ups: References: