Re: A82: Writing Text to APD_BUF


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

Re: A82: Writing Text to APD_BUF




>>>   How would you write text to APD_BUF? I figured out why set/res 
>>>7(iy+$14) doesn't work. It is because Andreas uses what he calls a 
>>>double graph buffer to speed up the game. He writes the screen data 
to
>>
>>>APD_BUF then copies it to GRAPH_MEM at a later point in the source. 
>>>Since set/res 7 doesn't work, he used this routine in the 85/86 
version
>>
>>>to keep the score on the screen:
>>> ld     HL,0
>>> ld     (CURSOR_X), hl
>>> ld     HL, (SCORE)
>>> call   DM_HL_DECI      ;display HL menu style
>>> push bc
>>> ld   b, 6
>>> ld   de, APD_BUF
>>> ld   hl, GRAPH_MEM
>>>CopyVid2Grf:
>>> push bc
>>> ldi
>>> ldi
>>> ldi
>>> ld   bc, 13
>>> add  hl, bc
>>> ex   de, hl
>>> add  hl, bc
>>> ex   de, hl
>>> pop  bc
>>> djnz CopyVid2Grf
>>> pop  bc
>>>
>>>   Why won't this work on the 82? Is there a better way to do it?
>>>
>>   Nevermind. I figured it out for myself.
>>
>
>Do you mind telling everyone else what the problem was?  I and a few 
other
>people might learn a lil bit from whatever it was. Thanx... =)
>								>							--Jason K.

   Well, I opted for "the better way" to do it approach. Here is what I 
have in my code:
 set 7,(iy+$14)              ;Write text to GRAPH_MEM
 ld     hl,$0000             ;Write at 0,0
 ld     (CURSOR_X), hl       ;Write in menu font
 ld     HL, (SCORE)          ;Write the score    
 call   HL_DECIMAL_MENU      ;display HL menu style
 res 7,(iy+$14)              ;Stop Writing text to GRAPH_MEM
 push bc                     ;Save bc (bc is the location of ball pos)
 ld   de, APD_BUF            ;Copy to APD_BUF
 ld   hl, GRAPH_MEM          ;Copy from GRAPH_MEM
 ld   bc,72                  ;Copy first 6 lines of GRAPH_MEM
                             ;There are 12 pixels(bytes) to a line
 ldir                        ;Do it
 pop  bc                     ;Restore BC


   I used set/res 7,(iy+$14) to write the text to GRAPH_MEM, then I 
copied the neccessary part of GRAPH_MEM to APD_BUF. Normally, you need 
to only copy the actuall bytes used, but that is a little more 
complicated and takes more room so I copied the entire lines. The way 
the Plain Jump double buffer display system works, the part of the lines 
that didn't need to be copied gets over-written before the graph_mem is 
displayed. Very simple.
 

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com