Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ZX0 decompression examples
#1
Hi

I have been looking into the ZX0 library

Having created a compress file by running this "zx0 testscreen.scr"
And to us this file this is a test file I created t.bas

#include "zx0.bas"

10 dzx0Standard(@testscreen1, 16384)
20 GOTO 20

testscreen1:
    asm
        incbin "testscreen.scr.zx0"
    end asm

When compiled and run it indeed does display the image on screen.
Some questions:-

Q1.I have been able to convert some artwork (PNG) to .SCR and compress this and then load it on screen BUT (newbie alert) I am running out of memory/program crashes/resets Emulator.
So the question is, can I do this and if so HOW?
(A) load from a M: drive (emulator allowing) and/or
(B) use the 128K Mode and then use the memory banks for images and leave the '48K' for the main game?

Q2. How can I display the SCR file but only print it to the top half of the screen?
1/3 or 2/3rds is okay as well? Is there any code examples (ASM/ZXB)

Q3. Next to the text,
I want to next compress text files that contain a description of a game room.
Looking at an example I tried this (don't laugh!) :-

dzx0Standard(@Text1, 50000)

Text1:
asm
incbin "location1.txt.zx00"
end asm
Text2:
asm
incbin "location2.txt.zx00"
end asm

But this does nothing but load it to the address of 50000 but I want the routine to return a STRING containing the decompressed text?

Quote:UPDATE 4th April 2021: I have worked how to do Q3 in a standalone test.bas file but when I do this in my main program it crashes the app soon after starting it up?
I am using these params --tzx --BASIC --autorun  --heap=1000 --optimize 2  --org=25000--debug-memory  --debug-array 

Lots of questions but hopefully some kind person can help? :-)
thanks
Reply
#2
Still trying to work out why the above code is crashing ?
Reply
#3
I would ensure you have at least 4 zero bytes after every zx0 compressed block or zx0 could continue through the next block.

Code:
Text1:
asm
incbin "location1.txt.zx00"
db 0,0,0,0
end asm
Reply
#4
(05-17-2021, 07:25 AM)emook Wrote: I would ensure you have at least 4 zero bytes after every zx0 compressed block or zx0 could continue through the next block.

Code:
Text1:
asm
incbin "location1.txt.zx00"
db 0,0,0,0
end asm

Thanks Emook I will try this out :-)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)