I recently picked up a QL last year and restored it to working state - I was a Spectrum user in my youth, and the QL always seemed rather exotic, so it was nice to be able to finally add one to my collection.
Anyway, at the moment I have an itch to scratch in the form of writing a multi-platform D&D RPG game (well, an engine actually, that runs different games based on the data set it is supplied with). It's a bit of a hybrid of something like the original Bards Tale (text based location descriptions for example - though full screen images may come at some point), crossed with a more modern turn based combat system - the main interface looks like this:
I have most of the basic functionality in place - parsing location data, displaying dialogue with npc's, conditional encounters/item/navigation options/enemy spawning (the portal to the north only opens if you posess the crown of righteousness, big boss #2 spawns if you killed all the minions in map location #55... that kind of thing).
For the QL I'm using the latest xtc86 cross compiler version of C68 (https://github.com/stronnag/xtc68) which integrates nicely into the rest of the build toolset that will support the other platforms (Atari, MSX, etc) that I'm targetting. As I'm still in the middle of building a working floppy solution for the physical QL, all testing is done with sQLux on Linux.
However, the game is a bit flat looking; I haven't yet got any animation, loading icons, etc... as I'm finding it difficult to find a method to synchronise / wait on display refresh - the C68 standard library only appears to have a second-granularity sleep() and nothing else that would help.
I see that there is some documentation on https://www.chibiakumas.com/68000/sinclairql.php for reading the state of the vsync interrupt, but I am hampered by the fact that C68 (at least in the xtc68 incarnation) doesn't appear to support inline assembly.
I am trying this at present:
Code: Select all
void vsync_wait(unsigned char wait){
// Wait a specified number vblank interrupts
unsigned int v;
unsigned char c = 0;
_super();
while (c < wait){
_WAITVBLANK();
c++;
}
_user();
}
Code: Select all
.text
.even
.extern _WAITVBLANK
_WAITVBLANK:
move.b #255,$18021 ;Clear interrupt bits
_WAITVBLANKAGAIN:
move.b $18021,d0 ;Read in interrupt state
tst.b d0 ;Wait for an interrupt
beq _WAITVBLANKAGAIN
rts
There are some oddities in the C68/Sozobon/JAS assembler; for one it does not like the #% immediate source value format as set as an operand for the move.b instruction in the original example - the % binary value indicator must be removed (and a hex or decimal value substituted) for it to assemble without error.
So a long shot, but has anyone else used C68 to do any graphics/games and had success using the vblank/vsync interrupt to synchronise things?