ecdhe wrote: Sat Jun 21, 2025 4:47 pm
Hello,
Are there some examples of assembly programming for the QL? In particular when the program is written and assembled on a host machine and running in an emulator. I am knowledgeable enough in 6800x programming, it's everything else I'm missing, e.g.
- A skeleton "Hello world" program for the QL (any things to setup in particular? Where is the program loaded in memory)
A QL program needs to be prepared to be loaded
anywhere in memory - That means it needs to be written using PC-relative addressing only (or must contain a self-relocating loader).
Norman's QL assembly books linked above by Andrew should contain a number of simple programs to start from.
ecdhe wrote: Sat Jun 21, 2025 4:47 pm
[*]Once the program is assembled on the host machine, how to copy the binary on a microdrive file
That's a tricky one. Transferring to a BBQL is best done using floppies or SD card solutions. There are a number available. Without additional hardware, there's still the serial port or the QL network and a QLUB adapter (search the forum for that)
ecdhe wrote: Sat Jun 21, 2025 4:47 pm
[*]How to execute the file in an emulator
I would recommend to build assembly programs natively (i.e. not cross-assemble) - That makes things a lot easier. Use an emulator like QPC2, you can still use a Windows IDE to edit, QPC2 can access Windows or Linux native file systems. Then you can simply run the program there.
ecdhe wrote: Sat Jun 21, 2025 4:47 pm
[*]How to wait for the vertical blank
Diving right in, don't you?
The simplest way to do that would be to
Code: Select all
trap #0 ; go into supervisor mode
stop #$0700 ; wait for an interrupt, then back to user mode
On an unexpanded QL, the 50Hz (or VBL) interrupt is the only one that can occur. (obviously only works on an unexpanded QL with no additional interrupt sources and needs to be packed into a tight loop)
[/list]