SMSQ/e Help needed

Discussion and advice about emulating the QL on other machines.
RWAP
RWAP Master
Posts: 2834
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: SMSQ/e Help needed

Post by RWAP »

You need to be very careful with using the ADATE commands in emulators - I didn't realise that QPC2 (and possibly others) allow this to affect the PC clock directly!


User avatar
Mr_Navigator
QL Fanatic
Posts: 782
Joined: Mon Dec 13, 2010 11:17 pm
Location: UK, Essex
Contact:

Re: SMSQ/e Help needed

Post by Mr_Navigator »

Well its not my program, i am trying to get it to run, thanks for the advice, I will probably replace with alternative code in that case.


-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: SMSQ/e Help needed

Post by EmmBee »

It might be an idea to only do the calculations after a time update.
This could be done, for example, by

start : REPeat test : IF PEEK_W(163886) <> old_time THEN calculations

I have tried this using Q-emuLator with Minerva and it works – there are no arithmetic overflows.
It just keeps running and updates the values on the screen.

Michael
EmmBee


EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: SMSQ/e Help needed

Post by EmmBee »

The reported crash only occurs when running at full speed. When the time read is the same as the previous time, “update” will become zero and this will result in a divide by zero error at line 2670.
My suggested fix for this bug is to wait until the time read is actually different from the previous time before continuing. So, line 2580 would be changed to ...

2580 REPeat wait : new_time = PEEK_W(163886) : IF new_time <> old_time : EXIT wait

The way the time is read is interesting. The function GET_SYSVARS returns 163840, and 163886 is just 46 bytes away. In HEX, decimal 46 is $2E, and !!$2E is system variable SV_RAND. It turns out that under QDOS, SV_RAND can be used as a 50/60Hz timer. I have actually used this myself in one of my programs, after making the discovery some years ago. It is good to learn that other people are also using this. The feature will not work under SMSQ/e, and ‘Real time fractional’ has a restriction of ‘(SMS only)’, meaning that it needs the operating system SMS2 or SMSQ to be installed;
SMSQ/e is not included.

You ask if there is documentation of the system variables under SMSQ/e. There is the QDOS SMS Reference Manual.pdf which is available for download from Marcel Kilgus’ Web site
http://www.kilgus.net/smsqe/development.html The restriction mentioned earlier is detailed on
page 6. These PDFs are rather good. You can navigate them by using the cursor keys, and to find something quickly you can press Ctrl f, and then type into the search box what you want to find. For example, you may want to find “fractional”. In chapter 10.11, which is on page 59, there is a timer mentioned, however, I believe this is only for the Atari.

If you want to use the DIY timer, then in your BOOT program you would include the line
“LRESPR win1_VolH_TIMING_code”. In the start procedure, line 2320 would become ...

2320 T_ON : T_START : old_time=0

The above line would start the default timer, and at the end of your program you should include the statements T_STOP and T_OFF. The function T_COUNT is used to read the time, it starts off at zero, and counts up 1-2-3-4 etc. It counts up at the same rate as SV_RAND. All instances of “PEEK_W(163886)” should be replaced with “T_COUNT”. Line 2580 would become ...

2580 REPeat wait : new_time = T_COUNT : IF new_time <> old_time : EXIT wait

The program should then run exactly as the original does. It should work both with QDOS and SMSQ/e and also at any speed. Your program actually works as it is without any modifications - and without any errors. To see this, use Q-emuLator with Minerva and set it to run at Original QL speed.

Michael Bulford
EmmBee


User avatar
Mr_Navigator
QL Fanatic
Posts: 782
Joined: Mon Dec 13, 2010 11:17 pm
Location: UK, Essex
Contact:

Re: SMSQ/e Help needed

Post by Mr_Navigator »

If you want to use the DIY timer, then in your BOOT program you would include the line
“LRESPR win1_VolH_TIMING_code”. In the start procedure, line 2320 would become ...

2320 T_ON : T_START : old_time=0
Thanks EmmBee (and others), I wanted to avoid the loading of the TIMER ext from DIY but may have to resort to that anyway. Will see if I can get this successfully done then report back when I do.


-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
Post Reply