Assembler generates OPL output

Use this section to showcase your programming examples. Or to ask members for programming suggestions
Post Reply
Posts: 45
Joined: Tue Jan 03, 2023 7:54 pm

Assembler generates OPL output

Post by amenjet »

I've just added a feature to the 6303 Psion macro assembler ( that outputs OPL code with the assembled machine code in it. It might be useful to someone...

So, if you have this example code:

Code: Select all

       MUL      ;Multiplies A and B together.
       XGDX     ;Put result in X	;
       RTS   ;Return
and you assemble it, you get (as well as other output files), a file with this in it:

Code: Select all

It's easily customised by altering the assembler Tcl source.

Posts: 28
Joined: Thu Jan 12, 2023 8:25 pm

Re: Assembler generates OPL output

Post by Lostgallifreyan »

If you want to do it for larger programs, instead of using OPL string extension which is slow, you could call this:

Code: Select all

REM CODE:18EC02DD43EE00DF414FE6003A54DD4509EC00814025028007C1402502C00748484848C40F1B36099C4122E4DE43D64632A700085A26F9DE4539
LOCAL C$(58),S$(255),V%(2)
S$=H$ :V%(1)=ADDR(S$) :V%(2)=A%
When that is translated to OB3, replacing the string of XXXXX... with the hex code in the comment will make a procedure that can stow an arbitrary string of code or data input by H$ anywhere you can point it to by the input A%. The reason for this weird method is that the procedure cannot build itself. :) Once you have it transferred to an Organiser pack, it will solve (or in a moment of misguided boredom, cause) some tough problems.

It can replace both POKCNV% and CONV$ when working with machine code in OPL.

If anyone wants to see a full listing of the ASM (and more explanation of why I did it) there's one on my site at in the software section.
Post Reply