Skip to content

Releases: qb40/s3-asm

S3Asm is an 8086 machine code assembler for Psion Series3a pocket computer : Goddard and Krister Wombell.

04 Feb 18:44
Compare
Choose a tag to compare
                      S3Asm

                  Version 2.00C


  Copyright Giles Goddard and Krister Wombell 1994


Introduction:
------------

 S3Asm is an 8086 machine code assembler for Psion Series3a pocket
computer. The bulk of the program is written in 8086, so its capable
of very high assembly speeds. 

 Machine code compiled using S3Asm can be incorporated into OPL
programs or can be translated into an image file ready for running
from the System screen.



WARNING:

 Extreme caution should be taken when using this program, if the code
you have just assembled has a bug, it could and most often does, crash 
the machine. Also, S3Asm holds NO WARRANTY. If the bug is caused by S3Asm 
itself not assembling correctly, then neither us (the authors) or Psion 
can be held responsible for any loss of data or damaged caused to you, your
machine or anything else in near proximity.


Registration:
-------------

 This version of S3Asm is fully functional, the only limitation is
the size of the output object code. This is set 256 bytes, which is
more than enough for most small programs. If you would like to 
assemble larger programs or if you just want to show your appreciation 
for this software please register it by either,

Sending 10 UK pounds to:

 Giles Goddard,
 6, Court Royal Mews,
 Northlands Road,
 Southampton. SO3
 England.

Or,

 Typing GO SWREG on Compuserve and following the prompts. S3Asm's
registration code is 2703 and it costs 20.00 dollars.


Installation:
------------

If you have RFM installed you may prefer to use the PC batch file
Install.bat to setup S3Asm. It assumes you have the s3a connected and 
ready. Otherwise just follow these simple steps:

Copy S3Asm.opa into an \APP directory on your Series3a, any drive will 
do, and install it by pressing Psion-I from the system screen.

If everything is well you should have the S3Asm icon with S3Asm
written underneath.

Next, make a directory on any drive called \ASM which holds the
source files for any machine code you write. 

copy s3obj.opl to \OPL 
copy s3obj.opo to \OPO

These files are used to load object code into your OPL programs.


If you would like to use the example source and EPOC service include
files then please:

Make another directory called \INC which holds the include files.
copy *.inc to \INC 
copy *.asm to \ASM
copy win.opl to \OPL

Selecting one of the example files that should appear under the S3Asm 
icon by pressing enter will run S3Asm using that file.



Usage:
-----

 When you run S3Asm you should be presented with a menu of commands,
these are:


Open file - Change the current source file.  

Setup     - Change the intialisation file for S3Asm.
Reset     - Reset intialisation file to default settings.

Assemble  - Start assembling the current source file.

Register  - Register S3Asm to assemble larger files and to the remove 
            nag screen.
About     - Show information about S3Asm.
Exit      - Exit S3Asm



Setup:
-----

The setup file for S3Asm is 'M:\OPD\s3asm.ini' it is created 
automagically and reset to the default settings when you first run S3Asm. 
You can change these settings using the Setup menu command.

Memory:

Amount of memory allocated for source block. S3Asm loads your source
file in small chunks or blocks. If you dont have enough memory on
your machine for the default setting, you can reduce the amount
allocated.

Amount of memory allocated for object block. This is the maximum size
of you object code output. For non-registered users this is limited
to 256 bytes.

Amount of memory allocated for symbols. Everytime you define a label,
equate or variable the name gets added to the symbol list. This is 
the total memory available for all your symbols names.

Amount of memory allocated for Forward References. If you reference a
label or variable which has been defined later on in the source file,
S3Asm stores this reference in the FR block and then later adjusts
the object code.

Amount of  memory allocated for relocations. If you use non-relative
addresses, such as referencing a variable or address of a variable
then S3Asm stores this information into the relocation block. When you 
use the object file in your OPL program, the relocation is automatically 
done for you.

Amount of memory for macros. Macros take up memory whenever they are
defined, this lets adjust the maximum amount of memory for all the
macros.


Directories:

S3Asm normally writes all of its output files back into the directory
from where the source file came from. You can override this for each
output file type.

Binary files, .BIN files that use loaded into your OPL programs.

Image file, .IMG files that can be run from the system screen.

OPL files, .OPL files that can be included into your OPL programs and
compiled.
(Warning: It can be dangerous to set this to your main \OPL
directory, where S3Asm may write over an existing OPL file of the
same name.)


Image files:
The intitial stack size and priority used when creating image files
may be changed.





