Login
Directly Assembler 2.4 +4
Title:Directly Assembler 2.4 +4
Category:Utility/Programming
Release Date:
Machine:PAL & NTSC
Code Type:Machine code
Distribution:Commercial/TA
Notes:See: this Usenet post. Coded by Leopoldo Ghielmetti. WANTED: missing software.
User comments: Read comments
Missing software


Description
        DIRECTLY ASSEMBLER VERSION 2.4 BY L.G.SOFTWARE.
-----------------------------------------------

+----------------------------------------------------------------------------+
: All the information in this document is believed to be correct at the time :
: of publishing. We do, however, reserve the right to make any changes in :
: product specifications without notice. :
+----------------------------------------------------------------------------+

You can copy and distribute this software with its documentation, provided you
do not modify them.


DISCLAIMER OF WARRANTY :

THIS SOFTWARE AND MANUAL ARE PROVIDED "AS IS" AND WITHOUT WARRANTIES AS TO
PERFORMANCE OR MERCHANTABILITY.

THE USER IS ADVISED TO TEST THIS SOFTWARE THOROUGHLY BEFORE RELYING ON IT.

I DECLINE ALL RESPONSIBILITIES ABOUT MISFUCTION OR DAMAGES CAUSED BY THIS
SOFTWARE.


INSTALLATION :

1) Load the assembler in memory (after computer initialization)

2) Type 'RUN'. The assembler will display the following message :

DIR-ASSEMBLER V2.4

BY

L.G. SOFTWARE 1992

3) The assembler is ready to be used.

If you want to install system labels :

1) Install the assembler (see above)

2) Load the file containing the system labels

3) Type 'RUN'

4) If you want to keep the modification, save a copy of the original
DIRASSEMBLER and save the new version according to the procedure described
after the description of the .SYS pragma.

To create new labels :

1) Create a new file containing system labels.
See furnished example.

2) Follow the same procedure as above.

HOW TO EXECUTE THE PROGRAM :

Once the program is loaded just type :

1) SYS 4080 if you want to clear all old labels
2) SYS 4083 if you want to preserve the old labels

OPERATORS :

1) all the BASIC functions are available

2) the "<" means the upper byte
the ">" means the lower byte

example : hello = $1234
>hello returns a value $34

<($76+$80) returns a value $01

CONSTANTS :

number : decimal number
$xxxx : xxxx = hex number (max 4 digits)
]label : label = system label (max 6 characters)
%num : num = binary number (max 16 digits)

LABELS :

label : program label (max 6 characters) must start with an alphabetical
character. You can't start with a BASIC command.

VARIABLES :

!var : var = BASIC variable

THE PROGRAM COUNTER :

THE PROGRAM COUNTER SYMBOL IS : @

THE AUXILIARY PROGRAM COUNTER SYMBOL IS : \ (pound sterling = CHR$(92))

example : 10 SYS 4080 : @ = $1000 : \ = $7000
... program ...

the program was assembled at $7000 but it is expected to work
at $1000

note : if the program counter is modified, the auxiliary program counter
follows the modification.

example : 10 SYS 4080 : @ = $1000 : \ = $7000

20 .BYT 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 : ; here @ = $100A and
\ = $700A

30 @ = @ + $156 : ; here @ = $100A + $156 = $1160 and
\ = $700A + $156 = $7160

40 .ASC "HELLO" : ; here @ = $1165
\ = $7165

50 @ = $1180 : ; here @ = $1180 = $1165 + $15 and
\ = $7165 + $15 = $7180

PRAGMAS :

The letters in lowercase are optional

= : assign a value to a label

example : hello = 1234
^ ^
these spaces are necessary

; : comment, skip to the end of the current line

.ASC : put a string in the code

example : .ASC "HELLO"

.BYTes : put a byte in the code

example : .BYTES 4, 7, 12, $65

.CORr : check the program syntax (no code generated)

.END : Quit the assembler, return to BASIC

.FILe # : Save the assembled code in the opened file.

note : .FILe # must be written directly at the first line of the
program, after the PC definition

warning : do not change the program counter when .FILe # is used
because this pragma writes the code directly in the file

