AMOS Pro Command Notes

Copy

Copy is inclusive, so when it says Start to Finish, that:

  • includes the Finish address
  • doesn't extend beyond that address

This is correct:

CAT$="Meow"
Reserve as Work 10,Len(CAT$)
Copy Varptr(CAT$),Varptr(CAT$) + Len(CAT$) to Start(10)

Font finding

You have to iterate through the entire list of system fonts using Font$() to find the one you want.

Get Fonts
' This is 1-indexed
F=1
FOUND_FONT=-1
While FOUND_FONT=-1
  FONT_INFO$=Lower$(Font$(F))
  ' FONT_INFO$ is empty string when you're out of fonts
  If FONT_INFO$=""
    ' Font not found
    Error 44
  End If
  ' Instr is 0 on fail, 1+ on match, because BASIC
  If Instr(FONT_INFO$,"garnet")>0 and Instr(FONT_INFO$," 9")>0
    FOUND_FONT=F
  End If
  F=F+1
Wend
Set Font FOUND_FONT
Text 100,100,"Wowow"

Pload, Call, and inline machine language Procedures

https://www.ultimateamiga.co.uk/HostedProjects/AMOSFactory/AMOSProManual/14/1414.html

Theoretically you can load an executable machine language thing and use it with Pload.

  • You get a parameter list via Call you unwind the same way as in an extension. You have to (A3)+ every parameter.
  • The code has to be an executable, not relocatable, so use wo with AsmPro and not wl.
  • You should wrap the code in MOVEM.L A4-A6,-(SP). I was able to get away with just preserving A6, though.
  • All references to memory in the code must be LEA Label(pc),A0. See note about Alignment below.

But, Call seems to work unreliably when used in nested procedures, despite the program correctly resetting stacks and unwinding arguments. Inlining the code with Insert Program into its own Procedure seems to work just fine.

Alignment

Your code in your procedure is part of the tokenized stream of stuff. I'm guessing the AMOS interpreter “generates bytecode” as you're typing, and your machine language routine lives in that bytecode stream.

I was being bitten trying to use dos/Info to load data into a ds.l structure. Sometimes, it worked and returned the correct data. Sometimes, it did not, and it made a difference as to how many tokens there were in the program. I had to forcibly long-align the address I was using. CNOP 0,4 will not save you. When the manual says “totally relocatable”, they mean it:

snippet.asm
  ; long align the disk info area for dos/Info()
  LEA DiskInfoArea(pc),A0
  MOVE.L A0,D0
  AND.L #$2,D0
  ADD.L D0,A0
  MOVE.L D0,D2
  CALLLIB _LVOInfo
 
; One normally only needs 9 longs for this, the extra is to
; handle realigning in cases this storage is not long-aligned.
DiskInfoArea ds.l 10

Updating/Removing Inline Machine Code

  • You can call “Insert Program” on an already-inlined Procedure
  • To remove an inlined Procedure, highlight the whole line and Cut

Load Iff

You can't load an IFF that's shorter than 16px. AMOS will declare itself out of memory or outright crash.

Get Bob

AMOS seems to want bobs that are:

  • an even number of lines high
  • if it's small, a value divisible by 8

I needed to pad some sprites with background color before AMOS would use them properly.