Creating source files:
----------------------

Source files may be created using the built in Program application.
The easiest way of doing this is by installing the Asm.als file included 
with S3Asm, which makes a 'virtual' copy of Program and tells it to use 
the directory \ASM and files with the .ASM extension. Copy the file 
Asm.als into a \APP and install it using Psion-I. You can then create 
and edit files the same way as you would OPL files.



Assembling source files:
------------------------

When you assemble a source file S3asm asks you which type of output
you would like, this can be Binary, OPL or Image. This can be made 
automatic by placing the word BINARY, OPL or IMAGE at the top of your 
source file, eg.

    BINARY

    mov ax,0

    retf

or,

    OPL

    mov ax,0

    retf

or,    

    IMAGE

somedata
    dw 1234

    CODE   
    mov ax,0
    retf


Notice the CODE line in the last example. This tells S3Asm where your
actual program starts. Image files are split into 2 parts, the Data
segment and Code segment. All variables and other data should be
placed before the CODE statment. 

If you select OPL output then S3Asm will ask you to give it a
variable name. This variable is used to put object code into, see
below for more details.



Note: The option to write out Image file types at the end of assembly
is just included for completeness. If you select this option you will 
be warned that you have no IMAGE statement in your code.


Assembler syntax:
----------------

S3Asm tries to keep to standard 8086 assembler syntax where possible.

Comments must start with a  ';'  unless they come after the end of
the instruction ie.

; This  is ok

    mov ax,0  ; so is this
    mov ax,1  and this

but this is not





Instruction format:

Instructions and data declarations must be preceeded by at least one
space or tab, ie.
  
 mov ax,1 ; is ok
mov ax,1 ; is bad

Labels and equates:

Labels and equates must start a line, ie. no spaces or tabs before
them, ie.

    mylabel  mov ax,0   ; is bad

mylabel  mov ax,0       ; is ok


Labels and equates must start with a non digit and can be upto 255
bytes long. ie.

6label dw 0            ; is bad

label6 dw 0            ; is ok

datapp1 equ $28   ; is ok


Also, for future versions please dont use labels with these
characters:

 - * , / + = % ! & > < $ " 



References to labels must be enclosed in square brackets, eg.

   mov ax,[a_label]



Addresses of labels use the OFFSET syntax, eg.

  mov bx, offset a_label

  mov ax,[bx]



Absolute addresses use the ABS syntax, eg.

  mov ax, ABS [datapp1]





Data:

 There are 3 types of data statement:

  db 0
  dw 0
  db "A string",0




Numbers:

 ASCII, Decimal, Hex and Binary numbers are supported, they have the
following syntax:



    mov ax,1234    ; a decimal number

    mov ax,$5678   ; a hex number

    mov ax,%0101   ; a binary number

    mov al,"a"     ; an ASCII character must be surrounded by quotes



Macros:

 Macros can be defined as such;

Name MACRO
     mov ax,!0  ; move 1st parameter into ax
     mov ax,!1  ; move 2nd parameter into ax
     ENDM

!0 to !9 are used to reference parameters, !0 being the 1st, !9 the 10th.

To envoke the macro use;
    name parameter1,parameter2.... 

eg.

increg MACRO
    inc !0
    ENDM

    increg ax

Macros cannot be nested.





Include files:

Include files can contain machine code, data, macros, equates or indeed 
anything that you would use normaly in a source file. They must be 
placed at the top of your main source file and cannot be nested. ig.

  include "m:\inc\win.inc"


The standard convention for include filenames is to have a .INC
extension and to be placed in a \INC directory.



Epoc functions:

S3Asm has a special instruction for defining EPOC service interupts.
Its syntax is such:

Name  EPOC  Function number, Int number, register1, register2....

eg.

HeapAllocateCell    EPOC   $00,$81,cx

    HeapAllocateCell  1000


And would expand out to be;

    mov cx,1000
    mov ah,$81
    int $81




How to use your assembled file:
------------------------------

 As mentioned earlier, S3Asm can output 3 types of file; Binary, OPL
and Image.

Binary files (with extensions .BIN) can be loaded into your OPL
programs using the Procedure LoadO: (fname$), which is included in
the S3Obj.opl file. A typical example would be;


    Global ass%

    LoadM ("m:\opo\s3obj.opo")

    ass%=LoadO:("m:\asm\win.bin")
    if ass%=0  : Alert ("Unable to load binary file")  :  endif

    usr(ass%,0,0,0,0)

...
Read more