example : 10 OPEN 1,8,2,"PROGRAM,P,W"
20 SYS 4080:@ = $7000:.FIL #1
30 LDA @
40 @ = $7500:; ! the real PC is not changed !
50 LDA @
60 .END
70 CLOSE 1
RUN
MONITOR
L "PROGRAM" 8
D7000 7002
.7000 AD 00 70 LDA $7000
.7002 AD 00 75 LDA $7500

.FINd " : search a specified string in the program

note : the double quotes must not be closed

.FINd ' : search a specified command in the program. With the .FIND '
command, the BASIC interpreter transforms the line before the
search. This allows a search of a BASIC command.

example : 10 PRINT "HELLO"
20 A$="PRINT"

for search the string PRINT type
SYS 4080:.FIND "PRINT

for search the command PRINT type
SYS 4080:.FIND 'PRINT

the first command writes [20]
(the string PRINT)

the second one writes [10]
(the command PRINT)

note : the .FINd pragma searches only the first occurence of the
string on the line

example : 10 PRINT A:PRINT B
20 PRINT C:PRINT D

SYS 4080:.FIND 'PRINT
writes only one [10] and one [20]

.GOTo : go to a specified line

.IF : if the condition is true the next instruction will be assembled

.IF condition : instruction : instruction
: ^ ^
: TRUE : :
:----->------+ :
: FALSE :
+------------>-------------+

examples : .IF a = 5 : .GOTO 100 : LDA #6
if the label a is 5 then go to line 100
else assemble LDA #6

.IF !a = 1 : .GOTO 100 : .GOTO 200
if the BASIC variable a is 1 then goto 100
else goto 200

.IF a = 1 : LDA #4 : STA 67
if the label a is 1 then assemble also LDA #4

.LET : put a value in a BASIC variable

note : the BASIC variable must not be prefixed

example : .LET a = 5 + hello + !b

.PRT : display the program labels

examples : .PRT hello display the value of a label named hello
.PRT ]CKOUT display the value of the system label
named CKOUT
.PRT display all program labels
.PRT] display all system labels
^
without space

.PRT # : write all the program variables in an opened file

examples : .PRT #4 write all the program labels to file 4
.PRT] #4 write all the system labels to file 4

.SYS : convert all the program labels into system labels,

note : only the part of program which is placed before the pragma
is assembled

The .SYS pragma can be used only once.

Make a copy of the original assembler before saving it.

example : 10 SYS 4080:@ = $7000:.SYS
20 CHKNUM = $9317
30 ARGFAC = $A281
...

after execution of this code the program writes

SYS: $1001-$XXXX

where XXXX is the end of the program

to keep changes, go to the monitor with the command
MONITOR and save the program with the following
command :

S "MY DIRASSEMBLER" 8 1001 XXXX

You can find an incomplete list of system labels at
the end of this text

This list is included in the example file 'SYSTEM.PRG'

.WORds : put a word in the code

example : .WORDS 35663, $F004, 343

COMPILING ERRORS :

Error number Error name

0 READY
3 FILE NOT OPEN
5 DEVICE NOT PRESENT
7 NOT OUTPUT FILE
11 SYNTAX
14 ILLEGAL QUANTITY
15 OVERFLOW
16 OUT OF MEMORY
17 UNDEF'D STATEMENT
18 BAD SUBSCRIPT
20 DIVISION BY ZERO
22 TYPE MISMATCH
23 STRING TOO LONG
25 FORMULA TOO COMPLEX
27 UNDEF'D FUNCTION
30 BREAK
34 DIRECT MODE ONLY
37 BRANCH OUT OF RANGE
38 UNDEF'D ORIGIN
39 REDEF'D LABEL
40 UNDEF'D LABEL

0 PROGRAM OK : The program has been correctly assembled
(returned if .CORr pragma is used)
0 IMPOSSIBLE : The program can't be assembled

Example : 10 A = 0
20 SYS 4080:@ = $7000
30 .IF !A : .GOTO 50
40 BRK
50 .LET A = NOT(!A)

This cannot assembled because
the BRK instruction (line 40) is
present only during odd assembly
passes.

The help command tells where the error occurred.

Errors 37 to 40 are not defined by the ERR$(.) instruction.

MODULAR ASSEMBLING :

FIRST METHOD :

10 PRINT "ASSEMBLING PROCEDURE 1"
20 SYS 4080:@ = $7000 -+
30 PAUSE LDY #0 :
40 A DEY:BNE A : procedure 1
50 .LET PA = PAUSE :
60 .LET PC = @ :
70 .END -+

