Search found 392 matches

by Timmy
Thu Feb 22, 2024 9:24 pm
Forum: Misc
Topic: switch jump table?
Replies: 6
Views: 187

Re: switch jump table?

As someone who sometimes use switch for all kind of stuff, I'd prefer not to cast something as flexible as a switch statement into a jump table. Especially if the switch case has sparse numbers. Or if you have only 32 cases but you still need to make a jump table with 256 entries. It might be easier...
by Timmy
Tue Feb 20, 2024 12:14 pm
Forum: Other platforms
Topic: Better Linux Install Experience?
Replies: 50
Views: 55698

Re: Better Linux Install Experience?

error: file not found: genmath.lib Strange, as genmath.lib is provided inside the distribution tar/zip file. That means you must have removed everything and then started to recompile all the files. Which is a great test that I could have been doing too (but I'm too lazy for that). I'm glad you're d...
by Timmy
Fri Feb 16, 2024 11:44 pm
Forum: Sinclair ZX
Topic: +zx81 Noob Question About Libraries
Replies: 16
Views: 2202

Re: Noob Question About Libraries

I will see if I can post a ZX81 demo game here. But that would probably not this year. Need to update to the latest version of z88dk and find a new emulator for Linux, and then see if the code I had actually worked. These are probably the busiest week of the remaining year. :) For those people who ...
by Timmy
Fri Feb 16, 2024 11:39 pm
Forum: Sinclair ZX
Topic: Pre-shifted graphics with SP1
Replies: 5
Views: 234

Re: Pre-shifted graphics with SP1

Just in case, Old Tower isn't my game. My Tower Adventure game is a different one, but I can understand you might get confused. And for your information, Cherry is a regular sp1 game, and Tower Adventure is a tile based game, and doesn't use sprites at all. There is still lots of free memory left in...
by Timmy
Tue Feb 13, 2024 10:01 am
Forum: Sinclair ZX
Topic: How to allocate a variable in a specific memory location
Replies: 12
Views: 287

Re: How to allocate a variable in a specific memory location

Thank you everyone, I didn't realise it would be this complex. I'd have thought this feature was essential to anyone making a ZX spectrum game, simply because you want your level data (etc) in the contended (slow) RAM and your code in the FAST RAM or your game will have wonky performance issues. Ye...
by Timmy
Sun Feb 11, 2024 3:12 pm
Forum: Sinclair ZX
Topic: Pre-shifted graphics with SP1
Replies: 5
Views: 234

Re: Pre-shifted graphics with SP1

I'm glad you've figured out on your own using those links. My English is not very good, and I can't write/explain as well as AA did. It also takes me lot of time to write posts, so I try for this once to just type and forget. This one will probably take me 1 hour+ to finish. You have a lot of questi...
by Timmy
Fri Feb 09, 2024 9:58 pm
Forum: Sinclair ZX
Topic: How to allocate a variable in a specific memory location
Replies: 12
Views: 287

Re: How to allocate a variable in a specific memory location

By default the contended memory isn't available to you unless you specify it at compile time. Try #pragma output CRT_ORG_CODE = 24500 Note that this line didn't work for me inside a C file, I had to put it in a separate file and link to it with -pragma-include:blahblah I didn't have much luck below...
by Timmy
Fri Feb 09, 2024 3:19 am
Forum: Sinclair ZX
Topic: Pre-shifted graphics with SP1
Replies: 5
Views: 234

Re: Pre-shifted graphics with SP1

Well, it's way past midnight now, but I had to do some research on this. I still feel like I should go to bed now, but I will post some links from WoS about pre-shifted sprites here: (Important Note: Everyone in these old threads have left WoS since then, so if you have any questions, please ask her...
by Timmy
Thu Feb 08, 2024 7:21 pm
Forum: Sinclair ZX
Topic: How to allocate a variable in a specific memory location
Replies: 12
Views: 287

Re: How to allocate a variable in a specific memory location

I don't 100% understand what you are saying, it seems like you're suggesting you can't put anything in the contended RAM until after your game is running, is that right? Correct, if you use zcc with default parameters. So I should inject it in an emulator then save a .z80 of my game? Sure, but I pe...
by Timmy
Thu Feb 08, 2024 6:08 pm
Forum: Sinclair ZX
Topic: How to allocate a variable in a specific memory location
Replies: 12
Views: 287

Re: How to allocate a variable in a specific memory location

Well, the spectrum compiler/appmake generates a tape file and load all the data at once at your specified start address. You have probably seen the .tap file before. There is only one data block that is loaded. That means that if you want to add data that is located before that start address, this d...
by Timmy
Thu Feb 01, 2024 9:19 pm
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to display sprites on colecovision?
Replies: 2
Views: 305

Re: How to display sprites on colecovision?

I must have posted an msx1 demo before?

