[Index] [Previous] [Next]

1.10 More Utility Functions

NextChar_tail

Jump back if we've got a space char, since we're not interested in spaces.
045E FE20 NextChar_tail CPI ' '
0460 CA1000 JZ NextChar
Set carry flag if char >= '0'.
0463 FE30 CPI '0'
0465 3F CMC
Test for null char without affecting carry flag.
0466 3C INR A
0467 3D DCR A
0468 C9 RET

 

Restore

Resets the data pointer to just before the start of the program.

0469 EB Restore XCHG
046A 2A6501 LHLD PROGRAM_BASE
046D 2B DCX H
046E 226D01 SHLD DATA_PROG_PTR
0471 EB XCHG
0472 C9 RET

 

TestBreakKey

Apparently the Altair had a 'break' key, to break program execution. This little function tests to see if the terminal input device is ready, and returns if it isn't. If it is ready (ie user has pressed a key) then it reads the char from the device, compares it to the code for the break key (0x03) and jumps to Stop. Since the first instruction at Stop is RNZ, this will return at once if the user pressed some other key.

0473 DB00 TestBreakKey IN 00 Exit if no key pressed.
0475 E601 ANI 01
0477 C0 RNZ
0478 CD8203 CALL InputChar
047B FE03 CPI 03 Break key?
047D C3F701 JMP Stop

 

CharIsAlpha

If character pointed to by HL is alphabetic, the carry flag is reset otherwise set.

0480 7E CharIsAlpha MOV A,M
0481 FE41 CPI 'A'
0483 D8 RC
0484 FE5B CPI 'Z'+1
0486 3F CMC
0487 C9 RET

 

GetSubscript

Gets the subscript of an array variable encountered in an expression or a DIM declaration. The subscript is returned as a positive integer in CDE.

0488 D7 GetSubscript RST NextChar
0489 CD8A06 CALL EvalExpression
If subscript is negative then jump to FC error below.
048C EF RST FTestSign
048D FA9804 JM FunctionCallError
Likewise, if subscript is >32767 then fall into FC error, otherwise exit to FAsInteger.
0490 3A7201 LDA FACCUM+3
0493 FE90 CPI 90
0495 DA770A JC FAsInteger
Invalid function call (FC) error..
0498 1E08 FunctionCallError MVI E,08
049A C3D501 JMP Error

 


[Index] [Previous] [Next]