80 PRINT "ASSEMBLING PROCEDURE 2"
90 SYS 4080:@ = !PC -+ procedure 2 calling the
100 JSR !PA -+ procedure 1

SECOND METHOD :

10 PRINT "ASSEMBLING PROCEDURE 1"
20 SYS 4080:@ = $7000 -+
30 PAUSE LDY #0 :
40 A DEY:BNE A : procedure 1
50 .END -+

60 PRINT "ASSEMBLING PROCEDURE 2"
70 SYS 4083 -+ procedure 2 calling the
80 JSR PAUSE -+ procedure 1

NOTE : I have not tested the modular assembling, so I'm not sure that it
runs properly.

WARNINGS :

1) SYS 4080:.PRT
^
this space cannot be omitted in direct mode

2) The argument cannot begin with a parentesis.

example : LDA (5+3)*2 wrong --> LDA 2*(5+3) right
JMP (23+6)*(5+2) wrong --> JMP +(23+6)*(5+2) right

LIMITATIONS :

Only the graphic memory area is used so 48381 bytes are available to the user.

The assembler takes 3975 bytes located between both adresses $1000
and $1F87.

Each label takes 8 bytes in memory (6 bytes for the name and 2 for the
value). In order to find the first free address (in the reserved ares), just
type :

PRINT DEC("1F88") + 8*N

where N is the number of labels used in the source code.

The last address of the reserved area in $3FF7. (--> max 1038 labels)


PARTIAL SYSTEM LABELS LIST :

A two-bytes number should be indicated as follows :
YA : number which A is the lowest byte and Y is the hightest byte
YX : number which X is the lowest byte and Y is the hightest byte
AY : number which Y is the lowest byte and A is the hightest byte
AX : number which X is the lowest byte and A is the hightest byte
XA : number which A is the lowest byte and X is the hightest byte

