[Index] [Previous] [Next]

1.12 Assigning Variables


Assigns a value to a variable.

First call GetVar. This returns the address of the variable's value in DE, allocating space for it if it doesn't already exist.
0502 CD1B07 Let CALL GetVar
Check that '=' follows the variable name.
0505 CF RST SyntaxCheck
0506 9D =



Assigns the result of the BASIC expression at HL to the variable pointed to by DE.

Preserve variable address on stack and get the variable value into FACCUM.
0507 D5 AssignVar PUSH D
0508 CD8A06 CALL EvalExpression
Swap (SP) and HL, so HL now holds the address of the variable's value and the program ptr is on the stack.
050B E3 XTHL
Store variable address in PROG_PTR_TEMP, don't know why.
Store FACCUM (the expression result) in the variable and get the variable value address into DE.
050F E5 PUSH H
0510 CD290A CALL FCopyToMem
0513 D1 POP D
Restore program ptr to HL and return.
0514 E1 POP H
0515 C9 RET


[Index] [Previous] [Next]