PAC v1.1	2003 by Mercury0x000D

PAC is a standard assembly language compiler for the PCOS kernel. This help file details the assembly language as well as the compiler directives you can include in your programs.





-Compiler Directives
Compiler directives are special instructions for the compiler which cause it to perform some function indirectly related to your program. They are as follows:

#name: <program name>
Specifies the name of your program to the kernel.

#logfile: <filename>
Generates a address map file, which contains listings of the addresses of all the instructions in your program, as well as any extra data associated with them. The <filename> can be a simple file name or an entire filepath, which specifies the name the log file will have.

#version: <version string>
Tells the compiler to create a 'VERS' resource in the compiled application file which specifies the version of your program to the kernel. A standard <version string> should be a simple version number such as 3.0, or 7.12, although letters are allowed also.





-Assembly Language Notes
The PAC compiler supports all assembly instructions currently included in the PCOS kernel. Some instructions have been improved upon to allow better use of the language. The instruction set is as follows in these examples:

ADD		ADD AX, BX, CX
 Adds AX and BX, and stores the result in CX

AND		AND AX, BX, CX
 Performs a logical AND operation on AX and BX, stores the result in CX

BRL		BRL AX


BRR


CALL NUM, REG


DBUG	dbug
 Enters into the kernel's built-in debugger.

DEC


FAR CALL


FAR RET


IN


IMOV MEM<REG


INC


INT NUM, REG


IRET


JMP


LMOV MEM<REG


MOV		MOV [AX], BX
 There are several different variations on the MOV instruction. Here, the contents of AX are 
 copied to the memory address stored in BX.
		MOV AX, [BX]
 In this example, the contents of the memory address in BX are copied to the register AX.
		MOV AX, 21452
 This would place the value 21452 in AX.
		MOV AX, BX
 This copies the contents of one register to another, in this case BX into AX.
 		MOV AX, &mainEventLoop
 Here, the address of a routine is copied into AX. This can be used with any routine you
 have defined in your program, just place an ampersand before its name in the MOV statement, 
 like above.
 		MOV AX, &myShortVariable
 This places the address of a variable created with the '#define:' directive in AX.

NOP


NOT


OR


OUT


POP


PUSH NUM, REG


RET


SIE


SIG


SIL


SISE


SISG


SISL


SUB


TEST


XOR