Page 6 of 7

Re: Joystick/Sound in Supervisor mode?

Posted: Fri Feb 23, 2024 12:47 pm
by NormanDunbar
t0nyt wrote:Thanks Tofro, but I still don't understand some of it - sorry
The following might help you out with regard to the QDOS/SMSQ internals of jobs etc.

My somewhat irregular QL Assembly Language eMagazine: https://github.com/NormanDunbar/QLAssem ... e/releases there are 11 issues available for download.

My QL Assembly Language eBook. Originally serialised over numerous years in QL Today magazine. https://github.com/NormanDunbar/QLAssem ... tober-2020. It's been updated since the demise of said magazine and rejigged as an eBook.

Somewhere in amongst all that lot there should be details on how a QDOS/SMSQ job is set up and the registers involved and what they are used for,


HTH

And apologies if "granny already knows how to suck eggs"! ;)

Cheers,
Norm.

Re: Joystick/Sound in Supervisor mode?

Posted: Fri Feb 23, 2024 1:04 pm
by t0nyt
NormanDunbar wrote: Fri Feb 23, 2024 12:47 pm
t0nyt wrote:Thanks Tofro, but I still don't understand some of it - sorry
The following might help you out with regard to the QDOS/SMSQ internals of jobs etc.

My somewhat irregular QL Assembly Language eMagazine: https://github.com/NormanDunbar/QLAssem ... e/releases there are 11 issues available for download.

My QL Assembly Language eBook. Originally serialised over numerous years in QL Today magazine. https://github.com/NormanDunbar/QLAssem ... tober-2020. It's been updated since the demise of said magazine and rejigged as an eBook.

Somewhere in amongst all that lot there should be details on how a QDOS/SMSQ job is set up and the registers involved and what they are used for,


HTH

And apologies if "granny already knows how to suck eggs"! ;)

Cheers,
Norm.
Thanks Norm. I already have your eBook but will take a look at the Magazines too

Many thanks

Re: Joystick/Sound in Supervisor mode?

Posted: Fri Feb 23, 2024 1:55 pm
by t0nyt
I've changed the linker line to include "-filetype 1" so it creates an exec binary

This _seems_ to have solved the problem in that I no longer get a crash

Have now got to see if the counter is incrementing...

Re: Joystick/Sound in Supervisor mode?

Posted: Fri Feb 23, 2024 4:17 pm
by t0nyt
As a quick and dirty test I put code in the timerTick routine to change the screen mode

As hoped the screen mode continually get's reset, which to my mind means the routine is being called as it should

My problem now is that I replaced that code with a line to add 1 to a counter location (which I initialised previously to 0) but whatever I try I can't use that counter in the main program loop to block for a time. It's like it's not incrementing.

The journey continues I guess

Could anyone confirm how many times a second the timerTick routine should be getting called please?

Many thanks

Re: Joystick/Sound in Supervisor mode?

Posted: Fri Feb 23, 2024 4:32 pm
by t0nyt
t0nyt wrote: Fri Feb 23, 2024 4:17 pm As a quick and dirty test I put code in the timerTick routine to change the screen mode

As hoped the screen mode continually get's reset, which to my mind means the routine is being called as it should

My problem now is that I replaced that code with a line to add 1 to a counter location (which I initialised previously to 0) but whatever I try I can't use that counter in the main program loop to block for a time. It's like it's not incrementing.

The journey continues I guess

Could anyone confirm how many times a second the timerTick routine should be getting called please?

Many thanks
Have managed to sort it now, thanks (and looks like it triggers about 50 times a second, 50hz?)

Many thanks for all the advise and patience everyone

Re: Joystick/Sound in Supervisor mode?

Posted: Fri Feb 23, 2024 6:18 pm
by t0nyt
Works great on “real iron” as well

There’s a slight flicker though so I guess I’ll also need to use vsync to smooth out the animation before I start working it into a game of some sort

Re: Joystick/Sound in Supervisor mode?

Posted: Sat Mar 02, 2024 6:07 pm
by t0nyt
tofro wrote: Thu Feb 22, 2024 5:26 pm Don't use OFFSET.

Here's what I do:
  • All of my program code goes into a SECTION code
  • All of my data goes into a SECTION DATA
If you start a new section, the assembler re-sets all the addresses it generates to 0.
By setting a6 to the data space base adress at the beginning of the program and indexing by the labels in the data section, the assembler will manage the proper addresses:

Code: Select all

    SECTION data
a: DS.L    1
b: DS.L    1
c: DS.W   1
buffer:   ds.b 100
After this, the assembler will assign 0 to the a offset, 4 to b, 8 to c and 12 to buffer. In your code, do

Code: Select all

    SECTION code
    lea.l 0(a6,a4),a6     ; let a6 point to the bottom of the data space
    move.l #100,a(a6)    ; moves 100 to a6+a
    move.l #200,b(a6)   ;  same for b
    move.w #100-1,d0
loop:
    clr.b buffer(a6,d0.w)    ; clear the buffer
    dbra d0,loop
    
Thus, you don't really care where your variables are - they are always relative to a6, and where a6 points to was allocated by QDOS. You simply use the names.

If you write your code in multiple source files, the code that defines what's going on in your data space typically goes into an include file, that is INCLUDEd in all your code files.
Hi Tofro,

I'm really struggling with getting this to work

I copied your code into a new asm file and no matter what options I choose it fails to compile with "relocatable value not allowed here" related to anything referencing A6 like "a(a6)" and "b(a6)" etc.

Any thoughts on why this is happening please? Am sure I'm doing something wrong, but don't understand what

Many thanks
Tony

Re: Joystick/Sound in Supervisor mode?

Posted: Sat Mar 02, 2024 7:28 pm
by tofro
That might have been my fault, sorry. Try adding an "OFFSET 0" after "SECTION data"

Re: Joystick/Sound in Supervisor mode?

Posted: Sun Mar 03, 2024 10:30 am
by t0nyt
Having got the timer code back in to the main code and assembling without errors I'm back to getting an exception

Happens when TRAP #1 is called

Is there an alternative to this 50hz stuff I could use that would be consistent across emulators & real iron please?

Could I use the RTC ticks maybe?

Many thanks

Screenshot 2024-03-03 at 10.11.38.png

Re: Joystick/Sound in Supervisor mode?

Posted: Sun Mar 03, 2024 10:45 am
by tofro
The QL's RTC is only progressing in 1s intervals. You could use it, but it would make your program crawl :) The polling interrupt is really the only way you get a suitably fast tick rate.

If you pack your sources and put them here I could have a look at it.