Making screen layouts in code

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
clebin
Manic Miner
Posts: 979
Joined: Thu Jun 25, 2020 1:06 pm
Location: Vale of Glamorgan
Contact:

Re: Making screen layouts in code

Post by clebin »

To keep the motivation up, I started putting together a vertical skyscraper level. It won't feature any flying vans.

Image
dfzx
Manic Miner
Posts: 682
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: Making screen layouts in code

Post by dfzx »

clebin wrote: Fri Apr 22, 2022 2:58 pm I did had real "doh!" moment earlier. I said I can't get my program to work when I move the DATA section around, no matter what I tried. Even CRT_ORG_DATA=-1 wouldn't work, which I read is supposed to stick it at the end of the code section but in a different bin file.

At that point I checked my file-sizes and realised that "-create-app" doesn't actually stick together the generated *_CODE.bin and *_DATA.bin files in the TAP file. Argh, no wonder it crashes every time!! So now I have to figure out z88dk-appmake to combine them. Slowly, I feel like the mist is clearing...
I'd expect setting CRT_ORG_DATA to -1 to produce the separate DATA bin file. Odd that it didn't.

In my experience the -create-app option is overrated. It only seems capable of doing really basic stuff, and doesn't complain when something harder is put in front of it. It normally gets those wrong, as you've found out. I use individual compile-to-object, link, and app-make commands in any less-than-trivial projects.
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
clebin
Manic Miner
Posts: 979
Joined: Thu Jun 25, 2020 1:06 pm
Location: Vale of Glamorgan
Contact:

Re: Making screen layouts in code

Post by clebin »

dfzx wrote: Fri Apr 22, 2022 6:08 pmI'd expect setting CRT_ORG_DATA to -1 to produce the separate DATA bin file. Odd that it didn't.
Sorry if I wasn't clear. CRT_ORG_DATA =-1 did create a separate DATA bin file, just that -create-app ignores it and I hadn't realised.
User avatar
clebin
Manic Miner
Posts: 979
Joined: Thu Jun 25, 2020 1:06 pm
Location: Vale of Glamorgan
Contact:

Re: Making screen layouts in code

Post by clebin »

I've moved my 'Spectrum Tiled Tool' from Bitbucket to Github:

https://github.com/clebin/spectiledtool

I also added the simple RLE compression that @dfzx suggested (cheers again) as an extra option:

Code: Select all

php SpecTiledTool.php --tileset=tileset.tsj --map=map.tmj --graphics=tiles.gif --compression=rle --format=c
This is only for the tilemap/screen data. If you use --format=asm, it adds a 16-bit number at the beginning to denote the size of the data.

I'm saving 40-60% depending on the screen with no noticeable extra delay in switching screens, so that'll give me enough space to be getting along with for now.
dfzx
Manic Miner
Posts: 682
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: Making screen layouts in code

Post by dfzx »

clebin wrote: Sat Apr 23, 2022 2:18 pm I'm saving 40-60% depending on the screen with no noticeable extra delay in switching screens, so that'll give me enough space to be getting along with for now.
Has this restored stability?
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
clebin
Manic Miner
Posts: 979
Joined: Thu Jun 25, 2020 1:06 pm
Location: Vale of Glamorgan
Contact:

Re: Making screen layouts in code

Post by clebin »

dfzx wrote: Sat Apr 23, 2022 2:29 pm
clebin wrote: Sat Apr 23, 2022 2:18 pm I'm saving 40-60% depending on the screen with no noticeable extra delay in switching screens, so that'll give me enough space to be getting along with for now.
Has this restored stability?
Yes it's running stable now thanks. I'm not relocating the DATA section anywhere at the moment as I haven't figured out z88dk-appmake yet, but speed is fine so far with the code in contended memory.
User avatar
clebin
Manic Miner
Posts: 979
Joined: Thu Jun 25, 2020 1:06 pm
Location: Vale of Glamorgan
Contact:

Re: Making screen layouts in code

Post by clebin »

Another little screenshot:

Image

It might be obvious now which game I'm remaking... although it's not exactly a well-loved title!

I was on the verge of releasing it, but decided to bit the bullet and revise those screen layouts again. By saving each building, tree, phone-box, etc as an individual tilemap and combining them to build the screen I should be able to save 2-3k total. That's huge in the context of this game as I'd had to strip everything right back to fit into RAM, including the wasp pictured in this shot.
Post Reply