The floating point accumulators are :
FAC : the Floating point ACcumulator (address $61-$66)
ARG : the auxiliary floating point accumulator (ARGument) (address $69-$6E)
FAC3 : the floating memory 3 (address $57-$5B)
FAC4 : the floating memory 4 (address $5C-$60)

]CHRGET $0473 : Copy in A the content of the address pointed by
($3B-$3C)

]ERROR $8683 : Displays the error message X and turns back to BASIC.

]SRCLIN $8A3D : Search the line number ($14-$15) in the BASIC
program. The address is returned in ($5F-$60).
The carry flag is set if the line has been found.

]SRCCHR $8DC3 : Search the character in X (or a '0') from the address
contained in ($3B-$3C).
The address of the character found is returned
in ($3B-$3C).

]WSCRN $9088 : Display the string pointed by YA.

]FRMNUM $9314 : Compute a numerical expression pointed by ($3B-$3C).
The result is returned in FAC.

]CHKNUM $9317 : Check the string flag. When set, produces the
TYPE MISMATCH error.
($0D flag = 0)

]CHKSTR $931A : Check the string flag. When not set, produces the
TYPE MISMATCH error.
($0D flag = $FF)

]FRMEVL $932C : Compute the expression pointed by ($3B-$3C) and
returns the result in FAC.

]SRCVAR $96A5 : Search a BASIC variable whose name is pointed by
($3B-$3C). The address of the variable is returned
in ($47-$48).

]FRMSTR $9C48 : Compute a string expression pointed by ($3B-$3C)
The result string is pointed by FAC.
(the length is in $61, the pointer is in ($62-$63))

]GTBYT $9D81 : Compute a numerical expression pointed by ($3B-$3C).
The resulting byte is returned in FAC.

]RENU20 $9DE1 : Compute a integer expression pointed by ($3B-$3C).
The result is returned in ($14-$15) and in AY

]GTADR $9DE4 : Convert FAC into an integer.
The result is returned in ($14-$15)

]ARSUFA $9E87 : FAC := ARG - FAC

]YAADFA $9E9B : FAC := ARG + (YA)

]ARADFA $9E9E : FAC := FAC + ARG

]ROSUFA $A06C : FAC := ARG - (YA) where YA points to a ROM constant

]RODIFA $A072 : FAC := (YA) / FAC where YA points to a ROM constant

]YAMUFA $A078 : FAC := FAC * (YA) where YA points to a variable

]ARMUFA $A07B : FAC := FAC * ARG

]ROMARG $A0DC : ARG := (YA) where YA points to a ROM constant

]YAARG $A107 : ARG := (YA) where YA points to a variable

]ARDIFA $A194 : FAC := ARG / FAC

]YAFAC $A21F : FAC := (YA) where YA points to a variable

]ROMFAC $A221 : FAC := (YA) where YA points to a ROM constant

]FACAC4 $A24C : FAC3 := FAC

]FACAC3 $A24F : FAC4 := FAC

]FACYX $A259 : (YX) := FAC where YX points to a variable

]ARGFAC $A281 : FAC := ARG

]FACARG $A291 : ARG := FAC

]CPYAFA $A2E0 : Compare the content of FAC to the variable pointed
by YA. The flags are modified according to the CMP
instruction.

]FACINT $A327 : FAC := INT(FAC)

]ASFAC $A37F : Convert an ASCII number pointed by ($3B-$3C).
The result is returned in FAC.

]PRAX $A45F : Display the integer AX

]FACAS $A46F : Convert the content of FAC into an ASCII number.
The result is returned at the $0100 address.

]ARPWFA $A5EE : FAC := ARG ^ FAC

]WRITE $A78B : Write the character contained in A

]PLOT $D839 : Set the text cursor at coordinates X, Y.

]CLEAR $D88B : Clear screen

]SCNKEY $DB11 : Read a character from the keyboard

]ESCV $DEF6 : Scroll Up the screen

]ESCW $DF04 : Scroll Down the screen

]BASIN $EBE8 : Read a line from standard input

]BSOUT $EC4B : Write a character to a standard output

]ACPTR $EC8B : Read byte from a standard input

]CIOUT $ECDF : Write a character to a standard output

]CHKIN $ED18 : Check if the file X is an input file

]CKOUT $ED60 : Check if the file X is an output file

]TALK $EDFA : Send the TALK signal to the IEEE-bus

]TKSA $EE1A : Send the TALK secondary address to the IEEE-bus

]LSTEN $EE2C : Send the LISTEN signal to the IEEE-bus

]SECOND $EE4D : Send the LISTEN secondary address to the IEEE-bus

]CLALL $EF08 : Close all opened files
WARNING : the handlers are simply deleted;
the peripheral doesn't receive any CLOSE
signal.

]UNLIST $EF23 : Send the UNLISTEN signal to the IEEE-bus

]UNTALK $EF3B : Send the UNTALK signal to the IEEE-bus

]BREAK $F265 : BASIC STOP instruction

]RESET $F2A4 : Reset the system

]RESTOR $F2CE : Reset the vector table

]VECTOR $F2D3 : Set the vector table

]IOINIT $F30B : Initialize the I/O

]RAMTAS $F351 : Initialize the RAM map

]SETNAM $F40C : Set the filename for open routine

]SETLFS $F413 : Set the filenumbers for open routine

]MEMTOP $F427 : Read/Set the memory top address

]MEMBOT $F436 : Read/Set the memory bottom address

]PHLXA $FAFF : Display the integer AX in hexadecimal

]PRHL $FB10 : Display the integer A in hexadecimal

]SCRN $FBD8 : Display a null-terminated string following the
JSR ]SCRN instruction.
EXAMPLE : JSR ]SCRN : .ASC "HELLO" : BRK
writes "HELLO"


MOST OF THESE LABELS ARE TAKEN FROM THE BOOK :

Spitzner, "C16, C116 und Plus/4 ROM-Listing", Muenchen,
Markt-und-Technik-Verlag, 1987


IF YOU APPRECIATE THIS SOFTWARE (AND ALL THE WORK BEHIND IT), PLEASE SEND MONEY
TO MY BANK ACCOUNT :

SWISS BANK CORPORATION , bank account number F4-702,550.0


CONTACT :

Leopoldo Ghielmetti
Via Castelrotto 20
6600 Locarno (CH)

E-MAIL : ghie...@eldi.epfl.ch

/**************************************\
* Ghielmetti Leopoldo *
\**************************************/*****\
* e-mail : ghie...@eldi.epfl.ch *
\************************************/


Copyright © Plus/4 World Team, 2001-2024