Assembler Programming Problem

Anything QL Software or Programming Related.
User avatar
t0nyt
QL Wafer Drive
Posts: 1217
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Assembler Programming Problem

Post by t0nyt »

Will take a look, thanks Norm

What I was doing was calling GTSTR, check for $0101 on the name table

If there was a match then I would use the string

If it wasn’t a match I’d then call GTINT but that didn’t return the 1 or 2 integers, but debugging showed the ascii version of the 1st integer value on the stack

In isolation both of my GTSTR and GTINT routines work fine, but not one after the other


User avatar
t0nyt
QL Wafer Drive
Posts: 1217
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Assembler Programming Problem

Post by t0nyt »

When I debug, the parameter(s) don't appear on the name table A6,A3.l until after GTSTR or GTINT are called

So that rules out checking the parameter type BEFORE making a GTSTR/GTINT call

And once I make a GTSTR call, and there's not a string parameter, the call to GTINT doesn't work to get the numeric parameter(s), but it does work if GTSTR isn't called first


User avatar
t0nyt
QL Wafer Drive
Posts: 1217
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Assembler Programming Problem

Post by t0nyt »

After doing just GTSTRG, but with 2 numeric parameters (in this case 16,1), the name table shows first entry as a numeric on the RI stack and the 2nd parameter as type $0203 so not on RI stack

When I look at the RI stack the number 16 is actually a string (2 bytes of length & ascii characters for "16")

|'m assuming that's why I can't get the first parameter then with GTINT, because it's already been processed?

EDIT: I also tried calling GTINT first, but that doesn’t work either (breaks reading the text)

Many thanks
Tony


User avatar
t0nyt
QL Wafer Drive
Posts: 1217
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Assembler Programming Problem

Post by t0nyt »

NormanDunbar wrote: Thu Sep 18, 2025 5:41 am
t0nyt wrote: Wed Sep 17, 2025 5:46 pm It seems if you try and read a string parameter before then trying to read numeric value(s) the first number gets read as a string
Really? I'm surprised!

You might find section 7.5.2, table 7.7 and section 7.6 in the 2020 edition of my book useful. You can determine each parameter type from 1(a6,a3.l) - bits 0--3 determine the type of each parameter. You should be able to fetch them one by one if necessary.

I've never written a procedure which can take different parameter types on different calls, so I might be wrong. Worth an experiment maybe?

HTH

Cheers,
Norm.
Hi Norm,

I was looking at page 79, because I'm working out how to use bv_chrix for my buffer, and you put 2 into D1 when calling it, but shouldn't this be D0 please?

EDIT: I'm confused. searches on here say D1, but the QL Technical Guide's I have say D0

Many thanks
Tony


User avatar
NormanDunbar
Forum Moderator
Posts: 2520
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: Assembler Programming Problem

Post by NormanDunbar »

Hi Tony,

From Wolfgangs current docs for SMSQ and QDOS:
Space may be allocated on the stack by calling the vectored routine QA.RESRI: the number of bytes required is given in D1.L; D0 to D3 are smashed by the call. Since both the stack within the S*Basic area and the S*Basic area itself may move during a call, the stack pointer should be saved in BV_RIP(A6) before the call, and restored from BV_RIP(A6) after the call has been completed. The routine ensures that the restored value will be correct.
QA.RESRI is the same as BV_CHRIX. So D1.L is where the space you require is put prior to calling the vector to do the allocation.

HTH.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply