Run a SuperBasic program from Assembler?
Re: Run a SuperBasic program from Assembler?
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
I don't have (S)GC so SMSQ/E isn't an option for me
Many thanks
Re: Run a SuperBasic program from Assembler?
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++.
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_
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
Per
dont be happy. worry
- ?
dont be happy. worry
- ?
Re: Run a SuperBasic program from Assembler?
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
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
-
- Font of All Knowledge
- Posts: 3997
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: Run a SuperBasic program from Assembler?
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...
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...
Regards,
Derek
Derek
Re: Run a SuperBasic program from Assembler?
Hi Derek,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.
<>
I agree. Its very well annotated too. Reads like a novel
Per
dont be happy. worry
- ?
dont be happy. worry
- ?
Re: Run a SuperBasic program from Assembler?
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 thempjw wrote: ↑Sun Mar 31, 2024 3:41 pmHi Derek,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.
<>
I agree. Its very well annotated too. Reads like a novel
Many thanks
- NormanDunbar
- Forum Moderator
- Posts: 2281
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: Run a SuperBasic program from Assembler?
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.
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.
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.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Re: Run a SuperBasic program from Assembler?
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
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?
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.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
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: Run a SuperBasic program from Assembler?
Many thanks Tofro, will give it a gotofro wrote: ↑Sun Mar 31, 2024 8:19 pmHave 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.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