where is org from 68k asm code?

Anything QL Software or Programming Related.
Post Reply
User avatar
nitrofurano
Chuggy Microdrive
Posts: 53
Joined: Sat Nov 16, 2013 10:48 am

where is org from 68k asm code?

Post by nitrofurano »

i have another noob questiion: is there some asm code around having org (defining where the code will be placed), or are all addresses relative? i'm asking this because i found no 68k asm code yet with org - or am i keeping bad habits from z80? xD

another question: where should we find good ql asm examples for trying out on vasm?


User avatar
NormanDunbar
Forum Moderator
Posts: 2271
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: where is org from 68k asm code?

Post by NormanDunbar »

QL code should always be position independent. Some old games expected things to be in certain places, and were written that way. Memory expansions or floppy interfaces bolloxed those programs.

C/Pascal compiled code usually has a startup routine at the front which has a table of all the explicit addresses in the code that follows, and retargets those to be relative to the start of the job in RAM, which need not be the same place in any two or more consecutive executions.

Assembly in the QL comes in three main types:

Jobs: these are EXEC/EXEC_W'd or EX/EW'd or similar depedning on the toolkit you are using. They must be position independent as they will most likely load to a different address each time.

Basic Extensions: Again, should be position independent as they get memory allocated (ALCHP or RESPR), loaded (LBYTES) and called (CALL) to install the extensions. Then the new functions and procedures can be called as S*BASIC commands/functions/procedures.

Callable Code: Again, should be position independent as they get memory allocated (ALCHP or RESPR), loaded (LBYTES) and called (CALL) to execute whatever the code is supposed to do.

VASM/VLINK for the QL are used in the Free Pascal Compiler suite for cross compiling for the QL. I help maintain it. (Some of the QL stuff, not VASM/VLINK) and I'm pretty certain that the code produced by those might have a relocation table at the start, as the FPC compiler output certainly does. Just out of interest, if you were assembling and linking the file ql.asm, which commands for vasm/vlink would you be using?


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.
User avatar
nitrofurano
Chuggy Microdrive
Posts: 53
Joined: Sat Nov 16, 2013 10:48 am

Re: where is org from 68k asm code?

Post by nitrofurano »

interesting, thanks!

i still didn't heart a thing of ql.asm (i'm getting curious now, taking a look what is there..., where from do we find it?) - for now i'm only about to try asm code generated from SecondBasic (cleaning it before compiling), or some very small code for learning 68k asm, without any included library code for now


User avatar
NormanDunbar
Forum Moderator
Posts: 2271
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: where is org from 68k asm code?

Post by NormanDunbar »

Sorry, my bad. I meant to type:

if you were assembling a file named ql.asm, what vasm/vlink commands/options would you use?

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.
spkr
Bent Pin Expansion Port
Posts: 98
Joined: Tue May 04, 2021 6:52 pm

Re: where is org from 68k asm code?

Post by spkr »

nitrofurano wrote:i have another noob questiion: is there some asm code around having org (defining where the code will be placed), or are all addresses relative? i'm asking this because i found no 68k asm code yet with org - or am i keeping bad habits from z80? xD

another question: where should we find good ql asm examples for trying out on vasm?
Hi there. I use org and absolute code myself together with a relocatie to load program and run it. I'm sure there are limitations to the use case, but I think it depends on your aim of your code. I target stock machine specifically it and don't intend to be system friendly; so there you have it.

I use vasm to do my QL code, and I'm happy to share some of it with you. You can use it any kind you wish.


Post Reply