(After a long search... Oh it's from 2016)

viewtopic.php?p=14195 (probably too old now)
by Timmy
Wed Jan 31, 2024 12:41 am
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

Finally, the complete source code, including everything. I compiled the code using: zcc +zx81 -lm -create-app demo3.c -o demo3.bin I also added some comments into the main function, but if you need more comments, you could now add them yourself to the code. #include <input.h> #include <zx81.h> int _...
by Timmy
Sun Jan 28, 2024 2:52 am
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

Ok, now that we have kept our scores somewhere, we can finally display it. The new main() would look like this: int main() { char y; int addr, bottom; char game_over; int score; char score_str[16] = { 0x38, 0x28, 0x34, 0x37, 0x2a, 0, 0xe, 0, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0, 0x99 }; // score string b...
by Timmy
Sun Jan 28, 2024 2:48 am
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

Next part now, but just answering this one first: May I suggest defining a constant star with value 0x17? (not sure of z88dk syntax) It's an interesting suggestion, and I heard it a lot. I understand replacing these numbers with names is being taught at most places to beginning coders. But I won't d...
by Timmy
Sat Jan 27, 2024 12:57 pm
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

Still working for the final part for now, and it's about printing a string with scores at the bottom of the screen. So, let's start with the a new main(), this time we are going to add a score variable first. And next part we will convert the score into a string, and put the screen on the screen. in...
by Timmy
Sat Jan 27, 2024 12:46 am
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

I wanted to do the final part for today, about displaying a line of scores on the bottom of the screen. But I'm really tired now, and instead I will discuss this part first, about the two extra helper functions that I'll need for displaying this line. (Which is a bit too important to skip.) We start...
by Timmy
Thu Jan 25, 2024 8:16 am
Forum: Sinclair ZX
Topic: ZX81 Static Variables
Replies: 7
Views: 464

Re: ZX81 Static Variables

Have I not declared an array of pointers, that what I wanted with sp and rp? Well, to be a little more exact, you've declared a variable pointer. Like regular variables like "int i;", they can become different things. With an integer variable, you can do things like "i=5; i=7; i++; i...
by Timmy
Thu Jan 25, 2024 12:28 am
Forum: Sinclair ZX
Topic: ZX81 Static Variables
Replies: 7
Views: 464

Re: ZX81 Static Variables

As the comments already said, you've declared the pointers. These are obviously 16 bits each.

Now you need to declare the arrays, and point the pointer to them.
by Timmy
Wed Jan 24, 2024 4:29 pm
Forum: MSX, SVI, TMS99x8 and Sega Master System
Topic: How to play psg music on the colecovision/adam?
Replies: 12
Views: 652

Re: How to play psg music on the colecovision/adam?

The tracker you mentioned seems to be a PC tracker with no way to export anything and no export file formats, so you probably should ask them to write the 8 bit support instead. It feels very uncertain that they have actually thought of actual playing on older hardware. My suggestion is for you to f...
by Timmy
Tue Jan 23, 2024 11:51 pm
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

Part 5, and today I will discuss how to end the game when the player touches a star. The new main function has new lines again: int main() { char y; int addr; char game_over; init_screen(0); y = 10; game_over = 0; while (!game_over) { scroll_left(); bpoke (zx81_saddr(combine(rand()%21,30)), 0x17); /...
by Timmy
Sun Jan 21, 2024 11:58 pm
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

Part 4, and today we're going to make the player move up and down. The all new main function looks like this (nothing changed in the helper functions, so I omitted those): int main() { char y; int addr; init_screen(0); y = 10; while (in_Inkey()!='0') { scroll_left(); bpoke (zx81_saddr(combine(rand()...
by Timmy
Fri Jan 19, 2024 12:19 am
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

Part 3 already, and today we're modifying the main to get a player in there. The new main function is replaced by this: int main() { char y; int addr; init_screen(0); y = 10; while (in_Inkey()!='0') { scroll_left(); bpoke (zx81_saddr(combine(rand()%21,30)), 0x17); // '*' addr = zx81_saddr(combine(y,...
by Timmy
Thu Jan 18, 2024 2:20 am
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

Re: A ZX81 Game Tutorial in z88dk, with source

I might have to explain a bit of the main() function first. int main() { init_screen(0); while (in_Inkey()!='0') { scroll_left(); bpoke (zx81_saddr(combine(rand()%21,30)), 0x17); // '*' } return 1; } main() is the main function of the game, and currently it does the following: 1) init_screen(0); Thi...
by Timmy
Wed Jan 17, 2024 1:03 pm
Forum: Sinclair ZX
Topic: A ZX81 Game Tutorial in z88dk, with source
Replies: 10
Views: 768

A ZX81 Game Tutorial in z88dk, with source

A ZX81 Game Tutorial in z88dk, with source, Part 1 This is a demo of a very simple game, and is based on the BASIC and the Spectrum versions in https://worldofspectrum.org/forums/discussion/57924/how-to-write-a-simple-basic-horizontal-scrolling-game-tutorial and https://worldofspectrum.org/forums/d...
by Timmy
Sat Jan 13, 2024 12:01 am
Forum: Other platforms
Topic: Better Linux Install Experience?
Replies: 50
Views: 55698

Re: Better Linux Install Experience?

A note to myself (and perhaps other linux users), the current versions requires you to install "libgmp3-dev" as well.

For me, the alternative (Fedora) package is called "gmp-devel". (see also the 2.13 release thread)