Re: A82: questions from a low intermidiate level programmer
[Prev][Next][Index][Thread]
Re: A82: questions from a low intermidiate level programmer
At 06:59 PM 9/30/97 -0400, you wrote:
>O.K. I have a couple more questions and I would like to thank anybody who
>could answer them.
>1. If you wanted to make a scrolling screen, (like for Pocman for the 85, or
>Srqxz for that matter) what would be the easiest way to do it? Could you just
>make a huge string of ones and zeros stored at the end of the program and
>then store a certain section of it into the graph_mem to display, using
>ROM_CALL(DISP_GRAPH) or is that immpossible.
The is a somewhat feasible but very inefficient way of doing it. A better
way to do it would be to store the level like this:
.db 1,1,1,1,1,1
.db 1,0,0,0,0,1
.db 1,4,0,2,0,1
.db 1,1,1,1,1,1
with each number corresponding to a different block in your game. Then you
need to draw your screen using that data. In order to scroll (depending on
how many/which ways you want to scroll) you need to either shift the screen
left, right, up or down. For the left and right scrolling, look into the
'rr' and 'rl' instructions and for the up and down scrolling, 'ldir' and
'lddr' are your best bet. Once you have scrolled, you will be left with
some garbage on the edge of the screen (which edge depends on which way you
scrolled) that needs to be filled in with the appropriate sprites. A good
way to do this is to use sprite clipping. There are some excellent routines
written by Jimmy Mardell for his 85/86 game Sqrxz that clip sprites. (They
need to be modified slightly, but the modifications aren't terribly difficult)
>2. If I have a label like this:
>highscore:
> .db 0,0
>and I go like this:
> ld a, 5
> ld (highscore), a
>would that change the string at highscore to
>highscore:
> .db 5,0
yes
>if I go like this:
> ld a, 5
> ld (hl), highscore
> inc hl
> ld (hl), a
>would that change the string at highscore to
>highscore:
> .db 5,5
Yes, provided you make one slight modification to the above; 'ld (hl),
highscore' should be changed to 'ld hl, highscore'
>if I have more than one row would that still work? I.E.
>highscore
> .db 0
> .db 0
Yes, in effect, that is the exact same thing you have above. The compiler
makes no note of the structure of your .db statements.
-Andrew
References: