-
Notifications
You must be signed in to change notification settings - Fork 2
The wAx API
The following subroutines will be useful in the development of user plug-ins.
##Routine Addr2CP
Copy Working Address to Command Pointer
Call Address: $A027
Affected Registers: Accumulator
Description: Copies the Working Address, which is usually the current address for a wAx process, to the Command Pointer, which indicates the next default address.
##Routine: Buff2Byte
Get hexadecimal byte from input
Call Address: $A003
Affected Registers: Accumulator, X
Description: If the next two non-space characters in the input buffer represent a valid hexadecimal byte, the value is returned in the Accumulator and the Carry flag is set. Otherwise, the carry flag is clear.
##Routine: CharGet
Get character from input
Call Address: $A006
Affected Registers: Accumulator, X Description: Gets the next character from the input buffer. Spaces are not returned unless within quotes. Accumulator of 0 indicates end of input.
##Routine: CharOut
Add character to output
Call Address: $A009
Affected Registers: None
Description: Adds a character with PETSCII code in Accumulator to the output buffer. Note that the output buffer is not flushed to the screen until PrintBuff is called.
##Routine: Hex
Add hexadecimal byte to the output buffer
Call Address: $A00C
Affected Registers: Accumulator, X
Description: Adds the value in the accumulator to the output buffer as a two-character hexadecimal number. Note that the output buffer is not flushed to the screen until PrintBuff is called.
##Routine: IncAddr
Increment the working address
Call Address: $A00F
Affected Registers: Accumulator, X
Description: Sets Accumulator to the value of the working address, then increment the working address. The Accumulator will be the value of the address prior to the increment.
##Routine: IncCP
Increment the Command Pointer
Call Address: $A012
Affected Registers: None
Description: Increments the Command Pointer.
##Routine: Install
Start wAx
Call Address: $A000
Affected Registers: Accumulator, X, Y
Description: This is the jump to starting wAx with SYS 40960.
##Routine: Lookup
Get 6502 instruction data
Call Address: $A015
Affected Registers: Accumulator, X, Y
Description: Looks up a 6502 instruction with the opcode in the Accumulator. The Carry flag is set if it's a valid instruction. The instruction's addressing mode is returned in the Accumulator. The instruction's mnemonic is packed in zeropage locations $A4 and $A5, with five bits per letter in bits 0-14.
You may include "illegal" opcodes in the lookup by setting zeropage location $AF to value $2C in preparation for the call.
##Routine: PrintBuff
Flush output buffer to screen
Call Address: $A018
Affected Registers: Accumulator, Y
Description: Flushes the output buffer to the screen or output device, to a limit of 22 characters. The output buffer is terminated by $00. PrintBuff always ends with Reverse Off and Linefeed. Note that PrintBuff does not reset the buffer itself, so a new line should be started with ResetOut.
##Routine: ResetIn
jLookup: jmp Lookup ; a015 jPrintBuff: jmp PrintBuff ; a018 jResetIn: jmp ResetIn ; a01b jResetOut: jmp ResetOut ; a01e jShowAddr: jmp ShowAddr ; a021 jShowCP: jmp ShowCP ; a024 jEAtoCP: jmp EAtoCP ; a027 jPrintStr: jmp PrintStr ; a02a jNextList: jmp NextList ; a02d jDirectMode:jmp DirectMode ; a030 jSizeOf: jmp SizeOf ; a033