To start getting familiar with the assembler and the nuances of QDOS I thought I'd try modifying (for GST/qmac) the Andrew Pennell program to print d1.l as hex. It appears here (cut and paste has slightly affected the formatting):
Code: Select all
TITLE First QL gst/qmac program
SECTION CODE
MT.FRJOB equ $05
Base bra.s Start
ds.b 6-(*-Base)
dc.w $4afb
dc.w $06 Length of program name
dc.b 'ASSTST' Program name
Start
move.l #$12aa34cc,d1 Test number to print
bsr.s PrtHex
moveq #-1,d1
clr.l d3
moveq #MT.FRJOB,d0 End program
trap #1
* Subroutines
* Print d1.l as hex
PrtHex moveq #7,d0
Phlp rol.l #4,d1
move.l d1,-(a7)
and.l #$0f,d1
cmp.b #$09,d1
ble.s Phdig
addq.b #$07,d1
Phdig add.b #'0',d1
bsr.s CPrint
move.l (a7)+,d1
dbf d0,Phlp
rts
* Char to print in d1.b
CPrint movem.l d0-d1/d3/a0-a1,-(a7)
movea.l #$00010001,a0 Channel #1 remains open
moveq #-1,d3
moveq #5,d0
trap #3
movem.l (a7)+,d0-d1/d3/a0-a1
rts
END
First, the above program (compiled under Qemulator), runs fine on my real hardware but freezes when I attempt to run it using Qemulator. If I comment out the trap #3 of the IO.SBYTES routine the program will at least run to completion.
Secondly, I tried running the program under Qmon. Again that works on real hardware but freezes without even producing a register display under Qemulator.
Though it would be nice to have, I can see why Qmon might not work under emulation (competition over exceptions etc) but I'm puzzled why Qemulator won't run the simple hex print program. Perhaps I haven't read the right manual yet and I'm missing some QDOSy thing or have otherwise blundered in a spectacular way (e.g. do I, for example, need to allocate some heap space for a7)?
Alan