Re: LZ: Program additions


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

Re: LZ: Program additions



According to "Frank":
>Remeber me ... the etch a sketch program kid... well i got it working 100% 
>with erasing also... my next idea was to save and load the drawing... i have 
>no clue were to start... can someone show me some code that has to do with 
>saving a screen .... i tried looking at sample codes there is just to much.... 
>also does anyone have any other ideas of things i can add onto that program 
>that will help me towards my goal (being able to make Bust A Move)... Thanx
> 


Howdy...


        There are two ways you could do saving drawings:


                1) Move video memory to the end of the program and
recalculate the
                   checksum; adds 1024 bytes to the program and a lot of
trouble at
                   times.
                2) Move the video mem to graph memory.


        If you want to do drawings with your program and keep Graph memory
clean for school / other wastes of time :), I'd say go with the first.  It'd
make the program large, but it's a great experience... hehe... Door number 2
is easier but you lose it all if there's something already in graph memory
or if you draw over it.


        Hmm... let me see, I think I have a vid-mem mover here somewhere...
ah, here it is, Jimmy Mardell gave this to me I believe:


        ld hl,$FC00  ; Beginning of lcd mem
        ld de,$8641  ; Beginning of graph mem
        ld bc,1024   ; 64*128/8 = 1024 bytes
        ldir         ; Move it
        ret          ; Return / Quit


( The rest is my code, save before doing this ;) )


        This would move it to graph memory; you could also replace DE with
the end of your program and recalculate the checksum when you quit, like so:
        
        ld hl,$FC00         ; Beginning of lcd mem
        ld de,(StoredImage) ; Beginning of screen in prog
        ld bc,1024          ; 64*128/8 = 1024 bytes
        ldir                ; Move it
        ret                 ; Return / Quit


  There are three tricks to this though.  First, if you don't recalculate
the checksum, the program will not be able to run when you try to enter
again ( To recalc checksum, set bit 0 of ZS_BITS to 1 ).  Second, leave 1024
bytes of 00 for the space of the image when it's first loaded onto the calc.
Third, load it back into memory at the beginning of the program, like so:


        ld hl,(StoredImage) ; Beginning of screen in prog
        ld de,$FC00         ; Beginning of lcd mem
        ld bc,1024          ; 64*128/8 = 1024 bytes
        ldir                ; Move it
        ret                 ; Return / Quit
       
        For those unfamiliar, ldir = move one byte at hl to one byte at de,
increase both pointers by one, decrease bc by 1, and continue until bc=0...
is that right?


Hope this helps,
Ryan Myers ( rmyers@teleport.com )
http://www.teleport.com/~rmyers/
"Canthus" or "Darren" on DARKWORLD / Twisted Fate


C> Warning: REALITY.SYS may be corrupt.  Reboot universe(y/n)?


References: