Arrakis Software

Anything QL Software or Programming Related.
User avatar
Mr_Navigator
QL Fanatic
Posts: 782
Joined: Mon Dec 13, 2010 11:17 pm
Location: UK, Essex
Contact:

Re: Arrakis Software

Post by Mr_Navigator »

Derek_Stewart wrote:Hi Dave,

It is not dedication, just an interest.

I was trying to get the QL World Microdrive Exchange Software Library availble, but this this seems to be not possible due to the non-availblity of the software.

So, the only other solution would be to start re-reading the magazines and type the featured programmes.
Any luck with the typing in Derek?


-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
Derek_Stewart
Font of All Knowledge
Posts: 3974
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Arrakis Software

Post by Derek_Stewart »

Hi,

I have typed the programme in last year, no real problem. Except for a error in the listing. CV&G acknowledge the error and were going to print a correction, but I have read all issues of CV&G available and can not find the correction.

I will have another look.


Regards,

Derek
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Arrakis Software

Post by tcat »

Line 2100 does not make much sense, I have all of the magazines, so will see if there is an errata. Otherwise, I will have to work out the logic of the statement
Hi,

I believe the line 2100 may read

Code: Select all

PRINT#tab," "(1 TO (mov_num<10));mov_num;".";TO 4;"ABCD"(side+1);"12345678"(((gunpos && 7) ^^ ((gunpos && 16)/16*7))+1);" : ";
The bit " && 7) " is missing before ^^ operation, I should think.

Tom


Derek_Stewart
Font of All Knowledge
Posts: 3974
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Arrakis Software

Post by Derek_Stewart »

Hi,

I will make the changes and see if it works and report back.


Regards,

Derek
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Arrakis Software

Post by tcat »

They also wrote a machine code routine to play music on the QL which was published in the October 1986 issue of Sinclair QL World - http://sinclairql.speccy.org/archivo/do ... 986-10.pdf
Hi,

I have typed the assembly as printed in the mag, unfortunately it does not seem to work for me. It makes use of $A command to IPC processor to play music. It contructs the parameter block

Code: Select all

;       align
messsound   nop
        dc.b    $0a,8           ; Command byte, no. of parameters
        dc.l    $0000aaaa       ; Instructs trap to send information
                                ; to IPC in bytes (see text)
        dc.b    0,0             ; Pitch 1, pitch 2 set to 0
        dc.b    0,0,255,255     ; Grad_x (0,0), Duration (65535)
        dc.b    0,0             ; No Grad_x, wrap, fuzziness or Rnd
        dc.b    1               ; No return parameters
As GST assembler does not have the ALIGN directive, I use NOP right after the label, as GST puts each label reference to be on even address, provided it is followed by an instruction. Is there a better way?

Parameter block address is then passed in A3, with D0 set to 17, and trap #1 instructs IPC to make sound.

Code: Select all

lea     messsound,a3    ; Loads the pointer to messsound
moveq   #17,d0    ; Make sound
trap    #1
Only Pitch1 is set, and IPC called and paused in a loop.
Cannot make the program work so far.

Tom


RWAP
RWAP Master
Posts: 2839
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: Arrakis Software

Post by RWAP »

The nop command has added an extra byte to the IPC command block unfortunately - not sure how to align this automatically in GST compiler....

If GST puts each label reference onto an even keel - why not add a new label above messsound;

Code: Select all

padding          nop


User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Arrakis Software

Post by tofro »

tcat wrote:
Hi,

I have typed the assembly as printed in the mag, unfortunately it does not seem to work for me. It makes use of $A command to IPC processor to play music. It contructs the parameter block

Code: Select all

;       align

As GST assembler does not have the ALIGN directive, I use NOP right after the label, as GST puts each label reference to be on even address, provided it is followed by an instruction. Is there a better way?

The correct translation of the above piece of code into GST lingo would be:

Code: Select all

        ds.w   0
messsound   
        dc.b    $0a,8           ; Command byte, no. of parameters
        dc.l    $0000aaaa       ; Instructs trap to send information
                                ; to IPC in bytes (see text)
        dc.b    0,0             ; Pitch 1, pitch 2 set to 0
        dc.b    0,0,255,255     ; Grad_x (0,0), Duration (65535)
        dc.b    0,0             ; No Grad_x, wrap, fuzziness or Rnd
        dc.b    1               ; No return parameters
(note the "ds.w 0"!)
If you ask the GST assembler to place zero words, it will align first and then place zero words ;)
Long-word alignment works the same. And, obviously, the alignment command needs to be before the label, otherwise the label will point to the padding byte as Rich has pointed out.

"align 2" translates into "ds.w 0"
"align 4" translates into "ds.l 0"

Regards,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Arrakis Software

Post by tcat »

Tobias, Rich,

Thank you for padding suggestions, it now works, I use 100 as a delay in below line, as otherwise it playes really fast
moveq #100,d2 ; Play it very fast

I am getting binary and when loaded into reserved memory and then called from S*BASIC it works as expected and plays Bach's Prelude.

What I don't quite understand is, why the binary does NOT play sound when EXECuted. The job started does not even finish on it's own and needs to be removed. GST manual says, that the binary output can be run by EXEC or EXEC_W commands.

Tom


User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Arrakis Software

Post by tofro »

Tom,

in order to build an executable job, your code needs to look slightly different.

The first few lines should look like

Code: Select all

mt.frjob    equ 5
start:
         bra job_start
         dc.w   0                     ; Every job should have a proper header
         dc.w $4afb
         dc.w 7
         dc.b 'Prelude'
job_start
         lea prelude,a0
         moveq #40,d2
         bsr.s hi_fi
       
job_end:
         move.l #mt.frjob.d0     ; instead of an rts, we need to do an MT.FRJOB trap to end the program
         move.l #-1,d1
         clr.l d3
         trap #1
;
;
;
Details on that can be found in the "QL Technical Guide" page 17+. A job may not just end with rts, it needs to be terminated properly from QDOS. That's what the MT.FRJOB does. And it should have a header.

Regards,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Arrakis Software

Post by tcat »

Tobias,

Thank you for explaining, I have also read pages 17+ from The Technical Guide, now with better understanding. I somehow realised, I also need to put an extra padding right at the assembly end.

Code: Select all

    ...
    dc.w    0
    end
To ensure the binary has even byte size, is all in words so to speak. Otherwise job gets loaded, but has problems executing. Cannot explain it, but seems to work with GST Assembler.

I can now call sound not only from SuperBASIC, but I can also run it as a job.
I may file a seperate topic on JOBS, as I have questions to ask.

Many thanks so far
Tom


Post Reply