EasyManua.ls Logo

Husky Hunter - Page 133

Husky Hunter
499 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
BASIC PROGRAMMING
SECTION 4.8
4.8.4
VER.V09F
To set up outgoing data the ARG reserved word is used, format as
shown. The variable will be equated to the value in brackets.
A
= ARG(5)
will cause the NSCBOO internal registers C and E to be set up as
follows:-
C = 5
E = 0
The pair are set up as a 16 bit integer, hence:-
ARG ( 10*256+30)
causes:-
C
= 30 and:-
E
= 10 (decimal)
when CALL is executed.
These registers are used for compatibility with the CP/M style
system call structure.
To return data to Basic the program:-
1000 X
= CALL (addr)
causes the value of variable X to take on the value contained in
register A.
PASSING MULTIPLE VARIABLES
To pass more than one integer between a 'CALLed' program and
Basic the machine code linkage stack is used.
This is controlled in Basic by PllSH and POP. In the routine:-
1000 PUSH X,Y
1010 A
= CALL. (addr)
1020
Y = POP(1)
1030 X
= POP( 1)
The integer values of X and
Y are first placed on the stack and
made available to the called routine, and then removed by the
POP instruction back into their own variables.
PAGE 4 - 18