Assembler, header corrupt?

Anything QL Software or Programming Related.
Post Reply
User avatar
grafvonb
Bent Pin Expansion Port
Posts: 80
Joined: Sat Jan 05, 2019 7:54 am
Location: Frankfurt/Germany

Assembler, header corrupt?

Post by grafvonb »

I just succeeded compiling and linking some assembler examples found with qmac but when try to run them I get "bad parameter" error, which as I read means my header is corrupt.
I have even created an empty "envelop" for my future exercises but the problem remains. Do you think this code creates a wrong header or maybe I'm completely on wrong path?

BASE BRA.S START The first real thing to assemble!
DS.B 6-(*-BASE) Filler ('*' is where we are)
DC.W $4AFB This is necessary
STRING$ '1' This is the name of the program.

Thank you, Adam


Loving QL & ZX Spectrum & Amiga...
Derek_Stewart
Font of All Knowledge
Posts: 3954
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Assembler, header corrupt?

Post by Derek_Stewart »

Hi Adam,

Did you put the -nolink directive in the QMAC command line, which puts all the code into a single relocable section and generates a executable header.

Try reading The QL Assembly Language Programming Series by Norman Dunbar, gives good grounding 68000 assembly language on the QL.
Last edited by Derek_Stewart on Tue Mar 12, 2024 4:21 pm, edited 1 time in total.


Regards,

Derek
User avatar
grafvonb
Bent Pin Expansion Port
Posts: 80
Joined: Sat Jan 05, 2019 7:54 am
Location: Frankfurt/Germany

Re: Assembler, header corrupt?

Post by grafvonb »

Hi Derek, I use Andrew Pennell's book as a start point. I did some demos for Amiga so I think I have quite good understanding what's going on. I have just these "trivial" lamer problems at the beginning ;) in case of QL.
Do you have a running example of a simple program (MOVE.W #$FF,($20000) ;) which I can build and link using qmac and finally run it? I own three original QLs but for the start I use QemuLator on Windows and Mac. Is this maybe a problem? And yes I used -nolink option as well as full blown qmac with qlink. Both end with "bad parameter" after ex/ew.


Loving QL & ZX Spectrum & Amiga...
Derek_Stewart
Font of All Knowledge
Posts: 3954
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Assembler, header corrupt?

Post by Derek_Stewart »

Hi Adam,

Here is a simple Caps Lock Indicator for Minerva, I wrote long time ago, using QMAC.

Code: Select all

* Minvera compatiable capslock
* using facility to change shape of the cursor
*
* 14.5.91 v1.0 BASIC program used in multi-tasking basic
* 15.5.91 v1.1 Liberated basic program
* 17.5.91 v1.2 Assembler file
*
JOB      EQU     -1                         job priority
MT.INF   EQU     $00                        System information
MT.FREE  EQU     $06                        Free Sapce
MT.PRIOR EQU     $0B                        Set prority
SV.CAPS  EQU     $88                        System variable caps offset
SV.CHTOP EQU     $7C                        Minvera enhances System variables
SX.FSTAT EQU     $33                        Minvera cursor offset
UPPER    EQU     $53                        Upper case
LOWER    EQU     $4C                        Lower case

         SECTION  CODE

         BRA.S    CAPS                      Jump to routine
         DS.B     4                         skip the next four bytes
         DC.W     $4AFB                     Job flag
         DC.W     9                         length of job name
         DC.B     'Caps v1.2'                Name of job

CAPS     MOVEQ    #MT.PRIOR,D0               Set priority of routine
         MOVEQ    #JOB,D1                    to run all the time
         MOVEQ    #8,D2                      And use Job priority of 8
         TRAP     #1
         MOVEQ    #MT.INF,D0                 Find the QDOS System variables
         TRAP     #1
         MOVE.L   SV.CHTOP(A0),A1            Start of Minvera S.V.
         CLR.L    D1                         clear register for test
LOOP     MOVE.W   SV.CAPS(A0),D1             Get condition of Caps Lock
         TST.W    D1                         Find the value is zero
         BNE.S    CAPSON                     If nonzero Caps lock ON
         MOVE.B   #LOWER,SX.FSTAT(A1)        must be 0 then caps off
         BRA.S    LOOP                       keep on looping
CAPSON   MOVE.B   #UPPER,SX.FSTAT(A1)        Set cursor, caps on
         BRA.S    LOOP                       Keep looping infinitely

         END
The Forum Software is messinup the Tab spacing.

The programme is not that good, but it does create an excecutable programme.

Can you upload the programme you having trouble with.


Regards,

Derek
User avatar
grafvonb
Bent Pin Expansion Port
Posts: 80
Joined: Sat Jan 05, 2019 7:54 am
Location: Frankfurt/Germany

Re: Assembler, header corrupt?

Post by grafvonb »

Hi Derek,

Many thanks for your support. I got the same problem with your code however I did something else. I created an example_link file like this (based on an example from qmac):

Code: Select all

filetype 1
data 4k
input example
With qmac I created a normal example_rel file (setting data DATA default device before) and than with qlink and "-with example -nolist" it created the final example_bin which works!

But I still have no idea why running qmac with -nolink or with just qlink afterwards (where I just use the name of the artifact) the final _bin has a wrong header...

Regards, Adam


Loving QL & ZX Spectrum & Amiga...
Derek_Stewart
Font of All Knowledge
Posts: 3954
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Assembler, header corrupt?

Post by Derek_Stewart »

Hi Adam,

I have just realised that QMAC v1.06 Quanta release, the Output File Type can be changed in the CONFIG Block within QMAC 1.06.

You need to use Menuconfig to open QMAC, which will load the default CONFIG blocks, change the Output File Type to 1

This will give an executable file type when the assembly programme has been compiled.

Though, I am sure inserting -NOLINK in the command line did the same thing.


Regards,

Derek
Post Reply