BASIC ASM Commands

These are the buildin BASIC ASM commands, are the only case-sensitive commands in BASIC ASM and should always be written in uppercase. Beside these compiler-buildin commands, you have the ASMLIB functions. These are default written in lowercase, but you may write them anyway you like. They are there for some basic functionality. You find a list of these functions under Header File Contents.


A note on syntax conventions used in this reference page
[ <stuff> ] indicates that the enclosed arguments are optional
{ <stuff> } indicates that the enclosed arguments are required
<stuff1> | <stuff2> indicates that one or the other of the arguments must be selected
... means more of the same kind of argument, or indicates code between the beginning and end of code block statements
<expression> means ANY expression or complex calculation can be used in that location
<variable> cannot be initialized to negative numbers

A

ASM ... ENDASM
Indicates the beginning and end of an assembly language function.
 
Syntax:
 

ASM

[ native assembly code ]

ENDASM

Notes:
BZC simply inserts the assembly code into the source file; it does not check the syntax of the assembly code. Also, arguments may passed to the function via PUSHes to the stack, and can be accessed, in reverse order, by repeated POPs. Additionally, the B_CALL() macro may NOT be used inside this function; use instead RST $28 <new line> .DW <romcall name>.
back to top

B

BYTE
Declares a 1-byte variable.
 
Syntax:
 

BYTE <variable_name> [ = <value> ]

Notes:
No prefix means a decimal value; a % preceeds binary values, $ preceeds hexadecimal values.
back to top

C

CONST
Declares a constant 2-byte variable (integer).
 
Syntax:
 

CONST <variable_name> = <value>

Notes:
This value cannot be modified by the program at run time. No prefix means a decimal value; a % preceeds binary values, $ preceeds hexadecimal values.
back to top

D

back to top

E

EXIT
Instantly terminates a program and returns to the OS or calling program
 
Syntax:
 

EXIT

Notes:
 
back to top

F

FOR...NEXT
Allows the construction of a FOR...NEXT loop.
 
Syntax:
 

FOR <variable_name> = <expression> TO <expression> [ BACK ]

...

NEXT

Notes:
BACK means counting backwards. At the begin, the variable is set to the first expression. Everytime the routine has been executed, there will be 1 added to (or subtracted from) the variable. The routine will be executed until the variable is equel to the second expression.
 
FORCE
Causes BZC to compile a variable or function, regardless of whether or not it is used in a program.
 
Syntax:
 

FORCE <function_name>

FORCE <variable_name>

Notes:
Since BZC uses a compile-as-needed strategy, this function is useful when using variables between ASM ... ENDASM (BZC wouldn't normally recognize that the variable or function was being used in that case).
 
FSTART ... FEND
Defines the code that comprises a function
 
Syntax:
 

FSTART <function_name> [ arg1 [ arg2 ... ] ]

[ function code ]

[ RETURN <variable_name> ]

FEND

Notes:
The same number of arguments must be passed to the function as was defined in the function prototype.
 
FUNCTION
Declares a function.
 
Syntax:
 

FUNCTION <function_name> [ ARG <number_of_arguments> ]

FUNCTION <function_name> ROMCALL [ <romcall_name> ARG <arg1> <arg2> ... ]

Notes:
For non-ROM call functions, the arguments that the function takes are defined in each function's FSTART ... FEND section. Also, ROM calls must declared beforehand, either in the header file or in the declarations section of the program code.
back to top

G

back to top

H

back to top

I

IF ... THEN ... ELSE ... ENDIF
Allows for conditional execution in a program
 
Syntax:
 

IF <expression> [ { == | >= | <= | > | < } <expression> ] [ { AND | OR } <expression> [ { == | >= | <= | > | < } <expression> ] ] [ ... ] THEN

...

[ ELSE

... ]

ENDIF

Notes:
When no operator (e.g. nothing like ==) is used, the condition will be true if the expression is anything other than 0 (zero).
 
INCLUDE
Inserts the contents of the specified file into the current file at compile time.
 
Syntax:
 

INCLUDE <filename>

Notes:
Under normal circumstances, this command should not be used. This command has nothing to do with #include!
 
INT
Declares a 2-byte variable (integer).
 
Syntax:
 

INT <variable_name> [ = <value> ]

Notes:
No prefix means a decimal value; a % preceeds binary values, $ preceeds hexadecimal values.
back to top

J

back to top

K

back to top

L

LOOP ... ENDLOOP
Constructs some kind of a DO-LOOP or while() statement
 
Syntax:
 

LOOP [ { WHILE | UNTIL } <expression> [ { == | >= | <= | > | < } <expression> ] [ { AND | OR } <expression> [ { == | >= | <= | > | < } <expression> ] ] [ ... ] ]

...

ENDLOOP

Notes:
If you use LOOP without WHILE or UNTIL, the only way to quit from this loop is to use the EXIT function.
 
back to top

M

MEM
Reserves a block of memory space for data at the end of the program.
 
Syntax:
 

MEM <mem_block_name> <length in bytes>

Notes:

<mem_block_name> actually points to the first byte of the memory block.

 
back to top

N

back to top

O

back to top

P

PRINTF
Prints a number or a string at the current cursor location, or a deined location.
 
Syntax:
 

PRINTF [ <row> <column> ] { <variable_name> | <string_name> }

Notes:
PRINTF automatically detects whether the argument is a number or a string and adjusts accordingly. The row and column values are optional passed, may not be calculations (they must be vars or constants) and must obey the following constraints: row=[0-7], column=[0-15]. Internally PRINTF calls the ASMLIB functions locate and printf.
 
back to top

Q

back to top

R

ROMCALL
Declares a ROM call.
 
Syntax:

ROMCALL <romcall_name> = <romcall_address>

Notes:
Under normal circumstances, you should not have to use this command. ROMCALL cannot be used to declare a ROM call with arguments; use FUNCTION instead.
back to top

S

SPRITE
Declares a sprite.
 
Syntax:
 

SPRITE <sprite_name> FROM <file_name>

Notes:
You can use this command already, but there are not yet any sprite routines available for this command, in other words: this command is not yet supported.
 
START ... END
Indicates the beginning and end of the main program.
 
Syntax:
 

START

[ program code ]

END

Notes:
There should be only one START ... END block in the source file.
 
STRING
Declares a constant string.
 
Syntax:
 

STRING <string_name> = <string_constant>

Notes:
A constant string must be specified.
 
SYSVAR
Declares a system variable.
 
Syntax:
 

SYSVAR <variable_name> = <memory address>

Notes:
Under normal circumstances you don't have to use this command. variables declared with SYSVAR are acting as variables from the BYTE type.
back to top

T

back to top

U

back to top

V

back to top

W

back to top

X

back to top

Y

back to top

Z

back to top