Page 3 of 4

Re: Run a SuperBasic program from Assembler?

Posted: Sat Mar 30, 2024 6:43 pm
by t0nyt
Hi Per, the extra byte was an attempt to try and work out why my code was failing (the actual reason being me!) and I forgot to remove it when posting the code. The code I've been using had that removed and still worked.

I don't have (S)GC so SMSQ/E isn't an option for me

Many thanks

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 12:02 am
by pjw
Anyone with a PC can have SMSQ/E for free if they want.

If one started out with Qdos nomenclature and at some later date wanted to develop programs for SMSQ/E one would have to relearn the entire nomenclature. Not so the other way round; SMSQ/E nomenclature works perfectly for Qdos too. And the most comprehensive, up to date, debugged documentation is written using the SMSQ/E nomenclature. Therefore it makes sense to learn to use that from the start.

Here is your program re-written with SMSQ/E nomenclature. I have taken the liberty of correcting my previous mistakes and unravelling the loop so it now only contains three instructions (plus whatever goes on in the ioq.pbyt routine) instead of 16++.

Code: Select all

;        Type a command into current keyboard queue

         section code

         filetype 0

         include  dev8_keys_sys
         include  dev8_keys_qdos_sms
         include  dev8_keys_qlv
         include  dev8_mac_proc2

         lea.l   define,a1
         move.w  sb.inipr,a2
         jmp     (a2)
*
define
         proc_stt
         proc_def MENU
         proc_end
         proc_stt
         proc_end
*
MENU     moveq    #sms.info,d0          get sys vars pointer into a0
         trap     #do.smsq
         move.l   sys_ckyq(a0),a2       a2 -> current keyboard queue
         move.w   ioq.pbyt,a4           a4 -> queue byte utility

         lea.l    runcmd,a5             a5 -> text/cmd
         move.w   (a5)+,d4              d4 = length word of text
         bra.s    lend                  - 1 for dbra
*
nextchar move.b   (a5)+,d1              get next character
         jsr      (a4)                  send it to queue
lend     dbra     d4,nextchar

done     moveq    #0,d0                 no errors
         rts                            back to BASIC
*
runcmd   dc.w     rcend-runcmd          set string length
         dc.b    'print "Hello world!"',$0A
rcend
         ds.w     0                     align

         end
The includes can be had by downloading the SMSQ/E sources (which also happens to contain lots of brilliant coding examples!) By convention they are accessed via dev8_

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 7:54 am
by t0nyt
Sorry Per, but SMSQ/E (like Minerva) isn’t something that’s of interest to me however good they are (I only use TK2 for folders and overwrite y/n otherwise I wouldn’t use that either)

And I’m not really interested in doing things on a PC that I can’t do on my actual QL (as with all my retro systems)

Many thanks

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 8:57 am
by Derek_Stewart
Hi

With regards to QL Assembler reference material, in addition to Norman's excellent Assembly Language Magazine, I use for:

QDOS: QL Technical Guide, Minerva ROM source code. SMSQ/E: SMSQ/E Reference Guide, SMSQ/E source code.

The operating system source code for Minerva and SMSQ/E give very good reference material on how assembly language on the QL should be written.

And it is all free...

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 3:41 pm
by pjw
Derek_Stewart wrote: Sun Mar 31, 2024 8:57 am <>
The operating system source code for Minerva and SMSQ/E give very good reference material on how assembly language on the QL should be written.
<>
Hi Derek,
I agree. Its very well annotated too. Reads like a novel ;)

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 5:21 pm
by t0nyt
pjw wrote: Sun Mar 31, 2024 3:41 pm
Derek_Stewart wrote: Sun Mar 31, 2024 8:57 am <>
The operating system source code for Minerva and SMSQ/E give very good reference material on how assembly language on the QL should be written.
<>
Hi Derek,
I agree. Its very well annotated too. Reads like a novel ;)
Thank you all for the heads up, I’ll download the code to have a look thru. Hopefully I can pick up some good QL programming practices from them

Many thanks

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 5:47 pm
by NormanDunbar
Hi T0nyt,

you asked about using config as a QL best practice. You don't have to!

My suggestion was simply a feeble attempt at humour. Sorry. However, as relates to your "menu" system, you will always be LRUNning the same S*BASIC program, so no need for a config block.

However, if this was a "commercial" or freely distributable utility, then other people might not have the same file as you; or may not have an assembler to make changes to suit their system. In that case, a config block would be a good idea. It would alow them to adapt the program to be LRUN to suit their own environment without the need to ever reassemble the utility. Maybe, they are using floppies or microdrives, so "win1" isn't any use, but with config, they could change that to their own device names.

As I said, it was a feeble attempt at humour.


Cheers,
Norm.

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 6:16 pm
by t0nyt
Hi Norm,

I did take it as a light hearted comment

But genuinely interested in what a config might look like in the “ QL world” though

Maybe, for something like this, pass the string to the code as a parameter at initialisation time in the boot file maybe? (If that’s possible)

Many thanks
Tony

Re: Run a SuperBasic program from Assembler?

Posted: Sun Mar 31, 2024 8:19 pm
by tofro
t0nyt wrote: Sun Mar 31, 2024 6:16 pm Hi Norm,

I did take it as a light hearted comment

But genuinely interested in what a config might look like in the “ QL world” though

Maybe, for something like this, pass the string to the code as a parameter at initialisation time in the boot file maybe? (If that’s possible)

Many thanks
Tony
Have a look into this assembly file for an example on how to create a config block (roughly starting at "configBlk"). It uses the Tony Tebby Macro file "config_mac" (same repository). Doing it that way allows you to configure binary files using "menuconfig" or "config", which is the "standard way" of configuring something in the QDOS/SMSQ/E world.

Re: Run a SuperBasic program from Assembler?

Posted: Mon Apr 01, 2024 8:08 am
by t0nyt
tofro wrote: Sun Mar 31, 2024 8:19 pm
t0nyt wrote: Sun Mar 31, 2024 6:16 pm Hi Norm,

I did take it as a light hearted comment

But genuinely interested in what a config might look like in the “ QL world” though

Maybe, for something like this, pass the string to the code as a parameter at initialisation time in the boot file maybe? (If that’s possible)

Many thanks
Tony
Have a look into this assembly file for an example on how to create a config block (roughly starting at "configBlk"). It uses the Tony Tebby Macro file "config_mac" (same repository). Doing it that way allows you to configure binary files using "menuconfig" or "config", which is the "standard way" of configuring something in the QDOS/SMSQ/E world.
Many thanks Tofro, will give it a go