LS-DOS 6.3.1 for the Model 4 - BASIC/CMD Disassembled

Page Customization

Introduction/Summary

LS-DOS 6.3.1 BASIC/CMD Disassembly (Model 4)

BASIC/CMD is the Disk BASIC of LS-DOS 6.3.1H, 23076 bytes on the diskette and dated 1 July 1987. It is not one program but two linked load modules in one file, and nothing about the way it loads or runs makes sense until that is clear. The first module, which carries no module name record at all, is 83 load blocks filling 3000H to 82FFH without a gap: 21248 bytes of Microsoft's interpreter, licensed to Tandy, whose own sign-on names it BASIC 01.01.00 of Logical Systems, Inc. The second module, named NEWB by a 05H record at file offset 0544CH, is 1496 bytes: eight short patches laid over the first module, then a body of its own at 8048H to 8280H and 82A1H to 85D9H. The loaded extent of the pair is 3000H to 85D9H, 21978 distinct bytes with no gap, and the transfer address is 83ECH, which belongs to the second module. The first module's own transfer address, 8048H, was overwritten when the enhancement was installed, so the program that runs is the enhancement, and the interpreter is what it calls.

The installer is MAKBAS/CMD, and what it does explains the shape of the file. It opens NEWB/LMF, takes its transfer address, asks for the drive holding BASIC/CMD, checks that the last record of that file is a 02H transfer record of length two, reads the base's transfer address and refuses two cases by it: 7F0CH gives Enhancements require BASIC version 01.01.00 and NEWB's own address gives Enhancements already installed. Then it positions back to the transfer record and writes NEWB/LMF over it a byte at a time. So a BASIC/CMD with the package installed has no transfer record of its own left, which is why the release file's records run straight from the first module's last load block into the second module's name record.

Thirty-two bytes at 8281H to 82A0H are the one place in the span where the two modules do not meet. NEWB/ASM declares them as a file control block and a buffer and the load module does not carry them, so the first module's bytes stay in memory there and the enhancement writes over them when it loads BASIC/OV2. The rows for those bytes on this page are the first module's, and they say so.

Two further files belong to the same program and have pages of their own. BASIC/OV1 is the arithmetic package, and it is resident the whole time BASIC runs rather than loaded for one job: eighteen of the twenty words at 6B53H to 6B7AH of the first module point into it, the two that do not being the 0000H at 6B55H, which is the slot of a type that does not exist, and the integer comparison at 6B77H, which is module 1's own, and so do the statement address table's entries for TAB( at 28FBH, STEP at 2AF5H, USR at 28E6H and ERL at 2746H. The interpreter cannot evaluate an expression without it, which is why 7F1FH exists to read it back and why Can't load BASIC/OV1 stands at 7F3CH. BASIC/OV2 is the MOVE, COPY and FIND overlay, a core image loaded flat at 1E00H in the DOS overlay area.

Every byte of BASIC/CMD is on this page. The file is 21978 bytes and the page shows all of them, each on exactly one row and each checked against the release file. It was built in nine passes between 23 and 25 November 2026, the parts written in the order the page most needed them rather than in address order, and the last of them was module 1's own variable area at 6E76H, which could not be written until the number package and the tokenizer had been read and their cells named. The 234 branches of the page that are not links are every one of them into BASIC/OV1 or BASIC/OV2, which have pages of their own still to come; nothing of BASIC/CMD branches to an address of BASIC/CMD without a row.

Notes

Where the program starts, and the three loops it runs in. Nothing of this file begins at 3000H, which is why the disassembly below does not read like a utility's. The DOS transfers to 83ECH, BEGIN, at the very top of the image, because the transfer address belongs to module 2; module 1's own transfer address was 8048H and MAKBAS wrote the package over it. BEGIN lays out memory and ends by reaching STARTUP 8028H, the last code of module 1, which clears the variables, and then either jumps to READY 5920H when the DOS command line named no program, or plants a quote and jumps to 4C20H, LOAD's second entry, so that BASIC PROG/BAS loads and runs it. From READY the interpreter sits in three loops, not one. Command level 593BH is the outer one: it sets the line number to 0FFFFH, which is what marks direct mode everywhere, and reads a line, either through the AUTO prompt or through the enhancement's IMMED 80B8H, which the patch at 5990H puts in the way so that a single keystroke can be a command. The keyboard line reader at 7E11H is the middle one, and it is where IMBACK 7E2AH stands. The statement loop 5E3BH is the inner one and is the interpreter's real command processor: it is what reads a statement token, takes the routine's address out of the table at 67C3H, and is pushed as every statement routine's return address. A line entered or typed goes from 598DH to 3F03H, which either files it in the program text or runs it.

Module 1 cannot be run without the enhancement installed, and READY is where that is settled. 5930H calls 8048H with Register Pair HL at the Ready text, and 8048H is the one block of module 1 the package is certain to occupy. In the unenhanced base, basic62.cmd, 8048H is module 1's own start-up behind a once-only flag at 8217H: the first entry runs the start-up and sets the flag, and every entry after it issues @ABORT. That call at 5930H is the only instruction in the whole of basic62.cmd that names 8048H besides its transfer record, so the base on its own cannot reach a second Ready prompt. In the release the package stands there and the call lands on SVCUSR, which reads a character of the Ready text, finds that the USR number at 7149H is not 11, and jumps to 773AH, module 1's own USR dispatch, which with Register Pair BC at 0000H works an address out into Register Pair DE and returns with nothing changed. So the call is harmless where the package is installed and fatal where it is not. The Ready text is written by 41D8H, not by that call.

The statement dispatcher settles how every statement routine is written. The statement loop runs at 5E3BH. It checks for BREAK, saves the text pointer into 718CH and the Stack Pointer into 718EH, reads the character at the pointer, and at the end of a line steps the two link bytes and takes the next line's number into 6E9CH. Then it calls NXTCHAR at 5E93H, pushes 5E3BH as the return address, subtracts 81H from the statement token, doubles it, takes the word out of the table at 67C3H, pushes it and falls into NXTCHAR at 5E93H, whose RET enters the statement routine. So every statement routine is entered with Register Pair HL at the character after the token, Register A holding that character, the Zero Flag set when the statement has ended there, and 5E3BH on the stack. Tokens 0CEH and above are refused at 7912H with one exception: 0FFH followed by 83H goes to 49CAH, the only two byte statement token in the interpreter.

The two dispatch tables, and where one of them ends. The statement address table at 67C3H is 77 words for tokens 081H to 0CDH and it ends at 685CH. The 51 words from 685DH to 68C2H are a second table, the function table, one word for each function token from 01H to 33H in token order, and 766AH to 7672H is what reads it: Register Pair HL arrives holding twice the token less two, 685DH is added, and the word there is jumped to. Every one of its 51 entries is a real code address and every token the reserved word table leaves without a keyword, 20H to 29H, holds 0000H. Thirty-one of the entries point into BASIC/OV1 at 2600H to 2FFFH, which is the arithmetic package, and that settles what the overlay is for from the other end. The two tables together also correct something the project had recorded wrongly: the four addresses 28FBH, 2AF5H, 28E6H and 2746H were taken for the statement table's entries for TAB(, STEP, USR and ERL, but those four tokens are 0D1H, 0D2H, 0D3H and 0D7H, which stand above the statement table's last token, and the four addresses are in fact the function table's entries for SGN, INT, ABS and LOG. The statement table holds no entry for any token above 0CDH, and 7912H is what refuses them. The first letter table at 68C3H is read at 5B90H, the operator precedence table at 6B47H at 7378H, and the 20 words from 6B53H to 6B7AH are read at 78E0H and 744AH, which index them by two different values.

The statement routines are reached through that table and almost nothing else. For every routine written so far, no instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 names the routine's address and no word of any of the four images holds it, apart from the table's own entry and a handful of internal calls. The addresses on this page were fixed from the table in the first place, by correlating all 77 of its words: CLEAR holds 447EH and RENUM holds 658EH, the two addresses NEWB/EQU names; the four DEF type statements stand three bytes apart; DATA and COMMON share 6065H and REM and ELSE share 6067H; and every token the reserved word table does not use holds 0000H.

Forty entry points in this file stand inside another instruction, and a decoder reading straight through shows none of them. Nineteen are in the two error chains, where each three byte `LD BC,nn1EH` carries the next entry's own `LD E,nn` in its operand: thirteen in the disk chain at 583BH and eight in the ordinary chain at 586CH. Three more are the type declarations, DEFINT at 5F4CH, DEFSNG at 5F4FH and DEFDBL at 5F52H, folded into DEFSTR at 5F49H the same way. The rest stand one at a time. TROFF at 43F1H is the operand byte of TRON's LD A at 43F0H; NEXT's second entry at 4529H is the operand byte of the OR at 4528H, which FOR jumps to; LOAD's own entry at 4C21H and its second at 4C43H are both operand bytes, as are GET at 4FC7H, LSET at 4E1FH, DATE$ at 7EB0H, and 5087H in the byte reader, whose LD B at 5086H carries the OR A that reports a byte read. 591FH, which END jumps to from 43BEH, is the operand byte of the LD A at 591EH, and 4683H, which 78B6H calls, is the operand byte of the LD A at 4682H. 4397H, which INPUT and LINE INPUT both jump to for a BREAK, is the operand of a LD HL at 4396H. The string code adds six of its own, and in two places a whole family of entries is folded into one line of instructions: 46BFH, where the string space collection returns, is the operand byte of the LD C at 46BEH; 48BFH, which 40B2H calls, is the operand of the LD A at 48BEH and pushes the descriptor one extra time so that an ordinary caller is returned to; 48C7H, which a substring request larger than the string reaches, is a LD C,00H inside the operand of a LD DE whose own value is read by nothing; and the six functions that convert between numbers and the bytes a random file holds carry four entries this way, MKS$ at 4ACAH and MKD$ at 4ACDH inside two LD BC instructions at 4AC9H and 4ACCH, and CVS at 4AE3H and CVD at 4AE6H inside two more at 4AE2H and 4AE5H. A tenth stands in a part not yet written: HEX$ at 368EH is the operand of a JP NZ at 368DH that the XOR A before it makes unreachable, which is how OCT$ and HEX$ share one routine. One goes the other way about: the DERR table at 529CH begins inside the operand of a JP, so there the data is overlapped on the instruction rather than the entry point. The rule the project works by is that nothing is called unreachable without an index of every word reference across all four images and a scan of every relative jump in them.

Three bytes in module 1 are self-modified operands, and each has a row saying so. 500DH is the operand of the LD A at 500CH and is PUT and GET's record number flag, cleared at 4FCCH and set to 0FFH at 4FE9H. KILL writes the drive into the operand at 5257H and the directory entry code into the one at 525CH, so that no register has to carry them through the walk of the open files. Module 2 has thirteen more of its own, all 00H or 0000H in the file.

The byte after every CALL 4353H is data. That routine compares the character the text pointer stands on with the byte standing after the call that reached it, gives Syntax error when they differ, and steps its own return address past that byte. The ones on this page are at 440CH, 4495H, 44B8H, 4D31H, 4DECH, 4DF0H, 538DH, 5738H and 7933H, and each is an @B row with a DEFB. A decoder reading straight through shows a comma as INC L.

Two blocks of module 1 are unreachable because the enhancement was installed, and neither is a fault of the interpreter. 4C97H is module 1's own EX DE,HL in LOAD, passed over because the patch at 4C91H ends with a JP to 4C98H, FASTLD having left the end of the program in Register Pair HL already. 4D7CH to 4D84H is module 1's byte at a time write loop for a tokenized program, whose end test stood at 4D76H, which is where the FASTSAV patch goes: nothing reaches any of its nine bytes.

Error numbers are mapped onto the message block before it is indexed, which is what makes the block's fifty one texts cover errors 1 to 30 and 50 to 70. The handler at 5886H takes the number in Register E; 58DFH to 58F0H leaves a number below 31 alone, takes 19 off a number from 50 to 70 so that it lands on texts 31 to 51, and sends everything else to text 21, Unprintable error. The two error chains ask for both ranges: 586CH holds the ordinary errors and 583BH the fourteen disk errors, of which the two highest, Disk full at 583BH and Device I/O error at 583EH, are reached by nothing because DERR's own table answers with those two numbers directly. The DERR table at 529FH, which turns DOS codes into BASIC error numbers, is a complete second proof of the mapping: every one of its 43 entries lands on exactly the text the DOS code deserves.

File number 0 is BASIC's own. The control block at the head of the table at 6EAEH is reached by the file lookup with Register A at 00H, and OPEN refuses that number at 5118H with error 52. KILL borrows it to open the file it is to remove, reads the drive and the directory entry code the open filled in, and clears its mode byte again at 527EH.

How a variable is found, and the one byte that decides what happens when it is not. 39FBH is the routine nineteen of the statements left and all three of CHAIN's COMMON walks turn on, and everything about it follows from the shape of an entry: the type as a count of bytes, the first character, the second, the length of the rest of the name, that rest, then the value. Three bytes carry the whole of a one or two character name, which is why those names cost nothing extra, and the search compares the first character, then the type, then the second, so that A% and A! are two variables and not one. A name may run to forty characters and the characters past the second live at 6ED0H with their high bits set until an entry is made for them. Not found, the routine looks at its own return address to decide what to do next, which is the thing about it most worth seeing: 3AE8H is a CALL 39FBH and a RET and nothing else, so a caller that comes through it leaves the address 3AEBH on the stack, 3AF4H recognises that address, and the answer is Register Pair DE of 0000H rather than a variable made. CALL, SWAP and ERASE all want that; LET and READ do not, and for them the whole array table is moved up by 4237H to let a new entry in. A second caller, 758AH, is recognised the same way and given a zero accumulator instead, a string getting the address of 732CH, the 00H that ends the text at 7328H, which serves as a string of no characters.

Four entry points that stand inside another instruction. The variable search and the array code hold four of them, more than the rest of the file together, and each one saves the two or three bytes a jump would have cost. 39FBH, the entry every caller but DIM uses, is the operand byte of the OR 0AFH at 39FAH and executes as XOR A, so the two entries differ only in what they leave in 7141H. 3BE6H, the array table search, is reached from 3A7EH as itself and fallen into at 3BE8H by the subscript code, whose LD DE,0F5E5H at 3BE5H exists to step over the PUSH HL and PUSH AF that the other entry needs and this path has done for itself; the Register Pair DE it spoils is loaded again at 3BEDH before anything reads it. 3BECH is the ADD HL,DE the table walk comes back to, hidden in the operand of a LD A,19H so that the first turn of the loop does not advance and every later one does, and 3CA8H is a POP HL hidden the same way in a LD D,0E1H, stepped over on the first turn of the element arithmetic because nothing has been put on the stack to pop yet. Neither the 19H nor the 0E1H is ever read.

Where an array's elements lie, and what the bounds mean. An array's entry carries the four bytes of a simple variable's, then the name's tail, then a word of its own whole length, which is what makes the table walk a single ADD HL,DE, then the count of dimensions, then one word for each dimension, then the elements. Each bound word is a count of elements and not the highest subscript, which is why 3C6DH adds one to the number the user wrote and why a subscript is refused at 3CB2H when it reaches the bound rather than when it passes it. The bounds are stored in the reverse of the order they were written, because the stack gives the subscripts back last first, and the element arithmetic takes them off in that same order, so that the first subscript is the one that varies fastest in memory. The multiply by the element size at 3CBFH is six instructions for all four types and picks the three byte string descriptor out with the Parity Flag: a type of 03H leaves 0FFH in Register A, whose eight set bits give even parity, and that is the one case that adds the index in a second time to make three. An array that was never dimensioned takes its bounds from the XOR 0BH at 3C64H instead, which turns an OPTION BASE of 0 into eleven elements and one of 1 into ten, the same ten usable subscripts either way. A negative subscript never reaches any of this: 5F8EH raises Illegal function call for one itself.

INPUT reads everything twice, and that is why nothing is assigned until the whole reply is good. The first pass, 6419H to 6498H, walks the variable list and the typed line together: each name is parsed by the search through 3AE8H, which makes no variable and answers Register Pair DE of 0000H, a subscript list is stepped over by counting brackets rather than evaluated, and each typed item is taken by the collector at 64BFH and thrown away. Only when both lists end together does 6499H put the leading comma back and run the whole thing again at 64A2H, this time with destinations. So ?Redo from start always leaves every variable the statement names holding exactly what it held.

INPUT and READ are one routine, and two instruction operands are the switch. OR 0AFH at 64A1H puts a value with bit 7 set into Register A and its operand byte at 64A2H executes as XOR A, and the store below writes whichever into 7183H: that one byte is READ or INPUT for the rest of the statement, read at 64B7H, 64D8H, 651DH and 63A6H. Fourteen bytes further on the same shape appears again, OR 0AFH at 64BEH setting 7299H and its operand at 64BFH clearing it, which is the switch between assigning the item and throwing it away. A third stands in BASIC/OV1, where 2F16H is the operand of an OR 0AFH at 2F15H, and 6503H and 6506H enter the conversion at the two addresses to say whether double precision is wanted.

A bad reply is reported and counted, not raised. Three cells do it. 6468H sets 6EA7H for the one call of the collector, and with it set the number conversion writes Overflow out of 6BD1H and raises 72F1H by one at 75F4H instead of reaching error 6 at 587EH or the Syntax error at 586CH. 2F22H of BASIC/OV1 puts 01H into 72F1H before a digit is read, 67B4H hands the count over into 72F2H and clears 72F1H, and 6478H takes one off it: a count of 01H means nothing complained. A string item never reaches the conversion and never reaches 67B4H, which is why 6465H puts that same 01H into 72F2H first.

READ names the DATA statement's line and not its own. 653DH is the only instruction in the loaded image that writes the word at 7180H, and it writes it with the number of the line the DATA hunt has just moved to. 5866H is the error entry that reads it, and 63AAH is what sends a READ there, so a DATA item that will not parse is reported against the line it stands on rather than the line the READ is on. For an INPUT the same test falls through to ?Redo from start instead.

How an expression is worked out, and the one comparison that is the whole of precedence. 7345H and 74C1H are the two halves of it: 74C1H reads one term and 7345H reads the operators between terms. A precedence is carried in Register D, taken from the twelve byte table at 6B47H, and the loop at 7358H ends on a single RET NC at 7381H whenever the operator it has just met does not bind tighter than the one its caller is holding. That is all there is to it: the caller applies its own operator and comes back for this one. An operator that does win pushes the value in hand two, four or eight bytes at a time by its type, pushes the type and the operator's number, pushes 741CH, and jumps back into 7348H to work out what is to the right of it, so the evaluator is recursive through one jump at 73C9H. Twenty-four instructions of the file call 7345H, and nineteen branches of this page that had no link until this pass reached it do.

The three operator tables at 6B5DH close the last question the keyword and table region held open. They are three tables of five words, one for a pair of double precision numbers, one for a pair of single precision ones and one for a pair of integers, and the five slots are the plus, the minus, the asterisk, the oblique stroke and the comparison. The fifth slot is free for the comparison because the up arrow, which would have been the fifth operator, is taken out of the line at 7388H before any table is reached, and 7405H loads its number of 04H outright for every one of the six relational operators. The wider type wins, which is the ladder at 7432H, and the shuffling at 745AH, 7481H, 7497H and 749EH is there because the three kinds of routine want their operands in three different places: an integer routine in Register Pair HL and Register Pair DE, a single precision one in the accumulator and Register Pair BC and Register Pair DE, a double precision one in the accumulator and the second accumulator at 72F5H. The one word of the nine arithmetic slots that names module 1 and not the overlay is the integer oblique stroke, 74B2H, because dividing two integers in this BASIC gives a single precision answer.

A comparison answers in Register A and in the Carry Flag together, and 7683H reads both. The four comparison routines give 0FFH with the Carry Flag set when the left hand operand is the greater, 00H with it clear when the two are equal and 01H with it clear when the left is the smaller. The INC A at 7683H is chosen because it changes no flag, so the ADC A,A after it folds the two halves of the answer into 01H, 02H or 04H, which are exactly the three bits 73D6H built its mask out of when it gathered the relational tokens. One AND against that mask then says whether what happened is what the program asked for. The mask is why >= and <> need no tokens of their own and why >> is Syntax error: 73DAH refuses a bit that was already set.

Every one of the fifty-one functions is reached from 7628H and from nowhere else. The tokenizer writes a function as 0FFH and then its own token raised by 80H, so the single INC A at 74D5H catches all of them and nothing of the term reader's ladder of twenty-one comparisons is spent on any function that takes an argument. 7628H splits on the doubled token: below 05H are LEFT$, RIGHT$ and MID$, whose first argument is a string and whose second is a byte and which take their text pointer out of Register Pair DE, and 05H and above are the functions of one argument, which are given 7585H as a return address and have their argument made a single precision number when the doubled token is below 1BH, which is the eight transcendentals.

A call of a function the program defined is the heaviest thing the interpreter does. 778AH works out each argument from the caller's text while reading each parameter's name from the definition's text, keeping the two pointers in 7199H and 717AH, and it does it in two passes. The first builds a frame on the stack of twelve bytes for each parameter, the second takes that frame apart and copies each parameter's whole table entry into the hundred byte save area at 722DH before assigning the argument to it through LET's own 60ACH. Only then does 7855H put the saved entries down at 71C5H as the call's own local variables and raise the flag at 7294H that makes the variable search walk them first. The nesting is a chain down the stack: each saved block begins with the two words at 71C1H and 71C3H, so its first word is where the block below it lies and its second is that block's length, which is what 78BFH reads to put it back. The two text demands at 77F8H and 784FH are what make the counts of arguments and parameters agree, one catching a call with too many and the other a call with too few.

An &H or &O constant guards against a value too large in two quite different ways. 75B7H counts digits, Register B starting at 05H so that a fifth hexadecimal digit falls out of the loop into the complaint at 75DFH; the octal loop watches the shifting instead, pushing 75DFH as a return address at 7612H so that any one of its three ADD HL,HL instructions can answer to it on the Carry Flag. An ampersand with digits and no letter after it is octal, which 7603H arranges by stepping the text pointer back so that the digit is read again.

Every character the interpreter writes goes through one routine, and it chooses between three destinations in its first eight bytes. 40D8H is called from thirty-one instructions of module 1, and the string writers at 46A5H and 7A04H and the line feed routine at 4212H all end there. A file takes the character when FILEX 6E98H is not 0000H, which 40D9H tests and 4F8CH takes over; the printer takes it when the flag at 6E92H is set; and the display takes it at 4152H, which is almost always. The two paths are not the same length, and the reason is the column: the display gives its column back, 7D7FH writing the character with the display supervisor call and then asking the video driver where the cursor stands, which it keeps in 713CH, while the printer's column has to be counted by hand at 6E91H, a backspace taking one off it, a tab turned into spaces to the next multiple of eight, a carriage return putting it back to nought and the width at 6E94H wrapping the line. A column of 0FFH is the signal to stop counting, which is how output is let run past a width that was never set.

EDIT dispatches on the key less 30H, because the digit reader above it has already subtracted that. 3D68H takes 30H off the key so that 3D6CH can test for a digit of the repeat count in one comparison, and the fourteen comparisons of the dispatch at 3D85H are all made against what is left: 0D8H for the backspace 08H, 0DDH for ENTER 0DH, 0F0H for the space 20H, and the eleven letters as their capital less 30H, A 11H, C 13H, D 14H, E 15H, H 18H, I 19H, K 1BH, L 1CH, Q 21H, S 23H and X 28H. Two things in the dispatch do nothing. The lowercase fold at 3D97H can never act on a key that names a command, 7598H having folded the case already, and the only keys that reach it are 7BH and above, which name none either way. And the comparison at 3E76H in the insert loop repeats the one at 3E72H, so its jump can never be taken and 3E96H is reached only by falling into it from 3E94H: four bytes that do nothing, and which second key was meant to delete a character cannot be told from the bytes. Neither is numbered as a bug, the instructions at 3E96H working perfectly well for the one path that does reach them.

EDIT cannot run with BASIC/OV1 out of memory, and the proof is two bytes. The deletion at 3EA3H ends by jumping to 27DBH of the overlay, which is a POP HL and a RET, so the editor reaches the arithmetic package for nothing more than a stack adjustment and a return. It is the plainest instance on this page of the dependence 7F1FH exists to repair, and it costs the overlay no arithmetic at all.

PRINT USING hides two entry points in instruction operands and carries a jump that can never be taken. 3FAFH is the operand byte of the CP 0AFH at 3FAEH and stands as an XOR A, which is how one dollar sign adds 10H to the format mask where a dollar after two asterisks adds 30H. 4095H is the operand byte of the LD A,0F1H at 4094H and stands as a POP AF, which is the one instruction the backslash field needs and the ampersand and the exclamation mark do not, because 3F46H pushed a pointer they never pushed. And 4001H is a JP Z,0D1EBH whose two operand bytes are the EX DE,HL at 4002H and the POP DE at 4003H that the five conditional returns of the exponent test come back to. The jump is safe because Register D is a mask of six bits, 01H an exponent, 04H a trailing sign, 08H a leading plus, 10H a floating dollar, 20H asterisk fill and 40H commas: nothing sets 02H or 80H, so Register D cannot exceed 7DH and the INC D above the jump cannot carry it to 00H.

PRINT USING keeps three words on the stack and no pointer into the string space. The descriptor address of the format string, a flag word whose Zero Flag says the item list has ended and whose Carry Flag says a carriage return is owed, and the text pointer: those three are pushed at 3F30H, 3F36H and 3F37H and rebuilt at 4058H after every item. The format pointer itself is worked out afresh each time at 405BH to 4065H, from the string's length less the characters still unread added to its text address, which is exactly what a statement must do when the evaluation of its own item can collect the string space and move the format string under it. The separator each item ended with is kept in 7183H, the byte INPUT and READ use for their own flag, written at 4046H and read at 3F28H; the Carry Flag set at 4043H and cleared by NXTCHAR after a separator is what makes a trailing semicolon or comma hold the display on the same line.

A hundred bytes of module 1 cannot be reached, which is the largest such run in the file. 7C71H to 7CD4H holds 00H throughout, and nothing in the release can read it: no instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 names any address in it, no relative jump of the four images reaches one, and every word of the images that matches one of them turns out to be a pair of bytes straddling two instructions, among them the RET at 434CH and two entries of the precedence table at 6B48H. It stands immediately above the three flag pointers at 7C6BH, which are the last thing before it that anything does read. Four smaller runs of the same kind have been found, the control key echo at 43C1H, the thirteen bytes at 419DH, the nine at 7E08H and the eight at 7D55H, and the five instructions at 75A1H.

BASIC clears a bit of the DOS keyboard flag that the flag has no bit for, and leaves alone the one the DOS's own library clears. The two masks the pause and BREAK handler uses, 0F4H at 7D16H and 0F5H at 7D33H, both clear bit 3 of KFLAG$ 0074H, where the flag byte's documented layout is bit 0 BREAK, bit 1 pause, bit 2 ENTER, bit 5 CAPS and bit 7 type-ahead not empty, and bit 3 is not among them. Neither mask clears bit 2, ENTER, where the DOS's own library routine RESKFL clears bits 1 and 2. So a pending ENTER survives every pause and every BREAK the interpreter handles, which the line reader does not mind because it goes through @KEYIN, and whatever bit 3 may mean to a driver is cleared by a BASIC program that is paused or broken into. What the masks were meant to be cannot be told from the bytes: 0F8H and 0F9H would clear bits 0 to 2 and bits 1 to 2 as the library does.

The overlay loader reads its filespec out of the middle of its own error message. 7F1FH loads Register Pair HL with 7F47H and copies characters into INBUF until it has copied a 0DH, and 7F47H is the twelfth character of the text at 7F3CH: Can't load is eleven characters and BASIC/OV1 the nine after them, with the 0DH at 7F50H ending both the name and the line. So the nine characters of the filename and the ender serve twice, once as the tail of the message @DSPLY writes when the load fails and once as the filespec @LOAD is given, and a change to either costs the other.

One routine of this file is written across the join between two modules, and the file that holds its head does not hold its tail. BASIC/OV1 is loaded at 2600H and its last byte is 2FFFH, which is the byte immediately below module 1's first. The routine that divides the value in the accumulator by ten and counts the division begins at 2FF9H in the overlay, reaches 2FFFH with a PUSH AF, and its next instruction is the CALL PO at 3000H, which is module 1's. The twelve bytes at 3000H to 300BH therefore belong to BASIC/OV1 and are shown here because this is the file they are loaded from; the page gives them a section of their own that says so.

The type test gives its callers four answers and not the three its own section describes, and the fourth is a parity bit. The OR A at 76ADH and the one at 76B2H leave the Parity Flag holding the parity of the type less three, which is 01H for a single precision value, one bit and odd, and 05H for a double precision one, two bits and even. Four instructions read it, and they are the only way anything in either file tells single from double in one test: 3000H and 3004H of the division above, and 2FEFH and 2FF3H of the multiplication that stands beside it in the overlay. Nothing reads the parity of an integer or a string, whose 0FFH and 00H are both even.

Overflow and Division by zero are warnings in this interpreter and not errors, and a program can only trap them by asking to. Every one of the eight entries at 308EH to 30BCH writes its message, sets the value to the largest number of its own type from the constants at 3129H and 312DH, and returns to the arithmetic that complained, so a program that overflows carries on. The count at 30CFH is what keeps the message from appearing forty times in one expression: it is written once and then once more, and a third warning is silent. Only when ON ERROR GOTO has put a line number in 7196H does the complaint become an error, 311EH giving error 6 and 3121H error 11, and then no message is written at all and the program's own handler sees it instead.

FIND sets the Carry Flag for an exact match and nothing else, and the address it gives back when there is no match is what makes it worth calling twice. 5AB4H answers with Register Pair BC holding the line's own address and the Carry Flag set when a line of exactly the number asked for exists, and with the Carry Flag clear and Register Pair BC addressing the first line whose number stands above it when none does, which is where a line of that number would be inserted. One convention therefore serves a GOTO looking for a line, a RENUM asking whether a new number would fall out of order, a DELETE marking the ends of a range and the entry of a typed line into the program text.

A single or double precision number is written out twice, and the second time is the one the user sees. 31CDH saves the whole of the value, clears the flag at 72F3H and calls 3269H, which lays the number out with one digit in front of the decimal point and an exponent after it. 31E4H then reads its own output back, scanning the text for the letter E and then for the letter D, and a text with neither is the finished answer, because the first pass writes an exponent only where the fixed form would not fit: 3285H and 3289H take the fixed form only when the decimal exponent 3496H worked out lies between minus the count of significant digits and nothing. A text with a marker has the exponent read back into Register B at 3214H, the count of digit characters added to it, and if the sum is below 09H for a single precision number or 12H, eighteen, for a double, 3242H sets 72F3H to 80H and the whole number is written again, this time with 327FH forcing the form with no exponent. The two thresholds are the width in characters the fixed form would need; a number wider than that keeps the exponential text the first pass made. Register B of 03H at 3274H is the exponential form's own layout, one digit in front of the point, because 352CH and the first call of 353EH each take one off it before any digit is written and the second brings it to nothing and writes the point.

GO TO with one space is a reserved word in its own right, and that is why the special case at 5B43H reads as though it only works for GO SUB. The reserved word list for the letter G holds four entries and the second of them is O TO with a space in the middle, token 89H, the same token as GOTO, so the ordinary table lookup at 5B90H finds the one space form without any help. What the special case is for is the two spellings the table cannot hold: the matcher at 5B74H skips no spaces at all and a table entry is one fixed spelling, so GO SUB with one space and GO TO with two or more reach their tokens only there. The shape follows from NXTCHAR: 5B53H matches the three characters GO and a space and leaves the pointer on the character after the space, and the call of NXTCHAR at 5B58H begins with an INC HL, so one more character is stepped over before the second pattern is tried. For GO SUB that character is the S and the pattern UB matches; for GO TO it is the second space and TO matches; and for GO TO the T is stepped over, both patterns fail against the O, and 5B8BH hands the line to the general table, where the O TO entry is waiting.

Twelve bytes of constants in the trigonometric block are reached by nothing at all. 3968H to 396FH is one over two pi in the eight byte double precision form, of which 396CH to 396FH is the top four bytes and so the single precision constant of the same value, exactly as the 0.5 at 3625H and 3629H is one constant read at two widths; and 3974H to 3977H is 0.25. No instruction of BASIC/CMD, BASIC/OV1 or BASIC/OV2 names 3968H, 396CH or 3974H, the word search and the relative jump scan both being silent for all three, and SIN carries the same two values in its own instructions instead, one over two pi as Register Pair BC of 7E22H and Register Pair DE of 0F983H at 3906H and a quarter as Register Pair BC of 7F00H at 391AH and again at 393EH. This interpreter has no double precision transcendental functions at all, which is what makes the double precision copy dead rather than waiting for one. 3970H, the quarter turn, is the one constant of the four that is used, by 38EAH of COS and by 39C4H of ATN.

A byte of 80H or more in the code part of a line is dropped by the tokenizer and not copied. 5B35H tests the character's bit 7 and 5B36H goes back to the top of the copying loop with the increment at 5B34H left standing, so the byte is stepped over and never reaches the line buffer. No line from the keyboard can hold such a byte, and a line read out of a text file by the reader at 7E42H can: 7E5DH keeps every byte of 20H or more and filters only the control characters. A byte of 80H or more inside a string literal or after a REM is safe, those being copied without being read by the loop at 5B22H, so what the drop reaches is a graphics or high code character standing where an instruction should be, which is junk in any case. It is recorded here because the page says in several places that the tokenizer copies what it does not recognise, and this is the one byte it does neither.

The five bytes at 75A1H cannot be reached, and the tokenizer is the reason. Pass 42 proved the run unreachable by an instruction scan, a relative jump scan and a word search, and left it unnumbered because both of its instructions would work if anything arrived at them. What reaches 75A6H, just below it, is 5CF6H of the tokenizer, and the two instructions at 75A1H are a CP 26H and a JP NZ,5FA4H which test for the ampersand the caller has already tested for itself at 5CDCH. So the run is the head of a routine whose one caller enters it one test late, which is a different thing from dead code that was never finished.

A protected program is hidden with the coefficients of the sine and the arctangent. SAVE "name",P reaches 5759H, which calls the scrambler at 5770H, writes the file with 0FEH as its first byte and then calls the unscrambler at 57A7H to put the text in memory back. The scrambler rewrites every byte of the program text in place, taking Register B off it, exclusive oring two key bytes into it and adding Register C, and the two key bytes are read out of the floating point coefficient tables of the transcendental functions: one from 39C8H plus Register C, which is the arctangent series, and one from 3978H plus Register B, which is the sine series. Register B counts down from thirteen and Register C from eleven, both of them for every byte, so the pattern they make together runs a hundred and forty-three bytes before it repeats. There is no key anywhere in the file: the numbers that work out a sine are the numbers that hide a program, and LOAD calls the same unscrambler at 4C9FH when it meets the 0FEH. The guards at 57DFH and 57E8H are the whole of the protection after that, and nine places call them.

A line entered into the program loses exactly one blank, and LIST puts exactly one back. 59B5H calls the trimmer at 5D4AH, which steps the pointer back over the blanks, tabs and line feeds that stand between the number and the statement and leaves it on the first of them, and 59BBH then steps one past it when that first one is a blank. So 10 PRINT is stored with two blanks and LIST, which writes a blank after the number at 79F1H, gives back the three that were typed. A tab is not a blank, so 10<tab>PRINT keeps its tab, and 79EDH is where LIST sees it and writes no blank at all: that is why the trimmer tests 09H and 0AH as well as 20H.

UNTOKE puts three spellings back as the characters they were typed as. The detokeniser at 7A0DH walks the whole reserved word table at 68F7H from its first byte for every keyword, counting the 00H bytes that end the groups to recover the first letter, which is why no index from a token to its word exists anywhere in the file. Three keywords need more than that. The apostrophe is stored as a colon, the REM token and token 0DCH, and 7A97H reads the four characters it has just written backwards to find the colon, the R, the E and the M, backs the buffer up over them and gives the four bytes of room back. ELSE is stored with a colon in front of it, which 7AE7H takes away again. And WHILE is stored as two bytes, the WHILE token and the plus token 0F3H, the second of which 7AEDH swallows.

CHAIN marks the variables it keeps with the one bit the search cannot match. Without ALL, 5486H walks the whole program text for COMMON statements and 550AH sets bit 7 of the second character of each named entry. Register B carries a name's second character with its high bit clear, so a marked entry is invisible to the ordinary search while the mark is on, and the two passes at 5553H and 55A3H take the mark off every entry and throw away the ones that never carried it. Then 55CBH and 55E7H, which the ALL path jumps straight to, copy into string space every string whose characters still lie in the program text, because the text is about to be read over; and 5640H moves the whole of the variables up against the bottom of the string area, keeping their length in 7295H and the old HIPT in 72C7H, so that 56C0H can copy them back down above the program that has been loaded.

Five runs of module 1 are reached by nothing, and the variable area holds fifty-one bytes more. The code runs are 57F2H to 57F5H, four bytes whose own alignment cannot be settled; 5821H to 5826H, six bytes that would have cut the stack back and gone to Ready; 583BH to 5840H, the two highest entries of the disk error chain; 56F8H to 56FAH, a jump to the statement skipper at the top of CHAIN; and 4F8BH, one byte that with the byte after it would have been an entry to the file output that takes a pointer back as well as the character. Each was proved three ways, by the instruction scan, by a scan of every relative jump of the three images and by a word search whose every hit was decoded, which is how the apparent hit on 57F2H at 394FH was shown to be the operand bytes of a JP P. The bytes of the variable area that nothing names are marked on their own rows, the largest run of them being the thirty at 72A7H.

Against the manual

The manual lists Overflow and Division by zero among its error messages and does not say that either of them stops a program, and the bytes show why it does not. Both are raised by the eight entries at 308EH to 30BCH, which write the message and go on with the largest number the type will hold, so PRINT 1E30*1E30 writes the warning and then writes 1.70141E+38. The manual's own numbering is borne out exactly: the text at 6BD1H is the sixth of the error block's fifty-one and the one at 6C2AH the eleventh, and 311EH and 3121H enter the error chain at 587EH and 586FH, which carry 06H and 0BH in their operand bytes.

The LDOS and LSDOS BASIC Reference Manual's syntax tables settle what its prose does not, and they have earned their keep on every statement written so far. CLEAR's table gives two forms, CLEAR [exp] for version 5 and CLEAR [,mem][,stack] for version 6; the code takes both and a third besides, an expression followed by both commas. What the manual calls the default of 512 bytes or an eighth of the available memory is the stack, not the string space, and 7153H is the top of the program and variable space, so what lies between it and BASEND 6E9AH is what CLEAR's third argument sizes.

Version 6's one NEXT for each FOR is enforced by the frame itself. The forward scan at 6714H finds the matching NEXT when the FOR statement runs and puts its text pointer in the frame; NEXT compares the pointer it stands at against that word at 454AH, so a second NEXT for the same FOR gives error 1. The manual's other version 6 rule, that the body of a loop whose start already passes its limit is skipped, is the flag at 729CH and nothing else: FOR enters NEXT at 4529H with it clear so that the first test is made before the body.

OPEN's modes follow the manual's tables exactly as far as the first letter. O is 02H, I is 01H, E is 04H, and D and R are both 03H, which is what the manual's random type table describes in giving D for DOS 6 BASIC and R for all of them. A file opened to extend records its mode as 02H and not 04H, so from then on it is an output file; an input open sets bit 0 of SFLAG$ at 51ECH, which is why a file that is not there is reported rather than created; and a random open makes the file when @OPEN gives 18H. The record length the manual allows, 1 to 255 with 0 meaning 256, is what the code takes, but 799FH gives Illegal function call for 256 or more, so OPEN "R",1,"F",256 is refused where OPEN "R",1,"F",0 is accepted and means the same thing.

WRITE does the three things the manual's page claims and two it does not mention. An empty item list sends an ENTER; a positive number loses the blank the conversion puts in front of it, which is the work of 5715H to 5726H; strings are enclosed in quotes. Besides those, the statement takes a semicolon as a separator exactly as it takes a comma and writes a comma either way, and its file number form insists on mode 02H, so a file opened for input or at random gives error 54 while one opened to extend is taken. Nothing examines the characters of a string, so a quote inside one is written as it stands.

CALL keeps the manual's register convention exactly, one to three parameters in Register Pair HL, Register Pair DE and Register Pair BC and a block of addresses from the third onward, and the block is the stack itself. Two things the manual's entry does not prepare a reader for: the entry address may not be an array, which it does say, and every parameter must be a variable the program has already used. The array table pointer at 71A1H is read before and after each lookup, and a parameter the search had to create moves every address already collected, so the statement is refused with Illegal function call. That guard is necessary and deliberate; only the wording of the refusal is unhelpful.

A GET of a record past the end of the file is not reported. The position gives 1CH or 1DH, which 5018H and 501CH let through, and GET then fills all 256 bytes of the buffer with 00H and returns with nothing said. A PUT in the same place goes on to extend the file.

SAVE has three forms and one of them is not SAVE's code at all. A plain SAVE writes the tokenized program marked 0FFH; SAVE "f",P goes by way of 5759H, which writes the 0FEH marker and calls back into SAVE at 4D6CH; and SAVE "f",A jumps to LIST at 79B3H with the file open, so the whole of a text save is done by LIST. The protected form is allowed whatever the flag at 72CBH holds, which is what lets a protected program be saved again, while the other two go through 57E8H and are refused.

RSET and LSET work on any string variable and not only on fields. When the variable's own bytes lie inside the program text, between PGMBGN 6E9EH and VARTAB 719FH, the path at 4E50H takes fresh string space and points the descriptor there instead, because writing where the descriptor pointed would alter the program. A string longer than the field is cut off without a word, and the padding routine at 4EA3H is the whole of the justification: called before the copy the characters end at the right, called after it they stay at the left.

Variable names: the forty characters are exactly right and the character set is one wider. The BASIC Reference Manual limits a name to A to Z and 0 to 9 with an alphabetic first character, and gives DOS 6 Interpreter BASIC names of up to forty characters, unique for their entire length. The forty is borne out to the character: 3A40H refuses a tail of 27H characters or more, so the tail runs to 38 and the name to 40 with its first two, and 3CFAH compares the whole tail, so two names that differ only in their fortieth character are two variables. But the full stop is part of a name and the manual's set has no full stop in it: 3A11H and 3A3DH take one wherever it stands after the first character, so A.1 and TOTAL.OUT are each a single variable.

The default array bound, and what OPTION BASE 1 really saves. The manual says Interpretive BASIC defaults to an array size of 10 when an array is referenced with no DIM, and that preferring 1 as the first index is wise because it reduces array storage. The XOR 0BH at 3C64H is the whole of both: an OPTION BASE of 00H becomes 0BH, eleven elements for the subscripts 0 to 10, and one of 01H becomes 0AH, ten elements for the subscripts 1 to 10. The index limit is 10 either way, which is the manual's size of 10, and the storage saved is that one element for each dimension.

Redimensioned array comes up where the manual says it should not. The manual gives the error for a DIM met for an array already dimensioned by a preceding DIM statement. The test at 3C13H asks something weaker, only whether the array stands in the table, and a plain reference to an array that was never dimensioned puts it there at 3C3BH with the default bounds. So A(1)=5 and then DIM A(20) gives Redimensioned array with no DIM anywhere before it.

Subscript out of range covers three things and the manual names one. The manual gives it for a subscript that exceeds the bounds declared in the DIM statement. 3CB2H refuses a subscript that reaches its bound, the stored word being a count of elements and not the highest index; 3C21H refuses the wrong number of subscripts, so a two dimensional array referred to with one subscript is reported as a subscript out of range and not as a syntax error; and 3BBDH refuses a subscript of 0 under OPTION BASE 1. A negative subscript is not among them and never reaches the array code at all: 5F8EH, which works every subscript out, raises Illegal function call for a negative value itself.

The two kinds of bracket are not required to match. 3A85H and 3A8AH open a subscript list on either an opening parenthesis or an opening square bracket, and 3BCFH and 3BD3H close it on either kind, with nothing kept to say which opened it, so A(1] and A[1) are both accepted. The manual shows parentheses throughout.

A semicolon before the prompt is accepted and does nothing. The manual gives INPUT's syntax as an optional position, an optional prompt string and the variables, and says the prompt may be ended with a semicolon or a comma with a comma suppressing the question mark, which is exactly what 63DEH and 63E3H do. It allows no semicolon before the prompt. 63C6H calls six bytes at 7E7FH that compare the character with 3BH and step the text pointer past it when it is one, and nothing records that it was there, so INPUT ;"Name";N$ is taken and behaves exactly as the same line without the semicolon.

The delimiters are the manual's, and for INPUT one of them is redundant. The manual says a string is read until a comma or an ENTER. 64E1H puts the comma in Register B and 64DCH puts 00H in Register D for an INPUT, which is the byte the line reader left after what was typed and which the collector stops at in any case through its own test, so INPUT gives the collector one delimiter and the appearance of two. For a READ 64DFH puts 3AH there instead, so an unquoted DATA item runs to the next comma or to the end of the statement.

The string space is collected by the plain quadratic method, and that is where a long pause in a BASIC program comes from. A string that is thrown away leaves its characters where they stand, so the string area fills with text nothing points at, and 46E7H is what reclaims it. One sweep of the collection looks at every string descriptor the interpreter holds, which means the pool of temporaries, the simple variables, the chained parameter regions and every element of every string array, and out of all that it finds one string: the highest one still below a ceiling. That string is moved up against the ceiling, the ceiling is lowered below it at 46EAH, and the whole sweep begins again. So a program with a thousand live strings sweeps a thousand times and the cost grows as the square of the number of strings. The two words the sweep carries, the highest text address found and the position past its descriptor, are kept on the stack rather than in registers, which is why the examiner at 479CH takes its own return address off and trades it twice through EX (SP),HL.

The region the variable search looks in before the simple variables holds a function's parameters, not CHAIN's COMMON variables. This page said otherwise until the string code was written, and the bytes settle it. Nothing in CHAIN writes 7294H, 71C1H or 71C3H; what writes them is 7855H, which a user-defined function call reaches at 77A2H. That code makes room on the stack with an ADD HL,SP and a LD SP,HL, copies the region in force onto the stack, lays the called function's own parameters at 71C5H, and raises the count at 7297H; the return at 78C7H copies the saved region back, lowers the count and clears 7294H when it reaches zero. So the search finding a name there before any ordinary variable is exactly what makes a parameter local to the function, and the nesting count is what lets one function call another. CHAIN's COMMON mechanism is a different thing, a bit in a variable's own type byte that 54BEH and its two fellows set and clear.

The string collector has four entries one instruction apart, and a delimiter of 00H can never match. 464FH steps the pointer back and takes both delimiters as a quotation mark, 4650H takes both as a quotation mark with the pointer already one short, 4652H copies Register B into Register D so one load sets both, and 4653H is the scan with both the caller's. Two delimiters are allowed because a file item ends at a comma or, for a number, at a blank as well. The test for the 00H that ends the text is made at 4659H before either delimiter is compared, so a caller that passes 00H gets everything to the end of the line, which is the whole of what makes LINE INPUT different from INPUT. Two instructions close the routine and are easy to misread: the load at 469CH hands the caller the character the scan stopped on and changes no flag, so the RET NZ after it is acting on the comparison made at 4695H, which is the only test that the pool of temporary descriptors still has room.

One routine of BASIC/OV1 ends inside module 1. The overlay occupies 2600H to 2FFFH and module 1 begins at 3000H, and the two are contiguous in memory rather than merely adjacent in the file: the routine that begins at 2FF9H with three pushes and a call of 76A4H runs across the boundary and finishes at 300BH with POP HL, POP DE, INC A and RET. Its near twin at 2FE9H, one register pair shorter, is what makes the reading certain. So module 1's first instruction boundary is not 3000H, and the twelve bytes at 3000H belong to a routine whose head is on another page. The rest of 300CH to 36D3H is the number conversion package, the digits of a typed number in at 300CH and the characters of a number out at 3147H, with the line number writer at 3139H and the in of an error message at 3131H standing between them.

A semicolon before LINE INPUT's prompt is accepted and does nothing either. The manual gives LINE INPUT the same prompt rules as INPUT and allows no semicolon in front of the prompt string. 6360H calls the same six bytes at 7E7FH that INPUT's 63C6H calls, which step the text pointer past a semicolon when there is one and record nothing, so LINE INPUT ;"Name";N$ is taken and behaves exactly as the same line without the semicolon. LINE is also the only statement of this BASIC whose keyword is never used alone: the byte at 635AH is the token of INPUT and 6357H demands it, which is why the manual gives the statement as two words.

A comparison cannot stand inside a comparison, and the manual does not say so. The precedence of a relational operator is 64H, and 7402H is a RET NC made against that same 64H, so the second relational operator of an expression ends the expression where it stands rather than being applied. A = B = C is therefore not a chain and not an error: it is A = B with = C left in the line for whatever reads the line next, which in a statement is Syntax error from the statement loop. The BASIC Reference Manual's table of operator precedence lists the relational operators as one level below NOT and gives no rule about two of them together.

Dividing one integer by another gives a single precision answer. The integer operator table's oblique stroke at 6B77H holds 74B2H, which makes both operands single precision numbers through 2A8AH and jumps into the single precision divide, so 7% / 2% is 3.5. The backslash and MOD are the integer forms and they go to the overlay at 2C0FH and 2C70H from 76C0H and 76BBH. The manual gives the backslash as integer division and the oblique stroke as division without saying which type comes out of it, and the code is the only place the answer is written down.

A hexadecimal constant is limited to four digits by a count and an octal one by its own arithmetic, and the two give different errors. Five hexadecimal digits reach 75DFH, which is Overflow, error 6; an octal digit of eight or nine reaches 75F9H, which is Syntax error, error 2. The manual's section on constants gives the two forms and the ranges 0 to &HFFFF and 0 to &O177777 and says nothing of what a value outside them does.

A call of a user defined function is limited by a hundred bytes and not by a count of parameters. 7829H weighs the names and the values of the parameters together against 64H, which is the size of the save area that runs from 722DH to 7290H, and gives Illegal function call when they reach it. So the number of parameters a function may take depends on how long their names are and what types they have: eight single precision parameters of one character each come to 64 bytes and pass, where the same eight with names of twenty characters do not. The manual gives DEF FN no limit of any kind.

A definition's body must end at the end of its line and this is only found out when it is called. 78A0H gives Syntax error when the character after the body is not the end of the line, so DEF FNA(X) = X : PRINT "HI" is accepted by DEF, which skips the whole line at 7781H without reading it, and refused the first time the function is used. The manual says the function definition must be the last statement on a line and does not say when that is enforced.

A function that gives one of its own parameters back has its answer copied into string space. 78AEH compares the answer's descriptor address with 7175H and copies the text through 462BH when it stands at or above it, which the local region at 71C5H and every variable's own descriptor do and the temporary descriptors at 7157H do not. Without the copy DEF FNA$(X$) = X$ would hand back a descriptor inside the region that 78CAH is about to restore.

Bugs

B295: SVCUSR tests the argument array's type and never its size (8075H). The USR11 call of the enhancement package takes an integer array whose element zero holds the supervisor call number and whose elements one to five hold the registers. The routine checks that the type byte nine bytes below element zero is 02H and makes no other check, then points the Stack Pointer at the array to pop five register pairs out and pushes six back in. An integer array dimensioned with fewer than six elements has the returned registers written over whatever follows it in the variable area, and element zero comes back holding Register AF in any case, so the supervisor call number the program put there is destroyed. Kind: No bounds check.

B296: MORC reads six whole sectors of BASIC/OV2 whatever the file holds (825FH). Register B is loaded with 06H and the file's length is never asked. BASIC/OV2 is 1376 bytes, five whole sectors and 96 bytes of a sixth, so the load writes 1E00H to 23FFH and the 160 bytes from 2360H to 23FFH are whatever follows the file in its last sector on the diskette. LOWBUF$ at 2300H, the DOS low memory disk buffer, lies inside what is written, and BASIC/OV2's own storage reaches to 235FH, which is inside it too. Kind: Reads past the end of a file.

B297: twenty-seven bytes at 43C1H to 43DBH cannot be reached. They echo a control key as a circumflex and a letter and would clear the printer flag at 6E92H and the output suppression flag at 6E97H for CTRL and C, which is Microsoft BASIC's own control key echo. Nothing in module 1, module 2, BASIC/OV1 or BASIC/OV2 names any address in the block or holds one as a word, no relative jump can reach it from outside module 1, and the statement address table does not hold it. Inside the block the two stores at 43C8H and 43CBH could not be made either: Register A is loaded with 0FH by the first instruction, so the subtraction of 03H never gives zero. Kind: No effect.

B298: CLEAR's first argument is evaluated and thrown away (4489H). The value is worked out by 5F91H into Register Pair DE and refused with Illegal function call when negative, and then never read again: on the comma path 4498H loads Register Pair DE from 6E9AH over it, and on the one argument path the whole tail from 42CBH to 4320H never reads it. So CLEAR 4600, which is what the manual tells a version 5 programmer to write two paragraphs above the version 6 syntax, is accepted in silence and allots nothing. Kind: Silently ignored.

B299: NEXT I, with a trailing comma and no name after it searches on a stale Register Pair DE (45DCH). The call at 45DCH stands below the LD DE,0000H at 452EH and is made with the Zero Flag set from the NXTCHAR at 45D9H, so 4534H does not call the variable search either. Register Pair DE therefore still holds the stack address that the EX DE,HL at 45CCH put there, and the frame search looks for a FOR frame whose variable address is that address instead of taking the innermost loop, which the manual says a NEXT with no variable closes. The usual outcome is error 1, NEXT without FOR. Kind: Wrong value used.

B300: a FIELD list whose widths come to exactly 256 escapes both of the statement's tests (4DFBH). The running total is one byte. The ADD A,B at 4DFBH leaves Register A at 00H, so the JP NZ at 4DFEH does not fire, and the record length test at 4E02H then compares the record length with a total of 00H, which it is never smaller than. Measured against a record length of 128: FIELD #1, 1 AS A$, 254 AS B$ gives error 50, FIELD overflow, as it should, and FIELD #1, 1 AS A$, 255 AS B$ is accepted, the second field being laid out from the 129th byte of a 128 byte record. The OR A at 4E0DH then leaves the Zero Flag set, so the loop is not taken again and the RET NZ at 4E1BH ends the statement: any further fields in the list are dropped without a word. Kind: Wrong value used, with a silent refusal of the rest of the statement.

B302: CHAIN puts the OPTION BASE setting back whether or not MERGE was given (53FDH). The value at 72A3H and the flag at 72A4H are saved into 72A5H and 72A6H at 53F4H to 53FFH and written back at 5696H to 56A1H, and neither the saving nor the restore asks about the MERGE keyword. A plain CHAIN loads through 42B1H, whose own test of the MERGE flag clears both bytes at 42D5H and 42D8H because the program is being replaced, and then CHAIN undoes that. The BASIC Reference Manual says of MERGE's effects, the OPTION BASE setting among them, that None of these actions occur if you omit the MERGE parameter. So a program that has done OPTION BASE 1 and then runs CHAIN "PROG2/BAS" hands PROG2/BAS a base of 1, where a RUN of the same file, which the manual calls equivalent, hands it the default base of 0, and a chained program that reads element 0 of an array meets a Subscript out of range that the same program run any other way does not. Kind: Wrong value used.

B303: three bytes at 795DH cannot be reached. They are a JP to the Syntax error entry, standing between WAIT's return at 795CH and WIDTH at 7960H. No instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 names 795DH, 795EH or 795FH or holds one as a word, and no relative jump of the three images reaches any of them. It is the second block of this shape in the file: the JP to 6065H at 56F8H, in the part of CHAIN not yet written, is the other. Kind: No effect.

B301: OPEN reads one character of the mode string and no more (50E4H), so every two letter mode the manual gives is silently reduced to its first letter. The length at 50DBH is weighed against nothing but 00H and the LD A,(BC) at 50E4H is the only instruction in the statement that reads the string at all. The manual's two type tables mark OO, ON, EO, EN, RN and RO as DOS 5 BASIC forms, and the point of those pairs is the file status they insist on: ON must not exist, OO must exist, RN must not exist, RO must exist. Under this interpreter OPEN "ON",1,"F" is taken as OPEN "O", which creates the file or throws away what is in it, and so is OPEN "OO",1,"F": the check a DOS 5 program relied on is gone and nothing is said. The worst of the six is ON, whose whole purpose is to refuse to touch a file that is already there. Kind: Silently ignored, with loss of data where a DOS 5 program is carried over.

B343: the bracket counter of INPUT's pre scan counts an opening parenthesis and not an opening square bracket (6442H). The scan at 6433H steps over a subscript list without evaluating it, keeping a count in Register B. An opening parenthesis at 6440H jumps to 6432H, which raises the count; an opening square bracket at 6442H jumps to 6433H, which does not. Both closing brackets lower it, 6448H for the square one and the fall through at 644EH for the round one. So the count comes out one short for every nested square bracket, the scan leaves the list early, and the character the comma test at 6457H then finds is the bracket the scan abandoned: INPUT A[B[1]] gives a Syntax error where INPUT A(B(1)) is taken, although 3A85H and 3A8AH open a subscript list on either bracket and the array code takes either throughout. The jump at 6442H wants 6432H, as the one two instructions above it has. Kind: Bug (minor).

B344: an octal eight or nine typed in answer to an INPUT leaves the text pointer holding the value instead of the line (75FDH). The octal digit loop exchanges the value into Register Pair HL and the text pointer into Register Pair DE at 7607H, and every one of its ordinary exits exchanges them back: 7620H for another digit and 7626H when the constant is complete. The digit test at 760CH does not. With 6EA7H clear it jumps to Syntax error and nothing is lost, but with 6EA7H set, which is what INPUT and READ do at 6468H while they convert an item, it jumps to 75F1H, which counts the complaint in 72F1H and returns with Register Pair HL still holding the value gathered. The evaluator stores that as the text pointer at 7355H and reads the next character of the line from it at 735CH, so &O8 typed in reply to INPUT A has the interpreter carry on reading its program text from 0000H, which is the DOS's own low memory. The hexadecimal complaint at 75DFH is reached from 75DCH after the exchange at 75DAH and so is right; it is only this one path that is not. Kind: Wrong value used, with loss of control.

B345: an odd parameter region is not halved but turned into a large number (785BH). The stack space check at 4247H counts in two byte levels, which is why 7349H asks for 01H and 77D4H for 04H, so 7855H halves the length of the block it is about to save before it asks. The halving is a RRCA, which rotates bit 0 round into bit 7 rather than dropping it, so an odd length comes out as 128 more than half of itself: a block of eleven bytes asks for 133 levels, which is 266 bytes, where eleven were wanted. A length is odd whenever the parameters of the call in force come to an odd number of bytes, which one string parameter of a short name does, a string's value being three bytes against an integer's two. The effect is that a nested call of a user defined function whose outer call had such a parameter demands about 266 bytes of stack more than it uses and gives Out of memory through 425CH where there was room: it fails safe, and it fails for a program that should have run. A SRL A is the instruction that was wanted. Kind: Wrong value used (latent).

B346: a tab is not expanded when the character written before it was a 00H (4192H). The display output keeps the character it last wrote in 6E8BH and the tab test at 4159H reads that cell: a 00H there means nothing has been written yet, and a tab is then passed to the display driver as a bare 09H instead of being expanded into spaces to the next tab stop. The three instructions at 418FH to 4195H exist to keep the cell out of 00H, and the DEC B at 4195H is what they were written for, but the test above it is made on the cell ored with the character where the character alone was what wanted testing. So the substitution is made only when the cell was already 00H, which is the one case in which it does not matter, and a 00H written while the cell held anything else leaves 00H standing. PRINT CHR$(0);CHR$(9); at the Ready prompt is enough to reach it: the first character puts 00H in the cell and the tab after it goes to the driver unexpanded. An OR B with 00H in Register A, or a plain LD A,B above it, is what was wanted. Kind: Wrong value tested.

B347: a RENUM with a fourth argument is counted to the end of the program and not to the end of the range (65DBH). The counting loop of the first module walks the links from the first line of the range to the last line of the program, adding the increment once for each, and refuses the statement at 65DCH when the running total passes 0FFFFH or at 65E8H when it passes 0FFF9H. The enhancement package has already measured the range properly, storing its end at 83B7H and counting only as far as that at 8391H, so the two checks measure different things and the first module's is the wrong one. RENUM 10,100,1000,200 on a program with seventy lines above 200 is refused with error 5, Illegal function call, although the lines it would actually renumber need numbers no higher than a few thousand. A fourth argument is the enhancement package's own addition, which is why the base was never changed to match it.

B348: the up arrow asks for a whole power with a sign mask where the exponent byte is wanted, so some negative whole powers come out as one (37FBH). 2AB7H of BASIC/OV1 turns the value in the accumulator into a sixteen bit integer in Register Pair DE, and its first five instructions are a test of Register A on entry: a Register A of 00H gives a Register Pair DE of 0000H and a Register Pair BC of 0000H without the value being looked at, which is how a caller says the value is nothing. 2B01H and every other caller of that routine in the three files hand it the exponent byte at 72EFH, where 3730H leaves in Register A the sign of the answer instead: the low byte of the whole power rotated right circularly and anded with 0FFH for a negative base or 7FH for a positive one. That byte is 00H whenever the low byte of the whole power is 00H, and also when it is 01H with a positive base, so the power comes back as nothing, 3804H leaves the running answer at one, the loop at 3821H ends before it begins and 3747H divides one by one. PRINT 1.001^-256 gives 1 where 0.774 was wanted, and so do the exponents -255, -511, -512 and every other negative whole power whose low byte is 00H, or 01H with a positive base. A positive exponent is safe, 374BH leaving the mask 7FH or 0FFH in Register A, which is never 00H. Kind: Wrong register passed.

B349: a line number above 65529 in a text file is taken as the running total the digits had reached before the one that overflowed (59B2H). 5FA4H reads the digits of a line number and refuses a further digit once the running total stands above 6552, so the highest number it will take is 65529; on that refusal it comes back with the Carry Flag set and Register Pair DE holding the total so far. 59ADH reads that flag, and 59AFH then calls 45DFH and gives Syntax error at 59B2H only when FILEX 6E98H says that no file is in hand. A line read in from a text file by an ASCII LOAD or MERGE has a file in hand, so the error is not given: the line is entered under the truncated number with the digits that overflowed left at the front of its text. 70000 PRINT "X" in a text file becomes line 7000 holding 0 PRINT "X", which gives Syntax error when it is run and which silently writes over any real line 7000 the program had. Typed at the Ready prompt the same line is refused at once. Kind: Latent.

Variables

Memory Used by BASIC/CMD

The number formatter uses the low byte of the same cell, and only the low byte, for its format mask: 31C4H writes it and 3166H and 3184H read it. That is safe because a number is formatted inside one PRINT item and nothing that keeps a text pointer here is live across it. The number formatter uses the same cell for the place it put the decimal point, written at 3530H and 3543H inside the routine 3294H calls. It is also the top four bytes of a double precision value, whose low four stand at 72E8H, and the four the Overflow warning fills from the constants at 3129H and 312DH through 30EEH. The number formatter writes the sign there, a space from 31CAH, a plus sign from 314FH or a minus from 3159H, and builds the digits from 72FFH up, so the text the three doors at 3131H, 3139H and 3147H give back always begins here.
Address
Size
Contents
0069H
1 byte
OVRLY$
The DOS cell that says which overlay is resident at 1E00H. MORC reads it at 8234H and skips the load when it already holds 01H, puts 00H in it while the load runs so that an interrupted load is not taken for a good one, and sets it to 01H when BASIC/OV2 is in. SVCUSR clears it at 8080H when it holds 01H, because the supervisor call it is about to make may load a DOS overlay over the top.
006CH, 0074H, 007CH
1 byte each
CFLAG$, KFLAG$ and SFLAG$
The DOS flag bytes. BEGIN takes their addresses from @FLAGS and writes them into the three empty word cells of module 1 at 7C6BH, 7C6DH and 7C6FH and into the operands of the instructions at 80B9H and 81BAH, so that module 1 and the enhancement reach the real bytes through pointers. BEGIN sets bit 0 of CFLAG$ to freeze memory while BASIC runs and resets bits 0 to 2 of KFLAG$.
6E8BH
1 byte
The character the display output last wrote, kept by 4197H and read in one place only, the tab test at 4159H. 0FFH stands in for a 00H written when the cell was already 00H, which is bug B346.
6E8FH
1 byte
The number of the last error, which the error handler writes and READY reads at 5933H; a 2, Syntax error, puts the line into the editor through 3D15H, which clears the cell so that one error offers the editor once.
6E94H
1 byte
The printer's line width, which WIDTH LPRINT sets at 796AH and which is 0FFH when none is in force. The printer's own output path reads it at 4119H and 4126H and sends a carriage return through 413CH when the column has reached it.
6E95H
1 byte
The display's line width, which WIDTH sets at 7978H and which is 0FFH when none is in force. The display output reads it at 417AH and writes a carriage return through 4186H when a printable character would land past it, and PRINT reads it at 6279H for its own comma fields.
6EA9H
1 byte
Where the end of a program load puts the file buffer count aside, 41C4H taking it out of 6ECEH and 41CFH putting it back, so that the clear at 42C7H walks no buffers and closes no file the program about to be run will want.
7190H
1 byte
The number of the line the last error was found in, which the error handler copies out of 6E9CH at 5889H and which 3D18H reads to decide which line to put into the editor, 0FFFFH meaning direct mode and no line at all.
6E92H
1 byte
Sends characters to the printer rather than the display. LPRINT sets it at 620DH and LLIST at 79B0H; 4137H and 634BH clear it.
6E97H
1 byte
Suppresses output. The character routine reads it at 414BH and throws the character away at 46D8H.
6E98H-6E99H
2 bytes
FILEX
The control block of the file in hand, less two, and 0000H when there is none. Written at 4A93H, 4C5EH, 4ECEH, 4F17H, 515DH, 5A5EH and 634FH. 45DFH loads it and sets the Zero Flag from Register H ORed with Register L, which is the test the keyboard input code, 7E1BH, 41F5H and 40D8H all make: it is how a LOAD or MERGE of a text file has the keyboard code read the program's lines out of the file, and why OPEN undoes it at 634BH.
6E9AH
2 bytes
BASEND
The top of free memory, which is also the Stack Pointer BEGIN sets at 84B3H and the address the file buffers are built from. CLEAR's second argument moves it.
6E9CH
2 bytes
The number of the line being run, written out of each line's header by 5E5AH and set to 0FFFFH at command level by 593BH. END and STOP save it into OLDLIN and skip the save when it is 0FFFFH; CONT puts it back; the error handler copies it to 7190H. NEWB/ASM calls this cell MAXSPAC and BEGIN stores 0FFFEH and then 0FFFFH in it during the start-up, which are line number sentinels: the source's label does not describe the cell.
6E9EH
2 bytes
PGMBGN
The pointer to the start of the program text. BEGIN pins the program area at 83EDH, inside its own first instruction, so that the user's program reclaims the start-up code and the tables.
6EA8H-6EA9H
1 byte each
LOAD's run flag, 00H to stop at Ready and 0F1H for the R option; and where the count of file buffers waits while a load clears the program.
6EAAH
1 byte
Which of PUT and GET is running, not 00H for PUT and 00H for GET. Read at 5021H and 5045H and nowhere else.
6EACH-6EADH
2 bytes
The first real file buffer address, written by 7FFBH.
6EAEH
2 bytes each
The table of file control block addresses. The first entry is file number 0, which is BASIC's own: OPEN refuses that number and KILL borrows it.
6ECEH
1 byte
The count of file buffers, 03H by default and set by the FILES parameter, which BEGIN refuses at sixteen or more. The file lookup gives error 52 for a number above it, and KILL's walk counts down from it.
6ECFH
1 byte
The count of the characters of a variable name beyond its second, kept by the name reader at 3A46H. A name of one or two characters leaves it 00H, and 39 or more gives Syntax error at 3A42H, so the most it holds is 26H. The array code pushes it and the characters above it onto the stack at 3B88H before it works a subscript out, because working one out can call the search again.
6ED0H
up to 38 bytes
The characters of a variable name from the third on, each with bit 7 set, written by the name reader at 3A2AH. 3CE6H copies them and the count below them into a new entry and 3CFAH compares them with an entry's own, in that same high bit form.
6EF6H
2 bytes
Where the text pointer waits while the array code pulls a variable name's tail back off the stack, written at 3B9AH and read at 3BA9H.
6EF9H
varies
LBUF
The line buffer. TOBUFF at 5AD3H puts a colon at 6EF9H and moves the line up in capitals with Register Pair BC holding 013BH.
7039H
varies
INBUF
The input buffer, which IMMED puts its first character into before handing the rest of the line to @KEYIN.
713CH
1 byte
The print position, read by 41E9H to decide whether a carriage return is needed and zeroed by 7E00H with the screen.
7141H
1 byte
The DIM flag. DIM's own entry at 39FAH leaves it holding 0AFH or more and the entry every other caller uses at 39FBH leaves it 00H, which is the one byte that tells a declaration from a reference: 3C13H gives Redimensioned array for a DIM of an array that exists, and the RLA at 3C5CH reads its bit 7 to decide whether each bound comes off the stack or from the default. The array code reads it and the type above it as one word at 3B71H and puts both back at 3BDFH, because working a subscript out can call the search again.
7142H
1 byte
The type of the value in hand, as a count of bytes: 02H integer, 03H string, 04H single precision, 08H double precision. The value move at 2946H of BASIC/OV1 copies exactly that many bytes, and 76A4H returns the type less 03H with the Carry Flag set below 08H.
7145H
2 bytes
IPOS
The continuation point after a reference number.
7151H
2 bytes
OLDHI
HIGH$ as BASIC found it, kept by BEGIN. CLEAR refuses a top of memory above it at 44AAH.
7153H
2 bytes
The top of the program and variable space. What lies between it and BASEND is the stack, which is what CLEAR's third argument sizes and what BEGIN gives an eighth of the free memory to with a ceiling of 0200H.
7155H-7157H
2 bytes each
The pointer to the next free temporary string descriptor, and the first byte of that pool. The pool runs below 7178H, which 4695H is the test against.
7175H-7177H
3 bytes
The three bytes 4641H and 464FH build a string descriptor in, a length and an address, before 467FH copies it into a temporary slot and makes it the accumulator's string.
7178H
2 bytes
HIPT
The high pointer of the string area, lowered by 46BDH when string space is taken and raised by 481DH when the topmost temporary is given back. LOAD takes eighty six bytes off it at 4C87H to get its ceiling, and RSET and LSET weigh it against 71A3H.
717AH
2 bytes
A third thing shares this cell: CHAIN keeps the byte after the last element of a string array here while it relocates them, written at 55FFH and read at 5609H. Where the address of a new array's count of dimensions waits while its elements are laid out and cleared, written at 3C54H and read at 3C92H to work the entry's own length word out. The expression machinery uses the same cell for the text pointer standing on the operator it has just met, written at 735DH and read at 73C6H, and a call of a user defined function for the definition's own text pointer: there is no conflict because the evaluator reads it before it recurses and the function call pushes it at 77C5H across the one expression that could write it.
717EH
2 bytes
The text pointer standing after the FOR statement, set at 5D84H and read at 5D99H and 5DB1H.
7182H
1 byte
The flag that makes the variable search demand an array that already exists, or refuse one, read at 3A7AH. Of its four values 01H demands an array and sends the search straight to 3BE6H, which is what CHAIN's three COMMON walks at 54BEH, 54D0H and 5516H do; 64H from FOR at 5D5CH and 80H from CALL at 535FH refuse one, so that a loop variable and a machine language entry address may not be subscripted; and 00H lets the line decide, an opening bracket after the name sending it to the array code. The search clears it to 00H at 3A90H every time it runs, so a caller that wants it set must set it again. ERASE writes it at 4439H and 4442H, the clearing code at 4344H, and READ's 641CH, 77B9H and 790AH besides.
7184H
2 bytes
Where the text pointer waits across a system call or a machine language routine. The shared open brings it back at 520EH and CALL at 53E7H.
718CH
2 bytes
SAVTXT
The text pointer the statement loop saves before every statement.
718EH
2 bytes
Where the Stack Pointer stands, saved by the statement loop and restored by 4317H and by CALL's return at 53E3H.
7198H
1 byte
The flag that says an error is being handled, read by RESUME at 613BH.
7199H
2 bytes
Where the text pointer waits while the stack is given over to the subscripts of an array reference, written at 3BDBH once the closing bracket has been passed and read by both of the array code's exits at 3CD5H. The expression machinery uses the same cell for the text pointer a term ended at, written at 7355H and read at 7358H, because the loop is entered from 76A1H and as a return address with Register Pair HL holding something else; a call of a user defined function keeps the caller's own pointer there.
719BH-719DH
2 bytes each
OLDLIN and OLDTXT
The line number and text pointer CONT goes back to.
719FH
2 bytes
VARTAB
The start of the simple variables. 4306H and 4309H set the two pointers above it from this one together, which is what CLEAR and NEW do.
71A1H
2 bytes
The start of the array table, which is also the end of the simple variables. CALL and SWAP read it before and after a variable lookup to see whether the search created a variable and moved the arrays.
71A3H
2 bytes
LOPT
The end of the arrays and the lowest free address.
71A5H
2 bytes
The DATA pointer, written only by RESTORE at 437AH and read only by READ at 649EH.
7192H
2 bytes
CURLIN
The current line number as the enhancement package reads it, which IMMED uses for the up arrow, down arrow and full stop keys.
71A7H-71C0H
26 bytes
The declared type table, one byte for each of the letters A to Z, holding the type as a count of bytes that a name beginning with that letter takes when it carries no suffix. The four DEF type statements at 5F49H fill it in and the variable search reads it at 3A6CH through the base 7166H, which plus the code of the letter A, 41H, is 71A7H. MERGE keeps it and NEW and CLEAR do not.
71C3H-71C4H
2 bytes
The length of the parameter region of a user-defined function call, in bytes, which the variable search adds to 71C5H at 3AA3H to find the first address above it. 7877H writes it from 722BH when a function is called and 433BH clears it.
71C5H
varies
The first byte of the parameter region of a user-defined function call, which is where that call's parameters stand. When 7294H says the region stands, the search walks it before the simple variables, which is what makes a parameter local to the function.
729AH-72A1H
varies
The FOR and NEXT working cells: 729AH the text pointer of the NEXT in hand, 729CH the flag that tells FOR's entry into NEXT from a NEXT statement's, 729DH the four byte cell FOR fills with the loop's starting value, and 72A1H the line number the forward scan at 6714H has reached.
7291H
1 byte
Which of the two regions the variable search is walking, set from 7294H at 3A98H and cleared at 3ADAH when the function parameter region has been walked, so that 3AD3H can tell the first exhaustion from the second.
7292H-7293H
2 bytes
The first address above the region the variable search is walking, written at 3AA4H for the function parameter region and at 3AE0H for the simple variables, and read by the limit test at 3AC6H and 3ACDH.
7294H
1 byte
The flag that makes the variable search walk the function parameter region at 71C5H before the simple variables, read at 3A94H. 7893H sets it from the count at 7297H when a function is called and 78D8H clears it when the last one returns.
72A3H
1 byte
The OPTION BASE in force, 00H or 01H, written by OPTION BASE at 66F7H and cleared with the program at 42D8H. The array code reads it twice: at 3BB5H, where a base of 01H makes a subscript of 0 give Subscript out of range and takes one off every other subscript, and at 3C61H, where the XOR 0BH turns it into the default bound of an array that was never dimensioned, eleven elements for a base of 0 and ten for a base of 1.
72C5H
2 bytes
CALL's entry address, worked out at 5370H and taken for the jump at 53DEH. UNTOKE uses 72C5H on its own for what it wrote last, 00H for nothing, 01H for a character of a name or a number and 0FFH for a keyword, written at 7A17H, 7A70H, 7B22H, 7B2CH, 7B37H and 7B5BH and read at 7A61H and 7B1CH: that one byte is the whole of the spacing of a listed line.
72CBH
1 byte
The protected program flag. 42B7H clears it with the program and 4C77H sets it to 0FEH when the first byte of the file loaded is 0FEH; 4C9BH calls 57A7H when it is set, and 57E8H gives Illegal function call when it is set, which is the guard IMMED makes at 8192H before it lists a line and the one CALL and SAVE make.
72CCH
1 byte
The MERGE flag. 5401H stores the MERGE token 0C5H into it; 4310H closes every file only when it is 00H, so a MERGE keeps the files open; 42CEH keeps the DEF type table of the 26 letters when it is set, so a MERGE keeps the declared types; 5683H sends the load on to 4CEFH; and the error handler clears it at 588DH.
72D2H
1 byte
The cell the error handler clears at 5890H and LOAD tests at 4CBCH to see whether it is part of a chain.
72D5H
8 bytes
The area SWAP exchanges the two values through.
72DDH
1 byte
The trace flag, read only at 5E5DH, which TRON sets and TROFF clears through the one pair of bytes at 43F0H.
72ECH-72EFH
4 bytes
The accumulator, the value in hand. For a string it holds the address of the descriptor, which is what WRITE reads at 5715H and 46A8H at 481DH.
72FEH
varies
Where the number conversion lays its text, with a blank or a minus sign in the first byte and a 00H at the end. PRINT adds a trailing blank to it at 6250H; WRITE takes the leading one off at 5721H.
7C2EH-7C4DH
32 bytes
The folded filespec, which 50A2H and 50BEH build the name into with the 03H that ends one after it and hand to @FSPEC, so that the system call reads its text from here and not out of the program. Thirty-one characters and the 03H is exactly what fits.
7C4EH
1 byte
Where DERR keeps the DOS's own error code before the table at 529FH turns it into a BASIC error number.
7C4FH-7C56H
1 byte each
One byte for each of the eight drives, whose bit 0 is set for a write protected diskette. Filled by the shared open at 51BBH from the Carry Flag @CKDRV returns, and read only by PUT at 5033H.
7C6BH, 7C6DH, 7C6FH
2 bytes each
The three empty word cells of module 1, 0000H in the file, that BEGIN fills at 84D6H, 84E2H and 84C9H with the addresses of KFLAG$, SFLAG$ and CFLAG$.
8281H-82A0H
32 bytes
The 32 bytes NEWB/ASM reserves and the load module does not carry, so module 1's own bytes stand here until the enhancement writes over them. The enhancement uses them as the file control block and buffer for the BASIC/OV2 load, FCB being 8281H.
83DBH-83EBH
varies
LSTTYP$, LSTLIN$, LSTNUM$, LSTKEY$ and LSTVAR$
The enhancement package's own storage, all 00H in the file, which is what makes a repeated FIND or SEARCH carry on from where the last one stopped.
6EA7H
1 byte
The flag that makes a number that will not convert a message instead of an error. Set by INPUT at 6468H for the one call of its collector and taken back at 6472H, and read by the conversion at 75DFH and 75F9H, where a set flag writes Overflow from 6BD1H and raises 72F1H rather than reaching error 6 at 587EH or the Syntax error at 586CH. READ never sets it, so a DATA item that will not parse raises a real error.
7180H
2 bytes
The number of the line READ is taking its items from, written by 653DH when the DATA hunt moves to a new line and by nothing else in the loaded image. 5866H is the only reader: it is the error entry 63AAH sends a READ to, so that a DATA item that will not parse names the DATA statement's own line.
7183H
1 byte
READ or INPUT, written at 64A3H out of the two bytes of one instruction: the OR 0AFH at 64A1H leaves bit 7 set for READ and its operand byte at 64A2H, which executes as XOR A, leaves 00H for INPUT and INPUT#. Read at 63A6H, 64B7H, 64D8H and 651DH. The PRINT USING family uses the same byte for a purpose of its own, writing it at 4046H and reading it at 3F28H.
7299H
1 byte
Whether the item in hand is to be put in a variable, written at 64C0H out of the two bytes of one instruction in the same way as 7183H: the OR 0AFH at 64BEH sets it and its operand byte at 64BFH clears it. Read once, at 64EBH, where a clear cell returns to INPUT's pre scan with the item taken and thrown away.
72C6H
1 byte
Whether INPUT writes the automatic question mark. Set to 0FFH at 63D6H for every INPUT and cleared at 63E3H when the prompt string was ended with a comma, which is the manual's own rule, and read once at 63F6H.
72F2H
1 byte
Where 67B4H hands the number conversion's complaint count over, having copied it out of 72F1H and cleared that. INPUT puts 01H here at 6465H before it takes an item, because a string never reaches the conversion, and 6475H reads it and takes one off: anything but 01H gives ?Redo from start.
521CH
1 byte
The mark that an open is BASIC's own rather than a user's, set to 0FFH by 4C17H for LOAD, MERGE and CHAIN so that a file that is not there is reported as BASIC's error and not the supervisor's.
717CH-717DH
2 bytes
The first address above the array the string space collection is walking the elements of, written at 4771H and read by the limit test at 477CH.
71C1H-71C2H
2 bytes
The pointer to the parameter region saved under the one in force, which 7871H writes when a function is called and 4341H clears, so that it is also what ends the chain the string space collection walks at 4734H.
7229H-722AH
2 bytes
The head of the chain of variable regions outside the ordinary table, which module 2 fills in at 8416H with 71C1H and the string space collection reads at 4705H.
722BH-722CH
2 bytes
The length of the parameter block a function definition carries, which 7874H copies into 71C3H when the function is called and 433BH clears.
7295H-7296H
2 bytes
Shared with CHAIN, which keeps the length of the simple variables here across the load, written at 5652H and read at 56AEH. Where the string space collection's walk of the chain of variable regions has reached, set to 7229H at 4708H and stepped on at 4742H.
7297H-7298H
2 bytes
The count of user-defined function calls in flight, raised at 788DH and lowered at 78D2H, which the flag at 7294H is set from and 433EH clears.
6E76H-6E89H
20 bytes
The ten USR vectors, two bytes each, USR0 at 6E76H. 775EH and 7760H write one from DEF USR and 771DH reads one to call through. 774FH works out which, adding twice the digit the tokenizer left at 7149H, and a bare USR with no digit after it names USR0 because 7737H loads Register Pair BC with 0000H.
6E91H
1 byte
The position the printer has reached across its line, which LPOS reads at 7703H and gives one more than.
7143H
1 byte
The number of the operator being applied, 00H for the plus, 01H for the minus, 02H for the asterisk, 03H for the oblique stroke and 04H for a comparison. 741EH writes it and the dispatch at 7473H reads it to index the double precision table at 6B5DH or the single precision one at 6B67H. The integer table at 6B71H is indexed from Register Pair BC instead and does not read this byte. The cell is shared twice over, as 717AH, 7199H, 7295H and 72C5H are. The tokenizer uses it as the copy verbatim flag: 5AD7H clears it, 5B17H sets it to 01H when a DATA is copied and 5B00H reads it. And UNTOKE uses its three low bits, bit 0 for inside a string literal, bit 1 for inside a DATA and bit 2 for inside a REM, written at 7A13H, 7A39H, 7A4BH, 7ABDH and 7AC7H and read at 7A86H: in any of the three a token is written out as the byte it is rather than expanded.
7147H
1 byte
The token of the numeric constant the tokenizer has already converted, which NXTCHAR at 5E93H writes at 5EB3H when it meets one of the tokens 0BH to 1FH. 5EA8H hands it back as the character the caller sees, 5F12H reads it to learn which kind of number is in hand, and 5FA4H and 5FACH read it to tell the two line reference tokens apart. Cleared to 00H by 5FB6H when the text pointer stands on no reference at all.
7148H
1 byte
The type of that constant as a count of bytes, 02H for an integer, 04H for single precision and 08H for double precision, written by 5ECFH for every narrow token and by 5EECH for the three wide ones. 5F2CH copies it into 7142H when the constant is put into the accumulator. It is not 7147H, which holds the token.
7149H-7150H
8 bytes
The value of that constant, unpacked out of the line: two bytes for an integer or a line reference, four for a single precision number and eight for a double precision one, which 5EF6H has 294AH of BASIC/OV1 move in. 7745H reads it for the digit of USR3, which is why the test above it is made on the token range and not on a character, and 5FAEH reads it as a line number reference.
722DH-7290H
100 bytes
The save area a call of a user defined function gathers the parameters' own table entries into, filled one entry at a time by 7837H and laid down at 71C5H by 7882H. 7829H is what holds it to a hundred bytes, and reaching that is Illegal function call.
72F1H
1 byte
The number conversion's complaint count, which 7352H clears at the start of every expression. The one argument function dispatch at 7667H and the power routine at 36E8H both set it to 01H, the Overflow warning at 75F4H raises it, 30CFH reads it and 67B4H hands it over to 72F2H and clears it.
72F5H-72FCH
8 bytes
The second accumulator, where a double precision operation looks for its right hand operand. 745DH and 7483H put it there through 2970H of BASIC/OV1 before either reaches the table at 6B5DH, and 72FBH is its sign byte, which is the byte 2C81H flips to turn a double precision minus into a plus.
72E8H-72EBH
4 bytes
The low four mantissa bytes of a double precision value in the accumulator, which stand below the four at 72ECH. They carry no sign, which is why 3104H fills all four with 0FFH for an overflowed result of either sign. 3101H is the only instruction of module 1 that names them.
72F3H
1 byte
The flag that picks between the two forms the number formatter can write a single or double precision value in. 31DBH clears it before the first pass, and when the digits and the exponent the first pass produced will fit in nine characters for single precision or eighteen for double, 3242H sets it to 80H and the value is formatted a second time.
7186H
1 byte
The flag that says the program text holds line references in their resolved form, the 0DH token with a line's address rather than the 0EH token with its number. 6036H of GOTO sets it to 0DH when it writes one, 42BDH clears it with the program, and the walk reads it at 6636H to know which way to go. 66B6H is the guard CHAIN, DELETE and the line number range parser call so that they pay nothing when it is clear.
6EA0H
2 bytes
The message the Overflow and Division by zero warning is to write. 30C0H is the one instruction that ever changes it, putting 6C2AH there for a division by zero, and 3116H puts 6BD1H back after every use, so every other one of the eight entries writes Overflow without having to say so.
7144H
1 byte
The tokenizer's own flag, which says what a digit standing where the pointer is would mean: 0FFH after a name, so that the digit belongs to it, 00H so that a number is a constant, and 01H so that a number is a line number, which only one of the fourteen tokens at 5C07H leaves. 5B17H writes it beside 7143H when a colon or a DATA is copied, 5C1AH after every token and 5D0DH after a name, and 5C56H is the one place that reads it. 5D43H is worth seeing: its INC A turns a 0FFH into 00H and the DEC A below puts every other value back, so an operator or a punctuation character ends a name without forgetting that a line number is expected.
713DH-713FH
3 bytes
The random number generator's seed. 38B6H and 38BBH read it and 38CFH and 38D8H write the next one, which is this one multiplied by the three bytes at 6E8CH with 05B065H added: a linear congruential generator of twenty four bits whose high byte becomes the top mantissa byte of the answer. Nothing in the release reseeds it, RND refusing a negative argument at 387BH, so a program gets the same sequence every time unless it has drawn numbers before.
6E8CH-6E8EH
3 bytes
The multiplier the random number generator uses, which 389CH loads the address of and 38B0H rotates one byte of at a time. The rotation is circular and there are eight of them to a byte, so the three bytes are left exactly as they were found and are a constant in everything but where they are kept.
72FBH-72FCH
2 bytes
The whole power the repeated squaring at 37F9H counts down, written at 3801H out of what 2AB7H made of the exponent and halved at 380DH once for every time round. The loop ends when both bytes are 00H, which 3826H tests, and it is the cell bug B348 leaves at 0000H when it should not.
72DEH
1 byte
The flag the exponent form of a PRINT USING field keeps, cleared at 341AH and set to 01H at 3450H when the value had to be divided by ten once more to bring its first digit into the field. 348AH adds it to the exponent 32ADH writes, which is the whole of what it is for.
72DFH-72E6H
8 bytes
Where the exponent form of a PRINT USING field keeps the mantissa while it works the exponent out. 3420H copies the accumulator there, four bytes of it for a single precision value and eight for a double, and 3447H loads it back once 3441H has taken the bias off the exponent byte. It lies below the accumulator at 72E8H and is used by nothing else.
6E8AH
1 byte
One byte holding 01H that no instruction of the three images names, standing between the last USR vector and the display's own last character.
6E93H
1 byte
The printer's last tab stop, which WIDTH LPRINT works out at 796EH as the width rounded down to a multiple of sixteen and 7971H stores, and which 62A9H reads for a comma in an LPRINT list. The file carries 0E0H.
6E96H
1 byte
The display's last tab stop, stored at 797FH and read at 62B7H for a comma in a PRINT list. The file carries 40H, which is the 80 of the width at 6E95H rounded down to a multiple of sixteen.
6EF8H
1 byte
The byte that stands in for a file control block while a line is being entered, cleared at 5A39H and pointed at by 5A3BH, so that the clearing at 42C7H finds file number 0 closed and walks no buffers.
717EH-717FH
2 bytes
The text pointer of what follows a FOR or a WHILE, which WHILE writes at 52CAH and reads at 52E4H for its condition and FOR writes at 5D84H for the statement after it, which goes into the frame at plus seventeen.
7187H
1 byte
The AUTO flag, set by AUTO at 61C2H, read by READY at 5947H and cleared at 5969H and 596FH when the automatic numbering has to stop.
7188H-7189H
2 bytes
The line number AUTO is to write next, set from AUTO's first argument at 61C6H, stored at 5984H as the one before it plus the increment and read at 594DH.
718AH-718BH
2 bytes
AUTO's increment, written at 61BFH out of its second argument and read at 5974H, where an addition that passes 0FFFAH is what stops the numbering.
7194H-7195H
2 bytes
The text pointer the error handler keeps at 58ADH out of SAVTXT, which is where RESUME takes the program up again at 6133H.
719BH-719CH
2 bytes
OLDLIN
The number of the line END or STOP was in, stored at 43A4H and by the error handler at 58B9H, which CONT reads at 43E7H to give Can't continue when there is nothing to go back to.
719DH-719EH
2 bytes
OLDTXT
The text pointer a CONT would go back to, stored at 43AAH and cleared by NEW at 42F0H, which CONT reads at 43DCH.
72A1H-72A2H
2 bytes
The number of the line the forward scan at 6714H has reached, written at 671CH and 674CH and lent to 6E9CH at 6793H, so that an error in a NEXT's variable list names the line the scan is reading and not the line the FOR is in.
72A5H-72A6H
1 byte each
Where CHAIN puts the OPTION BASE value and its set flag aside at 5401H, which 5696H and 569CH bring back, so that the program a CHAIN loads keeps the OPTION BASE the program it came from had and may not set one of its own.
72A7H-72C4H
30 bytes
Thirty bytes of 00H that no instruction of the three images names, which is the largest such run of the variable area. They are as wide as the temporary descriptor pool and are put to no use the bytes show.
72C7H-72C8H
2 bytes
Where CHAIN puts HIPT aside at 5658H while the variables stand above the program being loaded, which 56BAH brings back once they have been copied down again.
72CDH
1 byte
The flag CHAIN's parse sets when a DELETE range was given, read at 5664H before those lines are closed up.
72CEH-72D1H
2 bytes each
CHAIN's DELETE range as addresses: 72CEH the address after its last line and 72D0H the address of its first, which the parse works out through the range parser at 5A96H and which 566AH and 566FH hand to the block mover.
72D3H-72D4H
2 bytes
The line number CHAIN named, which the parse leaves 0000H when none was given and 56D3H reads to decide whether the chained program runs from that line or from its first.
72E7H
1 byte
The guard byte below the accumulator's own low mantissa bytes, which only BASIC/OV1 reaches, writing it at 2B64H, 2CC0H and 2CD2H and reading it at 2D25H: a byte shifted off the bottom of a double precision value goes here.
72F0H
1 byte
The byte above the accumulator's own exponent byte, whose address 38DEH of RND loads so that it can walk the four bytes downwards from above them.
72F4H
1 byte
The guard byte below the second accumulator, which only BASIC/OV1 reaches, writing it at 2CBFH and reading it at 2CCFH, and which does for the right hand operand what 72E7H does for the left.
72FDH
1 byte
The byte in front of the sign character of the number buffer below, whose address 3304H loads so that the step after it lands on 72FEH, and which 335DH steps back to.
72FEH-7317H
26 bytes
The buffer the number formatter writes its characters into, beginning with the sign character at 72FEH. 32CDH puts the 00H after the last character and returns with Register Pair HL addressing 72FEH, and UNTOKE copies the characters out of it at 7BB7H.
7318H-731FH
8 bytes
A third eight byte arithmetic area that only BASIC/OV1 reaches. 2EE2H of that file moves the accumulator's seven mantissa bytes here and clears the seven it took them from, which frees the accumulator to hold the running product of the double precision multiplication and the running quotient of its division, the remainder standing here; 2D4BH is the door of the seven byte add and subtract that works on it, with the second accumulator at 72F5H in Register Pair HL.
7320H-7327H
8 bytes
The last eight bytes of module 1, which no instruction of the three images names. They are as wide as each of the three arithmetic areas below them and stand where a fourth would.

Disassembly

3000H - The Tail of a Routine of BASIC/OV1 (3000H-300BH)

These twelve bytes belong to BASIC/OV1 and not to module 1's own code, and they are here because the overlay ran out of room. BASIC/OV1 is loaded at 2600H and its last byte stands at 2FFFH, which is the byte immediately below module 1's first; the routine that begins at 2FF9H in the overlay reaches 2FFFH with a PUSH AF and its next instruction is the CALL PO at 3000H, so one routine is written across the join and the file that holds its head does not hold its tail. The routine divides the value in the accumulator by ten and adds one to Register A, and the one just above it, at 2FE9H, multiplies by ten and takes one away, which is the pair the number conversion and the number formatter walk a value up and down with until it has the one digit in front of the decimal point that they want. The two conditional calls are how it tells a single precision number from a double one, and they read a flag the page has not credited 76A4H with until now. The OR A at 76ADH and the one at 76B2H leave the Parity Flag holding the parity of the type less three, which is 01H for single precision, one bit and odd, and 05H for double, two bits and even; so CALL PO takes the single precision route and CALL PE the double one, and the type test gives its callers four answers in one call and not the three the section at 76A4H describes. The four places that read it are 3000H and 3004H here and 2FEFH and 2FF3H of the routine above.

3000
The single precision division (3000H), the first instruction of module 1's bytes and the fourth of a routine of BASIC/OV1 that began at 2FF9H: call 27E2H on PO, the Parity Flag standing as the OR A inside 76A4H left it, which is odd only for a single precision value, and 27E2H divides the accumulator by ten in that precision.
3003
POP AF F1
Pop Register Pair AF, which brings back the flags 2FFFH pushed, so that the call below reads the same parity the call above did.
3004
Call 2E00H on PE, the parity being even and the value double precision, which divides the accumulator by ten in that precision: by a series that is exact to better than two to the minus sixty four for a value whose exponent stands at 41H or above, and by the eight byte constant at 2DF0H, which is a tenth, for anything smaller.
3007
POP AF F1
Pop Register Pair AF, which brings back the caller's own flags and the caller's own Register A, pushed at 2FFBH.
3008
POP HL E1
Pop Register Pair HL, the caller's, pushed at 2FFAH.
3009
POP DE D1
Pop Register Pair DE, the caller's, pushed at 2FF9H.
300A
INC A 3C
Increment Register A, the caller's own count of how many times the value has been divided by ten, which is the one thing this routine does for its caller besides the division, and which the routine at 2FE9H decrements instead.
300B
RET C9
Return with the accumulator holding one tenth of what it held, Register A one greater, and every other register as the caller left it.

300CH - A Digit of a Number Being Read In (300CH-308DH)

Where the conversion of a typed number puts each digit, in whichever of the three precisions the number has grown to by the time that digit arrives. The loop lives in BASIC/OV1, which clears Register Pair HL at 2F26H, sets Register Pair BC to 00FFH at 2F1CH and then calls NXTCHAR at 2F3CH round and round, jumping here at 2F3FH whenever the Carry Flag says the character is a digit. Register C is the whole of how the decimal point is remembered, and the ADC A,C at 300EH is the whole of what it is for. Register C holds 0FFH until a decimal point is read and 00H afterwards, 2FBCH incrementing it, and the Carry Flag is set because the character is a digit, so LD A,B, ADC A,C, LD B,A adds 0FFH and one to Register B before a decimal point, which leaves it exactly as it was, and 00H and one after it, which counts the digit. One instruction therefore both counts the digits after the decimal point and declines to count the ones before, and nothing has to test anything. The three precisions are reached in order and never go back. An integer is multiplied by ten with four additions at 3029H to 302CH and refused the moment it would pass 32767, which 3022H tests for in advance by comparing against 3277 and 3032H catches afterwards from the sign; a single precision value is compared against 100000.0, which is what 9143H and 5000H are as a single precision number in Register Pair BC and Register Pair DE, and promoted to double the moment it reaches it, so that a number of six digits or more is carried in double precision whatever the user asked for; and a double precision value is multiplied out through the second accumulator at 72F5H. 307BH is the exponent, read a digit at a time into Register E by the same trick of three rotates and an addition, and 3089H is an entry point inside the instruction at 3088H: the bytes 1EH and 7FH of that JP M stand as LD E,7FH, so an exponent of ten digits or more is clamped at 127 and the number is still read rather than refused.

300C
PUSH DE D5
A digit (300CH), which 2F3FH of BASIC/OV1 jumps to with the digit in Register A, the Carry Flag set, Register Pair HL on that character and the value so far in the accumulator: push Register Pair DE, which the arithmetic below writes over.
300D
LD A,B 78
Load Register A from Register B, the count of digits read since the decimal point.
300E
ADC A,C 89
Add Register C and the Carry Flag to Register A. Register C is 0FFH until a decimal point has been read and 00H after it, and the Carry Flag is set because this character is a digit, so the sum is Register B unchanged before the point and Register B and one after it: one instruction counts the decimal places and nothing has to ask whether there are any.
300F
LD B,A 47
Load Register B from Register A, the new count, which 2FDAH and the formatter read when the number is finished.
3010
PUSH BC C5
Push Register Pair BC, that count and the decimal point marker, which 3039H brings back for the next turn of the loop.
3011
PUSH HL E5
Push Register Pair HL, the text pointer standing on this digit, which 3038H brings back.
3012
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the digit as it stands in the line of text, 30H to 39H.
3013
SUB 30H D6 30
Subtract 30H from Register A, which turns the character into the number it stands for, 00H to 09H.
3015
PUSH AF F5
Push Register Pair AF, that value, which 302DH, 3055H and 3064H each bring back on their own path.
3016
Call the type test at 76A4H, which puts the type less three in Register A and leaves the Sign Flag set only for an integer, whose type 02H makes Register A 0FFH.
3019
Jump to 3044H on P, the value having grown past an integer already, where the single and double precision paths are chosen between.
301C
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the integer the accumulator holds so far.
301F
LD DE,0CCDH 11 CD 0C
Load Register Pair DE with 0CCDH, 3277, which is one more than a tenth of 32767: a value that large cannot be multiplied by ten and still be an integer.
3022
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them and sets the Carry Flag when the value so far is below 3277.
3025
Jump to 3040H on NC, the value standing at 3277 or above, where it is turned into a single precision number before this digit is added to it.
3027
LD D,H 54
Load Register D from Register H, the high byte of the value so far, which the four additions below need a second copy of.
3028
LD E,L 5D
Load Register E from Register L, its low byte, so that Register Pair DE holds the same value as Register Pair HL.
3029
ADD HL,HL 29
Add Register Pair HL to itself, which doubles the value.
302A
ADD HL,HL 29
Add Register Pair HL to itself again, which makes it four times what it was.
302B
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the copy taken above, which makes it five times what it was.
302C
ADD HL,HL 29
Add Register Pair HL to itself a third time, which makes it ten times what it was: four additions and no multiplication anywhere.
302D
POP AF F1
Pop Register Pair AF, the digit's value pushed at 3015H.
302E
LD C,A 4F
Load Register C from Register A, that value, so that Register Pair BC holds it with Register B still the count of decimal places.
302F
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which adds the digit. Register B is part of what is added, and it is safe only because a digit after the decimal point can never arrive here: the decimal point at 2FBFH turns the value into a single precision one, so 3019H sends every digit after it away and Register B is always 00H on this path.
3030
LD A,H 7C
Load Register A from Register H, the high byte of the new value.
3031
OR A B7
Or Register A with itself, which sets the Sign Flag when that byte stands at 80H or above and the value has passed 32767.
3032
Jump to 303EH on M, the value having overflowed the integer the test at 3022H let through, which happens for the last digit of a number between 3277 and 32767 that the tenth multiplication carried too far.
3035
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the accumulator, which now holds the integer with this digit on the end of it.
3038
POP HL E1
Round again (3038H), which 3059H and 306EH also reach: pop Register Pair HL, the text pointer standing on the digit just dealt with.
3039
POP BC C1
Pop Register Pair BC, the count of decimal places and the decimal point marker.
303A
POP DE D1
Pop Register Pair DE, the pair pushed at 300CH.
303B
Jump to 2F3CH of BASIC/OV1, the head of the loop, which calls NXTCHAR for the next character of the number.
303E
LD A,C 79
The integer overflowed (303EH), which 3032H reaches: load Register A from Register C, the digit's value, which 302EH put there.
303F
PUSH AF F5
Push Register Pair AF, that value, so that the stack holds it again for the pop the single precision path makes at 3055H, the pop at 302DH having taken it off.
3040
Turned into a single precision number (3040H), which 3025H also reaches: call 2A87H of BASIC/OV1, which makes a single precision number out of the integer at 72ECH and sets 7142H to 04H.
3043
SCF 37
Set the Carry Flag, so that the conditional jump below is never taken when the code falls in from the call above: the value is single precision now and the single precision path is what must run.
3044
Single or double (3044H), which 3019H jumps to with the Carry Flag as the type test left it, set for anything below double precision: jump to 305EH on NC, the value being double precision already.
3046
LD BC,9143H 01 43 91
Load Register Pair BC with 9143H, the exponent and the top byte of the mantissa of 100000.0 as a single precision number, 91H being an exponent of seventeen above the bias and 43H the mantissa's high byte with its leading bit left out.
3049
LD DE,5000H 11 00 50
Load Register Pair DE with 5000H, the other two bytes of that constant, so that Register Pair BC and Register Pair DE together are the single precision 100000.0 the comparison below wants.
304C
Call 2982H of BASIC/OV1, the single precision comparison, which compares the value in the accumulator against the 100000.0 in Register Pair BC and Register Pair DE and leaves the Sign Flag set when the accumulator is the smaller.
304F
Jump to 305BH on P, the value having reached 100000 already, where it is turned into a double precision number: a single precision number carries six digits and no more, so the seventh digit of any number forces the wider type whatever the user wrote.
3052
Call 28ADH of BASIC/OV1, which multiplies the accumulator by ten by taking a copy into Register Pair BC and Register Pair DE, raising that copy's exponent by two to make it four times the value, adding it to give five times, and then raising the accumulator's own exponent at 72EFH by one.
3055
POP AF F1
Pop Register Pair AF, the digit's value, pushed at 3015H or put back at 303FH.
3056
Call 3070H, which adds that digit to the single precision value in the accumulator.
3059
Jump to 3038H, which brings the three pairs back and goes round the loop for the next character.
305B
Turned into a double precision number (305BH), which 304FH reaches: call 2AA0H of BASIC/OV1, which clears the four low bytes of the mantissa at 72E8H and sets 7142H to 08H, so that the single precision value becomes the same value in double precision.
305E
The double precision path (305EH), which 3044H also reaches: call 2EF7H of BASIC/OV1, which multiplies the accumulator by ten in double precision.
3061
Call 2970H of BASIC/OV1, which copies the accumulator into the second accumulator at 72F5H, as many bytes as the type at 7142H asks for.
3064
POP AF F1
Pop Register Pair AF, the digit's value, pushed at 3015H.
3065
Call 28D3H of BASIC/OV1, which makes a single precision number out of the value in Register A, writing the exponent 88H and the mantissa from 72EFH down.
3068
Call 2AA0H of BASIC/OV1, which widens that digit to double precision, so that both operands of the addition below are of the same type.
306B
Call 2C88H of BASIC/OV1, which adds the second accumulator at 72F5H, the value this digit belongs on the end of, to the accumulator.
306E
Jump to 3038H, which brings the three pairs back and goes round the loop.
3070
The digit added in single precision (3070H), which 3056H calls: call 2917H of BASIC/OV1, which pushes the four bytes of the accumulator on to the stack as two words and returns with Register Pair HL untouched.
3073
Call 28D3H of BASIC/OV1, which makes a single precision number out of the digit in Register A and leaves it in the accumulator, the value it stood in having been put on the stack above.
3076
POP BC C1
Pop Register Pair BC, the high word of the value, which 2917H pushed.
3077
POP DE D1
Pop Register Pair DE, its low word, so that Register Pair BC and Register Pair DE are the single precision operand the addition below wants.
3078
Jump to 2622H of BASIC/OV1, the single precision addition, which adds Register Pair BC and Register Pair DE to the accumulator and whose own return takes the code back to 3059H.
307B
LD A,E 7B
A digit of the exponent (307BH), which 2F90H of BASIC/OV1 jumps to after an E or a D in the number: load Register A from Register E, the exponent read so far.
307C
CP 0AH FE 0A
Compare Register A with 0AH, ten, above which a further digit cannot change what the number means.
307E
Jump to 3089H on NC, the exponent standing at ten or above, where it is clamped rather than built any higher.
3080
RLCA 07
Rotate Register A left, which doubles the exponent so far.
3081
RLCA 07
Rotate Register A left again, which makes it four times what it was.
3082
ADD A,E 83
Add Register E to Register A, the exponent as it stood, which makes it five times what it was.
3083
RLCA 07
Rotate Register A left a third time, which makes it ten times what it was.
3084
ADD A,(HL) 86
Add the byte Register Pair HL addresses to Register A, the exponent's digit as it stands in the line of text.
3085
SUB 30H D6 30
Subtract 30H from Register A, which takes the character's offset off and leaves ten times the exponent and the digit.
3087
LD E,A 5F
Load Register E from Register A, the exponent with this digit on the end of it.
3088
Jump to 7F1EH on M, the exponent having passed 127. 7F1EH is a bare RET that stands at the end of the SYSTEM statement's code, so the conversion returns to whatever address its caller left on the stack, which for a number in a line of a program is the complaint at 67B4H that 2F1AH of BASIC/OV1 pushed. 3089H is an entry point, the bytes 1EH and 7FH of this instruction standing as LD E,7FH.
308B
Jump to 2F8DH of BASIC/OV1, the head of the exponent loop, which calls NXTCHAR for the next character of the exponent. Reached from 3089H it carries an exponent of 127, the largest the format holds, so a user who types a hundred digits of exponent gets the largest number rather than an error.

308EH - Overflow and Division by Zero, Which Are Warnings and Not Errors (308EH-3130H)

These two complaints do not stop a program. Every one of the eight entries writes its message, sets the value to the largest number of its type, and returns to the arithmetic that asked, so a program that overflows carries on with a number that is merely as big as the machine can hold. The entries are the overflow exits of the overlay's own arithmetic, five of which reach 30C3H by way of 30A1H, 30A9H or 30B1H with the sign of the result already worked out, and 30BDH is the only one that sets a different message, 6C2AH, Division by zero, every other path leaving 6EA0H holding the 6BD1H that 3116H puts back after every use. 30CFH is the counter, 72F1H, and it is what makes the message appear once and not forty times: the evaluator clears it at 7352H at the start of every expression and the number conversion counts its own warnings into it at 75F4H, and this code writes the message only while the count stands at 00H or 01H, incrementing it from 00H to 01H on the way so that the second warning of one expression is silent. The two constants at 3129H and 312DH are the largest single precision numbers, positive and negative, and 30EEH to 3107H copies whichever of them the sign asks for into the accumulator, with the four low mantissa bytes at 72E8H filled from the negative one as well when the type is double. 311BH is where a warning becomes an error. With a line number standing in 7196H, which is what ON ERROR GOTO puts there, the message is not merely written: 311EH gives error 6 through 587EH for an overflow and 3121H error 11 through 586FH for a division by zero, so the one thing that turns these two warnings into something a program can trap is the program having said it wants to trap them.

308E
PUSH HL E5
The sign of the result taken from an operand (308EH), which 27F9H, 27FDH and 28AAH of BASIC/OV1 reach: push Register Pair HL, the caller's, which the address below writes over.
308F
LD HL,72EEH 21 EE 72
Load Register Pair HL with 72EEH, the byte of the accumulator the sign of a single precision number stands in the top bit of.
3092
Call the type test at 76A4H, which leaves the Parity Flag odd for a single precision value and even for a double one.
3095
Jump to 309DH on PO, the value being single precision, whose sign byte is the 72EEH already in Register Pair HL.
3098
LD A,(72FBH) 3A FB 72
Load Register A with the byte at 72FBH, the sign byte of the second accumulator's double precision value, the operand whose sign the result is to take.
309B
Jump to 309EH, past the single precision load below, with that byte in Register A.
309D
LD A,C 79
Load Register A from Register C, the sign byte of the operand the single precision caller left in that register.
309E
XOR (HL) AE
The two signs combined (309EH), which 309BH also reaches: exclusive or Register A with the byte Register Pair HL addresses, which leaves the top bit set only when the two operands differ in sign and so the result is negative.
309F
RLA 17
Rotate Register A left through the Carry Flag, which brings that top bit into the Carry Flag, where 30F4H reads it to choose between the two constants.
30A0
POP HL E1
Pop Register Pair HL, the caller's, pushed at 308EH.
30A1
Jump to 30C3H, the message and the count, with the sign of the result in the Carry Flag.
30A3
POP AF F1
The entry that throws two words away (30A3H), which 37D0H of the power routine jumps to: pop Register Pair AF, the first of two words the power routine left on the stack.
30A4
POP AF F1
Pop Register Pair AF, the second of them, so that the stack stands as it did before the power routine began.
30A5
LD A,(72EEH) 3A EE 72
The sign taken from the accumulator (30A5H), which 28B5H and 28C1H of BASIC/OV1 reach: load Register A with the byte at 72EEH, the top byte of the single precision mantissa, whose high bit is the sign.
30A8
RLA 17
Rotate Register A left through the Carry Flag, which brings that sign into the Carry Flag.
30A9
Jump to 30C3H, the message and the count, with the sign of the accumulator standing in the Carry Flag.
30AB
POP AF F1
The entry that throws one word away (30ABH), which 26CEH of BASIC/OV1 jumps to: pop Register Pair AF, the word that routine left on the stack.
30AC
LD A,(72F0H) 3A F0 72
The sign taken from 72F0H and turned over (30ACH), which 2656H, 2CDCH, 2D44H, 2E9FH, 2F01H and 2F0CH of BASIC/OV1 all reach: load Register A with the byte at 72F0H, which is not part of any value but the byte standing above the accumulator, in which 295FH of BASIC/OV1 leaves the sign of the answer while it is being worked out.
30AF
CPL 2F
Complement Register A, every bit of it, which gives the sign of the answer: 295FH of BASIC/OV1 stores the complement of it at 72F0H and not the sign itself, which is why 26BFH of the addition packs the byte back with an XOR against the mantissa's leading one, and this complement is what makes the byte read the right way round here.
30B0
RLA 17
Rotate Register A left through the Carry Flag, which brings the turned over sign into the Carry Flag.
30B1
Jump to 30C3H, the message and the count, with the turned over sign standing in the Carry Flag.
30B3
OR B B0
The sign taken from a register pair (30B3H), which 27F0H of BASIC/OV1 reaches: or Register A with Register B, which sets the Zero Flag when both are 00H and there is no sign byte to read.
30B4
Jump to 30BCH on Z, no sign standing in either register, which leaves the Carry Flag as the rotate below makes it from whatever Register A holds.
30B6
LD A,C 79
Load Register A from Register C, the sign byte the caller left in that register.
30B7
Jump to 30BCH with that sign byte in Register A, past the load below which fetches a different one.
30B9
LD A,(72EEH) 3A EE 72
The sign taken from 72EEH (30B9H), which 2E90H of BASIC/OV1 reaches: load Register A with the byte at 72EEH, the top byte of the single precision mantissa.
30BC
RLA 17
The division by zero message (30BCH), which 30B4H, 30B7H and 36F8H of the power routine all reach: rotate Register A left through the Carry Flag, which brings the sign into the Carry Flag.
30BD
LD HL,6C2AH 21 2A 6C
Load Register Pair HL with 6C2AH, the text Division by zero, which is the eleventh of the error message block's fifty-one texts.
30C0
LD (6EA0H),HL 22 A0 6E
Store Register Pair HL into the word at 6EA0H, the message this complaint is to write, which is the only place anything but 3116H writes that word and the reason every other entry writes Overflow.
30C3
PUSH HL E5
The complaint (30C3H), which 30A1H, 30A9H, 30B1H and 373EH of the power routine all reach with the sign of the result in the Carry Flag: push Register Pair HL, the caller's.
30C4
PUSH BC C5
Push Register Pair BC, the caller's, which 3126H brings back once the complaint has been dealt with.
30C5
PUSH DE D5
Push Register Pair DE, the caller's, so that the arithmetic the complaint interrupts finds all three pairs as it left them.
30C6
PUSH AF F5
Push Register Pair AF, the sign in the Carry Flag, which 3124H brings back.
30C7
PUSH AF F5
Push Register Pair AF a second time, which 30EDH brings back for the choice of constant below.
30C8
LD HL,(7196H) 2A 96 71
Load Register Pair HL with the word at 7196H, the line number an ON ERROR GOTO named, which is 0000H when the program has not asked to trap its errors.
30CB
LD A,H 7C
Load Register A from Register H, the high byte of that line number.
30CC
OR L B5
Or Register A with Register L, the low byte, which sets the Zero Flag only when no line was named.
30CD
Jump to 30EDH on NZ, the program having an error handler of its own, which writes no message at all: the error itself is given at 311EH or 3121H below and the handler shows whatever it chooses.
30CF
LD HL,72F1H 21 F1 72
The warning counted (30CFH): load Register Pair HL with 72F1H, the count of warnings this expression has already given.
30D2
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that count.
30D3
OR A B7
Or Register A with itself, which sets the Zero Flag when no warning has been given in this expression yet.
30D4
Jump to 30DAH on Z, this being the first warning, which writes the message and increments the count below.
30D6
DEC A 3D
Decrement Register A, which leaves 00H when the count stands at one.
30D7
Jump to 30EDH on NZ, two or more warnings having been given already, which writes nothing: an expression that overflows forty times complains twice and no more.
30D9
INC (HL) 34
Increment the byte Register Pair HL addresses, 72F1H, which takes the count from 00H to 01H so that the next warning of this expression is the last.
30DA
LD HL,(6EA0H) 2A A0 6E
The message written (30DAH), which 30D4H reaches: load Register Pair HL with the word at 6EA0H, 6C2AH for a division by zero and 6BD1H for anything else.
30DD
Call 6702H, the text writer of the complaint cells, which writes that message out through 670CH and so to the display and not to the printer or the file in hand, and gives back in Register A the 00H that ended the text and nothing else.
30E0
LD (713CH),A 32 3C 71
Store Register A, that 00H, into the byte at 713CH, the print position, which says the cursor stands at the left margin. The carriage return below puts 713CH back from the video driver at 418AH, so this store tells only when 6E97H has the output suppressed and nothing was written at all.
30E3
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, the first of the two characters that end the warning's own line.
30E5
Call 670CH, which writes the one character in Register A.
30E8
LD A,0AH 3E 0A
Load Register A with 0AH, a line feed, which this complaint writes where nothing else in module 1 does.
30EA
Call 670CH, which writes it, so that the warning stands on a line of its own and the program's own output goes on below it.
30ED
POP AF F1
The value made the largest of its type (30EDH), which 30CDH and 30D7H reach: pop Register Pair AF, the sign of the result pushed at 30C7H.
30EE
LD HL,72ECH 21 EC 72
Load Register Pair HL with 72ECH, the four bytes a single precision value stands in and the top four of a double precision one.
30F1
LD DE,3129H 11 29 31
Load Register Pair DE with 3129H, the four bytes of the largest positive single precision number, which is the constant below this routine.
30F4
Jump to 30F9H on NC, the result being positive, which copies that constant.
30F6
LD DE,312DH 11 2D 31
Load Register Pair DE with 312DH, the four bytes of the largest negative one, which differ from the positive constant in the one bit that is the sign.
30F9
Call 2941H of BASIC/OV1, which copies four bytes from the address in Register Pair DE to the address in Register Pair HL.
30FC
Call the type test at 76A4H, which sets the Carry Flag for anything below double precision.
30FF
Jump to 310AH on C, the value being an integer or a single precision number, whose four bytes are all there are of it.
3101
LD HL,72E8H 21 E8 72
Load Register Pair HL with 72E8H, the four low bytes of the mantissa of a double precision value, which the copy above left untouched.
3104
LD DE,312DH 11 2D 31
Load Register Pair DE with 312DH, the four 0FFH bytes, which are what those four low bytes are to hold whichever way the sign went: the sign of a double precision value stands in its top byte and these four carry only mantissa.
3107
Call 2941H of BASIC/OV1, which copies them, so that the accumulator holds the largest double precision number of the sign the warning worked out.
310A
LD HL,(7196H) 2A 96 71
The error, if the program asked for one (310AH), which 30FFH also reaches: load Register Pair HL with the word at 7196H, the line an ON ERROR GOTO named.
310D
LD A,H 7C
Load Register A from Register H, its high byte.
310E
OR L B5
Or Register A with Register L, its low byte, which sets the Zero Flag when no line was named and the complaint is to be no more than the message already written.
310F
LD HL,(6EA0H) 2A A0 6E
Load Register Pair HL with the word at 6EA0H, the message this complaint used, which changes no flag and so leaves the test above standing for the jump at 3119H.
3112
LD DE,6BD1H 11 D1 6B
Load Register Pair DE with 6BD1H, the text Overflow, which is what 6EA0H is to be left holding whatever message was used.
3115
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts 6BD1H into Register Pair HL and the message used into Register Pair DE.
3116
LD (6EA0H),HL 22 A0 6E
Store Register Pair HL into the word at 6EA0H, which puts 6BD1H back: Overflow is the standing message and 30C0H is the one instruction that ever changes it.
3119
Jump to 3124H on Z, no error handler having been named, which returns to the arithmetic with the largest number of its type in the accumulator and the program none the wiser.
311B
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare the message used against 6BD1H and sets the Zero Flag when they are the same.
311E
Jump to 587EH on Z, the message having been Overflow, which is the error chain's entry for error 6 and sends the program to its own handler.
3121
Jump to 586FH, the message having been Division by zero, which is the error chain's entry for error 11.
3124
POP AF F1
The return (3124H), which 3119H reaches: pop Register Pair AF, the sign pushed at 30C6H.
3125
POP DE D1
Pop Register Pair DE, the caller's, pushed at 30C5H.
3126
POP BC C1
Pop Register Pair BC, the caller's, pushed at 30C4H.
3127
POP HL E1
Pop Register Pair HL, the caller's, pushed at 30C3H.
3128
RET C9
Return to the arithmetic of BASIC/OV1 that complained, which goes on with the largest number of its type where the result it could not hold should have been.
3129-312C
DEFB 0FFH, 0FFH, 7FH, 0FFH FF FF 7F FF
3129H to 312CH: the largest positive single precision number, 1.70141183E38. The three mantissa bytes are 0FFH, 0FFH and 7FH with the top bit of the third clear for a positive sign, and the fourth byte 0FFH is the exponent, the highest the format holds.
312D-3130
DEFB 0FFH, 0FFH, 0FFH, 0FFH FF FF FF FF
312DH to 3130H: the largest negative single precision number, which differs from the constant above in the top bit of its third byte alone. 3104H also copies these four bytes into 72E8H as the low mantissa of a double precision result, where they carry no sign and are simply the largest four bytes there are.

3131H - The Number Written as Text: NUMDSP, and the Formatter's Head and Tail (3131H-31CCH)

Every number this interpreter ever shows a user comes out of here. The routine has three doors. 3131H writes the text in from 7328H and falls into the next, which is how an error message names its line and how the undefined reference report at 667CH ends. 3139H is NUMDSP, the one the rest of the file calls with a line number in Register Pair HL: it stores that number as an integer through 2A53H, pushes 46A4H so that the finished text is written out without the caller having to, and goes on. 3147H and 3148H are the formatter proper, the first with no format mask and the second with the mask already in Register A, which is the entry PRINT USING uses at 4038H with its two field counts in Register B and Register C. The text is built in a buffer that begins at 72FEH, one byte for the sign and the digits from 72FFH up, and every door leaves Register Pair HL addressing 72FEH and a 00H byte at the end. The head reads the mask, the type and the value's sign in four instructions none of which disturbs the Zero Flag, which is this interpreter's habit taken as far as it goes: 3166H, 3169H and 316BH are all loads and 316AH is a rotate, so the Zero Flag the sign test at 3152H set is still the one 3171H reads, and the Carry Flag the rotate made is the one 316EH reads. The three ways out of 316EH to 3176H are the whole of the formatter's shape: a PRINT USING field to 32D5H, a value of nothing to 32CDH, which has only to end the buffer because 3164H has already put a 0 in it, a single or double precision number to 31CDH, and an integer straight on to 35D8H. 317EH is the tail every path comes back through, and what it does is suppress leading zeros, which it does by walking its own buffer with NXTCHAR at 5E93H, the same routine that reads the program text, because NXTCHAR skips spaces and reports a digit in the Carry Flag and the buffer is no different from a line of BASIC in that respect. The mask's bits decide the rest: bit 5 fills the empty places with asterisks, bit 4 puts a dollar sign in front of the first digit, and bit 2 says the sign has already been written after the number so no sign goes in front of it.

3131
PUSH HL E5
The word in and the number after it (3131H), which 591BH of the error handler calls and 667CH of the line reference walk: push Register Pair HL, the line number the caller wants named, because the text written below needs that pair.
3132
LD HL,7328H 21 28 73
Load Register Pair HL with 7328H, the text in with a space on each side of it, which is the fourth of the six text areas.
3135
Call the text writer at 46A5H, which makes a temporary string of the bytes from 7328H up to the 00H that ends them and writes it out.
3138
POP HL E1
Pop Register Pair HL, the line number, and fall into NUMDSP below, which writes it as decimal digits.
3139
LD BC,46A4H 01 A4 46
NUMDSP (3139H), which 3D47H of EDIT, 5951H of the error handler, 5E69H of the statement loop, 6675H of the line reference walk, 79E8H of LIST and 81A1H of the enhancement package all call with a number in Register Pair HL: load Register Pair BC with 46A4H, the text writer entered one byte short.
313C
PUSH BC C5
Push Register Pair BC, so that 46A4H is the address the formatter returns through: the finished buffer is written out and the caller of NUMDSP gets back a number already on the display rather than a buffer to deal with.
313D
Call 2A53H of BASIC/OV1, which stores Register Pair HL into the accumulator at 72ECH and puts 02H into 7142H, so that what follows formats it as an integer.
3140
XOR A AF
Clear Register A with XOR A, making 00H, the format mask of a plain number: no field width, no asterisk fill, no dollar sign and no PRINT USING.
3141
Call 31C4H, which stores Register A into 717AH as the mask and puts a space at 72FEH as the sign character, leaving Register Pair HL addressing that byte.
3144
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, the space just stored, which makes Register A 20H. The point is the flag and not the value: no sign test has been made on this path, so the Zero Flag would mean nothing at 3171H, and this one instruction makes sure it is clear and the type test below decides instead. A line number of 0000H therefore goes through the integer formatter like any other number rather than taking the shortcut for a value of nothing.
3145
Jump to 3163H, past the sign handling, which an integer stored by 2A53H out of Register Pair HL never needs.
3147
XOR A AF
The formatter with no mask (3147H): clear Register A with XOR A, making 00H, and fall into the entry below, which is the whole difference between the two doors.
3148
The formatter with a mask (3148H), which PRINT USING calls at 4038H with Register A holding the format bits, Register B the number of places before the decimal point and Register C the number after it: call 31C4H, which stores Register A into 717AH and puts a space at 72FEH, leaving Register Pair HL addressing that byte.
314B
AND 08H E6 08
And Register A with 08H, the mask bit that says a plus sign was asked for in front of a positive number.
314D
Jump to 3151H on Z, no plus sign having been asked for, which leaves the space at 72FEH to stand for the sign of a positive number.
314F
LD (HL),2BH 36 2B
Store 2BH, a plus sign, into the byte Register Pair HL addresses, 72FEH, which a negative value writes over below.
3151
EX DE,HL EB
The sign of the value (3151H): exchange Register Pair DE with Register Pair HL, which puts 72FEH into Register Pair DE out of the way of the test below.
3152
Call 2905H of BASIC/OV1, which tests the sign of the value in the accumulator and comes back with the Sign Flag set for a negative number and the Zero Flag set for a value of nothing, whatever of the four types it is.
3155
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which brings 72FEH back into Register Pair HL with both flags untouched.
3156
Jump to 3163H on P, the value being positive or nothing, which leaves the sign character as it stands and carries the Zero Flag forward to 3171H.
3159
LD (HL),2DH 36 2D
Store 2DH, a minus sign, into the byte Register Pair HL addresses, 72FEH, the value being negative: the digits written after it are the magnitude.
315B
PUSH BC C5
Push Register Pair BC, the two field counts, which the negation below writes over.
315C
PUSH HL E5
Push Register Pair HL, 72FEH, for the same reason.
315D
Call 28EAH of BASIC/OV1, which negates the value in the accumulator, so that the digits are written out of a positive number and the sign is the one byte at 72FEH.
3160
POP HL E1
Pop Register Pair HL, 72FEH, back into that pair.
3161
POP BC C1
Pop Register Pair BC, the two field counts, back into that pair.
3162
OR H B4
Or Register A with Register H, 72H, which makes Register A something other than 00H and so leaves the Zero Flag clear: the value was negative, so it was not nothing, and 3171H must not take the shortcut for a value of nothing.
3163
INC HL 23
The buffer started (3163H), which 3145H, 3156H and 3176H all reach: increment Register Pair HL to 72FFH, the first byte after the sign.
3164
LD (HL),30H 36 30
Store 30H, the character 0, into the byte Register Pair HL addresses, so that a value of nothing needs no digits written for it and 32CDH has only to put the 00H after this one.
3166
LD A,(717AH) 3A 7A 71
Load Register A with the byte at 717AH, the format mask 31C4H stored, which changes no flag and so leaves the Zero Flag of the sign test standing.
3169
LD D,A 57
Load Register D from Register A, keeping the mask for 32D9H and 32E7H of the PRINT USING path, which reads it again out of that register.
316A
RLA 17
Rotate Register A left through the Carry Flag, which brings bit 7 of the mask, the bit 4036H sets to say that PRINT USING and not an ordinary PRINT is asking, into the Carry Flag and disturbs no other flag.
316B
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the value, 02H an integer, 04H single precision and 08H double, which again changes no flag.
316E
Jump to 32D5H on C, a PRINT USING field having been asked for, which lays the number out inside the field the two counts in Register B and Register C describe.
3171
Jump to 32CDH on Z, the value being nothing: the Zero Flag has come all the way from 3152H through four instructions that do not touch it, the 0 is already in the buffer at 72FFH, and 32CDH has only to end it and give Register Pair HL back as 72FEH.
3174
CP 04H FE 04
Compare Register A with 04H, the type of a single precision number, which is the lowest of the two that need a mantissa and an exponent written out.
3176
Jump to 31CDH on NC, the value being single or double precision, where the digits are taken out of it one at a time; an integer, type 02H, falls through to the two instructions below.
3178
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, no places asked for before the decimal point and none after it, which is what the digit writer takes to mean that it is to write the number as it comes.
317B
Call 35D8H, which writes the integer in the accumulator into the buffer from Register Pair HL on as decimal digits and leaves Register Pair HL on the 00H that ends them.
317E
LD HL,72FEH 21 FE 72
The leading zeros suppressed (317EH), which 32FAH calls and every path comes back through: load Register Pair HL with 72FEH, the sign byte at the front of the buffer.
3181
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the sign character, which is a space, a plus sign or a minus sign and which goes back in front of the first digit at 31C2H.
3182
LD C,20H 0E 20
Load Register C with 20H, a space, which is the character the empty places in front of the number are to be filled with unless the mask asks for asterisks.
3184
LD A,(717AH) 3A 7A 71
Load Register A with the byte at 717AH, the format mask again, which the asterisk, the dollar sign and the trailing sign are all read out of.
3187
LD E,A 5F
Load Register E from Register A, keeping the mask through the three tests below, which write Register A.
3188
AND 20H E6 20
And Register A with 20H, the mask bit that asks for the empty places to be filled with asterisks rather than spaces.
318A
Jump to 3198H on Z, no asterisk fill having been asked for, which fills with the space already in Register C.
318C
LD A,B 78
Load Register A from Register B, the sign character, which is tested below against the space in Register C.
318D
CP C B9
Compare Register A with Register C, the space, which sets the Zero Flag only when no sign was written and the place in front of the number is empty.
318E
LD C,2AH 0E 2A
Load Register C with 2AH, an asterisk, the character the empty places are to be filled with, which changes no flag and so leaves the comparison above for the jump below to read.
3190
Jump to 3198H on NZ, a plus or a minus sign standing in front of the number, which is kept and only the places in front of it filled with asterisks.
3192
LD A,E 7B
Load Register A from Register E, the format mask, which the next instruction reads the trailing sign bit out of.
3193
AND 04H E6 04
And Register A with 04H, the mask bit that says the sign has been written after the number instead of in front of it.
3195
Jump to 3198H on NZ, the sign standing at the other end, which leaves the front place to be filled like any other.
3197
LD B,C 41
Load Register B from Register C, the asterisk, so that the character put back at 31C2H fills the sign's own place as well: an asterisk filled field with no sign is asterisks the whole way.
3198
LD (HL),C 71
The fill loop (3198H), which 31A8H and 31ACH come back to: store Register C, the space or the asterisk, into the byte Register Pair HL addresses, writing over whatever stood there.
3199
Call NXTCHAR at 5E93H, which steps Register Pair HL on and brings the next character of the buffer back in Register A. The interpreter's own text reader is used on the formatter's own buffer, which costs nothing because it skips spaces and reports a digit in the Carry Flag exactly as this loop wants.
319C
Jump to 31B2H on Z, the 00H that ends the buffer having been reached, which means every digit was a zero and one has to be put back.
319E
CP 45H FE 45
Compare Register A with 45H, the letter E that 32B4H writes in front of the exponent of a single precision number.
31A0
Jump to 31B2H on Z, the exponent having been reached with no digit before it, which puts a zero back in front of it.
31A2
CP 44H FE 44
Compare Register A with 44H, the letter D that 32B4H writes in front of the exponent of a double precision number.
31A4
Jump to 31B2H on Z, for the same reason as the letter E above.
31A6
CP 30H FE 30
Compare Register A with 30H, the character 0, which is a leading zero and is to be written over.
31A8
Jump to 3198H on Z, which writes the fill character over this zero and reads the next character.
31AA
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which 3504H writes between the groups of three digits and which has nothing to separate while the digits in front of it are still being suppressed.
31AC
Jump to 3198H on Z, which writes the fill character over the comma as well.
31AE
CP 2EH FE 2E
Compare Register A with 2EH, the decimal point, which is the one character that must have a digit in front of it.
31B0
Jump to 31B5H on NZ, a real digit having been reached, which is where the suppression stops and the dollar sign and the sign are put in.
31B2
DEC HL 2B
A zero put back (31B2H), which 319CH, 31A0H and 31A4H reach: decrement Register Pair HL to the place just filled.
31B3
LD (HL),30H 36 30
Store 30H, the character 0, into the byte Register Pair HL addresses, so that a value whose digits are all zeros, or one written as an exponent with nothing before it, shows as 0 and not as nothing at all.
31B5
LD A,E 7B
The dollar sign (31B5H): load Register A from Register E, the format mask.
31B6
AND 10H E6 10
And Register A with 10H, the mask bit that asks for a dollar sign immediately in front of the first digit.
31B8
Jump to 31BDH on Z, no dollar sign having been asked for.
31BA
DEC HL 2B
Decrement Register Pair HL to the place in front of the first digit, which is a fill character and is about to be written over.
31BB
LD (HL),24H 36 24
Store 24H, a dollar sign, into the byte Register Pair HL addresses, which is why the dollar sign of a PRINT USING field moves along with the number and does not stand still.
31BD
LD A,E 7B
The sign put back (31BDH): load Register A from Register E, the format mask once more.
31BE
AND 04H E6 04
And Register A with 04H, the mask bit that says the sign was written after the number.
31C0
RET NZ C0
Return on NZ, the sign standing at the other end of the field, which leaves Register Pair HL addressing the first character the field is to show.
31C1
DEC HL 2B
Decrement Register Pair HL to the place in front of that character.
31C2
LD (HL),B 70
Store Register B, the sign character kept since 3181H or the asterisk of 3197H, into the byte Register Pair HL addresses, so that a minus sign stands immediately in front of the number and not at the far end of an empty field.
31C3
RET C9
Return with Register Pair HL addressing that sign, which is the first character of the finished text.
31C4
LD (717AH),A 32 7A 71
The buffer prepared (31C4H), which 3141H and 3148H both call: store Register A, the format mask, into the byte at 717AH, which the formatter uses as a single byte where the evaluator at 735DH, the array code at 3C54H and the user function machinery at 7852H all use the same cell as a word.
31C7
LD HL,72FEH 21 FE 72
Load Register Pair HL with 72FEH, the byte the sign is written in, which is one below the first digit and which the caller gets back when the text is finished.
31CA
LD (HL),20H 36 20
Store 20H, a space, into the byte Register Pair HL addresses, which stands for the sign of a positive number until 314FH or 3159H writes over it.
31CC
RET C9
Return with Register Pair HL addressing 72FEH and Register A holding the mask, neither of the two instructions above having touched a flag, which is what lets 3144H and 314BH act on the flag the caller came in with.

31CDH - The Two Passes of the Floating Point Formatter (31CDH-32D4H)

A single or double precision number is written out twice, and the second time is the one the user sees. 31CDH saves the whole of the value, clears the flag at 72F3H and calls 3269H, which writes the number with one digit before the decimal point and an exponent after it. 31E4H then reads its own output back: it scans the text for the letter E and then for the letter D, and a text with neither is the finished answer, because the first pass writes an exponent only when the fixed form would not fit. A text with one has the exponent's digits read back into Register B at 3214H and the count of digit characters, which 31F5H made in Register C, added to it, and if the sum is below 09H for a single precision number or 12H, eighteen, for a double, 3242H sets 72F3H to 80H and the whole number is written again, which is what the second pass is for: 3278H reads the flag and 327FH forces the form with no exponent. So the first pass gives the exponential form whenever the decimal exponent 3496H works out falls outside the range of minus the digit count to nothing, and the second pass gives the fixed form always; the two thresholds are the width in characters the fixed form would need, and a number too wide for them keeps the exponential text the first pass made. 3274H's LD BC,0300H is the exponential form's own layout, Register B of 03H leaving exactly one digit in front of the decimal point because 352CH and the first call of 353EH each take one off it before any digit is written and the second brings it to 00H and writes the point. 32ADH is the exponent writer and its ADC A,A at 32B3H is the neatest instruction in the band: Register A holds 22H and the Carry Flag stands as 76A4H left it, so the sum is 45H, the letter E, for a single precision number and 44H, the letter D, for a double one.

31CD
The formatter for a single or double precision number (31CDH), which 3176H jumps to when the type at 7142H is 04H or 08H: call 2917H of BASIC/OV1, which puts the two words at 72ECH and 72EEH, the accumulator's top four bytes, on the stack underneath its own return address.
31D0
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the buffer pointer 72FFH into Register Pair DE out of the way of the two loads below.
31D1
LD HL,(72E8H) 2A E8 72
Load Register Pair HL with the word at 72E8H, the lowest two of the accumulator's eight bytes, which only a double precision value carries anything in.
31D4
PUSH HL E5
Push Register Pair HL, that word, so that a second pass has the whole of the value to work from again: 3269H destroys the accumulator as it takes the digits out of it.
31D5
LD HL,(72EAH) 2A EA 72
Load Register Pair HL with the word at 72EAH, the next two bytes of the accumulator, which is the rest of a double precision value's low half.
31D8
PUSH HL E5
Push Register Pair HL, that word, which with the one below it and the two 2917H put down makes all eight bytes of the value safe.
31D9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, bringing the buffer pointer 72FFH back into Register Pair HL for the digit writer.
31DA
PUSH AF F5
Push Register AF, Register A holding the type of the value, 04H for single precision and 08H for double, which 3269H reads out of it and which 3204H and 3256H both take back.
31DB
XOR A AF
Clear Register A with XOR A, making 00H, which is the value of the flag that means this is the first of the two passes.
31DC
LD (72F3H),A 32 F3 72
Store Register A into 72F3H, the byte 3278H reads to choose between the two forms of the number: 00H the first pass and 80H the second.
31DF
POP AF F1
Pop Register AF, the type, back into that pair, 31DCH having needed Register A for the flag and left the type nowhere else.
31E0
PUSH AF F5
Push Register AF again, so that both ways out of the scan below, 3204H and 3256H, have the type to take off the stack.
31E1
The first pass (31E1H): call 3269H, which writes the whole number into the buffer from 72FFH on and comes back with Register Pair HL addressing 72FEH, the sign character.
31E4
LD B,45H 06 45
Load Register B with 45H, the letter E, which is the marker 32B3H writes a single precision number's exponent with and the first of the two the scan looks for.
31E6
LD C,00H 0E 00
Clear Register C with 00H, which is the count of digit characters the scan below makes as it goes.
31E8
PUSH HL E5
The scan of the text just written (31E8H): push Register Pair HL, 72FEH, so that the second time round the scan begins at the same byte.
31E9
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which the first time round is the sign character at 72FEH and after that each character of the number in turn.
31EA
CP B B8
Compare Register A with Register B, the marker letter being looked for, which is 45H the first time round the scan and 44H the second.
31EB
Jump to 3214H on Z, the marker having been found, where the exponent written after it is read back as a number.
31ED
CP 3AH FE 3A
Compare Register A with 3AH, one past the character 9, the character not being the marker and the count below taking digits only.
31EF
Jump to 31F6H on NC, the character standing above the digits, which the decimal point, the comma and the sign characters all do.
31F1
CP 30H FE 30
Compare Register A with 30H, the character 0, which with the comparison above makes the pair of tests that says whether the character is a digit.
31F3
Jump to 31F6H on C, the character standing below the digits, which only a decimal point or a comma can at this stage.
31F5
INC C 0C
Increment Register C, the count of digit characters, the character being one of the ten: this count is what 323BH and 324AH add the exponent to.
31F6
INC HL 23
The next character (31F6H): increment Register Pair HL to the byte after the one just looked at.
31F7
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which is the next character of the text or the 00H 32CEH put after the last of them.
31F8
OR A B7
Or Register A with itself, which changes nothing and sets the Zero Flag on the byte just loaded: the 00H at the end of the text is the only one that gives it.
31F9
Jump to 31EAH on NZ, there being another character to look at, which takes the scan round again with Register Pair HL and Register C where it left them.
31FB
LD A,44H 3E 44
The end of the text reached (31FBH): load Register A with 44H, the letter D, the marker a double precision number's exponent is written with.
31FD
CP B B8
Compare Register A with Register B, the marker the scan has just finished looking for, so that the Zero Flag says whether this was already the second time round.
31FE
LD B,A 47
Load Register B from Register A, 44H, which is the marker the scan looks for if it is to go round again.
31FF
POP HL E1
Pop Register Pair HL, 72FEH, which 31E8H pushed, so that the second scan starts at the sign character as the first one did.
3200
LD C,00H 0E 00
Clear Register C with 00H, the count of digit characters, which the second scan makes again from the beginning.
3202
Jump to 31E8H on NZ, Register B having held 45H and the text having no letter E in it, which takes the scan round a second time looking for the letter D.
3204
POP AF F1
The first pass kept (3204H), which 31FDH reaches when the text holds neither marker and which 3240H, 324EH and 3254H reach when the exponential text is to stand: pop Register AF, the type of the value, which 31E0H pushed.
3205
POP BC C1
Pop Register Pair BC, the word 31D8H pushed out of 72EAH, which 320BH and 320CH put back where it came from.
3206
POP DE D1
Pop Register Pair DE, the word 31D4H pushed out of 72E8H, which 3208H puts back.
3207
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that word into Register Pair HL to be stored and 72FEH into Register Pair DE out of the way.
3208
LD (72E8H),HL 22 E8 72
Store Register Pair HL into the word at 72E8H, the lowest two bytes of the accumulator, which the digit writer took the value apart in.
320B
LD H,B 60
Load Register H from Register B, the high byte of the other word popped above, so that it can be stored as a pair.
320C
LD L,C 69
Load Register L from Register C, its low byte, which with the instruction above makes Register Pair HL that word again.
320D
LD (72EAH),HL 22 EA 72
Store Register Pair HL into the word at 72EAH, the next two bytes of the accumulator, so that a double precision value's low half stands as it did.
3210
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which brings 72FEH back into Register Pair HL as the answer this routine gives its caller.
3211
POP BC C1
Pop Register Pair BC, the word 2917H put down out of 72EEH, which is taken off the stack and not stored: the text is finished and the accumulator's top half is of no further use.
3212
POP DE D1
Pop Register Pair DE, the word 2917H put down out of 72ECH, the other half of the same, which leaves the stack as 31CDH found it.
3213
RET C9
Return to the caller of the formatter with Register Pair HL addressing 72FEH, the sign character in front of the finished text.
3214
PUSH BC C5
The exponent read back (3214H), which 31EBH reaches with Register Pair HL addressing the marker letter: push Register Pair BC, Register B holding the marker and Register C the count of digit characters, both of which the reading below writes over.
3215
LD B,00H 06 00
Load Register B with 00H, which is the exponent built up out of the digits that follow the marker.
3217
INC HL 23
Increment Register Pair HL to the character after the marker, which 32B7H or 32BCH wrote as a plus or a minus sign.
3218
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which is that sign the first time round and a digit of the exponent after it.
3219
CP 2BH FE 2B
The next character of the exponent (3219H): compare Register A with 2BH, a plus sign, which 32B7H writes in front of an exponent of nothing or more.
321B
Jump to 3252H on Z, the exponent being positive: a number that needs a positive exponent is longer than the fixed form could be and the exponential text stands as it is.
321D
CP 2DH FE 2D
Compare Register A with 2DH, a minus sign, which 32BCH writes in front of a negative exponent and which the digits of the exponent follow.
321F
Jump to 322FH on Z, the sign character having been read, which steps past it to the first of the two digits.
3221
SUB 30H D6 30
Subtract 30H from Register A, the character 0, which turns the digit character into the number it stands for.
3223
LD C,A 4F
Load Register C from Register A, that number, so that it may be added in below after Register B has been multiplied by ten.
3224
LD A,B 78
Load Register A from Register B, the exponent built so far, which the five instructions below multiply by ten.
3225
ADD A,A 87
Add Register A to itself, doubling the exponent so far, which is the first of the three doublings the multiplication by ten is made of.
3226
ADD A,A 87
Add Register A to itself again, so that Register A now holds four times what Register B does.
3227
ADD A,B 80
Add Register B to Register A, five times the exponent so far, Register B still holding the figure the three doublings began from.
3228
ADD A,A 87
Add Register A to itself a third time, which makes ten times the exponent the three instructions above started with.
3229
ADD A,C 81
Add Register C to Register A, the digit just read, which completes the exponent as far as the digits have been read.
322A
LD B,A 47
Load Register B from Register A, so that the exponent built so far is in Register B again for the next time round.
322B
CP 10H FE 10
Compare Register A with 10H, sixteen, which is more than any exponent of a number this interpreter holds can be.
322D
Jump to 3252H on NC, the exponent having run past sixteen, which keeps the exponential text: a value that large has no fixed form worth writing.
322F
INC HL 23
The character after the sign (322FH): increment Register Pair HL to the next character of the exponent.
3230
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which is a digit of the exponent or the 00H that ends the text.
3231
OR A B7
Or Register A with itself, which sets the Zero Flag on the byte just loaded and leaves the byte alone.
3232
Jump to 3219H on NZ, there being another character of the exponent, which takes the reading round again.
3234
LD H,B 60
The exponent read (3234H): load Register H from Register B, the exponent as a number, which keeps it over the pop below.
3235
POP BC C1
Pop Register Pair BC, Register B the marker letter and Register C the count of digit characters, both of which 3214H pushed.
3236
LD A,B 78
Load Register A from Register B, the marker letter, which says which of the two thresholds the sum below is measured against.
3237
CP 45H FE 45
Compare Register A with 45H, the letter E, which 32B3H writes for a single precision number and not for a double one.
3239
Jump to 3249H on NZ, the marker having been the letter D, where the wider threshold of a double precision number is used.
323B
LD A,C 79
A single precision number (323BH): load Register A from Register C, the count of digit characters the scan made.
323C
ADD A,H 84
Add Register H to Register A, the exponent read back above, which makes the number of character places the fixed form of this number would take.
323D
CP 09H FE 09
Compare Register A with 09H, nine, which is the width a single precision number's fixed form is allowed to reach.
323F
POP HL E1
Pop Register Pair HL, 72FEH, which 31E8H pushed, whichever way the comparison above has gone.
3240
Jump to 3204H on NC, the fixed form needing nine places or more, which keeps the exponential text the first pass wrote.
3242
LD A,80H 3E 80
The second pass asked for (3242H): load Register A with 80H, the value of the flag that means the second pass.
3244
LD (72F3H),A 32 F3 72
Store Register A into 72F3H, the byte 3278H reads, so that the form with no exponent is the one the second pass lays out.
3247
Jump to 3256H, where the value saved on the stack is put back together and the whole number written again.
3249
LD A,H 7C
A double precision number (3249H): load Register A from Register H, the exponent read back above.
324A
ADD A,C 81
Add Register C to Register A, the count of digit characters, which makes the width the fixed form would take, the two added the other way about from 323BH to the same end.
324B
CP 12H FE 12
Compare Register A with 12H, eighteen, which is the width a double precision number's fixed form is allowed to reach.
324D
POP HL E1
Pop Register Pair HL, 72FEH, which 31E8H pushed, whichever way the comparison above has gone.
324E
Jump to 3204H on NC, the fixed form needing eighteen places or more, which keeps the exponential text.
3250
Jump to 3242H, the fixed form fitting, where the flag is set and the number written a second time.
3252
POP BC C1
A positive or an oversized exponent (3252H), which 321BH and 322DH reach: pop Register Pair BC, Register B the marker and Register C the count, which 3214H pushed.
3253
POP HL E1
Pop Register Pair HL, 72FEH, which 31E8H pushed, so that the stack stands as 3204H wants it.
3254
Jump to 3204H, which puts the value back and returns with the exponential text standing as the first pass wrote it.
3256
POP AF F1
The value put back for the second pass (3256H): pop Register AF, the type of the value, which 31E0H pushed and 3269H reads.
3257
POP BC C1
Pop Register Pair BC, the word 31D8H pushed out of 72EAH, which 325DH and 325EH put back.
3258
POP DE D1
Pop Register Pair DE, the word 31D4H pushed out of 72E8H, which 325AH puts back.
3259
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that word into Register Pair HL to be stored and 72FEH into Register Pair DE.
325A
LD (72E8H),HL 22 E8 72
Store Register Pair HL into the word at 72E8H, the lowest two bytes of the accumulator, which the first pass took apart.
325D
LD H,B 60
Load Register H from Register B, the high byte of the other word, for the store below.
325E
LD L,C 69
Load Register L from Register C, its low byte, which makes Register Pair HL that word again.
325F
LD (72EAH),HL 22 EA 72
Store Register Pair HL into the word at 72EAH, the next two bytes of the accumulator, so that the low half of a double stands as it did.
3262
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, bringing 72FEH back into Register Pair HL.
3263
POP BC C1
Pop Register Pair BC, the word 2917H put down out of 72EEH, which 2927H below stores back.
3264
POP DE D1
Pop Register Pair DE, the word 2917H put down out of 72ECH, the other half of the top four bytes.
3265
Call 2927H of BASIC/OV1, which exchanges Register Pair DE with Register Pair HL, stores the two words into 72ECH and 72EEH and exchanges them back, so that the accumulator holds the value again and Register Pair HL addresses 72FEH.
3268
INC HL 23
Increment Register Pair HL to 72FFH, the first byte after the sign character, which is where 3163H left it for the first pass, and fall into the digit writer below for the second.
3269
CP 05H FE 05
The digits taken out of the value (3269H), which 31E1H calls for the first pass and 3268H falls into for the second: compare Register A with 05H, the type of the value standing in Register A as 04H for single precision or 08H for double.
326B
PUSH HL E5
Push Register Pair HL, the buffer pointer, which the four instructions below leave alone and 3292H takes back.
326C
SBC A,00H DE 00
Subtract 00H and the Carry Flag from Register A, which takes one off a single precision type and leaves a double precision one as it is, the comparison above having set the flag for the smaller of the two.
326E
RLA 17
Rotate Register A left through the Carry Flag, which doubles it: 03H becomes 06H for single precision and 08H becomes 10H for double.
326F
LD D,A 57
Load Register D from Register A, that figure, which 3270H makes the count of significant digits out of.
3270
INC D 14
Increment Register D to 07H for a single precision number and 11H, seventeen, for a double, which is the number of digits either type is worth writing.
3271
The value normalised (3271H): call 3496H, which multiplies or divides the value by ten until it lies between 99999.95 and 999999.5 for single precision or between 1.0E+15 and 9999999999999999.5 for double, and comes back with Register A holding the number of divisions, negative when it had to multiply.
3274
LD BC,0300H 01 00 03
Load Register Pair BC with 0300H, Register B of 03H being the layout of the exponential form and Register C of 00H the comma counter of 3549H turned off.
3277
PUSH AF F5
Push Register AF, Register A holding the decimal exponent 3496H worked out, which the load below writes over.
3278
LD A,(72F3H) 3A F3 72
Load Register A with the byte at 72F3H, the flag 31DCH cleared for the first pass and 3244H set to 80H for the second.
327B
OR A B7
Or Register A with itself, which sets the Sign Flag on bit 7 of the flag and leaves the byte alone.
327C
Jump to 3283H on P, the flag being 00H and this the first pass, where the two tests that choose the form are made.
327F
POP AF F1
The second pass (327FH): pop Register AF, the decimal exponent, back into that pair.
3280
ADD A,D 82
Add Register D to Register A, the count of significant digits, which makes the number of digit places that stand before the decimal point less one.
3281
Jump to 328CH, which lays out the fixed form without testing anything: the second pass is made only when 3240H or 324EH has already measured the width and found it fits.
3283
POP AF F1
The first pass (3283H): pop Register AF, the decimal exponent, back into that pair.
3284
ADD A,D 82
Add Register D to Register A, the count of significant digits, which is the figure both of the tests below are made on.
3285
Jump to 3290H on M, the sum being negative, which is a value so small that even the leading zeros of the fixed form would run past the digits there are: the exponential form is written for it.
3288
INC D 14
Increment Register D to one more than the count of significant digits, which is the figure the comparison below is made against.
3289
CP D BA
Compare Register A with Register D, so that the Carry Flag says whether the sum stands below the count of digits and one.
328A
Jump to 3290H on NC, the decimal exponent being 01H or more, which is a value whose digits run off the right of what there are: the exponential form is written for it and 3240H or 324EH may ask for the fixed one afterwards.
328C
INC A 3C
The fixed form (328CH): increment Register A, which makes the number of digit places in front of the decimal point and the two 352CH and 353EH take off before the point is written.
328D
LD B,A 47
Load Register B from Register A, that figure, which 352CH and 353EH count down to nothing and write the decimal point when they reach it.
328E
LD A,02H 3E 02
Load Register A with 02H, which 3290H turns into nothing so that 32ABH knows no exponent is to be written after the digits.
3290
SUB 02H D6 02
The exponent of the text (3290H): subtract 02H from Register A, which gives the exponent 32ADH writes and which is nothing exactly when 328EH set the fixed form.
3292
POP HL E1
Pop Register Pair HL, the buffer pointer 326BH pushed, which the digits are written from.
3293
PUSH AF F5
Push Register AF, Register A holding that exponent and the Zero Flag saying whether there is one, both of which 32AAH takes back.
3294
Call 352CH, which takes one off Register B and writes the decimal point and its leading zeros when the count has run out, keeping the place of the point in 7199H.
3297
LD (HL),30H 36 30
Store 30H, the character 0, into the byte Register Pair HL addresses, which is the place the first digit is written over and which stands as a 0 when there is no first digit.
3299
Call 293CH of BASIC/OV1 on Z, the decimal point having just been written by 352CH, which is an INC HL and a RET and nothing else, so the 0 just stored stands as the digit before the point and Register Pair HL steps past it.
329C
Call 3551H, which writes the significant digits of the value into the buffer from Register Pair HL on, calling 353EH before each of them so that the decimal point and the commas fall in their places.
329F
DEC HL 2B
The trailing zeros taken off (329FH): decrement Register Pair HL to the character before the one it addresses, which the first time round is the 00H after the last digit.
32A0
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the last character written so far.
32A1
CP 30H FE 30
Compare Register A with 30H, the character 0, which a number written to its full width ends in as many of as the value has no digits for.
32A3
Jump to 329FH on Z, the character being a 0, which steps back over it: the pointer ends on the last character that is not one.
32A5
CP 2EH FE 2E
Compare Register A with 2EH, a decimal point, which is what is left when every digit after the point was a 0.
32A7
Call 293CH of BASIC/OV1 on NZ, the last character being a digit, which is an INC HL and a RET and so steps Register Pair HL past it; a decimal point is left addressed and written over by what follows.
32AA
POP AF F1
Pop Register AF, the exponent 3290H worked out and the Zero Flag with it, which 3293H pushed.
32AB
Jump to 32CEH on Z, there being no exponent to write, which ends the text and gives the caller the buffer.
32AD
PUSH AF F5
The exponent written (32ADH): push Register AF, the exponent, which the test below writes over.
32AE
Call 76A4H, which loads the type from 7142H, takes 03H off it and comes back with the Carry Flag set for anything below double precision and clear for a double.
32B1
LD A,22H 3E 22
Load Register A with 22H, which is one less than the letter D and two less than the letter E.
32B3
ADC A,A 8F
Add Register A to itself with the Carry Flag, which gives 45H, the letter E, for a single precision number and 44H, the letter D, for a double one.
32B4
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the marker letter in front of the exponent, which 31E4H and 31FBH scan the text for.
32B5
INC HL 23
Increment Register Pair HL to the place the sign of the exponent goes.
32B6
POP AF F1
Pop Register AF, the exponent, back into that pair, with the Sign Flag saying which way it goes.
32B7
LD (HL),2BH 36 2B
Store 2BH, a plus sign, into the byte Register Pair HL addresses, which a negative exponent writes over below.
32B9
Jump to 32C0H on P, the exponent being nothing or more, which leaves the plus sign standing.
32BC
LD (HL),2DH 36 2D
Store 2DH, a minus sign, into the byte Register Pair HL addresses, the exponent being negative.
32BE
CPL 2F
Complement Register A, every bit of the exponent turned over, which with the instruction below makes its magnitude.
32BF
INC A 3C
Increment Register A, which completes the negation, so that the two digits below are written out of a positive number.
32C0
LD B,2FH 06 2F
The tens digit (32C0H): load Register B with 2FH, one below the character 0, which the loop below counts up from.
32C2
INC B 04
Increment Register B, the tens digit as a character, which the first time round makes it the character 0.
32C3
SUB 0AH D6 0A
Subtract 0AH, ten, from Register A, the exponent, which with the jump below counts how many tens it holds.
32C5
Jump to 32C2H on NC, there being another ten in the exponent, which takes the count round again.
32C7
ADD A,3AH C6 3A
Add 3AH to Register A, which puts back the ten taken off too many and adds the character 0, giving the units digit as a character.
32C9
INC HL 23
Increment Register Pair HL to the place the tens digit goes.
32CA
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the tens digit of the exponent.
32CB
INC HL 23
Increment Register Pair HL to the place the units digit goes.
32CC
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the units digit of the exponent.
32CD
INC HL 23
The end of the text (32CDH), which 3171H jumps to for a value of nothing: increment Register Pair HL to the byte after the last character written.
32CE
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL addresses, which is what 31F8H and 3231H read as the end of the text and what the text writer at 46A5H stops on.
32D0
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the pointer to that 00H into Register Pair DE for the caller that wants it.
32D1
LD HL,72FEH 21 FE 72
Load Register Pair HL with 72FEH, the sign character in front of the text, which is the answer every door of the formatter gives.
32D4
RET C9
Return to the caller with the finished text at 72FEH and Register Pair DE addressing the 00H that ends it.

32D5H - PRINT USING: an Integer in a Field, and the Overflow Marker (32D5H-3345H)

316EH comes here when bit 7 of the mask is set, which 4036H sets to say that PRINT USING and not an ordinary PRINT is asking, and Register B holds the number of digit places in front of the decimal point and Register C the number after it. The three doors are the type: an integer falls through to 32E0H, a single or double precision number goes to 3346H and a field written with the four up arrows, which is bit 0 of the mask, goes to 33E0H or 33E7H. The integer path is the simplest thing in the band: six digit places are laid out with LD BC,0603H, the places the field asks for beyond the five digits an integer has are written as leading zeros by 3504H, 35D8H writes the five digits and the point, and the places after the point are filled with zeros the same way. 3304H to 3345H is the field width check and it is the only place in the interpreter that walks its own output backwards: it measures the place of the decimal point, which 352CH and 3541H keep in 7199H, against the places the field asked for, and when they do not agree it steps forward over the spaces and asterisks, reads the sign and dollar characters with NXTCHAR at 5E93H pushing each one on the stack with the flags of the comparison that found it, and then either shifts them one place to the left at 3337H or unwinds the whole stack at 333FH and writes 25H, a per cent sign, in front of the number, which is how PRINT USING tells the user the value did not fit the field. 3319H is the address it pushes as its own return so that the reading goes round again, and 3337H is an entry point inside the LD BC,772BH at 3336H, its operand bytes 2BH and 77H standing as a DEC HL and a LD (HL),A.

32D5
INC HL 23
A number in a PRINT USING field (32D5H), which 316EH jumps to with Register B holding the digit places before the decimal point, Register C those after it and Register D the format mask: increment Register Pair HL to 72FFH, the first byte of the buffer after the sign character.
32D6
PUSH BC C5
Push Register Pair BC, the two counts, which 32E6H takes back into Register Pair DE so that Register Pair BC may be used for the layout.
32D7
CP 04H FE 04
Compare Register A with 04H, the type of a single precision number, Register A holding the type out of 7142H, and leave the Zero Flag standing for 334BH to read two instructions after 3347H has touched the Carry Flag alone.
32D9
LD A,D 7A
Load Register D into Register A, the format mask, which changes no flag and so leaves the comparison above standing.
32DA
Jump to 3346H on NC, the value being single or double precision, where the digits have to be taken out of it one at a time.
32DC
RRA 1F
Rotate Register A right through the Carry Flag, which brings bit 0 of the mask, the bit 3FFFH sets when the field is written with the four up arrows, into the Carry Flag and leaves the Zero Flag of 32D7H alone.
32DD
Jump to 33E0H on C, the field asking for the exponent form, where an integer is turned into a single precision number first.
32E0
LD BC,0603H 01 03 06
An integer in a plain field (32E0H): load Register Pair BC with 0603H, Register B of 06H being the six places 353EH is called at before the decimal point is written and Register C of 03H the comma counter 3549H counts down.
32E3
Call 3524H, which reads the mask at 717AH and clears Register C unless bit 6 of it is set, so that the commas are written only when the field asked for them.
32E6
POP DE D1
Pop Register Pair DE, the two counts 32D6H pushed, Register D holding the digit places before the decimal point and Register E those after it.
32E7
LD A,D 7A
Load Register D into Register A, the places before the decimal point.
32E8
SUB 05H D6 05
Subtract 05H from Register A, the five digits 35D8H writes out of a sixteen bit integer, which leaves the places the field asks for beyond them.
32EA
Call 3504H on P, there being places to spare, which writes that many characters 0 into the buffer from Register Pair HL on and steps it past them.
32ED
Call 35D8H, which writes the five digits of the integer at 72ECH into the buffer and the decimal point after them, calling 353EH before each digit so that the commas fall in their places.
32F0
LD A,E 7B
Load Register E into Register A, the digit places the field asks for after the decimal point.
32F1
OR A B7
Or Register A with itself, which sets the Zero Flag when the field asks for no places after the point.
32F2
Call 289EH of BASIC/OV1 on Z, which is a DEC HL and a RET, so that a field with nothing after the point has the point itself taken off the end of the number.
32F5
DEC A 3D
Decrement Register A, the places after the point, one of which 35D8H has already written the point for.
32F6
Call 3504H on P, there being places after the point, which writes that many characters 0 after it.
32F9
PUSH HL E5
The field finished (32F9H), which 33DDH and 3493H both jump to: push Register Pair HL, the buffer pointer, which 317EH works from 72FEH instead.
32FA
Call 317EH, which walks the buffer suppressing the leading zeros, fills the empty places with asterisks when bit 5 of the mask is set, puts a dollar sign in front of the first digit when bit 4 is set, and leaves the sign character in Register B and the Zero Flag clear when bit 2 says the sign is to go after the number.
32FD
POP HL E1
Pop Register Pair HL, the buffer pointer, back into that pair.
32FE
Jump to 3302H on Z, the sign having been written in front of the number, where the text is ended.
3300
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the sign character 317EH left in that register, bit 2 of the mask having asked for it after the number.
3301
INC HL 23
Increment Register Pair HL to the byte after the sign just written.
3302
LD (HL),00H 36 00
The text ended (3302H): store 00H into the byte Register Pair HL addresses, which is what the text writer at 46A5H stops on.
3304
LD HL,72FDH 21 FD 72
The field width checked (3304H): load Register Pair HL with 72FDH, one byte below the sign character, so that the step below leaves it on 72FEH.
3307
INC HL 23
The next character of the field (3307H): increment Register Pair HL to the character to be looked at.
3308
LD A,(7199H) 3A 99 71
Load Register A with the byte at 7199H, the low byte of the address 352CH or 3541H stored the decimal point at.
330B
SUB L 95
Subtract Register L from Register A, the low byte of the pointer, which gives the number of characters between here and the decimal point.
330C
SUB D 92
Subtract Register D from Register A, the digit places the field asked for before the point, so that the Zero Flag is set exactly when the two agree.
330D
RET Z C8
Return on Z, the number standing in the field the way it was asked for, which is the way out every field that fits takes.
330E
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character being looked at.
330F
CP 20H FE 20
Compare Register A with 20H, a space, which 317EH leaves in the places in front of the first digit.
3311
Jump to 3307H on Z, the character being a space, which steps over it and measures again.
3313
CP 2AH FE 2A
Compare Register A with 2AH, an asterisk, which 3197H puts in those places instead when bit 5 of the mask is set.
3315
Jump to 3307H on Z, the character being an asterisk, which steps over it and measures again.
3317
DEC HL 2B
Decrement Register Pair HL to the character before the one just read, which is the last of the spaces or asterisks.
3318
PUSH HL E5
Push Register Pair HL, that place, which 3342H takes back as the place the per cent sign goes.
3319
PUSH AF F5
The character pushed (3319H): push Register AF, Register A holding the character and the flags being those of the comparison that let it through, which 3339H and 333FH read back.
331A
LD BC,3319H 01 19 33
Load Register Pair BC with 3319H, the address of the instruction above, which is pushed below as the return of the reading that follows.
331D
PUSH BC C5
Push Register Pair BC, that address, so that each of the three returns on Z at 3323H, 3326H and 3329H comes back here and pushes the character it found.
331E
Call 5E93H, NXTCHAR, which steps Register Pair HL on, skips any spaces and comes back with the next character of the buffer in Register A and the Carry Flag set when it is a digit.
3321
CP 2DH FE 2D
Compare Register A with 2DH, a minus sign, which 31C2H may have written in front of the number.
3323
RET Z C8
Return on Z, the character being a minus sign, which goes back to 3319H and pushes it with the Zero Flag set.
3324
CP 2BH FE 2B
Compare Register A with 2BH, a plus sign, which 31C2H writes instead when the field asked for one.
3326
RET Z C8
Return on Z, the character being a plus sign, which goes back to 3319H in the same way.
3327
CP 24H FE 24
Compare Register A with 24H, a dollar sign, which 31BBH writes when bit 4 of the mask is set.
3329
RET Z C8
Return on Z, the character being a dollar sign, which goes back to 3319H in the same way.
332A
POP BC C1
Pop Register Pair BC, the 3319H the reading was coming back through, the character not being one of the three: the loop is finished with.
332B
CP 30H FE 30
Compare Register A with 30H, the character 0, which is what stands in the first digit place of a number narrower than its field.
332D
Jump to 333FH on NZ, the character being a digit other than 0 or something else again, which is a number too wide for the field.
332F
INC HL 23
Increment Register Pair HL to the character after the 0.
3330
Call 5E93H, NXTCHAR, which comes back with that character in Register A and the Carry Flag set when it is a digit.
3333
Jump to 333FH on NC, the character after the 0 not being a digit, which leaves nothing to shift and so makes the field overflow.
3335
DEC HL 2B
Decrement Register Pair HL back to the 0, which is the place the characters below are shifted into.
3336
LD BC,772BH 01 2B 77
Load Register Pair BC with 772BH, whose operand bytes 2BH and 77H stand as the two instructions at 3337H, which is how the loop below is entered from its middle.
3339
POP AF F1
Pop Register AF, Register A holding a character 3319H pushed and the Zero Flag saying whether it was one of the three the reading collected.
333A
Jump to 3337H on Z, the character having been a sign or a dollar sign, which writes it one place to the left and comes back here for the next.
333C
POP BC C1
Pop Register Pair BC, the last of what the reading left on the stack, the first character popped not having been one of the three.
333D
Jump to 3308H, which measures the field again now that the characters have been moved one place down.
333F
POP AF F1
The field overflowed (333FH): pop Register AF, a character the reading pushed, with the Zero Flag saying whether another follows it.
3340
Jump to 333FH on Z, there being another character on the stack, which unwinds the whole of what the reading put there.
3342
POP HL E1
Pop Register Pair HL, the place 3318H pushed, which is the character in front of the first digit of the number.
3343
LD (HL),25H 36 25
Store 25H, a per cent sign, into the byte Register Pair HL addresses, which is how PRINT USING shows that the value would not go in the field it was given.
3345
RET C9
Return to the caller with the number written and the per cent sign in front of it.

3346H - PRINT USING: a Single or Double Precision Number in a Field (3346H-33DFH)

The two counts and the mask are the same as the integer path's; what differs is that the digits have to be got out of the value, so 3372H normalises it with 3496H and the decimal exponent that comes back is what the whole of the layout turns on. A value of 1.0E+16 or more has no field it could fit, and 3358H deals with it by throwing the field away: the plain formatter at 3147H writes the number as it would for an ordinary PRINT and 335EH puts a per cent sign in front of it. Below that, 3377H splits on the sign of the exponent: 337AH is a value whose digits reach the decimal point or past it and it writes the leading zeros the field asks for, lays out the point and the commas with 3518H and hands the digits to 3551H, while 3394H is a value smaller than one, which has first to be divided by ten at 33A1H until the places the field has after the point can hold it, and then written with its own leading zeros on both sides of the point. 3347H's RRA is another of this file's flag carries: it moves bit 0 of the mask into the Carry Flag and leaves the Zero Flag that 32D7H set two instructions earlier for 334BH to read, which is how one comparison serves both the up arrow test and the choice between single and double precision.

3346
PUSH HL E5
A single or double precision number in a field (3346H), which 32DAH jumps to: push Register Pair HL, the buffer pointer at 72FFH, which 3358H and 3375H both take back.
3347
RRA 1F
Rotate Register A right through the Carry Flag, Register A holding the format mask, which brings bit 0 of it into that flag and leaves the Zero Flag of 32D7H standing.
3348
Jump to 33E7H on C, the field having been written with the four up arrows, where the number is laid out in the exponent form.
334B
Jump to 3361H on Z, the type at 7142H having been 04H exactly, where a single precision value is measured.
334D
LD DE,362DH 11 2D 36
Load Register Pair DE with 362DH, the address of the double precision constant 1.0E+16, which is the first value no field can hold.
3350
Call 29BEH of BASIC/OV1, which compares the double precision value in the accumulator with the one Register Pair DE addresses and leaves the Sign Flag set when the accumulator holds the smaller.
3353
LD D,10H 16 10
Load Register D with 10H, sixteen, which is the number of significant digits a double precision value is written to.
3355
Jump to 336FH on M, the value standing below 1.0E+16 and so having a field it could fit.
3358
POP HL E1
No field could hold it (3358H), which 336AH also reaches: pop Register Pair HL, the buffer pointer 3346H pushed, which the plain formatter sets up again for itself.
3359
POP BC C1
Pop Register Pair BC, the two counts 32D6H pushed, which the plain formatter takes no notice of.
335A
Call 3147H, the formatter with no mask, which writes the number the way an ordinary PRINT would and comes back with Register Pair HL addressing 72FEH.
335D
DEC HL 2B
Decrement Register Pair HL to 72FDH, the byte in front of the sign character.
335E
LD (HL),25H 36 25
Store 25H, a per cent sign, into the byte Register Pair HL addresses, which tells the user the field was too narrow and the number was written in full instead.
3360
RET C9
Return to the caller with the number at 72FDH and the per cent sign in front of it.
3361
LD BC,0B60EH 01 0E B6
A single precision value measured (3361H): load Register Pair BC with 0B60EH, Register B of 0B6H and Register C of 0EH being the top two bytes of the single precision constant 1.0E+16.
3364
LD DE,1BCAH 11 CA 1B
Load Register Pair DE with 1BCAH, Register D of 1BH and Register E of 0CAH, the other two bytes of the same constant.
3367
Call 2982H of BASIC/OV1, which compares the single precision value in the accumulator with the one in Register Pair BC and Register Pair DE and leaves the Sign Flag set when the accumulator holds the smaller.
336A
Jump to 3358H on P, the value standing at 1.0E+16 or above, where the field is thrown away and a per cent sign written.
336D
LD D,06H 16 06
Load Register D with 06H, six, which is the number of significant digits a single precision value is written to.
336F
The value normalised (336FH): call 28C4H of BASIC/OV1, which reads the exponent byte at 72EFH and comes back with the Zero Flag set for a value of nothing.
3372
Call 3496H on NZ, the value being something, which multiplies or divides it by ten until it lies in the range the digit writer wants and comes back with Register A holding the number of divisions, negative when it had to multiply.
3375
POP HL E1
Pop Register Pair HL, the buffer pointer 3346H pushed, which the digits are written from.
3376
POP BC C1
Pop Register Pair BC, the two counts 32D6H pushed, Register B the digit places before the decimal point and Register C those after it.
3377
Jump to 3394H on M, the decimal exponent being negative, which is a value whose digits all stand to the right of the decimal point.
337A
PUSH BC C5
The digits reach the point (337AH): push Register Pair BC, the two counts, which 3390H takes back into Register Pair DE.
337B
LD E,A 5F
Load Register A into Register E, the decimal exponent, so that it may be subtracted below and added back at 338DH.
337C
LD A,B 78
Load Register B into Register A, the digit places the field asks for before the decimal point.
337D
SUB D 92
Subtract Register D from Register A, the count of significant digits, which is six or sixteen.
337E
SUB E 93
Subtract Register E from Register A, the decimal exponent, which leaves the places the field has in front of the number itself.
337F
Call 3504H on P, there being places to spare, which writes that many characters 0 into the buffer and steps Register Pair HL past them.
3382
Call 3518H, which works out Register B as Register E and Register D and one, the place the decimal point falls at, and Register C as the comma counter, and clears Register C unless bit 6 of the mask asked for commas.
3385
Call 3551H, which writes the significant digits of the value into the buffer, calling 353EH before each so that the point and the commas fall in their places.
3388
OR E B3
Or Register E with Register A, the decimal exponent with what 3551H left in Register A, so that the Zero Flag is clear when either of them is something.
3389
Call 3512H on NZ, which writes a character 0 and then goes round 350EH writing one for every count left in Register A, so that a value with fewer digits than its field asked for is filled out.
338C
OR E B3
Or Register E with Register A again, which sets the Zero Flag the same way for the call below.
338D
Call 353EH on NZ, which takes one off Register B and writes the decimal point when the count has run out, so that a number whose digits ended before the point still gets one.
3390
POP DE D1
Pop Register Pair DE, the two counts 337AH pushed, Register D the places before the point and Register E those after it.
3391
Jump to 32F0H, where the places the field has after the decimal point are filled with zeros and the field is finished.
3394
LD E,A 5F
Every digit to the right of the point (3394H): load Register A into Register E, the decimal exponent, which is negative here.
3395
LD A,C 79
Load Register C into Register A, the digit places the field asks for after the decimal point.
3396
OR A B7
Or Register A with itself, which sets the Zero Flag when the field asks for no places after the point.
3397
Call 2FF7H of BASIC/OV1 on NZ, which is a DEC A and a RET, so that one of those places is taken for the digit the point itself is written against.
339A
ADD A,E 83
Add Register E to Register A, the decimal exponent, which gives the number of times the value has to be divided by ten before its first digit falls inside the field.
339B
Jump to 339FH on M, that figure being negative, which is a value small enough to need dividing.
339E
XOR A AF
Clear Register A with XOR A, making 00H, the value needing no dividing, which also clears the Sign Flag so that neither of the two instructions below acts.
339F
PUSH BC C5
The value brought into the field (339FH): push Register Pair BC, the two counts, which changes no flag and leaves the Sign Flag of 339BH standing.
33A0
PUSH AF F5
Push Register AF, Register A holding that figure, which 33A7H takes back into Register Pair BC and which again changes no flag.
33A1
Call 2FF9H of BASIC/OV1 on M, which divides the value in the accumulator by ten and comes back with Register A one higher.
33A4
Jump to 33A1H on M, Register A still being negative, which divides by ten again: the loop ends with Register A at nothing.
33A7
POP BC C1
Pop Register Pair BC, the word 33A0H pushed, which puts the figure the dividing began from into Register B and the flags of the time into Register C.
33A8
LD A,E 7B
Load Register E into Register A, the decimal exponent as it was.
33A9
SUB B 90
Subtract Register B from Register A, that figure, which gives the exponent the value now has after the dividing.
33AA
POP BC C1
Pop Register Pair BC, the two counts 339FH pushed, Register B the places before the point and Register C those after it.
33AB
LD E,A 5F
Load Register A into Register E, the new decimal exponent, which 33D7H adds back at the end.
33AC
ADD A,D 82
Add Register D to Register A, the count of significant digits, which gives the places the digits of the value take up in the field.
33AD
LD A,B 78
Load Register B into Register A, the digit places the field asks for before the decimal point, the addition above having been made for its flags alone.
33AE
Jump to 33BCH on M, the sum being negative, which is a value whose digits do not reach the field at all and which is written as zeros on both sides of the point.
33B1
SUB D 92
Subtract Register D from Register A, the count of significant digits.
33B2
SUB E 93
Subtract Register E from Register A, the new decimal exponent, which leaves the places the field has in front of the digits.
33B3
Call 3504H on P, there being places to spare, which writes that many characters 0 and steps Register Pair HL past them.
33B6
PUSH BC C5
Push Register Pair BC, the two counts, which 33D0H takes back.
33B7
Call 3518H, which works out the place of the decimal point into Register B and the comma counter into Register C.
33BA
Jump to 33CDH, where the digits themselves are written.
33BC
The digits short of the field (33BCH): call 3504H, which writes Register A characters 0, Register A holding the places in front of the first digit.
33BF
LD A,C 79
Load Register C into Register A, the digit places the field asks for after the decimal point.
33C0
Call 3541H, which stores a decimal point into the buffer, keeps its place in 7199H and steps Register Pair HL past it.
33C3
LD C,A 4F
Load Register A into Register C, which 3541H left as Register B, so that the comma counter is the place of the point.
33C4
XOR A AF
Clear Register A with XOR A, making 00H, which the two subtractions below work down from.
33C5
SUB D 92
Subtract Register D from Register A, the count of significant digits.
33C6
SUB E 93
Subtract Register E from Register A, the new decimal exponent, which gives the zeros that stand between the point and the first digit.
33C7
Call 3504H, which writes that many characters 0 after the point.
33CA
PUSH BC C5
Push Register Pair BC, the two counts, which 33D0H takes back.
33CB
LD B,A 47
Load Register A into Register B, nothing being left before the point, so that 353EH never writes a second one.
33CC
LD C,A 4F
Load Register A into Register C as well, which turns the comma counter off for a number that has no digits in front of the point.
33CD
The digits written (33CDH): call 3551H, which writes the significant digits of the value into the buffer and leaves the count it did not use in Register A.
33D0
POP BC C1
Pop Register Pair BC, the two counts pushed at 33B6H or 33CAH, Register B the places before the point and Register C those after it.
33D1
OR C B1
Or Register A with Register C, the count 3551H left with the places after the point, so that the Zero Flag is clear when either of them is something.
33D2
Jump to 33D7H on NZ, there being more of the field to fill, which leaves the buffer pointer where the digits ended.
33D4
LD HL,(7199H) 2A 99 71
Load Register Pair HL with the word at 7199H, the place of the decimal point, which puts the pointer back on it so that the point is the last character of the number.
33D7
ADD A,E 83
The places left after the point (33D7H): add Register E to Register A, the new decimal exponent, which with the count left over gives the zeros still owed.
33D8
DEC A 3D
Decrement Register A, one of those places having gone to the point itself.
33D9
Call 3504H on P, there being zeros owed, which writes them after the digits.
33DC
LD D,B 50
Load Register B into Register D, the digit places the field asks for before the decimal point, which 330CH measures the finished number against.
33DD
Jump to 32F9H, where 317EH suppresses the leading zeros and 3304H checks that the number fits the field.

33E0H - PRINT USING: the Exponent Form Field (33E0H-3495H)

A field written with the four up arrows asks for the number in the exponent form, and bit 0 of the mask is how 3FFFH says so. 33E0H is the door an integer comes in at, which 2A87H turns into a single precision value first, and 33E7H the door a single or double precision value comes in at; the XOR A at 33E6H is what makes the integer's path always take the single precision count of six digits. 33ECH is an entry point inside the LD BC,061EH at 33EBH, its operand bytes 1EH and 06H standing as a LD E,06H, which is the whole of how the two types are told apart here: the double precision path falls through 33E9H and sets Register E to 10H, sixteen, and the single precision path jumps into the middle of the next instruction and sets it to 06H. The rest is the layout: 3400H to 340CH works the mask's bit 2 into the count of places, 3413H brings the value down to a single digit in front of the point, 341DH and 3444H keep the mantissa in the four bytes at 72DFH while 3420H and 3447H move it in and out, 343EH reads the exponent byte at 72EFH and takes the bias of 81H off it, 344EH and 3450H keep a one in 72DEH when the value had to be divided once more, and 348AH adds that one to the exponent 32ADH writes. The two constants 0FAH and 0F0H at 342CH and 3434H are the negatives of six and sixteen, the counts of digits of the two types, which 3437H subtracts the mask's places from.

33E0
PUSH HL E5
An integer in an exponent form field (33E0H), which 32DDH jumps to: push Register Pair HL, the buffer pointer at 72FFH, which 3456H takes back.
33E1
PUSH DE D5
Push Register Pair DE, Register D holding the format mask, which 2A87H writes over.
33E2
Call 2A87H of BASIC/OV1, which reads the integer at 72ECH and stores it back as a single precision value with the type at 7142H made 04H.
33E5
POP DE D1
Pop Register Pair DE, the mask, back into that pair.
33E6
XOR A AF
Clear Register A with XOR A, making 00H, which sets the Zero Flag so that the jump below is always taken for an integer.
33E7
A single or double precision number in an exponent form field (33E7H), which 3348H jumps to with the Zero Flag of 32D7H standing: jump to 33ECH on Z, the type being 04H or the value having come from an integer, which sets the single precision count of digits.
33E9
LD E,10H 1E 10
Load Register E with 10H, sixteen, the count of significant digits a double precision value is written to, the type having been 08H.
33EB
LD BC,061EH 01 1E 06
Load Register Pair BC with 061EH, Register B of 06H and Register C of 1EH, whose two operand bytes 1EH and 06H stand at 33ECH as a LD E,06H and are the instruction the jump at 33E7H lands in the middle of, setting Register E to six for a single precision value where this instruction leaves it at sixteen for a double.
33EE
Call 28C4H of BASIC/OV1, which reads the exponent byte at 72EFH and comes back with the Zero Flag set for a value of nothing and the Sign Flag set for a negative one.
33F1
SCF 37
Set the Carry Flag, which 3483H reads to say that the value was taken through the normaliser below rather than left as it stood.
33F2
Call 3496H on NZ, the value being something, which brings it into the range the digit writer wants and comes back with Register A holding the decimal exponent.
33F5
POP HL E1
Pop Register Pair HL, the buffer pointer, which 33E0H or 3346H pushed.
33F6
POP BC C1
Pop Register Pair BC, the two counts 32D6H pushed, Register B the digit places before the decimal point and Register C those after it.
33F7
PUSH AF F5
Push Register AF, Register A holding the decimal exponent and the Carry Flag saying whether the normaliser ran, both of which 3482H takes back.
33F8
LD A,C 79
Load Register C into Register A, the digit places the field asks for after the decimal point.
33F9
OR A B7
Or Register A with itself, which sets the Zero Flag when the field asks for none.
33FA
PUSH AF F5
Push Register AF, that count and the Zero Flag with it, which 3473H takes back.
33FB
Call 2FF7H of BASIC/OV1 on NZ, which is a DEC A and a RET, so that one of the places after the point goes to the point itself.
33FE
ADD A,B 80
Add Register B to Register A, the places before the point, which makes the whole width of the number the field asked for.
33FF
LD C,A 4F
Load Register A into Register C, that width, which the instructions below work down from.
3400
XOR A AF
Clear Register A with XOR A, making 00H, which the test below turns into 00H or 0FFH.
3401
OR B B0
Or Register B with Register A, the places before the decimal point, which sets the Zero Flag when the field asked for none of them.
3402
Jump to 340AH on Z, the field having no places before the point, which leaves Register A at 00H.
3404
LD A,D 7A
Load Register D into Register A, the format mask.
3405
AND 04H E6 04
And Register A with 04H, bit 2 of the mask, which 400BH sets when the sign of the number is to be written after it rather than before.
3407
CP 01H FE 01
Compare Register A with 01H, which sets the Carry Flag when that bit is clear and clears it when the bit is set.
3409
SBC A,A 9F
Subtract Register A and the Carry Flag from itself, which makes Register A 0FFH when the bit was clear and 00H when it was set.
340A
LD D,A 57
Load Register A into Register D, that figure, which is the one place a leading sign takes out of the field.
340B
ADD A,C 81
Add Register C to Register A, the whole width the field asked for, which takes that place off it.
340C
LD C,A 4F
Load Register A into Register C, the width as it now stands.
340D
SUB E 93
Subtract Register E from Register A, the count of significant digits of the type, which leaves the places the field has beyond the digits there are.
340E
PUSH AF F5
Push Register AF, that figure, which 3473H reads back the Zero Flag of.
340F
PUSH BC C5
Push Register Pair BC, Register B the places before the point and Register C the width, which 3458H takes back.
3410
PUSH DE D5
Push Register Pair DE, Register D the one place of a leading sign and Register E the count of digits, which 3457H takes back.
3411
PUSH HL E5
Push Register Pair HL, the buffer pointer, which 3456H takes back.
3412
PUSH AF F5
Push Register AF, the same figure again, which 3436H takes back into Register Pair DE as the count the dividing below works to.
3413
Call 2FF9H of BASIC/OV1 on M, which divides the value by ten and comes back with Register A one higher.
3416
Jump to 3413H on M, Register A still being negative, which divides by ten again until the value has one digit in front of the point.
3419
XOR A AF
Clear Register A with XOR A, making 00H, the value of the flag that says no further division was needed.
341A
LD (72DEH),A 32 DE 72
Store Register A into 72DEH, that flag, which 348AH adds to the exponent written after the number.
341D
LD HL,72DFH 21 DF 72
Load Register Pair HL with 72DFH, a four byte area the mantissa is kept in while the exponent is worked out.
3420
Call 2973H of BASIC/OV1, which pushes 2946H as its own return and copies the accumulator, four bytes of it for a single precision value and eight for a double, into the area Register Pair HL addresses.
3423
Call 76A4H, which loads the type from 7142H, takes 03H off it and comes back with the Parity Flag even for a double precision value.
3426
Jump to 3431H on PE, the value being double precision, where the double precision rounding constant is added.
3429
Call 2614H of BASIC/OV1, the value being single precision, which adds the single precision constant 0.5 at 3629H to the accumulator and so rounds it.
342C
LD A,0FAH 3E FA
Load Register A with 0FAH, which is six taken away from nothing, the count of significant digits of a single precision value as a negative number.
342E
Jump to 3436H, past the double precision pair of instructions below.
3431
Call 2607H of BASIC/OV1, the value being double precision, which copies the accumulator to the second accumulator, loads the double precision constant 0.5 at 3625H and adds the two, rounding the value.
3434
LD A,0F0H 3E F0
Load Register A with 0F0H, which is sixteen taken away from nothing, the count of significant digits of a double precision value as a negative number.
3436
POP DE D1
The value scaled to the digits the field wants (3436H): pop Register Pair DE, the figure 3412H pushed, Register D holding its high half.
3437
SUB D 92
Subtract Register D from Register A, the places the field has beyond the digits of the type, which gives the number of divisions by ten still owed.
3438
Call 2FF9H of BASIC/OV1 on M, which divides the value by ten and raises Register A by one.
343B
Jump to 3438H on M, Register A still being negative, which divides again until the count has run out.
343E
LD A,(72EFH) 3A EF 72
Load Register A with the byte at 72EFH, the exponent byte of the value as the rounding and the dividing have left it.
3441
SUB 81H D6 81
Subtract 81H from Register A, the bias the exponent byte carries plus one, which leaves the exponent the number is to be written with.
3443
PUSH AF F5
Push Register AF, that exponent, which 344AH takes back once the mantissa has been put back.
3444
LD HL,72DFH 21 DF 72
Load Register Pair HL with 72DFH, the area 3420H kept the mantissa in.
3447
Call 296BH of BASIC/OV1, which pushes 2945H as its own return and loads the accumulator back from the area Register Pair HL addresses.
344A
POP AF F1
Pop Register AF, the exponent, back into that pair.
344B
Jump to 3456H on M, the exponent being negative, which needs no further division.
344E
LD A,01H 3E 01
Load Register A with 01H, the value of the flag that says one more division was made.
3450
LD (72DEH),A 32 DE 72
Store Register A into 72DEH, that flag, which 348AH adds to the exponent written after the number.
3453
Call 2FF9H of BASIC/OV1, which divides the value by ten one more time so that its first digit falls in the field.
3456
POP HL E1
The number laid out (3456H): pop Register Pair HL, the buffer pointer 3411H pushed.
3457
POP DE D1
Pop Register Pair DE, Register D the one place of a leading sign and Register E the count of digits, which 3410H pushed.
3458
POP BC C1
Pop Register Pair BC, Register B the places before the point and Register C the width, which 340FH pushed.
3459
POP AF F1
Pop Register AF, the figure 340EH pushed, with the Sign Flag saying whether the field has places beyond the digits there are.
345A
PUSH BC C5
Push Register Pair BC, the two counts again, which 3472H takes back.
345B
PUSH AF F5
Push Register AF, that figure and its flags, which 3473H takes back.
345C
Jump to 3460H on M, the field being narrower than the digits of the type, which leaves Register A as it is for the negation below.
345F
XOR A AF
Clear Register A with XOR A, making 00H, the field having places to spare, so that the negation below gives one.
3460
CPL 2F
Complement Register A, every bit turned over, which with the increment below negates it.
3461
INC A 3C
Increment Register A, which completes the negation of the figure.
3462
ADD A,B 80
Add Register B to Register A, the places the field asks for before the decimal point.
3463
INC A 3C
Increment Register A, the place of the point itself.
3464
ADD A,D 82
Add Register D to Register A, the one place a leading sign takes, which completes the count 352CH and 353EH count down to the point.
3465
LD B,A 47
Load Register A into Register B, that count, which 3551H hands to 353EH before each digit it writes.
3466
LD C,00H 0E 00
Load Register C with 00H, the comma counter turned off: a number in the exponent form carries no commas.
3468
Call 3551H, which writes the significant digits of the value into the buffer, the decimal point falling where Register B runs out.
346B
POP AF F1
Pop Register AF, the figure 345BH pushed, with the Sign Flag standing as it did.
346C
Call 350CH on P, the field having places to spare, which writes Register A characters 0, calling 353EH before each so that the point falls in its place.
346F
Call 353EH, which takes one off Register B and writes the decimal point when the count reaches nothing, so that a number whose digits ran out first still gets one.
3472
POP BC C1
Pop Register Pair BC, the two counts 345AH pushed, Register B the places before the point and Register C the width.
3473
POP AF F1
Pop Register AF, the count 33FAH pushed, with the Zero Flag saying whether the field asked for any places after the decimal point.
3474
Jump to 3482H on NZ, the field having places after the point, which leaves the point and the digits after it standing.
3476
Call 289EH of BASIC/OV1, which is a DEC HL and a RET, so that the last character written is the one looked at below.
3479
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that character.
347A
CP 2EH FE 2E
Compare Register A with 2EH, a decimal point, which is what stands there when the field asked for no places after it.
347C
Call 293CH of BASIC/OV1 on NZ, which is an INC HL and a RET, so that a last character that is a digit is kept and a decimal point is written over.
347F
LD (7199H),HL 22 99 71
Store Register Pair HL into the word at 7199H, the place of the decimal point, so that 330CH measures the number from where it now ends.
3482
POP AF F1
The exponent written (3482H): pop Register AF, the decimal exponent 33F7H pushed, with the Carry Flag saying whether the normaliser ran.
3483
Jump to 3488H on C, the normaliser having run, which leaves the exponent 3496H worked out standing in Register A.
3485
ADD A,E 83
Add Register E to Register A, the count of significant digits of the type, the value not having been normalised.
3486
SUB B 90
Subtract Register B from Register A, the places the field asks for before the decimal point.
3487
SUB D 92
Subtract Register D from Register A, the one place a leading sign takes, which completes the exponent for a value the normaliser left alone.
3488
PUSH BC C5
Push Register Pair BC, the two counts, which 3492H takes back into Register Pair DE.
3489
LD B,A 47
Load Register A into Register B, the exponent, so that the byte at 72DEH may be added to it.
348A
LD A,(72DEH) 3A DE 72
Load Register A with the byte at 72DEH, the flag 341AH cleared and 3450H may have set to 01H.
348D
ADD A,B 80
Add Register B to Register A, the exponent, which raises it by one when 3453H divided the value once more.
348E
Call 32ADH, which writes the marker letter E or D, the sign of the exponent and its two digits into the buffer from Register Pair HL on.
3491
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the buffer pointer 32CDH left in Register Pair DE back into Register Pair HL.
3492
POP DE D1
Pop Register Pair DE, the two counts 3488H pushed, Register D the places before the decimal point and Register E those after it.
3493
Jump to 32F9H, where 317EH suppresses the leading zeros and 3304H checks that the number fits the field it was given.

3496H - The Normaliser, the Decimal Point and the Digit Writers (3496H-360CH)

These are the five pieces every number the interpreter writes is made out of. 3496H is the normaliser: it multiplies or divides the value by ten until it lies between 99999.95 and 999999.5 for single precision or between 1.0E+15 and 9999999999999999.5 for double, which is six digits and sixteen, and gives back the count of divisions in Register A, negative when it had to multiply. Its inner test at 34E8H ends with a JP (HL) on an address it popped itself, so that the recursion through 34DCH unwinds to the caller of the test and not through it. 352CH and 353EH are called once for every digit place and they are what put the decimal point and the commas in: Register B counts the places down and the point is written when it reaches nothing, Register C counts three digits at a time for the commas and 3524H turns it off unless bit 6 of the mask at 717AH asked for them, and 7199H keeps the address of the point for 330CH and 33D4H to measure against. 3504H and 350CH write runs of the character 0, the first without the point and the commas and the second with them. 3551H is the digit writer, and it works by repeated subtraction of powers of ten: a double precision value is rounded by 2607H, turned into a fifty six bit integer and the top ten digits taken out of it with the seven byte table at 3635H, after which the remainder's low four bytes become the accumulator and the last six digits come out of the three byte table at 367BH and the two byte table at 3681H; a single precision value is rounded by 2614H, turned into a twenty four bit integer and written with those last two tables alone, which is six digits exactly. The LD A,9EH and LD A,8EH at 3574H and 357CH are the opcodes of SBC A,(HL) and ADC A,(HL): 2D58H of BASIC/OV1 stores Register A into 2D62H, its own instruction, so one routine both subtracts a seven byte power of ten and adds it back. 35D8H is the sixteen bit integer writer, five digits out of the two byte table and the decimal point after them, which 317BH calls for every integer the interpreter prints.

3496
PUSH DE D5
The value normalised (3496H), which 3271H, 3372H and 33F2H call: push Register Pair DE, which the comparisons below write over and 34E6H gives back.
3497
XOR A AF
Clear Register A with XOR A, making 00H, the count of divisions by ten made so far.
3498
PUSH AF F5
Push Register AF, that count, which every step of the walk below takes off the stack, changes and puts back.
3499
Call 76A4H, which loads the type from 7142H, takes 03H off it and comes back with the Parity Flag odd for anything below double precision.
349C
Jump to 34B8H on PO, the value being single precision, where the comparison against 999999.5 is made.
349F
LD A,(72EFH) 3A EF 72
A double precision value brought up (349FH): load Register A with the byte at 72EFH, the exponent byte of the value in the accumulator.
34A2
CP 91H FE 91
Compare Register A with 91H, which is the exponent byte of a value of about 65536, below which multiplying by ten at a time would take more steps than it is worth.
34A4
Jump to 34B8H on NC, the value standing above that, where the ordinary walk by single powers of ten begins.
34A6
LD DE,360DH 11 0D 36
Load Register Pair DE with 360DH, the address of the double precision constant 1.0E+10.
34A9
LD HL,72F5H 21 F5 72
Load Register Pair HL with 72F5H, the second accumulator, which the multiplication takes its other operand from.
34AC
Call 2946H of BASIC/OV1, which copies as many bytes as the type at 7142H says from the area Register Pair DE addresses to the one Register Pair HL addresses, putting 1.0E+10 in the second accumulator.
34AF
Call 2DB5H of BASIC/OV1, the double precision multiplication, which leaves the value ten thousand million times larger in the accumulator.
34B2
POP AF F1
Pop Register AF, the count of divisions, back into that pair.
34B3
SUB 0AH D6 0A
Subtract 0AH, ten, from Register A, the ten powers of ten just multiplied in, which the count carries as a debt.
34B5
PUSH AF F5
Push Register AF, the count as it now stands.
34B6
Jump to 349FH, which looks at the exponent byte again and multiplies by ten thousand million once more if the value is still that small.
34B8
The walk by single powers of ten (34B8H): call 34E8H, which divides the value by ten until it stands below the upper bound of its type and returns through the address it pops itself.
34BB
The lower bound tested (34BBH): call 76A4H, which loads the type from 7142H, takes 03H off it and comes back with the Parity Flag even for a double precision value.
34BE
Jump to 34CCH on PE, the value being double precision, where the double precision lower bound is used.
34C1
LD BC,9143H 01 43 91
Load Register Pair BC with 9143H, Register B of 91H and Register C of 43H being the exponent byte and the top mantissa byte of the single precision constant 99999.95.
34C4
LD DE,4FF9H 11 F9 4F
Load Register Pair DE with 4FF9H, Register D of 4FH and Register E of 0F9H, the other two bytes of that constant.
34C7
Call 2982H of BASIC/OV1, which compares the single precision value in the accumulator with the one in Register Pair BC and Register Pair DE and leaves the Sign Flag set when the accumulator holds the smaller.
34CA
Jump to 34D2H, where the answer is acted on, which is the same for both types.
34CC
LD DE,3615H 11 15 36
Load Register Pair DE with 3615H, the address of the double precision constant 1.0E+15, the lower bound of the sixteen digit range.
34CF
Call 29BEH of BASIC/OV1, which compares the double precision value in the accumulator with the one Register Pair DE addresses and leaves the Sign Flag set when the accumulator holds the smaller.
34D2
Jump to 34E4H on P, the value standing at the lower bound or above it, which is where the walk ends.
34D5
POP AF F1
Pop Register AF, the count of divisions, back into that pair, the value being too small.
34D6
Call 2FEAH of BASIC/OV1, which multiplies the value in the accumulator by ten and comes back with Register A one lower.
34D9
PUSH AF F5
Push Register AF, the count as it now stands, one further into the debt.
34DA
Jump to 34BBH, which tests the lower bound again and multiplies by ten once more if the value is still below it.
34DC
POP AF F1
The value too large (34DCH), which 3500H jumps to: pop Register AF, the count of divisions.
34DD
Call 2FF9H of BASIC/OV1, which divides the value in the accumulator by ten and comes back with Register A one higher, the INC A at 300AH of this file being that routine's own tail.
34E0
PUSH AF F5
Push Register AF, the count as it now stands, one division further on.
34E1
Call 34E8H, which tests the upper bound again and comes back here through its own JP (HL) if the value needs dividing once more.
34E4
POP AF F1
The walk finished (34E4H): pop Register AF, the count of divisions, which is the answer this routine gives.
34E5
OR A B7
Or Register A with itself, which sets the Sign Flag on the count and leaves it alone, so that 3285H, 3377H and 3413H can read its sign.
34E6
POP DE D1
Pop Register Pair DE, which 3496H pushed, so that the caller gets that pair back as it was.
34E7
RET C9
Return to the caller with Register A holding the decimal exponent, negative when the value had to be multiplied up.
34E8
The upper bound tested (34E8H), which 34B8H and 34E1H call: call 76A4H, which comes back with the Parity Flag even for a double precision value.
34EB
Jump to 34F9H on PE, the value being double precision, where the double precision upper bound is used.
34EE
LD BC,9474H 01 74 94
Load Register Pair BC with 9474H, Register B of 94H and Register C of 74H being the exponent byte and the top mantissa byte of the single precision constant 999999.5.
34F1
LD DE,23F8H 11 F8 23
Load Register Pair DE with 23F8H, Register D of 23H and Register E of 0F8H, the other two bytes of that constant.
34F4
Call 2982H of BASIC/OV1, which compares the single precision value with the one in Register Pair BC and Register Pair DE and leaves the Sign Flag set when the accumulator holds the smaller.
34F7
Jump to 34FFH, where the answer is acted on, which is the same for both types.
34F9
LD DE,361DH 11 1D 36
Load Register Pair DE with 361DH, the address of the double precision constant 9999999999999999.5, the upper bound of the sixteen digit range.
34FC
Call 29BEH of BASIC/OV1, which compares the double precision value with the one Register Pair DE addresses and leaves the Sign Flag set when the accumulator holds the smaller.
34FF
POP HL E1
The answer and the return in one (34FFH): pop Register Pair HL, which is this routine's own return address.
3500
Jump to 34DCH on P, the value standing at the upper bound or above it, which divides it by ten and comes back here: the return address is off the stack, so a walk of any length unwinds to one place.
3503
JP (HL) E9
Jump to the address in Register Pair HL, the return popped above, the value standing below the upper bound.
3504
OR A B7
A run of the character 0 (3504H), which 32EAH, 32F6H, 337FH, 33B3H, 33BCH, 33C7H and 33D9H call with Register A holding how many: or Register A with itself, which sets the Zero Flag when none are wanted.
3505
RET Z C8
The count tested (3505H): return on Z, the run being finished, which is the one way out of this routine.
3506
DEC A 3D
Decrement Register A, one of the characters being about to be written.
3507
LD (HL),30H 36 30
Store 30H, the character 0, into the byte Register Pair HL addresses.
3509
INC HL 23
Increment Register Pair HL to the place the next character goes.
350A
Jump to 3505H, which writes another 0 unless the count has run out: no decimal point and no comma is written on this path.
350C
A run of the character 0 with the point and the commas (350CH), which 346CH calls: jump to 3512H on NZ, the caller having left the Zero Flag clear, which writes the first character without calling 353EH for it.
350E
RET Z C8
The count tested (350EH): return on Z, the run being finished.
350F
Call 353EH, which takes one off Register B and writes the decimal point when the count reaches nothing and a comma every third digit.
3512
LD (HL),30H 36 30
The character written (3512H), which 3389H also calls: store 30H, the character 0, into the byte Register Pair HL addresses.
3514
INC HL 23
Increment Register Pair HL to the place the next character goes.
3515
DEC A 3D
Decrement Register A, one of the characters having been written.
3516
Jump to 350EH, which writes another unless the count has run out.
3518
LD A,E 7B
The place of the decimal point worked out (3518H), which 3382H and 33B7H call: load Register E into Register A, the decimal exponent of the value.
3519
ADD A,D 82
Add Register D to Register A, the count of significant digits of the type, six or sixteen.
351A
INC A 3C
Increment Register A, the place of the point itself, which makes the number of calls of 353EH before the point is due.
351B
LD B,A 47
Load Register A into Register B, that count, which 352CH and 353EH count down to nothing.
351C
INC A 3C
Increment Register A again, which with the subtractions below works out where the first comma falls.
351D
SUB 03H D6 03
The first comma found (351DH): subtract 03H from Register A, three digits being the space between commas.
351F
Jump to 351DH on NC, there being another three in the count, which takes the remainder down to between minus three and minus one.
3521
ADD A,05H C6 05
Add 05H to Register A, which brings that remainder up to between two and four, the number of digits before the first comma is due.
3523
LD C,A 4F
Load Register A into Register C, the comma counter, which 3549H counts down and resets to 03H.
3524
LD A,(717AH) 3A 7A 71
The commas turned off unless they were asked for (3524H), which 32E3H calls: load Register A with the byte at 717AH, the format mask 31C4H stored.
3527
AND 40H E6 40
And Register A with 40H, bit 6 of the mask, which 3FDAH sets when the format has a comma in it.
3529
RET NZ C0
Return on NZ, the commas having been asked for, which leaves the counter in Register C standing.
352A
LD C,A 4F
Load Register A into Register C, 00H, which turns the comma counter off: 3549H then decrements it to 0FFH and returns without writing anything.
352B
RET C9
Return to the caller with the point counter in Register B and the comma counter in Register C.
352C
DEC B 05
The first digit place (352CH), which 3294H calls before any digit is written: decrement Register B, the count of places before the decimal point is due.
352D
Jump to 353FH on P, the count not having gone below nothing, where the ordinary place is dealt with.
3530
LD (7199H),HL 22 99 71
Store Register Pair HL into the word at 7199H, the address the decimal point is written at, which 330BH and 33D4H read.
3533
LD (HL),2EH 36 2E
Store 2EH, a decimal point, into the byte Register Pair HL addresses, the count having begun at nothing or less: this is the point of a value smaller than one.
3535
INC HL 23
A zero after the point (3535H): increment Register Pair HL to the place the next character goes.
3536
LD (HL),30H 36 30
Store 30H, the character 0, into the byte Register Pair HL addresses, which is one of the zeros that stand between the point and the first significant digit.
3538
INC B 04
Increment Register B, the count, which was negative and is brought up towards nothing.
3539
Jump to 3535H on NZ, the count not yet being nothing, which writes another zero after the point.
353B
INC HL 23
Increment Register Pair HL to the place the first significant digit goes.
353C
LD C,B 48
Load Register B into Register C, 00H, which turns the comma counter off: a value written as a leading point and zeros carries no commas.
353D
RET C9
Return to the caller with the point and its zeros written.
353E
DEC B 05
The next digit place (353EH), which 338DH, 346FH, 350FH, 3568H, 35A6H, 35DEH and 3607H all call: decrement Register B, the count of places before the decimal point is due.
353F
The count tested (353FH), which 352DH jumps to: jump to 3549H on NZ, the point not being due at this place, where the comma counter is dealt with.
3541
LD (HL),2EH 36 2E
The decimal point written (3541H), which 33C0H calls outright: store 2EH, a decimal point, into the byte Register Pair HL addresses.
3543
LD (7199H),HL 22 99 71
Store Register Pair HL into the word at 7199H, the address of the point, which 330BH, 347FH and 33D4H read.
3546
INC HL 23
Increment Register Pair HL to the place the next digit goes.
3547
LD C,B 48
Load Register B into Register C, 00H, which turns the comma counter off: nothing after the decimal point is grouped.
3548
RET C9
Return to the caller with the point written and the Zero Flag set, which 3299H and 33D1H read.
3549
DEC C 0D
The comma counter (3549H): decrement Register C, the count of digits still to go before a comma is due.
354A
RET NZ C0
Return on NZ, no comma being due at this place, which is the way out of all but every third call.
354B
LD (HL),2CH 36 2C
Store 2CH, a comma, into the byte Register Pair HL addresses, the three digits since the last one having been written.
354D
INC HL 23
Increment Register Pair HL to the place the next digit goes.
354E
LD C,03H 0E 03
Load Register C with 03H, three, the digits that go by before the next comma is due.
3550
RET C9
Return to the caller with the comma written and the counter in Register C set to three again.
3551
PUSH DE D5
The significant digits written (3551H), which 329CH, 3385H, 33CDH and 3468H call: push Register Pair DE, which the tables below write over.
3552
PUSH BC C5
Push Register Pair BC, the point counter and the comma counter, which the rounding below writes over.
3553
PUSH HL E5
Push Register Pair HL, the buffer pointer, for the same reason.
3554
Call 76A4H, which loads the type from 7142H, takes 03H off it and comes back with the Parity Flag even for a double precision value.
3557
Jump to 3594H on PO, the value being single precision, where six digits are written out of a twenty four bit integer.
355A
Call 2607H of BASIC/OV1, which copies the accumulator to the second accumulator, loads the double precision constant 0.5 at 3625H and adds the two, rounding the value up at the digit the writing stops at.
355D
XOR A AF
Clear Register A with XOR A, which clears the Carry Flag: 2B41H of BASIC/OV1 pushes Register AF at once and reads that flag at 2B68H, where a clear Carry Flag means the answer is to be left as a fifty six bit integer and a set one means it is to be normalised back into a double precision value, so this instruction is here for the flag and not for the 00H.
355E
Call 2B41H of BASIC/OV1, which leaves the double precision value as a fifty six bit integer in 72E8H to 72EEH, the form the seven byte subtraction below works on.
3561
POP HL E1
Pop Register Pair HL, the buffer pointer 3553H pushed.
3562
POP BC C1
Pop Register Pair BC, the point counter and the comma counter 3552H pushed.
3563
LD DE,3635H 11 35 36
Load Register Pair DE with 3635H, the first of the ten seven byte powers of ten, which is 1.0E+15.
3566
LD A,0AH 3E 0A
Load Register A with 0AH, ten, the digits taken out of the value with that table.
3568
The next digit of the top ten (3568H): call 353EH, which takes one off Register B and writes the decimal point or a comma when one falls at this place.
356B
PUSH BC C5
Push Register Pair BC, the point counter and the comma counter, which the subtraction below writes over.
356C
PUSH AF F5
Push Register AF, Register A holding the count of digits still to write.
356D
PUSH HL E5
Push Register Pair HL, the buffer pointer, which 3582H takes back.
356E
PUSH DE D5
Push Register Pair DE, the table pointer, which 3572H and 357BH take back into Register Pair HL.
356F
LD B,2FH 06 2F
Load Register B with 2FH, one below the character 0, which the loop below counts up from.
3571
INC B 04
One more of this power of ten (3571H): increment Register B, the digit as a character, which the first time round makes it the character 0.
3572
POP HL E1
Pop Register Pair HL, the table pointer, which the subtraction takes its seven bytes from.
3573
PUSH HL E5
Push Register Pair HL, that pointer again, for the next time round the loop.
3574
LD A,9EH 3E 9E
Load Register A with 9EH, which is the opcode of SBC A,(HL), the instruction the routine below patches itself with.
3576
Call 2D58H of BASIC/OV1, which stores Register A into 2D62H, its own instruction, and then runs seven bytes of the value at 72E8H against the seven Register Pair HL addresses, so that the power of ten is taken away.
3579
Jump to 3571H on NC, the subtraction not having run below nothing, which counts another one of this power of ten.
357B
POP HL E1
Pop Register Pair HL, the table pointer, the subtraction having gone one too far.
357C
LD A,8EH 3E 8E
Load Register A with 8EH, which is the opcode of ADC A,(HL), so that the same routine adds where it took away.
357E
Call 2D58H of BASIC/OV1, which patches 2D62H with that opcode and adds the seven bytes Register Pair HL addresses back into the value, undoing the subtraction that went too far and leaving Register Pair HL past them.
3581
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the table pointer, now past this power of ten, into Register Pair DE for the next time round.
3582
POP HL E1
Pop Register Pair HL, the buffer pointer 356DH pushed.
3583
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the digit the counting loop made as a character.
3584
INC HL 23
Increment Register Pair HL to the place the next digit goes.
3585
POP AF F1
Pop Register AF, the count of digits still to write, which 356CH pushed.
3586
POP BC C1
Pop Register Pair BC, the point counter and the comma counter, which 356BH pushed.
3587
DEC A 3D
Decrement Register A, one of the ten digits having been written.
3588
Jump to 3568H on NZ, there being more of the ten to write, which takes the loop round with the table pointer moved on.
358A
PUSH BC C5
The remainder taken up (358AH): push Register Pair BC, the point counter and the comma counter, which 35A0H takes back.
358B
PUSH HL E5
Push Register Pair HL, the buffer pointer, which 359FH takes back.
358C
LD HL,72E8H 21 E8 72
Load Register Pair HL with 72E8H, the lowest four bytes of what is left of the value after the top ten digits have been taken out of it.
358F
Call 2924H of BASIC/OV1, which loads those four bytes into Register Pair DE and Register Pair BC and stores them into 72ECH and 72EEH, so that the remainder becomes the accumulator's own four bytes.
3592
Jump to 359FH, where the last six digits are written the way a single precision value's six are.
3594
A single precision value (3594H): call 2614H of BASIC/OV1, which adds the single precision constant 0.5 at 3629H to the accumulator, rounding the value at the sixth digit.
3597
LD A,01H 3E 01
Load Register A with 01H, which is the scale the conversion below is asked for.
3599
Call 2AB7H of BASIC/OV1, which with that argument leaves the value as a twenty four bit integer in Register Pair BC and Register Pair DE.
359C
Call 2927H of BASIC/OV1, which stores Register Pair HL into 72ECH and Register Pair BC into 72EEH, putting that integer in the accumulator.
359F
POP HL E1
The last six digits (359FH), which 3592H also reaches: pop Register Pair HL, the buffer pointer.
35A0
POP BC C1
Pop Register Pair BC, the point counter and the comma counter.
35A1
XOR A AF
Clear Register A with XOR A, making 00H, which clears the Carry Flag for the complement below.
35A2
LD DE,367BH 11 7B 36
Load Register Pair DE with 367BH, the first of the two three byte powers of ten, which is one hundred thousand.
35A5
CCF 3F
The next of the two (35A5H): complement the Carry Flag, which is clear the first time round and set the second, so that 35D0H takes the loop round exactly twice.
35A6
Call 353EH, which takes one off Register B and writes the decimal point or a comma when one falls at this place.
35A9
PUSH BC C5
Push Register Pair BC, the point counter and the comma counter, which the subtraction below writes over.
35AA
PUSH AF F5
Push Register AF, Register A and the Carry Flag the complement above made, which 35CEH takes back.
35AB
PUSH HL E5
Push Register Pair HL, the buffer pointer, which 35CBH takes back.
35AC
PUSH DE D5
Push Register Pair DE, the table pointer, which 35B0H takes back into Register Pair HL.
35AD
Call 2932H of BASIC/OV1, which loads Register Pair DE and Register Pair BC from 72ECH, so that Register E, Register D and Register C hold the twenty four bit value the subtraction works on.
35B0
POP HL E1
Pop Register Pair HL, the table pointer, which the three bytes below are read from.
35B1
LD B,2FH 06 2F
Load Register B with 2FH, one below the character 0, which the loop below counts up from.
35B3
INC B 04
One more of this power of ten (35B3H): increment Register B, the digit as a character.
35B4
LD A,E 7B
Load Register E into Register A, the low byte of the value.
35B5
SUB (HL) 96
Subtract the byte Register Pair HL addresses from Register A, the low byte of the power of ten.
35B6
LD E,A 5F
Load Register A into Register E, the low byte of the difference.
35B7
INC HL 23
Increment Register Pair HL to the middle byte of the power of ten.
35B8
LD A,D 7A
Load Register D into Register A, the middle byte of the value.
35B9
SBC A,(HL) 9E
Subtract the byte Register Pair HL addresses and the Carry Flag from Register A, the middle byte of the power of ten.
35BA
LD D,A 57
Load Register A into Register D, the middle byte of the difference.
35BB
INC HL 23
Increment Register Pair HL to the high byte of the power of ten.
35BC
LD A,C 79
Load Register C into Register A, the high byte of the value.
35BD
SBC A,(HL) 9E
Subtract the byte Register Pair HL addresses and the Carry Flag from Register A, the high byte of the power of ten.
35BE
LD C,A 4F
Load Register A into Register C, the high byte of the difference.
35BF
DEC HL 2B
Decrement Register Pair HL to the middle byte of the power of ten.
35C0
DEC HL 2B
Decrement Register Pair HL again, back to its first byte, ready for the next time round the loop.
35C1
Jump to 35B3H on NC, the subtraction not having run below nothing, which counts another one of this power of ten.
35C3
Call 26D1H of BASIC/OV1, which adds the three bytes Register Pair HL addresses back into Register E, Register D and Register C, undoing the subtraction that went too far, and leaves Register Pair HL on the third of them.
35C6
INC HL 23
Increment Register Pair HL past that third byte, which is the next power of ten in the table.
35C7
Call 2927H of BASIC/OV1, which stores Register Pair HL into 72ECH and Register Pair BC into 72EEH; the exchange it begins with puts the remainder back in the accumulator and leaves the table pointer in Register Pair HL.
35CA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the table pointer into Register Pair DE for the next time round.
35CB
POP HL E1
Pop Register Pair HL, the buffer pointer 35ABH pushed.
35CC
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the digit the counting loop made.
35CD
INC HL 23
Increment Register Pair HL to the place the next digit goes.
35CE
POP AF F1
Pop Register AF, which 35AAH pushed, the Carry Flag standing as the complement at 35A5H left it.
35CF
POP BC C1
Pop Register Pair BC, the point counter and the comma counter, which 35A9H pushed.
35D0
Jump to 35A5H on C, this having been the first of the two three byte powers of ten, which takes the loop round for the second and complements the flag so that it ends there.
35D2
INC DE 13
Increment Register Pair DE past the first byte of the two byte table that follows the three byte one.
35D3
INC DE 13
Increment Register Pair DE again, so that it addresses 3683H, the power of ten one thousand, the two entries above it having been used as three byte values.
35D4
LD A,04H 3E 04
Load Register A with 04H, four, the digits still to write out of the two byte table.
35D6
Jump to 35DEH, the loop of the integer writer below, which writes them.
35D8
PUSH DE D5
A sixteen bit integer written (35D8H), which 317BH, 32EDH and 3F7CH call: push Register Pair DE, which the table pointer below writes over.
35D9
LD DE,3681H 11 81 36
Load Register Pair DE with 3681H, the first of the five two byte powers of ten, which is ten thousand.
35DC
LD A,05H 3E 05
Load Register A with 05H, five, the digits of a sixteen bit integer.
35DE
The next digit (35DEH), which 35D6H also reaches: call 353EH, which takes one off Register B and writes the decimal point or a comma when one falls at this place.
35E1
PUSH BC C5
Push Register Pair BC, the point counter and the comma counter, which the subtraction below writes over.
35E2
PUSH AF F5
Push Register AF, Register A holding the count of digits still to write.
35E3
PUSH HL E5
Push Register Pair HL, the buffer pointer, which 35FFH takes back.
35E4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the table pointer into Register Pair HL.
35E5
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the power of ten.
35E6
INC HL 23
Increment Register Pair HL to the high byte of that power of ten, the table holding each of the five as two bytes.
35E7
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, that high byte, so that Register Pair BC holds the power of ten.
35E8
PUSH BC C5
Push Register Pair BC, that power of ten, which 35EAH exchanges with the pointer underneath it.
35E9
INC HL 23
Increment Register Pair HL past it, which is the next entry of the table.
35EA
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which leaves the table pointer on the stack and the power of ten in Register Pair HL.
35EB
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the power of ten into Register Pair DE for the subtraction and the old Register Pair DE into Register Pair HL.
35EC
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the sixteen bit integer being written.
35EF
LD B,2FH 06 2F
Load Register B with 2FH, one below the character 0, which the loop below counts up from.
35F1
INC B 04
One more of this power of ten (35F1H): increment Register B, the digit as a character.
35F2
LD A,L 7D
Load Register L into Register A, the low byte of the integer.
35F3
SUB E 93
Subtract Register E from Register A, the low byte of the power of ten.
35F4
LD L,A 6F
Load Register A into Register L, the low byte of the difference.
35F5
LD A,H 7C
Load Register H into Register A, the high byte of the integer.
35F6
SBC A,D 9A
Subtract Register D and the Carry Flag from Register A, the high byte of the power of ten.
35F7
LD H,A 67
Load Register A into Register H, so that Register Pair HL holds the difference.
35F8
Jump to 35F1H on NC, the subtraction not having run below nothing, which counts another one of this power of ten.
35FA
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the power of ten, which puts back the subtraction that went too far.
35FB
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the integer as it now stands, the digits written so far taken out of it.
35FE
POP DE D1
Pop Register Pair DE, the table pointer 35EAH left on the stack, which addresses the next power of ten.
35FF
POP HL E1
Pop Register Pair HL, the buffer pointer 35E3H pushed.
3600
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the digit the counting loop made.
3601
INC HL 23
Increment Register Pair HL to the place the next digit goes.
3602
POP AF F1
Pop Register AF, the count of digits still to write, which 35E2H pushed.
3603
POP BC C1
Pop Register Pair BC, the point counter and the comma counter, which 35E1H pushed.
3604
DEC A 3D
Decrement Register A, one of the digits having been written.
3605
Jump to 35DEH on NZ, there being more digits to write, which takes the loop round with the table pointer moved on.
3607
Call 353EH, which takes one off Register B and writes the decimal point when the count reaches nothing, so that the point falls after the digits just written.
360A
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, Register A being 00H after the loop above, which ends the digits with the byte the text writer stops on.
360B
POP DE D1
Pop Register Pair DE, which 35D8H pushed, so that the caller gets that pair back as it was.
360C
RET C9
Return to the caller with the digits written and Register Pair HL on the byte after them.

360DH - The Number Package's Constants and its Four Tables of Powers of Ten (360DH-368AH)

Every one of these is data and a decoder reading straight through this region gives nonsense for all of it. The six constants come first, in the eight byte double precision form of three mantissa words and a seventh mantissa byte with the exponent byte last, the top mantissa byte carrying the sign in its own bit 7 and the leading one of the mantissa being implied. The double precision 0.5 at 3625H and the single precision 0.5 at 3629H are the same four bytes read twice: 2607H loads eight bytes from 3625H and 2614H and 36D7H load four from 3629H, which are the top four of them, and the overlap is deliberate because the low four bytes of the double constant are all 00H. Then come the four tables of powers of ten the digit writers subtract, each in the width that writer works in: ten seven byte entries at 3635H from 1.0E+15 down to one million, which 3563H walks for the top ten digits of a double precision value; two three byte entries at 367BH, one hundred thousand and ten thousand, which 35A2H walks twice; and five two byte entries at 3681H, ten thousand down to one, which 35D9H walks for every sixteen bit integer the interpreter prints and which 35D3H joins two bytes in for the last four digits of a floating point number. Nothing in the file names 3683H to 368AH, the last four of the two byte entries, because they are reached by walking the table and never by their own address.

360D-3614
DEFB 00H, 00H, 00H, 00H, 0F9H, 02H, 15H, 0A2H 00 00 00 00 F9 02 15 A2
360DH to 3614H: the double precision constant 1.0E+10, which 34A6H copies into the second accumulator to bring a very small double precision value up ten powers of ten at a time instead of one. Its exponent byte is 0A2H, which is 34 above the bias of 80H, and its top mantissa byte 15H stands for a fraction of 0.58207660913.
3615-361C
DEFB 0E1H, 0FFH, 9FH, 31H, 0A9H, 5FH, 63H, 0B2H E1 FF 9F 31 A9 5F 63 B2
3615H to 361CH: the double precision constant 1.0E+15, which 34CCH compares a double precision value against as the lower bound of the sixteen digit range. Its exponent byte is 0B2H, 50 above the bias, and its top mantissa byte 63H stands for a fraction of 0.88817841970.
361D-3624
DEFB 0FEH, 0FFH, 03H, 0BFH, 0C9H, 1BH, 0EH, 0B6H FE FF 03 BF C9 1B 0E B6
361DH to 3624H: the double precision constant 9999999999999999.5, which 34F9H compares a double precision value against as the upper bound of the sixteen digit range. It differs from the 1.0E+16 at 362DH in its lowest two bytes alone, by two units of the fifty sixth bit of the mantissa, which at an exponent byte of 0B6H is one half exactly.
3625-3628
DEFB 00H, 00H, 00H, 00H 00 00 00 00
3625H to 3628H: the low four bytes of the double precision constant 0.5, which 2607H loads to round a double precision value before its digits are taken out. All four are 00H, which is what lets the single precision constant below be the top four bytes of this one.
3629-362C
DEFB 00H, 00H, 00H, 80H 00 00 00 80
3629H to 362CH: the single precision constant 0.5, which 2614H loads to round a single precision value and 36D7H loads as the power SQR raises its argument to. These same four bytes are the top four of the double precision 0.5 above, so one constant serves both widths: the exponent byte 80H is the bias itself and the mantissa is the implied leading one alone.
362D-3634
DEFB 00H, 00H, 04H, 0BFH, 0C9H, 1BH, 0EH, 0B6H 00 00 04 BF C9 1B 0E B6
362DH to 3634H: the double precision constant 1.0E+16, which 334DH compares a double precision value against to find out whether any PRINT USING field could hold it. 3361H holds the same value as a single precision constant in its own instructions, Register Pair BC of 0B60EH and Register Pair DE of 1BCAH being its four bytes.
3635-363B
DEFB 00H, 80H, 0C6H, 0A4H, 7EH, 8DH, 03H 00 80 C6 A4 7E 8D 03
3635H to 363BH: the first of the ten seven byte powers of ten, 1.0E+15, which is 3563H's starting entry and the one the first digit of a double precision value is counted out of.
363C-3642
DEFB 00H, 40H, 7AH, 10H, 0F3H, 5AH, 00H 00 40 7A 10 F3 5A 00
363CH to 3642H: 1.0E+14, the second of the ten.
3643-3649
DEFB 00H, 0A0H, 72H, 4EH, 18H, 09H, 00H 00 A0 72 4E 18 09 00
3643H to 3649H: 1.0E+13, the third of the ten.
364A-3650
DEFB 00H, 10H, 0A5H, 0D4H, 0E8H, 00H, 00H 00 10 A5 D4 E8 00 00
364AH to 3650H: 1.0E+12, the fourth of the ten.
3651-3657
DEFB 00H, 0E8H, 76H, 48H, 17H, 00H, 00H 00 E8 76 48 17 00 00
3651H to 3657H: 1.0E+11, the fifth of the ten.
3658-365E
DEFB 00H, 0E4H, 0BH, 54H, 02H, 00H, 00H 00 E4 0B 54 02 00 00
3658H to 365EH: 1.0E+10, the sixth of the ten, which is the same number as the constant at 360DH written as a fifty six bit integer instead of a floating point value.
365F-3665
DEFB 00H, 0CAH, 9AH, 3BH, 00H, 00H, 00H 00 CA 9A 3B 00 00 00
365FH to 3665H: one thousand million, the seventh of the ten.
3666-366C
DEFB 00H, 0E1H, 0F5H, 05H, 00H, 00H, 00H 00 E1 F5 05 00 00 00
3666H to 366CH: one hundred million, the eighth of the ten.
366D-3673
DEFB 80H, 96H, 98H, 00H, 00H, 00H, 00H 80 96 98 00 00 00 00
366DH to 3673H: ten million, the ninth of the ten.
3674-367A
DEFB 40H, 42H, 0FH, 00H, 00H, 00H, 00H 40 42 0F 00 00 00 00
3674H to 367AH: one million, the tenth and last of the seven byte entries, after which 358AH takes the remainder up as four bytes and the smaller tables finish the number.
367B-367D
DEFB 0A0H, 86H, 01H A0 86 01
367BH to 367DH: one hundred thousand as a three byte value, which is 35A2H's starting entry and the one the first of the last six digits is counted out of.
367E-3680
DEFB 10H, 27H, 00H 10 27 00
367EH to 3680H: ten thousand as a three byte value, the second and last of the three byte entries, after which 35D2H and 35D3H step two bytes on into the table below.
3681-3682
DEFB 10H, 27H 10 27
3681H to 3682H: ten thousand as a two byte value, which is 35D9H's starting entry for a sixteen bit integer. Its two bytes are not the two the three byte entry above ends with: that one carries a 00H after them.
3683-3684
DEFB 0E8H, 03H E8 03
3683H to 3684H: one thousand, the second of the five two byte entries and the one 35D3H leaves Register Pair DE addressing when a floating point number has its last four digits still to write.
3685-3686
DEFB 64H, 00H 64 00
3685H to 3686H: one hundred, the third of the five.
3687-3688
DEFB 0AH, 00H 0A 00
3687H to 3688H: ten, the fourth of the five, which writes the tens digit of every integer printed.
3689-368A
DEFB 01H, 00H 01 00
3689H to 368AH: one, the fifth and last entry of every one of the four tables, which writes the units digit and leaves the remainder at nothing.

368BH - OCT$ and HEX$, and the Trampoline that Negates an Answer (368BH-36D3H)

OCT$ and HEX$ are one routine and the only difference between them is Register B, 00H for the one and 01H for the other. 368EH is an entry point inside the JP NZ,0106H at 368DH, whose operand bytes 06H and 01H stand as a LD B,01H, and the jump itself can never be taken because the XOR A two instructions above it sets the Zero Flag, so the three bytes exist to hold the other function's entry and nothing else. The digits come out of the value four bits at a time for hexadecimal and three for octal, which is why the loop has four shifts in it and the two entries into it are three instructions apart: 36A3H shifts four times and 36A9H once, and the second time round 36C8H goes to 36A5H for three shifts of octal where 36CAH goes to 36A3H for four of hexadecimal, a sixteen bit value being five octal digits of three bits and a sixth of one. The leading zeros are suppressed by a trick worth keeping: 36BFH writes each character twice, once where it belongs and once in the place the next one will take, so the byte 36B2H reads is 00H exactly while nothing has been written yet and the character just written afterwards, and no separate flag is needed. 36CFH is three instructions that make the caller's caller return through 28F3H, which flips bit 7 of the top mantissa byte at 72EEH and so negates the answer: it loads 28F3H into Register Pair HL, exchanges it with the return address on the stack and jumps to the address it got back, so control carries on where the call would have returned to with a negation owed at the end. EXP uses it at 377FH and ATN at 39A5H.

368B
XOR A AF
OCT$ (368BH), which 4614H calls and 7B7EH jumps to: clear Register A with XOR A, making 00H, which also sets the Zero Flag so that the jump below can never be taken.
368C
LD B,A 47
Load Register B from Register A, 00H, the flag that says octal, three bits to a digit and six digits to a sixteen bit value.
368D
JP NZ,0106H C2 06 01
Jump to 0106H on NZ, which never happens, the XOR A above having set the Zero Flag: the three bytes are here for their operand, which stands at 368EH as the LD B,01H that is HEX$'s own entry.
3690
PUSH BC C5
Both functions (3690H): push Register Pair BC, Register B holding which of the two is being done, which the conversion below writes over.
3691
Call 6570H, the address conversion, which works the argument out, lets an integer through and brings a single precision value of 32768 or more down into the signed range by adding minus 65536, leaving the sixteen bits in Register Pair HL.
3694
POP BC C1
Pop Register Pair BC, that flag, back into that pair.
3695
LD DE,72FDH 11 FD 72
Load Register Pair DE with 72FDH, the first byte of the text the digits are written into.
3698
PUSH DE D5
Push Register Pair DE, that address, which 36CDH takes back as the start of the finished text.
3699
XOR A AF
Clear Register A with XOR A, making 00H, which marks the text as having nothing in it yet.
369A
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, 72FDH, which is the byte 36B2H reads to find out whether a digit has been written.
369B
DEC B 05
Decrement Register B, the flag that says which of the two functions is being done, which the increment below puts straight back.
369C
INC B 04
Increment Register B again, which leaves it as it was and sets the Zero Flag when it is 00H, the two instructions being a test of that register that spoils no other one.
369D
LD C,06H 0E 06
Load Register C with 06H, six, the digits of a sixteen bit value written in octal.
369F
Jump to 36A9H on Z, the function being OCT$, which takes the single shift that gets the top octal digit of sixteen bits.
36A1
LD C,04H 0E 04
Load Register C with 04H, four, the digits of a sixteen bit value written in hexadecimal.
36A3
ADD HL,HL 29
Four bits taken out (36A3H): add Register Pair HL to itself, which shifts the value left one place and puts its top bit into the Carry Flag.
36A4
ADC A,A 8F
Add Register A to itself with the Carry Flag, which brings that bit into the bottom of the digit being built.
36A5
ADD HL,HL 29
Three bits taken out (36A5H): add Register Pair HL to itself, the second of the four shifts.
36A6
ADC A,A 8F
Add Register A to itself with the Carry Flag, the second bit of the digit.
36A7
ADD HL,HL 29
Add Register Pair HL to itself, the third of the four shifts.
36A8
ADC A,A 8F
Add Register A to itself with the Carry Flag, the third bit of the digit.
36A9
ADD HL,HL 29
One bit taken out (36A9H): add Register Pair HL to itself, the last of the four shifts.
36AA
ADC A,A 8F
Add Register A to itself with the Carry Flag, which completes the digit in Register A.
36AB
OR A B7
Or Register A with itself, which sets the Zero Flag when the digit is nothing and leaves it alone.
36AC
Jump to 36B7H on NZ, the digit being something, which writes it whether anything has gone before it or not.
36AE
LD A,C 79
Load Register C into Register A, the count of digits still to write.
36AF
DEC A 3D
Decrement Register A, so that the Zero Flag is set when this is the last digit of the value.
36B0
Jump to 36B7H on Z, this being the last digit, which writes a 0 for a value of nothing rather than an empty string.
36B2
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, which is 00H while nothing has been written and the last character written after that.
36B3
OR A B7
Or Register A with itself, which sets the Zero Flag on that byte.
36B4
Jump to 36C2H on Z, nothing having been written yet, which throws this leading zero away.
36B6
XOR A AF
Clear Register A with XOR A, making 00H, the digit, something having been written before it so that the zero is kept.
36B7
ADD A,30H C6 30
The digit written (36B7H): add 30H to Register A, the character 0, which turns the digit into its character.
36B9
CP 3AH FE 3A
Compare Register A with 3AH, one past the character 9, which only a hexadecimal digit of ten or more reaches.
36BB
Jump to 36BFH on C, the character being one of the ten digits, which needs no further adjustment.
36BD
ADD A,07H C6 07
Add 07H to Register A, the seven characters between the 9 and the A, which turns ten to fifteen into the letters A to F.
36BF
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, the digit in its own place.
36C0
INC DE 13
Increment Register Pair DE to the place the next digit goes.
36C1
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses as well, the same character written a second time: it is what 36B2H reads as the mark that something has been written, and the next digit writes over it.
36C2
XOR A AF
The next digit (36C2H): clear Register A with XOR A, making 00H, the digit the shifts below build up.
36C3
DEC C 0D
Decrement Register C, the count of digits still to write.
36C4
Jump to 36CCH on Z, every digit having been written, where the text is ended.
36C6
DEC B 05
Decrement Register B, the flag that says which function is being done, which the increment below puts straight back.
36C7
INC B 04
Increment Register B again, which leaves it as it was and sets the Zero Flag for OCT$ and clears it for HEX$.
36C8
Jump to 36A5H on Z, the function being OCT$, which takes three shifts for the next octal digit.
36CA
Jump to 36A3H, the function being HEX$, which takes four shifts for the next hexadecimal digit.
36CC
LD (DE),A 12
The text ended (36CCH): store Register A into the byte Register Pair DE addresses, 00H after the shifts above, which writes over the duplicate character and ends the text.
36CD
POP HL E1
Pop Register Pair HL, 72FDH, which 3698H pushed, so that the caller gets the address of the text.
36CE
RET C9
Return to the caller, which is 4617H or 461CH of the string package, with the text at 72FDH.
36CF
LD HL,28F3H 21 F3 28
The answer made negative on the way out (36CFH), which 377FH of EXP and 39A5H of ATN call: load Register Pair HL with 28F3H, the three instructions of BASIC/OV1 that flip bit 7 of the byte at 72EEH and so negate the value in the accumulator.
36D2
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which leaves 28F3H on the stack as the return address and brings the caller's own return address into Register Pair HL.
36D3
JP (HL) E9
Jump to the address in Register Pair HL, the caller's return address, so that the caller carries straight on with a negation owed at whatever return it ends on.

36D4H - SQR, the Up Arrow and EXP (36D4H-37F8H)

SQR is five instructions and the up arrow does the rest of it: 36D7H loads the single precision constant 0.5 at 3629H into the accumulator and falls into the power routine, so SQR(X) is X^0.5 and nothing else. 36DFH is the up arrow, which 7388H sends every exponentiation to on its precedence of 7FH before any operator table is reached, and its shape is three special cases and then a logarithm: an exponent of nothing goes to 378FH, which is EXP, because EXP(0) is one and that is the answer; a base of nothing with a negative exponent gives Division by zero at 30BCH and with a positive one gives nothing at 2685H; a negative base is only allowed an integer exponent, which 3701H to 3776H works out and which 377FH and 3782H turn into the sign of the answer; and everything else is EXP(Y multiplied by LOG(X)), which is what 3787H and 378CH are. 36CFH is how the sign is carried out of the routine: called at 377FH it leaves 28F3H on the stack so that the negation happens at whatever return EXP ends on. 378FH is EXP, and it begins by multiplying by the constant 1.442695, which is one over the natural logarithm of two, so that what it has to work out is two raised to a power: 379BH refuses an argument of 128 or more with Overflow at 30A3H, 37A1H gives one for an argument too small to matter, 37A6H splits the argument into its whole part and its fraction, 37B6H works the fraction out with the seven term series at 37DCH and 37B0H and 37BEH put the whole part back as a power of two by adding it to the exponent byte. 72F1H is set to 01H at 36E8H and 67BCH is pushed as the return at 36E7H, which is the complaint cell the Overflow warning comes back through.

36D4
SQR (36D4H), which the function table at 685DH reaches for token 06H: call 2917H of BASIC/OV1, which puts the two words at 72ECH and 72EEH, the argument, on the stack under its own return address.
36D7
LD HL,3629H 21 29 36
Load Register Pair HL with 3629H, the four bytes of the single precision constant 0.5.
36DA
Call 2924H of BASIC/OV1, which loads those four bytes into Register Pair DE and Register Pair BC and stores them into 72ECH and 72EEH, so that the accumulator holds 0.5.
36DD
Jump to 36E2H, past the type check the up arrow needs, the exponent having been made by this routine and not read from a program.
36DF
The up arrow (36DFH), which 7388H and 73EDH reach for an exponentiation: call 2A6AH of BASIC/OV1, which refuses a string with Type mismatch at 5884H and makes the exponent a single or double precision value.
36E2
POP BC C1
The base taken off the stack (36E2H): pop Register Pair BC, the high word of the base, which 7388H left there.
36E3
POP DE D1
Pop Register Pair DE, the low word of the base, so that Register Pair BC and Register Pair DE hold it and the accumulator holds the exponent.
36E4
LD HL,67BCH 21 BC 67
Load Register Pair HL with 67BCH, the complaint cell the Overflow and Division by zero warning returns through.
36E7
PUSH HL E5
Push Register Pair HL, that address, so that every way out of this routine and of EXP below goes through it.
36E8
LD A,01H 3E 01
Load Register A with 01H, the value of the flag that says a warning rather than an error is to be given.
36EA
LD (72F1H),A 32 F1 72
Store Register A into 72F1H, that flag, which 30CFH reads when the result overflows.
36ED
Call 28C4H of BASIC/OV1, which reads the exponent byte at 72EFH and comes back with the Zero Flag set for an exponent of nothing and the Sign Flag set for a negative one.
36F0
LD A,B 78
Load Register B into Register A, the exponent byte of the base, which changes no flag and so leaves both of the above standing for the three jumps below.
36F1
Jump to 378FH on Z, the exponent being nothing, which is EXP's own entry and gives one for every base there is, which is the answer.
36F4
Jump to 36FBH on P, the exponent being positive, where a base of nothing gives nothing.
36F7
OR A B7
Or Register A with itself, the exponent being negative, which sets the Zero Flag when the base's exponent byte is 00H and so the base is nothing.
36F8
Jump to 30BCH on Z, a base of nothing raised to a negative power, which gives the Division by zero warning.
36FB
OR A B7
A positive exponent (36FBH): or Register A with itself, which sets the Zero Flag when the base is nothing.
36FC
Jump to 2685H of BASIC/OV1 on Z, a base of nothing raised to a positive power, which gives nothing as the answer.
36FF
PUSH DE D5
Push Register Pair DE, the low word of the base, which the work below writes over.
3700
PUSH BC C5
Push Register Pair BC, its high word, for the same reason.
3701
LD A,C 79
Load Register C into Register A, the top mantissa byte of the base, whose bit 7 is its sign.
3702
OR 7FH F6 7F
Or Register A with 7FH, which sets every other bit and leaves Register A as 0FFH for a negative base and 7FH for a positive one.
3704
Call 2932H of BASIC/OV1, which loads Register Pair DE and Register Pair BC from 72ECH, the exponent, so that the base in those pairs is replaced by it.
3707
PUSH AF F5
Push Register AF, Register A holding that mask and the Sign Flag with it, which 3759H takes back.
3708
PUSH DE D5
Push Register Pair DE, the low word of the exponent, which the truncation below writes over.
3709
PUSH BC C5
Push Register Pair BC, its high word, for the same reason.
370A
Call 2B01H of BASIC/OV1, which leaves the whole part of the exponent in the accumulator, throwing its fraction away.
370D
POP BC C1
Pop Register Pair BC, the exponent's high word, back into that pair.
370E
POP DE D1
Pop Register Pair DE, its low word, so that the pair hold the exponent as it was.
370F
PUSH AF F5
Push Register AF, which the comparison below writes over.
3710
Call 2982H of BASIC/OV1, which compares the whole part in the accumulator with the exponent in Register Pair BC and Register Pair DE and sets the Zero Flag when the two are the same, which is to say when the exponent is a whole number.
3713
Jump to 3758H on NZ, the exponent having a fraction, where a negative base is refused and a positive one goes through the logarithm.
3716
OR C B1
Or Register C with Register A, the top mantissa byte of the whole part with the whole part's own, which sets the Sign Flag on the sign of the exponent.
3717
PUSH AF F5
Push Register AF, that answer and its flags, which 3729H takes back.
3718
AND 7FH E6 7F
And Register A with 7FH, which takes the sign off the top mantissa byte so that the magnitude alone is measured below.
371A
LD (72EEH),A 32 EE 72
Store Register A into 72EEH, the top mantissa byte of the accumulator, which makes the exponent positive whatever it was.
371D
LD BC,9000H 01 00 90
Load Register Pair BC with 9000H, Register B of 90H being the exponent byte of a single precision 32768 and Register C of 00H its top mantissa byte, and
3720
LD DE,0000H 11 00 00
load Register Pair DE with 0000H, its other two bytes, so that the pairs hold 32768 exactly.
3723
Call 2982H of BASIC/OV1, which compares the exponent in the accumulator with 32768 and leaves the Sign Flag set when the accumulator holds the smaller.
3726
Jump to 3751H on P, the exponent being 32768 or more, where it is too large for the repeated squaring and the logarithm is used instead.
3729
POP AF F1
Pop Register AF, the sign of the exponent 3717H pushed.
372A
Jump to 374AH on P, the exponent being positive, where the base's sign is of no account because an even or odd power of a positive base is positive either way.
372D
POP AF F1
Pop Register AF, the mask 3707H pushed, 0FFH for a negative base and 7FH for a positive one.
372E
RRCA 0F
Rotate Register A right circularly, which brings bit 0 of the mask into bit 7 and so puts the sign of the base where the mantissa carries it.
372F
POP BC C1
Pop Register Pair BC, the base's high word 3700H pushed.
3730
AND B A0
And Register A with Register B, the base's exponent byte, which leaves the sign of the base in Register A only when the whole part of the exponent was odd.
3731
POP BC C1
Pop Register Pair BC, the base's high word again, which 3700H pushed and 372FH took the first copy of.
3732
POP DE D1
Pop Register Pair DE, the base's low word 36FFH pushed, so that Register Pair BC and Register Pair DE hold the base again.
3733
PUSH AF F5
Push Register AF, the sign of the answer and the flags with it, which 3737H takes back.
3734
Call 37F9H, which raises the base in Register Pair BC and Register Pair DE to the whole power in the accumulator by repeated squaring.
3737
POP AF F1
Pop Register AF, the sign of the answer 3733H pushed.
3738
RLA 17
Rotate Register A left through the Carry Flag, which brings that sign bit into the Carry Flag for 3784H to read.
3739
LD A,(72EFH) 3A EF 72
Load Register A with the byte at 72EFH, the exponent byte of the answer.
373C
INC A 3C
Increment Register A, the exponent byte of the answer, which the decrement below puts straight back.
373D
DEC A 3D
Decrement Register A again, which leaves it as it was and sets the Zero Flag when the answer is nothing, the two instructions testing that byte without disturbing the Carry Flag 3738H put the sign in.
373E
Jump to 30C3H on Z, the answer having come out as nothing from a base that was something, which gives the Overflow warning.
3741
LD BC,8100H 01 00 81
Load Register Pair BC with 8100H, Register B of 81H being the exponent byte of a single precision one and Register C of 00H its top mantissa byte, and
3744
LD DE,0000H 11 00 00
load Register Pair DE with 0000H, its other two bytes, so that the pairs hold one exactly.
3747
Jump to 27EDH of BASIC/OV1, the division, which gives one over the answer and so finishes a negative exponent.
374A
POP AF F1
A positive whole exponent (374AH): pop Register AF, which 3717H pushed and 3729H read.
374B
POP AF F1
Pop Register AF again, the mask 3707H pushed, neither of them being wanted for a positive exponent.
374C
POP BC C1
Pop Register Pair BC, the base's high word 3700H pushed.
374D
POP DE D1
Pop Register Pair DE, its low word 36FFH pushed, so that the pairs hold the base.
374E
Jump to 37F9H, which raises the base to the whole power in the accumulator by repeated squaring and returns through the 67BCH 36E7H pushed.
3751
POP AF F1
The exponent too large to square out (3751H): pop Register AF, the sign of the exponent 3717H pushed, which is wanted no further.
3752
LD (72EEH),A 32 EE 72
Store Register A into 72EEH, the top mantissa byte of the accumulator, which puts the sign of the exponent back after 371AH took it off.
3755
Call 2932H of BASIC/OV1, which loads Register Pair DE and Register Pair BC from 72ECH, the exponent as it now stands.
3758
POP AF F1
The exponent is not a whole number (3758H), which 3713H jumps to: pop Register AF, which 370FH pushed and which is of no account here.
3759
POP AF F1
Pop Register AF, the mask 3707H pushed, 0FFH for a negative base and 7FH for a positive one, with the Sign Flag standing for it.
375A
Jump to 3777H on P, the base being positive, which goes straight to the logarithm.
375D
PUSH AF F5
Push Register AF, that mask again, the base being negative, which 3765H and 3768H take back.
375E
LD A,(72EFH) 3A EF 72
Load Register A with the byte at 72EFH, the exponent byte of the exponent.
3761
CP 99H FE 99
Compare Register A with 99H, which is the exponent byte of a single precision value of about 16777216, above which every value is a whole number anyway.
3763
Jump to 3768H on C, the exponent standing below that, where it is tested for being a whole number.
3765
POP AF F1
Pop Register AF, the mask 375DH pushed, the exponent being so large that its fraction cannot exist.
3766
Jump to 3777H, which takes a negative base through the logarithm and so gives Illegal function call from 2746H.
3768
POP AF F1
Pop Register AF, the mask 375DH pushed, the exponent being small enough that it may yet be a whole number.
3769
PUSH DE D5
Push Register Pair DE, the low word of the exponent, which the truncation below writes over.
376A
PUSH BC C5
Push Register Pair BC, its high word, for the same reason.
376B
Call 2B01H of BASIC/OV1, which leaves the whole part of the exponent in the accumulator.
376E
POP BC C1
Pop Register Pair BC, the exponent's high word.
376F
POP DE D1
Pop Register Pair DE, its low word, so that the pairs hold the exponent as it was.
3770
PUSH AF F5
Push Register AF, which the comparison below writes over.
3771
Call 2982H of BASIC/OV1, which compares the whole part with the exponent and sets the Zero Flag when the two are the same.
3774
POP HL E1
Pop Register Pair HL, the word 3770H pushed, whose high byte is the mask.
3775
LD A,H 7C
Load Register H into Register A, that mask, which is 0FFH for a negative base and 7FH for a positive one.
3776
RRA 1F
Rotate Register A right through the Carry Flag, which brings bit 0 of the mask into the Carry Flag, so that 377FH reads the sign of the base and 3782H the Zero Flag of the comparison above.
3777
POP HL E1
The logarithm taken (3777H): pop Register Pair HL, the base's high word 3700H pushed.
3778
LD (72EEH),HL 22 EE 72
Store Register Pair HL into the word at 72EEH, the top two bytes of the accumulator.
377B
POP HL E1
Pop Register Pair HL, the base's low word 36FFH pushed.
377C
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the bottom two bytes, so that the accumulator holds the base again.
377F
Call 36CFH on C, the base having been negative and its power odd, which leaves 28F3H on the stack so that the answer is negated at the return EXP ends on.
3782
Call 28F3H of BASIC/OV1 on Z, the exponent having turned out to be a whole number, which flips bit 7 of 72EEH and so makes the base positive before the logarithm is taken of it.
3785
PUSH DE D5
Push Register Pair DE, the low word of the exponent, which the logarithm writes over.
3786
PUSH BC C5
Push Register Pair BC, its high word, for the same reason.
3787
Call 2746H of BASIC/OV1, LOG, which refuses a value of nothing or less with Illegal function call at 5F95H and otherwise leaves the natural logarithm of the base in the accumulator.
378A
POP BC C1
Pop Register Pair BC, the exponent's high word.
378B
POP DE D1
Pop Register Pair DE, its low word, so that the pairs hold the exponent again.
378C
Call 278BH of BASIC/OV1, the multiplication, which gives the exponent times the logarithm of the base and falls into EXP below, so that the whole of the up arrow is one exponential of one product.
378F
LD BC,8138H 01 38 81
EXP (378FH), which the function table at 685DH reaches for token 0CH and 36F1H jumps to for an exponent of nothing: load Register Pair BC with 8138H, Register B of 81H and Register C of 38H being the exponent byte and the top mantissa byte of the single precision constant 1.442695, and
3792
LD DE,0AA3BH 11 3B AA
load Register Pair DE with 0AA3BH, Register D of 0AAH and Register E of 3BH, its other two bytes: the constant is one over the natural logarithm of two.
3795
Call 278BH of BASIC/OV1, the multiplication, which turns the argument into the power of two that is wanted instead of the power of the base of natural logarithms.
3798
LD A,(72EFH) 3A EF 72
Load Register A with the byte at 72EFH, the exponent byte of that product.
379B
CP 88H FE 88
Compare Register A with 88H, which is the exponent byte of a value of about 128, the highest power of two a single precision number holds.
379D
Jump to 37C1H on NC, the product standing at 128 or above, where an Overflow warning or nothing is given according to its sign.
379F
CP 68H FE 68
Compare Register A with 68H, which is the exponent byte of a value of about 0.0000000000000000000000000001.
37A1
Jump to 37D3H on C, the product being smaller than that, which gives one as the answer: two raised to so small a power is one to every digit a single precision number keeps.
37A3
Call 2917H of BASIC/OV1, which puts the two words at 72ECH and 72EEH, the product, on the stack under its own return address.
37A6
Call 2B01H of BASIC/OV1, which leaves the whole part of the product in the accumulator and in Register A as a sixteen bit integer's low byte.
37A9
ADD A,81H C6 81
Add 81H to Register A, the bias of a single precision exponent and one, which makes the exponent byte the whole part stands for as a power of two.
37AB
Jump to 37C4H on Z, the sum having come out as nothing, where the sign is looked at and an Overflow warning or nothing given.
37AD
POP BC C1
Pop Register Pair BC, the high word of the product 37A3H put down.
37AE
POP DE D1
Pop Register Pair DE, its low word, so that the pairs hold the product and the accumulator its whole part.
37AF
PUSH AF F5
Push Register AF, that exponent byte, which 37B9H takes back.
37B0
Call 261FH of BASIC/OV1, the subtraction, which takes the whole part away from the product and leaves its fraction in the accumulator.
37B3
LD HL,37DCH 21 DC 37
Load Register Pair HL with 37DCH, the seven term series of two raised to a power, the count 07H standing at that address and the coefficients after it.
37B6
Call 3856H, the series evaluator, which works the series out at the fraction in the accumulator and leaves the answer there.
37B9
POP BC C1
Pop Register Pair BC, the word 37AFH pushed, whose Register B is the exponent byte of the whole part as a power of two.
37BA
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the two low mantissa bytes of that power of two, and
37BD
LD C,D 4A
load Register C from Register D, 00H, its top mantissa byte, so that Register Pair BC and Register Pair DE hold two raised to the whole part exactly.
37BE
Jump to 278BH of BASIC/OV1, the multiplication, which multiplies the series by that power of two and returns through the 67BCH 36E7H pushed.
37C1
The product too large (37C1H): call 2917H of BASIC/OV1, which puts the two words of the product on the stack under its own return address so that 37CBH and 37CCH have something to take off.
37C4
LD A,(72EEH) 3A EE 72
The sign looked at (37C4H): load Register A with the byte at 72EEH, the top mantissa byte of the product, whose bit 7 is its sign.
37C7
OR A B7
Or Register A with itself, which sets the Sign Flag on that byte and leaves it alone.
37C8
Jump to 37D0H on P, the product being positive, where the Overflow warning is given.
37CB
POP AF F1
Pop Register AF, one of the two words 37C1H or 37A3H put on the stack, the product being negative.
37CC
POP AF F1
Pop Register AF, the other of them, which leaves the stack with the 67BCH 36E7H pushed on top of it.
37CD
Jump to 2684H of BASIC/OV1, which gives nothing as the answer: two raised to a large negative power is smaller than a single precision number holds.
37D0
Jump to 30A3H, the Overflow warning, which prints it, carries on with the largest number there is and returns through 67BCH.
37D3
LD BC,8100H 01 00 81
The product too small to matter (37D3H): load Register Pair BC with 8100H, Register B of 81H and Register C of 00H being the exponent byte and top mantissa byte of a single precision one, and
37D6
LD DE,0000H 11 00 00
load Register Pair DE with 0000H, its other two bytes, so that the pairs hold one exactly.
37D9
Jump to 2927H of BASIC/OV1, which stores Register Pair HL into 72ECH and Register Pair BC into 72EEH after exchanging the pairs, putting one in the accumulator, and returns through 67BCH.
37DC
DEFB 07H 07
37DCH: the number of terms in the series below, which 3859H reads before any of them.
37DD-37E0
DEFB 7CH, 88H, 59H, 74H 7C 88 59 74
37DDH to 37E0H: 0.000207455771, the first and smallest coefficient of the series for two raised to a power, which is the natural logarithm of two to the seventh over five thousand and forty.
37E1-37E4
DEFB 0E0H, 97H, 26H, 77H E0 97 26 77
37E1H to 37E4H: 0.00127100572, the second coefficient, the logarithm of two to the sixth over seven hundred and twenty.
37E5-37E8
DEFB 0C4H, 1DH, 1EH, 7AH C4 1D 1E 7A
37E5H to 37E8H: 0.00965065137, the third coefficient, the logarithm of two to the fifth over one hundred and twenty.
37E9-37EC
DEFB 5EH, 50H, 63H, 7CH 5E 50 63 7C
37E9H to 37ECH: 0.0554965660, the fourth coefficient, the logarithm of two to the fourth over twenty four.
37ED-37F0
DEFB 1AH, 0FEH, 75H, 7EH 1A FE 75 7E
37EDH to 37F0H: 0.240227133, the fifth coefficient, the square of the logarithm of two over two.
37F1-37F4
DEFB 18H, 72H, 31H, 80H 18 72 31 80
37F1H to 37F4H: 0.693147182, the sixth coefficient, which is the natural logarithm of two itself.
37F5-37F8
DEFB 00H, 00H, 00H, 81H 00 00 00 81
37F5H to 37F8H: one, the seventh and last coefficient and the constant term of the series, which is what makes two raised to a power of nothing come out as one.

37F9H - A Whole Power by Repeated Squaring, and the Series Evaluator (37F9H-3875H)

37F9H raises a base to a whole power by squaring, which is the shortest way there is and the reason the up arrow bothers to find out whether its exponent is a whole number at all: the power is kept as a sixteen bit integer in 72FBH, 380DH to 3814H shifts it right one bit at a time, 381EH multiplies the running answer by the base whenever the bit that falls out is set and 3835H squares the base every time round, so a power of 255 costs eight squarings and eight multiplications where 37B6H's series would cost a logarithm and an exponential. The one thing worth knowing about 37FBH is a bug, numbered B348: the sixteen bit power is made by 2AB7H of BASIC/OV1, whose answer for a Register A of 00H is a Register Pair DE of 0000H without looking at the value at all, and every other call of that routine in the three files hands it the exponent byte at 72EFH where this one hands it the sign mask 3730H made. 3856H is the series evaluator and it is Horner's method exactly: the count stands at the head of the table, 385BH loads the first and smallest coefficient into the accumulator, and each time round the loop the accumulator is multiplied by the argument and the next coefficient added, so the polynomial comes out with one multiplication and one addition to a term. 385FH is an entry point inside the LD B,0F1H at 385EH, whose operand byte 0F1H stands as a POP AF: the instruction exists for that byte alone, Register B being popped over two instructions later, and it is how 3874H gets back into the loop one pop earlier than the entry does. 3847H is the evaluator for an odd series, which SIN and ATN both want: it saves the argument, pushes 2BFCH as the return, squares the argument and runs the series on the square, so that 2BFCH multiplies the answer by the argument on the way out.

37F9
PUSH DE D5
A base raised to a whole power (37F9H), which 3734H calls and 374EH jumps to with the base in Register Pair BC and Register Pair DE and the whole power in the accumulator: push Register Pair DE, the base's low word.
37FA
PUSH BC C5
Push Register Pair BC, the base's high word, so that the two pops at 381AH and 381BH have the base to multiply by.
37FB
Call 2AB7H of BASIC/OV1, which leaves the whole power as a sixteen bit integer in Register Pair DE. B348: that routine tests Register A on entry and answers with Register Pair DE at 0000H without reading the value when it is 00H, and 2B01H and every other caller hand it the exponent byte at 72EFH where 3730H leaves a sign mask in it, which is 00H whenever the low byte of the whole power is 00H, or 01H with a positive base, so a negative exponent of 255, 256, 511, 512 and so on gives a power of nothing and an answer of one.
37FE
LD HL,72FBH 21 FB 72
Load Register Pair HL with 72FBH, the two bytes the power is counted down in.
3801
LD (HL),E 73
Store Register E into the byte Register Pair HL addresses, the low byte of the power.
3802
INC HL 23
Increment Register Pair HL to 72FCH, the high byte's place.
3803
LD (HL),D 72
Store Register D into the byte Register Pair HL addresses, the high byte of the power.
3804
LD HL,2720H 21 20 27
Load Register Pair HL with 2720H of BASIC/OV1, the four bytes of the single precision constant one.
3807
Call 2924H of BASIC/OV1, which loads those four bytes and stores them into 72ECH and 72EEH, so that the running answer starts at one.
380A
LD HL,(72FBH) 2A FB 72
The next bit of the power (380AH): load Register Pair HL with the word at 72FBH, the power as it now stands.
380D
LD A,H 7C
Load Register H into Register A, its high byte.
380E
OR A B7
Or Register A with itself, which clears the Carry Flag and leaves the byte alone, so that the shift below brings a 0 into bit 7.
380F
RRA 1F
Rotate Register A right through the Carry Flag, which halves the high byte and puts its bottom bit into that flag.
3810
LD H,A 67
Load Register A into Register H, the high byte halved.
3811
LD A,L 7D
Load Register L into Register A, the low byte of the power.
3812
RRA 1F
Rotate Register A right through the Carry Flag, which halves it and brings the high byte's bottom bit into its bit 7, the bottom bit of the power falling into the Carry Flag.
3813
LD L,A 6F
Load Register A into Register L, so that Register Pair HL holds the power halved.
3814
LD (72FBH),HL 22 FB 72
Store Register Pair HL into the word at 72FBH, the power halved, which is what the next time round reads.
3817
Jump to 3821H on NC, the bit that fell out being clear, which leaves the running answer alone for this power of the base.
381A
POP BC C1
The running answer multiplied (381AH): pop Register Pair BC, the base's high word as 37FAH or 383AH left it.
381B
POP DE D1
Pop Register Pair DE, its low word, so that the pairs hold the base as it now stands, which is the base raised to this power of two.
381C
PUSH DE D5
Push Register Pair DE, that low word again, the pops above having been made to read it and not to take it off.
381D
PUSH BC C5
Push Register Pair BC, its high word, for the same reason.
381E
Call 278BH of BASIC/OV1, the multiplication, which multiplies the running answer by the base as it now stands.
3821
LD HL,72FBH 21 FB 72
The power tested (3821H): load Register Pair HL with 72FBH, the power as it now stands.
3824
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, its low byte.
3825
INC HL 23
Increment Register Pair HL to 72FCH, the high byte's place.
3826
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, its high byte, which sets the Zero Flag only when both bytes are 00H.
3827
Jump to 3844H on Z, the power having run out, where the two words of the base are taken off the stack and the answer stands in the accumulator.
382A
POP BC C1
The base squared (382AH): pop Register Pair BC, the base's high word.
382B
POP HL E1
Pop Register Pair HL, its low word, which 382FH and 3830H put into Register Pair DE.
382C
Call 2917H of BASIC/OV1, which puts the two words of the running answer on the stack under its own return address.
382F
LD D,H 54
Load Register D from Register H, the high byte of the base's low word, and
3830
LD E,L 5D
load Register E from Register L, its low byte, so that Register Pair DE holds that word again.
3831
Call 2927H of BASIC/OV1, which exchanges Register Pair DE with Register Pair HL and stores the pairs into 72ECH and 72EEH, so that the accumulator holds the base and Register Pair HL the old running answer.
3834
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the base's low word into Register Pair DE for the multiplication below.
3835
Call 278BH of BASIC/OV1, the multiplication, which squares the base: the accumulator holds it and Register Pair BC and Register Pair DE hold it too.
3838
POP BC C1
Pop Register Pair BC, the high word of the running answer 382CH put down.
3839
POP HL E1
Pop Register Pair HL, its low word, which 383DH puts into Register Pair DE.
383A
Call 2917H of BASIC/OV1, which puts the two words of the squared base on the stack under its own return address, for the next time round.
383D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the running answer's low word into Register Pair DE.
383E
Call 2927H of BASIC/OV1, which stores Register Pair DE and Register Pair BC into 72ECH and 72EEH, putting the running answer back in the accumulator.
3841
Jump to 380AH, which halves the power again and goes round until it reaches nothing.
3844
POP BC C1
The answer (3844H): pop Register Pair BC, the base's high word, which is the last squaring and is wanted no further.
3845
POP DE D1
Pop Register Pair DE, its low word, which leaves the stack as 37F9H found it.
3846
RET C9
Return to the caller with the answer in the accumulator, which for the up arrow is through the 67BCH 36E7H pushed.
3847
A series in the square of the argument (3847H), which 395AH of SIN and 39C1H of ATN call with the table in Register Pair HL: call 2917H of BASIC/OV1, which puts the two words of the argument on the stack under its own return address.
384A
LD DE,2BFCH 11 FC 2B
Load Register Pair DE with 2BFCH of BASIC/OV1, three instructions that pop a word into Register Pair BC and another into Register Pair DE and jump to the multiplication.
384D
PUSH DE D5
Push Register Pair DE, that address, so that it stands as the return underneath the two words 2917H put down and the answer is multiplied by the argument on the way out.
384E
PUSH HL E5
Push Register Pair HL, the table pointer, which 3855H takes back.
384F
Call 2932H of BASIC/OV1, which loads Register Pair DE and Register Pair BC from 72ECH, the argument.
3852
Call 278BH of BASIC/OV1, the multiplication, which squares the argument and leaves it in the accumulator.
3855
POP HL E1
Pop Register Pair HL, the table pointer 384EH pushed, and fall into the evaluator below, which works the series out at the square.
3856
A series in the argument (3856H), which 37B6H of EXP calls: call 2917H of BASIC/OV1, which puts the two words of the argument on the stack under its own return address.
3859
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the number of coefficients, which stands at the head of every one of the three tables.
385A
INC HL 23
Increment Register Pair HL to the first coefficient, which is the smallest and the one of the highest power.
385B
Call 2924H of BASIC/OV1, which loads the four bytes Register Pair HL addresses into Register Pair DE and Register Pair BC, stores them into 72ECH and 72EEH and leaves Register Pair HL past them, so that the accumulator holds that coefficient.
385E
LD B,0F1H 06 F1
Load Register B with 0F1H, which happens for no reason of its own: Register B is popped two instructions below, and the byte 0F1H stands at 385FH as the POP AF the loop comes back to at 3874H.
3860
POP BC C1
The count and the argument taken up (3860H): pop Register Pair BC, the high word of the argument, which 2917H put down or the loop below pushed.
3861
POP DE D1
Pop Register Pair DE, its low word, so that the pairs hold the argument for the multiplication.
3862
DEC A 3D
Decrement Register A, the count of coefficients still to take in.
3863
RET Z C8
Return on Z, every coefficient having been taken in, which for 3847H's door goes to the 2BFCH 384DH pushed and for 3856H's to the caller.
3864
PUSH DE D5
The next term (3864H): push Register Pair DE, the argument's low word, which the multiplication writes over.
3865
PUSH BC C5
Push Register Pair BC, its high word, for the same reason.
3866
PUSH AF F5
Push Register AF, Register A holding the count of coefficients still to take in.
3867
PUSH HL E5
Push Register Pair HL, the table pointer, which 386BH takes back.
3868
Call 278BH of BASIC/OV1, the multiplication, which multiplies the running total by the argument.
386B
POP HL E1
Pop Register Pair HL, the table pointer 3867H pushed.
386C
Call 2935H of BASIC/OV1, which loads the four bytes Register Pair HL addresses into Register Pair DE and Register Pair BC, the next coefficient, and leaves Register Pair HL past them.
386F
PUSH HL E5
Push Register Pair HL, the table pointer as it now stands, which 3873H takes back.
3870
Call 2622H of BASIC/OV1, the single precision addition, which adds that coefficient to the running total.
3873
POP HL E1
Pop Register Pair HL, the table pointer 386FH pushed, which addresses the coefficient after the one just taken in.
3874
Jump to 385FH, the POP AF inside the instruction at 385EH, which takes the count back off the stack and falls into 3860H for the argument.

3876H - RND, COS and SIN (3876H-3967H)

RND is two functions in one: an argument of nothing gives the next number of the generator and a positive argument gives a whole number from one to it, which 3890H to 3899H works out as the generator's number times the argument plus one with the fraction thrown away; a negative argument gives Illegal function call at 5F95H. 389CH is the generator itself and it is a multiplication done by hand: the seed is the three bytes at 713DH and the multiplier the three at 6E8CH, and 38A6H to 38C8H walks the multiplier bit by bit, eight bits of each of three bytes, shifting the running product left and adding the seed in whenever a bit comes out set, with the multiplier byte rotated circularly so that it is left as it was found. 0B065H and 05H are then added, which makes it a linear congruential generator of twenty four bits, and 38DCH to 38E7H hands the three bytes of the new seed to 2671H as a single precision mantissa with an exponent byte of 80H, so that the answer lies below one. COS is two instructions and SIN does the rest, 38EAH adding the quarter turn at 3970H and falling straight into it. SIN's own work is all in getting the argument into a quarter of a turn: 390CH multiplies by one over two pi so that a whole turn becomes one, 3917H throws the whole turns away, and 3920H to 3947H folds what is left into the range of minus a quarter to a quarter by taking three quarters off it, turning the sign over and taking it off a quarter, which is the reflection that makes the five term series at 3978H enough for the whole circle. 38F5H returns the argument untouched when its exponent byte is below 77H, which is a value too small for the sine to differ from it in any digit a single precision number keeps.

3876
RND (3876H), which the function table at 685DH reaches for token 0BH: call 29F4H of BASIC/OV1, CINT, which works the argument out as a sixteen bit integer in Register Pair HL and gives Overflow for anything outside the signed range.
3879
LD A,H 7C
Load Register H into Register A, the high byte of that integer, whose bit 7 is its sign.
387A
OR A B7
Or Register A with itself, which sets the Sign Flag on that byte and leaves it alone.
387B
Jump to 5F95H on M, the argument being negative, which gives Illegal function call: this BASIC has no reseeding through a negative argument.
387E
OR L B5
Or Register A with Register L, the low byte of the integer, which leaves the Zero Flag set only when both bytes are 00H.
387F
Jump to 389CH on Z, the argument being nothing, which gives the next number of the generator as it stands, below one and at or above nothing.
3881
PUSH HL E5
Push Register Pair HL, the argument, which the generator below writes over.
3882
Call 389CH, the generator, which makes the next number and leaves it in the accumulator.
3885
Call 2932H of BASIC/OV1, which loads Register Pair DE and Register Pair BC from 72ECH, the number just made.
3888
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the number's low word into Register Pair HL for the exchange below.
3889
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which puts the argument into Register Pair HL and leaves the number's low word on the stack.
388A
PUSH BC C5
Push Register Pair BC, the number's high word, so that both halves of it are on the stack over the conversion below.
388B
Call 2A8AH of BASIC/OV1, which turns the unsigned sixteen bit value in Register Pair HL into a single precision number in the accumulator with an exponent byte of 90H.
388E
POP BC C1
Pop Register Pair BC, the number's high word 388AH pushed.
388F
POP DE D1
Pop Register Pair DE, its low word 3889H left on the stack, so that the pairs hold the generator's number again.
3890
Call 278BH of BASIC/OV1, the multiplication, which gives the argument times a number below one, which is to say something at or above nothing and below the argument.
3893
LD HL,2720H 21 20 27
Load Register Pair HL with 2720H of BASIC/OV1, the four bytes of the single precision constant one.
3896
Call 2617H of BASIC/OV1, which loads those four bytes and adds them, so that the range becomes above nothing and at or below the argument and one.
3899
Jump to 2B01H of BASIC/OV1, which throws the fraction away and leaves a whole number from one to the argument in the accumulator, returning to RND's own caller.
389C
LD HL,6E8CH 21 8C 6E
The generator (389CH), which 387FH jumps to and 3882H calls: load Register Pair HL with 6E8CH, the first of the three bytes the seed is multiplied by.
389F
PUSH HL E5
Push Register Pair HL, that address, which the loop below keeps on the stack and exchanges into Register Pair HL whenever it wants the multiplier byte.
38A0
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the low two bytes of the running product.
38A3
LD C,E 4B
Load Register C from Register E, 00H, its high byte, so that Register Pair DE and Register C are a twenty four bit total at nothing.
38A4
LD H,03H 26 03
Load Register H with 03H, the three bytes of the multiplier, which is the outer count.
38A6
LD L,08H 2E 08
The next byte of the multiplier (38A6H): load Register L with 08H, the eight bits of a byte, which is the inner count.
38A8
EX DE,HL EB
The next bit of the multiplier (38A8H): exchange Register Pair DE with Register Pair HL, which puts the running product's low two bytes where they can be added to themselves.
38A9
ADD HL,HL 29
Add Register Pair HL to itself, which shifts those two bytes left one place and puts the bit that leaves the top into the Carry Flag.
38AA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which puts them back in Register Pair DE with the two counts in Register Pair HL.
38AB
LD A,C 79
Load Register C into Register A, the high byte of the running product.
38AC
RLA 17
Rotate Register A left through the Carry Flag, which takes in the bit the shift above put there and completes the twenty four bit doubling.
38AD
LD C,A 4F
Load Register A into Register C, that high byte doubled.
38AE
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which brings the multiplier pointer into Register Pair HL and leaves the two counts on the stack.
38AF
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the multiplier byte being walked.
38B0
RLCA 07
Rotate Register A left circularly, which brings its top bit into the Carry Flag and into bit 0, so that eight such rotations leave the byte exactly as it was found.
38B1
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the multiplier byte rotated, which is why the three bytes at 6E8CH are a constant and not consumed.
38B2
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which puts the multiplier pointer back on the stack and the two counts into Register Pair HL.
38B3
Jump to 38C1H on NC, the bit that came out of the multiplier being clear, which adds nothing for this place.
38B5
PUSH HL E5
Push Register Pair HL, the two counts, which the addition below writes over.
38B6
LD HL,(713DH) 2A 3D 71
Load Register Pair HL with the word at 713DH, the low two bytes of the seed.
38B9
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the running product's low two bytes, which adds the seed in at this place.
38BA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the sum back into Register Pair DE.
38BB
LD A,(713FH) 3A 3F 71
Load Register A with the byte at 713FH, the high byte of the seed.
38BE
ADC A,C 89
Add Register C to Register A with the Carry Flag, the high byte of the running product and the carry out of the two bytes below it.
38BF
LD C,A 4F
Load Register A into Register C, the high byte of the sum.
38C0
POP HL E1
Pop Register Pair HL, the two counts 38B5H pushed.
38C1
DEC L 2D
The bit counted (38C1H): decrement Register L, the count of bits left in this multiplier byte.
38C2
Jump to 38A8H on NZ, there being another bit in it, which doubles the running product again and looks at the next bit.
38C4
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which brings the multiplier pointer into Register Pair HL.
38C5
INC HL 23
Increment Register Pair HL to the next of the three multiplier bytes.
38C6
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which puts it back on the stack and the two counts into Register Pair HL.
38C7
DEC H 25
Decrement Register H, the count of multiplier bytes left.
38C8
Jump to 38A6H on NZ, there being another byte of the multiplier, which starts its eight bits.
38CA
POP HL E1
Pop Register Pair HL, the multiplier pointer 389FH pushed, which is wanted no further.
38CB
LD HL,0B065H 21 65 B0
Load Register Pair HL with 0B065H, the low two bytes of the constant the generator adds after the multiplication.
38CE
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the running product's low two bytes, which gives the low two bytes of the new seed.
38CF
LD (713DH),HL 22 3D 71
Store Register Pair HL into the word at 713DH, those two bytes, so that the next number follows from this one.
38D2
Call 2AACH of BASIC/OV1, which stores 04H into 7142H, making single precision the type of the answer.
38D5
LD A,05H 3E 05
Load Register A with 05H, the high byte of the constant being added.
38D7
ADC A,C 89
Add Register C to Register A with the Carry Flag, the high byte of the running product and the carry out of the addition above.
38D8
LD (713FH),A 32 3F 71
Store Register A into the byte at 713FH, the high byte of the new seed.
38DB
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the new seed's low two bytes into Register Pair DE for the normaliser below.
38DC
LD B,80H 06 80
Load Register B with 80H, which is the exponent byte of a single precision value at or above a half and below one.
38DE
LD HL,72F0H 21 F0 72
Load Register Pair HL with 72F0H, the byte above the accumulator's own exponent byte.
38E1
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, 80H, which is the guard byte the normaliser reads past its work.
38E2
DEC HL 2B
Decrement Register Pair HL to 72EFH, the accumulator's exponent byte.
38E3
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, 80H, so that the mantissa the normaliser builds is read as a fraction below one.
38E4
LD C,A 4F
Load Register A into Register C, the high byte of the new seed, which becomes the top mantissa byte.
38E5
LD B,00H 06 00
Load Register B with 00H, the byte below the mantissa, which the normaliser shifts in.
38E7
Jump to 2671H of BASIC/OV1, the normaliser, which takes the bytes in Register Pair BC and Register Pair DE and leaves the answer in the accumulator as a single precision value below one.
38EA
LD HL,3970H 21 70 39
COS (38EAH), which the function table at 685DH reaches for token 08H and 399CH of TAN calls: load Register Pair HL with 3970H, the four bytes of the single precision constant 1.5707963, which is a quarter of a turn.
38ED
Call 2617H of BASIC/OV1, which loads those four bytes and adds them to the argument, so that the cosine is the sine of a quarter turn further on, and fall into SIN below.
38F0
LD A,(72EFH) 3A EF 72
SIN (38F0H), which the function table at 685DH reaches for token 07H and 3990H of TAN calls: load Register A with the byte at 72EFH, the exponent byte of the argument.
38F3
CP 77H FE 77
Compare Register A with 77H, which is the exponent byte of a value of about 0.000061.
38F5
RET C D8
Return on C, the argument being smaller than that, which gives the argument back as its own sine: no digit a single precision number keeps would differ.
38F6
LD A,(72EEH) 3A EE 72
Load Register A with the byte at 72EEH, the top mantissa byte of the argument, whose bit 7 is its sign.
38F9
OR A B7
Or Register A with itself, which sets the Sign Flag on that byte and leaves it alone.
38FA
Jump to 3906H on P, the argument being positive, which needs no sign taken out of it.
38FD
AND 7FH E6 7F
And Register A with 7FH, which clears that sign bit and leaves the magnitude.
38FF
LD (72EEH),A 32 EE 72
Store Register A into the byte at 72EEH, so that the argument is positive and the folding below has one case to deal with.
3902
LD DE,28F3H 11 F3 28
Load Register Pair DE with 28F3H of BASIC/OV1, the three instructions that flip bit 7 of 72EEH and so negate the accumulator.
3905
PUSH DE D5
Push Register Pair DE, that address, so that the answer is negated at this routine's own return: the sine of a negative angle is the negative of the sine.
3906
LD BC,7E22H 01 22 7E
The turns taken off (3906H): load Register Pair BC with 7E22H, Register B of 7EH and Register C of 22H being the exponent byte and the top mantissa byte of the single precision constant 0.159154943, and
3909
LD DE,0F983H 11 83 F9
load Register Pair DE with 0F983H, Register D of 0F9H and Register E of 83H, its other two bytes: the constant is one over two pi, so that a whole turn becomes one.
390C
Call 278BH of BASIC/OV1, the multiplication, which turns the angle into turns.
390F
Call 2917H of BASIC/OV1, which puts the two words of that value on the stack under its own return address.
3912
Call 2B01H of BASIC/OV1, which leaves the whole number of turns in the accumulator, the fraction thrown away.
3915
POP BC C1
Pop Register Pair BC, the high word of the value in turns.
3916
POP DE D1
Pop Register Pair DE, its low word, so that the pairs hold it as it was and the accumulator the whole turns.
3917
Call 261FH of BASIC/OV1, the subtraction, which takes the whole turns from the value and leaves the fraction of a turn in the accumulator.
391A
LD BC,7F00H 01 00 7F
Load Register Pair BC with 7F00H, Register B of 7FH and Register C of 00H being the exponent byte and top mantissa byte of the single precision constant 0.25, and
391D
LD DE,0000H 11 00 00
load Register Pair DE with 0000H, its other two bytes, so that the pairs hold a quarter of a turn.
3920
Call 2982H of BASIC/OV1, which compares the fraction of a turn in the accumulator with a quarter and leaves the Sign Flag set when the accumulator holds the smaller.
3923
Jump to 394AH on M, the fraction standing below a quarter of a turn, where the series is worked out at once.
3926
LD BC,7F80H 01 80 7F
Load Register Pair BC with 7F80H, Register B of 7FH and Register C of 80H being the exponent byte and top mantissa byte of the single precision constant minus 0.25, and
3929
LD DE,0000H 11 00 00
load Register Pair DE with 0000H, its other two bytes, so that the pairs hold minus a quarter of a turn.
392C
Call 2622H of BASIC/OV1, the addition, which takes a quarter of a turn off the fraction.
392F
LD BC,8080H 01 80 80
Load Register Pair BC with 8080H, Register B of 80H and Register C of 80H being the exponent byte and top mantissa byte of the single precision constant minus 0.5, and
3932
LD DE,0000H 11 00 00
load Register Pair DE with 0000H, its other two bytes, so that the pairs hold minus half a turn.
3935
Call 2622H of BASIC/OV1, the addition, which takes another half turn off, so that three quarters of a turn have gone and the value lies between minus three quarters and a quarter.
3938
Call 28C4H of BASIC/OV1, which comes back with the Sign Flag set when the value is negative and the Zero Flag set when it is nothing.
393B
Call 28F3H of BASIC/OV1 on P, the value being positive, which flips bit 7 of 72EEH and so makes it negative.
393E
LD BC,7F00H 01 00 7F
Load Register Pair BC with 7F00H again, the exponent byte and top mantissa byte of the single precision constant 0.25, and
3941
LD DE,0000H 11 00 00
load Register Pair DE with 0000H, its other two bytes, so that the pairs hold a quarter of a turn as they did at 391AH.
3944
Call 2622H of BASIC/OV1, the addition, which brings the value into the range of minus a quarter to a quarter.
3947
Call 28F3H of BASIC/OV1, which flips bit 7 of 72EEH and so turns the value over, this reflection being what makes the sine of the folded angle the sine of the angle asked for.
394A
LD A,(72EEH) 3A EE 72
The sign taken out and the series worked out (394AH): load Register A with the byte at 72EEH, the top mantissa byte of the folded angle.
394D
OR A B7
Or Register A with itself, which sets the Sign Flag on that byte and leaves it alone.
394E
PUSH AF F5
Push Register AF, that byte and the Sign Flag with it, which 395DH takes back.
394F
Jump to 3957H on P, the folded angle being positive, which needs no sign taken out.
3952
XOR 80H EE 80
Exclusive or Register A with 80H, which turns bit 7 over and so makes the angle positive.
3954
LD (72EEH),A 32 EE 72
Store Register A into the byte at 72EEH, the top mantissa byte, so that the series is worked out at the magnitude.
3957
LD HL,3978H 21 78 39
The series (3957H): load Register Pair HL with 3978H, the five term series of the sine of a turn, the count 05H standing at that address and the coefficients after it.
395A
Call 3847H, which squares the angle, works the series out at the square and multiplies the answer by the angle on the way out through 2BFCH, which is what an odd series wants.
395D
POP AF F1
Pop Register AF, the sign of the folded angle 394EH pushed.
395E
RET P F0
Return on P, that angle having been positive, which leaves the answer as the series made it.
395F
LD A,(72EEH) 3A EE 72
Load Register A with the byte at 72EEH, the top mantissa byte of the answer.
3962
XOR 80H EE 80
Exclusive or Register A with 80H, which turns bit 7 over.
3964
LD (72EEH),A 32 EE 72
Store Register A into the byte at 72EEH, which negates the answer: the sine of a negative angle is the negative of the sine.
3967
RET C9
Return to the caller, or to the 28F3H 3905H pushed when the argument itself was negative.

3968H - The Trigonometric Constants, TAN and ATN (3968H-39ECH)

Four constants stand here and only one of them is reached by anything in the three files. 3968H to 396FH is one over two pi in the eight byte double precision form, of which 396CH to 396FH is the top four bytes and so the single precision constant of the same value, exactly as the 0.5 at 3625H and 3629H is one constant read at two widths; and 3974H to 3977H is 0.25. No instruction of BASIC/CMD, BASIC/OV1 or BASIC/OV2 names 3968H, 396CH or 3974H, the word search and the relative jump scan both being silent for all three: SIN carries the same two values in its own instructions instead, one over two pi as Register Pair BC of 7E22H and Register Pair DE of 0F983H at 3906H and a quarter as Register Pair BC of 7F00H at 391AH and again at 393EH, so twelve bytes of constants are left over. This BASIC has no double precision transcendental functions at all, which is what makes the double precision copy dead rather than waiting. 3970H, the quarter turn, is the one that is used, by 38EBH of COS and by 39C5H of ATN. TAN is the sine over the cosine and nothing else: 3990H takes the sine, 3995H puts it on the stack, 3999H brings the argument back, 399CH takes the cosine and 399FH divides through 27EBH, which pops the sine into Register Pair BC and Register Pair DE first. ATN works the nine term series at 39C8H out for an argument below one and turns a larger one over: 39B7H divides one by it and 39BDH pushes 261CH as the return, which loads the quarter turn at 3970H, negates the series' answer and adds, so that the arctangent of a large value is a quarter turn less the arctangent of its reciprocal. The LD HL,3970H at 39C4H is that pushed return's argument and not an answer of its own, which is why it stands between the series and a bare RET.

3968-396B
DEFB 00H, 00H, 00H, 00H 00 00 00 00
3968H to 396BH: the low four bytes of the double precision constant 0.159154943, which is one over two pi. Nothing in the three files reads them, this BASIC having no double precision sine or cosine for them to serve.
396C-396F
DEFB 83H, 0F9H, 22H, 7EH 83 F9 22 7E
396CH to 396FH: the top four bytes of that double precision constant, which are also the single precision constant 0.159154943 in their own right, as the 0.5 at 3629H is the top of the 0.5 at 3625H. Nothing reads these four either: 3906H and 3909H carry the same four bytes as the operands of two instructions.
3970-3973
DEFB 0DBH, 0FH, 49H, 81H DB 0F 49 81
3970H to 3973H: the single precision constant 1.5707963, a quarter of a turn, which 38EBH of COS loads to turn the cosine into a sine and 39C5H of ATN loads for the 261CH 39BDH pushed. Its exponent byte 81H stands for two and its mantissa for 0.785398163.
3974-3977
DEFB 00H, 00H, 00H, 7FH 00 00 00 7F
3974H to 3977H: the single precision constant 0.25, a quarter of a turn in the units SIN folds its argument in. Nothing reads it: 391AH and 393EH both carry it as Register Pair BC of 7F00H and Register Pair DE of 0000H in their own operands.
3978
DEFB 05H 05
3978H: the number of coefficients in the series below, which 3859H reads before any of them.
3979-397C
DEFB 0FBH, 0D7H, 1EH, 86H FB D7 1E 86
3979H to 397CH: 39.7109184, the first and highest power coefficient of the series for the sine of a turn, which is two pi to the ninth over nine factorial.
397D-3980
DEFB 65H, 26H, 99H, 87H 65 26 99 87
397DH to 3980H: minus 76.5749893, the second coefficient, which is two pi to the seventh over seven factorial with the sign of the series' alternation.
3981-3984
DEFB 58H, 34H, 23H, 87H 58 34 23 87
3981H to 3984H: 81.6022339, the third coefficient, two pi to the fifth over one hundred and twenty.
3985-3988
DEFB 0E1H, 5DH, 0A5H, 86H E1 5D A5 86
3985H to 3988H: minus 41.3416786, the fourth coefficient, two pi cubed over six with the alternating sign.
3989-398C
DEFB 0DBH, 0FH, 49H, 83H DB 0F 49 83
3989H to 398CH: 6.28318548, the fifth and last coefficient, which is two pi itself and the term the series comes down to for a small angle. Its three mantissa bytes are the three of the quarter turn at 3970H, the two differing in their exponent byte alone.
398D
TAN (398DH), which the function table at 685DH reaches for token 09H: call 2917H of BASIC/OV1, which puts the two words of the argument on the stack under its own return address.
3990
Call 38F0H, SIN, which leaves the sine of the argument in the accumulator.
3993
POP BC C1
Pop Register Pair BC, the high word of the argument 398DH put down.
3994
POP HL E1
Pop Register Pair HL, its low word, which 3998H puts into Register Pair DE.
3995
Call 2917H of BASIC/OV1, which puts the two words of the sine on the stack under its own return address, so that the division below has it to work on.
3998
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the argument's low word into Register Pair DE and the accumulator's into Register Pair HL for the store below.
3999
Call 2927H of BASIC/OV1, which exchanges the pairs and stores them into 72ECH and 72EEH, so that the accumulator holds the argument again.
399C
Call 38EAH, COS, which adds the quarter turn and takes the sine, leaving the cosine of the argument in the accumulator.
399F
Jump to 27EBH of BASIC/OV1, which pops the two words of the sine into Register Pair BC and Register Pair DE and divides them by the cosine in the accumulator, returning to TAN's own caller: a cosine of nothing gives Division by zero from 30B3H.
39A2
ATN (39A2H), which the function table at 685DH reaches for token 0AH: call 28C4H of BASIC/OV1, which comes back with the Sign Flag set when the argument is negative and the Zero Flag set when it is nothing.
39A5
Call 36CFH on M, the argument being negative, which leaves 28F3H on the stack so that the answer is negated at whatever return this routine ends on: the arctangent is an odd function.
39A8
Call 28F3H of BASIC/OV1 on M, the argument being negative, which flips bit 7 of 72EEH and so makes it positive, the series being worked out at the magnitude.
39AB
LD A,(72EFH) 3A EF 72
Load Register A with the byte at 72EFH, the exponent byte of the argument.
39AE
CP 81H FE 81
Compare Register A with 81H, which is the exponent byte of a value at or above one and below two.
39B0
Jump to 39BEH on C, the argument standing below one, where the series is worked out at it as it stands.
39B2
LD BC,8100H 01 00 81
Load Register Pair BC with 8100H, Register B of 81H and Register C of 00H being the exponent byte and the top mantissa byte of a single precision one, and
39B5
LD D,C 51
load Register D from Register C, 00H, one of the two low mantissa bytes of that constant, and
39B6
LD E,C 59
load Register E from Register C as well, the other of them, so that Register Pair BC and Register Pair DE hold one exactly.
39B7
Call 27EDH of BASIC/OV1, the division, which gives one over the argument and so brings a value of one or more down below one.
39BA
LD HL,261CH 21 1C 26
Load Register Pair HL with 261CH of BASIC/OV1, which loads the four bytes Register Pair HL addresses, negates the accumulator and adds them.
39BD
PUSH HL E5
Push Register Pair HL, that address, so that it stands as the return of the series below and the answer comes out as the quarter turn less the arctangent of the reciprocal.
39BE
LD HL,39C8H 21 C8 39
The series (39BEH): load Register Pair HL with 39C8H, the nine term series of the arctangent, the count 09H standing at that address and the coefficients after it.
39C1
Call 3847H, which squares the argument, works the series out at the square and multiplies the answer by the argument on the way out through 2BFCH, the arctangent being an odd series.
39C4
LD HL,3970H 21 70 39
Load Register Pair HL with 3970H, the quarter turn, which is the argument of the 261CH 39BDH pushed and not an answer: for an argument below one nothing was pushed and this load is of no account.
39C7
RET C9
Return to the caller, or to the 261CH 39BDH pushed, or to the 28F3H 36CFH left on the stack, in that order.
39C8
DEFB 09H 09
39C8H: the number of coefficients in the series below, which 3859H reads before any of them.
39C9-39CC
DEFB 4AH, 0D7H, 3BH, 78H 4A D7 3B 78
39C9H to 39CCH: 0.00286622578, the first and highest power coefficient of the series for the arctangent.
39CD-39D0
DEFB 02H, 6EH, 84H, 7BH 02 6E 84 7B
39CDH to 39D0H: minus 0.0161657371, the second coefficient of the arctangent series.
39D1-39D4
DEFB 0FEH, 0C1H, 2FH, 7CH FE C1 2F 7C
39D1H to 39D4H: 0.0429096147, the third coefficient of the arctangent series.
39D5-39D8
DEFB 74H, 31H, 9AH, 7DH 74 31 9A 7D
39D5H to 39D8H: minus 0.0752896369, the fourth coefficient of the arctangent series.
39D9-39DC
DEFB 84H, 3DH, 5AH, 7DH 84 3D 5A 7D
39D9H to 39DCH: 0.106562644, the fifth coefficient of the arctangent series.
39DD-39E0
DEFB 0C8H, 7FH, 91H, 7EH C8 7F 91 7E
39DDH to 39E0H: minus 0.142089009, the sixth coefficient, which stands for minus one seventh in the plain arctangent series and is fitted rather than exact.
39E1-39E4
DEFB 0E4H, 0BBH, 4CH, 7EH E4 BB 4C 7E
39E1H to 39E4H: 0.199935496, the seventh coefficient, which stands for one fifth.
39E5-39E8
DEFB 6CH, 0AAH, 0AAH, 7FH 6C AA AA 7F
39E5H to 39E8H: minus 0.333331466, the eighth coefficient, which stands for minus one third.
39E9-39EC
DEFB 00H, 00H, 00H, 81H 00 00 00 81
39E9H to 39ECH: one, the ninth and last coefficient and the term the series comes down to for a small argument, so that the arctangent of a very small value is that value. It is the last byte of the number package: 39EDH is DIM.

39EDH - DIM and the Variable Search: Reading the Name (39EDH-3A72H)

39FBH is the routine nineteen of module 1's statements and all three of CHAIN's COMMON walks turn on, and it is reached in two ways that differ by one byte. The statement address table holds 39F6H for DIM at 67CDH, and DIM pushes 39EDH as its own return address so that the search comes back to it for the next name in the list; the ordinary callers enter at 39FBH, which is the operand byte of the OR 0AFH at 39FAH and so executes as XOR A. The byte the two entries differ over is the one at 7141H: DIM leaves it holding 0AFH or more and an ordinary reference leaves it 00H, and that one byte decides whether an array that already exists is an error, whether a subscript list is a declaration or a reference, and whether a dimension with no bound takes the default. The name is read here into three places that the rest of the routine works from: Register C takes the first character, Register B the second or 00H when there is none, and the characters from the third on go to 6ED0H with their high bits set and their count to 6ECFH. A full stop and the digits are part of a name, which is why A.1 is one variable, and a name of 39 characters or more gives Syntax error. The type comes either from a suffix of %, $, ! or # or, when there is none, from the declared type table at 71A7H that DEFINT, DEFSTR, DEFSNG and DEFDBL fill in, read here through the base 7166H and the first character's own code.

39ED
DEC HL 2B
DIM's own loop (39EDH), which is not entered from the statement table but from the return address the entry below pushes, so that each name in the list comes back here: decrement Register Pair HL, which puts the text pointer back on the character the search stopped at.
39EE
Call 5E93H, the routine that steps the text pointer to the next character that matters and returns with it in Register A, with the Zero Flag set when the statement has ended.
39F1
RET Z C8
Return on Z, the statement having ended, which is a DIM whose last name has been allotted.
39F2
Call 4353H, the character demand, which insists that the text pointer stands on the character held in the byte after the call and steps its own return address past that byte, so that a DIM of two names needs a comma between them.
39F5
DEFB 2CH 2C
39F5H: the comma 4353H above demands, which is the byte that makes DIM A(10),B(20) one statement and gives Syntax error for anything else between two names.
39F6
LD BC,39EDH 01 ED 39
DIM (39F6H), the routine the statement address table holds for token 86H at 67CDH: load Register Pair BC with 39EDH, the address of the loop above, so that the search returns there for the next name.
39F9
PUSH BC C5
Push Register Pair BC, which puts 39EDH on the stack as the return address the search leaves through, and is what makes DIM a loop without a loop instruction of its own.
39FA
OR 0AFH F6 AF
OR Register A with 0AFH, which leaves Register A holding 0AFH or more whatever it held and so cannot leave it 00H: this is DIM's own mark, and its operand byte at 39FBH is the entry every other caller uses.
39FC
LD (7141H),A 32 41 71
The entry at 39FBH, which is the operand byte above and executes as XOR A, so that an ordinary caller arrives with Register A holding 00H: store Register A into 7141H, the cell that says whether this is a DIM.
39FF
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the first character of the name, which every comparison below is made against.
3A00
Call 4473H, which loads Register A with the byte Register Pair HL addresses and falls into the letter test at 4474H, returning with the Carry Flag set when the character is not one of A to Z.
3A03
Jump to 586CH on C, the first character not being a letter, which is the Syntax error entry of the error chain.
3A06
XOR A AF
Clear Register A, the value both of the two cells below want.
3A07
LD B,A 47
Load Register B from Register A, so that a name of one character carries 00H as its second character, which is what the table walk compares against.
3A08
LD (6ECFH),A 32 CF 6E
Store Register A into 6ECFH, the count of the characters of the name beyond the second, which stays 00H for a name of one or two characters.
3A0B
INC HL 23
Increment Register Pair HL, the text pointer, to the character after the first.
3A0C
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the second character of the name or whatever ends it.
3A0D
CP 2EH FE 2E
Compare Register A with 2EH, the full stop, which is the lowest character a name may hold after its first.
3A0F
Jump to 3A4AH on C, the character standing below a full stop, which ends the name at one character and goes to the type test below.
3A11
Jump to 3A20H on Z, the character being a full stop: a full stop is part of a name, which is what makes A.1 and TOTAL.OUT single variables.
3A13
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9.
3A15
Jump to 3A1BH on NC, the character standing at or above a colon, which is where the letter test is made.
3A17
CP 30H FE 30
Compare Register A with 30H, the digit 0, the character the test below turns on.
3A19
Jump to 3A20H on NC, the character being one of the digits 0 to 9, which are part of a name after its first character.
3A1B
Call 4474H, the letter test, which returns with the Carry Flag set when the character in Register A is not one of A to Z.
3A1E
Jump to 3A4AH on C, the character being neither a letter nor a digit nor a full stop, which ends the name at one character.
3A20
LD B,A 47
Load Register B from Register A, the second character of the name, which the table walk compares against the second character of each entry.
3A21
PUSH BC C5
Push Register Pair BC, the two characters of the name, which the loop below writes over and 3A45H takes back.
3A22
LD B,0FFH 06 FF
Load Register B with 0FFH, the count the loop below increments before it stores anything, so that the first character stored leaves Register B holding 00H.
3A24
LD DE,6ECFH 11 CF 6E
Load Register Pair DE with 6ECFH, the cell the count lives in, which the loop below uses as the start of the characters and 3A46H writes the count over.
3A27
OR 80H F6 80
OR Register A with 80H, which sets bit 7 of the character: the characters of the tail are held with their high bits set, and 3CFAH compares them in that form.
3A29
INC B 04
Increment Register B, one more character of the tail counted.
3A2A
LD (DE),A 12
Store Register A at the address in Register Pair DE, the character going into 6ECFH on the first pass and into 6ED0H and above on the later ones.
3A2B
INC DE 13
Increment Register Pair DE to the next byte of the tail.
3A2C
INC HL 23
Increment Register Pair HL, the text pointer, to the next character of the name.
3A2D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the next character or whatever ends the name.
3A2E
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9.
3A30
Jump to 3A36H on NC, the character standing at or above a colon, which is where the letter test is made.
3A32
CP 30H FE 30
Compare Register A with 30H, the digit 0, so that the tail may hold digits as well as letters.
3A34
Jump to 3A27H on NC, the character being a digit, which is part of the name.
3A36
Call 4474H, the letter test, which returns with the Carry Flag set when the character in Register A is not a letter.
3A39
Jump to 3A27H on NC, the character being a letter, which is part of the name.
3A3B
CP 2EH FE 2E
Compare Register A with 2EH, the full stop, which is part of a name wherever it stands after the first character.
3A3D
Jump to 3A27H on Z, the character being a full stop, which is part of the name.
3A3F
LD A,B 78
Load Register A from Register B, the count of the characters of the tail less one, the name having ended.
3A40
CP 27H FE 27
Compare Register A with 27H, which is 39: a name whose tail runs to 39 characters or more is refused below.
3A42
Jump to 586CH on NC, the Syntax error entry, which is what a name of 41 characters or more meets.
3A45
POP BC C1
Pop Register Pair BC, the first and second characters of the name that 3A21H pushed, which the loop above wrote over.
3A46
LD (6ECFH),A 32 CF 6E
Store Register A into 6ECFH, the count of the tail, which goes over the first character the loop stored there: the tail the entries carry and 3CFAH compares begins at 6ED0H with the third character of the name.
3A49
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character that ended the name, which the type suffix tests below are made against.
3A4A
CP 26H FE 26
The type from the suffix (3A4AH): compare Register A with 26H, the character after the dollar sign, which is the highest of the four suffixes.
3A4C
Jump to 3A65H on NC, the character standing at or above an ampersand, which cannot be a suffix and sends the name to the declared type table.
3A4E
LD DE,3A73H 11 73 3A
Load Register Pair DE with 3A73H, the address the four tests below return to when one of them matches.
3A51
PUSH DE D5
Push Register Pair DE, which puts 3A73H on the stack so that each RET Z below leaves with the type in Register D and the text pointer past the suffix.
3A52
LD D,02H 16 02
Load Register D with 02H, the length of an integer value in bytes.
3A54
CP 25H FE 25
Compare Register A with 25H, the per cent sign.
3A56
RET Z C8
Return on Z, the suffix being a per cent sign, which goes to 3A73H with Register D holding 02H.
3A57
INC D 14
Increment Register D to 03H, the length of a string descriptor in bytes.
3A58
CP 24H FE 24
Compare Register A with 24H, the dollar sign.
3A5A
RET Z C8
Return on Z, the suffix being a dollar sign, which goes to 3A73H with Register D holding 03H.
3A5B
INC D 14
Increment Register D to 04H, the length of a single precision value in bytes.
3A5C
CP 21H FE 21
Compare Register A with 21H, the exclamation mark.
3A5E
RET Z C8
Return on Z, the suffix being an exclamation mark, which goes to 3A73H with Register D holding 04H.
3A5F
LD D,08H 16 08
Load Register D with 08H, the length of a double precision value in bytes.
3A61
CP 23H FE 23
Compare Register A with 23H, the number sign.
3A63
RET Z C8
Return on Z, the suffix being a number sign, which goes to 3A73H with Register D holding 08H.
3A64
POP AF F1
Pop Register AF, which throws away the 3A73H that 3A51H pushed, no suffix having matched, and leaves the stack as it was.
3A65
LD A,C 79
The type from the declared type table (3A65H): load Register A from Register C, the first character of the name.
3A66
AND 7FH E6 7F
AND Register A with 7FH, which takes off a high bit the first character cannot carry here but which the COMMON mark sets on an entry's second character.
3A68
LD E,A 5F
Load Register E from Register A, the first character's own code, which is the index into the table.
3A69
LD D,00H 16 00
Load Register D with 00H, so that Register Pair DE holds the index as a word.
3A6B
PUSH HL E5
Push Register Pair HL, the text pointer, which the table read below writes over.
3A6C
LD HL,7166H 21 66 71
Load Register Pair HL with 7166H, the base the table is read from: the table itself is the 26 bytes at 71A7H that the four DEF statements at 5F49H fill in, and 7166H plus the code of the letter A, 41H, is 71A7H.
3A6F
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which puts Register Pair HL on the byte of the table that belongs to the first character of this name.
3A70
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, the declared type of names beginning with that letter, as a count of bytes.
3A71
POP HL E1
Pop Register Pair HL, the text pointer that 3A6BH pushed, the table read above having written over it.
3A72
DEC HL 2B
Decrement Register Pair HL, which puts the text pointer back on the character that ended the name, no suffix having been taken off the line.

3A73H - The Search Itself: the Simple Variable Walk (3A73H-3B6FH)

The name is in hand and the type is in Register D, and the flag at 7182H now decides which of the two tables is walked. Its four values are the four a caller writes: 01H from CHAIN's COMMON walks at 54BEH, 54D0H and 5516H demands an array and goes straight to 3BE6H; 64H from FOR at 5D5CH and 80H from CALL at 535FH refuse one, so that a loop variable and a machine language entry address may not be subscripted; and 00H, which the clearing code at 4344H and this routine's own 3A90H leave, lets the character the name ended on decide, an opening ( or [ sending the name to the array code at 3B70H. ERASE at 4439H and 4442H, READ's 641CH, 77B9H and 790AH write it too. The walk itself is nine instructions long and compares three things in an order worth noting: the first character, then the type, then the second character, so that two names that differ only in type are two variables and A% and A! can both exist. An entry is +0 the type as a count of bytes, +1 the first character, +2 the second, +3 the length of the tail, then the tail, then the value, and the next entry stands at +4 plus the tail and the type, which is the sum 3ABFH works out. Because Register B carries the second character with its high bit clear, an entry whose second character has bit 7 set cannot match: that bit is the COMMON mark CHAIN's walks set and clear, and while it is set the variable is invisible to every ordinary reference. When 7294H is set the function parameter region at 71C5H is walked before the simple variables, 7291H holding which of the two the walk is in. That region is not CHAIN's: it is the local variables of a user-defined function call, which 7855H lays down and 78C7H takes away. Not found, the routine looks at its own return address to decide what to do: 3AEBH, the RET of the wrapper at 3AE8H, means look up only and answer Register Pair DE of 0000H; 758AH means answer with a zero accumulator; anything else means make the variable, which moves the whole array table up to let it in.

3A73
LD A,D 7A
The type in hand (3A73H), which the four suffix tests return to and the declared type table falls into: load Register A from Register D, the length of this name's value in bytes.
3A74
LD (7142H),A 32 42 71
Store Register A into 7142H, the type of the value in hand, which the walk below compares against each entry's own first byte and 76A4H and the array code read.
3A77
Call 5E93H, which steps the text pointer past the character the name ended on and returns with the next character that matters in Register A, the decrement at 3A72H having allowed for the increment this routine begins with.
3A7A
LD A,(7182H) 3A 82 71
Load Register A with the byte at 7182H, the flag that says whether an array is demanded or refused.
3A7D
DEC A 3D
Decrement Register A, which makes a flag of 01H the only value that leaves the Zero Flag set and a flag of 00H the value that leaves the Sign Flag set.
3A7E
Jump to the array table search at 3BE6H on Z, the flag having held 01H: this is the path CHAIN's three COMMON walks take, and it demands an array that already exists.
3A81
Jump to 3A8FH on P, the flag having held 02H to 80H, which is FOR's 64H and CALL's 80H: the name is to be a simple variable whatever follows it on the line.
3A84
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the name ended on, the flag having held 00H.
3A85
SUB 28H D6 28
Subtract 28H from Register A, the opening parenthesis.
3A87
Jump to the array code at 3B70H on Z, the name being followed by an opening parenthesis, which makes it a subscripted reference.
3A8A
SUB 33H D6 33
Subtract 33H from Register A, which takes the total subtracted to 5BH, the opening square bracket.
3A8C
Jump to the array code at 3B70H on Z, the name being followed by an opening square bracket, which BASIC takes for a parenthesis throughout.
3A8F
XOR A AF
The simple variable walk (3A8FH): clear Register A, the value the flag is left holding.
3A90
LD (7182H),A 32 82 71
Store Register A into 7182H, which clears the flag so that the next name is looked up on its own terms: every caller that wants the flag set must set it again.
3A93
PUSH HL E5
Push Register Pair HL, the text pointer, which the walk writes over and which every exit below takes back.
3A94
LD A,(7294H) 3A 94 72
Load Register A with the byte at 7294H, the flag that says a user-defined function call is in progress and that its parameter region is to be searched before the simple variables.
3A97
OR A B7
OR Register A with itself, which sets the Zero Flag when no user-defined function call is in progress and so no parameter region stands.
3A98
LD (7291H),A 32 91 72
Store Register A into 7291H, the cell that says which of the two regions the walk is in, so that 3AD3H can tell the first exhaustion from the second.
3A9B
Jump to 3ADDH on Z, there being no function parameter region, which starts the walk on the simple variables.
3A9D
LD HL,(71C3H) 2A C3 71
Load Register Pair HL with the word at 71C3H, the length of the function parameter region in bytes.
3AA0
LD DE,71C5H 11 C5 71
Load Register Pair DE with 71C5H, the first byte of the function parameter region, which stands directly above that length.
3AA3
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which makes Register Pair HL the first address above the function parameter region.
3AA4
LD (7292H),HL 22 92 72
Store Register Pair HL into the word at 7292H, the limit the walk stops at.
3AA7
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the start of the region into Register Pair HL and the limit into Register Pair DE.
3AA8
Jump to 3AC5H, the limit test at the foot of the walk, which exchanges the pair back and so enters the loop with Register Pair DE on the first entry.
3AAA
LD A,(DE) 1A
The walk (3AAAH): load Register A with the byte at the address in Register Pair DE, the entry's type as a count of bytes.
3AAB
LD L,A 6F
Load Register L from Register A, which keeps that type for the comparison two instructions below.
3AAC
INC DE 13
Increment Register Pair DE to the entry's first character.
3AAD
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, the entry's first character.
3AAE
INC DE 13
Increment Register Pair DE to the entry's second character.
3AAF
CP C B9
Compare Register A with Register C, the first character of the name wanted.
3AB0
Jump to 3ABDH on NZ, the first characters differing, which steps over this entry.
3AB2
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the name wanted.
3AB5
CP L BD
Compare Register A with Register L, the entry's own type: the type is part of the name, so that A% and A! are two variables and not one.
3AB6
Jump to 3ABDH on NZ, the types differing, which steps over this entry.
3AB8
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, the entry's second character, whose bit 7 is the COMMON mark.
3AB9
CP B B8
Compare Register A with Register B, the second character of the name wanted, which carries no high bit: a marked entry cannot match here and is invisible to an ordinary reference while the mark stands.
3ABA
Jump to 3B41H on Z, all three having matched, which goes on to compare the tails.
3ABD
INC DE 13
Increment Register Pair DE to the entry's tail length.
3ABE
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, the length of this entry's tail.
3ABF
LD H,00H 26 00
Load Register H with 00H, so that the sum below is made in the low byte alone, a tail of 38 characters and a type of 8 bytes coming to 47 at most.
3AC1
ADD A,L 85
Add Register L to Register A, the entry's type, which with the tail length is the part of the entry that stands after the fourth byte.
3AC2
INC A 3C
Increment Register A, which allows for the tail length byte itself.
3AC3
LD L,A 6F
Load Register L from Register A, so that Register Pair HL holds the distance from the tail length byte to the next entry.
3AC4
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which puts Register Pair HL on the entry after this one.
3AC5
EX DE,HL EB
The limit test (3AC5H): exchange Register Pair DE with Register Pair HL, which puts the next entry into Register Pair DE and the limit into Register Pair HL.
3AC6
LD A,(7292H) 3A 92 72
Load Register A with the byte at 7292H, the low byte of the limit.
3AC9
CP E BB
Compare Register A with Register E, the low byte of the entry the walk stands on.
3ACA
Jump to 3AAAH on NZ, the walk not having reached the limit, which compares this entry.
3ACD
LD A,(7293H) 3A 93 72
Load Register A with the byte at 7293H, the high byte of the limit.
3AD0
CP D BA
Compare Register A with Register D, the high byte of the entry the walk stands on.
3AD1
Jump to 3AAAH on NZ, the walk not having reached the limit, which compares this entry.
3AD3
LD A,(7291H) 3A 91 72
The region exhausted (3AD3H): load Register A with the byte at 7291H, which says whether this was the function parameter region or the simple variables.
3AD6
OR A B7
OR Register A with itself, which sets the Zero Flag when the simple variables have been walked.
3AD7
Jump to 3AF1H on Z, both regions having been walked, which is where the name is made or refused.
3AD9
XOR A AF
Clear Register A, the function parameter region having been walked and the simple variables still to come.
3ADA
LD (7291H),A 32 91 72
Store Register A into 7291H, so that the next exhaustion is the last and goes to 3AF1H.
3ADD
LD HL,(71A1H) 2A A1 71
The simple variables (3ADDH): load Register Pair HL with the word at 71A1H, the start of the array table, which is also the first address above the simple variables.
3AE0
LD (7292H),HL 22 92 72
Store Register Pair HL into the word at 7292H, the limit the walk stops at.
3AE3
LD HL,(719FH) 2A 9F 71
Load Register Pair HL with the word at 719FH, VARTAB, the first simple variable.
3AE6
Jump to 3AC5H, the limit test, which enters the walk on that first entry.
3AE8
The look up only wrapper (3AE8H), which CALL at 5371H, SWAP and ERASE call in place of 39FBH: call 39FBH, the search, which leaves the return address 3AEBH on the stack for 3AF4H to recognise.
3AEB
RET C9
Return, the one instruction the wrapper adds, which is the whole of how the search tells a caller that wants a variable made from one that does not.
3AEC
LD D,A 57
The answer when the name is not to be made (3AECH): load Register D from Register A, which holds 00H, 434DH having answered equal.
3AED
LD E,A 5F
Load Register E from Register A, so that Register Pair DE holds 0000H, the answer that says the variable does not exist.
3AEE
POP BC C1
Pop Register Pair BC, which throws away the address 3AF3H pushed, the place a new entry would have gone.
3AEF
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the text pointer into Register Pair HL and the address 3AEBH back on the stack.
3AF0
RET C9
Return, which goes to the RET at 3AEBH and from there to the wrapper's own caller, with Register Pair DE holding 0000H.
3AF1
POP HL E1
Not found (3AF1H): pop Register Pair HL, the text pointer that 3A93H pushed.
3AF2
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the search's own return address into Register Pair HL and the text pointer on the stack.
3AF3
PUSH DE D5
Push Register Pair DE, the address the walk stopped at, which is the first free byte above the simple variables and where a new entry goes.
3AF4
LD DE,3AEBH 11 EB 3A
Load Register Pair DE with 3AEBH, the RET of the wrapper at 3AE8H.
3AF7
Call 434DH, the sixteen bit comparison, which sets the Zero Flag when the return address in Register Pair HL is that RET.
3AFA
Jump to 3AECH on Z, the caller having come through the wrapper, which answers 0000H and makes nothing.
3AFC
LD DE,758AH 11 8A 75
Load Register Pair DE with 758AH, the other return address the search knows by name.
3AFF
Call 434DH, the sixteen bit comparison, which sets the Zero Flag when the return address is 758AH.
3B02
POP DE D1
Pop Register Pair DE, the address a new entry would go at, which the two comparisons wrote over.
3B03
Jump to 3B5BH on Z, the caller being 758AH, which answers with a zero accumulator rather than making the variable.
3B05
EX (SP),HL E3
Making the variable (3B05H): exchange Register Pair HL with the word the Stack Pointer addresses, which puts the return address back on the stack and the text pointer into Register Pair HL.
3B06
PUSH HL E5
Push Register Pair HL, the text pointer, which 3B3FH takes back.
3B07
PUSH BC C5
Push Register Pair BC, the two characters of the name, which 3B36H takes back to write into the entry.
3B08
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the new variable as a count of bytes.
3B0B
LD B,A 47
Load Register B from Register A, the type, for the sum below.
3B0C
LD A,(6ECFH) 3A CF 6E
Load Register A with the byte at 6ECFH, the length of the name's tail.
3B0F
ADD A,B 80
Add Register B to Register A, the type, which is the part of the entry that follows the tail.
3B10
INC A 3C
Increment Register A, which allows for the tail length byte itself.
3B11
LD C,A 4F
Load Register C from Register A, so that Register C holds the entry's length less its first three bytes.
3B12
PUSH BC C5
Push Register Pair BC, the type in Register B and that length in Register C, which 3B33H takes back as Register Pair DE.
3B13
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC holds that length as a word.
3B15
INC BC 03
Increment Register Pair BC, the first of three increments that allow for the type, the first character and the second.
3B16
INC BC 03
Increment Register Pair BC a second time, which allows for the entry's first character.
3B17
INC BC 03
Increment Register Pair BC a third time, which makes Register Pair BC the whole length of the new entry.
3B18
LD HL,(71A3H) 2A A3 71
Load Register Pair HL with the word at 71A3H, LOPT, the end of the arrays and the lowest free address.
3B1B
PUSH HL E5
Push Register Pair HL, that old end, which the exchange inside 4237H wants as the source of the move.
3B1C
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which makes Register Pair HL the end the arrays are to have once the new entry is in.
3B1D
POP BC C1
Pop Register Pair BC, the old end back, so that Register Pair HL and Register Pair BC are the two ends of the move.
3B1E
PUSH HL E5
Push Register Pair HL, the new end, which 3B22H takes back.
3B1F
Call 4237H, which asks 426DH for the room and then moves every byte from the new entry's place up to the old end into its new place, working downwards so that the array table and the arrays themselves ride up by the length of the entry.
3B22
POP HL E1
Pop Register Pair HL, the new end of the arrays.
3B23
LD (71A3H),HL 22 A3 71
Store Register Pair HL into the word at 71A3H, LOPT, which is now the lowest free address again.
3B26
LD H,B 60
Load Register H from Register B, the high byte of the address the move left in Register Pair BC.
3B27
LD L,C 69
Load Register L from Register C, the low byte, so that Register Pair HL stands just above the new entry.
3B28
LD (71A1H),HL 22 A1 71
Store Register Pair HL into the word at 71A1H, the start of the array table, which has moved up by the length of the entry.
3B2B
DEC HL 2B
Decrement Register Pair HL, which steps back into the new entry, the highest byte of its value first.
3B2C
LD (HL),00H 36 00
Store 00H at the address in Register Pair HL, which is how a new variable starts at zero and a new string starts empty.
3B2E
Call 434DH, the sixteen bit comparison, which sets the Zero Flag when Register Pair HL has come down to the first byte of the entry in Register Pair DE.
3B31
Jump to 3B2BH on NZ, the entry not yet filled with zeros.
3B33
POP DE D1
Pop Register Pair DE, the word 3B12H pushed, Register D holding the type.
3B34
LD (HL),D 72
Store Register D at the address in Register Pair HL, the entry's first byte, which is the type as a count of bytes.
3B35
INC HL 23
Increment Register Pair HL to the entry's second byte.
3B36
POP DE D1
Pop Register Pair DE, the word 3B07H pushed, Register E holding the first character of the name and Register D the second.
3B37
LD (HL),E 73
Store Register E at the address in Register Pair HL, the entry's first character.
3B38
INC HL 23
Increment Register Pair HL to the entry's third byte.
3B39
LD (HL),D 72
Store Register D at the address in Register Pair HL, the entry's second character, which is 00H for a name of one character.
3B3A
Call 3CE6H, which writes the tail length and the tail itself from 6ECFH into the bytes above, leaving Register Pair HL on the last of them.
3B3D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that last byte of the tail into Register Pair DE.
3B3E
INC DE 13
Increment Register Pair DE to the first byte of the value, which is the address the search answers with.
3B3F
POP HL E1
Pop Register Pair HL, the text pointer that 3B06H pushed.
3B40
RET C9
Return, with Register Pair DE addressing the value of a variable that now exists and holds zero.
3B41
INC DE 13
The tails compared (3B41H), the three bytes above having matched: increment Register Pair DE to the entry's tail length.
3B42
LD A,(6ECFH) 3A CF 6E
Load Register A with the byte at 6ECFH, the length of the tail of the name wanted.
3B45
LD H,A 67
Load Register H from Register A, which keeps that length for the comparison below.
3B46
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, this entry's own tail length.
3B47
CP H BC
Compare Register A with Register H, the length wanted.
3B48
Jump to 3ABEH on NZ, the tails differing in length, which steps over this entry with Register Pair DE already on its tail length byte.
3B4B
OR A B7
OR Register A with itself, which sets the Zero Flag when neither name has a tail.
3B4C
Jump to 3B51H on NZ, there being a tail to compare.
3B4E
INC DE 13
Increment Register Pair DE to the first byte of the value, the name being of one or two characters and the entry found.
3B4F
POP HL E1
Pop Register Pair HL, the text pointer that 3A93H pushed.
3B50
RET C9
Return, with Register Pair DE addressing the value of the variable.
3B51
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the entry's tail length byte into Register Pair HL for the comparison below.
3B52
Call 3CFAH, which compares the tail at 6ED0H with the entry's own, byte for byte, and returns with the Zero Flag set when they are the same and Register Pair HL past the tail either way.
3B55
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the entry pointer back into Register Pair DE.
3B56
Jump to 3ABFH on NZ, the tails differing, which steps over this entry with the tail length already in Register A.
3B59
POP HL E1
Pop Register Pair HL, the text pointer that 3A93H pushed, the whole name having matched.
3B5A
RET C9
Return, with Register Pair DE addressing the value of the variable.
3B5B
LD (72EFH),A 32 EF 72
The answer for the caller at 758AH (3B5BH): store Register A, which holds 00H, into 72EFH, the high byte of the accumulator.
3B5E
LD H,A 67
Load Register H from Register A, which holds 00H, the high half of the zero answer.
3B5F
LD L,A 6F
Load Register L from Register A, so that Register Pair HL holds 0000H.
3B60
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the low two bytes of the accumulator, which makes the answer a numeric zero.
3B63
Call 76A4H, which reads the type at 7142H and returns with the Zero Flag set when it is 03H, a string.
3B66
Jump to 3B6EH on NZ, the type being a number, whose zero is already in the accumulator.
3B68
LD HL,732CH 21 2C 73
Load Register Pair HL with 732CH, the 00H byte that ends the text at 7328H, which serves here as a string of no characters.
3B6B
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, so that an undefined string reads as empty, its descriptor address pointing at that lone zero byte.
3B6E
POP HL E1
Pop Register Pair HL, the text pointer that 3A93H pushed.
3B6F
RET C9
Return to 758AH, which wanted the value of a name that may not exist and has been given zero or the empty string.

3B70H - A Subscripted Name: Collecting the Subscripts (3B70H-3BE4H)

A name followed by ( or [ comes here, and the work is done before the array table is ever looked at: each subscript is an expression, and working one out can call the variable search again, which would write over the very name this routine is holding. So the name is saved twice over. The flag at 7141H and the type at 7142H are read as one word and put on the stack, and the tail at 6ECFH is pushed onto the stack a word at a time and pulled back afterwards, which is what 3B88H and 3BA1H are for and why 4247H is asked for the room first. The subscripts themselves are left on the stack under that saved word, most recent on top, and the array code below takes them off in that order. Two things are settled here rather than in the array code. A negative subscript gives Illegal function call and not Subscript out of range, because 5F8EH raises error 5 itself for any negative value and never returns one. And OPTION BASE 1 is applied here: 72A3H holding 01H makes a subscript of 0 give error 9 at once and takes one off every other subscript, so that the element the user calls 1 is the element the arithmetic calls 0. The count of subscripts is kept in Register D across the whole loop and handed to the array search in a way worth seeing: 3BE4H pushes it with 00H beside it, so that the POP AF the search makes at 3C43H finds the count in Register A and the Zero Flag clear, and 3BE5H is a LD DE,0F5E5H whose two operand bytes are the PUSH HL and PUSH AF at 3BE6H, which this path has already done for itself and must not do twice. The Register Pair DE that instruction spoils is loaded again at 3BEDH before anything reads it.

3B70
PUSH HL E5
The array code (3B70H), reached from 3A87H and 3A8CH when the name is followed by an opening bracket: push Register Pair HL, the text pointer, which the exchange below puts the saved flag word in place of.
3B71
LD HL,(7141H) 2A 41 71
Load Register Pair HL with the word at 7141H, the DIM flag in the low byte and the type in the high byte, which the subscript expressions below would otherwise write over.
3B74
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that flag word on the stack and brings the text pointer back into Register Pair HL.
3B75
LD D,A 57
Load Register D from Register A, which holds 00H, both subtractions at 3A85H and 3A8AH having answered zero: Register D is the count of subscripts and starts empty.
3B76
PUSH DE D5
The loop over the subscripts (3B76H): push Register Pair DE, the count of subscripts so far in Register D.
3B77
PUSH BC C5
Push Register Pair BC, the two characters of the name, which the subscript expression below would write over.
3B78
LD DE,6ECFH 11 CF 6E
Load Register Pair DE with 6ECFH, the length of the name's tail.
3B7B
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, that length.
3B7C
OR A B7
OR Register A with itself, which sets the Zero Flag when the name has no tail to save.
3B7D
Jump to 3BAEH on Z, there being no tail, which works the subscript out without saving anything.
3B7F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts 6ECFH into Register Pair HL and the text pointer into Register Pair DE.
3B80
ADD A,02H C6 02
Add 02H to Register A, the tail length, which rounds it up to the next even number and allows for the length byte.
3B82
RRA 1F
Rotate Register A right through the Carry Flag, which halves it, the addition above having left the Carry Flag clear: Register A is the count of whole words the tail and its length byte fill.
3B83
LD C,A 4F
Load Register C from Register A, that count of words.
3B84
Call 4247H, which makes sure there is room below the Stack Pointer for twice Register C bytes and raises Out of memory itself when there is not.
3B87
LD A,C 79
Load Register A from Register C, the count of words, which the loop below counts down.
3B88
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of this word of the tail.
3B89
INC HL 23
Increment Register Pair HL to the next byte of the tail, the high byte of this word.
3B8A
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte of this word.
3B8B
INC HL 23
Increment Register Pair HL to the next word of the tail.
3B8C
PUSH BC C5
Push Register Pair BC, which puts that word of the name's tail on the stack out of the subscript expression's way.
3B8D
DEC A 3D
Decrement Register A, one fewer word to save.
3B8E
Jump to 3B88H on NZ, there being more of the tail to push.
3B90
PUSH HL E5
Push Register Pair HL, which stands just above the tail in the 6ECFH area and is where the restore below works down from.
3B91
LD A,(6ECFH) 3A CF 6E
Load Register A with the byte at 6ECFH, the tail length again, which the restore below needs and the expression may write over.
3B94
PUSH AF F5
Push Register AF, that tail length, which the restore at 3B9EH takes back and halves.
3B95
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer back into Register Pair HL for the expression.
3B96
Call 5F8EH, which steps the text pointer on and works the subscript out into Register Pair DE as a sixteen bit value, raising Illegal function call itself for a negative one.
3B99
POP AF F1
Pop Register AF, the tail length that 3B94H pushed.
3B9A
LD (6EF6H),HL 22 F6 6E
Store Register Pair HL into the word at 6EF6H, the text pointer standing after the subscript, which the restore below writes over.
3B9D
POP HL E1
Pop Register Pair HL, the address just above the tail that 3B90H pushed.
3B9E
ADD A,02H C6 02
Add 02H to Register A, the tail length, which rounds it up as 3B80H did.
3BA0
RRA 1F
Rotate Register A right through the Carry Flag, which halves it again: Register A is the count of words to pull back.
3BA1
POP BC C1
Pop Register Pair BC, the highest word of the tail that the loop above pushed.
3BA2
DEC HL 2B
Decrement Register Pair HL to the high byte of that word.
3BA3
LD (HL),B 70
Store Register B at the address in Register Pair HL, the high byte back in its place.
3BA4
DEC HL 2B
Decrement Register Pair HL to the low byte of that word of the tail.
3BA5
LD (HL),C 71
Store Register C at the address in Register Pair HL, the low byte back in its place.
3BA6
DEC A 3D
Decrement Register A, one fewer word to pull back.
3BA7
Jump to 3BA1H on NZ, there being more of the tail on the stack.
3BA9
LD HL,(6EF6H) 2A F6 6E
Load Register Pair HL with the word at 6EF6H, the text pointer standing after the subscript.
3BAC
Jump to 3BB5H, the OPTION BASE test, the tail being back where the walk reads it.
3BAE
A subscript with no tail to save (3BAEH): call 5F8EH, which works the subscript out into Register Pair DE as above.
3BB1
XOR A AF
Clear Register A, the value the tail length is to be left holding.
3BB2
LD (6ECFH),A 32 CF 6E
Store Register A into 6ECFH, which puts the tail length back to 00H, the expression having been free to use the bytes above it.
3BB5
LD A,(72A3H) 3A A3 72
OPTION BASE (3BB5H): load Register A with the byte at 72A3H, the OPTION BASE setting, 00H or 01H.
3BB8
OR A B7
OR Register A with itself, which sets the Zero Flag when the base is 0 and the subscript stands as it was given.
3BB9
Jump to 3BC1H on Z, the base being 0, which leaves the subscript alone.
3BBB
LD A,D 7A
Load Register A from Register D, the high byte of the subscript.
3BBC
OR E B3
OR Register A with Register E, the low byte, which sets the Zero Flag when the subscript given was 0.
3BBD
Jump to 3C24H on Z, a subscript of 0 under OPTION BASE 1 being Subscript out of range, error 9.
3BC0
DEC DE 1B
Decrement Register Pair DE, which takes one off the subscript, so that the element the user calls 1 is the element the arithmetic below calls 0.
3BC1
POP BC C1
Pop Register Pair BC, the two characters of the name that 3B77H pushed.
3BC2
POP AF F1
Pop Register AF, the word 3B76H pushed, Register A taking the count of subscripts from Register D.
3BC3
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the subscript into Register Pair HL and the text pointer into Register Pair DE.
3BC4
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the subscript on the stack and brings the saved flag word back into Register Pair HL.
3BC5
PUSH HL E5
Push Register Pair HL, that flag word, which goes back on top so that the subscripts pile up beneath it.
3BC6
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer back into Register Pair HL.
3BC7
INC A 3C
Increment Register A, one more subscript counted.
3BC8
LD D,A 57
Load Register D from Register A, the count, which 3B76H pushes again if another subscript follows.
3BC9
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the subscript.
3BCA
CP 2CH FE 2C
Compare Register A with 2CH, the comma that stands between two subscripts of a list.
3BCC
Jump to 3B76H on Z, a comma following, which takes the next subscript of the list.
3BCF
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis.
3BD1
Jump to 3BD8H on Z, the list having ended with a parenthesis.
3BD3
CP 5DH FE 5D
Compare Register A with 5DH, the closing square bracket.
3BD5
Jump to 586CH on NZ, the list ending with neither bracket, which is Syntax error: the two kinds of bracket are not required to match, so that A(1] is accepted.
3BD8
Call 5E93H, which steps the text pointer past the closing bracket to the next character that matters.
3BDB
LD (7199H),HL 22 99 71
Store Register Pair HL into the word at 7199H, the text pointer the two exits at 3CD5H put back, the stack being given over to the subscripts from here on.
3BDE
POP HL E1
Pop Register Pair HL, the flag word that 3BC5H pushed.
3BDF
LD (7141H),HL 22 41 71
Store Register Pair HL into the word at 7141H, which puts the DIM flag and the type back as they were before the subscripts were worked out.
3BE2
LD E,00H 1E 00
Load Register E with 00H, the byte that becomes the flags of the POP AF at 3C43H, and whose clear Zero Flag is what tells the array search that this path wants an array made.
3BE4
PUSH DE D5
Push Register Pair DE, the count of subscripts in Register D and that 00H in Register E.

3BE5H - The Array Table Search (3BE5H-3C3AH)

3BE6H is the array table's own search, and it is entered in the two ways the instruction above makes possible: from 3A7EH, where the flag at 7182H held 01H, with PUSH HL and PUSH AF both done and the caller's own Zero Flag riding on the stack, and from 3BE5H at 3BE8H with the text pointer and the subscript count already pushed. What the caller's Zero Flag decides is whether an array may be made. Set, the search answers a missing array by leaving Register A holding 0FFH with the Carry Flag set at 3CD9H, and answers one it finds by jumping to 27DBH of BASIC/OV1, which is a POP HL and a RET and nothing else, so that the caller gets the array's own descriptor address in Register Pair BC and the text pointer back. Clear, a missing array is made at 3C3BH. The entries are laid out as the simple variables are for their first four bytes, and then carry a word of their own whole length, which is what makes the walk a single ADD HL,DE: 3BEBH is a LD A,19H whose operand byte at 3BECH is that ADD HL,DE, so the first turn of the loop does not advance and every later one does. The 19H it leaves in Register A is read by nothing. After the length word stands the count of dimensions, then that many bound words, then the elements.

3BE5
LD DE,0F5E5H 11 E5 F5
Load Register Pair DE with 0F5E5H, whose two operand bytes at 3BE6H and 3BE7H are the PUSH HL and PUSH AF of the entry below: this path has pushed its own text pointer and its own word already, so the instruction exists to step over them, and the F5E5H it leaves in Register Pair DE is written over at 3BEDH before anything reads it.
3BE8
LD HL,(71A1H) 2A A1 71
The array table search (3BE6H), whose first two bytes are the operand of the instruction above: push Register Pair HL, the text pointer, and push Register AF, the caller's own Zero Flag, which is what says whether an array may be made. Load Register Pair HL with the word at 71A1H, the start of the array table.
3BEB
LD A,19H 3E 19
Load Register A with 19H, whose operand byte at 3BECH is the ADD HL,DE the loop below comes back to: on the first turn that addition is stepped over, so the walk starts on the first entry rather than past it. Nothing reads the 19H.
3BED
LD DE,(71A3H) ED 5B A3 71
Load Register Pair DE with the word at 71A3H, LOPT, the end of the arrays, which is the limit the walk stops at.
3BF1
Call 434DH, the sixteen bit comparison, which sets the Zero Flag when the walk has reached the end of the arrays.
3BF4
Jump to 3C3BH on Z, there being no such array in the table, which makes one or refuses to.
3BF6
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, this entry's type as a count of bytes.
3BF7
INC HL 23
Increment Register Pair HL to the entry's first character.
3BF8
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that first character.
3BF9
INC HL 23
Increment Register Pair HL to the entry's second character.
3BFA
CP C B9
Compare Register A with Register C, the first character of the name wanted.
3BFB
Jump to 3C07H on NZ, the first characters differing, which steps over this entry.
3BFD
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the name wanted.
3C00
CP E BB
Compare Register A with Register E, this entry's own type, the type being part of an array's name as it is part of a simple variable's.
3C01
Jump to 3C07H on NZ, the types differing, which steps over this entry.
3C03
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the entry's second character.
3C04
CP B B8
Compare Register A with Register B, the second character of the name wanted.
3C05
Jump to 3C2AH on Z, all three having matched, which goes on to compare the tails.
3C07
INC HL 23
Over this entry (3C07H): increment Register Pair HL to the entry's tail length byte.
3C08
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the length of this entry's tail.
3C09
INC E 1C
Increment Register E, which allows for the tail length byte itself and leaves the Zero Flag clear for the test at 3C11H.
3C0A
LD D,00H 16 00
Load Register D with 00H, so that Register Pair DE holds that distance as a word.
3C0C
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which puts Register Pair HL on the entry's own length word, past the tail.
3C0D
LD E,(HL) 5E
The length word (3C0DH): load Register E with the byte Register Pair HL addresses, its low byte.
3C0E
INC HL 23
Increment Register Pair HL to the high byte of that length word.
3C0F
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, that high byte, so that Register Pair DE is the whole length of this entry.
3C10
INC HL 23
Increment Register Pair HL to the entry's count of dimensions, which is where a match leaves it.
3C11
Jump to 3BECH on NZ, this entry not being the one wanted, which adds that length to Register Pair HL and tries the next: the Zero Flag here is the answer the tail comparison left, so a match falls through to the two instructions below.
3C13
LD A,(7141H) 3A 41 71
The array found (3C13H): load Register A with the byte at 7141H, the DIM flag.
3C16
OR A B7
OR Register A with itself, which sets the Zero Flag when this is an ordinary reference and not a DIM.
3C17
Jump to 5875H on NZ, a DIM of an array that already exists being Redimensioned array, error 10.
3C1A
POP AF F1
Pop Register AF, the caller's own Zero Flag that 3BE7H pushed, or the 00H that 3BE2H put in Register E.
3C1B
LD B,H 44
Load Register B from Register H, the high byte of the address of the entry's count of dimensions.
3C1C
LD C,L 4D
Load Register C from Register L, the low byte, so that Register Pair BC addresses that count.
3C1D
Jump to 27DBH on Z, the caller having wanted the array looked up and not used: 27DBH of BASIC/OV1 is a POP HL and a RET, which takes the text pointer back and returns with Register Pair BC addressing the array's own description.
3C20
SUB (HL) 96
Subtract the byte Register Pair HL addresses from Register A, the count of dimensions the array was made with, Register A holding the count of subscripts given.
3C21
Jump to 3CA3H on Z, the two counts agreeing, which works the element's address out.
3C24
LD DE,0009H 11 09 00
Subscript out of range (3C24H), which 3BBDH, 3CB2H and 2B76H of BASIC/OV1 all jump to: load Register Pair DE with 0009H, the number of the Subscript out of range text.
3C27
Jump to the error handler at 5886H, which names the line and goes back to command level: a reference with the wrong number of subscripts is reported as a subscript out of range and not as a syntax error.
3C2A
INC HL 23
The tails compared (3C2AH): increment Register Pair HL to this entry's tail length byte.
3C2B
LD A,(6ECFH) 3A CF 6E
Load Register A with the byte at 6ECFH, the length of the tail of the name wanted.
3C2E
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, this entry's own tail length.
3C2F
Jump to 3C08H on NZ, the tails differing in length, which steps over this entry with Register Pair HL already on its tail length byte.
3C31
INC HL 23
Increment Register Pair HL to the first character of this entry's tail.
3C32
OR A B7
OR Register A with itself, which sets the Zero Flag when neither name has a tail.
3C33
Jump to 3C0DH on Z, the name being of one or two characters and the entry the one wanted, the set Zero Flag being what carries that answer to 3C11H.
3C35
DEC HL 2B
Decrement Register Pair HL to the tail length byte, which is where the comparison below begins.
3C36
Call 3CFAH, which compares the tail at 6ED0H with this entry's own and returns with the Zero Flag set when they are the same, leaving Register Pair HL past the tail either way.
3C39
Jump to 3C0DH, the length word, which 3C11H reads the answer of this comparison at.

3C3BH - Making an Array (3C3BH-3CA2H)

The array is not in the table, and the caller's own Zero Flag decides whether one is made: set, 3C44H goes to 3CD9H and answers that there is no such array; clear, the entry is built here at the end of the table. The bounds come from one of two places, and the carry the RLA at 3C5CH takes out of bit 7 of the DIM flag is what chooses: a DIM pulls each bound off the stack and adds one to it, so that DIM A(10) makes eleven elements and the highest subscript is the one the user wrote; a reference to an array that was never dimensioned takes the default from 72A3H instead, and the XOR 0BH at 3C64H is the whole of that default, turning an OPTION BASE of 00H into 11 elements and one of 01H into 10, which is the same ten usable subscripts either way. Each bound is multiplied into a running total by 2B76H of BASIC/OV1, which starts from the element size and reports its own overflow by jumping back here to 3C24H. The elements are then filled with 00H from the top down, which is what makes a new numeric array read as zeros and a new string array as empty strings. The last thing written is the entry's own length word, worked out at 3C97H as twice the count of dimensions plus the bytes of the elements plus the one byte the count itself fills, which is exactly the distance the walk at 3BECH adds. The bounds are stored in the reverse of the order they were written, because the stack hands them back last first, and the element arithmetic below takes the subscripts off in that same reversed order, which is what makes the first subscript the one that varies fastest in memory.

3C3B
LD A,(7142H) 3A 42 71
The array is not there (3C3BH): load Register A with the byte at 7142H, the type of the new array as a count of bytes.
3C3E
LD (HL),A 77
Store Register A at the address in Register Pair HL, the entry's first byte, Register Pair HL standing at the end of the array table.
3C3F
INC HL 23
Increment Register Pair HL to the entry's second byte.
3C40
LD E,A 5F
Load Register E from Register A, the type, which is the size of one element and the figure the multiplications below start from.
3C41
LD D,00H 16 00
Load Register D with 00H, so that Register Pair DE holds that size as a word.
3C43
POP AF F1
Pop Register AF, the caller's own Zero Flag that 3BE7H pushed, or the 00H at 3BE2H which leaves it clear.
3C44
Jump to 3CD9H on Z, the caller having asked only whether the array exists: nothing is made and 3CD9H answers that it does not.
3C47
LD (HL),C 71
Store Register C at the address in Register Pair HL, the first character of the name.
3C48
INC HL 23
Increment Register Pair HL to the entry's third byte.
3C49
LD (HL),B 70
Store Register B at the address in Register Pair HL, the second character of the name, 00H for a name of one character.
3C4A
Call 3CE6H, which writes the tail length and the tail from 6ECFH into the bytes above and leaves Register Pair HL on the last of them.
3C4D
INC HL 23
Increment Register Pair HL to the entry's length word, which is written last of all at 3C9CH.
3C4E
LD C,A 4F
Load Register C from Register A, the count of dimensions, which Register A has held since the POP AF above.
3C4F
Call 4247H, which makes sure there is room below the Stack Pointer for twice Register C bytes, the bound words this array wants.
3C52
INC HL 23
Increment Register Pair HL past the low byte of the length word.
3C53
INC HL 23
Increment Register Pair HL past its high byte, to the byte the count of dimensions goes in.
3C54
LD (717AH),HL 22 7A 71
Store Register Pair HL into the word at 717AH, which is where 3C92H finds the count of dimensions again once the elements are laid out.
3C57
LD (HL),C 71
Store Register C at the address in Register Pair HL, the count of dimensions.
3C58
INC HL 23
Increment Register Pair HL to the first bound word.
3C59
LD A,(7141H) 3A 41 71
Load Register A with the byte at 7141H, the DIM flag, which holds 0AFH or more for a DIM and 00H for a reference.
3C5C
RLA 17
Rotate Register A left through the Carry Flag, which puts bit 7 of that flag into the Carry Flag: set for a DIM, clear for a reference to an array never dimensioned.
3C5D
LD A,C 79
Load Register A from Register C, the count of dimensions, which the loop below counts down.
3C5E
The loop over the bounds (3C5EH): jump to 3C6CH on C, this being a DIM, which takes the bound the user wrote.
3C60
PUSH AF F5
The default bound (3C60H): push Register AF, the count of dimensions and the Carry Flag that chose this path.
3C61
LD A,(72A3H) 3A A3 72
Load Register A with the byte at 72A3H, the OPTION BASE setting, 00H or 01H.
3C64
XOR 0BH EE 0B
Exclusive OR Register A with 0BH, which turns 00H into 0BH and 01H into 0AH: eleven elements under OPTION BASE 0 and ten under OPTION BASE 1, which is subscripts 0 to 10 and 1 to 10, the same ten usable either way.
3C66
LD C,A 4F
Load Register C from Register A, that default count of elements.
3C67
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC holds it as a word.
3C69
POP AF F1
Pop Register AF, the count of dimensions and the Carry Flag back.
3C6A
Jump to 3C6EH on NC, which is always taken here, the Carry Flag having been clear to reach this path at all.
3C6C
POP BC C1
A bound the user wrote (3C6CH): pop Register Pair BC, the last subscript the loop at 3B76H left on the stack, the stack giving them back in the reverse of the order they were written.
3C6D
INC BC 03
Increment Register Pair BC, which is why DIM A(10) makes eleven elements and the subscript 10 is usable.
3C6E
LD (HL),C 71
Store Register C at the address in Register Pair HL, the low byte of this bound.
3C6F
PUSH AF F5
Push Register AF, the count of dimensions and the Carry Flag, which the multiplication below writes over.
3C70
INC HL 23
Increment Register Pair HL to the high byte of this bound word.
3C71
LD (HL),B 70
Store Register B at the address in Register Pair HL, that high byte.
3C72
INC HL 23
Increment Register Pair HL to the next bound word.
3C73
Call 2B76H of BASIC/OV1, which multiplies Register Pair BC by Register Pair DE and answers in Register Pair DE, jumping to 3C24H itself when the product will not hold in sixteen bits.
3C76
POP AF F1
Pop Register AF, the count of dimensions and the Carry Flag back, the multiplication having spoiled them.
3C77
DEC A 3D
Decrement Register A, one fewer dimension to lay out.
3C78
Jump to 3C5EH on NZ, there being another bound, the Carry Flag having survived the decrement and so still saying whether this is a DIM.
3C7A
PUSH AF F5
The elements (3C7AH): push Register AF, the Carry Flag that says whether this is a DIM, which 3CA0H reads.
3C7B
LD B,D 42
Load Register B from Register D, the high byte of the product, which is the whole size of the elements in bytes.
3C7C
LD C,E 4B
Load Register C from Register E, its low byte, so that Register Pair BC holds that size.
3C7D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the first byte of the elements into Register Pair DE and that size into Register Pair HL.
3C7E
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which makes Register Pair HL the first address above the new array.
3C7F
Jump to 425CH on C, the sum having run past 0FFFFH, which is the Out of memory entry.
3C82
Call 426DH, which makes sure there is room below the Stack Pointer for everything up to Register Pair HL, collecting the string space once if it has to and raising Out of memory itself if it cannot.
3C85
LD (71A3H),HL 22 A3 71
Store Register Pair HL into the word at 71A3H, LOPT, the end of the arrays, which now stands above this one.
3C88
DEC HL 2B
Decrement Register Pair HL to the highest byte of the new array.
3C89
LD (HL),00H 36 00
Store 00H at the address in Register Pair HL, which is what makes a new numeric array read as zeros and a new string array as strings of no characters.
3C8B
Call 434DH, the sixteen bit comparison, which sets the Zero Flag when Register Pair HL has come down to the first element in Register Pair DE.
3C8E
Jump to 3C88H on NZ, there being more of the array to clear.
3C90
INC BC 03
Increment Register Pair BC, the size of the elements, which allows for the one byte the count of dimensions fills.
3C91
LD D,A 57
Load Register D from Register A, which holds 00H, 434DH having answered equal.
3C92
LD HL,(717AH) 2A 7A 71
Load Register Pair HL with the word at 717AH, the address of the count of dimensions that 3C54H kept.
3C95
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, that count, so that Register Pair DE holds it as a word.
3C96
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the count into Register Pair HL.
3C97
ADD HL,HL 29
Add Register Pair HL to itself, which doubles the count: the bound words fill two bytes each.
3C98
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, the elements and the count byte, which makes Register Pair HL the whole length the walk at 3BECH adds.
3C99
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that length into Register Pair DE and the address of the count of dimensions into Register Pair HL.
3C9A
DEC HL 2B
Decrement Register Pair HL to the high byte of the entry's length word.
3C9B
DEC HL 2B
Decrement Register Pair HL to the low byte of that length word, where the store below begins.
3C9C
LD (HL),E 73
Store Register E at the address in Register Pair HL, the low byte of that length.
3C9D
INC HL 23
Increment Register Pair HL to the high byte of the entry's length word.
3C9E
LD (HL),D 72
Store Register D at the address in Register Pair HL, the high byte of that length, which completes the entry.
3C9F
INC HL 23
Increment Register Pair HL to the count of dimensions, where the arithmetic below expects to stand.
3CA0
POP AF F1
Pop Register AF, the Carry Flag that 3C7AH pushed, which says whether this was a DIM.
3CA1
Jump to 3CD5H on C, a DIM having nothing more to do: the array exists and no element was asked for.

3CA3H - The Element's Address, and the Answer for an Array That Is Not There (3CA3H-3CDCH)

This is the arithmetic that turns the subscripts on the stack into one address, and it serves both an array just made and one found at 3C13H. The subscripts come off the stack in the reverse of the order they were written and the bounds are read in the order they were stored, which is that same reversed order, so each subscript meets its own bound; the running index is built as index times bound plus subscript, which leaves the first subscript varying fastest in memory. The entry pointer has no register to live in while this goes on, so it rides on the stack in the slot each subscript vacates: 3CADH exchanges it for the next subscript and the POP HL at 3CA8H takes it back, and 3CA7H is a LD D,0E1H whose operand byte is that POP HL, stepped over on the first turn because the first exchange has not happened yet. The last turn leaves the pointer on the stack for the POP BC at 3CD2H, standing just above the bounds, which is the first element. A subscript is refused when it reaches its bound rather than when it passes it, the stored bound being a count of elements. The multiply by the element size at 3CBFH is six instructions for all four types and uses the Parity Flag to pick out the three byte string descriptor: a type of 03H leaves 0FFH in Register A after the subtraction, whose eight set bits give even parity, and that is the one case that adds the index in a second time to make three.

3CA3
LD B,A 47
The element's address (3CA3H): load Register B from Register A, which holds 00H on both paths into this routine.
3CA4
LD C,A 4F
Load Register C from Register A, so that Register Pair BC holds 0000H, the running index before any subscript is taken.
3CA5
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the array's count of dimensions, which the loop below counts down.
3CA6
INC HL 23
Increment Register Pair HL to the first bound word.
3CA7
LD D,0E1H 16 E1
Load Register D with 0E1H, whose operand byte at 3CA8H is the POP HL the loop comes back to: the first turn steps over it, no entry pointer having been put on the stack yet. The 0E1H it leaves in Register D is written over at 3CABH.
3CA9
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of this dimension's bound, which is its count of elements.
3CAA
INC HL 23
Increment Register Pair HL to the high byte of that bound.
3CAB
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, that high byte, so that Register Pair DE holds the bound.
3CAC
INC HL 23
Increment Register Pair HL to the next bound word, or to the first element when this was the last.
3CAD
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the entry pointer on the stack in the place of the subscript and brings that subscript into Register Pair HL.
3CAE
PUSH AF F5
Push Register AF, the count of dimensions still to take, which the comparison and the multiplication below both spoil.
3CAF
Call 434DH, the sixteen bit comparison, which sets the Carry Flag when the subscript in Register Pair HL is below the bound in Register Pair DE.
3CB2
Jump to 3C24H on NC, the subscript having reached or passed the count of elements, which is Subscript out of range: the highest subscript a dimension allows is one less than the word stored for it.
3CB5
Call 2B76H of BASIC/OV1, which multiplies the running index in Register Pair BC by this bound in Register Pair DE and answers in Register Pair DE.
3CB8
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the subscript, which makes Register Pair HL the index so far.
3CB9
POP AF F1
Pop Register AF, the count of dimensions that 3CAEH pushed.
3CBA
DEC A 3D
Decrement Register A, one fewer dimension to take.
3CBB
LD B,H 44
Load Register B from Register H, the high byte of the index so far.
3CBC
LD C,L 4D
Load Register C from Register L, its low byte, so that Register Pair BC carries the index into the next turn.
3CBD
Jump to 3CA8H on NZ, there being another subscript, which pops the entry pointer back into Register Pair HL first.
3CBF
LD A,(7142H) 3A 42 71
The index times the element size (3CBFH): load Register A with the byte at 7142H, the type as a count of bytes.
3CC2
LD B,H 44
Load Register B from Register H, the high byte of the index, which is kept for the one case that adds it in again.
3CC3
LD C,L 4D
Load Register C from Register L, its low byte.
3CC4
ADD HL,HL 29
Add Register Pair HL to itself, which doubles the index: every type is at least two bytes.
3CC5
SUB 04H D6 04
Subtract 04H from Register A, the type, which sets the Carry Flag for an integer of 02H and a string of 03H and leaves 00H for a single precision value and 04H for a double.
3CC7
Jump to 3CCDH on C, the type being two or three bytes, which is as far as the doubling goes for either.
3CC9
ADD HL,HL 29
Add Register Pair HL to itself, which takes the index to four times the subscript.
3CCA
Jump to 3CD2H on Z, the type being 04H, a single precision value, which is done.
3CCC
ADD HL,HL 29
Add Register Pair HL to itself, which takes the index to eight times the subscript, the type being 08H, a double precision value.
3CCD
OR A B7
OR Register A with itself, which sets the Parity Flag from the byte the subtraction left: 0FFH for a string has even parity and 0FEH for an integer and 04H for a double have odd.
3CCE
Jump to 3CD2H on PO, the parity being odd, which is every type but the three byte string descriptor.
3CD1
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, the index once more, which makes three times the subscript: this one instruction is the whole of the three byte case.
3CD2
POP BC C1
Load Register Pair BC from the stack, the entry pointer the last exchange left there, which stands just above the bounds and so on the first element.
3CD3
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which makes Register Pair HL the address of the element asked for.
3CD4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE, where every caller of the search expects its answer.
3CD5
LD HL,(7199H) 2A 99 71
The way out (3CD5H), which a DIM reaches from 3CA1H: load Register Pair HL with the word at 7199H, the text pointer that 3BDBH kept while the stack was given over to the subscripts.
3CD8
RET C9
Return, with Register Pair DE addressing the element and Register Pair HL the text pointer standing after the closing bracket.
3CD9
SCF 37
No such array (3CD9H), which 3C44H reaches when the caller asked only whether the array exists: set the Carry Flag, which is half of the answer.
3CDA
SBC A,A 9F
Subtract Register A and the Carry Flag from Register A, which leaves Register A holding 0FFH and the Carry Flag set, the two together saying that there is no such array.
3CDB
POP HL E1
Pop Register Pair HL, the text pointer that 3BE6H pushed.
3CDC
RET C9
Return, with Register A holding 0FFH and the Carry Flag set: ERASE and CHAIN's walks read it this way.

3CDDH - The Three Name Tail Helpers (3CDDH-3D14H)

Three short routines the search and the array code lean on, and they are the reason a variable name may run to forty characters at no cost to the three bytes an entry spends on its first two. 3CDDH steps a pointer over a length prefixed tail, and 3CDFH, its second entry, steps over a count already in Register A, which is how 3D0DH skips the part of a tail it has stopped comparing. 3CE6H writes a tail into a new entry from 6ECFH, the length byte and the characters together, and keeps every register it was given. 3CFAH compares a tail against the one at 6ED0H and answers in the Zero Flag, and it leaves Register Pair HL past the whole tail whether the answer was yes or no, which is what lets both of its callers go straight on to the next entry. The 00H at 3CF9H stands between the second and the third and no instruction reaches it.

3CDD
LD A,(HL) 7E
Over a length prefixed tail (3CDDH): load Register A with the byte Register Pair HL addresses, the length of the tail.
3CDE
INC HL 23
Increment Register Pair HL to the first character of the tail.
3CDF
PUSH BC C5
The second entry (3CDFH), which 3D0DH calls with a count of its own in Register A: push Register Pair BC, which the sum below writes over.
3CE0
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC holds that count as a word.
3CE2
LD C,A 4F
Load Register C from Register A, the count of characters to step over.
3CE3
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which puts Register Pair HL past the tail.
3CE4
POP BC C1
Pop Register Pair BC, which puts back whatever the caller was keeping there, the two characters of a name among them.
3CE5
RET C9
Return, with Register Pair HL past the tail and every other register as it was.
3CE6
PUSH BC C5
Writing a tail into a new entry (3CE6H), which 3B3AH and 3C4AH call: push Register Pair BC, the two characters of the name, which this routine must give back.
3CE7
PUSH DE D5
Push Register Pair DE, which the pointer below writes over.
3CE8
PUSH AF F5
Push Register AF, which the characters below write over.
3CE9
LD DE,6ECFH 11 CF 6E
Load Register Pair DE with 6ECFH, the length of the tail, which the characters stand above.
3CEC
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, that length.
3CED
LD B,A 47
Load Register B from Register A, the length, which the count below is made from.
3CEE
INC B 04
Increment Register B, which allows for the length byte itself, so that a tail of no characters still writes its 00H.
3CEF
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, the length byte on the first turn and a character of the tail on the later ones.
3CF0
INC DE 13
Increment Register Pair DE to the next byte of the tail.
3CF1
INC HL 23
Increment Register Pair HL to the next byte of the entry.
3CF2
LD (HL),A 77
Store Register A at the address in Register Pair HL, that byte written into the entry.
3CF3
Decrement Register B and jump to 3CEFH when it is not zero, which copies the length byte and every character of the tail.
3CF5
POP AF F1
Pop Register AF, which puts back what 3CE8H kept.
3CF6
POP DE D1
Pop Register Pair DE, which puts back what 3CE7H kept.
3CF7
POP BC C1
Pop Register Pair BC, the two characters of the name back.
3CF8
RET C9
Return, with Register Pair HL standing on the last byte of the tail just written.
3CF9
DEFB 00H 00
3CF9H: one byte between the routine above and the one below that no instruction of the file reaches and nothing reads. It would decode as a NOP.
3CFA
PUSH DE D5
Comparing a tail (3CFAH), which 3B52H and 3C36H call with the length in Register A and Register Pair HL on the entry's own length byte: push Register Pair DE, which the pointer below writes over.
3CFB
PUSH BC C5
Push Register Pair BC, the two characters of the name, which the count below writes over.
3CFC
LD DE,6ED0H 11 D0 6E
Load Register Pair DE with 6ED0H, the first character of the tail of the name wanted, the length standing one byte below it.
3CFF
LD B,A 47
Load Register B from Register A, the length of the tail, which the loop below counts down.
3D00
INC HL 23
Increment Register Pair HL to the first character of this entry's tail.
3D01
INC B 04
Increment Register B, which allows for the decrement the loop makes before it compares anything.
3D02
DEC B 05
The loop (3D02H): decrement Register B, one fewer character to compare.
3D03
Jump to 3D12H on Z, every character having matched, which is the answer the Zero Flag carries back.
3D05
LD A,(DE) 1A
Load Register A with the byte at the address in Register Pair DE, this character of the name wanted, with its high bit set.
3D06
INC DE 13
Increment Register Pair DE to the next character of the name wanted.
3D07
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the entry's own character, which carries its high bit in the same way.
3D08
INC HL 23
Increment Register Pair HL to the entry's next character, which the comparison above has not touched.
3D09
Jump to 3D02H on Z, the two characters agreeing, which goes on to the next pair.
3D0B
LD A,B 78
Load Register A from Register B, the count of characters not yet compared, this one among them.
3D0C
DEC A 3D
Decrement Register A, which leaves the count of those after the one that differed.
3D0D
Call 3CDFH when Register A is not zero, which steps Register Pair HL over the rest of this entry's tail, so that the caller is left past the whole tail whether the name matched or not.
3D10
XOR A AF
Clear Register A, the first half of making the answer no.
3D11
DEC A 3D
Decrement Register A, which leaves 0FFH and clears the Zero Flag: the names differ.
3D12
POP BC C1
Pop Register Pair BC, the two characters of the name back.
3D13
POP DE D1
Pop Register Pair DE, which puts back what 3CFAH kept.
3D14
RET C9
Return, with the Zero Flag set when the tails are the same and clear when they are not, and Register Pair HL past the tail either way.

3D15H - EDIT: the Statement, the Syntax Error's Way In and the Line Put Up (3D15H-3D5CH)

The line editor, and it is the largest single routine of module 1 after the string package. Three places start it: the EDIT statement at 3D22H, which the statement address table holds for token 0A7H; DOEDIT 3D27H, which newb.asm names and which the enhancement package jumps to from 818FH when a comma is typed alone at the Ready prompt; and 3D15H, which READY calls at 5938H when the last error was a Syntax error, so that a mistyped line is offered for correction instead of merely being reported. 3D15H is entered with 00H in Register A and stores it in 6E8FH, which clears the last error number so that one Syntax error offers the editor once. It then reads the line the error was in out of 7190H and gives up on 0FFFFH, which is direct mode, so a direct statement is never put into the editor. From 3D27H on the work is the same whichever way in was taken: the line is found with FIND, its number taken out of the four bytes above the address FIND answers, its text expanded out of its tokens into INBUF by UNTOKE 7A0DH, its number written through NUMDSP 3139H with a space after it, and Register C set to the length of the text and Register B to 00H, which between them are the editor's whole idea of where it is: Register B is how far along the line the cursor stands and Register C how long the line is.

3D15
LD (6E8FH),A 32 8F 6E
The Syntax error's way in (3D15H), which READY calls at 5938H with 00H in Register A: store Register A into the byte at 6E8FH, the number of the last error, which clears it so that one Syntax error puts the line up once.
3D18
LD HL,(7190H) 2A 90 71
Load Register Pair HL from the word at 7190H, the line number the error handler copied there at 5889H, which is the line the Syntax error was found in.
3D1B
OR H B4
Or Register A with Register H, the high byte of that number, which with the instruction below makes the test for 0FFFFH.
3D1C
AND L A5
And Register A with Register L, the low byte, so that Register A is 0FFH only when both bytes are 0FFH.
3D1D
INC A 3C
Increment Register A, which sets the Zero Flag only when the line number is 0FFFFH, the value that marks direct mode everywhere in the interpreter.
3D1E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, so that Register Pair DE holds the line number, which is where the body below wants it.
3D1F
RET Z C8
Return on Z, the error having been found in a direct statement, so that nothing is put into the editor and READY goes straight on to command level at 593BH.
3D20
Jump to 3D26H, the line number being a real one, which throws the return address away and edits that line.
3D22
The EDIT statement (3D22H), which the statement address table holds for token 0A7H: call 5F9AH, NUM2DE, which reads a line number into Register Pair DE and takes a full stop to mean the line being run.
3D25
RET NZ C0
Return on NZ, something standing after the line number, which goes back to the statement loop at 5E3BH and is given Syntax error there by 5E4BH.
3D26
POP HL E1
The return address thrown away (3D26H), which 3D20H reaches: pop Register Pair HL, which takes the statement loop's own address off the stack, the editor never returning to its caller by a plain RET.
3D27
LD (7192H),DE ED 53 92 71
DOEDIT (3D27H), the name newb.asm gives it, which 3DD1H reaches and the enhancement package jumps to from 818FH: store Register Pair DE, the line number, into the word at 7192H, CURLIN, so the line being edited is the line the interpreter thinks it is running.
3D2B
Call 5AB4H, FIND, which searches the program from its first line for the line whose number stands in Register Pair DE.
3D2E
Jump to 6040H on NC, no such line being in the program, which gives error 8, Undefined line number.
3D31
LD H,B 60
Load Register H from Register B, the high byte of the address FIND answered, which is the line's own link word.
3D32
LD L,C 69
Load Register L from Register C, the low byte of it, so that Register Pair HL stands on the link word of the line found.
3D33
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of the link.
3D34
INC HL 23
Increment Register Pair HL a second time, so that it stands on the low byte of the line's own number.
3D35
LD C,(HL) 4E
Load Register C with the byte Register Pair HL stands on, the low byte of the line number.
3D36
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of the line number.
3D37
LD B,(HL) 46
Load Register B with the byte Register Pair HL stands on, the high byte of the line number.
3D38
INC HL 23
Increment Register Pair HL, so that it stands on the first byte of the line's tokenized text, four above the address FIND answered.
3D39
PUSH BC C5
Push Register Pair BC, the line number, which stays on the stack for as long as the editor runs and is what the E and the Q commands pop.
3D3A
Call 7A0DH, UNTOKE, which expands the tokenized line Register Pair HL stands on into INBUF 7039H as the characters it was typed as.
3D3D
POP HL E1
The line put up (3D3DH), which the L command jumps to from 3E10H: pop Register Pair HL, the line number, so that it can be tested and shown.
3D3E
PUSH HL E5
Push Register Pair HL, that line number, back on to the stack where the editor keeps it.
3D3F
LD A,H 7C
Load Register A from Register H, the high byte of the line number.
3D40
AND L A5
And Register A with Register L, the low byte, so that Register A is 0FFH only when the number is 0FFFFH.
3D41
INC A 3C
Increment Register A, which sets the Zero Flag only for 0FFFFH, a line that direct mode is using the number of.
3D42
LD A,21H 3E 21
Load Register A with 21H, an exclamation mark, which changes no flag, so the answer above still stands for the two conditional calls below.
3D44
Call 40D8H on Z, the number being 0FFFFH, which writes that exclamation mark in place of a line number.
3D47
Call 3139H on NZ, NUMDSP, which writes the line number in Register Pair HL as decimal digits.
3D4A
LD A,20H 3E 20
Load Register A with 20H, a space, which stands between the line number and the text.
3D4C
Call 40D8H, the character output, which writes that space.
3D4F
LD HL,7039H 21 39 70
Load Register Pair HL with 7039H, INBUF, where UNTOKE left the expanded text of the line.
3D52
PUSH HL E5
Push Register Pair HL, that address, because the length count below walks the buffer and the pointer is wanted back.
3D53
LD C,0FFH 0E FF
Load Register C with 0FFH, so that the increment at the head of the loop below makes the first count 00H.
3D55
INC C 0C
The length count (3D55H): increment Register C, the count of characters counted so far.
3D56
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the next character of the line.
3D57
INC HL 23
Increment Register Pair HL, so that it stands on the character after it.
3D58
OR A B7
Or Register A with itself, which sets the Zero Flag at the 00H that ends the buffer.
3D59
Jump to 3D55H on NZ, the line not having ended, which counts the next character.
3D5B
POP HL E1
Pop Register Pair HL, which brings the start of INBUF back, so that Register Pair HL is the cursor and Register C the length of the line.
3D5C
LD B,A 47
Load Register B from Register A, which is 00H, the cursor standing at the first character of the line.

3D5DH - EDIT: the Key and the Repeat Count (3D5DH-3D84H)

The editor's own command loop, and every subcommand returns to 3D5DH, which 3D7AH arranges by pushing that address before it dispatches. The loop reads a key through 7CDFH, which issues the keyboard supervisor call and throws away BREAK and the 03H, folds a lowercase letter to its capital through 7598H, and then gathers a run of digits into Register D as a repeat count ten at a time: the five instructions at 3D71H to 3D76H are a multiplication by ten written out, RLCA twice, ADD A,D, RLCA, which is two and four and five and ten. The count is one byte and is not checked, so a run of digits past 255 wraps round. The two instructions at 3D7FH and 3D80H make a count of nought mean one, and 3D81H and 3D84H are the usual pair, a jump past an increment, so the count is never left at nought when a command goes to work.

3D5D
LD D,00H 16 00
The command loop (3D5DH), which every subcommand returns to and 3D78H goes back to for another digit: load Register D with 00H, the repeat count, which the digits below build up.
3D5F
The key (3D5FH), which 3D63H and 3D78H both reach: call 7CDFH, which issues the keyboard supervisor call until a key is pressed and answers with it in Register A, having thrown away a BREAK and the 03H.
3D62
OR A B7
Or Register A with itself, which sets the Zero Flag when no key was read at all.
3D63
Jump to 3D5FH on Z, nothing having been read, which asks the keyboard again.
3D65
Call 7598H, which folds a lowercase letter in Register A to its capital and leaves every other character as it stands.
3D68
SUB 30H D6 30
Subtract 30H from Register A, the digit nought, which is the arithmetic every test below is made against, so that the dispatch at 3D85H reads the key less 30H and not the key.
3D6A
Jump to 3D7AH on C, the key standing below 30H, which is the dispatch, the three keys below the digits being the space, the backspace and ENTER.
3D6C
CP 0AH FE 0A
Compare Register A with 0AH, which is the ten digits, so that the Carry Flag is set for a digit and clear for everything above the nine.
3D6E
Jump to 3D7AH on NC, the key standing above 39H, which is the dispatch and where every letter command is told apart.
3D70
LD E,A 5F
A digit of the repeat count (3D70H): load Register E from Register A, the value of the digit, nought to nine.
3D71
LD A,D 7A
Load Register A from Register D, the count built up so far, which is to be multiplied by ten.
3D72
RLCA 07
Rotate Register A left circularly, which doubles the count.
3D73
RLCA 07
Rotate Register A left circularly a second time, which makes it four times the count.
3D74
ADD A,D 82
Add Register D to Register A, which makes it five times the count.
3D75
RLCA 07
Rotate Register A left circularly a third time, which makes it ten times the count.
3D76
ADD A,E 83
Add Register E to Register A, the new digit, so that Register A is the count with that digit added at its end.
3D77
LD D,A 57
Load Register D from Register A, the count as it now stands, which is one byte and is not checked for running past 255.
3D78
Jump to 3D5FH, which reads the next key and takes another digit if one is typed.
3D7A
PUSH HL E5
The dispatch set up (3D7AH), which 3D6AH and 3D6EH both reach: push Register Pair HL, the cursor, to make room on the stack for the return address below.
3D7B
LD HL,3D5DH 21 5D 3D
Load Register Pair HL with 3D5DH, the head of the command loop, which is where every subcommand is to return.
3D7E
EX (SP),HL E3
Exchange the word Register Pair HL holds with the word at the Stack Pointer, which leaves 3D5DH on the stack as the return address and brings the cursor back into Register Pair HL.
3D7F
DEC D 15
Decrement Register D, the repeat count, which with the instruction below sets the flags from it without changing it.
3D80
INC D 14
Increment Register D, which puts the count back and leaves the Zero Flag set when it was nought.
3D81
Jump to 3D85H on NZ, a count having been typed, which dispatches on the key with that count standing.
3D84
INC D 14
Increment Register D, no count having been typed, so that every command acts once where no number was given.

3D85H - EDIT: the Subcommand Dispatch (3D85H-3DD3H)

Fourteen comparisons in a row, and each is made against the key less 30H because 3D68H subtracted that before any of them was reached. So the three keys that are not letters read as 0D8H for the backspace 08H, 0DDH for ENTER 0DH and 0F0H for the space 20H, and the eleven letters read as their capital less 30H: A is 11H, C 13H, D 14H, E 15H, H 18H, I 19H, K 1BH, L 1CH, Q 21H, S 23H and X 28H. The fold at 3D93H to 3D98H can never do anything. It takes 20H off any value of 31H or more, which is the lowercase fold, but 7598H has already folded the case above, so the only keys that reach it are 7BH and higher, and none of those names a command either before the subtraction or after it. A 3DCCH is the odd one out: it writes a carriage return, throws the loop's return address away, takes the line number back off the stack and jumps to DOEDIT 3D27H, so the line is fetched out of the program again and every change made since the edit began is lost, which is exactly what A is for. Anything the ladder does not recognise falls out at the RET NZ at 3DCBH and goes back to the command loop, so an unknown key is ignored without a complaint.

3D85
CP 0D8H FE D8
The dispatch (3D85H), which 3D81H reaches: compare Register A with 0D8H, which is the backspace 08H less 30H.
3D87
Jump to 3EEAH on Z, the backspace having been typed, which moves the cursor back over as many characters as the repeat count asked for.
3D8A
CP 0DDH FE DD
Compare Register A with 0DDH, which is ENTER 0DH less 30H.
3D8C
Jump to 3EF8H on Z, ENTER having been typed, which writes the rest of the line out and then finishes the edit.
3D8F
CP 0F0H FE F0
Compare Register A with 0F0H, which is the space 20H less 30H.
3D91
Jump to 3DD4H on Z, a space having been typed, which moves the cursor forward over as many characters as the count asked for, echoing each.
3D93
CP 31H FE 31
Compare Register A with 31H, which is 61H less 30H, the lowest value the fold below could act on.
3D95
Jump to 3D99H on C, the value standing below 31H, which is every key that names a command and so every key the fold would have been for.
3D97
SUB 20H D6 20
Subtract 20H from Register A, the lowercase fold, which 7598H has already made unnecessary and which no key naming a command ever reaches.
3D99
CP 21H FE 21
The letters (3D99H), which 3D95H reaches: compare Register A with 21H, which is Q less 30H.
3D9B
Jump to 3F0DH on Z, Q having been typed, which leaves the edit with the program line exactly as it was.
3D9E
CP 1CH FE 1C
Compare Register A with 1CH, which is L less 30H.
3DA0
Jump to 3E09H on Z, L having been typed, which lists the rest of the line and starts the edit over.
3DA3
CP 23H FE 23
Compare Register A with 23H, which is S less 30H, and leaves the Carry Flag clear on a match.
3DA5
Jump to 3DE6H on Z, S having been typed, which searches forward for a character with the Carry Flag clear so that nothing is deleted.
3DA7
CP 19H FE 19
Compare Register A with 19H, which is I less 30H.
3DA9
Jump to 3E6FH on Z, I having been typed, which is the insert loop.
3DAC
CP 14H FE 14
Compare Register A with 14H, which is D less 30H.
3DAE
Jump to 3E13H on Z, D having been typed, which deletes as many characters as the count asked for.
3DB1
CP 13H FE 13
Compare Register A with 13H, which is C less 30H.
3DB3
Jump to 3E2EH on Z, C having been typed, which changes as many characters as the count asked for.
3DB6
CP 15H FE 15
Compare Register A with 15H, which is E less 30H.
3DB8
Jump to 3EFBH on Z, E having been typed, which ends the edit and puts the line back into the program without showing the rest of it.
3DBB
CP 28H FE 28
Compare Register A with 28H, which is X less 30H.
3DBD
Jump to 3E6AH on Z, X having been typed, which moves the cursor to the end of the line and then inserts.
3DC0
CP 1BH FE 1B
Compare Register A with 1BH, which is K less 30H.
3DC2
Jump to 3DE0H on Z, K having been typed, which deletes forward to a character with the Carry Flag set.
3DC4
CP 18H FE 18
Compare Register A with 18H, which is H less 30H.
3DC6
Jump to 3E67H on Z, H having been typed, which cuts the line off at the cursor and then inserts.
3DC9
CP 11H FE 11
Compare Register A with 11H, which is A less 30H.
3DCB
RET NZ C0
Return on NZ, the key naming no command at all, which goes back to the command loop at 3D5DH and asks for another without complaining.
3DCC
A, the edit begun again (3DCCH): call 41F5H, which writes a carriage return so that the line is put up on a line of its own.
3DCF
POP BC C1
Pop Register Pair BC, which throws away the 3D5DH the dispatch pushed, this command not returning to the command loop.
3DD0
POP DE D1
Pop Register Pair DE, the line number the editor has kept on the stack since 3D39H.
3DD1
Jump to 3D27H, DOEDIT, which finds that line in the program again and expands it into INBUF afresh, so every change made since the edit began is thrown away.

3DD4H - EDIT: the Space, K and S (3DD4H-3E08H)

3DD4H is the space, which moves the cursor forward over as many characters as the repeat count asked for and echoes each one so the user sees what is being passed over, and it is also what X calls at 3E6CH with a count of 255 to reach the end of the line. 3DE6H is S and 3DE0H is K, and they are one routine told apart by the Carry Flag alone: K sets it at 3DE5H and S arrives with it clear from the CP 23H that matched at 3DA3H, and the three conditional calls at 3DEDH, 3DF9H and the conditional jump at 3DFCH are everything the two commands differ by. S walks forward to the count-th occurrence of a character read from the keyboard; K walks forward the same way and deletes every character it passes, which is why 3DE0H pushes 3E28H as its return address: 3E28H writes the closing backslash that marks where a deletion ended, the opening one having been written by the conditional call at 3DEDH. Neither command passes the 00H that ends the line.

3DD4
LD A,(HL) 7E
The space (3DD4H), which 3D91H reaches and X calls at 3E6CH: load Register A with the byte Register Pair HL stands on, the character the cursor is on.
3DD5
OR A B7
Or Register A with itself, which sets the Zero Flag at the 00H that ends the line.
3DD6
RET Z C8
Return on Z, the cursor having reached the end of the line, so that nothing runs past the text.
3DD7
INC B 04
Increment Register B, the cursor's distance along the line, which the insert code reads to work out how much of the line stands to its right.
3DD8
Call 4212H, which writes the character in Register A, turning a line feed into a carriage return on the way.
3DDB
INC HL 23
Increment Register Pair HL, the cursor, so that it stands on the next character of the line.
3DDC
DEC D 15
Decrement Register D, the repeat count, one character having been passed over.
3DDD
Jump to 3DD4H on NZ, the count not being used up, which passes over the next character as well.
3DDF
RET C9
Return to the command loop at 3D5DH with the cursor as many characters further along as the count asked for.
3DE0
PUSH HL E5
K, delete forward to a character (3DE0H), which 3DC2H reaches: push Register Pair HL, the cursor, to make room on the stack for the return address below.
3DE1
LD HL,3E28H 21 28 3E
Load Register Pair HL with 3E28H, the closing backslash, which is where this command is to return when the search ends.
3DE4
EX (SP),HL E3
Exchange the word Register Pair HL holds with the word at the Stack Pointer, which leaves 3E28H on the stack and brings the cursor back into Register Pair HL.
3DE5
SCF 37
Set the Carry Flag, which is the one thing that tells this command from S all the way through the body below.
3DE6
PUSH AF F5
S, search forward for a character (3DE6H), which 3DA5H reaches with the Carry Flag clear: push Register Pair AF, whose Carry Flag says whether the characters passed over are to be deleted.
3DE7
Call 7CDFH, which reads the character to search for from the keyboard.
3DEA
LD E,A 5F
Load Register E from Register A, that character, which the comparison at 3E01H is made against.
3DEB
POP AF F1
Pop Register Pair AF, which brings the Carry Flag back.
3DEC
PUSH AF F5
Push Register Pair AF, that Carry Flag, back on to the stack, where every turn of the loop below reads it again.
3DED
Call 3E28H on C, this being K, which writes a backslash to mark where the deletion begins.
3DF0
LD A,(HL) 7E
The loop (3DF0H), which 3E02H and 3E05H both reach: load Register A with the byte Register Pair HL stands on, the character under the cursor.
3DF1
OR A B7
Or Register A with itself, which sets the Zero Flag at the 00H that ends the line.
3DF2
Jump to 3E07H on Z, the line having ended, which gives up with the search unfinished.
3DF4
Call 4212H, which writes that character, so the user sees what is being passed over or deleted.
3DF7
POP AF F1
Pop Register Pair AF, which brings the Carry Flag back.
3DF8
PUSH AF F5
Push Register Pair AF, that Carry Flag, back on to the stack for the next turn.
3DF9
Call 3EA3H on C, this being K, which deletes the character under the cursor and brings the rest of the line down one over it.
3DFC
Jump to 3E00H on C, this being K, so that the cursor is not stepped, the deletion having brought the next character under it already.
3DFE
INC HL 23
Increment Register Pair HL, the cursor, this being S, so that it stands on the next character.
3DFF
INC B 04
Increment Register B, the cursor's distance along the line, which S moves and K does not.
3E00
LD A,(HL) 7E
The character tested (3E00H), which 3DFCH reaches: load Register A with the byte Register Pair HL stands on, the character the cursor now stands on.
3E01
CP E BB
Compare Register A with Register E, the character that was searched for, which sets the Zero Flag on a match.
3E02
Jump to 3DF0H on NZ, this not being the character, which passes over it as well.
3E04
DEC D 15
Decrement Register D, the repeat count, one occurrence having been found.
3E05
Jump to 3DF0H on NZ, more occurrences being wanted, which goes on past this one.
3E07
POP AF F1
The end (3E07H), which 3DF2H reaches: pop Register Pair AF, which takes the Carry Flag off the stack.
3E08
RET C9
Return, to 3E28H for K, which writes the closing backslash, and to the command loop at 3D5DH for S.

3E09H - EDIT: L and D (3E09H-3E2DH)

L lists the rest of the line and starts the edit again, which is why it pops the command loop's return address and jumps to 3D3DH rather than returning: the whole line is put up afresh, number and all, with the cursor back at its first character. D deletes as many characters as the repeat count asked for and shows what it took out between a pair of backslashes, 3E16H writing the opening one and 3E28H the closing one. 3E28H is the two instruction routine that writes a backslash, and both K at 3DEDH and D reach it; D also falls into it when the line ends before the count is used up, which is what the jump at 3E1DH is for.

3E09
L, list the rest of the line (3E09H), which 3DA0H reaches: call 7A04H, which writes every character from the cursor to the 00H that ends the line through 4212H.
3E0C
Call 41F5H, which writes a carriage return so that the line put up below begins on a line of its own.
3E0F
POP BC C1
Pop Register Pair BC, which throws away the 3D5DH the dispatch pushed, this command going back to the top of the editor instead.
3E10
Jump to 3D3DH, which pops the line number, writes it with the text out of INBUF after it, and leaves the cursor at the first character again.
3E13
LD A,(HL) 7E
D, delete forward (3E13H), which 3DAEH reaches: load Register A with the byte Register Pair HL stands on, the character under the cursor.
3E14
OR A B7
Or Register A with itself, which sets the Zero Flag at the 00H that ends the line.
3E15
RET Z C8
Return on Z, there being nothing left to delete, which goes back to the command loop at 3D5DH.
3E16
LD A,5CH 3E 5C
Load Register A with 5CH, a backslash, which marks where the deletion begins.
3E18
Call 4212H, which writes that backslash, so the deletion is marked on the display before any character goes.
3E1B
LD A,(HL) 7E
The loop (3E1BH), which 3E26H reaches: load Register A with the byte Register Pair HL stands on, the character to be deleted.
3E1C
OR A B7
Or Register A with itself, which sets the Zero Flag at the 00H that ends the line.
3E1D
Jump to 3E28H on Z, the line having ended before the count was used up, which writes the closing backslash and stops.
3E1F
Call 4212H, which writes the character being deleted, so the user sees what is going.
3E22
Call 3EA3H, which takes that character out of the line and brings everything above it down one byte, taking one off Register C as it goes.
3E25
DEC D 15
Decrement Register D, the repeat count, one character having been deleted.
3E26
Jump to 3E1BH on NZ, the count not being used up, which deletes the next character as well.
3E28
LD A,5CH 3E 5C
The backslash (3E28H), which 3DEDH and 3E1DH reach and 3DE1H pushed as K's return address: load Register A with 5CH, a backslash.
3E2A
Call 40D8H, the character output, which writes that backslash.
3E2D
RET C9
Return to whichever of the two deleting commands asked for it, the command loop being reached from there.

3E2EH - EDIT: C (3E2EH-3E66H)

C changes as many characters as the repeat count asked for, taking one key for each and writing it over the character under the cursor. What it will take is narrower than what the insert loop takes: anything from 20H up, and the three control codes 07H, 09H and 0AH, and nothing else, with a 07H written to the display for every other key, which is a bell. The tab at 09H is the one that does more than store a character: it is stored as a space and then the line is filled with inserted spaces to the next tab stop through 3EB8H, so a tab typed into the middle of a line pushes the rest of it along. Register Pair DE is pushed around that call because 3EB8H works through the insert code, which uses Register Pair DE, and the repeat count in Register D has to survive.

3E2E
LD A,(HL) 7E
C, change characters (3E2EH), which 3DB3H reaches and 3E52H goes back to: load Register A with the byte Register Pair HL stands on, the character under the cursor.
3E2F
OR A B7
Or Register A with itself, which sets the Zero Flag at the 00H that ends the line.
3E30
RET Z C8
Return on Z, there being nothing left to change, which goes back to the command loop at 3D5DH.
3E31
The key (3E31H), which 3E49H goes back to: call 7CDFH, which reads the character that is to replace the one under the cursor.
3E34
CP 20H FE 20
Compare Register A with 20H, the lowest printable character.
3E36
Jump to 3E4BH on NC, the key being printable, which stores it over the character under the cursor.
3E38
CP 0AH FE 0A
Compare Register A with 0AH, the line feed, which this command allows into a line.
3E3A
Jump to 3E4BH on Z, a line feed having been typed, which is stored as it stands.
3E3C
CP 07H FE 07
Compare Register A with 07H, the bell, which this command also allows into a line.
3E3E
Jump to 3E4BH on Z, a bell having been typed, which is stored as it stands.
3E40
CP 09H FE 09
Compare Register A with 09H, the tab, which is the one key that lengthens the line.
3E42
Jump to 3E55H on Z, a tab having been typed, which stores a space and then fills to the next tab stop.
3E44
LD A,07H 3E 07
Load Register A with 07H, the bell, every other control code being refused.
3E46
Call 40D8H, the character output, which sounds that bell at the display.
3E49
Jump to 3E31H, which asks the keyboard again for a character this command will take.
3E4B
LD (HL),A 77
The character stored (3E4BH), which 3E36H, 3E3AH and 3E3EH all reach: store Register A into the byte Register Pair HL stands on, over the character that was there.
3E4C
Call 4212H, which writes the new character, so the line on the display matches the line in the buffer.
3E4F
INC HL 23
Increment Register Pair HL, the cursor, so that it stands on the next character of the line.
3E50
INC B 04
Increment Register B, the cursor's distance along the line.
3E51
DEC D 15
The count (3E51H), which 3E65H reaches: decrement Register D, the repeat count, one character having been changed.
3E52
Jump to 3E2EH on NZ, the count not being used up, which takes another key and changes the next character.
3E54
RET C9
Return to the command loop at 3D5DH with as many characters changed as the count asked for.
3E55
LD A,20H 3E 20
A tab (3E55H), which 3E42H reaches: load Register A with 20H, a space, which is what a tab is stored as.
3E57
LD (HL),A 77
Store Register A into the byte Register Pair HL stands on, over the character that was there.
3E58
Call 4212H, which writes that space, so the display shows the tab as the one character the line now holds.
3E5B
INC HL 23
Increment Register Pair HL, the cursor, so that it stands on the next character.
3E5C
INC B 04
Increment Register B, the cursor's distance along the line.
3E5D
LD A,B 78
Load Register A from Register B, that distance, which says whether the cursor stands on a tab stop.
3E5E
AND 07H E6 07
And Register A with 07H, which leaves nought only when the distance is a multiple of eight, the tab stops being every eight characters.
3E60
PUSH DE D5
Push Register Pair DE, the repeat count in Register D, because the insert code below works in Register Pair DE.
3E61
Call 3EB8H on NZ, the cursor not standing on a tab stop, which inserts spaces into the line until it does.
3E64
POP DE D1
Pop Register Pair DE, which brings the repeat count back into Register D.
3E65
Jump to 3E51H, which counts the tab as one change and takes another key if the count asks for one.

3E67H - EDIT: H, X and the Insert Loop (3E67H-3EE9H)

The insert loop at 3E6FH is where the editor spends most of its time, and H and X are two ways into it. H cuts the line off at the cursor, which is one instruction, 3E67H storing the 00H that ends a line and 3E69H making the length equal the cursor's distance along it. X walks to the end of the line first, by calling the space command at 3DD4H with a count of 255. The loop itself takes a key and acts on it: the backspace deletes the character to the left of the cursor, ENTER finishes the edit at 3EF8H, 1BH leaves insert mode and goes back to the command loop, the tab inserts spaces to the next tab stop, and 07H, 0AH and anything from 20H up are inserted where the cursor stands. Everything else is thrown away. The comparison at 3E76H repeats the one at 3E72H, so the jump at 3E78H can never be taken and 3E96H is reached only by falling into it from 3E94H: four bytes that do nothing, and what second key was meant to delete a character cannot be told from the bytes. 3EC9H is the insertion itself, and it is the only place in the editor that can refuse: a line of 0F9H characters or more is full, and 3ED0H answers with the Carry Flag set, which is also where the backspace goes when the cursor is already at the start of the line. 3EA3H is the deletion, and it ends by jumping to 27DBH in BASIC/OV1, which is a POP HL and a RET, so the editor is one more part of module 1 that cannot run with the arithmetic overlay out of memory.

3E67
LD (HL),00H 36 00
H, cut the line off here (3E67H), which 3DC6H reaches: store 00H into the byte Register Pair HL stands on, which ends the line at the cursor and throws away everything above it.
3E69
LD C,B 48
Load Register C from Register B, so that the length of the line becomes the cursor's own distance along it, which is what the cut has made it.
3E6A
LD D,0FFH 16 FF
X, insert at the end of the line (3E6AH), which 3DBDH reaches: load Register D with 0FFH, a repeat count of 255, which is more characters than a line can hold.
3E6C
Call 3DD4H, the space command, which walks the cursor forward to the 00H that ends the line, echoing every character on the way.
3E6F
The insert loop (3E6FH), which 3DA9H reaches for I and 3E90H, 3EB5H and 3EC7H all go back to: call 7CDFH, which reads the next key from the keyboard.
3E72
CP 08H FE 08
Compare Register A with 08H, the backspace, which deletes the character to the left of the cursor.
3E74
Jump to 3E94H on Z, a backspace having been typed, which writes it and deletes that character.
3E76
CP 08H FE 08
Compare Register A with 08H a second time, which is the same test as the one above and so can never be true.
3E78
Jump to 3E96H on Z, which is never taken, 3E96H being reached only by falling into it from 3E94H.
3E7A
CP 0DH FE 0D
Compare Register A with 0DH, ENTER, which ends the whole edit.
3E7C
Jump to 3EF8H on Z, ENTER having been typed, which writes the rest of the line out and puts it back into the program.
3E7F
CP 1BH FE 1B
Compare Register A with 1BH, which is the key that leaves insert mode.
3E81
RET Z C8
Return on Z, that key having been typed, which goes back to the command loop at 3D5DH with the line as the insertions have left it.
3E82
CP 0AH FE 0A
Compare Register A with 0AH, the line feed, which this loop allows into a line.
3E84
Jump to 3EC4H on Z, a line feed having been typed, which inserts it where the cursor stands.
3E86
CP 07H FE 07
Compare Register A with 07H, the bell, which this loop also allows into a line.
3E88
Jump to 3EC4H on Z, a bell having been typed, which inserts it where the cursor stands.
3E8A
CP 09H FE 09
Compare Register A with 09H, the tab, which is inserted as spaces to the next tab stop.
3E8C
Jump to 3EB2H on Z, a tab having been typed, which inserts those spaces.
3E8E
CP 20H FE 20
Compare Register A with 20H, the lowest printable character.
3E90
Jump to 3E6FH on C, the key being any other control code, which throws it away and reads the keyboard again.
3E92
Jump to 3EC4H, the key being printable, which inserts it where the cursor stands.
3E94
LD A,08H 3E 08
The backspace (3E94H), which 3E74H reaches: load Register A with 08H, the backspace itself, which is written to take the display's cursor back one place.
3E96
DEC B 05
The character to the left deleted (3E96H), which only the fall through from 3E94H reaches: decrement Register B, the cursor's distance along the line, which with the instruction below sets the flags from it.
3E97
INC B 04
Increment Register B, which puts that distance back and leaves the Zero Flag set when the cursor stands at the start of the line.
3E98
Jump to 3ED0H on Z, the cursor being at the start of the line, which returns with the Carry Flag set and nothing deleted.
3E9A
Call 4212H, which writes the character in Register A, the backspace, so the display's cursor moves back with the editor's.
3E9D
DEC HL 2B
Decrement Register Pair HL, the cursor, so that it stands on the character that is to go.
3E9E
DEC B 05
Decrement Register B, the cursor's distance along the line, which the deletion below makes one shorter.
3E9F
LD DE,3E6FH 11 6F 3E
Load Register Pair DE with 3E6FH, the head of the insert loop, which is where the deletion is to return.
3EA2
PUSH DE D5
Push Register Pair DE, that address, so that the deletion below returns into the insert loop and not into the command loop.
3EA3
PUSH HL E5
The deletion (3EA3H), which K calls at 3DF9H and D at 3E22H: push Register Pair HL, the cursor, which the walk below moves and every caller wants back.
3EA4
DEC C 0D
Decrement Register C, the length of the line, which is one shorter for the character about to go.
3EA5
LD A,(HL) 7E
The walk (3EA5H), which 3EB0H goes back to: load Register A with the byte Register Pair HL stands on, the next character of the line.
3EA6
OR A B7
Or Register A with itself, which sets the Zero Flag at the 00H that ends the line.
3EA7
SCF 37
Set the Carry Flag, which is the answer the insert code reads as a refusal and which this routine leaves set whichever way it ends.
3EA8
Jump to 27DBH of BASIC/OV1 on Z, the line having ended, which is a POP HL and a RET, so the cursor is brought back and the caller returned to.
3EAB
INC HL 23
Increment Register Pair HL, so that it stands on the character above the one being written over.
3EAC
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, that character.
3EAD
DEC HL 2B
Decrement Register Pair HL, so that it stands on the byte below it again.
3EAE
LD (HL),A 77
Store Register A into the byte Register Pair HL stands on, which brings the character down one place over the one that is going.
3EAF
INC HL 23
Increment Register Pair HL, so that it stands on the next pair to be moved.
3EB0
Jump to 3EA5H, which brings the next character down and goes on until the 00H is reached.
3EB2
A tab inserted (3EB2H), which 3E8CH reaches: call 3EB8H, which inserts spaces into the line until the cursor stands on a tab stop.
3EB5
Jump to 3E6FH, the head of the insert loop, which reads the next key.
3EB8
LD A,20H 3E 20
The spaces to the next tab stop (3EB8H), which 3EB2H, 3E61H and 3EC1H call: load Register A with 20H, a space.
3EBA
Call 3EC9H, which inserts that space where the cursor stands and brings the rest of the line up one byte.
3EBD
RET C D8
Return on C, the line being full, which stops the filling with as many spaces in as would go.
3EBE
LD A,B 78
Load Register A from Register B, the cursor's distance along the line as the insertion left it.
3EBF
AND 07H E6 07
And Register A with 07H, which leaves nought only when that distance is a multiple of eight.
3EC1
Jump to 3EB8H on NZ, the cursor not yet standing on a tab stop, which inserts another space.
3EC3
RET C9
Return with the cursor standing on a tab stop and the Carry Flag clear.
3EC4
A character inserted (3EC4H), which 3E84H, 3E88H and 3E92H all reach: call 3EC9H, which puts the character in Register A into the line where the cursor stands.
3EC7
Jump to 3E6FH, the head of the insert loop, which reads the next key, a full line having been passed over without a word.
3EC9
PUSH AF F5
The insertion (3EC9H), which 3EBAH and 3EC4H call: push Register Pair AF, the character to go in, because the arithmetic below writes Register A.
3ECA
LD A,C 79
Load Register A from Register C, the length of the line.
3ECB
CP 0F9H FE F9
Compare Register A with 0F9H, 249, which is the longest line the editor will make.
3ECD
Jump to 3ED2H on C, there being room, which is the insertion proper.
3ECF
POP AF F1
Pop Register Pair AF, the character, which is thrown away with the line full.
3ED0
SCF 37
The refusal (3ED0H), which 3E98H also reaches: set the Carry Flag, which is the answer 3EBDH reads as a refusal and which the insert loop throws away.
3ED1
RET C9
Return with the Carry Flag set and the line exactly as it was.
3ED2
SUB B 90
The room made (3ED2H): subtract Register B from Register A, which leaves the number of characters standing between the cursor and the end of the line.
3ED3
INC C 0C
Increment Register C, the length of the line, which is one longer for the character going in.
3ED4
INC B 04
Increment Register B, the cursor's distance along the line, which the insertion moves on by one.
3ED5
PUSH BC C5
Push Register Pair BC, those two counts, because the move below works in Register Pair BC.
3ED6
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the cursor into Register Pair DE, where the move reads it as the lowest byte to be shifted.
3ED7
LD L,A 6F
Load Register L from Register A, the number of characters above the cursor.
3ED8
LD H,00H 26 00
Load Register H with 00H, so that Register Pair HL is that count and nothing above it.
3EDA
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which makes Register Pair HL the last byte of the line, the cursor plus the count of characters above it.
3EDB
LD B,H 44
Load Register B from Register H, the high byte of that address.
3EDC
LD C,L 4D
Load Register C from Register L, the low byte of it, so that Register Pair BC is the highest byte of the run to be moved.
3EDD
INC HL 23
Increment Register Pair HL, so that Register Pair HL is one byte higher, which is where that highest byte is to go.
3EDE
Call 423AH, which copies the run from the cursor to the end of the line up one byte, working downwards so that the overlap cannot spoil it, and leaves Register Pair HL standing on the cursor.
3EE1
POP BC C1
Pop Register Pair BC, which brings the two counts back as the increments above left them.
3EE2
POP AF F1
Pop Register Pair AF, which brings the character to be inserted back into Register A.
3EE3
LD (HL),A 77
Store Register A into the byte Register Pair HL stands on, the cursor, the byte the move has just emptied.
3EE4
Call 4212H, which writes that character, so the display shows what has gone in.
3EE7
INC HL 23
Increment Register Pair HL, the cursor, so that it stands past the character just inserted.
3EE8
OR A B7
Or Register A with itself, which clears the Carry Flag, the answer that says the insertion was made.
3EE9
RET C9
Return with the Carry Flag clear, the character in the line and the cursor standing after it.

3EEAH - EDIT: the Backspace, ENTER, E, Q and the Line Entered (3EEAH-3F17H)

The four ways out and the backspace that is not one of them. 3EEAH is the backspace at the command loop, which walks the cursor back over as many characters as the count asked for without changing the line, and it is the only command that writes a backspace to the display for each one. The three that end the edit all pop the line number the editor has kept on the stack since 3D39H and all make the same test on it: 0FFFFH means the number belongs to direct mode and there is no program line to put the text back into. ENTER at 3EF8H writes the rest of the line out first and then falls into E. E at 3EFBH enters the line, and the way it does it is worth seeing: it does not write the line into the program itself but hands INBUF to the ordinary line entry at 3F03H, the same code READY jumps to from 598DH when a line has been typed, so an edited line goes into the program by exactly the path a typed one does, tokenizer and all. Q at 3F0DH throws the edit away, clearing the buffer through 41F0H when the number was 0FFFFH and going to READY otherwise, so the program line stands as it was.

3EEA
LD A,B 78
The backspace at the command loop (3EEAH), which 3D87H reaches: load Register A from Register B, the cursor's distance along the line.
3EEB
OR A B7
Or Register A with itself, which sets the Zero Flag when the cursor stands at the start of the line.
3EEC
RET Z C8
Return on Z, the cursor being at the start, so that nothing runs back past the first character.
3EED
DEC HL 2B
Decrement Register Pair HL, the cursor, so that it stands on the character before it.
3EEE
LD A,08H 3E 08
Load Register A with 08H, the backspace, which takes the display's cursor back one place.
3EF0
Call 4212H, which writes that backspace, so the display's cursor moves back with the editor's own.
3EF3
DEC B 05
Decrement Register B, the cursor's distance along the line, which is one less.
3EF4
DEC D 15
Decrement Register D, the repeat count, one character having been passed back over.
3EF5
Jump to 3EEAH on NZ, the count not being used up, which goes back over the next character.
3EF7
RET C9
Return to the command loop at 3D5DH with the cursor as far back as the count asked for.
3EF8
ENTER (3EF8H), which 3D8CH and 3E7CH reach: call 7A04H, which writes every character from the cursor to the 00H that ends the line, so the whole line is seen before it is entered.
3EFB
E, end the edit (3EFBH), which 3DB8H reaches and ENTER falls into: call 41F5H, which writes a carriage return so that what follows begins on a line of its own.
3EFE
POP BC C1
Pop Register Pair BC, which throws away the 3D5DH the dispatch pushed, this command not going back to the command loop.
3EFF
POP DE D1
Pop Register Pair DE, the line number the editor has kept on the stack since 3D39H.
3F00
LD A,D 7A
Load Register A from Register D, the high byte of that line number.
3F01
AND E A3
And Register A with Register E, the low byte, so that Register A is 0FFH only when the number is 0FFFFH.
3F02
INC A 3C
Increment Register A, which sets the Zero Flag only for 0FFFFH, the number direct mode uses.
3F03
LD HL,7038H 21 38 70
The line entered (3F03H), which READY jumps to from 598DH when a line has been typed: load Register Pair HL with 7038H, the byte below INBUF 7039H, which is where the line entry wants the pointer to start.
3F06
RET Z C8
Return on Z, the number being 0FFFFH, so that a line direct mode owns is not written into the program; the Zero Flag is always clear when 598DH jumps here, 598BH having taken the other path.
3F07
SCF 37
Set the Carry Flag, which is the flag the line entry reads at 59C7H as meaning that the line begins with a line number and is to be written into the program rather than run at once: NXTCHAR sets it at 59A9H for a typed line and the editor always hands back a numbered one, so it is forced here.
3F08
PUSH AF F5
Push Register Pair AF, that Carry Flag, which 59C3H pops after the line has been parsed.
3F09
INC HL 23
Increment Register Pair HL, so that Register Pair HL stands on the first character of INBUF 7039H.
3F0A
Jump to 59BEH, which pushes Register Pair DE and falls into the enhancement package's line parse at 59BFH, so the line is tokenized and put into the program exactly as a typed one is.
3F0D
POP BC C1
Q, throw the edit away (3F0DH), which 3D9BH reaches: pop Register Pair BC, which throws away the 3D5DH the dispatch pushed.
3F0E
POP DE D1
Pop Register Pair DE, the line number the editor has kept on the stack since 3D39H.
3F0F
LD A,D 7A
Load Register A from Register D, the high byte of that number.
3F10
AND E A3
And Register A with Register E, the low byte, so that Register A is 0FFH only when the number is 0FFFFH.
3F11
INC A 3C
Increment Register A, which sets the Zero Flag only for 0FFFFH.
3F12
Jump to 41F0H on Z, the number belonging to direct mode, which ends the buffer where the cursor stands, points at an empty one and writes a carriage return.
3F15
Jump to 5920H, READY, which writes the prompt and reads another line, the program line standing exactly as it was before the edit.

3F18H - PRINT USING: the Format String and the Next Field (3F18H-3F62H)

PRINT USING is 438 bytes and the only statement of module 1 that reads a little language of its own. PRINT reaches it at 3F18H when it meets the USING token 0DAH, and the first four instructions are the whole of its preamble: the format expression is worked out by the evaluator, 2AB0H of BASIC/OV1 insists that what came back is a string and gives error 13, Type mismatch, if it is not, 4353H demands the semicolon after it, and the string's descriptor address is taken out of the accumulator at 72ECH. From there the statement is a loop over two things at once, the format string and the list of items, and three words live on the stack for the whole of it: the descriptor address, a flag word whose Zero Flag says the item list has ended and whose Carry Flag says a carriage return is owed at the end, and the text pointer. 3F28H is where each item after the first comes back in, and it reads the separator the item before it ended with out of 7183H, the same byte INPUT and READ use for their own flag; 3F32H clears it again, so a re-entry with nothing there gives Illegal function call. An empty format string is refused at the same place, which is what the INC B and DEC B at 3F39H are for. 3F45H is the backslash field, which counts the spaces between a pair of backslashes into Register C as a width, and 3F5DH is where any character the format does not recognise is written out as it stands.

3F18
PRINT USING (3F18H), which PRINT jumps to from 6229H on the USING token: call 7346H, which loads Register D with 00H and falls into the evaluator at 7348H, so the format expression is worked out into the accumulator.
3F1B
Call 2AB0H of BASIC/OV1, which tests the type at 7142H and gives error 13, Type mismatch, through 5884H unless what was worked out is a string.
3F1E
Call 4353H, which compares the character of the line with the byte written after the call and gives Syntax error at 4362H when they differ.
3F21
DEFB 3BH 3B
The semicolon 4353H demands between the format string and the first item, which is data and not an instruction: a decoder reading straight through shows it as INC L.
3F22
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer standing after that semicolon into Register Pair DE.
3F23
LD HL,(72ECH) 2A EC 72
Load Register Pair HL from the word at 72ECH, the accumulator, which for a string holds the address of its three byte descriptor.
3F26
Jump to 3F30H, the body, which pushes the three words the statement keeps on the stack and reads the first field out of the format.
3F28
LD A,(7183H) 3A 83 71
The next item (3F28H), which 4075H jumps to when the format string has been used up and there are items left: load Register A with the byte at 7183H, the separator the item before this one ended with.
3F2B
OR A B7
Or Register A with itself, which sets the Zero Flag when no separator was recorded.
3F2C
Jump to 3F3BH on Z, which is a JP Z to Illegal function call and so refuses a re-entry with nothing in 7183H.
3F2E
POP DE D1
Pop Register Pair DE, the descriptor address of the format string, which 4058H left on the stack.
3F2F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that descriptor address into Register Pair HL and the text pointer into Register Pair DE.
3F30
PUSH HL E5
The body (3F30H), which 3F26H reaches for the first item: push Register Pair HL, the descriptor address, which stays on the stack for the whole of the statement and which 4057H and 407BH read.
3F31
XOR A AF
Exclusive or Register A with itself, which makes it 00H and clears the Carry Flag.
3F32
LD (7183H),A 32 83 71
Store Register A, 00H, into the byte at 7183H, which clears the separator so that a second re-entry without one cannot be made.
3F35
INC A 3C
Increment Register A, which makes it 01H, so the flag word pushed below carries a reset Zero Flag and a clear Carry Flag.
3F36
PUSH AF F5
Push Register Pair AF, the flag word, whose Zero Flag 4022H and 409CH read as the end of the item list and whose Carry Flag 4078H reads as a carriage return being owed.
3F37
PUSH DE D5
Push Register Pair DE, the text pointer, the third of the three words the statement keeps on the stack.
3F38
LD B,(HL) 46
Load Register B with the byte Register Pair HL stands on, the length of the format string, which is the count of format characters left to read.
3F39
INC B 04
Increment Register B, which with the instruction below sets the flags from that length without changing it.
3F3A
DEC B 05
Decrement Register B, which puts the length back and sets the Zero Flag when the format string is empty.
3F3B
The refusal (3F3BH), which 3F2CH also reaches: jump to 5F95H on Z, FUNCERR, which gives error 5, Illegal function call, for an empty format string or a re-entry with no separator.
3F3E
INC HL 23
Increment Register Pair HL, so that it stands on the low byte of the descriptor's text address.
3F3F
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, that low byte.
3F40
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of the text address.
3F41
LD H,(HL) 66
Load Register H with the byte Register Pair HL stands on, that high byte.
3F42
LD L,A 6F
Load Register L from Register A, so that Register Pair HL stands on the first character of the format string.
3F43
Jump to 3F63H, the field reader, which takes the first field out of the format.
3F45
LD E,B 58
The backslash field (3F45H), which 3F92H reaches: load Register E from Register B, the count of format characters left, which is put aside in case this is not a field at all.
3F46
PUSH HL E5
Push Register Pair HL, the format pointer standing after the first backslash, which 3F59H brings back and 4095H throws away.
3F47
LD C,02H 0E 02
Load Register C with 02H, the width of a field of two backslashes with nothing between them.
3F49
LD A,(HL) 7E
The spaces counted (3F49H), which 3F56H goes back to: load Register A with the byte Register Pair HL stands on, the next character after the backslash.
3F4A
INC HL 23
Increment Register Pair HL, so that it stands on the character after that.
3F4B
CP 5CH FE 5C
Compare Register A with 5CH, a backslash, which closes the field.
3F4D
Jump to 4095H on Z, the field being closed, which is the operand byte of the instruction at 4094H and stands as a POP AF that takes the pointer pushed at 3F46H off the stack.
3F50
CP 20H FE 20
Compare Register A with 20H, a space, which is the only character a backslash field may hold.
3F52
Jump to 3F59H on NZ, something else standing inside the backslashes, so this is not a field and the backslash is written as itself.
3F54
INC C 0C
Increment Register C, the width of the field, one space having been counted.
3F55
DEC B 05
Decrement Register B, the count of format characters left, one having been read.
3F56
Jump to 3F49H on NZ, the format string not being used up, which looks at the next character.
3F59
POP HL E1
Not a field after all (3F59H), which 3F52H reaches: pop Register Pair HL, the format pointer as it stood after the first backslash.
3F5A
LD B,E 43
Load Register B from Register E, the count of format characters left as it stood before the spaces were counted.
3F5B
LD A,5CH 3E 5C
Load Register A with 5CH, the backslash itself, which is written as an ordinary character.
3F5D
A character written as itself (3F5DH), which 3F95H, 3F9DH and 3FD5H also reach: call 40CEH, which writes a plus sign first when Register D says the format asked for one.
3F60
Call 40D8H, the character output, which writes the character in Register A wherever the output is going.

3F63H - PRINT USING: the Field Read Out of the Format (3F63H-4003H)

Register D is a mask of six bits and Register E the count of digit positions, and reading a field is the business of filling them in. The bits are 01H for an exponent, written by the INC D at 3FFFH; 04H for a trailing sign and 08H for a leading plus, added at 401BH and at 3F80H; 10H for a single floating dollar and 20H for asterisk fill, with 30H for the two together, added at 3FB4H; and 40H for commas between the thousands, ored in at 3FCBH. Nothing sets 02H or 80H, so Register D can never be larger than 7DH, and that is what makes the instruction at 4001H safe: its JP Z is reached only after the INC D above it, which cannot carry Register D to 00H, and the two bytes of its operand are the EX DE,HL at 4002H and the POP DE at 4003H that the five conditional returns of the exponent test come back to. 3FAFH is a second entry hidden the same way, the operand byte of the CP 0AFH at 3FAEH, which stands as an XOR A so that a single dollar sign adds 10H where a dollar after two asterisks adds 30H. The ladder at 3F6CH to 3F92H is read in a particular order: the three one-character fields first, then the end of the format, then the leading plus, and only then the characters that have to be seen doubled, which is why 3F84H goes back a byte and reads the character again after the LD A,08H at 3F80H destroyed it.

3F63
XOR A AF
The field reader (3F63H), which 3F43H and 4068H both reach: exclusive or Register A with itself, which makes it 00H.
3F64
LD E,A 5F
Load Register E from Register A, 00H, the count of digit positions in the field, which nothing has yet contributed to.
3F65
LD D,A 57
Load Register D from Register A, 00H, the mask of format bits, which nothing has yet set.
3F66
The next format character (3F66H), which 3F82H goes back to after a leading plus: call 40CEH, which writes a plus sign when Register D already says one was asked for and which gives Register A back untouched.
3F69
LD D,A 57
Load Register D from Register A, which is 00H on the first pass and 08H when 3F80H sent a leading plus round, so Register D holds the mask as the field has built it up.
3F6A
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the next character of the format string.
3F6B
INC HL 23
Increment Register Pair HL, so that it stands on the character after it.
3F6C
CP 21H FE 21
Compare Register A with 21H, an exclamation mark, which is a string field one character wide.
3F6E
Jump to 4092H on Z, that field having been found, which sets the width to 01H and takes an item.
3F71
CP 23H FE 23
Compare Register A with 23H, a hash, which is one digit position of a numeric field.
3F73
Jump to 3FB6H on Z, a numeric field having begun, which counts its digit positions.
3F75
CP 26H FE 26
Compare Register A with 26H, an ampersand, which is a string field of whatever length the string has.
3F77
Jump to 408EH on Z, that field having been found, which sets the width to 00H and takes an item.
3F7A
DEC B 05
Decrement Register B, the count of format characters left, this character having been read.
3F7B
Jump to 406DH on Z, the format string being used up, which writes this character as itself and finishes the statement.
3F7E
CP 2BH FE 2B
Compare Register A with 2BH, a plus sign, which asks for the sign of the number in front of it.
3F80
LD A,08H 3E 08
Load Register A with 08H, the bit that says a leading plus was asked for, which changes no flag so the comparison above still stands.
3F82
Jump to 3F66H on Z, a plus sign having been found, which ors that bit into Register D and reads the next format character.
3F84
DEC HL 2B
Decrement Register Pair HL, so that it stands on the character just read, the instruction above having destroyed Register A.
3F85
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, that character again.
3F86
INC HL 23
Increment Register Pair HL, so that it stands on the character after it once more.
3F87
CP 2EH FE 2E
Compare Register A with 2EH, a full stop, which begins a field of decimal places with no digits before them.
3F89
Jump to 3FD0H on Z, a full stop having been found, which counts the digit positions after it.
3F8B
CP 5FH FE 5F
Compare Register A with 5FH, an underline, which makes the character after it stand for itself.
3F8D
Jump to 4083H on Z, an underline having been found, which writes the next format character and nothing of this one.
3F90
CP 5CH FE 5C
Compare Register A with 5CH, a backslash, which opens a string field of a fixed width.
3F92
Jump to 3F45H on Z, a backslash having been found, which counts the spaces up to the closing one.
3F94
CP (HL) BE
Compare Register A with the byte Register Pair HL stands on, which sets the Zero Flag when the same character stands twice running.
3F95
Jump to 3F5DH on NZ, the character standing only once, so it is written as itself and the field begins again.
3F97
CP 24H FE 24
Compare Register A with 24H, a dollar sign, which doubled means a floating dollar in front of the number.
3F99
Jump to 3FAFH on Z, two dollar signs having been found, which is the operand byte of the instruction at 3FAEH and stands as an XOR A so that 10H and not 30H is added.
3F9B
CP 2AH FE 2A
Compare Register A with 2AH, an asterisk, which doubled means the field is filled with asterisks.
3F9D
Jump to 3F5DH on NZ, the doubled character being neither a dollar nor an asterisk, so it is written as itself.
3F9F
INC HL 23
Increment Register Pair HL, so that it stands past the second asterisk of the pair.
3FA0
LD A,B 78
Load Register A from Register B, the count of format characters left.
3FA1
CP 02H FE 02
Compare Register A with 02H, two characters being the fewest that could hold a dollar sign and a digit position after the asterisks.
3FA3
Jump to 3FA8H on C, fewer than two being left, so the character after the asterisks is not looked at.
3FA5
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the character standing after the two asterisks.
3FA6
CP 24H FE 24
Compare Register A with 24H, a dollar sign, which with the asterisks means both the fill and the floating dollar.
3FA8
LD A,20H 3E 20
Load Register A with 20H, the bit that says the field is filled with asterisks, which changes no flag so the comparison above still stands.
3FAA
Jump to 3FB3H on NZ, no dollar sign standing after the asterisks, which adds that bit alone.
3FAC
DEC B 05
Decrement Register B, the count of format characters left, the dollar sign having been read.
3FAD
INC E 1C
Increment Register E, the count of digit positions, the dollar sign taking one of them.
3FAE
CP 0AFH FE AF
Compare Register A with 0AFH, which is the test the one dollar sign path enters at 3FAFH instead of making, Register A standing at 20H here so that the operand byte is what matters and not the comparison.
3FB0
ADD A,10H C6 10
Add 10H to Register A, which makes 30H of the 20H above, the asterisk fill and the floating dollar together, and 10H of the 00H an XOR A at 3FAFH leaves.
3FB2
INC HL 23
Increment Register Pair HL, so that it stands past the dollar sign.
3FB3
INC E 1C
The bits added (3FB3H), which 3FAAH reaches: increment Register E, the count of digit positions.
3FB4
ADD A,D 82
Add Register D to Register A, the mask as the field has built it so far.
3FB5
LD D,A 57
Load Register D from Register A, so that Register D now carries 10H, 20H or 30H besides whatever it held.
3FB6
INC E 1C
The digit positions (3FB6H), which 3F73H, 3FC4H and 3FCEH all reach: increment Register E, the count of digit positions, one hash having been counted.
3FB7
LD C,00H 0E 00
Load Register C with 00H, the count of decimal places, which stays at nought until a full stop is met.
3FB9
DEC B 05
Decrement Register B, the count of format characters left.
3FBA
Jump to 4004H on Z, the format string being used up, which finishes the field here.
3FBC
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the next character of the format string.
3FBD
INC HL 23
Increment Register Pair HL, so that it stands on the character after it.
3FBE
CP 2EH FE 2E
Compare Register A with 2EH, a full stop, which begins the decimal places.
3FC0
Jump to 3FDBH on Z, a full stop having been found, which counts the digit positions after it.
3FC2
CP 23H FE 23
Compare Register A with 23H, a hash, which is another digit position.
3FC4
Jump to 3FB6H on Z, another digit position having been found, which counts it and reads on.
3FC6
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which asks for a comma between every three digits.
3FC8
Jump to 3FE5H on NZ, the character being none of the three, which is where the exponent is tested for.
3FCA
LD A,D 7A
Load Register A from Register D, the mask as the field has built it so far.
3FCB
OR 40H F6 40
Or Register A with 40H, the bit that asks for commas between the thousands.
3FCD
LD D,A 57
Load Register D from Register A, that mask with the comma bit in it.
3FCE
Jump to 3FB6H, which counts the comma as a digit position and reads the next format character.
3FD0
LD A,(HL) 7E
A field that begins with a full stop (3FD0H), which 3F89H reaches: load Register A with the byte Register Pair HL stands on, the character after the full stop.
3FD1
CP 23H FE 23
Compare Register A with 23H, a hash, a full stop being a field only when a digit position follows it.
3FD3
LD A,2EH 3E 2E
Load Register A with 2EH, the full stop itself, which changes no flag so the comparison above still stands.
3FD5
Jump to 3F5DH on NZ, no digit position standing after it, so the full stop is written as itself.
3FD8
LD C,01H 0E 01
Load Register C with 01H, the count of decimal places, the full stop itself taking one place of the field.
3FDA
INC HL 23
Increment Register Pair HL, so that it stands past the first hash after the full stop.
3FDB
INC C 0C
The decimal places (3FDBH), which 3FC0H and 3FE3H both reach: increment Register C, the count of places after the full stop.
3FDC
DEC B 05
Decrement Register B, the count of format characters left.
3FDD
Jump to 4004H on Z, the format string being used up, which finishes the field here.
3FDF
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the next character of the format string.
3FE0
INC HL 23
Increment Register Pair HL, so that it stands on the character after it.
3FE1
CP 23H FE 23
Compare Register A with 23H, a hash, which is another decimal place.
3FE3
Jump to 3FDBH on Z, another decimal place having been found, which counts it and reads on.
3FE5
PUSH DE D5
The exponent tested for (3FE5H), which 3FC8H reaches: push Register Pair DE, the mask and the count of digit positions, because the test below writes both of them.
3FE6
LD DE,4002H 11 02 40
Load Register Pair DE with 4002H, which is the pair of instructions inside the operand of the instruction at 4001H.
3FE9
PUSH DE D5
Push Register Pair DE, 4002H, as the address every one of the five conditional returns below comes back to.
3FEA
LD D,H 54
Load Register D from Register H, the high byte of the format pointer, so that the exchange at 4002H can put the pointer back where it stood.
3FEB
LD E,L 5D
Load Register E from Register L, the low byte of it, Register Pair DE now being the format pointer and no longer the mask.
3FEC
CP 5EH FE 5E
Compare Register A with 5EH, an upward arrow, four of which in a row ask for the number in exponent form.
3FEE
RET NZ C0
Return on NZ, the character not being an upward arrow, which goes to 4002H and leaves the field as it stood.
3FEF
CP (HL) BE
Compare Register A with the byte Register Pair HL stands on, which is the second of the four upward arrows.
3FF0
RET NZ C0
Return on NZ, only one upward arrow standing there, which goes to 4002H and leaves the field as it stood.
3FF1
INC HL 23
Increment Register Pair HL, so that it stands on the third of the four.
3FF2
CP (HL) BE
Compare Register A with the byte Register Pair HL stands on, that third upward arrow.
3FF3
RET NZ C0
Return on NZ, only two standing there, which goes to 4002H and leaves the field as it stood.
3FF4
INC HL 23
Increment Register Pair HL, so that it stands on the fourth of the four.
3FF5
CP (HL) BE
Compare Register A with the byte Register Pair HL stands on, that fourth upward arrow.
3FF6
RET NZ C0
Return on NZ, only three standing there, which goes to 4002H and leaves the field as it stood.
3FF7
INC HL 23
Increment Register Pair HL, so that it stands past the fourth upward arrow.
3FF8
LD A,B 78
Load Register A from Register B, the count of format characters left, which counts all four of the arrows.
3FF9
SUB 04H D6 04
Subtract 04H from Register A, the four arrows, which sets the Carry Flag when the format string was too short to hold them all.
3FFB
RET C D8
Return on C, the four arrows having run past the end of the format string, which goes to 4002H and leaves the field as it stood.
3FFC
POP DE D1
Pop Register Pair DE, which throws away the 4002H pushed at 3FE9H, the test having succeeded and no return being wanted.
3FFD
POP DE D1
Pop Register Pair DE, which brings the mask and the count of digit positions back into Register Pair DE.
3FFE
LD B,A 47
Load Register B from Register A, the count of format characters left after the four arrows.
3FFF
INC D 14
Increment Register D, which sets bit 0 of the mask, the bit that asks for the number in exponent form.
4000
INC HL 23
Increment Register Pair HL, which 4005H takes back, the two standing here because 4004H is reached by three other paths that want the pointer one lower.
4001
JP Z,0D1EBH CA EB D1
Jump to 0D1EBH on Z, which can never be taken, Register D being a mask of six bits whose largest value is 7DH so that the increment above cannot carry it to 00H; the two bytes of this operand are the instructions at 4002H and 4003H that the five returns above come back to.

4004H - PRINT USING: the Trailing Sign, the Number Written and the Next Item (4004H-4082H)

The field is read and this is where it is spent. 4004H settles the sign, and the INC E at 4006H against the DEC E at 400BH is the whole of the difference between the two kinds: a leading plus takes a digit position of its own, so Register E keeps the increment, and a trailing sign does not, so Register E gives it back and bit 2 of the mask tells 3148H to put the sign after the number instead. Then 4020H pops the two words the statement has been keeping, works the item out with the evaluator, refuses a field of 25 positions or more, and hands the whole thing to the number formatter at 3148H with bit 7 of the mask set, the integer positions in Register B and the decimal places in Register C, which writes the number into a buffer that 46A5H then displays. 403EH onwards reads what follows the item, and the two flags it leaves are what end the statement: the Zero Flag says the item list has ended and the Carry Flag, set at 4043H and cleared by NXTCHAR after a separator, says whether a carriage return is owed, which is how a semicolon or a comma at the end of a PRINT USING holds the display on the same line. 4055H to 4068H puts the format pointer back by working out how far into the string the reading got, length less characters left, and adding that to the string's text address, so the next field is read from exactly where the last one stopped and the statement never keeps a pointer it would have to guard against a string space collection.

4004
LD A,D 7A
The sign settled (4004H), which 3FBAH, 3FDDH and the fall through from 4001H all reach: load Register A from Register D, the mask the field reader built.
4005
DEC HL 2B
Decrement Register Pair HL, so that it stands on the format character that ended the field, which may be a trailing sign.
4006
INC E 1C
Increment Register E, the count of digit positions, which a leading plus takes one of and every other case gives back below.
4007
AND 08H E6 08
And Register A with 08H, the bit that says a leading plus was asked for.
4009
Jump to 4020H on NZ, a leading plus having been asked for, which leaves Register E one higher for the sign's own position.
400B
DEC E 1D
Decrement Register E, no leading plus having been asked for, which takes that position back again.
400C
LD A,B 78
Load Register A from Register B, the count of format characters left.
400D
OR A B7
Or Register A with itself, which sets the Zero Flag when the format string is used up.
400E
Jump to 4020H on Z, nothing being left to hold a trailing sign.
4010
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the format character that ended the field.
4011
SUB 2DH D6 2D
Subtract 2DH from Register A, a minus sign, which leaves nought for it and 0FEH for a plus sign.
4013
Jump to 401BH on Z, a trailing minus sign having been found, which asks for the sign only when the number is negative.
4015
CP 0FEH FE FE
Compare Register A with 0FEH, which is a plus sign expressed as 2BH less 2DH.
4017
Jump to 4020H on NZ, the character being neither sign, which leaves it for the next field to read.
4019
LD A,08H 3E 08
Load Register A with 08H, the bit that asks for a sign whichever way the number goes, a trailing plus sign having been found.
401B
ADD A,04H C6 04
The trailing sign recorded (401BH), which 4013H reaches with 00H in Register A: add 04H to Register A, the bit that says the sign goes after the number.
401D
ADD A,D 82
Add Register D to Register A, the mask as the field reader left it.
401E
LD D,A 57
Load Register D from Register A, that mask with the trailing sign's bits in it.
401F
DEC B 05
Decrement Register B, the count of format characters left, the sign having been read.
4020
POP HL E1
The item (4020H), which 4009H, 400EH and 4017H all reach: pop Register Pair HL, the text pointer the statement pushed at 3F37H.
4021
POP AF F1
Pop Register Pair AF, the flag word the statement pushed at 3F36H, whose Zero Flag says the item list has ended.
4022
Jump to 4078H on Z, the item list having ended, which finishes the statement and writes a carriage return if the Carry Flag asks for one.
4024
PUSH BC C5
Push Register Pair BC, the count of format characters left and the decimal places, because the evaluator uses every register.
4025
PUSH DE D5
Push Register Pair DE, the mask and the count of digit positions, for the same reason.
4026
Call 7345H, the evaluator, which works the item out into the accumulator and leaves the text pointer standing after it.
4029
POP DE D1
Pop Register Pair DE, which brings the mask and the count of digit positions back.
402A
POP BC C1
Pop Register Pair BC, which brings the count of format characters left and the decimal places back.
402B
PUSH BC C5
Push Register Pair BC, those two counts, which 4055H pops when the next field is read.
402C
PUSH HL E5
Push Register Pair HL, the text pointer standing after the item, which 403EH pops.
402D
LD B,E 43
Load Register B from Register E, the count of digit positions before the point, which the formatter wants in that register.
402E
LD A,B 78
Load Register A from Register B, that count of digit positions, so that the decimal places can be added to it.
402F
ADD A,C 81
Add Register C to Register A, the decimal places, which makes the whole width of the field.
4030
CP 19H FE 19
Compare Register A with 19H, 25, which is one more than the widest field the formatter will take.
4032
Jump to 5F95H on NC, FUNCERR, which gives error 5, Illegal function call, for a field of 25 positions or more.
4035
LD A,D 7A
Load Register A from Register D, the mask of format bits.
4036
OR 80H F6 80
Or Register A with 80H, the bit that tells the formatter it is working for PRINT USING and not for an ordinary PRINT.
4038
Call 3148H, the number formatter, which lays the value in the accumulator out as text in a buffer, obeying every bit of the mask in Register A and the two counts in Register B and Register C.
403B
Call 46A5H, BASDSP, which writes that buffer a character at a time until it reaches the 00H.
403E
POP HL E1
What follows the item (403EH), which 40BDH and 40C6H both jump to: pop Register Pair HL, the text pointer standing after the item.
403F
DEC HL 2B
Decrement Register Pair HL, so that NXTCHAR below reads the character the pointer already stands on.
4040
Call 5E93H, NXTCHAR, which brings that character into Register A and sets the Zero Flag when the statement has ended there.
4043
SCF 37
Set the Carry Flag, which is the flag 4078H reads as a carriage return being owed and which only a separator below clears.
4044
Jump to 4055H on Z, the statement having ended with no separator after the item, so the Carry Flag stands and the display is taken to the next line.
4046
LD (7183H),A 32 83 71
Store Register A, the separator, into the byte at 7183H, where 3F28H reads it when the format string has to be started over.
4049
CP 3BH FE 3B
Compare Register A with 3BH, a semicolon, which is one of the two separators PRINT USING allows.
404B
Jump to 4052H on Z, a semicolon having been found, which reads the character after it.
404D
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which is the other separator PRINT USING allows.
404F
Jump to 586CH on NZ, SYNERR, which gives error 2, Syntax error, for anything else standing after an item.
4052
Past the separator (4052H), which 404BH reaches: call 5E93H, NXTCHAR, which reads the character after the separator and clears the Carry Flag, so no carriage return is owed when the statement ends on a separator.
4055
POP BC C1
The format pointer put back (4055H), which 4044H also reaches: pop Register Pair BC, the count of format characters left and the decimal places, as 402BH pushed them.
4056
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer into Register Pair DE where the three pushes below want it.
4057
POP HL E1
Pop Register Pair HL, the descriptor address of the format string, which the statement pushed at 3F30H.
4058
PUSH HL E5
Push Register Pair HL, that descriptor address, back on to the stack where the statement keeps it.
4059
PUSH AF F5
Push Register Pair AF, the flag word as 4043H and 4052H left it, which 4021H and 409BH read.
405A
PUSH DE D5
Push Register Pair DE, the text pointer, the third of the three words the statement keeps.
405B
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the length of the format string.
405C
SUB B 90
Subtract Register B from Register A, the count of format characters left, which leaves how many of them have been read.
405D
INC HL 23
Increment Register Pair HL, so that it stands on the low byte of the descriptor's text address.
405E
LD D,00H 16 00
Load Register D with 00H, so that Register Pair DE is that count and nothing above it.
4060
LD E,A 5F
Load Register E from Register A, the count of format characters already read.
4061
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the low byte of the text address.
4062
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of it.
4063
LD H,(HL) 66
Load Register H with the byte Register Pair HL stands on, that high byte.
4064
LD L,A 6F
Load Register L from Register A, so that Register Pair HL stands on the first character of the format string.
4065
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which makes Register Pair HL the character the next field is to be read from.
4066
LD A,B 78
Another field or the end (4066H), which 408CH jumps to: load Register A from Register B, the count of format characters left.
4067
OR A B7
Or Register A with itself, which sets the Zero Flag when the format string is used up.
4068
Jump to 3F63H on NZ, there being format left, which reads the next field out of it.
406B
Jump to 4073H, the format string being used up, which starts it over if any items are left.
406D
The format used up inside a field (406DH), which 3F7BH reaches: call 40CEH, which writes a plus sign first when Register D says the format asked for one.
4070
Call 40D8H, the character output, which writes the last format character as itself.
4073
POP HL E1
The format string started over (4073H), which 406BH reaches: pop Register Pair HL, the text pointer the statement pushed.
4074
POP AF F1
Pop Register Pair AF, the flag word, whose Zero Flag says whether the item list has ended.
4075
Jump to 3F28H on NZ, items being left, which reads the separator out of 7183H and takes the format string from its first character again.
4078
The end of the statement (4078H), which 4022H and 409CH both reach: call 41F5H on C, which writes a carriage return, the Carry Flag being set only when the statement ended without a separator after its last item.
407B
EX (SP),HL E3
Exchange the word Register Pair HL holds with the word at the Stack Pointer, which puts the descriptor address of the format string into Register Pair HL and the text pointer on to the stack.
407C
Call 4820H, which puts that descriptor address into Register Pair DE and gives its space back when it is the topmost temporary string, so the format string is not left holding string space.
407F
POP HL E1
Pop Register Pair HL, the text pointer standing after the statement.
4080
Jump to 634BH, which clears the printer flag at 6E92H and FILEX at 6E98H and returns to the statement loop, exactly as an ordinary PRINT ends.

4083H - PRINT USING: the Underline and the String Fields (4083H-40CDH)

The three ways a field takes a string instead of a number, and the escape that takes neither. 4083H is the underline, which writes the format character standing after it as itself whatever that character is, so a hash or a backslash can be put in the output. The other three are one routine with three widths: 408EH is the ampersand, Register C at 00H, which writes the string at whatever length it has; 4092H is the exclamation mark, Register C at 01H, one character; and 4095H is the backslash field, which 3F4DH jumps into as the operand byte of the instruction above it and which is a POP AF that throws away the format pointer 3F46H pushed, Register C already holding the width the spaces between the backslashes counted. From 409EH the three are the same: the item is worked out, 2AB0H insists it is a string, 48BFH cuts it down to the field's width when there is one, 46A8H writes it, and then 40C0H to 40CCH pads what is left of the field with spaces. The ampersand skips the padding at 40BDH because its field is the string's own length, and the INC B and DEC B at 40C4H are the usual pair, there because a string exactly as long as the field leaves nought to pad and SUB (HL) would otherwise send the loop round 256 times.

4083
The underline (4083H), which 3F8DH reaches: call 40CEH, which writes a plus sign first when Register D says the format asked for one.
4086
DEC B 05
Decrement Register B, the count of format characters left, the character about to be written being read here.
4087
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the format character the underline protects.
4088
INC HL 23
Increment Register Pair HL, so that it stands on the character after it.
4089
Call 40D8H, the character output, which writes that character as itself however the field reader would have read it.
408C
Jump to 4066H, which reads another field out of the format or starts the format over.
408E
LD C,00H 0E 00
The ampersand (408EH), which 3F77H reaches: load Register C with 00H, which is the width that means the string is written at whatever length it has.
4090
Jump to 4096H, which takes the item without the POP AF the backslash field needs.
4092
LD C,01H 0E 01
The exclamation mark (4092H), which 3F6EH reaches: load Register C with 01H, a field one character wide.
4094
LD A,0F1H 3E F1
Load Register A with 0F1H, which is read for its operand byte and not for what it does, 4095H standing as the POP AF the backslash field enters at.
4096
DEC B 05
The item taken (4096H), which 4090H reaches and 4095H falls into: decrement Register B, the count of format characters left, the character that closed the field being read here.
4097
Call 40CEH, which writes a plus sign first when Register D says the format asked for one.
409A
POP HL E1
Pop Register Pair HL, the text pointer the statement pushed at 3F37H or 405AH.
409B
POP AF F1
Pop Register Pair AF, the flag word, whose Zero Flag says the item list has ended.
409C
Jump to 4078H on Z, the item list having ended, which finishes the statement.
409E
PUSH BC C5
Push Register Pair BC, the count of format characters left and the field's width, because the evaluator uses every register.
409F
Call 7345H, the evaluator, which works the item out into the accumulator and leaves the text pointer standing after it.
40A2
Call 2AB0H of BASIC/OV1, which gives error 13, Type mismatch, through 5884H unless the item is a string.
40A5
POP BC C1
Pop Register Pair BC, which brings the count of format characters left and the field's width back.
40A6
PUSH BC C5
Push Register Pair BC, those two, which 4055H pops when the next field is read.
40A7
PUSH HL E5
Push Register Pair HL, the text pointer standing after the item, which 403EH pops.
40A8
LD HL,(72ECH) 2A EC 72
Load Register Pair HL from the word at 72ECH, the accumulator, which for a string holds the address of its descriptor.
40AB
LD B,C 41
Load Register B from Register C, the field's width, which the truncation below wants in that register.
40AC
LD C,00H 0E 00
Load Register C with 00H, the decimal places, which a string field has none of and which 402FH would otherwise add in.
40AE
LD A,B 78
Load Register A from Register B, the field's width, which is 00H only for the ampersand.
40AF
PUSH AF F5
Push Register Pair AF, that width, which 40BBH pops to decide whether the field is padded.
40B0
LD A,B 78
Load Register A from Register B, the field's width again, the instruction above having left the flags from the push and not from the value.
40B1
OR A B7
Or Register A with itself, which sets the Zero Flag when the width is 00H.
40B2
Call 48BFH on NZ, which is a PUSH HL inside the instruction at 48BEH and reaches the string truncation, so the string is cut down to the width in Register B.
40B5
Call 46A8H, which writes the string the descriptor in Register Pair HL names a character at a time.
40B8
LD HL,(72ECH) 2A EC 72
Load Register Pair HL from the word at 72ECH, the accumulator, which the truncation may have given a new descriptor address.
40BB
POP AF F1
Pop Register Pair AF, the field's width as 40AFH pushed it.
40BC
OR A B7
Or Register A with itself, which sets the Zero Flag when that width is 00H.
40BD
Jump to 403EH on Z, the field being an ampersand, whose width is the string's own, so nothing is padded.
40C0
SUB (HL) 96
Subtract the byte Register Pair HL stands on from Register A, the string's length, which leaves how many places of the field the string did not fill.
40C1
LD B,A 47
Load Register B from Register A, that count of places to pad.
40C2
LD A,20H 3E 20
Load Register A with 20H, a space, which is what the padding is made of.
40C4
INC B 04
Increment Register B, the count, which with the instruction below sets the flags from it without changing it.
40C5
DEC B 05
The padding (40C5H), which 40CCH goes back to: decrement Register B, which puts the count back and sets the Zero Flag when there is nothing left to pad.
40C6
Jump to 403EH on Z, the field being full, which reads what follows the item.
40C9
Call 40D8H, the character output, which writes one space of the padding.
40CC
Jump to 40C5H, which counts that space and writes another if the field is still not full.

40CEH - The Plus Sign PRINT USING Writes (40CEH-40D7H)

Ten bytes that stand immediately above the character output and belong to PRINT USING alone, which calls them from 3F5DH, 3F66H, 406DH, 4083H and 4097H. Register D carries the flag that says a plus sign was asked for in the format, and the routine is written so that the caller need not test it: the LD A,2BH at 40D1H changes no flag, so the OR A two instructions above it still decides the conditional call below, and the character the caller had in Register A is pushed and popped around the whole of it.

40CE
PUSH AF F5
The plus sign (40CEH), which the five places of PRINT USING named above call: push Register Pair AF, the character the caller is in the middle of writing, which this routine must give back untouched.
40CF
LD A,D 7A
Load Register A from Register D, the flag PRINT USING sets when the format asked for a sign in front of the number.
40D0
OR A B7
Or Register A with itself, which sets the Zero Flag when no sign was asked for and leaves it reset when one was.
40D1
LD A,2BH 3E 2B
Load Register A with 2BH, the plus sign, which changes no flag at all, so the answer the instruction above worked out still stands for the call below.
40D3
Call 40D8H on NZ, a sign having been asked for, which writes the plus sign wherever the output is going.
40D6
POP AF F1
Pop Register Pair AF, which brings the caller's own character back into Register A.
40D7
RET C9
Return with that character in Register A and the plus sign written or not written as Register D said.

40D8H - The One Character Output, and the Printer's Own Column (40D8H-4136H)

Every character the interpreter writes anywhere goes through 40D8H. Thirty-one instructions of module 1 call it and the string displayers at 46A5H and 7A04H and the line feed routine at 4212H all end here. It chooses between three destinations in its first eight bytes: a file, when FILEX 6E98H is not 0000H, which 45DFH tests and 4F8CH takes over; the printer, when the flag at 6E92H is set, which is the code below; and the display at 4152H, which is everything else. The printer's path is the longer one because the interpreter counts the printer's column itself at 6E91H, where the display's column is read back out of the video driver into 713CH every time a character goes to it. So this code has to do by hand what the display gets for nothing: a backspace at 08H takes one off the column and will not go below nought, a tab at 09H is turned into spaces until the column is a multiple of eight, a carriage return at 0DH puts the column back to nought, the control codes below 0DH leave it alone, and anything else steps it by one and, when it has reached the width WIDTH LPRINT left at 6E94H, sends a carriage return through 413CH first. A column of 0FFH is the signal to stop counting, tested at 4107H and at 412BH, which is how the printer's output is let run past the width when nothing has set one. The two NOP instructions at 40E6H and the five at 4141H are slack left in the assembly, and the code runs through both runs.

40D8
PUSH AF F5
The one character output (40D8H), which thirty-one instructions of module 1 call: push Register Pair AF, the character to be written, which the test below destroys and every path pops back.
40D9
Call 45DFH, which loads Register Pair HL from FILEX 6E98H and sets the Zero Flag from Register H ored with Register L, so the Zero Flag is reset when a file is in hand for output.
40DC
Jump to 4F8CH on NZ, a file being in hand, which pops the character back and writes it to that file a byte at a time.
40DF
LD A,(6E92H) 3A 92 6E
Load Register A with the byte at 6E92H, the flag LPRINT sets at 620DH and LLIST at 79B0H to send what follows to the printer.
40E2
OR A B7
Or Register A with itself, which sets the Zero Flag when nothing has asked for the printer.
40E3
Jump to 4152H on Z, which is the display's own path and the one almost every character takes.
40E6
NOP 00
A NOP, the first of two bytes of slack standing between the three way choice above and the printer code below, which the printer path runs straight through.
40E7
NOP 00
A NOP, the second of them, after which the code reaches 40E8H with the character still on the stack.
40E8
POP AF F1
The printer (40E8H): pop Register Pair AF, the character, so that it can be tested.
40E9
PUSH AF F5
Push Register Pair AF again, because each of the tests below destroys Register A and the character is wanted at the end.
40EA
CP 08H FE 08
Compare Register A with 08H, the backspace, which is the one character that takes the printer's column backwards.
40EC
Jump to 40FBH on NZ, the character not being a backspace, where the tab is tested for.
40EE
LD A,(6E91H) 3A 91 6E
A backspace (40EEH): load Register A with the byte at 6E91H, the printer's column, which this code keeps for itself.
40F1
SUB 01H D6 01
Subtract 01H from Register A, which takes the column back one and sets the Carry Flag when it was already nought.
40F3
Jump to 40F8H on C, the column having been nought, so that a backspace at the start of a line leaves the count where it is.
40F5
LD (6E91H),A 32 91 6E
Store Register A, the column less one, into the byte at 6E91H.
40F8
POP AF F1
Pop Register Pair AF, the backspace, which is to be sent to the printer as it stands.
40F9
Jump to 4134H, which sends the character to the printer and returns.
40FB
CP 09H FE 09
Compare Register A with 09H, the tab, which the printer does not do for itself and which this code turns into spaces.
40FD
Jump to 4111H on NZ, the character being neither a backspace nor a tab, where the column is stepped.
40FF
LD A,20H 3E 20
A tab (40FFH): load Register A with 20H, a space, which is what a tab is written as.
4101
Call 40D8H, this routine's own head, which sends that space to the printer and steps the column by one on the way.
4104
LD A,(6E91H) 3A 91 6E
Load Register A with the byte at 6E91H, the printer's column as the space above left it.
4107
CP 0FFH FE FF
Compare Register A with 0FFH, the value that says the column is not being counted.
4109
Jump to 410FH on Z, the column not being counted, so that one space is all a tab writes.
410B
AND 07H E6 07
And Register A with 07H, which leaves nought only when the column is a multiple of eight, the tab stops being every eight columns.
410D
Jump to 40FFH on NZ, the column not yet standing on a tab stop, which writes another space and tests again.
410F
POP AF F1
Pop Register Pair AF, the tab, which has been written as spaces and is not to be sent to the printer itself.
4110
RET C9
Return with the printer standing on a tab stop and Register A holding the 09H the caller asked for.
4111
POP AF F1
Every other character (4111H): pop Register Pair AF, the character, to test it against the carriage return.
4112
PUSH AF F5
Push Register Pair AF again, because the test below destroys Register A and the character is wanted at 4133H.
4113
SUB 0DH D6 0D
Subtract 0DH from Register A, the carriage return, which leaves nought for it and sets the Carry Flag for every control code below it.
4115
Jump to 4130H on Z, the character being a carriage return, with Register A at nought, which is the new column exactly.
4117
Jump to 4133H on C, the character being a control code below 0DH, which neither moves the printer's column nor is counted.
4119
LD A,(6E94H) 3A 94 6E
Load Register A with the byte at 6E94H, the printer's width, which WIDTH LPRINT sets at 796AH and which is 0FFH when no width is in force.
411C
INC A 3C
Increment Register A, which sets the Zero Flag only when that width was 0FFH, so the test is made and the value thrown away.
411D
LD A,(6E91H) 3A 91 6E
Load Register A with the byte at 6E91H, the printer's column, the Zero Flag from the increment above standing.
4120
Jump to 412BH on Z, no width being in force, so that nothing wraps the printer's line.
4122
PUSH HL E5
Push Register Pair HL, the caller's own pointer, because the comparison below needs a register pair to point with.
4123
LD HL,6E94H 21 94 6E
Load Register Pair HL with 6E94H, the address of the printer's width, so that the column can be compared against it.
4126
CP (HL) BE
Compare Register A, the column, with the byte Register Pair HL stands on, the width, which sets the Zero Flag when the line is full.
4127
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back with the comparison's flags standing.
4128
Call 413CH on Z, the line being full, which sends a carriage return to the printer and puts the column back to nought.
412B
CP 0FFH FE FF
The column stepped (412BH), which 4120H also reaches: compare Register A with 0FFH, the value that says the column is not being counted.
412D
Jump to 4133H on Z, the column not being counted, so that it is left at 0FFH however many characters go by.
412F
INC A 3C
Increment Register A, which steps the printer's column by the one character about to be written.
4130
LD (6E91H),A 32 91 6E
The column stored (4130H), which 4115H reaches with nought in Register A for a carriage return: store Register A into the byte at 6E91H, the printer's column.
4133
POP AF F1
Pop Register Pair AF, the character, which every path through the code above has left on the stack.
4134
The character to the printer (4134H), which 40F9H also jumps to: jump to 7DF0H, which issues the supervisor call that writes Register A to the printer and goes to DERR at 5282H when the printer answers with an error.

4137H - Back to the Display, the Printer's Carriage Return and the Output Thrown Away (4137H-4151H)

Three fragments that belong with the output and are reached from quite different places. 4137H turns the printer off and is called by 432CH, by 43B1H and by READY at 5920H, so that a message always goes to the display whatever the program was doing when it stopped. 413CH is the printer's carriage return, which the width test above calls and nothing else does, and it is the only place in the file that writes the printer's column without going through 4130H. 414BH is the output suppression, the test STOP and the error handler set at 43AEH, 43CBH, 58D6H and 5924H and OPEN clears at 63D1H: when 6E97H is not 00H the character is thrown away by 46D8H, which pops the Register Pair AF that 40D8H pushed and returns, and when it is 00H the code falls into the display path at 4152H. Only 670DH reaches 414BH, so it is the entry the text writer of the complaint messages uses and not one the ordinary output takes.

4137
XOR A AF
The printer turned off (4137H), which 432CH, 43B1H and READY at 5920H call: exclusive or Register A with itself, which makes it 00H.
4138
LD (6E92H),A 32 92 6E
Store Register A, 00H, into the byte at 6E92H, the printer flag, so that what is written next goes to the display.
413B
RET C9
Return with the printer flag clear and the printer's own column at 6E91H left exactly as the last LPRINT found it.
413C
LD A,0DH 3E 0D
The printer's carriage return (413CH), which the width test at 4128H calls: load Register A with 0DH, the carriage return.
413E
Call 7DF0H, which issues the supervisor call that writes Register A to the printer, so that the printer's carriage moves to the next line.
4141
NOP 00
A NOP, the first of five bytes of slack between the carriage return above and the column below, which the code runs straight through.
4142
NOP 00
A NOP, the second of the five, which the code reaches with the carriage return already on its way to the printer.
4143
NOP 00
A NOP, the third of the five, standing where an instruction was once assembled and is no longer.
4144
NOP 00
A NOP, the fourth of the five, and the last but one of the run of slack.
4145
NOP 00
A NOP, the fifth of the five, after which the code reaches 4146H with the carriage return already written.
4146
XOR A AF
Exclusive or Register A with itself, which makes it 00H, the column of the start of a line.
4147
LD (6E91H),A 32 91 6E
Store Register A, 00H, into the byte at 6E91H, the printer's column, which the new line has put back to its start.
414A
RET C9
Return to the width test at 4128H, which goes on to count the character that would not fit on the line that has just ended.
414B
LD A,(6E97H) 3A 97 6E
The output thrown away (414BH), which 670DH jumps to: load Register A with the byte at 6E97H, the flag that stops anything reaching the display, which 43AEH, 43CBH, 58D6H and 5924H set and 63D1H clears.
414E
OR A B7
Or Register A with itself, which sets the Zero Flag only when the display is to be written to as usual.
414F
Jump to 46D8H on NZ, the output being stopped, which pops the Register Pair AF that 40D8H pushed and returns with the character written nowhere.

4152H - The Display Output (4152H-419CH)

Where almost every character of the interpreter ends up, and it is shorter than the printer's path because the video driver gives the column back: 7D7FH writes the character with the display supervisor call and then asks the driver where the cursor now stands, which it keeps in 713CH, so nothing here has to count. What is left for this code to do is the two things the driver will not do. A tab at 09H is turned into spaces until 713CH is a multiple of eight, exactly as the printer's path does it, with 0FFH again the value that says the column is not being counted. And a printable character that would land on the column WIDTH left at 6E95H has a carriage return written through 41F5H in front of it, so the display's line wraps where BASIC says it does and not where the hardware says it does. The last three instructions keep the character just written in 6E8BH, which is read in one place only, the tab test at 4159H, and the DEC B at 4195H shows what the cell is meant to hold: it is there so that writing a 00H cannot leave the cell at 00H, because 00H is the one value the tab test reads as nothing having been written yet. The guard is made on the cell ored with the character instead of on the character, which is bug B346.

4152
POP AF F1
The display (4152H), which 40E3H jumps to and 414FH falls into: pop Register Pair AF, the character to be written.
4153
PUSH BC C5
Push Register Pair BC, the caller's own value, because the width test below works in Register B.
4154
PUSH AF F5
Push Register Pair AF, the character, because each test below destroys Register A.
4155
CP 09H FE 09
Compare Register A with 09H, the tab, which the display driver does not expand and this code does.
4157
Jump to 4176H on NZ, the character not being a tab, where the width is tested.
4159
LD A,(6E8BH) 3A 8B 6E
A tab (4159H): load Register A with the byte at 6E8BH, the character this routine last wrote to the display, which is 00H only before it has ever written one.
415C
OR A B7
Or Register A with itself, which sets the Zero Flag when that cell holds 00H.
415D
Jump to 4163H on NZ, something having been written already, which expands the tab into spaces.
415F
LD A,09H 3E 09
Load Register A with 09H, the tab itself, so that it is sent to the display driver as a bare control code.
4161
Jump to 4176H, the ordinary character path, which writes that 09H and lets the driver make of it what it will.
4163
LD A,20H 3E 20
The tab expanded (4163H), which 4171H also reaches: load Register A with 20H, a space.
4165
Call 40D8H, the character output's own head, which sends that space to the display and has the driver give back the new column.
4168
LD A,(713CH) 3A 3C 71
Load Register A with the byte at 713CH, the display's column as 7D8DH last read it out of the video driver.
416B
CP 0FFH FE FF
Compare Register A with 0FFH, the value that says the column is not being counted.
416D
Jump to 4173H on Z, the column not being counted, so that one space is all the tab writes.
416F
AND 07H E6 07
And Register A with 07H, which leaves nought only when the column is a multiple of eight, the tab stops being every eight columns.
4171
Jump to 4163H on NZ, the column not yet standing on a tab stop, which writes another space and tests again.
4173
POP AF F1
Pop Register Pair AF, the tab, which has been written as spaces and is not sent to the display itself.
4174
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
4175
RET C9
Return with the display standing on a tab stop and Register A holding the 09H the caller asked for.
4176
CP 20H FE 20
Every other character (4176H), which 4157H and 4161H both reach: compare Register A with 20H, the lowest printable character.
4178
Jump to 4189H on C, the character being a control code, which is written as it stands and never wraps the line.
417A
LD A,(6E95H) 3A 95 6E
Load Register A with the byte at 6E95H, the display's width, which WIDTH sets at 7978H and which is 0FFH when no width is in force.
417D
LD B,A 47
Load Register B from Register A, that width, so that the column can be compared against it.
417E
LD A,(713CH) 3A 3C 71
Load Register A with the byte at 713CH, the display's column out of the video driver.
4181
INC B 04
Increment Register B, which sets the Zero Flag only when the width was 0FFH, and the width is wanted again below.
4182
Jump to 4189H on Z, no width being in force, so that the display's line wraps where the hardware wraps it.
4184
DEC B 05
Decrement Register B, which puts the width back after the test above.
4185
CP B B8
Compare Register A, the column, with Register B, the width, which sets the Zero Flag when the character would land past the last column BASIC allows.
4186
Call 41F5H on Z, the line being full, which writes a carriage return so that the character begins a line of its own.
4189
POP AF F1
The character written (4189H), which 4178H and 4182H both reach: pop Register Pair AF, the character.
418A
Call 7D7FH, which writes Register A to the display with the display supervisor call, asks the video driver where the cursor now stands and keeps that column in 713CH, and gives Register A back as it was.
418D
PUSH AF F5
Push Register Pair AF, the character, because the three instructions below work in Register A.
418E
LD B,A 47
Load Register B from Register A, the character just written, which is what the cell below is to hold.
418F
LD A,(6E8BH) 3A 8B 6E
Load Register A with the byte at 6E8BH, the character written before this one.
4192
OR B B0
Or Register A with Register B, which sets the Zero Flag only when the cell and the character are both 00H, where the character alone was what wanted testing: this is bug B346.
4193
Jump to 4196H on NZ, which stores the character just written exactly as it stands, 00H included.
4195
DEC B 05
Decrement Register B, which turns the 00H it must hold into 0FFH, so that a 00H written before anything else cannot read as nothing having been written.
4196
LD A,B 78
Load Register A from Register B, the value to be kept.
4197
LD (6E8BH),A 32 8B 6E
Store Register A into the byte at 6E8BH, where the tab test at 4159H reads it and nothing else in the file does.
419A
POP AF F1
Pop Register Pair AF, which brings the character back into Register A for the caller.
419B
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
419C
RET C9
Return with the character in Register A, written to the display, and the column standing in 713CH.

419DH - Thirteen Bytes Nothing Reaches (419DH-41A9H)

Slack in the assembly between the display output and the end of a program load, and the fourth such run found in module 1. No instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 branches into any of the thirteen addresses, no relative jump of any of the four images reaches one, and no word of them holds one as a pointer: the three words that do match, at 6AB2H, 6AF1H and 6B18H, are all inside the reserved word table at 68F7H and are keyword text. They would decode as thirteen NOP instructions.

419D-41A9
DEFB 00H x 13 00 x 13
419DH to 41A9H: thirteen bytes of 00H between the display output, which ends with the RET at 419CH, and the end of a program load at 41AAH. Nothing of the four images reaches them and nothing reads them.

41AAH - The End of a Program Load (41AAH-41E8H)

Reached from 7E49H in the keyboard line reader and from nowhere else, and it is the end of every LOAD, MERGE and chained load of a text file. The load has been driven by the keyboard reader with FILEX 6E98H standing, so that each line of the file has been read as though it had been typed, and this is where the end of the file is dealt with. It closes the file through 4CD0H, keeping all three register pairs across the call, and then chooses between three ends. A CHAIN in hand, which 72D2H says, goes to 5693H to finish the chain and copy the common variables over. The run flag at 6EA8H, which LOAD sets at 4C44H and 4CF0H, means a RUN was asked for: the FILES count at 6ECEH is put aside in 6EA9H and set to 00H so that 42C7H clears the variables without closing the files the program will want, the count is put back, and the statement loop is entered at 5E3BH. Anything else writes Ready and returns to the keyboard reader. Both of the first two ends pass through 8017H, which ors the byte 520AH left at 521DH into the protected program flag at 72CBH, so a program loaded from a protected file is protected the moment the load ends.

41AA
PUSH BC C5
The end of a program load (41AAH), which 7E49H calls: push Register Pair BC, the caller's own value, which the close below destroys.
41AB
PUSH DE D5
Push Register Pair DE, the caller's own value, for the same reason.
41AC
PUSH HL E5
Push Register Pair HL, the caller's own value, for the same reason.
41AD
Call 4CD0H, the tail LOAD and SAVE share, which closes the file and clears FILEX 6E98H so that the keyboard reader goes back to the keyboard.
41B0
POP HL E1
Pop Register Pair HL, which brings the caller's own value back into that pair.
41B1
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
41B2
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
41B3
LD A,(72D2H) 3A D2 72
Load Register A with the byte at 72D2H, the flag CHAIN sets at 5680H and 56A3H and the error handler clears at 5890H.
41B6
OR A B7
Or Register A with itself, which sets the Zero Flag when no CHAIN is in hand.
41B7
Jump to 5693H on NZ, a CHAIN being in hand, which carries the common variables over and runs the chained program.
41BA
LD A,(6EA8H) 3A A8 6E
Load Register A with the byte at 6EA8H, the flag LOAD sets at 4C44H and 4CF0H when the file is to be run as soon as it is loaded.
41BD
OR A B7
Or Register A with itself, which sets the Zero Flag when nothing is to be run.
41BE
Jump to 41D8H on Z, nothing being asked for, which writes Ready and goes back to the keyboard.
41C0
LD HL,6ECEH 21 CE 6E
The load that runs (41C0H): load Register Pair HL with 6ECEH, the address of the count of file buffers BEGIN set up from the FILES parameter.
41C3
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, that count.
41C4
LD (6EA9H),A 32 A9 6E
Store Register A into the byte at 6EA9H, where the count is kept while the clear below runs.
41C7
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL stands on, the count, so that the clear below walks no file buffers and closes no files.
41C9
Call 42C7H, RUN's own clear, which throws the variables away and sets the pointers for a program about to be run.
41CC
LD A,(6EA9H) 3A A9 6E
Load Register A with the byte at 6EA9H, the file buffer count put aside above.
41CF
LD (6ECEH),A 32 CE 6E
Store Register A into the byte at 6ECEH, so that the count is exactly what BEGIN worked out before the clear touched it.
41D2
Call 8017H, which ors the byte at 521DH into the protected program flag at 72CBH and then clears 521DH, so a program loaded from a protected file cannot be listed.
41D5
Jump to 5E3BH, the statement loop, which runs the program that has just been loaded from its first line.
41D8
PUSH HL E5
The load that does not run (41D8H), which 41BEH reaches: push Register Pair HL, the keyboard reader's own pointer, which the display below destroys.
41D9
PUSH BC C5
Push Register Pair BC, the caller's own value, for the same reason.
41DA
PUSH DE D5
Push Register Pair DE, the caller's own value, for the same reason.
41DB
LD HL,732DH 21 2D 73
Load Register Pair HL with 732DH, the text Ready with the carriage return and the 00H after it.
41DE
Call 46A5H, BASDSP, which writes that text a character at a time until it reaches the 00H.
41E1
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
41E2
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
41E3
XOR A AF
Exclusive or Register A with itself, which makes it 00H, the value 8017H wants to find in Register A for nothing.
41E4
POP HL E1
Pop Register Pair HL, which brings the keyboard reader's own pointer back into that pair.
41E5
Call 8017H, which ors the byte at 521DH into the protected program flag at 72CBH and clears 521DH, so the protection is carried over for a plain LOAD as well.
41E8
RET C9
Return to 7E49H in the keyboard line reader, which goes back to reading the keyboard with the program in memory.

41E9H - The Carriage Return, and the Column Put Back (41E9H-4211H)

41F5H is called from seventeen places and is the interpreter's carriage return: it writes a 0DH through the character output and then puts the column of whatever it was written to back to the start of a line. 41E9H is the form that writes nothing when the display is already at the start of a line, which 43B4H, 58D9H, READY at 592AH and 666AH use so that a message does not leave a blank line in front of it. 41F0H is PRINT USING's own way in from 3F12H, which first puts a 00H where Register Pair HL stands and then sets the pointer to 7038H, the byte below INBUF, so that the next character read comes out of an empty buffer. 41FAH is the column alone, which 4231H calls when a line feed has been turned into a carriage return and 46B7H calls when a 0DH inside a string has been written: the file gets nothing, since a file keeps no column, the printer's count at 6E91H goes to 00H and the display's at 713CH goes to 00H. Register A comes back 00H from every path, which is why 4200H, 420BH and 4211H each set it.

41E9
LD A,(713CH) 3A 3C 71
The carriage return only when one is wanted (41E9H), which 43B4H, 58D9H, 592AH and 666AH call: load Register A with the byte at 713CH, the display's column out of the video driver.
41EC
OR A B7
Or Register A with itself, which sets the Zero Flag when the display already stands at the start of a line.
41ED
RET Z C8
Return on Z with nothing written, so that a message about to be displayed does not have a blank line in front of it.
41EE
Jump to 41F5H, the display standing part way along a line, which writes the carriage return that takes it to the next.
41F0
LD (HL),00H 36 00
PRINT USING's way in (41F0H), which 3F12H jumps to: store 00H into the byte Register Pair HL stands on, which ends the format string the statement has just finished with.
41F2
LD HL,7038H 21 38 70
Load Register Pair HL with 7038H, the byte below INBUF 7039H, so that the next NXTCHAR reads the 00H at the start of the buffer and the statement ends.
41F5
LD A,0DH 3E 0D
The carriage return (41F5H), which seventeen instructions of module 1 call and 41EEH jumps to: load Register A with 0DH, the carriage return.
41F7
Call 40D8H, the character output, which sends that 0DH to the file, the printer or the display as the flags stand.
41FA
The column put back (41FAH), which 4231H and 46B7H call: call 45DFH, which sets the Zero Flag from FILEX 6E98H so that the Zero Flag is reset when a file is in hand.
41FD
Jump to 4201H on Z, no file being in hand, so that the printer's column or the display's is the one to put back.
41FF
XOR A AF
Exclusive or Register A with itself, which makes it 00H, the value every path of this routine returns.
4200
RET C9
Return with nothing changed, a file keeping no column of its own for a carriage return to put back.
4201
LD A,(6E92H) 3A 92 6E
The printer or the display (4201H): load Register A with the byte at 6E92H, the flag that sends what is written to the printer.
4204
OR A B7
Or Register A with itself, which sets the Zero Flag when the display is where the carriage return went.
4205
Jump to 420CH on Z, the display being the destination, where its own column is put back.
4207
XOR A AF
Exclusive or Register A with itself, which makes it 00H, the column of the start of a line.
4208
LD (6E91H),A 32 91 6E
Store Register A, 00H, into the byte at 6E91H, the printer's column, which this routine keeps in step with the carriage return just written.
420B
RET C9
Return with 00H in Register A and the printer standing at the start of a line.
420C
XOR A AF
The display's column (420CH): exclusive or Register A with itself, which makes it 00H.
420D
LD (713CH),A 32 3C 71
Store Register A, 00H, into the byte at 713CH, the display's column, so that the tab and width tests read the start of a line without asking the video driver again.
4210
XOR A AF
Exclusive or Register A with itself a second time, which is what makes Register A 00H on this path as well as on the other two.
4211
RET C9
Return with 00H in Register A and the display standing at the start of a line.

4212H - A Line Feed Turned into a Carriage Return (4212H-4236H)

The entry the string displayer at 7A04H writes every character through, and ten instructions of the file call it. Its whole business is the 0AH, which goes to a file as itself and to the printer or the display as a carriage return, because neither of those two needs a line feed after one and the display driver would move the cursor down a line without taking it back to the left. Register A comes back holding the 0AH either way, which 4236H is for: the caller is in the middle of walking a string and must not have its character changed under it. The order of the two tests is worth seeing, because it is the opposite of 40D8H's: this routine asks about the printer first and the file second, where 40D8H asks about the file first, so a line feed written with both a file in hand and the printer flag set reaches 422CH and has its carriage return sent to the file by 40D8H. Nothing of the release sets both at once.

4212
CP 0AH FE 0A
The line feed (4212H), which ten instructions of module 1 call: compare Register A with 0AH, the line feed, which is the one character this routine treats differently from the output below it.
4214
Jump to 40D8H on NZ, the character being anything else, which writes it and returns to this routine's own caller.
4217
LD A,(6E92H) 3A 92 6E
Load Register A with the byte at 6E92H, the printer flag, which LPRINT and LLIST set.
421A
OR A B7
Or Register A with itself, which sets the Zero Flag when the printer has not been asked for.
421B
Jump to 422CH on NZ, the printer being the destination, which is sent a carriage return in place of the line feed.
421D
PUSH HL E5
Push Register Pair HL, the caller's own pointer, because the test below needs a register pair to load.
421E
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL from the word at 6E98H, FILEX, which holds the control block of the file in hand less two and 0000H when there is none.
4221
LD A,H 7C
Load Register A from Register H, the high byte of that word.
4222
OR L B5
Or Register A with Register L, the low byte, which sets the Zero Flag only when the whole word is 0000H.
4223
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back with the comparison's flags standing.
4224
Jump to 422CH on Z, no file being in hand, so the display is sent a carriage return in place of the line feed.
4226
LD A,0AH 3E 0A
A file (4226H): load Register A with 0AH, the line feed, which a file is given exactly as the program wrote it.
4228
Call 40D8H, the character output, which writes that line feed to the file a byte at a time through 4F8CH.
422B
RET C9
Return with 0AH in Register A, the line feed written to the file as it stands.
422C
LD A,0DH 3E 0D
The printer or the display (422CH), which 421BH and 4224H both reach: load Register A with 0DH, the carriage return.
422E
Call 40D8H, the character output, which writes that carriage return wherever the flags say.
4231
Call 41FAH, which puts the printer's column at 6E91H or the display's at 713CH back to 00H, so the line feed has moved the output on a line exactly as a carriage return does.
4234
LD A,0AH 3E 0A
Load Register A with 0AH, the line feed the caller handed in, which must be in Register A when this routine returns.
4236
RET C9
Return with 0AH in Register A, so that a caller walking a string finds its own character unchanged.

4237H - The Block Move Downwards (4237H-4246H)

Sixteen bytes that move a run of memory to a higher address, and the direction is the whole point: it copies the last byte first and works down, so that a block moved up on to bytes it occupies itself cannot overwrite what it has still to read. Three places call 423AH, the string space collection at 47C4H, CHAIN at 565BH and EDIT at 3EDEH, and two more call 4237H, which is the same move with 426DH asked for the room first. On entry Register Pair BC is the highest byte of the block, Register Pair DE the lowest and Register Pair HL the highest byte of where it is to go, and the first three instructions exchange Register Pair HL and Register Pair BC through the stack because the Z80 has no instruction that does it. On return Register Pair BC holds the address the lowest byte was written to, which is the new address of the block and what all three callers read next.

4237
The move with the room asked for (4237H), which 3B1FH and 5A10H call: call 426DH, which makes sure the highest byte of the destination in Register Pair HL stands below the string text and raises Out of memory itself if it does not.
423A
PUSH BC C5
The move (423AH), which 3EDEH, 47C4H and 565BH call: push Register Pair BC, the highest byte of the block to be moved.
423B
EX (SP),HL E3
Exchange the word Register Pair HL holds with the word at the Stack Pointer, which puts the destination's highest byte on the stack and the block's highest byte into Register Pair HL.
423C
POP BC C1
Pop Register Pair BC, which brings the destination's highest byte into that pair, so Register Pair HL now walks the source and Register Pair BC the destination.
423D
The loop (423DH): call 434DH, CPHLDE, which compares Register Pair HL with Register Pair DE and sets the Zero Flag when the source pointer has reached the lowest byte of the block.
4240
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the next byte of the block, counting down from its last.
4241
LD (BC),A 02
Store Register A into the byte Register Pair BC stands on, the matching byte of the destination.
4242
RET Z C8
Return on Z, the byte just copied having been the lowest of the block, with Register Pair BC holding the address it went to.
4243
DEC BC 0B
Decrement Register Pair BC, the destination pointer, so that it stands on the byte below the one just written.
4244
DEC HL 2B
Decrement Register Pair HL, the source pointer, so that it stands on the byte below the one just read.
4245
Jump to 423DH, which tests the new source pointer and copies the next byte down.

4247H - The Stack Space Check and Out of Memory (4247H-426CH)

4247H is what the interpreter asks before it pushes anything of its own, and eight places call it: the array code at 3B84H and 3C4FH, CALL at 5375H, FOR at 5DADH, GOSUB at 5FF5H, the evaluator at 734BH, the function call at 77D6H and the parameter region at 785DH. The count comes in Register C and it counts in two byte levels and not in bytes, which is why 7349H asks for 01H and 77D4H for 04H, and the check is made against the bottom of the string space at 7153H with a margin of 6EH, 110 bytes, added to whatever was asked for. The arithmetic is a subtraction turned round: 424FH to 4256H works out 0FF92H less the string bottom and twice the count, so that the ADD HL,SP at 4259H sets the Carry Flag exactly when the Stack Pointer stands at least 110 bytes plus twice the count above it. 425CH is the general Out of memory, error 7, which bmove.asm names and which six places jump to, and the program load form at 4CD9H runs the program clear at 42B1H before it reaches here. It rebuilds the line links first, which matters because the error is usually raised in the middle of something that was moving them, and it puts the saved Stack Pointer at 718EH two below the top of memory so that the error handler unwinds to a stack that exists.

4247
PUSH HL E5
The stack space check (4247H), which eight instructions of module 1 call with the count of two byte levels in Register C: push Register Pair HL, the caller's own pointer, which the arithmetic below destroys.
4248
LD HL,(7153H) 2A 53 71
Load Register Pair HL from the word at 7153H, the bottom of the string space, which is the lowest address the stack may ever reach.
424B
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC holds the count of levels the caller put in Register C and nothing above it.
424D
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which counts the levels asked for once.
424E
ADD HL,BC 09
Add Register Pair BC to Register Pair HL a second time, which makes it twice the count, each level being two bytes.
424F
LD A,92H 3E 92
Load Register A with 92H, the low byte of 0FF92H, which is 0FFFFH less the 6DH that leaves a margin of 110 bytes once the carry is taken into account.
4251
SUB L 95
Subtract Register L from Register A, the low byte of the address the stack must stay above.
4252
LD L,A 6F
Load Register L from Register A, the low byte of the difference.
4253
LD A,0FFH 3E FF
Load Register A with 0FFH, the high byte of 0FF92H.
4255
SBC A,H 9C
Subtract Register H from Register A with the Carry Flag, the high byte of that address with the borrow from below.
4256
LD H,A 67
Load Register H from Register A, so that Register Pair HL holds 0FF92H less the string bottom and twice the count.
4257
Jump to 425CH on C, the subtraction having borrowed, which means the address asked for is above 0FF92H and no stack could satisfy it.
4259
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, which sets the Carry Flag exactly when the Stack Pointer stands at or above the string bottom plus twice the count plus 110.
425A
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back with that Carry Flag standing.
425B
RET C D8
Return on C, there being room, which is the answer every one of the eight callers goes on without testing.
425C
Out of memory (425CH), which bmove.asm names and six instructions reach: call 5A6EH, which walks the program and rebuilds every line's link, the error having usually been raised while they were being moved.
425F
LD HL,(6E9AH) 2A 9A 6E
Load Register Pair HL from the word at 6E9AH, BASEND, the top of the memory BASIC was given.
4262
DEC HL 2B
Decrement Register Pair HL, so that it stands one below that top.
4263
DEC HL 2B
Decrement Register Pair HL a second time, so that it stands two below it, which is one word of stack.
4264
LD (718EH),HL 22 8E 71
Store Register Pair HL into the word at 718EH, the Stack Pointer the statement loop saves and the error handler goes back to, so that the handler unwinds to a stack that exists however little room was left.
4267
LD DE,0007H 11 07 00
Load Register Pair DE with 0007H, the error number of Out of memory, which is the count of texts to step over in the block at 6B7CH.
426A
Jump to 5886H, the error handler, which writes that text and takes the interpreter back to command level.

426DH - The Room for the Variables, with One Collection (426DH-4290H)

426DH asks whether everything up to the address in Register Pair HL fits below the string text, and it is the test the variable area makes before it grows: the array code calls it at 3C82H, the move at 4237H calls it, and BEGIN calls it at 84BBH as it lays the memory out. The room is measured against HIPT 7178H, which the string collection leaves standing at the bottom of the packed string text, so the free space is everything between the arrays and that pointer. What makes the routine more than a comparison is the second chance: when the room is not there it collects the string space once through 46E7H and asks again, and only then gives Out of memory. It will not do that while a CHAIN is in hand, which 72D2H says, because 42F6H leaves HIPT alone for a chained program so that its variables survive the load and a collection would pack the strings against the wrong ceiling. 4286H is the comparison alone, and it is written to give the caller back both register pairs untouched: the EX DE,HL at 4287H puts the address wanted into Register Pair DE, the EX DE,HL at 428EH puts it back, and the flags CPHLDE set survive both of them and the POP DE.

426D
The room for the variables (426DH), which 3C82H, 4237H and 84BBH call with the highest address wanted in Register Pair HL: call 4286H, which compares that address with HIPT 7178H and clears the Carry Flag when it fits.
4270
RET NC D0
Return on NC, the address standing below the string text, which is the answer the callers want and the usual one.
4271
LD A,(72D2H) 3A D2 72
Load Register A with the byte at 72D2H, the flag CHAIN sets at 5680H and 56A3H while a chained program is being loaded.
4274
OR A B7
Or Register A with itself, which sets the Zero Flag when no CHAIN is in hand.
4275
Jump to 425CH on NZ, a CHAIN being in hand, which gives Out of memory rather than collect a string space whose ceiling 42F6H has deliberately left alone.
4277
PUSH BC C5
Push Register Pair BC, the caller's own value, because the collection below uses every register.
4278
PUSH DE D5
Push Register Pair DE, the caller's own value, for the same reason.
4279
PUSH HL E5
Push Register Pair HL, the address wanted, which is needed again for the second test.
427A
Call 46E7H, the string space collection, which sweeps the descriptors and packs every string in use against the top of the string area.
427D
POP HL E1
Pop Register Pair HL, which brings the address wanted back into that pair.
427E
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
427F
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
4280
Call 4286H, which compares the address wanted with HIPT 7178H as the collection has now left it.
4283
RET NC D0
Return on NC, the collection having made the room, which is the one path that recovers from a full variable area.
4284
Jump to 425CH, the room still not being there, which gives Out of memory with the string space already as tight as it will go.
4286
PUSH DE D5
The comparison (4286H), which 426DH and 4280H call: push Register Pair DE, the caller's own value, which the exchange below destroys.
4287
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address wanted into Register Pair DE so that CPHLDE can be used on it.
4288
LD HL,(7178H) 2A 78 71
Load Register Pair HL from the word at 7178H, HIPT, which stands at the bottom of the string text and so is the top of the free space.
428B
Call 434DH, CPHLDE, which compares Register Pair HL with Register Pair DE and sets the Carry Flag when the string text has already come down below the address wanted.
428E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL a second time, which puts the caller's own address back into Register Pair HL without touching the flags.
428F
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair, the flags still standing.
4290
RET C9
Return with the Carry Flag set when there is not room and clear when there is, and both register pairs exactly as the caller left them.

4291H - Every File Buffer Marked Unused (4291H-42ACH)

The last of the band, and both halves of it belong to the clearing code at 42ADH above which they stand. 4291H walks the table of file buffer addresses at 6EAEH and stores 00H in the first byte of each, which is the type byte of a file control block and marks it unused. It walks one more buffer than the FILES count at 6ECEH, the INC B at 4299H against the DEC B at 429FH, which is the buffer BEGIN takes off HIGH$ over and above the ones the program asked for and which the interpreter uses for a LOAD. 42A4H is what STARTUP calls at 8028H, and it is the whole of a cold start of the program area: every buffer marked unused, every open file closed through 4DB8H, and then the program clear at 42B1H with Register A at 00H.

4291
LD A,(6ECEH) 3A CE 6E
Every file buffer marked unused (4291H), which 42A4H calls: load Register A with the byte at 6ECEH, the count of file buffers the FILES parameter asked BEGIN for.
4294
LD B,A 47
Load Register B from Register A, that count, which the loop below counts down.
4295
LD HL,6EAEH 21 AE 6E
Load Register Pair HL with 6EAEH, the table of file buffer addresses BEGIN filled in at 7FFBH, one word for each.
4298
XOR A AF
Exclusive or Register A with itself, which makes it 00H, the type byte of a file control block that is not in use.
4299
INC B 04
Increment Register B, the count, so that the loop runs once for the extra buffer BEGIN takes off HIGH$ beyond the ones the program asked for.
429A
LD E,(HL) 5E
The loop (429AH): load Register E with the byte Register Pair HL stands on, the low byte of this buffer's address.
429B
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of that address.
429C
LD D,(HL) 56
Load Register D with the byte Register Pair HL stands on, the high byte of this buffer's address.
429D
INC HL 23
Increment Register Pair HL, so that it stands on the low byte of the next entry of the table.
429E
LD (DE),A 12
Store Register A, 00H, into the byte Register Pair DE stands on, the type byte of this buffer's file control block, which marks the file unused.
429F
DEC B 05
Decrement Register B, the count of buffers left to mark.
42A0
Jump to 429AH on NZ, there being another buffer in the table, which marks that one as well.
42A3
RET C9
Return with every one of the file control blocks marked unused and Register A holding 00H.
42A4
The cold start of the program area (42A4H), which STARTUP calls at 8028H: call 4291H, which marks every file control block unused.
42A7
Call 4DB8H, which closes every file the interpreter has open, so that nothing is left holding a directory entry.
42AA
XOR A AF
Exclusive or Register A with itself, which makes it 00H, the value the program clear below wants in Register A.
42AB
Jump to 42B1H, the program clear, which zeroes the first bytes of the program area, clears the protected program flag at 72CBH and sets VARTAB 719FH just above an empty program.

42ADH - NEW and the Clearing Code, 434DH and 4353H (42ADH-4364H)

These 184 bytes are the most referenced in module 1 after the statement loop, and a dozen of the routines already on this page point into them. NEW 42ADH clears the screen and falls into the program clear. 42B1H throws the program away: it zeroes the protected flag at 72CBH, the two line number flags at 7187H and 7186H and the first two bytes of the program text, and sets VARTAB 719FH just above them. 42C7H is where RUN with nothing after it comes in, and 42CBH is where CLEAR's own exit at 447BH jumps, which is why a CLEAR leaves the program text standing: 42CBH is below the part that throws it away. From 42CEH the code is shared by NEW, RUN, CLEAR, LOAD, MERGE, CHAIN and the Out of memory entry, and two flags decide what survives it. The MERGE flag at 72CCH, tested at 42CEH and again at 4310H, keeps the OPTION BASE setting and the 26 byte declared type table at 71A7H, and keeps every open file open, which is exactly what the manual says MERGE does. The CHAIN flag at 72D2H, tested at 42F6H, keeps the string area by leaving HIPT 7178H alone, which is how a chained program's variables survive the load. 4317H is the tail: it takes its own return address into Register Pair BC, puts the Stack Pointer two bytes below BASEND, and comes back through the RET at 434CH with a word of 0000H left on the new stack. 4322H is that tail's second entry, which the error handler jumps to at 58A1H with the return address already in Register Pair BC. Two small routines close the block and are called from everywhere: 434DH subtracts Register Pair DE from Register Pair HL to compare them, and 4353H insists that the character the text pointer stands on is the one in the byte standing after the call that reached it, stepping its own return address past that byte, which is why the byte after every CALL 4353H on this page is an @B row.

42AD
RET NZ C0
NEW (42ADH), the routine the statement address table holds for token 094H at 67D9H, entered with the Zero Flag set when the keyword stands alone: return on NZ, which goes to the statement loop at 5E3BH and gives Syntax error there for whatever follows.
42AE
Call CLS at 7E00H, which clears the display through @CLS and zeroes the print position at 713CH, so that NEW leaves a clean screen where the other callers of the code below leave the display as it was.
42B1
LD HL,(6E9EH) 2A 9E 6E
The program clear (42B1H), which LOAD calls at 4C4FH and OMERR at 4CD9H reaches through it: load Register Pair HL from the word at 6E9EH, PGMBGN, the address the program text begins at.
42B4
Call 43F1H, which is TROFF's own entry: it clears Register A with XOR A, stores that 00H into the trace flag at 72DDH and returns, so this one call turns tracing off and leaves Register A at 00H for the six stores below.
42B7
LD (72CBH),A 32 CB 72
Store Register A into the byte at 72CBH, the protected program flag, so that a program loaded with protection no longer protects the empty text that is left.
42BA
LD (7187H),A 32 87 71
Store Register A into the byte at 7187H, one of the two flags that say the program text is not in its settled state.
42BD
LD (7186H),A 32 86 71
Store Register A into the byte at 7186H, the flag that says the program holds resolved line references, which GOTO sets to 0DH at 6036H: an empty program holds none.
42C0
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the first byte of the program text, which is the low byte of the first line's link.
42C1
INC HL 23
Increment Register Pair HL onto the second byte of the text.
42C2
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, so that the link now reads 0000H and the statement loop's test at 5492H finds no program at all.
42C3
INC HL 23
Increment Register Pair HL past that second byte, so that Register Pair HL addresses the first free byte above the empty program.
42C4
LD (719FH),HL 22 9F 71
Store Register Pair HL into the word at 719FH, VARTAB, the start of the simple variables, which stands immediately above the program text.
42C7
LD HL,(6E9EH) 2A 9E 6E
The entry RUN with nothing after it uses (42C7H), which 5FDFH jumps to: load Register Pair HL from the word at 6E9EH, PGMBGN, the program text's own start.
42CA
DEC HL 2B
Decrement Register Pair HL to the byte below the program, which is where a text pointer stands before the first line is read.
42CB
LD (7184H),HL 22 84 71
The entry CLEAR uses (42CBH), which 447BH jumps to and which is below the part that throws the program away: store Register Pair HL into the word at 7184H, the cell the text pointer waits in.
42CE
LD A,(72CCH) 3A CC 72
Load Register A from the byte at 72CCH, the MERGE flag, which holds the MERGE token when the statement that reached here was a MERGE or a CHAIN MERGE and 00H otherwise.
42D1
OR A B7
OR Register A with itself, which sets the Zero Flag when no merge is in hand.
42D2
Jump to 42E7H on NZ, a merge being in hand, which keeps the OPTION BASE setting and the declared type table below: the manual says that a MERGE retains the types declared by DEFINT, DEFSNG, DEFDBL and DEFSTR and the current OPTION BASE, and this jump is the whole of it.
42D4
XOR A AF
Clear Register A with XOR A, making 00H, the value the two OPTION BASE bytes are to be cleared to.
42D5
LD (72A4H),A 32 A4 72
Store Register A into the byte at 72A4H, the flag that says an OPTION BASE statement has been obeyed, so that a new program may set the base again.
42D8
LD (72A3H),A 32 A3 72
Store Register A into the byte at 72A3H, the OPTION BASE value itself, which goes back to 0 and so to subscripts counted from zero. CHAIN writes both of these back after the load whether or not a merge was asked for, which is B302.
42DB
LD B,1AH 06 1A
Load Register B with 1AH, 26, the number of letters of the alphabet and so the number of bytes of the declared type table.
42DD
LD HL,71A7H 21 A7 71
Load Register Pair HL with 71A7H, the first byte of that table, which is the letter A's.
42E0
LD (HL),04H 36 04
The type table loop (42E0H): store 04H into the byte Register Pair HL addresses, the count of bytes a single precision value takes, which is the type an undeclared variable has.
42E2
INC HL 23
Increment Register Pair HL onto the next letter's byte of the table.
42E3
DEC B 05
Decrement Register B, the count of letters still to be filled.
42E4
Jump back to 42E0H on NZ, which sets all 26 letters to single precision, undoing every DEFSTR, DEFINT, DEFSNG and DEFDBL the program had declared.
42E7
XOR A AF
The common part (42E7H), which the merge path jumps to: clear Register A with XOR A, making 00H.
42E8
LD (7198H),A 32 98 71
Store Register A into the byte at 7198H, the flag that says an error is being handled, which RESUME reads at 613BH: nothing is being handled once the variables are gone.
42EB
LD L,A 6F
Load Register L from Register A, making it 00H.
42EC
LD H,A 67
Load Register H from Register A as well, so that Register Pair HL holds 0000H for the two stores below.
42ED
LD (7196H),HL 22 96 71
Store Register Pair HL into the word at 7196H, the line an ON ERROR GOTO named, which the error handler reads at 58C0H: clearing it takes the program's own error handler away.
42F0
LD (719DH),HL 22 9D 71
Store Register Pair HL into the word at 719DH, OLDTXT, the text pointer a CONT would go back to, so that a CONT after this gives Can't continue.
42F3
LD HL,(7153H) 2A 53 71
Load Register Pair HL from the word at 7153H, the top of the program and variable space, which is where the string area begins.
42F6
LD A,(72D2H) 3A D2 72
Load Register A from the byte at 72D2H, the flag CHAIN sets at 5680H to say that the load now running is part of a chain.
42F9
OR A B7
OR Register A with itself, which sets the Zero Flag when no chain is in hand.
42FA
Jump to 42FFH on NZ, a chain being in hand, which leaves HIPT alone: the strings of the program that issued the CHAIN are still wanted, and this jump is what lets them survive the load.
42FC
LD (7178H),HL 22 78 71
Store Register Pair HL into the word at 7178H, HIPT, the high pointer of the string area, which gives the whole of the space between 7153H and the top back to new strings and so throws every string the program held away.
42FF
XOR A AF
Clear Register A with XOR A, making 00H, which RESTORE takes to mean that no file is in hand.
4300
Call RESTORE at 4365H, which puts the DATA pointer at 71A5H back to the start of the program, so that a READ after this takes the first DATA item of the first line.
4303
LD HL,(719FH) 2A 9F 71
Load Register Pair HL from the word at 719FH, VARTAB, the start of the simple variables, which the program clear set just above the text and which a CLEAR leaves where it was.
4306
LD (71A1H),HL 22 A1 71
Store Register Pair HL into the word at 71A1H, the start of the array table, which is also the end of the simple variables: setting it to VARTAB says that there are no simple variables.
4309
LD (71A3H),HL 22 A3 71
Store Register Pair HL into the word at 71A3H, the end of the arrays and the lowest free address, which says that there are no arrays either. These two stores together are the whole of what clearing the variables amounts to.
430C
XOR A AF
Clear Register A with XOR A, making 00H, the value the DOS error code below is to be cleared to.
430D
LD (7C4EH),A 32 4E 7C
Store Register A into the byte at 7C4EH, where DERR keeps the DOS's own error code, so that a code left over from the last file error cannot be reported again.
4310
LD A,(72CCH) 3A CC 72
Load Register A from the byte at 72CCH, the MERGE flag again, which is tested a second time because the files are a separate question from the variables.
4313
OR A B7
OR Register A with itself, which sets the Zero Flag when no merge is in hand.
4314
Call 4DB8H on Z, which closes every open file: a merge keeps its files open, which is what lets MERGE and an ASCII LOAD go on reading the program out of the file they opened, and every other caller closes them.
4317
POP BC C1
The stack tail (4317H): pop Register Pair BC, which takes this routine's own return address off the stack into Register Pair BC, because the Stack Pointer is about to be moved and the address has to be carried by hand.
4318
LD HL,(6E9AH) 2A 9A 6E
Load Register Pair HL from the word at 6E9AH, BASEND, the top of free memory and so the top of the stack.
431B
DEC HL 2B
Decrement Register Pair HL, the first of the two bytes the saved Stack Pointer stands below the top.
431C
DEC HL 2B
Decrement Register Pair HL a second time, so that Register Pair HL holds BASEND less two, which is where the stack is to be recorded as standing.
431D
LD (718EH),HL 22 8E 71
Store Register Pair HL into the word at 718EH, the cell that says where the stack stands, which the statement loop saves to and 53E3H and 6051H restore from.
4320
INC HL 23
Increment Register Pair HL back towards the top, the first of the two bytes.
4321
INC HL 23
Increment Register Pair HL a second time, so that Register Pair HL holds BASEND itself, the address the Stack Pointer is to be set to.
4322
LD SP,HL F9
The entry the error handler uses (4322H), which 58A1H jumps to with the return address already in Register Pair BC and Register Pair HL loaded from 718EH: load the Stack Pointer from Register Pair HL, which throws away every frame of every FOR, WHILE and GOSUB the program had built.
4323
LD HL,7157H 21 57 71
Load Register Pair HL with 7157H, the first byte of the pool of temporary string descriptors.
4326
LD (7155H),HL 22 55 71
Store Register Pair HL into the word at 7155H, the pointer to the next free temporary descriptor, which gives the whole pool back.
4329
Call 67BCH, which clears the byte at 72F1H with Register A kept across the call, a flag of the expression evaluator's that must not be left set when the stack has just been cut back.
432C
Call 4137H, which clears the printer flag at 6E92H, so that output goes to the display again whatever LPRINT or LLIST had left.
432F
Call 634BH, which clears the printer flag again and both bytes of FILEX 6E98H, so that there is no file in hand and the keyboard input code reads the keyboard.
4332
XOR A AF
Clear Register A with XOR A, making 00H, the value the six cells below are cleared to.
4333
LD H,A 67
Load Register H from Register A, making it 00H.
4334
LD L,A 6F
Load Register L from Register A as well, so that Register Pair HL holds 0000H.
4335
LD (71C3H),HL 22 C3 71
Store Register Pair HL into the word at 71C3H, the length of the parameter region of a user-defined function call in force, which a cut stack leaves meaningless: clearing it is part of throwing away every function call that was in flight.
4338
LD (7294H),A 32 94 72
Store Register A into the byte at 7294H, the flag that makes the variable search walk that parameter region before the simple variables, which must not be left set when no function call stands.
433B
LD (722BH),HL 22 2B 72
Store Register Pair HL into the word at 722BH, the length of the parameter block a function definition carries, which 7874H copies into 71C3H when the function is called.
433E
LD (7297H),HL 22 97 72
Store Register Pair HL into the word at 7297H, the count of user-defined function calls in flight, which 788DH raises and 78D2H lowers and which the flag above is set from.
4341
LD (71C1H),HL 22 C1 71
Store Register Pair HL into the word at 71C1H, the last of the four words cleared here, which is the pointer to the parameter region saved under the one in force and so ends the chain the string space collection walks at 4734H.
4344
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H, the flag that makes the variable search demand or refuse an array, which CALL, SWAP, DIM and ERASE all set and which must not be left set for the next statement.
4347
PUSH HL E5
Push Register Pair HL, the 0000H, which is the word this routine deliberately leaves on the new stack: the error handler's 58A4H pops it and throws it away.
4348
PUSH BC C5
Push Register Pair BC, the return address taken at 4317H or handed in at 4322H, which the RET below goes to.
4349
LD HL,(7184H) 2A 84 71
Load Register Pair HL from the word at 7184H, the text pointer the caller left there, which is what the caller is given back in Register Pair HL.
434C
RET C9
Return to the address pushed above, with the text pointer in Register Pair HL and a word of 0000H standing on the new stack.
434D
LD A,H 7C
The sixteen bit comparison (434DH), which more than forty rows of this page call: load Register A from Register H, the high byte of Register Pair HL.
434E
SUB D 92
Subtract Register D from Register A, the high byte of Register Pair DE.
434F
RET NZ C0
Return on NZ with the Zero Flag clear and the Carry Flag set when Register Pair HL stands below Register Pair DE, the high bytes having settled it.
4350
LD A,L 7D
Load Register A from Register L, the low byte of Register Pair HL, the high bytes being equal.
4351
SUB E 93
Subtract Register E from Register A, the low byte of Register Pair DE.
4352
RET C9
Return with the Zero Flag set when the two pairs are equal and the Carry Flag set when Register Pair HL stands below Register Pair DE. Neither register pair is altered, which is why this and not a SBC HL,DE is what the interpreter compares with.
4353
LD A,(HL) 7E
The character demand (4353H), which fifteen rows of this page call and whose own caller carries the character it wants in the byte after the call: load Register A with the byte Register Pair HL addresses, the character the text pointer stands on.
4354
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings this routine's return address into Register Pair HL, so that Register Pair HL now addresses the byte standing after the call.
4355
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, which is that byte: the character the caller demands.
4356
Jump to 4362H on NZ, the line not carrying the character the caller wants, which prints Syntax error.
4358
INC HL 23
Increment Register Pair HL past that byte, which steps this routine's own return address over the data the caller put after the call, so that the caller resumes at the instruction beyond it.
4359
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses again, which puts the stepped return address back on the stack and brings the text pointer back into Register Pair HL.
435A
INC HL 23
Increment Register Pair HL past the character just matched, so that the text pointer stands on what follows it.
435B
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that following character.
435C
CP 3AH FE 3A
Compare Register A with 3AH, a colon, which is NXTCHAR's own test for the end of a statement.
435E
RET NC D0
Return on NC, the character standing at a colon or above, which is a token or a colon and needs none of the work NXTCHAR does for a blank or a digit.
435F
Jump to 5E98H, NXTCHAR two bytes in, which skips blanks and sorts a digit from a letter without stepping the pointer first, and whose RET goes to the caller of this routine.
4362
Jump to SYNERR 586CH, which prints Syntax error: this is where every unmatched character of every CALL 4353H on the page ends up.

4365H - RESTORE: Reset the DATA Pointer (4365H-437EH)

RESTORE sends the pointer that READ takes its next item from back to the beginning of the program, or to a line the user names. It is the first statement routine of module 1 to be written out, and like every other one it is reached only through the statement address table at 67C3H: no instruction anywhere in the loaded image, and no word of it, holds 4365H other than the table's own entry for token 08CH and the two calls at 4300H and 56D0H that the rest of the interpreter makes. The dispatcher at 5E7BH turns the statement token into an index, takes the word out of the table at 5E8EH, pushes it, and falls into NXTCHAR at 5E93H, whose return enters the routine with Register Pair HL at the character after the token, the Zero Flag set when the statement has ended there, and the address of the statement loop at 5E3BH on the stack. RESTORE uses that flag to tell `RESTORE` from `RESTORE nnn`: with the statement ended it takes the program start out of PGMBGN at 6E9EH, and with a line reference following it it reads the number, calls FIND at 5AB4H for the line and gives Undefined line number when there is no such line. Either way the pointer is decremented by one before it is stored, because the READ code steps forward before it reads.

4365
EX DE,HL EB
RESTORE (4365H), the routine the statement address table holds for token 08CH: exchange Register Pair DE with Register Pair HL, which puts the text pointer into Register Pair DE and leaves the flags alone, so the Zero Flag that NXTCHAR at 5E93H set, set when the statement ended at the RESTORE token, still stands.
4366
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL from the word at 6E9EH, PGMBGN, the pointer to the first byte of the program, which is where the DATA pointer goes when RESTORE is given no line.
4369
Jump to 4379H on Z, the statement having ended at the token, so that the program start in Register Pair HL is the value stored and no line is looked for.
436B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again: Register Pair HL is the text pointer once more and Register Pair DE holds the program start, which the line search throws away.
436C
Call 5FA4H, which steps back one character, takes the next one through NXTCHAR at 5E93H and tests it against 0EH and 0DH, the two tokens the tokenizer puts before a line reference: Register Pair DE comes back holding the line number out of the word at 7149H, where NXTCHAR leaves the value of a number it has just passed, and 0000H when the character is neither token.
436F
PUSH HL E5
Push Register Pair HL, the text pointer standing after the line reference, which the line search destroys.
4370
Call FIND at 5AB4H, the routine NEWB/EQU names: it walks the program's line links from PGMBGN for the line number in Register Pair DE and comes back with the address of that line's link word in Register Pair BC and the Carry Flag set when the line is there.
4373
LD H,B 60
Load Register H with Register B, the high byte of the address FIND returned.
4374
LD L,C 69
Load Register L with Register C, the low byte, so that Register Pair HL holds the address of the line's own link word.
4375
POP DE D1
Pop Register Pair DE, bringing back the text pointer saved at 436FH, which the statement has to leave in Register Pair HL when it returns.
4376
Jump to 6040H on No Carry, where Register E is loaded with 08H and the error handler at 5886H shows Undefined line number, the eighth text of the error message block at 6B7CH.
4379
DEC HL 2B
Decrement Register Pair HL, so that the pointer stands one byte below the line rather than on it, which is the form the READ code at 649EH takes out of the cell and steps forward from.
437A
LD (71A5H),HL 22 A5 71
Store Register Pair HL into the word at 71A5H, the DATA pointer, which READ reads at 649EH and which nothing else in the loaded image writes.
437D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, putting the text pointer back into Register Pair HL for the return.
437E
RET C9
Return to the statement loop at 5E3BH, whose address the dispatcher pushed at 5E79H, with Register Pair HL standing at the character after the statement.

437FH - STOP and END: Stop the Program (437FH-43C0H)

STOP and END share one piece of code and differ in one register. Both are reached through the statement address table at 67C3H, STOP as token 090H and END as token 081H, and the BREAK key reaches STOP as well: the check the statement loop makes before every statement, at 7CD5H, clears Register A and jumps to 437FH when BREAK is down, so that pressing BREAK and running a STOP take exactly the same path. The difference is the value in Register A when the shared tail at 43BBH tests it. STOP arrives with the Zero Flag set and increments Register A to 01H, so the tail shows Break in nnn through 58FDH; END clears Register A, so the tail jumps to 591FH and nothing is shown. END also closes every open file on its way, which STOP does not, because a stopped program may be continued. Both save where they stopped: the text pointer into SAVTXT at 718CH and from there into OLDTXT at 719DH, and the current line number out of 6E9CH into OLDLIN at 719BH, which is the state CONT at 43DCH puts back. Neither save is made when 6E9CH holds 0FFFFH, the value 593BH writes at command level, because a direct statement is nothing to continue. The tail is shared further: 4F22H and 5838H both jump into it at 439AH.

437F
RET NZ C0
STOP (437FH), the routine the statement address table holds for token 090H and the address the BREAK check at 7CDCH jumps to: return on NZ, which hands a character standing after the token back to the statement loop at 5E3BH, where 5E4BH gives Syntax error for it.
4380
INC A 3C
Increment Register A, which the BREAK check left at 00H and which the dispatcher leaves at 00H when the statement has ended, so that Register A is 01H and the test at 43BBH takes the branch that shows the Break message.
4381
Jump to 438DH, the code END and STOP share, passing over END's own two instructions so that the open files are left open and the program can be continued.
4383
RET NZ C0
END (4383H), the routine the statement address table holds for token 081H: return on NZ, which hands a character standing after the token back to the statement loop in the same way.
4384
XOR A AF
Clear Register A, which sets the Zero Flag for the conditional call that follows and leaves 00H for the test at 43BBH, the value that shows no message.
4385
LD (7198H),A 32 98 71
Store Register A into the byte at 7198H, the flag that says an error is being handled: RESUME at 613BH reads it and the ON ERROR code at 6162H, 616EH and 6189H writes it, so ending the program takes the interpreter out of the error handler.
4388
PUSH AF F5
Push Register Pair AF, keeping the 00H and its Zero Flag over the call that follows.
4389
Call 4DB8H on Z, which is always taken here: it pushes Register Pair DE and Register Pair BC, clears Register A and calls the CLOSE statement at 4D85H, where a file number of 00H means every open file, and comes back with Register A at 00H.
438C
POP AF F1
Pop Register Pair AF, bringing back the 00H and the Zero Flag saved at 4388H.
438D
LD (718CH),HL 22 8C 71
The code STOP and END share: store Register Pair HL, the text pointer standing after the statement, into the word at 718CH, SAVTXT, which the error handler at 58AAH and the INPUT code at 63B4H read as well.
4390
LD HL,7157H 21 57 71
Load Register Pair HL with 7157H, the first byte of the pool of temporary string descriptors.
4393
LD (7155H),HL 22 55 71
Store Register Pair HL into the word at 7155H, the pointer to the next free descriptor of that pool, which gives every temporary string back; 4326H does the same thing at the start of a statement and 46F5H in the string code.
4396
LD HL,0FFF6H 21 F6 FF
Load Register Pair HL with 0FFF6H. Falling in from 4393H the value is thrown away three instructions later by the load at 439AH, so as an instruction these three bytes do nothing; they are here for their operand. 4397H is an entry point, which INPUT jumps to at 640AH and LINE INPUT at 6373H when the keyboard line reader reports that BREAK was pressed, and there the two bytes 0F6H and 0FFH are an OR 0FFH, which puts 0FFH into Register A and leaves the Zero Flag clear so that the tail below writes Break at 43BBH instead of ending quietly at 43BEH. The author wrapped that instruction in a LD HL so that END and STOP could fall straight through it without a jump.
4399
POP BC C1
Pop Register Pair BC, which throws away the return address the dispatcher pushed at 5E79H: the program is stopping, so control does not go back to the statement loop.
439A
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL from the word at 6E9CH, the number of the line being run, which 5E5AH writes out of each line's own header and which 593BH sets to 0FFFFH at command level. 4F22H and 5838H both jump here, so this is the entry for stopping without closing a file or saving a flag.
439D
PUSH HL E5
Push Register Pair HL, that line number, which the two exits of the tail take off the stack again, 58FDH with its own POP HL at 5902H or 590BH and 591FH with the POP BC that the byte 0C1H of the instruction at 591EH forms.
439E
PUSH AF F5
Push Register Pair AF, the 00H of END or the 01H of STOP, which the tail pops back at 43B7H after the two calls that follow.
439F
LD A,L 7D
Load Register A with Register L, the low byte of the line number.
43A0
AND H A4
AND Register H into Register A, so that Register A is 0FFH only when both halves of the line number are 0FFH.
43A1
INC A 3C
Increment Register A, which sets the Zero Flag when the line number was 0FFFFH, the command level value.
43A2
Jump to 43ADH on Z: the statement was typed at the keyboard rather than run from a line, so there is nothing for CONT to go back to and neither cell is written.
43A4
LD (719BH),HL 22 9B 71
Store Register Pair HL, the line number, into the word at 719BH, OLDLIN, which CONT reads at 43E7H and the error handler writes at 58B9H.
43A7
LD HL,(718CH) 2A 8C 71
Load Register Pair HL from the word at 718CH, SAVTXT, the text pointer stored at 438DH.
43AA
LD (719DH),HL 22 9D 71
Store Register Pair HL into the word at 719DH, OLDTXT, which CONT reads at 43DCH and gives back as its own return value, and which NEW at 42F0H clears.
43AD
XOR A AF
Clear Register A, both for the store that follows and for the two calls, which do not read it.
43AE
LD (6E97H),A 32 97 6E
Store Register A into the byte at 6E97H, the flag that suppresses output: the character routine tests it at 414BH and throws the character away at 46D8H when it is not 00H, so stopping puts the display back on. READY at 5924H and the error handler at 58D6H clear it in the same way.
43B1
Call 4137H, which clears the byte at 6E92H, the flag that LPRINT at 620DH and LLIST at 79B0H set to send characters to the printer, so that what is shown next goes to the display.
43B4
Call 41E9H, which reads the print position at 713CH and returns at once when it is 00H, and otherwise sends a carriage return through 40D8H, so that the message starts at the left of a fresh line.
43B7
POP AF F1
Pop Register Pair AF, bringing back the 00H of END or the 01H of STOP pushed at 439EH, with the flags the increment at 43A1H left.
43B8
LD HL,7334H 21 34 73
Load Register Pair HL with 7334H, the text `Break`, the third of the three command level texts that stand at 7328H.
43BB
Jump to 58FDH on NZ, which is STOP's path and the BREAK key's: 58FDH shows the text at Register Pair HL through 46A5H, pops the line number pushed at 439DH, and adds ` in ` and the number to it unless the line number is 0FFFFH.
43BE
Jump to 591FH, which is END's path: the byte 0C1H that the instruction at 591EH is built from is a POP BC of its own, which throws away the line number pushed at 439DH, and the code falls into READY at 5920H with nothing shown.

43C1H - The Control Key Echo, Which Nothing Reaches (43C1H-43DBH)

These twenty-seven bytes show a control key on the display as a circumflex and a letter, and clear the printer flag at 6E92H and the output suppression flag at 6E97H when the key was 03H. Nothing in the loaded image reaches them. No instruction of module 1, of module 2, of BASIC/OV1 or of BASIC/OV2 names 43C1H or any address inside the block, no word of any of the four images holds one, and no relative jump can reach the block from outside module 1 because 2600H and 1E00H are both more than 127 bytes away; the statement address table at 67C3H does not hold the address either. Inside the block one further thing cannot happen: Register A is loaded with 0FH by the first instruction, so the subtraction of 03H never gives zero and the two stores at 43C8H and 43CBH are never made, which leaves the block as the echo of one fixed key, CTRL and O. The rows are written because every byte of the file goes on exactly one row, and the finding is recorded as B297.

43C1
LD A,0FH 3E 0F
Load Register A with 0FH, the control code of CTRL and O, which in Microsoft BASIC turns the display of output off and on. The value is fixed here, so the block can echo no other key. Nothing in the loaded image reaches this instruction or any address above it as far as 43DBH, which is B297.
43C3
PUSH AF F5
Push Register Pair AF, keeping that code over the subtraction and the first character display.
43C4
SUB 03H D6 03
Subtract 03H from Register A, the control code of CTRL and C, so that the Zero Flag is set only for that key. With 0FH in Register A the result is 0CH and the flag is clear every time.
43C6
Jump to 43CEH on NZ, which is every time, over the two stores that CTRL and C would have made.
43C8
LD (6E92H),A 32 92 6E
Store Register A into the byte at 6E92H, the flag that sends characters to the printer, which the character routine reads at 40DFH. Register A would hold 00H here, so this would put the output back on the display.
43CB
LD (6E97H),A 32 97 6E
Store Register A into the byte at 6E97H, the flag that suppresses output, which the character routine reads at 414BH and acts on at 46D8H. This would put the display back on as well, and END does both of these things at 43AEH and 43B1H.
43CE
LD A,5EH 3E 5E
Load Register A with 5EH, the circumflex that stands in front of the letter of a control key.
43D0
Call the one character output routine at 40D8H, which sends Register A to the open file when FILEX at 6E98H is set, to the printer when 6E92H is set, and otherwise to the display.
43D3
POP AF F1
Pop Register Pair AF, bringing back the control code pushed at 43C3H.
43D4
ADD A,40H C6 40
Add 40H to Register A, which turns a control code into its letter: 0FH becomes 4FH, the letter O, and 03H would become 43H, the letter C.
43D6
Call the one character output routine at 40D8H again, this time with the letter.
43D9
Jump to 41F5H, which sends a carriage return through 40D8H and returns to whatever called the block.

43DCH - CONT, TRON and TROFF (43DCH-43F5H)

CONT puts back the two cells END and STOP saved and leaves the saved text pointer in Register Pair HL, which is all that is needed: the statement loop takes Register Pair HL as the place to carry on from. When nothing was saved, OLDTXT at 719DH holding 0000H, it gives error 17, Can't continue, the seventeenth text of the block at 6B7CH. TRON and TROFF are six bytes between them and share all but one: TRON at 43F0H loads Register A with 0AFH and stores it in the trace flag at 72DDH, and TROFF is the address of that 0AFH operand byte itself, which as an instruction is XOR A, so entering one byte later stores 00H instead. The flag is read in one place, at 5E5DH in the statement loop, where a value other than 00H makes the loop show the number of each line it is about to run between square brackets through NUMDSP at 3139H.

43DC
LD HL,(719DH) 2A 9D 71
CONT (43DCH), the routine the statement address table holds for token 099H: load Register Pair HL from the word at 719DH, OLDTXT, the text pointer END or STOP stored at 43AAH, which NEW clears at 42F0H.
43DF
LD A,H 7C
Load Register A with Register H, the high byte of that pointer.
43E0
OR L B5
OR Register L into Register A, so that the Zero Flag is set only when the whole word is 0000H, which is the state after a NEW or after a program that has never been stopped.
43E1
LD DE,0011H 11 11 00
Load Register Pair DE with 0011H, error 17, Can't continue, which the error handler takes in Register E; Register D is left at 00H and is not read.
43E4
Jump to the error handler at 5886H on Z, which shows Can't continue and goes back to command level. Register Pair HL is 0000H on this path and the handler does not read it.
43E7
LD DE,(719BH) ED 5B 9B 71
Load Register Pair DE from the word at 719BH, OLDLIN, the number of the line END or STOP was in, stored at 43A4H.
43EB
LD (6E9CH),DE ED 53 9C 6E
Store Register Pair DE into the word at 6E9CH, the number of the line being run, so that the program carries on believing it is in the line it stopped in and an error from here on is reported against that line.
43EF
RET C9
Return to the statement loop at 5E3BH with Register Pair HL holding the saved text pointer, which is where execution goes on: the loop reads the character there and either steps to the next statement or follows the line link.
43F0
LD A,0AFH 3E AF
TRON (43F0H), the routine the statement address table holds for token 0A3H: load Register A with 0AFH, a value that is not 00H, so that the store that follows turns the trace on. The operand byte at 43F1H is itself the entry TROFF, which the statement address table holds for token 0A4H, and as an instruction 0AFH is XOR A, so TROFF clears Register A and falls into the same store.
43F2
LD (72DDH),A 32 DD 72
Store Register A into the byte at 72DDH, the trace flag, which the statement loop reads at 5E5DH and nothing else in the loaded image reads or writes.
43F5
RET C9
Return to the statement loop at 5E3BH. Neither statement looks at what follows it on the line, so TRON and TROFF with anything after them give Syntax error from the loop at 5E4BH rather than from here.

43F6H - SWAP: Exchange Two Variables (43F6H-4436H)

SWAP exchanges the values of two variables of the same type. It finds the first variable, copies its value into the eight byte area at 72D5H, finds the second, and then copies the second's value into the first and the area's copy into the second. Two things are checked. The types have to match, which is the comparison at 4415H, and finding the second variable must not have created a new one: the pointer to the start of the array table at 71A1H is taken before the second search and compared with it afterwards at 441FH, because a new simple variable moves the arrays up and the first variable's address with them. Either fault gives a message rather than a wrong answer, Type mismatch for the first and Illegal function call for the second. The value move itself is the routine at 2946H in BASIC/OV1, which copies as many bytes as the type byte at 7142H says, so the same four instructions serve an integer of two bytes and a double precision number of eight. The expected comma between the two variables is the byte at 440CH, which is not an instruction: the routine at 4353H reads the byte standing after the call that reached it, compares it with the character the text pointer is on and steps its own return address past it.

43F6
SWAP (43F6H), the routine the statement address table holds for token 0A5H: call the variable search at 39FBH, which reads the name at Register Pair HL and returns the address of its value in Register Pair DE and in Register Pair BC, creating the variable when it is new, and leaves the type in the byte at 7142H.
43F9
PUSH DE D5
Push Register Pair DE, the address of the first variable's value, which is wanted again at the end.
43FA
PUSH HL E5
Push Register Pair HL, the text pointer standing after the first name.
43FB
LD HL,72D5H 21 D5 72
Load Register Pair HL with 72D5H, the eight byte area that holds the first variable's value while the second is being found.
43FE
Call the value move at 2946H in BASIC/OV1, which copies the number of bytes the type byte at 7142H holds from the address in Register Pair DE to the address in Register Pair HL: the first variable's value goes into the area at 72D5H.
4401
LD HL,(71A1H) 2A A1 71
Load Register Pair HL from the word at 71A1H, the pointer to the start of the array table, which is also the end of the simple variables and which moves up whenever a new simple variable is made.
4404
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer points at: Register Pair HL is the text pointer again and the array table pointer takes its place on the stack.
4405
Call 76A4H, which reads the type byte at 7142H and returns it in Register A less 03H, with the Carry Flag set for a type below 08H.
4408
PUSH AF F5
Push Register Pair AF, keeping the first variable's type over the search for the second.
4409
Call 4353H, which insists that the character the text pointer is on is the one in the byte standing after this call, steps its own return address past that byte and takes the next character of the line: a comma is required here and anything else gives Syntax error at 4362H.
440C
DEFB 2CH 2C
The comma that 4353H compares the character with. It is read as data by the routine the call at 4409H reaches, not executed, and the instruction after the call is the one at 440DH.
440D
Call the variable search at 39FBH again for the second name, which returns the address of its value in Register Pair DE and in Register Pair BC and sets the type byte at 7142H for it.
4410
POP AF F1
Pop Register Pair AF, bringing back the first variable's type saved at 4408H.
4411
LD B,A 47
Load Register B with Register A, that first type, where the comparison takes it from.
4412
Call 76A4H again, which now returns the second variable's type in Register A in the same form.
4415
CP B B8
Compare Register A with Register B: the two types have to be the same byte for the exchange to mean anything, a two byte integer and an eight byte double precision number having nothing in common.
4416
Jump to 5884H on NZ, where Register E is loaded with 0DH and the error handler at 5886H shows Type mismatch, the thirteenth text of the block at 6B7CH.
4419
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer points at: Register Pair HL is the array table pointer taken at 4401H and the text pointer goes back on the stack.
441A
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE is that old array table pointer and Register Pair HL is the address of the second variable's value.
441B
PUSH HL E5
Push Register Pair HL, the second variable's address, over the comparison.
441C
LD HL,(71A1H) 2A A1 71
Load Register Pair HL from the word at 71A1H again, the array table pointer as it stands now that the second variable has been looked for.
441F
Call the comparison at 434DH, which subtracts Register Pair DE from Register Pair HL a byte at a time and sets the Zero Flag when the two are equal.
4422
Jump to 4434H on NZ: the second search made a new simple variable, which moved the arrays and may have moved the first variable, so the exchange is refused with Illegal function call rather than carried out on an address that no longer holds what it held.
4424
POP DE D1
Pop Register Pair DE, the address of the second variable's value, pushed at 441BH.
4425
POP HL E1
Pop Register Pair HL, the text pointer, pushed at 4419H.
4426
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer points at: Register Pair HL is the address of the first variable's value, pushed at 43F9H, and the text pointer goes back on the stack for the return.
4427
PUSH DE D5
Push Register Pair DE, the address of the second variable's value, which is wanted once more after the first move.
4428
Call the value move at 2946H: the second variable's value, at the address in Register Pair DE, is copied over the first variable, at the address in Register Pair HL.
442B
POP HL E1
Pop Register Pair HL, the address of the second variable's value, pushed at 4427H.
442C
LD DE,72D5H 11 D5 72
Load Register Pair DE with 72D5H, the area holding the first variable's own value.
442F
Call the value move at 2946H again: the saved value goes into the second variable, and the exchange is done.
4432
POP HL E1
Pop Register Pair HL, the text pointer saved at 4426H, which the statement has to leave in Register Pair HL.
4433
RET C9
Return to the statement loop at 5E3BH, which reads the character at Register Pair HL and gives Syntax error for anything but a colon or the end of the line, so SWAP takes one pair of variables and no list.
4434
The refusal both SWAP and ERASE use: jump to FUNCERR at 5F95H, the entry NEWB/EQU names, which shows Illegal function call, the fifth text of the block at 6B7CH.

4437H - ERASE and Two Fragments Beside It (4437H-447AH)

ERASE takes an array out of memory and gives its space back: it finds the array, works out where its bytes end, copies everything above it down over it and lowers the pointer to the lowest free address at 71A3H by as much. A comma lets one statement erase several arrays, the jump at 446EH going back to the top for each. The flag at 7182H is what makes the variable search behave differently here: set to 01H it says that the name must be an array that already exists, so a name that is not one comes back with the Zero Flag clear and the statement is refused with Illegal function call through the entry SWAP leaves at 4434H. Two small pieces of other routines follow ERASE and are written here because they lie between it and CLEAR. The three bytes at 4470H are an exit of the file code, reached only from 4F95H. The eight bytes at 4473H are the test for a capital letter that the variable search calls at 3A00H and the DEF code at 5F54H and 5F6AH.

4437
LD A,01H 3E 01
ERASE (4437H), the routine the statement address table holds for token 0A6H: load Register A with 01H, the value that tells the variable search to look for an array that is already there and not to make one.
4439
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H, the flag the variable search reads at 3A7AH and writes at 3A90H, which the DIM code at 5D5CH and the array code at 535FH, 54BEH, 54D0H and 5516H set in the same way.
443C
Call the variable search at 39FBH, which with that flag set returns the array's address in Register Pair BC, the number of bytes it occupies in Register Pair DE, Register A at 00H and the Zero Flag set when the name is an array that exists.
443F
Jump to 4434H on NZ, SWAP's own refusal, which shows Illegal function call: the name was not an array, or was an array that had never been dimensioned.
4441
PUSH HL E5
Push Register Pair HL, the text pointer standing after the name, which the copying destroys.
4442
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H again. Register A holds the 00H the search left, which is the same 00H the branch at 443FH tested, so this clears the flag and the next variable search behaves as it does everywhere else.
4445
LD H,B 60
Load Register H with Register B, the high byte of the array's address.
4446
LD L,C 69
Load Register L with Register C, the low byte, so that Register Pair HL holds the address of the array's own data.
4447
DEC BC 0B
Decrement Register Pair BC, the first of three steps back from the data to the length word and the name that stand in front of it.
4448
DEC BC 0B
Decrement Register Pair BC a second time, the second of the three steps that take it from the array's data back to the last character of its name.
4449
DEC BC 0B
Decrement Register Pair BC a third time, which puts it on the last character of the array's name.
444A
LD A,(BC) 0A
Load Register A from the byte at Register Pair BC, a character of the name.
444B
DEC BC 0B
Decrement Register Pair BC, stepping back to the character before it.
444C
OR A B7
OR Register A with itself, which sets the Sign Flag when bit 7 of the character is set, the bit that marks a character of the name as not the last one.
444D
Jump to 444AH on M, going on back through the name until a character without that bit is reached, so that Register Pair BC ends one byte below the whole entry whatever the length of the name.
4450
DEC BC 0B
Decrement Register Pair BC, the first of the two steps that take it over the two bytes the name is preceded by.
4451
DEC BC 0B
Decrement Register Pair BC a second time: Register Pair BC is now the first byte of the entry, which is where the bytes above are copied to.
4452
ADD HL,DE 19
Add Register Pair DE to Register Pair HL: Register Pair HL is the array's data plus its length, the first byte above the array.
4453
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE is the first byte above the array, the source of the copy, and Register Pair HL takes the sum away.
4454
LD HL,(71A3H) 2A A3 71
Load Register Pair HL from the word at 71A3H, the end of the arrays and the lowest free address, which BMOVE/ASM names LOPT and which is the address the copy stops at.
4457
Call the comparison at 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when they are equal, so that the loop ends when the source has reached the end of the arrays.
445A
LD A,(DE) 1A
Load Register A from the byte at Register Pair DE, one byte from above the array.
445B
LD (BC),A 02
Store Register A into the byte at Register Pair BC, which is the same byte's new place, lower in memory by the size of the whole entry.
445C
INC DE 13
Increment Register Pair DE, the address the next byte of the copy is taken from, which walks up towards the end of the arrays at 71A3H.
445D
INC BC 03
Increment Register Pair BC, the address the next byte of the copy is written to, which stays below Register Pair DE by the size of the erased entry.
445E
Jump to 4457H on NZ to compare and copy again, so that one byte is always copied before the first test and the loop moves everything from above the array down to the end of the arrays.
4460
DEC BC 0B
Decrement Register Pair BC, taking back the last increment, so that Register Pair BC holds the new end of the arrays.
4461
LD H,B 60
Load Register H with Register B, the high byte of that address.
4462
LD L,C 69
Load Register L with Register C, the low byte.
4463
LD (71A3H),HL 22 A3 71
Store Register Pair HL into the word at 71A3H: the arrays end lower by as many bytes as the erased array took, and the string space below is that much bigger.
4466
POP HL E1
Pop Register Pair HL, the text pointer pushed at 4441H.
4467
LD A,(HL) 7E
Load Register A from the byte at Register Pair HL, the character standing after the name that has just been erased.
4468
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which is what stands between the names of a list of arrays.
446A
RET NZ C0
Return to the statement loop at 5E3BH on NZ, the statement being finished; the loop gives Syntax error for anything there that is not a colon or the end of the line.
446B
Call NXTCHAR at 5E93H, which steps the text pointer past the comma and brings back the first character of the next name.
446E
Jump to 4437H to erase that one as well, which sets the flag at 7182H again for it.
4470
POP AF F1
An exit of the file code, reached only by the jump at 4F95H: pop Register Pair AF, which throws away a word of the stack.
4471
POP HL E1
Pop Register Pair HL, which throws away a second word and brings a text pointer back into Register Pair HL.
4472
RET C9
Return to whatever called the routine that jumped here.
4473
LD A,(HL) 7E
The test for a capital letter, called by the variable search at 3A00H and by the DEF code at 5F54H and 5F6AH: load Register A from the byte at Register Pair HL, the character to be tested.
4474
CP 41H FE 41
Compare Register A with 41H, the letter A, the lowest character a name may begin with.
4476
RET C D8
Return on Carry, the character being below the letter A, with the Carry Flag set to say that it is not a letter.
4477
CP 5BH FE 5B
Compare Register A with 5BH, the character one past the letter Z.
4479
CCF 3F
Complement the Carry Flag, which turns the comparison round: the Carry Flag comes back clear for a character from 41H to 5AH and set for anything above 5AH, so one flag answers the whole test.
447A
RET C9
Return with the Carry Flag clear for a capital letter and set for anything else, and with the character still in Register A.

447BH - CLEAR: Give the Variables Back and Set the Memory Sizes (447BH-4526H)

CLEAR closes every open file, throws every variable away and, with arguments, moves the two boundaries BASIC keeps above the program text. The manual's syntax table gives two forms, CLEAR with one expression for Compiler BASIC and the version 5 interpreter, where the expression is the string space to reserve, and CLEAR with an optional mem and an optional stack for version 6, each introduced by a comma with the first argument position left empty. This code takes both: an expression in the first position is evaluated and refused when it is negative, and then nothing whatever is done with it, which is B298. The mem argument is the highest address BASIC may use and is refused above the word at 7151H, which NEWB/EQU names OLDHI and which holds HIGH$ as BASIC found it. The stack argument is the space between the top of the program and variable space at 7153H and the top of free memory at 6E9AH, which the manual calls the stack and gives a default of 512 bytes or an eighth of the free memory, and whose floor here is 0082H. Four small routines in the range belong to CLEAR and nothing else reaches them: the argument evaluation at 4502H, the Out of memory exit at 450BH, the default stack size at 450EH and the subtraction at 4520H. Two of the bytes are data rather than code, the commas at 4495H and 44B8H that 4353H reads out of the line after its own call.

447B
The exit of CLEAR, which its four branches at 4483H, 4490H, 4496H and 44FFH all reach: jump to 42CBH, the part of NEW's clearing code standing below the part that throws the program away, so the program text survives and only the variables go.
447E
PUSH AF F5
CLEAR (447EH), the routine the statement address table holds for token 92H and the one MORC calls at 8238H in the enhancement package: push Register Pair AF, keeping the character the statement loop left in Register A and the Zero Flag that says whether the statement ended at the token itself.
447F
Call 4DB8H, which closes every open file: it calls 4D85H with Register A at 00H, the file number that stands for all of them, and comes back with Register A at 00H and the Zero Flag set whatever it closed.
4482
POP AF F1
Pop Register Pair AF, bringing back the character and the Zero Flag of the entry, both of which the file closing at 4DB8H destroyed by leaving Register A at 00H.
4483
Jump to 447BH on Z, the statement having ended at the token: CLEAR with nothing after it goes straight to the exit and leaves both boundaries standing where they are.
4485
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which is what the version 6 form of the statement begins with, its first argument position being left empty.
4487
Jump to 4492H on Z, which takes that comma and goes on to the mem argument, nothing having been offered for the string space.
4489
Call 5F91H, which evaluates the expression at the text pointer into Register Pair DE through 7990H and gives Illegal function call at 5F95H when the value is negative. This is the string space of the version 5 statement, and the value is never read again, which is B298.
448C
DEC HL 2B
Decrement Register Pair HL, taking the text pointer back one so that the call which follows reads the character it already stands on rather than the one beyond it.
448D
Call NXTCHAR at 5E93H, which steps Register Pair HL on and brings the character after the expression back in Register A with the Zero Flag set when the statement has ended there.
4490
Jump to 447BH on Z: this is the form with one expression and nothing after it, which closes the files and clears the variables and does nothing at all with the number it was given.
4492
Call 4353H, which demands the character written in the byte after the call and gives Syntax error at 586CH when the line holds anything else, then brings the next character back in Register A.
4495
DEFB 2CH 2C
The comma 4353H compares the line's character with. It is data read by the routine the call at 4492H reaches, not an instruction, and the instruction after that call is the one at 4496H.
4496
Jump to 447BH on Z, the statement having ended on the comma: a bare trailing comma is taken without complaint and both boundaries are left as they stand.
4498
LD DE,(6E9AH) ED 5B 9A 6E
Load Register Pair DE from the word at 6E9AH, the top of free memory that NEWB/ASM and BMOVE/ASM name BASEND, which is the value mem keeps when no mem is given. This load is also what throws the first argument away.
449C
CP 2CH FE 2C
Compare Register A with 2CH, a comma again, which is how a stack argument is given with no mem before it.
449E
Jump to 44AEH on Z, over the whole of the mem argument, so that Register Pair DE keeps the word it was just loaded with and the top of memory does not move.
44A0
Call 4502H, CLEAR's own argument routine, which evaluates a number into Register Pair DE through 6566H and gives Illegal function call for a value of zero. This is mem, the highest address BASIC may use.
44A3
PUSH HL E5
Push Register Pair HL, the text pointer standing after the mem expression, because the comparison that follows wants Register Pair HL for the ceiling.
44A4
LD HL,(7151H) 2A 51 71
Load Register Pair HL from the word at 7151H, which NEWB/EQU names OLDHI and which BEGIN filled with HIGH$ as BASIC found it, the ceiling mem may not pass.
44A7
Call CPHLDE at 434DH, which compares Register Pair HL with Register Pair DE by subtracting the high bytes and then the low ones, so the Carry Flag comes back set when Register Pair HL holds the smaller address.
44AA
Jump to 5F95H on Carry, which is Illegal function call, OLDHI standing below the address asked for: BASIC cannot be told to use memory that was never its to use.
44AD
POP HL E1
Pop Register Pair HL, the text pointer pushed at 44A3H, the comparison having finished with Register Pair HL.
44AE
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on, the same step made at 448CH.
44AF
Call NXTCHAR at 5E93H, which brings the character after the mem expression back in Register A and sets the Zero Flag when the statement has ended there.
44B2
PUSH DE D5
Push Register Pair DE, the top of memory, which is wanted again at 44C5H and which the stack argument's own evaluation would otherwise destroy.
44B3
Jump to 450EH on Z, the statement having ended after mem: 450EH works out the size the stack has at this moment and comes back with it, so that mem moves and the stack keeps its size.
44B5
Call 4353H, which demands the comma written in the byte after the call and gives Syntax error at 586CH for anything else, then brings the next character back in Register A.
44B8
DEFB 2CH 2C
The second comma, data for 4353H and not an instruction, read out of the line by the routine the call at 44B5H reaches; the instruction after that call is the one at 44B9H.
44B9
Jump to 450EH on Z, the statement having ended on that comma, so that a trailing comma after mem is taken and the stack size is worked out as it stands.
44BB
Call 4502H a second time, which evaluates the stack argument into Register Pair DE and refuses a value of zero with Illegal function call: this is the number of bytes BASIC keeps for its own use.
44BE
DEC HL 2B
Decrement Register Pair HL, the step before the character is read again, which the statement makes here for the third time.
44BF
Call NXTCHAR at 5E93H, which brings the character after the stack expression back in Register A with the Zero Flag set when the statement has ended.
44C2
Jump to SYNERR at 586CH on NZ: three arguments are all the statement takes, so anything still standing on the line is Syntax error.
44C5
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses: the top of memory pushed at 44B2H comes into Register Pair HL and the text pointer goes down in its place, which is where 44F3H takes it back from.
44C6
PUSH HL E5
Push Register Pair HL, the top of memory, so that the comparison which follows may have Register Pair HL for its floor and the address is still to hand at 44CFH.
44C7
LD HL,0082H 21 82 00
Load Register Pair HL with 0082H, which is 130 bytes, the smallest stack this statement allows.
44CA
Call CPHLDE at 434DH to compare the floor in Register Pair HL with the stack size in Register Pair DE, which leaves the Carry Flag set only when 0082H is the smaller of the two.
44CD
Jump to 450BH on no Carry, which is Out of memory: a stack of 130 bytes or fewer is refused, whether it was asked for or worked out at 450EH.
44CF
POP HL E1
Pop Register Pair HL, the top of memory pushed at 44C6H, which the file buffers are taken off next.
44D0
Call 7FEDH, which takes 564 bytes off Register Pair HL for each file BASIC was started with and one more, the count coming from the byte at 6ECEH, and returns with the Carry Flag set when there was room for them all.
44D3
Jump to 450BH on no Carry, which is Out of memory: the file buffers did not fit below the top of memory that Register Pair HL held.
44D5
Call 4520H, CLEAR's own subtraction, which leaves Register Pair HL less Register Pair DE in Register Pair DE: the top of memory, less the buffers, less the stack, which is where the program and variable space is now to end.
44D8
Jump to 450BH on Carry, which is Out of memory, the stack asked for having been larger than the memory left below the file buffers.
44DA
PUSH HL E5
Push Register Pair HL, the top of memory less the file buffers, which becomes BASEND at 44EDH once the test below has been passed.
44DB
LD HL,(719FH) 2A 9F 71
Load Register Pair HL from the word at 719FH, VARTAB, the address the simple variables start at and the first byte above the program text.
44DE
LD BC,0014H 01 14 00
Load Register Pair BC with 0014H, which is twenty bytes, the margin the statement insists on above the program text.
44E1
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which leaves VARTAB plus twenty in Register Pair HL as the floor of the test.
44E2
Call CPHLDE at 434DH to compare that floor in Register Pair HL with the new boundary in Register Pair DE, the Carry Flag coming back set only when there is room between them.
44E5
Jump to 450BH on no Carry, which is Out of memory: the new boundary would have stood at or below the program text and its twenty byte margin.
44E7
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the new boundary into Register Pair HL and sends the floor it was compared with away.
44E8
DEC HL 2B
Decrement Register Pair HL, because the boundary that is stored is the last byte of the program and variable space, one below the first byte of the stack.
44E9
LD (7153H),HL 22 53 71
Store Register Pair HL into the word at 7153H, the top of the program and variable space, which BEGIN set at the start-up and which the stack stands above.
44EC
POP HL E1
Pop Register Pair HL, the top of memory less the file buffers, which was pushed at 44DAH.
44ED
LD (6E9AH),HL 22 9A 6E
Store Register Pair HL into the word at 6E9AH, BASEND: the top of free memory now lies below the file buffers, which are built above it.
44F0
Call 7FFBH, which builds the file buffers from BASEND upward, writing the first address into 6EACH and the table of their addresses at 6EAEH, 564 bytes apart.
44F3
POP DE D1
Pop Register Pair DE, the text pointer that 44C5H left at the top of the stack, which has to be carried over by hand because the stack itself is about to move.
44F4
POP BC C1
Pop Register Pair BC, the return address 5E3BH that the statement dispatcher pushed, which is the other word that has to survive the move.
44F5
LD HL,(6E9AH) 2A 9A 6E
Load Register Pair HL from the word at 6E9AH, the BASEND just stored, which is where the stack is now to stand.
44F8
LD SP,HL F9
Load the Stack Pointer from Register Pair HL: the stack begins again at the new top of memory, and everything that stood on the old one is gone but the two words just taken off it.
44F9
PUSH BC C5
Push Register Pair BC, which puts the dispatcher's return address 5E3BH back on the new stack so that the statement can still return to the statement loop.
44FA
PUSH DE D5
Push Register Pair DE, which puts the text pointer back on the new stack above it, where 44FEH takes it off again.
44FB
Call 4291H, which walks the table of file buffer addresses at 6EAEH and stores 00H in the first byte of each, so that every one of the file control blocks is marked unused.
44FE
POP HL E1
Pop Register Pair HL, the text pointer, so that the exit leaves it where the statement loop expects to find it.
44FF
Jump to 447BH, the exit, which goes on to 42CBH and clears the variables with the program text left alone.
4502
CLEAR's argument routine (4502H), called from 44A0H for mem and from 44BBH for the stack and reached from nowhere else: call 6566H, which evaluates the expression at the text pointer and leaves it as a two byte integer in Register Pair DE.
4505
LD A,D 7A
Load Register A with Register D, the high byte of the value, which is the first half of the test for zero.
4506
OR E B3
OR Register A with Register E, the low byte, so that the Zero Flag is set only when both bytes of the value are 00H.
4507
Jump to FUNCERR at 5F95H on Z, which is Illegal function call: neither a top of memory of zero nor a stack of no bytes can be used.
450A
RET C9
Return with the value in Register Pair DE and with Register Pair HL, the text pointer, standing after the expression.
450B
The Out of memory exit of CLEAR (450BH), reached from the four branches at 44CDH, 44D3H, 44D8H and 44E5H: jump to 425CH, the general Out of memory entry, which loads Register Pair DE with 0007H and goes on to the error handler.
450E
PUSH HL E5
The default stack size (450EH), reached from 44B3H and 44B9H when no stack argument was given: push Register Pair HL, the text pointer, because the arithmetic below wants Register Pair HL.
450F
LD HL,(6E9AH) 2A 9A 6E
Load Register Pair HL from the word at 6E9AH, BASEND, which is the top of free memory as it stands at this moment.
4512
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE takes BASEND and Register Pair HL takes the mem value, which the load at 4513H writes over, the copy pushed at 44B2H being the one the statement goes on to use.
4513
LD HL,(7153H) 2A 53 71
Load Register Pair HL from the word at 7153H, the top of the program and variable space, the boundary that the stack stands above.
4516
INC HL 23
Increment Register Pair HL to the first byte of the stack, which is the one above that boundary.
4517
LD A,E 7B
Load Register A with Register E, the low byte of BASEND, which is the first half of the subtraction.
4518
SUB L 95
Subtract Register L from Register A, the low byte of the first byte of the stack.
4519
LD E,A 5F
Load Register E with Register A, which is the low byte of the difference.
451A
LD A,D 7A
Load Register A with Register D, the high byte of BASEND, for the second half of the subtraction.
451B
SBC A,H 9C
Subtract Register H from Register A with the Carry Flag, which carries the borrow of the low bytes into the high ones.
451C
LD D,A 57
Load Register D with Register A: Register Pair DE now holds BASEND less the first byte of the stack, which is the size the stack has at this moment.
451D
POP HL E1
Pop Register Pair HL, the text pointer that was pushed at 450EH.
451E
Jump to 44C5H with that size in Register Pair DE, so that the statement goes on exactly as it would with a stack argument of the same number.
4520
LD A,L 7D
CLEAR's subtraction (4520H), called from 44D5H and reached by nothing else: load Register A with Register L, the low byte of the address in Register Pair HL.
4521
SUB E 93
Subtract Register E from Register A, which is the low byte of the size held in Register Pair DE.
4522
LD E,A 5F
Load Register E with Register A, the low byte of the result, which is written over the size as it is worked out.
4523
LD A,H 7C
Load Register A with Register H, the high byte of the address, for the second half of the subtraction.
4524
SBC A,D 9A
Subtract Register D from Register A with the Carry Flag, which brings the borrow of the low bytes in.
4525
LD D,A 57
Load Register D with Register A, so that Register Pair DE holds the address less the size and the Carry Flag says whether the subtraction borrowed.
4526
RET C9
Return with the difference in Register Pair DE and with the Carry Flag set when the size was the larger of the two.

4527H - NEXT: Step a Loop and Test It, and the File Test Beside It (4527H-45E6H)

NEXT steps the loop variable of the innermost open FOR, or of the FOR named after it, tests it against the limit and either goes back to the statement after the FOR or falls through. It is also where FOR itself does the first step and the first test, because FOR ends with a jump to 4529H, which is the operand byte of the instruction at 4528H and as an instruction is XOR A: the same overlapping trick the error chain at 586CH and TRON at 43F0H use. That is what makes the flag at 729CH the whole difference between the two entries. Entered from the statement address table at 4527H the flag is set to a value that is not 00H and the variable is stepped, and entered from FOR at 4529H the flag is made 00H and the variable is given its starting value out of 729DH instead, with no step added. This is why the manual says that under version 6 the body of a loop whose start already passes its limit is skipped: the test is made before the body runs, not after. A FOR frame on the stack is nineteen bytes, built downward so that its lowest byte is the marker, and the search at 57F6H walks upward from the Stack Pointer plus four looking for one. Counting from the marker: 0 is the token 82H; 1 and 2 are the loop variable's address; 3 and 4 are the text pointer of the matching NEXT, which FOR found by scanning the program forward at 6714H and which is what makes a second NEXT for the same FOR give NEXT without FOR, as the manual says it does; 5 is the byte that carries the direction of the step; 6 is the variable's type less three, so FFH for an integer loop and 01H for a single precision one; 7 to 10 are the four byte step of a single precision loop and four bytes of leftovers in an integer one; 11 to 14 are the four byte limit of a single precision loop, and in an integer loop 11 and 12 are the two byte step and 13 and 14 the two byte limit; 15 and 16 are the line number of the FOR; and 17 and 18 are the text pointer of the statement after it. The eight bytes at 45DFH are not part of NEXT: they are the test for a file being in hand that eleven routines call, among them IMMED in the enhancement package at 80C3H.

4527
PUSH AF F5
NEXT (4527H), the routine the statement address table holds for token 83H: push Register Pair AF, keeping the character the statement loop left in Register A and the Zero Flag that says whether the statement ended at the token itself.
4528
OR 0AFH F6 AF
OR Register A with 0AFH, which cannot give 00H whatever the character was, so that the flag stored next says this entry came from a NEXT statement. The operand byte at 4529H is the entry FOR uses, and as an instruction 0AFH is XOR A, which makes Register A 00H and sets the Zero Flag, so FOR arrives with the flag about to be cleared and with no variable named.
452A
LD (729CH),A 32 9C 72
Store Register A into the byte at 729CH, the flag that decides at 4562H and at 4592H whether the step is added to the variable or the starting value is taken out of 729DH instead. Nothing outside this routine reads or writes it.
452D
POP AF F1
Pop Register Pair AF, which on the NEXT entry undoes the push at 4527H and on the FOR entry takes back one of the two words FOR pushed at 5E32H and 5E33H, so that the Stack Pointer is the same distance below the frame either way.
452E
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the address no variable has, which tells the search at 57F6H to take the innermost FOR frame whatever its variable is.
4531
LD (729AH),HL 22 9A 72
Store Register Pair HL into the word at 729AH, the text pointer standing at the variable this NEXT names, or at the end of the statement when it names none. This is also the entry the comma loop uses from 45DCH, which is why the load above it is not reached a second time.
4534
Call the variable search at 39FBH on NZ, a variable having been named, which returns its address in Register Pair DE. On Z there is no variable and Register Pair DE keeps the 0000H loaded at 452EH.
4537
LD (7184H),HL 22 84 71
Store Register Pair HL into the word at 7184H, the text pointer now standing after the variable's name, which 45CDH reads again to see whether a comma and another variable follow.
453A
Call 57F6H, which walks up the stack from the Stack Pointer plus four over any WHILE frame until it meets a FOR frame whose variable address matches Register Pair DE, or any frame when Register Pair DE is 0000H, and returns the Zero Flag set with Register Pair HL at the frame's third byte and Register Pair DE holding that frame's variable address.
453D
Jump to 5872H on NZ, which is error 1, NEXT without FOR: no FOR frame of this variable is open.
4540
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which throws away every frame inside the one that was found, so that a NEXT of an outer loop closes the inner loops with it.
4541
PUSH DE D5
Push Register Pair DE, the loop variable's address, which writes it back over the frame's own first and second bytes and keeps it where 4551H can take it.
4542
LD E,(HL) 5E
Load Register E from the byte at Register Pair HL, the low byte of the frame's third and fourth bytes, which hold the text pointer of the NEXT that FOR scanned forward to.
4543
INC HL 23
Increment Register Pair HL to the fourth byte of the frame, the high byte of that pointer.
4544
LD D,(HL) 56
Load Register D from the byte at Register Pair HL, so that Register Pair DE holds the whole of the pointer FOR recorded.
4545
INC HL 23
Increment Register Pair HL to the frame's fifth byte, which is where the direction of the step is kept.
4546
PUSH HL E5
Push Register Pair HL, that address, which 4550H takes back once the pointer has been checked. The push writes over the frame's marker byte, which NEXT no longer needs and which 5E37H puts back when the loop goes round again.
4547
LD HL,(729AH) 2A 9A 72
Load Register Pair HL from the word at 729AH, the text pointer of this NEXT, saved at 4531H before the variable was looked up.
454A
Call CPHLDE at 434DH, which compares Register Pair HL with Register Pair DE and returns the Zero Flag set when the two pointers are the same.
454D
Jump to 5872H on NZ, which is error 1, NEXT without FOR: this is not the NEXT that FOR scanned forward to, which is how the manual's rule that version 6 allows one and only one NEXT for each FOR is enforced.
4550
POP HL E1
Pop Register Pair HL, the address of the frame's fifth byte, pushed at 4546H.
4551
POP DE D1
Pop Register Pair DE, the loop variable's address, pushed at 4541H.
4552
PUSH DE D5
Push Register Pair DE, that address again, so that it is still on the stack for 45ADH to take after the value has been worked out.
4553
LD A,(HL) 7E
Load Register A from the byte at Register Pair HL, the frame's fifth byte, which carries the direction of the step: FOR puts 01H there when no STEP was given and 02H when the step it worked out was not a positive one.
4554
PUSH AF F5
Push Register Pair AF, keeping that byte, which 45B8H takes back into Register B to settle the comparison with.
4555
INC HL 23
Increment Register Pair HL to the frame's sixth byte, which holds the variable's type.
4556
PUSH DE D5
Push Register Pair DE, the loop variable's address a third time, which 4560H and 458BH exchange for the frame pointer.
4557
LD A,(HL) 7E
Load Register A from the byte at Register Pair HL, the type the test at 5DBEH left in the frame, which is the variable's type less three.
4558
INC HL 23
Increment Register Pair HL to the frame's seventh byte, the first byte of the step of a single precision loop.
4559
OR A B7
OR Register A with itself, which sets the Sign Flag when bit 7 of that byte is set, and bit 7 is set only for FFH, which is an integer variable's type of two less three.
455A
Jump to 4583H on M, the integer path, where the step and the limit are two byte values standing higher up the frame.
455D
Call 2924H in BASIC/OV1, which loads the four byte value at Register Pair HL into the arithmetic accumulator at 72ECH and leaves Register Pair HL four bytes on, so the accumulator now holds the step and Register Pair HL stands at the limit.
4560
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses: the limit's address goes down in place of the loop variable's address pushed at 4556H, and Register Pair HL takes that variable's address.
4561
PUSH HL E5
Push Register Pair HL, the loop variable's address, which 4575H takes back once the new value has been worked out.
4562
LD A,(729CH) 3A 9C 72
Load Register A from the byte at 729CH, the flag set at 452AH, to tell a NEXT statement from the first pass that FOR itself makes.
4565
OR A B7
OR Register A with itself, which sets the Zero Flag only for the 00H that the XOR A at 4529H leaves, the FOR entry.
4566
Jump to 456FH on NZ, a NEXT statement, so that the step stays in the accumulator and the variable's own value is added to it below.
4568
LD HL,729DH 21 9D 72
The FOR entry's path, reached only when the flag at 729CH is 00H: load Register Pair HL with 729DH, the four byte cell FOR filled at 5D77H with the loop's starting value.
456B
Call 2924H in BASIC/OV1 again, which loads that starting value into the accumulator at 72ECH over the step, because the first time round the loop the variable takes the start rather than the start plus a step.
456E
XOR A AF
Clear Register A with XOR, which sets the Zero Flag so that the jump below is taken and the addition is passed over.
456F
Jump to 4575H on Z, which happens only on the path from 4568H, so that the starting value goes into the variable untouched.
4572
Call 2617H in BASIC/OV1, which loads the four byte value at Register Pair HL, the loop variable's own, and adds it to the step standing in the accumulator at 72ECH.
4575
POP HL E1
Pop Register Pair HL, the loop variable's address, pushed at 4561H.
4576
Call 293EH in BASIC/OV1, which stores the four bytes of the accumulator at 72ECH into the bytes at Register Pair HL, so the variable now holds its new value.
4579
POP HL E1
Pop Register Pair HL, the address of the frame's eleventh byte, which 4560H put on the stack and which is where the limit of a single precision loop begins.
457A
Call 2935H in BASIC/OV1, which loads the four byte limit at Register Pair HL into Register Pair DE and Register Pair BC, low word first, and leaves Register Pair HL four bytes on at the frame's line number.
457D
PUSH HL E5
Push Register Pair HL, that line number's address, which 45B7H takes back.
457E
Call 2982H in BASIC/OV1, the single precision comparison, which compares the new value in the accumulator at 72ECH with the limit in Register Pair DE and Register Pair BC and leaves its answer in Register A.
4581
Jump to 45B7H, where the answer is weighed against the direction byte, the single precision path being finished.
4583
INC HL 23
The integer path (4583H), reached from 455AH: increment Register Pair HL, the first of four steps over the four bytes at the frame's seventh to tenth, which an integer loop does not use.
4584
INC HL 23
Increment Register Pair HL a second time, over the second of those four unused bytes.
4585
INC HL 23
Increment Register Pair HL a third time, over the third of them.
4586
INC HL 23
Increment Register Pair HL a fourth time, which brings it to the frame's eleventh byte, where an integer loop keeps the low byte of its two byte step.
4587
LD C,(HL) 4E
Load Register C from the byte at Register Pair HL, that low byte of the step.
4588
INC HL 23
Increment Register Pair HL to the frame's twelfth byte, the high byte of the step.
4589
LD B,(HL) 46
Load Register B from the byte at Register Pair HL, so that Register Pair BC holds the whole two byte step FOR pushed at 5DDDH.
458A
INC HL 23
Increment Register Pair HL to the frame's thirteenth byte, where the two byte limit begins.
458B
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses: that limit's address goes down in place of the loop variable's address pushed at 4556H, and Register Pair HL takes the variable's address.
458C
LD E,(HL) 5E
Load Register E from the byte at Register Pair HL, the low byte of the variable's present value.
458D
INC HL 23
Increment Register Pair HL to the variable's high byte.
458E
LD D,(HL) 56
Load Register D from the byte at Register Pair HL, so that Register Pair DE holds the variable's value.
458F
PUSH HL E5
Push Register Pair HL, the address of that high byte, which 45A9H takes back to store the new value through.
4590
LD L,C 69
Load Register L with Register C, the low byte of the step.
4591
LD H,B 60
Load Register H with Register B, the high byte, so that Register Pair HL holds the step and Register Pair DE the variable.
4592
LD A,(729CH) 3A 9C 72
Load Register A from the byte at 729CH, the same flag the single precision path reads at 4562H.
4595
OR A B7
OR Register A with itself, which sets the Zero Flag only for the 00H the FOR entry leaves.
4596
Jump to 459DH on NZ, a NEXT statement, so that the step and the variable are added together below.
4598
LD HL,(729DH) 2A 9D 72
The FOR entry's path for an integer loop, reached only when the flag at 729CH is 00H: load Register Pair HL from the word at 729DH, the first two bytes of the cell FOR filled with the starting value, which for an integer is the whole of it.
459B
Jump to 45A8H, so that the starting value is stored in the variable with nothing added to it.
459D
Call 2B9EH in BASIC/OV1, the integer addition, which adds Register Pair DE to Register Pair HL and, when the sum will not fit in two bytes, makes it a single precision value and sets the type at 7142H to 04H.
45A0
LD A,(7142H) 3A 42 71
Load Register A from the byte at 7142H, the type of the value in hand as a count of its bytes.
45A3
CP 04H FE 04
Compare Register A with 04H, which is the four bytes of a single precision value and so says that the integer addition overflowed.
45A5
Jump to 587EH on Z, which is error 6, Overflow: an integer loop cannot carry a value its variable has no room for.
45A8
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the new value into Register Pair DE for the two stores below and sends the variable's old value away.
45A9
POP HL E1
Pop Register Pair HL, the address of the variable's high byte, pushed at 458FH.
45AA
LD (HL),D 72
Store Register D into the byte at Register Pair HL, the high byte of the variable's new value.
45AB
DEC HL 2B
Decrement Register Pair HL to the variable's low byte.
45AC
LD (HL),E 73
Store Register E into the byte at Register Pair HL, which finishes writing the new value into the variable.
45AD
POP HL E1
Pop Register Pair HL, the address of the frame's thirteenth byte, which 458BH put on the stack.
45AE
PUSH DE D5
Push Register Pair DE, the variable's new value, which 45B3H exchanges for the frame pointer.
45AF
LD E,(HL) 5E
Load Register E from the byte at Register Pair HL, the low byte of the two byte limit.
45B0
INC HL 23
Increment Register Pair HL to the limit's high byte.
45B1
LD D,(HL) 56
Load Register D from the byte at Register Pair HL, so that Register Pair DE holds the limit.
45B2
INC HL 23
Increment Register Pair HL to the frame's fifteenth byte, where the line number of the FOR stands.
45B3
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the variable's new value back into Register Pair HL and sends that line number's address down.
45B4
Call 29AFH in BASIC/OV1, the signed comparison of two integers, which compares Register Pair HL with Register Pair DE and leaves its answer in Register A in the same form the single precision comparison uses.
45B7
POP HL E1
Pop Register Pair HL, the address of the frame's fifteenth byte, pushed at 457DH on one path and left by 45B3H on the other.
45B8
POP BC C1
Pop Register Pair BC, the word pushed at 4554H, so that Register B holds the frame's direction byte and Register C the flags that went with it.
45B9
SUB B 90
Subtract Register B from Register A, the comparison's answer less the direction byte, which gives 00H exactly when the variable has passed the limit in the direction the step runs.
45BA
Call 2935H in BASIC/OV1, which loads the four bytes at Register Pair HL into Register Pair DE and Register Pair BC, so Register Pair DE takes the FOR's line number and Register Pair BC the text pointer of the statement after it. Neither the loads nor the increments inside it touch the flags the subtraction set.
45BD
Jump to 45C8H on Z, the limit having been passed, so the loop is finished and the frame is given up.
45BF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the FOR's line number into Register Pair HL.
45C0
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that an error inside the loop names the FOR's line.
45C3
LD L,C 69
Load Register L with Register C, the low byte of the text pointer the loop goes back to.
45C4
LD H,B 60
Load Register H with Register B, the high byte, so that Register Pair HL stands at the statement after the FOR.
45C5
Jump to 5E37H, which pushes the token 82H back as the frame's marker byte and falls into the statement loop at 5E3BH, so the frame is whole again for the next time round.
45C8
LD SP,HL F9
The end of the loop (45C8H): load the Stack Pointer from Register Pair HL, the frame's fifteenth byte, which gives up the whole of the frame below it.
45C9
LD (718EH),HL 22 8E 71
Store Register Pair HL into the word at 718EH, the cell that holds where the stack stands, so that the interpreter's own idea of it keeps up with the move.
45CC
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that stack address into Register Pair DE and the FOR's line number into Register Pair HL, where the load at 45CDH destroys it at once. What this leaves in Register Pair DE is read again only at 4534H, by way of 45DCH, and that is B299.
45CD
LD HL,(7184H) 2A 84 71
Load Register Pair HL from the word at 7184H, the text pointer saved at 4537H, which stands after the variable this NEXT named.
45D0
LD A,(HL) 7E
Load Register A from the byte at Register Pair HL, the character standing there.
45D1
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which is what stands between the variables of the NEXT T,R form the manual gives.
45D3
Jump to the statement loop at 5E3BH on NZ, the statement being finished; the loop gives Syntax error for anything there that is not a colon or the end of the line.
45D6
LD (729CH),A 32 9C 72
Store Register A into the byte at 729CH, which is the comma itself and so not 00H, so that the next pass through the routine steps its variable instead of taking a starting value.
45D9
Call NXTCHAR at 5E93H, which steps Register Pair HL past the comma and brings the first character of the next variable's name back in Register A with the Zero Flag set when the statement has ended there instead.
45DC
Call 4531H to close that loop as well, below the load of 0000H into Register Pair DE, so a trailing comma with no name after it arrives at 4534H with the Zero Flag set and with Register Pair DE still holding the stack address 45CCH put there, which is B299. The call never comes back: every path out of 4531H either reaches the statement loop or the error entry.
45DF
PUSH HL E5
The test for a file being in hand (45DFH), which eleven routines call, among them 40D9H, 41FAH, 59AFH, 7E1EH and IMMED at 80C3H in the enhancement package: push Register Pair HL, the caller's pointer, which the test must give back untouched.
45E0
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL from the word at 6E98H, FILEX, which holds the file control block of the file in hand less two and 0000H when there is none.
45E3
LD A,H 7C
Load Register A with Register H, the high byte of that word.
45E4
OR L B5
OR Register A with Register L, the low byte, so that the Zero Flag is set only when both bytes are 00H and no file is in hand.
45E5
POP HL E1
Pop Register Pair HL, the caller's pointer, the push at 45DFH being what lets this test leave every register pair but Register Pair AF alone.
45E6
RET C9
Return with the Zero Flag set when there is no file in hand and clear when there is one.

45E7H - The String Comparison, which Every Relational Operator on Strings Reaches (45E7H-4613H)

Nothing calls this routine: the expression evaluator puts 45E7H into Register Pair BC at 7417H and jumps to 73C5H, which works the second operand out and comes back through that word, so the routine is entered by a return and the word the stack holds under it is the address of the first operand's descriptor, which 7413H and 7416H put there. Both strings are taken in hand before a character is looked at, the second through 481AH and the first through 4821H, which is how a comparison of two temporaries gives their space back rather than leaking it. What is left is four values in four registers, the two lengths in Register D and Register E and the two text addresses in Register Pair BC and Register Pair HL, and the loop at 45FDH walks them together. The comparison has four ways out and only one of them is the loop's. Both lengths reaching zero together returns through 45FFH with the Zero Flag set, the strings being equal; the second running out first returns through 4603H with the Carry Flag set; the first running out first returns through 4607H with Register A holding 01H and the Carry Flag clear; and a pair of characters that differ falls to 4610H, where the Carry Flag the comparison left is complemented and 28CFH of BASIC/OV1 turns it into the value of the operator. All four land on 7683H, the address 740CH pushed under everything. A shorter string that is otherwise the same therefore compares below a longer one, and the comparison is of the character codes alone with no case folding of any kind.

45E7
The string comparison (45E7H), which 7417H puts into Register Pair BC as the address to return through: call 481AH, which insists that the value in hand is a string, gives its space back when its descriptor is the topmost temporary, and returns the address of that three byte descriptor in Register Pair HL.
45EA
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the second operand's text.
45EB
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
45EC
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the address the second operand's text stands at.
45ED
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
45EE
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte of that address, so that Register Pair BC holds the second operand's text.
45EF
POP DE D1
Pop Register Pair DE, the address of the first operand's descriptor, which 7416H pushed before the second operand was worked out: what is left on the stack below it is 7683H, which all four of this routine's exits return to.
45F0
PUSH BC C5
Push Register Pair BC, the second operand's text address, which the pop at 45FCH brings back into Register Pair HL once the first operand has been taken in hand.
45F1
PUSH AF F5
Push Register Pair AF, Register A holding the second operand's length, which the pop at 45F5H brings back.
45F2
Call 4821H with Register Pair DE holding the first operand's descriptor address, which gives that string's space back when its descriptor is the topmost temporary and returns the same address in Register Pair HL either way.
45F5
POP AF F1
Pop Register Pair AF, which puts the second operand's length back into Register A.
45F6
LD D,A 57
Load Register D with Register A, so that Register D holds the second operand's length for the whole of the loop below.
45F7
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the length of the first operand's text.
45F8
INC HL 23
Step Register Pair HL on to the second byte of the first operand's descriptor.
45F9
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the first operand's text address.
45FA
INC HL 23
Step Register Pair HL on to the third byte of that descriptor.
45FB
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte of it, so that Register Pair BC holds the first operand's text.
45FC
POP HL E1
Pop Register Pair HL, the second operand's text address that 45F0H pushed, which leaves 7683H on top of the stack as the address every exit below returns to.
45FD
LD A,E 7B
The comparison loop (45FDH): load Register A with Register E, the number of characters of the first operand still to look at.
45FE
OR D B2
OR Register A with Register D, which leaves the Zero Flag set only when Register D and Register E are both 00H.
45FF
RET Z C8
Return to 7683H on Z with Register A holding 00H and the Zero Flag set, both strings having run out on the same character: the two are equal.
4600
LD A,D 7A
Load Register A with Register D, the number of characters of the second operand still to look at.
4601
SUB 01H D6 01
Subtract 01H from Register A, which sets the Carry Flag only when Register D held 00H.
4603
RET C D8
Return to 7683H on C, the second operand having run out while the first has characters left: the first string is the greater, and Register A holds 0FFH.
4604
XOR A AF
Clear Register A to 00H, which the comparison below weighs the first operand's remaining count against.
4605
CP E BB
Compare Register A with Register E, which sets the Carry Flag when Register E holds anything but 00H, Register A holding 00H.
4606
INC A 3C
Increment Register A to 01H, which leaves the Carry Flag as the comparison above set it.
4607
RET NC D0
Return to 7683H on NC with Register A holding 01H, the first operand having run out while the second has characters left: the first string is the lesser, which is why ABC compares below ABCD.
4608
DEC D 15
Decrement Register D, one character of the second operand being about to be used.
4609
DEC E 1D
Decrement Register E, one character of the first operand being about to be used.
460A
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, the next character of the first operand.
460B
INC BC 03
Step Register Pair BC on to the character after it.
460C
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the matching character of the second operand, which sets the Carry Flag when the first operand's character has the lower code.
460D
INC HL 23
Step Register Pair HL on to the character after it.
460E
Jump back to 45FDH on Z, the two characters being the same code, which takes the next pair.
4610
CCF 3F
Complement the Carry Flag, so that it is set when the first operand's character has the higher code: this is the one exit the loop itself takes.
4611
Jump to 28CFH of BASIC/OV1, which turns the Carry Flag and the Zero Flag into the value the relational operator leaves in the accumulator and returns to 7683H.

4614H - OCT$, HEX$ and STR$, and the Three Descriptor Makers (4614H-464EH)

The three functions that turn a number into text share everything but their first instruction. OCT$ 4614H, HEX$ 4619H and STR$ 461EH are the words the function address table holds at 688DH, 688FH and 6881H; each calls the conversion that writes its digits and then falls into the common tail at 4621H, which makes a string of the text and copies it into real string space, because the text itself is written into a fixed buffer that the next conversion would write over. OCT$ and HEX$ reach 368BH and 368EH, which are the same routine entered one instruction apart: 368BH clears Register A and loads Register B from it, and the JP NZ,0106H that follows can never be taken because the XOR A set the Zero Flag, so its two operand bytes at 368EH stand as a LD B,01H and Register B comes out 00H for octal and 01H for hexadecimal. STR$ reaches 3147H, the number to text conversion PRINT and WRITE also call. The tail is worth reading as three routines rather than one. 4621H makes a temporary string of the text, gives that temporary straight back, and pushes 4870H so that the copy below returns through it; 462BH is the copy itself and four other routines call it outright, LET's string assignment at 60E5H among them; and 4641H with 463FH and 4644H are the makers everything in this band uses, 4641H taking Register A bytes of string space and building a descriptor for them, 463FH doing the same for a single character, and 4644H building a descriptor at 7175H from a length and an address already in hand.

4614
OCT$ (4614H), the word the function address table holds at 688DH for token 19H: call 368BH, which clears Register A and leaves Register B holding 00H, the mark for base eight, and writes the digits of the number in the accumulator into the buffer at 72FDH.
4617
Jump to 4621H, the tail the three functions share, with Register Pair HL standing on the first character of the digits.
4619
HEX$ (4619H), the word the function address table holds at 688FH for token 1AH and which 491FH also holds: call 368EH, which is 368BH entered two bytes on, where the operand of a jump that cannot be taken stands as a LD B,01H and so leaves Register B holding 01H, the mark for base sixteen.
461C
Jump to 4621H, the same tail, the digits having been written into the same buffer.
461E
STR$ (461EH), the word the function address table holds at 6881H for token 13H and which 528EH also holds: call 3147H, the number to text conversion, which writes the number in the accumulator as decimal characters at 72FEH with a blank or a minus sign in the first byte and a 00H byte at the end.
4621
The tail the three functions share (4621H): call 464FH, which steps Register Pair HL back one so that the collector begins on the character it stands on, sets both of the collector's delimiters to 22H, and so runs to the 00H byte the conversion wrote and makes a temporary string of everything before it.
4624
Call 481DH, which takes the descriptor address out of the accumulator at 72ECH and gives that temporary back by lowering 7155H, leaving its address in Register Pair HL: the text it points at stands in a fixed buffer and not in the string space, so there is nothing to give back but the descriptor slot itself.
4627
LD BC,4870H 01 70 48
Load Register Pair BC with 4870H, which is a POP BC and a jump to 467FH, so that the copy below ends by making its own descriptor the accumulator's string.
462A
PUSH BC C5
Push Register Pair BC, which puts 4870H on the stack as the address the RET at 463EH leaves through.
462B
LD A,(HL) 7E
The copy into string space (462BH), which 49EDH, 5635H, LET's string assignment at 60E5H and 78B3H call outright and which 47B2H and 483DH hold as a word: load Register A with the byte Register Pair HL addresses, the length byte of the descriptor Register Pair HL stands on.
462C
INC HL 23
Step Register Pair HL on to the second byte of that descriptor.
462D
PUSH HL E5
Push Register Pair HL, that address, which the pop at 4631H brings back once the space has been taken.
462E
Call 46BDH, which takes Register A bytes off the top of the string area and returns their address in Register Pair DE, collecting the string space first and giving Out of string space when even that will not do.
4631
POP HL E1
Pop Register Pair HL, the address of the descriptor's second byte that 462DH pushed.
4632
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the address the text stands at now.
4633
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
4634
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte of it, so that Register Pair BC holds where the text is being copied from.
4635
Call 4644H, which builds a descriptor at 7175H from the length in Register A and the new address in Register Pair DE.
4638
PUSH HL E5
Push Register Pair HL, which 4644H left holding 7175H, so that the pop at 463DH hands it back as the result.
4639
LD L,A 6F
Load Register L with Register A, the length, which is the count the move below works from.
463A
Call 4811H, which moves Register L bytes from the address in Register Pair BC to the address in Register Pair DE and returns at once when Register L holds 00H.
463D
POP DE D1
Pop Register Pair DE, the 7175H that 4638H pushed, which is the descriptor the caller is given.
463E
RET C9
Return through 4870H for the three functions above, or to the caller for the four routines that call 462BH outright.
463F
LD A,01H 3E 01
The one character maker (463FH): load Register A with 01H, the length of a string of a single character, and fall into the maker below.
4641
The string maker (4641H), which 47EBH, 48A4H, 4AD4H, 4EB5H, 4EFFH, 7D69H and others call: call 46BDH, which takes Register A bytes of string space and returns their address in Register Pair DE.
4644
LD HL,7175H 21 75 71
The descriptor store (4644H), which 4635H, 467CH and 48DAH call with a length and an address already in hand: load Register Pair HL with 7175H, the three bytes every descriptor of this band is built in.
4647
PUSH HL E5
Push Register Pair HL, that same 7175H, which the pop at 464DH brings back so that the routine returns it.
4648
LD (HL),A 77
Store Register A, the length, into the byte Register Pair HL addresses, the first byte of the descriptor.
4649
INC HL 23
Step Register Pair HL on to the second byte of the descriptor, which takes the low byte of the text's address.
464A
LD (HL),E 73
Store Register E, the low byte of the text's address, into the byte Register Pair HL addresses.
464B
INC HL 23
Step Register Pair HL on to the third byte of the descriptor, which takes the high byte of that address.
464C
LD (HL),D 72
Store Register D, the high byte of that address, into the byte Register Pair HL addresses, which completes the descriptor.
464D
POP HL E1
Pop Register Pair HL, the 7175H that 4647H pushed, so that the caller is given the address of the descriptor rather than its end.
464E
RET C9
Return with Register Pair HL holding 7175H and the descriptor built.

464FH - The String Collector, and its Four Entries (464FH-46A3H)

This is the routine that turns a run of characters standing in memory into a string, and almost every string the interpreter makes out of text passes through it: a quoted literal in a program line, INPUT's prompt, a reply typed at the keyboard, an item read out of a file, and the digits OCT$, HEX$ and STR$ produce. It has four entries one instruction apart, which is how one piece of code serves callers that know different amounts about what they want. 464FH steps the pointer back one and takes both delimiters as 22H; 4650H takes both as 22H with the pointer already one short; 4652H copies Register B into Register D so that the caller sets both with one load; and 4653H is the scan itself with Register B and Register D both the caller's. The scan always begins on the character after the one Register Pair HL addresses, which is why the entries that step back exist. Two delimiters are allowed because a file item ends at a comma or, for a number, at a blank as well, and a quoted literal ends at a quotation mark; a delimiter of 00H can never match, the test at 4659H catching the 00H byte first, so a caller that wants everything to the end of the line passes 00H, which is exactly what LINE INPUT does at 6378H. The trailing blank strip at 466DH runs only when Register B holds 2CH, so a comma delimited item loses its trailing blanks and a quoted literal and a LINE INPUT reply keep theirs. The string is made a temporary at 467FH, and the two instructions that close the routine are easy to misread: the load at 469CH hands the caller the character the scan stopped on in Register A and changes no flag, so the RET NZ after it acts on the comparison at 4695H and gives String formula too complex when the temporary descriptor pool has filled up.

464F
DEC HL 2B
The collector entered with the pointer on the first character (464FH), which 4621H, 46A5H, 5712H and 624DH call: step Register Pair HL back one, so that the scan below begins on the character it stood on.
4650
LD B,22H 06 22
The quotation mark entry (4650H), which 63DAH and 74E5H call: load Register B with 22H, the quotation mark that ends a quoted literal, which the instruction below copies into Register D as well.
4652
LD D,B 50
The caller's delimiter entry (4652H), which LINE calls at 637AH: load Register D with Register B, so that both of the scan's delimiters are the one byte the caller put in Register B.
4653
PUSH HL E5
The scan (4653H), which 4BF5H and 64E4H call with Register B and Register D set to two different delimiters: push Register Pair HL, the address one before the first character, which the exchange at 4678H brings back.
4654
LD C,0FFH 0E FF
Load Register C with 0FFH, the count of characters less one, which the increment at 4658H brings to 00H before the first character is counted.
4656
INC HL 23
Step Register Pair HL on to the next character of the text.
4657
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that character.
4658
INC C 0C
Increment Register C, the count of characters taken so far.
4659
OR A B7
OR Register A with itself, which sets the Zero Flag when the character is the 00H byte that ends the text.
465A
Jump to 4662H on Z, the text having ended: this test is reached before either delimiter is compared, which is why a delimiter of 00H can never match a character and why 00H means run to the end.
465C
CP D BA
Compare Register A with Register D, the first of the two delimiters.
465D
Jump to 4662H on Z, the character being that delimiter.
465F
CP B B8
Compare Register A with Register B, the second of the two delimiters.
4660
Jump back to 4656H on NZ, the character being neither delimiter nor the end, which takes the character after it.
4662
CP 22H FE 22
Compare Register A with 22H, the quotation mark, Register A holding the character the scan stopped on.
4664
Call 5E93H on Z, which steps the text pointer past the closing quotation mark and brings the character after it back in Register A, so that the caller is left standing after the literal and not on its last character.
4667
PUSH HL E5
Push Register Pair HL, the address the scan stopped at, which the pop at 4677H brings back after the strip below.
4668
LD A,B 78
Load Register A with Register B, the second delimiter, which is what says whether this is a comma delimited item.
4669
CP 2CH FE 2C
Compare Register A with 2CH, the comma, which is the delimiter of a file item and the only one whose trailing blanks are dropped.
466B
Jump to 4677H on NZ, the delimiter not being a comma, which leaves the trailing blanks in the string: this is the path a quoted literal and a LINE INPUT reply take.
466D
INC C 0C
The trailing blank strip (466DH): increment Register C, the count, which the decrement below undoes so that the first turn of this loop does not lower it.
466E
DEC C 0D
Decrement Register C, the count of characters, which the loop lowers once for each trailing blank it drops.
466F
Jump to 4677H on Z, the count having reached 00H: an item of nothing but blanks becomes a string of no characters.
4671
DEC HL 2B
Step Register Pair HL back one, on to the last character the string holds.
4672
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that character.
4673
CP 20H FE 20
Compare Register A with 20H, a blank, Register A holding the last character the string still holds.
4675
Jump back to 466EH on Z, the last character being a blank, which drops it from the count and looks at the one before it.
4677
POP HL E1
Pop Register Pair HL, the address the scan stopped at that 4667H pushed, the strip above having moved Register Pair HL but not the address the caller is to be left on.
4678
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the stopping address on the stack for the pop at 469BH and brings back the address one before the first character.
4679
INC HL 23
Increment Register Pair HL to the first character of the string itself.
467A
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address of the first character into Register Pair DE where the descriptor store wants it.
467B
LD A,C 79
Load Register A with Register C, the count of characters, which is the string's length.
467C
Call 4644H, which builds the three byte descriptor at 7175H from the length in Register A and the address in Register Pair DE and returns 7175H in Register Pair HL.
467F
LD DE,7175H 11 75 71
The temporary allocation (467FH), which 4806H, 4871H, 48E5H, 4EB8H, 4F1BH and 7D6EH reach with a descriptor already built: load Register Pair DE with 7175H, the descriptor just made, which is what the copy below takes its three bytes from.
4682
LD A,0D5H 3E D5
Load Register A with 0D5H, whose operand byte at 4683H is the PUSH DE that 78B6H calls: a caller that already holds 7175H in Register Pair DE, which is what the copy at 462BH leaves, enters there and has the load above stepped over, and the word it pushes is what the pop at 469BH gives it back in Register Pair HL. As an instruction the two bytes do nothing, the 0D5H being written over at 468AH before anything reads it.
4684
LD HL,(7155H) 2A 55 71
Load Register Pair HL with the word at 7155H, the pointer to the next free temporary descriptor slot, which is where this descriptor is about to be copied.
4687
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the accumulator, so that the value in hand is this string: for a string the accumulator holds the address of the descriptor and not the text.
468A
LD A,03H 3E 03
Load Register A with 03H, the string type, which is also the count of bytes a descriptor takes.
468C
LD (7142H),A 32 42 71
Store Register A into the byte at 7142H, the type of the value in hand, which is what the copy below takes its count of bytes from and what every caller reads afterwards.
468F
Call 2946H of BASIC/OV1, which copies as many bytes as 7142H names, three, from the address in Register Pair DE to the address in Register Pair HL and leaves Register Pair HL past the last of them.
4692
LD DE,7178H 11 78 71
Load Register Pair DE with 7178H, HIPT, the high pointer of the string area, which stands immediately above the temporary descriptor pool and so is the pool's ceiling.
4695
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the new free slot pointer has reached that ceiling: this is the only test that the pool has room, and its flags are what the RET NZ at 469DH acts on.
4698
LD (7155H),HL 22 55 71
Store Register Pair HL into the word at 7155H, the new next free slot, which is done whether the pool has filled up or not.
469B
POP HL E1
Pop Register Pair HL, the address the scan stopped at that 4678H left on the stack, which is where the caller goes on reading.
469C
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the scan stopped on, which is handed back as the result: a load changes no flag, so the comparison made at 4695H is still the one in force.
469D
RET NZ C0
Return on NZ, the temporary descriptor pool having room: this is the ordinary exit, and Register Pair HL and Register A are the two things the caller is given.
469E
LD DE,0010H 11 10 00
Load Register Pair DE with 0010H, error 16, String formula too complex, the pool of temporary descriptors having filled up.
46A1
Jump to 5886H, the error handler, which writes the message and the line number: this is what an expression with more temporary strings in flight than the pool holds gives.

46A4H - The Two Text Writers (46A4H-46BCH)

Everything the interpreter writes as text goes out through one of these two entries. 46A5H writes a 00H terminated text standing in memory and nine routines call it, among them the in of an error message at 3135H, READY's own writing at 5908H, INPUT's ?Redo from start at 63B1H and the error printer at 6671H; it makes a string of the text with the collector and falls into the other entry. 46A8H writes the string the accumulator holds and PRINT reaches it at 628FH, WRITE at 5727H and 5749H, and INPUT's prompt at 63F0H. 46A4H is 46A5H with the pointer stepped on by one, which suits a caller standing on a count byte rather than on the first character. The write itself is a four instruction loop whose count is Register D and whose first turn is made to work by the increment at 46AEH that the decrement at 46AFH undoes, the same shape the blank strip at 466DH and the byte move at 4811H use. One thing the loop does besides writing: a character of 0DH is followed by a call of 41FAH, so a carriage return inside a string moves the display on rather than being sent as a bare code.

46A4
INC HL 23
The writer entered one short (46A4H), which 3139H puts on the stack at 313CH as the address the line number printer returns through: step Register Pair HL on to the first character of the text.
46A5
The text writer (46A5H), which 3135H, 403BH, 41DEH, 5908H, 63B1H, 6671H and three others call: call 464FH, which steps Register Pair HL back one and takes both delimiters as 22H, so the collector runs to the 00H byte that ends the text and makes a temporary string of it.
46A8
The string writer (46A8H), which 40B5H, 5727H, 5749H, 628FH and 63F0H call: call 481DH, which takes the descriptor address out of the accumulator at 72ECH and gives the string's space back when it is the topmost temporary, which is what keeps a written temporary from piling up.
46AB
Call 2937H of BASIC/OV1, which reads the descriptor and returns its length in Register D and the address of its text in Register Pair BC.
46AE
INC D 14
Increment Register D, the count of characters, which the decrement below undoes so that the first turn of the loop writes a character rather than stepping over one.
46AF
DEC D 15
Decrement Register D, the count of characters still to write.
46B0
RET Z C8
Return on Z, every character of the string having been written.
46B1
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, the next character of the string.
46B2
Call 40D8H, the character output, which sends Register A to whatever device the output is going to and keeps the print position at 713CH.
46B5
CP 0DH FE 0D
Compare Register A with 0DH, a carriage return.
46B7
Call 41FAH on Z, which moves the display on a line, so that a carriage return stored inside a string acts as one rather than being sent as a bare code.
46BA
INC BC 03
Step Register Pair BC on to the character after it.
46BB
Jump back to 46AFH, which lowers the count and writes the next character.

46BDH - The String Space Allocator (46BDH-46E0H)

Every string the interpreter stores takes its bytes here, off the top of the string area, and the whole of the routine is twenty eight bytes. The area grows downward: 7178H, which NEWB/EQU names HIPT, is the lowest byte in use, and 71A3H, LOPT, is the highest address the variables and arrays have reached, so the free space is what lies between them. The request is the count in Register A, and the subtraction is made the long way round, the CPL at 46C8H with the 0FFH in Register B building the negative of the count plus one so that one ADD HL,BC and one INC HL do the work. What happens when it will not fit is the interesting part. There is no room, so the string space is collected at 46E1H and the request is made again; and the way the routine remembers that it has already collected once is the Zero Flag, which 46E1H sets with a CP A before pushing it and which the collector's return at 46BFH takes off the stack. 46BFH is an entry inside an instruction: the LD C,0F1H at 46BEH leaves 0F1H in Register C where nothing reads it, 46C9H loading Register C again, and its operand byte is the POP AF the collector returns to. So a first failure collects and retries and a second gives Out of string space. The flags of the first attempt come from the OR A at 46BDH, which leaves the Zero Flag set only for a request of 00H bytes, so a zero length request that will not fit is refused without collecting, which can only happen on a system whose two pointers have already crossed.

46BD
OR A B7
The string space allocator (46BDH), which 462EH, 4641H, 48CAH and 4E62H call with the count of bytes wanted in Register A: OR Register A with itself, which sets the Zero Flag only for a request of 00H bytes and is the flag the refusal at 46DEH acts on.
46BE
LD C,0F1H 0E F1
Load Register C with 0F1H, whose operand byte at 46BFH is the POP AF that the string collection at 46E1H returns to: the 0F1H is read by nothing, Register C being loaded again at 46C9H.
46C0
PUSH AF F5
Push Register Pair AF, Register A holding the count of bytes wanted and the Zero Flag saying whether the collection has already been made, which the pops at 46D8H and 46DAH bring back.
46C1
LD HL,(71A3H) 2A A3 71
Load Register Pair HL with the word at 71A3H, LOPT, the end of the arrays and the lowest address the string area may not come down to.
46C4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that floor into Register Pair DE for the comparison below.
46C5
LD HL,(7178H) 2A 78 71
Load Register Pair HL with the word at 7178H, HIPT, the lowest byte of the string area in use.
46C8
CPL 2F
Complement Register A, which leaves the one's complement of the count of bytes wanted.
46C9
LD C,A 4F
Load Register C with Register A, the low byte of the negative of the count less one.
46CA
LD B,0FFH 06 FF
Load Register B with 0FFH, which makes Register Pair BC the two's complement of the count plus one, so that the addition below subtracts the count and one more.
46CC
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which brings Register Pair HL to one below where the new bytes would begin.
46CD
INC HL 23
Increment Register Pair HL to the address the new bytes would begin at.
46CE
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Carry Flag when the new bottom of the string area would be below LOPT.
46D1
Jump to 46DAH on C, there being no room between the arrays and the string area for the bytes asked for.
46D3
LD (7178H),HL 22 78 71
Store Register Pair HL into the word at 7178H, HIPT, which is what takes the bytes: the string area now reaches down to here.
46D6
INC HL 23
Increment Register Pair HL, which is a step that is undone by the exchange below reading it as the address of the first byte taken.
46D7
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address of the space into Register Pair DE where every caller expects it.
46D8
POP AF F1
Pop Register Pair AF, which puts the count of bytes back into Register A and restores the flags of the request.
46D9
RET C9
Return with Register Pair DE holding the address of the bytes taken and Register A holding their count.
46DA
POP AF F1
The no room path (46DAH): pop Register Pair AF, which brings back the count in Register A and, in the Zero Flag, whether the string space has already been collected once for this request.
46DB
LD DE,000EH 11 0E 00
Load Register Pair DE with 000EH, error 14, Out of string space.
46DE
Jump to 5886H on Z, the error handler, the collection having already been made and the space still not being there: this is the only way out when the string area and the arrays have met.
46E1
CP A BF
Compare Register A with itself, which sets the Zero Flag whatever Register A holds: this is the mark that the collection below has been made, and it is what turns a second failure into the error above.
46E2
PUSH AF F5
Push Register Pair AF, the count of bytes wanted and that mark, which the POP AF at 46BFH takes off the stack when the collection has finished.
46E3
LD BC,46BFH 01 BF 46
Load Register Pair BC with 46BFH, the POP AF inside the instruction at 46BEH, which is where the collection returns to so that the request is made again from the top.
46E6
PUSH BC C5
Push Register Pair BC, which puts 46BFH on the stack as the address the collection leaves through.

46E7H - The String Space Collection: the Scan (46E7H-4788H)

This is the routine that gives a BASIC program its longest unexplained pause, and 427AH, 4A72H and 5640H call it outright besides the allocator falling into it at 46E1H. The string area holds the text of every string, and a string that is thrown away leaves its bytes where they are, so the area fills up with text nothing points at. The collection moves the text that is still wanted up against the top of memory, highest first, and lowers a ceiling after each one; when it finds nothing below the ceiling the area is packed and everything below the ceiling is free. It is the plain quadratic algorithm: one whole sweep of every string descriptor in the interpreter finds one string, so a program with a thousand live strings sweeps a thousand times, which is why the pause grows as the square of the number of strings and why it is felt and not measured. A sweep looks in four places, and the four are what the code between 46F5H and 4787H is: the pool of temporary descriptors from 7157H up to 7155H; the simple variables from VARTAB 719FH up to the array table at 71A1H; the chain of variable regions whose head is the word at 7229H, which module 2 fills in at 8416H with 71C1H, the header of the parameter region of a user-defined function call that the variable search walks at 3A9DH, each block of the chain holding its next block's address, then its length, then its variables; and the array table from 71A1H up to LOPT 71A3H, where only an array whose type byte is 03H is looked into and every element of it is a descriptor. Two words ride on the stack through the whole sweep and are the sweep's answer: the text address of the highest string found so far, which 46F4H starts at LOPT so that any string in the area beats it, and the position just past that string's descriptor, which 46F0H starts at 0000H to mean that none has been found.

46E7
LD HL,(7153H) 2A 53 71
The string space collection (46E7H), which 427AH, 4A72H and 5640H call: load Register Pair HL with the word at 7153H, the top of the program and variable space, which is the highest byte the string area may use.
46EA
LD (7178H),HL 22 78 71
The ceiling (46EAH), which the move at 47CEH jumps back to with the ceiling lowered: store Register Pair HL into the word at 7178H, HIPT, so that the first sweep looks at every string in the area and each later one looks only below the string it has just moved.
46ED
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, which stands for no string having been found yet.
46F0
PUSH HL E5
Push Register Pair HL, that 0000H, which is the lower of the two words the sweep carries and which 47AEH pops as the position past the highest string's descriptor.
46F1
LD HL,(71A3H) 2A A3 71
Load Register Pair HL with the word at 71A3H, LOPT, the end of the arrays and the lowest address any string's text can stand at.
46F4
PUSH HL E5
Push Register Pair HL, that floor, which is the upper of the two words the sweep carries and which every string in the area beats, so that the first descriptor the sweep looks at becomes the highest found so far.
46F5
LD HL,7157H 21 57 71
The sweep of the temporary descriptors (46F5H): load Register Pair HL with 7157H, the first slot of the pool of temporary string descriptors.
46F8
LD DE,(7155H) ED 5B 55 71
Load Register Pair DE with the word at 7155H, the next free slot of that pool, which is where the used slots end.
46FC
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when every used slot has been looked at.
46FF
LD BC,46F8H 01 F8 46
Load Register Pair BC with 46F8H, this sweep's own loop address, which the push at 4788H makes the address the examiner returns through.
4702
Jump to 4788H on NZ, which pushes that loop address and examines the descriptor Register Pair HL stands on, so that the pool is walked a slot at a time.
4705
LD HL,7229H 21 29 72
The sweep of the simple variables (4705H): load Register Pair HL with 7229H, the head of the chain of variable regions, which is read as the next pointer of a block that does not exist so that the first real block is found the same way as every later one.
4708
LD (7295H),HL 22 95 72
Store Register Pair HL into the word at 7295H, the cell that holds where the chain walk has reached.
470B
LD HL,(71A1H) 2A A1 71
Load Register Pair HL with the word at 71A1H, the start of the array table, which is also the end of the simple variables.
470E
LD (7292H),HL 22 92 72
Store Register Pair HL into the word at 7292H, the first address above the region being walked, which is the limit the walk below stops at.
4711
LD HL,(719FH) 2A 9F 71
Load Register Pair HL with the word at 719FH, VARTAB, the start of the simple variables, which is where this region begins.
4714
LD DE,(7292H) ED 5B 92 72
The variable walk (4714H), which both the simple variables and every block of the chain come through: load Register Pair DE with the word at 7292H, the first address above the region.
4718
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the walk has reached that limit.
471B
Jump to 4734H on Z, the region being done, which takes the next block of the chain.
471D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, this variable's type byte, which is 02H, 03H, 04H or 08H and is also the count of bytes its value takes.
471E
INC HL 23
Step Register Pair HL on past the type byte, on to the first character of the variable's name.
471F
INC HL 23
Step Register Pair HL on past the first character of the name.
4720
INC HL 23
Step Register Pair HL on past the second character of the name.
4721
PUSH AF F5
Push Register Pair AF, the type byte in Register A, which the pop at 4725H brings back once the name has been stepped over.
4722
Call 3CDDH, which steps Register Pair HL over whatever the name holds beyond its first two characters, so that Register Pair HL stands on the value.
4725
POP AF F1
Pop Register Pair AF, which puts the type byte back into Register A.
4726
CP 03H FE 03
Compare Register A with 03H, the string type, this being the only type whose value is a descriptor rather than a number.
4728
Jump to 472EH on NZ, the variable not being a string, whose value is stepped over by its own length.
472A
Call 4789H, the descriptor examiner, which weighs this string against the highest found so far and leaves Register Pair HL past the three bytes of the descriptor.
472D
XOR A AF
Clear Register A to 00H, the examiner having already stepped Register Pair HL past the value, so that the addition below adds nothing.
472E
LD E,A 5F
Load Register E with Register A, the count of bytes this variable's value takes, which is 00H for a string and the type byte for anything else.
472F
LD D,00H 16 00
Load Register D with 00H, which makes Register Pair DE that count alone.
4731
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which brings Register Pair HL to the type byte of the next variable of the region.
4732
Jump back to 4714H, which weighs that variable in its turn.
4734
LD HL,(7295H) 2A 95 72
The next block of the chain (4734H): load Register Pair HL with the word at 7295H, the block the walk has reached, whose first word is the address of the block after it.
4737
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of that address.
4738
INC HL 23
Step Register Pair HL on to the high byte of it.
4739
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the address of the next block.
473A
LD A,D 7A
Load Register A with Register D, the high byte of that address.
473B
OR E B3
OR Register A with Register E, which sets the Zero Flag when the address is 0000H and the chain has ended.
473C
LD HL,(71A1H) 2A A1 71
Load Register Pair HL with the word at 71A1H, the start of the array table, which is where the sweep goes on when the chain is done.
473F
Jump to 4754H on Z, the chain having ended, which sweeps the arrays.
4741
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the next block's address into Register Pair HL.
4742
LD (7295H),HL 22 95 72
Store Register Pair HL into the word at 7295H, so that the walk comes back to this block to find the one after it.
4745
INC HL 23
Step Register Pair HL on past the low byte of the block's next pointer.
4746
INC HL 23
Step Register Pair HL on past its high byte, which leaves Register Pair HL on the block's length word.
4747
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the block's length in bytes.
4748
INC HL 23
Step Register Pair HL on to the high byte of that length.
4749
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the length.
474A
INC HL 23
Step Register Pair HL on to the first byte of the block's own variables.
474B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the length into Register Pair HL and the address of the variables into Register Pair DE.
474C
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which gives the first address above the block's variables.
474D
LD (7292H),HL 22 92 72
Store Register Pair HL into the word at 7292H, the limit the walk is to stop at.
4750
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address of the block's first variable back into Register Pair HL.
4751
Jump back to 4714H, which walks this block's variables exactly as it walked the simple ones.
4753
POP BC C1
The next array (4753H): pop Register Pair BC, the address of this array's own data that 476BH pushed, which is thrown away for an array that holds no strings.
4754
LD DE,(71A3H) ED 5B A3 71
The sweep of the arrays (4754H): load Register Pair DE with the word at 71A3H, LOPT, the end of the arrays.
4758
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when every array has been looked at.
475B
Jump to 47ADH on Z, every one of the four places having been swept, which moves the highest string the sweep found.
475E
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, this array's type byte.
475F
INC HL 23
Step Register Pair HL on past the type byte, on to the first character of the array's name.
4760
PUSH AF F5
Push Register Pair AF, that type byte in Register A, which the pop at 476AH brings back.
4761
INC HL 23
Step Register Pair HL on past the first character of the array's name.
4762
INC HL 23
Step Register Pair HL on past the second character of it.
4763
Call 3CDDH, which steps Register Pair HL over whatever the name holds beyond those two characters.
4766
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the array's whole length, which every array entry carries and the simple variables do not.
4767
INC HL 23
Step Register Pair HL on to the high byte of that length.
4768
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds the array's whole length.
4769
INC HL 23
Step Register Pair HL on to the count of dimensions.
476A
POP AF F1
Pop Register Pair AF, which puts the array's type byte back into Register A.
476B
PUSH HL E5
Push Register Pair HL, the address of the count of dimensions, which the pop at 4774H brings back for a string array and 4753H throws away for any other.
476C
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which gives the type byte of the next array.
476D
CP 03H FE 03
Compare Register A with 03H, the string type.
476F
Jump back to 4753H on NZ, the array holding numbers, whose elements are no business of the collection.
4771
LD (717CH),HL 22 7C 71
Store Register Pair HL into the word at 717CH, the first address above this array, which is the limit its own element walk stops at.
4774
POP HL E1
Pop Register Pair HL, the address of the count of dimensions that 476BH pushed.
4775
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the count of dimensions, there being one bound word for each.
4776
LD B,00H 06 00
Load Register B with 00H, which makes Register Pair BC that count alone.
4778
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps over one byte for each dimension.
4779
ADD HL,BC 09
Add Register Pair BC to Register Pair HL again, which steps over the second byte of each, the bounds being words.
477A
INC HL 23
Step Register Pair HL on past the count of dimensions itself, which leaves Register Pair HL on the array's first element.
477B
EX DE,HL EB
The element walk (477BH), which the examiner returns to: exchange Register Pair DE with Register Pair HL, which puts the element pointer into Register Pair DE.
477C
LD HL,(717CH) 2A 7C 71
Load Register Pair HL with the word at 717CH, the first address above this array.
477F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the element pointer back into Register Pair HL and that limit into Register Pair DE.
4780
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when every element has been looked at.
4783
Jump back to 4754H on Z, this array being done, which takes the next one.
4785
LD BC,477BH 01 7B 47
Load Register Pair BC with 477BH, the element walk above, which is the address the examiner is to return through.
4788
PUSH BC C5
Push Register Pair BC, which puts that address on the stack and falls into the examiner below: this is the one instruction the pool sweep at 4702H and the element walk share, each having put its own loop address into Register Pair BC.

4789H - The String Space Collection: the Highest String and the Move (4789H-47D0H)

Two routines finish the collection. 4789H is the examiner, called once for every string descriptor the sweep finds, and its whole business is to keep the highest text address below the ceiling together with the position just past its descriptor. It does that on the stack rather than in registers, which is why it reads so oddly: 479CH takes its own return address off, the two EX (SP),HL instructions at 479DH and 47A1H bring the best address out and put it back without a register to spare, and when a new best is found 47A6H to 47ACH pops the return address and both old words, pushes the two new ones and the return address again, and returns by RET. Three things make the examiner give up at once: a descriptor whose length is 00H, a text address above the ceiling, which means the string has already been moved in an earlier sweep, and a text address below the best so far. 47ADH is the move, and it is reached only when a whole sweep has finished. The descriptor position the sweep left is walked backwards to get the length and the address, 423AH copies the text up against the ceiling from its last byte downwards so that a move onto overlapping bytes is safe, the descriptor is given its new address, and 47CEH jumps back to 46EAH with the ceiling set one below the text just moved, which starts the next sweep. A sweep that finds nothing leaves 0000H as the descriptor position and the RET Z at 47B1H ends the collection there, with the string area packed and HIPT standing at the bottom of the packed text.

4789
XOR A AF
The descriptor examiner (4789H), which 472AH calls and which 4702H and 4785H reach through the push above: clear Register A to 00H.
478A
OR (HL) B6
OR Register A with the byte Register Pair HL addresses, the length byte of the descriptor, which sets the Zero Flag when the string holds no characters.
478B
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
478C
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address the string's text stands at.
478D
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
478E
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds that text address.
478F
INC HL 23
Step Register Pair HL on past the descriptor, which is where the caller goes on walking and is the position this routine keeps when the string turns out to be the highest.
4790
RET Z C8
Return on Z, the string holding no characters and so having no text that needs moving.
4791
LD B,H 44
Load Register B with Register H, which saves the high byte of the position past the descriptor.
4792
LD C,L 4D
Load Register C with Register L, which saves the low byte of it, Register Pair HL being needed for the comparison below.
4793
LD HL,(7178H) 2A 78 71
Load Register Pair HL with the word at 7178H, HIPT, the ceiling the collection has lowered to.
4796
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Carry Flag when the ceiling is below this string's text.
4799
LD H,B 60
Load Register H with Register B, which begins putting the position past the descriptor back.
479A
LD L,C 69
Load Register L with Register C, which finishes putting it back, whatever the comparison found.
479B
RET C D8
Return on C, the text standing above the ceiling: this string was moved by an earlier sweep and is already packed.
479C
POP HL E1
Pop Register Pair HL, this routine's own return address, there being no register free to hold the best address while it is compared.
479D
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the highest text address found so far into Register Pair HL and leaves the return address on the stack in its place.
479E
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Carry Flag when the best so far is below this string's text.
47A1
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses again, which puts the best so far back on the stack and brings the return address into Register Pair HL.
47A2
PUSH HL E5
Push Register Pair HL, the return address, which puts the stack back as it was with the two carried words under it.
47A3
LD H,B 60
Load Register H with Register B, which begins restoring the position past this descriptor.
47A4
LD L,C 69
Load Register L with Register C, which finishes restoring it, so that either exit hands the caller the same value.
47A5
RET NC D0
Return on NC, the best so far standing at or above this string: nothing changes and the caller goes on walking.
47A6
POP BC C1
Pop Register Pair BC, the return address, this string being the new highest and the two carried words having to be replaced.
47A7
POP AF F1
Pop Register Pair AF, which throws away the text address of the old best.
47A8
POP AF F1
Pop Register Pair AF, which throws away the position past the old best's descriptor.
47A9
PUSH HL E5
Push Register Pair HL, the position past this descriptor, which becomes the lower of the two carried words.
47AA
PUSH DE D5
Push Register Pair DE, this string's text address, which becomes the upper of them.
47AB
PUSH BC C5
Push Register Pair BC, the return address, which goes back on top where the return below wants it.
47AC
RET C9
Return to the caller with Register Pair HL past this descriptor and the two carried words naming this string.
47AD
POP DE D1
The move (47ADH), which 475BH reaches when a whole sweep has finished: pop Register Pair DE, the text address of the highest string the sweep found, which the descriptor itself is read for below.
47AE
POP HL E1
Pop Register Pair HL, the position just past that string's descriptor, which is 0000H when the sweep found nothing.
47AF
LD A,H 7C
Load Register A with Register H, the high byte of it.
47B0
OR L B5
OR Register A with Register L, which sets the Zero Flag when the position is 0000H.
47B1
RET Z C8
Return on Z, no string having been found below the ceiling: the string area is packed and the collection is done, returning through 46BFH for the allocator or to whichever of 427AH, 4A72H and 5640H called.
47B2
DEC HL 2B
Step Register Pair HL back on to the third byte of the descriptor, which 477EH and 483DH also hold as a word.
47B3
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte of the text's present address.
47B4
DEC HL 2B
Step Register Pair HL back on to the second byte of the descriptor.
47B5
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, so that Register Pair BC holds that address.
47B6
PUSH HL E5
Push Register Pair HL, the address of the descriptor's second byte, which the pop at 47C7H brings back to be written with the new address.
47B7
DEC HL 2B
Step Register Pair HL back on to the length byte of the descriptor.
47B8
LD L,(HL) 6E
Load Register L with the byte Register Pair HL addresses, the string's length.
47B9
LD H,00H 26 00
Load Register H with 00H, which makes Register Pair HL that length alone.
47BB
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which gives the first address above the string's text.
47BC
LD D,B 50
Load Register D with Register B, the high byte of the text's address.
47BD
LD E,C 59
Load Register E with Register C, so that Register Pair DE holds the address the text begins at, which is where the copy is to stop.
47BE
DEC HL 2B
Step Register Pair HL back on to the last byte of the text itself.
47BF
LD B,H 44
Load Register B with Register H, the high byte of that last byte's address.
47C0
LD C,L 4D
Load Register C with Register L, so that Register Pair BC holds it.
47C1
LD HL,(7178H) 2A 78 71
Load Register Pair HL with the word at 7178H, HIPT, the ceiling, which is the address the last byte of the text is to end up at.
47C4
Call 423AH, which exchanges Register Pair HL and Register Pair BC through the stack and then copies downwards from the last byte of the text to the address in Register Pair DE, so that a move onto bytes the text itself occupies cannot overwrite what it has still to read.
47C7
POP HL E1
Pop Register Pair HL, the address of the descriptor's second byte that 47B6H pushed.
47C8
LD (HL),C 71
Store Register C into the byte Register Pair HL addresses, the low byte of the text's new address, Register Pair BC having come back from the move holding where the text now begins.
47C9
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
47CA
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the high byte of it, which is the whole of what the move leaves behind: the length is unchanged and no other cell names the text.
47CB
LD H,B 60
Load Register H with Register B, the high byte of the text's new address.
47CC
LD L,C 69
Load Register L with Register C, so that Register Pair HL holds it.
47CD
DEC HL 2B
Step Register Pair HL back one, to the byte below the text just packed, which is the new ceiling.
47CE
Jump back to 46EAH, which stores that ceiling into HIPT and begins another whole sweep: this is the jump that makes the collection quadratic, one sweep of every descriptor in the interpreter buying one string.

47D1H - The String Concatenation, and the Four Entries that Take a String in Hand (47D1H-4849H)

47D1H is the plus sign on strings, and the evaluator at 7372H is the only thing that reaches it. It works the second operand out for itself through 74C1H rather than being handed it, which is why it begins by putting the first operand's descriptor on the stack and trading it for the text pointer twice over with two EX (SP),HL instructions. The total length is added in one byte at 47E4H, so a result of more than 255 characters gives String too long and the addition's own Carry Flag is the whole of the test. What follows is the pattern of every string result in this band: take the space, give the operands' space back if they were temporaries, move the texts, make the descriptor the accumulator's string. The two texts are moved by two calls of the same routine, 4809H, which takes its descriptor off the stack from under its own return address and leaves Register Pair DE past the bytes it moved, so the second call lays its text directly after the first with no arithmetic between them; 4811H is that routine's own move, which 463AH and others call with the count already in Register L. The four entries at the end are the ones the whole interpreter uses to take a string in hand, and they stand one instruction apart so that a caller joins at the point that suits what it already holds: 481AH insists the value is a string first and eleven routines call it, 481DH takes the descriptor address out of the accumulator, 4820H expects it in Register Pair HL, and 4821H expects it in Register Pair DE. All four end at the same place, giving the string's space back when, and only when, its descriptor is the topmost temporary, which is what 483AH decides.

47D1
PUSH BC C5
The string concatenation (47D1H), which the evaluator calls at 7372H for a plus sign between two strings: push Register Pair BC, the word the evaluator wants back.
47D2
PUSH HL E5
Push Register Pair HL, the program text pointer standing after the plus sign, which the exchange below trades for the first operand's descriptor.
47D3
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the accumulator, which for a string holds the address of its three byte descriptor: this is the first operand.
47D6
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that descriptor address on the stack and brings the text pointer back into Register Pair HL.
47D7
Call 74C1H, the expression evaluator, which works the second operand out and leaves it in the accumulator with the text pointer in Register Pair HL standing after it.
47DA
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses again, which puts the new text pointer on the stack and brings the first operand's descriptor address back into Register Pair HL.
47DB
Call 2AB0H of BASIC/OV1, which insists that what the evaluator left is a string and gives Type mismatch through 5884H when it is not: this is where A$ + 1 is refused.
47DE
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the first operand's text.
47DF
PUSH HL E5
Push Register Pair HL, the first operand's descriptor address, which the exchange at 47F2H brings back.
47E0
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the accumulator, which now holds the second operand's descriptor address.
47E3
PUSH HL E5
Push Register Pair HL, that address, which the pop at 47EEH brings back.
47E4
ADD A,(HL) 86
Add the byte Register Pair HL addresses to Register A, the second operand's length, which sets the Carry Flag when the two lengths come to more than 255.
47E5
LD DE,000FH 11 0F 00
Load Register Pair DE with 000FH, error 15, String too long.
47E8
Jump to 5886H on C, the error handler, the result not fitting in the one byte a descriptor's length takes: this is the only limit on how long a string may be.
47EB
Call 4641H, which takes Register A bytes of string space, collecting the space first if it must, and builds a descriptor for them at 7175H.
47EE
POP DE D1
Pop Register Pair DE, the second operand's descriptor address that 47E3H pushed.
47EF
Call 4821H, which gives the second operand's space back when its descriptor is the topmost temporary and returns that descriptor address in Register Pair HL either way.
47F2
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the second operand's descriptor address on the stack and brings the first operand's back into Register Pair HL.
47F3
Call 4820H, which puts that address into Register Pair DE and gives the first operand's space back when its descriptor is the topmost temporary.
47F6
PUSH HL E5
Push Register Pair HL, the first operand's descriptor address, so that the two descriptors stand on the stack with the first on top, which is the order the two moves below take them in.
47F7
LD HL,(7176H) 2A 76 71
Load Register Pair HL with the word at 7176H, the address field of the descriptor 4641H has just built, which is where the joined text is to be laid.
47FA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE where the move below writes to.
47FB
Call 4809H, which takes the first operand's descriptor off the stack from under its own return address, moves its text to the address in Register Pair DE and leaves Register Pair DE past the last byte it wrote.
47FE
Call 4809H again, which does the same for the second operand's descriptor and so lays its text directly after the first operand's, no arithmetic being needed between the two calls.
4801
LD HL,7355H 21 55 73
Load Register Pair HL with 7355H, the address inside the evaluator this routine is to return to, the two descriptors having now been taken off the stack.
4804
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves 7355H on the stack as the return address and brings the program text pointer back into Register Pair HL.
4805
PUSH HL E5
Push Register Pair HL, the text pointer, which the pop at 469BH takes back so that the evaluator goes on reading where the second operand ended.
4806
Jump to 467FH, which makes the descriptor at 7175H the accumulator's string in a temporary slot and returns through the 7355H left below.
4809
POP HL E1
The descriptor move (4809H), which 47FBH and 47FEH call and which 47F8H holds as a word: pop Register Pair HL, this routine's own return address, so that the descriptor address below it can be reached.
480A
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the descriptor address into Register Pair HL and puts the return address on the stack in its place.
480B
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of that string's text.
480C
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
480D
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the address the text stands at.
480E
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
480F
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds where the text is to be read from.
4810
LD L,A 6F
Load Register L with Register A, the length, which the move below counts down.
4811
INC L 2C
The byte move (4811H), which 463AH and 48DEH call with the count already in Register L: increment Register L, which the decrement below undoes so that the first turn moves a byte rather than stepping over one.
4812
DEC L 2D
Decrement Register L, the count of bytes still to move.
4813
RET Z C8
Return on Z, every byte having been moved: for 4809H this returns to the address its own exchange left on the stack.
4814
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, the next byte of the text.
4815
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, its place in the new text.
4816
INC BC 03
Step Register Pair BC on to the byte after it.
4817
INC DE 13
Step Register Pair DE on to the place after it, which is what leaves Register Pair DE ready for a second move straight after the first.
4818
Jump back to 4812H, which lowers the count and moves the next byte.
481A
The string in hand (481AH), which 45E7H, 484EH, 496BH, 4A0CH, 4AE9H, 4D23H and five others call: call 2AB0H of BASIC/OV1, which insists that the value in the accumulator is a string and gives Type mismatch through 5884H when it is not.
481D
LD HL,(72ECH) 2A EC 72
The entry that reads the accumulator (481DH), which 4624H, 46A8H, 4A6FH, 6480H and 772BH call with the type already known: load Register Pair HL with the word at 72ECH, the address of the string's descriptor.
4820
EX DE,HL EB
The entry that takes the address in Register Pair HL (4820H), which 407CH, 47F3H and 497DH call: exchange Register Pair DE with Register Pair HL, which puts the descriptor address into Register Pair DE.
4821
The entry that takes the address in Register Pair DE (4821H), which 45F2H, 47EFH and 48E2H call: call 483AH, which sets the Zero Flag when that descriptor is the topmost temporary and frees its slot, leaving the address of the text it names in Register Pair BC.
4824
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the descriptor address back into Register Pair HL for the return, whichever exit is taken.
4825
RET NZ C0
Return on NZ, the descriptor not being the topmost temporary: a string held by a variable or standing under another temporary keeps its space, and only Register Pair HL is given to the caller.
4826
PUSH DE D5
Push Register Pair DE, which is the same address, 483AH having returned the Zero Flag only when the slot it found is this very descriptor: the pop at 4838H brings it back as the result.
4827
LD D,B 50
Load Register D with Register B, the high byte of the address of the text this descriptor names.
4828
LD E,C 59
Load Register E with Register C, so that Register Pair DE holds that address.
4829
DEC DE 1B
Step Register Pair DE back one, to the byte below the text, which is what HIPT stands at when this text is the lowest thing in the string area.
482A
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the length of the text, which is how far the ceiling can be raised.
482B
LD HL,(7178H) 2A 78 71
Load Register Pair HL with the word at 7178H, HIPT, the lowest byte of the string area in use.
482E
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag only when the text is the lowest thing in the string area, and leaves Register A holding 00H when it does.
4831
Jump to 4838H on NZ, the text standing above something else in the area: its bytes cannot be given back without leaving a hole, so they are left for the collection to deal with.
4833
LD B,A 47
Load Register B with Register A, which is 00H, 434DH having returned equal, so that Register Pair BC holds the length alone.
4834
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which raises the ceiling by the length of the text.
4835
LD (7178H),HL 22 78 71
Store Register Pair HL into the word at 7178H, HIPT, which gives the bytes back: this is the one place in the interpreter where string space is recovered without a collection.
4838
POP HL E1
Pop Register Pair HL, the descriptor address that 4826H pushed, which is what the caller is given.
4839
RET C9
Return with Register Pair HL holding the descriptor address and the string's space given back when it could be.
483A
LD HL,(7155H) 2A 55 71
The topmost temporary test (483AH), which 4821H calls and which 4842H reaches: load Register Pair HL with the word at 7155H, the next free slot of the temporary descriptor pool.
483D
DEC HL 2B
Step Register Pair HL back on to the third byte of the slot below it, the last temporary made.
483E
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte of the address that temporary's text stands at.
483F
DEC HL 2B
Step Register Pair HL back on to the second byte of that slot.
4840
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, so that Register Pair BC holds that address.
4841
DEC HL 2B
Step Register Pair HL back on to the first byte of the slot, which is the address of the descriptor itself.
4842
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the descriptor the caller named is this very slot.
4845
RET NZ C0
Return on NZ, the descriptor being a variable's or a slot below the top: nothing is freed.
4846
LD (7155H),HL 22 55 71
Store Register Pair HL into the word at 7155H, which gives the slot back by lowering the pool's pointer over it.
4849
RET C9
Return with the Zero Flag set, the slot freed and Register Pair BC holding the address of the text it named.

484AH - LEN, ASC and CHR$, and the Exit the String Functions Share (484AH-4873H)

Three of the shortest functions in the interpreter, and the exit that makes the rest of them work. LEN 484AH and ASC 4856H both give a number back and both push 770CH, four instructions that turn the byte in Register A into the value in the accumulator; LEN's own body at 484EH is also what ASC and VAL begin with, so a string's length is read in one place. ASC of a string of no characters gives Illegal function call, which is what the JP Z at 485DH is for, the flags coming from the OR A at 4854H. CHR$ 4866H is the other way about: it takes one byte of string space before it even looks at the argument, which is safe because the argument is already a number in the accumulator and nothing it does can move a string. 4870H is the exit, and it is two instructions that look like nothing: the single-argument dispatch at 7661H pushes 7585H under the function, and 7585H is a POP HL and a RET; 467FH ends with exactly that POP HL and RET of its own, so a function that leaves through 467FH must first throw the 7585H away, and the POP BC at 4870H is what throws it away. Every string function of this band ends here.

484A
LD BC,770CH 01 0C 77
LEN (484AH), the word the function address table holds at 687FH for token 12H: load Register Pair BC with 770CH, the four instructions that make the byte in Register A the function's numeric result.
484D
PUSH BC C5
Push Register Pair BC, which puts 770CH on the stack as the address the return at 4855H leaves through.
484E
The length of the string in hand (484EH), which ASC reaches at 485AH and VAL at 4912H: call 481AH, which insists that the value in the accumulator is a string, gives its space back when its descriptor is the topmost temporary, and returns that descriptor's address in Register Pair HL.
4851
XOR A AF
Clear Register A to 00H, which the load below copies into Register D.
4852
LD D,A 57
Load Register D with Register A, so that Register D holds 00H: 770CH wants the high byte of its value to be 00H, a length never reaching 256.
4853
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length byte of the descriptor, which is the answer LEN gives.
4854
OR A B7
OR Register A with itself, which sets the Zero Flag when the string holds no characters: this is the test ASC makes and LEN does not.
4855
RET C9
Return, to 770CH for LEN and ASC and to the caller for VAL, with the length in Register A and the descriptor's address in Register Pair HL.
4856
LD BC,770CH 01 0C 77
ASC (4856H), the word the function address table holds at 6885H for token 17H: load Register Pair BC with 770CH, the numeric result maker.
4859
PUSH BC C5
Push Register Pair BC, which puts 770CH on the stack as the address the returns below leave through.
485A
ASC's body (485AH), which STRING$ calls at 4896H when its second argument is a string: call 484EH, the length above, which leaves the length in Register A, the descriptor's address in Register Pair HL and the Zero Flag set for a string of no characters.
485D
Jump to 5F95H on Z, FUNCERR, which gives error 5, Illegal function call: ASC of a string of no characters has no character to report and the manual gives no value for it.
4860
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
4861
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address the text stands at.
4862
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
4863
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds that address.
4864
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the first character of the string, which is the code ASC gives.
4865
RET C9
Return to 770CH with that code in Register A, which makes it the function's value.
4866
CHR$ (4866H), the word the function address table holds at 6887H for token 18H: call 463FH, which loads Register A with 01H and takes one byte of string space for it, building the descriptor at 7175H.
4869
Call 79A2H, the single byte argument reader, which turns the value in the accumulator into Register Pair DE, refuses anything of 256 or more through FUNCERR at 79A5H, and brings the byte back in Register A and Register E.
486C
LD HL,(7176H) 2A 76 71
Load Register Pair HL with the word at 7176H, the address field of the descriptor just built, which is the one byte of string space taken.
486F
LD (HL),E 73
Store Register E, the character's code, into the byte Register Pair HL addresses, which is the whole of the string CHR$ makes.
4870
POP BC C1
The exit the string functions share (4870H), which 48ABH and 48B6H jump to and which 4627H pushes as a return address: pop Register Pair BC, the 7585H the single argument dispatch pushed at 7664H, which is a POP HL and a RET and so would do twice over what 467FH does for itself.
4871
Jump to 467FH, which copies the descriptor at 7175H into a temporary slot, makes it the accumulator's string, pops the text pointer and returns to the evaluator.

4874H - STRING$ and SPACE$, and the Fill (4874H-48B7H)

The two functions that make a string of one character repeated. SPACE$ 489DH is in the function address table at 688BH and takes one argument; STRING$ 4874H is not in the table at all, 7564H jumping to it on token 0D9H from the dispatch of the functions that take more than one argument, and it is the only string function of this band that parses its own brackets. Its second argument may be a number, which is taken as a character code through 79A2H, or a string, whose first character is taken through ASC's body at 4896H, and the manual gives both. 48A2H is the fill: Register A holds the character and Register E the count, and it takes the space, writes the character that many times and leaves through 4870H. One thing in STRING$ is worth seeing: the CALL 48A2H at 489AH is never returned from. The fill leaves through 4870H, whose POP BC throws the top word away, and for a table function that word is the dispatcher's 7585H; here it is the return address this very call pushed. So the call is a jump that pushes a word on purpose, which is how a function reached by a JP rather than through the table arrives at 4870H with the stack the shape 4870H expects.

4874
STRING$ (4874H), which 7564H jumps to on token 0D9H: call 5E93H, NXTCHAR, which steps the text pointer past the token and brings the character after it back in Register A.
4877
Call 4353H, the character demand, which insists on the byte written after this call and gives Syntax error at 4362H for anything else.
487A
DEFB 28H 28
487AH: the opening bracket 4353H compares the line's character with. It is data read by the routine the call at 4877H reaches, not an instruction, and the instruction after that call is the one at 487BH.
487B
Call 799FH, the single byte argument reader, which works the first argument out, refuses 256 or more, and leaves the count in Register A and Register E with Register D holding 00H.
487E
PUSH DE D5
Push Register Pair DE, the count, which the exchange at 488AH brings back once the second argument has been read.
487F
Call 4353H a second time, which demands the byte written after this call in the same way.
4882
DEFB 2CH 2C
4882H: the comma between STRING$'s two arguments, data for the call at 487FH and not an instruction; the instruction after that call is the one at 4883H.
4883
Call 7345H, the expression evaluator, which works the second argument out into the accumulator and leaves its type in the byte at 7142H.
4886
Call 4353H a third time, which demands the byte written after this call and so closes the bracket list.
4889
DEFB 29H 29
4889H: the closing bracket, data for the call at 4886H and not an instruction; the instruction after that call is the one at 488AH.
488A
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the program text pointer on the stack and brings the count 487EH pushed into Register Pair HL.
488B
PUSH HL E5
Push Register Pair HL, the count again, which the pop at 4899H takes into Register Pair DE after the character has been settled.
488C
Call 76A4H, which loads the type from 7142H and subtracts 03H from it, so the Zero Flag is set when the second argument is a string.
488F
Jump to 4896H on Z, the second argument being a string, whose first character is the one to repeat.
4891
Call 79A2H, the single byte argument reader's body, which turns the number in the accumulator into Register Pair DE, refuses 256 or more, and leaves the character's code in Register A.
4894
Jump to 4899H, the character's code being in Register A, which skips the string path below.
4896
Call 485AH, ASC's own body, which insists the value is a string, gives Illegal function call for a string of no characters and leaves its first character's code in Register A.
4899
POP DE D1
Pop Register Pair DE, the count that 488BH pushed, which the fill below reads from Register E.
489A
Call 48A2H, the fill, which never returns here: it leaves through 4870H, whose pop throws this call's own return address away, which is the word a table function finds 7585H in.
489D
SPACE$ (489DH), the word the function address table holds at 688BH for token 1CH: call 79A2H, the single byte argument reader, which leaves the count in Register A and Register E and refuses 256 or more.
48A0
LD A,20H 3E 20
Load Register A with 20H, a blank, which is the character SPACE$ repeats.
48A2
PUSH AF F5
The fill (48A2H), which STRING$ reaches at 489AH: push Register Pair AF, Register A holding the character to repeat, which the pop at 48A8H brings back once the space has been taken.
48A3
LD A,E 7B
Load Register A with Register E, the count of characters wanted, which is what the allocation below takes.
48A4
Call 4641H, which takes Register A bytes of string space, collecting the space first if it must, and builds the descriptor for them at 7175H.
48A7
LD B,A 47
Load Register B with Register A, the count, which the loop below counts down.
48A8
POP AF F1
Pop Register Pair AF, which puts the character to repeat back into Register A.
48A9
INC B 04
Increment Register B, which the decrement below undoes so that the test is made on the count itself.
48AA
DEC B 05
Decrement Register B, the count of characters, which sets the Zero Flag when none were asked for.
48AB
Jump to 4870H on Z, a count of 00H having been asked for, which makes a string of no characters rather than refusing it.
48AD
LD HL,(7176H) 2A 76 71
Load Register Pair HL with the word at 7176H, the address field of the descriptor just built, which is where the characters are written.
48B0
LD (HL),A 77
Store Register A, the character, into the byte Register Pair HL addresses.
48B1
INC HL 23
Step Register Pair HL on to the next byte of the string.
48B2
DEC B 05
Decrement Register B, the count of characters still to write.
48B3
Jump back to 48B0H on NZ, which writes the next one.
48B6
Jump to 4870H, the string being filled, which makes the descriptor the accumulator's string.

48B8H - LEFT$, RIGHT$ and MID$, and the Substring Tail they Share (48B8H-4911H)

The three functions that cut a piece out of a string are one routine with three heads, and what each head works out is two bytes: Register B, how many characters to take, and Register C, how many to step over first. LEFT$ 48B8H sets Register C to 00H, RIGHT$ 48E8H sets it to the length less the count, and MID$ 48F1H sets it to the start position less one and settles Register B against both the length and its own optional third argument. The tail at 48C0H then does the same work for all three: take the space, step the source pointer on by Register C, move Register B bytes, give the original string's space back if it was a temporary, and make the new descriptor the accumulator's string. 48C7H is an entry point inside an instruction, and the instruction was chosen for it: the LD DE,000EH at 48C6H has the operand bytes 0EH and 00H, which stand as a LD C,00H, and the 000EH it loads is read by nothing, 46BDH filling Register Pair DE in at 46D7H and loading 000EH for itself at 46DBH when it fails. That entry is what makes a count larger than the string harmless: the JR C at 48C3H sends such a request there, the offset becomes 00H and Register A becomes the whole length, so RIGHT$("AB",5) gives AB rather than reading past the string. 48BFH is a second entry inside an instruction, the operand byte of the LD A,0E5H at 48BEH, which stands as a PUSH HL. Entering there pushes the descriptor twice rather than once, and that extra word is what 467FH's own POP HL consumes, so 40B2H can call the tail as an ordinary subroutine and be returned to while the table functions reach 48C0H and have 467FH return to the evaluator for them.

48B8
LEFT$ (48B8H), the word the function address table holds at 685DH for token 00H: call 492FH, which demands the closing bracket and takes the count off the stack into Register B.
48BB
XOR A AF
Clear Register A to 00H, which the load below makes the number of characters to step over.
48BC
EX (SP),HL E3
The head the three functions meet at (48BCH), which RIGHT$ jumps to at 48EFH: exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the program text pointer on the stack and brings the string's descriptor address into Register Pair HL.
48BD
LD C,A 4F
Load Register C with Register A, the number of characters to step over before taking any: 00H for LEFT$ and the length less the count for RIGHT$.
48BE
LD A,0E5H 3E E5
Load Register A with 0E5H, whose operand byte at 48BFH is a PUSH HL that 40B2H calls: entering there pushes the descriptor one extra time, which is the word 467FH's own pop takes, so that an ordinary caller is returned to. The 0E5H is written over at 48C1H before anything reads it.
48C0
PUSH HL E5
The substring tail (48C0H), which MID$ pushes as a return address at 4901H: push Register Pair HL, the descriptor's address, which the pop at 48CEH brings back after the space has been taken.
48C1
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the string being cut.
48C2
CP B B8
Compare Register A with Register B, the count of characters asked for, which sets the Carry Flag when the string is shorter than the request.
48C3
Jump to 48C7H on C, the string being shorter than asked for, which is the entry inside the instruction below and sets the step over count to 00H.
48C5
LD A,B 78
Load Register A with Register B, the count asked for, the string being long enough to give it.
48C6
LD DE,000EH 11 0E 00
Load Register Pair DE with 000EH, whose operand bytes at 48C7H and 48C8H stand as the LD C,00H the jump above lands on: the 000EH is read by nothing, 46BDH writing Register Pair DE at 46D7H and loading error 14 for itself at 46DBH.
48C9
PUSH BC C5
Push Register Pair BC, the count in Register B and the step over count in Register C, which the pop at 48CDH brings back after the allocation.
48CA
Call 46BDH, which takes Register A bytes of string space, collecting the space first if it must, and returns their address in Register Pair DE.
48CD
POP BC C1
Pop Register Pair BC, the two counts that 48C9H pushed.
48CE
POP HL E1
Pop Register Pair HL, the descriptor's address that 48C0H pushed.
48CF
PUSH HL E5
Push Register Pair HL, that address again, which the pop at 48E1H brings back so that the original string's space can be given up.
48D0
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
48D1
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the low byte of the address the text stands at, Register B's count having been put on the stack already.
48D2
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
48D3
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of that address.
48D4
LD L,B 68
Load Register L with Register B, so that Register Pair HL holds where the text begins.
48D5
LD B,00H 06 00
Load Register B with 00H, which makes Register Pair BC the step over count alone.
48D7
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps the source pointer on by that count: for LEFT$ it adds nothing, for RIGHT$ it reaches the tail of the string and for MID$ the character the start position names.
48D8
LD B,H 44
Load Register B with Register H, the high byte of the source address.
48D9
LD C,L 4D
Load Register C with Register L, so that Register Pair BC holds where the bytes are to be read from.
48DA
Call 4644H, which builds the new descriptor at 7175H from the count in Register A and the new space's address in Register Pair DE.
48DD
LD L,A 6F
Load Register L with Register A, the count of bytes to move.
48DE
Call 4811H, which moves Register L bytes from the address in Register Pair BC to the address in Register Pair DE.
48E1
POP DE D1
Pop Register Pair DE, the original string's descriptor address that 48CFH pushed.
48E2
Call 4821H, which gives that string's space back when its descriptor is the topmost temporary, which is what keeps A$ = LEFT$(A$+B$,3) from leaving the joined string behind.
48E5
Jump to 467FH, which makes the descriptor at 7175H the accumulator's string, pops the text pointer and returns to the evaluator.
48E8
RIGHT$ (48E8H), the word the function address table holds at 685FH for token 01H: call 492FH, which demands the closing bracket and takes the count off the stack into Register B.
48EB
POP DE D1
Pop Register Pair DE, the string's descriptor address, which the push below puts straight back.
48EC
PUSH DE D5
Push Register Pair DE, that address again, the pop above having been the only way to read it without losing it.
48ED
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the length of the string.
48EE
SUB B 90
Subtract Register B from Register A, which gives the number of characters to step over so that the last Register B of them are taken.
48EF
Jump to 48BCH, which takes that step over count into Register C and runs the tail: a count larger than the length underflows here and is caught by the comparison at 48C2H.
48F1
EX DE,HL EB
MID$ (48F1H), the word the function address table holds at 6861H for token 02H: exchange Register Pair DE with Register Pair HL, which brings the program text pointer into Register Pair HL.
48F2
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the text pointer stands on, which 4A4AH compares with a closing bracket to see whether a third argument was written.
48F3
Call 4934H, which takes the start position off the stack into Register B without demanding a bracket, MID$ having a third argument to read first.
48F6
INC B 04
Increment Register B, which the decrement below undoes so that the test is made on the start position itself.
48F7
DEC B 05
Decrement Register B, the start position, which sets the Zero Flag when it is 00H.
48F8
Jump to 5F95H on Z, FUNCERR, which gives error 5, Illegal function call: the manual numbers a string's characters from one and MID$(A$,0) has no first character to name.
48FB
PUSH BC C5
Push Register Pair BC, the start position in Register B, which the pop at 48FFH brings back into Register A.
48FC
Call 4A4AH, the optional third argument, which loads Register E with 0FFH as the default count and, when the character is not a closing bracket, demands a comma and reads a byte into Register E before demanding the bracket.
48FF
POP AF F1
Pop Register Pair AF, which puts the start position into Register A, a POP AF after a PUSH BC bringing Register B's byte into Register A.
4900
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack and brings the string's descriptor address into Register Pair HL.
4901
LD BC,48C0H 01 C0 48
Load Register Pair BC with 48C0H, the substring tail, which the two bytes worked out below are for.
4904
PUSH BC C5
Push Register Pair BC, which puts 48C0H on the stack as the address the three returns below leave through.
4905
DEC A 3D
Decrement Register A, the start position, which turns it into the number of characters to step over.
4906
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the length of the string, which sets the Carry Flag when the start position falls inside it.
4907
LD B,00H 06 00
Load Register B with 00H, the count to take when it does not.
4909
RET NC D0
Return to 48C0H on NC, the start position standing past the end of the string: the count is 00H and MID$ gives a string of no characters, which is what the manual says.
490A
LD C,A 4F
Load Register C with Register A, the number of characters to step over, the start position falling inside the string.
490B
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the string.
490C
SUB C 91
Subtract Register C from Register A, which gives how many characters stand from the start position to the end.
490D
CP E BB
Compare Register A with Register E, the count asked for, which sets the Carry Flag when fewer characters are there than were asked for.
490E
LD B,A 47
Load Register B with Register A, the count that is there, which is what is taken when the request runs past the end.
490F
RET C D8
Return to 48C0H on C, fewer characters standing than were asked for: MID$ gives what there is and does not complain.
4910
LD B,E 43
Load Register B with Register E, the count asked for, which is what is taken when the string holds that many.
4911
RET C9
Return to 48C0H with the count in Register B and the step over count in Register C.

4912H - VAL, and the Two Argument Helpers the Substring Functions Use (4912H-4938H)

VAL 4912H hands its string to the same number reader that reads a number out of a program line, 2F0FH of BASIC/OV1, and the one problem with doing that is that the reader stops at a byte it recognises as the end and a string has no such byte. So VAL makes one: it reads the byte standing just past the string, writes 00H over it, runs the reader, and puts the byte back. That is what 4920H to 492DH are, and it is why VAL leaves no trace even though it writes into memory that is not its own. A string of no characters is answered before any of that, the JP Z at 4915H going straight to 770CH with Register A holding 00H, so VAL("") is zero. 492FH and 4934H are the two helpers the substring functions share. 492FH demands the closing bracket and falls into 4934H; 4934H is the one that matters, four instructions that reach under their own return address to take the argument the evaluator left on the stack, putting its low byte into Register B and leaving the return address back on top. MID$ calls 4934H directly at 48F3H because it has a third argument to read before its bracket can be demanded, and LEFT$ and RIGHT$ call 492FH because they have not.

4912
VAL (4912H), the word the function address table holds at 6883H for token 16H: call 484EH, LEN's own body, which insists the value is a string, gives its space back when its descriptor is the topmost temporary, and returns the length in Register A, the descriptor's address in Register Pair HL and Register D holding 00H.
4915
Jump to 770CH on Z, the numeric result maker, the string holding no characters and Register A holding 00H: VAL of a string of no characters is zero rather than an error.
4918
LD E,A 5F
Load Register E with Register A, the length of the string, which the addition at 491FH uses to find the byte just past it.
4919
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
491A
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of the address the text stands at.
491B
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
491C
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of that address.
491D
LD L,A 6F
Load Register L with Register A, so that Register Pair HL holds where the text begins.
491E
PUSH HL E5
Push Register Pair HL, that address, which the exchange at 4922H brings back.
491F
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the length being in Register Pair DE, which gives the address of the byte standing just past the string.
4920
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, whatever that byte holds, which is saved so that it can be put back at 492DH.
4921
LD (HL),D 72
Store Register D, which 484EH left holding 00H, into the byte Register Pair HL addresses, which gives the number reader the end marker it needs.
4922
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the address of that byte on the stack and brings the start of the text back into Register Pair HL.
4923
PUSH BC C5
Push Register Pair BC, the byte that was overwritten, which the pop at 492BH brings back.
4924
DEC HL 2B
Step Register Pair HL back one, so that the call below brings the first character of the string back rather than the second.
4925
Call 5E93H, NXTCHAR, which steps the text pointer on and brings the character it now stands on back in Register A, blanks skipped.
4928
Call 2F0FH of BASIC/OV1, the number reader, which reads as much of the string as makes a number and leaves the value in the accumulator, stopping at the 00H that was written over the byte past the string.
492B
POP BC C1
Pop Register Pair BC, the byte that 4923H saved.
492C
POP HL E1
Pop Register Pair HL, the address of the byte just past the string that 4922H left on the stack.
492D
LD (HL),B 70
Store Register B, the saved byte, into the byte Register Pair HL addresses, which puts back what the 00H was written over: nothing in memory is left changed by VAL.
492E
RET C9
Return to the evaluator with the value in the accumulator.
492F
EX DE,HL EB
The bracket and count helper (492FH), which LEFT$ calls at 48B8H and RIGHT$ at 48E8H: exchange Register Pair DE with Register Pair HL, which brings the program text pointer into Register Pair HL.
4930
Call 4353H, the character demand, which insists on the byte written after this call and gives Syntax error at 4362H for anything else.
4933
DEFB 29H 29
4933H: the closing bracket 4353H compares the line's character with. It is data read by the routine the call at 4930H reaches, not an instruction, and the instruction after that call is the one at 4934H.
4934
POP BC C1
The count helper (4934H), which MID$ calls at 48F3H: pop Register Pair BC, this routine's own return address, so that the word the evaluator left under it can be reached.
4935
POP DE D1
Pop Register Pair DE, the count or start position the evaluator left on the stack when it worked the numeric argument out.
4936
PUSH BC C5
Push Register Pair BC, the return address, which puts the stack back as it was with that argument taken off it.
4937
LD B,E 43
Load Register B with Register E, the low byte of that argument, which is the count every one of the three functions works from.
4938
RET C9
Return to the caller with the count in Register B and the string's descriptor address still on the stack under the text pointer.

4939H - INSTR: Find One String Inside Another (4939H-49C9H)

INSTR is the one string function with an optional argument in front of the others, and 7546H jumps to it on token 0DBH from the dispatch of the functions that take more than one argument rather than through the function address table. The optional first argument is told from the string by its type: 493FH asks 76A4H whether what the first expression left is a string, and if it is there was no start position, so the 01H pushed at 4942H stands as the default. A start position of 00H is refused, which is the manual's rule that characters are numbered from one. The search itself is the plain one, two loops deep: for each character of the searched string from the start position on, compare the sought string against it character by character until a pair differs or the sought string runs out. There is no skip table and no backtrack shortcut, so a search is as long as the two lengths multiplied. Three answers come out of it: 0 when the sought string is not there or the start position stands past the end of the searched string, the start position itself when the sought string holds no characters, which 498BH and 498CH do without looking at anything, and otherwise the one-based position, which 49BBH to 49BEH work out by subtracting the count still unsearched at the match from the count that was unsearched at the beginning and adding back the characters the start position stepped over. Two return addresses are pushed, 770CH under 27DBH, so that the answer in Register A is made the function's value and the text pointer is then popped by the two instructions of 27DBH in BASIC/OV1.

4939
INSTR (4939H), which 7546H jumps to on token 0DBH: call 5E93H, NXTCHAR, which steps the text pointer past the token and brings the character after it back in Register A.
493C
Call 7341H, the expression evaluator entered on the character the text pointer stands on, which works the first argument out into the accumulator.
493F
Call 76A4H, which loads the type from 7142H and subtracts 03H from it, so the Zero Flag is set when that first argument was a string.
4942
LD A,01H 3E 01
Load Register A with 01H, the start position to use when none was written, which is the first character of the searched string.
4944
PUSH AF F5
Push Register Pair AF, that default, which the pop at 4971H brings back and the pop at 4947H throws away.
4945
Jump to 495AH on Z, the first argument having been a string and so being the string to search: no start position was given and the default stands.
4947
POP AF F1
Pop Register Pair AF, which throws the default away, a start position having been written.
4948
Call 79A2H, the single byte argument reader, which turns the first argument into Register Pair DE, refuses 256 or more through FUNCERR, and brings the start position back in Register A.
494B
OR A B7
OR Register A with itself, which sets the Zero Flag when the start position is 00H.
494C
Jump to 5F95H on Z, FUNCERR, which gives error 5, Illegal function call: the manual numbers the characters of a string from one and there is no character 0.
494F
PUSH AF F5
Push Register Pair AF, the start position in Register A, which the pop at 4971H brings back after both strings have been read.
4950
Call 4353H, the character demand, which insists on the byte written after this call and gives Syntax error at 4362H for anything else.
4953
DEFB 2CH 2C
4953H: the comma after the start position, data read by the routine the call at 4950H reaches and not an instruction; the instruction after that call is the one at 4954H.
4954
Call 7345H, the expression evaluator, which works the string to search out into the accumulator.
4957
Call 2AB0H of BASIC/OV1, which insists that what the evaluator left is a string and gives Type mismatch through 5884H when it is not.
495A
Call 4353H, which demands the byte written after this call: this is where the path with no start position joins, its own first argument having been the string to search.
495D
DEFB 2CH 2C
495DH: the comma between the two strings, data for the call at 495AH and not an instruction; the instruction after that call is the one at 495EH.
495E
PUSH HL E5
Push Register Pair HL, the program text pointer, which the exchange below trades for the searched string's descriptor.
495F
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the accumulator, which holds the address of the searched string's descriptor.
4962
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that descriptor address on the stack and brings the text pointer back into Register Pair HL.
4963
Call 7345H, the expression evaluator, which works the string to look for out into the accumulator.
4966
Call 4353H, which demands the byte written after this call and so closes the bracket list.
4969
DEFB 29H 29
4969H: the closing bracket, data for the call at 4966H and not an instruction; the instruction after that call is the one at 496AH.
496A
PUSH HL E5
Push Register Pair HL, the text pointer standing after the bracket, which the pop at 496FH brings back into Register Pair BC.
496B
Call 481AH, which insists that the string to look for is a string, gives its space back when its descriptor is the topmost temporary, and returns that descriptor's address in Register Pair HL.
496E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the sought string's descriptor address into Register Pair DE.
496F
POP BC C1
Pop Register Pair BC, the text pointer that 496AH pushed.
4970
POP HL E1
Pop Register Pair HL, the searched string's descriptor address that 4962H left on the stack.
4971
POP AF F1
Pop Register Pair AF, the start position, whether the default pushed at 4944H or the one read at 494FH.
4972
PUSH BC C5
Push Register Pair BC, the text pointer, which the two instructions of 27DBH pop when the answer has been made.
4973
LD BC,27DBH 01 DB 27
Load Register Pair BC with 27DBH, which in BASIC/OV1 is a POP HL and a RET and nothing else, so that the text pointer above is taken back on the way out.
4976
PUSH BC C5
Push Register Pair BC, which puts 27DBH on the stack under the address pushed next.
4977
LD BC,770CH 01 0C 77
Load Register Pair BC with 770CH, the four instructions that make the byte in Register A the function's numeric result.
497A
PUSH BC C5
Push Register Pair BC, which puts 770CH on top, so that every return below makes the answer a number and then gives the text pointer back.
497B
PUSH AF F5
Push Register Pair AF, the start position, which the pop at 4981H brings back once the searched string's space has been dealt with.
497C
PUSH DE D5
Push Register Pair DE, the sought string's descriptor address, which the pop at 4980H brings back.
497D
Call 4820H, which puts the searched string's descriptor address into Register Pair DE, gives that string's space back when its descriptor is the topmost temporary, and returns the same address in Register Pair HL.
4980
POP DE D1
Pop Register Pair DE, the sought string's descriptor address that 497CH pushed.
4981
POP AF F1
Pop Register Pair AF, which puts the start position back into Register A.
4982
LD B,A 47
Load Register B with Register A, the start position, which is the answer when the sought string holds no characters.
4983
DEC A 3D
Decrement Register A, which turns the start position into the count of characters to step over.
4984
LD C,A 4F
Load Register C with Register A, that step over count, which the search below adds back into its answer.
4985
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the length of the searched string, which sets the Carry Flag when the start position falls inside it.
4986
LD A,00H 3E 00
Load Register A with 00H, the answer when the sought string is not found or cannot be.
4988
RET NC D0
Return on NC through 770CH, the start position standing past the end of the searched string: the answer is 0, which is what the manual gives for a search that fails.
4989
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the length of the string being looked for.
498A
OR A B7
OR Register A with itself, which sets the Zero Flag when the sought string holds no characters.
498B
LD A,B 78
Load Register A with Register B, the start position, which is the answer in that case.
498C
RET Z C8
Return on Z through 770CH, the sought string holding no characters: INSTR of a string of no characters gives the start position itself and looks at nothing.
498D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the searched string.
498E
INC HL 23
Step Register Pair HL on to the second byte of the searched string's descriptor.
498F
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the low byte of the address its text stands at.
4990
INC HL 23
Step Register Pair HL on to the third byte of that descriptor.
4991
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of that address.
4992
LD L,B 68
Load Register L with Register B, so that Register Pair HL holds where the searched text begins.
4993
LD B,00H 06 00
Load Register B with 00H, which makes Register Pair BC the step over count alone.
4995
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which brings Register Pair HL to the character the start position names.
4996
SUB C 91
Subtract Register C from Register A, which gives how many characters of the searched string stand from the start position to its end.
4997
LD B,A 47
Load Register B with Register A, that count, which is how many attempts the outer loop can make.
4998
PUSH BC C5
Push Register Pair BC, that count in Register B and the step over count in Register C, which the pop at 49BAH or 49B4H brings back to work the answer out.
4999
PUSH DE D5
Push Register Pair DE, the sought string's descriptor address, which the exchange below trades for the searched position.
499A
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the searched position on the stack and brings the sought string's descriptor address into Register Pair HL.
499B
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the length of the sought string, which the inner loop counts down.
499C
INC HL 23
Step Register Pair HL on to the second byte of that descriptor.
499D
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address the sought text stands at.
499E
INC HL 23
Step Register Pair HL on to the third byte of that descriptor.
499F
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds where the sought text begins.
49A0
POP HL E1
Pop Register Pair HL, the searched position that the exchange above left on the stack.
49A1
PUSH HL E5
The outer loop (49A1H), one turn for each character of the searched string the sought string is tried against: push Register Pair HL, the position this attempt starts at, which 49C2H brings back to step it on by one.
49A2
PUSH DE D5
Push Register Pair DE, the start of the sought text, which 49C1H brings back so that each attempt compares from its first character.
49A3
PUSH BC C5
Push Register Pair BC, the two counts, which 49C0H brings back so that each attempt has the whole sought length to match and the whole searched remainder to use.
49A4
LD A,(DE) 1A
The inner loop (49A4H): load Register A with the byte Register Pair DE addresses, the next character of the sought string.
49A5
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the matching character of the searched string.
49A6
Jump to 49C0H on NZ, the two characters differing, which starts the next attempt one character further on.
49A8
INC DE 13
Step Register Pair DE on to the next character of the sought string.
49A9
DEC C 0D
Decrement Register C, the count of characters of the sought string still to match.
49AA
Jump to 49B7H on Z, every character of the sought string having matched: the string has been found at this attempt's position.
49AC
INC HL 23
Step Register Pair HL on to the next character of the searched string.
49AD
DEC B 05
Decrement Register B, the count of characters of the searched string still to look at.
49AE
Jump back to 49A4H on NZ, which compares the next pair.
49B1
POP DE D1
Pop Register Pair DE, the counts, the searched string having run out in the middle of a comparison, so that the sought string cannot be there.
49B2
POP DE D1
Pop Register Pair DE, the start of the sought text, which is no longer wanted.
49B3
POP BC C1
Pop Register Pair BC, this attempt's starting position, which is no longer wanted either.
49B4
POP DE D1
Pop Register Pair DE, the counts 4998H pushed, which clears the last of what the search put on the stack.
49B5
XOR A AF
Clear Register A to 00H, the answer for a search that failed.
49B6
RET C9
Return through 770CH with Register A holding 00H, which is the value INSTR gives when the sought string is not there.
49B7
POP HL E1
The match (49B7H): pop Register Pair HL, the counts this attempt began with, whose high byte is how many characters were still unsearched when the match started.
49B8
POP DE D1
Pop Register Pair DE, the start of the sought text, which is no longer wanted.
49B9
POP DE D1
Pop Register Pair DE, this attempt's starting position, which is no longer wanted, the answer being worked out from the counts.
49BA
POP BC C1
Pop Register Pair BC, the counts 4998H pushed, whose Register B is how many characters were unsearched at the beginning and whose Register C is the step over count.
49BB
LD A,B 78
Load Register A with Register B, the count that was unsearched when the search began.
49BC
SUB H 94
Subtract Register H from Register A, the count that was unsearched when the match began, which leaves the number of attempts that failed before it.
49BD
ADD A,C 81
Add Register C to Register A, the characters the start position stepped over, which brings the count back to the whole string.
49BE
INC A 3C
Increment Register A, which turns a count of characters before the match into the one-based position the manual asks for.
49BF
RET C9
Return through 770CH with the position in Register A, which is made the function's value and the text pointer then given back by 27DBH.
49C0
POP BC C1
The next attempt (49C0H): pop Register Pair BC, the two counts this attempt began with, which the next one is to begin with as well.
49C1
POP DE D1
Pop Register Pair DE, the start of the sought text, so that the next attempt compares from its first character again.
49C2
POP HL E1
Pop Register Pair HL, the position this attempt began at.
49C3
INC HL 23
Step Register Pair HL on one character, which is where the next attempt begins.
49C4
DEC B 05
Decrement Register B, the count of characters of the searched string left to start an attempt at.
49C5
Jump back to 49A1H on NZ, which tries the sought string against the next character.
49C8
Jump to 49B4H, every starting position having been tried: the stack is cleared and 00H returned.

49CAH - MID$ as a Statement: Write Characters into a String in Place (49CAH-4A5BH)

The only statement of this BASIC whose keyword is a function, and the only one that changes a string without changing its length. 791CH jumps here when the two bytes that begin the statement are 7EH and 83H, 83H being MID$'s function token 03H with bit 7 set, and anything else after the 7EH gives Syntax error at 791FH. What it does is write over characters of the target string where they already stand, so the target's length never changes and no string space is taken: too few characters on the right simply leave the rest of the target alone, and too many are dropped. The one thing that has to be settled first is where the target's text lies, and 49DBH to 49F2H is that test. A variable assigned a literal in a program line does not get a copy of the text; its descriptor points at the characters inside the program itself. Writing through such a descriptor would alter the program, so the test asks whether the text stands between PGMBGN 6E9EH and LOPT 71A3H, and when it does the text is copied into string space through 462BH and the variable given the new descriptor through 2946H before anything is written. A text already in the string area, above LOPT, is written in place. Three things are refused: a start position of 00H, a start position past the end of the target, and a count of 00H does nothing at all. The return goes through 27DBH of BASIC/OV1, two instructions that pop the text pointer and return, which 4A16H and 4A19H put under the work rather than over it.

49CA
MID$ as a statement (49CAH), which 791CH jumps to on the two bytes 7EH and 83H: call 4353H, the character demand, which insists on the byte written after this call.
49CD
DEFB 28H 28
49CDH: the opening bracket 4353H compares the line's character with, data read by the routine the call at 49CAH reaches and not an instruction; the instruction after that call is the one at 49CEH.
49CE
Call 39FBH, the variable search, which reads the target's name, makes the variable when it is new and returns the address of its value in Register Pair DE and Register Pair BC with the type in 7142H.
49D1
Call 2AB0H of BASIC/OV1, which insists that the target is a string variable and gives Type mismatch through 5884H when it is not.
49D4
PUSH HL E5
Push Register Pair HL, the program text pointer standing after the name, which the exchange at 49F6H brings back.
49D5
PUSH DE D5
Push Register Pair DE, the address of the target's descriptor, which the pops at 49EBH, 49F0H and 49F5H bring back.
49D6
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings that descriptor's address into Register Pair HL.
49D7
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
49D8
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address the target's text stands at.
49D9
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
49DA
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds that address.
49DB
LD HL,(71A3H) 2A A3 71
Load Register Pair HL with the word at 71A3H, LOPT, the end of the arrays, which is the lowest address the string area reaches down to.
49DE
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Carry Flag when the text stands above LOPT and so lies in the string area.
49E1
Jump to 49F5H on C, the text standing in the string area where it may be written over.
49E3
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL with the word at 6E9EH, PGMBGN, the first byte of the program text.
49E6
Call 434DH, which subtracts Register Pair DE from Register Pair HL and leaves the Carry Flag clear when the text stands at or below the start of the program.
49E9
Jump to 49F5H on NC, the text lying below the program and so not inside it: this is the path a string already copied into the string area by an earlier assignment takes.
49EB
POP HL E1
Pop Register Pair HL, the target's descriptor address, the text lying inside the program text and so having to be copied before it is written over.
49EC
PUSH HL E5
Push Register Pair HL, that address again, which the pop at 49F0H brings back.
49ED
Call 462BH, which takes as many bytes of string space as the descriptor names, copies the text into them and builds a new descriptor at 7175H naming the copy.
49F0
POP HL E1
Pop Register Pair HL, the target's descriptor address again.
49F1
PUSH HL E5
Push Register Pair HL, it once more, which the pop at 49F5H brings back.
49F2
Call 2946H of BASIC/OV1, which copies as many bytes as 7142H names, three, from the new descriptor into the variable's own, so that the variable now names the copy and the program text is safe.
49F5
POP HL E1
Pop Register Pair HL, the target's descriptor address, which the exchange below trades for the text pointer.
49F6
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that descriptor address on the stack and brings the program text pointer back into Register Pair HL.
49F7
Call 4353H, which demands the byte written after this call and gives Syntax error at 4362H for anything else.
49FA
DEFB 2CH 2C
49FAH: the comma after the target's name, data for the call at 49F7H and not an instruction; the instruction after that call is the one at 49FBH.
49FB
Call 799FH, the single byte argument reader, which works the start position out, refuses 256 or more through FUNCERR and brings it back in Register A and Register E.
49FE
OR A B7
OR Register A with itself, which sets the Zero Flag when the start position is 00H.
49FF
Jump to 5F95H on Z, FUNCERR, which gives error 5, Illegal function call: the characters of a string are numbered from one.
4A02
PUSH AF F5
Push Register Pair AF, the start position in Register A, which the pop at 4A12H brings back.
4A03
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the text pointer stands on, which the routine below compares with a closing bracket to see whether a count was written.
4A04
Call 4A4AH, the optional count, which loads Register E with 0FFH as the default and, when that character is not a closing bracket, demands a comma and reads a byte into Register E before demanding the bracket.
4A07
PUSH DE D5
Push Register Pair DE, the count in Register E, which the pop at 4A11H brings back into Register Pair BC.
4A08
Call 733AH, which demands the equals sign token 0F1H written after its own call and then runs the expression evaluator at 7345H on what follows it.
4A0B
PUSH HL E5
Push Register Pair HL, the program text pointer standing after the expression, which the pop at 4A10H brings back.
4A0C
Call 481AH, which insists that the expression's value is a string, gives its space back when its descriptor is the topmost temporary, and returns that descriptor's address in Register Pair HL.
4A0F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the source string's descriptor address into Register Pair DE.
4A10
POP HL E1
Pop Register Pair HL, the program text pointer that 4A0BH pushed.
4A11
POP BC C1
Pop Register Pair BC, the count that 4A07H pushed, which arrives in Register C.
4A12
POP AF F1
Pop Register Pair AF, which puts the start position back into Register A.
4A13
LD B,A 47
Load Register B with Register A, the start position, which the arithmetic below works from.
4A14
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack and brings the target's descriptor address into Register Pair HL.
4A15
PUSH HL E5
Push Register Pair HL, that descriptor address, which the exchange below trades for the return address.
4A16
LD HL,27DBH 21 DB 27
Load Register Pair HL with 27DBH, which in BASIC/OV1 is a POP HL and a RET and nothing else, so that the text pointer is taken back on the way out.
4A19
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves 27DBH on the stack as the return address and brings the target's descriptor address back into Register Pair HL.
4A1A
LD A,C 79
Load Register A with Register C, the count of characters to write.
4A1B
OR A B7
OR Register A with itself, which sets the Zero Flag when no characters were asked for.
4A1C
RET Z C8
Return on Z through 27DBH, a count of 00H having been written, which leaves the target exactly as it stood.
4A1D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the target string.
4A1E
SUB B 90
Subtract Register B from Register A, the start position, which sets the Carry Flag when the start position stands past the end of the target.
4A1F
Jump to 5F95H on C, FUNCERR, which gives error 5, Illegal function call: unlike MID$ the function, which gives a string of no characters, the statement refuses a start position past the end.
4A22
INC A 3C
Increment Register A, which turns the difference into the number of characters standing from the start position to the end of the target.
4A23
CP C B9
Compare Register A with Register C, the count asked for, which sets the Carry Flag when fewer characters stand there than were asked for.
4A24
Jump to 4A27H on C, fewer characters standing than were asked for, which writes as many as will fit and drops the rest.
4A26
LD A,C 79
Load Register A with Register C, the count asked for, the target having room for all of it.
4A27
LD C,B 48
Load Register C with Register B, the start position, which the step over below is worked out from.
4A28
DEC C 0D
Decrement Register C, which turns the start position into the number of characters to step over.
4A29
LD B,00H 06 00
Load Register B with 00H, which makes Register Pair BC that step over count alone.
4A2B
PUSH DE D5
Push Register Pair DE, the source string's descriptor address, which the pop at 4A33H brings back.
4A2C
INC HL 23
Step Register Pair HL on to the second byte of the target's descriptor.
4A2D
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address the target's text stands at.
4A2E
INC HL 23
Step Register Pair HL on to the third byte of that descriptor.
4A2F
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of that address.
4A30
LD L,E 6B
Load Register L with Register E, so that Register Pair HL holds where the target's text begins.
4A31
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which brings Register Pair HL to the character the start position names.
4A32
LD B,A 47
Load Register B with Register A, the count of characters to write, which the move below counts down.
4A33
POP DE D1
Pop Register Pair DE, the source string's descriptor address that 4A2BH pushed.
4A34
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that descriptor address into Register Pair HL and the place to write into Register Pair DE.
4A35
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the length of the source string, which is the second count the move stops on.
4A36
INC HL 23
Step Register Pair HL on to the second byte of the source's descriptor.
4A37
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of the address the source's text stands at.
4A38
INC HL 23
Step Register Pair HL on to the third byte of that descriptor.
4A39
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of that address.
4A3A
LD L,A 6F
Load Register L with Register A, so that Register Pair HL holds where the source's text begins.
4A3B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the place to write into Register Pair HL and the source's text into Register Pair DE.
4A3C
LD A,C 79
Load Register A with Register C, the length of the source string.
4A3D
OR A B7
OR Register A with itself, which sets the Zero Flag when the source holds no characters.
4A3E
RET Z C8
Return on Z through 27DBH, there being nothing to write: MID$(A$,2) = "" leaves A$ as it stood.
4A3F
LD A,(DE) 1A
The move (4A3FH): load Register A with the byte Register Pair DE addresses, the next character of the source string.
4A40
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, its place inside the target string, which is written over where it stands.
4A41
INC DE 13
Step Register Pair DE on to the next character of the source.
4A42
INC HL 23
Step Register Pair HL on to the next character of the target.
4A43
DEC C 0D
Decrement Register C, the count of characters the source still holds.
4A44
RET Z C8
Return on Z through 27DBH, the source having run out: the rest of the target keeps the characters it had, which is why MID$(A$,1,5) = "AB" changes only two of them.
4A45
DEC B 05
Decrement Register B, the count of characters there is room to write.
4A46
Jump back to 4A3FH on NZ, which writes the next character.
4A49
RET C9
Return through 27DBH, the room having run out before the source did, which is where the characters too many are dropped.
4A4A
LD E,0FFH 1E FF
The optional count (4A4AH), which MID$ the function calls at 48FCH and MID$ the statement at 4A04H: load Register E with 0FFH, the count to use when none was written, which no string can exceed.
4A4C
CP 29H FE 29
Compare Register A with 29H, a closing bracket, Register A holding the character the text pointer stands on.
4A4E
Jump to 4A57H on Z, the bracket list ending here, which leaves the default count standing.
4A50
Call 4353H, which demands the byte written after this call and gives Syntax error at 4362H for anything else.
4A53
DEFB 2CH 2C
4A53H: the comma before the count, data for the call at 4A50H and not an instruction; the instruction after that call is the one at 4A54H.
4A54
Call 799FH, the single byte argument reader, which works the count out, refuses 256 or more and brings it back in Register A and Register E.
4A57
Call 4353H, which demands the byte written after this call, the argument list being complete either way.
4A5A
DEFB 29H 29
4A5AH: the closing bracket, data for the call at 4A57H and not an instruction; the instruction after that call is the one at 4A5BH.
4A5B
RET C9
Return to the caller with the count in Register E and the text pointer standing after the bracket.

4A5CH - FRE, the File Number Parser and the File Lookup (4A5CH-4AC6H)

FRE 4A69H is the word the function address table holds at 6879H, and it gives the difference between HIPT 7178H and LOPT 71A3H, the free space between the top of the arrays and the bottom of the string area. The manual's rule that FRE of a string argument collects the string space first is exactly 4A6CH to 4A74H: 76A4H asks what the argument's type is and a string one falls through to the collection at 46E7H, so that the number FRE then gives is the space that is really free and not the space that merely has nothing pointing at it. 4A5CH is FRE's other head, which 755AH jumps to on token 0E1H for the form with brackets, and it clears 7142H before calling the body, so the argument's own type is forgotten and the collection is skipped whatever was written. The rest of the range is the file machinery three statements and four functions share. 4A7FH and 4A81H are the parser that turns a number sign and a number on the line into the file in hand at 6E98H, 4A7FH setting Register C to 01H as the mode it will insist on and 4A81H leaving that to the caller, which is how one routine serves INPUT# wanting an input file and PRINT# wanting an output one. 4A98H and 4AA8H are the lookup: the number is weighed against the count of files at 6ECEH, and the table of control block addresses at 6EAEH, two bytes to a file, gives the block itself. 4ABEH is the record buffer, the block's address plus 34H, which FIELD works out for itself at 4DD4H and which 7525H calls for here.

4A5C
XOR A AF
FRE with brackets (4A5CH), which 755AH jumps to on token 0E1H: clear Register A to 00H, the type that no argument has.
4A5D
PUSH HL E5
Push Register Pair HL, the program text pointer, which the pop at 4A64H brings back.
4A5E
LD (7142H),A 32 42 71
Store Register A into the byte at 7142H, the type of the value in hand, which makes the test below find no string and so skip the collection whatever was written in the brackets.
4A61
Call 4A69H, FRE's body, which gives the free space between the arrays and the string area as the function's value.
4A64
POP HL E1
Pop Register Pair HL, the program text pointer that 4A5DH pushed.
4A65
Call 5E93H, NXTCHAR, which steps the text pointer on and brings the character it now stands on back in Register A.
4A68
RET C9
Return to the evaluator with the free space in the accumulator.
4A69
FRE (4A69H), the word the function address table holds at 6879H for token 0EH: call 76A4H, which loads the type from 7142H and subtracts 03H from it, so the Zero Flag is set when the argument was a string.
4A6C
Jump to 4A75H on NZ, the argument not being a string, which gives the free space as it stands with no collection made.
4A6F
Call 481DH, which takes the string's descriptor address out of the accumulator at 72ECH and gives its space back when that descriptor is the topmost temporary.
4A72
Call 46E7H, the string space collection, which packs every string that is still wanted against the top of memory so that the number below is the space really free: this is what FRE("") is for.
4A75
LD DE,(71A3H) ED 5B A3 71
Load Register Pair DE with the word at 71A3H, LOPT, the end of the arrays and the lowest address the string area may reach.
4A79
LD HL,(7178H) 2A 78 71
Load Register Pair HL with the word at 7178H, HIPT, the lowest byte of the string area in use.
4A7C
Jump to 76FDH, which subtracts Register Pair DE from Register Pair HL with a SBC HL,DE and makes the difference the function's value through 2C66H of BASIC/OV1.
4A7F
LD C,01H 0E 01
The file number parser with a mode of its own (4A7FH), which INPUT# calls at 63B8H and LINE INPUT# at 4B0BH: load Register C with 01H, the mode an input file has, which is what the comparison below insists on.
4A81
CP 23H FE 23
The parser that takes the mode from the caller (4A81H), which 56FDH and 6215H call with their own mode in Register C: compare Register A with 23H, the number sign that makes this statement a file one.
4A83
RET NZ C0
Return on NZ, there being no number sign and so no file: the statement goes on with the keyboard or the display and 6E98H is left as it stood.
4A84
PUSH BC C5
Push Register Pair BC, the mode wanted in Register C, which the pop at 4A88H brings back into Register Pair DE.
4A85
Call 4A98H, the file lookup, which reads the number, weighs it against the count of files and returns the control block's address in Register Pair BC with its first byte, the mode, in Register A.
4A88
POP DE D1
Pop Register Pair DE, the mode wanted, which arrives in Register E.
4A89
CP E BB
Compare Register A with Register E, which sets the Zero Flag when the file was opened in the mode the statement needs.
4A8A
Jump to 5841H on NZ, the disk error chain's first entry, error 54, Bad file mode: this is what a PRINT# to a file opened for input gives, and an INPUT# from one opened for output.
4A8D
Call 4353H, which demands the byte written after this call and gives Syntax error at 4362H for anything else.
4A90
DEFB 2CH 2C
4A90H: the comma after the file number, data for the call at 4A8DH and not an instruction; the instruction after that call is the one at 4A91H.
4A91
LD D,B 50
Load Register D with Register B, the high byte of the control block's address.
4A92
LD E,C 59
Load Register E with Register C, so that Register Pair DE holds that address.
4A93
LD (6E98H),DE ED 53 98 6E
Store Register Pair DE into the word at 6E98H, FILEX, the file in hand, which is what makes every later read and write of this statement go to the file and not the keyboard or the display.
4A97
RET C9
Return with the file in hand and the text pointer standing after the comma.
4A98
DEC HL 2B
The file lookup (4A98H), which 4A85H, FIELD at 4DC2H, 4EE5H and 4FCFH call: step Register Pair HL back one, so that the call below brings the character the text pointer already stands on back.
4A99
Call 5E93H, NXTCHAR, which brings that character back in Register A with blanks skipped.
4A9C
CP 23H FE 23
Compare Register A with 23H, a number sign, which the manual allows before the number and does not require.
4A9E
Call 5E93H on Z, NXTCHAR again, which steps over that number sign when one was written.
4AA1
Call 7345H, the expression evaluator, which works the file number out into the accumulator.
4AA4
Call 79A2H, the single byte argument reader, which turns it into Register Pair DE, refuses 256 or more through FUNCERR and brings it back in Register A.
4AA7
LD E,A 5F
Load Register E with Register A, the file number, which the table step below is worked out from.
4AA8
LD A,(6ECEH) 3A CE 6E
The lookup with the number already in Register E (4AA8H), which 4ABEH calls: load Register A with the byte at 6ECEH, the count of files BASIC was started with.
4AAB
CP E BB
Compare Register A with Register E, which sets the Carry Flag when the number asked for is above that count.
4AAC
Jump to 5847H on C, error 52, Bad file number: a number above the count given with the FILES parameter, or above the three BASIC sets up when none was given.
4AAF
LD D,00H 16 00
Load Register D with 00H, which makes Register Pair DE the file number alone.
4AB1
PUSH HL E5
Push Register Pair HL, the program text pointer, which the pop at 4ABCH brings back untouched.
4AB2
LD HL,6EAEH 21 AE 6E
Load Register Pair HL with 6EAEH, the table of control block addresses, one word for each file and the files themselves 564 bytes apart.
4AB5
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which steps one byte for each file number.
4AB6
ADD HL,DE 19
Add Register Pair DE to Register Pair HL again, which steps the second byte of each, the entries being words: file 0 is therefore the word at 6EAEH itself.
4AB7
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of this file's control block address.
4AB8
INC HL 23
Step Register Pair HL on to the high byte of it.
4AB9
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds the control block's address.
4ABA
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, the first byte of the block, which is the mode the file was opened in and 00H when it is not open at all.
4ABB
OR A B7
OR Register A with itself, which sets the Zero Flag when the file is not open, which is the test FIELD makes at 4DC5H and 4A89H does not.
4ABC
POP HL E1
Pop Register Pair HL, the program text pointer that 4AB1H pushed.
4ABD
RET C9
Return with the control block's address in Register Pair BC, its mode in Register A and the Zero Flag set when the file is not open.
4ABE
The record buffer address (4ABEH), which 7525H calls: call 4AA8H, the lookup with the file number already in Register E, which returns the control block's address in Register Pair BC.
4AC1
LD HL,0034H 21 34 00
Load Register Pair HL with 0034H, the distance from a control block to its own record buffer, which FIELD works out again for itself at 4DD4H.
4AC4
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which gives the address of the buffer.
4AC5
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE where the caller expects it.
4AC6
RET C9
Return with the record buffer's address in Register Pair DE.

4AC7H - MKI$, MKS$, MKD$ and CVI, CVS, CVD (4AC7H-4AFCH)

The six functions that turn a number into the bytes a random file holds and back again, and six entry points in four instructions. Each family has three heads whose whole difference is one byte in Register A, and rather than three jumps the author wrote the second and third heads inside the operands of two LD BC,nn instructions: 4AC9H loads Register Pair BC with 043EH, and its operand bytes at 4ACAH and 4ACBH stand as LD A,04H, which is MKS$; 4ACCH loads 083EH and its operand bytes at 4ACDH stand as LD A,08H, which is MKD$; and 4AE2H and 4AE5H do the same for CVS and CVD. The values Register Pair BC takes are read by nothing. The byte in Register A is the type as a count of bytes, 02H, 04H and 08H for the makers, and for the converters it is one less than the type, 01H, 03H and 07H, because the same byte serves as the length test: CP (HL) against the string's length leaves the Carry Flag clear when the string is too short, and the increment at 4AF1H then turns it into the type. So CVI of a string of one character gives Illegal function call and CVD needs eight. A maker converts the value to its type through 78DDH first, so MKI$(1.7) stores the integer 1 rather than refusing the argument.

4AC7
LD A,02H 3E 02
MKI$ (4AC7H), the word the function address table holds at 68BBH for token 2FH: load Register A with 02H, the number of bytes an integer takes and its type.
4AC9
LD BC,043EH 01 3E 04
Load Register Pair BC with 043EH, whose operand bytes at 4ACAH and 4ACBH stand as the LD A,04H of MKS$, the word the table holds at 68BDH for token 30H: the 043EH is read by nothing, Register Pair BC being loaded again before anything looks at it.
4ACC
LD BC,083EH 01 3E 08
Load Register Pair BC with 083EH, whose operand bytes at 4ACDH and 4ACEH stand as the LD A,08H of MKD$, the word the table holds at 68BFH for token 31H: this 083EH is read by nothing either.
4ACF
PUSH AF F5
Push Register Pair AF, Register A holding the type wanted, which the pop at 4AD3H brings back once the value has been converted.
4AD0
Call 78DDH, which masks the type to three bits, indexes the conversion table at 6B53H by twice it and calls the routine in BASIC/OV1 that makes the value in the accumulator be of that type.
4AD3
POP AF F1
Pop Register Pair AF, which puts the type, and so the count of bytes, back into Register A.
4AD4
Call 4641H, which takes Register A bytes of string space, collecting the space first if it must, and builds the descriptor for them at 7175H.
4AD7
LD HL,(7176H) 2A 76 71
Load Register Pair HL with the word at 7176H, the address field of that descriptor, which is where the bytes of the number are to go.
4ADA
Call 2973H of BASIC/OV1, which points Register Pair DE at 72ECH or at 72E8H according to the type and copies as many bytes as 7142H names to the address in Register Pair HL.
4ADD
Jump to 4870H, the exit the string functions share, which throws the dispatcher's 7585H away and makes the new descriptor the accumulator's string.
4AE0
LD A,01H 3E 01
CVI (4AE0H), the word the function address table holds at 68AFH for token 2BH: load Register A with 01H, one less than the two bytes an integer takes, which serves both as the length test below and, raised by one, as the type.
4AE2
LD BC,033EH 01 3E 03
Load Register Pair BC with 033EH, whose operand bytes at 4AE3H and 4AE4H stand as the LD A,03H of CVS, the word the table holds at 68B1H for token 2CH: the 033EH is read by nothing.
4AE5
LD BC,073EH 01 3E 07
Load Register Pair BC with 073EH, whose operand bytes at 4AE6H and 4AE7H stand as the LD A,07H of CVD, the word the table holds at 68B3H for token 2DH: this 073EH is read by nothing either.
4AE8
PUSH AF F5
Push Register Pair AF, Register A holding one less than the type, which the pop at 4AECH brings back.
4AE9
Call 481AH, which insists that the value in the accumulator is a string, gives its space back when its descriptor is the topmost temporary, and returns that descriptor's address in Register Pair HL.
4AEC
POP AF F1
Pop Register Pair AF, which puts the count back into Register A.
4AED
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the length of the string, which leaves the Carry Flag clear when the string holds no more characters than the count.
4AEE
Jump to 5F95H on NC, FUNCERR, which gives error 5, Illegal function call: CVI needs two characters, CVS four and CVD eight, and this one comparison enforces all three.
4AF1
INC A 3C
Increment Register A, which turns one less than the type into the type itself.
4AF2
LD (7142H),A 32 42 71
Store Register A into the byte at 7142H, the type of the value in hand, which the load below takes its count of bytes from.
4AF5
INC HL 23
Step Register Pair HL on to the second byte of the descriptor.
4AF6
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of the address the string's text stands at.
4AF7
INC HL 23
Step Register Pair HL on to the third byte of the descriptor.
4AF8
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of that address.
4AF9
LD L,A 6F
Load Register L with Register A, so that Register Pair HL holds where the text begins.
4AFA
Jump to 296BH of BASIC/OV1, which loads the accumulator from the address in Register Pair HL with as many bytes as 7142H names: the characters of the string are read straight in as a number with no conversion of any kind.

4AFDH - The File Item Reader, LINE INPUT# and the Two Open Shortcuts (4AFDH-4C20H)

This is what INPUT# and READ# take one item out of a file with, and it is the longest routine of the band. It has two heads. 4AFDH is the one the assignment loop of INPUT and READ reaches at 64C6H: it asks 76A4H what type the item is going into and sets the two delimiters from the answer, a comma and a blank for a number and a comma alone for a string, which is why a string read from a file keeps its blanks and a number does not. 4B0BH is LINE INPUT#, which LINE jumps to at 635DH: it takes the file number, the variable and nothing else, sets both delimiters to 00H so that only the end of the line stops the scan, and pushes LET's second entry at 6087H under 634BH so that the assignment is made and the file in hand then cleared. Both heads meet at 4B1FH, and the word pushed there is the type, lowered by three by 76A4H, which 64E7H and 6087H both put back with an ADD A,03H: the two routines are the same mechanism seen from the two ends. The item is built in INBUF at 7039H with a room of 255 bytes, and the scan is fussier than it looks. Leading blanks are skipped only when the first delimiter is not 00H. A quotation mark opens a quoted item only for a string, and inside quotes nothing but the closing quotation mark ends it. A carriage return ends the item and 4B50H pushes the buffer position before jumping to the separator scan, so that the push 4B89H would have made is already there. A line feed is kept in a numeric item and swallowed in a string one. After the item the separator scan at 4B89H steps over blanks and takes one comma, or a carriage return with a line feed after it; anything else means the byte belongs to the next item, so 4BB9H un-reads it, stepping the control block's own buffer offset back and, when that offset wraps, calling @BKSP, supervisor call 3DH, to back the file up properly. The two shortcuts at the end, 4C15H and 4C1CH, open a file for reading on LOAD's and RUN's behalf, and 4C20H is the OR 0AFH whose operand byte is LOAD's own entry at 4C21H.

4AFD
The file item reader (4AFDH), which the assignment loop of INPUT and READ reaches at 64C6H: call 76A4H, which loads the type from 7142H and subtracts 03H from it, so the Zero Flag is set when the item is going into a string.
4B00
LD BC,64E7H 01 E7 64
Load Register Pair BC with 64E7H, the point in the assignment loop that pops the type back and adds the three 76A4H took off, which is the address this routine returns through.
4B03
LD DE,2C20H 11 20 2C
Load Register Pair DE with 2C20H, which puts a comma in Register D and a blank in Register E: these are the two delimiters a number is read with.
4B06
Jump to 4B1FH on NZ, the item not being a string, with a comma and a blank as the delimiters so that either ends the number.
4B08
LD E,D 5A
Load Register E with Register D, a comma, which makes both delimiters a comma: a string item is ended only by one, so its blanks are part of it.
4B09
Jump to 4B1FH, both delimiters now being a comma, which is the whole of what makes a string item a string item.
4B0B
LINE INPUT# (4B0BH), which LINE jumps to at 635DH: call 4A7FH, which insists on the number sign, reads the file number, checks the file was opened for input, stores it into FILEX 6E98H and demands the comma after it.
4B0E
Call 39FBH, the variable search, which reads the name, makes the variable when it is new and returns the address of its value in Register Pair DE with the type in 7142H.
4B11
Call 2AB0H of BASIC/OV1, which insists that the variable is a string one and gives Type mismatch through 5884H when it is not.
4B14
LD BC,634BH 01 4B 63
Load Register Pair BC with 634BH, which clears the printer flag and both bytes of FILEX 6E98H, so that the file is no longer in hand once the assignment has been made.
4B17
PUSH BC C5
Push Register Pair BC, which puts 634BH on the stack as the address the assignment at 60A0H finally returns to.
4B18
PUSH DE D5
Push Register Pair DE, the address of the variable's value, which the exchange at 60A0H brings into Register Pair HL as the destination of the assignment.
4B19
LD BC,6087H 01 87 60
Load Register Pair BC with 6087H, LET's second entry, which pops the type, adds three to it and jumps into LET's own assignment.
4B1C
XOR A AF
Clear Register A to 00H, which the two loads below make both delimiters and which, raised by three at 6088H, is the string type.
4B1D
LD D,A 57
Load Register D with Register A, 00H, the first delimiter, which no character of the line can match.
4B1E
LD E,A 5F
Load Register E with Register A, 00H, the second, so that only the end of the line ends a LINE INPUT# item.
4B1F
PUSH AF F5
The reader proper (4B1FH): push Register Pair AF, Register A holding the type as 76A4H left it, which 64E7H or 6087H pops and adds three to: this one word is what carries the item's type from here to the assignment.
4B20
PUSH BC C5
Push Register Pair BC, the address this routine returns through, 64E7H for an INPUT# or READ# item and 6087H for a LINE INPUT#.
4B21
PUSH HL E5
Push Register Pair HL, the program text pointer, which the pop at 4BF8H or 4C0AH brings back for the assignment that follows.
4B22
Call 5064H, the byte reader, which takes one byte of the file in hand through @GET, supervisor call 3, and sets the Carry Flag at the end of the file.
4B25
Jump to 584DH on C, error 62, Input past end: there was nothing left in the file to make an item of.
4B28
CP 20H FE 20
Compare Register A with 20H, a blank, which may stand before an item and not be part of it.
4B2A
Jump to 4B30H on NZ, the byte not being a blank, which goes on to the quotation mark test.
4B2C
INC D 14
Increment Register D, the first delimiter, which the decrement below undoes and which is here only to set the flags from it.
4B2D
DEC D 15
Decrement Register D, which sets the Zero Flag when the first delimiter is 00H, as it is for a LINE INPUT#.
4B2E
Jump back to 4B22H on NZ, the delimiter not being 00H, which throws the blank away and reads the next byte: leading blanks are skipped for every item but a LINE INPUT#, whose own blanks are kept.
4B30
CP 22H FE 22
Compare Register A with 22H, a quotation mark.
4B32
Jump to 4B42H on NZ, the byte not being a quotation mark, which begins the item with it.
4B34
LD A,E 7B
Load Register A with Register E, the second delimiter, which says whether this item is a string one.
4B35
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which both delimiters are for a string item and only the first is for a number.
4B37
LD A,22H 3E 22
Load Register A with 22H, the quotation mark, which the loads below make both delimiters when the item is a string one.
4B39
Jump to 4B42H on NZ, the item not being a string one, so that a quotation mark in a number is read as part of it and stops nothing.
4B3B
LD D,A 57
Load Register D with Register A, a quotation mark, the first delimiter of a quoted item.
4B3C
LD E,A 5F
Load Register E with Register A, the second, so that nothing but a closing quotation mark can end the item: commas, blanks and carriage returns inside the quotes are all kept.
4B3D
Call 5064H, which reads the first byte inside the quotation marks, the opening one not being part of the item.
4B40
Jump to 4B89H on C, the file having ended inside the quotes, which closes the item at what was read.
4B42
LD HL,7039H 21 39 70
The collection loop (4B42H): load Register Pair HL with 7039H, INBUF, the buffer the item is built in.
4B45
LD B,0FFH 06 FF
Load Register B with 0FFH, 255, the room there is in that buffer, which the store at 4C10H counts down.
4B47
LD C,A 4F
Load Register C with Register A, the byte just read, which is kept across the test of the delimiter below.
4B48
LD A,D 7A
Load Register A with Register D, the first delimiter.
4B49
CP 22H FE 22
Compare Register A with 22H, a quotation mark, which it is only inside a quoted item.
4B4B
LD A,C 79
Load Register A with Register C, the byte just read, put back for the tests below.
4B4C
Jump to 4B78H on Z, the item being a quoted one, which stores the byte without any of the carriage return and line feed handling below.
4B4E
CP 0DH FE 0D
Compare Register A with 0DH, a carriage return.
4B50
PUSH HL E5
Push Register Pair HL, the place in the buffer the item has reached, which is the push 4B89H makes on the ordinary path and which the pop at 4B53H undoes when the byte is not a carriage return.
4B51
Jump to 4BA4H on Z, the separator scan's own carriage return path, which looks for a line feed after it and ends the item.
4B53
POP HL E1
Pop Register Pair HL, that place in the buffer, the byte not being a carriage return.
4B54
CP 0AH FE 0A
Compare Register A with 0AH, a line feed, which WRITE# puts after every carriage return it writes.
4B56
Jump to 4B78H on NZ, the byte being an ordinary character, which stores it.
4B58
LD C,A 4F
Load Register C with Register A, the line feed, kept across the test below.
4B59
LD A,E 7B
Load Register A with Register E, the second delimiter.
4B5A
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which it is for a string item and is not for a number.
4B5C
LD A,C 79
Load Register A with Register C, the line feed, put back.
4B5D
Call 4C0CH on NZ, the store, which keeps the line feed in a numeric item: in a string item it is thrown away, which is what a file written by WRITE# relies on.
4B60
Call 5064H, which reads the byte after the line feed.
4B63
Jump to 4B89H on C, the file having ended, which closes the item.
4B65
CP 0AH FE 0A
Compare Register A with 0AH, another line feed.
4B67
Jump back to 4B58H on Z, a run of line feeds being dealt with one at a time.
4B69
CP 0DH FE 0D
Compare Register A with 0DH, a carriage return.
4B6B
Jump to 4B78H on NZ, the byte being an ordinary character, which stores it.
4B6D
LD A,E 7B
Load Register A with Register E, the second delimiter, a carriage return having followed a line feed.
4B6E
CP 20H FE 20
Compare Register A with 20H, a blank, which the second delimiter is for a numeric item.
4B70
Jump to 4B84H on Z, the item being a numeric one, which reads the next byte without storing this carriage return.
4B72
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which the second delimiter is for a string item.
4B74
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return, put back for the store below.
4B76
Jump to 4B84H on Z, the item being a string one, which also reads the next byte without storing it.
4B78
OR A B7
The store (4B78H): OR Register A with itself, which sets the Zero Flag when the byte is 00H.
4B79
Jump to 4B84H on Z, a 00H byte in the file being passed over rather than stored or treated as a delimiter.
4B7B
CP D BA
Compare Register A with Register D, the first delimiter.
4B7C
Jump to 4B89H on Z, the byte being the first delimiter and the item therefore complete.
4B7E
CP E BB
Compare Register A with Register E, the second delimiter.
4B7F
Jump to 4B89H on Z, the item being complete on the other delimiter.
4B81
Call 4C0CH, the store, which puts the byte in the buffer and lowers the room: a buffer that fills up ends the item there through 4C12H.
4B84
Call 5064H, which reads the next byte of the file.
4B87
Jump back to 4B47H on NC, a byte having been read, which weighs it in its turn.
4B89
PUSH HL E5
The separator scan (4B89H): push Register Pair HL, the place in the buffer the item ended at, which the pop at 4BE7H brings back to write the 00H that terminates it.
4B8A
CP 22H FE 22
Compare Register A with 22H, a quotation mark, which is how a quoted item ended.
4B8C
Jump to 4B92H on Z, a quoted item having been closed, which steps over blanks and a comma after it.
4B8E
CP 20H FE 20
Compare Register A with 20H, a blank, which is the only delimiter whose separator still has to be looked for.
4B90
Jump to 4BE7H on NZ, the item having ended on a delimiter that is not a blank, which is the separator itself and needs no scan.
4B92
Call 5064H, which reads the byte after the item.
4B95
Jump to 4BE7H on C, the file having ended, which finishes the item.
4B97
CP 20H FE 20
Compare Register A with 20H, a blank, of which any number may stand between an item and its separator.
4B99
Jump back to 4B92H on Z, blanks between the item and its separator being stepped over.
4B9B
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which is the separator this scan is looking for.
4B9D
Jump to 4BE7H on Z, the comma being the separator, which is taken and not put back.
4BA0
CP 0DH FE 0D
Compare Register A with 0DH, a carriage return.
4BA2
Jump to 4BADH on NZ, the byte being neither blank, comma nor carriage return, which puts it back for the next item.
4BA4
The carriage return path (4BA4H), which 4B51H jumps to from the middle of an item: call 5064H, which reads the byte after the carriage return.
4BA7
Jump to 4BE7H on C, the file having ended after it.
4BA9
CP 0AH FE 0A
Compare Register A with 0AH, a line feed, which a carriage return written by WRITE# is followed by.
4BAB
Jump to 4BE7H on Z, the pair being the separator, which is taken whole.
4BAD
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL with the word at 6E98H, FILEX, the control block of the file in hand.
4BB0
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the distance to the byte that says where in the buffer the next byte comes from.
4BB3
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which addresses that byte.
4BB4
Call 4BB9H, the un-read, which steps the file back one byte so that what was just read begins the next item.
4BB7
Jump to 4BE7H, the separator having been dealt with one way or another.
4BB9
DEC (HL) 35
The un-read (4BB9H): decrement the byte Register Pair HL addresses, the offset of the next byte to be taken out of the buffer.
4BBA
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that offset as it now stands.
4BBB
OR A B7
OR Register A with itself, which sets the Zero Flag when the offset has come down to 00H.
4BBC
Jump to 4BD2H on NZ, the offset still standing inside the buffer, where the only case left to deal with is the one that has wrapped.
4BBE
LD BC,0FFFCH 01 FC FF
Load Register Pair BC with 0FFFCH, which is four less than nothing: FFFCH added steps Register Pair HL back four bytes.
4BC1
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which addresses the byte at the control block plus 0003H.
4BC2
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that byte as it stands.
4BC3
OR 20H F6 20
OR Register A with 20H, which sets bit 5 of it.
4BC5
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, which marks the buffer as holding a sector that must be read again.
4BC6
LD BC,0009H 01 09 00
Load Register Pair BC with 0009H, the distance from the control block plus 0003H to the record number at the control block plus 000CH.
4BC9
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which addresses the low byte of that record number.
4BCA
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, its low byte.
4BCB
INC HL 23
Step Register Pair HL on to the high byte of that record number.
4BCC
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds the record number.
4BCD
DEC BC 0B
Step Register Pair BC back one, which names the record before the one in the buffer.
4BCE
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the high byte of the new record number.
4BCF
DEC HL 2B
Step Register Pair HL back on to the low byte of it.
4BD0
LD (HL),C 71
Store Register C into the byte Register Pair HL addresses, which completes the step back.
4BD1
RET C9
Return with the file standing one byte earlier than it did.
4BD2
CP 0FFH FE FF
Compare Register A with 0FFH, which the offset holds when it was 00H before the decrement and so has wrapped past the start of the buffer.
4BD4
RET NZ C0
Return on NZ, the offset standing inside the buffer and nothing more being needed.
4BD5
PUSH HL E5
Push Register Pair HL, the address of the offset byte, which the pop at 4BE3H brings back.
4BD6
PUSH DE D5
Push Register Pair DE, the two delimiters, which the supervisor call below writes over and the pop at 4BE2H brings back.
4BD7
LD BC,0FFFBH 01 FB FF
Load Register Pair BC with 0FFFBH, which is five less than nothing: FFFBH added steps Register Pair HL back five bytes.
4BDA
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which addresses the control block plus 0002H, the form a supervisor call wants.
4BDB
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE.
4BDC
LD A,3DH 3E 3D
Load Register A with 3DH, 61, the number of @BKSP, the supervisor call that steps a file back one byte.
4BDE
RST 28H EF
Call the supervisor through restart 28H, which backs the file up over the buffer boundary the offset could not be stepped across.
4BDF
Jump to 5282H on NZ, DERR, which turns the disk error the supervisor returned into one of BASIC's own messages.
4BE2
POP DE D1
Pop Register Pair DE, the two delimiters that 4BD6H pushed.
4BE3
POP HL E1
Pop Register Pair HL, the address of the offset byte that 4BD5H pushed.
4BE4
LD (HL),0FFH 36 FF
Store 0FFH into the byte Register Pair HL addresses, the offset the supervisor call's own work is to be read with.
4BE6
RET C9
Return with the file standing one byte earlier than it did.
4BE7
POP HL E1
The end of the item (4BE7H), which 4C13H also reaches when the buffer fills up: pop Register Pair HL, the place in the buffer the item ended at, pushed either at 4B89H or at 4B50H.
4BE8
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL addresses, which ends the item in the buffer as the keyboard line reader ends a typed line.
4BEA
LD HL,7038H 21 38 70
Load Register Pair HL with 7038H, the byte below INBUF, which is where both of the routines below expect to be given the item.
4BED
LD A,E 7B
Load Register A with Register E, the second delimiter, which says whether the item is a number or a string.
4BEE
SUB 20H D6 20
Subtract 20H from Register A, a blank, which sets the Zero Flag when the item is a numeric one.
4BF0
Jump to 4BFAH on Z, the item being a number, which is converted rather than collected.
4BF2
LD B,D 42
Load Register B with Register D, the first delimiter, which the collector takes as one of its two.
4BF3
LD D,00H 16 00
Load Register D with 00H, the other, so that the collector runs to the 00H just written and the whole item becomes the string.
4BF5
Call 4653H, the string collector, which makes a temporary string of the item and leaves its descriptor in the accumulator at 72ECH.
4BF8
POP HL E1
Pop Register Pair HL, the program text pointer that 4B21H pushed.
4BF9
RET C9
Return to 64E7H or to 6087H, leaving the type that 4B1FH pushed on the stack for whichever of them it is to pop.
4BFA
The numeric item (4BFAH): call 76A4H, which loads the type from 7142H and sets the Carry Flag for a type below 08H, so the Carry Flag is clear only for double precision.
4BFD
PUSH AF F5
Push Register Pair AF, those flags, which the pop at 4C01H brings back.
4BFE
Call 5E93H, NXTCHAR, which steps Register Pair HL on to the first character of the item and brings it back in Register A.
4C01
POP AF F1
Pop Register Pair AF, which puts the flags back.
4C02
PUSH AF F5
Push Register Pair AF, them again, which the pop at 4C06H brings back, the first call below destroying them.
4C03
Call 2F16H on C, the number reader of BASIC/OV1 entered where single precision is wanted, which is the entry one byte above the double precision one.
4C06
POP AF F1
Pop Register Pair AF, the flags once more, so that the second of the two calls can be made on them.
4C07
Call 2F0FH on NC, the same reader entered for double precision, the Carry Flag having been clear: exactly one of these two calls is made.
4C0A
POP HL E1
Pop Register Pair HL, the program text pointer that 4B21H pushed.
4C0B
RET C9
Return to 64E7H, leaving the type that 4B1FH pushed on the stack for it to pop and add three to.
4C0C
OR A B7
The store (4C0CH), which 4B5DH and 4B81H call: OR Register A with itself, which sets the Zero Flag when the byte is 00H.
4C0D
RET Z C8
Return on Z, a 00H byte never being stored, which is how a file holding one reads as though it did not.
4C0E
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the byte's place in the buffer.
4C0F
INC HL 23
Step Register Pair HL on to the next place in the buffer.
4C10
DEC B 05
Decrement Register B, the room left in the buffer.
4C11
RET NZ C0
Return on NZ, there being room in the buffer for more of the item.
4C12
POP BC C1
Pop Register Pair BC, this routine's own return address, the buffer having filled up: the item is ended here and the caller is never returned to.
4C13
Jump to 4BE8H, which writes the 00H that ends the item with Register Pair HL already standing where it goes: an item of more than 255 characters is cut here and the rest of it is read as the next one.
4C15
LD A,0FFH 3E FF
The open for LOAD (4C15H), which LOAD calls at 4C23H, MERGE at 4CE0H and CHAIN at 540FH: load Register A with 0FFH, the mark that this open is BASIC's own.
4C17
LD (521CH),A 32 1C 52
Store Register A into the byte at 521CH, which the open code reads so that a file not found is reported as BASIC's own error and not the supervisor's.
4C1A
LD D,01H 16 01
Load Register D with 01H, the mode to open the file in, which is input.
4C1C
XOR A AF
The open for RUN (4C1CH), which 4D52H jumps to: clear Register A to 00H, the file number, so that the file is opened on buffer 0.
4C1D
Jump to 511CH, the shared open, which takes the filespec off the line and opens the file in the mode Register D names.
4C20
DEFB 0F6H F6
4C20H: the first byte of an OR 0AFH, whose operand byte at 4C21H is LOAD's own entry and is shown as the XOR A there. RUN at 5FE8H and the start-up at 8041H jump to 4C20H, where the OR 0AFH leaves Register A holding a value that is not 00H and so asks for the program to be run once it has been read; LOAD itself begins one byte higher with Register A cleared.

4C21H - LOAD: Read a Program In, up to the Enhancement Package's Patch (4C21H-4C90H)

LOAD opens the file named after it, throws the program in memory away and reads the new one in. Its own entry is 4C21H, which the statement address table holds for token 0C4H, and that byte is the operand of the instruction at 4C20H: as an instruction 0AFH is XOR A, so LOAD begins by clearing Register A, where the entry one byte lower reaches the same push with Register A not 00H. That byte is what the run after loading turns on, and it is kept on the stack across the parse and then stored in 6EA8H at 4C44H, where 00H means stop at Ready and anything else means run the program that has just been read. The comma and the letter R of the LOAD filespec,R form are the two data bytes 4353H reads out of the line at 4C35H and 4C39H. The first byte of the file decides what kind of program it is: 0FEH is a protected one and sets the flag at 72CBH, 0FFH is a plain tokenized one, and anything else is refused at 4D01H. The read itself is the one place the enhancement package cuts in: the six bytes at 4C91H have their own spec, because module 2 replaced them with a call to FASTLD and a jump that lands past the byte at 4C97H.

4C21
XOR A AF
LOAD (4C21H), the routine the statement address table holds for token 0C4H: clear Register A with XOR, the 00H that says the program is not to be run once it has been read. This byte is also the operand of the instruction at 4C20H, whose own entry leaves Register A holding a value that is not 00H and so asks for the run.
4C22
PUSH AF F5
Push Register Pair AF, keeping that answer across the open and the parse, because 4C3DH and 4C43H are where it is taken back and 4C44H is where it is stored.
4C23
Call 4C15H, which sets the byte at 521CH to 0FFH, loads Register D with 01H, clears Register A and goes on to 511CH, the code that takes the filespec off the line and opens the file for reading.
4C26
LD A,(6ECEH) 3A CE 6E
Load Register A from the byte at 6ECEH, the number of file buffers BASIC was started with, which the clearing below is about to disturb.
4C29
LD (6EA9H),A 32 A9 6E
Store Register A into the byte at 6EA9H, where that count waits until 4C52H puts it back.
4C2C
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on rather than the one beyond it.
4C2D
Call NXTCHAR at 5E93H, which brings the character after the filespec back in Register A with the Zero Flag set when the statement has ended there.
4C30
Jump to 4C43H on Z, the statement having ended: there is no run option, and 4C43H is the byte 0F1H of the instruction at 4C42H, which as an instruction is POP AF and so takes the answer pushed at 4C22H straight back.
4C32
Call 4353H, which demands the character written in the byte after the call and gives Syntax error at 586CH when the line holds anything else, then brings the next character back in Register A.
4C35
DEFB 2CH 2C
The comma of the LOAD filespec,R form. It is data read out of the line by the routine the call at 4C32H reaches, not an instruction, and the instruction after that call is the one at 4C36H.
4C36
Call 4353H a second time, which demands the byte written after this call in the same way and leaves the character that follows it in Register A.
4C39
DEFB 52H 52
The letter R of the run option, data for the call at 4C36H and not an instruction. A decoder reading straight through shows it as LD D,D.
4C3A
Jump to SYNERR at 586CH on NZ: the letter R is the end of the statement, so anything still standing on the line is Syntax error.
4C3D
POP AF F1
Pop Register Pair AF, which throws the pushed answer away, the R having settled the question whatever the entry was.
4C3E
XOR A AF
Clear Register A with XOR, the 00H the count of file buffers is about to be set to.
4C3F
LD (6ECEH),A 32 CE 6E
Store Register A into the byte at 6ECEH, so that no file buffer is built while the program is cleared below; 4C55H puts the real count back afterwards.
4C42
OR 0F1H F6 F1
OR Register A with 0F1H, which makes it 0F1H, the value that says the program is to be run. The operand byte at 4C43H is the entry the branch at 4C30H takes, and as an instruction 0F1H is POP AF.
4C44
LD (6EA8H),A 32 A8 6E
Store Register A into the byte at 6EA8H, the run flag, which 4CC6H reads at the end to choose between Ready at 5920H and the statement loop at 5E3BH.
4C47
LD HL,6EF8H 21 F8 6E
Load Register Pair HL with 6EF8H, the byte below the line buffer at LBUF 6EF9H, which is made the first file buffer address so that the table below has something harmless in it.
4C4A
LD (HL),00H 36 00
Store 00H into the byte at Register Pair HL, which marks that buffer closed.
4C4C
LD (6EAEH),HL 22 AE 6E
Store Register Pair HL into the word at 6EAEH, the first entry of the table of file buffer addresses, so that the clearing below finds a table it can walk even with the count at 00H.
4C4F
Call 42B1H, which throws the program away: it stores 00H in the protected flag at 72CBH and in 7187H and 7186H, zeroes the first two bytes of the program area and sets VARTAB 719FH just above them.
4C52
LD A,(6EA9H) 3A A9 6E
Load Register A from the byte at 6EA9H, the count of file buffers saved at 4C29H.
4C55
LD (6ECEH),A 32 CE 6E
Store Register A into the byte at 6ECEH, which puts the count back now that the clearing is done.
4C58
LD HL,(6EACH) 2A AC 6E
Load Register Pair HL from the word at 6EACH, the first real file buffer address, which 7FFBH wrote when the buffers were built.
4C5B
LD (6EAEH),HL 22 AE 6E
Store Register Pair HL into the word at 6EAEH, the first entry of the table, which puts the real buffer back over the 6EF8H planted at 4C4CH.
4C5E
LD (6E98H),HL 22 98 6E
Store Register Pair HL into the word at 6E98H, FILEX, so that the file being read is the file in hand and the test at 45DFH says so.
4C61
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL from the word at 6E9CH, the number of the line being run, which at command level is 0FFFFH.
4C64
INC HL 23
Increment Register Pair HL, which makes that 0000H at command level and the next line number otherwise.
4C65
LD A,H 7C
Load Register A with Register H, the high byte of the result.
4C66
AND L A5
AND Register A with Register L, the low byte, so that Register A comes out 0FFH only when both bytes are 0FFH.
4C67
INC A 3C
Increment Register A, which gives 00H and sets the Zero Flag only in that case.
4C68
Jump to 4C6DH on NZ, leaving the line number alone, because the LOAD was made from inside a program and the line it is on still matters.
4C6A
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the incremented value, which at command level writes 0000H over the 0FFFFH so that the load does not look as though it were made from a line.
4C6D
Call 5064H, which reads one byte of the open file through the system's own read call, SVC 3 on the file control block at FILEX plus two, and returns it in Register A with the Carry Flag set when the file has no more bytes.
4C70
Jump to 593BH on Carry, which is command level: the file held nothing at all, so there is no program to read.
4C73
CP 0FEH FE FE
Compare Register A with 0FEH, the first byte of a program saved with the protection option.
4C75
Jump to 4C7CH on NZ to try the other kind, this file not being a protected one.
4C77
LD (72CBH),A 32 CB 72
Store Register A into the byte at 72CBH, the protected program flag, which 0FEH turns on: 57E8H then gives Illegal function call for any attempt to list or edit the program.
4C7A
Jump to 4C80H, past the test for the plain kind, the first byte having been settled.
4C7C
INC A 3C
Increment Register A, which gives 00H and sets the Zero Flag only when the byte was 0FFH, the first byte of a plain tokenized program.
4C7D
Jump to 4D01H on NZ, the first byte being neither 0FEH nor 0FFH, so the file holds an ASCII program: 4D01H puts that byte back and goes to command level, which reads the program in as though it were typed, because the file is still the one in hand.
4C80
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL from the word at 6E9EH, PGMBGN, the address the program text starts at, which is where the bytes are to be read to.
4C83
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE for the read and leaves Register Pair HL free for the ceiling.
4C84
LD HL,(7178H) 2A 78 71
Load Register Pair HL from the word at 7178H, HIPT, the high pointer BEGIN set to the top of the program and variable space.
4C87
LD BC,0FFAAH 01 AA FF
Load Register Pair BC with 0FFAAH, which is eighty six bytes taken away, the margin the read insists on below that pointer.
4C8A
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which brings Register Pair HL down to the highest address the program may reach.
4C8B
Call CPHLDE at 434DH, which compares that ceiling in Register Pair HL with the start in Register Pair DE and sets the Carry Flag when the ceiling is the lower of the two.
4C8E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which puts the start back into Register Pair HL for the read, the comparison having been made.
4C8F
Jump to 4CD9H on Carry, the program load form of Out of memory: there is not room between the program area and the ceiling even to begin.

4C91H - The FASTLD Patch (4C91H-4C96H)

BASIC/CMD holds two linked load modules. The first, file bytes 00000H-0544BH, is BASIC version 01.01.00 of Logical Systems, Inc., loading 3000H-82FFH; the second carries the 05H module name NEWB and is the enhancement package of 1984, whose source is NEWB/ASM. MAKBAS/CMD installs the package by positioning to the first module's 02H transfer record and writing the second module over it, so the file that results has one transfer address, 83ECH, the enhancement's own entry. The package reaches into the interpreter at eight places, each of them an ORG in NEWB/ASM that replaces instructions of the first module with a call or a jump into the new code at 8048H and above. Those eight places are the rows below; every one of them is a byte of the first module loaded and then loaded over again by the second.

4C91
FASTLD intercept (4C91H-4C93H): call FASTLD at 82A1H, the package's own loader for a tokenized BASIC program, in place of the three bytes of the first module that stood here. FASTLD reads the program with one @READ of whole sectors rather than a byte at a time.
4C94
4C94H-4C96H: jump to 4C98H, the point in the first module's program load where the check of what was read goes on, so the two instructions of this patch stand in for the five bytes 4C91H-4C95H that the first module loaded.

4C97H - LOAD Finished, the Save's Tail and the Program Load Out of Memory (4C97H-4CDEH)

What follows the enhancement package's patch is the rest of LOAD: the end of the program is made VARTAB, the line links are rebuilt, the variables are cleared and the run flag decides between Ready and running what has just been read. The byte at 4C97H is module 1's own and the patch jumps over it, so in the release as it stands nothing reaches it. Two pieces that are not LOAD's follow. The nine bytes at 4CD0H finish with the file in hand and are reached from four places, among them MERGE at 4CE9H and the enhancement package's patch at 4D79H after FASTSAV has written the program out; they end in a jump to 4349H, which returns through the RET at 434CH rather than going on to the statement loop. The six bytes at 4CD9H are OMERR, the Out of memory of a program load, which NEWB/EQU names: it throws the half read program away before it shows the error, so that a load which ran out of room does not leave a broken program behind.

4C97
EX DE,HL EB
Module 1's own instruction here exchanges Register Pair DE with Register Pair HL after the byte at a time read it used to do, and nothing in the release reaches it: the patch at 4C91H ends with a jump to 4C98H, FASTLD having left the end of the program in Register Pair HL already.
4C98
LD (719FH),HL 22 9F 71
Store Register Pair HL into the word at 719FH, VARTAB, which puts the start of the simple variables at the first byte above the program just read.
4C9B
LD A,(72CBH) 3A CB 72
Load Register A from the byte at 72CBH, the protected program flag, which 4C77H set to 0FEH for a protected file and 42B1H cleared for any other.
4C9E
OR A B7
OR Register A with itself, which sets the Zero Flag when the program that has been read is not a protected one.
4C9F
Call 57A7H on NZ, the code that takes a protected program in hand, which begins by loading Register Pair BC with 0D0BH and the program start from 6E9EH.
4CA2
Call 5A6EH, which walks the program from 6E9EH rebuilding the link word at the head of every line, because the words saved in the file are the addresses the program had when it was written and not the ones it has now. It comes back with Register Pair HL at the two 00H bytes that end the program.
4CA5
INC HL 23
Increment Register Pair HL over the first of those two bytes.
4CA6
INC HL 23
Increment Register Pair HL over the second, so that it stands at the first byte the program does not use.
4CA7
LD (719FH),HL 22 9F 71
Store Register Pair HL into the word at 719FH, VARTAB again, which is the value that stands: the first store at 4C98H was made before the links were walked and the walk is what finds the true end.
4CAA
LD HL,6ECEH 21 CE 6E
Load Register Pair HL with 6ECEH, the address of the count of file buffers, which is read and then zeroed through the same pointer.
4CAD
LD A,(HL) 7E
Load Register A from the byte at Register Pair HL, that count.
4CAE
LD (6EA9H),A 32 A9 6E
Store Register A into the byte at 6EA9H, where it waits a second time while the variables are cleared.
4CB1
LD (HL),00H 36 00
Store 00H into the byte at Register Pair HL, so that the clearing below builds no file buffer.
4CB3
Call 42C7H, which loads Register Pair HL with the program start less one and falls into 42CBH, the part of NEW's clearing code that throws the variables away and leaves the program alone.
4CB6
LD A,(6EA9H) 3A A9 6E
Load Register A from the byte at 6EA9H, the count saved at 4CAEH.
4CB9
LD (6ECEH),A 32 CE 6E
Store Register A into the byte at 6ECEH, which puts the count of file buffers back for good.
4CBC
LD A,(72D2H) 3A D2 72
Load Register A from the byte at 72D2H, the cell the error handler clears at 5890H.
4CBF
OR A B7
OR Register A with itself, which sets the Zero Flag when that cell holds 00H.
4CC0
Jump to 5693H on NZ, which reads the MERGE flag at 72CCH and goes back into the load code at 4C3EH or to 4CEFH, so that a load made as part of a chain carries on there instead of finishing here.
4CC3
Call 8017H, which ORs the byte at 521DH into the protected program flag at 72CBH and then clears 521DH, so that a protection the open recorded is carried into the flag the interpreter reads.
4CC6
LD A,(6EA8H) 3A A8 6E
Load Register A from the byte at 6EA8H, the run flag stored at 4C44H.
4CC9
OR A B7
OR Register A with itself, which sets the Zero Flag when the flag is 00H and the program is only to be read.
4CCA
Jump to 5920H on Z, which is READY, the entry NEWB/EQU names that prints Ready and waits for the keyboard.
4CCD
Jump to the statement loop at 5E3BH, which runs the program that has just been read: this is what the R of the LOAD filespec,R form and the entry at 4C20H both ask for.
4CD0
Finish with the file in hand (4CD0H), which four places reach: 41ADH, MERGE at 4CE9H, 5927H, and the enhancement package's patch at 4D79H once FASTSAV has written the program out. Call 634BH, the first of its two steps.
4CD3
Call 4F52H, which closes the file the program was written to.
4CD6
Jump to 4349H, which loads Register Pair HL from the word at 7184H and then returns through the RET at 434CH, so this routine comes back to whoever called it with the text pointer restored rather than going on to the statement loop.
4CD9
OMERR (4CD9H), the Out of memory of a program load, which NEWB/EQU names and which the branch at 4C8FH and three jumps in FASTLD reach: call 42B1H, which throws the half read program away, clears the protected flag at 72CBH and sets VARTAB 719FH just above an empty program area.
4CDC
Jump to 425CH, the general Out of memory entry, which resets the stack pointer cell at 718EH from BASEND 6E9AH and loads Register Pair DE with 0007H, the index of the Out of memory text in the block at 6B7CH.

4CDFH - MERGE: Read an ASCII Program In over the One in Memory (4CDFH-4D1DH)

MERGE takes a program saved in ASCII and reads its lines in over the program already in memory, line by line, as though they were typed. It does that by the same trick an ASCII LOAD uses: the file is opened and left as the file in hand, the one byte already read is put back, and command level is entered with the file still open, so that the keyboard input code, which tests for a file in hand at 45DFH, takes its lines from the file instead of the keyboard. So the whole of the reading is done elsewhere and MERGE itself is only the opening, the check and the handover. A tokenized program is refused: the first byte being 0FFH for a plain one or 0FEH for a protected one, both go to the error entry at 5841H. The flag at 72CCH, which 5401H set to the MERGE token 0C5H, is what keeps the files open and the declared variable types standing while this goes on. Two pieces that are not MERGE's follow it: the thirteen bytes at 4D01H, which put the byte back and hand over to command level and which LOAD reaches as well from 4C7DH, and the sixteen bytes at 4D0EH, which refuse a statement that needs no file to be in hand.

4CDF
POP BC C1
MERGE (4CDFH), the routine the statement address table holds for token 0C5H: pop Register Pair BC, which throws away the return address 5E3BH the statement dispatcher pushed, because MERGE ends at command level and never goes back to the statement loop.
4CE0
Call 4C15H, which sets the byte at 521CH to 0FFH, loads Register D with 01H, clears Register A and goes on to 511CH, the code that takes the filespec off the line and opens the file for reading.
4CE3
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on rather than the one beyond it.
4CE4
Call NXTCHAR at 5E93H, which brings the character after the filespec back in Register A with the Zero Flag set when the statement has ended there.
4CE7
Jump to 4CEFH on Z, the statement having properly ended, so that the merge goes ahead.
4CE9
Call 4CD0H, which finishes with the file that was just opened and closes it, because the statement is about to be refused and the file must not be left open.
4CEC
Jump to SYNERR at 586CH: MERGE takes a filespec and nothing else, so anything still standing on the line is Syntax error. The call above it comes back, 4CD0H ending in a jump to 4349H whose RET at 434CH returns.
4CEF
XOR A AF
Clear Register A with XOR, the 00H the run flag is about to be set to.
4CF0
LD (6EA8H),A 32 A8 6E
Store Register A into the byte at 6EA8H, LOAD's run flag, so that the program is not run when the reading is done: a merge always ends at Ready, whatever the LOAD before it asked for.
4CF3
Call 5064H, which reads one byte of the open file through the system's own read call, SVC 3 on the file control block at FILEX plus two, and returns it in Register A with the Carry Flag set when the file has no more bytes.
4CF6
Jump to 593BH on Carry, which is command level: the file held nothing at all, so there is nothing to merge.
4CF9
INC A 3C
Increment Register A, which gives 00H and sets the Zero Flag only when the byte was 0FFH, the first byte of a plain tokenized program.
4CFA
Jump to 5841H on Z, the error entry that loads Register E with 36H: a tokenized program cannot be merged, only an ASCII one.
4CFD
INC A 3C
Increment Register A a second time, which gives 00H and sets the Zero Flag only when the byte was 0FEH, the first byte of a protected program.
4CFE
Jump to 5841H on Z as well, so that both kinds of tokenized file are refused with the same error.
4D01
LD HL,(6E98H) 2A 98 6E
The handover to command level (4D01H), which MERGE falls into and which LOAD reaches from 4C7DH for a file whose first byte is neither of the tokenized markers: load Register Pair HL from the word at 6E98H, FILEX, the file control block of the file in hand less two.
4D04
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the offset that reaches the byte five past the start of the file control block.
4D07
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, so that Register Pair HL stands at the offset of the next byte in the file's buffer.
4D08
Call 4BB9H, which backs the file up by one byte through that offset and, when the offset runs off the start of the buffer, backs it up a whole sector with SVC 61H and takes one off the ending record number: the byte read at 4CF3H or at 4C6DH is thus put back to be read again.
4D0B
Jump to 593BH, command level, which sets the line number at 6E9CH to 0FFFFH and the text pointer at 718CH to 6EA2H. The file is still open and still the file in hand, so every line of the program is read from it as though it were typed.
4D0E
PUSH HL E5
A statement's refusal when a file is in hand (4D0EH), which is not part of MERGE: push Register Pair HL, the caller's text pointer.
4D0F
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL from the word at 6E98H, FILEX, which is 0000H when no file is in hand.
4D12
LD A,H 7C
Load Register A with Register H, the high byte of that word.
4D13
OR L B5
OR Register A with Register L, the low byte, so that the Zero Flag is set only when no file is in hand.
4D14
LD DE,0042H 11 42 00
Load Register Pair DE with 0042H, which asks the handler for error 66, a number above the fifty one texts the block at 6B7CH holds, and that is question 10 of section 9.
4D17
Jump to the error handler at 5886H on NZ, a file being in hand, which is what this statement will not have.
4D1A
POP HL E1
Pop Register Pair HL, the caller's text pointer, no file being in hand.
4D1B
Jump to 5E73H, the statement loop's entry for another statement on the same line, so the caller's statement is passed over and the line goes on.

4D1EH - SAVE: Write the Program to a File (4D1EH-4D75H)

SAVE writes the program in memory to the file named after it, in one of three forms. A plain SAVE writes the tokenized program, marked with 0FFH; SAVE with the P option writes it tokenized and marked 0FEH, which is the protected form; SAVE with the A option writes it as text, and it does that by jumping into LIST at 79B3H with the file open, so that the whole of the writing is LIST's work and no code of SAVE's own is used for it. The routine carries two text pointers at once, because the filespec has to be evaluated to find where it ends before the options after it can be read, and then handed to the open at 4C1CH from its original position: the pointer the statement dispatcher came in with is pushed at 4D1EH and brought back by the EX (SP),HL at 4D46H, which puts the pointer standing after the options in its place on the stack for the POP HL at 4D56H to take. The tokenized paths meet at 4D67H, where NORMNUM 661EH puts every line reference back into its plain number form, the marker byte is written through 4F8DH, and Register Pair DE and Register Pair HL are loaded with the two ends of the program text for the write that follows. That write is the enhancement package's: the six bytes at 4D76H are module 2's FASTSAV patch, so control leaves this routine there and never reaches the byte at a time loop of module 1 that stands at 4D7CH. The protected form at 5759H is not part of this range but ends inside it, calling 4D6CH so that the marker and the two ends are set up by the same three instructions.

4D1E
PUSH HL E5
SAVE (4D1EH), the routine the statement address table holds for token 0CBH at 6857H: push Register Pair HL, the text pointer the statement dispatcher came in with, which stands at the first character of the filespec and is wanted again at 4D46H after the options have been read.
4D1F
Call 7345H, the expression evaluator, which works the filespec expression out and leaves the text pointer in Register Pair HL standing after it, so that an option letter can be looked for; the open at 4C1CH reads the filespec again for itself from the pointer pushed above.
4D22
PUSH HL E5
Push Register Pair HL, that pointer, across the call below, which works on the value the evaluation left and has no use for the position on the line.
4D23
Call 481AH, which opens by calling 2AB0H of the overlay to insist that what the evaluation left is a string, giving Type mismatch through 5884H when it is not, and then takes that string in hand by way of the accumulator at 72ECH and the string area pointer at 7178H.
4D26
POP HL E1
Pop Register Pair HL, the text pointer standing after the filespec expression, which the call above left alone.
4D27
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the pointer already stands on rather than the one beyond it.
4D28
Call NXTCHAR at 5E93H, which brings the next character of the line back in Register A, with the Zero Flag set when the statement has ended there.
4D2B
Jump to 4D46H on Z, the statement having ended with the filespec, which is the plain SAVE with no option after it.
4D2E
Call 4353H, which insists that the character the text pointer is on is the one in the byte standing after this call, steps its own return address past that byte and brings the character after it back in Register A: a comma is required before the option letter.
4D31
DEFB 2CH 2C
The comma that 4353H compares the line's character with. It is read as data by the routine the call at 4D2EH reaches, not executed, and the instruction after that call is the one at 4D32H.
4D32
CP 41H FE 41
Compare Register A with 41H, the letter A, which asks for the program to be written as text rather than tokenized.
4D34
Jump to 4D3CH on Z, the A option having been given, so that the letter is checked for being the last thing on the line.
4D37
CP 50H FE 50
Compare Register A with 50H, the letter P, the only other option SAVE takes, which asks for the protected form.
4D39
Jump to SYNERR at 586CH on NZ: a comma after the filespec may be followed by the letter A or the letter P and by nothing else.
4D3C
PUSH HL E5
Push Register Pair HL, the text pointer standing on the option letter, which is wanted back below once the line has been checked for ending there.
4D3D
PUSH AF F5
Push Register Pair AF, the option letter in Register A with it, because the call below returns another character in Register A and the letter is what the two tests at 4D48H and 4D57H weigh.
4D3E
Call NXTCHAR at 5E93H again, which brings the character after the option letter back in Register A and sets the Zero Flag when the statement ends there.
4D41
Jump to SYNERR at 586CH on NZ: the option letter must be the last thing on the line, so anything still standing after it is Syntax error.
4D44
POP AF F1
Pop Register Pair AF, which brings the option letter back into Register A for the two tests that follow.
4D45
POP HL E1
Pop Register Pair HL, the text pointer standing on the option letter, the line having properly ended.
4D46
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the entry text pointer pushed at 4D1EH into Register Pair HL for the open below and leaves the pointer standing after the options on the stack for the POP HL at 4D56H.
4D47
PUSH AF F5
Push Register Pair AF, the option letter in Register A, across the open below, which uses Register A for its own work.
4D48
CP 50H FE 50
Compare Register A with 50H, the letter P, so that a protected save is let through the check that follows.
4D4A
Jump to 4D50H on Z, the P option having been given: a program may be saved in the protected form whatever the protected flag holds, which is what lets a protected program be saved again.
4D4D
Call 57E8H, which reads the byte at 72CBH, the protected program flag, and jumps to FUNCERR 5F95H to give Illegal function call when it is not 00H: a program loaded with protection cannot be saved in the plain or the text form.
4D50
LD D,02H 16 02
Load Register D with 02H, the mode the open below is to use, which is output; the entry at 4C15H that LOAD and MERGE use loads Register D with 01H instead, for input.
4D52
Call 4C1CH, which clears Register A and goes on to 511CH, the code that takes the filespec off the line the text pointer in Register Pair HL stands on and opens the file in the mode Register D holds.
4D55
POP AF F1
Pop Register Pair AF, which brings the option letter back into Register A once the file is open.
4D56
POP HL E1
Pop Register Pair HL, the text pointer standing after the options, which the exchange at 4D46H left on the stack.
4D57
CP 50H FE 50
Compare Register A with 50H, the letter P, to pick the protected form out of the three.
4D59
Jump to 5759H on Z, which writes the marker 0FEH and calls back into this routine at 4D6CH, so that the protected save uses the same three instructions as the plain one.
4D5C
CP 41H FE 41
Compare Register A with 41H, the letter A, to pick the text form out of the two that are left.
4D5E
Jump to 4D67H on NZ, no option or neither of the two letters standing in Register A, which is the plain tokenized save.
4D61
Call NXTCHAR at 5E93H, which brings the character after the option letter back in Register A for the code at 79B3H, which expects the text pointer set as a LIST statement would leave it.
4D64
Jump to LIST at 79B3H, which writes the program out as text: the file is open and is the file in hand, so every line LIST would have put on the screen goes to the file instead, and the whole of a text save is done by LIST.
4D67
Call NORMNUM at 661EH, which walks the program and puts every line reference back into its plain number form, because what is written to the file must not carry the pointers BASIC keeps while the program runs.
4D6A
LD A,0FFH 3E FF
Load Register A with 0FFH, the first byte of a plain tokenized program file, which marks it as tokenized and unprotected; the protected path at 5765H loads 0FEH here instead and enters below.
4D6C
Call 4F8DH, which writes the byte in Register A to the file in hand and brings it back unchanged, every PUSH AF of it being matched and the last POP AF at 4FB7H standing before its register pops: so the marker is still in Register A when the patch at 4D76H calls FASTSAV, which is the byte FASTSAV writes as the file's type at 8307H.
4D6F
LD DE,(719FH) ED 5B 9F 71
Load Register Pair DE from the word at 719FH, VARTAB, the address the simple variables start at and so the first byte above the program text, which is the end of what is to be written.
4D73
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL from the word at 6E9EH, PGMBGN, the pointer to the first byte of the program, which is where the write begins; the next instruction is module 2's FASTSAV patch at 4D76H, which takes the write over.

4D76H - The FASTSAV Patch (4D76H-4D7BH)

One of the eight places where the NEWB enhancement package of module 2 replaces instructions of module 1 with a call or a jump into its own code at 8048H and above, each of them an ORG in NEWB/ASM. The bytes here are loaded by module 1 and then loaded over again by module 2.

4D76
FASTSAV intercept (4D76H-4D78H): call FASTSAV at 8302H, the package's own writer for a tokenized BASIC program, which saves it with whole sectors in place of the first module's byte at a time write.
4D79
4D79H-4D7BH: jump to 4CD0H, where the first module's save carries on after the program has been written.

4D7CH - SAVE's Byte at a Time Write, Which the Release Never Reaches (4D7CH-4D84H)

These nine bytes are module 1's own writer for a tokenized program: one byte taken from the program text, written through 4F8DH, and the jump back to the test that decided whether the end had been reached. In the release they are unreachable. The test they jump back to stood at 4D76H, and 4D76H is where module 2 puts its FASTSAV patch, so the only two ways in are both closed: the fall through from 4D75H now lands on the patch's CALL 8302H, which never comes back here because FASTSAV writes the whole program itself and the patch's second instruction jumps to 4CD0H, and the JR at 4D83H is inside this block and so can only be reached from within it. Nothing else in the file reaches any byte of the range, by word reference or by relative jump: the three images were swept for a word naming each of the nine addresses with `tools\xrefimg.py` and every JR, conditional JR and DJNZ of module 1 and module 2 was decoded for a target inside it, and both came back empty. This is the second block the enhancement package orphans, after 4C97H in LOAD, and like that one it is not a fault of module 1: the code is sound and complete, and installing the package is what puts it out of reach. What the lost test at 4D76H did can be read off the two instructions that survive it, since Register Pair DE holds VARTAB from 4D6FH and Register Pair HL the program start from 4D73H, and the loop below raises Register Pair HL by one for each byte written: it compared the two and left the loop when Register Pair HL reached Register Pair DE.

4D7C
LD A,(HL) 7E
The write loop (4D7CH), which the release does not reach: load Register A with the byte of the program text that Register Pair HL addresses, the next byte to go to the file.
4D7D
INC HL 23
Increment Register Pair HL to the byte after it, which is what makes the test at 4D76H come true when the whole of the program text has been written.
4D7E
PUSH DE D5
Push Register Pair DE, VARTAB, across the call below, which does not keep it: 4F8DH pushes Register Pair DE itself at 4F99H, so this push guards against the path at 4F95H that leaves through 4470H instead of returning.
4D7F
Call 4F8DH, which writes the byte in Register A to the file in hand and brings Register A back unchanged.
4D82
POP DE D1
Pop Register Pair DE, VARTAB, which the end test at 4D76H weighs against Register Pair HL.
4D83
Jump back to 4D76H, where the test stood that ends the loop; in the release that address holds module 2's FASTSAV patch, and this is the one instruction that would reach it if any instruction reached this block.

4D85H - CLOSE: Close Every File or the Ones Named (4D85H-4DC1H)

CLOSE takes either no argument, when it closes every file BASIC was started with, or a list of file numbers separated by commas, each of which may carry a number sign in front of it. Which of the two it is costs the routine nothing to find out, because the Zero Flag already says so: the statement dispatcher at 5E3BH falls into NXTCHAR at 5E93H after it pushes the statement routine's address, so every statement routine is entered with the flags NXTCHAR left, and NXTCHAR returns with the Zero Flag set when the character is a colon or the 00H that ends the line. Neither the LD BC,4F52H at 4D85H nor the LD A,(6ECEH) at 4D88H touches a flag, so the JR NZ at 4D8BH is weighing the end of the statement when it decides between the two forms. Both forms close a file by the same routine, 4F52H, and both reach it by pushing its address and returning to it rather than by calling it, which is what lets the address be carried in Register Pair BC and the return address be chosen: the sweep at 4D8DH returns into 4D96H to count down, and the list at 4DA7H returns into 4D9EH to look for the next comma. The twelve bytes at 4DB8H are a third entry, for the rest of BASIC rather than for a statement: they clear Register A only to set the Zero Flag, so that the call to 4D85H below takes the no argument path and closes everything, and they put Register Pair DE and Register Pair BC back for the caller.

4D85
LD BC,4F52H 01 52 4F
CLOSE (4D85H), the routine the statement address table holds for token 0C3H at 6847H: load Register Pair BC with 4F52H, the address of the routine that closes one file, which both forms below reach by pushing this value and returning to it.
4D88
LD A,(6ECEH) 3A CE 6E
Load Register A from the byte at 6ECEH, the number of file buffers BASIC was started with, which is the highest file number there can be and so the count the sweep below works down from.
4D8B
Jump to 4DA7H on NZ, the statement not having ended at the dispatcher's NXTCHAR, which means a list of file numbers follows and only those files are to be closed.
4D8D
PUSH HL E5
The sweep over every file (4D8DH), the statement having ended: push Register Pair HL, the text pointer, which the whole of the sweep leaves alone and the exit at 4D9CH gives back.
4D8E
PUSH BC C5
Push Register Pair BC, 4F52H, which the return below consumes off the stack and which is therefore pushed again on each turn of the loop.
4D8F
PUSH AF F5
Push Register Pair AF, the file number in Register A, because the routine at 4F52H does not keep it and the count is what the loop runs on.
4D90
LD DE,4D96H 11 96 4D
Load Register Pair DE with 4D96H, the address this turn of the loop is to come back to, which is the instruction after the return below.
4D93
PUSH DE D5
Push Register Pair DE, 4D96H, so that it lies under the routine address and serves as the return address for the routine the return below enters.
4D94
PUSH BC C5
Push Register Pair BC, 4F52H, the address of the close, which now lies on top of the return address 4D96H.
4D95
RET C9
Return, which takes 4F52H off the stack and jumps to it: this is a call to 4F52H made with the address in a register pair, and it closes the file whose number stands in Register A, doing nothing for a number that was never opened.
4D96
POP AF F1
The turn of the loop (4D96H), reached by the return of 4F52H: pop Register Pair AF, which brings the file number back into Register A.
4D97
POP BC C1
Pop Register Pair BC, which brings 4F52H back for the next turn, the return at 4D95H having taken it off.
4D98
DEC A 3D
Decrement Register A to the next file number down, which is the one the next turn closes.
4D99
Jump to 4D8EH on P, the Sign Flag being clear while Register A is 00H or above, so that file number 00H is closed and the turn after it, with Register A at 0FFH, leaves the loop.
4D9C
POP HL E1
Pop Register Pair HL, the text pointer pushed at 4D8DH, every file having been closed.
4D9D
RET C9
Return to 5E3BH, the statement loop, whose address the dispatcher pushed at 5E79H, with Register Pair HL standing at the character after the statement.
4D9E
POP BC C1
The turn of the list (4D9EH), reached by the return of 4F52H for a named file: pop Register Pair BC, which brings 4F52H back, the exchange at 4DB1H having put it on the stack and the push at 4DB2H having put it there again.
4D9F
POP HL E1
Pop Register Pair HL, the text pointer standing after the file number just closed, which the exchange at 4DB1H left on the stack.
4DA0
LD A,(HL) 7E
Load Register A with the character of the line that Register Pair HL addresses, to see whether another file number follows this one.
4DA1
CP 2CH FE 2C
Compare Register A with 2CH, the comma that separates one file number of the list from the next.
4DA3
RET NZ C0
Return on NZ to 5E3BH, the statement loop, the list having ended with no comma after the last number: this is the ordinary end of the named form.
4DA4
Call NXTCHAR at 5E93H, which steps the text pointer past the comma and brings the first character of the next file number back in Register A.
4DA7
PUSH BC C5
The list of named files (4DA7H), which the test at 4D8BH jumps to and the turn above falls into: push Register Pair BC, 4F52H, which the exchange at 4DB1H takes back off the stack.
4DA8
LD A,(HL) 7E
Load Register A with the character of the line that Register Pair HL addresses, which is where a number sign may stand before the file number.
4DA9
CP 23H FE 23
Compare Register A with 23H, the number sign, which CLOSE allows before a file number and does not require.
4DAB
Call NXTCHAR at 5E93H on Z, which steps the text pointer past the number sign; for anything else the text pointer is left where it is and the expression begins there.
4DAE
Call 799FH, which evaluates the file number, gives Illegal function call through 5F95H for a value of 256 or more, steps the text pointer past the expression and returns the number in Register A.
4DB1
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts 4F52H into Register Pair HL for the jump below and leaves the text pointer standing after the file number on the stack for the POP HL at 4D9FH.
4DB2
PUSH HL E5
Push Register Pair HL, 4F52H, which the POP BC at 4D9EH takes back when this file has been closed.
4DB3
LD DE,4D9EH 11 9E 4D
Load Register Pair DE with 4D9EH, the address the close is to come back to, which is where the next comma of the list is looked for.
4DB6
PUSH DE D5
Push Register Pair DE, 4D9EH, which becomes the return address of the routine the jump below enters.
4DB7
JP (HL) E9
Jump to the address in Register Pair HL, 4F52H, which closes the file whose number stands in Register A and returns to 4D9EH.
4DB8
PUSH DE D5
Close every file, for the rest of BASIC rather than for a statement (4DB8H): push Register Pair DE, which this entry gives back and which its callers keep across it.
4DB9
PUSH BC C5
Push Register Pair BC, which this entry gives back as well, and which the sweep below loads with 4F52H.
4DBA
XOR A AF
Clear Register A with exclusive OR, which is done for the Zero Flag it sets and not for the value: the entry below reloads Register A from 6ECEH at once, and the flag is what sends it down the no argument path.
4DBB
Call 4D85H, the statement entry above, which with the Zero Flag set closes every file BASIC was started with and returns through the RET at 4D9DH.
4DBE
POP BC C1
Pop Register Pair BC, which gives the caller back what it had.
4DBF
POP DE D1
Pop Register Pair DE, which gives the caller back what it had.
4DC0
XOR A AF
Clear Register A with exclusive OR, so that this entry returns with 00H in Register A and the Zero Flag set, whatever the closing left behind.
4DC1
RET C9
Return to the caller, every file having been closed.

4DC2H - FIELD: Lay the Record Buffer of a Random File out into String Variables (4DC2H-4E1DH)

FIELD takes a file number and then a list of widths, each followed by the word AS and a string variable, and gives each variable a descriptor that points into the file's own record buffer instead of into the string space: the length byte of the descriptor is the width and the address is the place in the buffer the field begins at, so the variable reads and writes the buffer directly and no copying is done. The word AS is not a token of this BASIC, so it is spelled out as two separate characters by two calls of 4353H whose data bytes are the letter A at 4DECH and the letter S at 4DF0H. The buffer stands 34H bytes above the start of the file's control block, which the entry at 4ABEH confirms by working the same address out for its own callers, and the fields are laid down it one after another: Register Pair BC is rebuilt as the width alone at 4DFAH and 4E14H, so the ADD HL,BC at 4DDCH steps the buffer pointer on by the last field's width each time round. The record length is taken from the byte at the control block plus 000BH and kept at 521BH, and a length of 256 is held there as 00H, which is why the test at 4E08H lets a total that passes the record length through when that byte is zero. Two things are required before any of it: the file must be open, or the Zero Flag the routine at 4A98H returns gives error 52 Bad file number, and its mode must be 03H, random, or the SUB 03H at 4DC8H gives error 54 Bad file mode. The running total of the widths is held in one byte, and B300 is what that costs when the widths come to exactly 256.

4DC2
FIELD (4DC2H), the routine the statement address table holds for token 0C0H at 6841H: call 4A98H, which reads the file number after an optional number sign, returns the address of that file's control block in Register Pair BC and its mode byte in Register A, and sets the Zero Flag when the mode is 00H, which is a file that is not open.
4DC5
Jump to 5847H on Z, the file not being open: that entry loads Register E with 34H and the handler prints error 52, Bad file number, the text being the thirty third of the block at 6B7CH.
4DC8
SUB 03H D6 03
Subtract 03H from Register A, the mode byte, which leaves 00H only for a file opened in the random mode, the one mode whose record buffer FIELD can lay out.
4DCA
Jump to 5841H on NZ, the file being open in some other mode: that entry loads Register E with 36H and the handler prints error 54, Bad file mode.
4DCD
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which parks the text pointer in Register Pair DE while the record length is fetched.
4DCE
LD HL,000BH 21 0B 00
Load Register Pair HL with 000BH, the offset of the record length byte inside the file's control block.
4DD1
ADD HL,BC 09
Add Register Pair BC, the control block address, to Register Pair HL, so that Register Pair HL addresses that byte.
4DD2
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the file's record length, which is held as 00H when the length is 256.
4DD3
LD (521BH),A 32 1B 52
Store Register A into the byte at 521BH, where the record length waits while the list is read, the test at 4E02H reading it once for every field.
4DD6
XOR A AF
Clear Register A with exclusive OR, which is the running total of the widths before the first field is read.
4DD7
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL.
4DD8
LD DE,0034H 11 34 00
Load Register Pair DE with 0034H, the offset of the record buffer inside the control block, which the first turn below turns into the address of the first field.
4DDB
EX DE,HL EB
The turn of the list (4DDBH): exchange Register Pair DE with Register Pair HL, which puts the offset of the first field, or the address of the last one, into Register Pair HL and parks the text pointer in Register Pair DE.
4DDC
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which on the first turn makes the address of the buffer out of the offset 0034H and the control block address, and on every turn after it steps the last field's address on by the width Register Pair BC was rebuilt as at 4DFAH and 4E14H.
4DDD
LD B,A 47
Load Register B with Register A, the running total of the widths, so that the addition at 4DFBH can weigh the next width against it; this also makes the high byte of Register Pair BC the total until 4E14H clears it.
4DDE
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL and leaves this field's address in Register Pair DE.
4DDF
LD A,(HL) 7E
Load Register A with the character of the line that Register Pair HL addresses, which is where a comma stands before each field of the list.
4DE0
CP 2CH FE 2C
Compare Register A with 2CH, the comma that stands before every width of the list, the first one included.
4DE2
RET NZ C0
Return on NZ to 5E3BH, the statement loop, the list having ended: a FIELD naming a file and nothing else is accepted and does nothing.
4DE3
PUSH DE D5
Push Register Pair DE, this field's address in the buffer, which the exchange at 4DF9H takes back once the width and the variable have been read.
4DE4
PUSH BC C5
Push Register Pair BC, the control block address, which the calls below do not keep.
4DE5
Call 799CH, which steps the text pointer past the comma with NXTCHAR and goes on into 799FH to work the width out, giving Illegal function call through 5F95H for a value of 256 or more and returning the width in Register A.
4DE8
PUSH AF F5
Push Register Pair AF, the width in Register A, across the three calls below, which all use Register A for their own work.
4DE9
Call 4353H, which insists that the character the text pointer is on is the one in the byte standing after this call, steps its own return address past that byte and brings the next character back in Register A.
4DEC
DEFB 41H 41
The letter A, the first character of the word AS, which 4353H compares the line's character with. It is read as data by the routine the call at 4DE9H reaches, not executed, and the instruction after that call is the one at 4DEDH.
4DED
Call 4353H a second time, for the second character of the word AS, which this BASIC does not hold as a token and so spells out one character at a time.
4DF0
DEFB 53H 53
The letter S, the second character of the word AS, data for the call at 4DEDH and not an instruction; the instruction after that call is the one at 4DF1H.
4DF1
Call the variable search at 39FBH, which finds the variable named after the word AS, creating it when it is new, and returns its address in Register Pair DE.
4DF4
Call 2AB0H of the overlay, which insists that the variable is a string one and gives Type mismatch through 5884H when it is not, because only a string descriptor can be pointed into the buffer.
4DF7
POP AF F1
Pop Register Pair AF, which brings the width back into Register A.
4DF8
POP BC C1
Pop Register Pair BC, which brings the control block address back into Register Pair BC.
4DF9
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts this field's buffer address into Register Pair HL and leaves the text pointer standing after the variable on the stack for the POP HL at 4E16H.
4DFA
LD C,A 4F
Load Register C with Register A, the width, which makes Register Pair BC the width alone once Register B is cleared at 4E14H, and that is what steps the buffer pointer on at 4DDCH next turn.
4DFB
ADD A,B 80
Add Register B, the running total, to Register A, which gives the total through the end of this field and sets the Carry Flag when it passes 255. The running total is one byte and this is where B300 begins: a total of exactly 256 comes out of this addition as 00H with the Zero Flag set, which the test at 4DFEH reads as no overflow at all and the record length test at 4E02H then weighs against nothing.
4DFC
Jump to 4E01H on NC, the total still fitting in a byte, so that the record length is weighed against it below.
4DFE
Jump to 5859H on NZ, the total having passed 255 and not landed exactly on 256: that entry loads Register E with 32H and the handler prints error 50, FIELD overflow. A total of exactly 256 leaves Register A at 00H with the Zero Flag set, so this jump is not taken and the overflow goes unreported, which is the first half of B300.
4E01
LD B,A 47
Load Register B with Register A, the running total through this field, which the comparison below weighs the record length against.
4E02
LD A,(521BH) 3A 1B 52
Load Register A from the byte at 521BH, the record length saved at 4DD3H.
4E05
CP B B8
Compare Register A with Register B, which clears the Carry Flag when the record length is as large as the total and the fields therefore fit the record.
4E06
Jump to 4E0CH on NC, the fields fitting the record, so that this one's descriptor is written. A total that wrapped to 00H at 4DFBH passes this test whatever the record length holds, which is the second half of B300.
4E08
OR A B7
OR Register A with itself, which sets the Zero Flag only when the record length byte is 00H, the way a record length of 256 is held.
4E09
Jump to 5859H on NZ, the fields passing a record length that is really as small as its byte says: error 50, FIELD overflow.
4E0C
LD A,B 78
Load Register A with Register B, the running total, which the test below reads and the next turn takes as its starting total.
4E0D
OR A B7
OR Register A with itself, which sets the Zero Flag when the total has come to exactly 256 and so filled a whole buffer; the flag survives the four stores below and the POP HL, none of which touches it, and is read at 4E17H.
4E0E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the variable's address into Register Pair HL and this field's buffer address into Register Pair DE.
4E0F
LD (HL),C 71
Store Register C, the width, into the byte Register Pair HL addresses, which is the length byte of the string descriptor.
4E10
INC HL 23
Increment Register Pair HL to the second byte of the descriptor, where the address of the string begins.
4E11
LD (HL),E 73
Store Register E, the low byte of this field's buffer address, into the byte Register Pair HL addresses.
4E12
INC HL 23
Increment Register Pair HL to the third byte of the descriptor, the high byte of the address.
4E13
LD (HL),D 72
Store Register D, the high byte of this field's buffer address, into the byte Register Pair HL addresses: the variable now reads and writes the record buffer itself.
4E14
LD B,00H 06 00
Load Register B with 00H, which leaves Register Pair BC holding the width alone, the amount the buffer pointer is stepped on by at 4DDCH.
4E16
POP HL E1
Pop Register Pair HL, the text pointer standing after the variable, which the exchange at 4DF9H left on the stack.
4E17
Jump back to 4DDBH on NZ, the buffer not yet full, to look for a comma and another field.
4E19
LD A,C 79
Load Register A with Register C, this field's width, the total having come to exactly 256 and the buffer being full.
4E1A
OR A B7
OR Register A with itself, which sets the Zero Flag only for a width of 00H.
4E1B
RET NZ C0
Return on NZ to 5E3BH, the statement loop, a field of some width having filled the buffer: anything still standing on the line is dropped without a word, which is the third part of B300.
4E1C
Jump back to 4DDBH, the width having been 00H, so that a run of zero width fields at the end of a full buffer is read to the end of the list.

4E1EH - RSET and LSET: Put a String into a Field, Right or Left Justified (4E1EH-4EC1H)

RSET and LSET both take a string variable, the equals token and a string expression, and lay the expression's characters into the variable's existing space without changing its length: what is shorter is padded with spaces, what is longer is cut off. The two differ in one bit and nothing else. RSET enters at 4E1EH, whose OR 37H leaves Register A not zero and clears the Carry Flag; LSET enters at 4E1FH, which is the operand byte 37H of that instruction and as an instruction of its own is SCF, so it sets the Carry Flag. The PUSH AF at 4E20H puts that flag away for the whole of the routine, the POP AF at 4E8BH brings it back, and the two conditional calls of the padding routine are what it decides: CALL NC,4EA3H at 4E8CH pads before the copy, which pushes the characters to the right, and CALL C,4EA3H at 4E9EH pads after it, which leaves them at the left. This is the fifth place in this file where one entry point stands inside the instruction of another, after the error chain at 586CH, TRON at 43F0H, NEXT at 4529H and LOAD at 4C20H. The copy loop at 4E90H and the padding loop at 4EA6H both use the same trick of an INC and a DEC of the count, which sets the flags from a count the instruction leaves as it found it. Most of the routine is stack work, because five values have to be kept while the two descriptors are read: the justification flag, the text pointer, the two descriptor addresses and the pair of lengths. The one path that is not about fields at all is 4E50H to 4E76H, taken when the variable's own bytes lie between PGMBGN 6E9EH and VARTAB 719FH, which is to say inside the program text: that happens to a string variable that has never been FIELDed and still points at a literal of the program, and writing into it would alter the program, so fresh string space is taken and the descriptor is pointed at that instead.

4E1E
OR 37H F6 37
RSET (4E1EH), the routine the statement address table holds for token 0CAH at 6855H: OR Register A with 37H, which is done for the clear Carry Flag it leaves and not for the value, and the byte 37H it ORs with is LSET's entry point one address on.
4E20
PUSH AF F5
Push Register Pair AF, which puts the Carry Flag away for the whole routine: clear from the OR above for RSET, set from the SCF at 4E1FH for LSET, and nothing between here and the POP AF at 4E8BH depends on it.
4E21
Call the variable search at 39FBH, which finds the variable named after the keyword, creating it when it is new, and returns its address in Register Pair DE.
4E24
Call 2AB0H of the overlay, which insists that the variable is a string one and gives Type mismatch through 5884H when it is not.
4E27
PUSH DE D5
Push Register Pair DE, the address of the variable's descriptor, which is wanted after the expression on the right has been worked out.
4E28
Call 733AH, which insists on the equals token 0F1H through 4353H and then goes on into the evaluator at 7345H, so that this one call reads both the equals sign and the whole of the expression after it.
4E2B
POP BC C1
Pop Register Pair BC, the address of the variable's descriptor, which the push at 4E27H left on the stack.
4E2C
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the text pointer standing after the expression on the stack under the pushes that follow and brings the saved Register Pair AF word into Register Pair HL.
4E2D
PUSH HL E5
Push Register Pair HL, that saved word, which goes back on the stack in the text pointer's place and is popped as Register Pair AF at 4E8BH.
4E2E
PUSH BC C5
Push Register Pair BC, the variable's descriptor address, which the exchange at 4E33H takes back off the stack.
4E2F
Call 481AH, which insists through 2AB0H that the expression's value is a string, brings the descriptor address of that string into Register Pair HL out of the accumulator at 72ECH, and gives its space back when it is the topmost temporary of the string area by raising the pointer at 7178H.
4E32
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the length of the string on the right, which is how many characters there are to copy.
4E33
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the variable's descriptor address into Register Pair HL and leaves the expression's descriptor address on the stack for the POP HL at 4E7EH.
4E34
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the variable, which is the width of the field and the number of characters that will be written whatever the length on the right.
4E35
LD C,A 4F
Load Register C with Register A, that width, so that Register Pair BC now holds the length on the right and the width of the field together.
4E36
PUSH BC C5
Push Register Pair BC, the two lengths, which the POP BC at 4E7DH brings back once both addresses have been read.
4E37
PUSH HL E5
Push Register Pair HL, the variable's descriptor address, which the POP HL at 4E78H brings back.
4E38
PUSH AF F5
Push Register Pair AF, the width in Register A with the flags that 481AH left, which the POP AF at 4E77H brings back and whose Zero Flag the test at 4EB1H reads on the path that runs out of string space.
4E39
INC HL 23
Increment Register Pair HL to the second byte of the variable's descriptor, where the address of its characters begins.
4E3A
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of that address.
4E3B
INC HL 23
Increment Register Pair HL to the third byte of the descriptor, the high byte of the address.
4E3C
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE now holds the address the characters are to be written to.
4E3D
OR A B7
OR Register A with itself, the width, which sets the Zero Flag for a variable whose length is 00H and clears the Carry Flag.
4E3E
Jump to 4E99H on Z, the field being of no width at all: there is nothing to copy and nothing to pad, so the five pushes are taken off the stack and the statement ends.
4E40
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL from the word at 6E9EH, PGMBGN, the pointer to the first byte of the program, the lower end of the range this test asks about.
4E43
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Carry Flag when Register Pair HL is the smaller.
4E46
Jump to 4E77H on NC, the program's first byte standing at or above the field's address, so the field is not inside the program text and may be written where it is.
4E48
LD HL,(719FH) 2A 9F 71
Load Register Pair HL from the word at 719FH, VARTAB, the address the simple variables start at and so the first byte above the program text, the upper end of the range.
4E4B
Call 434DH again, which compares that address with the field's address in Register Pair DE in the same way.
4E4E
Jump to 4E77H on C, VARTAB standing below the field's address, so the field is above the program text, which is where a FIELDed variable points and where the string area lies.
4E50
LD E,C 59
Load Register E with Register C, the width, the field's address having been found inside the program text so that room must be taken for a copy.
4E51
LD D,00H 16 00
Load Register D with 00H, so that Register Pair DE holds the width as a sixteen bit number for the addition below.
4E53
LD HL,(71A3H) 2A A3 71
Load Register Pair HL from the word at 71A3H, the lowest free address of the string area, which is the floor the string space reaches down to.
4E56
ADD HL,DE 19
Add Register Pair DE, the width, to Register Pair HL, which gives the lowest address the string area could hold after this string is taken from it.
4E57
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that sum into Register Pair DE for the comparison.
4E58
LD HL,(7178H) 2A 78 71
Load Register Pair HL from the word at 7178H, HIPT, which 46BDH lowers as each string is taken and which is therefore the top of the free string space.
4E5B
Call 434DH, which compares the top of the free space in Register Pair HL with the sum in Register Pair DE.
4E5E
Jump to 4EACH on C, the top standing below the floor plus the width, so there is not enough room and a collection has to be made first.
4E60
POP AF F1
Pop Register Pair AF, the width and the flags pushed at 4E38H, there being room for the string.
4E61
LD A,C 79
Load Register A with Register C, the width, which is how many bytes of string space are to be taken.
4E62
Call 46BDH, which takes that many bytes off the top of the string space by lowering the pointer at 7178H and returns the address of them in Register Pair DE, making a collection first when the space has to be tidied.
4E65
POP HL E1
Pop Register Pair HL, the variable's descriptor address pushed at 4E37H.
4E66
POP BC C1
Pop Register Pair BC, the two lengths pushed at 4E36H.
4E67
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the expression's descriptor address into Register Pair HL and puts the variable's on the stack.
4E68
PUSH DE D5
Push Register Pair DE, the address of the new string space, which the POP DE at 4E6EH brings back once the expression's descriptor has been found again.
4E69
PUSH BC C5
Push Register Pair BC, the two lengths, across the call below.
4E6A
Call 481AH a second time, because a collection may have moved the string: it brings the expression's descriptor address into Register Pair HL out of the accumulator at 72ECH as it stands now.
4E6D
POP BC C1
Pop Register Pair BC, the length on the right and the width of the field, which the push at 4E69H guarded across the call above.
4E6E
POP DE D1
Pop Register Pair DE, the address of the new string space.
4E6F
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the variable's descriptor address back into Register Pair HL and puts the expression's on the stack for the POP HL at 4E7EH.
4E70
PUSH BC C5
Push Register Pair BC, the two lengths, so that the stack is as the common tail below expects it.
4E71
PUSH HL E5
Push Register Pair HL, the variable's descriptor address, which the POP HL at 4E78H brings back.
4E72
INC HL 23
Increment Register Pair HL to the second byte of the variable's descriptor, where its address is kept.
4E73
PUSH AF F5
Push Register Pair AF, so that the stack holds what the POP AF at 4E77H expects, this path having popped it at 4E60H.
4E74
LD (HL),E 73
Store Register E, the low byte of the new string space, into the byte Register Pair HL addresses.
4E75
INC HL 23
Increment Register Pair HL to the third byte of the descriptor.
4E76
LD (HL),D 72
Store Register D, the high byte of the new string space, into the byte Register Pair HL addresses: the variable now points at space of its own and the program text is left alone.
4E77
POP AF F1
The common tail (4E77H), which both the ordinary path and the copied one reach: pop Register Pair AF, the width and the flags pushed at 4E38H.
4E78
POP HL E1
Pop Register Pair HL, the variable's descriptor address.
4E79
INC HL 23
Increment Register Pair HL to the second byte of that descriptor.
4E7A
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the field's address.
4E7B
INC HL 23
Increment Register Pair HL to the third byte of the descriptor.
4E7C
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the address the characters go to, which the copy and the padding both advance.
4E7D
POP BC C1
Pop Register Pair BC, the length on the right in Register B and the width of the field in Register C.
4E7E
POP HL E1
Pop Register Pair HL, the expression's descriptor address, which the exchange at 4E33H or the one at 4E6FH left on the stack.
4E7F
INC HL 23
Increment Register Pair HL to the second byte of the expression's descriptor.
4E80
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of the address of the characters to copy.
4E81
INC HL 23
Increment Register Pair HL to the third byte of that descriptor.
4E82
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of that address, which overwrites the pointer now that the low byte is held in Register A.
4E83
LD L,A 6F
Load Register L with Register A, so that Register Pair HL addresses the characters of the string on the right.
4E84
LD A,C 79
Load Register A with Register C, the width of the field, to be weighed against the length on the right.
4E85
CP B B8
Compare Register A with Register B, which clears the Carry Flag when the field is as wide as the string is long.
4E86
Jump to 4E89H on NC, the string fitting the field, so that all of it is copied.
4E88
LD B,A 47
Load Register B with Register A, the width, the string being longer than the field: only as many characters as the field holds are copied and the rest are cut off without a word.
4E89
SUB B 90
Subtract Register B, the number of characters to copy, from Register A, the width, which leaves the number of spaces the field has to be padded with.
4E8A
LD C,A 4F
Load Register C with Register A, that count of spaces, which is what the padding routine at 4EA3H works down.
4E8B
POP AF F1
Pop Register Pair AF, which brings back the Carry Flag the entry point set and with it the choice between the two statements; it brings back the entry value of Register A as well, which nothing below reads.
4E8C
Call 4EA3H on NC, the Carry Flag being clear for RSET: the spaces are written first and Register Pair DE is left standing after them, so the characters that follow finish at the right hand end of the field.
4E8F
INC B 04
Increment Register B, the count of characters to copy, so that the decrement below leaves it as it was while setting the flags from it.
4E90
DEC B 05
Decrement Register B, which puts the count back to what it was on the first turn and takes one off it on every turn after, and sets the Zero Flag when none is left.
4E91
Jump to 4E9EH on Z, every character having been copied, so that LSET's padding can be put after them.
4E93
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the next character of the string on the right.
4E94
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, which is the next place in the field.
4E95
INC HL 23
Increment Register Pair HL to the next character of the string.
4E96
INC DE 13
Increment Register Pair DE to the next place in the field.
4E97
Jump back to 4E90H, where the count is taken down and tested again.
4E99
POP BC C1
The exit for a field of no width (4E99H), reached from 4E3EH: pop Register Pair BC, the first of the five words the pushes at 4E27H to 4E38H left, none of which is wanted.
4E9A
POP BC C1
Pop Register Pair BC, the second of the five, Register Pair BC being used because what is popped is thrown away.
4E9B
POP BC C1
Pop Register Pair BC, the third of the five, which is the variable's descriptor address that 4E37H pushed.
4E9C
POP BC C1
Pop Register Pair BC, the fourth of the five.
4E9D
POP BC C1
Pop Register Pair BC, the fifth of the five, which leaves the text pointer on top of the stack.
4E9E
Call 4EA3H on C, the Carry Flag being set for LSET: the spaces go after the characters, which leaves them at the left hand end of the field. Reached from 4E99H the Carry Flag is clear, the OR A at 4E3DH having cleared it, so a field of no width is never padded.
4EA1
POP HL E1
Pop Register Pair HL, the text pointer standing after the expression, which the exchange at 4E2CH put on the stack.
4EA2
RET C9
Return to 5E3BH, the statement loop, the field having been written.
4EA3
LD A,20H 3E 20
The padding routine (4EA3H), which both statements call and which writes spaces at Register Pair DE and advances it: load Register A with 20H, the space character.
4EA5
INC C 0C
Increment Register C, the count of spaces, so that the decrement below leaves it as it was while setting the flags from it.
4EA6
DEC C 0D
Decrement Register C, which puts the count back on the first turn and takes one off it on every turn after, and sets the Zero Flag when none is left.
4EA7
RET Z C8
Return on Z, every space having been written, with Register Pair DE standing after them.
4EA8
LD (DE),A 12
Store Register A, the space, into the byte Register Pair DE addresses.
4EA9
INC DE 13
Increment Register Pair DE to the next place in the field.
4EAA
Jump back to 4EA6H, where the count is taken down and tested again.
4EAC
POP AF F1
Not enough string space (4EACH), reached from 4E5EH: pop Register Pair AF, the width and the flags pushed at 4E38H, whose Zero Flag the test at 4EB1H reads.
4EAD
POP HL E1
Pop Register Pair HL, the variable's descriptor address pushed at 4E37H.
4EAE
POP BC C1
Pop Register Pair BC, the two lengths pushed at 4E36H.
4EAF
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the expression's descriptor address into Register Pair HL and puts the variable's on the stack.
4EB0
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the expression's descriptor address into Register Pair DE, where the routine at 4641H wants it.
4EB1
Jump to 4EBCH on NZ, the flags that 481AH left saying that the string on the right was not the topmost temporary it could give back, so it stands in the string area already and the collection to come will move it with the rest.
4EB3
PUSH BC C5
Push Register Pair BC, the two lengths, across the two calls below.
4EB4
LD A,B 78
Load Register A with Register B, the length of the string on the right, which is how many bytes the copy of it needs.
4EB5
Call 4641H, which takes that many bytes of string space through 46BDH and writes the length and the address into the three bytes at 7175H, making a descriptor there.
4EB8
Call 467FH, which makes that descriptor the accumulator's string by putting the address into 72ECH and the type 03H into 7142H, so that the second call of 481AH at 4E6AH finds the copy rather than a string the collection has moved.
4EBB
POP BC C1
Pop Register Pair BC, the two lengths, which the push at 4EB3H guarded across the two calls that made the copy.
4EBC
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the variable's descriptor address back into Register Pair HL and puts the expression's on the stack.
4EBD
PUSH BC C5
Push Register Pair BC, the two lengths, so that the stack is as the code at 4E61H expects it.
4EBE
PUSH HL E5
Push Register Pair HL, the variable's descriptor address, for the POP HL at 4E65H.
4EBF
Jump to 4E61H, which takes the width again and calls 46BDH, whose own collection now has room to work in.

4EC2H - INPUT$, EOF, CLOSE's Own Routine, LOC and LOF (4EC2H-4F8CH)

One function and four pieces of the file machinery, and between them they finish the statements of module 1. INPUT$ 4EC2H is the function the term reader jumps to at 7569H for token 0E6H: it reads a count of characters either from the keyboard, one key at a time and with no echo, or from a file, and gives back a string of exactly that length. It is written here with the file statements because the second form is INPUT$(n,#f), and because of the trick it plays with FILEX 6E98H: it puts the file in hand aside on the stack and sets FILEX to 0000H at 4ED4H before it works the count out, so that the expression inside the brackets is evaluated with no file in hand and anything it writes goes to the display, and then puts FILEX back at 4F17H. EOF 4F2DH, LOC 4F71H and LOF 4F74H are three more functions, whose words stand at 68B5H, 68B7H and 68B9H in the function address table; LOC and LOF are two entries in two instructions, the second of them being the operand byte of the first. And 4F52H is the routine that closes one file, which CLOSE pushes the address of at 4D85H and LOAD calls at 4CD3H. Nothing reaches 4F8BH, one byte that would be a POP HL; the byte after it, 4F8CH, is where the character output jumps at 40DCH to write a character to the file in hand, and it falls into SAVE's byte writer at 4F8DH.

4EC2
INPUT$ (4EC2H), which the term reader jumps to at 7569H for token 0E6H: call NXTCHAR at 5E93H, which steps Register Pair HL past the token and brings the character after it back in Register A.
4EC5
Call 4353H, the character demand, which insists that the text pointer stands on the character held in the byte after the call and gives Syntax error through 586CH when it does not.
4EC8
DEFB 24H 24
4EC8H: the dollar sign 4353H demands, the token 0E6H standing for the letters INPUT and the dollar sign being written out in the line. It is data read by the routine the call at 4EC5H reaches, not an instruction, and the instruction after that call is the one at 4EC9H.
4EC9
Call 4353H again, which insists on the character held in the byte after this call.
4ECC
DEFB 28H 28
4ECCH: the opening parenthesis 4353H demands, which every form of this function has. It is data read by the routine the call at 4EC9H reaches, not an instruction, and the instruction after that call is the one at 4ECDH.
4ECD
PUSH HL E5
Push Register Pair HL, the text pointer, which the exchange at 4ED8H swaps for the file in hand.
4ECE
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL with the word at FILEX 6E98H, the control block of the file in hand, which is 0000H when there is none.
4ED1
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the value that says no file is in hand.
4ED4
LD (6E98H),DE ED 53 98 6E
Store Register Pair DE into FILEX 6E98H, which takes the file out of hand for the whole of the evaluation below: a count worked out from an expression that writes anything writes it to the display and not into the file.
4ED8
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the old FILEX on the stack and brings the text pointer back into Register Pair HL.
4ED9
Call 799FH, the single byte argument reader entered with the text pointer on the first character of the expression, which works it out, refuses 256 or more through FUNCERR and brings it back in Register A and in Register Pair DE.
4EDC
PUSH DE D5
Push Register Pair DE, that count as a word, which the exchange at 4EF7H swaps for the text pointer.
4EDD
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the count ended at.
4EDE
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which stands before the file number of the second form.
4EE0
Jump to 4EF1H on NZ, no comma standing there, which is the form that reads from the keyboard: the Zero Flag the comparison left is what 4F06H reads much later.
4EE2
Call NXTCHAR at 5E93H, which steps Register Pair HL past the comma.
4EE5
Call 4A98H, the file lookup, which reads the number sign and the number, gives Bad file number for a number above the count at 6ECEH and comes back with the control block's address in Register Pair BC and its mode in Register A.
4EE8
CP 01H FE 01
Compare Register A with 01H, the mode of a file opened for sequential input, which is the only mode this function will read from.
4EEA
Jump to 5841H on NZ, error 54, Bad file mode: a file opened for output or for random access cannot be read a character at a time this way.
4EED
Call 4A91H, which stores Register Pair BC into FILEX 6E98H, so that the file is in hand again for the reading below while the old FILEX waits on the stack.
4EF0
XOR A AF
Clear Register A to 00H, which sets the Zero Flag that the test at 4F06H reads as meaning that the characters come from a file.
4EF1
PUSH AF F5
The closing parenthesis (4EF1H), which 4EE0H reaches: push Register Pair AF, the Zero Flag that says which of the two forms this is, which 4EF6H takes back.
4EF2
Call 4353H, the character demand, which insists on the character held in the byte after this call.
4EF5
DEFB 29H 29
4EF5H: the closing parenthesis 4353H demands, which ends both forms of the function. It is data read by the routine the call at 4EF2H reaches, not an instruction, and the instruction after that call is the one at 4EF6H.
4EF6
POP AF F1
Pop Register Pair AF, the Zero Flag pushed at 4EF1H.
4EF7
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack and brings the count into Register Pair HL.
4EF8
PUSH AF F5
Push Register Pair AF, that Zero Flag again, which 4F04H takes back once for every character read.
4EF9
LD A,L 7D
Load Register A from Register L, the low byte of the count, which is the whole of it, 799FH having refused anything above 0FFH.
4EFA
OR A B7
Or Register A with itself, which sets the Zero Flag for a count of nothing.
4EFB
Jump to FUNCERR at 5F95H on Z, error 5, Illegal function call: INPUT$(0) is refused where the manual's own table gives the range as 1 to 255.
4EFE
PUSH HL E5
Push Register Pair HL, the count, which 4F03H takes back into Register Pair BC as the number of characters still to read.
4EFF
Call 4641H, the string maker, which takes Register A bytes of string space, builds a descriptor of them at 7175H and returns their address in Register Pair DE.
4F02
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address of that string space into Register Pair HL, where the characters are written.
4F03
POP BC C1
Pop Register Pair BC, the count pushed at 4EFEH, whose low byte in Register C the loop below counts down.
4F04
POP AF F1
The read loop (4F04H), which 4F12H goes back to: pop Register Pair AF, the Zero Flag that says which form this is, pushed at 4EF8H or at 4F05H.
4F05
PUSH AF F5
Push Register Pair AF, that Zero Flag again, so that the next time round the loop finds it where it expects it.
4F06
Jump to 4F25H on Z, the characters coming from a file.
4F08
Call 7CDFH, the key read, which waits for a key through @KEY, supervisor call 1, and brings it back in Register A without writing it anywhere: this is the whole of why INPUT$ shows nothing of what is typed.
4F0B
CP 03H FE 03
Compare Register A with 03H, which is the code BREAK gives.
4F0D
Jump to 4F1EH on Z, BREAK having been pressed, which stops the program where it stands.
4F0F
LD (HL),A 77
The character stored (4F0FH), which 4F2BH reaches: store Register A into the byte Register Pair HL addresses, its place in the string space.
4F10
INC HL 23
Increment Register Pair HL to the next place in it.
4F11
DEC C 0D
Decrement Register C, one character fewer to read.
4F12
Jump to 4F04H on NZ, the count not being used up, which reads the next character.
4F14
POP AF F1
Pop Register Pair AF, the Zero Flag pushed at 4F05H, which nothing reads again.
4F15
POP BC C1
Pop Register Pair BC, the text pointer 4EF7H left on the stack.
4F16
POP HL E1
Pop Register Pair HL, the FILEX 4ECEH read and 4ED8H left on the stack.
4F17
LD (6E98H),HL 22 98 6E
Store Register Pair HL into FILEX 6E98H, which puts the file in hand back as it was before the brackets were read.
4F1A
PUSH BC C5
Push Register Pair BC, the text pointer, which is where 467FH's own POP HL below takes it from.
4F1B
Jump to 467FH, the temporary allocation, which puts the descriptor at 7175H into the temporary string table and ends with a POP HL that takes the text pointer off the stack: this function builds no descriptor of its own.
4F1E
LD HL,(718EH) 2A 8E 71
BREAK (4F1EH), which 4F0DH reaches: load Register Pair HL with the word at 718EH, the cell that says where the stack stands.
4F21
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which throws away every frame this function and every statement under it had built.
4F22
Jump to 439AH, the entry that stops without closing a file or saving a line number for CONT: a BREAK in an INPUT$ ends the program and there is no CONT from it.
4F25
A character out of the file (4F25H), which 4F06H reaches: call 5064H, the byte reader, which takes one byte of the file in hand through @GET, supervisor call 3, and sets the Carry Flag at the end of the file.
4F28
Jump to 584DH on C, error 62, Input past end: a file that runs out before the count is used up is an error and not a short string.
4F2B
Jump to 4F0FH, which stores that character and counts it.
4F2D
EOF (4F2DH), the function whose word the table at 685DH holds at 68B5H: call 4AA4H, which reads the file number after the function's own parenthesis and comes back with the control block's address in Register Pair BC and its mode in Register A.
4F30
CP 02H FE 02
Compare Register A with 02H, the mode of a file opened for sequential output.
4F32
Jump to 5841H on Z, error 54, Bad file mode: a file being written to has no end to have been reached.
4F35
LD HL,000FH 21 0F 00
Load Register Pair HL with 000FH, the distance from the control block's own first byte to the high byte of the ending record number, the file control block proper beginning two bytes into the block.
4F38
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which makes Register Pair HL the address of that byte.
4F39
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the high byte of the ending record number.
4F3A
DEC HL 2B
Decrement Register Pair HL to the low byte of the ending record number.
4F3B
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, that low byte, which 4F41H reads back.
4F3C
DEC HL 2B
Decrement Register Pair HL to the high byte of the next record number.
4F3D
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, which sets the Zero Flag when the two high bytes agree.
4F3E
Jump to 4F4CH on NZ, the two record numbers lying in different hundreds and the end of the file not being the record in hand: Register A is left holding the ending record number's own high byte, and the test below gives the answer no for any value but 00H, which is right because a 00H there can only mean that the next record number stands above the ending one.
4F40
DEC HL 2B
Decrement Register Pair HL to the low byte of the next record number.
4F41
LD A,E 7B
Load Register A from Register E, the ending record number's low byte.
4F42
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, which sets the Zero Flag when the two low bytes agree as well.
4F43
Jump to 4F4CH on NZ, the two record numbers differing, with Register A holding the ending record number's low byte for the same reason.
4F45
DEC HL 2B
Decrement Register Pair HL to the logical record length.
4F46
DEC HL 2B
Decrement Register Pair HL to the offset of the end of file within its last record.
4F47
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that offset.
4F48
DEC HL 2B
Decrement Register Pair HL to the drive the file is on.
4F49
DEC HL 2B
Decrement Register Pair HL to the second byte of the buffer address.
4F4A
DEC HL 2B
Decrement Register Pair HL to the offset the file has been read to within the record in hand.
4F4B
SUB (HL) 96
Subtract the byte Register Pair HL addresses from Register A, which leaves 00H only when the reading has reached the end of file offset exactly.
4F4C
SUB 01H D6 01
The answer (4F4CH), which 4F3EH and 4F43H reach: subtract 01H from Register A, which sets the Carry Flag only when Register A held 00H.
4F4E
SBC A,A 9F
Subtract Register A from Register A with the Carry Flag, which leaves 0FFH when that flag was set and 00H when it was clear, so that the answer is minus one for the end of the file and nothing for anywhere else.
4F4F
Jump to 28FEH of BASIC/OV1, which puts Register A into the accumulator as a signed integer, which is how every function of this interpreter gives a true or false answer.
4F52
One file closed (4F52H), which CLOSE loads into Register Pair BC at 4D85H and returns to, and which LOAD calls at 4CD3H: call 4AA7H, the lookup with the file number already in Register A, which comes back with the control block's address in Register Pair BC, its mode in Register A and the Zero Flag set when the file is not open at all.
4F55
RET Z C8
Return on Z, the file not being open: closing a file that was never opened is not an error.
4F56
CP 01H FE 01
Compare Register A with 01H, the mode of a file opened for sequential input, which has nothing to write out.
4F58
Jump to 4F68H on Z, the file being an input one, which only clears the block.
4F5A
PUSH BC C5
Push Register Pair BC, the control block's address, which 4F67H takes back.
4F5B
XOR A AF
Clear Register A to 00H, the byte that marks the end of what has been written.
4F5C
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, the mode byte, which says at once that the file is no longer open.
4F5D
INC BC 03
Increment Register Pair BC past that mode byte, the first of the two that stand in front of the file control block.
4F5E
INC BC 03
Increment Register Pair BC again, which brings it to the file control block proper, two bytes into the block.
4F5F
LD D,B 50
Load Register D from Register B, the high byte of that address.
4F60
LD E,C 59
Load Register E from Register C, its low byte, so that Register Pair DE is what the supervisor call below wants.
4F61
LD A,3CH 3E 3C
Load Register A with 3CH, 60, the number of @CLOSE, the supervisor call that writes the last record out and brings the directory entry up to date.
4F63
RST 28H EF
Call the supervisor through RST 28H with Register A holding that number and Register Pair DE the file control block, which closes the file.
4F64
Jump to DERR at 5282H on NZ, the system having refused the close, which turns its own code into one of BASIC's errors.
4F67
POP BC C1
Pop Register Pair BC, the control block's address, pushed at 4F5AH.
4F68
LD D,34H 16 34
The block cleared (4F68H), which 4F58H reaches: load Register D with 34H, 52, the number of bytes of the block that are cleared, which reaches from its mode byte to the start of its record buffer.
4F6A
XOR A AF
Clear Register A to 00H, the byte every one of them is given.
4F6B
LD (BC),A 02
The clearing loop (4F6BH), which 4F6EH goes back to: store Register A into the byte Register Pair BC addresses.
4F6C
INC BC 03
Increment Register Pair BC to the next byte of the block.
4F6D
DEC D 15
Decrement Register D, one byte fewer to clear.
4F6E
Jump to 4F6BH on NZ, the count not being used up: the record buffer at 34H bytes in is left as it stands, which is why a FIELD string still reads after a CLOSE.
4F70
RET C9
Return with the file closed and its control block cleared.
4F71
LD A,3FH 3E 3F
LOC (4F71H), the function whose word the table at 685DH holds at 68B7H: load Register A with 3FH, 63, the number of @LOC, the supervisor call that gives the number of the record last read or written.
4F73
LD BC,403EH 01 3E 40
Load Register Pair BC with 403EH, a value nothing reads: its operand bytes at 4F74H and 4F75H are LOF's own entry, which as an instruction is LD A,40H.
4F76
PUSH AF F5
Both functions (4F76H): push Register Pair AF, the supervisor call number, which 4F81H takes back once the file has been found.
4F77
Call 4AA4H, which reads the file number and comes back with the control block's address in Register Pair BC, its mode in Register A and the Zero Flag set when the file is not open.
4F7A
Jump to 5847H on Z, error 52, Bad file number: neither of these two functions will answer for a file that is not open.
4F7D
INC BC 03
Increment Register Pair BC past the mode byte of the block.
4F7E
INC BC 03
Increment Register Pair BC again, which brings it to the file control block proper.
4F7F
LD D,B 50
Load Register D from Register B, the high byte of that address.
4F80
LD E,C 59
Load Register E from Register C, its low byte, so that Register Pair DE is what the supervisor call wants.
4F81
POP AF F1
Pop Register Pair AF, the supervisor call number pushed at 4F76H, which is 3FH for LOC and 40H for LOF.
4F82
RST 28H EF
Call the supervisor through RST 28H with Register A holding that number and Register Pair DE the file control block, which gives the record number back in Register Pair BC.
4F83
Jump to DERR at 5282H on NZ, the system having refused, which turns its code into one of BASIC's errors.
4F86
LD H,B 60
Load Register H from Register B, the high byte of the record number the system gave.
4F87
LD L,C 69
Load Register L from Register C, its low byte, so that Register Pair HL holds it.
4F88
Jump to 2A53H of BASIC/OV1, which stores Register Pair HL into the accumulator at 72ECH and puts 02H into 7142H, so that the answer is an integer: a record number above 32767 therefore comes out negative.
4F8B
DEFB 0E1H E1
4F8BH: one byte reached by nothing. As an instruction it is a POP HL, and with the POP AF after it the two would have been an entry that takes back a pointer as well as the character. No instruction of the three files branches here, no relative jump reaches it and no word anywhere in the three images holds its address; the character output enters at 4F8CH instead and keeps Register Pair HL for itself.
4F8C
POP AF F1
The character written to the file in hand (4F8CH), which the one character output jumps to at 40DCH: pop Register Pair AF, the character 40D8H pushed, and fall into SAVE's byte writer at 4F8DH, which writes Register A to the file through @PUT, supervisor call 4.

4F8DH - SAVE's Byte Writer, and What It Settles about FASTSAV (4F8DH-4FC5H)

This writes one byte to the file in hand through @PUT, SVC 4, and keeps a column count while it does it. Only SAVE calls it, from 4D6CH for the marker byte that begins a tokenized program and from 4D7FH inside the byte at a time loop that the enhancement package orphans, so in the release it is reached exactly once in a save, for the marker. It gives every register back: Register Pair HL, Register Pair DE and Register Pair BC are pushed and popped in the ordinary way, and Register A is guarded twice over, at 4F8EH across the mode test and at 4FADH across the system call, with the POP AF at 4FB7H standing immediately before the three register pops and the return. The one path that leaves by another door, the JP Z,4470H at 4F95H, is no exception: the three bytes at 4470H are a POP AF and a POP HL and a return, which undo this routine's first two pushes and hand Register A back as well. **That settles the question pass 32 left open.** FASTSAV writes whatever Register A holds as the file's type byte at 8307H, and the first module loads 0FFH at 4D6AH and then calls here before the patch at 4D76H is reached: because Register A comes back holding the byte that was written, the marker is still in Register A at 4D76H, and FASTSAV writes 0FFH for a plain program. The protected form settles the same way, 5765H loading 0FEH and entering at 4D6CH, so FASTSAV writes 0FEH for it. The column count is kept in the byte at the control block plus one: a carriage return sets it to 00H, a character of 20H or more adds one to it, and a control character below 20H leaves it alone, the test being the ADD A,0E0H at 4FA5H, which carries for 20H and above. An error from the system call is reported only when bit 7 of the file control block's first byte says the file is open, which is the bit the Part 13 notes record as the open flag.

4F8D
PUSH HL E5
SAVE's byte writer (4F8DH): push Register Pair HL, the caller's pointer, which the POP HL at 4FBAH gives back and which the exit at 4470H gives back as well.
4F8E
PUSH AF F5
Push Register Pair AF, the byte to be written in Register A, across the mode test below, which reads the control block into Register A.
4F8F
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL from the word at 6E98H, FILEX, the control block of the file in hand, whose first byte is its mode and whose third byte begins the file control block the system calls want.
4F92
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that mode byte.
4F93
CP 01H FE 01
Compare Register A with 01H, the input mode, in which nothing may be written.
4F95
Jump to 4470H on Z, the file in hand being open for input: those three bytes pop Register Pair AF and Register Pair HL and return, so the byte is dropped without a word and the caller gets its registers back.
4F98
POP AF F1
Pop Register Pair AF, which brings the byte to be written back into Register A.
4F99
PUSH DE D5
Push Register Pair DE, the caller's, which this routine uses for the file control block address.
4F9A
PUSH BC C5
Push Register Pair BC, the caller's, which this routine uses to carry the byte to the system call.
4F9B
INC HL 23
Increment Register Pair HL to the control block plus one, the byte that holds the column count.
4F9C
LD B,00H 06 00
Load Register B with 00H, which is the count a carriage return leaves behind and the zero the addition below adds the carry to.
4F9E
PUSH AF F5
Push Register Pair AF, the byte to be written in Register A, across the counting below, which does its arithmetic in Register A.
4F9F
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, the column count as it stands.
4FA0
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return, which ends a line and so sets the count back to the beginning.
4FA2
LD (HL),B 70
Store Register B, 00H, into the byte Register Pair HL addresses, which clears the count before it is decided whether anything is to be added back.
4FA3
Jump to 4FAAH on Z, the byte being a carriage return, which leaves the count at the 00H just stored.
4FA5
ADD A,0E0H C6 E0
Add 0E0H to Register A, the byte being written, which sets the Carry Flag for 20H and above and leaves it clear for a control character below it: this is how a printable character is told from one that takes up no column.
4FA7
LD A,D 7A
Load Register A with Register D, the column count as it was before the store above.
4FA8
ADC A,B 88
Add Register B, 00H, to Register A with the carry, which adds one for a printable character and nothing for a control character.
4FA9
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the column count brought up to date.
4FAA
INC HL 23
Increment Register Pair HL to the control block plus two, which is the file control block the system calls take.
4FAB
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE where the system call wants it.
4FAC
POP AF F1
Pop Register Pair AF, which brings the byte to be written back into Register A, the counting having used Register A for itself.
4FAD
PUSH AF F5
Push Register Pair AF again, the byte in Register A, and this is the push the POP AF at 4FB7H takes, which is why the caller gets the byte back in Register A.
4FAE
LD C,A 4F
Load Register C with Register A, the byte to be written, which is where @PUT takes it from.
4FAF
PUSH DE D5
Push Register Pair DE, the file control block address, across the system call, which does not keep it.
4FB0
LD A,04H 3E 04
Load Register A with 04H, the number of @PUT, the call that writes one byte to a file.
4FB2
RST 28H EF
Call the system through RST 28H, which writes the byte in Register C to the file whose control block Register Pair DE addresses.
4FB3
POP DE D1
Pop Register Pair DE, the file control block address, which the error path below reads the open flag through.
4FB4
Jump to 4FBCH on NZ, the system call having failed, so that it is decided whether the failure is worth reporting.
4FB7
POP AF F1
The ordinary ending (4FB7H): pop Register Pair AF, which hands the byte that was written back to the caller in Register A, and that is what keeps the marker in Register A as far as the patch at 4D76H.
4FB8
POP BC C1
Pop Register Pair BC, the caller's, pushed at 4F9AH.
4FB9
POP DE D1
Pop Register Pair DE, the caller's, pushed at 4F99H.
4FBA
POP HL E1
Pop Register Pair HL, the caller's pointer, pushed at 4F8DH.
4FBB
RET C9
Return to the caller with every register as it was and the byte still in Register A.
4FBC
LD C,A 4F
The failed call (4FBCH): load Register C with Register A, the code the system gave back, so that Register A can be used for the test below.
4FBD
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the first byte of the file control block, whose bit 7 is the open flag.
4FBE
OR A B7
OR Register A with itself, which sets the Sign Flag from that bit 7.
4FBF
LD A,C 79
Load Register A with Register C, the system's code, which the handler below wants in Register A.
4FC0
Jump to 5282H on M, bit 7 having been set and the file being open: 5282H keeps the system's code at 7C4EH and turns it into the BASIC error the handler prints.
4FC3
Jump to 4FB7H, the file not being open, so that a failure on a file nothing opened is dropped and the caller is given its registers back as though the byte had gone out.

4FC6H - PUT and GET: Write or Read One Record of a Random File (4FC6H-5063H)

PUT writes the record buffer of a random file out to the diskette and GET reads a record into it, and the two share every instruction. PUT enters at 4FC6H, whose OR 0AFH leaves Register A not zero; GET enters at 4FC7H, which is the operand byte 0AFH of that instruction and as an instruction of its own is XOR A, so it leaves Register A at 00H. The byte is put away at 6EAAH and the three places that have to know which statement is running read it there: 5021H after a position that failed, 5045H to choose between the read call and the write, and nothing else. This is the sixth place in this file where one entry point stands inside the instruction of another. The record number is optional, and whether it was given is remembered in the strangest way this routine has: the operand byte of the LD A,00H at 500CH is itself written, cleared to 00H at 4FCCH before the line is read and set to 0FFH at 4FE9H when no comma was found, so the test at 500EH reads a flag that lives inside the instruction stream. With a record number the system is asked to position to it with @POSN, SVC 42H; without one the position is skipped and the record after the last one touched is used, which is what the word at the control block plus 000CH held and 4FE0H stepped on. The three system calls do all the work: @POSN, then @READ, SVC 43H, for GET or @WRITE, SVC 4BH, for PUT, each given the file control block plus two in Register Pair DE and the buffer at the control block plus 0034H in Register Pair HL. Two failures are not failures: a position that gives error 1CH or 1DH is let through, and for GET it means the record is past the end of the file, which 5054H answers by filling the whole 256 byte buffer with zeros and returning rather than giving an error at all. PUT alone tests the write protect byte of its drive first, from the eight byte table at 7C4FH that 51BBH fills, and gives error 68, Disk write protected, when bit 0 of it is set.

4FC6
OR 0AFH F6 AF
PUT (4FC6H), the routine the statement address table holds for token 0C2H at 6845H: OR Register A with 0AFH, which is done for the value it leaves and not for the flags, since any value but 00H means a write; the byte 0AFH it ORs with is GET's entry point one address on.
4FC8
LD (6EAAH),A 32 AA 6E
Store Register A into the byte at 6EAAH, the flag that says which of the two statements is running: not 00H for PUT and 00H for GET, read at 5021H and at 5045H and nowhere else.
4FCB
XOR A AF
Clear Register A with exclusive OR, the 00H that marks a record number as given, which the store below plants in the instruction at 500CH.
4FCC
LD (500DH),A 32 0D 50
Store Register A into the byte at 500DH, which is the operand of the LD A,00H at 500CH: the flag for whether a record number was given is kept inside that instruction, and this clears it before the line is looked at.
4FCF
Call 4A98H, which reads the file number after an optional number sign, returns the address of that file's control block in Register Pair BC and its mode byte in Register A, and gives error 52, Bad file number, through 5847H for a file that is not open.
4FD2
CP 03H FE 03
Compare Register A with 03H, the random mode, the only mode in which a record may be written or read whole.
4FD4
Jump to 5841H on NZ, the file being open in some other mode: that entry loads Register E with 36H and the handler prints error 54, Bad file mode.
4FD7
PUSH BC C5
Push Register Pair BC, the control block address, which the exchange at 4FFBH takes back off the stack once the line has been read.
4FD8
PUSH HL E5
Push Register Pair HL, the text pointer, across the reading of the last record number below.
4FD9
LD HL,000CH 21 0C 00
Load Register Pair HL with 000CH, the offset of the word inside the control block that holds the number of the record last touched.
4FDC
ADD HL,BC 09
Add Register Pair BC, the control block address, to Register Pair HL, so that Register Pair HL addresses that word.
4FDD
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of that record number.
4FDE
INC HL 23
Increment Register Pair HL to the high byte of the word.
4FDF
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the number of the record last touched.
4FE0
INC DE 13
Increment Register Pair DE to the record after it, which is the one a PUT or a GET with no record number works on.
4FE1
POP HL E1
Pop Register Pair HL, the text pointer, which is where a comma and a record number may stand.
4FE2
LD A,(HL) 7E
Load Register A with the character of the line that Register Pair HL addresses.
4FE3
CP 2CH FE 2C
Compare Register A with 2CH, the comma that stands before a record number.
4FE5
Jump to 4FECH on Z, a comma having been found, so that the flag inside 500CH is left at the 00H which says a record number was given.
4FE7
LD A,0FFH 3E FF
Load Register A with 0FFH, the value that says no record number was given, no comma having been found.
4FE9
LD (500DH),A 32 0D 50
Store Register A into the byte at 500DH, the operand of the LD A,00H at 500CH, which makes the test at 500EH skip the position and use the record number worked out at 4FE0H.
4FEC
Jump to 4FF4H on NZ, the flags still being those of the comparison at 4FE3H because neither instruction between touches them: with no comma there is no expression to work out.
4FEE
Call 7FABH, which steps past the comma with NXTCHAR, works the record number out through the evaluator at 7345H and returns it in Register Pair DE, setting the Carry Flag for a number it will not take.
4FF1
Jump to 5856H on C, the record number being out of range: that entry loads Register E with 3FH and the handler prints error 63, Bad record number.
4FF4
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the pointer already stands on rather than the one beyond it.
4FF5
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended there.
4FF8
Jump to SYNERR at 586CH on NZ: nothing may stand after the record number, so anything still on the line is Syntax error.
4FFB
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the control block address into Register Pair HL and leaves the text pointer on the stack for the POP HL at 5052H or at 5062H.
4FFC
PUSH HL E5
Push Register Pair HL, the control block address, which the POP BC at 5051H brings back as the routine ends.
4FFD
LD A,E 7B
Load Register A with Register E, the low byte of the record number.
4FFE
OR D B2
OR Register A with Register D, the high byte, so that the Zero Flag is set only when the record number is 0000H.
4FFF
Jump to 5856H on Z, the record number being 0000H: records are counted from one, so error 63, Bad record number, is given. A file whose last record is 0FFFFH reaches this as well, the increment at 4FE0H having wrapped.
5002
DEC DE 1B
Decrement Register Pair DE back to the record number itself, the system calls counting records from zero where the statement counts from one.
5003
LD B,D 42
Load Register B with Register D, the high byte of that number.
5004
LD C,E 4B
Load Register C with Register E, the low byte, so that Register Pair BC holds the record number the way @POSN wants it.
5005
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the control block address into Register Pair DE and the record number into Register Pair HL, where it is not read again.
5006
INC DE 13
Increment Register Pair DE to the control block plus one.
5007
INC DE 13
Increment Register Pair DE again, to the control block plus two, which is the address every one of the system calls below wants as the file control block.
5008
LD HL,0032H 21 32 00
Load Register Pair HL with 0032H, which is the offset of the record buffer counted from the control block plus two rather than from the control block itself.
500B
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which makes Register Pair HL the address of the record buffer, the same place FIELD lays its fields out at the control block plus 0034H.
500C
LD A,00H 3E 00
Load Register A with the byte at 500DH, which is this instruction's own operand and holds 00H when a record number was given and 0FFH when none was: the two stores at 4FCCH and 4FE9H are what put it there.
500E
OR A B7
OR Register A with itself, which sets the Zero Flag when a record number was given.
500F
Jump to 5045H on NZ, no record number having been given, so that the position is skipped and the record worked out at 4FE0H is used where the file stands.
5011
PUSH HL E5
Push Register Pair HL, the buffer address, across the system call below, which does not keep it.
5012
LD A,42H 3E 42
Load Register A with 42H, the number of @POSN, the call that positions the file at a record.
5014
RST 28H EF
Call the system through RST 28H, which positions the file whose control block Register Pair DE addresses at the record Register Pair BC holds.
5015
POP HL E1
Pop Register Pair HL, the buffer address, which the read and the write below both want.
5016
Jump to 5045H on Z, the position having succeeded, so that the record is read or written.
5018
CP 1CH FE 1C
Compare Register A with 1CH, the first of the two position errors that are let through rather than reported.
501A
Jump to 5021H on Z, that error standing: for PUT the record is past the end and the file is to be extended, and for GET there is nothing there to read.
501C
CP 1DH FE 1D
Compare Register A with 1DH, the second of the two errors that are let through.
501E
Jump to 5282H on NZ, the error being neither of them: 5282H keeps the system's own code at 7C4EH and turns it into the BASIC error the handler prints.
5021
LD A,(6EAAH) 3A AA 6E
A position past the end of the file (5021H): load Register A from the byte at 6EAAH, the flag that says which statement is running.
5024
OR A B7
OR Register A with itself, which sets the Zero Flag for GET and clears it for PUT.
5025
Jump to 5054H on Z, the statement being GET: there is no record there to read, and rather than give an error the buffer is filled with zeros.
5027
PUSH HL E5
The write protect test (5027H), which only PUT reaches: push Register Pair HL, the buffer address, across the test.
5028
PUSH BC C5
Push Register Pair BC, the record number, across the test as well.
5029
LD HL,0006H 21 06 00
Load Register Pair HL with 0006H, the offset of the byte that holds the drive, counted from the control block plus two that Register Pair DE holds.
502C
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, so that Register Pair HL addresses that byte.
502D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which carries the drive in its low bits.
502E
AND 07H E6 07
AND Register A with 07H, which leaves the drive number alone, nought to seven, and is what makes the table below eight bytes long.
5030
LD C,A 4F
Load Register C with Register A, that drive number.
5031
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC holds the drive number as a sixteen bit offset.
5033
LD HL,7C4FH 21 4F 7C
Load Register Pair HL with 7C4FH, the first of the eight bytes that hold what BASIC knows about each drive, one per drive, which 51BBH fills and this is the only other place that reads.
5036
ADD HL,BC 09
Add Register Pair BC, the drive number, to Register Pair HL, so that Register Pair HL addresses this drive's byte.
5037
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses.
5038
AND 01H E6 01
AND Register A with 01H, which leaves bit 0, the bit that is set for a drive whose diskette is write protected.
503A
Jump to 5862H on NZ, the diskette being write protected: that entry loads Register E with 44H and the handler prints the forty ninth text of the block at 6B7CH, Disk write protected.
503D
POP BC C1
Pop Register Pair BC, the record number, the drive being one that may be written.
503E
POP HL E1
Pop Register Pair HL, the buffer address, which the write below takes its bytes from.
503F
LD A,4BH 3E 4B
Load Register A with 4BH, the number of @WRITE, the call that writes one record.
5041
RST 28H EF
Call the system through RST 28H, which writes the buffer Register Pair HL addresses to the file whose control block Register Pair DE addresses.
5042
Jump to 504EH, the common ending, where the result of the call is weighed.
5045
LD A,(6EAAH) 3A AA 6E
The read or write where the file stands (5045H), reached when no record number was given and when the position succeeded: load Register A from the byte at 6EAAH, the flag that says which statement is running.
5048
OR A B7
OR Register A with itself, which sets the Zero Flag for GET and clears it for PUT.
5049
Jump back to 5027H on NZ, the statement being PUT, so that the write protect byte of the drive is tested before anything is written.
504B
LD A,43H 3E 43
Load Register A with 43H, the number of @READ, the call that reads one record.
504D
RST 28H EF
Call the system through RST 28H, which reads a record of the file whose control block Register Pair DE addresses into the buffer Register Pair HL addresses.
504E
Jump to 5282H on NZ, the read or the write having failed: 5282H keeps the system's code at 7C4EH and turns it into the BASIC error the handler prints.
5051
POP BC C1
Pop Register Pair BC, the control block address pushed at 4FFCH, which is not read again.
5052
POP HL E1
Pop Register Pair HL, the text pointer that the exchange at 4FFBH left on the stack.
5053
RET C9
Return to 5E3BH, the statement loop, the record having been written or read.
5054
POP HL E1
A GET of a record past the end of the file (5054H): pop Register Pair HL, the control block address pushed at 4FFCH, which this path uses to find the buffer instead of trusting the pointer the position left.
5055
LD DE,0034H 11 34 00
Load Register Pair DE with 0034H, the offset of the record buffer inside the control block.
5058
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, so that Register Pair HL addresses the first byte of the buffer.
5059
LD B,00H 06 00
Load Register B with 00H, which stands for 256 in the loop below, because the count is taken down before it is tested.
505B
XOR A AF
Clear Register A with exclusive OR, the 00H that every byte of the buffer is about to be set to.
505C
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, which clears one byte of the buffer.
505D
INC HL 23
Increment Register Pair HL to the next byte of the buffer.
505E
DEC B 05
Decrement Register B, the count, which reaches 00H after 256 turns because it started there.
505F
Jump back to 505CH on NZ, there being bytes of the buffer still to clear.
5062
POP HL E1
Pop Register Pair HL, the text pointer that the exchange at 4FFBH left on the stack.
5063
RET C9
Return to 5E3BH, the statement loop, with a buffer of zeros and no error reported: a GET past the end of the file is quiet about it, and the fields the program reads come out as strings of 00H bytes.

5064H - The Byte Reader of the File in Hand (5064H-508BH)

This reads one byte of the file in hand through @GET, SVC 3, and is the routine every piece of BASIC that takes characters from a file goes through: ten places call it, among them LOAD at 4C6DH, MERGE at 4CF3H and the keyboard input code that reads a merged program's lines as though they were typed. It answers in the Carry Flag, clear for a byte read and set for the end of the file, and the two answers are given by a pair of instructions that stand inside one another. The fall through from the SCF at 5085H reaches the LD B,0B7H at 5086H, whose operand byte 0B7H is the address 5087H that the JR Z at 5070H jumps to, and as an instruction that byte is OR A, which clears the Carry Flag. The LD B does nothing else: the POP BC at 508AH throws Register B away three instructions later, so the instruction is there to carry its own operand and for no other reason. That makes it the seventh place in this file where one entry point stands inside another instruction. Neither the LD B nor any of the three pops touches a flag, so the Carry Flag the two paths set survives to the return. A call that comes back with Register A at 00H and the Zero Flag clear is neither a byte nor the end of the file: the file is not ready, and 7CD5H is called to see whether the user has pressed BREAK before the read is tried again, which is what keeps a program interruptible while it waits on a device.

5064
PUSH BC C5
The byte reader (5064H): push Register Pair BC, the caller's, which the POP BC at 508AH gives back.
5065
PUSH HL E5
Push Register Pair HL, the caller's, which the POP HL at 5089H gives back.
5066
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL from the word at 6E98H, FILEX, the control block of the file in hand, whose third byte begins the file control block the system call wants.
5069
PUSH DE D5
Push Register Pair DE, the caller's, which the POP DE at 5088H gives back.
506A
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the control block address into Register Pair DE.
506B
INC DE 13
Increment Register Pair DE to the control block plus one.
506C
INC DE 13
Increment Register Pair DE again, to the control block plus two, which is the file control block the system call takes.
506D
LD A,03H 3E 03
Load Register A with 03H, the number of @GET, the call that reads one byte of a file.
506F
RST 28H EF
Call the system through RST 28H, which reads a byte of the file whose control block Register Pair DE addresses and brings it back in Register A.
5070
Jump to 5087H on Z, a byte having been read: that address is the operand byte of the instruction below it and as an instruction is an OR A, which clears the Carry Flag to say so.
5072
OR A B7
OR Register A with itself, the call not having succeeded, which sets the Zero Flag when Register A holds no code at all.
5073
Jump to 507CH on NZ, the system having given a code, so that it is decided whether the code means the end of the file.
5076
Call 7CD5H, there being no code and so nothing wrong but the file not being ready: it tests bits 0 and 1 of the keyboard flag the word at 7C6BH points at through 7CFEH, returns when neither is set, and otherwise clears Register A and jumps to STOP at 437FH, which is how a program waiting on a device can still be broken into.
5079
Jump back to 506DH, where the read is asked for again.
507C
CP 1CH FE 1C
Compare Register A with 1CH, the first of the two codes that mean the file has no more bytes.
507E
Jump to 5085H on Z, that code standing, so that the end of the file is reported in the Carry Flag.
5080
CP 1DH FE 1D
Compare Register A with 1DH, the second of the two codes that mean the end of the file.
5082
Jump to 5282H on NZ, the code being neither of them: 5282H keeps the system's code at 7C4EH and turns it into the BASIC error the handler prints.
5085
SCF 37
Set the Carry Flag, which is how the end of the file is reported to the caller, and fall into the instruction below whose operand byte is the other answer.
5086
LD B,0B7H 06 B7
Load Register B with 0B7H, which is done for the operand byte and not for the value: 0B7H is the byte the JR Z at 5070H lands on as an instruction, and the POP BC at 508AH throws Register B away, so nothing reads what this stores.
5088
POP DE D1
Pop Register Pair DE, the caller's, pushed at 5069H, which leaves the Carry Flag as it was.
5089
POP HL E1
Pop Register Pair HL, the caller's, pushed at 5065H.
508A
POP BC C1
Pop Register Pair BC, the caller's, pushed at 5064H, which is also what makes the store at 5086H come to nothing.
508B
RET C9
Return to the caller with the byte in Register A and the Carry Flag clear, or with the Carry Flag set and nothing read.

508CH - Take a Filespec off the Line and Hand It to @FSPEC (508CH-50CFH)

This works a filespec expression out, folds it to upper case into the twenty byte area at 7C2EH, and asks the system to parse it into the file control block its caller names. Four statements go through it: the open at 5125H, which is where SAVE, LOAD, MERGE and OPEN all end up, KILL at 5222H, and NAME at 7FCDH and 7FDBH for both of its names. The caller passes the control block address in Register Pair BC and gets it back there, with the text pointer in Register Pair HL, and the route by which that happens is worth seeing: the caller's Register Pair BC is pushed at 508CH and popped into Register Pair DE at 50B9H, which is the pair @FSPEC wants the control block in, and 50BAH and 50BBH copy it back into Register Pair BC so that both pairs hold it at once. A filespec of no characters and one of 21H characters or more are both refused with error 64, Bad file name, before anything is copied, which is the only length check any of the four statements gets. The fold is the plain one, 61H to 7AH exclusive ORed with 20H, so a name typed in lower case reaches the directory in upper case; and the 00H that 50B7H writes after the last character is written out of Register E, which the loop has just counted down to nought.

508C
PUSH BC C5
The filespec reader (508CH): push Register Pair BC, the control block address the caller named, which comes back as Register Pair DE at 50B9H for the system call.
508D
Call 7345H, the expression evaluator, which works the filespec expression out and leaves the text pointer in Register Pair HL standing after it.
5090
PUSH HL E5
Push Register Pair HL, that text pointer, which the POP HL at 50B8H gives back to the caller.
5091
Call 481AH, which insists through 2AB0H that the value is a string, giving Type mismatch through 5884H when it is not, and brings the address of its descriptor into Register Pair HL out of the accumulator at 72ECH.
5094
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the filespec.
5095
OR A B7
OR Register A with itself, which sets the Zero Flag for a filespec of no characters at all.
5096
Jump to 5853H on Z, the filespec being empty: that entry loads Register E with 40H and the handler prints the forty fifth text of the block at 6B7CH, Bad file name.
5099
CP 21H FE 21
Compare Register A with 21H, one more than the longest filespec the area at 7C2EH is to hold.
509B
Jump to 5853H on NC, the filespec being 21H characters or longer, which is the same error 64, Bad file name. This is the only length check the four statements that come here are given.
509E
INC HL 23
Increment Register Pair HL to the second byte of the descriptor, where the address of the characters begins.
509F
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of that address.
50A0
INC HL 23
Increment Register Pair HL to the third byte of the descriptor.
50A1
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC addresses the characters of the filespec.
50A2
LD HL,7C2EH 21 2E 7C
Load Register Pair HL with 7C2EH, the first byte of the area the folded filespec is built in and that the system call below is handed.
50A5
LD E,A 5F
Load Register E with Register A, the length, which is the count the loop below works down and the 00H that 50B7H writes when it reaches nought.
50A6
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, the next character of the filespec.
50A7
CP 61H FE 61
Compare Register A with 61H, the letter a, the first character the fold applies to.
50A9
Jump to 50B1H on C, the character standing below the letter a and so needing no fold.
50AB
CP 7BH FE 7B
Compare Register A with 7BH, one past the letter z, the last character the fold applies to.
50AD
Jump to 50B1H on NC, the character standing above the letter z and so needing no fold.
50AF
XOR 20H EE 20
Exclusive OR Register A with 20H, which turns a lower case letter into the upper case one, the two differing in that bit alone.
50B1
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the next byte of the area at 7C2EH.
50B2
INC HL 23
Increment Register Pair HL to the next byte of that area.
50B3
INC BC 03
Increment Register Pair BC to the next character of the filespec.
50B4
DEC E 1D
Decrement Register E, the count of characters still to copy.
50B5
Jump back to 50A6H on NZ, there being characters of the filespec still to fold and copy.
50B7
LD (HL),E 73
Store Register E into the byte Register Pair HL addresses, which is a 00H because the loop has just counted Register E down to nought: that is the byte @FSPEC takes as the end of the text.
50B8
POP HL E1
Pop Register Pair HL, the text pointer pushed at 5090H, which the caller gets back.
50B9
POP DE D1
Pop Register Pair DE, which is the control block address the caller named and the push at 508CH put on the stack, now in the pair the system call wants it in.
50BA
LD B,D 42
Load Register B with Register D, the high byte of the control block address.
50BB
LD C,E 4B
Load Register C with Register E, the low byte, so that Register Pair BC holds it again for the caller.
50BC
PUSH BC C5
Push Register Pair BC, the control block address, which the POP BC at 50CEH gives back to the caller.
50BD
PUSH HL E5
Push Register Pair HL, the text pointer, which the POP HL at 50CDH gives back.
50BE
LD HL,7C2EH 21 2E 7C
Load Register Pair HL with 7C2EH again, the folded filespec, which is what the system call reads its text from.
50C1
INC DE 13
Increment Register Pair DE to the control block plus one.
50C2
INC DE 13
Increment Register Pair DE again, to the control block plus two, the file control block @FSPEC is to write.
50C3
LD A,4EH 3E 4E
Load Register A with 4EH, the number of @FSPEC, the call that parses a filespec into a file control block.
50C5
RST 28H EF
Call the system through RST 28H, which reads the text at Register Pair HL and builds the file control block Register Pair DE addresses out of it.
50C6
Jump to 5853H on NZ, @FSPEC having refused the filespec: error 64, Bad file name.
50C9
OR A B7
OR Register A with itself, which sets the Zero Flag when @FSPEC gave back no code at all.
50CA
Jump to 5853H on NZ, @FSPEC having succeeded by its flag but left a code behind, which is the same error 64, Bad file name.
50CD
POP HL E1
Pop Register Pair HL, the text pointer, which the caller goes on reading the line from.
50CE
POP BC C1
Pop Register Pair BC, the control block address, which the caller named and which now holds the parsed filespec at its third byte.
50CF
RET C9
Return to the caller with the filespec parsed, the text pointer in Register Pair HL and the control block in Register Pair BC.

50D0H - OPEN: Read the Mode, the File Number and the Filespec (50D0H-511BH)

OPEN reads a mode string, a file number and a filespec and then falls into the shared open at 511CH, which is the same code SAVE, LOAD and MERGE reach by way of 4C15H and 4C1CH. The mode is taken from the first character of the string alone and nothing after it is looked at, so `OPEN "OUTPUT",1,"F"` and `OPEN "O",1,"F"` are the same statement, and so is every two letter mode the manual gives for DOS 5 BASIC, which is B301; the character is folded to upper case by the AND 0DFH at 50E5H, which clears the bit that separates the two cases, and then weighed against five letters in turn with Register D loaded with the mode before each test. **O is 02H output, I is 01H input, E is 04H extend, and D and R are both 03H**, the random mode, because Register D is loaded with 03H at 50F9H for the D test and the R test at 50FFH falls through to 5104H with it still there. Anything else is error 54, Bad file mode, as is a mode string of no characters at all. The one thing OPEN does that the other three openers do not is push 634BH at 50D3H as the address the shared open will return to: those three bytes clear 6E92H and the word at 6E98H, FILEX, so that the file OPEN has just opened is **not** left as the file in hand, which is the state LOAD and MERGE depend on and which would make the keyboard take its lines from this file. 634BH then returns to the statement loop at 5E3BH, whose address the dispatcher pushed.

50D0
LD BC,634BH 01 4B 63
OPEN (50D0H), the routine the statement address table holds for token 0BFH at 683FH: load Register Pair BC with 634BH, the address this statement is to come back to when the shared open has finished with it.
50D3
PUSH BC C5
Push Register Pair BC, 634BH, which lies above the statement loop's own address on the stack, so the return at 521AH goes there first: those three bytes clear 6E92H and the word at 6E98H so that the file just opened is not the file in hand, and then return to the statement loop.
50D4
Call 7345H, the expression evaluator, which works the mode string out and leaves the text pointer in Register Pair HL standing after it.
50D7
PUSH HL E5
Push Register Pair HL, that text pointer, which the POP HL at 5104H brings back once the mode letter has been decided.
50D8
Call 481AH, which insists through 2AB0H that the value is a string, giving Type mismatch through 5884H when it is not, and brings the address of its descriptor into Register Pair HL out of the accumulator at 72ECH.
50DB
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the length of the mode string.
50DC
OR A B7
OR Register A with itself, which sets the Zero Flag for a mode string of no characters.
50DD
Jump to 5841H on Z, there being no mode letter at all: that entry loads Register E with 36H and the handler prints error 54, Bad file mode.
50E0
INC HL 23
Increment Register Pair HL to the second byte of the descriptor, where the address of the characters begins.
50E1
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of that address.
50E2
INC HL 23
Increment Register Pair HL to the third byte of the descriptor.
50E3
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC addresses the characters of the mode string.
50E4
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, the first character of the mode string. It is the only character of it that is ever read: the length at 50DBH is weighed against nothing but 00H, and this is the one instruction in the statement that reads the string at all, so every character after the first is thrown away without a word. That is B301, and what it costs is in the introduction.
50E5
AND 0DFH E6 DF
AND Register A with 0DFH, which clears bit 5 and so folds a lower case letter to the upper case one, the two differing in that bit alone.
50E7
LD D,02H 16 02
Load Register D with 02H, the output mode, before the test that it belongs to.
50E9
CP 4FH FE 4F
Compare Register A with 4FH, the letter O, which asks for a file opened for output.
50EB
Jump to 5104H on Z, the mode being output with 02H already in Register D.
50ED
LD D,01H 16 01
Load Register D with 01H, the input mode, before its own test.
50EF
CP 49H FE 49
Compare Register A with 49H, the letter I, which asks for a file opened for input.
50F1
Jump to 5104H on Z, the mode being input with 01H already in Register D.
50F3
LD D,04H 16 04
Load Register D with 04H, the extend mode, before its own test.
50F5
CP 45H FE 45
Compare Register A with 45H, the letter E, which asks for a file opened and then positioned at its end.
50F7
Jump to 5104H on Z, the mode being extend with 04H already in Register D.
50F9
LD D,03H 16 03
Load Register D with 03H, the random mode, before the two tests that share it.
50FB
CP 44H FE 44
Compare Register A with 44H, the letter D, which asks for the direct, or random, mode.
50FD
Jump to 5104H on Z, the mode being random with 03H already in Register D.
50FF
CP 52H FE 52
Compare Register A with 52H, the letter R, the other letter the random mode answers to: the test needs no load of its own because 50F9H has already put 03H in Register D, so D and R give exactly the same mode.
5101
Jump to 5841H on NZ, the first character being none of the five letters: error 54, Bad file mode.
5104
POP HL E1
Pop Register Pair HL, the text pointer standing after the mode string, which the push at 50D7H left on the stack.
5105
Call 4353H, which insists that the character the text pointer is on is the one in the byte standing after this call, steps its own return address past that byte and brings the character after it back in Register A.
5108
DEFB 2CH 2C
The comma that must stand between the mode string and the file number, which 4353H compares the line's character with. It is read as data by the routine the call at 5105H reaches, not executed, and the instruction after that call is the one at 5109H.
5109
PUSH DE D5
Push Register Pair DE, the mode in Register D, across the reading of the file number, which uses Register Pair DE for its own answer; the POP DE at 511BH brings it back.
510A
CP 23H FE 23
Compare Register A with 23H, the number sign, which OPEN allows before the file number and does not require.
510C
Call NXTCHAR at 5E93H on Z, which steps the text pointer past the number sign; for anything else the pointer is left where it stands and the expression begins there.
510F
Call 799FH, which works the file number out through the evaluator, gives Illegal function call through 5F95H for a value of 256 or more, steps the text pointer past the expression and returns the number in Register A and in Register E.
5112
Call 4353H a second time, for the comma that must stand between the file number and the filespec.
5115
DEFB 2CH 2C
The second comma, data for the call at 5112H and not an instruction; the instruction after that call is the one at 5116H.
5116
LD A,E 7B
Load Register A with Register E, the file number, which 799FH left there as well as in Register A and which the call at 5112H has since used Register A for.
5117
OR A B7
OR Register A with itself, which sets the Zero Flag for file number 00H.
5118
Jump to 5847H on Z, file number 00H not being a file a program may open: that entry loads Register E with 34H and the handler prints error 52, Bad file number.
511B
POP DE D1
Pop Register Pair DE, the mode back into Register D, and fall into the shared open at 511CH, whose first instruction puts the file number into Register E so that Register Pair DE carries both.

511CH - The Shared Open, and the Three Cells Below It (511CH-521DH)

Every file BASIC opens is opened here. OPEN falls in at 511CH with the mode in Register D and the file number in Register A; SAVE enters at 4C1CH with Register D at 02H; and LOAD and MERGE enter at 4C15H, which first sets the byte at 521CH to 0FFH and then loads Register D with 01H, so that this code can tell their opens from an ordinary one. The file number is checked and turned into a control block by 4AA7H, the filespec is parsed into it by 508CH, and a random open may carry a record length after a second comma, which 513CH works out and leaves in Register B. The mode then picks one of four routes, and each is a different pair of system calls: **extend** does @INIT at 5172H and then @PEOF at 5181H to put the file at its end, and records the mode as 02H rather than 04H, so a file opened for extending is an output file from then on; **input** sets bit 0 of SFLAG$ at 51ECH so that a file which is not there is reported rather than created, and does @OPEN; **random** does @OPEN at 5192H and, when that gives 18H, @INIT at 519EH instead, so a random open creates the file when it has to, and then asks @CKDRV whether the drive is write protected and keeps the answer in this drive's byte of the table at 7C4FH, which is the table PUT reads at 5033H; and **output**, which is everything else, does @INIT alone at 51DDH. The three little routines at 51D2H, 51D5H and 51D9H are a chain of codes each route is willing to accept, entered at whichever link suits it. What the system is handed as the file's buffer depends on the record length: Register Pair HL is made the record area at the control block plus 0034H, and the INC H at 516CH raises it by 256 when the record length is not 00H. A record length of 00H means 256, so for a whole sector the record area and the sector buffer are the same 256 bytes; for anything shorter the system is given a sector buffer of its own above the record area, and the record area stays where FIELD's descriptors point. Both ends meet at 520EH, which reports anything the calls left, writes the mode into the control block's first byte and clears the column count after it, and brings the text pointer back from 7184H. The three bytes at 521BH to 521DH are data that the code above and below reaches around.

511C
LD E,A 5F
The shared open (511CH), which OPEN falls into and which 4C15H and 4C1CH jump to: load Register E with Register A, the file number, so that Register Pair DE carries the mode and the number together.
511D
PUSH DE D5
Push Register Pair DE, the mode and the number, which the POP AF at 512BH takes back as a word so that the mode in Register D lands in Register A.
511E
Call 4AA7H, the entry of the file lookup that takes the number already in Register E: it gives error 52 through 5847H for a number above the count at 6ECEH, returns the control block address in Register Pair BC and its mode byte in Register A, and sets the Zero Flag when that byte is 00H, a file not open.
5121
Jump to 5850H on NZ, the file being open already: that entry loads Register E with 37H and the handler prints error 55, File already open.
5124
PUSH BC C5
Push Register Pair BC, the control block address, which the POP DE at 512AH takes back into the pair 508CH wants it in.
5125
Call 508CH, which works the filespec expression out, folds it to upper case into the area at 7C2EH and has @FSPEC parse it into the control block's file control block, giving error 64, Bad file name, for an empty or overlong one.
5128
LD B,00H 06 00
Load Register B with 00H, the record length that stands for 256, which is what a file gets unless a random open names another.
512A
POP DE D1
Pop Register Pair DE, the control block address, which 508CH gave back in Register Pair BC and the push at 5124H left on the stack.
512B
POP AF F1
Pop Register Pair AF, the word pushed at 511DH, which puts the mode that was in Register D into Register A and the file number into the flags, where it is not read.
512C
PUSH AF F5
Push Register Pair AF, the mode, which the POP AF at 515AH brings back once SFLAG$ has been dealt with.
512D
PUSH DE D5
Push Register Pair DE, the control block address, which the POP HL at 5147H brings back.
512E
CP 03H FE 03
Compare Register A with 03H, the random mode, the only one that may carry a record length.
5130
Jump to 5140H on NZ, the mode not being random, so that the record length stays at the 00H of 5128H.
5132
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on rather than the one beyond it.
5133
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended there.
5136
Jump to 5140H on Z, the statement having ended with the filespec, so that a random file with no record length named gets 256.
5138
Call 4353H, which insists that the character the text pointer is on is the one in the byte standing after this call and brings the character after it back in Register A.
513B
DEFB 2CH 2C
The comma that must stand between the filespec and the record length, which 4353H compares the line's character with. It is read as data by the routine the call at 5138H reaches, not executed, and the instruction after that call is the one at 513CH.
513C
Call 799FH, which works the record length out through the evaluator, gives Illegal function call through 5F95H for a value of 256 or more, and returns it in Register A and in Register E.
513F
LD B,E 43
Load Register B with Register E, the record length, which the system calls take as the logical record length and in which 00H stands for 256.
5140
LD (7184H),HL 22 84 71
Store Register Pair HL into the word at 7184H, the text pointer, which 5217H brings back at the end: the system calls below use Register Pair HL for the buffer and would lose it.
5143
LD HL,(7C6DH) 2A 6D 7C
Load Register Pair HL from the word at 7C6DH, one of the three cells BEGIN fills at 84E2H, which holds the address of SFLAG$ 007CH, the system flag byte.
5146
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, SFLAG$ as it stands.
5147
POP HL E1
Pop Register Pair HL, the control block address pushed at 512DH.
5148
AND 0F9H E6 F9
AND Register A with 0F9H, which clears bits 1 and 2 of SFLAG$ and leaves every other bit of it alone.
514A
LD C,A 4F
Load Register C with Register A, that value, so that Register A can be used for the test below.
514B
LD A,(521CH) 3A 1C 52
Load Register A from the byte at 521CH, which 4C17H set to 0FFH for a LOAD or a MERGE and which is 00H for every other open.
514E
OR A B7
OR Register A with itself, which sets the Zero Flag when this is not a LOAD or a MERGE.
514F
LD A,C 79
Load Register A with Register C, the SFLAG$ value with bits 1 and 2 cleared.
5150
Jump to 5154H on Z, this being an ordinary open, so that bit 2 is left clear.
5152
OR 04H F6 04
OR Register A with 04H, which sets bit 2 of SFLAG$ for a LOAD or a MERGE alone.
5154
PUSH HL E5
Push Register Pair HL, the control block address, across the store below, which wants Register Pair HL for the flag's own address.
5155
LD HL,(7C6DH) 2A 6D 7C
Load Register Pair HL from the word at 7C6DH again, the address of SFLAG$ 007CH.
5158
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, which writes SFLAG$ back with bits 1 and 2 as this open wants them.
5159
POP HL E1
Pop Register Pair HL, the control block address.
515A
POP AF F1
Pop Register Pair AF, the mode, pushed at 512CH.
515B
PUSH AF F5
Push Register Pair AF, the mode, again, which the POP AF at 5212H takes to write into the control block.
515C
PUSH HL E5
Push Register Pair HL, the control block address, which the POP HL at 5211H or at 517BH takes.
515D
LD (6E98H),HL 22 98 6E
Store Register Pair HL into the word at 6E98H, FILEX, which makes this the file in hand: LOAD and MERGE need that and OPEN undoes it at 634BH, whose address OPEN pushed at 50D3H.
5160
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the control block address into Register Pair DE, where the system calls want the file control block.
5161
INC DE 13
Increment Register Pair DE to the control block plus one.
5162
INC DE 13
Increment Register Pair DE again, to the control block plus two, the file control block itself.
5163
LD HL,0032H 21 32 00
Load Register Pair HL with 0032H, the offset of the record area counted from the file control block rather than from the control block.
5166
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which makes Register Pair HL the record area at the control block plus 0034H, the same place FIELD lays its fields.
5167
LD C,A 4F
Load Register C with Register A, the mode, so that Register A can carry the record length for the test below.
5168
LD A,B 78
Load Register A with Register B, the record length.
5169
OR A B7
OR Register A with itself, which sets the Zero Flag for the 00H that stands for a record length of 256.
516A
Jump to 516DH on Z, the record being a whole sector, so that the system is given the record area itself as its buffer: the two are the same 256 bytes and no second buffer is wanted.
516C
INC H 24
Increment Register H, which raises Register Pair HL by 256 and so hands the system a sector buffer of its own above the record area: for a record shorter than a sector the system blocks and deblocks through that buffer, and the record area below it stays where FIELD's descriptors point.
516D
LD A,C 79
Load Register A with Register C, the mode, which the four tests below weigh.
516E
CP 04H FE 04
Compare Register A with 04H, the extend mode, which OPEN gives for the letter E.
5170
Jump to 518AH on NZ, the mode not being extend, so that the other three are tried.
5172
LD A,3AH 3E 3A
Load Register A with 3AH, the number of @INIT, the call that opens a file and creates it when it is not there.
5174
RST 28H EF
Call the system through RST 28H, which opens or creates the file whose control block Register Pair DE addresses with the buffer at Register Pair HL and the record length in Register B.
5175
Call 51D5H, the second link of the chain of acceptable codes, which leaves the Zero Flag set for a clean call or for the code 2AH and clear for anything else.
5178
Jump to 5282H on NZ, the call having failed with a code this route will not take: 5282H keeps the system's code at 7C4EH and turns it into the BASIC error the handler prints.
517B
POP HL E1
Pop Register Pair HL, the control block address pushed at 515CH, so that the mode below can be put in its place.
517C
POP AF F1
Pop Register Pair AF, the mode 04H pushed at 515BH, which is about to be thrown away.
517D
LD A,02H 3E 02
Load Register A with 02H, the output mode, which is what an extended file is recorded as: 04H names the way it was opened and does not outlive the opening.
517F
PUSH AF F5
Push Register Pair AF, that 02H, which the POP AF at 5212H writes into the control block's first byte.
5180
PUSH HL E5
Push Register Pair HL, the control block address, which the POP HL at 5211H takes.
5181
LD A,41H 3E 41
Load Register A with 41H, the number of @PEOF, the call that positions a file at the end of what it holds.
5183
RST 28H EF
Call the system through RST 28H, which puts the file whose control block Register Pair DE addresses at its end, so that what is written next is added to it.
5184
Call 51D9H, the chain's third link, which leaves the Zero Flag set for a clean call or for the code 1CH, the end of the file, which is what @PEOF reaches by design.
5187
Jump to 520EH, the common ending, where anything the calls left is reported and the mode is written into the control block.
518A
CP 01H FE 01
Compare Register A with 01H, the input mode, which OPEN gives for the letter I.
518C
Jump to 51E7H on Z, the mode being input, which is the one route that sets a bit of SFLAG$ of its own.
518E
CP 03H FE 03
Compare Register A with 03H, the random mode, which OPEN gives for the letters D and R alike.
5190
Jump to 51DDH on NZ, the mode being neither input nor random nor extend, which leaves output.
5192
LD A,3BH 3E 3B
Load Register A with 3BH, the number of @OPEN, the call that opens a file that is already there and does not create one.
5194
RST 28H EF
Call the system through RST 28H, which opens the file whose control block Register Pair DE addresses with the buffer at Register Pair HL and the record length in Register B.
5195
Call 51D2H, the first link of the chain, which leaves the Zero Flag set for a clean call or for the codes 29H or 2AH.
5198
Jump to 51A9H on Z, the file having opened, so that the drive is asked about below.
519A
CP 18H FE 18
Compare Register A with 18H, the code for a file that is not there.
519C
Jump to 51A6H on NZ, the call having failed for some other reason, which is reported.
519E
LD A,3AH 3E 3A
Load Register A with 3AH, the number of @INIT, so that a random open creates the file when @OPEN has just said it is not there.
51A0
RST 28H EF
Call the system through RST 28H, which creates the file whose control block Register Pair DE addresses with the same buffer and record length.
51A1
Call 51D2H again, the same first link of the chain of acceptable codes.
51A4
Jump to 51A9H on Z, the file having been created, so that the drive is asked about below.
51A6
Jump to 5282H, which keeps the system's code at 7C4EH and turns it into the BASIC error the handler prints.
51A9
PUSH HL E5
The drive test, which only a random open makes (51A9H): push Register Pair HL, the buffer address, across the call below.
51AA
PUSH BC C5
Push Register Pair BC, the record length in Register B, across the call below, which wants Register Pair BC for the drive number.
51AB
LD HL,0006H 21 06 00
Load Register Pair HL with 0006H, the offset of the byte that carries the drive inside the file control block.
51AE
ADD HL,DE 19
Add Register Pair DE, the file control block address, to Register Pair HL, so that Register Pair HL addresses that byte.
51AF
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which carries the drive in its low bits.
51B0
AND 07H E6 07
AND Register A with 07H, which leaves the drive number alone, nought to seven, and is what makes the table below eight bytes long.
51B2
LD C,A 4F
Load Register C with Register A, that drive number.
51B3
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC holds the drive number as a sixteen bit offset.
51B5
PUSH BC C5
Push Register Pair BC, the drive number, across the call below, which wants Register Pair BC for itself.
51B6
LD A,21H 3E 21
Load Register A with 21H, the number of @CKDRV, the call that says what state a drive is in.
51B8
RST 28H EF
Call the system through RST 28H, which asks about the drive and answers in the Carry Flag, set for a diskette that is write protected.
51B9
POP BC C1
Pop Register Pair BC, the drive number, which the table below is indexed by.
51BA
PUSH AF F5
Push Register Pair AF, which keeps the Carry Flag the call gave while Register Pair HL is worked out.
51BB
LD HL,7C4FH 21 4F 7C
Load Register Pair HL with 7C4FH, the first of the eight bytes that hold what BASIC knows about each drive.
51BE
ADD HL,BC 09
Add Register Pair BC, the drive number, to Register Pair HL, so that Register Pair HL addresses this drive's byte.
51BF
POP AF F1
Pop Register Pair AF, which brings the Carry Flag back now that the byte's address is in hand.
51C0
Jump to 51C8H on NC, the diskette not being write protected, so that the bit is cleared rather than set.
51C2
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, this drive's byte as it stands.
51C3
OR 01H F6 01
OR Register A with 01H, which sets bit 0, the bit PUT reads at 5038H before it writes anything.
51C5
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the drive being write protected.
51C6
Jump to 51CCH, where the two answers meet and the pushes of the drive test are taken back off the stack.
51C8
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, this drive's byte as it stands, the diskette not being write protected.
51C9
AND 0FEH E6 FE
AND Register A with 0FEH, which clears bit 0 and leaves every other bit of the byte alone.
51CB
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the drive being one that may be written.
51CC
POP BC C1
Pop Register Pair BC, the record length pushed at 51AAH.
51CD
POP HL E1
Pop Register Pair HL, the buffer address pushed at 51A9H.
51CE
XOR A AF
Clear Register A with exclusive OR, which sets the Zero Flag so that the common ending below reports nothing: the drive test cannot fail, it only records what it found.
51CF
Jump to 520EH, the common ending, which the cleared Register A above makes sure reports nothing for this route.
51D2
RET Z C8
The chain of acceptable codes, first link (51D2H): return on Z, the call having been clean.
51D3
CP 29H FE 29
Compare Register A with 29H, a code this link forgives, and fall into the link below.
51D5
RET Z C8
The chain's second link (51D5H), which extend and output enter directly: return on Z, which is a clean call for them and the code 29H for a caller that came through the link above.
51D6
CP 2AH FE 2A
Compare Register A with 2AH, the other code the chain forgives, and fall into the return below.
51D8
RET C9
Return with the Zero Flag set only when the code was one the chain accepts, which is what the three callers test.
51D9
RET Z C8
The chain's third link, for @PEOF alone (51D9H): return on Z, the call having been clean.
51DA
CP 1CH FE 1C
Compare Register A with 1CH, the end of the file, which is the state @PEOF is asked to reach and so no failure at all.
51DC
RET C9
Return with the Zero Flag set for a clean call or for that end of file code.
51DD
LD A,3AH 3E 3A
The output route (51DDH): load Register A with 3AH, the number of @INIT, which opens the file and creates it when it is not there.
51DF
RST 28H EF
Call the system through RST 28H, which opens or creates the file whose control block Register Pair DE addresses with the buffer at Register Pair HL and the record length in Register B.
51E0
Call 51D5H, the chain's second link, which leaves the Zero Flag set for a clean call or the code 2AH.
51E3
Jump to 520EH on Z, the file having opened, so that the mode is written into the control block.
51E5
Jump to 51A6H, which goes on to 5282H and turns the system's code into a BASIC error.
51E7
PUSH HL E5
The input route (51E7H): push Register Pair HL, the buffer address, across the flag work below.
51E8
LD HL,(7C6DH) 2A 6D 7C
Load Register Pair HL from the word at 7C6DH, the address of SFLAG$ 007CH.
51EB
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, SFLAG$ as 5158H left it.
51EC
OR 01H F6 01
OR Register A with 01H, which sets bit 0, the bit that makes the system report a file which is not there rather than create one: that is why OPEN for input gives File not found where OPEN for output makes the file.
51EE
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, SFLAG$ with that bit set.
51EF
POP HL E1
Pop Register Pair HL, the buffer address, which the call below is handed now that SFLAG$ has been set.
51F0
LD A,3BH 3E 3B
Load Register A with 3BH, the number of @OPEN, which opens a file that is already there.
51F2
RST 28H EF
Call the system through RST 28H, which opens the file whose control block Register Pair DE addresses with the buffer at Register Pair HL and the record length in Register B.
51F3
Call 51D2H, the chain's first link, which leaves the Zero Flag set for a clean call or the codes 29H or 2AH.
51F6
PUSH AF F5
Push Register Pair AF, the answer of that call, which the POP AF at 520DH brings back: everything between is about the LOAD and MERGE flag and must not disturb it.
51F7
LD A,(521CH) 3A 1C 52
Load Register A from the byte at 521CH, which 4C17H set to 0FFH for a LOAD or a MERGE.
51FA
OR A B7
OR Register A with itself, which sets the Zero Flag when this is an ordinary open for input.
51FB
Jump to 520DH on Z, this not being a LOAD or a MERGE, so that the byte below is left as it is.
51FD
XOR A AF
Clear Register A with exclusive OR, the 00H that puts the LOAD and MERGE flag out again.
51FE
LD (521CH),A 32 1C 52
Store Register A into the byte at 521CH, which clears it: the flag is for one open only, and this is the one place that puts it back.
5201
PUSH HL E5
Push Register Pair HL, the buffer address, across the read of the flag below.
5202
LD HL,(7C6DH) 2A 6D 7C
Load Register Pair HL from the word at 7C6DH, the address of SFLAG$ 007CH.
5205
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, SFLAG$ as the open left it.
5206
POP HL E1
Pop Register Pair HL, the buffer address, which the push at 5201H guarded while SFLAG$ was read.
5207
RRA 1F
Rotate Register A right through the Carry Flag, which puts bit 0 of SFLAG$ into the Carry Flag.
5208
RRA 1F
Rotate Register A right through the Carry Flag again, which puts bit 1 of SFLAG$ into the Carry Flag, and that bit is the one this is after.
5209
SBC A,A 9F
Subtract Register A from Register A with the carry, which leaves 0FFH when the Carry Flag was set and 00H when it was clear, turning that one bit into a whole byte.
520A
LD (521DH),A 32 1D 52
Store Register A into the byte at 521DH, so that bit 1 of SFLAG$ as this open left it is kept for the code at 801CH, the only place that reads it, which is part of module 1 not yet written.
520D
POP AF F1
Pop Register Pair AF, the answer of the open, which the push at 51F6H kept across all of that.
520E
The common ending (520EH), which all four routes reach: jump to 5282H on NZ, a code having been left that the route would not accept.
5211
POP HL E1
Pop Register Pair HL, the control block address pushed at 515CH or at 5180H.
5212
POP AF F1
Pop Register Pair AF, the mode pushed at 515BH or at 517FH, which for an extended file is the 02H of 517DH rather than 04H.
5213
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the control block's first byte, which is the mode: that is the byte 4A98H returns and whose 00H means a file is not open.
5214
INC HL 23
Increment Register Pair HL to the control block plus one, the column count.
5215
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL addresses, which starts the column count of a newly opened file at the beginning of a line.
5217
LD HL,(7184H) 2A 84 71
Load Register Pair HL from the word at 7184H, the text pointer the store at 5140H put away before the system calls used Register Pair HL.
521A
RET C9
Return, which for OPEN goes to 634BH, the three bytes that clear 6E92H and FILEX 6E98H so that the file is not left in hand, and for SAVE, LOAD and MERGE goes to the caller that wants it left in hand.
521B
DEFB 00H 00
521BH, where FIELD keeps the record length while it reads its list of widths: 4DD3H writes it from the control block plus 000BH and 4E02H reads it once for every field. Nothing in this routine touches it.
521C
DEFB 00H 00
521CH, the byte that says this open is a LOAD or a MERGE: 4C17H sets it to 0FFH, 514BH reads it to set bit 2 of SFLAG$, 51F7H reads it again on the input route and 51FEH clears it, so it lasts one open.
521D
DEFB 00H 00
521DH, where 520AH keeps bit 1 of SFLAG$ as a whole byte, 0FFH or 00H, after a LOAD or MERGE open for input. 801CH reads it and 8022H writes it, both in the part of module 1 not yet written.

521EH - KILL: Remove a File from the Diskette (521EH-5281H)

KILL opens the file in a control block of BASIC's own, uses what the open tells it to make sure no program buffer has the same file open, and then asks the system to remove it. The control block it borrows is the one at the head of the table, which the lookup at 4AA7H reaches with Register A at 00H: **file number 0 is BASIC's own and no program can reach it**, which is why OPEN refuses that number at 5118H with error 52. The test that follows is the careful part. The drive and the directory entry code of the file just opened are the two things that name a file on a diskette, and rather than hold them in registers across the walk the code **plants them in its own instruction stream**: 523FH writes the drive into the operand of the LD A,00H at 5257H and 5244H writes the entry code into the operand of the one at 525CH, so the comparisons at 5259H and 525FH are made against bytes that were instructions a moment before. Those are the second and third self-modifying bytes found in module 1, after the record number flag at 500DH. The walk then counts Register A down from the number of buffers at 6ECEH and looks at every open file's drive and entry code at its own control block plus 8 and plus 9; on a match the borrowed block is closed and the DOS code 29H is sent to DERR, which the table at 529EH turns into BASIC error 55, File already open. With no match @REMOVE takes the file off the diskette and 527EH clears the borrowed block's mode byte so that it reads as not open again.

521E
XOR A AF
KILL (521EH), the routine the statement address table holds for token 0C8H at 6851H: clear Register A with exclusive OR, the file number 00H, which is the control block BASIC keeps for itself and no program can open.
521F
Call 4AA7H, the entry of the file lookup that takes the number already in Register A: it returns that control block's address in Register Pair BC and leaves Register Pair HL standing where it was.
5222
Call 508CH, which works the filespec expression out, folds it to upper case into the area at 7C2EH and has @FSPEC parse it into the control block Register Pair BC names, giving error 64, Bad file name, for an empty or overlong one.
5225
PUSH HL E5
Push Register Pair HL, the text pointer standing after the filespec, which the POP HL at 5280H gives back to the statement loop.
5226
LD HL,(6EAEH) 2A AE 6E
Load Register Pair HL from the word at 6EAEH, the first entry of the table of control block addresses, which is the block KILL borrows.
5229
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE.
522A
INC DE 13
Increment Register Pair DE to the control block plus one.
522B
INC DE 13
Increment Register Pair DE again, to the control block plus two, the file control block the system call takes.
522C
LD B,00H 06 00
Load Register B with 00H, the logical record length that stands for 256, which is what an open made only to read the directory wants.
522E
LD A,3BH 3E 3B
Load Register A with 3BH, the number of @OPEN, which opens a file that is already there and does not create one.
5230
RST 28H EF
Call the system through RST 28H, which opens the file whose control block Register Pair DE addresses and fills in its drive and directory entry code.
5231
Call 51D5H, the second link of the chain of acceptable codes shared with the open, which leaves the Zero Flag set for a clean call or for the code 2AH.
5234
Jump to 5282H on NZ, the file not having opened: DERR keeps the system's code at 7C4EH and turns it into the BASIC error the handler prints, so a file that is not there gives File not found.
5237
PUSH HL E5
Push Register Pair HL, which the walk below uses for the addresses it compares and the POP HL at 5274H or 5265H gives back.
5238
PUSH DE D5
Push Register Pair DE, the file control block address, which @REMOVE below is handed.
5239
PUSH BC C5
Push Register Pair BC, the borrowed control block's address, across the walk.
523A
LD HL,0006H 21 06 00
Load Register Pair HL with 0006H, the offset of the byte that carries the drive inside the file control block.
523D
ADD HL,DE 19
Add Register Pair DE, the file control block address, to Register Pair HL, so that Register Pair HL addresses that byte.
523E
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the drive the file was found on.
523F
LD (5258H),A 32 58 52
Store Register A into the byte at 5258H, which is the operand of the LD A,00H at 5257H: the drive is planted in the instruction that the comparison at 5259H will load it with, so no register has to carry it through the walk.
5242
INC HL 23
Increment Register Pair HL to the file control block plus seven, the directory entry code, which with the drive is what names this file on the diskette.
5243
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that entry code.
5244
LD (525DH),A 32 5D 52
Store Register A into the byte at 525DH, the operand of the LD A,00H at 525CH, planted the same way for the comparison at 525FH.
5247
LD A,(6ECEH) 3A CE 6E
Load Register A from the byte at 6ECEH, the number of file buffers BASIC was started with, which is the highest file number there can be and the count the walk below works down from.
524A
OR A B7
OR Register A with itself, which sets the Zero Flag when BASIC was started with no file buffers at all.
524B
Jump to 5272H on Z, there being no program buffer that could hold this file, so that the removal goes straight ahead.
524D
PUSH AF F5
The walk over the program's buffers (524DH): push Register Pair AF, the number of the buffer being looked at, which the call below does not keep.
524E
Call 4AA7H, the file lookup, which returns this buffer's control block address in Register Pair BC and sets the Zero Flag when its mode byte is 00H, a buffer with no file in it.
5251
Jump to 526EH on Z, this buffer being empty, so that the next one down is tried.
5253
LD HL,0008H 21 08 00
Load Register Pair HL with 0008H, the offset of the drive byte counted from the control block rather than from the file control block, the two differing by two.
5256
ADD HL,BC 09
Add Register Pair BC, this buffer's control block address, to Register Pair HL, so that Register Pair HL addresses its drive byte.
5257
LD A,00H 3E 00
Load Register A with the byte 523FH planted at 5258H, the drive the file to be removed was found on.
5259
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, this buffer's drive.
525A
Jump to 526EH on NZ, this buffer holding a file on another drive, so that the next one down is tried.
525C
LD A,00H 3E 00
Load Register A with the byte 5244H planted at 525DH, the directory entry code of the file to be removed.
525E
INC HL 23
Increment Register Pair HL to this buffer's directory entry code, which stands one byte above its drive.
525F
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, this buffer's entry code: with the drive already matched, an entry code that matches as well means this buffer holds the very file KILL was asked to remove.
5260
Jump to 526EH on NZ, this buffer holding another file of the same drive, so that the next one down is tried.
5262
POP AF F1
Pop Register Pair AF, the buffer number, the file having been found open and the removal being about to be refused.
5263
POP BC C1
Pop Register Pair BC, the borrowed control block's address pushed at 5239H.
5264
POP DE D1
Pop Register Pair DE, the file control block address pushed at 5238H, which the close below is handed.
5265
POP HL E1
Pop Register Pair HL, pushed at 5237H, so that the stack is as it was when the walk began.
5266
LD A,3CH 3E 3C
Load Register A with 3CH, the number of @CLOSE, which closes the borrowed control block: KILL opened it and must not leave it open when it refuses.
5268
RST 28H EF
Call the system through RST 28H, which closes the file whose control block Register Pair DE addresses, and whatever it answers is thrown away by the load below.
5269
LD A,29H 3E 29
Load Register A with 29H, the DOS code for a file that is already open, which is not what the call above returned but what KILL wants reported.
526B
Jump to 5282H, DERR, whose table at 529EH turns DOS code 29H into BASIC error 55 and so prints File already open: a file a program has open cannot be removed under it.
526E
POP AF F1
The next buffer down (526EH): pop Register Pair AF, the number of the buffer just looked at.
526F
DEC A 3D
Decrement Register A to the next buffer number down, buffer 00H being BASIC's own and never reached because the jump below leaves on zero.
5270
Jump back to 524DH on NZ, there being buffers still to look at; when Register A reaches 00H the walk is done and the removal goes ahead below.
5272
POP BC C1
The removal (5272H): pop Register Pair BC, the borrowed control block's address pushed at 5239H.
5273
POP DE D1
Pop Register Pair DE, the file control block address pushed at 5238H, which @REMOVE is handed.
5274
POP HL E1
Pop Register Pair HL, pushed at 5237H, which puts the stack back as it was before the walk so that the removal below runs on a clean one.
5275
LD A,39H 3E 39
Load Register A with 39H, the number of @REMOVE, the call that takes a file off the diskette and gives its space back.
5277
RST 28H EF
Call the system through RST 28H, which removes the file whose control block Register Pair DE addresses.
5278
Jump to 5282H on NZ, the removal having failed: DERR turns the system's code into the BASIC error the handler prints.
527B
LD HL,(6EAEH) 2A AE 6E
Load Register Pair HL from the word at 6EAEH, the first entry of the table of control block addresses, which is the block KILL borrowed.
527E
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL addresses, the mode byte, which makes the borrowed block read as not open again: 4A98H and 4AA7H both tell an open file from a closed one by that byte alone.
5280
POP HL E1
Pop Register Pair HL, the text pointer pushed at 5225H.
5281
RET C9
Return to 5E3BH, the statement loop, the file having been removed.

5282H - DERR: Turn a DOS Code into a BASIC Error, and Its Table (5282H-52C9H)

Everything that goes wrong inside the system comes through here. A dozen places jump to 5282H with the system's own code in Register A, and DERR keeps it at 7C4EH for anything that wants to see it, turns it into a BASIC error number through the 44 byte table at 529EH, and goes to the handler at 5886H with that number in Register E. The one code it does not look up is 0FFH, which 528EH answers with error 46H, 70, whose text is the fifty first and last of the block at 6B7CH, Command Aborted. A code of 2CH or more is not in the table either and is forced to 01H at 5297H, so it comes out as the table's second entry, Device I/O error. **The table is a complete second proof of the mapping the handler makes at 58DFH**, which section 9's question 10 settles: every number the table holds is either below 31 or between 50 and 70, which are the two ranges the handler takes as they stand or lowers by 19 onto the block's last twenty-one texts, and every one of them lands on exactly the text the DOS code deserves. The fourteen hardware codes 1 to 14 all give 57, Device I/O error; 15 gives 68, Disk write protected; 24 gives 53, File not found; 28 gives 62, Input past end; 29 gives 63, Bad record number; 41 gives 55, File already open, which is the code KILL sends at 5269H by hand; and 42 gives 5, Illegal function call, the one entry that falls in the low range. The first entry, for DOS code 0, holds 58H, 88, which is above 71 and so prints text 21, Unprintable error: code 0 means nothing went wrong, so reaching DERR with it is a slip of the caller's and the table says so.

5282
LD B,00H 06 00
DERR (5282H), which a dozen places reach with the system's code in Register A: load Register B with 00H, the high byte of the offset the table below is indexed by, which is a byte so the high byte is always 00H.
5284
LD HL,529EH 21 9E 52
Load Register Pair HL with 529EH, the first byte of the table that turns a DOS code into a BASIC error number.
5287
LD (7C4EH),A 32 4E 7C
Store Register A into the byte at 7C4EH, the system's own code as it came, which is kept whatever the table makes of it and which the three flag cells above it at 7C4FH have nothing to do with.
528A
CP 0FFH FE FF
Compare Register A with 0FFH, the code that means the run was abandoned rather than that anything failed.
528C
Jump to 5293H on NZ, the code being an ordinary one, so that the table is consulted.
528E
LD E,46H 1E 46
Load Register E with 46H, BASIC error 70, whose text is the fifty first and last of the block at 6B7CH, Command Aborted: the handler's mapping takes 19 off a number in the 50 to 70 range, and 70 less 19 is 51.
5290
Jump to the error handler at 5886H, which prints that text and goes to command level.
5293
CP 2CH FE 2C
Compare Register A with 2CH, one past the last code the table holds, the table being 44 bytes for codes 00H to 2BH.
5295
Jump to 5299H on C, the code standing inside the table, so that it is looked up as it is.
5297
LD A,01H 3E 01
Load Register A with 01H, the code being past the end of the table: 01H is the table's second entry, Device I/O error, which is what every code the table does not know comes out as.
5299
LD C,A 4F
Load Register C with Register A, the code, so that Register Pair BC holds it as a sixteen bit offset with the 00H Register B already holds.
529A
ADD HL,BC 09
Add Register Pair BC, the code, to Register Pair HL, so that Register Pair HL addresses that code's entry in the table.
529B
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the BASIC error number the table gives for this code.
529C
Jump to the error handler at 5886H, which maps that number onto the message block at 58DFH, prints the text and goes to command level. This instruction's own high byte is the table's first entry. 5284H points the table at 529EH, which is the third byte of this jump, so the lookup for DOS code 0 reads the 58H of the operand 5886H and comes out as BASIC error 88. Code 0 means nothing went wrong and cannot properly reach DERR, so the author spent no byte on it and let the jump's own high byte stand in: the table proper begins at 529FH with code 1.
529F-52AC
DEFB 39H, 39H, 39H, 39H, 39H, 39H, 39H, 39H, 39H, 39H, 39H, 39H, 39H, 39H 39 39 39 39 39 39 39 39 39 39 39 39 39 39
DOS codes 1 to 14, the fourteen hardware and controller failures, all of them BASIC error 57, Device I/O error, text 38. This is also the entry 5297H forces every code of 2CH or more onto.
52AD
DEFB 44H 44
DOS code 15: BASIC error 68, Disk write protected, text 49. The same error PUT raises for itself at 503AH from the table at 7C4FH, before it ever asks the system.
52AE
DEFB 33H 33
DOS code 16: BASIC error 51, Internal error, text 32.
52AF-52B0
DEFB 39H, 39H 39 39
DOS codes 17 and 18: BASIC error 57, Device I/O error.
52B1
DEFB 40H 40
DOS code 19: BASIC error 64, Bad file name, text 45, which is the error 508CH gives for itself when @FSPEC refuses a filespec.
52B2-52B5
DEFB 39H, 39H, 39H, 39H 39 39 39 39
DOS codes 20 to 23: BASIC error 57, Device I/O error.
52B6
DEFB 35H 35
DOS code 24, a file that is not there: BASIC error 53, File not found, text 34. This is the error an OPEN for input gives, bit 0 of SFLAG$ at 51ECH being what makes the system report the file rather than create it.
52B7
DEFB 45H 45
DOS code 25: BASIC error 69, File access DENIED, text 50.
52B8
DEFB 44H 44
DOS code 26: BASIC error 68, Disk write protected.
52B9
DEFB 3DH 3D
DOS code 27: BASIC error 61, Disk full, text 42.
52BA
DEFB 3EH 3E
DOS code 28: BASIC error 62, Input past end, text 43. This is one of the two codes the byte reader at 5064H forgives rather than reports, 507CH taking it as the end of the file.
52BB
DEFB 3FH 3F
DOS code 29: BASIC error 63, Bad record number, text 44. The other code the byte reader forgives, and the one PUT and GET let through at 501CH for a record past the end.
52BC
DEFB 3DH 3D
DOS code 30: BASIC error 61, Disk full, text 42, which is the second of the three codes this table answers with it.
52BD
DEFB 35H 35
DOS code 31: BASIC error 53, File not found, text 34, the second of the two codes that come out that way.
52BE
DEFB 40H 40
DOS code 32: BASIC error 64, Bad file name, text 45, the second of the two codes that come out that way.
52BF
DEFB 3DH 3D
DOS code 33: BASIC error 61, Disk full, the last of the three codes this table answers with that error.
52C0-52C2
DEFB 33H, 33H, 33H 33 33 33
DOS codes 34 to 36: BASIC error 51, Internal error.
52C3
DEFB 45H 45
DOS code 37: BASIC error 69, File access DENIED.
52C4-52C6
DEFB 33H, 33H, 33H 33 33 33
DOS codes 38 to 40: BASIC error 51, Internal error.
52C7
DEFB 37H 37
DOS code 41, a file that is already open: BASIC error 55, File already open, text 36. KILL loads this code by hand at 5269H and jumps here, so that its own refusal is worded by the same table as the system's.
52C8
DEFB 05H 05
DOS code 42: BASIC error 5, Illegal function call, text 5. The only entry of the table that falls below 31 and so is used by the handler as it stands, with nothing taken off it.
52C9
DEFB 33H 33
DOS code 43, the last the table holds: BASIC error 51, Internal error. A code of 2CH or more never reaches here, 5297H having forced it to 01H.

52CAH - WHILE and WEND, Their Stack Frame and the Frame Finder (52CAH-5359H)

WHILE and WEND are one loop built on a seven byte stack frame and a single piece of code at 530EH that weighs the condition for both of them. The frame is pushed by WHILE: from its marker byte, +0 is the token 0B4H, **+1 and +2 the text pointer just after the matching WEND**, +3 and +4 the text pointer just after the WHILE keyword, where the condition stands, and +5 and +6 the line number WHILE was found on. WHILE learns where its WEND is before it does anything else, by the forward scanner at 6710H: that is the same routine FOR enters at 6714H, and **Register C carries both the error number and the choice of tokens**, 1AH counting FOR and NEXT and giving error 26, FOR Without NEXT, and 1DH counting WHILE and WEND and giving error 29, WHILE without WEND, the test being the `CP 1AH` at 676AH. Because +1 and +2 hold the pointer after the WEND, WEND can find its own frame by matching the text pointer it is standing at, which is what the finder at 532DH does: it walks up the stack from the Stack Pointer plus four, steps over a FOR frame by 18 bytes from the byte after its token, which is the nineteen byte frame pass 35 measured, and over a WHILE frame by 6, and returns with the Zero Flag set and Register Pair HL at the frame's token plus one when the pointers match. Both statements drop the statement loop's own return address rather than returning, WHILE with the two INC SP at 52D7H and WEND by cutting the Stack Pointer to the frame, so that the frame always lies directly above the enclosing one. A WHILE that is reached a second time without its WEND having run, which a GOTO back into the loop will do, finds its own old frame and cuts the stack back to it at 52DCH rather than stacking a second: the loop costs seven bytes however often it is re-entered. The condition is weighed by 2905H of the overlay, which gives Type mismatch through 5884H for a string, and when it is false the three words are popped and the pointer after the WEND is the one execution goes on from, with the line number taken back out of 72A1H.

52CA
LD (717EH),HL 22 7E 71
WHILE (52CAH), the routine the statement address table holds for token 0B4H at 6823H: store Register Pair HL, the text pointer standing at the condition, into the word at 717EH, where it waits to be pushed into the frame at 52E4H.
52CD
Call 6710H, the forward scanner, which walks the program from here counting nesting in Register B and stops at the matching WEND, keeping the line number it reaches in 72A1H and giving error 29, WHILE without WEND, when the program runs out. Register C holds 1DH, which is both that error number and what makes the scanner count WHILE and WEND rather than FOR and NEXT.
52D0
Call NXTCHAR at 5E93H, which steps the text pointer past the WEND token the scanner stopped on, so that Register Pair HL stands at the character after the matching WEND.
52D3
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that pointer into Register Pair DE, where the finder below weighs it and the push at 52E8H takes it from.
52D4
Call 532DH, the frame finder, which looks up the stack for a WHILE frame whose text pointer is the one in Register Pair DE and returns with the Zero Flag set and Register Pair HL at that frame's token plus one when it finds one.
52D7
INC SP 33
Increment the Stack Pointer, the first of two, which together drop the statement loop's return address that the dispatcher pushed at 5E79H: this statement jumps to 5E3BH by hand at 531EH, and the frame must lie directly above the enclosing one with nothing between.
52D8
INC SP 33
Increment the Stack Pointer again, the second byte of that return address, and neither increment touches a flag so the finder's answer still stands below.
52D9
Jump to 52E0H on NZ, no frame of this WHILE being on the stack already, which is the ordinary first entry into the loop.
52DB
ADD HL,BC 09
Add Register Pair BC, the 0006H the finder left, to Register Pair HL, which is the found frame's token plus one, so that Register Pair HL stands just past the whole seven byte frame.
52DC
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which throws that frame and everything above it away: this WHILE has been reached again without its WEND having run, and it takes its own frame back rather than stacking a second one.
52DD
LD (718EH),HL 22 8E 71
Store Register Pair HL into the word at 718EH, the cell that holds where the stack stands, so that the interpreter's own idea of it keeps up with the move.
52E0
LD HL,(6E9CH) 2A 9C 6E
The frame (52E0H): load Register Pair HL from the word at 6E9CH, the number of the line being run, which is the line this WHILE stands on.
52E3
PUSH HL E5
Push Register Pair HL, that line number, which becomes the frame's fifth and sixth bytes and is what puts the line back when the loop ends.
52E4
LD HL,(717EH) 2A 7E 71
Load Register Pair HL from the word at 717EH, the text pointer standing at the condition, which 52CAH put there.
52E7
PUSH HL E5
Push Register Pair HL, that pointer, which becomes the frame's third and fourth bytes and is where WEND goes back to weigh the condition again.
52E8
PUSH DE D5
Push Register Pair DE, the text pointer just after the matching WEND, which becomes the frame's first and second bytes: it is both what the finder matches on and where execution goes when the condition fails.
52E9
Jump to 530EH, the condition, which WHILE and WEND share.
52EB
WEND (52EBH), the routine the statement address table holds for token 0B5H at 6825H: jump to SYNERR at 586CH on NZ, the statement not having ended at the dispatcher's NXTCHAR, because WEND takes nothing after it.
52EE
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer standing just after this WEND into Register Pair DE, the value the frame's first two bytes hold.
52EF
Call 532DH, the frame finder, which looks up the stack for a WHILE frame whose text pointer is that one and returns with Register Pair HL at its token plus one.
52F2
Jump to 5354H on NZ, no frame answering to this WEND being on the stack: error 30, WEND without WHILE.
52F4
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, the frame's token plus one, which throws the token and everything above the frame away, the statement loop's own return address included.
52F5
LD (718EH),HL 22 8E 71
Store Register Pair HL into the word at 718EH, the cell that holds where the stack stands, so that the interpreter's own idea of it keeps up.
52F8
LD DE,(6E9CH) ED 5B 9C 6E
Load Register Pair DE from the word at 6E9CH, the number of the line this WEND stands on, which has to be kept because the condition is about to be weighed as though it were the WHILE's.
52FC
LD (72A1H),DE ED 53 A1 72
Store Register Pair DE into the word at 72A1H, where that line number waits: if the condition now fails, 5321H is what puts it back, and the scanner at 6710H uses the same cell for the same purpose.
5300
INC HL 23
Increment Register Pair HL to the frame's second byte.
5301
INC HL 23
Increment Register Pair HL again, to the frame's third byte, where the text pointer of the condition begins.
5302
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of that pointer.
5303
INC HL 23
Increment Register Pair HL to the frame's fourth byte.
5304
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the text pointer standing at the WHILE's condition.
5305
INC HL 23
Increment Register Pair HL to the frame's fifth byte, where the WHILE's line number begins.
5306
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of that line number.
5307
INC HL 23
Increment Register Pair HL to the frame's sixth byte.
5308
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, the high byte of the line number, which overwrites the pointer now that the low byte is held in Register A.
5309
LD L,A 6F
Load Register L with Register A, so that Register Pair HL holds the line number the WHILE was found on.
530A
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that an error in the condition is reported against the WHILE's line and not this WEND's.
530D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer of the condition into Register Pair HL for the evaluator below.
530E
The condition, which both statements reach (530EH): call 7345H, the expression evaluator, which works the condition out and leaves the text pointer in Register Pair HL standing after it.
5311
PUSH HL E5
Push Register Pair HL, that pointer, across the test below, which is where the loop's body begins when the condition holds.
5312
Call 2905H of the overlay, which insists the value is a number, giving Type mismatch through 5884H for a string, and sets the Zero Flag when it is zero, which is false.
5315
POP HL E1
Pop Register Pair HL, the text pointer standing after the condition.
5316
Jump to 5321H on Z, the condition being false, so that the frame is thrown away and the loop left.
5318
LD BC,00B4H 01 B4 00
Load Register Pair BC with 00B4H, the condition holding: Register C takes the WHILE token 0B4H and Register B takes 00H, which the load below replaces.
531B
LD B,C 41
Load Register B with Register C, so that both halves of Register Pair BC hold the token and either byte of the push below will serve as the marker.
531C
PUSH BC C5
Push Register Pair BC, which puts two bytes of 0B4H on the stack where only one is wanted.
531D
INC SP 33
Increment the Stack Pointer, which takes the lower of those two bytes back and leaves one byte, the marker 0B4H, as the frame's first byte: this is the same trick FOR uses to push a single byte.
531E
Jump to 5E3BH, the statement loop, with Register Pair HL standing after the condition, which is the first statement of the loop's body.
5321
LD HL,(72A1H) 2A A1 72
The loop is over (5321H): load Register Pair HL from the word at 72A1H, which holds the line number of the WEND, put there by the scanner at 671CH for a WHILE whose condition failed at once and by 52FCH for a WEND whose condition has just failed.
5324
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that what follows is reported against the line the WEND stands on.
5327
POP HL E1
Pop Register Pair HL, the frame's first two bytes, which are the text pointer just after the matching WEND: that is where execution goes on.
5328
POP BC C1
Pop Register Pair BC, the frame's third and fourth bytes, the pointer to the condition, which is thrown away.
5329
POP BC C1
Pop Register Pair BC, the frame's fifth and sixth bytes, the WHILE's line number, thrown away as well, and the frame is now wholly off the stack.
532A
Jump to 5E3BH, the statement loop, with Register Pair HL standing just after the WEND, so the program goes on from there.
532D
LD HL,0004H 21 04 00
The frame finder (532DH): load Register Pair HL with 0004H, the offset that reaches past this routine's own return address and the statement loop's.
5330
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, so that Register Pair HL addresses the first byte above both return addresses, which is where the innermost frame's marker stands.
5331
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the marker of the frame being looked at.
5332
INC HL 23
Increment Register Pair HL to the byte after that marker, which is where both strides below are counted from.
5333
LD BC,0082H 01 82 00
Load Register Pair BC with 0082H, the FOR token in Register C, which is the first of the two markers that can stand here.
5336
CP C B9
Compare Register A with Register C, the FOR token.
5337
Jump to 533FH on NZ, this frame not being a FOR's, so that it is weighed against the WHILE token.
5339
LD BC,0012H 01 12 00
Load Register Pair BC with 0012H, 18, which with the marker byte already stepped over makes the nineteen bytes of a FOR frame.
533C
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps over the whole FOR frame to the next marker.
533D
Jump back to 5331H, where the next marker is read.
533F
LD BC,00B4H 01 B4 00
Load Register Pair BC with 00B4H, the WHILE token in Register C.
5342
CP C B9
Compare Register A with Register C, the WHILE token.
5343
RET NZ C0
Return on NZ, the marker being neither a FOR's nor a WHILE's, which means the stack holds no frame for this statement and the Zero Flag is clear to say so.
5344
PUSH HL E5
Push Register Pair HL, the byte after the marker, which the pop below brings back once the pointer has been read through it.
5345
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of this frame's text pointer.
5346
INC HL 23
Increment Register Pair HL to the high byte of it.
5347
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, that high byte, which overwrites the pointer now that the low byte is in Register A.
5348
LD L,A 6F
Load Register L with Register A, so that Register Pair HL holds this frame's text pointer, the one just after its matching WEND.
5349
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Zero Flag when this is the frame the caller is asking about.
534C
POP HL E1
Pop Register Pair HL, the byte after the marker, which both the return and the stride below want.
534D
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, which with the marker already stepped over makes the seven bytes of a WHILE frame, and which WHILE also uses at 52DBH to step past a frame it is taking back.
5350
RET Z C8
Return on Z, this being the frame asked for, with Register Pair HL at its marker plus one and Register Pair BC at 0006H.
5351
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps over the whole WHILE frame to the next marker.
5352
Jump back to 5331H, where the next marker is read.
5354
LD DE,001EH 11 1E 00
WEND with no WHILE (5354H): load Register Pair DE with 001EH, which asks the handler for error 30, whose text is the thirtieth of the block at 6B7CH, WEND without WHILE.
5357
Jump to the error handler at 5886H, which prints that text and goes to command level.

535AH - CALL: Enter a Machine Language Routine with the Addresses of Variables (535AH-53ECH)

CALL takes a variable whose value is an entry address and a parenthesised list of variables, and enters that address with pointers to the variables in the registers. The convention is the manual's, and the code keeps it exactly: **one to three parameters go in Register Pair HL, Register Pair DE and Register Pair BC**, and for more than three Register Pair HL and Register Pair DE carry the first two while **Register Pair BC points at a block holding the addresses of the third onward**. The addresses are collected on the stack itself: 537CH lowers the Stack Pointer by 64 bytes, which is room for the 32 parameters Register C counts down from, and each parameter's address is written there in turn; then 53C3H to 53D7H take the first three back off into the register pairs and, when more than three were given, leave Register Pair BC pointing at the fourth word of the block so that the third and everything after it can be read from it. The routine is entered by pushing 53E3H and then the entry address and returning, so an ordinary Z80 RET in the machine code comes back to 53E3H, which puts the Stack Pointer back from 718EH and goes to the statement loop. Two things the code insists on that the manual does not mention. The entry address may not be an array, which is what the 80H written into the variable search's flag at 7182H is for; and **every parameter must be a variable that already exists**. The second is the same guard SWAP makes: the array table pointer at 71A1H is read before each parameter is looked up and again afterwards, and if the search had to create the variable the pointer has moved, every address collected so far has moved with it, and the statement is refused with Illegal function call at 5F95H. CALL typed at the keyboard against a protected program is refused as well, by 57DFH, which returns at once when a program is running and falls into the protected test at 57E8H when the line number is 0FFFFH.

535A
CALL (535AH), the routine the statement address table holds for token 0B6H at 6827H: call 57DFH, which returns at once when a program is running and, when the line number at 6E9CH is 0FFFFH and so the statement was typed at the keyboard, falls into 57E8H and gives Illegal function call for a protected program.
535D
LD A,80H 3E 80
Load Register A with 80H, the value the variable search's flag is to carry while the entry address is looked up.
535F
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H, the flag the variable search reads at 3A7AH, which the array code sets here and at 54BEH, 54D0H and 5516H: it is what makes the search refuse an array for the entry address, as the manual says it must.
5362
Call the variable search at 39FBH, which finds the variable holding the entry address and returns its address in Register Pair DE.
5365
PUSH HL E5
Push Register Pair HL, the text pointer standing after that variable, which the POP DE at 5378H brings back.
5366
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the variable's address into Register Pair HL for the two calls below.
5367
Call 76A4H, which reads the variable's type so that the conversion below knows what it is working from.
536A
Call 296BH of the overlay, which loads the variable's value into the accumulator at 72ECH whatever its type.
536D
Call 6570H, which turns that value into a sixteen bit address in Register Pair HL, pushing 29F4H of the overlay as its own tail and refusing a value that will not fit an address.
5370
LD (72C5H),HL 22 C5 72
Store Register Pair HL into the word at 72C5H, the entry address of the machine language routine, where it waits until 53DEH takes it for the jump.
5373
LD C,20H 0E 20
Load Register C with 20H, 32, which is the greatest number of parameters the block below has room for and the count the commas work down.
5375
Call 4247H, which works out whether there is room for 32 words above the top of the program and variable space at 7153H and gives Out of memory through 425CH when there is not.
5378
POP DE D1
Pop Register Pair DE, the text pointer standing after the entry address variable.
5379
LD HL,0FFC0H 21 C0 FF
Load Register Pair HL with 0FFC0H, which is 64 taken away as a sixteen bit number: room for the 32 addresses Register C counts.
537C
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, so that Register Pair HL holds the address the Stack Pointer is about to be lowered to, which is also the first word of the block of addresses.
537D
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which reserves those 64 bytes: the block of parameter addresses is the stack itself, which is why 53C3H onward can take the first three back off it with plain pops.
537E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer back into Register Pair HL and leaves Register Pair DE addressing the first word of the block.
537F
LD C,20H 0E 20
Load Register C with 20H again, 32, the count of free slots in the block, which each comma takes one from so that 53C2H can work out how many parameters there were.
5381
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the pointer already stands on rather than the one beyond it.
5382
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended there.
5385
LD (7184H),HL 22 84 71
Store Register Pair HL into the word at 7184H, the text pointer, where it waits for 53E7H to bring it back after the machine language routine has returned.
5388
Jump to 53D8H on Z, the statement having ended with the entry address, which is a CALL with no parameter list at all: the routine is entered with nothing in the register pairs.
538A
Call 4353H, which insists that the character the text pointer is on is the one in the byte standing after this call and brings the character after it back in Register A.
538D
DEFB 28H 28
The opening parenthesis of the parameter list, which 4353H compares the line's character with. It is read as data by the routine the call at 538AH reaches, not executed, and the instruction after that call is the one at 538EH.
538E
PUSH BC C5
The turn of the parameter list (538EH): push Register Pair BC, the count of free slots, which the search below does not keep.
538F
PUSH DE D5
Push Register Pair DE, the address in the block this parameter's pointer is to be written at.
5390
PUSH HL E5
Push Register Pair HL, the text pointer standing at this parameter's name.
5391
LD HL,(71A1H) 2A A1 71
Load Register Pair HL from the word at 71A1H, the pointer to the start of the array table, which is also the end of the simple variables and which moves up whenever a new simple variable is made.
5394
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts that pointer away on the stack and brings the text pointer back into Register Pair HL for the search.
5395
Call the variable search at 39FBH, which finds this parameter and returns its address in Register Pair DE, creating the variable when it is new.
5398
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses again, which puts the text pointer standing after the parameter on the stack and brings the array table pointer as it was back into Register Pair HL.
5399
PUSH DE D5
Push Register Pair DE, this parameter's address, which the POP DE at 53A4H brings back once the guard below has passed.
539A
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the old array table pointer into Register Pair DE where the comparison below weighs it.
539B
LD HL,(71A1H) 2A A1 71
Load Register Pair HL from the word at 71A1H again, the array table pointer as it stands now that the parameter has been looked for.
539E
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Zero Flag when the pointer has not moved and so no new variable was made.
53A1
Jump to FUNCERR 5F95H on NZ, a new simple variable having been made: it moves the arrays up and with them every parameter address already written into the block, so the statement cannot go on and gives Illegal function call. Every parameter of a CALL must therefore be a variable the program has already used, which the manual does not say.
53A4
POP DE D1
Pop Register Pair DE, this parameter's address, pushed at 5399H.
53A5
POP HL E1
Pop Register Pair HL, the text pointer standing after the parameter, which 5398H put on the stack.
53A6
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the address in the block into Register Pair HL and puts the text pointer on the stack.
53A7
LD (HL),E 73
Store Register E, the low byte of this parameter's address, into the byte Register Pair HL addresses.
53A8
INC HL 23
Increment Register Pair HL to the second byte of this slot of the block.
53A9
LD (HL),D 72
Store Register D, the high byte of this parameter's address, into the byte Register Pair HL addresses.
53AA
INC HL 23
Increment Register Pair HL to the next slot of the block, which the next parameter is written at.
53AB
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the text pointer back into Register Pair HL and puts the advanced block pointer on the stack.
53AC
POP DE D1
Pop Register Pair DE, that advanced block pointer, ready for the next parameter.
53AD
POP BC C1
Pop Register Pair BC, the count of free slots pushed at 538EH.
53AE
LD A,(HL) 7E
Load Register A with the character of the line that Register Pair HL addresses, which is where a comma stands before another parameter.
53AF
CP 2CH FE 2C
Compare Register A with 2CH, the comma that separates one parameter from the next.
53B1
Jump to 53B9H on NZ, the list having ended, so that the closing parenthesis is demanded.
53B3
DEC C 0D
Decrement Register C, one slot of the block spent, which is what 53C2H counts the parameters by.
53B4
Call NXTCHAR at 5E93H, which steps the text pointer past the comma to the next parameter's name.
53B7
Jump back to 538EH, where the next parameter is looked up and written into the block.
53B9
Call 4353H, which insists on the character in the byte standing after this call, the closing parenthesis, and brings the character after it back in Register A.
53BC
DEFB 29H 29
The closing parenthesis of the parameter list, data for the call at 53B9H and not an instruction; the instruction after that call is the one at 53BDH.
53BD
LD (7184H),HL 22 84 71
Store Register Pair HL into the word at 7184H, the text pointer standing after the closing parenthesis, which is where the statement loop goes on from when the machine language routine returns.
53C0
LD A,21H 3E 21
Load Register A with 21H, 33, which is one more than the 32 slots Register C started at.
53C2
SUB C 91
Subtract Register C from Register A, which leaves the number of parameters: Register C lost one for every comma, so with n parameters it holds 33 less n and this gives n.
53C3
POP HL E1
Pop Register Pair HL, the first word of the block, which is the address of the first parameter and the register pair the manual says it goes in.
53C4
DEC A 3D
Decrement Register A, the count of parameters.
53C5
Jump to 53D8H on Z, there having been one parameter, so that the routine is entered with its address in Register Pair HL alone.
53C7
POP DE D1
Pop Register Pair DE, the second word of the block, the address of the second parameter.
53C8
DEC A 3D
Decrement Register A again, the second parameter's address now being in Register Pair DE.
53C9
Jump to 53D8H on Z, there having been two parameters, so that the routine is entered with Register Pair HL and Register Pair DE.
53CB
POP BC C1
Pop Register Pair BC, the third word of the block, the address of the third parameter.
53CC
DEC A 3D
Decrement Register A a third time, the third parameter's address now being in Register Pair BC.
53CD
Jump to 53D8H on Z, there having been three parameters, which is the most that go wholly in register pairs.
53CF
PUSH BC C5
Push Register Pair BC, the third parameter's address, back onto the block, there being more than three parameters: it has to stay in the block for the routine to read.
53D0
PUSH HL E5
Push Register Pair HL, the first parameter's address, which is pushed only so that the Stack Pointer can be read two instructions on and is taken back at 53D7H.
53D1
LD HL,0002H 21 02 00
Load Register Pair HL with 0002H, the offset that reaches past that push to the word the third parameter's address now stands at.
53D4
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, so that Register Pair HL addresses the third parameter's address in the block.
53D5
LD B,H 44
Load Register B with Register H, the high byte of that address.
53D6
LD C,L 4D
Load Register C with Register L, the low byte, so that Register Pair BC points at the block of the third parameter onward, which is the convention the manual gives for more than three.
53D7
POP HL E1
Pop Register Pair HL, the first parameter's address back out of the push at 53D0H, so that all three register pairs now hold what the routine is to be entered with.
53D8
PUSH HL E5
The entry (53D8H), which every parameter count reaches: push Register Pair HL, which is the first parameter's address for a list and the text pointer for a CALL with none, and which the exchange below takes straight back.
53D9
LD HL,53E3H 21 E3 53
Load Register Pair HL with 53E3H, the address the machine language routine is to return to.
53DC
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves 53E3H on the stack as the return address and brings Register Pair HL back to what it held.
53DD
PUSH HL E5
Push Register Pair HL, that value again, so that the exchange below can put the entry address in its place without losing it.
53DE
LD HL,(72C5H) 2A C5 72
Load Register Pair HL from the word at 72C5H, the entry address 5370H worked out.
53E1
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the entry address on the stack above the return address and brings Register Pair HL back to the first parameter's address.
53E2
RET C9
Return, which takes the entry address off the stack and jumps to it with 53E3H left as the return address: a plain RET in the machine language routine comes back here, which is what the manual tells its readers to write.
53E3
LD HL,(718EH) 2A 8E 71
The return from the machine language routine (53E3H): load Register Pair HL from the word at 718EH, the cell that holds where the stack stands.
53E6
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which gives back the 64 bytes the block was built in and anything the routine left behind.
53E7
LD HL,(7184H) 2A 84 71
Load Register Pair HL from the word at 7184H, the text pointer standing after the statement, which 53BDH or 5385H put there.
53EA
Jump to 5E3BH, the statement loop, which goes on with whatever follows the CALL on the line.

53EDH - CHAIN: Load Another Program and Pass the Variables to It, the Parse (53EDH-5485H)

CHAIN is the largest statement of the interpreter, 782 bytes from 53EDH to 56FAH, and it is the only one that hands the running program's variables to the program it loads. The BASIC Reference Manual's syntax table gives it as CHAIN [MERGE] "filespec" [,line][,ALL][,DELETE line1-line2], and these first 153 bytes read exactly that and nothing else. The order of the work is: clear the MERGE flag at 72CCH and the DELETE flag at 72CDH; save the OPTION BASE value at 72A3H and its set flag at 72A4H into 72A5H and 72A6H; take the MERGE token if it is there; open the file with the entry LOAD and MERGE share at 4C15H; clear the starting line cell at 72D3H and read a line number into it if one is given; spell out the word ALL letter by letter through 4353H; and read the DELETE range with the parser the DELETE statement itself uses at 5A96H, keeping the first line's address in 72D0H and the address after the last in 72CEH. The whole of the parse remembers whether ALL was given in one flag and nothing else: the PUSH AF at 545BH saves the Zero Flag that the DELETE token test left, the OR A at 545AH is there only to make it non-zero on the path that came through ALL, and the POP AF at 5482H and the JP NZ at 5483H read it forty bytes later. ALL goes to 55CBH, which passes every variable; without it the code falls into 5486H, which walks the program for COMMON statements and marks only the variables they name. Four of the statement's bytes are data for 4353H: the three letters of ALL at 5446H, 544AH and 544EH, and the commas at 5423H, 543CH and 5455H.

53ED
XOR A AF
CHAIN (53EDH), the routine the statement address table holds for token 0B9H at 6833H: clear Register A with XOR A, making 00H, the value both of the statement's own flags start from.
53EE
LD (72CCH),A 32 CC 72
Store Register A into the byte at 72CCH, the MERGE flag, which 4310H, 42CEH and 5683H all read later and which must be 00H unless the MERGE keyword stands on this line.
53F1
LD (72CDH),A 32 CD 72
Store Register A into the byte at 72CDH, the flag that says a DELETE range was given, which 5664H reads when the load is over.
53F4
LD A,(72A4H) 3A A4 72
Load Register A from the byte at 72A4H, the flag that says an OPTION BASE statement has been obeyed, which 66FBH sets to the base plus one and which 42D5H clears with the program.
53F7
LD (72A6H),A 32 A6 72
Store Register A into the byte at 72A6H, where that flag is kept while the chained program is loaded, because the load clears it and 569FH puts it back.
53FA
LD A,(72A3H) 3A A3 72
Load Register A from the byte at 72A3H, the OPTION BASE value, 00H or 01H, which the array code reads at 3BB5H to fix the lowest subscript.
53FD
LD (72A5H),A 32 A5 72
Store Register A into the byte at 72A5H, where the base is kept across the load, 5699H being what puts it back. Neither this saving nor the restore at 5699H asks whether MERGE was given, so the OPTION BASE setting survives a CHAIN that has no MERGE keyword, where the manual says plainly that it should not. That is B302.
5400
LD A,(HL) 7E
Load Register A with the character the byte Register Pair HL addresses holds, the character the text pointer stands on, which the dispatcher has already put in Register A and which is read again here so that the token test below needs no assumption about the entry.
5401
LD DE,00C5H 11 C5 00
Load Register Pair DE with 00C5H, whose low byte in Register E is 0C5H, the token of the MERGE keyword, and whose high byte in Register D is 00H.
5404
CP E BB
Compare Register A with Register E, which asks whether the keyword standing after CHAIN is MERGE.
5405
Jump to 540BH on NZ, there being no MERGE keyword, so that the flag at 72CCH is left at the 00H set above.
5407
LD (72CCH),A 32 CC 72
Store Register A into the byte at 72CCH, the MERGE flag, which now holds the MERGE token itself: the lines of the file are to overlay like numbered lines of the program in memory instead of replacing it.
540A
INC HL 23
Increment Register Pair HL past the MERGE token, which is the one position by which this path differs from the one that skipped it.
540B
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on rather than the one beyond it.
540C
Call NXTCHAR at 5E93H, which brings the character of the filespec back in Register A and leaves the text pointer on it.
540F
Call 4C15H, the opener LOAD and MERGE share: it puts 0FFH in 521CH so that the shared open at 511CH can tell this open from any other, loads Register D with 01H for the input mode, and opens the file named at the text pointer.
5412
PUSH HL E5
Push Register Pair HL, the text pointer standing after the filespec, which the POP HL at 5419H brings straight back.
5413
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the value that says no starting line number was given and that the chained program is to run from its first line.
5416
LD (72D3H),HL 22 D3 72
Store Register Pair HL into the word at 72D3H, the starting line number, which 56D3H reads when the load is over.
5419
POP HL E1
Pop Register Pair HL, the text pointer, pushed at 5412H.
541A
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
541B
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended with the filespec.
541E
Jump to 5486H on Z, the statement being the plain CHAIN of a filespec alone: there is no ALL, so the COMMON walk at 5486H decides which variables are passed.
5420
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
5423
DEFB 2CH 2C
The comma that separates the filespec from whatever follows it. It is read as data by the routine the call at 5420H reaches, not executed, and the instruction after that call is the one at 5424H.
5424
CP 2CH FE 2C
Compare Register A with 2CH, a second comma, which stands where the starting line number would be and so says that the line number has been left out of a statement that goes on to ALL or DELETE.
5426
Jump to 5439H on Z, the line number having been omitted, with 72D3H left at the 0000H stored above.
5428
Call the expression evaluator at 7345H, which works the starting line number out and leaves its value in the accumulator at 72ECH.
542B
PUSH HL E5
Push Register Pair HL, the text pointer standing after the line number, which the POP HL at 5432H brings back.
542C
Call 6570H, which turns the value in the accumulator into a sixteen bit number in Register Pair HL, pushing 29F4H of the overlay as its own tail and refusing a value that will not fit.
542F
LD (72D3H),HL 22 D3 72
Store Register Pair HL into the word at 72D3H, the line of the chained program that is to be run first.
5432
POP HL E1
Pop Register Pair HL, the text pointer, pushed at 542BH.
5433
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
5434
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended with the line number.
5437
Jump to 5486H on Z, the statement being CHAIN of a filespec and a line: again there is no ALL, so only the COMMON variables are passed.
5439
Call 4353H, which insists on the byte standing after this call and gives Syntax error at 4362H when the line does not carry it.
543C
DEFB 2CH 2C
The comma that separates the line number from ALL or DELETE, data for the call at 5439H and not an instruction; the instruction after that call is the one at 543DH.
543D
LD DE,00AAH 11 AA 00
Load Register Pair DE with 00AAH, whose low byte in Register E is 0AAH, the token of the DELETE keyword, and whose high byte in Register D is 00H. Register E keeps that token as far as the test at 5456H.
5440
CP E BB
Compare Register A with Register E, which asks whether the keyword standing here is DELETE and so whether ALL has been left out.
5441
Jump to 545BH on Z with the Zero Flag set, a DELETE and no ALL: the flag the PUSH AF at 545BH saves is that Zero Flag, and it is what tells 5483H that ALL was not given.
5443
Call 4353H, which insists on the byte standing after this call: the keyword here can only be ALL, and its three letters are spelled out one call at a time.
5446
DEFB 41H 41
The letter A, the first letter of the word ALL, which 4353H compares the line's character with. It is data for the call at 5443H and not an instruction; the instruction after that call is the one at 5447H.
5447
Call 4353H again for the second letter of the keyword, which gives Syntax error at 4362H when the line does not carry it.
544A
DEFB 4CH 4C
The letter L, the second letter of ALL, data for the call at 5447H and not an instruction; the instruction after that call is the one at 544BH. A decoder reading straight through shows it as LD C,H.
544B
Call 4353H for the third letter, after which Register A holds the character standing past the whole keyword and the Zero Flag says whether the statement ended there.
544E
DEFB 4CH 4C
The letter L, the third and last letter of ALL, data for the call at 544BH and not an instruction; the instruction after that call is the one at 544FH.
544F
Jump to 55CBH on Z, the statement having ended with ALL: every variable is passed and no lines are deleted, which is the CHAIN MERGE filespec, line, ALL of the manual's own example.
5452
Call 4353H, which insists on the byte standing after this call, there being more of the statement after ALL and only a comma allowed before it.
5455
DEFB 2CH 2C
The comma that separates ALL from DELETE, data for the call at 5452H and not an instruction; the instruction after that call is the one at 5456H.
5456
CP E BB
Compare Register A with Register E, which still holds the 0AAH loaded at 543DH: the only keyword that may follow ALL and its comma is DELETE.
5457
Jump to SYNERR 586CH on NZ, which prints Syntax error, anything other than DELETE standing after the comma.
545A
OR A B7
OR Register A with itself, which sets the Zero Flag from the 0AAH in Register A and so clears it: this one byte is the whole record that ALL was given, and the test at 5483H is what reads it.
545B
PUSH AF F5
The DELETE range (545BH), reached with the Zero Flag set from 5441H when ALL was left out and clear from 545AH when it was given: push Register Pair AF to keep that flag through the whole of the range parse below.
545C
LD (72CDH),A 32 CD 72
Store Register A into the byte at 72CDH, which now holds the DELETE token and so says that a block of lines is to be removed; 5664H reads it when the load is over.
545F
Call NXTCHAR at 5E93H, which steps the text pointer past the DELETE keyword and onto the first line number of the range.
5462
Call 5A96H, the line number range parser the DELETE statement itself uses: it reads line1 into Register Pair DE, insists on the minus token between the two, defaults line2 to 0FFFAH, leaves line2 on the stack and falls into FIND at 5AB4H, which returns the address of line1 in Register Pair BC.
5465
PUSH BC C5
Push Register Pair BC, the address of the first line of the range, which the POP BC at 5469H brings back.
5466
Call 66B6H, which returns at once when the pending line number flag at 7186H is 00H and otherwise goes on to 661EH to settle it, so that the program's lines are in their final order before they are measured.
5469
POP BC C1
Pop Register Pair BC, the address of the first line of the range, pushed at 5465H.
546A
POP DE D1
Pop Register Pair DE, the second line number of the range, which 5A96H left on the stack at 5AB2H and 5AB3H.
546B
PUSH BC C5
Push Register Pair BC again, the address of the first line, which the POP HL at 547BH takes back for the comparison.
546C
LD H,B 60
Load Register H from Register B, the high byte of the address of the first line of the range.
546D
LD L,C 69
Load Register L from Register C, its low byte, so that Register Pair HL now holds that address.
546E
LD (72D0H),HL 22 D0 72
Store Register Pair HL into the word at 72D0H, the address of the first line to be deleted, which 566AH reads when the lines are taken out.
5471
Call FIND at 5AB4H, which walks the program for the line number in Register Pair DE and returns the address of the line that follows it in Register Pair HL, with the Carry Flag set when a line of that number or beyond it was reached.
5474
Jump to 547FH on NC, no line of the program reaching the second number of the range, where the JP NC there gives Illegal function call.
5476
LD D,H 54
Load Register D from Register H, the high byte of the address of the line that follows the last line of the range.
5477
LD E,L 5D
Load Register E from Register L, its low byte, so that Register Pair DE now holds the address the deleted block ends at.
5478
LD (72CEH),HL 22 CE 72
Store Register Pair HL into the word at 72CEH, the address just past the block of lines to be deleted, which 566FH reads when the lines are taken out.
547B
POP HL E1
Pop Register Pair HL, the address of the first line of the range, pushed at 546BH.
547C
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Carry Flag when the first line of the block stands below the byte the block ends at.
547F
Jump to FUNCERR 5F95H on NC, which prints Illegal function call: the range is empty or runs backwards, and this is also where 5474H sends a range whose second line was never reached.
5482
POP AF F1
Pop Register Pair AF, the flag the push at 545BH saved before any of the range was read, which says whether the ALL keyword stood on the line.
5483
Jump to 55CBH on NZ, ALL having been given, which passes every variable of the program; with the Zero Flag set the code falls into the COMMON walk at 5486H instead, which passes only the variables a COMMON statement names.

5486H - CHAIN: the COMMON Walk, the Variables Kept and the Program Loaded (5486H-56FAH)

The rest of the largest statement of the interpreter, and the only code in the file that moves the variables out of the way of a program being loaded. The parse above has read the line and 5486H now has to decide which variables survive. Without ALL it walks the whole program text for COMMON statements and marks every variable they name by setting bit 7 of the second character of its entry, which is exactly the bit the ordinary search at 3A82H cannot match, so a marked entry is invisible while the mark is on. Then 5553H walks the simple variables and 55A3H the arrays, takes the mark off every entry and throws away every entry that did not carry one, closing the table up with 5588H as it goes. With ALL nothing is marked and the parse jumps straight to 55CBH, which is where both paths meet: 55CBH and 55E7H walk what is left and copy into string space every string whose characters still lie in the program text, because the program text is about to be read over. 5640H then collects the string space and moves the whole of the variables and arrays up against the bottom of the string area with 423AH, keeping their length in 7295H and the old HIPT in 72C7H, deletes the lines the DELETE option named, and goes into LOAD's own code at 4C3EH or MERGE's at 4CEFH with the chain flag at 72D2H set. 5693H is the other half, which 41B7H and 4CC0H jump to when the load has finished: it carries the protection over with 8017H, puts the OPTION BASE back, copies the variables back down to the new VARTAB, restores HIPT, and runs the new program either from its first line or from the line the CHAIN named. 5616H is the string mover and 56ECH the entry stepper, and 56F8H is three bytes reached by nothing.

5486
LD HL,(6E9CH) 2A 9C 6E
The COMMON walk (5486H), which the parse reaches at 541EH and 5437H when no ALL was given: load Register Pair HL with the word at 6E9CH, the number of the line being run.
5489
PUSH HL E5
Push Register Pair HL, that number, which 5553H takes back: the walk below writes each line's own number into 6E9CH so that an error in a COMMON statement names the line it stands in.
548A
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL with the word at 6E9EH, PGMBGN, the first byte of the program text.
548D
DEC HL 2B
Decrement Register Pair HL, which the increment at the head of the loop below undoes: the two together make one entry serve both the first line and every later one.
548E
INC HL 23
The next line (548EH), which 54A1H reaches: increment Register Pair HL to the low byte of this line's link.
548F
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that low byte.
5490
INC HL 23
Increment Register Pair HL to the high byte of the link.
5491
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, which sets the Zero Flag when the link is 0000H and the program has been walked to its end.
5492
Jump to 5553H on Z, the whole of the program text having been read.
5495
INC HL 23
Increment Register Pair HL to the low byte of this line's number.
5496
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, that low byte.
5497
INC HL 23
Increment Register Pair HL to the high byte of the number.
5498
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the line's number.
5499
LD (6E9CH),DE ED 53 9C 6E
Store Register Pair DE into 6E9CH, the number of the line being run, which is what an error raised below names.
549D
The next statement (549DH), which 54A5H and 54B4H reach: call NXTCHAR at 5E93H, which steps Register Pair HL on to the statement's first character and brings it back in Register A.
54A0
OR A B7
The character weighed (54A0H), which 54B9H, 5529H and 5549H reach: or Register A with itself, which sets the Zero Flag for the 00H that ends the line.
54A1
Jump to 548EH on Z, the line having ended, which takes the next line of the program.
54A3
CP 3AH FE 3A
Compare Register A with 3AH, a colon, which stands between two statements of one line.
54A5
Jump to 549DH on Z, a colon standing there, which takes the statement after it.
54A7
LD DE,00B8H 11 B8 00
Load Register Pair DE with 00B8H, which puts the token of COMMON into Register E and 00H into Register D: a two byte compare with 0B8H would have done as well, and the three bytes here are what the author wrote.
54AA
CP E BB
Compare Register A with Register E, that token, which sets the Zero Flag for a COMMON statement.
54AB
Jump to 54B6H on Z, the statement being a COMMON, whose names are the ones to be marked.
54AD
Call NXTCHAR at 5E93H, the statement being something else, which steps Register Pair HL on one character.
54B0
Call 6065H, the statement skipper's DATA entry, which runs Register Pair HL on to the colon or the 00H that ends the statement, counting quotation marks so that one inside a string does not stop it.
54B3
DEC HL 2B
Decrement Register Pair HL so that the call at 549DH reads the character the skipper stopped on rather than the one beyond it.
54B4
Jump to 549DH, which steps on from that character to the next statement of the line.
54B6
A COMMON statement (54B6H), which 54ABH reaches: call NXTCHAR at 5E93H, which steps Register Pair HL on to the first character of the first name.
54B9
Jump to 54A0H on Z, the COMMON having nothing after it, which weighs the end of the line.
54BB
PUSH HL E5
A name of the list (54BBH), which 5550H reaches for the name after a comma: push Register Pair HL, the text pointer, which 54E4H and 5516H take back.
54BC
LD A,01H 3E 01
Load Register A with 01H, the value of the flag at 7182H that demands an array and sends the search straight to 3BE6H.
54BE
LD (7182H),A 32 82 71
Store Register A into 7182H, which is the cell the search reads at 3A75H to choose which of its two tables to walk.
54C1
Call 3AE8H, the look up only wrapper, which calls the search at 39FBH and leaves its own RET at 3AEBH on the stack so that the search answers rather than makes the array.
54C4
Jump to 5516H on Z, no array of that name standing in the table.
54C6
LD A,B 78
Load Register A from Register B, the name's second character, an array of that name having been found.
54C7
OR 80H F6 80
Or Register A with 80H, which sets bit 7 of it, the bit the ordinary search can never match.
54C9
LD B,A 47
Load Register B from Register A, so that the name now carries its mark and the search below looks for the marked form.
54CA
XOR A AF
Clear Register A to 00H, which sets the Zero Flag the array search reads as meaning that no array is to be made.
54CB
Call 3BE6H, the array table's own search, which answers an array that is not there by setting the Carry Flag at 3CD9H.
54CE
LD A,00H 3E 00
Load Register A with 00H, the value of the flag at 7182H that lets the character the name ended on decide which table is walked.
54D0
LD (7182H),A 32 82 71
Store Register A into 7182H, which puts that cell back for every other caller of the search.
54D3
Jump to 54DDH on NZ, the marked name not having been found, which is the ordinary case: the mark is written by 550AH below.
54D5
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the name ended on, the marked name having already been in the table.
54D6
CP 28H FE 28
Compare Register A with 28H, an opening parenthesis, which a COMMON writes after the name of an array.
54D8
Jump to 54E4H on NZ, no parenthesis standing there, which looks the name up among the simple variables instead.
54DA
POP AF F1
Pop Register Pair AF, which throws away the text pointer 54BBH pushed, the array having been marked already.
54DB
Jump to 5530H, which reads the empty pair of brackets or the subscript list after the name.
54DD
LD A,(HL) 7E
The marked array not found (54DDH), which 54D3H reaches: load Register A with the byte Register Pair HL addresses, the character the name ended on.
54DE
CP 28H FE 28
Compare Register A with 28H, an opening parenthesis.
54E0
POP DE D1
Pop Register Pair DE, the text pointer 54BBH pushed.
54E1
Jump to 5525H on Z, a parenthesis standing there: the name is an array that is not in the table, and a COMMON of an array that does not exist is not an error.
54E3
PUSH DE D5
Push Register Pair DE, that text pointer again, no parenthesis standing there.
54E4
POP HL E1
A simple variable (54E4H), which 54D8H and 551CH reach: pop Register Pair HL, the text pointer pushed at 54BBH, so that the name is read from its own first character again.
54E5
Call 3AE8H, the look up only wrapper, which this time has 7182H at 00H and so walks the simple variables.
54E8
LD A,D 7A
Load Register A from Register D, the high byte of the address the search gave.
54E9
OR E B3
Or Register A with Register E, its low byte, which sets the Zero Flag when the search gave 0000H and the name is not in the table.
54EA
Jump to 5503H on NZ, the name having been found, which marks it.
54EC
LD A,B 78
Load Register A from Register B, the name's second character, the name not being in the table.
54ED
OR 80H F6 80
Or Register A with 80H, which sets bit 7 of it.
54EF
LD B,A 47
Load Register B from Register A, so that the marked form of the name is what the second search looks for.
54F0
LD DE,54FFH 11 FF 54
Load Register Pair DE with 54FFH, the address this routine is to come back to.
54F3
PUSH DE D5
Push Register Pair DE, that address, which the RET of the wrapper reaches.
54F4
LD DE,3AEBH 11 EB 3A
Load Register Pair DE with 3AEBH, the RET of the look up only wrapper at 3AE8H.
54F7
PUSH DE D5
Push Register Pair DE, that RET, which is what 3AF4H compares against to learn that the caller wants no variable made.
54F8
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type the name's own suffix or the declared type table gave it.
54FB
LD D,A 57
Load Register D from Register A, that type, which is what the walk below compares.
54FC
Jump to 3A8FH, the simple variable walk entered with the name already read, which looks for the marked form of it.
54FF
LD A,D 7A
The second search answered (54FFH), which 54F3H pushed: load Register A from Register D, the high byte of the address it gave.
5500
OR E B3
Or Register A with Register E, its low byte, which sets the Zero Flag when the marked form is not in the table either.
5501
Jump to 5525H on Z, neither form of the name being in the table: a COMMON of a variable that has never been given a value is not an error.
5503
PUSH HL E5
The entry marked (5503H), which 54EAH reaches: push Register Pair HL, the text pointer, which 5524H takes back.
5504
LD B,D 42
Load Register B from Register D, the high byte of the entry's value address.
5505
LD C,E 4B
Load Register C from Register E, its low byte, so that Register Pair BC addresses the value and the walk below can step back from it.
5506
LD HL,5524H 21 24 55
Load Register Pair HL with 5524H, the address the marking is to return to.
5509
PUSH HL E5
Push Register Pair HL, that address, so that the marking below can be reached by a call at 5521H as well as fallen into here.
550A
DEC BC 0B
The mark written (550AH), which 5521H calls: decrement Register Pair BC to the last byte that stands before the value, which is the tail's last character when there is a tail and the tail's length byte when there is none.
550B
LD A,(BC) 0A
The tail walked back (550BH), which 550EH goes back to: load Register A with the byte Register Pair BC addresses.
550C
DEC BC 0B
Decrement Register Pair BC to the byte below it.
550D
OR A B7
Or Register A with itself, which sets the Sign Flag when the byte has bit 7 set, which every character of a tail carries and the tail's own length byte does not.
550E
Jump to 550BH on M, the byte having been a character of the tail, which steps back over the one before it.
5511
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, which is the second character of the name, the byte above it having been the tail's length.
5512
OR 80H F6 80
Or Register A with 80H, which sets bit 7 of that second character.
5514
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, which is the whole of the mark: the entry is now one the ordinary search cannot find, and 5567H and 55AFH are what take the mark off again.
5515
RET C9
Return to the 5524H pushed above, or to 5521H's own caller.
5516
LD (7182H),A 32 82 71
No array of that name (5516H), which 54C4H reaches with Register A holding 00H: store Register A into 7182H, which puts the flag back so that the search below may walk either table.
5519
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the name ended on.
551A
CP 28H FE 28
Compare Register A with 28H, an opening parenthesis.
551C
Jump to 54E4H on NZ, no parenthesis standing there, so that the name is looked up among the simple variables.
551E
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack and brings the address the array search gave into Register Pair HL.
551F
DEC BC 0B
Decrement Register Pair BC to the high byte of the array entry's own length word.
5520
DEC BC 0B
Decrement Register Pair BC to its low byte, so that Register Pair BC stands where the walk at 550AH wants it.
5521
Call 550AH, which walks back over the tail and sets bit 7 of the array's second character.
5524
POP HL E1
The mark done (5524H), which 5509H pushed: pop Register Pair HL, the text pointer pushed at 5503H or left by the exchange at 551EH.
5525
DEC HL 2B
The name read past (5525H), which 54E1H and 5501H reach: decrement Register Pair HL so that the call below reads the character the name ended on.
5526
Call NXTCHAR at 5E93H, which brings that character back in Register A.
5529
Jump to 54A0H on Z, the statement having ended with that name, which weighs the end of the line.
552C
CP 28H FE 28
Compare Register A with 28H, an opening parenthesis, which stands after the name of an array.
552E
Jump to 554CH on NZ, no parenthesis standing there, where a comma is demanded before the next name.
5530
PUSH HL E5
The brackets after an array's name (5530H), which 54DBH reaches: push Register Pair HL, the text pointer, which 5538H or 5544H takes back.
5531
Call NXTCHAR at 5E93H, which steps Register Pair HL past the parenthesis and brings the character after it back in Register A.
5534
CP 29H FE 29
Compare Register A with 29H, a closing parenthesis, which makes the brackets an empty pair.
5536
Jump to 5544H on Z, the brackets being empty, which is how the manual tells a user to name an array in a COMMON.
5538
POP HL E1
Pop Register Pair HL, the text pointer pushed at 5530H, something standing inside the brackets.
5539
Call 74C1H, one term of an expression, which works out whatever was written there and leaves its type in 7142H.
553C
Call 76A4H, the type test, which sets the Zero Flag when the value in the accumulator is a string.
553F
Jump to FUNCERR at 5F95H on Z, error 5, Illegal function call: a subscript inside the brackets of a COMMON may be any number and may not be a string, and the number itself is thrown away.
5542
Jump to 5545H, which demands the closing parenthesis.
5544
POP DE D1
Pop Register Pair DE, the text pointer pushed at 5530H, the brackets having been empty, which throws it away: Register Pair HL already stands after the closing parenthesis.
5545
The closing parenthesis (5545H), which 5542H reaches: call 4353H, the character demand, which insists that the text pointer stands on the character held in the byte after the call.
5548
DEFB 29H 29
5548H: the closing parenthesis 4353H demands, which every bracketed name of a COMMON must end with. It is data read by the routine the call at 5545H reaches, not an instruction, and the instruction after that call is the one at 5549H.
5549
Jump to 54A0H on Z, the demand having left the Zero Flag of a colon or of the 00H that ends the line, so that the list has ended with this name.
554C
Call 4353H again, which insists on the character held in the byte after this call.
554F
DEFB 2CH 2C
554FH: the comma 4353H demands, which is what must stand between two names of a COMMON list. It is data read by the routine the call at 554CH reaches, not an instruction, and the instruction after that call is the one at 5550H.
5550
Jump to 54BBH, which reads the name after that comma.
5553
POP HL E1
The simple variables weighed (5553H), which 5492H reaches: pop Register Pair HL, the number of the line that was running, pushed at 5489H.
5554
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into 6E9CH, which puts that number back, the walk having written every line's own number there in turn.
5557
LD DE,(71A1H) ED 5B A1 71
Load Register Pair DE with the word at 71A1H, the start of the array table, which is where the simple variables end.
555B
LD HL,(719FH) 2A 9F 71
Load Register Pair HL with the word at 719FH, VARTAB, where they begin.
555E
The loop (555EH), which 5576H and 5586H reach: call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the two are equal.
5561
Jump to 55A3H on Z, every simple variable having been weighed, which takes the arrays up.
5563
PUSH HL E5
Push Register Pair HL, the entry's own address, which 5575H takes back into Register Pair BC.
5564
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the entry's type as a count of bytes, which is how wide its value is.
5565
INC HL 23
Increment Register Pair HL to the name's first character.
5566
INC HL 23
Increment Register Pair HL to its second character.
5567
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that second character, whose bit 7 the COMMON walk sets for a name to be kept.
5568
OR A B7
Or Register A with itself, which sets the Sign Flag when the entry carries the mark.
5569
PUSH AF F5
Push Register Pair AF, that Sign Flag, which 5574H takes back once the entry's own length is known.
556A
AND 7FH E6 7F
And Register A with 7FH, which takes the mark off.
556C
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the second character as it was before the walk: every entry is unmarked here whether it is kept or not, so that the search can find it again.
556D
INC HL 23
Increment Register Pair HL to the length of the name's tail.
556E
Call 3CDDH, which steps Register Pair HL over that length prefixed tail and leaves it on the entry's value.
5571
LD B,00H 06 00
Load Register B with 00H, which makes Register Pair BC the type alone.
5573
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps over the value and leaves Register Pair HL on the next entry of the table.
5574
POP AF F1
Pop Register Pair AF, the Sign Flag pushed at 5569H.
5575
POP BC C1
Pop Register Pair BC, the entry's own address, pushed at 5563H.
5576
Jump to 555EH on M, the entry having carried the mark, which keeps it and weighs the next one.
5579
PUSH BC C5
Push Register Pair BC, the entry's address, which 5585H takes back as the place the next entry now stands at.
557A
Call 5588H, which copies everything above the entry down over it and brings LOPT 71A3H down by its length.
557D
LD HL,(71A1H) 2A A1 71
Load Register Pair HL with the word at 71A1H, the start of the array table.
5580
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, Register Pair DE holding the negative of the entry's length, which brings the array table down by exactly that much.
5581
LD (71A1H),HL 22 A1 71
Store Register Pair HL into 71A1H, the array table's new start.
5584
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that new start into Register Pair DE, where the loop above compares it.
5585
POP HL E1
Pop Register Pair HL, the address pushed at 5579H, where the next entry now stands.
5586
Jump to 555EH, which weighs that next entry against the array table's new start.
5588
EX DE,HL EB
An entry thrown away (5588H), which 557AH and 55C4H call with Register Pair BC on the entry and Register Pair HL on the entry after it: exchange Register Pair DE with Register Pair HL, which puts the address of the entry after it into Register Pair DE.
5589
LD HL,(71A3H) 2A A3 71
Load Register Pair HL with the word at 71A3H, LOPT, the byte after the last of the arrays.
558C
The copy loop (558CH), which 5593H goes back to: call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the copy has reached LOPT.
558F
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, one byte of what is to be kept.
5590
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, its new place lower down.
5591
INC DE 13
Increment Register Pair DE to the next byte to be copied.
5592
INC BC 03
Increment Register Pair BC to the next place it goes.
5593
Jump to 558CH on NZ, LOPT not having been reached, which copies the next byte.
5595
LD A,C 79
Load Register A from Register C, the low byte of where the copying ended.
5596
SUB L 95
Subtract Register L from Register A, the low byte of LOPT.
5597
LD E,A 5F
Load Register E from Register A, the low byte of the difference.
5598
LD A,B 78
Load Register A from Register B, the high byte of where the copying ended.
5599
SBC A,H 9C
Subtract Register H from Register A with the Carry Flag, the high byte of LOPT.
559A
LD D,A 57
Load Register D from Register A, so that Register Pair DE is that difference, which is the negative of the entry's length.
559B
DEC DE 1B
Decrement Register Pair DE, the copy having run one byte past LOPT before the test stopped it.
559C
DEC BC 0B
Decrement Register Pair BC for the same reason.
559D
LD H,B 60
Load Register H from Register B, the high byte of the new end.
559E
LD L,C 69
Load Register L from Register C, its low byte.
559F
LD (71A3H),HL 22 A3 71
Store Register Pair HL into 71A3H, LOPT, which is that much lower than it was.
55A2
RET C9
Return with Register Pair DE holding the negative of the entry's length, which 5580H adds to the array table's start.
55A3
LD DE,(71A3H) ED 5B A3 71
The arrays weighed (55A3H), which 5561H reaches: load Register Pair DE with the word at 71A3H, LOPT, where the arrays end.
55A7
The loop (55A7H), which 55C0H and 55C9H reach: call 434DH, which sets the Zero Flag when Register Pair HL has reached LOPT.
55AA
Jump to 55CBH on Z, every array having been weighed, which takes the strings up.
55AC
PUSH HL E5
Push Register Pair HL, the entry's own address, which 55BFH takes back into Register Pair BC.
55AD
INC HL 23
Increment Register Pair HL to the name's first character.
55AE
INC HL 23
Increment Register Pair HL to its second character.
55AF
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that second character.
55B0
OR A B7
Or Register A with itself, which sets the Sign Flag when the entry carries the mark.
55B1
PUSH AF F5
Push Register Pair AF, that Sign Flag, which 55BEH takes back.
55B2
AND 7FH E6 7F
And Register A with 7FH, which takes the mark off.
55B4
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the second character as the search will want it.
55B5
INC HL 23
Increment Register Pair HL to the length of the name's tail.
55B6
Call 3CDDH, which steps Register Pair HL over that tail and leaves it on the entry's own length word.
55B9
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of that length.
55BA
INC HL 23
Increment Register Pair HL to the high byte of that length word.
55BB
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC is the whole length of the entry from here on.
55BC
INC HL 23
Increment Register Pair HL past that length word, on to the count of dimensions.
55BD
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which lands Register Pair HL on the next entry of the array table.
55BE
POP AF F1
Pop Register Pair AF, the Sign Flag pushed at 55B1H.
55BF
POP BC C1
Pop Register Pair BC, the entry's own address, pushed at 55ACH.
55C0
Jump to 55A7H on M, the array having carried the mark, which keeps it and weighs the next one.
55C3
PUSH BC C5
Push Register Pair BC, the entry's address, which 55C8H takes back.
55C4
Call 5588H, which copies everything above the array down over it and brings LOPT 71A3H down by its length.
55C7
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the new LOPT into Register Pair DE, where the loop above compares it, the arrays needing no second pointer brought down as the simple variables did.
55C8
POP HL E1
Pop Register Pair HL, the address pushed at 55C3H, where the next array now stands.
55C9
Jump to 55A7H, which weighs that next array against the new LOPT.
55CB
LD HL,(719FH) 2A 9F 71
The strings of the simple variables (55CBH), which the parse jumps to at 544FH and 5483H for an ALL and which 55AAH reaches otherwise: load Register Pair HL with the word at 719FH, VARTAB, where the simple variables begin.
55CE
LD DE,(71A1H) ED 5B A1 71
The loop (55CEH), which 55E4H goes back to: load Register Pair DE with the word at 71A1H, where they end.
55D2
Call 434DH, which sets the Zero Flag when every simple variable has been looked at.
55D5
Jump to 55E7H on Z, which takes the arrays up.
55D7
Call 56ECH, which reads the entry's type into Register A, steps Register Pair HL over the three bytes of its head and over its tail, and sets the Zero Flag when the type is 03H and the value a string.
55DA
Jump to 55E0H on NZ, the value not being a string and so holding no address that could point into the program text.
55DC
Call 5616H, which copies the string's characters into string space when they still lie between PGMBGN 6E9EH and VARTAB 719FH, and leaves Register Pair HL past the three byte descriptor.
55DF
XOR A AF
Clear Register A to 00H, so that the step below adds nothing, 5616H having stepped over the descriptor itself.
55E0
LD E,A 5F
The next entry (55E0H), which 55DAH reaches: load Register E from Register A, the type as a count of bytes, or 00H for a string already stepped over.
55E1
LD D,00H 16 00
Load Register D with 00H, which makes Register Pair DE that count alone.
55E3
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which steps over the value and lands on the next entry.
55E4
Jump to 55CEH, which weighs that next entry against the start of the array table.
55E6
POP BC C1
Pop Register Pair BC, which throws away the address 55F9H pushed, the array not being one of strings: this byte is reached only by the jump at 55FDH, the instruction above it being an unconditional one.
55E7
LD DE,(71A3H) ED 5B A3 71
The strings of the arrays (55E7H), which 55D5H and 5610H reach: load Register Pair DE with the word at 71A3H, LOPT, where the arrays end.
55EB
Call 434DH, which sets the Zero Flag when every array has been looked at.
55EE
Jump to 5640H on Z, which moves the variables out of the program's way.
55F0
Call 56ECH, which reads the entry's type into Register A and steps Register Pair HL over its head and its tail on to its own length word.
55F3
PUSH AF F5
Push Register Pair AF, that type, which 55F8H takes back once the length word has been read.
55F4
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the entry's length from here on.
55F5
INC HL 23
Increment Register Pair HL to the high byte of that length word.
55F6
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC is that length.
55F7
INC HL 23
Increment Register Pair HL past the length word, on to the count of dimensions.
55F8
POP AF F1
Pop Register Pair AF, the type pushed at 55F3H.
55F9
PUSH HL E5
Push Register Pair HL, the address of that count, which 5602H takes back and 55E6H throws away.
55FA
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which lands Register Pair HL on the next entry of the table.
55FB
CP 03H FE 03
Compare Register A with 03H, the type of a string.
55FD
Jump to 55E6H on NZ, the array not being one of strings, which throws the pushed address away and weighs the next entry.
55FF
LD (717AH),HL 22 7A 71
Store Register Pair HL into 717AH, the byte after this array's last element, which is a second use of a cell the array maker owns.
5602
POP HL E1
Pop Register Pair HL, the address of the count of dimensions, pushed at 55F9H.
5603
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, that count.
5604
LD B,00H 06 00
Load Register B with 00H, which makes Register Pair BC the count alone.
5606
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps one byte for each dimension.
5607
ADD HL,BC 09
Add Register Pair BC to Register Pair HL again, which steps the second byte of each, the bounds being words.
5608
INC HL 23
Increment Register Pair HL past the count byte itself, so that Register Pair HL stands on the first element.
5609
LD DE,(717AH) ED 5B 7A 71
The element loop (5609H), which 5612H pushes as the return of the mover below: load Register Pair DE with the word at 717AH, the byte after the last element.
560D
Call 434DH, which sets the Zero Flag when every element has been looked at.
5610
Jump to 55E7H on Z, this array being done, which takes the next one.
5612
LD BC,5609H 01 09 56
Load Register Pair BC with 5609H, the head of this loop.
5615
PUSH BC C5
Push Register Pair BC, that address, so that the mover below returns here for the next element.
5616
LD A,(HL) 7E
A string copied into string space (5616H), which 55DCH calls and 5615H pushes a return for: load Register A with the byte Register Pair HL addresses, the descriptor's length byte.
5617
INC HL 23
Increment Register Pair HL to the low byte of the descriptor's address word.
5618
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, that low byte.
5619
INC HL 23
Increment Register Pair HL to the high byte of the descriptor's address word.
561A
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE is where the string's characters stand.
561B
INC HL 23
Increment Register Pair HL past the descriptor, which is where the caller wants Register Pair HL whichever way this routine goes.
561C
OR A B7
Or Register A with itself, which sets the Zero Flag for a string of no characters.
561D
RET Z C8
Return on Z, an empty string having no characters to move.
561E
PUSH HL E5
Push Register Pair HL, the pointer past the descriptor, which 5625H takes back.
561F
LD HL,(719FH) 2A 9F 71
Load Register Pair HL with the word at 719FH, VARTAB, the byte after the last of the program text.
5622
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Carry Flag when the characters stand above VARTAB.
5625
POP HL E1
Pop Register Pair HL, the pointer pushed at 561EH.
5626
RET C D8
Return on C, the characters standing above the program text and so in string space already, where the program about to be loaded cannot reach them.
5627
PUSH HL E5
Push Register Pair HL, that pointer again, which 562EH takes back.
5628
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL with the word at 6E9EH, PGMBGN, the first byte of the program text.
562B
Call 434DH, which sets the Carry Flag when the characters stand above PGMBGN.
562E
POP HL E1
Pop Register Pair HL, the pointer pushed at 5627H.
562F
RET NC D0
Return on NC, the characters standing at or below the start of the program text, which puts them in the line buffer or in a record buffer and out of harm's way.
5630
PUSH HL E5
Push Register Pair HL, the pointer past the descriptor, which 563EH takes back: the characters lie inside the program text and must be copied out of it.
5631
DEC HL 2B
Decrement Register Pair HL to the high byte of the descriptor's address word.
5632
DEC HL 2B
Decrement Register Pair HL to the low byte of that address word.
5633
DEC HL 2B
Decrement Register Pair HL to the descriptor's length byte, which is where the copy below wants it.
5634
PUSH HL E5
Push Register Pair HL, the descriptor's own address, which 5638H takes back.
5635
Call 462BH, the copy into string space, which takes as many bytes of string space as the descriptor's length asks for, copies the characters into them and builds a new descriptor at 7175H, leaving its address in Register Pair DE.
5638
POP HL E1
Pop Register Pair HL, the descriptor's own address, pushed at 5634H.
5639
LD B,03H 06 03
Load Register B with 03H, the three bytes of a string descriptor.
563B
Call 294AH of BASIC/OV1, the block mover, which copies those three bytes from the address in Register Pair DE to the address in Register Pair HL, so that the variable now points into string space.
563E
POP HL E1
Pop Register Pair HL, the pointer past the descriptor, pushed at 5630H.
563F
RET C9
Return with the string out of the program text and Register Pair HL where the caller left it.
5640
The variables moved out of the way (5640H), which 55EEH reaches: call 46E7H, the string space collection, which throws away every string nothing points at and packs the rest against the top of memory.
5643
LD HL,(71A3H) 2A A3 71
Load Register Pair HL with the word at 71A3H, LOPT, the byte after the last of the arrays.
5646
LD B,H 44
Load Register B from Register H, the high byte of it.
5647
LD C,L 4D
Load Register C from Register L, its low byte, so that Register Pair BC is where the block to be moved ends.
5648
LD DE,(719FH) ED 5B 9F 71
Load Register Pair DE with the word at 719FH, VARTAB, where it begins.
564C
LD HL,(71A1H) 2A A1 71
Load Register Pair HL with the word at 71A1H, the start of the array table.
564F
OR A B7
Or Register A with itself, which clears the Carry Flag for the subtraction below.
5650
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL with the Carry Flag, which leaves the length of the simple variables in Register Pair HL.
5652
LD (7295H),HL 22 95 72
Store Register Pair HL into 7295H, that length, which 56AEH reads to put the array table back where it belongs: this is a second use of a cell the string space collection owns.
5655
LD HL,(7178H) 2A 78 71
Load Register Pair HL with the word at 7178H, HIPT, the byte below the string area.
5658
LD (72C7H),HL 22 C7 72
Store Register Pair HL into 72C7H, where it waits until 56BAH puts it back.
565B
Call 423AH, the move, which exchanges Register Pair HL with Register Pair BC and then copies from LOPT down to VARTAB writing from HIPT down, so that the whole of the variables and arrays comes to rest with its top byte at the old HIPT and the program text below it may be read over.
565E
LD H,B 60
Load Register H from Register B, the high byte of the lowest place the move wrote.
565F
LD L,C 69
Load Register L from Register C, its low byte.
5660
DEC HL 2B
Decrement Register Pair HL to the byte below the moved block.
5661
LD (7178H),HL 22 78 71
Store Register Pair HL into 7178H, HIPT, so that nothing takes string space from under the variables while the new program is read in.
5664
LD A,(72CDH) 3A CD 72
Load Register A with the byte at 72CDH, the flag the parse sets when a DELETE range was given.
5667
OR A B7
Or Register A with itself, which sets the Zero Flag when no DELETE was asked for.
5668
Jump to 567EH on Z, no DELETE range having been given and no lines being taken out.
566A
LD HL,(72D0H) 2A D0 72
Load Register Pair HL with the word at 72D0H, the address of the first line of the range the parse found.
566D
LD B,H 44
Load Register B from Register H, the high byte of it.
566E
LD C,L 4D
Load Register C from Register L, its low byte, so that Register Pair BC is where the deleted lines begin.
566F
LD HL,(72CEH) 2A CE 72
Load Register Pair HL with the word at 72CEH, the address after the last line of the range.
5672
Call 7C15H, the block mover, which copies the program text from there down over the deleted lines and brings 719FH, 71A1H and 71A3H down to the new end, leaving that end in Register Pair HL.
5675
LD (71A1H),HL 22 A1 71
Store Register Pair HL into 71A1H, the start of the array table, which 7C15H has already written and which is written again here for nothing.
5678
LD (71A3H),HL 22 A3 71
Store Register Pair HL into 71A3H, LOPT, which 7C15H has also already written.
567B
Call 5A6EH, which walks the shortened program and writes every line's link again.
567E
LD A,01H 3E 01
The load begun (567EH), which 5668H reaches: load Register A with 01H, the value that says a chain is in hand.
5680
LD (72D2H),A 32 D2 72
Store Register A into 72D2H, which 4CBCH of LOAD tests and 41B7H reads, and which is what sends the end of the load to 5693H below instead of to Ready.
5683
LD A,(72CCH) 3A CC 72
Load Register A with the byte at 72CCH, the MERGE flag the parse sets for a CHAIN MERGE.
5686
OR A B7
Or Register A with itself, which sets the Zero Flag when the program is to be loaded and not merged.
5687
Jump to 4CEFH on NZ, a merge being asked for, which is MERGE's own path through the load code.
568A
LD A,(6ECEH) 3A CE 6E
Load Register A with the byte at 6ECEH, the count of file buffers.
568D
LD (6EA9H),A 32 A9 6E
Store Register A into 6EA9H, where the end of the load puts it back from at 41CFH, so that the clearing the load does closes no file.
5690
Jump to 4C3EH, LOAD's own code with the file already open, which reads the new program in over the old one.
5693
The program loaded (5693H), which 41B7H and 4CC0H jump to when 72D2H says a chain is in hand: call 8017H, which carries the protected program flag over from the file just read.
5696
LD A,(72A5H) 3A A5 72
Load Register A with the byte at 72A5H, the OPTION BASE value the parse put aside at 5401H.
5699
LD (72A3H),A 32 A3 72
Store Register A into 72A3H, the OPTION BASE in force, which the clearing the load did had set back to 00H.
569C
LD A,(72A6H) 3A A6 72
Load Register A with the byte at 72A6H, the flag that says an OPTION BASE was given, put aside with it.
569F
LD (72A4H),A 32 A4 72
Store Register A into 72A4H, that flag, so that the chained program may not set an OPTION BASE of its own.
56A2
XOR A AF
Clear Register A to 00H, the value both flags below are given.
56A3
LD (72D2H),A 32 D2 72
Store Register A into 72D2H, which says that no chain is in hand any longer.
56A6
LD (72CCH),A 32 CC 72
Store Register A into 72CCH, the MERGE flag, which the next CHAIN sets for itself.
56A9
LD HL,(719FH) 2A 9F 71
Load Register Pair HL with the word at 719FH, VARTAB, which the new program's own length has moved.
56AC
LD B,H 44
Load Register B from Register H, the high byte of it.
56AD
LD C,L 4D
Load Register C from Register L, its low byte, so that Register Pair BC is where the variables are to go.
56AE
LD HL,(7295H) 2A 95 72
Load Register Pair HL with the word at 7295H, the length of the simple variables 5652H put aside.
56B1
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which gives the address the array table is to begin at.
56B2
LD (71A1H),HL 22 A1 71
Store Register Pair HL into 71A1H, the start of the array table.
56B5
LD HL,(7178H) 2A 78 71
Load Register Pair HL with the word at 7178H, the HIPT 5661H left below the moved block.
56B8
INC HL 23
Increment Register Pair HL to the block's own lowest byte.
56B9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE as the place the copy below reads from.
56BA
LD HL,(72C7H) 2A C7 72
Load Register Pair HL with the word at 72C7H, the HIPT 5658H put aside.
56BD
LD (7178H),HL 22 78 71
Store Register Pair HL into 7178H, which puts the string area's own boundary back where it was before the move.
56C0
The variables copied back (56C0H), which 56C7H goes back to: call 434DH, which sets the Zero Flag when Register Pair DE has reached that old HIPT and the whole block has been copied.
56C3
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, one byte of the block.
56C4
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, its place above the new program.
56C5
INC DE 13
Increment Register Pair DE to the next byte of the block.
56C6
INC BC 03
Increment Register Pair BC to the next place it goes.
56C7
Jump to 56C0H on NZ, the block not having been copied whole.
56C9
DEC BC 0B
Decrement Register Pair BC, the copy having run one byte past the end before the test stopped it.
56CA
LD H,B 60
Load Register H from Register B, the high byte of where it ended.
56CB
LD L,C 69
Load Register L from Register C, its low byte.
56CC
LD (71A3H),HL 22 A3 71
Store Register Pair HL into 71A3H, LOPT, the byte after the last of the arrays in their new place.
56CF
XOR A AF
Clear Register A to 00H, the value RESTORE wants in Register A for a restore to the first line of the program.
56D0
Call 4365H, RESTORE, which puts the DATA pointer at 71A5H back to the start of the new program.
56D3
LD DE,(72D3H) ED 5B D3 72
Load Register Pair DE with the word at 72D3H, the line number the CHAIN named, which the parse leaves 0000H when none was given.
56D7
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL with the word at 6E9EH, PGMBGN, the first byte of the new program.
56DA
DEC HL 2B
Decrement Register Pair HL, which is where the statement loop wants the pointer when it is to take the first line of the program.
56DB
LD A,D 7A
Load Register A from Register D, the high byte of that line number.
56DC
OR E B3
Or Register A with Register E, its low byte, which sets the Zero Flag when no line was named.
56DD
Jump to 5E3BH on Z, the statement loop, which runs the new program from its first line.
56E0
Call FIND at 5AB4H, which sets the Carry Flag only when a line of exactly that number stands in the new program and leaves its address in Register Pair BC.
56E3
Jump to 6040H on NC, error 8, Undefined line number: the line a CHAIN names must exist in the program it loads.
56E6
DEC BC 0B
Decrement Register Pair BC to the byte below that line, which is where the statement loop wants the pointer.
56E7
LD H,B 60
Load Register H from Register B, the high byte of it.
56E8
LD L,C 69
Load Register L from Register C, its low byte.
56E9
Jump to 5E3BH, the statement loop, which runs the new program from the line the CHAIN named.
56EC
LD A,(HL) 7E
An entry's type and its head stepped over (56ECH), which 55D7H and 55F0H call: load Register A with the byte Register Pair HL addresses, the entry's type as a count of bytes.
56ED
INC HL 23
Increment Register Pair HL to the name's first character.
56EE
INC HL 23
Increment Register Pair HL to its second character.
56EF
INC HL 23
Increment Register Pair HL to the length of its tail.
56F0
PUSH AF F5
Push Register Pair AF, that type, which 56F4H takes back, the call below working in Register A.
56F1
Call 3CDDH, which steps Register Pair HL over the length prefixed tail and leaves it on the entry's value or on its length word.
56F4
POP AF F1
Pop Register Pair AF, the type pushed at 56F0H.
56F5
CP 03H FE 03
Compare Register A with 03H, the type of a string.
56F7
RET C9
Return with that type in Register A and the Zero Flag set when the entry holds a string.
56F8-56FA
DEFB 0C3H, 65H, 60H C3 65 60
56F8H to 56FAH: three bytes reached by nothing. As an instruction they are a jump to 6065H, the statement skipper's DATA entry, which would have run the text pointer on to the end of a statement. No instruction of the three files branches here, no relative jump reaches them and no word anywhere in the three images holds one of their addresses.

56FBH - WRITE: Write Items to the Display or to a Sequential File, Comma Separated (56FBH-5758H)

WRITE writes its list of items the way a comma delimited data file wants them, and the BASIC Reference Manual's page for it lists three differences from PRINT, every one of which is a piece of this code. **Omitting the item list sends an ENTER**, which is the jump at 5704H to the carriage return at 5753H. **A positive number is not preceded by a blank**, which is what 5715H to 5726H do: the number conversion at 3147H always lays a blank or a minus sign in the first byte of its text, so WRITE reads the descriptor the conversion left, and when that byte is a blank it steps the text address past it and takes one off the length. **Strings are automatically enclosed by quotes**, which is 5744H to 5751H. Between every pair of items a comma is written, and the last item is followed by the ENTER. Two things the manual's page does not say. The statement takes **a semicolon as a separator exactly as it takes a comma** (the test at 5731H) and writes a comma either way, where in PRINT the two mean different things; and the file number form insists on the mode the file was opened in, Register C being loaded with 02H at 56FBH and the reader at 4A81H giving error 54, Bad file mode, for anything else, so a file opened for input or at random is refused while one opened to extend is taken, 511CH having recorded an extend open as mode 02H. Nothing in the statement examines the characters of a string, so a quote inside one is written as it stands and the line it makes cannot be read back by an INPUT of the same file.

56FB
LD C,02H 0E 02
WRITE (56FBH), the routine the statement address table holds for token 0B7H at 682FH: load Register C with 02H, the output file mode, which is the only mode this statement writes to and what the file number reader below weighs the file's own mode against.
56FD
Call 4A81H, the file number reader PRINT shares at 6215H, which returns at once unless the character in Register A is 23H, a number sign, and otherwise works the number out, looks the file up, gives error 54 through 5841H when the mode is not the one Register C holds, insists on the comma after it, and sets FILEX 6E98H to the file control block.
5700
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on rather than the one beyond it, whether or not 4A81H took a file number off the line.
5701
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended there, at a colon 3AH or at the 00H that ends the line.
5704
Jump to 5753H on Z, the item list being empty: a WRITE with nothing after it sends an ENTER and no more, which is what 5753H writes.
5706
The turn of the item list (5706H): call the expression evaluator at 7345H, which works this item out and leaves its value in the accumulator at 72ECH.
5709
PUSH HL E5
Push Register Pair HL, the text pointer standing after this item, which the POP HL at 572AH brings back once the item has been written.
570A
Call 76A4H, which reads the type of the value in hand out of 7142H and returns it in Register A less 03H, so that the Zero Flag is set for a string and reset for a number of any precision.
570D
Jump to 5744H on Z, the item being a string, which is written between quotes instead of being converted.
570F
Call 3147H, which converts the number in the accumulator to text at 72FEH and ends it with a 00H byte, laying a blank in the first byte for a positive value and 2DH, a minus sign, for a negative one.
5712
Call 464FH, which measures that 00H ended text, builds a string descriptor for it in the three bytes at 7175H, copies the descriptor into a temporary slot below 7178H and makes it the accumulator's string at 72ECH with type 03H at 7142H.
5715
LD HL,(72ECH) 2A EC 72
Load Register Pair HL from the word at 72ECH, the address of the descriptor the converted number now has, so that its three bytes can be altered below.
5718
INC HL 23
Increment Register Pair HL to step over the descriptor's length byte and onto the low byte of its text address.
5719
LD E,(HL) 5E
Load Register E from the byte Register Pair HL addresses, the low byte of the address of the converted number's first character.
571A
INC HL 23
Increment Register Pair HL onto the high byte of that address.
571B
LD D,(HL) 56
Load Register D from the byte Register Pair HL addresses, so that Register Pair DE now holds the address of the text while Register Pair HL stands on the descriptor's third byte.
571C
LD A,(DE) 1A
Load Register A with the byte at the address Register Pair DE holds, the first character of the converted number, which the conversion made a blank for a positive value and a minus sign for a negative one.
571D
CP 20H FE 20
Compare Register A with 20H, a blank, which is the character WRITE has to take off: the manual's own words are that contrary to PRINT positive numbers are not preceded by a blank.
571F
Jump to 5727H on NZ, the first character being a minus sign and so part of the number, which is written exactly as the conversion left it.
5721
INC DE 13
Increment Register Pair DE past the blank, so that the text of the number begins at its first digit.
5722
LD (HL),D 72
Store Register D into the byte Register Pair HL addresses, the high byte of the descriptor's text address, which now points past the blank.
5723
DEC HL 2B
Decrement Register Pair HL back onto the low byte of that address.
5724
LD (HL),E 73
Store Register E into the byte Register Pair HL addresses, which finishes writing the shortened text's address into the descriptor.
5725
DEC HL 2B
Decrement Register Pair HL onto the descriptor's length byte, the last of the three the step past the blank alters.
5726
DEC (HL) 35
Decrement the byte Register Pair HL addresses, the length, which is one character shorter now that the blank is no longer part of the string.
5727
Call 46A8H, which takes the string out of the accumulator at 72ECH and writes it a character at a time through 40D8H, to the file when FILEX 6E98H is set and to the display when it is not.
572A
POP HL E1
The separator (572AH), which the number path and the string path both reach: pop Register Pair HL, the text pointer standing after the item, pushed at 5709H.
572B
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on rather than the one beyond it.
572C
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended with the item just written.
572F
Jump to 5753H on Z, the list having ended: the ENTER at 5753H follows the last item, which is why only the items before it carry a comma.
5731
CP 3BH FE 3B
Compare Register A with 3BH, a semicolon, which this statement takes as a separator as readily as a comma although the manual's page names the comma alone.
5733
Jump to 573AH on Z, the separator being a semicolon, which the NXTCHAR there steps over.
5735
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call, gives Syntax error at 4362H when it is not, and brings the character after it back in Register A.
5738
DEFB 2CH 2C
The comma that 4353H compares the line's character with. It is read as data by the routine the call at 5735H reaches, not executed, and the instruction after that call is the one at 5739H.
5739
DEC HL 2B
Decrement Register Pair HL so that the NXTCHAR below gives back the character 4353H has already stepped to, which is what brings the comma path and the semicolon path onto the same character.
573A
Call NXTCHAR at 5E93H, which steps past the semicolon on that path and reads the character after the comma again on this one, leaving the text pointer at the next item of the list.
573D
LD A,2CH 3E 2C
Load Register A with 2CH, a comma, which is written between every pair of items whichever of the two separators the line carried.
573F
Call 40D8H, which writes that comma to the file when FILEX 6E98H is set and to the display when it is not, and which is what saves a program from writing its own delimiters.
5742
Jump to 5706H to work the next item out, so that every item but the last is followed by a comma, as the manual's page says.
5744
LD A,22H 3E 22
The string item (5744H), reached from 570DH: load Register A with 22H, a quote, which encloses every string this statement writes.
5746
Call 40D8H to write that opening quote, to the file when FILEX 6E98H is set and to the display when it is not.
5749
Call 46A8H, which writes the string in the accumulator at 72ECH a character at a time with nothing examined and nothing escaped, so that a quote inside the string is written as it stands.
574C
LD A,22H 3E 22
Load Register A with 22H again, the quote that is to close the string just written.
574E
Call 40D8H to write that closing quote, which is the whole of what the manual means by strings being automatically enclosed by quotes.
5751
Jump to 572AH, the separator, which the two item paths share and where the text pointer comes back off the stack.
5753
The end of the statement (5753H): call 41F5H, which writes 0DH through 40D8H and so sends the ENTER that follows the last item, or that stands alone when the list was empty.
5756
Jump to 634BH, which clears the printer flag at 6E92H and both bytes of FILEX 6E98H so that the next statement writes to the display again, and whose own RET returns to the statement loop at 5E3BH the dispatcher pushed.

5759H - The Protected Program, the Stack Frame Search and the End of the Program (5759H-5840H)

Two hundred and thirty-two bytes that hold four unrelated things, and the first of them is the only piece of this interpreter written to keep a secret. 5759H is the protected SAVE, which 4D59H reaches for the P of SAVE "name",P: it scrambles the whole of the program text, writes it out with 0FEH as the file's first byte and unscrambles it again, so that the diskette holds a program nobody can LIST. 5770H is the scrambler and 57A7H the unscrambler, which 4C9FH of LOAD also calls when it meets that 0FEH. The two of them key off the coefficient tables of the transcendental functions, 3978H for the sine series and 39C8H for the arctangent series, reading one byte of each per byte of program: there is no key anywhere in the file and the numbers that work out a sine are the numbers that hide a program. 57DFH and 57E8H are the two guards that refuse a command when the program in memory came in that way. 57F6H is the search that walks the stack for a FOR frame or a GOSUB frame, which NEXT calls at 453AH and RETURN at 6048H. And 5827H is where a program that has run off its last line ends. Three runs of these bytes are reached by nothing: 57F2H to 57F5H, 5821H to 5826H, and the two error chain entries at 583BH and 583EH, which are the entries for Disk full and for Device I/O error and which nothing needs because DERR's own table at 529FH answers with those two error numbers directly.

5759
The protected SAVE (5759H), which 4D59H jumps to for the P of a SAVE: call NXTCHAR at 5E93H, which steps Register Pair HL past the P and leaves the character after it in Register A.
575C
LD (7184H),HL 22 84 71
Store Register Pair HL, that text pointer, into 7184H, where the system call below will find it again and where 4349H reads it back.
575F
Call NORMNUM at 661EH, which walks the program text and turns every resolved line reference back into a line number, so that what is written out holds numbers and not the addresses this run of the interpreter happened to give them.
5762
Call 5770H, the scrambler, which rewrites every byte of the program text in place.
5765
LD A,0FEH 3E FE
Load Register A with 0FEH, the byte that marks a protected program, where a plain tokenized one carries 0FFH.
5767
Call 4D6CH, the three instructions the plain SAVE uses as well, which write that marker to the file and then the whole of the text after it.
576A
Call 57A7H, the unscrambler, which puts the program text back as it was: the scrambling lasts only as long as the write, and the copy in memory is readable again the moment it is over.
576D
Jump to 4349H, which loads Register Pair HL from 7184H, the text pointer 575CH put there, and returns to the statement loop with it.
5770
LD BC,0D0BH 01 0B 0D
The scrambler (5770H), which 5762H calls: load Register Pair BC with 0D0BH, Register B of 0DH and Register C of 0BH, the two counters the keys are indexed by, which are thirteen and eleven and have no factor in common, so the pattern they make together runs a hundred and forty-three bytes before it repeats.
5773
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL with the word at 6E9EH, PGMBGN, the first byte of the program text.
5776
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE, where the loop below keeps it.
5777
LD HL,(719FH) 2A 9F 71
The scrambling loop (5777H), which 57A1H and 57A5H go back to: load Register Pair HL with the word at 719FH, VARTAB, the byte after the last of the program text.
577A
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the two are equal.
577D
RET Z C8
Return on Z, the whole of the program text having been scrambled.
577E
LD HL,39C8H 21 C8 39
Load Register Pair HL with 39C8H, the count byte of the arctangent series, whose coefficients stand above it and are the first of the two key tables.
5781
LD A,L 7D
Load Register A from Register L, the low byte of 39C8H.
5782
ADD A,C 81
Add Register C to Register A, the first counter, so that Register A is the low byte of the key byte's address.
5783
LD L,A 6F
Load Register L from Register A, that low byte.
5784
LD A,H 7C
Load Register A from Register H, the high byte of 39C8H.
5785
ADC A,00H CE 00
Add 00H to Register A with the Carry Flag, which carries the addition into the high byte.
5787
LD H,A 67
Load Register H from Register A, so that Register Pair HL addresses the key byte, which stands between 39C9H and 39D3H as Register C runs from 01H to 0BH.
5788
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the byte of the program text that is to be scrambled.
5789
SUB B 90
Subtract Register B from Register A, the second counter, which is the first of the three operations and is undone last by 57CFH.
578A
XOR (HL) AE
Exclusive Or Register A with the byte Register Pair HL addresses, the arctangent key byte.
578B
PUSH AF F5
Push Register Pair AF, that part scrambled byte, so that Register Pair HL can be loaded again for the second key.
578C
LD HL,3978H 21 78 39
Load Register Pair HL with 3978H, the count byte of the sine series, whose coefficients are the second key table.
578F
LD A,L 7D
Load Register A from Register L, the low byte of 3978H.
5790
ADD A,B 80
Add Register B to Register A, the second counter, so that Register A is the low byte of the second key byte's address.
5791
LD L,A 6F
Load Register L from Register A, that low byte.
5792
LD A,H 7C
Load Register A from Register H, the high byte of 3978H.
5793
ADC A,00H CE 00
Add 00H to Register A with the Carry Flag, which carries into the high byte.
5795
LD H,A 67
Load Register H from Register A, so that Register Pair HL addresses the second key byte, which stands between 3979H and 3985H as Register B runs from 01H to 0DH.
5796
POP AF F1
Pop Register Pair AF, the part scrambled byte 578BH pushed.
5797
XOR (HL) AE
Exclusive Or Register A with the byte Register Pair HL addresses, the sine key byte.
5798
ADD A,C 81
Add Register C to Register A, the first counter, which is the last of the three operations and is undone first by 57BFH.
5799
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, the scrambled byte in the place the plain one stood.
579A
INC DE 13
Increment Register Pair DE to the next byte of the program text.
579B
DEC C 0D
Decrement Register C, the first counter, which the key table at 39C8H is indexed by.
579C
Jump to 57A0H on NZ, Register C not having run out.
579E
LD C,0BH 0E 0B
Load Register C with 0BH, eleven, which starts that counter again.
57A0
DEC B 05
The second counter stepped (57A0H), which 579CH reaches: decrement Register B, which happens for every byte whether Register C wrapped or not.
57A1
Jump to 5777H on NZ, Register B not having run out, which takes the next byte of the text.
57A3
LD B,0DH 06 0D
Load Register B with 0DH, thirteen, which starts that counter again.
57A5
Jump to 5777H, which takes the next byte of the text with both counters begun afresh.
57A7
LD BC,0D0BH 01 0B 0D
The unscrambler (57A7H), which 576AH calls after the write and which LOAD calls at 4C9FH when the file's first byte was 0FEH: load Register Pair BC with 0D0BH, the same two counters at thirteen and eleven.
57AA
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL with the word at 6E9EH, PGMBGN, the first byte of the program text.
57AD
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE.
57AE
LD HL,(719FH) 2A 9F 71
The unscrambling loop (57AEH), which 57D8H and 57DDH go back to: load Register Pair HL with the word at 719FH, VARTAB, the byte after the last of the text.
57B1
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the two are equal.
57B4
RET Z C8
Return on Z, the whole of the program text having been put back.
57B5
LD HL,3978H 21 78 39
Load Register Pair HL with 3978H, the sine series, which this routine reaches for first because it undoes the scrambler's operations in the reverse order.
57B8
LD A,L 7D
Load Register A from Register L, the low byte of 3978H.
57B9
ADD A,B 80
Add Register B to Register A, the second counter.
57BA
LD L,A 6F
Load Register L from Register A, that low byte.
57BB
LD A,H 7C
Load Register A from Register H, the high byte of 3978H.
57BC
ADC A,00H CE 00
Add 00H to Register A with the Carry Flag, which carries into the high byte.
57BE
LD H,A 67
Load Register H from Register A, so that Register Pair HL addresses the sine key byte for this byte of the text.
57BF
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the scrambled byte.
57C0
SUB C 91
Subtract Register C from Register A, the first counter, which undoes the addition 5798H made.
57C1
XOR (HL) AE
Exclusive Or Register A with the byte Register Pair HL addresses, the sine key byte, which undoes 5797H.
57C2
PUSH AF F5
Push Register Pair AF, that part unscrambled byte.
57C3
LD HL,39C8H 21 C8 39
Load Register Pair HL with 39C8H, the arctangent series, the second key table on the way back.
57C6
LD A,L 7D
Load Register A from Register L, the low byte of 39C8H.
57C7
ADD A,C 81
Add Register C to Register A, the first counter.
57C8
LD L,A 6F
Load Register L from Register A, that low byte.
57C9
LD A,H 7C
Load Register A from Register H, the high byte of 39C8H.
57CA
ADC A,00H CE 00
Add 00H to Register A with the Carry Flag, which carries into the high byte.
57CC
LD H,A 67
Load Register H from Register A, so that Register Pair HL addresses the arctangent key byte.
57CD
POP AF F1
Pop Register Pair AF, the part unscrambled byte 57C2H pushed.
57CE
XOR (HL) AE
Exclusive Or Register A with the byte Register Pair HL addresses, which undoes 578AH.
57CF
ADD A,B 80
Add Register B to Register A, the second counter, which undoes the subtraction 5789H made and leaves the plain byte.
57D0
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, the plain byte in the place the scrambled one stood.
57D1
INC DE 13
Increment Register Pair DE to the next byte of the program text.
57D2
DEC C 0D
Decrement Register C, the first counter, which the key table at 39C8H is indexed by.
57D3
Jump to 57D7H on NZ, Register C not having run out.
57D5
LD C,0BH 0E 0B
Load Register C with 0BH, eleven, which starts that counter again.
57D7
DEC B 05
The second counter stepped (57D7H), which 57D3H reaches: decrement Register B.
57D8
Jump to 57AEH on NZ, Register B not having run out, which takes the next byte of the text.
57DB
LD B,0DH 06 0D
Load Register B with 0DH, thirteen, which starts that counter again.
57DD
Jump to 57AEH, which takes the next byte with both counters begun afresh.
57DF
PUSH HL E5
The protected program guard at command level only (57DFH), which 535AH of CLOAD, 654EH and 6559H of RENUM and 7712H all call: push Register Pair HL, the caller's text pointer, which 57E5H takes back.
57E0
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL with the word at 6E9CH, the number of the line being run, which is 0FFFFH when the statement was typed at the keyboard.
57E3
LD A,H 7C
Load Register A from Register H, the high byte of that number.
57E4
AND L A5
And Register A with Register L, its low byte, which leaves 0FFH only when both bytes are 0FFH.
57E5
POP HL E1
Pop Register Pair HL, the caller's text pointer, pushed at 57DFH.
57E6
INC A 3C
Increment Register A, which sets the Zero Flag only for that 0FFFFH and so only at command level.
57E7
RET NZ C0
Return on NZ, a program being in the middle of running: these four callers refuse a protected program only when the command was typed, a running program having been allowed to reach them.
57E8
PUSH AF F5
The protected program guard (57E8H), which 4D4DH of SAVE, 59CCH of the line entry, 79B8H of LIST, 7A1AH and 8192H of the enhancement package all call and which the guard above falls into: push Register Pair AF, the caller's flags, so that this routine gives back the flags it was given.
57E9
LD A,(72CBH) 3A CB 72
Load Register A with the byte at 72CBH, the flag LOAD sets at 4CB1H when the file it read began with 0FEH.
57EC
OR A B7
Or Register A with itself, which sets the Zero Flag when the program in memory is not a protected one.
57ED
Jump to FUNCERR at 5F95H on NZ, which is error 5, Illegal function call: a protected program cannot be listed, edited, saved or added to, and these five calls are the whole of the protection.
57F0
POP AF F1
Pop Register Pair AF, the caller's flags, pushed at 57E8H, the program not being protected.
57F1
RET C9
Return to the caller with its own flags as they were, which is why 59CCH can call this between a comparison and the conditional that reads it.
57F2-57F5
DEFB 0F4H, 29H, 53H, 2AH F4 29 53 2A
57F2H to 57F5H: four bytes reached by nothing. No instruction of the three files branches here, no relative jump reaches them and no word anywhere in the three images holds one of their addresses, the one apparent hit, at 394FH, being the operand bytes of a JP P. Their own alignment cannot be settled either, 57F2H reading as a CALL P and 57F5H as the first byte of a load, and both alignments arrive at 57FAH.
57F6
LD HL,0004H 21 04 00
The stack frame search (57F6H), which NEXT calls at 453AH and RETURN at 6048H: load Register Pair HL with 0004H, the distance up the stack the first frame stands at.
57F9
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, which steps over this routine's own return address and the caller's return address into the statement loop and leaves Register Pair HL on the first byte above them.
57FA
LD A,(HL) 7E
A frame weighed (57FAH), which 5804H and 581FH go back to and which 5D8BH of the tokenizer also calls: load Register A with the byte Register Pair HL addresses, which is the marker byte of a frame when there is one.
57FB
INC HL 23
Increment Register Pair HL past that marker byte.
57FC
CP 0B4H FE B4
Compare Register A with 0B4H, the token of WHILE, which is the marker a WHILE frame carries.
57FE
Jump to 5806H on NZ, the frame not being a WHILE.
5800
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, the rest of a WHILE frame, which is seven bytes with its marker.
5803
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps Register Pair HL over the whole of it.
5804
Jump to 57FAH, which weighs the frame above the WHILE: a WHILE between the NEXT and its FOR is stepped over and left standing.
5806
CP 82H FE 82
A FOR frame tested (5806H), which 57FEH reaches: compare Register A with 82H, the token of FOR, which is the marker a FOR frame carries.
5808
RET NZ C0
Return on NZ with that byte still in Register A and Register Pair HL one past it, the frame being neither a WHILE nor a FOR: RETURN reads Register A at 604BH to see whether it has found the 8DH of a GOSUB frame, and NEXT takes the NZ at 453DH as error 1.
5809
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of this frame's loop variable address.
580A
INC HL 23
Increment Register Pair HL to the high byte of it.
580B
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, that high byte, so that Register Pair BC is the address of the variable this FOR loops on.
580C
INC HL 23
Increment Register Pair HL to the frame's fourth byte, which is where the frame proper begins.
580D
PUSH HL E5
Push Register Pair HL, that address, which 581CH takes back and which is what a match hands the caller.
580E
LD H,B 60
Load Register H from Register B, the high byte of the variable's address.
580F
LD L,C 69
Load Register L from Register C, its low byte, so that Register Pair HL is the frame's own variable.
5810
LD A,D 7A
Load Register A from Register D, the high byte of the variable the caller asked for.
5811
OR E B3
Or Register A with Register E, its low byte, which sets the Zero Flag when the caller asked for 0000H and so for any FOR frame at all.
5812
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the frame's variable into Register Pair DE, where a match leaves it for 4541H, and the caller's wanted address into Register Pair HL.
5813
Jump to 5819H on Z, the caller having asked for 0000H: the innermost FOR frame is taken whatever variable it loops on, which is what a bare NEXT wants.
5815
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which puts the two back for the comparison below.
5816
Call 434DH, which subtracts Register Pair DE from Register Pair HL and sets the Zero Flag when the frame's variable is the one asked for.
5819
LD BC,0010H 01 10 00
The answer (5819H), which 5813H reaches: load Register Pair BC with 0010H, the sixteen bytes of a FOR frame that stand above its variable address, so that the whole frame is nineteen bytes with its marker.
581C
POP HL E1
Pop Register Pair HL, the address of the frame's fourth byte, pushed at 580DH.
581D
RET Z C8
Return on Z with Register Pair HL on that byte and Register Pair DE holding the frame's variable address, the frame asked for having been found.
581E
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps Register Pair HL over the rest of this frame.
581F
Jump to 57FAH, which weighs the frame above it: the search goes outwards through the open loops until it finds the one it wants.
5821-5826
DEFB 01H, 1FH, 59H, 0C3H, 9EH, 58H 01 1F 59 C3 9E 58
5821H to 5826H: six bytes reached by nothing. As instructions they load Register Pair BC with 591FH, the POP BC inside the instruction at 591EH that END jumps to, and jump to 589EH, which cuts the stack back through 4322H and returns to the address in Register Pair BC, so they would have abandoned a statement and gone to Ready. Nothing in the three files branches here, no relative jump reaches them and no word holds one of their addresses.
5827
LD HL,(6E9CH) 2A 9C 6E
The end of the program (5827H), which the statement loop jumps to at 5E52H when a line's link word is 0000H: load Register Pair HL with the word at 6E9CH, the number of the line being run.
582A
LD A,H 7C
Load Register A from Register H, the high byte of that number.
582B
AND L A5
And Register A with Register L, its low byte, which leaves 0FFH only when both bytes are 0FFH.
582C
INC A 3C
Increment Register A, which sets the Zero Flag only for that 0FFFFH and so only when the statement was typed at the keyboard.
582D
Jump to 5838H on Z, the line being a typed one, which goes to Ready with nothing to complain of.
582F
LD A,(7198H) 3A 98 71
Load Register A with the byte at 7198H, the flag that says an error is being handled, which 6162H, 616EH and 6189H of ON ERROR GOTO write and RESUME reads at 613BH.
5832
OR A B7
Or Register A with itself, which sets the Zero Flag when no error is being handled.
5833
LD E,13H 1E 13
Load Register E with 13H, 19, the number of the No RESUME error, whose text stands at 6CBEH.
5835
Jump to the error handler at 5886H on NZ, an error having been handled when the program ran out: a handler that ends by running off the last line of the program instead of by a RESUME is what this error is for.
5838
Ready (5838H), which 582DH reaches: jump to 439AH, the entry that stops without closing a file or saving a line number for CONT, and which 4F22H also uses.

583BH - The Two Error Chains: Twenty-Three Entry Points Folded Into Each Other (583BH-5885H)

Every error the interpreter raises is raised by jumping to one of twenty-three addresses in these seventy-five bytes, and the instructions and the entry points do not begin at the same bytes. Each three byte `LD BC,nn1EH` carries the next entry inside its own operand: the operand bytes are 1EH and nn, which read as `LD E,nn`, so the entry stands one byte into the instruction and the twenty-two entries that are folded in this way cost three bytes an error instead of five. The rows below are the instructions, and the entries have ids of their own at the addresses the jumps use. Both chains fall into the handler at 5886H, which takes the error number in Register E. 583BH to 5864H is the disk chain, fourteen entries at 583BH, 583EH, 5841H, 5844H, 5847H, 584AH, 584DH, 5850H, 5853H, 5856H, 5859H, 585CH, 585FH and 5862H, whose numbers are in the fifty to seventy range, and it ends with a JR to the handler because nothing falls into it from above. The two highest entries of that chain, 583BH and 583EH, are reached by nothing: they are Disk full and Device I/O error, and every one of those two errors in the interpreter comes out of DERR's own table at 529FH instead, which answers with those two numbers directly. 586CH to 5885H is the ordinary chain, nine entries at 586CH, 586FH, 5872H, 5875H, 5878H, 587BH, 587EH, 5881H and 5884H, whose numbers are below thirty-one, and it falls straight into the handler. Above the ordinary chain, 5866H brings the line number at 7180H up to date before it falls into SYNERR 586CH, which is what 63AAH uses so that a Syntax error met while a line is being read in from a file names the line the file gave. SYNERR 586CH and FUNCERR 5F95H are the two error entries NEWB/ASM names, and 586CH is jumped to from nineteen places in module 1 as well as from the enhancement package.

583B
LD E,3DH 1E 3D
The disk error chain (583BH), the first of its fourteen entries and one of the two that nothing reaches: load Register E with 3DH, 61, the number of the Disk full error, whose text stands at 6D8AH. Every Disk full the interpreter gives comes out of DERR's table instead, which answers DOS codes 27, 30 and 33 with that number at 52B9H, 52BCH and 52BFH.
583D
LD BC,391EH 01 1E 39
Load Register Pair BC with 391EH, a value nothing reads: its operand bytes at 583EH and 583FH are the entry for error 57, Device I/O error, which as an instruction is LD E,39H and which nothing reaches either, DERR answering fourteen DOS codes and every code it does not know with that number at 529FH and 5297H.
5840
LD BC,361EH 01 1E 36
Load Register Pair BC with 361EH, a value nothing reads: its operand bytes at 5841H and 5842H are the entry for error 54, Bad file mode, which as an instruction is LD E,36H and which 4A81H gives when the file a PRINT or a WRITE names was not opened for output. This is the highest entry of the chain that anything reaches.
5843
LD BC,351EH 01 1E 35
Load Register Pair BC with 351EH, a value nothing reads: its operand bytes at 5844H and 5845H are the entry for error 53, File not found, which as an instruction is LD E,35H.
5846
LD BC,341EH 01 1E 34
Load Register Pair BC with 341EH, whose operand bytes at 5847H and 5848H are the entry for error 52, Bad file number, which the file lookup at 4A98H gives for a number above the count at 6ECEH and OPEN gives at 5118H for file number 00H.
5849
LD BC,331EH 01 1E 33
Load Register Pair BC with 331EH, whose operand bytes at 584AH and 584BH are the entry for error 51, Internal error, the text DERR's table sends eight DOS codes to.
584C
LD BC,3E1EH 01 1E 3E
Load Register Pair BC with 3E1EH, whose operand bytes at 584DH and 584EH are the entry for error 62, Input past end.
584F
LD BC,371EH 01 1E 37
Load Register Pair BC with 371EH, whose operand bytes at 5850H and 5851H are the entry for error 55, File already open, which KILL reaches through DERR when the file it is to remove is open.
5852
LD BC,401EH 01 1E 40
Load Register Pair BC with 401EH, whose operand bytes at 5853H and 5854H are the entry for error 64, Bad file name.
5855
LD BC,3F1EH 01 1E 3F
Load Register Pair BC with 3F1EH, whose operand bytes at 5856H and 5857H are the entry for error 63, Bad record number.
5858
LD BC,321EH 01 1E 32
Load Register Pair BC with 321EH, whose operand bytes at 5859H and 585AH are the entry for error 50, FIELD overflow, which FIELD gives at 4DFEH when the widths pass the record length.
585B
LD BC,431EH 01 1E 43
Load Register Pair BC with 431EH, whose operand bytes at 585CH and 585DH are the entry for error 67, Too many files, the forty-eighth text of the block.
585E
LD BC,3A1EH 01 1E 3A
Load Register Pair BC with 3A1EH, whose operand bytes at 585FH and 5860H are the entry for error 58, File already exists, the thirty-ninth text: File access DENIED is error 69, which only DERR's table asks for.
5861
LD BC,441EH 01 1E 44
Load Register Pair BC with 441EH, whose operand bytes at 5862H and 5863H are the entry for error 68, Disk write protected, which PUT reaches when the drive's byte of the table at 7C4FH says the diskette is protected.
5864
Jump to the handler at 5886H, which takes the error number in Register E: this chain is reached only by a jump to one of its entries, so it needs a jump of its own where the chain below falls through.
5866
LD HL,(7180H) 2A 80 71
The entry that names the DATA statement's line (5866H), which 63AAH jumps to: load Register Pair HL from the word at 7180H, which 653DH is the only instruction in the loaded image that writes and which holds the number of the line READ is taking its items from, so that a DATA item that will not parse names the DATA statement's own line and not the line the READ stands on.
5869
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, which the handler copies to 7190H and which the message names.
586C
LD E,02H 1E 02
SYNERR (586CH), the name NEWB/ASM gives it and the first entry of the ordinary chain: load Register E with 02H, the number of the Syntax error text, the second of the block at 6B7CH.
586E
LD BC,0B1EH 01 1E 0B
Load Register Pair BC with 0B1EH, whose operand bytes at 586FH and 5870H are the entry for error 11, Division by zero.
5871
LD BC,011EH 01 1E 01
Load Register Pair BC with 011EH, whose operand bytes at 5872H and 5873H are the entry for error 1, NEXT without FOR, which NEXT gives when a second NEXT is met for a FOR that has had one.
5874
LD BC,0A1EH 01 1E 0A
Load Register Pair BC with 0A1EH, whose operand bytes at 5875H and 5876H are the entry for error 10, Duplicate Definition, which OPTION BASE gives at 66E4H for a second statement that changes the base.
5877
LD BC,121EH 01 1E 12
Load Register Pair BC with 121EH, whose operand bytes at 5878H and 5879H are the entry for error 18, Undefined user function.
587A
LD BC,141EH 01 1E 14
Load Register Pair BC with 141EH, whose operand bytes at 587BH and 587CH are the entry for error 20, RESUME without error.
587D
LD BC,061EH 01 1E 06
Load Register Pair BC with 061EH, whose operand bytes at 587EH and 587FH are the entry for error 6, Overflow, which NEXT gives at 45A3H when an integer loop's addition carries into a single precision sum.
5880
LD BC,161EH 01 1E 16
Load Register Pair BC with 161EH, whose operand bytes at 5881H and 5882H are the entry for error 22, Missing operand.
5883
LD BC,0D1EH 01 1E 0D
Load Register Pair BC with 0D1EH, whose operand bytes at 5884H and 5885H are the entry for error 13, Type mismatch, which 2AB0H of the overlay gives when a string was wanted and a number given. These are the last two bytes of the chain, so the code falls straight into the handler at 5886H.

5886H - The Error Handler: Number to Message, and ON ERROR GOTO (5886H-591FH)

This is where every error of the interpreter is printed, and it answers the one question the project had left open about the error machinery. The number arrives in Register E from one of the two chains above or from DERR. The handler first records where the error happened, in 7190H and, for a line that is not direct mode, in 7192H as well; clears the MERGE flag at 72CCH and the chain flag at 72D2H; and runs 4322H to clear the string temporaries with 58A4H pushed as its tail. Then comes the choice: when 7196H holds the line an ON ERROR GOTO named and the handling flag at 7198H is not already set, 58CEH sets that flag and jumps to 5E4FH, so the program's own handler runs instead of a message. Otherwise the message is printed, and 58DFH to 58F0H is the mapping Part 13's question 10 asked about. A number below 31 is the text's own number; 50 to 70 loses 19 and lands on texts 31 to 51; and everything else is forced to 40 before the subtraction, which makes it text 21, Unprintable error. The text is then found by stepping the block at 6B7BH with the statement skipper at 6067H, once for each text to pass, which works because every text ends with the 00H the skipper stops on. The eight numbers the block has no text for hold a single question mark, and 58FDH to 5906H is what that is for: a text whose first character is 3FH sends the handler back to 58ECH to print Unprintable error instead. Two tails follow the message. A line number of 0FFFEH, which is what BEGIN leaves in 6E9CH while BASIC is starting up, goes to SYSTEM at 7ED4H, so an error during the start-up gives the program back to the DOS. Otherwise 591BH prints the number through 3131H unless the line was 0FFFFH, direct mode, and the code falls into READY at 5920H by way of the byte END enters at 591FH.

5886
LD HL,(6E9CH) 2A 9C 6E
The error handler (5886H), reached from nineteen places in module 1 with the error number in Register E: load Register Pair HL from the word at 6E9CH, the number of the line being run, or 0FFFFH when the statement was typed at the keyboard.
5889
LD (7190H),HL 22 90 71
Store Register Pair HL into the word at 7190H, where the handler keeps the line the error happened on, which 58B1H and 58F9H both read below.
588C
XOR A AF
Clear Register A with XOR A, making 00H, the value both flags below are to be cleared to.
588D
LD (72CCH),A 32 CC 72
Store Register A into the byte at 72CCH, the MERGE flag, so that an error during a MERGE does not leave the next load thinking it is a merge.
5890
LD (72D2H),A 32 D2 72
Store Register A into the byte at 72D2H, the flag CHAIN sets at 5680H to say that a load is part of a chain, so that an error ends the chaining rather than carrying it on.
5893
LD A,H 7C
Load Register A from Register H, the high byte of the line number.
5894
AND L A5
AND Register A with Register L, its low byte, so that Register A holds 0FFH only when both bytes are 0FFH and the statement was typed at the keyboard.
5895
INC A 3C
Increment Register A, which sets the Zero Flag for that 0FFH and so for direct mode alone.
5896
Jump to 589BH on Z, the statement having been typed at the keyboard: 7192H is left holding the last line of the program that ran, because there is no line for CURLIN to name.
5898
LD (7192H),HL 22 92 71
Store Register Pair HL into the word at 7192H, CURLIN, the cell the enhancement package and the ERL function read as the line in hand.
589B
LD BC,58A4H 01 A4 58
Load Register Pair BC with 58A4H, the address this handler goes on from, which the call below is given as its own tail.
589E
LD HL,(718EH) 2A 8E 71
Load Register Pair HL from the word at 718EH, the cell that says where the stack stands, which 4322H is to cut the stack back to.
58A1
Jump to 4322H, which takes 58A4H out of Register Pair BC as its return address, puts the Stack Pointer back from Register Pair HL and clears the string temporaries, so that the handler runs on a stack with nothing of the failed statement left on it.
58A4
POP BC C1
The handler proper (58A4H), which 4322H returns to: pop Register Pair BC, the word 4322H leaves on the new stack, which is thrown away.
58A5
LD A,E 7B
Load Register A from Register E, the error number, which has come through 4322H untouched.
58A6
LD C,E 4B
Load Register C from Register E as well, a second copy of the number, because Register E is about to be used for the text number and 58D5H needs the error number back.
58A7
LD (6E8FH),A 32 8F 6E
Store Register A into the byte at 6E8FH, where the error number itself is kept, which is what the ERR function reads and what makes ERR give the number and not the text.
58AA
LD HL,(718CH) 2A 8C 71
Load Register Pair HL from the word at 718CH, SAVTXT, the text pointer the statement loop saved before the statement that failed.
58AD
LD (7194H),HL 22 94 71
Store Register Pair HL into the word at 7194H, where the handler keeps that pointer, which is where RESUME takes the program up again.
58B0
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer into Register Pair DE and leaves Register Pair HL free for the line number.
58B1
LD HL,(7190H) 2A 90 71
Load Register Pair HL from the word at 7190H, the line the error happened on, stored at 5889H.
58B4
LD A,H 7C
Load Register A from Register H, its high byte.
58B5
AND L A5
AND Register A with Register L, its low byte, so that Register A holds 0FFH only for the 0FFFFH of direct mode.
58B6
INC A 3C
Increment Register A, which sets the Zero Flag for direct mode alone.
58B7
Jump to 58C0H on Z, the failing statement having been typed at the keyboard, so that OLDLIN and OLDTXT are left alone and a CONT after the error still goes back to where the program stopped.
58B9
LD (719BH),HL 22 9B 71
Store Register Pair HL into the word at 719BH, OLDLIN, the line a CONT goes back to, which the error now sets so that CONT carries on from the failing line.
58BC
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL.
58BD
LD (719DH),HL 22 9D 71
Store Register Pair HL into the word at 719DH, OLDTXT, the text pointer a CONT goes back to.
58C0
LD HL,(7196H) 2A 96 71
Load Register Pair HL from the word at 7196H, the line number an ON ERROR GOTO statement named, which is 0000H when the program has set no handler of its own.
58C3
LD A,H 7C
Load Register A from Register H, its high byte.
58C4
OR L B5
OR Register A with Register L, its low byte, so that the Zero Flag is set when no handler line was named.
58C5
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that line number into Register Pair DE where 5E4FH takes it, and the text pointer back into Register Pair HL.
58C6
LD HL,7198H 21 98 71
Load Register Pair HL with 7198H, the address of the flag that says an error is being handled, which RESUME reads at 613BH and which is what stops a handler that fails from being entered a second time.
58C9
Jump to 58D3H on Z, no ON ERROR GOTO line having been named, so that the message below is printed.
58CB
AND (HL) A6
AND Register A with the byte Register Pair HL addresses, the handling flag, so that the Zero Flag is set when the flag is 00H and no handler is running already.
58CC
Jump to 58D3H on NZ, a handler being in hand already: an error inside the error handler prints its message rather than going round again.
58CE
DEC (HL) 35
Decrement the byte Register Pair HL addresses, which takes the flag at 7198H from 00H to 0FFH and so marks the program's own handler as running.
58CF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the ON ERROR line number back into Register Pair HL for the transfer below.
58D0
Jump to 5E4FH, the part of the statement loop that takes up a line by number, so that the program's own handler runs with nothing printed.
58D3
XOR A AF
The message (58D3H): clear Register A with XOR A, making 00H.
58D4
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, 7198H, which clears the handling flag because the error is being reported and no handler is to be entered.
58D5
LD E,C 59
Load Register E from Register C, the error number, which 58A6H kept while Register E was in use.
58D6
LD (6E97H),A 32 97 6E
Store Register A into the byte at 6E97H, the flag that suppresses output, so that nothing can swallow the message about to be printed.
58D9
Call 41E9H, which writes a carriage return when the print position at 713CH says the line has something on it, so that the message starts at the left.
58DC
LD HL,6B7BH 21 7B 6B
Load Register Pair HL with 6B7BH, the byte below the first text of the error message block, which the stepping loop below counts up from.
58DF
LD A,E 7B
The mapping (58DFH), which settles how error numbers reach the fifty one texts: load Register A from Register E, the error number.
58E0
CP 47H FE 47
Compare Register A with 47H, 71, the first number above the range the block has texts for.
58E2
Jump to 58ECH on NC, the number standing at 71 or above, which is forced to 40 below and so prints Unprintable error.
58E4
CP 32H FE 32
Compare Register A with 32H, 50, the first number of the disk error range.
58E6
Jump to 58EEH on NC, the number standing from 50 to 70, which loses 19 below and lands on texts 31 to 51.
58E8
CP 1FH FE 1F
Compare Register A with 1FH, 31, the first number above the ordinary range.
58EA
Jump to 58F1H on C, the number standing below 31, which is the text's own number and needs no mapping at all.
58EC
LD A,28H 3E 28
Load Register A with 28H, 40, which is reached by a number from 31 to 49 and by one of 71 or more, and which the subtraction below turns into 21, the number of the Unprintable error text.
58EE
SUB 13H D6 13
Subtract 13H from Register A, 19, which maps the disk error range onto texts 31 to 51 and the forced 40 onto text 21.
58F0
LD E,A 5F
Load Register E from Register A, the number of the text to be printed, counted from the first of the block.
58F1
The stepping loop (58F1H): call 6067H, the statement skipper's REM entry, which runs Register Pair HL on to the 00H that ends the text it stands in, every text of the block being 00H ended.
58F4
INC HL 23
Increment Register Pair HL past that 00H and onto the first character of the next text.
58F5
DEC E 1D
Decrement Register E, the count of texts still to be stepped over.
58F6
Jump back to 58F1H on NZ, which steps one text for each count and leaves Register Pair HL on the text the number asked for.
58F8
PUSH HL E5
Push Register Pair HL, the address of that text, which the POP HL at 5902H or 590BH brings back.
58F9
LD HL,(7190H) 2A 90 71
Load Register Pair HL from the word at 7190H, the line the error happened on, stored at 5889H.
58FC
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts that line number away on the stack and brings the text's address back into Register Pair HL.
58FD
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the first character of the text found.
58FE
CP 3FH FE 3F
Compare Register A with 3FH, a question mark, which is the whole of each of the eight texts the block holds for the error numbers it has no message for.
5900
Jump to 5908H on NZ, the text being a real message, which is printed as it stands.
5902
POP HL E1
Pop Register Pair HL, the line number put on the stack at 58FCH, which is thrown away and read again at 590BH.
5903
LD HL,6B7BH 21 7B 6B
Load Register Pair HL with 6B7BH, the foot of the block again, because the count has to be made afresh for the text that is to replace the question mark.
5906
Jump back to 58ECH, which loads 40 and takes 19 off it, so that an error number the block has no text for prints Unprintable error.
5908
Call 46A5H, which builds a descriptor for the 00H ended text and writes it a character at a time, so the message itself reaches the display.
590B
POP HL E1
Pop Register Pair HL, the line the error happened on, put on the stack at 58FCH.
590C
LD DE,0FFFEH 11 FE FF
Load Register Pair DE with 0FFFEH, the line number BEGIN leaves in 6E9CH while BASIC is starting up, which is the one line number that is neither a program line nor direct mode.
590F
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Zero Flag when the error happened during the start-up.
5912
Call 41F5H on Z, which writes the carriage return after the message, the start-up path having nothing more to print.
5915
Jump to 7ED4H on Z, the SYSTEM statement's own code, which gives the program back to the DOS: an error raised while BASIC is starting up does not reach a Ready prompt at all.
5918
LD A,H 7C
Load Register A from Register H, the high byte of the line number.
5919
AND L A5
AND Register A with Register L, its low byte, so that Register A holds 0FFH only for the 0FFFFH of direct mode.
591A
INC A 3C
Increment Register A, which sets the Zero Flag for direct mode alone.
591B
Call 3131H on NZ, which writes the ` in ` text at 7328H and the line number after the message, so that a program error names its line and a statement typed at the keyboard does not.
591E
LD A,0C1H 3E C1
Load Register A with 0C1H, a value nothing reads: the two bytes of this instruction are there for the operand byte at 591FH, which as an instruction is POP BC and is where END jumps from 43BEH to throw away the line number it pushed.

5920H - READY and Command Level: the Prompt and the Line Loop (5920H-598FH)

This is the loop a user sits in, and the one place where the two modules are joined so tightly that the base cannot run without the package. READY 5920H, which NEWB/ASM names, clears the printer and output suppression flags, closes the file in hand, writes a carriage return if the line has anything on it, and then does the thing worth stopping at: it loads Register Pair HL with the Ready text at 732DH and calls 8048H. 8048H is OLDINIT, the address newb.asm glosses as the end of BASIC before the package, and it is the one block of module 1 the enhancement is certain to occupy. In the unenhanced base, `ls631rst\DISK7\basic62.cmd`, 8048H is module 1's own start-up, guarded by a once-only flag at 8217H: the first entry runs the start-up and sets the flag, and every entry after that issues @ABORT. 5930H is the only instruction in the whole of basic62.cmd that names 8048H besides its transfer record, so the base on its own cannot reach a second Ready prompt. In the release the enhancement stands there, so the call lands on SVCUSR, which reads a character of the Ready text, finds that 7149H does not hold 11, and jumps to 773AH, module 1's own USR dispatch, which with Register Pair BC at 0000H works an address out into Register Pair DE and returns harmlessly. So the call does nothing in the release and is fatal without the package: module 1 was built so that it can only be used with the enhancement installed, and the Ready text is written not here but by 41D8H. After the call READY looks at the last error number at 6E8FH and, when it was 2, Syntax error, calls 3D15H to put the offending line into the editor, which is Microsoft BASIC's own behaviour. Command level 593BH sets the line number to 0FFFFH, which is what marks direct mode everywhere in the interpreter, points SAVTXT at 6EA2H, and then takes one of two paths: with the AUTO flag at 7187H set it shows the next line number through NUMDSP, marks a line that already exists with an asterisk, and reads a line; otherwise it calls IMMED 80B8H, the enhancement's keystroke intercept, which is the patch at 5990H.

5920
READY (5920H), the name newb.asm gives it, reached from 8036H when no program was named on the DOS command line, from 4CCAH at the end of a LOAD, from 79C9H, from 3F15H and from the error handler falling through 591FH: call 4137H, which clears the printer flag at 6E92H so that the prompt goes to the display.
5923
XOR A AF
Clear Register A with XOR A, making 00H, the value the output suppression flag is to be cleared to.
5924
LD (6E97H),A 32 97 6E
Store Register A into the byte at 6E97H, the flag that throws output away, which the character routine reads at 414BH: a prompt must not be swallowed by a flag an INPUT left set.
5927
Call 4CD0H, which clears the printer flag and FILEX through 634BH, closes the file in hand through 4F52H, and returns through 4349H with Register Pair HL loaded from 7184H.
592A
Call 41E9H, which reads the print position at 713CH and writes a carriage return only when the line has something on it, so that Ready does not follow a half finished line.
592D
LD HL,732DH 21 2D 73
Load Register Pair HL with 732DH, the Ready text, five characters and a carriage return ended by a 00H byte.
5930
Call 8048H, OLDINIT, which in the base is module 1's own start-up and in the release is the enhancement's SVCUSR. In the release the call is harmless: SVCUSR reads a character of the text through NXTCHAR, finds that the USR number at 7149H is not 11, and jumps to 773AH, which with Register Pair BC at 0000H works an address out into Register Pair DE and returns. In the base the once-only flag at 8217H has been set by the transfer, so this call issues @ABORT, which is why module 1 cannot be run without the package. The Ready text itself is written by 41D8H and not by this call.
5933
LD A,(6E8FH) 3A 8F 6E
Load Register A from the byte at 6E8FH, the number of the last error, which the handler stored there at 58A7H.
5936
SUB 02H D6 02
Subtract 02H from Register A, the number of the Syntax error text, so that the Zero Flag is set only when the last error was a Syntax error.
5938
Call 3D15H on Z, which puts the line the Syntax error was found in into the editor, so that a mistyped line is offered for correction instead of merely being reported.
593B
LD HL,0FFFFH 21 FF FF
Command level (593BH), which ten places reach, eight of them in module 1 and two in the enhancement package at 8185H and 819CH, among them the end of a line entered at 5A6BH, MERGE's handover at 4D0BH and AUTO's own jump at 61CAH: load Register Pair HL with 0FFFFH, the line number that means direct mode.
593E
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that every test for direct mode in the interpreter, from the protected program guard at 57DFH to the error handler's at 5895H, now reads true.
5941
LD HL,6EA2H 21 A2 6E
Load Register Pair HL with 6EA2H, a byte that holds 00H, which stands as an empty line for the text pointer to point at.
5944
LD (718CH),HL 22 8C 71
Store Register Pair HL into the word at 718CH, SAVTXT, so that an error raised before any line has been read finds a text pointer that addresses an end of line rather than rubbish.
5947
LD A,(7187H) 3A 87 71
Load Register A from the byte at 7187H, the flag AUTO sets at 61C2H, which says that line numbers are to be offered.
594A
OR A B7
OR Register A with itself, which sets the Zero Flag when AUTO is off.
594B
Jump to 5990H on Z, AUTO being off, which is the patched instruction: module 2 replaced the three bytes there with a call to IMMED 80B8H, so the ordinary prompt reads one keystroke through the enhancement.
594D
LD HL,(7188H) 2A 88 71
Load Register Pair HL from the word at 7188H, the line number AUTO is to offer, which 61C6H set and 5984H brings up to date.
5950
PUSH HL E5
Push Register Pair HL, that line number, which the POP DE at 5954H brings back.
5951
Call NUMDSP at 3139H, which writes the line number as decimal digits, so the user sees the number he is about to type a line for.
5954
POP DE D1
Pop Register Pair DE, the line number pushed at 5950H.
5955
PUSH DE D5
Push Register Pair DE again, which the POP DE at 5965H brings back after the line has been read.
5956
Call FIND at 5AB4H, which walks the program for that line number and sets the Carry Flag when a line of that number or beyond was reached.
5959
LD A,2AH 3E 2A
Load Register A with 2AH, an asterisk, which is what AUTO shows after the number of a line that already exists.
595B
Jump to 595FH on C, the line number being one the program already has, so that the asterisk is the character written.
595D
LD A,20H 3E 20
Load Register A with 20H, a blank, which follows the number of a line that does not exist yet.
595F
Call 40D8H, which writes the asterisk or the blank after the line number.
5962
Call 7E1BH, the keyboard line reader past the question mark and space it writes for itself at 7E11H, which reads a whole line into INBUF 7039H and sets the Carry Flag when BREAK was pressed.
5965
POP DE D1
Pop Register Pair DE, the line number pushed at 5955H.
5966
Jump to 5974H on NC, no BREAK having been pressed, so that the increment is added and AUTO goes round again.
5968
XOR A AF
Clear Register A with XOR A, making 00H, the value that turns AUTO off.
5969
LD (7187H),A 32 87 71
Store Register A into the byte at 7187H, the AUTO flag, so that BREAK ends the automatic numbering.
596C
Jump back to 5920H, READY, which prints the prompt and so shows the user that AUTO has stopped.
596E
XOR A AF
The overflow exit (596EH), which 5978H and 5982H reach: clear Register A with XOR A, making 00H.
596F
LD (7187H),A 32 87 71
Store Register A into the byte at 7187H, the AUTO flag, turning AUTO off because the next line number would not fit.
5972
Jump to 5987H, which goes on to enter the line just read rather than throwing it away: the line is kept and only the numbering stops.
5974
LD HL,(718AH) 2A 8A 71
The increment (5974H): load Register Pair HL from the word at 718AH, the increment AUTO was given, which 61BFH set.
5977
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the line number just used, so that Register Pair HL holds the number to offer next.
5978
Jump to 596EH on C, the addition having carried past 65535, which turns AUTO off.
597A
PUSH DE D5
Push Register Pair DE, the line number just used, which the POP DE at 5981H brings back.
597B
LD DE,0FFFAH 11 FA FF
Load Register Pair DE with 0FFFAH, 65530, the highest line number the digit reader at 5FB5H will build, so the next number must not pass it.
597E
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Carry Flag when the next number is still below 65530.
5981
POP DE D1
Pop Register Pair DE, the line number pushed at 597AH.
5982
Jump to 596EH on NC, the next number standing at 65530 or above, which turns AUTO off for the same reason.
5984
LD (7188H),HL 22 88 71
Store Register Pair HL into the word at 7188H, the line number AUTO is to offer next time round.
5987
LD A,(7039H) 3A 39 70
Enter the line (5987H), which both AUTO paths reach: load Register A from the byte at 7039H, the first character of INBUF, the line just read.
598A
OR A B7
OR Register A with itself, which sets the Zero Flag when the line is empty.
598B
Jump back to 593BH on Z, nothing having been typed, which goes round command level again.
598D
Jump to 3F03H, which takes the line in INBUF and either enters it into the program text, when it begins with a line number, or runs it as a direct statement.

5990H - The IMMED Patch (5990H-5992H)

One of the eight places where the NEWB enhancement package of module 2 replaces instructions of module 1 with a call or a jump into its own code at 8048H and above, each of them an ORG in NEWB/ASM. The bytes here are loaded by module 1 and then loaded over again by module 2.

5990
IMMED intercept (5990H-5992H): call IMMED at 80B8H on every line the interpreter takes in, which is where the package adds its immediate commands before the first module sees the line.

5993H - The Line Entered into the Program (5993H-5A6DH)

This is the routine that makes a typed line part of the program, and it is the last of the program text management to be written. Two things reach it. The line read at 5990H returns here, which in the release is IMMED 80B8H of the enhancement package and in module 1's own bytes, which module 2 loads over, is CALL 7E1BH, the line reader: either way the line stands in INBUF 7039H and Register Pair HL comes back at 7038H, the byte below it. BASIC/OV2's COPY command jumps straight here at 233DH with Register Pair HL at that same 7038H, and bmove.asm says why in four words of its own, Treat as typed line, having built the copied line's new number into the buffer as plain characters through HEXDEC. So the text this routine reads is always raw and never tokenized, which is what settles question 19 of section 9: the tokenizing happens afterwards, at 59BFH, where module 1's own byte is CALL 5AD3H, TOBUFF, and the package's is CALL 81B9H, ABBR. The work falls into four parts. 5993H to 59A7H clears a BREAK left over from the typing and throws an empty line away. 59A9H to 59BEH reads the line number and settles whether there is one. 59C2H to 59C7H decides from that whether the line is to be run now or written into the program. And 59CAH to 5A6DH does the writing: the old line of that number is taken out, room is made for the new one with 4237H, the tokenized text is copied in from LBUF, the links are rebuilt by 5A72H and the variables are cleared by 42C7H, because a line entered invalidates every variable in memory.

5993
The line entered into the program (5993H), which the line read at 5990H returns to and BASIC/OV2's COPY jumps to at 233DH: jump to 593BH on C, BREAK having been pressed while the line was being read, so that nothing is entered and the interpreter goes back to command level.
5995
PUSH AF F5
Push Register Pair AF, the flags the line read left with the Carry Flag clear, which 59A1H takes back once the keyboard flag byte has been seen to.
5996
PUSH BC C5
Push Register Pair BC, which 59A0H takes back, the call below wanting Register C for a mask of its own.
5997
PUSH DE D5
Push Register Pair DE, which 599FH takes back, so that nothing the keyboard flag routine does can disturb it.
5998
PUSH HL E5
Push Register Pair HL, the text pointer the line read left at 7038H, which 599EH takes back.
5999
LD C,0F4H 0E F4
Load Register C with 0F4H, the mask that clears bits 0, 1 and 3 of KFLAG$ 0074H and leaves the other five standing, which is the same mask the BREAK handler loads at 7D16H.
599B
Call 7D39H, which ands that mask into the flag byte and waits through a pause for as long as the driver keeps setting the bits again: a BREAK or a pause still held from the line just typed is used up here and does not reach the line about to be entered.
599E
POP HL E1
Pop Register Pair HL, the text pointer 5998H pushed, which stands at 7038H.
599F
POP DE D1
Pop Register Pair DE, the pair pushed at 5997H, which this routine does not itself read again.
59A0
POP BC C1
Pop Register Pair BC, the pair pushed at 5996H, Register C having been given over to the mask above.
59A1
POP AF F1
Pop Register Pair AF, the flags 5995H pushed, which this routine does not read again.
59A2
Call NXTCHAR at 5E93H, which steps Register Pair HL from 7038H on to the first character of INBUF 7039H, skipping any blank in front of it, and brings that character into Register A.
59A5
INC A 3C
Increment Register A, the character, which with the decrement below sets the Zero Flag from the character itself.
59A6
DEC A 3D
Decrement Register A back to the character, the Zero Flag now standing for a 00H and for nothing else: NXTCHAR's own way out at 5E97H leaves the flags of a comparison with 3AH, which a line beginning with a colon would have set, and the two instructions here throw those flags away.
59A7
Jump to 593BH on Z, the line holding no characters at all, which takes an empty line back to command level without a word.
59A9
PUSH AF F5
Push Register Pair AF, whose Carry Flag NXTCHAR sets only for a character between 30H and 39H: that one bit is the whole of what 59C7H reads to tell a numbered line from a statement typed to be run at once.
59AA
Call 5FA4H, which reads the digits of a line number into Register Pair DE and leaves Register Pair HL on the first character after them, with the Carry Flag set only when the running total already stood above 6552 and a further digit followed.
59AD
Jump to 59B5H on NC, the number having been read without running past 65529, which is the highest line number this interpreter will take.
59AF
Call 45DFH, which sets the Zero Flag when FILEX 6E98H holds 0000H and no file is in hand, so that the error below is given for a line typed at the keyboard or built by COPY and not for one being read out of a text file.
59B2
Jump to SYNERR at 586CH on Z, which is error 2, Syntax error: a line number above 65529 typed at the keyboard is refused here, where the same line read in from a text file is let through with Register Pair DE holding the total the digits had reached before the one that overflowed, which is bug B349.
59B5
Call 5D4AH, which steps Register Pair HL back over the blanks, the tabs and the line feeds that stand between the number and the statement and leaves it on the first of them.
59B8
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, which is that first blank, a tab, or the first character of the statement when nothing separated them.
59B9
CP 20H FE 20
Compare Register A with 20H, a blank, which is the one character this code takes out of the line.
59BB
Call 293CH on Z, which is two bytes of BASIC/OV1 that increment Register Pair HL and return, so exactly one blank is dropped from the front of the stored text: LIST writes one back after the line number at 79F1H, and a tab, which 79EDH tests for, is kept instead and gets no blank.
59BE
PUSH DE D5
The entry EDIT uses (59BEH), which 3F0AH jumps to with the Carry Flag forced set at 3F07H and the line number already in Register Pair DE: push Register Pair DE, that number, which 59C2H takes back after the text has been tokenized.

59BFH - The ABBR Patch (59BFH-59C1H)

One of the eight places where the NEWB enhancement package of module 2 replaces instructions of module 1 with a call or a jump into its own code at 8048H and above, each of them an ORG in NEWB/ASM. The bytes here are loaded by module 1 and then loaded over again by module 2.

59BF
ABBR intercept (59BFH-59C1H): call ABBR at 81B9H as the line is parsed, which is where the package expands an abbreviated keyword into the keyword the first module's tokenizer expects.

59C2H - The Line Written into the Program (59C2H-5A6DH)

The tokenizing at 59BFH has been done and what follows decides what to do with the result. TOBUFF leaves the tokenized line in LBUF with its first character at 6EFAH, Register Pair HL at 6EF9H and Register Pair BC holding the number of bytes the line will take up in the program text, which is 0140H less the room it had left: the characters plus the two bytes of the link, the two of the number and the 00H that ends it, five more than the line is long. That count is what the whole of the writing below is arranged around. Three things can happen. A line that began with something other than a digit goes to 4D0EH and is run at once. A line that was nothing but a number takes the line of that number out of the program. And a line with text after its number has the old line of that number taken out and the new one put in its place, which means moving everything below it. Whichever of the last two it is, every variable in memory is thrown away at the end by the clear at 42C7H, because the program has changed; the four cells saved and put back around that clear, 6EAEH and 6ECEH with 6E98H and 6EA9H, are what keeps it from closing the file an ASCII LOAD is reading the lines out of.

59C2
POP DE D1
The line written into the program (59C2H), which 59BFH returns to: pop Register Pair DE, the line number 59BEH pushed, which the tokenizing left where it was.
59C3
POP AF F1
Pop Register Pair AF, the Carry Flag that 59A9H pushed from NXTCHAR or that 3F08H pushed after forcing it set, which stands set only when the line began with a digit.
59C4
LD (718CH),HL 22 8C 71
Store Register Pair HL, which TOBUFF left at LBUF 6EF9H, into SAVTXT 718CH, where the statement loop and the error handler both look for the text pointer.
59C7
Jump to 4D0EH on NC, the line having begun with something that is not a digit: there a statement typed at command level is refused with error 66 if a file is in hand and is otherwise run at 5E73H, and this routine is done with.
59CA
PUSH DE D5
A numbered line (59CAH): push Register Pair DE, the line's number, which 5A1AH takes back when the number comes to be written into the text.
59CB
PUSH BC C5
Push Register Pair BC, the number of bytes the line will take up, which 5A0CH and 5A19H both want and which nothing else now computes.
59CC
Call 57E8H, which gives error 5, Illegal function call, when the flag at 72CBH says the program in memory is a protected one: a protected program cannot be added to or edited, and this is where that is enforced.
59CF
Call NXTCHAR at 5E93H, which steps Register Pair HL from 6EF9H on to 6EFAH and brings the first character of the tokenized line into Register A.
59D2
OR A B7
Or Register A with itself, which sets the Zero Flag when the line held nothing after its number and so asks for the line of that number to be taken out.
59D3
PUSH AF F5
Push Register Pair AF, that Zero Flag, which 59DDH and 59F1H both read: it is the one bit that tells a deletion from an insertion.
59D4
LD (7192H),DE ED 53 92 71
Store Register Pair DE, the line's number, into CURLIN 7192H, so that an error raised by anything below names this line.
59D8
Call FIND at 5AB4H, which sets the Carry Flag only when a line of exactly that number already stands in the program, leaves Register Pair BC addressing it, or addressing the line that would follow it when it does not, and leaves Register Pair HL addressing the line after that.
59DB
Jump to 59E3H on C, a line of this number being in the program and having to come out whether the new line replaces it or not.
59DD
POP AF F1
Pop Register Pair AF, the Zero Flag 59D3H pushed, no such line existing.
59DE
PUSH AF F5
Push Register Pair AF again, so that 59F1H still finds it where it expects it.
59DF
Jump to 6040H on Z, which is error 8, Undefined line number: a bare line number was typed for a line that is not there to take out.
59E2
OR A B7
Or Register A with itself, which clears the Carry Flag, so that the deletion below is not made for a line that was never found.
59E3
PUSH BC C5
The old line taken out (59E3H), which 59DBH reaches: push Register Pair BC, the address of the line of this number or of the place it would stand, which 59EBH takes back.
59E4
PUSH AF F5
Push Register Pair AF, the Carry Flag that stands set only when a line of this number is in the program, which 59EAH takes back.
59E5
PUSH HL E5
Push Register Pair HL, the address of the line after it, which 59E9H takes back and 7C15H copies from.
59E6
Call 66B6H, which runs the walk at 661EH when the flag at 7186H says the program text holds line references in their resolved form, turning every one of them back into a line number: the text is about to move and an address in it would no longer point at its line.
59E9
POP HL E1
Pop Register Pair HL, the address of the line after the one being replaced, pushed at 59E5H.
59EA
POP AF F1
Pop Register Pair AF, the Carry Flag pushed at 59E4H.
59EB
POP BC C1
Pop Register Pair BC, the address of the line being replaced, pushed at 59E3H.
59EC
PUSH BC C5
Push Register Pair BC again, that same address, which 59F0H takes back as the place the new line is to go.
59ED
Call 7C15H on C, a line of this number standing in the program: it copies the whole of the text from the address in Register Pair HL down to VARTAB 719FH over the line at the address in Register Pair BC and brings 719FH, 71A1H and 71A3H down by the length of the line that has gone.
59F0
POP DE D1
Pop Register Pair DE, the address the new line is to stand at, pushed at 59ECH.
59F1
POP AF F1
Pop Register Pair AF, the Zero Flag 59D3H and 59DEH pushed, which stands set when nothing but a number was typed.
59F2
PUSH DE D5
Push Register Pair DE, that address, so that both ways out below find the stack the same: the deletion at 5A32H pops it and so does 59F5H.
59F3
Jump to 5A32H on Z, the line having been nothing but a number: the old line is already out and there is nothing to put in its place.
59F5
POP DE D1
Pop Register Pair DE, the address the new line is to stand at, pushed at 59F2H.
59F6
LD A,(72D2H) 3A D2 72
Load Register A with the byte at 72D2H, which the error handler clears at 5890H and which LOAD tests at 4CBCH to see whether a chain is running.
59F9
OR A B7
Or Register A with itself, which sets the Zero Flag when no chain is running and the string space may be thrown away.
59FA
Jump to 5A02H on NZ, a chain being in hand, which keeps the string space it has already built.
59FC
LD HL,(7153H) 2A 53 71
Load Register Pair HL with the word at 7153H, the top of the program and variable space, no chain being in hand.
59FF
LD (7178H),HL 22 78 71
Store Register Pair HL into HIPT 7178H, which gives the whole of the string area back: every string in memory is about to be unreachable anyway, the variables going with the clear below.
5A02
LD HL,0000H 21 00 00
The string space and the error line settled (5A02H), which 59FAH reaches: load Register Pair HL with 0000H, the line number that means no handler.
5A05
LD (7196H),HL 22 96 71
Store Register Pair HL into 7196H, which takes ON ERROR GOTO out: a line has changed and the line the handler named may no longer be the line it was.
5A08
LD HL,(719FH) 2A 9F 71
Load Register Pair HL with the word at 719FH, VARTAB, which is the byte after the last of the program text.
5A0B
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that VARTAB on the stack and brings the line's own length back into Register Pair HL.
5A0C
POP BC C1
Pop Register Pair BC, that VARTAB, so that Register Pair BC is the old end of the text and Register Pair HL its growth.
5A0D
PUSH HL E5
Push Register Pair HL, the length again, which 5A19H takes back when the text comes to be copied.
5A0E
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which makes Register Pair HL the end the text will have once the new line is in it.
5A0F
PUSH HL E5
Push Register Pair HL, that new end, which 5A13H takes back.
5A10
Call 4237H, which refuses the room with Out of memory if the new end in Register Pair HL would reach the string text and otherwise copies the text from the old end in Register Pair BC down to the insertion point in Register Pair DE, writing it from the new end down: the tail of the program moves up by the length of the line.
5A13
POP HL E1
Pop Register Pair HL, the new end of the text, pushed at 5A0FH.
5A14
LD (719FH),HL 22 9F 71
Store Register Pair HL into VARTAB 719FH, the program text now being that much longer.
5A17
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the insertion point into Register Pair HL and the new end into Register Pair DE.
5A18
LD (HL),H 74
Store Register H, the high byte of the insertion point itself, into the byte Register Pair HL addresses, the low byte of the new line's link: any value that is not 00H will do, and this one is to hand, the point being that the link walk below must not take this half built line for the end of the program.
5A19
POP BC C1
Pop Register Pair BC, the line's length, pushed at 5A0DH.
5A1A
POP DE D1
Pop Register Pair DE, the line's number, pushed at 59CAH.
5A1B
PUSH HL E5
Push Register Pair HL, the insertion point, which 5A32H takes back as the line the link walk is to start from.
5A1C
INC HL 23
Increment Register Pair HL to the high byte of the new line's link.
5A1D
INC HL 23
Increment Register Pair HL to the low byte of its number.
5A1E
LD (HL),E 73
Store Register E, the low byte of the number, into the byte Register Pair HL addresses.
5A1F
INC HL 23
Increment Register Pair HL to the high byte of the number.
5A20
LD (HL),D 72
Store Register D, that high byte, into the byte Register Pair HL addresses: the line now carries its own number.
5A21
INC HL 23
Increment Register Pair HL to the first byte of the line's text.
5A22
LD DE,6EFAH 11 FA 6E
Load Register Pair DE with 6EFAH, the first character of the tokenized line in LBUF, which is what the loop below copies from.
5A25
DEC BC 0B
Decrement Register Pair BC, the length, which takes the link's low byte off it.
5A26
DEC BC 0B
Decrement Register Pair BC, which takes the link's high byte off it.
5A27
DEC BC 0B
Decrement Register Pair BC, which takes the number's low byte off it.
5A28
DEC BC 0B
Decrement Register Pair BC, which takes the number's high byte off it, so that Register Pair BC is now the characters plus the 00H that ends them.
5A29
LD A,(DE) 1A
The text copied in (5A29H), which 5A30H goes back to: load Register A with the byte Register Pair DE addresses, one character or token of the line.
5A2A
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, its place in the program text.
5A2B
INC HL 23
Increment Register Pair HL to the next place in the text.
5A2C
INC DE 13
Increment Register Pair DE to the next byte of the buffer.
5A2D
DEC BC 0B
Decrement Register Pair BC, one byte fewer to copy.
5A2E
LD A,C 79
Load Register A from Register C, the low byte of what is left.
5A2F
OR B B0
Or Register A with Register B, its high byte, which sets the Zero Flag when the whole line has been copied.
5A30
Jump to 5A29H on NZ, more of the line being left, which copies the next byte.
5A32
POP DE D1
The links and the variables (5A32H), which 59F3H reaches when a line was taken out and the copy above falls into: pop Register Pair DE, the address of the line the walk is to start from, which 5A1BH or 59F2H pushed.
5A33
Call 5A72H, the link walk entered with the address already in Register Pair DE, which writes every line's link again from that line to the end of the program.
5A36
LD HL,6EF8H 21 F8 6E
Load Register Pair HL with 6EF8H, the byte below LBUF, which is about to stand in for a file control block.
5A39
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL addresses, which is all of that stand-in there is: the clear below reads the first byte of file number 0's block and goes no further when it is 00H.
5A3B
LD (6EAEH),HL 22 AE 6E
Store Register Pair HL, that 6EF8H, into 6EAEH, the first entry of the table of file control block addresses, so that the clear below finds no open file there.
5A3E
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL with the word at FILEX 6E98H, the control block of the file in hand, which is 0000H when there is none.
5A41
LD (7199H),HL 22 99 71
Store Register Pair HL into 7199H, which is the third thing that cell is used for, the array code and the expression machinery having the other two: here it holds FILEX across the clear.
5A44
LD A,H 7C
Load Register A from Register H, the high byte of that control block address.
5A45
OR L B5
Or Register A with Register L, its low byte, which sets the Zero Flag when no file is in hand.
5A46
Jump to 5A52H on Z, no file being in hand, which has nothing to put aside.
5A48
LD A,(6ECEH) 3A CE 6E
Load Register A with the byte at 6ECEH, the count of file buffers, a file being in hand.
5A4B
LD (6EA9H),A 32 A9 6E
Store Register A into 6EA9H, where the end of a program load puts the same count aside at 41C4H, so that it survives the clear below.
5A4E
XOR A AF
Clear Register A to 00H, the count the clear is to see.
5A4F
LD (6ECEH),A 32 CE 6E
Store Register A into 6ECEH, which leaves the clear below no buffers to walk and so no file to close: the file the lines are being read out of stays open.
5A52
The variables thrown away (5A52H), which 5A46H reaches: call 42C7H, the entry RUN with nothing after it uses, which clears every variable, array and string and resets the stack, because a program whose text has changed cannot keep them.
5A55
LD HL,(6EACH) 2A AC 6E
Load Register Pair HL with the word at 6EACH, the first real file buffer address, which 7FFBH wrote.
5A58
LD (6EAEH),HL 22 AE 6E
Store Register Pair HL into 6EAEH, which puts the table of file control block addresses back where 5A3BH took it from.
5A5B
LD HL,(7199H) 2A 99 71
Load Register Pair HL with the word at 7199H, the FILEX 5A41H put aside.
5A5E
LD (6E98H),HL 22 98 6E
Store Register Pair HL into FILEX 6E98H, so that the file in hand is the file in hand again.
5A61
LD A,H 7C
Load Register A from Register H, the high byte of it.
5A62
OR L B5
Or Register A with Register L, its low byte, which sets the Zero Flag when there was no file.
5A63
Jump to 5A6BH on Z, there having been no buffer count to put aside.
5A65
LD A,(6EA9H) 3A A9 6E
Load Register A with the byte at 6EA9H, the buffer count 5A4BH put aside.
5A68
LD (6ECEH),A 32 CE 6E
Store Register A into 6ECEH, the count itself, which is the last of the four cells put back.
5A6B
Jump to 593BH, command level, the line being part of the program and every variable gone: this is where a program is built one line at a time.

5A6EH - The Line Links Rebuilt, the Line Number Range, and FIND (5A6EH-5AD2H)

A hundred and one bytes that more of this page depends on than any other hundred bytes of it. Three routines stand here, and they are written one after another because the second ends by falling into the third. 5A6EH walks the program and writes every line's link word again, which has to happen whenever the text has moved or arrived from somewhere else: a line entered or deleted moves everything below it, LOAD and MERGE bring in a file whose links are the addresses the program had when it was saved, and the Out of memory exit at 425CH runs it because the error is usually raised in the middle of a move. The walk has to step over the packed constants the tokenizer leaves in the text, which is what 5A87H and 5A8AH are for: a byte between 0BH and 1FH is a number token and NXTCHAR is the only thing that knows how wide the number after it is. 5A96H is the line number range that LIST, DELETE and CHAIN's own line count all read, and it gives the three forms the manual describes from one piece of code: nothing at all is 0 to 65530, one number is that line alone, and a number with the minus token after it and nothing else is that line to 65530. It leaves the second line on the stack under its own return address and falls into FIND for the first, so its callers get both ends of the range and the address of the first line in one call. 5AB4H is FIND, and fifteen places outside these hundred bytes call it, more than any other routine of module 1 but NXTCHAR, 4353H and 76A4H. It answers with the Carry Flag set only when a line of exactly the number asked for exists, and with Register Pair BC holding that line's address, or, when no such line exists, with the Carry Flag clear and Register Pair BC holding the address of the first line whose number stands above it, which is where a new line of that number would be inserted. That one convention is what lets the same routine serve a GOTO, a RENUM, a DELETE and the entry of a line into the program. The three doors differ only in where they start: 5AB4H from the first line of the program, 5AB7H from the line whose address stands in Register Pair HL, which is how 602BH searches forward from the line being run rather than from the beginning, and 5AB2H, which is 5AB4H with the caller's own Register Pair HL left on the stack for it to take back.

5A6E
LD HL,(6E9EH) 2A 9E 6E
The links rebuilt (5A6EH), which 425CH, 4CA2H and 567BH call: load Register Pair HL with the word at 6E9EH, PGMBGN, the address the program text begins at.
5A71
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE, where the loop below wants it.
5A72
LD H,D 62
The loop, with the address already in Register Pair DE (5A72H), which 5A33H calls and 5A94H goes back to: load Register H from Register D, the high byte of this line's address.
5A73
LD L,E 6B
Load Register L from Register E, its low byte, so that Register Pair HL addresses the line's link word while Register Pair DE keeps the line's own address.
5A74
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of the link.
5A75
INC HL 23
Increment Register Pair HL to the high byte of the link.
5A76
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, which sets the Zero Flag when the link is 0000H and this is the last line of the program.
5A77
RET Z C8
Return on Z, every link having been written, which is all the three callers want of this routine.
5A78
INC HL 23
Increment Register Pair HL to the low byte of this line's number.
5A79
INC HL 23
Increment Register Pair HL to the high byte of that number.
5A7A
INC HL 23
The text scanned (5A7AH), which 5A81H, 5A85H and 5A8DH all come back to: increment Register Pair HL to the next byte of the line's text.
5A7B
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, a character or a token of the line.
5A7C
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that ends every line.
5A7D
Jump to 5A8FH on Z, the end of the line having been reached, where its link is written.
5A7F
CP 20H FE 20
Compare Register A with 20H, the space, below which stand the tokens the tokenizer puts in place of a constant it has already converted.
5A81
Jump to 5A7AH on NC, the byte standing at 20H or above and so being an ordinary character or a keyword token, which is one byte wide and needs nothing done to it.
5A83
CP 0BH FE 0B
Compare Register A with 0BH, the lowest of the number tokens.
5A85
Jump to 5A7AH on C, the byte standing below 0BH, which is a control character in a string or a byte of the text that no number follows.
5A87
A packed constant stepped over (5A87H): call 5E94H, the entry of NXTCHAR that does not step the pointer, which reads this token and unpacks the number after it, leaving the place to carry on from in IPOS at 7145H.
5A8A
Call NXTCHAR at 5E93H, which reads the two byte stand-in at 5F10H the call above left Register Pair HL on and so puts the real pointer back out of 7145H, past however many bytes the number occupied.
5A8D
Jump to 5A7CH, which tests the byte now reached for the end of the line without stepping the pointer again, this routine being the only thing on the page that has to know how wide a packed number is and the only thing that does not.
5A8F
INC HL 23
The link written (5A8FH), which 5A7DH reaches: increment Register Pair HL past the 00H that ends the line, so that Register Pair HL addresses the first byte of the next line.
5A90
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the next line's address into Register Pair DE and this line's own address into Register Pair HL.
5A91
LD (HL),E 73
Store Register E, the low byte of the next line's address, into the byte Register Pair HL addresses, the first byte of this line's link.
5A92
INC HL 23
Increment Register Pair HL to the second byte of the link.
5A93
LD (HL),D 72
Store Register D, the high byte of that address, into the byte Register Pair HL addresses: this line now points at the one that follows it wherever the text has been moved to.
5A94
Jump to 5A72H, the head of the loop, which takes the next line up with its address already in Register Pair DE.
5A96
LD DE,0000H 11 00 00
The line number range (5A96H), which LIST calls at 79B4H, DELETE at 7BF0H and CHAIN at 5462H, entered with the Zero Flag set when nothing was typed after the keyword: load Register Pair DE with 0000H, the first line of the program, which is what the first of the two numbers means when it is not given.
5A99
PUSH DE D5
Push Register Pair DE, that 0000H, which 5AB1H takes off as the first number when nothing at all was typed.
5A9A
Jump to 5AA7H on Z, nothing standing after the keyword, which takes the second number's default of 65530 and asks for nothing.
5A9C
POP DE D1
Pop Register Pair DE, the default first number, which is thrown away because a real one is about to be read.
5A9D
Call NUM2DE at 5F9AH, which reads the first line number into Register Pair DE and leaves the Zero Flag set when the statement ends there.
5AA0
PUSH DE D5
Push Register Pair DE, that number, which 5AB1H takes off as the first end of the range.
5AA1
Jump to 5AB0H on Z, the statement having ended after one number, which makes both ends of the range that number and so lists or deletes the one line.
5AA3
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
5AA6
DEFB 0F4H F4
The token of the minus sign, which 4353H demands between the two numbers of the range. It is a token and not the character 2DH because the line has been through the tokenizer, and the leading 0 of the written form is why a decoder reading straight through shows these three bytes as CALL P,0FA11H.
5AA7
LD DE,0FFFAH 11 FA FF
The second number's default (5AA7H), which 5A9AH also jumps to: load Register Pair DE with 0FFFAH, 65530, the highest line number the interpreter will take, which is what the second of the two numbers means when it is not given.
5AAA
Call NUM2DE at 5F9AH on NZ, something standing after the minus token, which reads the second line number into Register Pair DE over the default just loaded.
5AAD
Jump to SYNERR 586CH on NZ, something standing after the second number, which can only be an error: a range is two numbers and a minus token and nothing else.
5AB0
EX DE,HL EB
The two ends settled (5AB0H), which 5AA1H also reaches: exchange Register Pair DE with Register Pair HL, which puts the second number into Register Pair HL. Reached from 5AA1H it puts the first number there instead, which is how one number comes to stand for both ends of the range.
5AB1
POP DE D1
Pop Register Pair DE, the first number pushed at 5A99H or 5AA0H, so that Register Pair DE is the first end of the range and Register Pair HL the second.
5AB2
EX (SP),HL E3
FIND with the caller's own pair saved (5AB2H), which 6104H calls and the range parser above falls into: exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the second number of the range, or the caller's own Register Pair HL, on the stack and brings the return address into Register Pair HL.
5AB3
PUSH HL E5
Push Register Pair HL, that return address, so that the value is on the stack below it and the caller takes it off for itself once FIND has answered.
5AB4
LD HL,(6E9EH) 2A 9E 6E
FIND (5AB4H), which fifteen places outside these bytes call, among them 3D2BH of EDIT, 4370H of RESTORE, 5956H of the error handler, 602EH of GOTO, 65C1H and 65C7H of RENUM, 6662H of the line reference walk and 7BFBH of DELETE: load Register Pair HL with the word at 6E9EH, PGMBGN, so that the search begins at the first line of the program.
5AB7
LD B,H 44
FIND from a line already reached (5AB7H), which 602BH calls when the line a GOTO names stands above the line being run and the whole program need not be searched: load Register B from Register H, the high byte of the address in Register Pair HL.
5AB8
LD C,L 4D
Load Register C from Register L, its low byte, so that Register Pair BC addresses the line this turn of the search is looking at, which is also the answer the routine gives back.
5AB9
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of this line's link.
5ABA
INC HL 23
Increment Register Pair HL to the high byte of the link.
5ABB
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, the high byte, which sets the Zero Flag when the link is 0000H and the program has ended. It also clears the Carry Flag, which is the answer this routine gives for a line that does not exist.
5ABC
DEC HL 2B
Decrement Register Pair HL back to the low byte of the link, the test above having moved it.
5ABD
RET Z C8
Return on Z with the Carry Flag clear, the program having ended with no line of that number in it, and Register Pair BC addressing the 0000H link, which is where a new line of that number would be put.
5ABE
INC HL 23
Increment Register Pair HL to the low byte of this line's number.
5ABF
INC HL 23
Increment Register Pair HL a second time, to the high byte of the link having been the first, so that Register Pair HL addresses that low byte.
5AC0
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of this line's number.
5AC1
INC HL 23
Increment Register Pair HL to the high byte of the number.
5AC2
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, that high byte, which also throws away the pointer because Register Pair BC holds the line's address.
5AC3
LD L,A 6F
Load Register L from Register A, the low byte, so that Register Pair HL is this line's number.
5AC4
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare this line's number with the one asked for, setting the Zero Flag when they are equal and the Carry Flag when this line's number is the smaller.
5AC7
LD H,B 60
Load Register H from Register B, the high byte of this line's address, which the two comparisons below need back.
5AC8
LD L,C 69
Load Register L from Register C, its low byte, so that Register Pair HL addresses this line again with both flags untouched, a load changing neither.
5AC9
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of this line's link, which is where the search goes next.
5ACA
INC HL 23
Increment Register Pair HL to the high byte of that link.
5ACB
LD H,(HL) 66
Load Register H with the byte Register Pair HL addresses, that high byte.
5ACC
LD L,A 6F
Load Register L from Register A, the low byte, so that Register Pair HL addresses the next line of the program.
5ACD
CCF 3F
Complement the Carry Flag, which turns the clear flag of an exact match into a set one: 434DH leaves the Carry Flag clear when the two numbers are equal and this is the one instruction that makes a match say so.
5ACE
RET Z C8
Return on Z with the Carry Flag set, the line asked for having been found, and Register Pair BC addressing it. This is the only way out of FIND that sets the Carry Flag, so a caller that reads the flag is asking whether a line of exactly that number exists and nothing else.
5ACF
CCF 3F
Complement the Carry Flag a second time, which puts it back as 434DH left it, the match having been tested for and failed.
5AD0
RET NC D0
Return on NC, this line's number standing above the one asked for, so that no line of that number exists and Register Pair BC addresses the first line beyond it, which is where one of that number would be inserted.
5AD1
Jump to 5AB7H, this line's number standing below the one asked for, which goes round the search with Register Pair HL addressing the next line.

5AD3H - TOBUFF: the Line Copied and Tokenized (5AD3H-5B42H)

Every line this interpreter ever runs comes through here. TOBUFF takes a line of text at the address in Register Pair HL and copies it into the line buffer at 6EFAH, turning each reserved word into its one byte token on the way, and the enhancement package's abbreviation patch calls it at 81C1H and jumps to it at 81BEH and 81E1H. Register Pair BC starts at 013BH, three hundred and fifteen, which is the room there is, and 5CFFH counts it down and gives error 23, Line buffer overflow, at 5D05H when it runs out. Two flags govern the copying and they are both written by the same instruction pair at 5B17H: 7143H set means copy everything verbatim and tokenize nothing, which is what DATA does, and 7144H is a three state flag that says what a digit means where it stands, 0FFH after a name so that a digit belongs to it, 00H so that a number is a constant and 01H after one of the fourteen tokens listed at 5C07H so that a number is a line number. A colon clears both of them because it ends a statement. 5B21H and 5B2CH are one loop with its terminator kept on the stack, which is how REM and a string literal are both copied without being read: the terminator is pushed as the Register A half of a word, 00H for REM and 22H for a quote, and 5B24H to 5B26H brings it back by exchanging Register Pair HL with the stack, taking Register H and popping the pointer again, three instructions none of which disturbs the Zero Flag that 5B23H set on the end of the line. 5B36H drops a byte whose bit 7 is set, stepping over it without copying it, which no line from the keyboard can hold and a line read out of a text file by 7E5DH can.

5AD3
XOR A AF
TOBUFF (5AD3H), which 59C2H of the line entered reaches and the enhancement package's abbreviation patch calls at 81C1H: clear Register A with XOR A, making 00H, the value both flags start at.
5AD4
LD (7144H),A 32 44 71
Store Register A into 7144H, the flag that says what a digit means where it stands, 00H meaning that a number is a constant.
5AD7
LD (7143H),A 32 43 71
Store Register A into 7143H, the flag that says copy everything verbatim, which no line starts with set.
5ADA
LD BC,013BH 01 3B 01
Load Register Pair BC with 013BH, three hundred and fifteen, the room there is in the line buffer, which 5D01H counts down.
5ADD
LD DE,6EFAH 11 FA 6E
Load Register Pair DE with 6EFAH, the second byte of the line buffer, the first being left for the line's own length.
5AE0
LD A,(HL) 7E
The next character of the line (5AE0H), which 5B1FH, 5B36H, 5BE9H, 5C7EH, 5CC7H and 5D2DH all reach: load Register A with the byte Register Pair HL addresses, the character being looked at.
5AE1
OR A B7
Or Register A with itself, which sets the Zero Flag when the byte is 00H and so the line has ended.
5AE2
Jump to 5AF7H on NZ, there being a character, which decides below what is to be done with it.
5AE4
LD HL,0140H 21 40 01
The line finished (5AE4H), which 5B27H also reaches: load Register Pair HL with 0140H, three hundred and twenty, which is the room there was and five bytes more.
5AE7
LD A,L 7D
Load Register L into Register A, 40H, the low byte of that figure.
5AE8
SUB C 91
Subtract Register C from Register A, the low byte of the room left.
5AE9
LD C,A 4F
Load Register A into Register C, the low byte of the difference, which is the length of the line as it now stands.
5AEA
LD A,H 7C
Load Register H into Register A, 01H, the high byte of that figure.
5AEB
SBC A,B 98
Subtract Register B and the Carry Flag from Register A, the high byte of the room left.
5AEC
LD B,A 47
Load Register A into Register B, so that Register Pair BC holds the length of the tokenized line and the caller at 59C2H has it.
5AED
LD HL,6EF9H 21 F9 6E
Load Register Pair HL with 6EF9H, LBUF, the first byte of the line buffer, which is what the caller is given to read the line from.
5AF0
XOR A AF
Clear Register A with XOR A, making 00H, the byte that ends the line and the two the link of the next line is read from.
5AF1
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, the byte after the last character, which ends the line.
5AF2
INC DE 13
Increment Register Pair DE to the byte after it.
5AF3
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, the first byte of a link of 0000H.
5AF4
INC DE 13
Increment Register Pair DE to the byte after that.
5AF5
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, the second byte of that link, so that a line run from the buffer ends the program there.
5AF6
RET C9
Return to the caller with Register Pair HL addressing 6EF9H and Register Pair BC holding the length.
5AF7
CP 22H FE 22
The character weighed (5AF7H): compare Register A with 22H, a double quote, which begins a string literal.
5AF9
Jump to 5B2CH on Z, the character being a quote, which copies it and everything up to the matching one without reading any of it.
5AFC
CP 20H FE 20
Compare Register A with 20H, a space, which is kept exactly where the user put it.
5AFE
Jump to 5B07H on Z, the character being a space, which copies it and takes the next.
5B00
LD A,(7143H) 3A 43 71
Load Register A with the byte at 7143H, the flag that says copy everything verbatim.
5B03
OR A B7
Or Register A with itself, which sets the Zero Flag when the flag is clear.
5B04
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character again, which changes no flag and so leaves that Zero Flag standing for the jump below.
5B05
Jump to 5B34H on Z, the flag being clear, where the character is tried against the reserved words.
5B07
INC HL 23
The character copied as it stands (5B07H), which 5AFEH, 5B2AH, 5C5DH, 5C64H and 5CDEH all reach: increment Register Pair HL to the character after it.
5B08
PUSH AF F5
Push Register AF, Register A holding the byte to be copied, which the call below writes over.
5B09
Call 5CFFH, which stores Register A into the buffer at the address in Register Pair DE, steps that pair on and gives Line buffer overflow when the room runs out.
5B0C
POP AF F1
Pop Register AF, that byte, back into that pair.
5B0D
SUB 3AH D6 3A
Subtract 3AH from Register A, a colon, so that the Zero Flag is set for a colon and the two comparisons below are made against the difference.
5B0F
Jump to 5B17H on Z, the byte being a colon, which clears both flags: a colon ends a statement, so what follows is read afresh.
5B11
CP 4AH FE 4A
Compare Register A with 4AH, which is 84H, the DATA token, less the colon taken off above.
5B13
Jump to 5B1DH on NZ, the byte being neither a colon nor DATA, where REM is tested for.
5B15
LD A,01H 3E 01
Load Register A with 01H, the byte being DATA, which is the value both flags take: everything to the end of the statement is copied as it stands.
5B17
LD (7143H),A 32 43 71
The two flags written (5B17H): store Register A into 7143H, the verbatim flag, 00H after a colon and 01H after DATA.
5B1A
LD (7144H),A 32 44 71
Store Register A into 7144H, the flag that says what a digit means, which takes the same value.
5B1D
SUB 55H D6 55
Subtract 55H from Register A, which is 8FH, the REM token, less the colon 5B0DH took off and the two values 5B17H may have left.
5B1F
Jump to 5AE0H on NZ, the byte not having been REM, which takes the next character of the line.
5B21
PUSH AF F5
REM reached (5B21H): push Register AF, Register A being 00H after the subtraction above, which is the terminator this loop looks for and which a line's own end gives instead.
5B22
LD A,(HL) 7E
The next character copied without being read (5B22H): load Register A with the byte Register Pair HL addresses.
5B23
OR A B7
Or Register A with itself, which sets the Zero Flag when the line has ended, and the three instructions below leave that flag alone.
5B24
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which puts the pointer into the line on the stack and brings the terminator word into Register Pair HL.
5B25
LD A,H 7C
Load Register H into Register A, the terminator, which is 00H for REM and 22H for a string literal.
5B26
POP HL E1
Pop Register Pair HL, the pointer into the line, which leaves the terminator nowhere but in Register A and the Zero Flag of 5B23H still standing.
5B27
Jump to 5AE4H on Z, the line having ended, where the length is worked out and the buffer closed: an unclosed string and a REM both end there.
5B29
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the terminator against the character, so that the Zero Flag is set when the closing quote has been reached.
5B2A
Jump to 5B07H on Z, the terminator having been found, which copies it and goes back to the ordinary reading of the line.
5B2C
PUSH AF F5
The character copied verbatim (5B2CH), which 5AF9H jumps to with Register A holding 22H and 5C44H with it holding 00H: push Register AF, that terminator, which the loop keeps on the stack.
5B2D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character inside the string or the remark.
5B2E
INC HL 23
Increment Register Pair HL to the character after it.
5B2F
Call 5CFFH, which stores Register A into the buffer and steps Register Pair DE on.
5B32
Jump to 5B22H, which takes the next character without reading it.
5B34
INC HL 23
The character tried as a reserved word (5B34H): increment Register Pair HL to the character after it, which the decrement at 5B39H undoes for every byte but one.
5B35
OR A B7
Or Register A with itself, Register A holding the character 5B04H loaded, which sets the Sign Flag on its bit 7.
5B36
Jump to 5AE0H on M, the byte standing at 80H or above, which drops it: the increment above stands, so the byte is stepped over and never copied, which is what becomes of a byte of 80H or more that 7E5DH let through out of a text file.
5B39
DEC HL 2B
Decrement Register Pair HL back to the character, the byte being an ordinary one.
5B3A
CP 3FH FE 3F
Compare Register A with 3FH, a question mark, which stands for PRINT.
5B3C
LD A,91H 3E 91
Load Register A with 91H, the PRINT token, which changes no flag and so leaves that comparison standing for the jump below.
5B3E
PUSH DE D5
Push Register Pair DE, the buffer pointer, which the reserved word search writes over.
5B3F
PUSH BC C5
Push Register Pair BC, the room left, for the same reason.
5B40
Jump to 5BF8H on Z, the character having been a question mark, which emits the PRINT token for it.

5B43H - The Tokenizer's Special Case for GO SUB and GO TO (5B43H-5B8AH)

This is the answer to a question the project carried for a pass, and the answer is in the keyword table and not in this code. The reserved word list for the letter G at 69AFH holds four entries, and the second of them is O TO with one space in the middle, so GO TO written with a single space is a reserved word in its own right and 5B90H's ordinary table lookup finds it and gives token 89H for it, the same token as GOTO. What this special case is for is everything the table cannot hold: the matcher at 5B74H skips no spaces at all and a table entry is one fixed spelling, so GO SUB with one space and GO TO with two or more reach their tokens only here. The shape follows from NXTCHAR: 5B53H matches the three characters GO and a space and leaves Register Pair HL on the character after the space, and 5B58H's call of NXTCHAR begins with an INC HL, so one more character is stepped over before the second pattern is tried. For GO SUB that character is the S and the pattern UB at 5B88H matches exactly; for GO TO the second space is what is stepped over and TO at 5B85H matches; and for GO TO with one space the T is stepped over, both patterns fail against the O, and 5B8BH hands the line to the general table, which is where the O TO entry is waiting. 5B46H and 5B49H are the guard: 7597H reads the character and turns a lower case letter into a capital, 4474H refuses anything that is not a letter, and a line that begins a word with anything else goes to 5C47H for the digits and the operators.

5B43
LD DE,6B32H 11 32 6B
A letter reached (5B43H): load Register Pair DE with 6B32H, the operator character table, which 5C47H's path uses and which this path leaves in that pair without reading.
5B46
Call 7597H, which loads the byte Register Pair HL addresses into Register A and turns a lower case letter into a capital by clearing bit 5, leaving anything else as it stands.
5B49
Call 4474H, the letter test, which sets the Carry Flag when Register A is not a letter of the alphabet.
5B4C
Jump to 5C47H on C, the character not being a letter, where a digit, a decimal point, an operator or a control character is dealt with.
5B4F
PUSH HL E5
Push Register Pair HL, the character the word begins at, which 5B8BH takes back when both patterns below have failed.
5B50
LD DE,5B81H 11 81 5B
Load Register Pair DE with 5B81H, the pattern of three characters GO and a space with a 00H after them.
5B53
Call 5B74H, the pattern matcher, which comes back with the Zero Flag set when every character of the pattern matched and Register Pair HL on the character after the last of them.
5B56
Jump to 5B8BH on NZ, the line not beginning with GO and a space, which hands it to the general reserved word table.
5B58
Call 5E93H, NXTCHAR, whose first instruction is an INC HL, so that one character past the space is stepped over before the two patterns below are tried: it is the second space of GO TO and the S of GO SUB.
5B5B
LD DE,5B85H 11 85 5B
Load Register Pair DE with 5B85H, the pattern of the two characters TO with a 00H after them.
5B5E
Call 5B74H, the pattern matcher, which sets the Zero Flag when both characters matched.
5B61
LD A,89H 3E 89
Load Register A with 89H, the GOTO token, which changes no flag and so leaves that Zero Flag standing for the jump below.
5B63
Jump to 5B70H on Z, GO TO with two spaces having been found, which emits the GOTO token for it.
5B66
LD DE,5B88H 11 88 5B
Load Register Pair DE with 5B88H, the pattern of the two characters UB with a 00H after them, the S having been stepped over at 5B58H.
5B69
Call 5B74H, the pattern matcher, which sets the Zero Flag when both characters matched.
5B6C
Jump to 5B8BH on NZ, neither pattern having matched, which hands the line to the general reserved word table: GO TO with one space goes this way and is found there.
5B6E
LD A,8DH 3E 8D
Load Register A with 8DH, the GOSUB token, GO SUB having been found.
5B70
POP BC C1
The token found (5B70H): pop Register Pair BC, the character the word began at which 5B4FH pushed, which is thrown away because Register Pair HL already stands past the whole of the keyword.
5B71
Jump to 5BF7H, which steps Register Pair HL back one and emits the token, the common tail every reserved word found this way and at 5B90H reaches.
5B74
LD A,(DE) 1A
The pattern matcher (5B74H), which 5B53H, 5B5EH and 5B69H call with the pattern in Register Pair DE and the line in Register Pair HL: load Register A with the byte Register Pair DE addresses, the next character of the pattern.
5B75
OR A B7
Or Register A with itself, which sets the Zero Flag on the 00H that ends every one of the three patterns.
5B76
RET Z C8
Return on Z, the whole pattern having matched, with the Zero Flag set and Register Pair HL standing on the character after the last one matched.
5B77
LD C,A 4F
Load Register A into Register C, the pattern character, so that the comparison below may be made after the call.
5B78
Call 7597H, which loads the byte Register Pair HL addresses into Register A as a capital letter: the routine skips no spaces, which is why a table entry cannot stand for two spellings.
5B7B
CP C B9
Compare Register A with Register C, the line's character against the pattern's.
5B7C
RET NZ C0
Return on NZ, the two differing, which leaves the Zero Flag clear and Register Pair HL wherever the matching got to.
5B7D
INC HL 23
Increment Register Pair HL to the next character of the line.
5B7E
INC DE 13
Increment Register Pair DE to the next character of the pattern.
5B7F
Jump to 5B74H, which tries that pair and so on to the end of the pattern.
5B81-5B84
DEFB 47H, 4FH, 20H, 00H 47 4F 20 00
5B81H to 5B84H: the characters G and O and a space with the 00H that ends them, which is the pattern 5B50H matches. A decoder reading straight through shows these four bytes as a LD B,A, a LD C,A and a JR NZ,5B85H.
5B85-5B87
DEFB 54H, 4FH, 00H 54 4F 00
5B85H to 5B87H: the characters T and O with the 00H that ends them, which is the pattern 5B5BH matches for GO TO written with two spaces.
5B88-5B8A
DEFB 55H, 42H, 00H 55 42 00
5B88H to 5B8AH: the characters U and B with the 00H that ends them, which is the pattern 5B66H matches for GO SUB, the S having been stepped over by NXTCHAR.

5B8BH - The Reserved Word Table Lookup and the Token Emitted (5B8BH-5C46H)

The table at 68C3H is one word for each letter of the alphabet and it points at the list of reserved words beginning with that letter, each word stored without its own first letter, the last character of a name carrying bit 7 and the token following it. 5B93H turns the letter into the index by taking 41H off it and doubling, which is why a word can only be found under its first letter and why a name that is not a reserved word costs one walk of one list and no more. 5BC2H to 5BCEH is the guard that keeps a keyword from being found inside a name: a letter or a digit after the match, which 7B62H answers for, or a decimal point, which 5BC5H tests itself because a decimal point is a character a BASIC name may carry, sends the whole word to 5D0AH to be copied as capitals instead, so GOTOX and IF.A are variables. 5BD9H to 5BE6H is the two byte form of a function token: a token with bit 7 clear is one of the fifty one functions the table at 685DH indexes, and it is emitted as 0FFH followed by the token with bit 7 set, which is how the tokenized line tells a function from a statement. 5C07H to 5C15H is the list of the fourteen tokens a line number may follow, and 5C18H, which is an entry point inside the JP NZ,013EH at 5C17H whose operand byte 3EH stands as a LD A,01H, is how a token found in that list leaves 7144H at 01H where every other token leaves it at 00H. The jump itself can never be taken, the XOR A above it having set the Zero Flag. Three tokens are not emitted as they stand: ELSE takes a colon in front of it, WHILE takes a second byte 0F3H after it, and the apostrophe becomes a colon, the REM token and the rest of the line copied without being read.

5B8B
POP HL E1
The general reserved word table (5B8BH), which 5B56H and 5B6CH reach: pop Register Pair HL, the character the word begins at, which 5B4FH pushed.
5B8C
Call 7597H, which loads that character into Register A and turns a lower case letter into a capital.
5B8F
PUSH HL E5
Push Register Pair HL, the word's first character, which 5B9DH takes back once the list has been found.
5B90
LD HL,68C3H 21 C3 68
Load Register Pair HL with 68C3H, the table of twenty six words, one for each letter of the alphabet.
5B93
SUB 41H D6 41
Subtract 41H from Register A, the character A, which turns the letter into a number from nothing to twenty five.
5B95
ADD A,A 87
Add Register A to itself, which doubles it, the table holding a word for each letter.
5B96
LD C,A 4F
Load Register A into Register C, that offset.
5B97
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC holds it as a sixteen bit value.
5B99
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which makes Register Pair HL address the letter's own word in the table.
5B9A
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address of that letter's list.
5B9B
INC HL 23
Increment Register Pair HL to the high byte's place.
5B9C
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE addresses the list of words beginning with that letter.
5B9D
POP HL E1
Pop Register Pair HL, the word's first character, which 5B8FH pushed.
5B9E
INC HL 23
Increment Register Pair HL to the character after it, the first letter being the index and standing in no stored name.
5B9F
PUSH HL E5
The next name of the list (5B9FH), which 5BF4H reaches: push Register Pair HL, the character after the word's first letter, so that every name of the list is tried from the same place.
5BA0
The next character compared (5BA0H): call 7597H, which loads the line's character into Register A as a capital.
5BA3
LD C,A 4F
Load Register A into Register C, that character, so that the comparison below may be made the other way about.
5BA4
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the stored name's character, whose bit 7 is set on the last of them.
5BA5
AND 7FH E6 7F
And Register A with 7FH, which takes that marker off and leaves the character itself.
5BA7
Jump to 5D0AH on Z, the byte having been 00H and the list having ended, where the word is copied as capitals: no reserved word begins this way.
5BAA
INC HL 23
Increment Register Pair HL to the next character of the line, whether this one matches or not.
5BAB
CP C B9
Compare Register A with Register C, the stored character against the line's.
5BAC
Jump to 5BECH on NZ, the two differing, where the rest of this name is stepped over and the next tried.
5BAE
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses again, the stored character with its bit 7 as it stands.
5BAF
INC DE 13
Increment Register Pair DE to the byte after it, which is the next character or the token.
5BB0
OR A B7
Or Register A with itself, which sets the Sign Flag on bit 7, the marker of the last character of the name.
5BB1
Jump to 5BA0H on P, there being another character of the name, which compares that one too.
5BB4
LD A,C 79
The whole name matched (5BB4H): load Register C into Register A, the last character of the line that matched.
5BB5
CP 28H FE 28
Compare Register A with 28H, an opening parenthesis, which the names TAB( and SPC( and the like end in.
5BB7
Jump to 5BD1H on Z, the name having ended in a parenthesis, which needs no guard: nothing can carry on from it.
5BB9
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the token of the name just matched.
5BBA
CP 0D4H FE D4
Compare Register A with 0D4H, the FN token, which the name of a user defined function follows and so must be taken even with a letter after it.
5BBC
Jump to 5BD1H on Z, the token being FN, which is accepted without the guard below.
5BBE
CP 0D3H FE D3
Compare Register A with 0D3H, the USR token, which a digit from nothing to nine follows and so must be taken with one after it.
5BC0
Jump to 5BD1H on Z, the token being USR, which is accepted in the same way.
5BC2
Call 7597H, which loads the character after the matched name into Register A as a capital.
5BC5
CP 2EH FE 2E
Compare Register A with 2EH, a decimal point, which a BASIC name may carry and which therefore makes what matched part of a name and not a keyword.
5BC7
Jump to 5BCCH on Z, the character being a decimal point, which leaves the Carry Flag clear and so takes the word to 5D0AH below.
5BC9
Call 7B62H, which calls 4474H and then tests the digits, coming back with the Carry Flag clear when Register A is a letter or a digit and set when it is neither.
5BCC
LD A,00H 3E 00
Load Register A with 00H, which 5D0CH turns into the 0FFH it stores in 7144H and which changes no flag, so that the Carry Flag of either test above stands for the jump below.
5BCE
Jump to 5D0AH on NC, a letter, a digit or a decimal point following the match, where the whole word is copied as capitals: a keyword is only a keyword when nothing carries on from it.
5BD1
POP AF F1
The token accepted (5BD1H): pop Register AF, the word pointer 5B9FH pushed, which is thrown away because Register Pair HL already stands past the keyword.
5BD2
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the token of the name matched.
5BD3
OR A B7
Or Register A with itself, which sets the Sign Flag on its bit 7.
5BD4
Jump to 5BF7H on M, the token standing at 80H or above and so being one of the statements, where the common tail emits it.
5BD7
POP BC C1
Pop Register Pair BC, the room left in the buffer, which 5B3FH pushed.
5BD8
POP DE D1
Pop Register Pair DE, the buffer pointer, which 5B3EH pushed, so that 5CFFH may write to it.
5BD9
OR 80H F6 80
Or Register A with 80H, which sets bit 7 of the function token: the token itself runs from 01H to 33H and the second byte of the pair carries it with that bit set.
5BDB
PUSH AF F5
Push Register AF, that byte, which the two instructions below write over.
5BDC
LD A,0FFH 3E FF
Load Register A with 0FFH, which is the first byte of every function in a tokenized line.
5BDE
Call 5CFFH, which stores it into the buffer and steps Register Pair DE on.
5BE1
XOR A AF
Clear Register A with XOR A, making 00H, the value 7144H takes after a function: a number that follows one is a constant.
5BE2
LD (7144H),A 32 44 71
Store Register A into 7144H, the flag that says what a digit means where it stands.
5BE5
POP AF F1
Pop Register AF, the function token with bit 7 set, which 5BDBH pushed.
5BE6
Call 5CFFH, which stores it into the buffer as the second byte of the pair.
5BE9
Jump to 5AE0H, which takes the next character of the line.
5BEC
POP HL E1
This name did not match (5BECH): pop Register Pair HL, the word pointer 5B9FH pushed, so that the next name is tried from the same character.
5BED
LD A,(DE) 1A
The rest of the name stepped over (5BEDH): load Register A with the byte Register Pair DE addresses, a character of the name being abandoned.
5BEE
INC DE 13
Increment Register Pair DE to the byte after it.
5BEF
OR A B7
Or Register A with itself, which sets the Sign Flag on bit 7, the marker of the last character.
5BF0
Jump to 5BEDH on P, that character not having been the last, which steps over the next.
5BF3
INC DE 13
Increment Register Pair DE past the token byte, so that the pair addresses the first character of the next name.
5BF4
Jump to 5B9FH, which tries that name from the same character of the line.
5BF7
DEC HL 2B
A statement token emitted (5BF7H), which 5B71H and 5BD4H reach: decrement Register Pair HL to the last character of the keyword, which 5B07H's own increment makes up for.
5BF8
PUSH AF F5
The token weighed against the line number list (5BF8H), which 5B40H reaches with the PRINT token for a question mark: push Register AF, the token, which 5C1DH takes back.
5BF9
LD DE,5C07H 11 07 5C
Load Register Pair DE with 5C07H, the list of the fourteen tokens after which a number is a line number and not a constant.
5BFC
LD C,A 4F
Load Register A into Register C, the token, so that the comparison below may be made the other way about.
5BFD
LD A,(DE) 1A
The next token of the list (5BFDH): load Register A with the byte Register Pair DE addresses.
5BFE
OR A B7
Or Register A with itself, which sets the Zero Flag on the 00H at 5C15H that ends the list.
5BFF
Jump to 5C16H on Z, the list having ended without a match, where 7144H is left at 00H.
5C01
INC DE 13
Increment Register Pair DE to the next token of the list.
5C02
CP C B9
Compare Register A with Register C, the listed token against the one found.
5C03
Jump to 5BFDH on NZ, the two differing, which tries the next of the fourteen.
5C05
Jump to 5C18H, the token being one of the fourteen, which is the LD A,01H standing inside the instruction at 5C17H.
5C07-5C15
DEFB 8CH, 0ABH, 0ACH, 0AAH, 0A7H, 0A9H, 0D7H, 0A2H, 8AH, 93H, 9EH, 89H, 0D0H, 8DH, 00H 8C AB AC AA A7 A9 D7 A2 8A 93 9E 89 D0 8D 00
5C07H to 5C15H: the fourteen tokens after which a number in the line is a line number, with the 00H at 5C15H that ends the list. They are RESTORE 8CH, AUTO 0ABH, RENUM 0ACH, DELETE 0AAH, EDIT 0A7H, RESUME 0A9H, ERL 0D7H, ELSE 0A2H, RUN 8AH, LIST 93H, LLIST 9EH, GOTO 89H, THEN 0D0H and GOSUB 8DH. A decoder reading straight through shows these bytes as instructions, the first of them an ADC A,H.
5C16
XOR A AF
Not one of the fourteen (5C16H): clear Register A with XOR A, making 00H, the value of 7144H that says a number following is a constant, which also sets the Zero Flag so that the jump below can never be taken.
5C17
JP NZ,013EH C2 3E 01
Jump to 013EH on NZ, which never happens: the three bytes are here for their operand, whose first byte 3EH stands at 5C18H as the LD A,01H that 5C05H jumps to.
5C1A
LD (7144H),A 32 44 71
The flag stored and the token emitted (5C1AH), which 5D47H also reaches: store Register A into 7144H, 00H for an ordinary token, 01H for one of the fourteen and whatever 5D40H left for an operator.
5C1D
POP AF F1
Pop Register AF, the token, which 5BF8H pushed.
5C1E
POP BC C1
Pop Register Pair BC, the room left in the buffer, which 5B3FH pushed.
5C1F
POP DE D1
Pop Register Pair DE, the buffer pointer, which 5B3EH pushed.
5C20
CP 0A2H FE A2
Compare Register A with 0A2H, the ELSE token, which the tokenized line carries a colon in front of.
5C22
PUSH AF F5
Push Register AF, the token and that comparison with it, which 5C26H takes back.
5C23
Call 5CFDH on Z, the token being ELSE, which loads Register A with 3AH and emits a colon, so that the statement before the ELSE is ended as the interpreter wants it.
5C26
POP AF F1
Pop Register AF, the token, which 5C22H pushed.
5C27
CP 0B4H FE B4
Compare Register A with 0B4H, the WHILE token, which is the one keyword the line carries two bytes for.
5C29
Jump to 5C30H on NZ, the token not being WHILE, where the apostrophe is tested for.
5C2B
Call 5CFFH, which emits the WHILE token itself into the buffer.
5C2E
LD A,0F3H 3E F3
Load Register A with 0F3H, the second byte WHILE is stored as, which 5C32H's own jump then emits through 5B07H.
5C30
CP 0DCH FE DC
The apostrophe tested for (5C30H): compare Register A with 0DCH, the token of the apostrophe, which stands for a remark.
5C32
Jump to 5CDCH on NZ, the token being any other, where the ampersand is tested for and every ordinary token is emitted through 5B07H.
5C35
PUSH AF F5
Push Register AF, the token, which 5C3EH takes back.
5C36
Call 5CFDH, which loads Register A with 3AH and emits a colon, so that the remark stands as a statement of its own.
5C39
LD A,8FH 3E 8F
Load Register A with 8FH, the REM token, which is what the apostrophe becomes in the tokenized line.
5C3B
Call 5CFFH, which stores the REM token into the buffer and steps Register Pair DE on.
5C3E
POP AF F1
Pop Register AF, the apostrophe's own token, which 5C35H pushed and which is not emitted: the colon and the REM stand in its place.
5C3F
PUSH HL E5
Push Register Pair HL, the pointer into the line, which the exchange below swaps for the terminator.
5C40
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, which is the terminator the copying loop below looks for, meaning the end of the line and nothing else.
5C43
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which leaves that terminator on the stack and brings the pointer into the line back into Register Pair HL.
5C44
Jump to 5B2EH, the middle of the verbatim loop, which copies the rest of the line without reading any of it: everything after an apostrophe is a remark.

5C47H - Line Numbers, Numeric Constants, the Operators and the Byte Emitter (5C47H-5D09H)

A character that is not a letter comes here and 7144H decides what it means. A digit or a decimal point with the flag at 0FFH belongs to the name just copied and goes through verbatim; with the flag at 00H it is a numeric constant, which 2F16H of BASIC/OV1 works out and 5CA9H stores in the line as a marker byte and the value's own two, four or eight bytes; and with the flag at 01H, which only one of the fourteen tokens at 5C07H leaves, it is a line number, which 5FA4H reads and 5C67H puts in the line as the byte 0EH and two bytes of binary. 5C9DH to 5CA7H is the short form of a small integer: a value below ten is one byte, the token 11H to 1AH, and a value below 256 is the byte 0FH and the value, which is why a line of BASIC takes less room than its text and why NXTCHAR at 5EB6H has three cases of its own to read these back. The markers for the longer constants come out of the type by one rotate and one addition at 5CAAH, 1CH for an integer, 1DH for single precision and 1FH for double. 5CCAH is the operator table at 6B32H, walked as character and token pairs with bit 7 taken off the character, and the one thing it leaves behind is the flag: 5D40H turns a 0FFH into 00H and leaves every other value standing, so an operator after a name lets the next number be a constant. 5CFFH is the one instruction the whole tokenizer writes through, and the room it counts down is what gives error 23, Line buffer overflow, at 5D05H; 5CFDH is the same thing with a colon loaded first. 5CDCH is the ampersand, 0BH for an octal constant and 0CH for a hexadecimal one, and because it makes that test here the CP 26H at 75A1H is never needed, which is why those five bytes cannot be reached.

5C47
LD A,(HL) 7E
Not a letter (5C47H), which 5B4CH jumps to: load Register A with the byte Register Pair HL addresses, the character.
5C48
CP 2EH FE 2E
Compare Register A with 2EH, a decimal point, which begins a constant as readily as a digit does.
5C4A
Jump to 5C56H on Z, the character being a decimal point, where the flag at 7144H decides what it means.
5C4C
CP 3AH FE 3A
Compare Register A with 3AH, one past the character 9.
5C4E
Jump to 5CCAH on NC, the character standing above the digits, where the operator table is walked for it.
5C51
CP 30H FE 30
Compare Register A with 30H, the character 0.
5C53
Jump to 5CCAH on C, the character standing below the digits, where the operator table is walked for it.
5C56
LD A,(7144H) 3A 44 71
A digit or a decimal point (5C56H): load Register A with the byte at 7144H, the flag that says what a digit means where it stands.
5C59
OR A B7
Or Register A with itself, which sets the Sign Flag for 0FFH and the Zero Flag for 00H.
5C5A
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character again, which changes no flag and so leaves both of those standing.
5C5B
POP BC C1
Pop Register Pair BC, the room left in the buffer, which 5B3FH pushed.
5C5C
POP DE D1
Pop Register Pair DE, the buffer pointer, which 5B3EH pushed, so that 5CFFH may write through it.
5C5D
Jump to 5B07H on M, the flag being 0FFH, which copies the digit as it stands: it belongs to the name just copied.
5C60
Jump to 5C81H on Z, the flag being 00H, where the characters are read as a numeric constant.
5C62
CP 2EH FE 2E
Compare Register A with 2EH, a decimal point, the flag being 01H and a line number being expected.
5C64
Jump to 5B07H on Z, the character being a decimal point where a line number was expected, which copies it as it stands and leaves the interpreter to complain later.
5C67
LD A,0EH 3E 0E
Load Register A with 0EH, the byte that stands in front of a line number as it was typed, which 5FA8H reads back.
5C69
Call 5CFFH, which stores it into the buffer and steps Register Pair DE on.
5C6C
PUSH DE D5
Push Register Pair DE, the buffer pointer, which 5C73H brings back by exchanging it for the pointer into the line.
5C6D
Call 5FA4H, the line reference test, which reads the digits and leaves the line number in Register Pair DE and Register Pair HL on the character after them.
5C70
Call 5D4AH, which steps Register Pair HL back over any spaces, tabs and line feeds and then forward one, so that the pointer stands on the last character of the number.
5C73
EX (SP),HL E3
Exchange the word Register Pair HL addresses at the Stack Pointer with Register Pair HL, which brings the buffer pointer into Register Pair HL and leaves the pointer into the line on the stack.
5C74
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the buffer pointer into Register Pair DE for 5CFFH and the line number into Register Pair HL.
5C75
LD A,L 7D
The low byte written (5C75H), which 5CA3H also reaches: load Register L into Register A, the low byte of the line number.
5C76
Call 5CFFH, which stores it into the buffer and steps Register Pair DE on.
5C79
LD A,H 7C
Load Register H into Register A, the high byte of the line number.
5C7A
POP HL E1
The high byte written (5C7AH), which 5CA7H also reaches: pop Register Pair HL, the pointer into the line which 5C73H left on the stack.
5C7B
Call 5CFFH, which stores that byte into the buffer and steps Register Pair DE on.
5C7E
Jump to 5AE0H, which takes the next character of the line.
5C81
PUSH DE D5
A numeric constant (5C81H): push Register Pair DE, the buffer pointer, which 5C8BH takes back.
5C82
PUSH BC C5
Push Register Pair BC, the room left, which 5C8AH takes back.
5C83
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the first character of the number.
5C84
Call 2F16H of BASIC/OV1, which reads the digits, the decimal point, the exponent and any type suffix, leaves the value in the accumulator and its type in 7142H and Register Pair HL on the character after the number.
5C87
Call 5D4AH, which steps Register Pair HL back over any trailing spaces, tabs and line feeds and then forward one.
5C8A
POP BC C1
Pop Register Pair BC, the room left, which 5C82H pushed.
5C8B
POP DE D1
Pop Register Pair DE, the buffer pointer, which 5C81H pushed.
5C8C
PUSH HL E5
Push Register Pair HL, the pointer into the line, which 5C7AH or 5CC6H takes back.
5C8D
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the constant, 02H an integer, 04H single precision and 08H double.
5C90
CP 02H FE 02
Compare Register A with 02H, an integer, which is the only type the short forms below are used for.
5C92
Jump to 5CA9H on NZ, the constant being a floating point one, where the marker and its bytes are written in full.
5C94
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the integer itself.
5C97
LD A,H 7C
Load Register H into Register A, its high byte.
5C98
OR A B7
Or Register A with itself, which sets the Zero Flag when the value stands below 256.
5C99
LD A,02H 3E 02
Load Register A with 02H, the type, which changes no flag and so leaves that Zero Flag standing for the jump below.
5C9B
Jump to 5CA9H on NZ, the value standing at 256 or above, where the marker 1CH and its two bytes are written.
5C9D
LD A,L 7D
Load Register L into Register A, the low byte of the value, the whole of it.
5C9E
LD H,L 65
Load Register H from Register L, the same byte, so that 5C7AH writes it as the high half of what it thinks is a word.
5C9F
LD L,0FH 2E 0F
Load Register L with 0FH, the marker that stands in front of a one byte constant, so that 5C75H writes that marker and 5C7BH the value.
5CA1
CP 0AH FE 0A
Compare Register A with 0AH, ten, the values below which have a marker of their own.
5CA3
Jump to 5C75H on NC, the value standing at ten or above, which writes the marker 0FH and then the byte.
5CA5
ADD A,11H C6 11
Add 11H to Register A, the value standing below ten, which makes the tokens 11H to 1AH, one for each of the ten digits.
5CA7
Jump to 5C7AH, which writes that one byte and nothing else: a constant of nothing to nine costs a single byte in the line.
5CA9
PUSH AF F5
The marker and the bytes of the value (5CA9H): push Register AF, Register A holding the type, which 5CBBH takes back as the count of bytes to write.
5CAA
RRCA 0F
Rotate Register A right circularly, which halves the type, 02H becoming 01H, 04H becoming 02H and 08H becoming 04H.
5CAB
ADD A,1BH C6 1B
Add 1BH to Register A, which makes the marker: 1CH for an integer, 1DH for single precision and 1FH for double.
5CAD
Call 5CFFH, which stores that marker into the buffer and steps Register Pair DE on.
5CB0
LD HL,72ECH 21 EC 72
Load Register Pair HL with 72ECH, the accumulator's own four bytes, which hold an integer or a single precision value entire.
5CB3
Call 76A4H, which loads the type from 7142H, takes 03H off it and comes back with the Carry Flag set for anything below double precision.
5CB6
Jump to 5CBBH on C, the constant not being double precision, which leaves Register Pair HL at 72ECH.
5CB8
LD HL,72E8H 21 E8 72
Load Register Pair HL with 72E8H, the lowest of the accumulator's eight bytes, the constant being double precision.
5CBB
POP AF F1
Pop Register AF, the type, which 5CA9H pushed and which is also the number of bytes to write.
5CBC
PUSH AF F5
The next byte of the value (5CBCH): push Register AF, that count.
5CBD
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, a byte of the value.
5CBE
Call 5CFFH, which stores it into the buffer and steps Register Pair DE on.
5CC1
POP AF F1
Pop Register AF, the count, which 5CBCH pushed.
5CC2
INC HL 23
Increment Register Pair HL to the next byte of the value.
5CC3
DEC A 3D
Decrement Register A, one byte having been written.
5CC4
Jump to 5CBCH on NZ, there being more of the value, so that two, four or eight bytes go into the line after the marker.
5CC6
POP HL E1
Pop Register Pair HL, the pointer into the line, which 5C8CH pushed.
5CC7
Jump to 5AE0H, which takes the next character of the line.
5CCA
LD DE,6B31H 11 31 6B
The operator table (5CCAH), which 5C4EH and 5C53H reach: load Register Pair DE with 6B31H, one byte below the table at 6B32H, so that the increment below lands on its first character.
5CCD
INC DE 13
The next entry of the table (5CCDH): increment Register Pair DE to the character of this entry.
5CCE
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, that character with its bit 7 set as the table holds it.
5CCF
AND 7FH E6 7F
And Register A with 7FH, which takes that bit off and leaves the character itself, and sets the Zero Flag on the 00H at 6B46H that ends the table.
5CD1
Jump to 5D30H on Z, the table having ended without a match, where a control character is turned into a space.
5CD4
INC DE 13
Increment Register Pair DE to the token of this entry.
5CD5
CP (HL) BE
Compare Register A with the byte Register Pair HL addresses, the table's character against the line's.
5CD6
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, the token of this entry, which changes no flag and so leaves that comparison standing.
5CD7
Jump to 5CCDH on NZ, the two characters differing, which tries the next entry, the pair now addressing this entry's token.
5CD9
Jump to 5D3FH, the character having been found, with its token in Register A: the flag at 7144H is settled there and the token emitted through 5C1AH.
5CDC
CP 26H FE 26
The ampersand, and every other token emitted (5CDCH), which 5C32H reaches: compare Register A with 26H, an ampersand, which begins an octal or hexadecimal constant.
5CDE
Jump to 5B07H on NZ, Register A holding anything else, which stores it into the buffer and takes the next character: this is where every ordinary token leaves the tokenizer.
5CE1
PUSH HL E5
Push Register Pair HL, the pointer at the ampersand, which 5CE5H takes back.
5CE2
Call 5E93H, NXTCHAR, which steps past the ampersand and brings the character after it back in Register A.
5CE5
POP HL E1
Pop Register Pair HL, the pointer at the ampersand, back into that pair.
5CE6
Call 7598H, which is 7597H without its first instruction, so that the character already in Register A is turned into a capital rather than a fresh one read.
5CE9
CP 48H FE 48
Compare Register A with 48H, the letter H, which marks a hexadecimal constant where anything else, the letter O included, marks an octal one.
5CEB
LD A,0BH 3E 0B
Load Register A with 0BH, the marker of an octal constant, which changes no flag and so leaves that comparison standing.
5CED
Jump to 5CF1H on NZ, the letter not being H, which leaves that marker in Register A.
5CEF
LD A,0CH 3E 0C
Load Register A with 0CH, the marker of a hexadecimal constant.
5CF1
Call 5CFFH, which stores that marker into the buffer and steps Register Pair DE on.
5CF4
PUSH DE D5
Push Register Pair DE, the buffer pointer, which 5C73H brings back by exchanging it for the pointer into the line.
5CF5
PUSH BC C5
Push Register Pair BC, the room left, which 5CF9H takes back.
5CF6
Call 75A6H, the ampersand constant reader, which reads the digits in the base the letter named and leaves the value in Register Pair DE.
5CF9
POP BC C1
Pop Register Pair BC, the room left, which 5CF5H pushed.
5CFA
Jump to 5C73H, which exchanges the buffer pointer back and writes the two bytes of the value after the marker.
5CFD
LD A,3AH 3E 3A
A colon emitted (5CFDH), which 5C23H and 5C36H call: load Register A with 3AH, a colon, and fall into the emitter below.
5CFF
LD (DE),A 12
A byte emitted (5CFFH), which fifteen places of the tokenizer call: store Register A into the byte Register Pair DE addresses, the next place in the line buffer.
5D00
INC DE 13
Increment Register Pair DE to the place after it.
5D01
DEC BC 0B
Decrement Register Pair BC, the room left in the buffer, which 5ADAH set to 013BH.
5D02
LD A,C 79
Load Register C into Register A, the low byte of the room left.
5D03
OR B B0
Or Register B with Register A, its high byte, which leaves the Zero Flag set only when both are 00H.
5D04
RET NZ C0
Return on NZ, there being room still, which is the way out of all but the last of the three hundred and fifteen calls.
5D05
LD E,17H 1E 17
The buffer full (5D05H), which 7E7CH of the line reader also jumps to: load Register E with 17H, twenty three, the number of the Line buffer overflow error.
5D07
Jump to 5886H, the error handler, which prints the message and takes the interpreter back to command level.

5D0AH - A Name, a Punctuation Character, and the Whitespace Trimmer (5D0AH-5D59H)

5D0AH is where a word that is not a reserved word is copied, and it copies it as capitals: 7597H clears bit 5 of each letter, so print typed in lower case comes out of the tokenizer as the PRINT token and total as TOTAL, which is why a listing shows every name in capitals whatever the user typed. The run it copies is a letter and then any letter, digit or decimal point, which are the characters a BASIC name may carry, and 5D0CH leaves 7144H at 0FFH so that the digits of A1 belong to the name and are not read as a constant. 5D30H is the last resort: a character of 20H or more that is in no reserved word and in no operator table entry is copied as it stands, which is how the comma, the semicolon, the parentheses and the quote inside a format all reach the line, and anything below 20H that is not a tab or a line feed becomes a space. 5D3FH then settles the flag: 5D43H's INC A turns a 0FFH into 00H and the DEC A at 5D46H puts every other value back, so a punctuation character after a name lets the next number be a constant and a punctuation character after a line number keeps the 01H. 5D4AH is the trailing whitespace trimmer, sixteen bytes that step backwards over spaces, tabs and line feeds and then forward one, and it is called in three places after a number has been read so that the pointer stands on the number's own last character and not on the space after it.

5D0A
POP HL E1
A word that is not a reserved word (5D0AH), which 5BA7H and 5BCEH reach: pop Register Pair HL, the character after the word's first letter which 5B9FH pushed.
5D0B
DEC HL 2B
Decrement Register Pair HL to the word's first letter, which is where the copying begins.
5D0C
DEC A 3D
Decrement Register A, 00H as 5BCCH left it, which makes 0FFH.
5D0D
LD (7144H),A 32 44 71
Store Register A into 7144H, the flag that says what a digit means, 0FFH meaning that a digit belongs to the name just copied.
5D10
POP BC C1
Pop Register Pair BC, the room left in the buffer, which 5B3FH pushed.
5D11
POP DE D1
Pop Register Pair DE, the buffer pointer, which 5B3EH pushed, so that 5CFFH may write through it.
5D12
Call 7597H, which loads the byte Register Pair HL addresses into Register A and turns a lower case letter into a capital.
5D15
The character copied (5D15H): call 5CFFH, which stores Register A into the buffer and steps Register Pair DE on.
5D18
INC HL 23
Increment Register Pair HL to the next character of the line.
5D19
Call 7597H, which loads that character into Register A as a capital.
5D1C
Call 4474H, the letter test, which sets the Carry Flag when Register A is not a letter of the alphabet.
5D1F
Jump to 5D15H on NC, the character being a letter, which copies it and takes the next.
5D21
CP 3AH FE 3A
Compare Register A with 3AH, one past the character 9.
5D23
Jump to 5D2DH on NC, the character standing above the digits, which ends the name there.
5D25
CP 30H FE 30
Compare Register A with 30H, the character 0.
5D27
Jump to 5D15H on NC, the character being a digit, which copies it as part of the name.
5D29
CP 2EH FE 2E
Compare Register A with 2EH, a decimal point, which a BASIC name may carry.
5D2B
Jump to 5D15H on Z, the character being a decimal point, which copies it as part of the name.
5D2D
Jump to 5AE0H, the name having ended, which takes the next character of the line.
5D30
LD A,(HL) 7E
A character in no table (5D30H), which 5CD1H reaches: load Register A with the byte Register Pair HL addresses, that character.
5D31
CP 20H FE 20
Compare Register A with 20H, a space, which is the lowest code that is an ordinary character.
5D33
Jump to 5D3FH on NC, the character standing at 20H or above, which copies it as it stands: the comma, the semicolon and the parentheses all come this way.
5D35
CP 09H FE 09
Compare Register A with 09H, a tab, which a text file may hold and which the line keeps.
5D37
Jump to 5D3FH on Z, the character being a tab, which is kept as it is.
5D39
CP 0AH FE 0A
Compare Register A with 0AH, a line feed, which is kept in the same way.
5D3B
Jump to 5D3FH on Z, the character being a line feed.
5D3D
LD A,20H 3E 20
Load Register A with 20H, a space, which every other control character becomes.
5D3F
PUSH AF F5
The flag settled and the byte emitted (5D3FH), which 5CD9H reaches with an operator's token: push Register AF, the byte to be emitted, which 5C1DH takes back.
5D40
LD A,(7144H) 3A 44 71
Load Register A with the byte at 7144H, the flag that says what a digit means.
5D43
INC A 3C
Increment Register A, which makes 00H of a 0FFH and sets the Zero Flag for it alone.
5D44
Jump to 5D47H on Z, the flag having been 0FFH, which leaves Register A at 00H: a punctuation character or an operator ends a name, so the next number is a constant.
5D46
DEC A 3D
Decrement Register A, which puts the flag back as it was, 00H or 01H, so that a line number expected after one of the fourteen tokens is still expected after a comma.
5D47
Jump to 5C1AH, which stores the flag into 7144H and emits the byte with the three special cases of ELSE, WHILE and the apostrophe.
5D4A
DEC HL 2B
The trailing whitespace trimmer (5D4AH), which 5C70H, 5C87H and 59B5H call: decrement Register Pair HL to the character before the one it addresses.
5D4B
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that character.
5D4C
CP 20H FE 20
Compare Register A with 20H, a space, which is the commonest of the three this routine steps back over.
5D4E
Jump to 5D4AH on Z, the character being a space, which steps back over it.
5D50
CP 09H FE 09
Compare Register A with 09H, a tab, which only a line read out of a text file can hold.
5D52
Jump to 5D4AH on Z, the character being a tab, which steps back over it in the same way.
5D54
CP 0AH FE 0A
Compare Register A with 0AH, a line feed, the third and last of the three this routine steps back over.
5D56
Jump to 5D4AH on Z, the character being a line feed, which steps back over it as well.
5D58
INC HL 23
Increment Register Pair HL to the character after the last one that is none of the three, which is the character the caller is to carry on from.
5D59
RET C9
Return to the caller with Register Pair HL standing on the last character of what was read and not on the whitespace after it.

5D5AH - FOR: Build the Loop Frame and Make the First Test (5D5AH-5E3AH)

FOR builds the nineteen byte frame NEXT reads and then jumps into NEXT to make the first test, which is why the manual can say that under version 6 the body of a loop whose start already passes its limit is skipped. The frame is built downward by nine words and one byte, so that its lowest byte is the marker 82H, and counting up from that marker it is: +0 the token 82H; +1,+2 the loop variable's address; +3,+4 the text pointer of the matching NEXT; +5 the direction byte; +6 the variable's type less three; +7 to +10 the step; +11 to +14 the limit; +15,+16 the line number of the FOR; and +17,+18 the text pointer of the statement after it. Three things in it are worth setting out. The direction byte at +5 is the sign of the step, 01H for a positive one, 0FFH for a negative one and 02H for a step of zero, and NEXT's `SUB B` at 45B9H ends the loop when the comparison's answer equals it: a comparison can answer only -1, 0 or +1, so a step of zero makes a loop that never ends, which is exactly what the manual warns of when it says this might never happen, say if STEP = 0. A double precision loop is refused at 5DC4H with Type mismatch, so only integer and single precision loops exist, and the two build the frame's step and limit by different routes, the integer path reaching the stack through the EX (SP),HL at 5DD3H and the single path popping that word at 5DEBH and pushing two of its own. And a FOR met again without its NEXT having run finds its old frame and cuts the stack back to it, the walk at 5D8BH to 5DA1H matching both the variable's address and the text pointer, so a GOTO back into a loop costs nothing. The scan for the matching NEXT is made now, not later: 5E1CH calls 6714H, which gives error 26, FOR Without NEXT, if the program runs out, and the pointer it finds goes into the frame at +3,+4 so that NEXT's test at 454AH can enforce one NEXT for each FOR.

5D5A
LD A,64H 3E 64
FOR (5D5AH), the routine the statement address table holds for token 082H at 67C5H: load Register A with 64H, the value the variable search's flag is to carry while the loop variable is found.
5D5C
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H, the flag the variable search reads at 3A7AH, which here says that the name is to be found or made as a simple variable and not as an array.
5D5F
Call the variable search at 39FBH, which finds or makes the loop variable and returns its address in Register Pair DE, with its type left in 7142H.
5D62
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
5D65
DEFB 0F1H F1
The equals token, which 4353H compares the line's character with. It is read as data by the routine the call at 5D62H reaches, not executed, and the instruction after that call is the one at 5D66H. A decoder reading straight through shows it as POP AF.
5D66
PUSH DE D5
Push Register Pair DE, the loop variable's address, which the POP DE at 5D7EH brings back.
5D67
LD (7184H),DE ED 53 84 71
Store Register Pair DE into the word at 7184H, the cell a text pointer usually waits in, which here keeps the variable's address until 5E2AH takes it for the frame.
5D6B
LD A,(7142H) 3A 42 71
Load Register A from the byte at 7142H, the type of the loop variable, which the initial value is to be converted to.
5D6E
PUSH AF F5
Push Register Pair AF, that type, which the POP AF at 5D72H brings back across the expression.
5D6F
Call the expression evaluator at 7345H, which works the initial value out and leaves it in the accumulator at 72ECH with its own type in 7142H.
5D72
POP AF F1
Pop Register Pair AF, the loop variable's type, pushed at 5D6EH.
5D73
PUSH HL E5
Push Register Pair HL, the text pointer standing after the initial value, which the POP HL at 5D7DH brings back.
5D74
Call 78DDH, the type conversion dispatcher, which masks the type in Register A to three bits and takes the conversion routine out of the table at 6B53H: 29F4H CINT for an integer, 2A6AH CSNG for a single and 2A96H CDBL for a double. The initial value is now of the variable's own type.
5D77
LD HL,729DH 21 9D 72
Load Register Pair HL with 729DH, the four byte cell the loop's starting value is kept in, which NEXT reads at 4568H and 4598H on the FOR entry.
5D7A
Call 293EH of the overlay, which stores the four bytes of the accumulator into the bytes Register Pair HL addresses, so that NEXT can give the variable its starting value instead of adding the step.
5D7D
POP HL E1
Pop Register Pair HL, the text pointer pushed at 5D73H.
5D7E
POP DE D1
Pop Register Pair DE, the loop variable's address, pushed at 5D66H.
5D7F
POP BC C1
Pop Register Pair BC, the statement loop's own address that the dispatcher pushed, which has to come off before the frame is built and which this statement never uses again, because it leaves through NEXT.
5D80
PUSH HL E5
Push Register Pair HL, the text pointer standing after the initial value, which the EX (SP),HL at 5DB4H exchanges for the pointer below.
5D81
Call 6065H, the statement skipper's DATA entry, which runs the text pointer on to the colon of the next statement or to the end of the line.
5D84
LD (717EH),HL 22 7E 71
Store Register Pair HL into the word at 717EH, the text pointer of the statement after the FOR, which goes into the frame at +17,+18 and is where NEXT sends the program at the top of each turn.
5D87
LD HL,0002H 21 02 00
Load Register Pair HL with 0002H, the offset at which the frames begin above the Stack Pointer once the return address has been taken off.
5D8A
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, so that Register Pair HL addresses the first byte of whatever frame stands on the stack.
5D8B
The old frame walk (5D8BH): call 57FAH, the frame finder's second entry, which takes the marker byte Register Pair HL addresses, steps over a WHILE frame by six bytes, and returns with the Zero Flag set and Register Pair BC holding the variable's address when it meets a FOR frame.
5D8E
Jump to 5DA9H on NZ, no FOR frame for this variable standing on the stack, which is the ordinary case of a loop met for the first time: 5DA9H is the operand byte of the instruction at 5DA8H and is a POP DE of its own.
5D90
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps Register Pair HL on by the frame's own length to the bytes the walk is to read.
5D91
PUSH DE D5
Push Register Pair DE, the loop variable's address, which the POP DE at 5DA0H brings back each turn of the walk.
5D92
DEC HL 2B
Decrement Register Pair HL to the high byte of the frame's own text pointer at +17,+18.
5D93
LD D,(HL) 56
Load Register D from the byte Register Pair HL addresses, that high byte.
5D94
DEC HL 2B
Decrement Register Pair HL to the low byte of that same text pointer, two bytes being read downward because the walk arrived above them.
5D95
LD E,(HL) 5E
Load Register E from the byte Register Pair HL addresses, so that Register Pair DE holds the text pointer this old frame was built with.
5D96
INC HL 23
Increment Register Pair HL back towards the frame's foot, the first of two steps.
5D97
INC HL 23
Increment Register Pair HL a second time, so that Register Pair HL stands where the walk left it.
5D98
PUSH HL E5
Push Register Pair HL, that address, which the POP HL at 5D9FH brings back.
5D99
LD HL,(717EH) 2A 7E 71
Load Register Pair HL from the word at 717EH, the text pointer this FOR statement has just worked out.
5D9C
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Zero Flag when the old frame belongs to this very FOR statement and not to another loop on the same variable.
5D9F
POP HL E1
Pop Register Pair HL, the walk's own pointer, pushed at 5D98H.
5DA0
POP DE D1
Pop Register Pair DE, the loop variable's address, pushed at 5D91H.
5DA1
Jump back to 5D8BH on NZ, the frame belonging to a different FOR on the same variable, so that the walk goes on up the stack.
5DA3
POP DE D1
Pop Register Pair DE, the word the walk left on the stack, which is thrown away now that the old frame has been found.
5DA4
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which cuts the stack back to the old frame and so throws it and everything above it away: a FOR met again without its NEXT having run does not stack a second frame, which is the same device WHILE makes at 52DCH.
5DA5
LD (718EH),HL 22 8E 71
Store Register Pair HL into the word at 718EH, the cell that says where the stack stands, which has just moved.
5DA8
LD C,0D1H 0E D1
Load Register C with 0D1H, a value nothing reads: this instruction is here for its operand byte at 5DA9H, which as an instruction is POP DE and is the entry the jump at 5D8EH takes.
5DAA
EX DE,HL EB
The frame (5DAAH), which both paths reach: exchange Register Pair DE with Register Pair HL, which puts the loop variable's address into Register Pair HL.
5DAB
LD C,08H 0E 08
Load Register C with 08H, the number of words of stack the frame below needs.
5DAD
Call 4247H, which works out whether there is room for eight words above the top of the program and variable space at 7153H and gives Out of memory through 425CH when there is not.
5DB0
PUSH HL E5
Push Register Pair HL, the loop variable's address, which the exchange below swaps for the text pointer: this is the frame's highest word, +17 and +18.
5DB1
LD HL,(717EH) 2A 7E 71
Load Register Pair HL from the word at 717EH, the text pointer of the statement after the FOR.
5DB4
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that text pointer in the frame at +17,+18 and brings the loop variable's address back into Register Pair HL.
5DB5
PUSH HL E5
Push Register Pair HL, the variable's address again, which the exchange below swaps for the line number: this word becomes the frame's +15,+16.
5DB6
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL from the word at 6E9CH, the number of the line being run, which is the FOR's own line.
5DB9
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that line number in the frame at +15,+16 and brings the variable's address back into Register Pair HL.
5DBA
Call 4353H, which insists on the byte standing after this call, the only word allowed after the initial value being TO.
5DBD
DEFB 0CFH CF
The TO token, data for the call at 5DBAH and not an instruction; the instruction after that call is the one at 5DBEH. A decoder reading straight through shows it as RST 08H.
5DBE
Call 76A4H, which reads the type of the loop variable from 7142H and returns it in Register A less 03H, with the Zero Flag set for a string and the Carry Flag set for anything below double precision.
5DC1
Jump to 5884H on Z, which is error 13, Type mismatch: the loop variable is a string and no string can be counted.
5DC4
Jump to 5884H on NC, which is error 13 again: the type stands at 08H or above and so is double precision, which this interpreter will not make a loop of. Only integer and single precision loops exist.
5DC7
PUSH AF F5
Push Register Pair AF, the type and the Carry Flag that says which of the two kinds it is, which the POP AF at 5DCBH brings back.
5DC8
Call the expression evaluator at 7345H, which works the loop's limit out and leaves it in the accumulator.
5DCB
POP AF F1
Pop Register Pair AF, the loop variable's type, pushed at 5DC7H.
5DCC
PUSH HL E5
Push Register Pair HL, the text pointer standing after the limit, which the two paths below take back in their own way.
5DCD
Jump to 5DE5H on P, the variable being single precision, which builds the frame's step and limit as two four byte values.
5DD0
The integer loop (5DD0H): call CINT at 29F4H of the overlay, which turns the limit into a two byte integer in Register Pair HL.
5DD3
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the two byte limit on the stack and brings the text pointer back into Register Pair HL.
5DD4
LD DE,0001H 11 01 00
Load Register Pair DE with 0001H, the step a loop takes when no STEP keyword is given.
5DD7
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the limit.
5DD8
CP 0D2H FE D2
Compare Register A with 0D2H, the token of the STEP keyword.
5DDA
Call 798DH on Z, which steps the text pointer past the token, works the step out and leaves it in Register Pair DE with the flags set from Register D.
5DDD
PUSH DE D5
Push Register Pair DE, the two byte step, which becomes the frame's +11,+12 with the limit already at +13,+14 from the exchange at 5DD3H.
5DDE
PUSH HL E5
Push Register Pair HL, the text pointer, which the POP HL at 5E07H brings back.
5DDF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the step into Register Pair HL for the sign test below.
5DE0
Call 2911H of the overlay, the integer sign test, which returns 00H in Register A for a step of zero and otherwise the sign of Register H turned into 01H or 0FFH.
5DE3
Jump to 5E07H, the point both kinds of loop meet at, with the sign of the step in Register A.
5DE5
The single precision loop (5DE5H), reached from 5DCDH: call CSNG at 2A6AH of the overlay, which makes the limit single precision whatever it arrived as.
5DE8
Call 2932H of the overlay, which reads the accumulator out into Register Pair DE and Register Pair BC, low word first, so that the limit is in registers for the two pushes below.
5DEB
POP HL E1
Pop Register Pair HL, the text pointer pushed at 5DCCH, which this path takes back now rather than leaving it under the frame.
5DEC
PUSH BC C5
Push Register Pair BC, the high half of the four byte limit, which becomes the frame's +13,+14.
5DED
PUSH DE D5
Push Register Pair DE, its low half, which becomes +11,+12.
5DEE
LD BC,8100H 01 00 81
Load Register Pair BC with 8100H, the high two bytes of the single precision constant 1, which is the step a loop takes when no STEP keyword is given.
5DF1
LD D,C 51
Load Register D from Register C, making it 00H, the first of the constant's two low bytes.
5DF2
LD E,D 5A
Load Register E from Register D, making it 00H as well, so that Register Pair DE holds the constant's low half.
5DF3
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the limit.
5DF4
CP 0D2H FE D2
Compare Register A with 0D2H, the token of the STEP keyword.
5DF6
LD A,01H 3E 01
Load Register A with 01H, the direction byte of a positive step, which is what a loop with no STEP has; the load sets no flag, so the comparison above still decides the jump below.
5DF8
Jump to 5E08H on NZ, there being no STEP keyword, with the constant 1 in Register Pair BC and Register Pair DE and 01H in Register A.
5DFA
Call 7346H, the expression evaluator one byte in, which steps past the STEP token and works the step out into the accumulator.
5DFD
PUSH HL E5
Push Register Pair HL, the text pointer standing after the step, which the POP HL at 5E07H brings back.
5DFE
Call CSNG at 2A6AH of the overlay, which makes the step single precision.
5E01
Call 2932H of the overlay, which reads it out into Register Pair DE and Register Pair BC for the two pushes below.
5E04
Call 28C4H of the overlay, the sign test, which returns 00H in Register A for a step of zero, 01H for a positive one and 0FFH for a negative one.
5E07
POP HL E1
Pop Register Pair HL, the text pointer, pushed at 5DDEH on the integer path and at 5DFDH on the single one.
5E08
PUSH BC C5
Push Register Pair BC, the high half of the step, which becomes the frame's +9,+10; on the integer path these two words are leftovers that nothing ever reads.
5E09
PUSH DE D5
Push Register Pair DE, its low half, which becomes the frame's +7,+8.
5E0A
OR A B7
OR Register A with itself, which sets the Zero Flag when the sign test gave 00H and so when the step is zero.
5E0B
Jump to 5E0FH on NZ, the step having a sign of its own, which goes into the frame as it stands.
5E0D
LD A,02H 3E 02
Load Register A with 02H, the direction byte of a step of zero. No comparison can answer 2, the answers being -1, 0 and 1, so NEXT's test at 45B9H never ends such a loop: this is the endless loop the manual warns of when it says that the loop might never finish if STEP is 0.
5E0F
LD C,A 4F
Load Register C from Register A, the direction byte, which becomes the frame's +5.
5E10
Call 76A4H, which reads the loop variable's type out of 7142H again and returns it in Register A less 03H.
5E13
LD B,A 47
Load Register B from Register A, that type less three, which becomes the frame's +6 and is 0FFH for an integer loop and 01H for a single precision one.
5E14
PUSH BC C5
Push Register Pair BC, which puts the direction byte at +5 and the type at +6.
5E15
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
5E16
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended.
5E19
Jump to SYNERR 586CH on NZ, which prints Syntax error: nothing may follow the step on a FOR statement.
5E1C
Call 6714H, the forward scan for the matching NEXT, which walks the program from here counting FOR and NEXT tokens, keeps the line number it reaches in 72A1H, and gives error 26, FOR Without NEXT, at 6744H when the program runs out.
5E1F
Call NXTCHAR at 5E93H, which brings the text pointer onto the character after the NEXT token the scan stopped on.
5E22
PUSH HL E5
Push Register Pair HL, that text pointer, which becomes the frame's +3,+4 and is what NEXT compares against at 454AH to enforce one NEXT for each FOR.
5E23
PUSH HL E5
Push Register Pair HL a second time, a word the exchange below replaces, which becomes the frame's +1,+2.
5E24
LD HL,(72A1H) 2A A1 72
Load Register Pair HL from the word at 72A1H, the number of the line the forward scan reached.
5E27
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that an error raised by the first test below names the line the matching NEXT is on.
5E2A
LD HL,(7184H) 2A 84 71
Load Register Pair HL from the word at 7184H, the loop variable's address, which 5D67H put there before any of the frame was built.
5E2D
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the variable's address in the frame at +1,+2 and brings the text pointer back into Register Pair HL.
5E2E
LD B,82H 06 82
Load Register B with 82H, the token of the FOR keyword, which is the frame's marker at +0 and what the finder at 57F6H looks for.
5E30
PUSH BC C5
Push Register Pair BC, which puts that marker and the byte below it on the stack.
5E31
INC SP 33
Increment the Stack Pointer, which throws the lower of those two bytes away and leaves the marker alone as the frame's foot: the whole frame is nineteen bytes.
5E32
PUSH AF F5
Push Register Pair AF, two bytes of working room below the frame which NEXT's entry at 4529H uses and which are no part of the frame itself.
5E33
PUSH AF F5
Push Register Pair AF again, two more such bytes.
5E34
Jump to 4529H, which is the operand byte of the OR at 4528H and so NEXT's second entry: the flag at 729CH is 00H there, which is what makes NEXT give the variable its starting value out of 729DH and make the first test before the body of the loop is run, exactly as the manual says version 6 does.
5E37
LD B,82H 06 82
The tail NEXT jumps to when a loop goes round again (5E37H), reached from 45C5H: load Register B with 82H, the frame's marker token.
5E39
PUSH BC C5
Push Register Pair BC, which puts that marker and the byte below it back on the stack, the frame having been read down to its foot.
5E3A
INC SP 33
Increment the Stack Pointer, which throws the lower byte away and leaves the marker standing, so that the frame is whole again, and falls into the statement loop at 5E3BH.

5E3BH - The Statement Loop: the Interpreter's Own Command Processor (5E3BH-5E92H)

These 88 bytes are the heart of the interpreter, and every statement routine on this page is written against the state they leave. The loop checks for BREAK, saves the text pointer into SAVTXT 718CH and the Stack Pointer into 718EH, and then looks at the character the pointer stands on: a colon means another statement on the same line, a 00H means the end of a line, and anything else at this point is Syntax error. At the end of a line it steps the two link bytes, and a link of 0000H ends the program at 5827H; otherwise it takes the next line's number into 6E9CH and, when the trace flag at 72DDH is not 00H, shows that number between square brackets, which is what TRON turns on. Then 5E73H reads the statement's first character, pushes 5E3BH as the return address so that every statement routine comes back here with a plain RET, and dispatches: below the first statement token the line is an assignment and goes to LET at 608CH; 0CEH and above is refused at 7912H; otherwise the token less 81H is doubled and the word is taken out of the statement address table at 67C3H, pushed, and the code falls into NXTCHAR at 5E93H, whose RET is what enters the statement routine. So every statement routine is entered with Register Pair HL at the character after the token, Register A holding that character, the Zero Flag set when the statement ends there, and 5E3BH on the stack. The RET Z at 5E7AH is worth seeing on its own: a statement that is nothing but a colon or the end of a line returns straight to 5E3BH without a routine being reached at all.

5E3B
The statement loop (5E3BH), which every statement routine of module 1 returns to and which the dispatcher pushes as their return address: call 7CD5H, which reads KFLAG$ through the pointer at 7C6BH and stops the program when BREAK has been pressed.
5E3E
LD (718CH),HL 22 8C 71
Store Register Pair HL into the word at 718CH, SAVTXT, the text pointer as it stands at the start of this statement, which the error handler takes at 58AAH so that RESUME can come back to it.
5E41
LD (718EH),SP ED 73 8E 71
Store the Stack Pointer into the word at 718EH, the cell that says where the stack stands, so that the error handler and CALL's own return can cut the stack back to the start of this statement.
5E45
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the text pointer stands on, which is a colon between statements and 00H at the end of a line.
5E46
CP 3AH FE 3A
Compare Register A with 3AH, a colon, which is what stands between two statements on one line.
5E48
Jump to 5E73H on Z, another statement following on the same line, which is dispatched without any of the line stepping below.
5E4A
OR A B7
OR Register A with itself, which sets the Zero Flag when the character is the 00H that ends a line.
5E4B
Jump to SYNERR 586CH on NZ, which prints Syntax error: a statement routine has left the text pointer on something that is neither a colon nor the end of a line, which is how a statement with rubbish after it is caught.
5E4E
INC HL 23
Increment Register Pair HL onto the low byte of the next line's link, the 00H that ended the line having been passed.
5E4F
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that low byte.
5E50
INC HL 23
Increment Register Pair HL onto the high byte of the link.
5E51
OR (HL) B6
OR Register A with the byte Register Pair HL addresses, so that the Zero Flag is set only when both bytes of the link are 00H, which marks the end of the program text.
5E52
Jump to 5827H on Z, the program having run out, which is where a program that reaches its last line ends and the interpreter goes back to command level.
5E55
INC HL 23
Increment Register Pair HL onto the low byte of the next line's number.
5E56
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, that low byte.
5E57
INC HL 23
Increment Register Pair HL onto the high byte of the line number.
5E58
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the number of the line about to be run and Register Pair HL stands on its last header byte.
5E59
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the line number into Register Pair HL for the store below and the text pointer into Register Pair DE.
5E5A
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, which every error message names and which END, STOP and CONT all read.
5E5D
LD A,(72DDH) 3A DD 72
Load Register A from the byte at 72DDH, the trace flag, which TRON sets to 0AFH at 43F0H and TROFF clears at 43F1H, and which is read here and nowhere else.
5E60
OR A B7
OR Register A with itself, which sets the Zero Flag when tracing is off.
5E61
Jump to 5E72H on Z, tracing being off, which is the ordinary case and costs the program only these four instructions a line.
5E63
PUSH DE D5
Push Register Pair DE, the text pointer, which the POP DE at 5E71H brings back once the line number has been shown.
5E64
LD A,5BH 3E 5B
Load Register A with 5BH, an opening square bracket, which is what TRON puts round each line number.
5E66
Call 40D8H, which writes that character to the display, or to the printer when 6E92H is set.
5E69
Call NUMDSP at 3139H, which writes the line number in Register Pair HL as decimal digits.
5E6C
LD A,5DH 3E 5D
Load Register A with 5DH, a closing square bracket.
5E6E
Call 40D8H, which writes it, so that a traced program shows each line number as it is reached.
5E71
POP DE D1
Pop Register Pair DE, the text pointer pushed at 5E63H.
5E72
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL, standing on the last byte of the line's header.
5E73
The dispatch (5E73H), which a colon reaches from 5E48H: call NXTCHAR at 5E93H, which steps the text pointer onto the statement's first character, skips blanks, and sets the Zero Flag when the statement has ended there.
5E76
LD DE,5E3BH 11 3B 5E
Load Register Pair DE with 5E3BH, the address of this loop, which the push below makes every statement routine's return address.
5E79
PUSH DE D5
Push Register Pair DE, so that a statement routine ends with a plain RET and so that the loop is reached again with whatever text pointer the routine leaves in Register Pair HL.
5E7A
RET Z C8
Return on Z, the statement having ended at the character just read: a line that is nothing but a colon, or a line whose last statement is empty, goes straight back to 5E3BH without any routine being entered.
5E7B
SUB 81H D6 81
Subtract 81H from Register A, the first statement token, so that Register A holds the statement's place in the table and the Carry Flag is set for anything below it.
5E7D
Jump to LET at 608CH on C, the character standing below the first statement token: a line that begins with a letter is an assignment, which is why LET may be written without its keyword.
5E80
CP 4DH FE 4D
Compare Register A with 4DH, 77, the number of entries the statement address table holds.
5E82
Jump to 7912H on NC, the token standing at 0CEH or above, which refuses it with one exception: 0FFH followed by 83H goes to 49CAH, the only two byte statement token the interpreter has.
5E85
RLCA 07
Rotate Register A left, which doubles the table index because each entry of the table is a word.
5E86
LD C,A 4F
Load Register C from Register A, that doubled index.
5E87
LD B,00H 06 00
Load Register B with 00H so that Register Pair BC holds it as a sixteen bit offset.
5E89
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer away in Register Pair DE while the table is read.
5E8A
LD HL,67C3H 21 C3 67
Load Register Pair HL with 67C3H, the first word of the statement address table, which holds one address for each token from 081H to 0CDH in token order.
5E8D
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, so that Register Pair HL addresses this statement's own entry.
5E8E
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the statement routine's address.
5E8F
INC HL 23
Increment Register Pair HL onto the high byte.
5E90
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds the routine's address.
5E91
PUSH BC C5
Push Register Pair BC, which puts that address on the stack above the 5E3BH pushed at 5E79H, so that the RET which ends NXTCHAR below enters the statement routine and the routine's own RET comes back to the loop.
5E92
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL, and falls into NXTCHAR at 5E93H: NXTCHAR reads the character after the token and its RET is what enters the statement routine, which is why every routine is entered with the flags NXTCHAR left.

5E93H - NXTCHAR, the Next Character of the BASIC Line (5E93H-5EB0H)

The most called routine in the file. A hundred and twenty-seven instructions of module 1 and module 2 call 5E93H, and every statement routine of the interpreter is entered through it, because the statement loop at 5E3BH pushes the statement's address and then falls into this routine so that its RET does the entering. What it hands back is three things at once, and the whole of module 1 is written against them: Register Pair HL stepped to the next character of the line that is not a space, Register A holding that character, the Zero Flag set when the character is a colon 3AH or the 00H that ends the line (the colon's Zero Flag comes out of the CP 3AH at 5E95H, the 00H's out of the OR A at 5E9EH), and the Carry Flag set when the character is an ASCII digit 30H to 39H and clear for everything else. 5E94H is the entry that reads the character the pointer already stands on, which 5A87H uses, and 5E98H is the entry that tests a character already in Register A, which is where 4353H goes when the byte after its call matched. The space at 20H is thrown away and the routine goes round again, and so are 09H and 0AH at 5F05H, which stand in the text of a line and are not code. The characters 0BH to 1FH are the tokenizer's own number tokens and the rest of the routine takes them apart.

5E93
INC HL 23
NXTCHAR (5E93H), the name NEWB/EQU gives it: increment Register Pair HL, the text pointer, so that it stands on the character after the one the caller had.
5E94
LD A,(HL) 7E
The entry that does not step the pointer (5E94H), which 5A87H calls and 5EE8H jumps to: load Register A with the character Register Pair HL stands on.
5E95
CP 3AH FE 3A
Compare Register A with 3AH, the colon that separates two statements of one line, which is also the first character above the nine digits and the punctuation below them.
5E97
RET NC D0
Return on NC, the character being 3AH or above, with the Carry Flag clear and the Zero Flag set only for the colon itself, which is how every caller tells one statement of a line from the next.
5E98
CP 20H FE 20
The entry for a character already in Register A (5E98H), which 435FH jumps to: compare Register A with 20H, the space.
5E9A
Jump to 5E93H on Z, the character being a space, which steps the pointer and reads again, so that spaces between the words of a statement cost the interpreter nothing but this loop.
5E9C
Jump to 5F0AH on NC, the character standing between 21H and 39H, where the digit test turns it into the Carry Flag the callers read.
5E9E
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that stands at the end of every line of the program and in the line buffer.
5E9F
RET Z C8
Return on Z with the Carry Flag clear, the character being that 00H, which is the answer every statement routine reads to learn that its statement has ended.
5EA0
CP 0BH FE 0B
Compare Register A with 0BH, the lowest of the number tokens the tokenizer writes in place of a constant it has already converted.
5EA2
Jump to 5F05H on C, the character being 0AH or below, where 09H and 0AH are thrown away like a space and anything lower falls into the digit test.
5EA4
CP 1EH FE 1E
Compare Register A with 1EH, which is not a token the tokenizer ever writes but the first byte of the two byte stand-in at 5F10H that this routine hands the caller after it has taken a constant out of the line.
5EA6
Jump to 5EADH on NZ, the character being any other number token, which leaves the stand-in to the two instructions below.
5EA8
LD A,(7147H) 3A 47 71
The stand-in's first byte (5EA8H): load Register A with the byte at 7147H, the token of the constant this routine last took out of the line, so that the caller sees which kind of number is waiting in the accumulator at 7149H.
5EAB
OR A B7
Or Register A with itself, which clears the Carry Flag and leaves the Zero Flag reset, the token never being 00H, so the caller reads neither a digit nor the end of a statement.
5EAC
RET C9
Return with that token in Register A, which is what the term reader at 74D0H compares against 20H to learn that a converted number stands at the text pointer.
5EAD
CP 10H FE 10
Any other number token (5EADH): compare Register A with 10H, which is the second byte of the stand-in at 5F10H and the one token in the range that the tokenizer leaves unused.
5EAF
Jump to 5EE5H on Z, which puts the real text pointer back from 7145H and reads the character standing after the constant.

5EB1H - The Number the Tokenizer Has Already Converted (5EB1H-5F04H)

A line of BASIC does not hold its numbers as digits. The tokenizer at 5B43H converts each one as the line is entered and leaves a token in its place with the value packed after it, and this is where the interpreter unpacks it again. The tokens are 0BH an octal constant, 0CH a hexadecimal one, 0DH the address of a line once a GOTO has looked it up, 0EH a line number as it was typed, 0FH a single byte integer, 11H to 1BH the integers nought to ten with no bytes after them at all, 1CH a two byte integer, 1DH a single precision number of four bytes and 1FH a double precision one of eight. The unpacking puts the token in 7147H, the type as a count of bytes in 7148H, the bytes themselves at 7149H and the place in the line to carry on from in 7145H, and then it does the thing that makes the routine worth reading twice: it returns with Register Pair HL pointing at 5F10H instead of into the program. The two bytes there are 1EH and 10H, so the caller reads one character 1EH where the number stood, and its next call to NXTCHAR reads the 10H and lands at 5EE5H, which puts the real pointer back. The whole of the rest of the interpreter can therefore treat a converted number as a single character, and only the term reader at 74D0H and the reference tests at 5FA4H have to know better.

5EB1
PUSH AF F5
The number tokens (5EB1H): push Register Pair AF, the token, because the arithmetic below writes Register A and the token is wanted again at 5ED5H and 5EFFH.
5EB2
INC HL 23
Increment Register Pair HL, so that the text pointer stands on the first of the bytes the tokenizer packed after the token.
5EB3
LD (7147H),A 32 47 71
Store Register A, the token, into the byte at 7147H, where 5EA8H, 5F12H and 5FA4H all read it to learn which kind of number is in hand.
5EB6
SUB 1CH D6 1C
Subtract 1CH from Register A, the lowest token whose bytes are copied wholesale, which leaves the Carry Flag set for every token below it.
5EB8
Jump to 5EEAH on NC, the token being 1CH, 1DH or 1FH, whose bytes are moved to 7149H by the overlay's own mover.
5EBA
SUB 0F5H D6 F5
Subtract 0F5H from Register A, which is to add 0BH to it, so that Register A now holds the token less 11H and the Carry Flag is set for every token below 11H.
5EBC
Jump to 5EC4H on NC, the token standing between 11H and 1BH, where Register A is already the value nought to ten the token stands for and there are no bytes in the line to read.
5EBE
CP 0FEH FE FE
Compare Register A with 0FEH, which is the token 0FH expressed as 0FH less 11H, the single byte integer.
5EC0
Jump to 5ED8H on NZ, the token being 0BH, 0CH, 0DH or 0EH, each of which carries two bytes after it.
5EC2
LD A,(HL) 7E
A single byte integer (5EC2H): load Register A with the byte Register Pair HL stands on, which is the whole of the value and holds 10 to 255.
5EC3
INC HL 23
Increment Register Pair HL, so that the text pointer stands on the character after the one byte value.
5EC4
LD (7145H),HL 22 45 71
The resumption point (5EC4H), which 5EBCH also reaches: store Register Pair HL into the word at 7145H, which NEWB/EQU and BMOVE/ASM both call IPOS, so that 5EE5H can put the pointer back when the caller asks for the character after the number.
5EC7
LD H,00H 26 00
Load Register H with 00H, the high byte of a value that came out of one byte or out of the token itself.
5EC9
LD L,A 6F
The value into Register Pair HL (5EC9H), which 5EE0H also reaches: load Register L from Register A, the low byte of the value.
5ECA
LD (7149H),HL 22 49 71
Store Register Pair HL into the word at 7149H, the eight byte area the unpacked value is left in, of which a two byte integer fills the first two.
5ECD
LD A,02H 3E 02
Load Register A with 02H, the number of bytes an integer takes and the interpreter's own code for the integer type.
5ECF
LD (7148H),A 32 48 71
Store Register A, that type, into the byte at 7148H, which 5F2CH reads when it copies the value into the accumulator and which is not 7147H, the token.
5ED2
LD HL,5F10H 21 10 5F
Load Register Pair HL with 5F10H, the address of the two byte stand-in, so that the caller is given a pointer into the interpreter's own bytes and not into the program.
5ED5
POP AF F1
Pop Register Pair AF, which brings the token back into Register A for the caller to see.
5ED6
OR A B7
Or Register A with itself, which clears the Carry Flag and leaves the Zero Flag reset, so the caller reads neither a digit nor the end of a statement.
5ED7
RET C9
Return with the token in Register A and Register Pair HL at 5F10H, which is the whole of the trick this routine turns.
5ED8
LD A,(HL) 7E
The two byte tokens (5ED8H): load Register A with the byte Register Pair HL stands on, the low byte of the value or of the line's address.
5ED9
INC HL 23
Increment Register Pair HL, so that the text pointer stands on the high byte of the two.
5EDA
INC HL 23
Increment Register Pair HL a second time, so that it stands on the character after the value and is the resumption point itself.
5EDB
LD (7145H),HL 22 45 71
Store Register Pair HL into the word at 7145H, IPOS, the place in the line the caller carries on from.
5EDE
DEC HL 2B
Decrement Register Pair HL, so that it stands on the high byte again, the low byte being safe in Register A.
5EDF
LD H,(HL) 66
Load Register H with the byte Register Pair HL stands on, the high byte of the value.
5EE0
Jump to 5EC9H, which puts the low byte into Register L and stores the pair at 7149H as a two byte integer.
5EE2
The number into the accumulator (5EE2H), which the term reader jumps to from 74D2H: call 5F12H, which takes the value out of 7149H and 7147H and leaves it in the accumulator with its type at 7142H.
5EE5
LD HL,(7145H) 2A 45 71
Back into the real line (5EE5H), which 5EAFH reaches from the stand-in's second byte: load Register Pair HL from the word at 7145H, the resumption point the unpacking left there.
5EE8
Jump to 5E94H, which reads the character at that point and works it out like any other, so the caller is answered as though the number in the line had been one character wide.
5EEA
INC A 3C
The wide values (5EEAH), the tokens 1CH, 1DH and 1FH: increment Register A, which holds the token less 1CH and so becomes 01H, 02H or 04H.
5EEB
RLCA 07
Rotate Register A left circularly, which doubles it to 02H, 04H or 08H, the interpreter's own type codes for an integer, a single precision number and a double precision one.
5EEC
LD (7148H),A 32 48 71
Store Register A, that type, into the byte at 7148H, which is also the count of bytes the move below has to make.
5EEF
PUSH DE D5
Push Register Pair DE, because the move takes its source address in that pair and the caller's own value in it is wanted again at 5EFBH.
5EF0
PUSH BC C5
Push Register Pair BC, because the move counts down in Register B and the caller's own value is wanted again at 5EFAH.
5EF1
LD DE,7149H 11 49 71
Load Register Pair DE with 7149H, the eight byte area the value is to be unpacked into.
5EF4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, so that Register Pair HL is the destination 7149H and Register Pair DE is the text pointer the bytes are read from.
5EF5
LD B,A 47
Load Register B from Register A, the count of bytes to move, which is 02H, 04H or 08H.
5EF6
Call 294AH of BASIC/OV1, the byte mover that takes its count in Register B rather than from the type at 7142H, which copies the value out of the line and leaves both pointers past it.
5EF9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL a second time, so that Register Pair HL is the text pointer standing after the value and Register Pair DE is the end of the eight byte area.
5EFA
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
5EFB
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
5EFC
LD (7145H),HL 22 45 71
Store Register Pair HL into the word at 7145H, IPOS, the place in the line the caller carries on from.
5EFF
POP AF F1
Pop Register Pair AF, which brings the token back into Register A.
5F00
LD HL,5F10H 21 10 5F
Load Register Pair HL with 5F10H, the two byte stand-in, exactly as 5ED2H does for the narrow values.
5F03
OR A B7
Or Register A with itself, which clears the Carry Flag and leaves the Zero Flag reset for the token in Register A.
5F04
RET C9
Return with the token in Register A and Register Pair HL at 5F10H, the wide value unpacked at 7149H and its type at 7148H.

5F05H - The Characters Below 0BH and the Digit Test (5F05H-5F0FH)

NXTCHAR's two tails. The first throws 09H and 0AH away as it throws a space away, which is why those two bytes can stand in the text of a line without the interpreter reading them as code, and 819FH of the enhancement package knows the 09H well enough to suppress the space it would otherwise print after a line number. The second is the digit test, and it is written to leave the Carry Flag alone: a plain OR A to set the Zero and Sign Flags from the character would have cleared the Carry Flag that is the whole answer, so the INC A and DEC A are used instead, neither of which touches it. The CCF above them is there because CP 30H sets the Carry Flag for a character below the digits and the callers want it set for a digit, which is the opposite way round.

5F05
CP 09H FE 09
The characters below 0BH (5F05H), which 5EA2H reaches: compare Register A with 09H, the lowest of the two bytes that stand in a line's text and are not code.
5F07
Jump to 5E93H on NC, the character being 09H or 0AH, which steps the pointer and reads the next character, so those two bytes are passed over as a space is.
5F0A
CP 30H FE 30
The digit test (5F0AH), which 5E9CH reaches with a character between 21H and 39H: compare Register A with 30H, the digit nought, which sets the Carry Flag for the punctuation below it.
5F0C
CCF 3F
Complement the Carry Flag, which turns that answer round, so the Carry Flag is set for 30H and above and the caller reads a set Carry Flag as a digit.
5F0D
INC A 3C
Increment Register A, which is the first half of a pair of instructions chosen because neither of them changes the Carry Flag the test has just set.
5F0E
DEC A 3D
Decrement Register A, which puts the character back and sets the Zero Flag and the Sign Flag from it while the Carry Flag stands.
5F0F
RET C9
Return with the character in Register A, the Carry Flag set for a digit and clear for anything else, and the Zero Flag reset.

5F10H - The Stand-In Pair and the Number into the Accumulator (5F10H-5F48H)

Two bytes of data and then the routine that spends them. 5F10H and 5F11H are 1EH and 10H, the one place in the interpreter where a pointer is handed out that points at nothing in the program, and the unpacking above leaves Register Pair HL on them so that a converted number reads as a single character. 5F12H is what turns the unpacked number into a value, and the two line reference tokens are why it is not a simple copy. For 0BH, 0CH, 0FH and 1CH to 1FH the bytes at 7149H are the value and the type at 7148H says how many of them there are, so 5F2CH copies them into the accumulator and is done. For 0EH, a line number as it was typed, the two bytes are the number and 2C66H floats it into a single precision value. For 0DH, a line's address once a GOTO has resolved it, the value wanted is the line's number, so the routine has to go and read it: the interpreter addresses a line by the 00H byte that ends the line before it, which is why 5E4EH of the statement loop steps one byte before it reads the link and why 6033H decrements what FIND answered, so the line's own number stands three and four bytes above the address and that is exactly where 5F22H to 5F27H reach for it. Only the term reader at 74D2H and the detokenizer at 7B74H call this routine.

5F10-5F11
DEFB 1EH, 10H 1E 10
The two byte stand-in (5F10H), which 5ED2H and 5F00H hand to the caller in place of a pointer into the program: 1EH, which 5EA4H answers with the token at 7147H, and 10H, which 5EADH answers by putting the real text pointer back from 7145H.
5F12
LD A,(7147H) 3A 47 71
The number into the accumulator (5F12H), which 5EE2H calls for the term reader and 7B74H calls for the detokenizer: load Register A with the byte at 7147H, the token of the number in hand.
5F15
CP 0FH FE 0F
Compare Register A with 0FH, the single byte integer, which is the lowest token whose bytes at 7149H are the value itself.
5F17
Jump to 5F2CH on NC, the token being 0FH or above, where the bytes at 7149H are copied into the accumulator with the type at 7148H saying how many.
5F19
CP 0DH FE 0D
Compare Register A with 0DH, the token the interpreter writes before a line's address once a GOTO has looked the line up.
5F1B
Jump to 5F2CH on C, the token being 0BH or 0CH, an octal or a hexadecimal constant, whose two bytes at 7149H are an ordinary integer.
5F1D
LD HL,(7149H) 2A 49 71
The two line reference tokens (5F1DH): load Register Pair HL from the word at 7149H, which is the line's number for the 0EH token and the line's address for the 0DH one.
5F20
Jump to 5F29H on NZ, the token being 0EH, so that Register Pair HL is already the line number as it was typed and nothing has to be read out of the program.
5F22
INC HL 23
A resolved reference (5F22H): increment Register Pair HL, the address of the 00H byte that ends the line before the one named, so that it stands on the low byte of that line's link.
5F23
INC HL 23
Increment Register Pair HL a second time, so that it stands on the high byte of the link.
5F24
INC HL 23
Increment Register Pair HL a third time, so that it stands on the low byte of the line's own number, three above the address the interpreter keeps for a line.
5F25
LD E,(HL) 5E
Load Register E with the byte Register Pair HL stands on, the low byte of the line number.
5F26
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of the line number.
5F27
LD D,(HL) 56
Load Register D with the byte Register Pair HL stands on, the high byte of the line number.
5F28
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, so that Register Pair HL holds the line number the resolved address was standing in for.
5F29
The line number floated (5F29H), which 5F20H also reaches: jump to 2C66H of BASIC/OV1, which converts the unsigned value in Register Pair HL into a single precision number in the accumulator, so a line reference used as a value is its own number.
5F2C
LD A,(7148H) 3A 48 71
The plain values (5F2CH), which 5F17H and 5F1BH both reach: load Register A with the byte at 7148H, the type the unpacking worked out, which is 02H, 04H or 08H.
5F2F
LD (7142H),A 32 42 71
Store Register A, that type, into the byte at 7142H, the type of the value in the accumulator, which every routine of the expression machinery reads.
5F32
CP 08H FE 08
Compare Register A with 08H, the width of a double precision number, which is the one type too wide for the four bytes the copy below makes.
5F34
Jump to 5F43H on Z, the value being a double precision number, which the overlay's own loader moves all eight bytes of.
5F36
LD HL,(7149H) 2A 49 71
Load Register Pair HL from the word at 7149H, the first two bytes of the unpacked value.
5F39
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the low half of the accumulator, which is the whole of it for an integer.
5F3C
LD HL,(714BH) 2A 4B 71
Load Register Pair HL from the word at 714BH, the third and fourth bytes of the unpacked value, which an integer never set and which the copy below moves anyway.
5F3F
LD (72EEH),HL 22 EE 72
Store Register Pair HL into the word at 72EEH, so that a single precision number is in the accumulator entire and an integer has two bytes of its own and two of whatever stood above it.
5F42
RET C9
Return with the value in the accumulator at 72ECH and its type at 7142H, which is all the term reader asked for.
5F43
LD HL,7149H 21 49 71
A double precision number (5F43H): load Register Pair HL with 7149H, the eight byte area the unpacking filled.
5F46
Jump to 296BH of BASIC/OV1, which works out the right half of the accumulator for the type at 7142H and moves that many bytes into it from Register Pair HL, so the eight bytes land at 72E8H.

5F49H - DEFSTR, DEFINT, DEFSNG and DEFDBL: Declare the Type of a Range of Letters (5F49H-5F8DH)

The four type declaration statements are one routine with four entries three bytes apart, and the three bytes between them are not padding: each is a `LD BC,nn1EH` whose last two bytes are the `LD E,nn` of the next entry, so one instruction's operand is another's opcode. That is the same device the error chain at 586CH uses nine times over, and it is why the statement address table holds 5F49H, 5F4CH, 5F4FH and 5F52H at 681BH, 681DH, 681FH and 6821H. Register E carries the type the letters are to have, as the count of bytes the interpreter keeps that type in: 03H for DEFSTR, 02H for DEFINT, 04H for DEFSNG and 08H for DEFDBL, which are the same numbers the type cell at 7142H holds. All four fall into 5F54H, which reads a letter, or a range of two letters written with the minus token 0F4H between them, and writes the type into one byte of the table at 71A7H for each letter of the range. The table is 26 bytes, one per letter from A at 71A7H, and 42DBH fills it with 04H when a program is cleared, which is why an undeclared variable is single precision. A comma takes the routine round again for another range. One thing worth seeing in the stack work: 5F57H and 5F5AH push SYNERR 586CH as a return address before any of the range is read, so that each of the three RET C instructions below prints Syntax error; the EX (SP),HL at 5F78H is what takes that address back off, so that from 5F84H onward a RET goes to the statement loop as usual.

5F49
LD E,03H 1E 03
DEFSTR (5F49H), the routine the statement address table holds for token 0ADH at 681BH: load Register E with 03H, the count of bytes a string descriptor takes and the number the type cell at 7142H holds for a string.
5F4B
LD BC,021EH 01 1E 02
Load Register Pair BC with 021EH, whose own value is never used: the two bytes of its operand at 5F4CH and 5F4DH are DEFINT's entry, the instruction LD E,02H, and the statement address table holds 5F4CH for token 0AEH at 681DH.
5F4E
LD BC,041EH 01 1E 04
Load Register Pair BC with 041EH, whose operand bytes at 5F4FH and 5F50H are DEFSNG's entry, the instruction LD E,04H, which the table holds for token 0AFH at 681FH.
5F51
LD BC,081EH 01 1E 08
Load Register Pair BC with 081EH, whose operand bytes at 5F52H and 5F53H are DEFDBL's entry, the instruction LD E,08H, which the table holds for token 0B0H at 6821H, so that all four statements arrive here with their own type in Register E.
5F54
The letter range (5F54H), which all four entries reach and which a comma brings back round: call 4473H, the capital letter test, which sets the Carry Flag when the character the text pointer stands on is not a letter from A to Z.
5F57
LD BC,586CH 01 6C 58
Load Register Pair BC with 586CH, the address of SYNERR, the Syntax error entry of the error chain.
5F5A
PUSH BC C5
Push Register Pair BC, which puts 586CH on the stack above the statement loop's own address, so that the three RET C instructions below print Syntax error instead of going back to the statement loop.
5F5B
RET C D8
Return on C, the character not being a letter, which lands on the 586CH just pushed and prints Syntax error.
5F5C
SUB 41H D6 41
Subtract 41H from Register A, the character code of the letter A, leaving Register A holding the letter's place in the alphabet counted from zero.
5F5E
LD C,A 4F
Load Register C from Register A, the first letter of the range, which is also the last when no minus token follows.
5F5F
LD B,A 47
Load Register B from Register A as well, so that a range of one letter has the same first and last letter.
5F60
Call NXTCHAR at 5E93H, which brings the character standing after the letter back in Register A.
5F63
CP 0F4H FE F4
Compare Register A with 0F4H, the token of the minus sign, which is what stands between the two letters of a range such as DEFINT A-Z.
5F65
Jump to 5F74H on NZ, there being no minus token and so a single letter rather than a range.
5F67
Call NXTCHAR at 5E93H, which brings the second letter of the range back in Register A.
5F6A
Call 4473H, the capital letter test, which sets the Carry Flag when what follows the minus token is not a letter.
5F6D
RET C D8
Return on C, which lands on the 586CH pushed at 5F5AH and prints Syntax error.
5F6E
SUB 41H D6 41
Subtract 41H from Register A, leaving Register A holding the second letter's place in the alphabet counted from zero.
5F70
LD B,A 47
Load Register B from Register A, the last letter of the range, where Register C already holds the first.
5F71
Call NXTCHAR at 5E93H, which brings the character standing after the second letter back in Register A for the comma test below.
5F74
LD A,B 78
The range in hand (5F74H): load Register A from Register B, the last letter of the range.
5F75
SUB C 91
Subtract Register C from Register A, the first letter, leaving Register A holding how many letters stand between them and setting the Carry Flag when the range runs backwards.
5F76
RET C D8
Return on C, a range written the wrong way round such as DEFINT Z-A, which lands on the 586CH pushed at 5F5AH and prints Syntax error.
5F77
INC A 3C
Increment Register A so that it counts the letters of the range itself rather than the gaps between them, which is 1 for a single letter.
5F78
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the text pointer away on the stack and takes the 586CH pushed at 5F5AH off it into Register Pair HL, where the load below throws it away: from here on a RET goes to the statement loop.
5F79
LD HL,71A7H 21 A7 71
Load Register Pair HL with 71A7H, the first byte of the table of 26 declared types, one for each letter from A, which 42DBH fills with 04H when a program is cleared.
5F7C
LD B,00H 06 00
Load Register B with 00H so that Register Pair BC holds the first letter's place in the alphabet as a sixteen bit number.
5F7E
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which makes Register Pair HL address the table byte of the first letter of the range.
5F7F
LD (HL),E 73
The store (5F7FH): store Register E, the type this statement declares, into the byte Register Pair HL addresses, which is one letter's entry in the table.
5F80
INC HL 23
Increment Register Pair HL onto the next letter's byte of the table.
5F81
DEC A 3D
Decrement Register A, the count of letters of the range still to be written.
5F82
Jump back to 5F7FH on NZ, which writes the type into one byte for every letter of the range, so that DEFINT A-Z fills all 26.
5F84
POP HL E1
Pop Register Pair HL, the text pointer, which the exchange at 5F78H put on the stack, and which leaves the statement loop's address on top again.
5F85
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the range just declared.
5F86
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which is what separates one range from the next in a statement such as DEFINT A-C,X-Z.
5F88
RET NZ C0
Return on NZ, the statement having ended with this range, which goes to the statement loop at 5E3BH that the dispatcher pushed.
5F89
Call NXTCHAR at 5E93H, which steps the text pointer past the comma and onto the first letter of the next range.
5F8C
Jump back to 5F54H for that range, which pushes 586CH afresh and reads another letter or pair of letters.

5F8EH - The Number Helpers and FUNCERR: a Numeric Argument, Illegal Function Call, and the Line Reference Readers (5F8EH-5FDEH)

Five short routines stand together here and the statements above and below them all lean on one or another. 5F8EH and 5F91H work a numeric argument out into Register Pair DE and return with the sign flag set from Register D, which is how a caller tells a negative value from a positive one; CLEAR enters at 5F91H and NEWB/EQU knows nothing of either. FUNCERR 5F95H is the Illegal function call entry, error 5, which NEWB/ASM names and which more of module 1 jumps to than any other error. NUM2DE 5F9AH, which NEWB/EQU names, reads a line number, taking a full stop 2EH to mean the line being run, whose number is at CURLIN 7192H. 5FA4H is the test for a line reference: the interpreter keeps one in the program text in two forms, the 0EH token with the line's number after it as it was typed, and the 0DH token with the line's address after it once a GOTO has resolved it, and this routine reports which it found in 7147H and brings the number or address back in Register Pair DE. NUMPOSN 5FAEH, which bmove.asm names, is the entry for the resolved form alone. 5FB5H to 5FDEH is the digit reader for a line number typed out in full: it builds the value in Register Pair HL ten times at a time, and the limit at 5FC3H is 1998H, 6552, which is the largest value that can be multiplied by ten and still take another digit, so a line number of 65530 or more is left where the reader stopped rather than reported.

5F8E
A numeric argument with a step first (5F8EH): call NXTCHAR at 5E93H, which steps the text pointer onto the first character of the expression.
5F91
A numeric argument where the text pointer already stands on it (5F91H), which is the entry CLEAR uses at 4489H: call 7990H, which works the expression out, turns it into a sixteen bit value in Register Pair DE through 29F4H of the overlay, and leaves Register A holding Register D with the flags set from it.
5F94
RET P F0
Return on P, the value being positive, so that a caller which needs a non-negative number goes on and one which gave a negative one falls into the error entry below.
5F95
LD E,05H 1E 05
FUNCERR (5F95H), the name NEWB/ASM gives it: load Register E with 05H, the number of the Illegal function call text, which is the fifth of the block at 6B7CH.
5F97
Jump to the error handler at 5886H, which takes the number in Register E, maps it through 58DFH and prints Illegal function call.
5F9A
LD A,(HL) 7E
NUM2DE (5F9AH), the name NEWB/EQU gives it: load Register A with the byte Register Pair HL addresses, the character the text pointer stands on, where a line number is expected.
5F9B
CP 2EH FE 2E
Compare Register A with 2EH, a full stop, which the editor's commands take to mean the line being run rather than a number typed out.
5F9D
LD DE,(7192H) ED 5B 92 71
Load Register Pair DE from the word at 7192H, CURLIN, the number of the line being run, which is the value a full stop stands for.
5FA1
Jump to NXTCHAR at 5E93H on Z, which steps the text pointer past the full stop and returns to this routine's own caller with Register Pair DE holding that line number.
5FA4
DEC HL 2B
The line reference test (5FA4H): decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
5FA5
Call NXTCHAR at 5E93H, which brings that character back in Register A.
5FA8
CP 0EH FE 0E
Compare Register A with 0EH, the token the interpreter puts in front of a line number as it was typed, before any GOTO has resolved it.
5FAA
Jump to 5FAEH on Z, the reference being of the unresolved kind, whose two bytes are read by the same instruction as the other kind's.
5FAC
CP 0DH FE 0D
Compare Register A with 0DH, the token the interpreter leaves in front of a line's address once a GOTO has turned the number into one, which is what 66ADH writes.
5FAE
LD DE,(7149H) ED 5B 49 71
NUMPOSN (5FAEH), the name bmove.asm gives it, and the entry for a resolved reference: load Register Pair DE from the word at 7149H, the two bytes standing after the token, which are the line's number for a 0EH reference and its address for a 0DH one.
5FB2
Jump to NXTCHAR at 5E93H on Z, a reference of either kind having been found, which steps the text pointer past its two bytes and returns to this routine's caller with the pair in Register Pair DE.
5FB5
XOR A AF
No reference token (5FB5H): clear Register A with XOR A, making 00H, the value that says no reference token was found.
5FB6
LD (7147H),A 32 47 71
Store Register A into the byte at 7147H, which the callers above read to learn which of the two kinds of reference the text pointer stood on, 00H saying neither.
5FB9
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the line number the digit reader below builds up from nothing.
5FBC
DEC HL 2B
The digit loop (5FBCH): decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
5FBD
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Carry Flag set for a digit, 30H to 39H, and clear for anything else.
5FC0
RET NC D0
Return on NC, the character not being a digit, with Register Pair DE holding the number built so far and 7147H holding 00H.
5FC1
PUSH HL E5
Push Register Pair HL, the text pointer standing on the digit, which the POP HL at 5FD9H brings back.
5FC2
PUSH AF F5
Push Register Pair AF, the digit itself, which the POP AF at 5FD1H brings back once the multiplication below is done with Register A.
5FC3
LD HL,1998H 21 98 19
Load Register Pair HL with 1998H, 6552, the largest number that can be multiplied by ten and still take a digit without passing 65535.
5FC6
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Carry Flag when the number built so far already stands above 6552.
5FC9
Jump to 5FDCH on C, the number having grown too large for another digit, which gives up and leaves the text pointer where it is rather than reporting anything.
5FCB
LD H,D 62
Load Register H from Register D, the high byte of the number built so far.
5FCC
LD L,E 6B
Load Register L from Register E, its low byte, so that Register Pair HL holds the same number as Register Pair DE.
5FCD
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, making twice the number.
5FCE
ADD HL,HL 29
Add Register Pair HL to itself, making four times it.
5FCF
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, making five times it.
5FD0
ADD HL,HL 29
Add Register Pair HL to itself, making ten times the number built so far, which is the shift the next digit needs.
5FD1
POP AF F1
Pop Register Pair AF, the digit character pushed at 5FC2H.
5FD2
SUB 30H D6 30
Subtract 30H from Register A, the character code of the digit zero, leaving Register A holding the digit's own value from 0 to 9.
5FD4
LD E,A 5F
Load Register E from Register A, the digit, as the low byte of a sixteen bit number.
5FD5
LD D,00H 16 00
Load Register D with 00H, its high byte, so that Register Pair DE holds the digit alone.
5FD7
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which puts the digit into the number that has just been multiplied by ten.
5FD8
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the number built so far back into Register Pair DE where the loop keeps it.
5FD9
POP HL E1
Pop Register Pair HL, the text pointer, pushed at 5FC1H.
5FDA
Jump back to 5FBDH for the next character, which ends the loop at the first one that is not a digit.
5FDC
POP AF F1
Too large (5FDCH): pop Register Pair AF, the digit pushed at 5FC2H, which is thrown away.
5FDD
POP HL E1
Pop Register Pair HL, the text pointer pushed at 5FC1H, which still stands on that digit.
5FDE
RET C9
Return with Register Pair DE holding the number reached before the digit that would have overflowed, so a line number of 65530 or more is quietly cut short rather than refused.

5FDFH - RUN, GOSUB and GOTO, and the Line Resolution They Share (5FDFH-6044H)

The three statements that move the program somewhere else are built one on top of another. RUN 5FDFH has three forms. With nothing after it the whole of 42C7H clears the program's variables and starts from the first line. With a line reference it clears the variables through 42CBH, pushes the statement loop's own address, and falls into GOTO. With anything else, which can only be a filespec, it jumps to 4C20H, the second entry of LOAD, so that a RUN of a file is a LOAD with the run flag set and nothing of RUN's own code is used. GOSUB 5FF3H builds a four part frame on the stack and then jumps into GOTO's body at 600DH: the frame is the text pointer standing after the statement, the number of the line it stands on, the one byte token 8DH, and the return address, and 4247H has made room for three words before any of it is pushed. GOTO 600AH works the reference out and then does the work both share at 600DH. That work is the interesting part. The interpreter keeps a line reference in the program text in two forms, the 0EH token with the number as it was typed and the 0DH token with the line's address once it has been looked up, and 600DH reads which of the two 5FA4H found. For a resolved reference it has nothing to do but put the address in Register Pair HL and return. For an unresolved one it searches the program with FIND, entering at 5AB7H to search onward from the current line when the target stands above it and at 5AB4H to search from the start when it does not, gives error 8, Undefined line number, at 6040H when there is no such line, and then writes the answer back into the program text through 66ADH, replacing the 0EH token and the number with the 0DH token and the address and putting 0DH into the flag at 7186H to say that the program now holds resolved references. That flag is why 661EH exists to undo them before a program is listed or saved, and why CHAIN calls 66B6H at 5466H before it measures any lines.

5FDF
RUN (5FDFH), the routine the statement address table holds for token 08AH at 67D5H, entered with the Zero Flag set when nothing follows the keyword: jump to 42C7H on Z, which clears the variables and the pointers and starts the program at its first line.
5FE2
CP 0EH FE 0E
Compare Register A with 0EH, the token that stands in front of a line number as it was typed, which is what a RUN of a line number carries.
5FE4
Jump to 5FEBH on Z, a line reference of the unresolved kind having been found.
5FE6
CP 0DH FE 0D
Compare Register A with 0DH, the token that stands in front of a line's address once a GOTO has resolved the reference, which a RUN inside a running program can meet.
5FE8
Jump to 4C20H on NZ, there being no line reference and so nothing but a filespec: 4C20H is the second entry of LOAD, the operand byte pair that LOAD and PUT and GET both use, so a RUN of a file is a LOAD that runs what it loads and uses none of RUN's own code below.
5FEB
Call 42CBH, the part of NEW's clearing code that throws the variables away and leaves the program text where it is, which is what RUN of a line number must do before it starts.
5FEE
LD BC,5E3BH 01 3B 5E
Load Register Pair BC with 5E3BH, the address of the statement loop, which the push below makes this statement's return address.
5FF1
Jump to 6009H, which pushes that address and falls into GOTO's own reference reader, so that RUN of a line number is GOTO with the variables cleared first.
5FF3
LD C,03H 0E 03
GOSUB (5FF3H), the routine the statement address table holds for token 08DH at 67DBH: load Register C with 03H, the number of words of stack the frame below needs.
5FF5
Call 4247H, which works out whether there is room for three words above the top of the program and variable space at 7153H and gives Out of memory through 425CH when there is not.
5FF8
Call 5FA4H, which reads the line reference at the text pointer, puts 0EH, 0DH or 00H into 7147H to say which kind it was, and brings its number or address back in Register Pair DE.
5FFB
POP BC C1
Pop Register Pair BC, the statement loop's address that the dispatcher pushed, which has to come off before the frame is built and goes back on at 6006H as the frame's last part.
5FFC
PUSH HL E5
Push Register Pair HL, the text pointer standing after the line reference, which is where the program goes on when the matching RETURN runs.
5FFD
PUSH HL E5
Push Register Pair HL a second time, so that the exchange below has a word of its own to write the line number over without losing the text pointer.
5FFE
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL from the word at 6E9CH, the number of the line being run, which the matching RETURN puts back so that an error reported after it names the right line.
6001
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves that line number on the stack over the second copy of the text pointer and brings the text pointer back into Register Pair HL.
6002
LD A,8DH 3E 8D
Load Register A with 8DH, the token of the GOSUB keyword, which marks the frame so that the finder at 57F6H can tell a GOSUB frame from a FOR or a WHILE one.
6004
PUSH AF F5
Push Register Pair AF, which puts that token and the flags on the stack as two bytes.
6005
INC SP 33
Increment the Stack Pointer, which throws the flags byte away and leaves the token as the frame's one byte marker, so the whole frame is seven bytes.
6006
PUSH BC C5
Push Register Pair BC, the statement loop's address popped at 5FFBH, which is the return address the frame sits under.
6007
Jump to 600DH, GOTO's own body, which resolves the reference GOSUB has already read and leaves the program at the line it names.
6009
PUSH BC C5
The entry RUN of a line number uses (6009H), reached by the jump at 5FF1H: push Register Pair BC, which puts the statement loop's address on the stack in place of the one 5FEBH left, and falls into GOTO.
600A
GOTO (600AH), the routine the statement address table holds for token 089H at 67D3H and the entry 61ECH uses for ON GOTO: call 5FA4H, which reads the line reference at the text pointer and reports its kind in 7147H.
600D
LD A,(7147H) 3A 47 71
The resolution (600DH), which GOTO reaches by falling through and GOSUB by the jump at 6007H: load Register A from the byte at 7147H, which says whether the reference was of the 0EH kind, the 0DH kind, or neither.
6010
CP 0DH FE 0D
Compare Register A with 0DH, the token of a reference whose line has been looked up already, so that Register Pair DE holds the line's own address and there is nothing left to do.
6012
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair HL, where the statement loop takes the program up again.
6013
RET Z C8
Return on Z, the reference having been resolved on an earlier pass, which goes to the statement loop at 5E3BH and so to the line the address names.
6014
CP 0EH FE 0E
Compare Register A with 0EH, the token of a reference that still carries the number as it was typed.
6016
Jump to SYNERR 586CH on NZ, which prints Syntax error, 7147H holding 00H and so no line reference standing where one is needed.
6019
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which puts the text pointer back into Register Pair HL and the line number into Register Pair DE.
601A
PUSH HL E5
Push Register Pair HL, the text pointer standing after the reference, which the exchange below swaps for IPOS.
601B
LD HL,(7145H) 2A 45 71
Load Register Pair HL from the word at 7145H, IPOS, the continuation point 5FA4H left standing just after the reference's two bytes.
601E
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves IPOS on the stack and brings the text pointer back into Register Pair HL.
601F
Call 6067H, the statement skipper's REM entry, which runs the text pointer on to the end of the line, counting nested IF tokens in Register D as it goes.
6022
INC HL 23
Increment Register Pair HL past the 00H that ends the line, so that Register Pair HL addresses the first byte of the next line's link.
6023
PUSH HL E5
Push Register Pair HL, that address, which the POP HL at 602AH brings back as the place the forward search is to start from.
6024
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL from the word at 6E9CH, the number of the line being run.
6027
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare the line being run with the line asked for, setting the Carry Flag when the target stands above it.
602A
POP HL E1
Pop Register Pair HL, the address of the line after the one being run, pushed at 6023H.
602B
Call 5AB7H on C, FIND's loop entry, which searches forward from the line Register Pair HL names rather than from the start of the program, because the target stands above the line being run.
602E
Call 5AB4H on NC, FIND itself, which searches from PGMBGN 6E9EH, because the target stands at or below the line being run and the forward search would miss it.
6031
Jump to 6040H on NC, no line of the program carrying the number asked for, which is error 8.
6033
DEC BC 0B
Decrement Register Pair BC, which FIND left holding the address of the line found, so that Register Pair BC addresses the byte before its link.
6034
LD A,0DH 3E 0D
Load Register A with 0DH, the token that marks a resolved line reference, which is written into the program text below in place of the 0EH that was there.
6036
LD (7186H),A 32 86 71
Store Register A into the byte at 7186H, the flag that says the program text now holds resolved references, which 661EH reads when they have to be turned back into numbers before a listing or a save.
6039
POP HL E1
Pop Register Pair HL, IPOS, the address just past the reference's own two bytes, which the exchange at 601EH left on the stack.
603A
Call 66ADH, which writes three bytes down from Register Pair HL: Register A, the 0DH token, then Register C and Register B, the address of the line. The reference in the program text is now the resolved form, so this line is found by one instruction the next time it is run.
603D
LD H,B 60
Load Register H from Register B, the high byte of the found line's address.
603E
LD L,C 69
Load Register L from Register C, its low byte, so that Register Pair HL addresses that line.
603F
RET C9
Return, which goes to the statement loop at 5E3BH for GOTO and RUN, and to the same loop for GOSUB with its seven byte frame standing under the return address.
6040
LD E,08H 1E 08
Undefined line number (6040H), which 6031H reaches and which MERGE's 56E3H also jumps to: load Register E with 08H, the number of the Undefined line number text, the eighth of the block at 6B7CH.
6042
Jump to the error handler at 5886H, which prints it and ends the program.

6045H - RETURN: Go Back to the Statement After the GOSUB (6045H-6064H)

RETURN finds the nearest GOSUB frame with the same finder FOR, NEXT and WEND use at 57F6H, Register D being loaded with 0FFH so that the finder takes the first frame of any kind rather than looking for a particular variable. The frame it wants carries the one byte token 8DH, and a frame of any other kind gives error 3, RETURN without GOSUB, which is how a RETURN inside a FOR loop that has no GOSUB under it is caught. The Stack Pointer is then cut back to the frame, which throws away any FOR or WHILE frames that were built inside the subroutine, and 718EH is brought up to date with it. The last thing RETURN does is the part worth seeing: having put the line number and the text pointer back, it falls into the statement skipper at 6065H with Register Pair BC loaded so that the skip stops at a colon, so the rest of the statement that the GOSUB stood in is passed over. That is what makes ON N GOSUB 100,200,300 work: the GOSUB that is taken leaves the other line references on the line, and this fall through is what steps over them. The two bytes at 6063H load Register A with 0E1H and nothing reads it: the skipper's own LD A,C at 606BH overwrites Register A before any instruction looks at it.

6045
RET NZ C0
RETURN (6045H), the routine the statement address table holds for token 08EH at 67DDH, entered with the Zero Flag set when the keyword stands alone: return on NZ, which goes to the statement loop at 5E3BH and gives Syntax error there for whatever follows the keyword.
6046
LD D,0FFH 16 FF
Load Register D with 0FFH, the value that tells the finder below to take the first frame it meets of any kind rather than looking for a frame whose loop variable matches.
6048
Call 57F6H, the frame finder that FOR, NEXT and WEND share: it walks up from the Stack Pointer plus four, stepping over a FOR frame by eighteen bytes and a WHILE frame by six, and returns with Register A holding the marker byte of the frame it stopped on and Register Pair HL addressing that frame.
604B
CP 8DH FE 8D
Compare Register A with 8DH, the token of the GOSUB keyword, which is the marker a GOSUB frame carries.
604D
Jump to 6050H on Z, the frame being a GOSUB one, with Register Pair HL standing where the Stack Pointer is to be cut back to.
604F
DEC HL 2B
Decrement Register Pair HL, which puts the Stack Pointer one byte lower for a frame that is not a GOSUB one, so that the error below is raised with the stack tidy.
6050
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which throws away every frame built inside the subroutine, any FOR or WHILE frames among them, and leaves the GOSUB frame's own words on top.
6051
LD (718EH),HL 22 8E 71
Store Register Pair HL into the word at 718EH, the cell that says where the stack stands, which the statement loop saves and 4317H and CALL's 53E3H restore.
6054
CP 8DH FE 8D
Compare Register A with 8DH a second time, the flags having been lost to the stack work above, which is the test the error below turns on.
6056
LD E,03H 1E 03
Load Register E with 03H, the number of the RETURN without GOSUB text, the third of the block at 6B7CH.
6058
Jump to the error handler at 5886H on NZ, the frame found being a FOR or a WHILE one and not a GOSUB: a RETURN with no GOSUB under it is reported here.
605B
POP HL E1
Pop Register Pair HL, the number of the line the GOSUB stood on, which 5FFEH and 6001H put into the frame.
605C
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that an error reported after this RETURN names the line the GOSUB was on and not the subroutine's last line.
605F
LD HL,5E3BH 21 3B 5E
Load Register Pair HL with 5E3BH, the address of the statement loop, which the exchange below leaves on the stack as the return address of the skip that follows.
6062
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves 5E3BH on the stack and brings the frame's text pointer, the one GOSUB pushed at 5FFCH, into Register Pair HL.
6063
LD A,0E1H 3E E1
Load Register A with 0E1H, a value nothing reads: the skipper this instruction falls into loads Register A from Register C at 606BH before any instruction tests it, so these two bytes have no effect.

6065H - DATA and COMMON, ELSE and REM: the Statement Skipper (6065H-6086H)

Four statements do nothing when they are run, and all four are this one routine with two entries two bytes apart. DATA and COMMON share 6065H, which the statement address table holds at 67C9H for token 084H and at 6831H for token 0B8H; ELSE and REM share 6067H, which the table holds at 6805H for token 0A2H and at 67DFH for token 08FH; and 6067H is the second and third operand bytes of the LD BC at 6065H, which as an instruction is LD C,00H. The difference between the two entries is one byte of Register Pair BC and it decides where the skip stops. DATA and COMMON arrive with 3AH in Register C, a colon, so the skip ends at the next statement of the line and the rest of the line is still run; ELSE and REM arrive with 00H, so nothing but the end of the line stops them. The swap at 606BH is what makes the pair work: Register B holds the character that ends the skip and Register C the other one, and every quote 22H exchanges them, so a colon inside a string literal does not end a DATA statement and a quote that is never closed leaves the skip running to the end of the line. Register D counts something as well: the INC A at 607BH means the test at 607EH is made against the character plus one, so the token it matches is 8BH, IF, and 6082H to 6084H raise Register D by one for every IF token a DATA or COMMON skip passes, the comparison with Register B being what makes the ELSE and REM entry count nothing. Nothing in the routine reads that count or clears it, so it belongs to the caller. The routine is also the general end of statement skip of the interpreter, called from nine places, and RETURN falls into it at 6065H to step over the rest of an ON GOSUB list.

6065
LD BC,0E3AH 01 3A 0E
DATA and COMMON (6065H), which the statement address table holds for token 084H at 67C9H and for token 0B8H at 6831H, and which RETURN falls into from 6063H: load Register Pair BC with 0E3AH, putting 3AH, a colon, into Register C as the character that is to end the skip, and 0EH into Register B, which the load at 6069H throws away.
6068
NOP 00
A NOP, reached only on the DATA and COMMON path, which steps over the byte that is the second half of the ELSE and REM entry's own instruction and brings the two paths together at 6069H.
6069
LD B,00H 06 00
Load Register B with 00H, the character that is not to end the skip, which the swap below exchanges with Register C at every quote.
606B
LD A,C 79
The swap (606BH), which a quote reaches from 6079H: load Register A from Register C, the character that ends the skip.
606C
LD C,B 48
Load Register C from Register B, the character that does not end it.
606D
LD B,A 47
Load Register B from Register A, so that the two have changed places: inside a string literal the colon no longer ends a DATA statement, and the next quote puts them back.
606E
DEC HL 2B
The character loop (606EH): decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on rather than the one beyond it.
606F
Call NXTCHAR at 5E93H, which brings that character back in Register A, though the Zero Flag it returns is not the one this loop goes by.
6072
OR A B7
OR Register A with itself, which sets the Zero Flag when the character is the 00H that ends the line.
6073
RET Z C8
Return on Z, the end of the line having been reached, which ends a REM or an ELSE and also ends a DATA whose line stops there.
6074
CP B B8
Compare Register A with Register B, the character that ends the skip, which is a colon for DATA and COMMON outside a string and 00H for ELSE and REM.
6075
RET Z C8
Return on Z, the colon of the next statement having been reached, with the text pointer standing on it so that the statement loop takes the line up from there.
6076
INC HL 23
Increment Register Pair HL past the character just read, which is the step the loop makes when the character ends nothing.
6077
CP 22H FE 22
Compare Register A with 22H, a quote, which opens and closes a string literal inside the text being skipped.
6079
Jump back to 606BH on Z, which exchanges Register B and Register C so that the end of skip character and the other one change places for the inside of the string.
607B
INC A 3C
Increment Register A, which makes the comparison below one against the character plus one and sets the Zero Flag when the character was 0FFH.
607C
Jump back to 606FH on Z, the character having been 0FFH, which is the first byte of the interpreter's one two byte statement token and is stepped over without the second byte being read as text.
607E
SUB 8CH D6 8C
Subtract 8CH from Register A, which is the character plus one, so the Zero Flag is set when the character itself was 8BH, the token of the IF keyword.
6080
Jump back to 606EH on NZ, the character being ordinary text that the skip passes over without counting.
6082
CP B B8
Compare Register A with Register B, made with Register A holding 00H, so that the Carry Flag is set when Register B is not 00H, which is the DATA and COMMON entry outside a string literal, and clear for the ELSE and REM entry.
6083
ADC A,D 8A
Add Register D and the Carry Flag to Register A, which is 00H, so that Register A holds the count Register D carried raised by one when the Carry Flag was set and left alone when it was not.
6084
LD D,A 57
Load Register D from Register A, so that Register D counts one for every IF token a DATA or COMMON skip passes and nothing for an ELSE or REM one. No instruction of this routine reads it: the count belongs to whatever called the skip, and the routine never clears it.
6085
Jump back to 606EH for the next character, which runs the skip on to the colon or the end of the line.

6087H - LET: Assign a Value to a Variable, and its Second Entry (6087H-60F1H)

LET is the statement every program uses most and the shortest of the large ones, and it is reached twice over: the statement address table holds 608CH for token 88H at 67D1H, and the statement dispatcher's JP C,608CH at 5E7DH sends every line that begins with something below the statement tokens here as well, which is what makes the keyword optional. It calls the variable search at 39FBH first, so the variable is made if it does not exist, and then demands an equals sign through 4353H: the byte at 6092H is 0F1H, the token the tokenizer gives =, and not the character itself, so the row for it is a data row. What follows is the assignment proper. The destination's address goes into 7184H and onto the stack and its type into Register A, the expression is worked out by 7345H into the accumulator, and the two types are compared and the accumulator converted at 78DDH when they differ, which is where A% = 1.7 loses its fraction. The copy itself is 2946H of BASIC/OV1, which moves exactly as many bytes as 7142H names, from 72ECH for a value of four bytes or fewer and from 72E8H for a double precision one. A string takes the longer way: three comparisons at 60C9H, 60D1H and 60DAH decide whether the text is copied into the string space or the descriptor is simply pointed at where the text already lies, and the rule they make rests on the string space routines at 462BH, 483AH and 46BDH, which this pass has not written; what is certain is what each comparison compares and where it goes. 60DFH is a LD A,0D1H whose operand byte at 60E0H is the POP DE the first of those comparisons jumps to, the fifth entry of that kind in this part of the file, and the 0D1H it leaves in Register A is read by nothing, 2946H taking the type from 7142H and not from Register A. 6087H is LET's second entry, five bytes that 4B19H pushes as a return address in the way DIM pushes 39EDH: it takes a word off the stack, adds three to the type and jumps into the assignment at 60A0H. Those three put the plain type back rather than reaching anything new, and the account of them this page carried until INPUT and READ were written had it the wrong way round. Every caller of this entry comes through 4AFDH, the file item collector, which calls 76A4H to find out whether the type is a string one; 76A4H makes that test by subtracting three from the type, and the value it leaves is what reaches the stack, so the add here restores it. 78DDH then masks the plain type to three bits and the ADD HL,BC at 766DH adds the index a second time, which doubles it, so the words the dispatch reaches are 6B57H for an integer, 6B59H for a string, 6B5BH for a single precision number and 6B53H for a double precision one, whose 08H masks to 00H. 6B55H holds 0000H because there is no type of 01H, and that gap is the proof of the indexing; 6B5DH, 6B5FH and 6B61H are not entries of this table at all, but the first words of the one 7470H loads.

6087
POP AF F1
LET's second entry (6087H), which 4B19H puts on the stack as a return address rather than jumping to: pop Register AF, the word the caller left under it.
6088
ADD A,03H C6 03
Add 03H to Register A, which puts back the three that 76A4H took off: every caller of this entry reaches it through 4AFDH, which calls 76A4H and pushes the lowered type, so Register A arrives three below the destination's real type and leaves holding it. READ and INPUT add the same three for themselves at 64E8H and enter at 60A1H instead.
608A
Jump to 60A0H, LET's own assignment, with the raised type in Register A: the comparison there cannot match, so 78DDH is always called and the value is always converted.
608C
LET (608CH), the routine the statement address table holds for token 88H at 67D1H and the one 5E7DH sends a bare assignment to: call the variable search at 39FBH, which finds the variable named at the text pointer or makes it, and answers with its value's address in Register Pair DE.
608F
Call 4353H, the character demand, which insists that the text pointer stands on the character held in the byte after the call and steps its own return address past that byte.
6092
DEFB 0F1H F1
6092H: the token the tokenizer gives the equals sign, which 4353H above demands. It is the token and not the character 3DH, the reserved word table's operator group at 6B32H giving = the token 0F1H, so a line that reaches LET with anything else at the text pointer is given Syntax error by 4362H.
6093
LD (7184H),DE ED 53 84 71
Store Register Pair DE into the word at 7184H, the address of the variable's value, so that a machine language routine or a system call made while the expression is worked out cannot lose it.
6097
PUSH DE D5
Push Register Pair DE, that same address, which the exchange at 60A0H brings back into Register Pair HL once the expression is in.
6098
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the variable the value is going into, as a count of bytes.
609B
PUSH AF F5
Push Register AF, that type, which the expression below writes 7142H over.
609C
Call 7345H, which works the expression after the equals sign out into the accumulator and leaves its own type in 7142H, pushing a precedence of 00H so that the whole expression is taken.
609F
POP AF F1
Pop Register AF, the type of the destination that 609BH pushed.
60A0
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack and brings the destination's address into Register Pair HL.
60A1
LD B,A 47
Load Register B from Register A, the type of the destination, which the comparison below is made against.
60A2
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type the expression came out as.
60A5
CP B B8
Compare Register A with Register B, the type of the destination.
60A6
LD A,B 78
Load Register A from Register B, the destination's type, which is the type the value must be turned into.
60A7
Jump to 60AFH on Z, the two types being the same, which needs no conversion.
60A9
Call 78DDH, which masks the type in Register A to three bits with AND 07H, adds it to 6B53H at 78E6H and adds it again inside 766DH, so that the table is indexed by twice the type: 02H reaches 6B57H, 03H reaches 6B59H, 04H reaches 6B5BH and the 08H of double precision masks to 00H and reaches 6B53H, and the four words there are 29F4H, 2AB0H, 2A6AH and 2A96H of BASIC/OV1. This is where the fraction of A% = 1.7 is lost, and the 2AB0H that a type of 03H reaches is the overlay routine that insists the value is a string.
60AC
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type again, the conversion above having set it to the destination's.
60AF
LD DE,72ECH 11 EC 72
Load Register Pair DE with 72ECH, the accumulator, which is where a value of four bytes or fewer stands.
60B2
CP 05H FE 05
Compare Register A with 05H, which is above every type but double precision.
60B4
Jump to 60B9H on C, the type being 02H, 03H or 04H, whose value is in the four bytes at 72ECH.
60B6
LD DE,72E8H 11 E8 72
Load Register Pair DE with 72E8H, the type being 08H: a double precision value fills the eight bytes from 72E8H, of which 72ECH is the second half.
60B9
PUSH HL E5
Push Register Pair HL, the destination's address, which 60EFH takes back and the string path below writes over.
60BA
CP 03H FE 03
Compare Register A with 03H, the type of a string.
60BC
Jump to 60ECH on NZ, the value being a number, which is copied where it stands.
60BE
LD HL,(72ECH) 2A EC 72
A string (60BEH): load Register Pair HL with the word at 72ECH, which for a string is the address of its three byte descriptor and not the string itself.
60C1
PUSH HL E5
Push Register Pair HL, that descriptor's address, which 60D4H and 60E0H take back.
60C2
INC HL 23
Increment Register Pair HL to the second byte of the descriptor, the length standing in the first.
60C3
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address the string's text stands at.
60C4
INC HL 23
Increment Register Pair HL to the third byte of the descriptor.
60C5
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, the high byte, so that Register Pair DE holds where the text lies.
60C6
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL with the word at 6E9EH, PGMBGN, the first byte of the program text.
60C9
Call 434DH, the sixteen bit comparison, which sets the Carry Flag when the program starts below the text of the string.
60CC
Jump to 60E0H on NC, the text standing at or below the start of the program, which is the path that takes a copy of it.
60CE
LD HL,(71A3H) 2A A3 71
Load Register Pair HL with the word at 71A3H, LOPT, the end of the arrays and the lowest free address.
60D1
Call 434DH, the sixteen bit comparison, which sets the Carry Flag when that end stands below the text of the string.
60D4
POP DE D1
Pop Register Pair DE, the descriptor's address that 60C1H pushed, which the comparison below is made against and which takes the place of the text's address in Register Pair DE.
60D5
Jump to 60E8H on NC, the text standing at or below the end of the arrays and so not in the string space, where the descriptor may be pointed at it where it lies.
60D7
LD HL,7175H 21 75 71
Load Register Pair HL with 7175H, the three bytes a string descriptor is built in before it is given a slot of its own.
60DA
Call 434DH, the sixteen bit comparison, which sets the Carry Flag when 7175H stands below the descriptor.
60DD
Jump to 60E8H on NC, the descriptor standing at or below 7175H.
60DF
LD A,0D1H 3E D1
Load Register A with 0D1H, whose operand byte at 60E0H is the POP DE that 60CCH jumps to: this path has taken the descriptor's address back at 60D4H already and must not pop a second word. Nothing reads the 0D1H, 2946H below taking the count of bytes from 7142H.
60E1
Call 483AH, which gives the topmost temporary string descriptor back when the address in Register Pair DE is its own, so that a temporary is not left held.
60E4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the descriptor's address into Register Pair HL for the routine below.
60E5
Call 462BH, which takes the length and the address out of that descriptor, asks 46BDH for that many bytes of string space and copies the text into it, so that the variable's string survives whatever the text stood in.
60E8
Call 483AH, which gives the topmost temporary string descriptor back when the address in Register Pair DE is its own.
60EB
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the destination's address back into Register Pair HL and leaves the descriptor's address on the stack for 60EFH to throw away.
60EC
The copy (60ECH): call 2946H of BASIC/OV1, which copies as many bytes as 7142H names from the address in Register Pair DE to the address in Register Pair HL, which is the assignment itself.
60EF
POP DE D1
Pop Register Pair DE, the word 60B9H or 60EBH left on the stack, which is thrown away.
60F0
POP HL E1
Pop Register Pair HL, the text pointer that 60A0H left on the stack.
60F1
RET C9
Return to the statement loop at 5E3BH, the text pointer standing after the expression.

60F2H - ON: ON ERROR GOTO, and ON n GOTO or GOSUB (60F2H-613AH)

ON is two statements under one token and the test at 60F2H is what tells them apart. ON ERROR GOTO reads a line reference and keeps it in 7196H, the cell the error handler reads at 58C0H to decide whether to print a message or enter the program's own handler. Two details of it are worth seeing. ON ERROR GOTO 0 takes the handler away, the test at 6100H letting a line of 0000H through to the store without the line having to exist; and ON ERROR GOTO 0 met while an error is being handled re-raises that error, which is what 6112H to 611CH do, reading the handling flag at 7198H and the error number at 6E8FH and going back into the handler at 589BH, so that the message the program declined to handle is printed after all. Any other line must exist, and 610AH gives error 8, Undefined line number, when FIND cannot reach it. ON n GOTO and ON n GOSUB are the other half. The number is read into Register E, the keyword after it must be GOSUB 8DH or GOTO 89H, and then 612DH walks the list of line references counting down: each comma steps to the next, and when the count reaches zero the statement jumps into the statement dispatcher at 5E7BH with the keyword's own token in Register A, so that GOTO or GOSUB is dispatched exactly as though it had been written on its own. A count that runs off the end of the list falls out at 6138H and the statement does nothing, which is how ON 4 GOTO 10,20,30 goes quietly to the next statement.

60F2
CP 0A8H FE A8
ON (60F2H), the routine the statement address table holds for token 095H at 67DDH: compare Register A with 0A8H, the token of the ERROR keyword, which is what tells ON ERROR GOTO from ON n GOTO.
60F4
Jump to 611FH on NZ, the statement being ON followed by a number rather than by ERROR.
60F6
Call NXTCHAR at 5E93H, which steps the text pointer past the ERROR token and onto the GOTO that must follow it.
60F9
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
60FC
DEFB 89H 89
The GOTO token, which is the only keyword allowed after ON ERROR. It is read as data by the routine the call at 60F9H reaches, not executed, and the instruction after that call is the one at 60FDH. A decoder reading straight through shows it as ADC A,C.
60FD
Call 5FA4H, which reads the line reference after the GOTO, reports its kind in 7147H and brings its number or address back in Register Pair DE.
6100
LD A,D 7A
Load Register A from Register D, the high byte of that line number.
6101
OR E B3
OR Register A with Register E, its low byte, so that the Zero Flag is set when the line is 0000H.
6102
Jump to 610DH on Z, the statement being ON ERROR GOTO 0, which takes the program's handler away and needs no line to exist.
6104
Call 5AB2H, FIND's entry two instructions in, which leaves the caller's own Register Pair HL on the stack and then walks the program for the line number in Register Pair DE, returning its address in Register Pair BC and the Carry Flag set only when a line of exactly that number exists, and with Register Pair BC addressing the first line beyond it when none does.
6107
LD D,B 50
Load Register D from Register B, the high byte of the found line's address.
6108
LD E,C 59
Load Register E from Register C, its low byte, so that Register Pair DE holds the address rather than the number: the handler is to jump straight to it.
6109
POP HL E1
Pop Register Pair HL, the text pointer that FIND's entry left on the stack.
610A
Jump to 6040H on NC, no line of the program carrying that number, which gives error 8, Undefined line number: an ON ERROR GOTO must name a line that exists.
610D
LD (7196H),DE ED 53 96 71
Store Register Pair DE into the word at 7196H, the line the error handler is to enter, which is 0000H for ON ERROR GOTO 0 and the line's own address otherwise.
6111
RET C D8
Return on C, a real line having been found, which goes to the statement loop at 5E3BH: the handler is set and there is nothing more to do.
6112
LD A,(7198H) 3A 98 71
Load Register A from the byte at 7198H, the flag that says an error is being handled, which the handler sets with its DEC at 58CEH.
6115
OR A B7
OR Register A with itself, which sets the Zero Flag when no error is being handled.
6116
LD A,E 7B
Load Register A from Register E, the low byte of the line, which is 00H here and which the instruction below leaves alone.
6117
RET Z C8
Return on Z, no error being handled, so that ON ERROR GOTO 0 outside a handler merely takes the handler away.
6118
LD A,(6E8FH) 3A 8F 6E
Load Register A from the byte at 6E8FH, the number of the error being handled, which the handler kept there at 58A7H.
611B
LD E,A 5F
Load Register E from Register A, that number, which is what the handler takes its text from.
611C
Jump to 589BH, back into the error handler below its own bookkeeping, so that an ON ERROR GOTO 0 met inside a handler re-raises the error it was handling and the message is printed after all.
611F
ON n (611FH), reached from 60F4H: call 799FH, which works the number out into Register A and Register E and gives Illegal function call for anything above 255.
6122
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the number, which must be GOSUB or GOTO.
6123
LD B,A 47
Load Register B from Register A, that token, which is kept until 612FH hands it to the dispatcher.
6124
CP 8DH FE 8D
Compare Register A with 8DH, the token of the GOSUB keyword.
6126
Jump to 612DH on Z, the keyword being GOSUB, which needs no further test.
6128
Call 4353H, which insists on the byte standing after this call, the only other keyword allowed being GOTO.
612B
DEFB 89H 89
The GOTO token, data for the call at 6128H and not an instruction; the instruction after that call is the one at 612CH.
612C
DEC HL 2B
Decrement Register Pair HL so that the walk below reads the character the text pointer already stands on, which 4353H has stepped past.
612D
LD C,E 4B
The walk (612DH): load Register C from Register E, the number the statement was given, which is the count of line references to step over.
612E
DEC C 0D
Decrement Register C, the count of references still to pass: the first reference is the one a number of 1 chooses.
612F
LD A,B 78
Load Register A from Register B, the GOSUB or GOTO token, which the dispatcher below takes as though it had been written on its own.
6130
Jump to 5E7BH on Z, the count having run out at this reference: 5E7BH is the statement dispatcher's own token handling, so GOTO or GOSUB is dispatched with the text pointer standing at the line reference the number chose.
6133
Call 5FA5H, the line reference test one instruction in, which steps the text pointer past this reference without using it.
6136
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which separates one line reference from the next.
6138
RET NZ C0
Return on NZ, the list having run out before the count did, which goes to the statement loop: ON 4 GOTO 10,20,30 does nothing at all and the program carries on with the next statement.
6139
Jump back to 612EH for the next reference of the list, which takes one off the count and tries again.

613BH - RESUME, ERROR and AUTO (613BH-61CCH)

Three statements, and the first of them is where an error handler gives the program back. RESUME 613BH reads the flag at 7198H that the error handler set with its DEC (HL) at 58CEH: when it is 00H no error is being handled and the statement gives error 20, RESUME without error, having first cleared the ON ERROR line at 7196H so that the handler cannot be entered again. Otherwise the INC A at 614AH turns the 0FFH into 00H and clears both ERR at 6E8FH and the DOS code at 7C4EH, so a program cannot read the error it has just resumed from. Three forms follow, and they are the manual's: RESUME NEXT, which the token 83H at 6151H recognises, takes up the statement after the one that failed; RESUME line goes through GOTO's own resolution at 600DH; and RESUME alone, which the manual says is the same as RESUME 0, takes up the failing statement itself. The line number and text pointer come from 7190H and 7194H, which the handler saved at 5889H and 58ADH. One thing is worth setting beside the manual: it says RESUME NEXT returns to the line number following the statement where the error occurred, but the code returns to the next statement, 618CH calling the statement skipper to step over the rest of the failing one, and it moves to the next line only when the failing statement was the last on its line, which 617FH to 6186H do by stepping four bytes over the link and the line number. ERROR 6190H reads a number and raises it as though the interpreter had: a number of 0 is refused with Illegal function call and anything else goes straight to the handler at 5886H, so a program can raise any of the 51 texts and any number the mapping turns into Unprintable error. AUTO 619BH sets the line number at 7188H, the increment at 718AH and the flag at 7187H that command level reads at 5947H, and then jumps to command level rather than returning: AUTO alone starts at line 10 and steps by 10, both coming from the one `LD DE,000AH` at 619BH, and an increment of zero is refused.

613B
LD A,(7198H) 3A 98 71
RESUME (613BH), the routine the statement address table holds for token 0A9H at 6813H: load Register A from the byte at 7198H, the flag the error handler sets at 58CEH to say that the program's own ON ERROR handler is running.
613E
OR A B7
OR Register A with itself, which sets the Zero Flag when no error is being handled.
613F
Jump to 614AH on NZ, a handler being in hand, so that the program may be given back.
6141
LD (7196H),A 32 96 71
Store Register A into the byte at 7196H, the low byte of the line an ON ERROR GOTO named, which is 00H here: a RESUME with no error takes the handler away so that the error about to be raised cannot enter it.
6144
LD (7197H),A 32 97 71
Store Register A into the byte at 7197H, the high byte of that line, finishing the clear.
6147
Jump to 587BH, the entry of the ordinary error chain for error 20, RESUME without error.
614A
INC A 3C
A handler is running (614AH): increment Register A, which turns the 0FFH the handler left into 00H, and so gives this routine the value both stores below want.
614B
LD (6E8FH),A 32 8F 6E
Store Register A into the byte at 6E8FH, the error number the handler kept at 58A7H, which is what the ERR function reads: a resumed error is no longer readable.
614E
LD (7C4EH),A 32 4E 7C
Store Register A into the byte at 7C4EH, where DERR keeps the DOS's own code, cleared for the same reason.
6151
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the RESUME keyword.
6152
CP 83H FE 83
Compare Register A with 83H, the token of the NEXT keyword, which is the one word the statement allows after it.
6154
Jump to 6167H on Z, the statement being RESUME NEXT, which takes up the statement after the one that failed.
6156
Call 5FA4H, which reads a line reference at the text pointer, reports its kind in 7147H and brings its number or address back in Register Pair DE.
6159
RET NZ C0
Return on NZ, something standing after the keyword that is neither NEXT nor a line reference, which goes to the statement loop at 5E3BH and gives Syntax error there.
615A
LD A,D 7A
Load Register A from Register D, the high byte of the line number read.
615B
OR E B3
OR Register A with Register E, its low byte, so that the Zero Flag is set when the statement was RESUME 0 or RESUME with nothing after it.
615C
Jump to 616DH on Z, which is the RESUME 0 path: the manual says that omitting the line is the same as RESUME 0 and that both take up the statement in which the error occurred.
615E
Call 600DH, GOTO's own resolution, which finds the line the reference names, writes the resolved form back into the program text and leaves Register Pair HL addressing that line.
6161
XOR A AF
Clear Register A with XOR A, making 00H, the value the handling flag is to be cleared to.
6162
LD (7198H),A 32 98 71
Store Register A into the byte at 7198H, the handling flag, so that a later error enters the ON ERROR handler again rather than printing its message.
6165
Jump to 618FH, the return, which goes to the statement loop at 5E3BH with Register Pair HL at the line the statement named.
6167
RESUME NEXT (6167H), reached from 6154H: call NXTCHAR at 5E93H, which steps the text pointer past the NEXT token and reports whether the statement ends there.
616A
RET NZ C0
Return on NZ, something standing after NEXT, which goes to the statement loop and gives Syntax error there.
616B
Jump to 6172H with the Zero Flag set, which is what 617DH reads to tell this form from RESUME 0.
616D
XOR A AF
RESUME 0 (616DH): clear Register A with XOR A, making 00H.
616E
LD (7198H),A 32 98 71
Store Register A into the byte at 7198H, the handling flag, which is cleared here as on the other two paths.
6171
INC A 3C
Increment Register A, making 01H, which leaves the Zero Flag clear so that 617DH takes this path to the return and not to the statement stepper.
6172
LD HL,(7194H) 2A 94 71
The shared restore (6172H): load Register Pair HL from the word at 7194H, the text pointer of the statement that failed, which the handler stored there at 58ADH out of SAVTXT.
6175
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that pointer into Register Pair DE while the line number is fetched.
6176
LD HL,(7190H) 2A 90 71
Load Register Pair HL from the word at 7190H, the number of the line the error happened on, which the handler stored at 5889H.
6179
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that the program goes on as though it were still on that line.
617C
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL.
617D
Jump to 618FH on NZ, which is the RESUME 0 and RESUME line paths: the text pointer stands at the failing statement itself and the program takes it up again.
617F
LD A,(HL) 7E
RESUME NEXT, the stepper (617FH): load Register A with the byte Register Pair HL addresses, the character the failing statement began at.
6180
OR A B7
OR Register A with itself, which sets the Zero Flag when that byte is the 00H that ends a line, so that the failing statement was the last one on its line.
6181
Jump to 6187H on NZ, the failing statement not being at the end of its line, so that only the one step below is made.
6183
INC HL 23
Increment Register Pair HL past the 00H that ended the line, the first of four steps that carry the pointer into the next line.
6184
INC HL 23
Increment Register Pair HL past the low byte of the next line's link.
6185
INC HL 23
Increment Register Pair HL past its high byte.
6186
INC HL 23
Increment Register Pair HL past the low byte of the next line's number.
6187
INC HL 23
Increment Register Pair HL once more, past the high byte of the line number on the path from 6183H and past the failing statement's first character on the path from 6181H, so that both leave the pointer inside the text.
6188
XOR A AF
Clear Register A with XOR A, making 00H, the value the handling flag below is to be cleared to.
6189
LD (7198H),A 32 98 71
Store Register A into the byte at 7198H, the handling flag, cleared on this path as on the other two.
618C
Call 6065H, the statement skipper's DATA entry, which runs the text pointer on to the colon that begins the next statement or to the end of the line, so that the statement the error happened in is passed over.
618F
RET C9
The return (618FH): return to the statement loop at 5E3BH, which takes the program up at whatever the text pointer now stands on.
6190
ERROR (6190H), the routine the statement address table holds for token 0A8H at 6811H: call 799FH, which works the error number out into Register A and Register E and refuses anything above 255 with Illegal function call.
6193
RET NZ C0
Return on NZ, the statement not having ended with the number, which goes to the statement loop at 5E3BH and gives Syntax error there.
6194
OR A B7
OR Register A with itself, which sets the Zero Flag when the number given was 0.
6195
Jump to FUNCERR 5F95H on Z, which prints Illegal function call: there is no error 0, the handler's own mapping having no text for it.
6198
Jump to the error handler at 5886H with the number in Register E, which raises it exactly as the interpreter's own chains do, so a program can raise any of the fifty one texts and any number the mapping at 58DFH turns into Unprintable error.
619B
LD DE,000AH 11 0A 00
AUTO (619BH), the routine the statement address table holds for token 0ABH at 6817H: load Register Pair DE with 000AH, ten, which is both the line number and the increment the statement defaults to.
619E
PUSH DE D5
Push Register Pair DE, that ten, which the POP HL at 61C5H takes as the starting line number when the statement names none.
619F
Jump to 61B9H on Z, the keyword standing alone, so that both the line and the increment are the ten loaded above.
61A1
Call NUM2DE at 5F9AH, which reads the first line number into Register Pair DE, taking a full stop to mean the line being run.
61A4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that line number into Register Pair HL and the text pointer into Register Pair DE.
61A5
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the line number on the stack in place of the ten and brings the ten into Register Pair HL as the increment.
61A6
Jump to 61BAH on Z, the statement having ended with the line number, so that the increment stays at ten.
61A8
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL and leaves the ten in Register Pair DE.
61A9
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
61AC
DEFB 2CH 2C
The comma between the line number and the increment, read as data by the routine the call at 61A9H reaches, not executed; the instruction after that call is the one at 61ADH.
61AD
LD DE,(718AH) ED 5B 8A 71
Load Register Pair DE from the word at 718AH, the increment in force, so that a statement written as AUTO line, with the comma and nothing after it keeps the increment it already had rather than going back to ten.
61B1
Jump to 61B9H on Z, the statement having ended with the comma, which takes that increment.
61B3
Call 5FA4H, which reads the increment at the text pointer into Register Pair DE.
61B6
Jump to SYNERR 586CH on NZ, which prints Syntax error, something standing after the increment.
61B9
EX DE,HL EB
The increment in hand (61B9H): exchange Register Pair DE with Register Pair HL, which puts the increment into Register Pair HL and the text pointer into Register Pair DE.
61BA
LD A,H 7C
Load Register A from Register H, the high byte of the increment.
61BB
OR L B5
OR Register A with Register L, its low byte, so that the Zero Flag is set when the increment is 0000H and Register A is left non-zero when it is not.
61BC
Jump to FUNCERR 5F95H on Z, which prints Illegal function call: an increment of zero would number every line the same and is refused.
61BF
LD (718AH),HL 22 8A 71
Store Register Pair HL into the word at 718AH, the increment, which command level adds at 5974H after each line is entered.
61C2
LD (7187H),A 32 87 71
Store Register A into the byte at 7187H, the flag that says AUTO is on, which 5947H reads to decide whether to prompt with a line number: Register A holds the OR of the increment's two bytes and so is never 00H here.
61C5
POP HL E1
Pop Register Pair HL, the starting line number, which 61A5H put on the stack or which is the ten pushed at 619EH.
61C6
LD (7188H),HL 22 88 71
Store Register Pair HL into the word at 7188H, the line number AUTO is to offer first, which 594DH displays through NUMDSP 3139H.
61C9
POP BC C1
Pop Register Pair BC, the statement loop's own address that the dispatcher pushed, which is thrown away because this statement does not go back to the line it stands on.
61CA
Jump to 593BH, command level, which sets the line number to 0FFFFH, sees the flag at 7187H and begins offering line numbers instead of printing Ready.

61CDH - IF, THEN and ELSE (61CDH-620AH)

IF works out its condition, tests the sign of the result with 2905H, and then goes two quite different ways. A true condition falls to 61E6H, which reads what follows the THEN: a line reference of the unresolved kind goes to GOTO at 600AH, one of the resolved kind needs nothing but its own address and the RET at 61F7H takes the program there, and anything else is dispatched at 5E7BH as a statement, which is how IF A THEN PRINT works without IF knowing anything about PRINT. A false condition goes to 61F8H, which skips forward looking for the matching ELSE with the statement skipper at 6065H and counts the nesting in Register D: the skipper raises Register D by one for every IF token it passes, 61F8H starts the count at 01H for this IF itself, and 6206H takes one off at each ELSE, so that the ELSE of a nested IF is passed over and only the one belonging to this IF ends the skip. If the line runs out first the RET at 61FEH goes to the statement loop and the whole of the rest of the line is dropped, which is the ordinary case of an IF with no ELSE. The keyword after the condition may be THEN 0D0H, GOTO 89H or a comma, which 61D0H to 61DEH allow between them, and the comma form is why IF A, PRINT is taken: 61D3H calls NXTCHAR for a comma and the 4353H at 61DAH demands THEN only when neither a comma nor a GOTO was found.

61CD
IF (61CDH), the routine the statement address table holds for token 08BH at 67CFH: call the expression evaluator at 7345H, which works the condition out and leaves it in the accumulator at 72ECH.
61D0
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the condition.
61D1
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which this interpreter allows in place of THEN.
61D3
Call NXTCHAR at 5E93H on Z, which steps the text pointer past the comma and brings the next character back in Register A.
61D6
CP 89H FE 89
Compare Register A with 89H, the token of the GOTO keyword, which may stand where THEN would.
61D8
Jump to 61DFH on Z, the keyword being GOTO, which is left on the line for 61E6H to find again.
61DA
Call 4353H, which insists on the byte standing after this call, neither a comma nor a GOTO having been found.
61DD
DEFB 0D0H D0
The THEN token, data for the call at 61DAH and not an instruction; the instruction after that call is the one at 61DEH. A decoder reading straight through shows it as RET NC.
61DE
DEC HL 2B
Decrement Register Pair HL so that the text pointer stands on the character 4353H stepped past, which the two paths below both read for themselves.
61DF
PUSH HL E5
The test (61DFH), which the GOTO path reaches from 61D8H: push Register Pair HL, the text pointer standing after the keyword, which the POP HL at 61E3H brings back.
61E0
Call 2905H of the overlay, which tests the sign of the value in the accumulator, giving Type mismatch at 5884H for a string and setting the Zero Flag when the condition is zero and so false.
61E3
POP HL E1
Pop Register Pair HL, the text pointer pushed at 61DFH.
61E4
Jump to 61F8H on Z, the condition being false, which skips forward to the matching ELSE or to the end of the line.
61E6
The true path (61E6H), which 6209H also reaches when an ELSE has been found: call NXTCHAR at 5E93H, which brings the character after the keyword back in Register A.
61E9
RET Z C8
Return on Z, nothing following the THEN, which goes to the statement loop at 5E3BH and so to the next line.
61EA
CP 0EH FE 0E
Compare Register A with 0EH, the token that stands in front of a line number as it was typed.
61EC
Jump to GOTO at 600AH on Z, the THEN being followed by a line number, which resolves the reference, writes the resolved form back into the program and leaves the program at that line.
61EF
CP 0DH FE 0D
Compare Register A with 0DH, the token that stands in front of a line's address once a GOTO has resolved the reference.
61F1
Jump to 5E7BH on NZ, the THEN being followed by something that is not a line reference at all: 5E7BH is the statement dispatcher's own token handling, so a statement written after THEN is dispatched as though it stood alone, and a letter goes to LET.
61F4
LD HL,(7149H) 2A 49 71
Load Register Pair HL from the word at 7149H, the two bytes standing after a resolved reference, which are the line's own address.
61F7
RET C9
Return with Register Pair HL at that line, which goes to the statement loop at 5E3BH and so takes the program up there: a resolved reference after THEN costs two instructions.
61F8
LD D,01H 16 01
The false path (61F8H): load Register D with 01H, the count of IF statements whose ELSE is still to be matched, which is this one.
61FA
The skip (61FAH): call 6065H, the statement skipper's DATA entry, which runs the text pointer on to the next colon or the end of the line and raises Register D by one for every IF token it passes.
61FD
OR A B7
OR Register A with itself, which sets the Zero Flag when the skipper stopped at the 00H that ends the line rather than at a colon.
61FE
RET Z C8
Return on Z, the line having run out with no ELSE found, which goes to the statement loop at 5E3BH: an IF with no ELSE drops the whole of the rest of its line when the condition is false.
61FF
Call NXTCHAR at 5E93H, which steps the text pointer past the colon the skipper stopped on and onto the first character of the next statement.
6202
CP 0A2H FE A2
Compare Register A with 0A2H, the token of the ELSE keyword.
6204
Jump back to 61FAH on NZ, the statement not being an ELSE, which skips it too.
6206
DEC D 15
Decrement Register D, the count of IF statements waiting for an ELSE, this ELSE having matched one of them.
6207
Jump back to 61FAH on NZ, the ELSE belonging to a nested IF that the skipper counted, which is passed over so that only this IF's own ELSE ends the skip.
6209
Jump back to 61E6H, the ELSE belonging to this IF having been found, which reads what follows it exactly as the true path reads what follows a THEN: a line reference, a resolved reference or a statement.

620BH - LPRINT and PRINT, with TAB(, SPC( and the Comma Fields (620BH-6355H)

PRINT is the most used statement of the interpreter and the longest of the ones written so far, and nearly all of its 334 bytes are about where a thing is printed rather than what. LPRINT 620BH is three instructions: it sets the printer flag at 6E92H and jumps into PRINT's own loop, so every test below reads the printer's width at 6E94H and position at 6E91H instead of the display's at 6E95H and 713CH. PRINT 6213H loads Register C with 02H and calls the file number reader at 4A81H, so a PRINT #n, insists on a file opened for output exactly as WRITE does; then it looks for PRINT@, the 40H at 6218H, which 7D95H turns into a cursor position. The loop at 621DH sorts out what comes next: the end of the statement writes a carriage return and clears the flags through 634BH; the USING token 0DAH goes to 3F18H; TAB( 0D1H and SPC( 0D5H both go to 62D0H; a comma goes to the field code at 6296H; a semicolon goes to 6344H, which prints nothing and reads the next item. Anything else is an item: 6241H works it out, and a number is turned into text by 3147H and given a trailing blank at 6250H, which is the difference from WRITE, where 5721H takes the leading one off instead. Then 6256H to 628CH asks whether the item fits: a line is only broken when the position is not already at the left and the item would pass the width, and a width of 0FFH means no limit at all, which is what the INC A tests at 6268H and 627DH are for. The comma field code at 62C9H does its arithmetic by taking 10H off until it goes negative and complementing what is left, which is how many blanks carry the position to the next multiple of sixteen. TAB( and SPC( share 62D0H and differ by one instruction: 62DDH takes one off the argument for TAB( because TAB(1) means column one, and 62FEH divides the argument by the width through 2C70H so that a TAB( past the end of the line wraps rather than running away.

620B
LD A,01H 3E 01
LPRINT (620BH), the routine the statement address table holds for token 09DH at 67EDH: load Register A with 01H, the value that sends output to the printer.
620D
LD (6E92H),A 32 92 6E
Store Register A into the byte at 6E92H, the printer flag, which 40D8H reads at 40DFH and which 634BH clears when the statement ends.
6210
Jump to 621DH, PRINT's own item loop, so that LPRINT is PRINT with the one flag set: it takes no file number, a printer being the only destination.
6213
LD C,02H 0E 02
PRINT (6213H), the routine the statement address table holds for token 091H at 67E3H: load Register C with 02H, the output file mode, which the reader below weighs the file's own mode against.
6215
Call 4A81H, the file number reader PRINT shares with WRITE, which returns at once unless the character is 23H and otherwise works the number out, gives error 54 when the mode is not 02H, insists on the comma, and sets FILEX 6E98H.
6218
CP 40H FE 40
Compare Register A with 40H, the at sign, which is the PRINT@ form that names a position on the display.
621A
Call 7D95H on Z, which works the position out and moves the cursor there, so that PRINT@ 512,"X" starts where it was told.
621D
DEC HL 2B
The item loop (621DH), which 6210H jumps to and 6348H comes back to: decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
621E
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended there.
6221
Call 41F5H on Z, which writes a carriage return: a PRINT whose list has ended sends one, and a PRINT with no list at all sends one and nothing else.
6224
Jump to 634BH on Z, which clears the printer flag at 6E92H and both bytes of FILEX 6E98H and returns to the statement loop: that is the end of every PRINT and LPRINT.
6227
CP 0DAH FE DA
Compare Register A with 0DAH, the token of the USING keyword.
6229
Jump to 3F18H on Z, the formatted print, which is a routine of its own and handles the whole of the rest of the statement.
622C
CP 0D1H FE D1
Compare Register A with 0D1H, the token of TAB(, which takes the position to a column.
622E
Jump to 62D0H on Z, where TAB( and SPC( are read together.
6231
CP 0D5H FE D5
Compare Register A with 0D5H, the token of SPC(, which writes a count of blanks.
6233
Jump to 62D0H on Z, the same place, the two differing by one instruction there.
6236
PUSH HL E5
Push Register Pair HL, the text pointer, which the POP BC at 6240H and the POP HL at 6344H both take back, each path knowing which it needs.
6237
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which carries the position to the next comma field.
6239
Jump to 6296H on Z, the comma field code, which carries the position to the next multiple of sixteen.
623B
CP 3BH FE 3B
Compare Register A with 3BH, a semicolon, which separates two items without moving the position at all.
623D
Jump to 6344H on Z, which pops the text pointer and reads the next item, so a semicolon costs nothing but the reading of it.
6240
POP BC C1
An item (6240H): pop Register Pair BC, the text pointer pushed at 6236H, which this path does not need in Register Pair HL.
6241
Call the expression evaluator at 7345H, which works the item out and leaves it in the accumulator at 72ECH.
6244
PUSH HL E5
Push Register Pair HL, the text pointer standing after the item, which the POP HL at 6292H brings back.
6245
Call 76A4H, which reads the type of the value and returns it in Register A less 03H, so that the Zero Flag is set for a string.
6248
Jump to 6256H on Z, the item being a string, which needs neither conversion nor a trailing blank.
624A
Call 3147H, which converts the number in the accumulator to text at 72FEH with a blank or a minus sign in the first byte and a 00H at the end.
624D
Call 464FH, which measures that text, builds a descriptor for it and makes it the accumulator's string, leaving Register Pair HL on the 00H that ended it.
6250
LD (HL),20H 36 20
Store 20H into the byte Register Pair HL addresses, a blank, which writes over that 00H: every number PRINT writes is followed by a blank, where WRITE takes the leading one off at 5721H instead.
6252
LD HL,(72ECH) 2A EC 72
Load Register Pair HL from the word at 72ECH, the address of the string's descriptor, whose first byte is its length.
6255
INC (HL) 34
Increment the byte Register Pair HL addresses, the length, so that the blank just written is part of the string.
6256
The width test (6256H), which a string reaches from 6248H: call 45DFH, which loads FILEX 6E98H and sets the Zero Flag when there is no file in hand.
6259
Jump to 628FH on NZ, output going to a file, where no line is ever broken: a file has no width and the item is written as it stands.
625B
LD HL,(72ECH) 2A EC 72
Load Register Pair HL from the word at 72ECH, the string's descriptor, whose length byte the arithmetic below adds to the position.
625E
LD A,(6E92H) 3A 92 6E
Load Register A from the byte at 6E92H, the printer flag.
6261
OR A B7
OR Register A with itself, which sets the Zero Flag when output is going to the display.
6262
Jump to 6279H on Z, the display's own width and position being the pair to read.
6264
LD A,(6E94H) 3A 94 6E
Load Register A from the byte at 6E94H, the printer's width, which WIDTH LPRINT set at 796AH.
6267
LD B,A 47
Load Register B from Register A, that width, which the comparison below weighs the new position against.
6268
INC A 3C
Increment Register A, which sets the Zero Flag when the width was 0FFH.
6269
Jump to 628FH on Z, the printer's width being 0FFH, which means no limit: the item is written and the line is never broken.
626B
LD A,(6E91H) 3A 91 6E
Load Register A from the byte at 6E91H, the printer's print position.
626E
OR A B7
OR Register A with itself, which sets the Zero Flag when the position is at the left margin.
626F
Jump to 628FH on Z, the line being empty, so that an item longer than the whole width is written rather than a carriage return being wasted before it.
6271
ADD A,(HL) 86
Add the byte Register Pair HL addresses to Register A, the item's length, so that Register A holds where the position would stand after it.
6272
CCF 3F
Complement the Carry Flag, so that the Carry Flag is set when the addition did not carry past 255.
6273
Jump to 628CH on NC, the addition having carried past 255, which breaks the line.
6275
DEC A 3D
Decrement Register A, so that the comparison below is of the last column the item would use.
6276
CP B B8
Compare Register A with Register B, the width, which sets the Carry Flag when the item still fits.
6277
Jump to 628CH, the common end of both width tests, with the Carry Flag saying whether the item fits.
6279
LD A,(6E95H) 3A 95 6E
The display's width (6279H): load Register A from the byte at 6E95H, the display's width, which a plain WIDTH set at 7978H.
627C
LD B,A 47
Load Register B from Register A, the display's width, which the comparison below weighs the new position against.
627D
INC A 3C
Increment Register A, which sets the Zero Flag when the width was 0FFH.
627E
Jump to 628FH on Z, no limit being set for the display either.
6280
LD A,(713CH) 3A 3C 71
Load Register A from the byte at 713CH, the display's print position.
6283
OR A B7
OR Register A with itself, which sets the Zero Flag when the position is at the left margin.
6284
Jump to 628FH on Z, the line being empty, for the same reason as 626FH.
6286
ADD A,(HL) 86
Add the byte Register Pair HL addresses to Register A, the item's length.
6287
CCF 3F
Complement the Carry Flag, as the printer's test does.
6288
Jump to 628CH on NC, the addition having carried past 255.
628A
DEC A 3D
Decrement Register A to the last column the item would use.
628B
CP B B8
Compare Register A with Register B, the display's width, setting the Carry Flag when the item fits.
628C
Jump to 41F5H on NC when it does not fit, which writes a carriage return so that the item begins on a line of its own.
628F
Write the item (628FH), which every path reaches: call 46A8H, which takes the string out of the accumulator and writes it a character at a time through 40D8H.
6292
POP HL E1
Pop Register Pair HL, the text pointer pushed at 6244H.
6293
Jump back to 621DH for the next item of the list.
6296
LD BC,0007H 01 07 00
The comma field (6296H), reached from 6239H: load Register Pair BC with 0007H, the offset at which the file control block's own column count stands.
6299
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL from the word at 6E98H, FILEX, the control block of the file in hand less two.
629C
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, so that Register Pair HL addresses that column count, which is meaningless when there is no file in hand and is not read in that case.
629D
Call 45DFH, which sets the Zero Flag when there is no file in hand.
62A0
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the file's own column count, which only the file path below uses.
62A1
Jump to 62C9H on NZ, output going to a file, where a comma carries the position to the next multiple of sixteen in the file's own count.
62A3
LD A,(6E92H) 3A 92 6E
Load Register A from the byte at 6E92H, the printer flag.
62A6
OR A B7
OR Register A with itself, which sets the Zero Flag when output is going to the display.
62A7
Jump to 62B7H on Z, the display's own pair of cells being the ones to read.
62A9
LD A,(6E93H) 3A 93 6E
Load Register A from the byte at 6E93H, the printer's last tab stop, which WIDTH worked out at 796EH as the width rounded down to a multiple of sixteen.
62AC
LD B,A 47
Load Register B from Register A, that last stop, which the comparison below weighs the position against.
62AD
INC A 3C
Increment Register A, which sets the Zero Flag when the last stop was 0FFH and so no limit is set.
62AE
LD A,(6E91H) 3A 91 6E
Load Register A from the byte at 6E91H, the printer's print position, loaded here because the jump below needs the flags of the increment and the value of the position both.
62B1
Jump to 62C9H on Z, no limit being set, so that the comma carries the position to the next multiple of sixteen however far the line has run.
62B3
CP B B8
Compare Register A with Register B, the last tab stop, setting the Carry Flag when the position is still below it.
62B4
Jump to 62C3H, the common end of both comma tests, with the Carry Flag saying whether another field fits on the line.
62B7
LD A,(6E96H) 3A 96 6E
The display's comma field (62B7H): load Register A from the byte at 6E96H, the display's last tab stop.
62BA
LD B,A 47
Load Register B from Register A, the display's last tab stop, which the comparison below weighs the position against.
62BB
LD A,(713CH) 3A 3C 71
Load Register A from the byte at 713CH, the display's print position.
62BE
CP 0FFH FE FF
Compare Register A with 0FFH, the position a display line that has been filled exactly reaches.
62C0
Jump to 62C9H on Z, the position being 0FFH, so that the comma is taken as moving to the next field rather than as ending the line.
62C2
CP B B8
Compare Register A with Register B, the display's last tab stop, setting the Carry Flag when another field fits.
62C3
Call 41F5H on NC, which writes a carriage return: the position has passed the last tab stop and the comma takes the output to the next line instead of to a field.
62C6
Jump to 6344H on NC, which reads the next item, the carriage return having done the comma's work.
62C9
SUB 10H D6 10
The field arithmetic (62C9H): subtract 10H from Register A, sixteen, which is the width of one comma field.
62CB
Jump back to 62C9H on NC, which takes sixteen off again and again until the result passes below zero, leaving Register A holding how far the position stands past the field boundary below it, less sixteen.
62CD
CPL 2F
Complement Register A, every bit of it, which turns that into the count of blanks that carries the position to the next multiple of sixteen.
62CE
Jump to 6339H, the blank writer, which writes that many blanks and reads the next item.
62D0
PUSH AF F5
TAB( and SPC( (62D0H), which 622EH and 6233H both reach: push Register Pair AF, the token itself, which the POP AF at 62D7H brings back so that the two can be told apart.
62D1
Call NXTCHAR at 5E93H, which steps the text pointer past the token and onto the argument.
62D4
Call 7990H, which works the argument out into Register Pair DE with the flags set from Register D.
62D7
POP AF F1
Pop Register Pair AF, the token pushed at 62D0H.
62D8
PUSH AF F5
Push Register Pair AF again, which the POP AF at 6308H brings back after the argument has been dealt with.
62D9
CP 0D5H FE D5
Compare Register A with 0D5H, the token of SPC(, which counts blanks from where the position stands.
62DB
Jump to 62DEH on Z, the token being SPC(, whose argument is a count and is taken as it is.
62DD
DEC DE 1B
Decrement Register Pair DE, the argument, because TAB(1) means the first column and the position is counted from zero: this one instruction is the whole difference between the two.
62DE
LD A,D 7A
Load Register A from Register D, the high byte of the argument.
62DF
OR A B7
OR Register A with itself, which sets the sign flag from that byte.
62E0
Jump to 62E6H on P, the argument being positive, which is the ordinary case.
62E3
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, a negative argument being taken as nothing rather than refused: TAB(-5) moves the position nowhere and gives no message.
62E6
PUSH HL E5
Push Register Pair HL, the text pointer, which the POP HL at 6302H brings back.
62E7
Call 45DFH, which sets the Zero Flag when there is no file in hand.
62EA
Jump to 6302H on NZ, output going to a file, where the argument is not reduced because a file has no width to wrap at.
62EC
LD A,(6E92H) 3A 92 6E
Load Register A from the byte at 6E92H, the printer flag, read for its flags alone.
62EF
OR A B7
OR Register A with itself, which sets the Zero Flag when output is going to the display.
62F0
LD A,(6E94H) 3A 94 6E
Load Register A from the byte at 6E94H, the printer's width, loaded before the jump so that both paths have a width in Register A.
62F3
Jump to 62F8H on NZ, output going to the printer, whose width is the one just loaded.
62F5
LD A,(6E95H) 3A 95 6E
Load Register A from the byte at 6E95H, the display's width, which replaces it when output is going to the display.
62F8
LD L,A 6F
Load Register L from Register A, the width, as the low byte of the divisor below.
62F9
INC A 3C
Increment Register A, which sets the Zero Flag when the width was 0FFH.
62FA
Jump to 6302H on Z, no limit being set, so that the argument is used as it stands however large it is.
62FC
LD H,00H 26 00
Load Register H with 00H, so that Register Pair HL holds the width as a sixteen bit number.
62FE
Call 2C70H of the overlay, which divides the argument in Register Pair DE by the width in Register Pair HL and leaves the remainder, so that a TAB( past the end of the line wraps round rather than writing hundreds of blanks.
6301
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that remainder back into Register Pair DE where the blank writer takes it.
6302
POP HL E1
Pop Register Pair HL, the text pointer pushed at 62E6H.
6303
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
6306
DEFB 29H 29
The closing parenthesis of TAB( or SPC(, read as data by the routine the call at 6303H reaches, not executed; the instruction after that call is the one at 6307H. A decoder reading straight through shows it as ADD HL,HL.
6307
DEC HL 2B
Decrement Register Pair HL so that the text pointer stands on the character after the parenthesis for 6345H to read.
6308
POP AF F1
Pop Register Pair AF, the token pushed at 62D8H.
6309
SUB 0D5H D6 D5
Subtract 0D5H from Register A, the token of SPC(, so that the Zero Flag is set for SPC( and clear for TAB(.
630B
PUSH HL E5
Push Register Pair HL, the text pointer, which the POP HL at 6344H brings back.
630C
Jump to 632AH on Z, the token being SPC(, whose count of blanks is written from wherever the position stands with no test of where that is.
630E
LD BC,0007H 01 07 00
TAB( (630EH): load Register Pair BC with 0007H, the offset of the file control block's own column count.
6311
LD HL,(6E98H) 2A 98 6E
Load Register Pair HL from the word at 6E98H, FILEX, the control block of the file in hand less two.
6314
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, so that Register Pair HL addresses that column count.
6315
Call 45DFH, which sets the Zero Flag when there is no file in hand.
6318
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the file's own column count, which only the file path uses.
6319
Jump to 632AH on NZ, output going to a file, whose column count is the position TAB( measures from.
631B
LD A,(6E92H) 3A 92 6E
Load Register A from the byte at 6E92H, the printer flag.
631E
OR A B7
OR Register A with itself, which sets the Zero Flag when output is going to the display.
631F
Jump to 6327H on Z, the display's own position being the one to read.
6322
LD A,(6E91H) 3A 91 6E
Load Register A from the byte at 6E91H, the printer's print position.
6325
Jump to 632AH, the blank count, with the printer's position in Register A.
6327
LD A,(713CH) 3A 3C 71
Load Register A from the byte at 713CH, the display's print position.
632A
CPL 2F
The blank count (632AH): complement Register A, the position, which with the addition below gives the count of blanks between where the position stands and the column asked for.
632B
ADD A,E 83
Add Register E to Register A, the low byte of the argument, so that Register A holds that count less one.
632C
Jump to 6339H on C, the column asked for standing beyond the position, which is the ordinary case and writes the blanks.
632E
INC A 3C
Increment Register A, which sets the Zero Flag when the position already stands exactly at the column asked for.
632F
Jump to 6344H on Z, the position already being there, so that TAB( to the current column writes nothing.
6331
Call 41F5H, which writes a carriage return: the column asked for stands behind the position, so TAB( takes the output to the next line and counts the blanks from the left.
6334
LD A,E 7B
Load Register A from Register E, the low byte of the argument, which is the column counted from the left of the new line.
6335
DEC A 3D
Decrement Register A, the position on a fresh line being zero.
6336
Jump to 6344H on M, the column asked for being the first one, so that nothing is written after the carriage return.
6339
INC A 3C
The blank writer (6339H), which the comma field reaches from 62CEH: increment Register A, which turns the count less one into the count itself.
633A
LD B,A 47
Load Register B from Register A, the count of blanks to write.
633B
LD A,20H 3E 20
Load Register A with 20H, a blank, which is the one character this loop writes however many times Register B counts.
633D
Call 40D8H, which writes it to the file, the printer or the display as the flags stand.
6340
DEC B 05
Decrement Register B, the count of blanks still to write.
6341
Jump back to 633DH on NZ, which writes the whole run of blanks.
6344
POP HL E1
The next item (6344H), which the semicolon reaches from 623DH: pop Register Pair HL, the text pointer, which 6236H, 630BH or the field code left on the stack.
6345
Call NXTCHAR at 5E93H, which steps the text pointer past the separator or the parenthesis just dealt with.
6348
Jump to 6224H, which tests the Zero Flag NXTCHAR left: the statement ends there, and a PRINT that ends with a comma or a semicolon writes no carriage return, which is how a line is left open for the next PRINT.
634B
XOR A AF
The end of the statement (634BH), which OPEN reaches at 50D3H and READY through 4CD0H: clear Register A with XOR A, making 00H.
634C
LD (6E92H),A 32 92 6E
Store Register A into the byte at 6E92H, the printer flag, so that the next statement writes to the display again whatever LPRINT or LLIST set.
634F
LD (6E98H),A 32 98 6E
Store Register A into the byte at 6E98H, the low byte of FILEX, so that there is no file in hand.
6352
LD (6E99H),A 32 99 6E
Store Register A into the byte at 6E99H, its high byte, finishing the clear.
6355
RET C9
Return, which for a PRINT reached through 6224H goes to the statement loop at 5E3BH, and which OPEN's own push at 50D3H makes the instruction that undoes the file in hand the shared open set.

6356H - LINE: Take a Whole Typed Line into One String Variable (6356H-6382H)

LINE is the only statement of this BASIC whose keyword is never used alone: the statement address table holds 6357H for token 0B1H at 6823H, and the first thing the code does is insist that the token after it is INPUT, the byte at 635AH being 85H and read out of the line by 4353H. From there the two forms part at once. A number sign sends the statement to LINE INPUT# at 4B0BH, which reads its line out of a file; everything below is the keyboard form. It writes the prompt through the same routine INPUT uses, 63CDH, takes the variable with the search at 39FBH and insists through 2AB0H of BASIC/OV1 that it is a string one, reads a line with 7E1BH, and then collects the whole of what was typed as one string by entering the collector at 4652H with Register B holding 00H. That one byte is the whole of the difference between LINE INPUT and INPUT. The collector takes its two delimiters from Register D and Register B, 4652H copies Register B into Register D, and a delimiter of 00H can never match a character of the line because the 00H the line reader puts after what was typed is caught by the test at 4659H before the two comparisons are reached: so commas, quotation marks, colons and leading blanks are all part of the string, and because Register B is not 2CH the trailing blank strip at 466DH is skipped as well, so trailing blanks are kept too. The assignment is LET's own, the jump at 6380H reaching 60A0H with the type Register A names and the type the collector left in 7142H both 03H, so no conversion is ever made. The byte at 6356H is filler between the routine above and this one and no instruction reaches it.

6356
DEFB 00H 00
6356H: one byte of filler between the RET at 6355H that ends the routine above and LINE's own first instruction at 6357H. Nothing jumps to it, no word of any table holds its address, and the statement address table's entry for LINE at 6823H holds 6357H.
6357
LINE (6357H), the routine the statement address table holds for token 0B1H at 6823H: call 4353H, the character demand, which insists that the byte the text pointer stands on is the one written in the byte after this call and steps its own return address past that byte, so that LINE on its own gives Syntax error at 4362H.
635A
DEFB 85H 85
635AH: the token of INPUT, which is the byte the call at 6357H has 4353H compare the line's character with. It is data read by that routine and not an instruction, and the instruction after the call is the one at 635BH. This is why the manual gives the statement as LINE INPUT and why no other word may follow LINE.
635B
CP 23H FE 23
Compare Register A with 23H, the number sign, Register A holding the character after the INPUT token that 4353H brought back.
635D
Jump to 4B0BH on Z, LINE INPUT#, which takes a file number instead of a prompt and reads its line out of that file rather than the keyboard.
6360
Call 7E7FH, six bytes that compare Register A with 3BH and step the text pointer past it through 5E93H when it is a semicolon, and leave Register A as it stands when it is not: a semicolon written before LINE INPUT's prompt is swallowed here and recorded nowhere, exactly as INPUT's own is at 63C6H.
6363
Call 63CDH, INPUT's prompt, which clears the output suppression flag at 6E97H, sets the question mark flag at 72C6H, and when Register A holds a quotation mark collects the prompt string and writes it: unlike INPUT, which pushes 63F5H at 63CCH so that both of the prompt's exits land on the line reader, LINE calls it and takes both exits back here.
6366
Call 39FBH, the variable search, which reads the name the text pointer stands on, makes the variable when it is new, and returns the address of its value in Register Pair DE and in Register Pair BC with the type in the byte at 7142H.
6369
Call 2AB0H of BASIC/OV1, which insists that the type the search left in 7142H is 03H, a string, and gives Type mismatch through 5884H when it is not: LINE INPUT A is refused and only a string variable is taken.
636C
PUSH DE D5
Push Register Pair DE, the address of the variable's value, which the pop at 6372H brings back into Register Pair BC once the line has been read.
636D
PUSH HL E5
Push Register Pair HL, the program text pointer standing after the variable's name, which the pop at 6371H brings back into Register Pair DE.
636E
Call 7E1BH, the line reader, which reads a whole line into INBUF at 7039H with supervisor call 9, puts a 00H after what was typed, returns with Register Pair HL holding 7038H, the byte below the buffer, and sets the Carry Flag when BREAK was pressed.
6371
POP DE D1
Pop Register Pair DE, the program text pointer that 636DH pushed, Register Pair HL now holding 7038H and no longer the text pointer.
6372
POP BC C1
Pop Register Pair BC, the address of the variable's value that 636CH pushed.
6373
Jump to 4397H on C, the BREAK entry inside STOP's code, which puts 0FFH into Register A so that the tail at 43BBH writes Break and the line number: a BREAK at LINE INPUT's prompt leaves the variable holding what it held and ends the program.
6376
PUSH BC C5
Push Register Pair BC, the address of the variable's value, which is the word the exchange at 60A0H brings into Register Pair HL as the destination of the assignment.
6377
PUSH DE D5
Push Register Pair DE, the program text pointer, which the pop at 637DH takes back into Register Pair HL so that 60A0H has it to leave on the stack.
6378
LD B,00H 06 00
Load Register B with 00H, the delimiter the collector below is given, which is the byte that makes this LINE INPUT and not INPUT and which no character of the line can match.
637A
Call 4652H, which copies Register B into Register D and falls into the string collector at 4653H, so that the string runs from the byte after the one Register Pair HL addresses to the 00H the line reader wrote, and the collector leaves its descriptor in a temporary slot with the accumulator at 72ECH pointing at it and the type 03H in 7142H.
637D
POP HL E1
Pop Register Pair HL, the program text pointer that 6377H pushed, which leaves the address of the variable's value on the stack for 60A0H.
637E
LD A,03H 3E 03
Load Register A with 03H, the string type, which 60A1H takes into Register B and 60A2H compares with the 03H the collector left in 7142H: the two always match, so the conversion at 78DDH is never called for a LINE INPUT.
6380
Jump to 60A0H, the assignment inside LET, which exchanges Register Pair HL with the word the Stack Pointer addresses to bring the destination's address back and then copies the string descriptor into it.

6383H - The Redo From Start Text (6383H-6394H)

The text INPUT shows when what was typed cannot be read as the kind of value the statement asked for. It stands in the middle of the INPUT code, between the jump at 6380H and the test at 6395H, which is why the bytes are data and not instructions.

6383-6394
DEFM "?Redo from start" / DEFB 0DH, 00H 3F 52 65 64 6F 20 66 72 6F 6D 20 73 74 61 72 74 0D 00
6383H-6394H: the question mark, the words Redo from start, the 0DH that ends the line and the 00H that ends the text. The question mark is part of the stored text, not something the display routine adds, so INPUT's prompt and this message both begin with one.

6395H - INPUT: the Retry, the Extra Ignored Path and INPUT# (6395H-63C1H)

INPUT is the longest of module 1's statements and the only one that reads its own text twice over. It writes the prompt, takes a line at the keyboard, and then walks the variable list and the typed line together without assigning anything, collecting each reply so that the number conversion can complain about it; only when every item has been taken does it go round a second time, at 64A2H, and put the values in the variables. That is why a bad reply gives ?Redo from start with every variable still holding what it held, and it is the whole reason the item collector at 64BFH has an entry that throws its value away. The three routines gathered here are the ends of that work: the scan at 6395H, which runs to the end of a quoted reply; the two retry entries at 63A2H and 63A6H, which part INPUT from READ; and INPUT# at 63B8H, which has no prompt and no pre-scan at all and joins the assignment loop directly.

6395
INC HL 23
Step Register Pair HL on to the next character of the typed line, this scan running to the end of a reply that opened with a quotation mark.
6396
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that character of the typed line.
6397
OR A B7
OR Register A with itself, which sets the Zero Flag when the byte is the 00H the line reader put after what was typed.
6398
Jump to 586CH on Z, the Syntax error entry of the ordinary chain: a quotation mark was opened in the reply and the line ended before another closed it.
639B
CP 22H FE 22
Compare Register A with 22H, the quotation mark that closes the reply.
639D
Jump back to 6395H on NZ, which takes the character after this one.
639F
Jump to 6433H, the bracket scan of the variable list, the closing quotation mark having been found and the reply being complete.
63A2
POP HL E1
The Redo From Start entry (63A2H), which 6460H and 6479H jump to: pop Register Pair HL, one of the two copies of 7038H that 6417H and 6418H put on the stack, and throw it away.
63A3
POP HL E1
Pop Register Pair HL, the other copy of 7038H, which leaves the program text pointer that 6416H pushed on top of the stack.
63A4
Jump to 63ADH, which writes the message and sets the statement up to run again.
63A6
LD A,(7183H) 3A 83 71
The entry READ uses (63A6H), which 6511H jumps to: load Register A with the byte at 7183H, which holds 00H for INPUT and a value with bit 7 set for READ.
63A9
OR A B7
OR Register A with itself, which sets the Zero Flag for INPUT and leaves it clear for READ.
63AA
Jump to 5866H on NZ, the error entry that takes its line number from the word at 7180H: 653DH fills that word in with the number of the DATA statement READ is taking items from, so a DATA item that will not parse names the DATA line and not the line the READ stands on.
63AD
POP BC C1
Pop Register Pair BC, the program text pointer 6416H pushed, which the two pointers above were stacked on top of and which the load at 63B4H replaces.
63AE
LD HL,6383H 21 83 63
Load Register Pair HL with 6383H, the text ?Redo from start, which stands in the middle of this code between the jump at 6380H and the test at 6395H.
63B1
Call 46A5H, which writes the characters Register Pair HL addresses until it meets the 00H at 6394H that ends them.
63B4
LD HL,(718CH) 2A 8C 71
Load Register Pair HL from the word at 718CH, SAVTXT, the text pointer the statement loop saved before this statement: the return below therefore hands the dispatcher the INPUT statement over again, which is how the whole statement is run a second time rather than the reply being asked for again.
63B7
RET C9
Return to the statement loop with Register Pair HL at the INPUT statement itself.
63B8
INPUT# (63B8H), which 63C4H jumps to when the character after the token is a number sign: call 4A7FH, which reads the file number and the comma after it and stores the file in hand into the word at 6E98H.
63BB
PUSH HL E5
Push Register Pair HL, the program text pointer, which the assignment loop expects to find under the pointer it is given.
63BC
LD HL,7038H 21 38 70
Load Register Pair HL with 7038H, the byte below INBUF at 7039H, which is where the file's own line will be read.
63BF
Jump to 6499H, which puts the leading comma at 7038H and enters the assignment loop at 64A2H: a file is never prompted for, never pre scanned and never given ?Redo from start, so its data raises a real error when it will not parse.

63C2H - INPUT: the Entry, the Prompt and the Question Mark (63C2H-6418H)

The statement address table holds 63C2H for token 85H at 67CBH, so Register Pair HL stands on the first character after the token and Register A holds it. Three things are settled before a key is touched: whether this is INPUT or INPUT#, whether there is a prompt string and how it was ended, and whether the automatic question mark is wanted. The manual puts the last of those exactly as the bytes have it: the prompt may be ended with a semicolon or a comma, and a comma suppresses the question mark. The routine at 63CDH is called as a subroutine of itself, 63C9H pushing 63F5H so that both its exits land on the line reader, and the prompt is written through 46A8H out of the same string accumulator every other statement uses.

63C2
CP 23H FE 23
INPUT (63C2H), the routine the statement address table holds for token 85H at 67CBH: compare Register A with 23H, the number sign that makes this a read from a file.
63C4
Jump back to 63B8H on Z, INPUT#, which takes the file number and joins the assignment loop with no prompt of any kind.
63C6
Call 7E7FH, six bytes that compare Register A with 3BH and step the text pointer past it through 5E93H when it is a semicolon, and return with Register A untouched when it is not. The manual's syntax for INPUT has no semicolon before the prompt and nothing here records one, so INPUT ;"Name";N$ is taken and behaves exactly as the same line without it.
63C9
LD BC,63F5H 01 F5 63
Load Register Pair BC with 63F5H, the line reader below, which is the address the prompt code returns through whichever of its two exits it takes.
63CC
PUSH BC C5
Push Register Pair BC, which puts 63F5H on the stack as the return address of the routine the next instruction begins.
63CD
CP 22H FE 22
The prompt (63CDH), which LINE INPUT calls at 6363H: compare Register A with 22H, the quotation mark that opens a prompt string.
63CF
LD A,00H 3E 00
Load Register A with 00H, the value that turns the suppression of output off.
63D1
LD (6E97H),A 32 97 6E
Store Register A into the byte at 6E97H, the flag that suppresses output, so that nothing can swallow the prompt and the question mark about to be written.
63D4
LD A,0FFH 3E FF
Load Register A with 0FFH, the value that asks for the question mark.
63D6
LD (72C6H),A 32 C6 72
Store Register A into the byte at 72C6H, the flag the line reader reads at 63F6H to decide whether to write the question mark and the space after it.
63D9
RET NZ C0
Return NZ to 63F5H, there being no quotation mark and so no prompt string, with the question mark asked for.
63DA
Call 4650H, which sets Register B and Register D both to 22H and falls into the string collector at 4653H, so that the prompt runs from the quotation mark to the next one and becomes the accumulator's string.
63DD
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character that follows the closing quotation mark.
63DE
CP 2CH FE 2C
Compare Register A with 2CH, the comma the manual gives as the second way of ending a prompt.
63E0
Jump to 63EBH on NZ, which demands the semicolon instead.
63E2
XOR A AF
Clear Register A with XOR A, making the 00H that says no question mark is to be written.
63E3
LD (72C6H),A 32 C6 72
Store Register A into the byte at 72C6H, which is how a comma after the prompt suppresses the question mark, as the manual says it does.
63E6
Call 5E93H, which steps the text pointer past that comma and returns the next character that matters in Register A.
63E9
Jump to 63EFH, the comma having been taken, which writes the prompt out.
63EB
Call 4353H, the character demand, which insists that the text pointer stands on the character held in the byte after the call and steps its own return address past that byte.
63EE
DEFB 3BH 3B
63EEH: the semicolon 4353H above demands, which is the only other way the manual allows a prompt to be ended. A decoder reads this byte as DEC SP, the byte after a CALL 4353H being data throughout this file.
63EF
PUSH HL E5
Push Register Pair HL, the program text pointer, which the write below has no use for and must have back.
63F0
Call 46A8H, which takes the string out of the accumulator at 72ECH and writes it a character at a time through 40D8H, to the file when the word at 6E98H is set and to the display when it is not.
63F3
POP HL E1
Pop Register Pair HL, the program text pointer, back off the stack.
63F4
RET C9
Return to 63F5H, which 63CCH put on the stack, the prompt having been written.
63F5
PUSH HL E5
The line reader (63F5H), which both exits of the prompt above reach: push Register Pair HL, the program text pointer, which the read below writes over.
63F6
LD A,(72C6H) 3A C6 72
Load Register A with the byte at 72C6H, the flag 63D6H set to 0FFH and 63E3H clears when the prompt was ended with a comma.
63F9
OR A B7
OR Register A with itself, which sets the Zero Flag when no question mark is wanted.
63FA
Jump to 6406H on Z, which reads the line without writing anything at all.
63FC
LD A,3FH 3E 3F
Load Register A with 3FH, the question mark, which is written only because 72C6H was left holding 0FFH by 63D6H.
63FE
Call 40D8H, the character output routine of module 1, which writes it.
6401
LD A,20H 3E 20
Load Register A with 20H, the space that follows the question mark.
6403
Call 40D8H, which writes that space. These four instructions are the same four that stand at 7E11H to 7E1AH immediately above the line reader, written out again here because the test at 63F9H has to come between them and the read.
6406
Call 7E1BH, the line reader past the question mark it writes for itself, which reads a whole line into INBUF at 7039H, puts a 00H after it and returns with Register Pair HL holding 7038H, the byte below the buffer, and with the Carry Flag set when BREAK was pressed.
6409
POP BC C1
Pop Register Pair BC, the program text pointer pushed at 63F5H, which the read above wrote over.
640A
Jump to 4397H on C, BREAK having been pressed: 4397H is the operand of the LD HL,0FFF6H at 4396H and executes as OR 0FFH, which puts 0FFH in Register A and leaves the Zero Flag clear so that STOP's own tail writes Break at 43BBH rather than ending quietly at 43BEH.
640D
PUSH BC C5
Push Register Pair BC, the program text pointer, back on to the stack.
640E
XOR A AF
Clear Register A with XOR A, making the 00H that marks this statement an INPUT and not a READ.
640F
LD (7183H),A 32 83 71
Store Register A into the byte at 7183H, which the item collector reads at 64B7H and at 64D8H and the retry entry at 63A6H reads to tell the two statements apart.
6412
LD (HL),2CH 36 2C
Store 2CH into the byte Register Pair HL addresses, which is 7038H, the byte below INBUF: the typed line is therefore read as though a comma stood in front of it, so that the collector's demand for a comma before every item is met by the first item as well.
6414
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts 7038H into Register Pair DE.
6415
POP HL E1
Pop Register Pair HL, the program text pointer, which stands on the first character of the variable list.
6416
PUSH HL E5
Push Register Pair HL, that same program text pointer, which every exit of the pre scan takes back.
6417
PUSH DE D5
Push Register Pair DE, 7038H, the copy the pre scan swaps in and out with EX (SP),HL.
6418
PUSH DE D5
Push Register Pair DE, 7038H again, the second copy, which is the one the scan of the typed line moves along while the first stays where it is.

6419H - INPUT: the Pre Scan of the Variable List and the Typed Line (6419H-649CH)

This is the loop that reads everything twice. For each name in the variable list it calls the search with the flag at 7182H holding 80H, which refuses an array, and through 3AE8H, which makes the search answer Register Pair DE of 0000H without making the variable: the name is parsed and the text pointer moved on, and nothing is created and nothing is assigned. A subscript list is stepped over by counting brackets at 6432H to 644FH rather than evaluated. Then the typed line is made to give up one item through the collector at 64BFH, with the flag at 6EA7H set so that the number conversion writes Overflow as a message and counts the complaint in 72F1H instead of raising error 6, and with 72F2H holding 01H so that a string item, which never reaches the conversion at all, still passes the test at 6478H. When the two lists end together, 6499H puts the leading comma back and the whole statement is done again at 64A2H, this time with destinations.

6419
DEC HL 2B
Decrement Register Pair HL, the program text pointer, so that the increment 5E93H begins with lands on the first character of the name.
641A
LD A,80H 3E 80
Load Register A with 80H, the value that makes the variable search refuse an array.
641C
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H, the flag the search reads at 3A7AH, which sends a value of 02H to 80H to the simple variable walk at 3A8FH whatever follows the name on the line: CALL at 535FH writes the same 80H for the same reason.
641F
Call 5E93H, which steps the text pointer on to the first character that matters and returns it in Register A.
6422
Call 3AE8H, the look up only wrapper of the variable search, which leaves 3AEBH on the stack so that 3AF4H answers Register Pair DE of 0000H without making the variable: the name is read off the line and nothing else happens, this pass existing only to find where each name ends.
6425
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the name ended on.
6426
DEC HL 2B
Decrement Register Pair HL, which puts the text pointer back on that character.
6427
CP 5BH FE 5B
Compare Register A with 5BH, the opening square bracket, which BASIC takes for a parenthesis throughout.
6429
Jump to 642FH on Z, the name being subscripted, which counts the brackets off instead of reading the list.
642B
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis.
642D
Jump to 6452H on NZ, the name standing on its own, which goes straight to the comma test.
642F
INC HL 23
Step Register Pair HL on to the character after that bracket.
6430
LD B,00H 06 00
Load Register B with 00H, the count of brackets still open, which the increment below raises to one for the bracket just found.
6432
INC B 04
The bracket counter (6432H), which 6440H jumps back to for every further opening bracket: increment Register B, one more bracket being open.
6433
The bracket scan (6433H), which 639FH and three jumps below reach: call 5E93H, which steps the text pointer on and returns the next character that matters in Register A, with the Zero Flag set when the statement has ended.
6436
Jump to 586CH on Z, the Syntax error entry: the statement ended with a bracket still open.
6439
CP 22H FE 22
Compare Register A with 22H, a quotation mark inside the subscript list.
643B
Jump to 6395H on Z, the scan that runs to the closing quotation mark, so that a bracket inside a quoted string is not counted.
643E
CP 28H FE 28
Compare Register A with 28H, a further opening parenthesis.
6440
Jump back to 6432H on Z, which counts it as one more bracket open.
6442
CP 5BH FE 5B
Compare Register A with 5BH, a further opening square bracket, which the jump below does not count where the parenthesis two instructions above it is counted: this is B343.
6444
Jump back to 6433H on Z, which takes the next character without counting it: this is the jump of B343, and it wants 6432H as the one at 6440H has, an opening square bracket inside a list being stepped over and never counted where an opening parenthesis is, so INPUT A([1]) ends its list at the first closing bracket.
6446
CP 5DH FE 5D
Compare Register A with 5DH, the closing square bracket.
6448
Jump to 644EH on Z, which takes one off the count.
644A
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis.
644C
Jump back to 6433H on NZ, the character being none of the five that matter, which takes the next one.
644E
DEC B 05
Decrement Register B, one of the open brackets having been closed.
644F
Jump back to 6433H on NZ, brackets still being open, which goes on scanning.
6452
Call 5E93H, which returns the character after the name or its subscript list in Register A, with the Zero Flag set when the statement has ended.
6455
Jump to 645CH on Z, the variable list having ended, which takes the item for the last name.
6457
CP 2CH FE 2C
Compare Register A with 2CH, the comma that separates one name from the next.
6459
Jump to 586CH on NZ, the Syntax error entry, the only two things allowed after a name being a comma and the end of the statement.
645C
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the program text pointer on the stack and brings the pointer into the typed line into Register Pair HL.
645D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which for the first item is the comma 6412H stored at 7038H.
645E
CP 2CH FE 2C
Compare Register A with 2CH, the comma every item must be preceded by.
6460
Jump to 63A2H on NZ, ?Redo from start: the variable list asked for another value and the typed line has no comma left, so fewer items were typed than were asked for.
6463
LD A,01H 3E 01
Load Register A with 01H, which both cells below are set to.
6465
LD (72F2H),A 32 F2 72
Store Register A into the byte at 72F2H, the cell 67B4H hands the conversion's complaint count over in. A string item never reaches the conversion and never reaches 67B4H, so this 01H is what makes the test at 6478H pass for one.
6468
LD (6EA7H),A 32 A7 6E
Store Register A into the byte at 6EA7H, the flag the number conversion reads at 75DFH and at 75F9H: with it set, a value that will not convert writes Overflow from 6BD1H and counts itself in 72F1H at 75F4H instead of reaching error 6 at 587EH or the Syntax error at 586CH.
646B
Call 64BFH, the operand of the OR 0AFH at 64BEH, which executes as XOR A and so clears 7299H: the item is taken off the typed line and converted and then thrown away, 64EFH returning before the value is put anywhere.
646E
LD A,(6EA7H) 3A A7 6E
Load Register A with the byte at 6EA7H, which the call above left as this instruction's own 01H or as whatever the conversion made of it.
6471
DEC A 3D
Decrement Register A, which takes that 01H back to 00H.
6472
LD (6EA7H),A 32 A7 6E
Store Register A into the byte at 6EA7H, which puts the number conversion back to raising its errors in the ordinary way for every expression the rest of the program works out.
6475
LD A,(72F2H) 3A F2 72
Load Register A with the byte at 72F2H, which holds the 01H of 6465H when nothing complained and the count 67B4H copied out of 72F1H when something did.
6478
DEC A 3D
Decrement Register A, which leaves the Zero Flag set only for the 01H that means the item was taken without a complaint.
6479
Jump to 63A2H on NZ, ?Redo from start: the conversion counted at least one bad character or one overflow, and because this pass assigns nothing every variable the statement names still holds what it held.
647C
PUSH HL E5
Push Register Pair HL, the pointer into the typed line, which the call below writes over.
647D
Call 76A4H, which loads Register A from 7142H, the type of the value in hand, takes 03H off it and sets the Zero Flag for the 03H of a string.
6480
Call 481DH on Z, which raises the high pointer of the string area at 7178H and so gives the temporary descriptor this item built straight back, nothing being kept from this pass.
6483
POP HL E1
Pop Register Pair HL, the pointer into the typed line, back off the stack.
6484
DEC HL 2B
Decrement Register Pair HL, so that the increment 5E93H begins with lands on the character the item ended on.
6485
Call 5E93H, which steps along the typed line and returns the character that ended the item in Register A.
6488
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the typed line pointer back on the stack and brings the program text pointer into Register Pair HL.
6489
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character that ended the name in the variable list.
648A
CP 2CH FE 2C
Compare Register A with 2CH, the comma that says another name follows.
648C
Jump back to 641AH on Z, which takes the next name and the next item.
648F
POP HL E1
Pop Register Pair HL, the typed line pointer, the variable list having ended.
6490
DEC HL 2B
Decrement Register Pair HL, so that the increment 5E93H begins with lands on the character after the last item.
6491
Call 5E93H, which returns the first character of the typed line that is left over in Register A, with the Zero Flag set when there is none.
6494
OR A B7
OR Register A with itself, which sets the Zero Flag when the typed line ended exactly where the variable list did.
6495
POP HL E1
Pop Register Pair HL, the program text pointer 6416H pushed, which the second pass needs.
6496
Jump to 63ADH on NZ: more items were typed than were asked for, and the message written there is ?Redo from start and not an extra ignored warning, so the whole statement is asked again.
6499
LD (HL),2CH 36 2C
The join (6499H), which INPUT# jumps to at 63BFH: store 2CH into the byte Register Pair HL addresses, which for INPUT# is 7038H and for a keyboard INPUT is the same byte with the same comma put back, 6485H and 6491H having moved nothing but a pointer.
649B
Jump to 64A2H, the operand of the OR 0AFH at 64A1H, which executes as XOR A and so marks the statement an INPUT for the assignment loop it shares with READ.

649DH - READ, and the Assignment Loop INPUT Shares With It (649DH-654AH)

READ and INPUT are one routine with two entries, and the whole of the difference between them is the byte at 7183H and where the items come from. The two entries are the two bytes of one instruction: OR 0AFH at 64A1H puts a value with bit 7 set into Register A for READ, and its operand byte at 64A2H executes as XOR A and clears Register A for INPUT, and the store at 64A3H writes whichever of the two into 7183H. The same trick is used again fourteen bytes further on, where OR 0AFH at 64BEH sets 7299H and its operand at 64BFH clears it, which is the switch between taking an item to assign and taking one to throw away. Two pointers are carried, one in Register Pair HL and one on the stack, and EX (SP),HL turns the routine from the program text to the data and back. The DATA hunt at 652AH is READ's alone, and it is the one place in the file that writes the word at 7180H.

649D
PUSH HL E5
READ (649DH), the routine the statement address table holds for token 87H at 67CFH: push Register Pair HL, the program text pointer, which the load below writes over.
649E
LD HL,(71A5H) 2A A5 71
Load Register Pair HL from the word at 71A5H, the DATA pointer, which RESTORE sets to the start of the program at 437AH and which 653DH and this statement are the only things that move.
64A1
OR 0AFH F6 AF
OR Register A with 0AFH, which leaves Register A holding 0AFH or more whatever it held and so cannot leave it 00H, which is the value that would mark the statement an INPUT.
64A3
LD (7183H),A 32 83 71
Store Register A into the byte at 7183H, the byte that tells the two statements apart: the OR 0AFH above leaves it with bit 7 set for READ and the entry at 64A2H, which is that instruction's operand byte and executes as XOR A, leaves it 00H for INPUT and for INPUT#. The same byte serves a second and unrelated purpose for the PRINT USING family, which writes it at 4046H and reads it at 3F28H.
64A6
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the data pointer on the stack and brings the program text pointer into Register Pair HL.
64A7
Jump to 64ADH, the variable search, past the comma demand the second and later items go through.
64A9
The next item (64A9H), which 6519H jumps back to: call 4353H, the character demand, which insists that the text pointer stands on the character held in the byte after the call and steps its own return address past that byte.
64AC
DEFB 2CH 2C
64ACH: the comma 4353H above demands, which is what separates one variable of the list from the next. A decoder reads this byte as INC L.
64AD
The variable search (64ADH), which 64A7H jumps to for the first item: call 39FBH, the search, which finds the variable the text pointer names or makes it and answers with the address of its value in Register Pair DE. The flag at 7182H is not written here, so a subscripted name is read as an array and the element's own address is what comes back.
64B0
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the program text pointer on the stack and brings the data pointer into Register Pair HL.
64B1
PUSH DE D5
Push Register Pair DE, the address of the variable's value, which the collection below writes over and which 64F6H pushes again for the assignment.
64B2
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the data stands on.
64B3
CP 2CH FE 2C
Compare Register A with 2CH, the comma that separates one item from the next.
64B5
Jump to 64BEH on Z, there being an item to take.
64B7
LD A,(7183H) 3A 83 71
Load Register A with the byte at 7183H, which holds 00H for INPUT and a value with bit 7 set for READ.
64BA
OR A B7
OR Register A with itself, which sets the Zero Flag for INPUT.
64BB
Jump to 652AH on NZ, the DATA hunt: READ has run out of items in the statement it was reading and goes looking for the next DATA statement in the program.
64BE
OR 0AFH F6 AF
OR Register A with 0AFH, which leaves Register A holding 0AFH or more and so cannot leave it 00H, this being the value that says the item is to be assigned.
64C0
LD (7299H),A 32 99 72
Store Register A into the byte at 7299H, which the test at 64EBH reads: the OR 0AFH above leaves it set, so that the item is put in the variable, and the entry at 64BFH, which is that instruction's operand byte and executes as XOR A, leaves it 00H, so that the item is taken and the routine returns without assigning anything. That entry is called from one place only, 646BH, which is INPUT's pre scan.
64C3
Call 45DFH, the test for a file being in hand, which returns with the Zero Flag set when the word at 6E98H holds 0000H and the data is coming from the program or the keyboard.
64C6
Jump to 4AFDH on NZ, the file collector, which calls 76A4H for itself, sets its two delimiters to 2CH and 20H for a number or 2CH and 2CH for a string and puts 64E7H on the stack as its own return address, so that a file's item comes back to the same place this one does.
64C9
Call 76A4H, which loads Register A from 7142H, the type of the value in hand, takes 03H off it, and sets the Zero Flag for the 03H of a string and the Carry Flag for every type below 08H.
64CC
PUSH AF F5
Push Register Pair AF, the lowered type and both of those flags, which 64E7H and 64FDH take back.
64CD
Jump to 64FAH on NZ, the numeric path, the type not being that of a string.
64CF
Call 5E93H, which steps the data pointer on to the first character of the item that matters and returns it in Register A.
64D2
LD D,A 57
Load Register D with Register A, that first character, which is the delimiter the collector stops at when the item is quoted.
64D3
LD B,A 47
Load Register B with Register A, the same character, which is its second delimiter.
64D4
CP 22H FE 22
Compare Register A with 22H, the quotation mark that opens a quoted string.
64D6
Jump to 64E4H on Z, the item being quoted, with both delimiters holding the quotation mark so that the string runs to the next one.
64D8
LD A,(7183H) 3A 83 71
Load Register A with the byte at 7183H, which holds 00H for INPUT and a value with bit 7 set for READ.
64DB
OR A B7
OR Register A with itself, which sets the Zero Flag for INPUT.
64DC
LD D,A 57
Load Register D with Register A, which for INPUT is the 00H that the collector stops at in any case, its own test at 4659H being for that byte.
64DD
Jump to 64E1H on Z, INPUT needing no second delimiter of its own.
64DF
LD D,3AH 16 3A
Load Register D with 3AH, the colon, which is READ's second delimiter: a colon ends a statement, so an unquoted DATA item runs to the next comma or to the end of the DATA statement and no further.
64E1
LD B,2CH 06 2C
Load Register B with 2CH, the comma, which is the delimiter both statements share and which is what the manual means by a string being read until a comma or an ENTER.
64E3
DEC HL 2B
Decrement Register Pair HL, so that the increment the collector begins with lands on the first character of the item.
64E4
Call 4653H, which counts the characters up to either delimiter or to a 00H, builds a three byte descriptor for them at 7175H through 4644H and makes it the accumulator's string.
64E7
POP AF F1
The join from the file collector (64E7H), which 4B00H and 4B18H put on the stack: pop Register Pair AF, the type 64CCH lowered by three and the flags that went with it.
64E8
ADD A,03H C6 03
Add 03H to Register A, which puts the plain type back: this is the inverse of the SUB 03H inside 76A4H, and the same three is added back at 6088H, LET's second entry, for callers that reach the assignment through 4B19H instead.
64EA
LD C,A 4F
Load Register C with Register A, the type of the item, which 64F0H gives the assignment.
64EB
LD A,(7299H) 3A 99 72
Load Register A with the byte at 7299H, which 64BEH set and the entry at 64BFH cleared.
64EE
OR A B7
OR Register A with itself, which sets the Zero Flag when nothing is to be assigned.
64EF
RET Z C8
Return Z to INPUT's pre scan at 646EH, the item having been taken and converted and nothing being wanted of it.
64F0
LD A,C 79
Load Register A from Register C, the type of the item, which the assignment compares the destination against.
64F1
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the data pointer into Register Pair DE.
64F2
LD HL,6509H 21 09 65
Load Register Pair HL with 6509H, the continuation below, which the exchange with the stack makes this routine's return address.
64F5
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts 6509H on the stack and brings the address of the variable's value, pushed at 64B1H, into Register Pair HL.
64F6
PUSH DE D5
Push Register Pair DE, the data pointer, which the assignment leaves alone and 6509H takes back.
64F7
Jump to 60A1H, LET's own assignment, with the type in Register A and the destination's address in Register Pair HL: the value is converted to that type through 78DDH when the two differ and then moved into the variable.
64FA
The numeric path (64FAH), which 64CDH jumps to: call 5E93H, which steps the data pointer on to the first character of the number and returns it in Register A.
64FD
POP AF F1
Pop Register Pair AF, the lowered type and the flags 64CCH pushed, the Carry Flag among them.
64FE
PUSH AF F5
Push Register Pair AF, the same word again, which 64E7H takes off when the conversion has finished.
64FF
LD BC,64E7H 01 E7 64
Load Register Pair BC with 64E7H, the join above.
6502
PUSH BC C5
Push Register Pair BC, which makes 64E7H the return address of the conversion in BASIC/OV1.
6503
Jump to 2F16H in BASIC/OV1 on C, the type being 02H, 03H or 04H: 2F16H is the operand byte of an OR 0AFH at 2F15H there and executes as XOR A, so the overlay is entered with Register A holding 00H and with the two calls at 2F0FH and 2F12H skipped.
6506
Jump to 2F0FH in BASIC/OV1, the type being 08H, double precision: the full entry runs its two calls and then the OR 0AFH at 2F15H, so the overlay is entered with Register A not 00H. Either way 2F22H puts 01H into 72F1H before a digit is read, and 75F4H raises it once for every character the conversion will not take.
6509
DEC HL 2B
The continuation (6509H), which 64F2H makes the assignment's return address: decrement Register Pair HL, so that the increment 5E93H begins with lands on the character the item ended on.
650A
Call 5E93H, which returns the character after the item in Register A, with the Zero Flag set when the data has ended.
650D
Jump to 6514H on Z, the data having ended, which asks whether the variable list has ended as well.
650F
CP 2CH FE 2C
Compare Register A with 2CH, the comma that would separate this item from another.
6511
Jump to 63A6H on NZ, which gives ?Redo from start for an INPUT and, for a READ, the error entry at 5866H that names the DATA statement's own line out of the word at 7180H.
6514
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the data pointer on the stack and brings the program text pointer into Register Pair HL.
6515
DEC HL 2B
Decrement Register Pair HL, so that the increment 5E93H begins with lands on the character after the name just filled in.
6516
Call 5E93H, which returns that character in Register A, with the Zero Flag set when the statement has ended.
6519
Jump back to 64A9H on NZ, which demands the comma and takes the next variable of the list.
651C
POP DE D1
Pop Register Pair DE, the data pointer, the variable list having ended.
651D
LD A,(7183H) 3A 83 71
Load Register A with the byte at 7183H, which holds 00H for INPUT and a value with bit 7 set for READ.
6520
OR A B7
OR Register A with itself, which sets the Zero Flag for INPUT.
6521
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the data pointer into Register Pair HL and the program text pointer into Register Pair DE.
6522
Jump to 437AH on NZ, which stores Register Pair HL into the word at 71A5H and so leaves the DATA pointer where this READ stopped, ready for the next one, and then returns to the statement loop.
6525
PUSH DE D5
Push Register Pair DE, the program text pointer, this being an INPUT, whose typed line is finished with and needs no pointer kept.
6526
POP HL E1
Pop Register Pair HL, that same program text pointer, which is the two instruction way of moving Register Pair DE into Register Pair HL that this file uses throughout.
6527
Jump to 634BH, the end of the statement, which returns to the statement loop with the text pointer standing after the INPUT.
652A
The DATA hunt (652AH), which 64BBH jumps to and which is READ's alone: call 6065H, DATA and COMMON, which steps the pointer over the rest of the text of this statement and stops on the colon or the 00H that ends it, with Register A holding that byte.
652D
OR A B7
OR Register A with itself, which sets the Zero Flag when the byte is the 00H that ends the whole line.
652E
Jump to 6541H on NZ, there being another statement on this same line to look at.
6530
INC HL 23
Step Register Pair HL on to the first byte of the next line's header, which is the low half of the link to the line after it.
6531
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that low half.
6532
INC HL 23
Step Register Pair HL on to the high half of that link.
6533
OR (HL) B6
OR the byte Register Pair HL addresses into Register A, so that the Zero Flag is set only when both halves are 00H, which is how the end of the program is marked.
6534
LD E,04H 1E 04
Load Register E with 04H, the number of the text Out of DATA, which stands at 6BAFH in the block at 6B7CH.
6536
Jump to 5886H on Z, the error handler, there being no further line and so no further DATA statement anywhere in the program.
6539
INC HL 23
Step Register Pair HL on to the low half of the line's own number.
653A
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, that low half.
653B
INC HL 23
Step Register Pair HL on to the high half of the line's number.
653C
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, that high half.
653D
LD (7180H),DE ED 53 80 71
Store Register Pair DE into the word at 7180H, the only instruction in the loaded image that writes it: it holds the number of the line READ is taking items from, and 5866H reads it so that an item that will not parse names the DATA statement's own line rather than the line the READ stands on.
6541
Call 5E93H, which steps on to the first character that matters of the statement now reached and returns it in Register A.
6544
CP 84H FE 84
Compare Register A with 84H, the token the reserved word table gives DATA, which the statement address table holds 6065H for at 67C9H.
6546
Jump back to 652AH on NZ, this statement not being a DATA one, which steps over it and goes on looking.
6548
Jump to 64BEH, which sets 7299H and takes the first item of the DATA statement just found.

654BH - PEEK and POKE, and the Address Converter They Share (654BH-658DH)

PEEK and POKE are four and six instructions, and almost all of their work is in the two routines below them. 6566H works an expression out and turns it into an address, and 6570H is the conversion itself, which is the part worth reading: a Z80 address runs from 0 to 65535 but BASIC's own integers are signed and stop at 32767, so an address of 32768 or more has to arrive as a single precision number. 6570H pushes CINT at 29F4H as its own tail, lets an integer through untouched, and for a single precision value whose exponent byte at 72EFH is 90H and whose sign is positive adds the constant -65536 to it through 2622H before CINT is reached, which brings 32768 to 65535 down into the signed range as -32768 to -1 and leaves the bits of the address unchanged. So PEEK(49152) and PEEK(-16384) name the same byte, which is what a Model 4 program reading the video memory at 0F800H needs. Both statements also call 57DFH, the guard that refuses a protected program: it returns at once while a program is running and gives Illegal function call for a PEEK or a POKE typed at the keyboard against a program loaded with protection, so that nobody can read a protected program out of memory a byte at a time.

654B
PEEK (654BH), the routine the function table at 685DH holds for token 17H at 6889H: call 6570H, which turns the value in the accumulator into a sixteen bit address in Register Pair HL.
654E
Call 57DFH, which returns at once while a program is running and, when the line number at 6E9CH is 0FFFFH and so the function was typed at the keyboard, gives Illegal function call for a protected program.
6551
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, which is the whole of what the function does: any address of the machine may be read.
6552
Jump to 770CH, which makes that byte the accumulator's value as an integer and returns to the expression evaluator with it as the function's answer.
6555
POKE (6555H), the routine the statement address table holds for token 098H at 67E7H: call 6566H, which works the address out and leaves it in Register Pair DE.
6558
PUSH DE D5
Push Register Pair DE, the address, which the POP DE at 6563H brings back once the byte has been read.
6559
Call 57DFH, the protected program guard, which refuses a POKE typed at the keyboard against a protected program for the same reason PEEK is refused.
655C
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
655F
DEFB 2CH 2C
The comma between the address and the byte, read as data by the routine the call at 655CH reaches, not executed; the instruction after that call is the one at 6560H.
6560
Call 799FH, which works the byte out into Register A and gives Illegal function call for anything above 255.
6563
POP DE D1
Pop Register Pair DE, the address pushed at 6558H.
6564
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, which is the whole of the statement: no address is refused and nothing of the interpreter's own memory is protected from it.
6565
RET C9
Return to the statement loop at 5E3BH, the byte written and nothing of the statement's work left.
6566
The address and value reader (6566H), which POKE, OUT and the expression code's own 792CH all call: call the expression evaluator at 7345H, which leaves the value in the accumulator at 72ECH.
6569
PUSH HL E5
Push Register Pair HL, the text pointer standing after the expression, which the POP HL at 656EH brings back.
656A
Call 6570H, the conversion below, which leaves the address in Register Pair HL.
656D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address into Register Pair DE where the callers expect it.
656E
POP HL E1
Pop Register Pair HL, the text pointer pushed at 6569H.
656F
RET C9
Return to the caller with the address in Register Pair DE and the text pointer in Register Pair HL.
6570
LD BC,29F4H 01 F4 29
The address conversion (6570H), which CALL's 536DH also uses for an entry address: load Register Pair BC with 29F4H, the address of CINT in the overlay, which turns the accumulator into a two byte integer in Register Pair HL.
6573
PUSH BC C5
Push Register Pair BC, which makes CINT this routine's own tail: every path below ends by reaching it, so the answer is always a sixteen bit value in Register Pair HL.
6574
Call 76A4H, which reads the type of the value in hand from 7142H and returns it in Register A less 03H, so that the sign flag is set for an integer and clear for a single or double precision number.
6577
RET M F8
Return on M, the value already being an integer, which goes to the CINT pushed above and needs no adjustment: an address written as a negative number is taken as it stands.
6578
LD A,(72EFH) 3A EF 72
Load Register A from the byte at 72EFH, the fourth byte of the accumulator, which for a single precision value is its exponent.
657B
CP 90H FE 90
Compare Register A with 90H, the exponent of a value in the range 32768 to 65535, which is the one range that cannot be held as a signed integer and must be brought down.
657D
RET NZ C0
Return on NZ, the value standing below 32768 or above 65535, which CINT takes as it is and refuses if it will not fit.
657E
Call 28C4H of the overlay, which tests the sign of the value in the accumulator.
6581
RET M F8
Return on M, the value being negative, which is already in the signed range and goes straight to CINT.
6582
Call 2A6AH of the overlay, CSNG, which makes sure the value is single precision before the addition below, a double precision one having the same exponent byte in another place.
6585
LD BC,9180H 01 80 91
Load Register Pair BC with 9180H, the high two bytes of the single precision constant -65536, where Register B holds the exponent 91H and Register C the sign and the first of the mantissa bits.
6588
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the low two bytes of that constant, which are zero.
658B
Jump to 2622H of the overlay, which adds the constant in Register Pair BC and Register Pair DE to the accumulator and returns to the CINT pushed at 6573H: an address of 32768 to 65535 comes out as the same sixteen bits read as a negative number, so PEEK(49152) and PEEK(-16384) name one byte.

658EH - The RENUM Patch (658EH-6590H)

One of the eight places where the NEWB enhancement package of module 2 replaces instructions of module 1 with a call or a jump into its own code at 8048H and above, each of them an ORG in NEWB/ASM. The bytes here are loaded by module 1 and then loaded over again by module 2.

658E
RENUM intercept (658EH-6590H): call 833FH, which gives the RENUM statement a default last line of FFFFH when the line was not typed.

6591H - RENUM: the Arguments (6591H-65B4H)

RENUM is the one statement of the interpreter the enhancement package rewrote rather than merely intercepted, and its three patches are all in these 269 bytes. The statement takes up to four numbers and the first module reads three of them: RENUM newnumber, oldstart, increment, the fourth, the last line of the range, being read by RENB in module 2 at 835CH. The defaults are laid down in the first three instructions of the base and in RENA above them: RENA at 833FH loads Register Pair BC with 000AH, which 6591H pushes as the increment and which also stands as the new starting number when nothing at all is typed, and 6592H and 6593H make Register Pair DE 0000H, which is the old starting line and means the first line of the program. So a bare RENUM is RENUM 10, 0, 10. The POP AF at 65ACH is what throws the default increment away once a real one has been typed, and the three jumps to 65C0H at 6594H, 65A1H and 65AAH are the three places the statement may stop short. Every one of them leaves the same three things: the new number in Register Pair BC, the old starting line in Register Pair DE and the increment on the stack.

6591
PUSH BC C5
RENUM (6591H), which the patch at 658EH falls into after RENA: push Register Pair BC, which RENA loaded with 000AH, so that ten stands on the stack as the increment until a real one is typed.
6592
LD D,B 50
Load Register D from Register B, 00H, the high byte of the old starting line.
6593
LD E,B 58
Load Register E from Register B, 00H, so that Register Pair DE is 0000H, which the search below takes to mean the first line of the program.
6594
Jump to 65C0H on Z, nothing having been typed after RENUM, the Zero Flag standing as NXTCHAR left it because the LD BC in RENA changes no flag; Register Pair BC is still 000AH and so ten is the new starting number as well as the increment.
6596
CP 2CH FE 2C
Compare Register A with 2CH, a comma, which stands where the new starting number would have been.
6598
Jump to 65A3H on Z, a comma standing first, which leaves the new starting number at ten and reads the old starting line.
659A
PUSH DE D5
Push Register Pair DE, 0000H, the old starting line, because the read below writes that pair.
659B
Call 5F9AH, NUM2DE, which reads the new starting number into Register Pair DE and takes a full stop to mean the line being run.
659E
LD B,D 42
Load Register B from Register D, the high byte of that number.
659F
LD C,E 4B
Load Register C from Register E, the low byte of it, so that Register Pair BC is the new starting number.
65A0
POP DE D1
Pop Register Pair DE, which brings 0000H back as the old starting line.
65A1
Jump to 65C0H on Z, the statement having ended after the new starting number, with the old starting line at 0000H and the increment still ten on the stack.
65A3
The old starting line (65A3H), which 6598H reaches: call 4353H, which compares the character of the line with the byte written after the call and gives Syntax error at 4362H when they differ.
65A6
DEFB 2CH 2C
The comma 4353H demands between the new starting number and the old starting line, which is data and not an instruction: a decoder reading straight through shows it as INC L.
65A7
Call 5F9AH, NUM2DE, which reads the old starting line into Register Pair DE, a full stop meaning the line being run.
65AA
Jump to 65C0H on Z, the statement having ended after the old starting line, with the increment still ten on the stack.
65AC
POP AF F1
Pop Register Pair AF, which throws away the default increment of ten, a real one being about to be read.
65AD
Call 4353H, which compares the character of the line with the byte written after the call and gives Syntax error at 4362H when they differ.
65B0
DEFB 2CH 2C
The comma 4353H demands between the old starting line and the increment, which is data and not an instruction: a decoder reading straight through shows it as INC L.
65B1
PUSH DE D5
Push Register Pair DE, the old starting line, which the read below writes over and which RENB takes off the stack at 834CH.
65B2
Call 5FA4H, which reads the increment into Register Pair DE in whichever of its three forms it stands, the 0EH token, the 0DH token or plain digits.

65B5H - The RENUM1 Patch (65B5H-65B7H)

One of the eight places where the NEWB enhancement package of module 2 replaces instructions of module 1 with a call or a jump into its own code at 8048H and above, each of them an ORG in NEWB/ASM. The bytes here are loaded by module 1 and then loaded over again by module 2.

65B5
RENUM1 intercept (65B5H-65B7H): jump to 834AH, the package's test of whether a last line was entered on the RENUM statement.

65B8H - RENUM: the Range Checked and Counted (65B8H-6603H)

What the first module does once the arguments are in: it makes sure the renumbering will fit, and it does so twice over in two quite different ways. 65C0H to 65D3H is the collision test: it searches for the old starting line and then for the new starting number, and refuses the statement when the place the new number would fall is below the first line of the range, because the renumbering would then put lines out of order. FIND answers with the insertion point when there is no such line, so the test works whether or not the new number is already in use. 65DBH to 65FAH is the counting loop, and it walks from the first line of the range to the end of the program, adding the increment once for each line but the last and refusing the statement when the running total runs past 0FFFFH or above 0FFF9H, 65529. It counts past the end of the range, where RENB's own count at 8391H does not, so with a fourth argument given the two checks do not measure the same thing and B347 is the result: a renumbering that would fit can be refused. 65FDH is the clever part. It calls 661DH, which is the operand byte of the CP 0F6H at 661CH and stands as OR 0AFH, so the walk that follows runs with 7186H set instead of cleared and turns every line reference into the resolved 0DH form. Once every reference is an address rather than a number, the line numbers can be changed without breaking anything, which is the whole of how RENUM works.

65B8
LD A,D 7A
The increment tested (65B8H), which RENRET at 83B3H jumps to after RENB: load Register A from Register D, the high byte of the increment.
65B9
OR E B3
Or Register A with Register E, the low byte, which sets the Zero Flag only when the increment is 0000H.
65BA
Jump to 5F95H on Z, FUNCERR, which gives error 5, Illegal function call, an increment of nothing being no increment at all.
65BD
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the increment into Register Pair HL and the text pointer into Register Pair DE.
65BE
EX (SP),HL E3
Exchange the word Register Pair HL holds with the word at the Stack Pointer, which brings the old starting line into Register Pair HL and leaves the increment on the stack.
65BF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL a second time, which puts the old starting line into Register Pair DE and the text pointer back into Register Pair HL.
65C0
PUSH BC C5
The collision test (65C0H), which 6594H, 65A1H and 65AAH all reach: push Register Pair BC, the new starting number, which the search below writes over.
65C1
Call 5AB4H, FIND, which searches the program from its first line for the line whose number stands in Register Pair DE and answers with its address in Register Pair BC.
65C4
POP DE D1
Pop Register Pair DE, which brings the new starting number into that pair for the second search.
65C5
PUSH DE D5
Push Register Pair DE, that number, back on to the stack, where 65D4H takes it off again.
65C6
PUSH BC C5
Push Register Pair BC, the address of the first line of the range, which the second search writes over.
65C7
Call 5AB4H, FIND, which searches for the line whose number is the new starting number and answers with its address, or with the place it would be inserted when there is no such line.
65CA
LD H,B 60
Load Register H from Register B, the high byte of that address.
65CB
LD L,C 69
Load Register L from Register C, the low byte of it, so that Register Pair HL is where the new starting number falls.
65CC
POP DE D1
Pop Register Pair DE, which brings the address of the first line of the range back into that pair.
65CD
Call 434DH, CPHLDE, which compares Register Pair HL with Register Pair DE and sets the Carry Flag when the new number's place is below the first line of the range.
65D0
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the first line of the range into Register Pair HL, where the loops below want it.
65D1
Jump to 5F95H on C, FUNCERR, the new starting number falling below the range, which would renumber the program out of order.
65D4
POP DE D1
Pop Register Pair DE, which brings the new starting number back into that pair.
65D5
POP BC C1
Pop Register Pair BC, which brings the increment off the stack into that pair.
65D6
POP AF F1
Pop Register Pair AF, which throws away the statement loop's own return address, RENUM ending at READY and not at the next statement.
65D7
PUSH HL E5
Push Register Pair HL, the address of the first line of the range, which 6602H takes off again when the renumbering begins.
65D8
PUSH DE D5
Push Register Pair DE, the new starting number, which 6601H takes off again.
65D9
Jump to 65EBH, the head of the counting loop, which reads the first line's own link before it adds anything.
65DB
ADD HL,BC 09
The count (65DBH), which 65FAH reaches for every line but the last: add Register Pair BC, the increment, to Register Pair HL, the running new number. B347: this loop walks to the end of the program and not to the end of the range, so when a fourth argument has named a last line the increment is added once for every line beyond it as well, and the two refusals below can stop a renumbering that would have fitted. The enhancement package's own count at 8391H walks to the address 8369H stored and measures the right thing.
65DC
Jump to 5F95H on C, FUNCERR, the running total having run past 0FFFFH, which is more than a line number can hold.
65DF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the line's address into Register Pair HL and the running total into Register Pair DE.
65E0
PUSH HL E5
Push Register Pair HL, that address, because the comparison below needs Register Pair HL.
65E1
LD HL,0FFF9H 21 F9 FF
Load Register Pair HL with 0FFF9H, 65529, the highest line number RENUM will give out.
65E4
Call 434DH, CPHLDE, which compares 0FFF9H with the running total and sets the Carry Flag when the total is the greater.
65E7
POP HL E1
Pop Register Pair HL, which brings the line's address back into that pair.
65E8
Jump to 5F95H on C, FUNCERR, the running total standing above 65529, so that RENUM never gives a line a number the digit reader at 5FC3H could not take back.
65EB
PUSH DE D5
The next line (65EBH), which 65D9H reaches first: push Register Pair DE, the running new number, which the read below writes over.
65EC
LD E,(HL) 5E
Load Register E with the byte Register Pair HL stands on, the low byte of this line's link to the next.
65ED
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of that link.
65EE
LD D,(HL) 56
Load Register D with the byte Register Pair HL stands on, the high byte of it, so Register Pair DE is the address of the next line.
65EF
LD A,D 7A
Load Register A from Register D, that high byte.
65F0
OR E B3
Or Register A with Register E, the low byte, which sets the Zero Flag when the link is 0000H and this line is the last of the program.
65F1
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the next line's address into Register Pair HL.
65F2
POP DE D1
Pop Register Pair DE, which brings the running new number back into that pair without touching the flags.
65F3
Jump to 65FCH on Z, the program having ended, which stops counting and goes on to resolve the references.
65F5
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the low byte of the next line's own link.
65F6
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of that link.
65F7
OR (HL) B6
Or Register A with the byte Register Pair HL stands on, which sets the Zero Flag when the next line is the last of the program.
65F8
DEC HL 2B
Decrement Register Pair HL, so that it stands on the next line's address again.
65F9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the running new number into Register Pair HL and the next line's address into Register Pair DE.
65FA
Jump to 65DBH on NZ, another line standing after the next one, which adds the increment for it and goes round.
65FC
PUSH BC C5
The references resolved (65FCH), which 65F3H reaches: push Register Pair BC, the increment, because the walk below uses every register.
65FD
Call 661DH, which is the operand byte of the instruction at 661CH and stands as OR 0AFH, so the walk runs with 7186H set and turns every line reference in the program from its number into the address of the line it names.
6600
POP BC C1
Pop Register Pair BC, which brings the increment back into that pair.
6601
POP DE D1
Pop Register Pair DE, which brings the new starting number back into that pair, where it is the number the first line of the range is about to be given.
6602
POP HL E1
Pop Register Pair HL, which brings the address of the first line of the range back into that pair.
6603
PUSH DE D5
The renumbering loop (6603H), which 6616H goes back to: push Register Pair DE, the number this line is to be given, which the patch below writes over.

6604H - The RENUM2 Patch (6604H-6606H)

One of the eight places where the NEWB enhancement package of module 2 replaces instructions of module 1 with a call or a jump into its own code at 8048H and above, each of them an ORG in NEWB/ASM. The bytes here are loaded by module 1 and then loaded over again by module 2.

6604
RENUM2 intercept (6604H-6606H): jump to 83B6H, the package's test of whether the line reached is past the last line RENUM was given.

6607H - RENUM: the Line Numbered, and the End of the Statement (6607H-661CH)

The body of the renumbering loop, which the enhancement package's RENC at 83B6H jumps into through the patch at 6604H. On entry Register Pair HL addresses the high byte of this line's link, Register Pair DE the next line's address, Register Pair BC the increment, and the number this line is to be given stands on the stack, pushed at 6603H. All the loop does is write two bytes: the line number lives at plus two and plus three of a line, straight after the two byte link, and nothing else of the line moves, which is why RENUM can renumber a program of any size without rebuilding it. The three exchanges at 660BH to 660DH exist because the Z80 cannot bring a word off the stack into Register Pair DE and leave Register Pair HL alone, and the one at 6612H with the ADD HL,BC after it is how the running number is carried to the next line. 6618H is the end of the statement, and it does something the rest of the interpreter does nowhere else: it pushes 591FH, which is the operand byte of the instruction at 591EH and as an instruction a POP BC falling into READY, and then walks the program one more time with the flag at 7186H cleared, so that every reference the statement resolved on its way in is written back as the line's new number. RENUM therefore ends at command level, never at the next statement, which is why 65D6H threw the statement loop's own return address away.

6607
LD A,D 7A
The line reached (6607H), which RENC jumps back to at 83C4H: load Register A from Register D, the high byte of the link to the next line that 83C1H and 83C3H read out of this line's first two bytes.
6608
OR E B3
Or Register A with Register E, the low byte of that link, which sets the Zero Flag only when the link is 0000H and this line is the last of the program.
6609
Jump to 6618H on Z, the program having ended, which stops the renumbering and walks the text once more to put the new numbers into the line references.
660B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the next line's address into Register Pair HL and the address of this line's link high byte into Register Pair DE.
660C
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the number this line is to be given into Register Pair HL and leaves the next line's address on the stack for the POP HL at 6615H.
660D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL a second time, which leaves the new number in Register Pair DE and puts the address of the link's high byte back into Register Pair HL.
660E
INC HL 23
Increment Register Pair HL, so that it addresses the low byte of this line's own number, which stands one byte above the link's high byte and two above the start of the line.
660F
LD (HL),E 73
Store Register E, the low byte of the new number, into the byte Register Pair HL addresses, which is the first of the line number's two bytes.
6610
INC HL 23
Increment Register Pair HL to the second of those two bytes, the high byte of the line's number.
6611
LD (HL),D 72
Store Register D, the high byte of the new number, into the byte Register Pair HL addresses: the line carries its new number and nothing else of it has moved.
6612
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the number just given out into Register Pair HL for the addition below and the address of its high byte into Register Pair DE.
6613
ADD HL,BC 09
Add Register Pair BC, the increment, to Register Pair HL, so that Register Pair HL holds the number the next line is to be given. No test is made here, the whole range having been counted at 65DBH before a single byte was written.
6614
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL a second time, which leaves the next line's number in Register Pair DE, where 6603H pushes it on the next turn of the loop.
6615
POP HL E1
Pop Register Pair HL, the next line's address that 660CH left on the stack, which is the line the loop now goes round with.
6616
Jump to 6603H, the head of the loop, which pushes the number in Register Pair DE and reaches RENC at 83B6H through the patch at 6604H to test this line against the end of the range.
6618
LD BC,591FH 01 1F 59
The end of RENUM (6618H), which 6609H reaches at the end of the program and 83BEH jumps to when the line reached stands past the last line of the range: load Register Pair BC with 591FH, which is the operand byte of the instruction at 591EH and as an instruction a POP BC that falls into READY at 5920H.
661B
PUSH BC C5
Push Register Pair BC, so that 591FH stands as the return address of the walk below: the RET Z at 662AH lands on it, the POP BC there throws away whatever word is above it, and BASIC comes back to command level. 65D6H has already thrown the statement loop's own return address away, so this is the only exit RENUM has.
661C
CP 0F6H FE F6
Compare Register A with 0F6H, a comparison nothing reads. The two bytes of this instruction are here for the operand byte at 661DH: 661DH is an entry point, which 65FDH calls, and there the bytes 0F6H and 0AFH form an OR 0AFH which puts 0AFH into Register A where the XOR A at 661EH puts 00H. That one byte of difference is the whole of how the walk below runs in two directions, and the author wrapped it in a CP so that RENUM's end could fall straight through into the clearing entry.

661EH - NORMNUM: Every Line Reference Resolved, or Put Back (661EH-6683H)

The one routine that makes RENUM possible, and the reason the interpreter can afford to look a line up only once. A line reference in the program text stands in one of two forms, the 0EH token with the number as it was typed or the 0DH token with the address of the line once a GOTO has found it, and this walk converts the whole program from either form to the other. Which way it goes is decided by one byte, the flag at 7186H, and the two entries differ only in what they put there: 661DH, which is the operand byte of the instruction at 661CH, stores 0AFH and resolves, and 661EH, which newb.asm calls NORMNUM with the comment that it normalizes all line references, stores 00H and puts them back. RENUM calls the resolving entry at 65FDH before it changes a single number, because once every reference is an address the numbers can be rewritten freely, and then falls through the clearing entry at 661EH afterwards so that the references name the new numbers. The clearing entry is also what SAVE calls at 4D67H, what the overlay loader calls at 823BH, and what 66B6H reaches for CHAIN, DELETE and the line number range parser, for the same reason in each case: an address is meaningless once the program has moved or been written to a file. The walk steps line by line from PGMBGN, reads each line through NXTCHAR so that the tokenizer's own packing is undone for it, and treats ON ERROR GOTO as the one special case, because ON ERROR GOTO 0 turns the handler off and names no line. An undefined reference does not stop the walk: 666AH reports it with the text at 6684H and the line it stands in, and the walk reads straight on, so a program with ten bad GOTOs gives ten messages and still ends up renumbered.

661E
XOR A AF
NORMNUM (661EH), the name newb.asm gives it at its line 41, and the entry that puts resolved references back: clear Register A with XOR A, making 00H, where the entry at 661DH leaves 0AFH in Register A instead.
661F
LD (7186H),A 32 86 71
Store Register A into the byte at 7186H, the flag that says the program text holds resolved line references. The 00H stored from here turns every address back into a number; the 0AFH stored from 661DH turns every number into an address.
6622
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL from the word at 6E9EH, PGMBGN, the address the program text begins at, which is the low byte of the first line's link.
6625
DEC HL 2B
Decrement Register Pair HL, so that the increment at the head of the loop below brings Register Pair HL back to that first byte.
6626
INC HL 23
The next line (6626H), which 6633H comes back to at the end of every line: increment Register Pair HL to the low byte of this line's link to the next.
6627
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of that link.
6628
INC HL 23
Increment Register Pair HL to the high byte of the link.
6629
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, the high byte, which sets the Zero Flag only when both bytes are 00H and the program has ended.
662A
RET Z C8
Return on Z, the program having ended. For RENUM that lands on the 591FH pushed at 661BH and so at command level; for every other caller it is an ordinary return.
662B
INC HL 23
Increment Register Pair HL to the low byte of this line's own number, which stands immediately above the link.
662C
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of this line's number.
662D
INC HL 23
Increment Register Pair HL to the high byte of that number.
662E
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE holds the number of the line being walked, which the report at 667CH prints after the word in when a reference in this line names nothing.
662F
The next character (662FH), which 665BH, 6646H, 664DH and 6682H all come back to: call NXTCHAR at 5E93H, which steps the text pointer on and brings the character back in Register A, giving the token out of 7147H when a number the tokenizer has already converted stands there.
6632
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that stands at the end of every line of the program text.
6633
Jump to 6626H on Z, the line having ended, which takes the walk on to the next line.
6635
LD C,A 4F
Load Register C from Register A, keeping the character while the flag is read, because the load below writes Register A.
6636
LD A,(7186H) 3A 86 71
Load Register A with the byte at 7186H, the flag 661FH or 661DH set, which says which way this walk is going.
6639
OR A B7
Or Register A with itself, which sets the Zero Flag when the flag holds 00H and the walk is turning addresses back into numbers.
663A
LD A,C 79
Load Register A from Register C, the character read, which changes no flag, so the Zero Flag the test above set is still the one the jump below reads.
663B
Jump to 6694H on Z, the flag holding 00H, where a 0DH reference is turned back into the number of the line it addresses.
663D
CP 0A8H FE A8
Compare Register A with 0A8H, the token of the ERROR keyword, which is the one case the resolving direction has to look at twice: a line number of zero after ON ERROR GOTO names no line and must be left exactly as it stands.
663F
Jump to 6659H on NZ, the character being anything but ERROR, where an ordinary unresolved reference is dealt with.
6641
Call NXTCHAR at 5E93H, which brings the character standing after the ERROR token back in Register A.
6644
CP 89H FE 89
Compare Register A with 89H, the token of the GOTO keyword, which is what has to follow ERROR for the statement to be an ON ERROR GOTO.
6646
Jump to 6632H on NZ, GOTO not following ERROR, which tests this character for the end of the line and reads on from it.
6648
Call NXTCHAR at 5E93H a third time, which brings the character standing after the GOTO token back in Register A.
664B
CP 0EH FE 0E
Compare Register A with 0EH, the token of a line reference still carrying the number as it was typed, which is what stands after the GOTO of an ON ERROR GOTO that has not been run.
664D
Jump to 6632H on NZ, no unresolved reference standing after the GOTO, which reads on from this character.
664F
PUSH DE D5
Push Register Pair DE, the number of the line being walked, which the call below writes over and 6680H brings back.
6650
Call NUMPOSN at 5FAEH, which loads Register Pair DE from the word at 7149H, the two bytes standing after the token, and leaves the text pointer at the character after them.
6653
LD A,D 7A
Load Register A from Register D, the high byte of the line number the ON ERROR GOTO names.
6654
OR E B3
Or Register A with Register E, the low byte of it, which sets the Zero Flag only when that number is 0000H.
6655
Jump to 6661H on NZ, a real line number standing after the GOTO, which is looked up and written back as an address like any other reference.
6657
Jump to 6680H, the number being 0000H: ON ERROR GOTO 0 turns the program's own error handler off and names no line, so there is nothing to look up and the three bytes are left as they stand.
6659
CP 0EH FE 0E
An ordinary reference (6659H), which 663FH reaches: compare Register A with 0EH, the token of a line reference whose number has not yet been looked up.
665B
Jump to 662FH on NZ, this character being neither the ERROR token nor an unresolved reference, which reads the next one.
665D
PUSH DE D5
Push Register Pair DE, the number of the line being walked, which the call below writes over and 6679H and 6680H bring back.
665E
Call NUMPOSN at 5FAEH, which loads Register Pair DE from the word at 7149H, the number this reference carries, and leaves the text pointer at the character standing after its three bytes.
6661
PUSH HL E5
The line looked up (6661H), which 6655H also reaches: push Register Pair HL, the text pointer, which 6678H and 667FH bring back.
6662
Call FIND at 5AB4H, which searches the program from PGMBGN for the line whose number stands in Register Pair DE and answers with its address in Register Pair BC and the Carry Flag set, or with the Carry Flag clear when the program holds no such line.
6665
DEC BC 0B
Decrement Register Pair BC, which FIND left addressing the line found, so that Register Pair BC holds the byte below its link: that is the form 6033H writes into the program text and 669DH reads back out of it.
6666
LD A,0DH 3E 0D
Load Register A with 0DH, the token that marks a resolved reference. The load changes no flag, so the Carry Flag FIND set is still the one the jump below reads, which is this interpreter's habit of putting a value in hand between a test and the branch that acts on it.
6668
Jump to 66A6H on C, the line having been found, which writes the 0DH token in Register A and the address in Register Pair BC over the reference's three bytes.
666A
The undefined reference reported (666AH), the walk having found no line of that number: call 41E9H, which writes a carriage return only when the display does not already stand at the start of a line.
666D
LD HL,6684H 21 84 66
Load Register Pair HL with 6684H, the text Undefined line with a space after it, which the writer below puts on the display.
6670
PUSH DE D5
Push Register Pair DE, the number this reference asked for, which the writer below writes over and 6674H brings back.
6671
Call the text writer at 46A5H, which makes a temporary string of the bytes from 6684H up to the 00H at 6693H that ends them and writes it to the display.
6674
POP HL E1
Pop Register Pair HL, the number this reference asked for, which the printer below wants in that pair.
6675
Call NUMDSP at 3139H, which writes the number in Register Pair HL to the display as decimal digits, so that the message names the line that cannot be found.
6678
POP BC C1
Pop Register Pair BC, the text pointer pushed at 6661H, which the two pushes below put back in the order the exits want them.
6679
POP HL E1
Pop Register Pair HL, the number of the line being walked, pushed at 665DH, which the printer below wants in that pair.
667A
PUSH HL E5
Push Register Pair HL, that line number, back on to the stack, where 6680H takes it off into Register Pair DE.
667B
PUSH BC C5
Push Register Pair BC, the text pointer, back on to the stack, where 667FH takes it off into Register Pair HL.
667C
Call 3131H, which writes the text in at 7328H and falls into NUMDSP at 3139H to write the number in Register Pair HL, so that the message ends by naming the line the bad reference stands in.
667F
POP HL E1
The reference dealt with (667FH), which 66A9H pushes as the return address of the three byte writer: pop Register Pair HL, the text pointer, pushed at 6661H or put back at 667BH.
6680
POP DE D1
The reference left alone (6680H), which 6657H reaches: pop Register Pair DE, the number of the line being walked, pushed at 664FH or 665DH or put back at 667AH.
6681
DEC HL 2B
Decrement Register Pair HL, because NUMPOSN left the text pointer standing on the character after the reference and the call at 662FH increments Register Pair HL before it reads, exactly as the 5FA4H entry does with its own decrement.
6682
The next character with nothing to put back (6682H), which 6696H jumps to: jump to 662FH, which reads on through this line.

6684H - The Undefined Line Text (6684H-6693H)

The words RENUM and DELETE put in front of the line number they cannot find. Error 8 of the block at 6B7CH is the whole sentence Undefined line number; this is the shorter form, which the number itself is printed after.

6684-6693
DEFM "Undefined line " / DEFB 00H 55 6E 64 65 66 69 6E 65 64 20 6C 69 6E 65 20 00
6684H-6693H: the words Undefined line, the space that follows them and the 00H that ends the text. The space is stored, so the number printed after it needs nothing of its own.

6694H - NORMNUM: a Resolved Reference Turned Back, and the Three Byte Writer (6694H-66BDH)

The other half of the walk, and the one piece of it the rest of the interpreter uses on its own. 6694H is the clearing direction: it finds a 0DH reference, reads the address it carries, steps three bytes into the line that address names and takes the line's number out of its header, and writes that number back where the address stood. The number it finds is whatever the line carries now, which is what makes RENUM work: the renumbering loop at 6603H changed every line's number while every reference was an address, and this walk then reads the new numbers straight out of the line headers. 66ADH is the writer, three bytes down from IPOS at 7145H, and it is written to serve two callers at once. The walk comes in at 66A6H, which pushes 667FH so that the RET at 66B5H lands back in the walk, and GOTO calls 66ADH directly at 603AH with its own return address already on the stack, so the same six instructions resolve a reference for a running program and un-resolve one for a listing. 66B6H is the guard that CHAIN at 5466H, DELETE at 7BF4H and the line number range parser at 59E6H call rather than the walk itself: it reads the flag at 7186H and returns at once when nothing has been resolved, so a program that has never been run costs them two instructions and no walk at all.

6694
CP 0DH FE 0D
A resolved reference (6694H), the clearing direction, which 663BH jumps to when the flag at 7186H holds 00H: compare Register A with 0DH, the token that stands in front of a line's address once 603AH has written one there.
6696
Jump to 6682H on NZ, the character being anything but a resolved reference, which reads on through the line with nothing of its own to put back.
6698
PUSH DE D5
Push Register Pair DE, the number of the line being walked, which the call below writes over and 6680H brings back.
6699
Call NUMPOSN at 5FAEH, which loads Register Pair DE from the word at 7149H, here the address of the line this reference names, and leaves the text pointer at the character after the reference's three bytes.
669C
PUSH HL E5
Push Register Pair HL, the text pointer, which 667FH brings back once the three bytes have been written.
669D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that line's address into Register Pair HL. It addresses the byte below the line's link, which is the form 6665H and 6033H store.
669E
INC HL 23
Increment Register Pair HL to the low byte of the line's link, the first of the four bytes that head every line of the program text.
669F
INC HL 23
Increment Register Pair HL to the high byte of that link.
66A0
INC HL 23
Increment Register Pair HL a third time, to the low byte of the line's own number, which is the number the reference is to carry again.
66A1
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the line's number.
66A2
INC HL 23
Increment Register Pair HL to the high byte of the line's number.
66A3
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds the number the line carries now, which after a RENUM is the new one the loop at 660FH wrote.
66A4
LD A,0EH 3E 0E
Load Register A with 0EH, the token of a reference carrying a number as it was typed, which is the form the writer below is about to put back into the program text.
66A6
LD HL,667FH 21 7F 66
The three bytes written (66A6H), which 6668H jumps to with the 0DH token in Register A and a line's address in Register Pair BC: load Register Pair HL with 667FH, the point of the walk that puts the text pointer and the line number back.
66A9
PUSH HL E5
Push Register Pair HL, so that 667FH is the address the RET at 66B5H returns to. This is the one instruction that lets the six below serve both the walk, which has no return address of its own on the stack here, and GOTO at 603AH, which has.
66AA
LD HL,(7145H) 2A 45 71
Load Register Pair HL from the word at 7145H, IPOS, which the unpacking at 5EC4H left addressing the character standing after the reference's three bytes.
66AD
PUSH HL E5
The writer's own entry (66ADH), which GOTO calls at 603AH with Register A holding 0DH and Register Pair BC the line's address: push Register Pair HL, IPOS, which the POP HL at 66B4H gives back unchanged.
66AE
DEC HL 2B
Decrement Register Pair HL to the third of the reference's three bytes, the high byte of whatever it is to carry.
66AF
LD (HL),B 70
Store Register B into the byte Register Pair HL addresses, the high byte of the line's number from 66A3H or of its address from FIND.
66B0
DEC HL 2B
Decrement Register Pair HL to the second of the reference's three bytes.
66B1
LD (HL),C 71
Store Register C into the byte Register Pair HL addresses, the low byte of that number or address.
66B2
DEC HL 2B
Decrement Register Pair HL to the first of the three bytes, which is the token itself.
66B3
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses: 0DH from 6666H or from 603AH, 0EH from 66A4H. That one byte is the whole of what tells the interpreter which of the two forms the reference stands in, and 5FA4H is what reads it back.
66B4
POP HL E1
Pop Register Pair HL, IPOS exactly as it was, so that neither caller has to put the text pointer back for itself.
66B5
RET C9
Return, which goes to 667FH for the walk above, that address having been pushed at 66A9H, and to 603DH for the GOTO that called this entry at 603AH.
66B6
LD A,(7186H) 3A 86 71
The guard (66B6H), which CHAIN calls at 5466H, DELETE at 7BF4H and the line number range parser at 59E6H: load Register A with the byte at 7186H, the flag that says the program text holds resolved line references.
66B9
OR A B7
Or Register A with itself, which sets the Zero Flag when the flag holds 00H and no reference has been resolved since the last walk.
66BA
RET Z C8
Return on Z, there being nothing to put back, which is why these three callers can ask for the program to be settled before every measurement they make and pay almost nothing for it.
66BB
Jump to NORMNUM at 661EH, which clears the flag and walks the whole program text, turning every resolved reference back into the number of the line it names.

66BEH - OPTION BASE: Set the Lowest Subscript of an Array (66BEH-6701H)

OPTION BASE is the one statement of the interpreter whose effect cannot be undone without clearing the program, and the code is exactly as careful as that requires. The keyword after OPTION is spelled out letter by letter through 4353H, BASE being the only word allowed; the digit after it must be 0 or 1 and anything else gives Syntax error; and then come the two guards. A second OPTION BASE that asks for the base already in force is accepted and does nothing, the test at 66DDH sending it straight to 66FAH. A second one that asks for the other base is refused with error 10, Duplicate Definition, and so is one met after any array has been made, which 66E7H to 66F2H test by comparing the start of the array table at 71A1H with its end at 71A3H. The flag at 72A4H is what remembers that a statement has been obeyed, and it is set to the base plus one so that 00H can mean untouched; 42D5H clears it with the program unless a MERGE is running. The base itself lives at 72A3H and is read by the array code at 3BB5H, which is where a subscript is weighed. CHAIN saves both bytes across a load and puts them back, which is B302.

66BE
OPTION BASE (66BEH), the routine the statement address table holds for token 0BAH at 6835H: call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
66C1
DEFB 42H 42
The letter B, the first letter of the word BASE, read as data by the routine the call at 66BEH reaches, not executed; the instruction after that call is the one at 66C2H. A decoder reading straight through shows it as LD B,D.
66C2
Call 4353H for the second letter of the keyword, which gives Syntax error when the line does not carry it.
66C5
DEFB 41H 41
The letter A, the second letter of BASE, data for the call at 66C2H and not an instruction; the instruction after that call is the one at 66C6H.
66C6
Call 4353H for the third letter of the keyword.
66C9
DEFB 53H 53
The letter S, the third letter of BASE, data for the call at 66C6H and not an instruction; the instruction after that call is the one at 66CAH.
66CA
Call 4353H for the fourth and last letter, after which the text pointer stands on the digit.
66CD
DEFB 45H 45
The letter E, the fourth letter of BASE, data for the call at 66CAH and not an instruction; the instruction after that call is the one at 66CEH.
66CE
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the keyword, which is to be the digit 0 or the digit 1.
66CF
SUB 30H D6 30
Subtract 30H from Register A, the character code of the digit zero, leaving Register A holding the digit's own value and setting the Carry Flag for any character below it.
66D1
Jump to SYNERR 586CH on C, which prints Syntax error, the character standing after BASE being below the digit zero.
66D4
CP 02H FE 02
Compare Register A with 02H, the first value the statement does not allow, the base being 0 or 1 and nothing else.
66D6
Jump to SYNERR 586CH on NC, which prints Syntax error for a digit of 2 or above and for any character above the digits.
66D9
LD B,A 47
Load Register B from Register A, the base this statement asks for, which the comparison below weighs against the one in force.
66DA
LD A,(72A3H) 3A A3 72
Load Register A from the byte at 72A3H, the base in force, which 42D8H clears to 00H with the program.
66DD
CP B B8
Compare Register A with Register B, which asks whether this statement asks for the base that is already set.
66DE
Jump to 66FAH on Z, the statement asking for the base already in force: it is accepted and the only thing it does is set the flag below, so a program may say OPTION BASE 0 as often as it likes.
66E0
LD A,(72A4H) 3A A4 72
Load Register A from the byte at 72A4H, the flag that says an OPTION BASE statement has already been obeyed, which holds the base plus one and 00H when none has been.
66E3
OR A B7
OR Register A with itself, which sets the Zero Flag when no OPTION BASE statement has been obeyed yet.
66E4
Jump to 5875H on NZ, which is the entry for error 10, Duplicate Definition: a second OPTION BASE that asks for the other base is refused, and the base can only be changed by clearing the program.
66E7
PUSH HL E5
Push Register Pair HL, the text pointer standing on the digit, which the POP HL at 66F5H brings back.
66E8
LD HL,(71A1H) 2A A1 71
Load Register Pair HL from the word at 71A1H, the start of the array table, which is also the end of the simple variables.
66EB
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that address into Register Pair DE where the comparison takes it.
66EC
LD HL,(71A3H) 2A A3 71
Load Register Pair HL from the word at 71A3H, the end of the arrays and the lowest free address, which stands above 71A1H by exactly the room the arrays take.
66EF
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Zero Flag when the two are equal and so when no array has been made.
66F2
Jump to 5875H on NZ, error 10, Duplicate Definition: an array exists already, and its subscripts were worked out against the base in force, so the base may not be changed under it.
66F5
POP HL E1
Pop Register Pair HL, the text pointer pushed at 66E7H.
66F6
LD A,B 78
Load Register A from Register B, the base this statement asks for, which has passed both guards.
66F7
LD (72A3H),A 32 A3 72
Store Register A into the byte at 72A3H, the base in force, which the array code reads at 3BB5H to decide whether subscript zero exists.
66FA
INC A 3C
Increment Register A, so that a base of 0 gives 01H and a base of 1 gives 02H: the flag below must be able to say that a statement has been obeyed without 00H meaning base zero.
66FB
LD (72A4H),A 32 A4 72
Store Register A into the byte at 72A4H, the flag that says an OPTION BASE statement has been obeyed, which 66E0H reads to refuse a second one and 42D5H clears with the program.
66FE
Call NXTCHAR at 5E93H, which steps the text pointer past the digit and onto whatever follows the statement.
6701
RET C9
Return to the statement loop at 5E3BH, which goes on with the rest of the line.

6702H - The Text Writer, the Forward Scan for NEXT and WEND, and the Complaint Cells (6702H-67C2H)

Three unrelated things, and the first of them is nine bytes that write a message on the screen whatever PRINT is doing. 6702H writes the 00H ended text at the address in Register Pair HL one character at a time through 670CH, and 670CH enters the one character output at 414BH, past the file test at 40D9H and the printer test at 40DFH, so a text written this way reaches the display and nothing else: that is how the Overflow and Division by zero warnings at 30DAH appear on the screen while the program's own output is going to a file or to the printer. 6710H and 6714H are the forward scan, which reads ahead through the program for the statement that closes a loop: WHILE calls 6710H at 52CDH to find its WEND and FOR calls 6714H at 5E1CH to find its NEXT, the two differing only in the error number in Register C, which is also what the test at 676AH reads to choose which pair of tokens to count. The scan walks the text itself rather than the line links alone, because a loop may be opened and closed in one line and because a NEXT can close several loops at once: it steps over string literals, over REM and DATA, and over the variable list of a NEXT I,J, taking a level off the count for each name in it. The line it has reached is kept in 72A1H so that an error inside that variable list names the right line. And 67B4H with 67BCH are the two cells the number conversion's complaint count is handed through, which 2F17H of BASIC/OV1 and 4329H reach.

6702
LD A,(HL) 7E
The text writer (6702H), which 30DDH of the Overflow warning and 75EAH both call and 6709H goes back to: load Register A with the byte Register Pair HL addresses, one character of the text.
6703
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that ends every text of this interpreter.
6704
RET Z C8
Return on Z with Register A holding that 00H, the whole of the text having been written: this routine gives back no column and no count, only the terminating byte it stopped on.
6705
Call 670CH, which writes the one character in Register A to the display.
6708
INC HL 23
Increment Register Pair HL to the next character of the text.
6709
Jump to 6702H, the head of the loop, which takes that character up.
670C
PUSH AF F5
The one character written to the display (670CH), which 30E5H and 30EAH of the Overflow warning call as well as 6705H: push Register Pair AF, the character, which is what 4152H pops at the far end.
670D
Jump to 414BH, which tests the display suppression flag at 6E97H and otherwise falls into the display's own path at 4152H: this is the only instruction in the loaded image that names 414BH, and entering the output there is what skips the file and printer destinations 40D8H would have chosen.
6710
LD C,1DH 0E 1D
The forward scan for WEND (6710H), which WHILE calls at 52CDH: load Register C with 1DH, 29, the number of the WHILE without WEND error, which is both the error this scan gives when the program runs out and the mark that makes it count WHILE and WEND rather than FOR and NEXT.
6712
Jump to 6716H, which steps over the entry below so that the two scans share everything after the one load that tells them apart.
6714
LD C,1AH 0E 1A
The forward scan for NEXT (6714H), which FOR calls at 5E1CH: load Register C with 1AH, 26, the number of the FOR Without NEXT error, which is the same mark the other way about.
6716
LD B,00H 06 00
The scan begun (6716H), which 6712H reaches: load Register B with 00H, the count of loops still open, which the increment at 6720H at once makes 01H for the loop being matched.
6718
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer into Register Pair DE while the two loads below have Register Pair HL.
6719
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL with the word at 6E9CH, the number of the line being run.
671C
LD (72A1H),HL 22 A1 72
Store Register Pair HL into 72A1H, the line the scan has reached, which 6790H reads when it has to lend it to the variable search.
671F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which brings the text pointer back into Register Pair HL untouched.
6720
INC B 04
A level counted (6720H), which 6771H and 677EH reach for a nested WHILE or FOR and which 671FH falls into: increment Register B, one more loop being open than was open before.
6721
DEC HL 2B
The scan from the character already reached (6721H), which 6775H, 6778H and 6782H reach: decrement Register Pair HL so that the call below reads the character the text pointer already stands on rather than the one beyond it.
6722
The character loop (6722H), which 673BH goes back to: call NXTCHAR at 5E93H, which steps Register Pair HL on one character and brings it back in Register A, having skipped any blank and unpacked any number token on the way.
6725
Jump to 673DH on Z, which NXTCHAR sets for the 00H that ends a line and for the 3AH that ends a statement, those being the two places a new statement can begin.
6727
CP 22H FE 22
Compare Register A with 22H, a quotation mark, the start of a string literal.
6729
Jump to 6735H on NZ, the character not opening a literal.
672B
Inside a string literal (672BH), which 6733H goes back to: call NXTCHAR at 5E93H, which brings the next character of the literal back in Register A.
672E
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that ends the line.
672F
Jump to 673DH on Z, the line having ended with the literal still open, which the tokenizer allows.
6731
CP 22H FE 22
Compare Register A with 22H, the quotation mark that closes the literal.
6733
Jump to 672BH on NZ, the literal not having closed, which takes its next character: a colon inside a string is not the end of a statement and this loop is why.
6735
CP 0A2H FE A2
The two tokens that begin a statement (6735H), which 6729H reaches: compare Register A with 0A2H, the token of ELSE, after which a statement stands.
6737
Jump to 6750H on Z, the token being that ELSE, which weighs what follows it as a statement.
6739
CP 0D0H FE D0
Compare Register A with 0D0H, the token of THEN, after which a statement also stands.
673B
Jump to 6722H on NZ, the character being none of the five this loop looks for, which takes the next one.
673D
OR A B7
A statement boundary reached (673DH), which 6725H, 672FH, 675CH, 6767H and 6789H all reach: or Register A with itself, which sets the Zero Flag only for the 00H that ends a line, the colon, the ELSE and the THEN all being values of their own.
673E
Jump to 6750H on NZ, the boundary being a colon, an ELSE or a THEN, so that the next statement stands in this same line.
6740
INC HL 23
Increment Register Pair HL past the 00H that ends the line, on to the low byte of the next line's link.
6741
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that low byte.
6742
INC HL 23
Increment Register Pair HL to the high byte of the link.
6743
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, which sets the Zero Flag when the link is 0000H and this was the last line of the program.
6744
LD E,C 59
Load Register E from Register C, the error number this scan was begun with, which is 1AH for a FOR and 1DH for a WHILE.
6745
Jump to the error handler at 5886H on Z, the program having run out before the loop was closed: this is where FOR Without NEXT and WHILE without WEND are given.
6748
INC HL 23
Increment Register Pair HL to the low byte of the next line's number.
6749
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, that low byte.
674A
INC HL 23
Increment Register Pair HL to the high byte of the number.
674B
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, so that Register Pair DE is the number of the line the scan is moving into.
674C
LD (72A1H),DE ED 53 A1 72
Store Register Pair DE into 72A1H, which keeps the scan's own line number up to date for 6790H.
6750
A statement weighed (6750H), which 6737H and 673EH reach and 674CH falls into: call NXTCHAR at 5E93H, which steps Register Pair HL on to the statement's first character and brings it back in Register A.
6753
CP 8FH FE 8F
Compare Register A with 8FH, the token of REM, after which nothing in the line is read.
6755
Jump to 675EH on NZ, the statement not being a remark.
6757
PUSH BC C5
Push Register Pair BC, the count and the error number, which the skipper below works in.
6758
Call 6067H, the statement skipper's REM entry, which runs Register Pair HL on to the 00H that ends the line.
675B
POP BC C1
Pop Register Pair BC, the count and the error number, pushed at 6757H.
675C
Jump to 673DH with Register A holding the 00H the skipper stopped on, which takes the scan into the next line.
675E
CP 84H FE 84
Compare Register A with 84H, the token of DATA, whose items are not statements and must not be read as any.
6760
Jump to 6769H on NZ, the statement not being a DATA.
6762
PUSH BC C5
Push Register Pair BC, the count and the error number.
6763
Call 6065H, the statement skipper's DATA entry, which runs Register Pair HL on to the colon or the 00H that ends the items, counting quotation marks so that a colon inside one does not stop it.
6766
POP BC C1
Pop Register Pair BC, the count and the error number, pushed at 6762H.
6767
Jump to 673DH with Register A holding the byte the skipper stopped on, which is a colon or the 00H that ends the line.
6769
LD A,C 79
The four tokens counted (6769H), which 6760H reaches: load Register A from Register C, the error number this scan was begun with.
676A
CP 1AH FE 1A
Compare Register A with 1AH, 26, which is the number the FOR scan carries and the WHILE scan does not.
676C
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the statement's token: a load changes no flag, so the comparison above is still the one the jump below reads, and the token is in hand before the test is acted on.
676D
Jump to 677CH on Z, this being the scan for a NEXT, where FOR and NEXT are the tokens counted.
676F
CP 0B4H FE B4
Compare Register A with 0B4H, the token of WHILE, this being the scan for a WEND.
6771
Jump to 6720H on Z, a nested WHILE having been met, which counts a level and goes on.
6773
CP 0B5H FE B5
Compare Register A with 0B5H, the token of WEND, which closes a WHILE.
6775
Jump to 6721H on NZ, the statement being neither, which goes on without changing the count.
6777
DEC B 05
Decrement Register B, one of the open loops having been closed.
6778
Jump to 6721H on NZ, loops being open still, which goes on through the text.
677B
RET C9
Return with Register Pair HL on the WEND's own token, the WHILE this scan was begun for having been closed.
677C
CP 82H FE 82
FOR and NEXT counted (677CH), which 676DH reaches: compare Register A with 82H, the token of FOR.
677E
Jump to 6720H on Z, a nested FOR having been met, which counts a level and goes on.
6780
CP 83H FE 83
Compare Register A with 83H, the token of NEXT, which closes a FOR.
6782
Jump to 6721H on NZ, the statement being neither, which goes on without changing the count.
6784
DEC B 05
A NEXT counted (6784H), which 67B3H returns to for the second and later names of a variable list: decrement Register B, one of the open loops having been closed.
6785
RET Z C8
Return on Z with Register Pair HL on the NEXT's own token, the FOR this scan was begun for having been closed.
6786
Call NXTCHAR at 5E93H, which steps Register Pair HL past the NEXT token and brings the character after it back in Register A, loops being open still.
6789
Jump to 673DH on Z, the NEXT having nothing after it, which takes the scan into the next line: a bare NEXT closes one loop and this scan has already counted it.
678B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer into Register Pair DE while the loads below have Register Pair HL.
678C
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL with the word at 6E9CH, the number of the line being run, which is the line the FOR itself stands in.
678F
PUSH HL E5
Push Register Pair HL, that number, which 67ADH exchanges back.
6790
LD HL,(72A1H) 2A A1 72
Load Register Pair HL with the word at 72A1H, the number of the line the scan has reached.
6793
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into 6E9CH, so that an error raised by the variable search below names the line the scan is reading and not the line the FOR was in.
6796
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL.
6797
PUSH BC C5
Push Register Pair BC, the count and the error number, which the search below works in.
6798
Call 39FBH, the variable search entered with Register A at 00H, which reads the name after the NEXT and finds or creates the variable: the scan does not use the address it gives back and calls it only to step the text pointer past the name.
679B
POP BC C1
Pop Register Pair BC, the count and the error number, pushed at 6797H.
679C
DEC HL 2B
Decrement Register Pair HL so that the call below reads the character the search stopped on.
679D
Call NXTCHAR at 5E93H, which brings that character back in Register A.
67A0
LD DE,673DH 11 3D 67
Load Register Pair DE with 673DH, the address the scan goes back to when the variable list has ended, which is the statement boundary test.
67A3
Jump to 67ADH on Z, the list having ended at the 00H of the line or at a colon.
67A5
Call 4353H, the character demand, which insists that the text pointer stands on the character held in the byte after the call and gives Syntax error through 586CH when it does not.
67A8
DEFB 2CH 2C
67A8H: the comma 4353H demands, which is what must stand between two names of a NEXT's variable list. It is data read by the routine the call at 67A5H reaches, not an instruction, and the instruction after that call is the one at 67A9H.
67A9
DEC HL 2B
Decrement Register Pair HL, the demand above having stepped the pointer past the comma, so that the character after it is read next.
67AA
LD DE,6784H 11 84 67
Load Register Pair DE with 6784H, the address the scan goes back to when another name follows the comma, which takes another level off the count: this is how one NEXT closes two loops.
67AD
EX (SP),HL E3
The line number put back (67ADH), which 67A3H reaches: exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack and brings the line number 678FH pushed back into Register Pair HL.
67AE
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into 6E9CH, the number of the line being run, which is the line the FOR stands in again.
67B1
POP HL E1
Pop Register Pair HL, the text pointer the exchange above left on the stack.
67B2
PUSH DE D5
Push Register Pair DE, the address 67A0H or 67AAH chose, which the return below goes to.
67B3
RET C9
Return to that address, which is 673DH for the end of the list and 6784H for another name in it.
67B4
PUSH AF F5
The complaint count handed over (67B4H), which 2F17H of BASIC/OV1 loads into Register Pair BC so that the number conversion returns through it: push Register Pair AF, the caller's flags, which 67BBH takes back.
67B5
LD A,(72F1H) 3A F1 72
Load Register A with the byte at 72F1H, the number conversion's complaint count.
67B8
LD (72F2H),A 32 F2 72
Store Register A into 72F2H, where INPUT reads it at 6475H, so that an item that overflowed can be told from one that did not.
67BB
POP AF F1
Pop Register Pair AF, the caller's flags, pushed at 67B4H.
67BC
PUSH AF F5
The complaint count cleared (67BCH), which 4329H calls and 36E5H loads into Register Pair HL, and which the cells above fall into: push Register Pair AF, the caller's flags, which 67C1H takes back.
67BD
XOR A AF
Clear Register A to 00H, the count that says nothing has complained yet.
67BE
LD (72F1H),A 32 F1 72
Store Register A into 72F1H, the complaint count, which 7352H also clears at the start of every expression.
67C1
POP AF F1
Pop Register Pair AF, the caller's flags, pushed at 67BCH.
67C2
RET C9
Return with the flags the caller had, both of these cells being written so that they can be called from anywhere without disturbing a test.

67C3H - The Statement Address Table (67C3H-685CH)

Module 1 holds one word for each statement token, in token order from 081H, and the word is the address of the routine for that statement. The table was fixed from the bytes alone, module 1 having no source anywhere: every one of the seventy-seven words lines up with the keyword the reserved word table at 68F7H gives the same token, the word for CLEAR holds 447EH and the word for RENUM holds 658EH, the two addresses NEWB/EQU names, the four DEF type statements stand three bytes apart, the two tokens with no keyword hold SYNERR at 586CH, and every token the reserved word table does not use holds 0000H. The code that indexes the table is the statement loop's own dispatch at 5E7BH. The table ends here, at 685CH with token 0CDH, and another begins at 685DH: the question this entry asked until pass 38, whether the words from 685DH up were this table running on to token 0E2H, is answered no. They are the function address table, one word for each function token from 01H to 33H, and the 4A69H that would have been the apostrophe's entry is FRE's routine. Pass 39 wrote that table in its own section below.

67C3-67C4
DEFW 4383H 83 43
END, token 81H: the word 4383H. END stops the program and returns to command level.
67C5-67C6
DEFW 5D5AH 5A 5D
FOR, token 82H: the word 5D5AH. FOR opens a loop and builds its entry on the stack.
67C7-67C8
DEFW 4527H 27 45
NEXT, token 83H: the word 4527H. NEXT closes the innermost loop whose variable matches.
67C9-67CA
DEFW 6065H 65 60
DATA, token 84H: the word 6065H. DATA is stepped over at run time, its text being read by READ.
67CB-67CC
DEFW 63C2H C2 63
INPUT, token 85H: the word 63C2H. INPUT asks at the keyboard.
67CD-67CE
DEFW 39F6H F6 39
DIM, token 86H: the word 39F6H. DIM allots an array.
67CF-67D0
DEFW 649DH 9D 64
READ, token 87H: the word 649DH. READ takes the next item of the DATA text.
67D1-67D2
DEFW 608CH 8C 60
LET, token 88H: the word 608CH. LET assigns, and is the routine a bare assignment reaches as well.
67D3-67D4
DEFW 600AH 0A 60
GOTO, token 89H: the word 600AH. GOTO and GO TO share this token, the reserved word table holding both spellings against it.
67D5-67D6
DEFW 5FDFH DF 5F
RUN, token 8AH: the word 5FDFH. RUN starts the program.
67D7-67D8
DEFW 61CDH CD 61
IF, token 8BH: the word 61CDH. IF tests and either runs the rest of the line or steps over it.
67D9-67DA
DEFW 4365H 65 43
RESTORE, token 8CH: the word 4365H. RESTORE puts the DATA pointer back.
67DB-67DC
DEFW 5FF3H F3 5F
GOSUB, token 8DH: the word 5FF3H. GOSUB calls, leaving its return on the stack.
67DD-67DE
DEFW 6045H 45 60
RETURN, token 8EH: the word 6045H. RETURN takes that return back off.
67DF-67E0
DEFW 6067H 67 60
REM, token 8FH: the word 6067H. REM is skipped to the end of the line, and ELSE at token 0A2H shares the same routine.
67E1-67E2
DEFW 437FH 7F 43
STOP, token 90H: the word 437FH. STOP breaks into command level and leaves the line number for CONT.
67E3-67E4
DEFW 6213H 13 62
PRINT, token 91H: the word 6213H. PRINT writes to the display or, after a file number, to a file.
67E5-67E6
DEFW 447EH 7E 44
CLEAR, token 92H: the word 447EH. CLEAR is the routine NEWB/EQU names CLEAR at 447EH, which is how this table was fixed.
67E7-67E8
DEFW 79B3H B3 79
LIST, token 93H: the word 79B3H. LIST shows lines, and LLIST at token 09EH goes to 79AEH three bytes below it.
67E9-67EA
DEFW 42ADH AD 42
NEW, token 94H: the word 42ADH. NEW throws the program away.
67EB-67EC
DEFW 60F2H F2 60
ON, token 95H: the word 60F2H. ON takes GOTO, GOSUB and ERROR after it.
67ED-67EE
DEFW 793FH 3F 79
WAIT, token 96H: the word 793FH. WAIT reads a port until it answers.
67EF-67F0
DEFW 7763H 63 77
DEF, token 97H: the word 7763H. DEF takes FN after it, the four type forms having their own tokens below.
67F1-67F2
DEFW 6555H 55 65
POKE, token 98H: the word 6555H. POKE writes one byte of memory.
67F3-67F4
DEFW 43DCH DC 43
CONT, token 99H: the word 43DCH. CONT carries on from a STOP or a BREAK.
67F5-67F6
DEFW 586CH 6C 58
token 9AH: the word 586CH. Token 09AH has no keyword in the reserved word table and the word holds SYNERR at 586CH, the Syntax error entry NEWB/EQU names, so a line byte of 09AH is refused rather than run.
67F7-67F8
DEFW 586CH 6C 58
token 9BH: the word 586CH. Token 09BH is the same: no keyword, and SYNERR at 586CH.
67F9-67FA
DEFW 7939H 39 79
OUT, token 9CH: the word 7939H. OUT writes one byte to a port.
67FB-67FC
DEFW 620BH 0B 62
LPRINT, token 9DH: the word 620BH. LPRINT prints to the printer.
67FD-67FE
DEFW 79AEH AE 79
LLIST, token 9EH: the word 79AEH. LLIST lists to the printer.
67FF-6800
DEFW 7E00H 00 7E
CLS, token 9FH: the word 7E00H. CLS clears the screen, and 7E00H is the routine that calls @CLS and zeroes 713CH.
6801-6802
DEFW 0000H 00 00
token A0H: the word 0000H. Token 0A0H has no keyword in the reserved word table and its word is 0000H, so nothing in a tokenized line can reach it.
6803-6804
DEFW 7960H 60 79
WIDTH, token A1H: the word 7960H. WIDTH sets the line width.
6805-6806
DEFW 6067H 67 60
ELSE, token A2H: the word 6067H. ELSE shares REM's routine at 6067H: once the IF has decided to run the rest of the line, ELSE and what follows it are skipped exactly as a remark is.
6807-6808
DEFW 43F0H F0 43
TRON, token A3H: the word 43F0H. TRON turns the trace on, and TROFF at token 0A4H is the next byte of the same routine at 43F1H.
6809-680A
DEFW 43F1H F1 43
TROFF, token A4H: the word 43F1H. TROFF turns it off, entering one byte past TRON.
680B-680C
DEFW 43F6H F6 43
SWAP, token A5H: the word 43F6H. SWAP exchanges two variables.
680D-680E
DEFW 4437H 37 44
ERASE, token A6H: the word 4437H. ERASE gives an array up.
680F-6810
DEFW 3D22H 22 3D
EDIT, token A7H: the word 3D22H. EDIT edits a line, and DOEDIT, which NEWB/EQU names at 3D27H, is five bytes into this routine.
6811-6812
DEFW 6190H 90 61
ERROR, token A8H: the word 6190H. ERROR raises an error of the number given.
6813-6814
DEFW 613BH 3B 61
RESUME, token A9H: the word 613BH. RESUME carries on after an error.
6815-6816
DEFW 7BF0H F0 7B
DELETE, token AAH: the word 7BF0H. DELETE removes lines.
6817-6818
DEFW 619BH 9B 61
AUTO, token ABH: the word 619BH. AUTO numbers lines as they are typed.
6819-681A
DEFW 658EH 8E 65
RENUM, token ACH: the word 658EH. RENUM is the one entry the enhancement package patches: 658EH holds the package's own CALL 833FH, which gives RENUM a default last line of 0FFFFH.
681B-681C
DEFW 5F49H 49 5F
DEFSTR, token ADH: the word 5F49H. DEFSTR, the first of the four DEF type statements, whose four routines stand three bytes apart at 5F49H, 5F4CH, 5F4FH and 5F52H.
681D-681E
DEFW 5F4CH 4C 5F
DEFINT, token AEH: the word 5F4CH. DEFINT, three bytes past DEFSTR.
681F-6820
DEFW 5F4FH 4F 5F
DEFSNG, token AFH: the word 5F4FH. DEFSNG, three bytes past DEFINT.
6821-6822
DEFW 5F52H 52 5F
DEFDBL, token B0H: the word 5F52H. DEFDBL, three bytes past DEFSNG, the four of them falling through to one body.
6823-6824
DEFW 6357H 57 63
LINE, token B1H: the word 6357H. LINE takes INPUT after it.
6825-6826
DEFW 0000H 00 00
token B2H: the word 0000H. Token 0B2H has no keyword and its word is 0000H.
6827-6828
DEFW 0000H 00 00
token B3H: the word 0000H. Token 0B3H has no keyword and its word is 0000H.
6829-682A
DEFW 52CAH CA 52
WHILE, token B4H: the word 52CAH. WHILE opens a loop, and WEND at token 0B5H closes it from 52EBH.
682B-682C
DEFW 52EBH EB 52
WEND, token B5H: the word 52EBH. WEND closes the WHILE loop.
682D-682E
DEFW 535AH 5A 53
CALL, token B6H: the word 535AH. CALL runs a machine language routine.
682F-6830
DEFW 56FBH FB 56
WRITE, token B7H: the word 56FBH. WRITE prints items separated by commas.
6831-6832
DEFW 6065H 65 60
COMMON, token B8H: the word 6065H. COMMON shares DATA's routine at 6065H, both being stepped over at run time, COMMON having done its work when the program was loaded.
6833-6834
DEFW 53EDH ED 53
CHAIN, token B9H: the word 53EDH. CHAIN loads another program and runs it.
6835-6836
DEFW 66BEH BE 66
OPTION, token BAH: the word 66BEH. OPTION takes BASE after it.
6837-6838
DEFW 7E85H 85 7E
RANDOM, token BBH: the word 7E85H. RANDOM reseeds the random number generator.
6839-683A
DEFW 0000H 00 00
token BCH: the word 0000H. Token 0BCH has no keyword and its word is 0000H.
683B-683C
DEFW 7ED4H D4 7E
SYSTEM, token BDH: the word 7ED4H. SYSTEM leaves BASIC for the DOS command line.
683D-683E
DEFW 0000H 00 00
token BEH: the word 0000H. Token 0BEH has no keyword and its word is 0000H.
683F-6840
DEFW 50D0H D0 50
OPEN, token BFH: the word 50D0H. OPEN opens a file.
6841-6842
DEFW 4DC2H C2 4D
FIELD, token C0H: the word 4DC2H. FIELD lays a random file buffer out.
6843-6844
DEFW 4FC7H C7 4F
GET, token C1H: the word 4FC7H. GET reads a record, and PUT at token 0C2H is one byte below it at 4FC6H, the two entering the same body.
6845-6846
DEFW 4FC6H C6 4F
PUT, token C2H: the word 4FC6H. PUT writes a record, one byte below GET.
6847-6848
DEFW 4D85H 85 4D
CLOSE, token C3H: the word 4D85H. CLOSE closes a file.
6849-684A
DEFW 4C21H 21 4C
LOAD, token C4H: the word 4C21H. LOAD loads a program, and the enhancement package's FASTLD is patched into the load it uses at 4C91H.
684B-684C
DEFW 4CDFH DF 4C
MERGE, token C5H: the word 4CDFH. MERGE loads a program over the one in memory.
684D-684E
DEFW 0000H 00 00
token C6H: the word 0000H. Token 0C6H has no keyword and its word is 0000H.
684F-6850
DEFW 7FCAH CA 7F
NAME, token C7H: the word 7FCAH. NAME renames a file.
6851-6852
DEFW 521EH 1E 52
KILL, token C8H: the word 521EH. KILL deletes a file, one of the keywords Logical Systems added.
6853-6854
DEFW 4E1FH 1F 4E
LSET, token C9H: the word 4E1FH. LSET stores left justified in a field, and RSET at token 0CAH is one byte below at 4E1EH.
6855-6856
DEFW 4E1EH 1E 4E
RSET, token CAH: the word 4E1EH. RSET stores right justified, entering one byte before LSET.
6857-6858
DEFW 4D1EH 1E 4D
SAVE, token CBH: the word 4D1EH. SAVE writes the program to a file, and FASTSAV is patched into its write at 4D76H.
6859-685A
DEFW 0000H 00 00
token CCH: the word 0000H. Token 0CCH has no keyword and its word is 0000H.
685B-685C
DEFW 7E8BH 8B 7E
SOUND, token CDH: the word 7E8BH. SOUND sounds a tone, the last of the statement tokens and another of the Logical Systems additions.

685DH - The Function Address Table (685DH-68C2H)

The table pass 38 found and this pass wrote, which answers question 12 of section 9: one word for each intrinsic function token from 01H to 33H, in token order, holding the address of the routine for that function. 766AH to 7672H is the whole of the dispatch, LD BC,685DH and ADD HL,BC with Register Pair HL holding twice the token less two, then the word is taken and JP (HL). Fifty-one words stand here and only forty-one tokens have a keyword in the reserved word table at 68F7H: the ten words for tokens 20H to 29H hold 0000H and the table is laid out for them all the same, so that the dispatch needs no test. Of the forty-one that are real, eight point into BASIC/OV1 at 2600H to 2FFFH, which are SGN, INT, ABS, LOG, CINT, CSNG, CDBL and FIX, and the other thirty-three point into module 1. (Pass 38 recorded thirty-one as the count pointing into BASIC/OV1; thirty-one is the count of the tokens 01H to 1FH, and the count of words that reach OV1 is eight, counted here from the bytes with the load map of section 3 beside them.) Seven of the module 1 entries, SQR, RND, SIN, EXP, COS, TAN and ATN, stand together at 36D4H to 39E6H with their constants, directly below the variable search at 39EDH, and three pairs of three, CVI with CVS and CVD and MKI$ with MKS$ and MKD$, are three bytes apart each, one jump apiece into a routine they share.

685D-685E
DEFW 48B8H B8 48
685DH to 685EH: the word 48B8H, the routine for LEFT$, token 01H, in module 1. Which takes its three arguments through the string helpers above it.
685F-6860
DEFW 48E8H E8 48
685FH to 6860H: the word 48E8H, the routine for RIGHT$, token 02H, in module 1.
6861-6862
DEFW 48F1H F1 48
6861H to 6862H: the word 48F1H, the routine for MID$, token 03H, in module 1.
6863-6864
DEFW 28FBH FB 28
6863H to 6864H: the word 28FBH, the routine for SGN, token 04H, in BASIC/OV1. SGN, INT, ABS and LOG are the four entries pass 33 read as the statement table running on past token 0CDH, and they are functions in BASIC/OV1.
6865-6866
DEFW 2AF5H F5 2A
6865H to 6866H: the word 2AF5H, the routine for INT, token 05H, in BASIC/OV1.
6867-6868
DEFW 28E6H E6 28
6867H to 6868H: the word 28E6H, the routine for ABS, token 06H, in BASIC/OV1.
6869-686A
DEFW 36D4H D4 36
6869H to 686AH: the word 36D4H, the routine for SQR, token 07H, in module 1. SQR, and with RND, SIN, EXP, COS, TAN and ATN below it one of the seven transcendental routines module 1 keeps at 36D4H to 39E6H, just under the variable search.
686B-686C
DEFW 3876H 76 38
686BH to 686CH: the word 3876H, the routine for RND, token 08H, in module 1.
686D-686E
DEFW 38F0H F0 38
686DH to 686EH: the word 38F0H, the routine for SIN, token 09H, in module 1.
686F-6870
DEFW 2746H 46 27
686FH to 6870H: the word 2746H, the routine for LOG, token 0AH, in BASIC/OV1.
6871-6872
DEFW 378FH 8F 37
6871H to 6872H: the word 378FH, the routine for EXP, token 0BH, in module 1.
6873-6874
DEFW 38EAH EA 38
6873H to 6874H: the word 38EAH, the routine for COS, token 0CH, in module 1.
6875-6876
DEFW 398DH 8D 39
6875H to 6876H: the word 398DH, the routine for TAN, token 0DH, in module 1.
6877-6878
DEFW 39A2H A2 39
6877H to 6878H: the word 39A2H, the routine for ATN, token 0EH, in module 1.
6879-687A
DEFW 4A69H 69 4A
6879H to 687AH: the word 4A69H, the routine for FRE, token 0FH, in module 1. FRE, which LIST also uses at 79AEH.
687B-687C
DEFW 7922H 22 79
687BH to 687CH: the word 7922H, the routine for INP, token 10H, in module 1.
687D-687E
DEFW 7708H 08 77
687DH to 687EH: the word 7708H, the routine for POS, token 11H, in module 1.
687F-6880
DEFW 484AH 4A 48
687FH to 6880H: the word 484AH, the routine for LEN, token 12H, in module 1.
6881-6882
DEFW 461EH 1E 46
6881H to 6882H: the word 461EH, the routine for STR$, token 13H, in module 1.
6883-6884
DEFW 4912H 12 49
6883H to 6884H: the word 4912H, the routine for VAL, token 14H, in module 1.
6885-6886
DEFW 4856H 56 48
6885H to 6886H: the word 4856H, the routine for ASC, token 15H, in module 1.
6887-6888
DEFW 4866H 66 48
6887H to 6888H: the word 4866H, the routine for CHR$, token 16H, in module 1.
6889-688A
DEFW 654BH 4B 65
6889H to 688AH: the word 654BH, the routine for PEEK, token 17H, in module 1. PEEK, which shares its routine with POKE at 654BH.
688B-688C
DEFW 489DH 9D 48
688BH to 688CH: the word 489DH, the routine for SPACE$, token 18H, in module 1.
688D-688E
DEFW 4614H 14 46
688DH to 688EH: the word 4614H, the routine for OCT$, token 19H, in module 1.
688F-6890
DEFW 4619H 19 46
688FH to 6890H: the word 4619H, the routine for HEX$, token 1AH, in module 1.
6891-6892
DEFW 7703H 03 77
6891H to 6892H: the word 7703H, the routine for LPOS, token 1BH, in module 1.
6893-6894
DEFW 29F4H F4 29
6893H to 6894H: the word 29F4H, the routine for CINT, token 1CH, in BASIC/OV1.
6895-6896
DEFW 2A6AH 6A 2A
6895H to 6896H: the word 2A6AH, the routine for CSNG, token 1DH, in BASIC/OV1.
6897-6898
DEFW 2A96H 96 2A
6897H to 6898H: the word 2A96H, the routine for CDBL, token 1EH, in BASIC/OV1.
6899-689A
DEFW 2AE2H E2 2A
6899H to 689AH: the word 2AE2H, the routine for FIX, token 1FH, in BASIC/OV1.
689B-68AE
DEFB 00H x 20 00 x 20
689BH to 68AEH: the ten words for the tokens 20H to 29H, which the reserved word table at 68F7H leaves without a keyword, so that no program can ever name one of them and the dispatch at 766DH can never reach these words. They are here because the table is indexed by the token itself and holding them costs twenty bytes where a test on every function call would cost more.
68AF-68B0
DEFW 4AE0H E0 4A
68AFH to 68B0H: the word 4AE0H, the routine for CVI, token 2AH, in module 1. CVI, CVS and CVD, three entries three bytes apart, which is one jump each into a routine they share.
68B1-68B2
DEFW 4AE3H E3 4A
68B1H to 68B2H: the word 4AE3H, the routine for CVS, token 2BH, in module 1.
68B3-68B4
DEFW 4AE6H E6 4A
68B3H to 68B4H: the word 4AE6H, the routine for CVD, token 2CH, in module 1.
68B5-68B6
DEFW 4F2DH 2D 4F
68B5H to 68B6H: the word 4F2DH, the routine for EOF, token 2DH, in module 1. EOF, whose routine stands with LOC and LOF in the file statement family.
68B7-68B8
DEFW 4F71H 71 4F
68B7H to 68B8H: the word 4F71H, the routine for LOC, token 2EH, in module 1.
68B9-68BA
DEFW 4F74H 74 4F
68B9H to 68BAH: the word 4F74H, the routine for LOF, token 2FH, in module 1.
68BB-68BC
DEFW 4AC7H C7 4A
68BBH to 68BCH: the word 4AC7H, the routine for MKI$, token 30H, in module 1. MKI$, MKS$ and MKD$, three entries three bytes apart like CVI, CVS and CVD above.
68BD-68BE
DEFW 4ACAH CA 4A
68BDH to 68BEH: the word 4ACAH, the routine for MKS$, token 31H, in module 1.
68BF-68C0
DEFW 4ACDH CD 4A
68BFH to 68C0H: the word 4ACDH, the routine for MKD$, token 32H, in module 1.
68C1-68C2
DEFW 7ECBH CB 7E
68C1H to 68C2H: the word 7ECBH, the routine for ROW, token 33H, in module 1. ROW, the last function token and the one the 6.3 enhancement added, whose routine stands with RANDOM, SOUND, TIME$ and DATE$ at 7E85H.

68C3H - The First Letter Table of the Reserved Words (68C3H-68F6H)

Twenty-six words, one for each letter of the alphabet in order, each the address at which the reserved word table's group for that letter begins. The tokenizer takes the first letter of the word it has found, indexes this table by it, and walks the group there. The table was fixed from the bytes: the twenty-six words run in ascending order from 68F7H to 6B31H, each one lands on the first character of a group whose words all begin with that letter, and the last two, for Y and Z, land on single 00H bytes, LS-DOS BASIC having no keyword that begins with either.

68C3-68C4
DEFW 68F7H F7 68
The word for the letter A: 68F7H, where the A group of the reserved word table begins. The 5 keywords of the A group run from there to 6906H.
68C5-68C6
DEFW 6908H 08 69
The word for the letter B: 6908H, where the B group of the reserved word table begins. The group is the single 00H byte at that address: no keyword of this BASIC begins with B.
68C7-68C8
DEFW 6909H 09 69
The word for the letter C: 6909H, where the C group of the reserved word table begins. The 15 keywords of the C group run from there to 6944H.
68C9-68CA
DEFW 6946H 46 69
The word for the letter D: 6946H, where the D group of the reserved word table begins. The 9 keywords of the D group run from there to 6972H.
68CB-68CC
DEFW 6974H 74 69
The word for the letter E: 6974H, where the E group of the reserved word table begins. The 11 keywords of the E group run from there to 699CH.
68CD-68CE
DEFW 699EH 9E 69
The word for the letter F: 699EH, where the F group of the reserved word table begins. The 5 keywords of the F group run from there to 69ADH.
68CF-68D0
DEFW 69AFH AF 69
The word for the letter G: 69AFH, where the G group of the reserved word table begins. The 4 keywords of the G group run from there to 69BFH.
68D1-68D2
DEFW 69C1H C1 69
The word for the letter H: 69C1H, where the H group of the reserved word table begins. The one keyword of the H group stands there.
68D3-68D4
DEFW 69C6H C6 69
The word for the letter I: 69C6H, where the I group of the reserved word table begins. The 7 keywords of the I group run from there to 69E0H.
68D5-68D6
DEFW 69E2H E2 69
The word for the letter J: 69E2H, where the J group of the reserved word table begins. The group is the single 00H byte at that address: no keyword of this BASIC begins with J.
68D7-68D8
DEFW 69E3H E3 69
The word for the letter K: 69E3H, where the K group of the reserved word table begins. The one keyword of the K group stands there.
68D9-68DA
DEFW 69E8H E8 69
The word for the letter L: 69E8H, where the L group of the reserved word table begins. The 13 keywords of the L group run from there to 6A1AH.
68DB-68DC
DEFW 6A1CH 1C 6A
The word for the letter M: 6A1CH, where the M group of the reserved word table begins. The 7 keywords of the M group run from there to 6A36H.
68DD-68DE
DEFW 6A38H 38 6A
The word for the letter N: 6A38H, where the N group of the reserved word table begins. The 4 keywords of the N group run from there to 6A45H.
68DF-68E0
DEFW 6A47H 47 6A
The word for the letter O: 6A47H, where the O group of the reserved word table begins. The 6 keywords of the O group run from there to 6A5BH.
68E1-68E2
DEFW 6A5DH 5D 6A
The word for the letter P: 6A5DH, where the P group of the reserved word table begins. The 5 keywords of the P group run from there to 6A6FH.
68E3-68E4
DEFW 6A71H 71 6A
The word for the letter Q: 6A71H, where the Q group of the reserved word table begins. The group is the single 00H byte at that address: no keyword of this BASIC begins with Q.
68E5-68E6
DEFW 6A72H 72 6A
The word for the letter R: 6A72H, where the R group of the reserved word table begins. The 12 keywords of the R group run from there to 6AA9H.
68E7-68E8
DEFW 6AABH AB 6A
The word for the letter S: 6AABH, where the S group of the reserved word table begins. The 13 keywords of the S group run from there to 6AE3H.
68E9-68EA
DEFW 6AE5H E5 6A
The word for the letter T: 6AE5H, where the T group of the reserved word table begins. The 7 keywords of the T group run from there to 6AFFH.
68EB-68EC
DEFW 6B01H 01 6B
The word for the letter U: 6B01H, where the U group of the reserved word table begins. The 2 keywords of the U group run from there to 6B08H.
68ED-68EE
DEFW 6B0AH 0A 6B
The word for the letter V: 6B0AH, where the V group of the reserved word table begins. The 2 keywords of the V group run from there to 6B12H.
68EF-68F0
DEFW 6B14H 14 6B
The word for the letter W: 6B14H, where the W group of the reserved word table begins. The 5 keywords of the W group run from there to 6B2AH.
68F1-68F2
DEFW 6B2CH 2C 6B
The word for the letter X: 6B2CH, where the X group of the reserved word table begins. The one keyword of the X group stands there.
68F3-68F4
DEFW 6B30H 30 6B
The word for the letter Y: 6B30H, where the Y group of the reserved word table begins. The group is the single 00H byte at that address: no keyword of this BASIC begins with Y.
68F5-68F6
DEFW 6B31H 31 6B
The word for the letter Z: 6B31H, where the Z group of the reserved word table begins. The group is the single 00H byte at that address: no keyword of this BASIC begins with Z.

68F7H - The Reserved Word Table (68F7H-6B31H)

The reserved words themselves, in twenty-six groups, one for each first letter and each ended by a 00H byte. The first letter is not stored: the group's address in the table at 68C3H says what it is, and the bytes hold the rest of the word with the high bit set on its last character, then the token. One hundred and thirty-five keywords are stored this way. A token of 081H and above is a statement or an operand word and has its word in the table at 67C3H; a token below 080H is one of the intrinsic functions, whose routine is reached through a table of its own, the function address table at 685DH, which pass 39 wrote. The ten operator characters have a short table of the same shape at 6B32H.

68F7-68FA
DEFM "UT" / DEFB 0CFH, 0ABH 55 54 CF AB
68F7H: the characters "UT" and with the high bit set on the 0CFH, which with the letter A of this group spells AUTO. Token 0ABH, whose word in the statement address table stands at 6817H and holds 619BH.
68FB-68FD
DEFM "N" / DEFB 0C4H, 0F8H 4E C4 F8
68FBH: the characters "N" and with the high bit set on the 0C4H, which with the letter A of this group spells AND. Token 0F8H, which is above the statement tokens of the table at 67C3H.
68FE-6900
DEFM "B" / DEFB 0D3H, 06H 42 D3 06
68FEH: the characters "B" and with the high bit set on the 0D3H, which with the letter A of this group spells ABS. Token 06H is below 080H, so ABS is an intrinsic function.
6901-6903
DEFM "T" / DEFB 0CEH, 0EH 54 CE 0E
6901H: the characters "T" and with the high bit set on the 0CEH, which with the letter A of this group spells ATN. Token 0EH is below 080H, so ATN is an intrinsic function.
6904-6906
DEFM "S" / DEFB 0C3H, 15H 53 C3 15
6904H: the characters "S" and with the high bit set on the 0C3H, which with the letter A of this group spells ASC. Token 15H is below 080H, so ASC is an intrinsic function.
6907
DEFB 00H 00
The 00H byte that ends the A group of the reserved word table. The B group begins at the next byte, 6908H.
6908
DEFB 00H 00
The 00H byte that ends the B group of the reserved word table. The C group begins at the next byte, 6909H.
6909-690D
DEFM "LOS" / DEFB 0C5H, 0C3H 4C 4F 53 C5 C3
6909H: the characters "LOS" and with the high bit set on the 0C5H, which with the letter C of this group spells CLOSE. Token 0C3H, whose word in the statement address table stands at 6847H and holds 4D85H.
690E-6911
DEFM "ON" / DEFB 0D4H, 99H 4F 4E D4 99
690EH: the characters "ON" and with the high bit set on the 0D4H, which with the letter C of this group spells CONT. Token 99H, whose word in the statement address table stands at 67F3H and holds 43DCH.
6912-6916
DEFM "LEA" / DEFB 0D2H, 92H 4C 45 41 D2 92
6912H: the characters "LEA" and with the high bit set on the 0D2H, which with the letter C of this group spells CLEAR. Token 92H, whose word in the statement address table stands at 67E5H and holds 447EH.
6917-691A
DEFM "IN" / DEFB 0D4H, 1CH 49 4E D4 1C
6917H: the characters "IN" and with the high bit set on the 0D4H, which with the letter C of this group spells CINT. Token 1CH is below 080H, so CINT is an intrinsic function.
691B-691E
DEFM "SN" / DEFB 0C7H, 1DH 53 4E C7 1D
691BH: the characters "SN" and with the high bit set on the 0C7H, which with the letter C of this group spells CSNG. Token 1DH is below 080H, so CSNG is an intrinsic function.
691F-6922
DEFM "DB" / DEFB 0CCH, 1EH 44 42 CC 1E
691FH: the characters "DB" and with the high bit set on the 0CCH, which with the letter C of this group spells CDBL. Token 1EH is below 080H, so CDBL is an intrinsic function.
6923-6925
DEFM "V" / DEFB 0C9H, 2AH 56 C9 2A
6923H: the characters "V" and with the high bit set on the 0C9H, which with the letter C of this group spells CVI. Token 2AH is below 080H, so CVI is an intrinsic function.
6926-6928
DEFM "V" / DEFB 0D3H, 2BH 56 D3 2B
6926H: the characters "V" and with the high bit set on the 0D3H, which with the letter C of this group spells CVS. Token 2BH is below 080H, so CVS is an intrinsic function.
6929-692B
DEFM "V" / DEFB 0C4H, 2CH 56 C4 2C
6929H: the characters "V" and with the high bit set on the 0C4H, which with the letter C of this group spells CVD. Token 2CH is below 080H, so CVD is an intrinsic function.
692C-692E
DEFM "O" / DEFB 0D3H, 0CH 4F D3 0C
692CH: the characters "O" and with the high bit set on the 0D3H, which with the letter C of this group spells COS. Token 0CH is below 080H, so COS is an intrinsic function.
692F-6932
DEFM "HR" / DEFB 0A4H, 16H 48 52 A4 16
692FH: the characters "HR" and with the high bit set on the 0A4H, which with the letter C of this group spells CHR$. Token 16H is below 080H, so CHR$ is an intrinsic function.
6933-6936
DEFM "AL" / DEFB 0CCH, 0B6H 41 4C CC B6
6933H: the characters "AL" and with the high bit set on the 0CCH, which with the letter C of this group spells CALL. Token 0B6H, whose word in the statement address table stands at 682DH and holds 535AH.
6937-693C
DEFM "OMMO" / DEFB 0CEH, 0B8H 4F 4D 4D 4F CE B8
6937H: the characters "OMMO" and with the high bit set on the 0CEH, which with the letter C of this group spells COMMON. Token 0B8H, whose word in the statement address table stands at 6831H and holds 6065H.
693D-6941
DEFM "HAI" / DEFB 0CEH, 0B9H 48 41 49 CE B9
693DH: the characters "HAI" and with the high bit set on the 0CEH, which with the letter C of this group spells CHAIN. Token 0B9H, whose word in the statement address table stands at 6833H and holds 53EDH.
6942-6944
DEFM "L" / DEFB 0D3H, 9FH 4C D3 9F
6942H: the characters "L" and with the high bit set on the 0D3H, which with the letter C of this group spells CLS. Token 9FH, whose word in the statement address table stands at 67FFH and holds 7E00H.
6945
DEFB 00H 00
The 00H byte that ends the C group of the reserved word table. The D group begins at the next byte, 6946H.
6946-694B
DEFM "ELET" / DEFB 0C5H, 0AAH 45 4C 45 54 C5 AA
6946H: the characters "ELET" and with the high bit set on the 0C5H, which with the letter D of this group spells DELETE. Token 0AAH, whose word in the statement address table stands at 6815H and holds 7BF0H.
694C-694F
DEFM "AT" / DEFB 0C1H, 84H 41 54 C1 84
694CH: the characters "AT" and with the high bit set on the 0C1H, which with the letter D of this group spells DATA. Token 84H, whose word in the statement address table stands at 67C9H and holds 6065H.
6950-6952
DEFM "I" / DEFB 0CDH, 86H 49 CD 86
6950H: the characters "I" and with the high bit set on the 0CDH, which with the letter D of this group spells DIM. Token 86H, whose word in the statement address table stands at 67CDH and holds 39F6H.
6953-6958
DEFM "EFST" / DEFB 0D2H, 0ADH 45 46 53 54 D2 AD
6953H: the characters "EFST" and with the high bit set on the 0D2H, which with the letter D of this group spells DEFSTR. Token 0ADH, whose word in the statement address table stands at 681BH and holds 5F49H.
6959-695E
DEFM "EFIN" / DEFB 0D4H, 0AEH 45 46 49 4E D4 AE
6959H: the characters "EFIN" and with the high bit set on the 0D4H, which with the letter D of this group spells DEFINT. Token 0AEH, whose word in the statement address table stands at 681DH and holds 5F4CH.
695F-6964
DEFM "EFSN" / DEFB 0C7H, 0AFH 45 46 53 4E C7 AF
695FH: the characters "EFSN" and with the high bit set on the 0C7H, which with the letter D of this group spells DEFSNG. Token 0AFH, whose word in the statement address table stands at 681FH and holds 5F4FH.
6965-696A
DEFM "EFDB" / DEFB 0CCH, 0B0H 45 46 44 42 CC B0
6965H: the characters "EFDB" and with the high bit set on the 0CCH, which with the letter D of this group spells DEFDBL. Token 0B0H, whose word in the statement address table stands at 6821H and holds 5F52H.
696B-696D
DEFM "E" / DEFB 0C6H, 97H 45 C6 97
696BH: the characters "E" and with the high bit set on the 0C6H, which with the letter D of this group spells DEF. Token 97H, whose word in the statement address table stands at 67EFH and holds 7763H.
696E-6972
DEFM "ATE" / DEFB 0A4H, 0DEH 41 54 45 A4 DE
696EH: the characters "ATE" and with the high bit set on the 0A4H, which with the letter D of this group spells DATE$. Token 0DEH, which is above the statement tokens of the table at 67C3H. One of the keywords Logical Systems added, token 0DEH being above the statement tokens.
6973
DEFB 00H 00
The 00H byte that ends the D group of the reserved word table. The E group begins at the next byte, 6974H.
6974-6977
DEFM "LS" / DEFB 0C5H, 0A2H 4C 53 C5 A2
6974H: the characters "LS" and with the high bit set on the 0C5H, which with the letter E of this group spells ELSE. Token 0A2H, whose word in the statement address table stands at 6805H and holds 6067H.
6978-697A
DEFM "N" / DEFB 0C4H, 81H 4E C4 81
6978H: the characters "N" and with the high bit set on the 0C4H, which with the letter E of this group spells END. Token 81H, whose word in the statement address table stands at 67C3H and holds 4383H.
697B-697F
DEFM "RAS" / DEFB 0C5H, 0A6H 52 41 53 C5 A6
697BH: the characters "RAS" and with the high bit set on the 0C5H, which with the letter E of this group spells ERASE. Token 0A6H, whose word in the statement address table stands at 680DH and holds 4437H.
6980-6983
DEFM "DI" / DEFB 0D4H, 0A7H 44 49 D4 A7
6980H: the characters "DI" and with the high bit set on the 0D4H, which with the letter E of this group spells EDIT. Token 0A7H, whose word in the statement address table stands at 680FH and holds 3D22H.
6984-6988
DEFM "RRS" / DEFB 0A4H, 0DFH 52 52 53 A4 DF
6984H: the characters "RRS" and with the high bit set on the 0A4H, which with the letter E of this group spells ERRS$. Token 0DFH, which is above the statement tokens of the table at 67C3H. Token 0DFH, above the statement tokens.
6989-698D
DEFM "RRO" / DEFB 0D2H, 0A8H 52 52 4F D2 A8
6989H: the characters "RRO" and with the high bit set on the 0D2H, which with the letter E of this group spells ERROR. Token 0A8H, whose word in the statement address table stands at 6811H and holds 6190H.
698E-6990
DEFM "R" / DEFB 0CCH, 0D7H 52 CC D7
698EH: the characters "R" and with the high bit set on the 0CCH, which with the letter E of this group spells ERL. Token 0D7H, which is above the statement tokens of the table at 67C3H.
6991-6993
DEFM "R" / DEFB 0D2H, 0D8H 52 D2 D8
6991H: the characters "R" and with the high bit set on the 0D2H, which with the letter E of this group spells ERR. Token 0D8H, which is above the statement tokens of the table at 67C3H.
6994-6996
DEFM "X" / DEFB 0D0H, 0BH 58 D0 0B
6994H: the characters "X" and with the high bit set on the 0D0H, which with the letter E of this group spells EXP. Token 0BH is below 080H, so EXP is an intrinsic function.
6997-6999
DEFM "O" / DEFB 0C6H, 2DH 4F C6 2D
6997H: the characters "O" and with the high bit set on the 0C6H, which with the letter E of this group spells EOF. Token 2DH is below 080H, so EOF is an intrinsic function.
699A-699C
DEFM "Q" / DEFB 0D6H, 0FBH 51 D6 FB
699AH: the characters "Q" and with the high bit set on the 0D6H, which with the letter E of this group spells EQV. Token 0FBH, which is above the statement tokens of the table at 67C3H.
699D
DEFB 00H 00
The 00H byte that ends the E group of the reserved word table. The F group begins at the next byte, 699EH.
699E-69A0
DEFM "O" / DEFB 0D2H, 82H 4F D2 82
699EH: the characters "O" and with the high bit set on the 0D2H, which with the letter F of this group spells FOR. Token 82H, whose word in the statement address table stands at 67C5H and holds 5D5AH.
69A1-69A5
DEFM "IEL" / DEFB 0C4H, 0C0H 49 45 4C C4 C0
69A1H: the characters "IEL" and with the high bit set on the 0C4H, which with the letter F of this group spells FIELD. Token 0C0H, whose word in the statement address table stands at 6841H and holds 4DC2H.
69A6-69A7
DEFB 0CEH, 0D4H CE D4
69A6H: the characters with the high bit set on the 0CEH, which with the letter F of this group spells FN. Token 0D4H, which is above the statement tokens of the table at 67C3H.
69A8-69AA
DEFM "R" / DEFB 0C5H, 0FH 52 C5 0F
69A8H: the characters "R" and with the high bit set on the 0C5H, which with the letter F of this group spells FRE. Token 0FH is below 080H, so FRE is an intrinsic function.
69AB-69AD
DEFM "I" / DEFB 0D8H, 1FH 49 D8 1F
69ABH: the characters "I" and with the high bit set on the 0D8H, which with the letter F of this group spells FIX. Token 1FH is below 080H, so FIX is an intrinsic function.
69AE
DEFB 00H 00
The 00H byte that ends the F group of the reserved word table. The G group begins at the next byte, 69AFH.
69AF-69B2
DEFM "OT" / DEFB 0CFH, 89H 4F 54 CF 89
69AFH: the characters "OT" and with the high bit set on the 0CFH, which with the letter G of this group spells GOTO. Token 89H, whose word in the statement address table stands at 67D3H and holds 600AH.
69B3-69B7
DEFM "O T" / DEFB 0CFH, 89H 4F 20 54 CF 89
69B3H: the characters "O T" and with the high bit set on the 0CFH, which with the letter G of this group spells GO TO. Token 89H, whose word in the statement address table stands at 67D3H and holds 600AH. The second spelling of the GOTO keyword, token 89H, the space being part of the stored characters: both spellings tokenize to the same byte, so a listing shows whichever spelling the table reaches first.
69B8-69BC
DEFM "OSU" / DEFB 0C2H, 8DH 4F 53 55 C2 8D
69B8H: the characters "OSU" and with the high bit set on the 0C2H, which with the letter G of this group spells GOSUB. Token 8DH, whose word in the statement address table stands at 67DBH and holds 5FF3H.
69BD-69BF
DEFM "E" / DEFB 0D4H, 0C1H 45 D4 C1
69BDH: the characters "E" and with the high bit set on the 0D4H, which with the letter G of this group spells GET. Token 0C1H, whose word in the statement address table stands at 6843H and holds 4FC7H.
69C0
DEFB 00H 00
The 00H byte that ends the G group of the reserved word table. The H group begins at the next byte, 69C1H.
69C1-69C4
DEFM "EX" / DEFB 0A4H, 1AH 45 58 A4 1A
69C1H: the characters "EX" and with the high bit set on the 0A4H, which with the letter H of this group spells HEX$. Token 1AH is below 080H, so HEX$ is an intrinsic function.
69C5
DEFB 00H 00
The 00H byte that ends the H group of the reserved word table. The I group begins at the next byte, 69C6H.
69C6-69CA
DEFM "NPU" / DEFB 0D4H, 85H 4E 50 55 D4 85
69C6H: the characters "NPU" and with the high bit set on the 0D4H, which with the letter I of this group spells INPUT. Token 85H, whose word in the statement address table stands at 67CBH and holds 63C2H.
69CB-69CC
DEFB 0C6H, 8BH C6 8B
69CBH: the characters with the high bit set on the 0C6H, which with the letter I of this group spells IF. Token 8BH, whose word in the statement address table stands at 67D7H and holds 61CDH.
69CD-69D1
DEFM "NST" / DEFB 0D2H, 0DBH 4E 53 54 D2 DB
69CDH: the characters "NST" and with the high bit set on the 0D2H, which with the letter I of this group spells INSTR. Token 0DBH, which is above the statement tokens of the table at 67C3H.
69D2-69D4
DEFM "N" / DEFB 0D4H, 05H 4E D4 05
69D2H: the characters "N" and with the high bit set on the 0D4H, which with the letter I of this group spells INT. Token 05H is below 080H, so INT is an intrinsic function.
69D5-69D7
DEFM "N" / DEFB 0D0H, 10H 4E D0 10
69D5H: the characters "N" and with the high bit set on the 0D0H, which with the letter I of this group spells INP. Token 10H is below 080H, so INP is an intrinsic function.
69D8-69DA
DEFM "M" / DEFB 0D0H, 0FCH 4D D0 FC
69D8H: the characters "M" and with the high bit set on the 0D0H, which with the letter I of this group spells IMP. Token 0FCH, which is above the statement tokens of the table at 67C3H.
69DB-69E0
DEFM "NKEY" / DEFB 0A4H, 0E0H 4E 4B 45 59 A4 E0
69DBH: the characters "NKEY" and with the high bit set on the 0A4H, which with the letter I of this group spells INKEY$. Token 0E0H, which is above the statement tokens of the table at 67C3H.
69E1
DEFB 00H 00
The 00H byte that ends the I group of the reserved word table. The J group begins at the next byte, 69E2H.
69E2
DEFB 00H 00
The 00H byte that ends the J group of the reserved word table. The K group begins at the next byte, 69E3H.
69E3-69E6
DEFM "IL" / DEFB 0CCH, 0C8H 49 4C CC C8
69E3H: the characters "IL" and with the high bit set on the 0CCH, which with the letter K of this group spells KILL. Token 0C8H, whose word in the statement address table stands at 6851H and holds 521EH. One of the keywords Logical Systems added.
69E7
DEFB 00H 00
The 00H byte that ends the K group of the reserved word table. The L group begins at the next byte, 69E8H.
69E8-69ED
DEFM "PRIN" / DEFB 0D4H, 9DH 50 52 49 4E D4 9D
69E8H: the characters "PRIN" and with the high bit set on the 0D4H, which with the letter L of this group spells LPRINT. Token 9DH, whose word in the statement address table stands at 67FBH and holds 620BH.
69EE-69F2
DEFM "LIS" / DEFB 0D4H, 9EH 4C 49 53 D4 9E
69EEH: the characters "LIS" and with the high bit set on the 0D4H, which with the letter L of this group spells LLIST. Token 9EH, whose word in the statement address table stands at 67FDH and holds 79AEH.
69F3-69F6
DEFM "PO" / DEFB 0D3H, 1BH 50 4F D3 1B
69F3H: the characters "PO" and with the high bit set on the 0D3H, which with the letter L of this group spells LPOS. Token 1BH is below 080H, so LPOS is an intrinsic function.
69F7-69F9
DEFM "E" / DEFB 0D4H, 88H 45 D4 88
69F7H: the characters "E" and with the high bit set on the 0D4H, which with the letter L of this group spells LET. Token 88H, whose word in the statement address table stands at 67D1H and holds 608CH.
69FA-69FD
DEFM "IN" / DEFB 0C5H, 0B1H 49 4E C5 B1
69FAH: the characters "IN" and with the high bit set on the 0C5H, which with the letter L of this group spells LINE. Token 0B1H, whose word in the statement address table stands at 6823H and holds 6357H.
69FE-6A01
DEFM "OA" / DEFB 0C4H, 0C4H 4F 41 C4 C4
69FEH: the characters "OA" and with the high bit set on the 0C4H, which with the letter L of this group spells LOAD. Token 0C4H, whose word in the statement address table stands at 6849H and holds 4C21H.
6A02-6A05
DEFM "SE" / DEFB 0D4H, 0C9H 53 45 D4 C9
6A02H: the characters "SE" and with the high bit set on the 0D4H, which with the letter L of this group spells LSET. Token 0C9H, whose word in the statement address table stands at 6853H and holds 4E1FH.
6A06-6A09
DEFM "IS" / DEFB 0D4H, 93H 49 53 D4 93
6A06H: the characters "IS" and with the high bit set on the 0D4H, which with the letter L of this group spells LIST. Token 93H, whose word in the statement address table stands at 67E7H and holds 79B3H.
6A0A-6A0C
DEFM "O" / DEFB 0C7H, 0AH 4F C7 0A
6A0AH: the characters "O" and with the high bit set on the 0C7H, which with the letter L of this group spells LOG. Token 0AH is below 080H, so LOG is an intrinsic function.
6A0D-6A0F
DEFM "O" / DEFB 0C3H, 2EH 4F C3 2E
6A0DH: the characters "O" and with the high bit set on the 0C3H, which with the letter L of this group spells LOC. Token 2EH is below 080H, so LOC is an intrinsic function.
6A10-6A12
DEFM "E" / DEFB 0CEH, 12H 45 CE 12
6A10H: the characters "E" and with the high bit set on the 0CEH, which with the letter L of this group spells LEN. Token 12H is below 080H, so LEN is an intrinsic function.
6A13-6A17
DEFM "EFT" / DEFB 0A4H, 01H 45 46 54 A4 01
6A13H: the characters "EFT" and with the high bit set on the 0A4H, which with the letter L of this group spells LEFT$. Token 01H is below 080H, so LEFT$ is an intrinsic function.
6A18-6A1A
DEFM "O" / DEFB 0C6H, 2FH 4F C6 2F
6A18H: the characters "O" and with the high bit set on the 0C6H, which with the letter L of this group spells LOF. Token 2FH is below 080H, so LOF is an intrinsic function.
6A1B
DEFB 00H 00
The 00H byte that ends the L group of the reserved word table. The M group begins at the next byte, 6A1CH.
6A1C-6A20
DEFM "ERG" / DEFB 0C5H, 0C5H 45 52 47 C5 C5
6A1CH: the characters "ERG" and with the high bit set on the 0C5H, which with the letter M of this group spells MERGE. Token 0C5H, whose word in the statement address table stands at 684BH and holds 4CDFH.
6A21-6A23
DEFM "O" / DEFB 0C4H, 0FDH 4F C4 FD
6A21H: the characters "O" and with the high bit set on the 0C4H, which with the letter M of this group spells MOD. Token 0FDH, which is above the statement tokens of the table at 67C3H.
6A24-6A27
DEFM "KI" / DEFB 0A4H, 30H 4B 49 A4 30
6A24H: the characters "KI" and with the high bit set on the 0A4H, which with the letter M of this group spells MKI$. Token 30H is below 080H, so MKI$ is an intrinsic function.
6A28-6A2B
DEFM "KS" / DEFB 0A4H, 31H 4B 53 A4 31
6A28H: the characters "KS" and with the high bit set on the 0A4H, which with the letter M of this group spells MKS$. Token 31H is below 080H, so MKS$ is an intrinsic function.
6A2C-6A2F
DEFM "KD" / DEFB 0A4H, 32H 4B 44 A4 32
6A2CH: the characters "KD" and with the high bit set on the 0A4H, which with the letter M of this group spells MKD$. Token 32H is below 080H, so MKD$ is an intrinsic function.
6A30-6A33
DEFM "ID" / DEFB 0A4H, 03H 49 44 A4 03
6A30H: the characters "ID" and with the high bit set on the 0A4H, which with the letter M of this group spells MID$. Token 03H is below 080H, so MID$ is an intrinsic function.
6A34-6A36
DEFM "E" / DEFB 0CDH, 0E1H 45 CD E1
6A34H: the characters "E" and with the high bit set on the 0CDH, which with the letter M of this group spells MEM. Token 0E1H, which is above the statement tokens of the table at 67C3H. One of the keywords Logical Systems added.
6A37
DEFB 00H 00
The 00H byte that ends the M group of the reserved word table. The N group begins at the next byte, 6A38H.
6A38-6A3B
DEFM "EX" / DEFB 0D4H, 83H 45 58 D4 83
6A38H: the characters "EX" and with the high bit set on the 0D4H, which with the letter N of this group spells NEXT. Token 83H, whose word in the statement address table stands at 67C7H and holds 4527H.
6A3C-6A3F
DEFM "AM" / DEFB 0C5H, 0C7H 41 4D C5 C7
6A3CH: the characters "AM" and with the high bit set on the 0C5H, which with the letter N of this group spells NAME. Token 0C7H, whose word in the statement address table stands at 684FH and holds 7FCAH.
6A40-6A42
DEFM "E" / DEFB 0D7H, 94H 45 D7 94
6A40H: the characters "E" and with the high bit set on the 0D7H, which with the letter N of this group spells NEW. Token 94H, whose word in the statement address table stands at 67E9H and holds 42ADH.
6A43-6A45
DEFM "O" / DEFB 0D4H, 0D6H 4F D4 D6
6A43H: the characters "O" and with the high bit set on the 0D4H, which with the letter N of this group spells NOT. Token 0D6H, which is above the statement tokens of the table at 67C3H.
6A46
DEFB 00H 00
The 00H byte that ends the N group of the reserved word table. The O group begins at the next byte, 6A47H.
6A47-6A4A
DEFM "PE" / DEFB 0CEH, 0BFH 50 45 CE BF
6A47H: the characters "PE" and with the high bit set on the 0CEH, which with the letter O of this group spells OPEN. Token 0BFH, whose word in the statement address table stands at 683FH and holds 50D0H.
6A4B-6A4D
DEFM "U" / DEFB 0D4H, 9CH 55 D4 9C
6A4BH: the characters "U" and with the high bit set on the 0D4H, which with the letter O of this group spells OUT. Token 9CH, whose word in the statement address table stands at 67F9H and holds 7939H.
6A4E-6A4F
DEFB 0CEH, 95H CE 95
6A4EH: the characters with the high bit set on the 0CEH, which with the letter O of this group spells ON. Token 95H, whose word in the statement address table stands at 67EBH and holds 60F2H.
6A50-6A51
DEFB 0D2H, 0F9H D2 F9
6A50H: the characters with the high bit set on the 0D2H, which with the letter O of this group spells OR. Token 0F9H, which is above the statement tokens of the table at 67C3H.
6A52-6A55
DEFM "CT" / DEFB 0A4H, 19H 43 54 A4 19
6A52H: the characters "CT" and with the high bit set on the 0A4H, which with the letter O of this group spells OCT$. Token 19H is below 080H, so OCT$ is an intrinsic function.
6A56-6A5B
DEFM "PTIO" / DEFB 0CEH, 0BAH 50 54 49 4F CE BA
6A56H: the characters "PTIO" and with the high bit set on the 0CEH, which with the letter O of this group spells OPTION. Token 0BAH, whose word in the statement address table stands at 6835H and holds 66BEH.
6A5C
DEFB 00H 00
The 00H byte that ends the O group of the reserved word table. The P group begins at the next byte, 6A5DH.
6A5D-6A61
DEFM "RIN" / DEFB 0D4H, 91H 52 49 4E D4 91
6A5DH: the characters "RIN" and with the high bit set on the 0D4H, which with the letter P of this group spells PRINT. Token 91H, whose word in the statement address table stands at 67E3H and holds 6213H.
6A62-6A64
DEFM "U" / DEFB 0D4H, 0C2H 55 D4 C2
6A62H: the characters "U" and with the high bit set on the 0D4H, which with the letter P of this group spells PUT. Token 0C2H, whose word in the statement address table stands at 6845H and holds 4FC6H.
6A65-6A68
DEFM "OK" / DEFB 0C5H, 98H 4F 4B C5 98
6A65H: the characters "OK" and with the high bit set on the 0C5H, which with the letter P of this group spells POKE. Token 98H, whose word in the statement address table stands at 67F1H and holds 6555H.
6A69-6A6B
DEFM "O" / DEFB 0D3H, 11H 4F D3 11
6A69H: the characters "O" and with the high bit set on the 0D3H, which with the letter P of this group spells POS. Token 11H is below 080H, so POS is an intrinsic function.
6A6C-6A6F
DEFM "EE" / DEFB 0CBH, 17H 45 45 CB 17
6A6CH: the characters "EE" and with the high bit set on the 0CBH, which with the letter P of this group spells PEEK. Token 17H is below 080H, so PEEK is an intrinsic function.
6A70
DEFB 00H 00
The 00H byte that ends the P group of the reserved word table. The Q group begins at the next byte, 6A71H.
6A71
DEFB 00H 00
The 00H byte that ends the Q group of the reserved word table. The R group begins at the next byte, 6A72H.
6A72-6A77
DEFM "ETUR" / DEFB 0CEH, 8EH 45 54 55 52 CE 8E
6A72H: the characters "ETUR" and with the high bit set on the 0CEH, which with the letter R of this group spells RETURN. Token 8EH, whose word in the statement address table stands at 67DDH and holds 6045H.
6A78-6A7B
DEFM "EA" / DEFB 0C4H, 87H 45 41 C4 87
6A78H: the characters "EA" and with the high bit set on the 0C4H, which with the letter R of this group spells READ. Token 87H, whose word in the statement address table stands at 67CFH and holds 649DH.
6A7C-6A7E
DEFM "U" / DEFB 0CEH, 8AH 55 CE 8A
6A7CH: the characters "U" and with the high bit set on the 0CEH, which with the letter R of this group spells RUN. Token 8AH, whose word in the statement address table stands at 67D5H and holds 5FDFH.
6A7F-6A85
DEFM "ESTOR" / DEFB 0C5H, 8CH 45 53 54 4F 52 C5 8C
6A7FH: the characters "ESTOR" and with the high bit set on the 0C5H, which with the letter R of this group spells RESTORE. Token 8CH, whose word in the statement address table stands at 67D9H and holds 4365H.
6A86-6A88
DEFM "E" / DEFB 0CDH, 8FH 45 CD 8F
6A86H: the characters "E" and with the high bit set on the 0CDH, which with the letter R of this group spells REM. Token 8FH, whose word in the statement address table stands at 67DFH and holds 6067H.
6A89-6A8E
DEFM "ESUM" / DEFB 0C5H, 0A9H 45 53 55 4D C5 A9
6A89H: the characters "ESUM" and with the high bit set on the 0C5H, which with the letter R of this group spells RESUME. Token 0A9H, whose word in the statement address table stands at 6813H and holds 613BH.
6A8F-6A92
DEFM "SE" / DEFB 0D4H, 0CAH 53 45 D4 CA
6A8FH: the characters "SE" and with the high bit set on the 0D4H, which with the letter R of this group spells RSET. Token 0CAH, whose word in the statement address table stands at 6855H and holds 4E1EH.
6A93-6A98
DEFM "IGHT" / DEFB 0A4H, 02H 49 47 48 54 A4 02
6A93H: the characters "IGHT" and with the high bit set on the 0A4H, which with the letter R of this group spells RIGHT$. Token 02H is below 080H, so RIGHT$ is an intrinsic function.
6A99-6A9B
DEFM "N" / DEFB 0C4H, 08H 4E C4 08
6A99H: the characters "N" and with the high bit set on the 0C4H, which with the letter R of this group spells RND. Token 08H is below 080H, so RND is an intrinsic function.
6A9C-6AA0
DEFM "ENU" / DEFB 0CDH, 0ACH 45 4E 55 CD AC
6A9CH: the characters "ENU" and with the high bit set on the 0CDH, which with the letter R of this group spells RENUM. Token 0ACH, whose word in the statement address table stands at 6819H and holds 658EH.
6AA1-6AA6
DEFM "ANDO" / DEFB 0CDH, 0BBH 41 4E 44 4F CD BB
6AA1H: the characters "ANDO" and with the high bit set on the 0CDH, which with the letter R of this group spells RANDOM. Token 0BBH, whose word in the statement address table stands at 6837H and holds 7E85H.
6AA7-6AA9
DEFM "O" / DEFB 0D7H, 33H 4F D7 33
6AA7H: the characters "O" and with the high bit set on the 0D7H, which with the letter R of this group spells ROW. Token 33H is below 080H, so ROW is an intrinsic function. One of the keywords Logical Systems added to the Microsoft interpreter.
6AAA
DEFB 00H 00
The 00H byte that ends the R group of the reserved word table. The S group begins at the next byte, 6AABH.
6AAB-6AAE
DEFM "TO" / DEFB 0D0H, 90H 54 4F D0 90
6AABH: the characters "TO" and with the high bit set on the 0D0H, which with the letter S of this group spells STOP. Token 90H, whose word in the statement address table stands at 67E1H and holds 437FH.
6AAF-6AB2
DEFM "WA" / DEFB 0D0H, 0A5H 57 41 D0 A5
6AAFH: the characters "WA" and with the high bit set on the 0D0H, which with the letter S of this group spells SWAP. Token 0A5H, whose word in the statement address table stands at 680BH and holds 43F6H.
6AB3-6AB6
DEFM "AV" / DEFB 0C5H, 0CBH 41 56 C5 CB
6AB3H: the characters "AV" and with the high bit set on the 0C5H, which with the letter S of this group spells SAVE. Token 0CBH, whose word in the statement address table stands at 6857H and holds 4D1EH.
6AB7-6ABA
DEFM "PC" / DEFB 0A8H, 0D5H 50 43 A8 D5
6AB7H: the characters "PC" and with the high bit set on the 0A8H, which with the letter S of this group spells SPC(. Token 0D5H, which is above the statement tokens of the table at 67C3H.
6ABB-6ABE
DEFM "TE" / DEFB 0D0H, 0D2H 54 45 D0 D2
6ABBH: the characters "TE" and with the high bit set on the 0D0H, which with the letter S of this group spells STEP. Token 0D2H, which is above the statement tokens of the table at 67C3H.
6ABF-6AC1
DEFM "G" / DEFB 0CEH, 04H 47 CE 04
6ABFH: the characters "G" and with the high bit set on the 0CEH, which with the letter S of this group spells SGN. Token 04H is below 080H, so SGN is an intrinsic function.
6AC2-6AC4
DEFM "Q" / DEFB 0D2H, 07H 51 D2 07
6AC2H: the characters "Q" and with the high bit set on the 0D2H, which with the letter S of this group spells SQR. Token 07H is below 080H, so SQR is an intrinsic function.
6AC5-6AC7
DEFM "I" / DEFB 0CEH, 09H 49 CE 09
6AC5H: the characters "I" and with the high bit set on the 0CEH, which with the letter S of this group spells SIN. Token 09H is below 080H, so SIN is an intrinsic function.
6AC8-6ACB
DEFM "TR" / DEFB 0A4H, 13H 54 52 A4 13
6AC8H: the characters "TR" and with the high bit set on the 0A4H, which with the letter S of this group spells STR$. Token 13H is below 080H, so STR$ is an intrinsic function.
6ACC-6AD2
DEFM "TRING" / DEFB 0A4H, 0D9H 54 52 49 4E 47 A4 D9
6ACCH: the characters "TRING" and with the high bit set on the 0A4H, which with the letter S of this group spells STRING$. Token 0D9H, which is above the statement tokens of the table at 67C3H.
6AD3-6AD8
DEFM "PACE" / DEFB 0A4H, 18H 50 41 43 45 A4 18
6AD3H: the characters "PACE" and with the high bit set on the 0A4H, which with the letter S of this group spells SPACE$. Token 18H is below 080H, so SPACE$ is an intrinsic function.
6AD9-6ADE
DEFM "YSTE" / DEFB 0CDH, 0BDH 59 53 54 45 CD BD
6AD9H: the characters "YSTE" and with the high bit set on the 0CDH, which with the letter S of this group spells SYSTEM. Token 0BDH, whose word in the statement address table stands at 683BH and holds 7ED4H.
6ADF-6AE3
DEFM "OUN" / DEFB 0C4H, 0CDH 4F 55 4E C4 CD
6ADFH: the characters "OUN" and with the high bit set on the 0C4H, which with the letter S of this group spells SOUND. Token 0CDH, whose word in the statement address table stands at 685BH and holds 7E8BH. One of the keywords Logical Systems added, and the highest statement token.
6AE4
DEFB 00H 00
The 00H byte that ends the S group of the reserved word table. The T group begins at the next byte, 6AE5H.
6AE5-6AE8
DEFM "HE" / DEFB 0CEH, 0D0H 48 45 CE D0
6AE5H: the characters "HE" and with the high bit set on the 0CEH, which with the letter T of this group spells THEN. Token 0D0H, which is above the statement tokens of the table at 67C3H.
6AE9-6AEC
DEFM "RO" / DEFB 0CEH, 0A3H 52 4F CE A3
6AE9H: the characters "RO" and with the high bit set on the 0CEH, which with the letter T of this group spells TRON. Token 0A3H, whose word in the statement address table stands at 6807H and holds 43F0H.
6AED-6AF1
DEFM "ROF" / DEFB 0C6H, 0A4H 52 4F 46 C6 A4
6AEDH: the characters "ROF" and with the high bit set on the 0C6H, which with the letter T of this group spells TROFF. Token 0A4H, whose word in the statement address table stands at 6809H and holds 43F1H.
6AF2-6AF5
DEFM "AB" / DEFB 0A8H, 0D1H 41 42 A8 D1
6AF2H: the characters "AB" and with the high bit set on the 0A8H, which with the letter T of this group spells TAB(. Token 0D1H, which is above the statement tokens of the table at 67C3H.
6AF6-6AF7
DEFB 0CFH, 0CFH CF CF
6AF6H: the characters with the high bit set on the 0CFH, which with the letter T of this group spells TO. Token 0CFH, which is above the statement tokens of the table at 67C3H.
6AF8-6AFC
DEFM "IME" / DEFB 0A4H, 0E2H 49 4D 45 A4 E2
6AF8H: the characters "IME" and with the high bit set on the 0A4H, which with the letter T of this group spells TIME$. Token 0E2H, which is above the statement tokens of the table at 67C3H. One of the keywords Logical Systems added.
6AFD-6AFF
DEFM "A" / DEFB 0CEH, 0DH 41 CE 0D
6AFDH: the characters "A" and with the high bit set on the 0CEH, which with the letter T of this group spells TAN. Token 0DH is below 080H, so TAN is an intrinsic function.
6B00
DEFB 00H 00
The 00H byte that ends the T group of the reserved word table. The U group begins at the next byte, 6B01H.
6B01-6B05
DEFM "SIN" / DEFB 0C7H, 0DAH 53 49 4E C7 DA
6B01H: the characters "SIN" and with the high bit set on the 0C7H, which with the letter U of this group spells USING. Token 0DAH, which is above the statement tokens of the table at 67C3H.
6B06-6B08
DEFM "S" / DEFB 0D2H, 0D3H 53 D2 D3
6B06H: the characters "S" and with the high bit set on the 0D2H, which with the letter U of this group spells USR. Token 0D3H, which is above the statement tokens of the table at 67C3H.
6B09
DEFB 00H 00
The 00H byte that ends the U group of the reserved word table. The V group begins at the next byte, 6B0AH.
6B0A-6B0C
DEFM "A" / DEFB 0CCH, 14H 41 CC 14
6B0AH: the characters "A" and with the high bit set on the 0CCH, which with the letter V of this group spells VAL. Token 14H is below 080H, so VAL is an intrinsic function.
6B0D-6B12
DEFM "ARPT" / DEFB 0D2H, 0DDH 41 52 50 54 D2 DD
6B0DH: the characters "ARPT" and with the high bit set on the 0D2H, which with the letter V of this group spells VARPTR. Token 0DDH, which is above the statement tokens of the table at 67C3H.
6B13
DEFB 00H 00
The 00H byte that ends the V group of the reserved word table. The W group begins at the next byte, 6B14H.
6B14-6B18
DEFM "IDT" / DEFB 0C8H, 0A1H 49 44 54 C8 A1
6B14H: the characters "IDT" and with the high bit set on the 0C8H, which with the letter W of this group spells WIDTH. Token 0A1H, whose word in the statement address table stands at 6803H and holds 7960H.
6B19-6B1C
DEFM "AI" / DEFB 0D4H, 96H 41 49 D4 96
6B19H: the characters "AI" and with the high bit set on the 0D4H, which with the letter W of this group spells WAIT. Token 96H, whose word in the statement address table stands at 67EDH and holds 793FH.
6B1D-6B21
DEFM "HIL" / DEFB 0C5H, 0B4H 48 49 4C C5 B4
6B1DH: the characters "HIL" and with the high bit set on the 0C5H, which with the letter W of this group spells WHILE. Token 0B4H, whose word in the statement address table stands at 6829H and holds 52CAH.
6B22-6B25
DEFM "EN" / DEFB 0C4H, 0B5H 45 4E C4 B5
6B22H: the characters "EN" and with the high bit set on the 0C4H, which with the letter W of this group spells WEND. Token 0B5H, whose word in the statement address table stands at 682BH and holds 52EBH.
6B26-6B2A
DEFM "RIT" / DEFB 0C5H, 0B7H 52 49 54 C5 B7
6B26H: the characters "RIT" and with the high bit set on the 0C5H, which with the letter W of this group spells WRITE. Token 0B7H, whose word in the statement address table stands at 682FH and holds 56FBH.
6B2B
DEFB 00H 00
The 00H byte that ends the W group of the reserved word table. The X group begins at the next byte, 6B2CH.
6B2C-6B2E
DEFM "O" / DEFB 0D2H, 0FAH 4F D2 FA
6B2CH: the characters "O" and with the high bit set on the 0D2H, which with the letter X of this group spells XOR. Token 0FAH, which is above the statement tokens of the table at 67C3H.
6B2F
DEFB 00H 00
The 00H byte that ends the X group of the reserved word table. The Y group begins at the next byte, 6B30H.
6B30
DEFB 00H 00
The 00H byte that ends the Y group of the reserved word table. The Z group begins at the next byte, 6B31H.
6B31
DEFB 00H 00
The 00H byte that ends the Z group of the reserved word table. The table ends here and the operator table begins at 6B32H.

6B32H - The Operator Table (6B32H-6B46H)

The ten operators that are written as characters rather than as words, each stored as its character with the high bit set and then its token, and the table ended by a 00H byte. It is the reserved word table's own shape with the first character stored as well, there being no letter group to imply it. The tokens run 0F0H to 0F7H for the relational and arithmetic operators and 0FEH for the backslash, and the apostrophe takes 0DCH; the word operators AND, OR, XOR, EQV, IMP and MOD carry the tokens between them, 0F8H to 0FDH, and are stored in the reserved word table with the rest of their letters.

6B32-6B33
DEFB 0ABH, 0F3H AB F3
6B32H-6B33H: the plus sign with the high bit set, 0ABH, and its token 0F3H.
6B34-6B35
DEFB 0ADH, 0F4H AD F4
6B34H-6B35H: the minus sign with the high bit set, 0ADH, and its token 0F4H.
6B36-6B37
DEFB 0AAH, 0F5H AA F5
6B36H-6B37H: the asterisk with the high bit set, 0AAH, and its token 0F5H.
6B38-6B39
DEFB 0AFH, 0F6H AF F6
6B38H-6B39H: the oblique stroke with the high bit set, 0AFH, and its token 0F6H.
6B3A-6B3B
DEFB 0DEH, 0F7H DE F7
6B3AH-6B3BH: the upward arrow with the high bit set, 0DEH, and its token 0F7H. The upward arrow is exponentiation, the operator of highest precedence.
6B3C-6B3D
DEFB 0DCH, 0FEH DC FE
6B3CH-6B3DH: the backslash with the high bit set, 0DCH, and its token 0FEH. The backslash is integer division, and its token 0FEH is the highest of the operator tokens.
6B3E-6B3F
DEFB 0A7H, 0DCH A7 DC
6B3EH-6B3FH: the apostrophe with the high bit set, 0A7H, and its token 0DCH. The apostrophe is the short form of REM, and its token 0DCH is one of the tokens the statement address table at 67C3H leaves without a keyword, its word at 6879H holding 4A69H.
6B40-6B41
DEFB 0BEH, 0F0H BE F0
6B40H-6B41H: the greater than sign with the high bit set, 0BEH, and its token 0F0H. The three relational operators, token 0F0H to 0F2H, have no entry in the precedence table at 6B47H.
6B42-6B43
DEFB 0BDH, 0F1H BD F1
6B42H-6B43H: the equals sign with the high bit set, 0BDH, and its token 0F1H.
6B44-6B45
DEFB 0BCH, 0F2H BC F2
6B44H-6B45H: the less than sign with the high bit set, 0BCH, and its token 0F2H. The last entry of the table; the 00H byte at 6B46H ends it.
6B46
DEFB 00H 00
The 00H byte that ends the operator table, as a 00H byte ends each of the twenty-six groups of the reserved word table at 68F7H: the walk of the table stops when it reads this byte without having matched the character it was given.

6B47H - The Operator Precedence Table (6B47H-6B52H)

Twelve bytes, the precedence of each operator from token 0F3H to token 0FEH in token order: the plus sign and the minus sign share 79H, the asterisk and the oblique stroke share 7CH, the upward arrow has the highest value 7FH, and the word operators fall away from 7AH for MOD down to 28H for IMP. The base of the table was fixed from those equal pairs: the two additive operators and the two multiplicative operators carry the same byte as each other, which lines the table up with tokens 0F3H to 0FEH and with nothing else. The three relational operators, tokens 0F0H to 0F2H, are not in the table. The words from 6B53H up are two tables and not one. The first five, 6B53H-6B5CH, are the type conversion table and have their own section below; the words from 6B5DH to 6B7AH are the table 7470H loads the base of, and whether the first twelve of them are the routines of these same twelve operators is settled when the expression evaluator of module 1 is written.

6B47
DEFB 79H 79
The precedence of the plus sign operator, token 0F3H: 79H.
6B48
DEFB 79H 79
The precedence of the minus sign operator, token 0F4H: 79H.
6B49
DEFB 7CH 7C
The precedence of the asterisk operator, token 0F5H: 7CH.
6B4A
DEFB 7CH 7C
The precedence of the oblique stroke operator, token 0F6H: 7CH.
6B4B
DEFB 7FH 7F
The precedence of the upward arrow operator, token 0F7H: 7FH.
6B4C
DEFB 50H 50
The precedence of the AND operator, token 0F8H: 50H.
6B4D
DEFB 46H 46
The precedence of the OR operator, token 0F9H: 46H.
6B4E
DEFB 3CH 3C
The precedence of the XOR operator, token 0FAH: 3CH.
6B4F
DEFB 32H 32
The precedence of the EQV operator, token 0FBH: 32H.
6B50
DEFB 28H 28
The precedence of the IMP operator, token 0FCH: 28H.
6B51
DEFB 7AH 7A
The precedence of the MOD operator, token 0FDH: 7AH.
6B52
DEFB 7BH 7B
The precedence of the backslash operator, token 0FEH: 7BH.

6B53H - The Type Conversion Table (6B53H-6B5CH)

Five words, each the address of a routine in BASIC/OV1 that makes the value in the accumulator be of one particular type, and the table every assignment of a value to a variable of a different type goes through. 78DDH is the whole of the dispatch: it masks the type to three bits with AND 07H at 78DEH, loads 6B53H, adds the masked type once at 78E6H, and then calls 766DH, which adds it a second time and jumps to the word it lands on, so the table is indexed by twice the type. The types of this BASIC are 02H for an integer, 03H for a string, 04H for a single precision number and 08H for a double precision one, which is why the five words are reached in the order 6B57H, 6B59H, 6B5BH and, the 08H having masked to 00H, 6B53H. The 0000H at 6B55H is what proves that reading: there is no type of 01H, so the slot its index would reach holds no address, and a table indexed any other way would have no reason for a hole in the middle of it. Nothing reaches 6B5DH and above through this dispatch, those words being the start of the table 7470H loads. 78DDH is called from four places, 4AD0H and 5D74H, LET's own 60A9H, and 77D1H in the expression code; the plain type it needs is what the ADD A,03H at 6088H and at 64E8H put back after 76A4H has taken three off to make its string test.

6B53-6B54
DEFW 2A96H 96 2A
6B53H-6B54H: the word 2A96H of BASIC/OV1, the routine that makes the value a double precision one. It is reached for a type of 08H, which the AND 07H at 78DEH leaves as 00H, so double precision is the type that takes the first slot of the table rather than the last.
6B55-6B56
DEFW 0000H 00 00
6B55H-6B56H: a word of 0000H, the slot an index of 01H would reach. No type of 01H exists in this BASIC, so no dispatch ever lands here, and the word was never filled in. It is the hole that settles how the table is indexed.
6B57-6B58
DEFW 29F4H F4 29
6B57H-6B58H: the word 29F4H of BASIC/OV1, the routine that makes the value an integer, reached for a type of 02H. This is where A% = 1.7 loses its fraction.
6B59-6B5A
DEFW 2AB0H B0 2A
6B59H-6B5AH: the word 2AB0H of BASIC/OV1, reached for a type of 03H, a string. It converts nothing: it insists that the value in hand is already a string and gives Type mismatch through 5884H when it is not, which is why it is also called outright by FIELD at 4DF4H, by RSET and LSET at 4E24H, and by LINE at 6369H.
6B5B-6B5C
DEFW 2A6AH 6A 2A
6B5BH-6B5CH: the word 2A6AH of BASIC/OV1, the routine that makes the value a single precision number, reached for a type of 04H. The last word of the table; 6B5DH begins the one 7470H loads.

6B5DH - The Three Operator Tables, One for Each Kind of Number (6B5DH-6B7BH)

Three tables of five words, and the last thing of the keyword and table region to be read. Each holds the five operations BASIC can perform on a pair of numbers of one kind: the plus, the minus, the asterisk, the oblique stroke and the comparison, in that order. 7470H loads 6B5DH for a pair of double precision numbers, 7499H loads 6B67H for a pair of single precision ones and 744AH loads 6B71H for a pair of integers, and all three index by twice the operator's number, which 741DH has put in 7143H. The operator's number is the one 7367H works out, the token less 0F3H, so that the plus is 00H, the minus 01H, the asterisk 02H and the oblique stroke 03H; the up arrow would be 04H and is never seen here, because 7387H sends the up arrow to 36DFH of its own accord before any table is reached. That leaves the fifth slot free for the comparison, and 7405H takes it with an outright LD E,04H, which is how one word of each table serves all six of the relational operators. The words below 6B5DH are a table of another shape altogether, the five words of the type conversion at 6B53H, and the single 00H byte at 6B7BH divides these three from the error message block that begins at 6B7CH. Two things are worth seeing across the three tables. The minus of each kind is not a routine of its own but the entry three, seven or eleven bytes below its own plus: 261FH negates the single precision operand and falls into the add at 2622H, 2C81H flips the sign byte of a double precision one at 72FBH and falls into 2C88H, and 2B93H sign extends an integer and reaches 2BA1H, where the add at 2B9EH reaches it too. And the integer table's own oblique stroke is the only word of the three tables that names module 1: integer division in this BASIC gives a single precision answer, so 74B2H turns both operands into single precision numbers and jumps into the single precision divide, which is why the other nine arithmetic words name BASIC/OV1 and that one does not.

6B5D-6B5E
DEFW 2C88H 88 2C
6B5DH-6B5EH: the word 2C88H of BASIC/OV1, the first slot of the double precision table and the routine that adds two double precision numbers. 7470H loads 6B5DH and reaches this word for an operator number of 00H, the plus.
6B5F-6B60
DEFW 2C81H 81 2C
6B5FH-6B60H: the word 2C81H of BASIC/OV1, the double precision minus, reached for an operator number of 01H. It is seven bytes below the add above it: it flips bit 7 of the sign byte at 72FBH and falls into the add at 2C88H, so the subtraction is the addition of a negated operand.
6B61-6B62
DEFW 2DB5H B5 2D
6B61H-6B62H: the word 2DB5H of BASIC/OV1, the double precision multiply, reached for an operator number of 02H, the asterisk.
6B63-6B64
DEFW 2E8CH 8C 2E
6B63H-6B64H: the word 2E8CH of BASIC/OV1, the double precision divide, reached for an operator number of 03H, the oblique stroke.
6B65-6B66
DEFW 29EDH ED 29
6B65H-6B66H: the word 29EDH of BASIC/OV1, the double precision comparison and the last slot of the table, reached for the operator number of 04H that 7405H loads for a relational operator. It calls 29C4H and answers 0FFH, 00H or 01H in Register A, which 7683H turns into the true or false the operator asked for.
6B67-6B68
DEFW 2622H 22 26
6B67H-6B68H: the word 2622H of BASIC/OV1, the first slot of the single precision table and the routine that adds two single precision numbers. 7499H loads 6B67H and reaches this word for an operator number of 00H, the plus.
6B69-6B6A
DEFW 261FH 1F 26
6B69H-6B6AH: the word 261FH of BASIC/OV1, the single precision minus, reached for an operator number of 01H. It is the three bytes above the add that call 28F3H to negate the operand, and it falls into the add at 2622H.
6B6B-6B6C
DEFW 278BH 8B 27
6B6BH-6B6CH: the word 278BH of BASIC/OV1, the single precision multiply, reached for an operator number of 02H, the asterisk.
6B6D-6B6E
DEFW 27EDH ED 27
6B6DH-6B6EH: the word 27EDH of BASIC/OV1, the single precision divide, reached for an operator number of 03H. The two bytes below it at 27EBH pop the operands off the stack and fall into it, which is the entry 74B2H uses for an integer division.
6B6F-6B70
DEFW 2982H 82 29
6B6FH-6B70H: the word 2982H of BASIC/OV1, the single precision comparison and the last slot of the table, reached for the operator number of 04H that 7405H loads. It answers 0FFH, 00H or 01H in Register A for 7683H to read.
6B71-6B72
DEFW 2B9EH 9E 2B
6B71H-6B72H: the word 2B9EH of BASIC/OV1, the first slot of the integer table and the routine that adds two integers. 744AH loads 6B71H and reaches this word for an operator number of 00H, the plus; it sign extends Register Pair HL into Register B and adds Register Pair DE to it at 2BA6H.
6B73-6B74
DEFW 2B93H 93 2B
6B73H-6B74H: the word 2B93H of BASIC/OV1, the integer minus, reached for an operator number of 01H. It is the eleven bytes above the add that sign extend Register Pair HL, call 2C51H and reach 2BA1H, which is where the add arrives as well.
6B75-6B76
DEFW 2BBEH BE 2B
6B75H-6B76H: the word 2BBEH of BASIC/OV1, the integer multiply, reached for an operator number of 02H, the asterisk.
6B77-6B78
DEFW 74B2H B2 74
6B77H-6B78H: the word 74B2H, which is in module 1 and not in BASIC/OV1, the only arithmetic word of the three tables that is. It is reached for an operator number of 03H, and dividing one integer by another in this BASIC gives a single precision answer, so 74B2H turns both operands into single precision numbers through 2A8AH and jumps to 27EBH, the two bytes that pop them and fall into the single precision divide.
6B79-6B7A
DEFW 29AFH AF 29
6B79H-6B7AH: the word 29AFH of BASIC/OV1, the integer comparison and the last slot of the table, reached for the operator number of 04H that 7405H loads. It exclusive ORs the two high bytes to find whether the signs differ and answers in Register A for 7683H.
6B7B
DEFB 00H 00
6B7BH: one byte of 00H, which is the last byte of the keyword and table region of module 1 and the byte below the error message block that begins at 6B7CH. No code reaches it and no table counts it in: the three tables above end at 6B7AH and the first text of the block is the NEXT without FOR of error 1.

6B7CH - The Error Message Block (6B7CH-6E75H)

Fifty-one texts, one for each error number from 1 to 51, each ended by a 00H byte, which is how the error printer finds the one it wants: the error number in Register Pair DE is the count of texts to step over, so error 7 is the seventh text, and the general Out of memory entry at 425CH loads 0007H for exactly that reason. The texts are full English sentences, where the Level II BASIC in the Model I and Model III ROMs holds two letter codes for the same errors, both being Microsoft BASIC built differently. Eight of the fifty-one numbers, 24, 25, 27, 28, 37, 40, 41 and 46, have no message of their own and hold a single question mark so that the numbering of the texts above them stands. The block runs from 6B7CH to 6E75H and nothing else is stored inside it.

6B7C-6B8C
DEFM "NEXT without FOR" / DEFB 00H 4E 45 58 54 20 77 69 74 68 6F 75 74 20 46 4F 52 00
Error 1, the text "NEXT without FOR", 16 characters and the 00H byte that ends it. The first text of the block, which is why the error number is also the count of 00H bytes to step over to reach a text.
6B8D-6B99
DEFM "Syntax error" / DEFB 00H 53 79 6E 74 61 78 20 65 72 72 6F 72 00
Error 2, the text "Syntax error", 12 characters and the 00H byte that ends it. The error SYNERR at 586CH, which NEWB/EQU names, raises.
6B9A-6BAE
DEFM "RETURN without GOSUB" / DEFB 00H 52 45 54 55 52 4E 20 77 69 74 68 6F 75 74 20 47 4F 53 55 42 00
Error 3, the text "RETURN without GOSUB", 20 characters and the 00H byte that ends it.
6BAF-6BBA
DEFM "Out of DATA" / DEFB 00H 4F 75 74 20 6F 66 20 44 41 54 41 00
Error 4, the text "Out of DATA", 11 characters and the 00H byte that ends it.
6BBB-6BD0
DEFM "Illegal function call" / DEFB 00H 49 6C 6C 65 67 61 6C 20 66 75 6E 63 74 69 6F 6E 20 63 61 6C 6C 00
Error 5, the text "Illegal function call", 21 characters and the 00H byte that ends it. The error FUNCERR at 5F95H raises, which NEWB/EQU names and which the enhancement package's SVCUSR at 8048H uses for a bad supervisor call number.
6BD1-6BD9
DEFM "Overflow" / DEFB 00H 4F 76 65 72 66 6C 6F 77 00
Error 6, the text "Overflow", 8 characters and the 00H byte that ends it.
6BDA-6BE7
DEFM "Out of memory" / DEFB 00H 4F 75 74 20 6F 66 20 6D 65 6D 6F 72 79 00
Error 7, the text "Out of memory", 13 characters and the 00H byte that ends it. The seventh text, which is why the general Out of memory entry at 425CH loads Register Pair DE with 0007H before it reaches the error printer.
6BE8-6BFD
DEFM "Undefined line number" / DEFB 00H 55 6E 64 65 66 69 6E 65 64 20 6C 69 6E 65 20 6E 75 6D 62 65 72 00
Error 8, the text "Undefined line number", 21 characters and the 00H byte that ends it.
6BFE-6C14
DEFM "Subscript out of range" / DEFB 00H 53 75 62 73 63 72 69 70 74 20 6F 75 74 20 6F 66 20 72 61 6E 67 65 00
Error 9, the text "Subscript out of range", 22 characters and the 00H byte that ends it.
6C15-6C29
DEFM "Duplicate Definition" / DEFB 00H 44 75 70 6C 69 63 61 74 65 20 44 65 66 69 6E 69 74 69 6F 6E 00
Error 10, the text "Duplicate Definition", 20 characters and the 00H byte that ends it. Logical Systems left the second word capitalised where the rest of the block capitalises only the first.
6C2A-6C3A
DEFM "Division by zero" / DEFB 00H 44 69 76 69 73 69 6F 6E 20 62 79 20 7A 65 72 6F 00
Error 11, the text "Division by zero", 16 characters and the 00H byte that ends it.
6C3B-6C49
DEFM "Illegal direct" / DEFB 00H 49 6C 6C 65 67 61 6C 20 64 69 72 65 63 74 00
Error 12, the text "Illegal direct", 14 characters and the 00H byte that ends it.
6C4A-6C57
DEFM "Type mismatch" / DEFB 00H 54 79 70 65 20 6D 69 73 6D 61 74 63 68 00
Error 13, the text "Type mismatch", 13 characters and the 00H byte that ends it.
6C58-6C6B
DEFM "Out of string space" / DEFB 00H 4F 75 74 20 6F 66 20 73 74 72 69 6E 67 20 73 70 61 63 65 00
Error 14, the text "Out of string space", 19 characters and the 00H byte that ends it.
6C6C-6C7B
DEFM "String too long" / DEFB 00H 53 74 72 69 6E 67 20 74 6F 6F 20 6C 6F 6E 67 00
Error 15, the text "String too long", 15 characters and the 00H byte that ends it.
6C7C-6C96
DEFM "String formula too complex" / DEFB 00H 53 74 72 69 6E 67 20 66 6F 72 6D 75 6C 61 20 74 6F 6F 20 63 6F 6D 70 6C 65 78 00
Error 16, the text "String formula too complex", 26 characters and the 00H byte that ends it.
6C97-6CA5
DEFM "Can't continue" / DEFB 00H 43 61 6E 27 74 20 63 6F 6E 74 69 6E 75 65 00
Error 17, the text "Can't continue", 14 characters and the 00H byte that ends it. The only text with an apostrophe in it.
6CA6-6CBD
DEFM "Undefined user function" / DEFB 00H 55 6E 64 65 66 69 6E 65 64 20 75 73 65 72 20 66 75 6E 63 74 69 6F 6E 00
Error 18, the text "Undefined user function", 23 characters and the 00H byte that ends it.
6CBE-6CC7
DEFM "No RESUME" / DEFB 00H 4E 6F 20 52 45 53 55 4D 45 00
Error 19, the text "No RESUME", 9 characters and the 00H byte that ends it.
6CC8-6CDC
DEFM "RESUME without error" / DEFB 00H 52 45 53 55 4D 45 20 77 69 74 68 6F 75 74 20 65 72 72 6F 72 00
Error 20, the text "RESUME without error", 20 characters and the 00H byte that ends it.
6CDD-6CEE
DEFM "Unprintable error" / DEFB 00H 55 6E 70 72 69 6E 74 61 62 6C 65 20 65 72 72 6F 72 00
Error 21, the text "Unprintable error", 17 characters and the 00H byte that ends it.
6CEF-6CFE
DEFM "Missing operand" / DEFB 00H 4D 69 73 73 69 6E 67 20 6F 70 65 72 61 6E 64 00
Error 22, the text "Missing operand", 15 characters and the 00H byte that ends it.
6CFF-6D13
DEFM "Line buffer overflow" / DEFB 00H 4C 69 6E 65 20 62 75 66 66 65 72 20 6F 76 65 72 66 6C 6F 77 00
Error 23, the text "Line buffer overflow", 20 characters and the 00H byte that ends it.
6D14-6D15
DEFM "?" / DEFB 00H 3F 00
Error 24, the text of one question mark, 1 characters and the 00H byte that ends it. Error 24 has no message: the text is the single question mark, the place held so that the numbering of the texts above it is not disturbed.
6D16-6D17
DEFM "?" / DEFB 00H 3F 00
Error 25, the text of one question mark, 1 characters and the 00H byte that ends it. Error 25 is another single question mark with no message of its own.
6D18-6D28
DEFM "FOR Without NEXT" / DEFB 00H 46 4F 52 20 57 69 74 68 6F 75 74 20 4E 45 58 54 00
Error 26, the text "FOR Without NEXT", 16 characters and the 00H byte that ends it. The capital W of Without is Logical Systems' own, every other text of the block using a small w.
6D29-6D2A
DEFM "?" / DEFB 00H 3F 00
Error 27, the text of one question mark, 1 characters and the 00H byte that ends it. Error 27 is a single question mark.
6D2B-6D2C
DEFM "?" / DEFB 00H 3F 00
Error 28, the text of one question mark, 1 characters and the 00H byte that ends it. Error 28 is a single question mark, the last of the four that stand between the line buffer error and the WHILE errors.
6D2D-6D3F
DEFM "WHILE without WEND" / DEFB 00H 57 48 49 4C 45 20 77 69 74 68 6F 75 74 20 57 45 4E 44 00
Error 29, the text "WHILE without WEND", 18 characters and the 00H byte that ends it.
6D40-6D52
DEFM "WEND without WHILE" / DEFB 00H 57 45 4E 44 20 77 69 74 68 6F 75 74 20 57 48 49 4C 45 00
Error 30, the text "WEND without WHILE", 18 characters and the 00H byte that ends it.
6D53-6D61
DEFM "FIELD overflow" / DEFB 00H 46 49 45 4C 44 20 6F 76 65 72 66 6C 6F 77 00
Error 31, the text "FIELD overflow", 14 characters and the 00H byte that ends it.
6D62-6D70
DEFM "Internal error" / DEFB 00H 49 6E 74 65 72 6E 61 6C 20 65 72 72 6F 72 00
Error 32, the text "Internal error", 14 characters and the 00H byte that ends it.
6D71-6D80
DEFM "Bad file number" / DEFB 00H 42 61 64 20 66 69 6C 65 20 6E 75 6D 62 65 72 00
Error 33, the text "Bad file number", 15 characters and the 00H byte that ends it.
6D81-6D8F
DEFM "File not found" / DEFB 00H 46 69 6C 65 20 6E 6F 74 20 66 6F 75 6E 64 00
Error 34, the text "File not found", 14 characters and the 00H byte that ends it.
6D90-6D9D
DEFM "Bad file mode" / DEFB 00H 42 61 64 20 66 69 6C 65 20 6D 6F 64 65 00
Error 35, the text "Bad file mode", 13 characters and the 00H byte that ends it.
6D9E-6DAF
DEFM "File already open" / DEFB 00H 46 69 6C 65 20 61 6C 72 65 61 64 79 20 6F 70 65 6E 00
Error 36, the text "File already open", 17 characters and the 00H byte that ends it.
6DB0-6DB1
DEFM "?" / DEFB 00H 3F 00
Error 37, the text of one question mark, 1 characters and the 00H byte that ends it. Error 37 is a single question mark, standing between the file already open and the device error.
6DB2-6DC2
DEFM "Device I/O error" / DEFB 00H 44 65 76 69 63 65 20 49 2F 4F 20 65 72 72 6F 72 00
Error 38, the text "Device I/O error", 16 characters and the 00H byte that ends it.
6DC3-6DD6
DEFM "File already exists" / DEFB 00H 46 69 6C 65 20 61 6C 72 65 61 64 79 20 65 78 69 73 74 73 00
Error 39, the text "File already exists", 19 characters and the 00H byte that ends it.
6DD7-6DD8
DEFM "?" / DEFB 00H 3F 00
Error 40, the text of one question mark, 1 characters and the 00H byte that ends it. Error 40 is a single question mark.
6DD9-6DDA
DEFM "?" / DEFB 00H 3F 00
Error 41, the text of one question mark, 1 characters and the 00H byte that ends it. Error 41 is a single question mark, the pair of them standing before the disk full error.
6DDB-6DE4
DEFM "Disk full" / DEFB 00H 44 69 73 6B 20 66 75 6C 6C 00
Error 42, the text "Disk full", 9 characters and the 00H byte that ends it.
6DE5-6DF3
DEFM "Input past end" / DEFB 00H 49 6E 70 75 74 20 70 61 73 74 20 65 6E 64 00
Error 43, the text "Input past end", 14 characters and the 00H byte that ends it.
6DF4-6E05
DEFM "Bad record number" / DEFB 00H 42 61 64 20 72 65 63 6F 72 64 20 6E 75 6D 62 65 72 00
Error 44, the text "Bad record number", 17 characters and the 00H byte that ends it.
6E06-6E13
DEFM "Bad file name" / DEFB 00H 42 61 64 20 66 69 6C 65 20 6E 61 6D 65 00
Error 45, the text "Bad file name", 13 characters and the 00H byte that ends it.
6E14-6E15
DEFM "?" / DEFB 00H 3F 00
Error 46, the text of one question mark, 1 characters and the 00H byte that ends it. Error 46 is a single question mark, the last of the eight placeholders in the block.
6E16-6E2E
DEFM "Direct statement in file" / DEFB 00H 44 69 72 65 63 74 20 73 74 61 74 65 6D 65 6E 74 20 69 6E 20 66 69 6C 65 00
Error 47, the text "Direct statement in file", 24 characters and the 00H byte that ends it. The error a LOAD meets when the file holds a line with no number.
6E2F-6E3D
DEFM "Too many files" / DEFB 00H 54 6F 6F 20 6D 61 6E 79 20 66 69 6C 65 73 00
Error 48, the text "Too many files", 14 characters and the 00H byte that ends it.
6E3E-6E52
DEFM "Disk write protected" / DEFB 00H 44 69 73 6B 20 77 72 69 74 65 20 70 72 6F 74 65 63 74 65 64 00
Error 49, the text "Disk write protected", 20 characters and the 00H byte that ends it.
6E53-6E65
DEFM "File access DENIED" / DEFB 00H 46 69 6C 65 20 61 63 63 65 73 73 20 44 45 4E 49 45 44 00
Error 50, the text "File access DENIED", 18 characters and the 00H byte that ends it. DENIED is in capitals, which no other text of the block does, and the error is the DOS's own refusal passed on.
6E66-6E75
DEFM "Command Aborted" / DEFB 00H 43 6F 6D 6D 61 6E 64 20 41 62 6F 72 74 65 64 00
Error 51, the text "Command Aborted", 15 characters and the 00H byte that ends it. The last text of the block, which ends at 6E75H; the bytes from 6E76H up are not part of it and are not shown yet.

6E76H - Module 1's Variable Area (6E76H-7327H)

Twelve hundred and two bytes, and every one of them is a cell some routine of this page writes or reads: this is the whole of module 1's own storage and the last part of the file to be written. Only the first forty-five bytes carry anything in the file, 6E76H to 6EA2H, and what they carry is the state a cold BASIC starts in: the ten USR vectors all pointing at FUNCERR 5F95H, so that a USR called before any DEF USR gives Illegal function call; the display's width at 50H and the printer's at 0FFH; PGMBGN 6E9EH at 82E1H and BASEND 6E9AH at 8344H, which BEGIN overwrites at 83EDH and 84B3H with what the machine really has; the warning message pointer at 6EA0H set to the Overflow text; the line being run at 0FFFEH; and a colon at 6EA2H, which is where 5944H points the text pointer at command level so that the first thing the statement loop reads is the end of a statement. Everything from 6EA3H up is 00H in the file, 1157 bytes of it, and the start chain fills in what it needs. Four things in the band are larger than a cell and worth seeing whole. The two line buffers stand back to back, LBUF 6EF9H of 320 bytes and INBUF 7039H above it, which is why TOBUFF can be given 013BH of room and why NAME's two filespec buffers at 7037H and 7057H straddle the join. The temporary string descriptor pool is 7157H to 7174H, ten slots of three bytes, and the eleventh slot is the build area at 7175H itself, which is how 4695H turns a pool that has filled into String formula too complex. The parameter region of a user-defined function call is 71C5H to 7228H and the area the call gathers it in is 722DH to 7290H, a hundred bytes each, which is the limit 7829H enforces. And the accumulator is five areas in a row: the low mantissa at 72E8H, the four bytes at 72ECH, the second accumulator at 72F5H and two more eight byte areas at 7318H and 7320H that only BASIC/OV1 reaches, each of the first three with a guard byte below or above it at 72E7H, 72F0H and 72F4H. Fifty-one bytes of the band are named by no instruction of the three images, and they are marked as such below; some of them may yet turn out to be BASIC/OV1's, that page not being written.

6E76-6E77
DEFW 5F95H 95 5F
USR0's vector (6E76H), the first of the ten and the one a bare USR with no digit uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E78-6E79
DEFW 5F95H 95 5F
USR1's vector (6E78H), the second of the ten and the one USR1 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E7A-6E7B
DEFW 5F95H 95 5F
USR2's vector (6E7AH), the third of the ten and the one USR2 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E7C-6E7D
DEFW 5F95H 95 5F
USR3's vector (6E7CH), the fourth of the ten and the one USR3 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E7E-6E7F
DEFW 5F95H 95 5F
USR4's vector (6E7EH), the fifth of the ten and the one USR4 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E80-6E81
DEFW 5F95H 95 5F
USR5's vector (6E80H), the sixth of the ten and the one USR5 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E82-6E83
DEFW 5F95H 95 5F
USR6's vector (6E82H), the seventh of the ten and the one USR6 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E84-6E85
DEFW 5F95H 95 5F
USR7's vector (6E84H), the eighth of the ten and the one USR7 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E86-6E87
DEFW 5F95H 95 5F
USR8's vector (6E86H), the ninth of the ten and the one USR8 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E88-6E89
DEFW 5F95H 95 5F
USR9's vector (6E88H), the tenth of the ten and the one USR9 uses: the word 5F95H, FUNCERR, so that the function gives Illegal function call until a DEF USR has written a real address here. 775EH and 7760H of DEF USR write one and 771DH of USR reads one to call it.
6E8A
DEFB 01H 01
6E8AH: one byte holding 01H, named by no instruction of the three images. It stands between the last USR vector and the display's own last character, and nothing of module 1, module 2 or BASIC/OV1 loads its address or reads it.
6E8B
DEFB 0FFH FF
6E8BH: the character the display output last wrote, which 4197H keeps and the tab test at 418FH and 4159H reads. The 0FFH the file carries is a character no key gives, so the first tab of a session cannot match it.
6E8C-6E8E
DEFB 40H, 0E6H, 4DH 40 E6 4D
6E8CH to 6E8EH: the three byte multiplier the random number generator works with, which 389CH loads the address of and 38B0H rotates a byte of at a time. Its value is 4DE640H, and it is the one constant of module 1 that stands in the variable area rather than among the tables.
6E8F
DEFB 00H 00
6E8FH: the number of the last error, which the error handler writes at 58A7H and READY reads at 5933H, a 2 for Syntax error putting the line into the editor. The file carries 00H, no error having happened yet.
6E90
DEFB 00H 00
6E90H: one byte of 00H, named by no instruction of the three images, standing between the last error number and the printer's own position.
6E91
DEFB 00H 00
6E91H: the position the printer has reached across its line, which the printer path of the output at 40EEH and 4120H keeps by hand and LPOS reads at 7703H, the interpreter having no way to ask a printer where it stands.
6E92
DEFB 00H 00
6E92H: the flag that sends what follows to the printer rather than the display, which LPRINT sets at 620DH and LLIST at 79B0H and which 4137H and 634BH clear, and which 40DFH of the output reads.
6E93
DEFB 0E0H E0
6E93H: the printer's last tab stop, which WIDTH LPRINT works out at 796EH and 7971H stores, and which 62A9H reads for a comma in an LPRINT list. The file carries 0E0H, 224, which is fourteen times sixteen.
6E94
DEFB 0FFH FF
6E94H: the printer's line width, which WIDTH LPRINT sets at 796AH and which 0FFH means no width is in force, so that nothing is ever broken across two printed lines until a width is asked for.
6E95
DEFB 50H 50
6E95H: the display's line width, which WIDTH sets at 7978H and 417AH of the output reads to decide whether a character begins a line of its own. The file carries 50H, 80 characters, which is the Model 4's own screen.
6E96
DEFB 40H 40
6E96H: the display's last tab stop, which 797FH stores and 62B7H reads for a comma in a PRINT list. The file carries 40H, 64, which is the 80 of the width above rounded down to a multiple of sixteen.
6E97
DEFB 00H 00
6E97H: the flag that suppresses output, which 414BH reads and 46D8H throws the character away for, and which 43AEH, 43CBH, 58D6H and 5924H set and 63D1H clears.
6E98-6E99
DEFW 0000H 00 00
6E98H to 6E99H, FILEX: the control block of the file in hand, two bytes below the file control block proper, and 0000H when there is none, which is what the file carries. 45DFH is the test on it that the keyboard input, the output and INPUT$ all make.
6E9A-6E9B
DEFW 8344H 44 83
6E9AH to 6E9BH, BASEND: the top of free memory and the Stack Pointer BEGIN sets at 84B3H. The 8344H the file carries is inside module 2's own bytes and is never used as it stands, BEGIN writing what the machine really has over it.
6E9C-6E9D
DEFW 0FFFEH FE FF
6E9CH to 6E9DH: the number of the line being run, written out of each line's own header by 5E5AH and set to 0FFFFH at command level by 593BH. The file carries 0FFFEH, one less than that, and BEGIN overwrites it: NEWB/ASM calls the cell MAXSPAC.
6E9E-6E9F
DEFW 82E1H E1 82
6E9EH to 6E9FH, PGMBGN: the pointer to the start of the program text. The 82E1H the file carries lies inside module 2's own area and BEGIN pins the real program area at 83EDH, inside its own first instruction.
6EA0-6EA1
DEFW 6BD1H D1 6B
6EA0H to 6EA1H: the message the Overflow and Division by zero warning is to write, which 30DAH loads and 30C0H is the one instruction that ever changes. The 6BD1H the file carries is the Overflow text, which is the warning the interpreter gives most.
6EA2
DEFB 3AH 3A
6EA2H: a colon, which 5941H and 5944H make SAVTXT 718CH point at for command level, so that the first thing the statement loop reads at the Ready prompt is the end of a statement and nothing else.
6EA3-6EA6
DEFS 4 00 x 4
6EA3H to 6EA6H: four bytes of 00H, named by no instruction of the three images, standing between the colon above and the conversion message flag below.
6EA7
DEFB 00H 00
6EA7H: the flag that makes a number which will not convert give a message rather than an error, which INPUT sets at 6468H for the one item it is reading and which 3123H of the conversion reads.
6EA8
DEFB 00H 00
6EA8H: LOAD's run flag, 00H to stop at Ready and 0F1H for the R option, stored at 4C44H out of the byte the entry one below LOAD's own left in Register A and read at 41B0H when the load has finished.
6EA9
DEFB 00H 00
6EA9H: where the count of file buffers waits while a program is loaded, 41C4H taking it out of 6ECEH and 41CFH putting it back, and 5A4BH and 568DH doing the same for a line entered and for a chain, so that the clearing closes no file.
6EAA
DEFB 00H 00
6EAAH: which of PUT and GET is running, not 00H for PUT and 00H for GET, stored at 4FCAH out of the two entries' own byte and read at 5021H and 5045H and nowhere else.
6EAB
DEFB 00H 00
6EABH: one byte of 00H, named by no instruction of the three images, standing between the PUT and GET flag and the first real file buffer address.
6EAC-6EAD
DEFW 0000H 00 00
6EACH to 6EADH: the address of the first real file buffer, written by 7FFBH when BASIC sets its files up and read at 5A55H, which puts the table of control block addresses below back after a line has been entered.
6EAE-6ECD
DEFS 32 00 x 32
6EAEH to 6ECDH: the table of file control block addresses, one word for each of up to sixteen files, the first being file number 0, which is BASIC's own. 4AB2H indexes it, OPEN refuses number 0 and 5A3BH points its first entry at a dummy byte at 6EF8H.
6ECE
DEFB 00H 00
6ECEH: the count of file buffers, 03H by default and set by the FILES parameter, which BEGIN refuses at sixteen or more. 4AA8H gives Bad file number for a number above it and KILL's walk counts down from it.
6ECF
DEFB 00H 00
6ECFH: the count of the characters of a variable name beyond its second, kept by the name reader at 3A46H, which 3CE6H copies into a new entry and 3CFAH compares an entry's own against.
6ED0-6EF5
DEFS 38 00 x 38
6ED0H to 6EF5H: the characters of a variable name from the third on, up to thirty-eight of them, each with bit 7 set, written by the name reader at 3A2AH. A name of thirty-nine characters or more gives Syntax error because this is all the room there is.
6EF6-6EF7
DEFW 0000H 00 00
6EF6H to 6EF7H: where the text pointer waits while the array code pulls a variable name's tail back off the stack, written at 3B9AH and read at 3BA9H.
6EF8
DEFB 00H 00
6EF8H: the byte that stands in for a file control block while a line is being entered, which 5A39H clears and 5A3BH points the table at, so that the clearing at 42C7H finds file number 0 closed and walks no buffers.
6EF9-7038
DEFS 320 00 x 320
6EF9H to 7038H, LBUF: the line buffer, 320 bytes of it, which TOBUFF at 5AD3H fills with the tokenized line from 6EFAH up with Register Pair BC holding 013BH, 315, as the room, and whose own first byte 5AEDH leaves Register Pair HL on. NAME's first filespec buffer at 7037H is its top two bytes and the thirty above them.
7039-7138
DEFS 256 00 x 256
7039H to 7138H, INBUF: the input buffer, 256 bytes of it, which IMMED puts the first key into at 812DH before handing the rest of the line to @KEYIN, which 7E23H gives a maximum of 0F9H, 249 characters, and which 7E42H fills from a file up to 255 characters and a 00H. NAME's second filespec buffer stands at 7057H and UNTOKE lays its characters down from 7039H.
7139-713B
DEFS 3 00 x 3
7139H to 713BH: three bytes of 00H above the input buffer, named by no instruction of the three images and beyond the reach of either of the two readers that fill it.
713C
DEFB 00H 00
713CH: the print position, which 418AH keeps out of the video driver and 41E9H reads to decide whether a carriage return is wanted, and which 420DH, 41FAH and 7E00H put back to 00H.
713D-713F
DEFS 3 00 x 3
713DH to 713FH: the random number generator's seed, three bytes of it, which 38B6H and 38BBH read and 38CFH and 38D8H write the next one into, so that RND's own answer is also its state.
7140
DEFB 00H 00
7140H: one byte of 00H, named by no instruction of the three images, standing between the random seed and the DIM flag.
7141
DEFB 00H 00
7141H: the DIM flag. DIM's own entry at 39FAH leaves it holding 0AFH or more and the entry every other caller uses at 39FBH leaves it 00H, and that one byte decides whether an array that exists is an error and whether a subscript list declares or refers.
7142
DEFB 00H 00
7142H: the type of the value in hand as a count of bytes, 02H integer, 03H string, 04H single precision and 08H double precision, which 76A4H reads and which more rows of this page name than any other cell of the band.
7143
DEFB 00H 00
7143H: a cell three parts of the interpreter share. The evaluator keeps the number of the operator being applied here, 741EH writing it and 7473H reading it; the tokenizer uses it as the copy verbatim flag, 5AD7H clearing it and 5B17H setting it; and UNTOKE uses its three low bits for inside a string, inside a DATA and inside a REM, written at 7A13H, 7A39H, 7ABDH and 7AC7H.
7144
DEFB 00H 00
7144H: the tokenizer's own flag, which says what a digit standing where the pointer is would mean, 0FFH after a name so that the digit is part of it, written at 5B17H and read at 5C01H.
7145-7146
DEFW 0000H 00 00
7145H to 7146H, IPOS: the continuation point after a number the tokenizer packed, which NXTCHAR writes at 5EC4H and 5EFCH and which 5F10H's stand-in brings back, and which 7BEAH of UNTOKE reads when it has written the digits out again.
7147
DEFB 00H 00
7147H: the token of the numeric constant the tokenizer has already converted, which NXTCHAR writes at 5EB3H, 5EA8H hands back as the character the caller sees, 5FB6H clears and 7B8EH of UNTOKE reads to choose between an octal and a hexadecimal prefix.
7148
DEFB 00H 00
7148H: the type of that constant as a count of bytes, 02H for an integer, 04H for single precision and 08H for double precision, written by 5ECFH for every narrow token and by 5EECH for the three wide ones, and read at 7BA8H to choose the type suffix.
7149-7150
DEFS 8 00 x 8
7149H to 7150H: the value of that constant, unpacked out of the line, two bytes for an integer or a line reference, four for a single precision number and eight for a double precision one, which 5EF6H has 294AH of BASIC/OV1 move in. 5FAEH reads it as a line number and 7745H for the digit of USR3.
7151-7152
DEFW 0000H 00 00
7151H to 7152H, OLDHI: HIGH$ as BASIC found it, kept by BEGIN at 8477H, which CLEAR weighs a top of memory against at 44AAH and refuses anything above.
7153-7154
DEFW 0000H 00 00
7153H to 7154H: the top of the program and variable space, what lies between it and BASEND being the stack, which CLEAR's third argument sizes and which 59FCH gives the whole of the string area back from.
7155-7156
DEFW 0000H 00 00
7155H to 7156H: the pointer to the next free slot of the temporary string descriptor pool below, which 4323H and 4390H set to 7157H to give the whole pool back, 4698H moves up and 481DH moves down.
7157-7174
DEFS 30 00 x 30
7157H to 7174H: the pool of temporary string descriptors, ten slots of three bytes, which every string expression in flight takes one of. 4323H gives the whole of it back at the start of a statement.
7175-7177
DEFS 3 00 x 3
7175H to 7177H: the three bytes 4641H and 464FH build a string descriptor in, a length and an address, before 467FH copies it into the pool. These three are also the pool's eleventh slot, which is how 4695H's test against 7178H turns a pool that has filled into error 16, String formula too complex: the copy of the eleventh descriptor is of these bytes onto themselves.
7178-7179
DEFW 0000H 00 00
7178H to 7179H, HIPT: the high pointer of the string area, lowered by 46BDH when string space is taken and raised by 481DH when the topmost temporary is given back, and which 5661H lowers below the variables a CHAIN has moved.
717A-717B
DEFW 0000H 00 00
717AH to 717BH: a cell two things share. The array maker leaves the address of a new array's count of dimensions here while its elements are laid out and cleared, and CHAIN's walk of a string array's elements keeps the byte after the last of them here, written at 55FFH and read at 5609H.
717C-717D
DEFW 0000H 00 00
717CH to 717DH: the first address above the array whose elements the string space collection is walking, written at 4771H and read at 4761H, which is what stops that walk at the end of one array rather than at the end of the table.
717E-717F
DEFW 0000H 00 00
717EH to 717FH: a cell FOR and WHILE share for the text pointer of what follows them, written by WHILE at 52CAH and read at 52E4H for the condition, and written by FOR at 5D84H for the statement after it, which goes into the frame at plus seventeen.
7180-7181
DEFW 0000H 00 00
7180H to 7181H: the number of the line READ is taking its items from, written only by 653DH when the DATA hunt moves to a new line and read by 5866H, which names it when a Syntax error is found in the data.
7182
DEFB 00H 00
7182H: the flag that makes the variable search demand an array that already exists or refuse one, read at 3A7AH. 01H from CHAIN's COMMON walks demands one, 64H from FOR and 80H from CALL refuse one, and 00H lets the character the name ended on decide.
7183
DEFB 00H 00
7183H: READ or INPUT, written at 64A3H out of the two bytes of one instruction, the OR 0AFH at 64A1H leaving bit 7 set for one and the XOR A one byte on leaving 00H for the other, and read at 6440H and 6484H.
7184-7185
DEFW 0000H 00 00
7184H to 7185H: where the text pointer waits across a system call or a machine language routine, which the shared open brings back at 520EH, CALL at 53E7H and the protected SAVE at 4349H.
7186
DEFB 00H 00
7186H: the flag that says the program text holds line references in their resolved form, the 0DH token with a line's address rather than the 0EH token with its number. 6036H of GOTO sets it, 661DH and 661EH are the two walks that turn one form into the other and 42BDH clears it with the program.
7187
DEFB 00H 00
7187H: the AUTO flag, which AUTO sets at 61C2H and which READY reads at 5947H to decide whether to write a line number and wait, and which 5969H and 596FH clear when the automatic numbering has to stop.
7188-7189
DEFW 0000H 00 00
7188H to 7189H: the line number AUTO is to write next, stored at 5984H as the one before it plus the increment and read at 594DH, and which 61C6H sets from AUTO's own first argument.
718A-718B
DEFW 0000H 00 00
718AH to 718BH: AUTO's increment, written at 61BFH out of its second argument and read at 5974H, where the addition that overflows 0FFFAH is what stops the numbering.
718C-718D
DEFW 0000H 00 00
718CH to 718DH, SAVTXT: the text pointer the statement loop saves before every statement, written at 5E3EH, at 59C4H for a line being entered and at 5944H with the colon at 6EA2H for command level, and read at 43A7H and 63B4H.
718E-718F
DEFW 0000H 00 00
718EH to 718FH: where the Stack Pointer stands, saved by the statement loop and read by 4317H, by CALL's return at 53E3H, by the error handler at 589EH and by INPUT$ at 4F1EH when BREAK is pressed.
7190-7191
DEFW 0000H 00 00
7190H to 7191H: the number of the line the last error was found in, which the error handler copies out of 6E9CH at 5889H and which ERL reads at 7F4CH and RESUME at 6144H.
7192-7193
DEFW 0000H 00 00
7192H to 7193H, CURLIN: the current line number as the enhancement package reads it, which IMMED uses for the up arrow, the down arrow and the full stop, and which LIST writes at 79E5H and the line entry at 59D4H.
7194-7195
DEFW 0000H 00 00
7194H to 7195H: the text pointer the error handler keeps at 58ADH out of SAVTXT, which is where RESUME takes the program up again at 6133H.
7196-7197
DEFW 0000H 00 00
7196H to 7197H: the line number ON ERROR GOTO named, written at 6195H and cleared at 616DH and 5A05H, and read at 58C1H, which is what makes an error reach the program's own handler rather than the message writer.
7198
DEFB 00H 00
7198H: the flag that says an error is being handled, written at 6162H, 616EH and 6189H, cleared at 42E8H and 4385H with the variables, and read by RESUME at 613BH and by 582FH, which gives No RESUME when the program runs out with it set.
7199-719A
DEFW 0000H 00 00
7199H to 719AH: a cell three things share. The array code leaves the text pointer here while the stack is given over to the subscripts, written at 3BDBH and read at 3CD5H; the expression machinery keeps the pointer a term ended at here; and 5A41H of the line entry keeps FILEX here across the clearing of the variables.
719B-719C
DEFW 0000H 00 00
719BH to 719CH, OLDLIN: the number of the line END or STOP was in, stored at 43A4H and by the error handler at 58B9H, which CONT reads at 43E7H to give Can't continue when there is nothing to go back to.
719D-719E
DEFW 0000H 00 00
719DH to 719EH, OLDTXT: the text pointer a CONT would go back to, stored at 43AAH and cleared by NEW at 42F0H, which CONT reads at 43DCH and gives back as the place to carry on from.
719F-71A0
DEFW 0000H 00 00
719FH to 71A0H, VARTAB: the start of the simple variables and the byte after the last of the program text. 4306H and 4309H set the two pointers above it from this one together, which is what CLEAR and NEW do.
71A1-71A2
DEFW 0000H 00 00
71A1H to 71A2H: the start of the array table, which is also the end of the simple variables. CALL and SWAP read it before and after a variable lookup to see whether the search created a variable and moved the arrays.
71A3-71A4
DEFW 0000H 00 00
71A3H to 71A4H, LOPT: the end of the arrays and the lowest free address, which 5588H lowers when CHAIN throws a variable away and 7C15H writes with the other two when a line is deleted.
71A5-71A6
DEFW 0000H 00 00
71A5H to 71A6H: the DATA pointer, written only by RESTORE at 437AH and read only by READ at 649EH, which is the whole of how a program's data is walked.
71A7-71C0
DEFS 26 00 x 26
71A7H to 71C0H: the declared type table, one byte for each of the letters A to Z, holding the type as a count of bytes that a name beginning with that letter takes when it carries no suffix. DEFINT, DEFSTR, DEFSNG and DEFDBL fill it in and the name reader indexes it through the base 7166H.
71C1-71C2
DEFW 0000H 00 00
71C1H to 71C2H: the pointer to the parameter region saved under the one in force, which 7871H writes when a user-defined function is called and 78C7H reads when it returns, and which module 2 puts into the chain head at 8416H.
71C3-71C4
DEFW 0000H 00 00
71C3H to 71C4H: the length of the parameter region of a user-defined function call in bytes, which 7874H copies out of 722BH when the function is called and which the variable search adds to 71C5H to find the region's end.
71C5-7228
DEFS 100 00 x 100
71C5H to 7228H: the parameter region of a user-defined function call, a hundred bytes of it, which 7882H lays down and 78B9H takes away. When 7294H says the region stands, the variable search walks it before the simple variables, and that is the whole of what makes a parameter local to its function.
7229-722A
DEFW 0000H 00 00
7229H to 722AH: the head of the chain of variable regions outside the ordinary table, which module 2 fills in at 8416H with 71C1H and which the string space collection walks from 4708H.
722B-722C
DEFW 0000H 00 00
722BH to 722CH: the length of the parameter block a function definition carries, written when the definition is read and copied into 71C3H at 7874H when the function is called.
722D-7290
DEFS 100 00 x 100
722DH to 7290H: the area a call of a user-defined function gathers the parameters' own table entries into, a hundred bytes of it, filled one entry at a time by 7837H and laid down at 71C5H by 7882H. 7829H is what holds it to a hundred bytes, and reaching that is Illegal function call.
7291
DEFB 00H 00
7291H: which of the two regions the variable search is walking, set from 7294H at 3A98H and cleared at 3ADAH when the function parameter region has been walked and the simple variables are next.
7292-7293
DEFW 0000H 00 00
7292H to 7293H: the first address above the region the variable search is walking, written at 3AA4H for the function parameter region and from 71A1H for the simple variables, and read by the walk at 3A9EH.
7294
DEFB 00H 00
7294H: the flag that makes the variable search walk the function parameter region at 71C5H before the simple variables, which 7297H's own count of calls in flight is what sets and clears.
7295-7296
DEFW 0000H 00 00
7295H to 7296H: a cell two things share. The string space collection keeps the place its walk of the chain of variable regions has reached here, set to 7229H at 4708H; and 5652H of CHAIN keeps the length of the simple variables here across the load, which 56AEH reads to put the array table back.
7297-7298
DEFW 0000H 00 00
7297H to 7298H: the count of user-defined function calls in flight, raised at 788DH and lowered at 78D2H, which is what the flag at 7294H is set and cleared from.
7299
DEFB 00H 00
7299H: whether the item in hand is to be put in a variable, written at 64C0H out of the two bytes of one instruction in the READ and INPUT code and read at 6514H.
729A-729B
DEFW 0000H 00 00
729AH to 729BH: the text pointer of the NEXT in hand, written at 4531H so that the loop can be gone round again from the statement after the FOR.
729C
DEFB 00H 00
729CH: the flag that tells FOR's own entry into NEXT from a NEXT statement's, which 4527H and 4528H are the two bytes of, so that the shared code knows which of the two statements it is running.
729D-72A0
DEFS 4 00 x 4
729DH to 72A0H: the four byte cell FOR fills with the loop's starting value before the first test, which is what makes a loop whose limit is already past run its body once.
72A1-72A2
DEFW 0000H 00 00
72A1H to 72A2H: the number of the line the forward scan at 6714H has reached, written at 671CH and 674CH and lent to 6E9CH at 6793H so that an error in a NEXT's variable list names the line the scan is reading.
72A3
DEFB 00H 00
72A3H: the OPTION BASE in force, 00H or 01H, written by OPTION BASE at 66F7H and cleared with the program at 42D8H. 3BC9H applies it to every subscript and 3C64H's XOR 0BH is how it sets the default bound.
72A4
DEFB 00H 00
72A4H: the flag that says an OPTION BASE has been given, which 66F4H sets and 42D5H clears, and which is what makes a second OPTION BASE in one program Illegal function call.
72A5
DEFB 00H 00
72A5H: where CHAIN puts the OPTION BASE value aside at 5401H, so that the program it loads keeps the one the program it came from had, which 5696H brings back.
72A6
DEFB 00H 00
72A6H: where CHAIN puts the OPTION BASE set flag aside with it, which 569CH brings back, so that the chained program may not set an OPTION BASE of its own either.
72A7-72C4
DEFS 30 00 x 30
72A7H to 72C4H: thirty bytes of 00H, named by no instruction of the three images, which is the largest such run of the band. No instruction of module 1, of module 2 or of BASIC/OV1 loads any of their addresses or reads them, and nothing writes a pointer to them into a cell: they are as wide as the temporary descriptor pool and are put to no use the bytes show.
72C5
DEFB 00H 00
72C5H: a cell two things share. CALL works its entry address out into 72C5H and 72C6H at 5370H and takes the jump from them at 53DEH; and UNTOKE uses this byte alone to say what it wrote last, 00H for nothing, 01H for a character of a name and 0FFH for a keyword, which is what puts one blank between two things that would otherwise run together.
72C6
DEFB 00H 00
72C6H: the high byte of CALL's entry address, and on its own the flag that says whether INPUT writes the automatic question mark, set to 0FFH at 63D6H for every INPUT and cleared at 63E3H when the statement names its own prompt.
72C7-72C8
DEFW 0000H 00 00
72C7H to 72C8H: where CHAIN puts HIPT aside at 5658H while the variables stand above the program being loaded, which 56BAH brings back once they have been copied down again.
72C9-72CA
DEFW 0000H 00 00
72C9H to 72CAH: two bytes of 00H, named by no instruction of the three images, standing between the HIPT CHAIN puts aside and the protected program flag.
72CB
DEFB 00H 00
72CBH: the protected program flag, which 4C77H sets to 0FEH when the first byte of the file read says the program is protected and 42B7H clears with the program, and which 57E8H reads to refuse a LIST, an EDIT, a SAVE or a line entered.
72CC
DEFB 00H 00
72CCH: the MERGE flag, which 5401H stores the MERGE token 0C5H into and 4310H reads so that a MERGE closes no file, and which 5683H of CHAIN reads to choose between LOAD's path and MERGE's.
72CD
DEFB 00H 00
72CDH: the flag CHAIN's parse sets when a DELETE range was given, which 5664H reads before it closes those lines up.
72CE-72CF
DEFW 0000H 00 00
72CEH to 72CFH: the address after the last line of CHAIN's DELETE range, which the parse works out through the range parser at 5A96H and 566FH reads as the place the block mover copies from.
72D0-72D1
DEFW 0000H 00 00
72D0H to 72D1H: the address of the first line of CHAIN's DELETE range, which 566AH reads as the place the block mover copies to.
72D2
DEFB 00H 00
72D2H: the flag that says a chain is in hand, set at 5680H and cleared by the error handler at 5890H and at 56A3H, which LOAD tests at 4CBCH and 41B7H reads to send the end of a load to CHAIN's second half rather than to Ready.
72D3-72D4
DEFW 0000H 00 00
72D3H to 72D4H: the line number CHAIN named, which the parse leaves 0000H when none was given and 56D3H reads to decide whether the chained program runs from that line or from its first.
72D5-72DC
DEFS 8 00 x 8
72D5H to 72DCH: the eight bytes SWAP exchanges the two values through, which is one more than the seven a double precision value takes and so serves every type.
72DD
DEFB 00H 00
72DDH: the trace flag, read only at 5E5DH, which TRON sets and TROFF clears through the one pair of bytes at 43F0H, and which is what makes the statement loop write each line number in brackets.
72DE
DEFB 00H 00
72DEH: the flag the exponent form of a PRINT USING field keeps, cleared at 341AH and set to 01H at 3450H when the value had to be divided by ten once more to bring its first digit into the field, which 348AH adds to the exponent 32ADH writes.
72DF-72E6
DEFS 8 00 x 8
72DFH to 72E6H: where the exponent form of a PRINT USING field keeps the mantissa while it works the exponent out, four bytes of it for a single precision value and eight for a double, copied there at 3420H and loaded back at 3447H.
72E7
DEFB 00H 00
72E7H: the guard byte below the accumulator's own low mantissa bytes, which only BASIC/OV1 reaches, writing it at 2B64H, 2CC0H and 2CD2H and reading it at 2D25H: it is where a byte shifted off the bottom of a double precision value goes.
72E8-72EB
DEFS 4 00 x 4
72E8H to 72EBH: the low four mantissa bytes of a double precision value in the accumulator, which stand below the four at 72ECH, so that a single precision value is the top four bytes of a double one and nothing has to be moved to widen it.
72EC-72EF
DEFS 4 00 x 4
72ECH to 72EFH: the accumulator, the value in hand, with its exponent byte at 72EFH. For a string it holds the address of the descriptor and not the characters, which is what WRITE and the string functions read, and more rows of this page name 72ECH than any other address of the band but 7142H.
72F0
DEFB 00H 00
72F0H: the byte above the accumulator's own exponent byte, which 38DEH of RND loads the address of so that it can walk the four bytes downwards from above them.
72F1
DEFB 00H 00
72F1H: the number conversion's complaint count, which 7352H clears at the start of every expression and 67BCH clears for 4329H, and which 30D3H reads so that an expression that overflows forty times writes the warning twice and no more.
72F2
DEFB 00H 00
72F2H: where 67B4H hands that count over, having copied it out of 72F1H and cleared that, and which INPUT sets to 01H at 6465H before it takes an item and reads at 6475H to see whether the item overflowed.
72F3
DEFB 00H 00
72F3H: the flag that picks between the two forms the number formatter writes a value in, cleared at 31DBH for the first pass and set to 80H at 3242H for the second, and read at 3278H: clear gives the exponential form and set the fixed one.
72F4
DEFB 00H 00
72F4H: the guard byte below the second accumulator, which only BASIC/OV1 reaches, writing it at 2CBFH and reading it at 2CCFH, and which does for the right hand operand what 72E7H does for the left.
72F5-72FA
DEFS 6 00 x 6
72F5H to 72FAH: the first six bytes of the second accumulator, where a double precision operation looks for its right hand operand, which 745DH and 7483H put it into through 2927H of BASIC/OV1.
72FB-72FC
DEFW 0000H 00 00
72FBH to 72FCH: the top two bytes of that second accumulator, which the up arrow uses on their own as the whole power the repeated squaring at 37F9H counts down, written at 3801H out of what 2AB7H made of the exponent and read at 3821H.
72FD
DEFB 00H 00
72FDH: the byte in front of the sign character of the number buffer below, which 3304H loads the address of so that the step after it lands on 72FEH, and which 335DH steps back to.
72FE-7317
DEFS 26 00 x 26
72FEH to 7317H: the buffer the number formatter writes its characters into, twenty-six bytes of it, beginning with the sign character at 72FEH. 32CDH puts the 00H after the last character and returns with Register Pair HL addressing 72FEH, and UNTOKE at 7BB7H copies the characters out of it. The first address above it that anything names is 7318H.
7318-731D
DEFS 6 00 x 6
7318H to 731DH: the first six bytes of a third eight byte working area that only BASIC/OV1 reaches, which 2D4BH loads into Register Pair DE with 72F5H in Register Pair HL and 2ECFH loads on its own. 2EE2H of that file moves the accumulator's seven mantissa bytes here and clears the seven it took them from, which is what frees the accumulator to hold the running product of the double precision multiplication and the running quotient of its division, the remainder of the division standing here.
731E
DEFB 00H 00
731EH: the seventh byte of that area and the top of the seven the mantissa is moved into, which 2EE7H of BASIC/OV1 loads the address of on its own.
731F
DEFB 00H 00
731FH: the eighth and last byte of it, which stands above the seven the mantissa is moved into and takes the borrow out of them: 2EA8H of BASIC/OV1 clears it and 2EBBH writes the top byte of the remainder into it, no quotient digit ever standing here.
7320-7327
DEFS 8 00 x 8
7320H to 7327H: the last eight bytes of module 1, named by no instruction of the three images. They are as wide as each of the three accumulators below them and stand where a fourth would, and the page for BASIC/OV1 may yet find a reader for them.

7328H - The Command Level Texts (7328H-7339H)

Three texts the interpreter shows at command level, each ended by a 00H byte, with the bytes below them, 7300H-7327H, holding 00H and belonging to the module's variable area. BASDSP at 46A5H, which NEWB/EQU names, is the routine that writes a text of this shape.

7328-732C
DEFM " in " / DEFB 00H 20 69 6E 20 00
7328H-732CH: a space, the word in, another space and the 00H that ends the text. It is what stands between an error message and the line number the error happened on, so that Syntax error in 100 is the message, this text and the number.
732D-7333
DEFM "Ready" / DEFB 0DH, 00H 52 65 61 64 79 0D 00
732DH-7333H: the word Ready, the 0DH that ends the line and the 00H that ends the text. READY at 5920H, which NEWB/EQU names, is the routine that shows it, and it is what the interpreter writes whenever it comes back to command level.
7334-7339
DEFM "Break" / DEFB 00H 42 72 65 61 6B 00
7334H-7339H: the word Break and the 00H that ends the text. It is shown without a line number of its own, the text at 7328H and the number being added after it when the break happened in a program.

733AH - The Two Entries that Demand a Character First (733AH-7344H)

Two three byte heads that stand in front of the evaluator so that a caller which must see one particular character before the expression does not have to write the demand out for itself. 733AH demands the equals sign, the byte at 733DH being 0F1H, the token the tokenizer gives it, and is what DEF FN's body at 7899H, RSET and LSET at 4E28H and the file number parser at 4A08H reach. 7341H demands the opening parenthesis, the byte at 7344H being the character 28H itself and not a token, and it is reached by INSTR at 493CH, by the one argument function path at 7651H through 7571H, and by the three argument string functions at 7639H. Both demands are made by 4353H, which compares the character at the text pointer with the byte standing after the call and steps its own return address past it, so each of these heads is three bytes of call and one byte of data. 733AH has to jump to the evaluator because 733DH stands between it and 7345H; 7341H falls straight into it.

733A
Demand an equals sign, then work out the expression (733AH): call 4353H, the character demand, which insists that the text pointer in Register Pair HL stands on the character held in the byte after the call.
733D
DEFB 0F1H F1
733DH: the byte 4353H above compares the line character with, which is 0F1H, the token the reserved word table's operator group at 6B32H gives the equals sign. It is the token and not the character 3DH, because the line has been through the tokenizer by the time an expression is worked out.
733E
Jump to 7345H, the evaluator proper, which the byte of data above keeps this entry from falling into.
7341
Demand an opening parenthesis, then work out the expression (7341H): call 4353H, the character demand, which insists on the byte that follows it and steps the return address past that byte.
7344
DEFB 28H 28
7344H: the byte 4353H above compares the line character with, which is 28H, the opening parenthesis itself. A parenthesis is punctuation and the tokenizer leaves it as the character it is, where the equals sign of 733DH is a token, and this row and the one at 733DH side by side are the plainest statement of that difference the page holds. The evaluator begins at the next byte, so this entry needs no jump.

7345H - The Expression Evaluator (7345H-73CBH)

The routine the whole interpreter turns on: twenty-four places call 7345H and nineteen branches of the page that had no link until this pass reached it. It works out one expression from the text pointer in Register Pair HL and leaves its value in the accumulator at 72ECH with the value's type in 7142H. The method is the one every Microsoft BASIC uses, and the only state it keeps is on the stack. A precedence is carried in Register D: 7345H starts with 00H, which takes everything, and each operator that is met puts its own precedence from the table at 6B47H there before the expression to its right is worked out. 7348H is the entry that takes the precedence already in Register D, and the whole of the recursion goes through it. 7358H is the head of the loop and the address 7383H pushes as a return, so that an operator which has had its right hand side worked out comes back here to look for the next one. The loop reads the character at the text pointer: below 0F0H it is not an operator and the expression ends with a RET; 0F0H, 0F1H and 0F2H are the three relational operators and go to 73CCH, which gathers as many of them as stand together into one mask; 0F3H up are the twelve arithmetic and logical operators, numbered by 7367H as the token less 0F3H. An operator whose precedence is no higher than the one the caller is holding ends the loop too, and that is the whole of how precedence works: the caller applies its own operator first and then comes back for this one. An operator that does win pushes four things and recurses: the caller's precedence and operator number, 7358H to come back to, the value in hand (two, four or eight bytes, by its type), the type and the new operator number, and 741CH to apply the operator with. The plus is the one operator that can take strings, and 736CH tests for that before anything else, sending a string to the concatenation at 47D1H. The up arrow is taken out of the line at 7387H before any table is reached, and the ten logical and integer operators at 738CH and 7390H, so that only the plus, the minus, the asterisk and the oblique stroke reach 7396H and have their operand pushed as a number.

7345
DEC HL 2B
The expression evaluator (7345H): decrement Register Pair HL, the text pointer, so that the call to NXTCHAR at 5E93H which 74C1H makes below reads the character the caller was standing on rather than the one after it.
7346
LD D,00H 16 00
Load Register D with 00H, the precedence this entry works at, which is below that of every operator in the table at 6B47H and so lets the whole expression be taken.
7348
PUSH DE D5
The entry that keeps the precedence in Register D (7348H), which 73C9H recurses through and which unary minus at 757BH and NOT at 7691H use for their own precedences: push Register Pair DE, the precedence in Register D and the operator number in Register E, which 735BH takes back into Register Pair BC.
7349
LD C,01H 0E 01
Load Register C with 01H, one level of stack, which the check below reads as the number of three byte frames this evaluation needs to be sure of.
734B
Call 4247H, the stack space check, which gives Out of memory through 425CH when Register C levels of stack are not to be had.
734E
Call 74C1H, which works out one term of the expression into the accumulator at 72ECH, puts its type in 7142H, and answers with Register Pair HL at the character after it.
7351
XOR A AF
Clear Register A to 00H, the value the flag below is to be set to.
7352
LD (72F1H),A 32 F1 72
Store Register A into the byte at 72F1H, the flag the function dispatch sets to 01H at 7667H and the number conversion counts its Overflow warnings up in at 75F4H, so that every expression starts with it holding 00H. 67B4H takes a copy of it into 72F2H and clears it the same way.
7355
LD (7199H),HL 22 99 71
Store Register Pair HL, the text pointer standing after the term, into the word at 7199H, which the instruction below brings straight back: the loop is entered at 7358H from 76A1H and as the return address 7386H pushes, and both of those arrive with Register Pair HL holding something else, so the pointer has to come out of memory and not out of the register.
7358
LD HL,(7199H) 2A 99 71
The head of the operator loop (7358H), which 7383H pushes as a return address and 76A1H jumps to: load Register Pair HL with the word at 7199H, the text pointer the term ended at.
735B
POP BC C1
Pop Register Pair BC, which brings back the precedence 7348H pushed from Register D into Register B and the operator number it pushed from Register E into Register C.
735C
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character of the line standing after the term that was just worked out.
735D
LD (717AH),HL 22 7A 71
Store Register Pair HL into the word at 717AH, the text pointer standing on that character, which 73C6H loads again when an operator is taken and 7852H and 784CH use for the same purpose in a user function call.
7360
CP 0F0H FE F0
Compare Register A with 0F0H, the token of the greater than sign and the lowest token of any operator.
7362
RET C D8
Return on C, the character being below every operator token, which is the end of the expression: the value is in the accumulator at 72ECH and its type in 7142H, and Register Pair HL stands on the character that ended it.
7363
CP 0F3H FE F3
Compare Register A with 0F3H, the token of the plus sign, which is the first of the twelve arithmetic and logical operators.
7365
Jump to 73CCH on C, the character being 0F0H, 0F1H or 0F2H, one of the three relational operators, which are gathered into a mask there rather than taken one at a time.
7367
SUB 0F3H D6 F3
Subtract 0F3H from Register A, which turns the operator's token into its number in the table at 6B47H: 00H for the plus, 01H for the minus, 02H for the asterisk, 03H for the oblique stroke, 04H for the up arrow, and 05H to 0BH for AND, OR, XOR, EQV, IMP, MOD and the backslash.
7369
LD E,A 5F
Load Register E from Register A, that operator number, which is the index this routine carries from here on and which 73BFH hands to 741CH.
736A
Jump to 7375H on NZ, the operator number not being 00H, so that the string test below is made for the plus sign alone.
736C
LD A,(7142H) 3A 42 71
The plus sign (736CH): load Register A with the byte at 7142H, the type of the value the term left in the accumulator.
736F
CP 03H FE 03
Compare Register A with 03H, the type of a string, which is the one type the plus sign can be asked to add.
7371
LD A,E 7B
Load Register A from Register E, the operator number of 00H, which the jump below needs in Register A when it is not taken. A LD changes no flag, so the comparison made above is the one the jump acts on.
7372
Jump to 47D1H on Z, the value in hand being a string: A$ + B$ is the concatenation and not an addition, and 47D1H takes the second string itself rather than coming back here.
7375
CP 0CH FE 0C
Compare Register A with 0CH, which is one above the highest operator number the table at 6B47H holds.
7377
RET NC D0
Return on NC, the token having been above 0FEH and so no operator at all, which ends the expression where it stands.
7378
LD HL,6B47H 21 47 6B
Load Register Pair HL with 6B47H, the first byte of the operator precedence table, which holds one byte for each of the twelve operators in token order.
737B
LD D,00H 16 00
Load Register D with 00H, the high byte of the index, the operator number standing in Register E.
737D
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which makes Register Pair HL the address of this operator's precedence byte in the table at 6B47H.
737E
LD A,B 78
Load Register A from Register B, the precedence the caller is holding, which 735BH brought back off the stack.
737F
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, this operator's own precedence out of the table at 6B47H, which is where it stays until 7348H pushes it.
7380
CP D BA
Compare Register A with Register D, the caller's precedence against this operator's.
7381
RET NC D0
Return on NC, the caller's precedence being the same as this one or higher: the caller applies its own operator first and comes back to 7358H for this one afterwards, and that single comparison is the whole of how precedence is kept.
7382
PUSH BC C5
Push Register Pair BC, the caller's precedence in Register B and its operator number in Register C, which the return to 7358H below pops again.
7383
LD BC,7358H 01 58 73
Load Register Pair BC with 7358H, the head of this loop.
7386
PUSH BC C5
Push Register Pair BC, that address, as the return the operator below comes back to once it has been applied, so that the loop looks for another operator after it.
7387
LD A,D 7A
Load Register A from Register D, this operator's precedence, which is what the three tests below are made against rather than the token or the number.
7388
CP 7FH FE 7F
Compare Register A with 7FH, the precedence the table at 6B47H gives the up arrow, which is the highest of the twelve.
738A
Jump to 73E7H on Z, the operator being the up arrow, whose operand is pushed as a single precision number and whose routine is 36DFH, so that it never reaches an operator table.
738C
CP 51H FE 51
Compare Register A with 51H, which is one above the 50H the table gives AND and so above all five of AND, OR, XOR, EQV and IMP.
738E
Jump to 73F4H on C, the operator being one of those five, whose operands are made integers and whose work is done at 76B4H.
7390
AND 0FEH E6 FE
And Register A with 0FEH, which clears bit 0 and makes the 7AH of MOD and the 7BH of the backslash the same value.
7392
CP 7AH FE 7A
Compare Register A with 7AH, the precedence of MOD, which the instruction above has made the precedence of the backslash as well.
7394
Jump to 73F4H on Z, the operator being MOD or the backslash, which are integer operators like the five above and go the same way.
7396
LD HL,72ECH 21 EC 72
A number for the plus, the minus, the asterisk or the oblique stroke (7396H), and the path the relational operators reach at 7410H: load Register Pair HL with 72ECH, the accumulator, where a value of four bytes or fewer stands.
7399
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the value in the accumulator.
739C
SUB 03H D6 03
Subtract 03H from Register A, which makes the type of a string 00H, an integer 0FFH, a single precision number 01H and a double precision one 05H, and those four values are what the three jumps below read.
739E
Jump to 5884H on Z, the type having been 03H: a string cannot be the operand of any of these operators, and 5884H is the entry of the error chain that gives Type mismatch.
73A1
OR A B7
Or Register A with itself, which sets the Sign Flag and the Parity Flag from the value the subtraction left without changing it.
73A2
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the first byte of the value at 72ECH.
73A3
INC HL 23
Increment Register Pair HL to the second byte of the value.
73A4
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, that second byte.
73A5
PUSH BC C5
Push Register Pair BC, the first two bytes of the value, which 741CH and the routine it dispatches to take back off the stack.
73A6
Jump to 73BDH on M, the type having been 02H, an integer, whose whole value is the two bytes already pushed.
73A9
INC HL 23
Increment Register Pair HL to the third byte of the value.
73AA
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, that third byte.
73AB
INC HL 23
Increment Register Pair HL to the fourth byte of the value.
73AC
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, that fourth byte.
73AD
PUSH BC C5
Push Register Pair BC, the third and fourth bytes, so that four bytes of the value are now on the stack.
73AE
Jump to 73BDH on PO, the type having been 04H: the subtraction left 01H, which is one bit set and so odd parity, and a single precision number is the four bytes already pushed.
73B1
LD HL,72E8H 21 E8 72
A double precision number (73B1H): load Register Pair HL with 72E8H, the first byte of the eight byte accumulator, of which 72ECH is the second half.
73B4
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the first of the eight bytes.
73B5
INC HL 23
Increment Register Pair HL to the second of them.
73B6
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, that second byte.
73B7
INC HL 23
Increment Register Pair HL to the third of them.
73B8
PUSH BC C5
Push Register Pair BC, the first two of the eight bytes, which go on the stack under the four that 73A5H and 73ADH have already pushed.
73B9
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the third byte.
73BA
INC HL 23
Increment Register Pair HL to the fourth byte.
73BB
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, that fourth byte.
73BC
PUSH BC C5
Push Register Pair BC, the third and fourth of the eight bytes, so that all eight are on the stack.
73BD
ADD A,03H C6 03
Add 03H to Register A, which puts back the three 739CH took off and leaves Register A holding the type itself again.
73BF
LD C,E 4B
Load Register C from Register E, the operator number, which 741DH stores into 7143H.
73C0
LD B,A 47
Load Register B from Register A, the type of the value that has just been pushed, which 7424H compares the second operand's type with.
73C1
PUSH BC C5
Push Register Pair BC, the type in Register B and the operator number in Register C, which 741CH pops.
73C2
LD BC,741CH 01 1C 74
Load Register Pair BC with 741CH, the routine that reconciles the two types and dispatches to the operator.
73C5
PUSH BC C5
Push Register Pair BC, that address, as the return the expression below comes back to. The up arrow at 73F2H, the integer operators at 73FDH and the relational operators at 741AH all jump here with their own address in Register Pair BC instead.
73C6
LD HL,(717AH) 2A 7A 71
Load Register Pair HL with the word at 717AH, the text pointer standing on the operator, which 735DH stored.
73C9
Jump to 7348H, which pushes this operator's precedence from Register D and its number from Register E and works out the expression to its right, so that the whole evaluator is recursive through this one jump.

73CCH - The Relational Operators Gathered into One Mask (73CCH-73E6H)

The three tokens 0F0H, 0F1H and 0F2H are the greater than sign, the equals sign and the less than sign, and BASIC lets two of them stand together: >=, <= and <> are each two tokens in the line. This loop reads every relational token that stands together at the text pointer and builds a three bit mask in Register D out of them, bit 0 for the less than sign, bit 1 for the equals sign and bit 2 for the greater than sign. 73D6H is where each bit is made: the token less 0F0H is 00H, 01H or 02H, the comparison with 01H sets the Carry Flag for the greater than sign alone, and the RLA that follows shifts that Carry Flag into the value, so that 00H becomes 01H, 01H becomes 02H and 02H becomes 04H. The exclusive OR with what has been gathered so far sets the new bit, and the comparison after it gives Syntax error through 586CH when the bit was already set, which is what makes >> and == wrong where >= is right. The mask then goes to 73FFH, which pushes it and asks the operator table for the comparison.

73CC
LD D,00H 16 00
The relational operators (73CCH): load Register D with 00H, the mask of relational tokens gathered so far, which is empty when the first of them is met.
73CE
SUB 0F0H D6 F0
Subtract 0F0H from Register A, the character at the text pointer, which leaves 00H for the greater than sign, 01H for the equals sign and 02H for the less than sign.
73D0
Jump to 73FFH on C, the character having been below 0F0H and so not a relational token at all, which ends the gathering and takes the mask in Register D to the comparison.
73D2
CP 03H FE 03
Compare Register A with 03H, which is one above the highest of the three relational tokens.
73D4
Jump to 73FFH on NC, the character having been 0F3H or above, which ends the gathering the same way.
73D6
CP 01H FE 01
Compare Register A with 01H, which sets the Carry Flag for the 00H of the greater than sign and clears it for the equals sign and the less than sign.
73D8
RLA 17
Rotate Register A left through the Carry Flag, which doubles the value and brings that Carry Flag in at bit 0, so that the greater than sign becomes 01H, the equals sign 02H and the less than sign 04H.
73D9
XOR D AA
Exclusive OR Register A with Register D, the mask gathered so far, which sets this token's bit when it was clear and clears it when it was already set.
73DA
CP D BA
Compare Register A with Register D, the mask as it was, which sets the Carry Flag when the exclusive OR has cleared a bit rather than set one.
73DB
LD D,A 57
Load Register D from Register A, the mask with this token's bit in it, which is where the mask is kept until 7404H pushes it.
73DC
Jump to 586CH on C, the bit having been set already: the same relational token twice over is Syntax error, so >= is taken and >> is not.
73DF
LD (717AH),HL 22 7A 71
Store Register Pair HL into the word at 717AH, the text pointer standing on this token, so that the operator the mask belongs to is remembered at the token the gathering started from.
73E2
Call NXTCHAR at 5E93H, which steps Register Pair HL to the next character of the line and answers with it in Register A.
73E5
Jump to 73CEH, which tests that character for another relational token and so gathers the second of a pair.

73E7H - The Up Arrow (73E7H-73F3H)

The only operator of the twelve that neither takes an operator table nor is done in module 1. Both of its operands are made single precision numbers, the left hand one is pushed by 2917H of BASIC/OV1, and 36DFH is pushed as the routine to apply: 36DFH is in module 1's number package at 3000H-39ECH, which this pass has not written. The precedence of 7FH in Register D is reloaded because 7387H read it into Register A and nothing has put it back.

73E7
The up arrow (73E7H): call 2A6AH of BASIC/OV1, which makes the value in the accumulator a single precision number whatever type it arrived as.
73EA
Call 2917H of BASIC/OV1, which pushes that single precision value onto the stack as the left hand operand of the power.
73ED
LD BC,36DFH 01 DF 36
Load Register Pair BC with 36DFH, the power routine of module 1's number package, which is the address 73C5H pushes as the return instead of 741CH.
73F0
LD D,7FH 16 7F
Load Register D with 7FH, the precedence of the up arrow out of the table at 6B47H, which 7387H loaded into Register A and which 7348H must have in Register D.
73F2
Jump to 73C5H, which pushes Register Pair BC as the return address and recurses through 7348H to work out the operand to the right of the up arrow.

73F4H - The Integer and Logical Operators (73F4H-73FEH)

The path AND, OR, XOR, EQV and IMP take by their precedence at 738EH, and MOD and the backslash by theirs at 7394H. The left hand operand is made an integer by 29F4H of BASIC/OV1 and pushed as the single word in Register Pair HL rather than through the byte by byte pushing at 7396H, and 76B4H is the routine that applies the operator once the right hand operand is in. 73FFH stands one byte past the end of this path and is reached only by the two jumps from 73CCH.

73F4
PUSH DE D5
The integer and logical operators (73F4H): push Register Pair DE, the precedence in Register D and the operator number in Register E, which the conversion below can change.
73F5
Call 29F4H of BASIC/OV1, which makes the value in the accumulator an integer and answers with it in Register Pair HL.
73F8
POP DE D1
Pop Register Pair DE, the precedence and the operator number back again.
73F9
PUSH HL E5
Push Register Pair HL, the left hand operand as one word, which 76BAH takes off the stack into Register Pair DE.
73FA
LD BC,76B4H 01 B4 76
Load Register Pair BC with 76B4H, which turns the right hand operand into an integer as well and then does the operator's own work on the two words.
73FD
Jump to 73C5H, which pushes Register Pair BC as the return address and works out the operand to the right.

73FFH - The Relational Operators' Comparison (73FFH-741BH)

What 73CCH reaches once it has gathered its mask. The precedence of a relational operator is 64H, which is below every arithmetic precedence in the table at 6B47H and above nothing, and that is why A + 1 = B adds before it compares and why A = B = C is refused outright by the RET NC at 7402H: a comparison cannot stand inside a comparison. The operator number is 04H, which 7405H loads outright, and that is the slot the three operator tables keep for the comparison. The mask goes on the stack for 7683H to read, 7683H goes on the stack as the return, and then the type decides which way the operand is pushed: a string takes 45E7H, the string comparison, and a number takes 7396H, the same byte by byte pushing the arithmetic operators use.

73FF
LD A,B 78
The comparison (73FFH): load Register A from Register B, the precedence the caller is holding, which 735BH brought off the stack.
7400
CP 64H FE 64
Compare Register A with 64H, the precedence of a relational operator, which is the precedence this routine is about to work at.
7402
RET NC D0
Return on NC, the caller already holding 64H or more: a comparison inside a comparison ends the expression here, which is why A = B = C is not a chain of comparisons in this BASIC.
7403
PUSH BC C5
Push Register Pair BC, the caller's precedence in Register B and its operator number in Register C, which the return to 7358H pops.
7404
PUSH DE D5
Push Register Pair DE, the mask of relational tokens in Register D that 73DBH built, which 7685H pops into Register Pair BC to read.
7405
LD E,04H 1E 04
Load Register E with 04H, the operator number of the comparison, which is the fifth and last slot of each of the three operator tables at 6B5DH, 6B67H and 6B71H.
7407
LD D,64H 16 64
Load Register D with 64H, the precedence of a relational operator, which is below every arithmetic operator's and so lets the whole of each side be worked out first.
7409
LD HL,7683H 21 83 76
Load Register Pair HL with 7683H, the routine that turns the comparison's answer into the true or false the mask asks for.
740C
PUSH HL E5
Push Register Pair HL, that address, as the return the comparison itself comes back to, which goes on the stack under the 741CH that 73C5H pushes.
740D
Call 76A4H, which reads the type at 7142H and sets the Zero Flag when the value in the accumulator is a string.
7410
Jump to 7396H on NZ, the value being a number, which is pushed there byte by byte by its type exactly as it is for the plus and the minus.
7413
LD HL,(72ECH) 2A EC 72
A string (7413H): load Register Pair HL with the word at 72ECH, which for a string is the address of its three byte descriptor and not of its text.
7416
PUSH HL E5
Push Register Pair HL, that descriptor's address, which 45E7H takes off the stack as the left hand string of the comparison.
7417
LD BC,45E7H 01 E7 45
Load Register Pair BC with 45E7H, the string comparison, which answers 0FFH, 00H or 01H in Register A exactly as the three numeric comparisons of the operator tables do.
741A
Jump to 73C5H, which pushes Register Pair BC as the return address and works out the string to the right of the operator.

741CH - Reconciling the Two Operands' Types (741CH-7449H)

The return address 73C5H pushes, and the routine every arithmetic and relational operator comes back to once the expression to its right has been worked out. It arrives with the left hand operand on the stack, pushed two, four or eight bytes at a time by 73A5H to 73BCH, the right hand operand in the accumulator at 72ECH with its type in 7142H, and the left hand operand's type and the operator's number in the word 73C1H pushed. Its whole work is to make the two operands be of one kind and then dispatch to the word of the operator table that belongs to that kind. The rule is that the wider type wins: double precision over everything, then single precision, then integer, which is what the ladder of comparisons at 7432H to 7448H works out. The three tables are reached at 744AH for a pair of integers, at 7470H for a pair of double precision numbers and at 7499H for a pair of single precision ones, and the dispatch at 7473H is shared by the last two. The conventions the three kinds of routine want differ and that is why there is so much shuffling here: an integer routine wants the right hand operand in Register Pair HL and the left in Register Pair DE, a single precision one wants the right in the accumulator and the left in Register Pair BC and Register Pair DE, and a double precision one wants the right in the second accumulator at 72F5H and the left in the accumulator at 72E8H. The pops here reverse the pushes of 73A5H to 73BCH exactly, which is why 7460H writes 72EAH and 7464H writes 72E8H in that order.

741C
POP BC C1
The operator is applied (741CH), the address 73C5H pushed as the return: pop Register Pair BC, which brings back the left hand operand's type in Register B and the operator's number in Register C that 73C1H pushed.
741D
LD A,C 79
Load Register A from Register C, the operator's number, which is 00H for the plus, 01H for the minus, 02H for the asterisk, 03H for the oblique stroke and 04H for a comparison.
741E
LD (7143H),A 32 43 71
Store Register A into the byte at 7143H, the operator's number, which the dispatch at 7473H reads when it indexes the double precision or single precision table and which 78DDH has no part in.
7421
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the right hand operand that the expression just worked out left in the accumulator.
7424
CP B B8
Compare Register A with Register B, the left hand operand's type, so that the common case of two operands of one kind is settled in one comparison.
7425
Jump to 7432H on NZ, the two types differing, which is where the wider of them is worked out.
7427
CP 02H FE 02
Compare Register A with 02H, the type of an integer, both operands being of the same type.
7429
Jump to 744AH on Z, both operands being integers, which is the one kind whose table is indexed by Register Pair BC rather than by 7143H.
742B
CP 04H FE 04
Compare Register A with 04H, the type of a single precision number.
742D
Jump to 7497H on Z, both operands being single precision numbers, which pops the left hand one into Register Pair BC and Register Pair DE on its way to the table at 6B67H.
7430
Jump to 745DH on NC, the type being 08H and both operands double precision numbers, which puts the right hand one in 72F5H and rebuilds the left in the accumulator.
7432
LD D,A 57
The two types differ (7432H): load Register D from Register A, the right hand operand's type, which Register A is needed for below.
7433
LD A,B 78
Load Register A from Register B, the left hand operand's type, which the comparison below is made on.
7434
CP 08H FE 08
Compare Register A with 08H, the type of a double precision number.
7436
Jump to 745AH on Z, the left hand operand being double precision: the right hand one is widened to match it, whether it was an integer or a single precision number.
7438
LD A,D 7A
Load Register A from Register D, the right hand operand's type again.
7439
CP 08H FE 08
Compare Register A with 08H, the type of a double precision number.
743B
Jump to 7481H on Z, the right hand operand being double precision and the left not, which widens the left.
743D
LD A,B 78
Load Register A from Register B, the left hand operand's type once more, neither operand being double precision.
743E
CP 04H FE 04
Compare Register A with 04H, the type of a single precision number.
7440
Jump to 7494H on Z, the left hand operand being single precision and the right an integer, which widens the right.
7442
LD A,D 7A
Load Register A from Register D, the right hand operand's type, the left being an integer.
7443
CP 03H FE 03
Compare Register A with 03H, the type of a string, which no arithmetic operator can take as its right hand operand.
7445
Jump to 5884H on Z, the right hand operand being a string where the left is a number, which is Type mismatch: 1 + "A" ends here where "A" + 1 ends at 739EH.
7448
Jump to 749EH on NC, the right hand operand being a single precision number and the left an integer, which widens the left and swaps the two round. Falling through means the right hand operand is an integer and so is the left, which 7429H has already taken, so no path reaches 744AH from here.

744AH - The Integer Operator Table Dispatch (744AH-7459H)

The shortest of the three, and the only one that indexes with Register Pair BC rather than with the byte at 7143H, because Register C is still holding the operator's number from 741CH and Register B can be cleared where Register A cannot. Two ADD HL,BC instructions double the number, which is the same doubling the RLCA at 7476H does for the other two tables. The routine is entered by a PUSH and a RET rather than a JP (HL), so that Register Pair HL can hold the right hand operand when it arrives.

744A
LD HL,6B71H 21 71 6B
The integer table (744AH): load Register Pair HL with 6B71H, the first word of the integer operator table, whose five words are the plus, the minus, the asterisk, the oblique stroke and the comparison.
744D
LD B,00H 06 00
Load Register B with 00H, the high byte of the index, the operator's number standing in Register C and Register B having held the type until now.
744F
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, the operator's number, which is half of the index the table wants.
7450
ADD HL,BC 09
Add Register Pair BC to Register Pair HL a second time, which makes the index twice the operator's number and Register Pair HL the address of that operator's word in the table at 6B71H.
7451
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the routine's address.
7452
INC HL 23
Increment Register Pair HL to the high byte of that word.
7453
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte, so that Register Pair BC holds the routine the operator is done by.
7454
POP DE D1
Pop Register Pair DE, the left hand operand, which 73A5H pushed as the two bytes of the accumulator at 72ECH and which is the operand an integer routine wants in Register Pair DE.
7455
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the right hand operand, which is the operand an integer routine wants in Register Pair HL.
7458
PUSH BC C5
Push Register Pair BC, the routine's address, so that the return below enters it.
7459
RET C9
Return, which takes the address Register Pair BC pushed and so enters the operator's routine with both operands in registers and nothing of this dispatch left on the stack.

745AH - Double Precision: the Operands Put Where the Overlay Wants Them (745AH-7480H)

A double precision operation takes its right hand operand out of the second accumulator at 72F5H and its left out of the accumulator at 72E8H, so both operands have to be moved before the table is reached. 2970H of BASIC/OV1 writes the accumulator into 72F5H, and the four pops that follow rebuild the left hand operand's eight bytes in the accumulator in the reverse of the order 73A5H to 73BCH pushed them. 7470H holds the dispatch, and 7473H is the part of it the single precision path at 7499H shares: a RLCA doubles the operator's number and the three instructions at 7477H add Register A to Register Pair HL without a sixteen bit add, by adding it to Register L and carrying into Register H.

745A
The left hand operand is double precision and the right is not (745AH): call 2A96H of BASIC/OV1, which makes the value in the accumulator a double precision number whether it arrived as an integer or as a single precision one.
745D
Both operands are double precision (745DH), which 7430H reaches: call 2970H of BASIC/OV1, which copies the accumulator into the second accumulator at 72F5H, where a double precision routine looks for its right hand operand.
7460
POP HL E1
Pop Register Pair HL, the last word 73BCH pushed, which held the bytes at 72EAH and 72EBH of the left hand operand.
7461
LD (72EAH),HL 22 EA 72
Store Register Pair HL into the word at 72EAH, putting those two bytes of the left hand operand back where they came from.
7464
POP HL E1
Pop Register Pair HL, the word 73B8H pushed, which held the bytes at 72E8H and 72E9H.
7465
LD (72E8H),HL 22 E8 72
Store Register Pair HL into the word at 72E8H, the lowest two bytes of the eight byte accumulator.
7468
POP BC C1
The four byte tail of the left hand operand (7468H), which 748CH reaches for a single precision left hand operand: pop Register Pair BC, the word 73ADH pushed, which held the bytes at 72EEH and 72EFH.
7469
POP DE D1
Pop Register Pair DE, the word 73A5H pushed, which held the bytes at 72ECH and 72EDH, so that the four high bytes of the left hand operand are now in Register Pair BC and Register Pair DE.
746A
Call 2927H of BASIC/OV1, which writes Register Pair DE into the accumulator at 72ECH and Register Pair BC into 72EEH, the reverse of what 2932H does.
746D
Call 2A96H of BASIC/OV1, which makes the value now in the accumulator a double precision number and sets 7142H to 08H, so that a left hand operand which was an integer or a single precision number is widened here.
7470
LD HL,6B5DH 21 5D 6B
The double precision dispatch (7470H): load Register Pair HL with 6B5DH, the first word of the double precision operator table.
7473
LD A,(7143H) 3A 43 71
The dispatch the single precision path shares (7473H), which 749CH reaches with 6B67H in Register Pair HL: load Register A with the byte at 7143H, the operator's number that 741EH stored.
7476
RLCA 07
Rotate Register A left, which doubles the operator's number so that it indexes words rather than bytes.
7477
ADD A,L 85
Add Register L to Register A, the low byte of the table's address, Register Pair HL holding 6B5DH or 6B67H.
7478
LD L,A 6F
Load Register L from Register A, the low byte of the indexed address.
7479
ADC A,H 8C
Add Register H to Register A with the Carry Flag, which brings the carry out of the addition above into the high byte.
747A
SUB L 95
Subtract Register L from Register A, which takes the low byte back out and leaves Register A holding the high byte alone.
747B
LD H,A 67
Load Register H from Register A, so that Register Pair HL now addresses this operator's word in the table without a sixteen bit add having been used.
747C
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of the routine's address.
747D
INC HL 23
Increment Register Pair HL to the high byte of that word.
747E
LD H,(HL) 66
Load Register H from the byte Register Pair HL addresses, the high byte of the routine's address.
747F
LD L,A 6F
Load Register L from Register A, the low byte, so that Register Pair HL holds the routine itself.
7480
JP (HL) E9
Jump to the address in Register Pair HL, the operator's routine in BASIC/OV1, which answers to the caller 740CH or 7386H left on the stack.

7481H - The Left Hand Operand is Widened (7481H-749DH)

Three short paths that widen the operand which is already on the stack rather than the one in the accumulator, and so have to take it off the stack to do it. 7481H is reached when the right hand operand is double precision and the left is not, 7494H when the left is single precision and the right an integer, and 7497H is the head both the pair of single precision operands and 7494H use. The type of the left hand operand goes into 7142H before the widening, because the overlay's conversions read the type out of that byte and not out of a register.

7481
LD A,B 78
The right hand operand is double precision and the left is not (7481H): load Register A from Register B, the left hand operand's type, which is 02H or 04H.
7482
PUSH AF F5
Push Register AF, that type, because the call below writes 7142H and Register A is wanted after it.
7483
Call 2970H of BASIC/OV1, which copies the right hand operand out of the accumulator into the second accumulator at 72F5H, where a double precision routine wants it.
7486
POP AF F1
Pop Register AF, the left hand operand's type back again.
7487
LD (7142H),A 32 42 71
Store Register A into the byte at 7142H, the type of the value the accumulator is about to hold, so that the widening below knows what it is converting from.
748A
CP 04H FE 04
Compare Register A with 04H, the type of a single precision number.
748C
Jump to 7468H on Z, the left hand operand being a single precision number, whose four bytes are popped into Register Pair BC and Register Pair DE there and written to the accumulator by 2927H.
748E
POP HL E1
The left hand operand is an integer (748EH): pop Register Pair HL, the word 73A5H pushed, which is the whole of an integer operand.
748F
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the accumulator, where the widening below reads it from.
7492
Jump to 746DH, which calls 2A96H to make that integer a double precision number and falls into the dispatch at 7470H.
7494
The left hand operand is single precision and the right an integer (7494H): call 2A6AH of BASIC/OV1, which makes the integer in the accumulator a single precision number and sets 7142H to 04H.
7497
POP BC C1
Both operands are single precision (7497H), which 742DH reaches: pop Register Pair BC, the word 73ADH pushed, the high half of the left hand operand.
7498
POP DE D1
Pop Register Pair DE, the word 73A5H pushed, the low half, so that the left hand operand stands in Register Pair BC and Register Pair DE exactly as 2932H would have left it.
7499
LD HL,6B67H 21 67 6B
The single precision dispatch (7499H): load Register Pair HL with 6B67H, the first word of the single precision operator table.
749C
Jump to 7473H, the dispatch the double precision path uses, which indexes the table in Register Pair HL by twice the operator's number at 7143H.

749EH - The Left Hand Operand is an Integer and the Right Single Precision (749EH-74B1H)

The one path that has to put the two operands the other way round. The right hand operand is already in the accumulator and the left is an integer on the stack, but a single precision routine wants the right in the accumulator and the left in Register Pair BC and Register Pair DE, so the right is pushed by 2917H, the left is widened in the accumulator, read out into registers by 2932H, and the right is then written back into the accumulator from the stack.

749E
POP HL E1
The left hand operand is an integer, the right single precision (749EH): pop Register Pair HL, the word 73A5H pushed, which is the left hand operand entire.
749F
Call 2917H of BASIC/OV1, which pushes the two words of the single precision right hand operand at 72ECH and 72EEH onto the stack under this routine's own return address.
74A2
Call 2A8AH of BASIC/OV1, which makes the signed integer in Register Pair HL a single precision number in the accumulator and sets 7142H to 04H.
74A5
Call 2932H of BASIC/OV1, which reads that widened left hand operand out of the accumulator into Register Pair DE and Register Pair BC, low word first, which is where a single precision routine wants it.
74A8
POP HL E1
Pop Register Pair HL, the second of the two words 2917H pushed, which held the right hand operand's bytes at 72EEH and 72EFH.
74A9
LD (72EEH),HL 22 EE 72
Store Register Pair HL into the word at 72EEH, the high half of the accumulator.
74AC
POP HL E1
Pop Register Pair HL, the first of the two words 2917H pushed, the right hand operand's bytes at 72ECH and 72EDH.
74AD
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, so that the right hand operand is back in the accumulator with the left hand one in Register Pair BC and Register Pair DE.
74B0
Jump to 7499H, which loads the single precision table at 6B67H and dispatches through 7473H.

74B2H - Integer Division (74B2H-74C0H)

The one word of the three operator tables that names module 1 and not BASIC/OV1, held at 6B77H as the integer table's oblique stroke. Dividing one integer by another in this BASIC gives a single precision answer and not an integer, so there is no integer divide to call: both operands are widened and the single precision divide is entered at 27EBH, the two bytes above it that pop the left hand operand off the stack. The two calls to 2A8AH are the signed conversion, which is right here where the unsigned 2C66H that FRE uses at 76FDH would not be.

74B2
PUSH HL E5
Integer division (74B2H), the word 6B77H of the integer operator table: push Register Pair HL, the right hand operand, which 744AH left there and which the conversion below writes over.
74B3
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the left hand operand that 7454H popped into Register Pair HL to be widened first.
74B4
Call 2A8AH of BASIC/OV1, which makes the signed integer in Register Pair HL a single precision number in the accumulator.
74B7
POP HL E1
Pop Register Pair HL, the right hand operand that 74B2H pushed, which has to be out of the way while the accumulator is written.
74B8
Call 2917H of BASIC/OV1, which pushes the widened left hand operand's two words onto the stack, where 27EBH takes them back.
74BB
Call 2A8AH of BASIC/OV1, which makes the signed integer right hand operand in Register Pair HL a single precision number in the accumulator.
74BE
Jump to 27EBH of BASIC/OV1, the two bytes that pop the left hand operand into Register Pair BC and Register Pair DE and fall into the single precision divide at 27EDH, so that 7% / 2% gives 3.5 and not 3.

74C1H - One Term of an Expression (74C1H-7578H)

The other half of the evaluator, which 734EH calls once for each operand: it reads one term out of the line and leaves its value in the accumulator at 72ECH with the type in 7142H. A term is a number, a string, a variable, a function, a parenthesised expression, or one of those with a unary plus, a unary minus or NOT in front of it. The first three tests are made on the flags NXTCHAR at 5E93H comes back with and not on comparisons: NXTCHAR sets the Zero Flag at the end of a line and sets the Carry Flag for a digit, so a missing operand and a number in the text are both settled before the character itself is looked at. What follows is a ladder of comparisons rather than a table, twenty-one of them, and the order they stand in is the order the interpreter meets them in: the unary signs first, then the quotation mark and NOT, then the ampersand, then ERR and ERL, which are the two that read a cell and need no argument, then VARPTR, which is the longest of them, and then eleven tokens one after another whose whole work is done somewhere else. The fall through at the foot of the ladder is a parenthesised expression, which is why (A+B)*C needs no token of its own: anything that is not any of the above is taken to begin with an opening parenthesis and 7571H demands one. Functions do not stand in this ladder at all. The tokenizer writes a function as 0FFH and the function's token raised by 80H, so a single INC A at 74D5H catches every one of the fifty-one of them and 7628H looks the address up in the table at 685DH.

74C1
One term of an expression (74C1H), which 734EH calls: call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL to the next character of the line, answers with it in Register A, sets the Zero Flag at the end of the line and sets the Carry Flag for a digit.
74C4
Jump to 5881H on Z, the line having ended where a term was wanted, which is the entry of the error chain that gives Missing operand, error 22: it is what PRINT 1+ comes to.
74C7
Jump to 2F16H of BASIC/OV1 on C, the character being a digit: the term is a number written out in the line text, and the overlay reads the digits, the decimal point and the exponent and leaves the value in the accumulator with its type in 7142H.
74CA
Call 4474H, which compares the character in Register A with 41H and with 5BH and clears the Carry Flag for a capital letter alone.
74CD
Jump to 7587H on NC, the character being a capital letter: the term is a variable, and 7587H looks its name up.
74D0
CP 20H FE 20
Compare Register A with 20H, the space, which is below every character the tokenizer leaves in a line and above every token it writes for a number.
74D2
Jump to 5EE2H on C, the character being one of the tokens the tokenizer writes for a number it has already converted, which 5F12H reads out of 7149H and 7147H into the accumulator.
74D5
INC A 3C
Increment Register A, which sets the Zero Flag when the character was 0FFH and makes no other test necessary for any of the fifty-one functions.
74D6
Jump to 7628H on Z, the character having been 0FFH, the byte the tokenizer writes in front of a function's own token: 7628H takes the token that follows and indexes the function address table at 685DH with it.
74D9
DEC A 3D
Decrement Register A, which puts the character back after the test above.
74DA
CP 0F3H FE F3
Compare Register A with 0F3H, the token of the plus sign.
74DC
Jump to 74C1H on Z, the plus sign standing in front of a term: a unary plus changes nothing at all, so the term is simply read again from the character after it.
74DE
CP 0F4H FE F4
Compare Register A with 0F4H, the token of the minus sign.
74E0
Jump to 7579H on Z, the minus sign standing in front of a term, which is the unary minus and is worked out at its own precedence of 7DH.
74E3
CP 22H FE 22
Compare Register A with 22H, the quotation mark, which the tokenizer leaves as the character it is.
74E5
Jump to 4650H on Z, the term being a string written out in the line: 4650H is the entry of the string collector that takes 22H as its ending character and builds a descriptor pointing into the program text itself.
74E8
CP 0D6H FE D6
Compare Register A with 0D6H, the token of NOT.
74EA
Jump to 768FH on Z, the term being NOT, which works its operand out at a precedence of 5AH and complements both bytes of it.
74ED
CP 26H FE 26
Compare Register A with 26H, the ampersand, which the tokenizer leaves as the character it is.
74EF
Jump to 75A6H on Z, the term being an ampersand constant, which is &H for hexadecimal, &O for octal and an ampersand with digits after it for octal as well.
74F2
CP 0D8H FE D8
Compare Register A with 0D8H, the token of ERR.
74F4
Jump to 7502H on NZ, the token not being ERR, which carries the ladder on.
74F6
ERR (74F6H): call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL past the token, ERR taking no argument of any kind.
74F9
LD A,(6E8FH) 3A 8F 6E
Load Register A with the byte at 6E8FH, the number of the last error, which the error handler stored there at 58A7H.
74FC
PUSH HL E5
Push Register Pair HL, the text pointer, which the conversion below writes over.
74FD
Call 770CH, which makes the byte in Register A a positive integer in the accumulator and sets 7142H to 02H, the shared tail LPOS and POS use as well.
7500
POP HL E1
Pop Register Pair HL, the text pointer standing after the token.
7501
RET C9
Return, the value of ERR being in the accumulator and the evaluator's loop at 7358H ready to look for an operator after it.
7502
CP 0D7H FE D7
Compare Register A with 0D7H, the token of ERL.
7504
Jump to 7512H on NZ, the token not being ERL.
7506
ERL (7506H): call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL past the token, ERL taking no argument either.
7509
PUSH HL E5
Push Register Pair HL, the text pointer, which the conversion below writes over.
750A
LD HL,(7190H) 2A 90 71
Load Register Pair HL with the word at 7190H, the number of the line the last error happened on, which the error handler keeps there.
750D
Call 2C66H of BASIC/OV1, which makes the value in Register Pair HL a single precision number without a sign, which is what a line number wants: a line of 40000 is a positive number here where the signed 2A8AH would make it negative.
7510
POP HL E1
Pop Register Pair HL, the text pointer standing after the token.
7511
RET C9
Return with the line number in the accumulator as a single precision value.
7512
CP 0DDH FE DD
Compare Register A with 0DDH, the token of VARPTR.
7514
Jump to 753FH on NZ, the token not being VARPTR, which carries the ladder on.
7516
VARPTR (7516H): call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL to the character after the token.
7519
Call 4353H, the character demand, which insists that the text pointer stands on the byte held after the call.
751C
DEFB 28H 28
751CH: the byte 4353H above compares the line character with, which is 28H, the opening parenthesis of VARPTR(.
751D
CP 23H FE 23
Compare Register A with 23H, the number sign, which is what makes the argument a file number rather than a variable name.
751F
Jump to 752CH on NZ, the argument being a variable name and not a file.
7521
VARPTR(#n) (7521H): call 799CH, which works out the file number after the number sign as an integer.
7524
PUSH HL E5
Push Register Pair HL, the text pointer, which the lookup below writes over.
7525
Call 4ABEH, the file number lookup, which answers with the address of that file's control block in Register Pair DE.
7528
POP HL E1
Pop Register Pair HL, the text pointer standing after the file number.
7529
Jump to 752FH, the closing parenthesis and the test that the address is not 0000H, which both forms of VARPTR share.
752C
VARPTR(name) (752CH): call 3AE8H, the entry of the variable search that answers Register Pair DE of 0000H rather than making a variable that does not exist.
752F
Call 4353H, the character demand, which insists on the byte held after the call.
7532
DEFB 29H 29
7532H: the byte 4353H above compares the line character with, which is 29H, the closing parenthesis of VARPTR's argument.
7533
PUSH HL E5
Push Register Pair HL, the text pointer standing after the parenthesis, which the conversion below writes over.
7534
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the address the lookup answered into Register Pair HL.
7535
LD A,H 7C
Load Register A from Register H, the high byte of that address.
7536
OR L B5
Or Register A with Register L, the low byte, which sets the Zero Flag only when the whole address is 0000H.
7537
Jump to 5F95H on Z, the variable or the file not existing: VARPTR of something that was never made is Illegal function call and not a zero.
753A
Call 2A53H of BASIC/OV1, which stores Register Pair HL into the accumulator at 72ECH and sets 7142H to 02H, so that VARPTR gives a signed integer and an address above 7FFFH comes out negative.
753D
POP HL E1
Pop Register Pair HL, the text pointer standing after the closing parenthesis.
753E
RET C9
Return with the address in the accumulator as an integer.
753F
CP 0D3H FE D3
Compare Register A with 0D3H, the token of USR.
7541
Jump to 7712H on Z, the term being a USR call, which 7734H reads the number of and 7718H works the argument out for.
7544
CP 0DBH FE DB
Compare Register A with 0DBH, the token of INSTR.
7546
Jump to 4939H on Z, the term being INSTR, which is written with the string functions and not here because it takes three arguments.
7549
CP 0E0H FE E0
Compare Register A with 0E0H, the token of INKEY$.
754B
Jump to 7D5DH on Z, the term being INKEY$, which reads one key without waiting and gives a string of one character or of none.
754E
CP 0DEH FE DE
Compare Register A with 0DEH, the token of DATE$.
7550
Jump to 7EAFH on Z, the term being DATE$, which asks the system for the date and makes a string of it.
7553
CP 0DFH FE DF
Compare Register A with 0DFH, the token of ERRS$.
7555
Jump to 7F51H on Z, the term being ERRS$, which gives the text of the last error as a string rather than its number.
7558
CP 0E1H FE E1
Compare Register A with 0E1H, the token of MEM.
755A
Jump to 4A5CH on Z, the term being MEM, which is written beside FRE because the two of them answer out of the same pointers.
755D
CP 0E2H FE E2
Compare Register A with 0E2H, the token of TIME$.
755F
Jump to 7EB0H on Z, the term being TIME$, which is the one byte above DATE$ because the two share the call that asks the system.
7562
CP 0D9H FE D9
Compare Register A with 0D9H, the token of STRING$.
7564
Jump to 4874H on Z, the term being STRING$, which is written with the string functions because it takes two arguments.
7567
CP 85H FE 85
Compare Register A with 85H, the token of INPUT, which stands in an expression only as the INPUT$ function.
7569
Jump to 4EC2H on Z, the term being INPUT$, which reads a count of characters from the keyboard or from a file and is written with the file statements.
756C
CP 0D4H FE D4
Compare Register A with 0D4H, the token of FN.
756E
Jump to 778AH on Z, the term being a call of a function the program defined with DEF FN, which 7855H builds a parameter frame for.
7571
A parenthesised expression (7571H), which is what every character the ladder above did not match is taken to be, and which 7651H calls for the argument of a one argument function: call 7341H, which demands an opening parenthesis and works the expression inside out.
7574
Call 4353H, the character demand, which insists on the byte held after the call.
7577
DEFB 29H 29
7577H: the byte 4353H above compares the line character with, which is 29H, the closing parenthesis. A line that opens a parenthesis and does not close it is given Syntax error by 4362H here.
7578
RET C9
Return with the value of the parenthesised expression in the accumulator and its type in 7142H.

7579H - Unary Minus (7579H-7586H)

A precedence of 7DH, which is above the 7CH of the asterisk and the oblique stroke and below the 7FH of the up arrow, and that one byte is the whole reason -2^2 is minus four and -2*2 is minus four as well while 2^-2 needs no parentheses. The negation itself is 28EAH of BASIC/OV1, which refuses a string, sends an integer to 2C5BH and flips bit 7 of the sign byte at 72EEH for a single or a double precision number.

7579
LD D,7DH 16 7D
Unary minus (7579H): load Register D with 7DH, the precedence a unary minus works at, which lets it take an up arrow to its right and nothing else.
757B
Call 7348H, the evaluator's own entry, which works out everything to the right of the minus sign that binds tighter than 7DH and leaves it in the accumulator.
757E
LD HL,(7199H) 2A 99 71
Load Register Pair HL with the word at 7199H, the text pointer the expression ended at, which 7355H stored because Register Pair HL is wanted for other things while the expression is worked out.
7581
PUSH HL E5
Push Register Pair HL, that text pointer, which the negation below writes over.
7582
Call 28EAH of BASIC/OV1, which negates the value in the accumulator: an integer through 2C5BH, a string refused with Type mismatch at 5884H, and a single or double precision number by flipping bit 7 of the sign byte at 72EEH.
7585
POP HL E1
Pop Register Pair HL, the text pointer standing after the term, which 7661H pushes this address for and uses the same way.
7586
RET C9
Return with the negated value in the accumulator.

7587H - A Variable as a Term (7587H-7596H)

What 74CDH reaches for any term that begins with a capital letter. The variable is made if it does not exist, which is what makes PRINT A give a zero rather than an error, and then the type decides what goes into the accumulator: a number is loaded into it and a string is not. For a string the accumulator holds the address of the variable's three byte descriptor and nothing is copied, which is the convention the whole string package at 45E7H is built on and the reason 7413H can push 72ECH's word straight at the comparison.

7587
A variable (7587H): call 39FBH, the variable search, which reads the name at the text pointer, makes the variable when it does not exist, answers with the address of its value in Register Pair DE and puts its type in 7142H.
758A
PUSH HL E5
Push Register Pair HL, the text pointer standing after the name and its subscripts, which the load below writes over.
758B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the address of the value into Register Pair HL for the two instructions below.
758C
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the accumulator, which for a string variable is the whole of the answer: the accumulator holds the address of the descriptor and the text is not touched.
758F
Call 76A4H, which reads the type at 7142H and sets the Zero Flag when it is 03H, a string.
7592
Call 296BH of BASIC/OV1 on NZ, the variable being a number, which loads as many bytes as 7142H names from the address in Register Pair HL into the accumulator, so that the value and not its address is what the expression works with.
7595
POP HL E1
Pop Register Pair HL, the text pointer standing after the variable's name.
7596
RET C9
Return with the variable's value, or a string's descriptor address, in the accumulator.

7597H - The Capital Letter Conversion and an Entry Nothing Reaches (7597H-75A5H)

Ten bytes that do two unrelated things and are only neighbours. 7597H and 7598H are the conversion to capitals the tokenizer leans on: seven of its own instructions call 7597H, which loads the character first, and four other places call 7598H with the character already in Register A, among them the two digit loops below. The conversion is a single AND 5FH, which clears bit 5 and bit 7 together, and it is guarded so that only a character from 61H to 7AH is touched: that is what lets a lower case letter be typed into a program and come out in capitals while a character of a string literal is left alone. 75A1H is five bytes that nothing in the file can reach. No instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 calls it or jumps to it, no relative jump of any of the four reaches it, and the word 75A1H stands in none of the tables and nowhere in any of the four images, which was checked across all of them. What it would do is plain enough from its two instructions: an ampersand takes the constant below, and anything else goes to 5FA4H, which is the test for a line number reference. Nothing is lost by its being unreachable, because 74EDH makes the same ampersand test for itself inside the term reader and 5FA4H is called in its own right from four places. It is the second run of unreachable code the page has found in module 1, the first being the control key echo at 43C1H.

7597
LD A,(HL) 7E
The conversion to capitals, loading the character first (7597H), which the tokenizer calls from 5B46H, 5B78H, 5B8CH, 5BA0H, 5BC2H, 5D12H and 5D19H: load Register A with the byte Register Pair HL addresses, the character of the line.
7598
CP 61H FE 61
The conversion to capitals with the character in Register A (7598H), which 3D65H, 5CE6H, 75ACH and 75BBH call: compare Register A with 61H, the lower case letter a, which is the lowest character the conversion touches.
759A
RET C D8
Return on C, the character being below 61H, which leaves every digit, every capital and all of the punctuation exactly as it stood.
759B
CP 7BH FE 7B
Compare Register A with 7BH, which is one above 7AH, the lower case letter z.
759D
RET NC D0
Return on NC, the character being 7BH or above, which leaves the three characters above the alphabet alone.
759E
AND 5FH E6 5F
And Register A with 5FH, which clears bit 5 and bit 7 of the character: 61H becomes 41H and 7AH becomes 5AH, so the whole lower case alphabet becomes the upper case one in one instruction.
75A0
RET C9
Return with the capital letter in Register A.
75A1
CP 26H FE 26
The entry nothing reaches (75A1H): compare Register A with 26H, the ampersand, which is the character that begins a hexadecimal or octal constant.
75A3
Jump to 5FA4H on NZ, the character not being an ampersand, which is the test for the 0EH of a line number reference and for the 0DH that ends one. Falling through takes the ampersand constant below. Both halves of this test are made elsewhere for themselves, 74EDH for the ampersand and the four callers of 5FA4H for the reference, and nothing in the file reaches these five bytes.

75A6H - The Hexadecimal and Octal Constants (75A6H-7627H)

What 74EFH reaches for a term that begins with an ampersand. &H takes hexadecimal digits, &O takes octal ones, and an ampersand with digits straight after it is octal too, which 75B5H arranges by stepping the text pointer back a character at 7603H so that the digit is read again by the octal loop. The value accumulates in Register Pair DE while the text pointer is in Register Pair HL, and the two are exchanged round each other at the head and foot of each loop, which is why both loops begin with an EX DE,HL. Either loop ends as soon as a character that is not a digit of its base is met, and 7623H then makes the accumulated value an integer with 2A53H, so &HFFFF is minus one and not 65535. The two bases guard against a value too large in quite different ways and that is the most interesting thing about them: hexadecimal counts digits, Register B starting at 05H so that a fifth digit falls out of the loop into the complaint at 75DFH, and octal watches the shifting, pushing 75DFH as a return address at 7612H so that any one of the three ADD HL,HL instructions can answer to it on the Carry Flag. 7619H pops that address off again when the digit has gone in without a carry. The complaint itself is 75DFH, and what it does turns on the byte at 6EA7H, which INPUT and READ set at 6468H: with it clear the constant is an error, and with it set Overflow is written out of the message block at 6BD1H and the attempt is counted in 72F1H so that INPUT's own test at 6478H can give ?Redo from start.

75A6
LD DE,0000H 11 00 00
An ampersand constant (75A6H), which 74EFH reaches: load Register Pair DE with 0000H, the value the digits accumulate into, which is kept in Register Pair DE because Register Pair HL is the text pointer.
75A9
Call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL to the character after the ampersand and answers with it in Register A.
75AC
Call 7598H, which makes that character a capital letter when it was a lower case one, so that &h1F is taken exactly as &H1F is.
75AF
CP 4FH FE 4F
Compare Register A with 4FH, the letter O, which names the octal base.
75B1
Jump to 7604H on Z, the base being octal, which reads its digits three bits at a time.
75B3
CP 48H FE 48
Compare Register A with 48H, the letter H, which names the hexadecimal base.
75B5
Jump to 7603H on NZ, the character being neither letter: an ampersand with digits straight after it is an octal constant, and 7603H steps the text pointer back one so that the octal loop reads this character as its first digit.
75B7
LD B,05H 06 05
Hexadecimal (75B7H): load Register B with 05H, the count of passes the loop below is allowed, which lets four digits be taken and sends a fifth to the complaint at 75DFH.
75B9
INC HL 23
The hexadecimal digit loop (75B9H): increment Register Pair HL, the text pointer, to the next character of the line.
75BA
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that character.
75BB
Call 7598H, which makes it a capital letter, so that the letters a to f are taken as A to F.
75BE
Call 4474H, which compares the character in Register A with 41H and with 5BH and clears the Carry Flag for a capital letter alone.
75C1
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the value so far into Register Pair HL to be shifted and puts the text pointer into Register Pair DE.
75C2
Jump to 75CEH on NC, the character being a capital letter, which is where A to F are turned into 0AH to 0FH.
75C4
CP 3AH FE 3A
Compare Register A with 3AH, which is one above 39H, the digit nine.
75C6
Jump to 7623H on NC, the character being above the digits and not a letter, which ends the constant where it stands.
75C8
SUB 30H D6 30
Subtract 30H from Register A, the character zero, which turns the digits 0 to 9 into the values 00H to 09H.
75CA
Jump to 7623H on C, the character having been below 30H, which ends the constant: the ampersand's digits are over and 7623H makes what has been gathered an integer.
75CC
Jump to 75D4H, the shifting, with the digit's value 00H to 09H in Register A.
75CE
CP 47H FE 47
A letter (75CEH): compare Register A with 47H, the letter G, which is one above F and so above every hexadecimal digit.
75D0
Jump to 7623H on NC, the letter being G or above, which is not a hexadecimal digit and ends the constant.
75D2
SUB 37H D6 37
Subtract 37H from Register A, which turns the letters A to F into the values 0AH to 0FH.
75D4
ADD HL,HL 29
The shifting (75D4H): add Register Pair HL to itself, which doubles the value gathered so far.
75D5
ADD HL,HL 29
Add Register Pair HL to itself a second time, four times the value gathered.
75D6
ADD HL,HL 29
Add Register Pair HL to itself a third time, eight times the value gathered.
75D7
ADD HL,HL 29
Add Register Pair HL to itself a fourth time, which is the multiplication by sixteen one hexadecimal digit is worth and which leaves the low four bits of Register L clear.
75D8
OR L B5
Or Register A with Register L, the low byte of the shifted value, which puts the new digit into the four bits the shifting has just emptied and is an addition in all but name.
75D9
LD L,A 6F
Load Register L from Register A, that low byte with the digit in it.
75DA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the value back into Register Pair DE and the text pointer back into Register Pair HL for the next pass.
75DB
DEC B 05
Decrement Register B, the count of passes left, which started at 05H.
75DC
Jump to 75B9H on NZ, there being another pass to make. Falling through means five digits have gone in, which is one more than a sixteen bit value can hold, and the complaint below is reached.
75DF
LD A,(6EA7H) 3A A7 6E
The value will not fit (75DFH), which the hexadecimal loop falls into and the three ADD HL,HL instructions of the octal loop return to: load Register A with the byte at 6EA7H, the flag INPUT and READ set at 6468H while they convert a typed or read item.
75E2
OR A B7
Or Register A with itself, which sets the Zero Flag when the flag is clear and no INPUT or READ is converting.
75E3
Jump to 587EH on Z, no INPUT or READ being in hand: the entry of the error chain that gives Overflow, error 6, so that a constant of &H10000 in a program line stops it.
75E6
PUSH HL E5
Push Register Pair HL, the text pointer, which the writing below uses Register Pair HL for.
75E7
LD HL,6BD1H 21 D1 6B
Load Register Pair HL with 6BD1H, the text Overflow in the error message block, which is the sixth of its fifty-one texts.
75EA
Call 6702H, which writes the 00H ended text at the address in Register Pair HL out to the display: 670CH enters the one character output at 414BH, past the file and printer tests, so this text reaches the screen whatever PRINT is doing.
75ED
Call 41F5H, which writes a carriage return through the one character output at 40D8H, so that the warning stands on a line of its own.
75F0
POP HL E1
Pop Register Pair HL, the text pointer, which the writing left alone.
75F1
LD A,(72F1H) 3A F1 72
The attempt is counted (75F1H), which 75FDH reaches as well: load Register A with the byte at 72F1H, which 7352H cleared when this expression began.
75F4
INC A 3C
Increment Register A, so that the byte becomes 02H where a clean conversion would have left the 01H the function dispatch at 7667H and the power routine at 36E8H put there.
75F5
LD (72F1H),A 32 F1 72
Store Register A into the byte at 72F1H, the byte 67B4H hands over to 72F2H and 30CFH reads, so that INPUT's test at 6478H finds something other than 01H and gives ?Redo from start from the text at 6383H.
75F8
RET C9
Return with the value gathered so far, which nothing has thrown away: a warned constant is used as it stands.
75F9
LD A,(6EA7H) 3A A7 6E
An octal digit of eight or nine (75F9H), which 760CH reaches: load Register A with the byte at 6EA7H, the flag INPUT and READ set at 6468H.
75FC
OR A B7
Or Register A with itself, which sets the Zero Flag when no INPUT or READ is converting.
75FD
Jump to 75F1H on NZ, an INPUT or a READ being in hand, which counts the attempt in 72F1H without writing any message at all, where the path at 75E6H writes one. Register Pair HL holds the value gathered and not the text pointer when this jump is taken, 7607H having exchanged the two, and nothing exchanges them back: this is bug B344.
7600
Jump to 586CH, no INPUT or READ being in hand: the entry of the error chain that gives Syntax error, error 2, which is what &O8 in a program line comes to rather than Overflow.
7603
DEC HL 2B
An ampersand with digits and no letter (7603H), which 75B5H reaches: decrement Register Pair HL, the text pointer, so that the character already read is read again below as the first octal digit.
7604
The octal digit loop (7604H): call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL to the next character, answers with it in Register A, and sets the Carry Flag when it is a digit.
7607
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the value gathered so far into Register Pair HL and puts the text pointer into Register Pair DE.
7608
Jump to 7623H on NC, the character not being a digit at all, which ends the constant and makes what has been gathered an integer.
760A
CP 38H FE 38
Compare Register A with 38H, the digit eight, which is the first digit no octal number may hold.
760C
Jump to 75F9H on NC, the digit being eight or nine, which is Syntax error in a program line and a counted complaint under INPUT and READ.
760F
LD BC,75DFH 01 DF 75
Load Register Pair BC with 75DFH, the complaint, which the three shifts below answer to on the Carry Flag.
7612
PUSH BC C5
Push Register Pair BC, that address, so that any one of the three RET C instructions below leaves this loop for the complaint without a jump of its own.
7613
ADD HL,HL 29
Add Register Pair HL to itself, which doubles the value gathered so far.
7614
RET C D8
Return on C, a bit having been shifted out of the top of Register Pair HL, which takes the address 7612H pushed and so reaches the complaint at 75DFH with the text pointer in Register Pair DE.
7615
ADD HL,HL 29
Add Register Pair HL to itself a second time, four times the value gathered.
7616
RET C D8
Return on C, a bit having been shifted out, which reaches 75DFH the same way.
7617
ADD HL,HL 29
Add Register Pair HL to itself a third time, which is the multiplication by eight one octal digit is worth.
7618
RET C D8
Return on C, a bit having been shifted out of the top, which reaches 75DFH.
7619
POP BC C1
Pop Register Pair BC, which takes the 75DFH that 7612H pushed back off the stack, the three shifts having all gone through without a carry.
761A
LD B,00H 06 00
Load Register B with 00H, the high byte of the digit's value for the addition below.
761C
SUB 30H D6 30
Subtract 30H from Register A, the character zero, which turns the digit 0 to 7 into the value 00H to 07H.
761E
LD C,A 4F
Load Register C from Register A, that value, so that Register Pair BC holds it as a sixteen bit number.
761F
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which puts the digit into the three bits the shifting emptied.
7620
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the value back into Register Pair DE and the text pointer back into Register Pair HL.
7621
Jump to 7604H, which reads the next character of the line and takes another octal digit if that is what it is.
7623
The constant is complete (7623H), which both loops reach: call 2A53H of BASIC/OV1, which stores Register Pair HL, the value gathered, into the accumulator at 72ECH and sets 7142H to 02H, an integer. &HFFFF is therefore minus one and &H8000 is minus 32768.
7626
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL for the evaluator's loop at 7358H.
7627
RET C9
Return with the constant in the accumulator as an integer and the text pointer standing on the character that ended it.

7628H - The Function Dispatch (7628H-7672H)

Every one of the fifty-one functions is reached from here and from nowhere else. The tokenizer writes a function as the byte 0FFH and then the function's own token raised by 80H, and 74D5H catches the 0FFH with a single INC A, so this routine arrives with the text pointer on the second of those two bytes. Taking 81H off it gives the function's number from 00H for LEFT$ to 32H for ROW, and the RLCA at 762EH doubles it so that it indexes the fifty-one words of the function address table at 685DH. The dispatch splits on that doubled number at 7635H: below 05H are the three string functions that take more than one argument, LEFT$, RIGHT$ and MID$, whose first argument is a string and whose second is a byte, and 05H and above are the functions of one argument, which 7651H works out through 7571H. The one argument side then does two things the three argument side does not. It converts the argument to a single precision number for the eight functions whose doubled number is below 1BH, which are SQR, RND, SIN, LOG, EXP, COS, TAN and ATN, the transcendentals of the number package, and leaves the argument as it stands for SGN, INT and ABS below them and for everything from FRE upwards. And it pushes 7585H under the function as a return address, which is the POP HL and RET that puts the text pointer back; the three argument side leaves the text pointer on the stack for the function to take itself. 766AH to 7672H is the dispatch both sides share, and 766DH inside it is called in its own right by 78DDH, which arrives with its own table and its own index.

7628
INC HL 23
A function (7628H), which 74D6H reaches: increment Register Pair HL, the text pointer, from the 0FFH that marks a function to the byte that holds the function's own token.
7629
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the function's token raised by 80H, so that LEFT$ of token 01H stands here as 81H and ROW of token 33H as 0B3H.
762A
SUB 81H D6 81
Subtract 81H from Register A, which takes off both the 80H the tokenizer added and the one that makes LEFT$ the first function, leaving 00H for LEFT$ and 32H for ROW.
762C
LD B,00H 06 00
Load Register B with 00H, the high byte of the index, the number standing in Register A.
762E
RLCA 07
Rotate Register A left, which doubles the function's number so that it indexes the words of the table at 685DH rather than its bytes.
762F
LD C,A 4F
Load Register C from Register A, that doubled number, which is the index both halves of this dispatch carry.
7630
PUSH BC C5
Push Register Pair BC, the index, which 7647H and 7654H each bring back with an exchange rather than a pop.
7631
Call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL past the token onto the opening parenthesis of the argument list.
7634
LD A,C 79
Load Register A from Register C, the doubled function number, which the comparison below is made on.
7635
CP 05H FE 05
Compare Register A with 05H, which is above the 00H of LEFT$, the 02H of RIGHT$ and the 04H of MID$ and below the 06H of SGN.
7637
Jump to 7651H on NC, the function taking one argument, which is every function but the three string ones below.
7639
LEFT$, RIGHT$ and MID$ (7639H): call 7341H, which demands the opening parenthesis and works out the first argument, the string the function takes a part of.
763C
Call 4353H, the character demand, which insists that the text pointer stands on the byte held after the call.
763F
DEFB 2CH 2C
763FH: the byte 4353H above compares the line character with, which is 2CH, the comma that stands between the string and the count.
7640
Call 2AB0H of BASIC/OV1, which insists that the value in the accumulator is a string and gives Type mismatch through 5884H when it is not, so LEFT$(1,2) is refused here.
7643
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the text pointer into Register Pair DE out of the way of the two instructions below.
7644
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, which for a string in the accumulator is the address of its three byte descriptor.
7647
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the descriptor's address on the stack in the place of the index and brings the index into Register Pair HL.
7648
PUSH HL E5
Push Register Pair HL, the index again, so that the stack now holds the index above the descriptor's address.
7649
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL and puts the index into Register Pair DE.
764A
Call 799FH, which works out the next argument as one byte, refuses a value above 255 with Illegal function call at 5F95H, and answers with it in Register A and in Register E.
764D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the byte argument into Register Pair HL, 799FH having left it in Register E with Register D holding 00H, and puts the text pointer into Register Pair DE.
764E
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the byte argument on the stack in the place of the index and brings the index back into Register Pair HL. The stack now holds the byte argument above the string's descriptor, which is how 48B8H and 48C7H find them.
764F
Jump to 766AH, the dispatch, with the text pointer in Register Pair DE rather than on the stack: these three functions take their own text pointer out of Register Pair DE and so need no 7585H pushed for them.
7651
A function of one argument (7651H): call 7571H, which demands the opening parenthesis, works out the argument and demands the closing parenthesis.
7654
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack and brings the index 7630H pushed into Register Pair HL.
7655
LD A,L 7D
Load Register A from Register L, the doubled function number, Register H holding 00H.
7656
CP 0CH FE 0C
Compare Register A with 0CH, which is the doubled number of SQR and so above the 06H of SGN, the 08H of INT and the 0AH of ABS.
7658
Jump to 7661H on C, the function being SGN, INT or ABS, which take the argument in whatever type it arrived as and convert nothing.
765A
CP 1BH FE 1B
Compare Register A with 1BH, which is one above the 1AH of ATN and so above all eight of SQR, RND, SIN, LOG, EXP, COS, TAN and ATN.
765C
PUSH HL E5
Push Register Pair HL, the index, which the conversion below writes over. A PUSH changes no flag, so the comparison made above is the one the conditional call below acts on.
765D
Call 2A6AH of BASIC/OV1 on C, which makes the argument in the accumulator a single precision number: the eight transcendentals of the number package work in single precision alone, which is why SQR(2#) gives a single precision answer.
7660
POP HL E1
Pop Register Pair HL, the doubled function number that 765CH pushed, which the dispatch below needs as its index into the table at 685DH.
7661
LD DE,7585H 11 85 75
The one argument tail (7661H): load Register Pair DE with 7585H, which is a POP HL and a RET and nothing else.
7664
PUSH DE D5
Push Register Pair DE, that address, as the return the function answers to, so that the text pointer 7654H left on the stack is popped back into Register Pair HL when the function is done. 4870H exists because 467FH does that same POP HL and RET for itself and the 7585H has to be thrown away first.
7665
LD A,01H 3E 01
Load Register A with 01H, the value the byte below is set to.
7667
LD (72F1H),A 32 F1 72
Store Register A into the byte at 72F1H, which 7352H cleared when this expression began: the power routine at 36E8H sets the same byte to the same 01H, 67B4H hands it to 72F2H, 30CFH reads it, and the Overflow warning at 75F4H counts it up past 01H so that INPUT's test at 6478H fails.
766A
LD BC,685DH 01 5D 68
The dispatch (766AH): load Register Pair BC with 685DH, the first word of the function address table, whose fifty-one words stand in token order from LEFT$ to ROW.
766D
ADD HL,BC 09
The indexing, which 78DDH calls in its own right (766DH) with 6B53H in Register Pair HL and the masked type in Register Pair BC: add Register Pair BC to Register Pair HL, which makes Register Pair HL the address of the wanted word in whichever table Register Pair BC named.
766E
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of the routine's address.
766F
INC HL 23
Increment Register Pair HL to the high byte of that word.
7670
LD H,(HL) 66
Load Register H from the byte Register Pair HL addresses, the high byte of the routine's address.
7671
LD L,C 69
Load Register L from Register C, the low byte, so that Register Pair HL holds the routine itself.
7672
JP (HL) E9
Jump to the address in Register Pair HL, the function's own routine, which answers to the 7585H that 7664H pushed or, for the three string functions, takes the text pointer out of Register Pair DE.

7673H - The Sign of an Exponent (7673H-7682H)

Ten bytes that module 1 never calls: the one instruction in any of the four images that reaches them is a CALL 7673H at 2F8AH of BASIC/OV1, inside the conversion of a typed number. It reads one character and counts it in Register D, decrementing for a minus sign and leaving Register D alone for a plus sign, and when the character is neither it steps the text pointer back so that the caller reads it again. Both the token and the character are tested for each sign, 0F4H and 2DH for the minus and 2BH and 0F3H for the plus, and that is not waste: a number in a program line has been through the tokenizer, so the minus of 1E-5 stands there as 0F4H, while a number typed in answer to an INPUT has not been tokenized and the same minus stands as the character 2DH. The two forms are the one place in module 1 where that difference is met head on.

7673
DEC D 15
The sign of an exponent (7673H), which 2F8AH of BASIC/OV1 calls: decrement Register D, the count of minus signs, on the assumption that this character is one, which the two returns below act on and 767AH undoes.
7674
CP 0F4H FE F4
Compare Register A with 0F4H, the token the tokenizer gives the minus sign in a program line.
7676
RET Z C8
Return on Z, the character being a tokenized minus sign, with Register D counted down for it.
7677
CP 2DH FE 2D
Compare Register A with 2DH, the minus sign as a character, which is how it stands in a line typed in answer to an INPUT and never tokenized.
7679
RET Z C8
Return on Z, the character being an untokenized minus sign, with Register D counted down for it.
767A
INC D 14
Increment Register D, which puts back the decrement made above, this character being no minus sign of either form.
767B
CP 2BH FE 2B
Compare Register A with 2BH, the plus sign as a character.
767D
RET Z C8
Return on Z, the character being an untokenized plus sign, with Register D as it was: a plus changes nothing.
767E
CP 0F3H FE F3
Compare Register A with 0F3H, the token the tokenizer gives the plus sign.
7680
RET Z C8
Return on Z, the character being a tokenized plus sign, with Register D as it was.
7681
DEC HL 2B
Decrement Register Pair HL, the text pointer, the character being no sign at all, so that the caller in BASIC/OV1 reads it again as the first digit of the exponent.
7682
RET C9
Return with Register D holding the count of minus signs and the text pointer standing one back.

7683H - The Comparison Turned into True or False (7683H-768EH)

Twelve bytes, and the neatest piece of arithmetic in the interpreter. The four comparison routines the operator tables hold, 29EDH, 2982H, 29AFH and the string comparison at 45E7H, all answer the same way, and they answer in Register A and in the Carry Flag together: 0FFH with the Carry Flag set when the left hand operand is the greater, 00H with it clear when the two are equal, and 01H with it clear when the left is the smaller. The INC A here is chosen because it changes no flag, so the three answers become 00H, 01H and 02H with the Carry Flag still carrying its half of the news, and the ADC A,A that follows folds the two halves into one number: 01H for greater, 02H for equal and 04H for smaller. Those are exactly the three bits 73D6H built its mask out of, so one AND against the mask says whether the comparison the program asked for is the one that happened. The ADD A,0FFH and SBC A,A below then turn any non-zero result into 0FFH and zero into 00H, which is minus one and zero, BASIC's own true and false.

7683
INC A 3C
The comparison's answer (7683H), the address 7409H pushed: increment Register A, which turns the 0FFH, 00H or 01H the comparison answered into 00H, 01H or 02H and leaves the Carry Flag exactly as the comparison set it.
7684
ADC A,A 8F
Add Register A to itself with the Carry Flag, which doubles the value and brings that Carry Flag in at bit 0: a greater than gives 01H, an equal 02H and a smaller 04H, and those are the three bits of the mask.
7685
POP BC C1
Pop Register Pair BC, which brings back into Register B the mask of relational tokens that 7404H pushed from Register D.
7686
AND B A0
And Register A with Register B, the mask, which leaves a non-zero value only when the comparison that happened is one the program asked for.
7687
ADD A,0FFH C6 FF
Add 0FFH to Register A, which sets the Carry Flag for any non-zero value and clears it for 00H alone.
7689
SBC A,A 9F
Subtract Register A from itself with the Carry Flag, which makes Register A 0FFH when that Carry Flag was set and 00H when it was clear.
768A
Call 28FEH of BASIC/OV1, which puts the sign of Register A into Register H, Register A itself into Register L and stores the pair as an integer in the accumulator through 2A53H, so that a true comparison is minus one and a false one is zero.
768D
Jump to 76A1H, which is a JP 7358H and so takes the evaluator's loop up again to look for the next operator after the comparison.

768FH - NOT (768FH-76A3H)

A precedence of 5AH, which stands above the 50H of AND and below the 64H of every relational operator, so that NOT A = B compares first and NOT A AND B complements first. The complement is made on the two bytes of the value by hand rather than by anything in the overlay, which is why NOT is in module 1 and the ten other logical operators of 76B4H are here with it. The POP BC at 76A0H throws away the return into 7351H that EVAL was called with, because NOT reaches the loop at 7358H and not at 7351H.

768F
LD D,5AH 16 5A
NOT (768FH), which 74EAH reaches: load Register D with 5AH, the precedence NOT works at, which is above AND and below every comparison.
7691
Call 7348H, the evaluator's own entry, which works out everything to the right of NOT that binds tighter than 5AH.
7694
Call 29F4H of BASIC/OV1, which makes the value in the accumulator an integer and answers with it in Register Pair HL, so that NOT 1.5 complements the integer one and not the fraction.
7697
LD A,L 7D
Load Register A from Register L, the low byte of that integer.
7698
CPL 2F
Complement Register A, which turns every bit of the low byte over.
7699
LD L,A 6F
Load Register L from Register A, the complemented low byte.
769A
LD A,H 7C
Load Register A from Register H, the high byte of the integer.
769B
CPL 2F
Complement Register A, which turns every bit of the high byte over.
769C
LD H,A 67
Load Register H from Register A, so that Register Pair HL holds the one's complement of the value, which is why NOT 0 is minus one and NOT -1 is zero.
769D
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the accumulator, the type at 7142H already being 02H from the conversion above.
76A0
POP BC C1
Pop Register Pair BC, which throws away the return into 7351H that 734EH left on the stack when it called the term reader, NOT having jumped out of the term reader rather than returned from it.
76A1
The way back into the loop (76A1H), which 768DH also jumps to: jump to 7358H, the head of the operator loop, which takes the text pointer out of 7199H and looks for an operator after the term.

76A4H - The Type Test Everything Calls (76A4H-76B3H)

Thirty places in module 1 call this routine and thirteen more in BASIC/OV1 do, which makes it the most called routine of the file after NXTCHAR at 5E93H and 4353H. It reads the type byte at 7142H and leaves three things at once: Register A holding the type less three, the Zero Flag set when the type is 03H and the value is a string, and the Carry Flag set when the type is below 08H and so is not a double precision number. The two paths differ in that one instruction, the SCF, and in nothing else. The three bytes above 76B0H exist so that a caller which wants only the string test can have it from the Zero Flag while a caller which wants to know whether it has a double precision number reads the Carry Flag, and the SUB 03H that both make is the three that 6088H and 64E8H have to add back.

76A4
LD A,(7142H) 3A 42 71
The type test (76A4H): load Register A with the byte at 7142H, the type of the value in the accumulator, which is 02H for an integer, 03H for a string, 04H for a single precision number and 08H for a double precision one.
76A7
CP 08H FE 08
Compare Register A with 08H, the type of a double precision number, which is the widest of the four.
76A9
Jump to 76B0H on NC, the type being 08H, which takes the path that leaves the Carry Flag clear.
76AB
SUB 03H D6 03
Subtract 03H from Register A, which makes a string 00H, an integer 0FFH and a single precision number 01H.
76AD
OR A B7
Or Register A with itself, which sets the Zero Flag for a string and the Sign Flag for an integer and clears the Carry Flag, the subtraction above having set it for an integer.
76AE
SCF 37
Set the Carry Flag, which is what tells the caller that the type is below 08H and so is not a double precision number.
76AF
RET C9
Return with the type less three in Register A, the Zero Flag set for a string and the Carry Flag set.
76B0
SUB 03H D6 03
A double precision number (76B0H): subtract 03H from Register A, which leaves 05H, the value the parity test at 73AEH reads as even.
76B2
OR A B7
Or Register A with itself, which clears the Carry Flag and sets the flags from the 05H, so that neither the Zero Flag nor the Sign Flag is set.
76B3
RET C9
Return with 05H in Register A and the Carry Flag clear, which is the one answer that says the value is a double precision number.

76B4H - The Integer and Logical Operators (76B4H-76FCH)

The seven operators 73F4H sends here, and the only arithmetic of the whole expression machinery that module 1 does for itself rather than calling the overlay for. Both operands are made integers, the right by 29F4H and the left having been made one at 73F5H before it was pushed, and then the operator is told apart by its precedence and not by its number: Register B holds the precedence because the inner evaluator's own POP BC at 735BH put this operator's own precedence there, so the ladder here reads 7AH for MOD, 7BH for the backslash, 46H for OR, 50H for AND, 3CH for XOR and 32H for EQV, and anything left over is IMP. MOD and the backslash are integer division and go to the overlay at 2C70H and 2C0FH; the five bitwise operators are done in four instructions each. 770EH is pushed as the return for all five of them, and it is two instructions inside the tail LPOS and POS use, LD H,A and a jump to 2A53H, so each operator leaves its low byte in Register L and its high byte in Register A and lets 770EH put the pair together. IMP is the one that needs reading twice: CPL, AND, CPL is De Morgan's law written out, and it gives the left operand complemented or the right, which is what implication means.

76B4
LD A,B 78
The integer and logical operators (76B4H), the address 73FAH pushed: load Register A from Register B, which holds this operator's own precedence out of the table at 6B47H, 735BH having popped it there.
76B5
PUSH AF F5
Push Register AF, that precedence, because the conversion below writes Register A.
76B6
Call 29F4H of BASIC/OV1, which makes the right hand operand in the accumulator an integer and answers with it in Register Pair HL.
76B9
POP AF F1
Pop Register AF, this operator's precedence back into Register A, which the ladder of comparisons below tells the seven operators apart by.
76BA
POP DE D1
Pop Register Pair DE, the left hand operand, which 73F9H pushed as the one word 29F4H had already made of it.
76BB
CP 7AH FE 7A
Compare Register A with 7AH, the precedence the table at 6B47H gives MOD.
76BD
Jump to 2C70H of BASIC/OV1 on Z, the operator being MOD, which divides Register Pair DE by Register Pair HL and gives the remainder.
76C0
CP 7BH FE 7B
Compare Register A with 7BH, the precedence the table gives the backslash.
76C2
Jump to 2C0FH of BASIC/OV1 on Z, the operator being the backslash, which divides Register Pair DE by Register Pair HL and gives the quotient as an integer, where the oblique stroke at 74B2H gives a single precision answer.
76C5
LD BC,770EH 01 0E 77
Load Register Pair BC with 770EH, which is a LD H,A and a jump to 2A53H and so makes an integer of Register L and Register A.
76C8
PUSH BC C5
Push Register Pair BC, that address, as the return all five of the bitwise operators below answer to.
76C9
CP 46H FE 46
Compare Register A with 46H, the precedence the table gives OR.
76CB
Jump to 76D3H on NZ, the operator not being OR.
76CD
LD A,E 7B
OR (76CDH): load Register A from Register E, the low byte of the left hand operand.
76CE
OR L B5
Or Register A with Register L, the low byte of the right hand operand, which sets every bit either of them has.
76CF
LD L,A 6F
Load Register L from Register A, that low byte of the answer.
76D0
LD A,H 7C
Load Register A from Register H, the high byte of the right hand operand.
76D1
OR D B2
Or Register A with Register D, the high byte of the left hand operand, which gives the high byte of the answer.
76D2
RET C9
Return, which takes the 770EH that 76C8H pushed and so makes an integer of Register L and Register A.
76D3
CP 50H FE 50
Compare Register A with 50H, the precedence the table gives AND.
76D5
Jump to 76DDH on NZ, the operator not being AND.
76D7
LD A,E 7B
AND (76D7H): load Register A from Register E, the low byte of the left hand operand.
76D8
AND L A5
And Register A with Register L, the low byte of the right hand operand, which keeps only the bits both of them have.
76D9
LD L,A 6F
Load Register L from Register A, that low byte of the answer.
76DA
LD A,H 7C
Load Register A from Register H, the high byte of the right hand operand.
76DB
AND D A2
And Register A with Register D, the high byte of the left hand operand.
76DC
RET C9
Return, which takes the 770EH that 76C8H pushed.
76DD
CP 3CH FE 3C
Compare Register A with 3CH, the precedence the table gives XOR.
76DF
Jump to 76E7H on NZ, the operator not being XOR.
76E1
LD A,E 7B
XOR (76E1H): load Register A from Register E, the low byte of the left hand operand.
76E2
XOR L AD
Exclusive OR Register A with Register L, the low byte of the right hand operand, which keeps the bits exactly one of them has.
76E3
LD L,A 6F
Load Register L from Register A, that low byte of the answer.
76E4
LD A,H 7C
Load Register A from Register H, the high byte of the right hand operand.
76E5
XOR D AA
Exclusive OR Register A with Register D, the high byte of the left hand operand.
76E6
RET C9
Return, which takes the 770EH that 76C8H pushed.
76E7
CP 32H FE 32
Compare Register A with 32H, the precedence the table gives EQV.
76E9
Jump to 76F3H on NZ, the operator not being EQV, which leaves IMP as the only one it can be.
76EB
LD A,E 7B
EQV (76EBH): load Register A from Register E, the low byte of the left hand operand.
76EC
XOR L AD
Exclusive OR Register A with Register L, the low byte of the right hand operand.
76ED
CPL 2F
Complement Register A, which turns the exclusive OR into its opposite and so sets the bits the two operands agree on, which is what equivalence means.
76EE
LD L,A 6F
Load Register L from Register A, that low byte of the answer.
76EF
LD A,H 7C
Load Register A from Register H, the high byte of the right hand operand.
76F0
XOR D AA
Exclusive OR Register A with Register D, the high byte of the left hand operand.
76F1
CPL 2F
Complement Register A, which gives the high byte of the equivalence.
76F2
RET C9
Return, which takes the 770EH that 76C8H pushed.
76F3
LD A,L 7D
IMP (76F3H), the operator left when none of the four precedences above matched: load Register A from Register L, the low byte of the right hand operand.
76F4
CPL 2F
Complement Register A, the first of the three steps that write De Morgan's law out.
76F5
AND E A3
And Register A with Register E, the low byte of the left hand operand.
76F6
CPL 2F
Complement Register A, which makes the whole of it the left hand operand complemented or the right: A IMP B is false only where A is true and B is false.
76F7
LD L,A 6F
Load Register L from Register A, that low byte of the answer.
76F8
LD A,H 7C
Load Register A from Register H, the high byte of the right hand operand.
76F9
CPL 2F
Complement Register A, the same three steps again for the high byte.
76FA
AND D A2
And Register A with Register D, the high byte of the left hand operand.
76FB
CPL 2F
Complement Register A, which gives the high byte of the implication.
76FC
RET C9
Return, which takes the 770EH that 76C8H pushed and makes an integer of the two bytes.

76FDH - FRE's Subtraction (76FDH-7702H)

Six bytes that belong to FRE and stand here because the conversion they end with is the unsigned one. 4A7CH jumps here with the two pointers FRE has worked out in Register Pair HL and Register Pair DE, and 2C66H is used and not 2A8AH: 2C66H treats Register Pair HL as a number without a sign and 2A8AH treats it as one with a sign, so a free space of 40000 bytes comes out as forty thousand here where the signed conversion would make it minus 25536. It is the same choice ERL makes at 750DH for a line number.

76FD
OR A B7
FRE's subtraction (76FDH), which 4A7CH jumps to: or Register A with itself, which clears the Carry Flag so that the subtraction below borrows nothing.
76FE
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL with the Carry Flag, which leaves the count of free bytes between the two pointers FRE worked out.
7700
Jump to 2C66H of BASIC/OV1, which makes the value in Register Pair HL a single precision number without a sign, so that a count above 32767 is a positive answer.

7703H - LPOS, POS and the Integer Return They Share (7703H-7711H)

The two position functions, fifteen bytes between them and five of those shared. LPOS is the word 6891H of the function address table and POS the word 687DH, and the only difference between them is which cell is read: 6E91H for the printer and 713CH for the display. Both add one, because BASIC counts a position from one where the interpreter counts it from nothing. 770BH is the increment and 770CH is the entry ERR uses at 74FDH with the error number already in Register A, and 770EH inside that is the two instructions the five bitwise operators of 76B4H return to.

7703
LD A,(6E91H) 3A 91 6E
LPOS (7703H), the word 6891H of the function address table: load Register A with the byte at 6E91H, the position the printer has reached across its line.
7706
Jump to 770BH, the increment both functions share.
7708
LD A,(713CH) 3A 3C 71
POS (7708H), the word 687DH of the function address table: load Register A with the byte at 713CH, the position the display has reached across its line, which 41E9H reads to decide whether a carriage return is wanted.
770B
INC A 3C
The increment (770BH): increment Register A, so that the first position of a line is one and not nothing.
770C
LD L,A 6F
The entry ERR uses (770CH), which 74FDH calls with the number of the last error in Register A: load Register L from Register A, the low byte of the value.
770D
XOR A AF
Clear Register A to 00H, which is the high byte every one of these three values takes, none of them reaching 256.
770E
LD H,A 67
The entry the logical operators return to (770EH), which 76C8H pushed: load Register H from Register A, which for those operators is the high byte they worked out and for the three functions above is the 00H of 770DH.
770F
Jump to 2A53H of BASIC/OV1, which stores Register Pair HL into the accumulator at 72ECH and sets the type at 7142H to 02H, an integer.

7712H - USR: the Head of the Call (7712H-7714H)

Three bytes, and the last three of module 1 below the eight patch bytes of the NEWB package at 7715H. The guard is worth the row: a USR call hands control to machine code of the program's own, which could read a protected program out of memory, so 57DFH is called to stop one that was typed at the keyboard against a protected program. The bytes at 7715H to 7717H that follow are module 2's, the one patch of the eight that intercepts a function rather than a statement or the line reader, and SVCUSR at 8048H takes over the call when the USR number is 11 and jumps back to 773AH when it is not.

7712
USR (7712H), which 7541H reaches: call 57DFH, which returns at once while a program is running and, when the line number at 6E9CH is 0FFFFH and so the USR was typed at the keyboard, falls into the test at 57E8H that gives Illegal function call through 5F95H for a protected program.

7715H - The SVCUSR Patch (7715H-7717H)

One of the eight places where the NEWB enhancement package of module 2 replaces instructions of module 1 with a call or a jump into its own code at 8048H and above, each of them an ORG in NEWB/ASM. The bytes here are loaded by module 1 and then loaded over again by module 2.

7715
SVCUSR intercept (7715H-7717H): call SVCUSR at 8048H, which takes over the USR call of the first module so that USR11 can issue a supervisor call; SVCUSR returns to the first module at 773AH when the USR number is not 11.

7718H - USR: the Argument and the Call (7718H-7733H)

The twenty-eight bytes of module 1 that stand above the SVCUSR patch, and the rest of the USR function. They arrive with the address of the USR vector in Register Pair DE, which 7734H worked out from the digit after the keyword, and their work is to evaluate the one argument, set the stack up so that the program's own machine code can simply RET, and jump to it. The machine code is entered with Register Pair HL holding 72ECH, the accumulator, and Register A holding the type at 7142H, so a routine reads its argument out of the accumulator and leaves its answer there. 27DBH of BASIC/OV1 is the return, and it is two instructions, a POP HL and a RET, which take the text pointer 771CH left on the stack back into Register Pair HL and answer to the evaluator: it is the same two instructions as 7585H, which the one argument functions use, and it stands in the overlay rather than here only because that is where there was room for it. A string argument has 481DH called for it first, which frees the slot if the string is the topmost temporary, and that is the whole difference the type makes.

7718
PUSH DE D5
USR: the argument (7718H), which the CALL 8048H of the SVCUSR patch returns into when the USR number is not 11: push Register Pair DE, the address of this USR number's vector in the table at 6E76H, which 774FH worked out.
7719
Call 7571H, which demands the opening parenthesis, works out the one argument into the accumulator and demands the closing parenthesis.
771C
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the text pointer on the stack for 27DBH to pop and brings the vector's address into Register Pair HL.
771D
LD E,(HL) 5E
Load Register E with the byte Register Pair HL addresses, the low byte of the address the program put in this USR vector with DEF USR.
771E
INC HL 23
Increment Register Pair HL to the high byte of the vector.
771F
LD D,(HL) 56
Load Register D with the byte Register Pair HL addresses, the high byte, so that Register Pair DE holds the machine code address the program gave.
7720
LD HL,27DBH 21 DB 27
Load Register Pair HL with 27DBH of BASIC/OV1, which is a POP HL and a RET and nothing else.
7723
PUSH HL E5
Push Register Pair HL, that address, as the return the machine code answers to, which pops the text pointer back and returns to the evaluator at 7351H.
7724
PUSH DE D5
Push Register Pair DE, the machine code's own address, which the return at 7733H takes to enter it.
7725
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type of the argument's value, which is what the machine code is given in Register A.
7728
PUSH AF F5
Push Register AF, that type, because the call below writes Register A.
7729
CP 03H FE 03
Compare Register A with 03H, the type of a string.
772B
Call 481DH on Z, the argument being a string, which reads the descriptor's address out of 72ECH and frees its slot through 483AH when it is the topmost temporary, so that a USR(A$+B$) does not leave the joined string holding space.
772E
POP AF F1
Pop Register AF, the type of the argument back into Register A, which is how the machine code is told what it has been given.
772F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the machine code's address into Register Pair HL and puts into Register Pair DE the descriptor's address for a string argument or the vector's address raised by one for a number.
7730
LD HL,72ECH 21 EC 72
Load Register Pair HL with 72ECH, the accumulator, which is where the machine code reads the argument from and writes its answer to.
7733
RET C9
Return, which takes the machine code's address that 7724H pushed and so enters the program's own routine with 27DBH standing under it as the way back.

7734H - Which USR Vector the Call Names (7734H-7751H)

Thirty bytes shared by the USR function and by DEF USR, and the first two instructions of them are what the SVCUSR patch of module 2 replaces: NEWB/ASM's SVCUSR at 8048H begins with the same CALL 5E93H and LD BC,0000H and then jumps to 773AH, so that a USR number of 11 is taken by the enhancement package and every other number comes back into the middle of this routine. The ten USR vectors stand at 6E76H to 6E89H, two bytes each, and USR with no digit after it means USR0, which is what the 0000H in Register Pair BC arranges. The digit is not a character by the time this runs: the tokenizer turns a one digit number into a token from 11H for nothing to 1AH for nine, and NXTCHAR at 5E93H, meeting one of those, puts its value in the word at 7149H and its kind in 7147H. So the test here is on the token range and the value is read out of 7149H, and that is why USR 10 names USR1 and then has a nought left over for the evaluator to make Syntax error of.

7734
Which USR vector (7734H), which 7752H calls and the SVCUSR patch at 7715H called before module 2 replaced the call: call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL to the character after the USR keyword.
7737
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the index into the vector table, which is what makes a bare USR mean USR0 when no digit follows the keyword.
773A
CP 1BH FE 1B
Where SVCUSR comes back (773AH), the point 8057H of module 2 jumps to for every USR number but 11: compare Register A with 1BH, which is one above 1AH, the token the tokenizer gives the digit nine.
773C
Jump to 774BH on NC, the character being above every digit token, which leaves the index at 0000H and so names USR0.
773E
CP 11H FE 11
Compare Register A with 11H, the token the tokenizer gives the digit nothing, which is the lowest of the ten.
7740
Jump to 774BH on C, the character being below every digit token, which names USR0 as well: a bare USR(X) comes through here.
7742
A digit follows (7742H): call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL past the digit token onto the opening parenthesis.
7745
LD A,(7149H) 3A 49 71
Load Register A with the byte at 7149H, the value of the digit, which NXTCHAR stored there when it met the token: the low byte of that word is the number 00H to 09H.
7748
OR A B7
Or Register A with itself, which clears the Carry Flag so that the rotation below brings nothing in at bit 0.
7749
RLA 17
Rotate Register A left through the Carry Flag, which doubles the USR number so that it indexes the two byte vectors rather than their bytes.
774A
LD C,A 4F
Load Register C from Register A, the doubled USR number, Register B still holding the 00H that 7737H put there.
774B
EX DE,HL EB
The vector's address (774BH): exchange Register Pair DE with Register Pair HL, which puts the text pointer into Register Pair DE out of the way of the two instructions below.
774C
LD HL,6E76H 21 76 6E
Load Register Pair HL with 6E76H, the first of the ten USR vectors, which stand two bytes each from 6E76H to 6E89H in the variable area of module 1.
774F
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, the doubled USR number, which makes Register Pair HL the address of this call's own vector.
7750
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the vector's address into Register Pair DE and brings the text pointer back into Register Pair HL.
7751
RET C9
Return with the vector's address in Register Pair DE, which 7718H pushes to call through and 7755H pushes to store into.

7752H - DEF: DEF USR and DEF FN (7752H-7789H)

The routine the statement address table holds for token 97H at 67ECH, and it is two statements in one. The token after DEF decides: 0D3H is USR and the address the program gives goes straight into one of the ten vectors at 6E76H, and anything else must be 0D4H, FN, which 7904H demands. DEF FN stores nothing but a text pointer. The function's own name is looked up as a variable with bit 7 set in its first character, so that FN A and A are two different variables and the one can never be reached by an ordinary reference, and what goes into its two byte value is the address in the program text of the ( that opens the parameter list. Nothing of the body is read, nothing is checked beyond that one parenthesis, and the parameter names are created as ordinary variables here and then left, which is what makes them visible at the point of definition and is why the call at 7855H has to save and restore them rather than make its own. The whole statement ends by jumping into the statement skipper at 6065H, so the body is stepped over as if it were a REM: a DEF FN whose body is nonsense is accepted without complaint until it is called. 78F6H is the guard that makes DEF FN typed at the keyboard give Illegal direct, error 12, which it does by testing the line number at 6E9CH for 0FFFFH.

7752
DEF USR (7752H), which 7765H reaches: call 7734H, which reads the digit after the USR keyword and answers with the address of that number's vector in the table at 6E76H in Register Pair DE.
7755
PUSH DE D5
Push Register Pair DE, the vector's address, which 775DH brings back with an exchange once the value is in hand.
7756
Call 4353H, the character demand, which insists that the text pointer stands on the byte held after the call.
7759
DEFB 0F1H F1
7759H: the byte 4353H above compares the line character with, which is 0F1H, the token the tokenizer gives the equals sign of DEF USR0 = 32000.
775A
Call 6566H, which works out the expression after the equals sign and makes it a sixteen bit address in Register Pair DE.
775D
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the vector's address into Register Pair HL and leaves the text pointer on the stack.
775E
LD (HL),E 73
Store Register E into the byte Register Pair HL addresses, the low byte of the address the program gave, into the first byte of the vector.
775F
INC HL 23
Increment Register Pair HL to the second byte of the vector.
7760
LD (HL),D 72
Store Register D into the byte Register Pair HL addresses, the high byte, so that the whole address now stands in the vector for 771DH to read when the function is called.
7761
POP HL E1
Pop Register Pair HL, the text pointer standing after the expression.
7762
RET C9
Return to the statement loop at 5E3BH, which 5E8CH pushed before it entered this statement.
7763
CP 0D3H FE D3
DEF (7763H), the routine the statement address table holds for token 97H at 67ECH: compare Register A with 0D3H, the token of USR, Register A holding the character the statement loop left there.
7765
Jump to 7752H on Z, the statement being DEF USR, which needs no name and no parameters.
7767
DEF FN (7767H): call 7904H, which demands the token 0D4H of FN, sets 7182H to 80H so that the name may not be subscripted, and looks the name up with bit 7 set in its first character, answering with the address of its two byte value in Register Pair DE.
776A
Call 78F6H, which gives Illegal direct, error 12, through the error chain at 5886H when the line number at 6E9CH is 0FFFFH: a function may be defined in a program and not at the keyboard.
776D
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the address of the function's value into Register Pair HL and puts the text pointer into Register Pair DE.
776E
LD (HL),E 73
Store Register E into the byte Register Pair HL addresses, the low byte of the text pointer, which is the whole of what a definition keeps.
776F
INC HL 23
Increment Register Pair HL to the second byte of the function's value.
7770
LD (HL),D 72
Store Register D into the byte Register Pair HL addresses, the high byte, so that the function's value is the address in the program text of the character after its name.
7771
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the text pointer back into Register Pair HL.
7772
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character standing after the function's name.
7773
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis of the parameter list.
7775
Jump to 6065H on NZ, there being no parameter list: the statement skipper steps to the end of the line, so DEF FNA = 3 is taken without complaint and 779FH finds no parenthesis when it is called.
7778
Call NXTCHAR at 5E93H, which steps the text pointer in Register Pair HL past the opening parenthesis onto the first parameter's name.
777B
The parameter loop (777BH): call 39FBH, the variable search, which makes the parameter a variable of its own if it does not exist already and steps the text pointer past its name.
777E
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character after that name.
777F
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis of the parameter list.
7781
Jump to 6065H on Z, the list being over: the statement skipper steps over the equals sign and the whole body of the definition without reading any of it.
7784
Call 4353H, the character demand, which insists on the byte held after the call.
7787
DEFB 2CH 2C
7787H: the byte 4353H above compares the line character with, which is 2CH, the comma between two parameter names. Anything else is Syntax error from 4362H, so a parameter list is the one part of a definition that is checked when it is made.
7788
Jump to 777BH, which makes the next parameter a variable and so goes round the list until the closing parenthesis is met.

778AH - Calling a Function the Program Defined (778AH-7854H)

The hardest routine of module 1 to read, and the one this pass corrected the page's account of a region for. A call of FN A(X,Y) has to work out each argument from the caller's text while reading each parameter's name from the definition's text, which means two text pointers in play at once, and it has to make the parameters hold the arguments while the body is worked out and then give them back whatever they held before. The two pointers are kept in 7199H for the call and 717AH for the definition, and the loop here moves between them with exchanges. The work is done in two passes over the argument list. The first pass, 77B7H to 77F9H, builds a frame on the stack: for each parameter it finds the variable, works out the argument, converts it to the parameter's type through 78DDH, and pushes twelve bytes, which are the parameter's address, eight bytes of the argument's value and the type. The second pass, 77FFH to 783FH, takes that frame apart and, for each entry, copies the parameter's whole table entry into the save area at 722DH and then assigns the argument to the parameter through LET's own 60ACH. The 00H that 77B4H pushed under the frame is what tells the second pass it has reached the bottom. The save area is a hundred bytes and 7829H enforces it, so a call whose parameters' names and values come to a hundred bytes or more is Illegal function call. Only when all of that is done does 7855H lay the saved entries down as the function's own local region. 7851H is an entry inside the operand byte of the LD A,0D5H at 7850H, and it is how a definition with no parameter list at all skips both passes: 0D5H executes as PUSH DE.

778A
A call of a user defined function (778AH), which 756EH reaches for the token 0D4H: call 7904H, which demands the FN token, sets 7182H to 80H and looks the name up with bit 7 set in its first character, answering with the address of its value in Register Pair DE and its type in 7142H.
778D
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type the function's own name gives its answer, which is what 78DCH pops and 78DDH converts to at the end.
7790
OR A B7
Or Register A with itself, which sets the flags from that type so that the push below carries them and 7800H can test for the 00H marker on the same bits.
7791
PUSH AF F5
Push Register AF, the function's type, which stays under the whole of the call until 78DCH pops it.
7792
LD (7199H),HL 22 99 71
Store Register Pair HL into the word at 7199H, the caller's own text pointer standing after the function's name, which is the first of the two pointers this routine keeps.
7795
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the address of the function's value into Register Pair HL.
7796
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the low byte of the text pointer the definition stored at 776EH.
7797
INC HL 23
Increment Register Pair HL to the second byte of the function's value.
7798
LD H,(HL) 66
Load Register H from the byte Register Pair HL addresses, the high byte of that stored text pointer.
7799
LD L,A 6F
Load Register L from Register A, the low byte, so that Register Pair HL stands where DEF FN left off in the program text.
779A
LD A,H 7C
Load Register A from Register H, the high byte of the stored pointer.
779B
OR L B5
Or Register A with Register L, the low byte, which sets the Zero Flag only when the whole word is 0000H and the function was never defined.
779C
Jump to 5878H on Z, the function having no definition: the entry of the error chain that gives Undefined user function, error 18.
779F
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character the definition stored a pointer to.
77A0
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis of the definition's parameter list.
77A2
Jump to 7851H on NZ, the definition having no parameter list, which 7775H let through: both passes are skipped and the body is worked out with no parameters at all.
77A5
Call NXTCHAR at 5E93H, which steps the definition's text pointer in Register Pair HL past the opening parenthesis onto the first parameter's name.
77A8
LD (717AH),HL 22 7A 71
Store Register Pair HL into the word at 717AH, the definition's text pointer, which is the second of the two this routine keeps.
77AB
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the definition's pointer into Register Pair DE out of the way.
77AC
LD HL,(7199H) 2A 99 71
Load Register Pair HL with the word at 7199H, the caller's text pointer standing after the function's name.
77AF
Call 4353H, the character demand, which insists that the caller's text stands on the byte held after the call.
77B2
DEFB 28H 28
77B2H: the byte 4353H above compares the caller's line character with, which is 28H, the opening parenthesis of the argument list. A definition with parameters must be called with parentheses, and FN A on its own is Syntax error from 4362H here.
77B3
XOR A AF
Clear Register A to 00H, the marker that goes under the frame.
77B4
PUSH AF F5
Push Register AF, that 00H, which 77FFH pops when it has taken every entry of the frame and which 7800H reads as the bottom of it.
77B5
PUSH HL E5
Push Register Pair HL, the caller's text pointer, which 77C0H brings back with an exchange and 77F1H pushes again on every pass after the first.
77B6
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the definition's text pointer into Register Pair HL for the lookup below.
77B7
LD A,80H 3E 80
The first pass over the argument list (77B7H), which 77F9H comes back to: load Register A with 80H, the value that makes the variable search refuse a subscript.
77B9
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H, that flag, which has to be set again on every pass because 3A90H clears it: a parameter of a definition may not be an array, so DEF FNA(B(1)) is refused.
77BC
Call 39FBH, the variable search, reading the parameter's name out of the definition's text and answering with the address of its value in Register Pair DE.
77BF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the parameter's value address into Register Pair HL and puts the definition's text pointer into Register Pair DE.
77C0
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves the parameter's value address on the stack and brings the caller's text pointer back into Register Pair HL.
77C1
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the parameter's own type, which the search left there and which the argument is converted to below.
77C4
PUSH AF F5
Push Register AF, that type, which 77D0H pops once the argument has been worked out.
77C5
PUSH DE D5
Push Register Pair DE, the definition's text pointer, which the expression below would otherwise lose: 735DH inside the evaluator writes the word at 717AH for itself and the array code writes it at 3C54H, so the one cell cannot hold this pointer across a call of 7345H and the stack has to.
77C6
Call the expression evaluator at 7345H, which works the argument out of the caller's text into the accumulator and leaves its own type in 7142H.
77C9
LD (7199H),HL 22 99 71
Store Register Pair HL into the word at 7199H, the caller's text pointer standing after the argument.
77CC
POP HL E1
Pop Register Pair HL, the definition's text pointer that 77C5H pushed.
77CD
LD (717AH),HL 22 7A 71
Store Register Pair HL into the word at 717AH, the definition's text pointer, which 77F2H loads again for the comma.
77D0
POP AF F1
Pop Register AF, the parameter's type that 77C4H pushed.
77D1
Call 78DDH, the type conversion dispatch, which indexes the table at 6B53H and makes the argument be of the parameter's type: an argument of 1.7 given to an integer parameter loses its fraction here.
77D4
LD C,04H 0E 04
Load Register C with 04H, four levels of stack, which is what one entry of the frame and the work below it need.
77D6
Call 4247H, the stack space check, which gives Out of memory through 425CH when the stack cannot take them.
77D9
LD HL,0FFF8H 21 F8 FF
Load Register Pair HL with 0FFF8H, which is minus eight.
77DC
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, which makes Register Pair HL the Stack Pointer lowered by eight.
77DD
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which opens eight bytes of room on the stack, enough for a value of any of the four types.
77DE
Call 2973H of BASIC/OV1, which copies the accumulator into the address in Register Pair HL for as many bytes as 7142H names, so the argument's value now stands in that room.
77E1
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type the value was stored as, which is the parameter's own type after the conversion above.
77E4
PUSH AF F5
Push Register AF, that type, which 77FFH pops as the top of this entry of the frame.
77E5
LD HL,(7199H) 2A 99 71
Load Register Pair HL with the word at 7199H, the caller's text pointer standing after the argument.
77E8
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the character after the argument.
77E9
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis of the argument list.
77EB
Jump to 77FFH on Z, the list being over, which begins the second pass over the frame just built.
77ED
Call 4353H, the character demand, which insists on the byte held after the call.
77F0
DEFB 2CH 2C
77F0H: the byte 4353H above compares the caller's line character with, which is 2CH, the comma between two arguments.
77F1
PUSH HL E5
Push Register Pair HL, the caller's text pointer standing after the comma, which 77C0H brings back on the next pass exactly as 77B5H did on the first.
77F2
LD HL,(717AH) 2A 7A 71
Load Register Pair HL with the word at 717AH, the definition's text pointer standing after the parameter's name.
77F5
Call 4353H, the character demand, which insists on the byte held after the call.
77F8
DEFB 2CH 2C
77F8H: the byte 4353H above compares the definition's line character with, which is 2CH, the comma between two parameter names. The two demands at 77EDH and 77F5H are what make the counts match: a call with more arguments than the definition has parameters finds no comma in the definition and is given Syntax error.
77F9
Jump to 77B7H, the head of the first pass, which looks the next parameter up and works the next argument out.
77FB
POP AF F1
Where the assignment comes back to (77FBH), the address 783DH and 783EH both push: pop Register AF, the running total of the frame's names and values that 782EH pushed.
77FC
LD (722BH),A 32 2B 72
Store Register A into the byte at 722BH, that running total, which is where the length of the region being built is kept and which 7874H reads when it is complete.
77FF
POP AF F1
The second pass over the frame (77FFH), which 77EBH reaches: pop Register AF, the type at the top of the frame's next entry, or the 00H that 77B4H pushed under all of them.
7800
OR A B7
Or Register A with itself, which sets the Zero Flag when the 00H marker has been reached and the whole frame is taken.
7801
Jump to 7842H on Z, the frame being empty: every parameter has been saved and assigned and the body can be worked out.
7803
LD (7142H),A 32 42 71
Store Register A into the byte at 7142H, this entry's type, so that the load below takes the right number of bytes.
7806
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, which the addition below turns into the Stack Pointer itself.
7809
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, which makes Register Pair HL the address of the eight bytes 77DDH opened and 77DEH filled.
780A
Call 296BH of BASIC/OV1, which loads the accumulator from the address in Register Pair HL for as many bytes as 7142H names, so the argument's value is in the accumulator again.
780D
LD HL,0008H 21 08 00
Load Register Pair HL with 0008H, the eight bytes that value took.
7810
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, which makes Register Pair HL the Stack Pointer raised past them.
7811
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which gives those eight bytes back.
7812
POP DE D1
Pop Register Pair DE, the parameter's value address that 77C0H left on the stack, which is the last of this entry's twelve bytes.
7813
LD L,03H 2E 03
Load Register L with 03H, the three bytes of an entry's header that stand above the two name characters, which the walk below adds its own count to.
7815
INC L 2C
The walk back over the name (7815H): increment Register L, the count of bytes this entry takes before its value.
7816
DEC DE 1B
Decrement Register Pair DE, stepping one byte down from the value towards the name.
7817
LD A,(DE) 1A
Load Register A with the byte Register Pair DE addresses, which is a character of the name's tail while bit 7 is set and the second character or 00H when it is not.
7818
OR A B7
Or Register A with itself, which sets the Sign Flag from bit 7 of that byte.
7819
Jump to 7815H on M, the byte being a character of the name's tail: every character beyond the second is stored with its high bit set, so the walk counts them and stops at the second character.
781C
DEC DE 1B
Decrement Register Pair DE, the first of three steps over the bytes a table entry carries above its two name characters.
781D
DEC DE 1B
Decrement Register Pair DE a second time, Register L being left alone for these three steps because the three bytes they cross are counted by the 03H that 7813H started it at.
781E
DEC DE 1B
Decrement Register Pair DE a third time, so that Register Pair DE now stands at the first byte of the parameter's whole table entry and Register L holds its length up to the value.
781F
LD A,(7142H) 3A 42 71
Load Register A with the byte at 7142H, the type, which is also the count of bytes the parameter's value takes.
7822
ADD A,L 85
Add Register L to Register A, the length of the entry's name and header, so that Register A holds the whole length of the entry, value and all.
7823
LD B,A 47
Load Register B from Register A, that whole length, which the sum below adds to the running total.
7824
LD A,(722BH) 3A 2B 72
Load Register A with the byte at 722BH, the total of the entries saved so far, which is 00H at the first of them.
7827
LD C,A 4F
Load Register C from Register A, that total, which is also the offset into the save area at 722DH.
7828
ADD A,B 80
Add Register B to Register A, this entry's length, which gives the total the save area would hold.
7829
CP 64H FE 64
Compare Register A with 64H, which is one hundred, the size of the save area that runs from 722DH to 7290H.
782B
Jump to 5F95H on NC, the entries coming to a hundred bytes or more: Illegal function call, which is the only limit a call of a user defined function has and is reached by names and values together and not by a count of parameters.
782E
PUSH AF F5
Push Register AF, the new running total, which 77FBH pops back into 722BH after the assignment below.
782F
LD A,L 7D
Load Register A from Register L, the length of this entry's name and header, which is the count of bytes to copy.
7830
LD B,00H 06 00
Load Register B with 00H, the high byte of the offset into the save area, the total standing in Register C.
7832
LD HL,722DH 21 2D 72
Load Register Pair HL with 722DH, the first byte of the hundred byte save area.
7835
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, the offset, which makes Register Pair HL the place in the save area this entry's copy goes.
7836
LD C,A 4F
Load Register C from Register A, the count of bytes to copy, Register B holding 00H.
7837
Call 78F1H, the block mover's own count test, which copies the parameter's name and header out of the variable table into the save area so that 7882H can lay them down as the function's local region.
783A
LD BC,77FBH 01 FB 77
Load Register Pair BC with 77FBH, the two instructions that put the running total back into 722BH and fall into the next pass.
783D
PUSH BC C5
Push Register Pair BC, that address, which is the return LET's assignment answers to.
783E
PUSH BC C5
Push Register Pair BC a second time, because 60ACH is entered below the PUSH HL at 60B9H and the POP HL at 60EFH takes one of the two off, so the assignment needs two copies of its return address to come back here with one.
783F
Jump to 60ACH, inside LET's own assignment, which stores the value in the accumulator at the address the parameter's value stands at: the parameter now holds the argument and its old value is in the save area.
7842
LD HL,(7199H) 2A 99 71
The arguments are all assigned (7842H), which 7801H reaches: load Register Pair HL with the word at 7199H, the caller's text pointer standing on the closing parenthesis of the argument list.
7845
Call NXTCHAR at 5E93H, which steps the caller's text pointer in Register Pair HL past that closing parenthesis.
7848
PUSH HL E5
Push Register Pair HL, the caller's text pointer, which 78DBH pops at the very end of the call and hands back to the evaluator.
7849
LD HL,(717AH) 2A 7A 71
Load Register Pair HL with the word at 717AH, the definition's text pointer standing on the closing parenthesis of the parameter list.
784C
Call 4353H, the character demand, which insists on the byte held after the call.
784F
DEFB 29H 29
784FH: the byte 4353H above compares the definition's line character with, which is 29H, the closing parenthesis of the parameter list. This is the other half of the count test: a call with fewer arguments than the definition has parameters finds a comma where this demands a parenthesis, so the two demands at 77F8H and here between them insist that the two lists are the same length.
7850
LD A,0D5H 3E D5
Load Register A with 0D5H, which nothing reads: 7855H writes Register A before anything looks at it, and the instruction stands here for its operand byte alone. That byte at 7851H is the entry 77A2H jumps to, and 0D5H executes as a PUSH DE which puts the caller's text pointer on the stack where 7848H would have put it, so that 78DBH finds it there whether the definition had parameters or not.
7852
LD (717AH),HL 22 7A 71
Both paths meet (7852H): store Register Pair HL into the word at 717AH, the definition's text pointer standing after the parameter list, which 7896H loads to work the body out from.

7855H - The Local Parameters Laid Down and Taken Away (7855H-78DCH)

The region this routine builds is the one the page called CHAIN's COMMON region in fifteen places until pass 41 corrected it. It is the local variables of a call of a user defined function and nothing else. 7855H opens room on the stack, copies the whole of 71C1H and upwards into it, puts the entries the second pass saved in the area at 722DH down at 71C5H instead, and raises the nesting count at 7297H and the flag at 7294H that makes the variable search walk this region before the simple variables. The body of the definition is then worked out by 733AH, which demands the equals sign first. 78B9H undoes all of it: the saved block is copied back over 71C1H, the Stack Pointer is put back to just above it, and the count and the flag come down again. Because the saved block begins with 71C1H and 71C3H themselves, the whole of the nesting is a chain down the stack: each frame's first word is where the frame below it was saved and its second word is that frame's length, which is what 78BFH reads to know how much to copy back. The two words of the pair are read at a distance of four from the block's start at 78BDH, and the four INC BC instructions at 78C3H add that same four back on. The last two instructions pop the caller's text pointer and the function's own type and fall into the conversion at 78DDH, so a function declared with a type always has its answer converted to it and DEF FNA%(X) = X/2 gives a whole number.

7855
LD A,(71C3H) 3A C3 71
The local region is laid down (7855H), which 7852H falls into from both paths: load Register A with the byte at 71C3H, the length of the region now in force, which is 00H when no user defined function is being called.
7858
ADD A,04H C6 04
Add 04H to Register A, the two words at 71C1H and 71C3H that are saved with the region, so that Register A holds the whole length of the block to be saved.
785A
PUSH AF F5
Push Register AF, that length, which 7860H brings back after the check below.
785B
RRCA 0F
Rotate Register A right, which halves the length into the count of two byte levels the stack check wants. An odd length is not halved but turned into a large number, bit 0 going round into bit 7, which is bug B345.
785C
LD C,A 4F
Load Register C from Register A, that count of levels, which 4247H reads.
785D
Call 4247H, the stack space check, which gives Out of memory through 425CH when the stack cannot take the block and leaves Register B holding 00H for the move below.
7860
POP AF F1
Pop Register AF, the whole length of the block back again.
7861
LD C,A 4F
Load Register C from Register A, that length, which with the 00H that 424BH left in Register B is the count the move at 786DH works to.
7862
CPL 2F
Complement Register A, the first half of making the length negative.
7863
INC A 3C
Increment Register A, which completes the two's complement so that Register A holds the length negated.
7864
LD L,A 6F
Load Register L from Register A, the low byte of that negative length.
7865
LD H,0FFH 26 FF
Load Register H with 0FFH, the high byte of it, the length being below 256.
7867
ADD HL,SP 39
Add the Stack Pointer to Register Pair HL, which makes Register Pair HL the Stack Pointer lowered by the length of the block.
7868
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which opens exactly that much room on the stack for the block.
7869
PUSH HL E5
Push Register Pair HL, the address of that room, which 7870H brings back once the copy is made.
786A
LD DE,71C1H 11 C1 71
Load Register Pair DE with 71C1H, the first byte of the block to be saved, which is the word that points at where the frame below this one was saved.
786D
Call 78F1H, the block mover's count test, which copies Register Pair BC bytes from 71C1H into the room on the stack: the two words and the whole of the region at 71C5H go with it.
7870
POP HL E1
Pop Register Pair HL, the address of the saved block on the stack.
7871
LD (71C1H),HL 22 C1 71
Store Register Pair HL into the word at 71C1H, which makes that word the link down to this call's own saved block and is what 78B9H reads to find it again.
7874
LD HL,(722BH) 2A 2B 72
Load Register Pair HL with the word at 722BH, the total length of the entries the second pass gathered into the save area at 722DH.
7877
LD (71C3H),HL 22 C3 71
Store Register Pair HL into the word at 71C3H, the length of the region that is about to be in force, which the next call down reads at 7855H and which 78BFH reads out of the saved block.
787A
LD B,H 44
Load Register B from Register H, the high byte of that length, which is 00H the save area being a hundred bytes.
787B
LD C,L 4D
Load Register C from Register L, the low byte, so that Register Pair BC is the count of bytes to move.
787C
LD HL,71C5H 21 C5 71
Load Register Pair HL with 71C5H, the first byte of the local parameter region, which the variable search walks when 7294H is set.
787F
LD DE,722DH 11 2D 72
Load Register Pair DE with 722DH, the first byte of the save area the second pass filled with the parameters' table entries.
7882
Call 78F1H, the block mover's count test, which lays those entries down at 71C5H as the function's own local variables.
7885
LD H,A 67
Load Register H from Register A, which the mover left holding 00H: its count test ends with an OR C on a count of zero, so Register A is a nought to be had for nothing.
7886
LD L,A 6F
Load Register L from Register A, the same 00H, so that Register Pair HL is 0000H.
7887
LD (722BH),HL 22 2B 72
Store Register Pair HL into the word at 722BH, which clears the running total so that the next call of a function starts its own save area from the bottom.
788A
LD HL,(7297H) 2A 97 72
Load Register Pair HL with the word at 7297H, the count of user defined function calls now nested.
788D
INC HL 23
Increment Register Pair HL, this call being one more.
788E
LD (7297H),HL 22 97 72
Store Register Pair HL into the word at 7297H, that count.
7891
LD A,H 7C
Load Register A from Register H, the high byte of the count.
7892
OR L B5
Or Register A with Register L, the low byte, which gives a non-zero value whenever any call at all is nested.
7893
LD (7294H),A 32 94 72
Store Register A into the byte at 7294H, the flag the variable search reads to know that the region at 71C5H must be walked before the simple variables, with 7291H saying which of the two walks is in hand.
7896
LD HL,(717AH) 2A 7A 71
Load Register Pair HL with the word at 717AH, the definition's text pointer standing after the parameter list.
7899
Call 733AH, which demands the equals sign of the definition and works the whole body out into the accumulator, the parameters now holding the arguments.
789C
DEC HL 2B
Decrement Register Pair HL, the text pointer, so that the call below reads the character the body ended on.
789D
Call NXTCHAR at 5E93H, which steps to the next character that matters and sets the Zero Flag at the end of the line.
78A0
Jump to 586CH on NZ, the definition's body not ending at the end of its line: Syntax error, which is why DEF FNA(X) = X : PRINT is refused when the function is called and not when it is defined.
78A3
Call 76A4H, which sets the Zero Flag when the type at 7142H is 03H and the answer is a string.
78A6
Jump to 78B9H on NZ, the answer being a number, which needs nothing doing to it: a number stands in the accumulator and no part of it is in the region about to be taken away.
78A8
LD DE,7175H 11 75 71
A string answer (78A8H): load Register Pair DE with 7175H, the descriptor the string routines build in, which is the first address above the pool of temporary descriptors that begins at 7157H.
78AB
LD HL,(72ECH) 2A EC 72
Load Register Pair HL with the word at 72ECH, the address of the descriptor the answer is held by.
78AE
Call 434DH, the sixteen bit comparison, which sets the Carry Flag when that descriptor stands below 7175H and so is one of the temporaries.
78B1
Jump to 78B9H on C, the descriptor being a temporary: its three bytes are not in the region about to be taken away and the answer stands as it is.
78B3
Call 462BH, which takes the length and address out of the descriptor, allots that many bytes of string space and copies the text into it, so that a function which gives one of its own parameters back does not hand out a descriptor inside the region that is about to be restored.
78B6
Call 4683H, the PUSH DE inside the LD A,0D5H at 4682H, which is the entry for a caller already holding 7175H in Register Pair DE and which makes that descriptor the value in the accumulator.
78B9
LD HL,(71C1H) 2A C1 71
The local region is taken away (78B9H): load Register Pair HL with the word at 71C1H, the address on the stack where this call's block was saved.
78BC
LD D,H 54
Load Register D from Register H, the high byte of that address.
78BD
LD E,L 5D
Load Register E from Register L, the low byte, so that Register Pair DE is the saved block and is the source of the copy back.
78BE
INC HL 23
Increment Register Pair HL to the second byte of the saved block.
78BF
INC HL 23
Increment Register Pair HL a second time, to the first byte of the second word of the block, which is the length the frame below this one was saved with.
78C0
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of that length.
78C1
INC HL 23
Increment Register Pair HL to the high byte of the length.
78C2
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, the high byte, so that Register Pair BC is the length of the region to be put back.
78C3
INC BC 03
Increment Register Pair BC, the first of four, which add back the two words at 71C1H and 71C3H that stand in front of the region.
78C4
INC BC 03
Increment Register Pair BC a second time, the second byte of the word at 71C1H.
78C5
INC BC 03
Increment Register Pair BC a third time, the first byte of the word at 71C3H.
78C6
INC BC 03
Increment Register Pair BC a fourth time, the second byte of that word, so that Register Pair BC is the whole length of the saved block exactly as 7858H worked it out.
78C7
LD HL,71C1H 21 C1 71
Load Register Pair HL with 71C1H, the first byte the copy back goes to.
78CA
Call 78F1H, the block mover's count test, which copies the saved block back over 71C1H, 71C3H and the region at 71C5H, so that the parameters hold again whatever they held before the call.
78CD
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings into Register Pair HL the address the mover left Register Pair DE at, which is the first byte above the saved block on the stack.
78CE
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which gives the stack the block's room back in one instruction.
78CF
LD HL,(7297H) 2A 97 72
Load Register Pair HL with the word at 7297H, the count of nested calls.
78D2
DEC HL 2B
Decrement Register Pair HL, this call being over.
78D3
LD (7297H),HL 22 97 72
Store Register Pair HL into the word at 7297H, that count.
78D6
LD A,H 7C
Load Register A from Register H, the high byte of the count.
78D7
OR L B5
Or Register A with Register L, the low byte, which is 00H only when no call is nested any longer.
78D8
LD (7294H),A 32 94 72
Store Register A into the byte at 7294H, so that the variable search stops walking the region at 71C5H when the last call has finished.
78DB
POP HL E1
Pop Register Pair HL, the caller's text pointer that 7848H pushed, or that the PUSH DE at 7851H pushed for a definition with no parameters.
78DC
POP AF F1
Pop Register AF, the function's own type that 7791H pushed, which the conversion below is made to.

78DDH - The Type Conversion Dispatch (78DDH-78EBH)

Nine bytes called from four places, LET's 60A9H, the file item collector's 4AD0H, DIM's 5D74H and the user function call at 77D1H, and fallen into by the function call's own ending. It masks the type to three bits so that the 08H of double precision becomes 00H, adds it to 6B53H once, and then calls 766DH inside the function dispatch, which adds it a second time and jumps to the word it lands on. So the table at 6B53H is indexed by twice the type and its five words are reached in the order 6B53H for double precision, 6B57H for an integer, 6B59H for a string and 6B5BH for a single precision number, with 6B55H holding the 0000H of the type that does not exist. Register Pair HL is pushed and popped around the whole of it, so a caller's text pointer comes through untouched.

78DD
PUSH HL E5
The type conversion dispatch (78DDH): push Register Pair HL, which for every one of the four callers and for the fall through from 78DCH is the text pointer, so that the conversion gives it back.
78DE
AND 07H E6 07
And Register A with 07H, the type, which leaves 02H, 03H and 04H as they are and makes the 08H of double precision 00H.
78E0
LD HL,6B53H 21 53 6B
Load Register Pair HL with 6B53H, the first word of the type conversion table.
78E3
LD C,A 4F
Load Register C from Register A, the masked type, which is the index.
78E4
LD B,00H 06 00
Load Register B with 00H, the high byte of the index, so that Register Pair BC is the masked type as a sixteen bit value for the two additions.
78E6
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, the index once, which is half of what the table wants.
78E7
Call 766DH, the indexing inside the function dispatch, which adds Register Pair BC to Register Pair HL a second time and jumps to the word it lands on, so the conversion routine in BASIC/OV1 is entered with this routine's own return address under it.
78EA
POP HL E1
Pop Register Pair HL, the text pointer the conversion was not to touch.
78EB
RET C9
Return with the value in the accumulator made to be of the type Register A named.

78ECH - The Block Mover (78ECH-78F5H)

Ten bytes that do what an LDIR does, and are used instead of one by the four places that build and take down a function call's local region. The count test is at the foot and the entry is 78F1H, which is how a count of 0000H is handled without moving anything, and every one of the four callers uses that entry. Register A is left holding 00H when the move is over, the test being a LD A,B and an OR C on a count that has reached zero, and 7885H takes advantage of that to get itself a nought.

78EC
LD A,(DE) 1A
The move itself (78ECH): load Register A with the byte Register Pair DE addresses, one byte of the source.
78ED
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the matching byte of the destination.
78EE
INC HL 23
Increment Register Pair HL to the next byte of the destination.
78EF
INC DE 13
Increment Register Pair DE to the next byte of the source.
78F0
DEC BC 0B
Decrement Register Pair BC, the count of bytes left to move.
78F1
LD A,B 78
The count test and the entry every caller uses (78F1H), which 7837H, 786DH, 7882H and 78CAH all call: load Register A from Register B, the high byte of the count.
78F2
OR C B1
Or Register A with Register C, the low byte, which sets the Zero Flag only when the whole count is 0000H.
78F3
Jump to 78ECH on NZ, there being bytes left to move.
78F5
RET C9
Return with Register A holding 00H, which is what the test above leaves on a count of nothing and what 7885H reads as a nought.

78F6H - The Direct Statement Test (78F6H-7903H)

What makes DEF FN typed at the keyboard give Illegal direct, error 12. The line number of the statement being run is kept at 6E9CH and 593BH puts 0FFFFH there at command level, so one increment and a test of both bytes is the whole of it. Register Pair HL is pushed and popped around the test, which is why DEF FN can call it with its text pointer in hand.

78F6
PUSH HL E5
The direct statement test (78F6H), which 776AH calls: push Register Pair HL, the text pointer, which the load below writes over.
78F7
LD HL,(6E9CH) 2A 9C 6E
Load Register Pair HL with the word at 6E9CH, the number of the line being run, which 593BH sets to 0FFFFH at command level.
78FA
INC HL 23
Increment Register Pair HL, which makes 0FFFFH into 0000H and leaves every real line number as something else.
78FB
LD A,H 7C
Load Register A from Register H, the high byte of the raised number.
78FC
OR L B5
Or Register A with Register L, the low byte, which sets the Zero Flag only for a line number of 0FFFFH.
78FD
POP HL E1
Pop Register Pair HL, the text pointer, the test being made and the flags set.
78FE
RET NZ C0
Return on NZ, a real line number standing at 6E9CH and the statement being part of a program.
78FF
LD E,0CH 1E 0C
Load Register E with 0CH, which is twelve, the number of the error Illegal direct in the message block at 6B7CH.
7901
Jump to 5886H, the error handler, which takes the number in Register E and writes the twelfth text of the block.

7904H - The Name of a Function (7904H-7911H)

Fourteen bytes both DEF FN and a call of a function begin with. The FN token is demanded first, so FN cannot be left out of either, and then the name is looked up in a way that puts it out of the reach of every ordinary reference: 790DH ors 80H into the first character of the name before jumping into the variable search at 3A00H, one instruction past the LD C,(HL) at 39FFH that would have read the character plainly. So FN A is kept as a variable whose first character is 0C1H where the variable A has 41H, and the two can stand side by side in one program and never be taken for each other. The 80H put in 7182H stops a subscript, so a function's name may not be an array.

7904
The name of a function (7904H), which 7767H and 778AH both call: call 4353H, the character demand, which insists that the text pointer stands on the byte held after the call.
7907
DEFB 0D4H D4
7907H: the byte 4353H above compares the line character with, which is 0D4H, the token the tokenizer gives FN. It is demanded by both the definition and the call, so neither DEF A(X) nor PRINT A(1) can reach a user defined function by accident.
7908
LD A,80H 3E 80
Load Register A with 80H, which is both the flag value below and the bit that marks the name.
790A
LD (7182H),A 32 82 71
Store Register A into the byte at 7182H, the flag that makes the variable search refuse a subscript, which is the same 80H CALL writes at 535FH and which stops FN A(1) being read as an array reference.
790D
OR (HL) B6
Or Register A with the byte Register Pair HL addresses, the first character of the function's name, which sets bit 7 of it.
790E
LD C,A 4F
Load Register C from Register A, that marked first character, which is what the search compares the table's entries against.
790F
Jump to 3A00H, one instruction into the variable search, past the LD C,(HL) at 39FFH that would have read the character plainly: the search goes on from there with the marked character already in Register C and makes the variable if it does not exist.

7912H - The Tokens the Statement Loop Refuses, and INP (7912H-792BH)

Twenty-six bytes that have nothing to do with each other and are neighbours because this is where module 1's code ends and the out, wait and width group begins at 792CH. 7912H is where every token above the statement table goes: the statement loop subtracts 81H at 5E7AH and anything 4DH or above comes here, which is every token from 0CEH up, and all of it is Syntax error but one pair. The exception is the 0FFH that marks a function, which arrives as 7EH, and even then only one function may begin a statement: 0FFH and 83H, which is MID$, and that pair goes to 49CAH, which is MID$ used as a statement to put characters into the middle of a string. 7922H is INP, the word 687BH of the function address table, and it is the only function of the fifty-one that reads a port.

7912
CP 7EH FE 7E
A token above the statement table (7912H), which 5E80H reaches for every token from 0CEH upwards: compare Register A with 7EH, which is 0FFH less the 81H the statement loop took off and so is the byte that marks a function.
7914
Jump to 586CH on NZ, the token being anything else: Syntax error, so that a statement which begins with TO, THEN, STEP, a relational operator or any of the other operand tokens is refused here rather than by the evaluator.
7917
INC HL 23
Increment Register Pair HL, the text pointer, from the 0FFH to the byte that holds the function's own token raised by 80H.
7918
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that raised token.
7919
INC HL 23
Increment Register Pair HL to the character after it, which is where 49CAH wants the text pointer when it is entered.
791A
CP 83H FE 83
Compare Register A with 83H, the raised token of MID$, whose own token is 03H.
791C
Jump to 49CAH on Z, the statement being MID$ used as a statement: MID$(A$,2,3) = "XYZ" puts characters into the middle of a string in place and is the one function that may stand where a statement does.
791F
Jump to 586CH, every other function having been named where a statement was wanted: Syntax error, so LEN(A$) = 3 is refused.
7922
INP (7922H), the word 687BH of the function address table: call 6570H, which works the argument out and makes it a sixteen bit value in Register Pair HL through CINT at 29F4H of the overlay.
7925
LD B,H 44
Load Register B from Register H, the high byte of the port number, which the Z80 puts on the top half of the address bus during an IN.
7926
LD C,L 4D
Load Register C from Register L, the low byte, which is the port the byte is read from.
7927
IN A,(C) ED 78
Read the port Register C names into Register A, which is the whole of INP: the Model 4 has no port above 0FFH, so the high byte in Register B reaches the bus and nothing answers it.
7929
Jump to 770CH, the integer return LPOS, POS and ERR share, which makes the byte in Register A a positive integer in the accumulator and sets 7142H to 02H.

792CH - OUT, WAIT and WIDTH, and the Numeric Argument Readers They Share (792CH-79ADH)

Three statements and four little readers stand together in these 130 bytes. 792CH is the port and value reader OUT and WAIT both begin with: it works out the port number into Register Pair DE through 6566H, insists on the comma after it, and works the second argument out into Register A through 799FH, leaving the port in Register Pair BC so that the Z80's own OUT (C),A and IN A,(C) can be used. OUT 7939H is three instructions: read the pair and write the byte to the port. WAIT 793FH reads the same pair and then an optional third argument, and sits in a two instruction loop reading the port until the byte, exclusive ORed with the third argument and ANDed with the second, is not zero: the second argument is the mask of bits to watch and the third the state they are to be compared against. Nothing breaks that loop, so a WAIT on a port that never changes hangs the machine with no way back but RESET. WIDTH 7960H takes two forms: WIDTH LPRINT, the token 9DH, sets the printer's width at 6E94H, and WIDTH alone sets the display's at 6E95H; each then works out a tab stop count through 7983H and keeps it at 6E93H or 6E96H. 7983H is worth seeing on its own: it takes 10H off the width until the result goes negative, adds 20H back, negates what is left and adds the width, which is the width rounded down to a multiple of sixteen. The readers below it are the interpreter's general numeric argument routines: 7990H works an expression out and turns it into a sixteen bit value in Register Pair DE, leaving the flags set from Register D, which is the entry CLEAR reaches through 5F91H; 798DH is the same with a NXTCHAR first; 799FH adds the refusal of anything that will not fit a single byte and brings the value back in Register A; and 799CH is that with a NXTCHAR first.

792C
The port and value reader (792CH), which OUT and WAIT both call: call 6566H, which works the port number out at the text pointer and leaves it in Register Pair DE.
792F
PUSH DE D5
Push Register Pair DE, the port number, which the POP BC at 7937H brings back into Register Pair BC so that the Z80's own port instructions can use it.
7930
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
7933
DEFB 2CH 2C
The comma between the port number and the value, read as data by the routine the call at 7930H reaches, not executed; the instruction after that call is the one at 7934H.
7934
Call 799FH, which works the second argument out and brings it back in Register A, giving Illegal function call at 5F95H for anything that will not fit a single byte.
7937
POP BC C1
Pop Register Pair BC, the port number pushed at 792FH, which the OUT and IN instructions below address the port through.
7938
RET C9
Return to whichever of the two statements called, with the port in Register Pair BC and the value in Register A.
7939
OUT (7939H), the routine the statement address table holds for token 09CH at 67EBH: call 792CH, which reads the port into Register Pair BC and the byte into Register A.
793C
OUT (C),A ED 79
Write Register A to the port Register Pair C addresses, which is the whole of what the statement does: no port number is refused and no port is reserved.
793E
RET C9
Return to the statement loop at 5E3BH that the dispatcher pushed.
793F
WAIT (793FH), the routine the statement address table holds for token 096H at 67DFH: call 792CH, which reads the port into Register Pair BC and the mask into Register A.
7942
PUSH BC C5
Push Register Pair BC, the port number, which the POP BC at 7955H brings back once the third argument has been read.
7943
PUSH AF F5
Push Register Pair AF, the mask of bits to watch, which the POP AF at 7953H brings back.
7944
LD E,00H 1E 00
Load Register E with 00H, the value the third argument defaults to when the statement gives only two.
7946
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
7947
Call NXTCHAR at 5E93H, which brings that character back in Register A with the Zero Flag set when the statement has ended with two arguments.
794A
Jump to 7953H on Z, there being no third argument, so that the port is watched for any of the masked bits going to one.
794C
Call 4353H, which insists on the byte standing after this call, only a comma being allowed before the third argument.
794F
DEFB 2CH 2C
The comma before the third argument, data for the call at 794CH and not an instruction; the instruction after that call is the one at 7950H.
7950
Call 799FH, which works the third argument out into Register A, and whose own 79ACH leaves it in Register E for the loop below.
7953
POP AF F1
Pop Register Pair AF, the mask pushed at 7943H.
7954
LD D,A 57
Load Register D from Register A, the mask, where the loop keeps it because Register A is needed for the port's own byte.
7955
POP BC C1
Pop Register Pair BC, the port number pushed at 7942H.
7956
IN A,(C) ED 78
The wait loop (7956H): read the port Register C addresses into Register A, which is the one instruction of the statement that touches the hardware.
7958
XOR E AB
Exclusive OR Register A with Register E, the third argument, which turns every bit that already stands in the state asked for into a zero.
7959
AND D A2
AND Register A with Register D, the mask, which leaves only the bits the statement named.
795A
Jump back to 7956H on Z, not one of the masked bits having reached the state asked for. Nothing else ends this loop: a WAIT on a port that never changes holds the machine until it is reset.
795C
RET C9
Return to the statement loop at 5E3BH, one of the watched bits having changed.
795D
Jump to SYNERR 586CH, which prints Syntax error: three bytes that nothing reaches. No instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 names 795DH, 795EH or 795FH or holds one as a word, and no relative jump of the three images reaches any of them, so WAIT's return at 795CH falls out of the statement and WIDTH begins at 7960H with these three bytes between. That is B303.
7960
CP 9DH FE 9D
WIDTH (7960H), the routine the statement address table holds for token 0A1H at 67E3H: compare Register A with 9DH, the token of the LPRINT keyword, which is what tells WIDTH LPRINT from a plain WIDTH.
7962
Jump to 7975H on NZ, the statement being a plain WIDTH and so about the display rather than the printer.
7964
Call NXTCHAR at 5E93H, which steps the text pointer past the LPRINT token and onto the width itself.
7967
Call 799FH, which works the width out into Register A and refuses anything above 255 with Illegal function call.
796A
LD (6E94H),A 32 94 6E
Store Register A into the byte at 6E94H, the printer's width, which PRINT reads at 6264H to decide when a comma field must go to the next line.
796D
LD E,A 5F
Load Register E from Register A, the width, which 7983H works its answer out from.
796E
Call 7983H, which rounds the width down to a multiple of sixteen and returns the result in Register A.
7971
LD (6E93H),A 32 93 6E
Store Register A into the byte at 6E93H, the printer's last tab stop, which is the width rounded down to a multiple of sixteen.
7974
RET C9
Return to the statement loop at 5E3BH, the printer's width and its last tab stop both set.
7975
A plain WIDTH (7975H), reached from 7962H: call 799FH, which works the display width out into Register A.
7978
LD (6E95H),A 32 95 6E
Store Register A into the byte at 6E95H, the display's width, which PRINT reads at 6279H for its own comma fields.
797B
LD E,A 5F
Load Register E from Register A, the width, for the rounding below.
797C
Call 7983H, which rounds it down to a multiple of sixteen.
797F
LD (6E96H),A 32 96 6E
Store Register A into the byte at 6E96H, the display's last tab stop.
7982
RET C9
Return to the statement loop at 5E3BH, the display's width and its last tab stop both set.
7983
SUB 10H D6 10
The tab stop rounding (7983H): subtract 10H from Register A, sixteen, which is the width of one comma field.
7985
Jump back to 7983H on NC, which takes sixteen off again and again until the result passes below zero, so that Register A holds the width less the greatest multiple of sixteen that fits it, less sixteen more.
7987
ADD A,20H C6 20
Add 20H to Register A, thirty-two, which brings the result back into range after the subtraction that went negative.
7989
CPL 2F
Complement Register A, every bit of it, which with the increment below negates the number.
798A
INC A 3C
Increment Register A, finishing the negation, so that Register A holds how far the width stands above the multiple of sixteen below it, counted the other way about.
798B
ADD A,E 83
Add Register E to Register A, the width itself, so that Register A holds the width rounded down to a multiple of sixteen, which is the last comma field that fits.
798C
RET C9
Return to whichever form of WIDTH called, with the rounded width in Register A and the width itself still in Register E.
798D
A sixteen bit argument with a step first (798DH): call NXTCHAR at 5E93H, which steps the text pointer onto the first character of the expression.
7990
A sixteen bit argument where the text pointer stands on it (7990H), which 5F91H calls: call the expression evaluator at 7345H, which leaves the value in the accumulator at 72ECH.
7993
PUSH HL E5
Push Register Pair HL, the text pointer standing after the expression, which the POP HL at 7998H brings back.
7994
Call 29F4H of the overlay, which turns the value in the accumulator into a two byte integer in Register Pair HL.
7997
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts that value into Register Pair DE where every caller of this routine expects it.
7998
POP HL E1
Pop Register Pair HL, the text pointer pushed at 7993H.
7999
LD A,D 7A
Load Register A from Register D, the high byte of the value.
799A
OR A B7
OR Register A with itself, which sets the sign flag from that byte and the Zero Flag when it is 00H, so that a caller can tell a negative value from a positive one and one that fits a byte from one that does not.
799B
RET C9
Return to the caller with the value in Register Pair DE and those flags.
799C
A single byte argument with a step first (799CH): call NXTCHAR at 5E93H, which steps the text pointer onto the expression.
799F
A single byte argument where the text pointer stands on it (799FH), which OUT, WAIT, WIDTH, SOUND and nine other places call: call the expression evaluator at 7345H.
79A2
Call 7993H, the body of the sixteen bit reader above, which turns the value into Register Pair DE and sets the flags from Register D.
79A5
Jump to FUNCERR 5F95H on NZ, Register D not being 00H and so the value standing at 256 or above, which is what refuses a port number, a width or a byte that will not fit.
79A8
DEC HL 2B
Decrement Register Pair HL so that the call which follows reads the character the text pointer already stands on.
79A9
Call NXTCHAR at 5E93H, which brings that character back in Register A and leaves the text pointer on it for the caller.
79AC
LD A,E 7B
Load Register A from Register E, the low byte of the value, which is the whole of it: the caller gets the argument in Register A and Register E both.
79AD
RET C9
Return to the caller with the argument in Register A and in Register E, and the text pointer standing on the character after it.

79AEH - LLIST and LIST, and the String Writer at 7A04H (79AEH-7A0CH)

LLIST 79AEH sets the printer flag and falls into LIST, which is the whole of the difference between them. LIST 79B3H reads a line number range with 5A96H, the parser DELETE and CHAIN's own DELETE parameter also use, refuses a protected program through 57E8H, and then walks the program a line at a time: the link is read at 79C3H, a link of 0000H ends the listing at READY 5920H, the line number is read and compared with the end of the range at 79DAH, and a line past it ends the listing at 591FH, which is END's own entry and throws the pushed word away before falling into READY. For each line in the range the number is written through NUMDSP, a blank follows it unless the line's text begins with 09H, the text is expanded into INBUF 7039H by UNTOKE 7A0DH, and 7A04H writes it a character at a time through 4212H. Two things are worth noting. 79E5H stores each line's number into CURLIN 7192H as it goes, so a BREAK during a listing leaves the last line listed as the line in hand; and the BREAK test at 79CFH is made only when there is no file in hand, which is what lets SAVE "f",A use this routine at full speed: 4D5EH jumps here with the file open, and 40D8H then sends every character to the file instead of the display, so the whole of an ASCII save is done by LIST and SAVE contributes nothing to it.

79AE
LD A,01H 3E 01
LLIST (79AEH), the routine the statement address table holds for token 09EH at 67EFH: load Register A with 01H, the value that sends output to the printer.
79B0
LD (6E92H),A 32 92 6E
Store Register A into the byte at 6E92H, the printer flag, which 40D8H reads at 40DFH, and fall into LIST: the two statements are one routine and this store is the only difference.
79B3
POP BC C1
LIST (79B3H), the routine the statement address table holds for token 093H at 67E7H and which SAVE's ASCII form jumps to at 4D5EH: pop Register Pair BC, the statement loop's own address that the dispatcher pushed, which this statement does not return through.
79B4
Call 5A96H, the line number range parser, which reads line1 into Register Pair DE, insists on the minus token between the two, defaults line2 to 0FFFAH, leaves line2 on the stack and falls into FIND at 5AB4H, which returns the address of line1 in Register Pair BC.
79B7
PUSH BC C5
Push Register Pair BC, the address of the first line to list, which the POP HL at 79C1H brings back.
79B8
Call 57E8H, which gives Illegal function call at 5F95H when the protected program flag at 72CBH is set: a protected program cannot be listed, which is the whole of what protection amounts to.
79BB
LD HL,0FFFFH 21 FF FF
The line loop (79BBH), which 7A02H comes back to: load Register Pair HL with 0FFFFH, the line number that means direct mode.
79BE
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, so that a BREAK or an error during the listing is reported as having happened at the keyboard and not inside the program.
79C1
POP HL E1
Pop Register Pair HL, the address of the line to list, pushed at 79B7H on the first turn and at 79E2H on every turn after it.
79C2
POP DE D1
Pop Register Pair DE, the second line number of the range, which 5A96H left on the stack and which every turn of the loop puts back.
79C3
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of this line's link.
79C4
INC HL 23
Increment Register Pair HL onto the high byte of the link.
79C5
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds the address of the next line.
79C6
INC HL 23
Increment Register Pair HL onto the low byte of this line's number.
79C7
LD A,B 78
Load Register A from Register B, the high byte of the link.
79C8
OR C B1
OR Register A with Register C, its low byte, so that the Zero Flag is set only when the link is 0000H and the program has run out.
79C9
Jump to READY 5920H on Z, the listing having reached the end of the program, which prints the prompt and drops into command level.
79CC
Call 45DFH, which loads FILEX 6E98H and sets the Zero Flag when there is no file in hand.
79CF
Call 7CD5H on Z, which reads KFLAG$ and stops the listing when BREAK has been pressed. The test is made only when there is no file in hand, so an ASCII save runs at full speed and cannot be broken into.
79D2
PUSH BC C5
Push Register Pair BC, the address of the next line, which the POP BC at 79DDH brings back.
79D3
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the low byte of this line's number.
79D4
INC HL 23
Increment Register Pair HL onto the high byte of the number.
79D5
LD B,(HL) 46
Load Register B with the byte Register Pair HL addresses, so that Register Pair BC holds this line's number.
79D6
INC HL 23
Increment Register Pair HL onto the first byte of the line's text.
79D7
PUSH BC C5
Push Register Pair BC, this line's number, which the exchange below swaps for the text pointer.
79D8
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the text pointer on the stack and brings this line's number into Register Pair HL.
79D9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the number into Register Pair DE and the end of the range into Register Pair HL for the comparison.
79DA
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Carry Flag when this line's number stands above the end of the range.
79DD
POP BC C1
Pop Register Pair BC, the address of the next line, pushed at 79D2H.
79DE
Jump to 591FH on C, this line standing past the end of the range: 591FH is the operand byte of the instruction at 591EH, a POP BC of its own, which throws the pushed word away and falls into READY.
79E1
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the text pointer back into Register Pair HL and puts the end of the range on the stack.
79E2
PUSH HL E5
Push Register Pair HL, the text pointer, which the POP HL at 79EBH brings back once the number has been written.
79E3
PUSH BC C5
Push Register Pair BC, the address of the next line, which the POP HL at 79C1H takes on the next turn of the loop.
79E4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts this line's number into Register Pair HL for the store and the display below.
79E5
LD (7192H),HL 22 92 71
Store Register Pair HL into the word at 7192H, CURLIN, the line in hand as the enhancement package and the ERL function read it, so that a listing leaves the last line listed as the line in hand.
79E8
Call NUMDSP at 3139H, which writes the line number as decimal digits.
79EB
POP HL E1
Pop Register Pair HL, the text pointer pushed at 79E2H, standing on the first byte of the line's text.
79EC
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that first byte.
79ED
CP 09H FE 09
Compare Register A with 09H, a tab, which a line may begin with and which is to stand in the place of the blank below.
79EF
Jump to 79F6H on Z, the line beginning with a tab, so that no blank is written and the tab itself is expanded with the rest of the text.
79F1
LD A,20H 3E 20
Load Register A with 20H, a blank, which separates the line number from the line's text.
79F3
Call 40D8H, which writes that blank to the file, the printer or the display as the flags stand.
79F6
Call UNTOKE at 7A0DH, the name NEWB/EQU gives it, which expands the line's tokens back into keywords and lays the text down in INBUF 7039H as a 00H ended string.
79F9
LD HL,7039H 21 39 70
Load Register Pair HL with 7039H, INBUF, the start of that expanded text.
79FC
Call 7A04H, the string writer below, which writes it a character at a time.
79FF
Call 41F5H, which writes the carriage return that ends the listed line.
7A02
Jump back to 79BBH for the next line, which reads the link and the number again and stops at the end of the program or the end of the range.
7A04
LD A,(HL) 7E
The string writer (7A04H), which IMMED's 8192H path also calls: load Register A with the byte Register Pair HL addresses, one character of the 00H ended string.
7A05
OR A B7
OR Register A with itself, which sets the Zero Flag when the character is the 00H that ends the string.
7A06
RET Z C8
Return on Z, the whole string having been written.
7A07
Call 4212H, which writes the character, taking the tab at 09H and the control codes into account as it goes.
7A0A
INC HL 23
Increment Register Pair HL onto the next character of the string.
7A0B
Jump back to 7A04H, which writes the string to its end.

7A0DH - UNTOKE: a Tokenized Line Turned Back into Characters (7A0DH-7BEFH)

The exact opposite of the tokenizer at 5AD3H, and the routine that makes LIST and EDIT possible. UNTOKE is the name NEWB/EQU gives 7A0DH, and five places call it: LIST at 79F6H, EDIT at 3D3AH, the enhancement package at 81ADH and 81CEH, and BASIC/OV2's COPY at 2305H. It reads the tokenized text from Register Pair HL and lays the characters down from Register Pair BC, which it starts at INBUF 7039H, with Register D as the room left, 255 bytes of it, so that a line whose keywords expand past the buffer is cut off rather than allowed to run over. Three cells carry its state. 7143H holds three bits, which is a third use of a cell the evaluator and the tokenizer already share: bit 0 says the scan is inside a string literal, bit 1 that it is inside a DATA, bit 2 that it is inside a REM, and in any of those three a token is copied out as the byte it is rather than expanded. 72C5H says what was written last, 00H for nothing that matters, 01H for a character of a name or a number and 0FFH for a keyword, and it is what puts exactly one blank between two things that would otherwise run together: this is a second use of a cell CALL owns. And 7148H carries the type of a numeric constant, which decides whether the detokenizer at 7B6DH writes a ! or a # after the digits. A keyword is expanded by walking the whole reserved word table at 68F7H from its first byte, counting the 00H bytes that end the groups to recover the first letter, which is why the table needs no index from token to address. Three spellings are put back as the single characters they were typed as: the apostrophe, which is stored as a colon, REM and token 0DCH and which 7A97H recognises by reading the four characters it has just written backwards; ELSE, which is stored with a colon in front of it that 7AE7H takes away again; and WHILE, which is stored as two bytes and whose second, the plus token 0F3H, 7AEDH swallows.

7A0D
LD BC,7039H 01 39 70
UNTOKE (7A0DH), the name NEWB/EQU gives it, which LIST calls at 79F6H, EDIT at 3D3AH, the enhancement package at 81ADH and 81CEH and BASIC/OV2's COPY at 2305H: load Register Pair BC with 7039H, INBUF, the buffer the characters are laid down in.
7A10
LD D,0FFH 16 FF
Load Register D with 0FFH, 255, the room left in that buffer, which every byte written takes one off.
7A12
XOR A AF
Clear Register A to 00H, the value the two flag cells below are to start at.
7A13
LD (7143H),A 32 43 71
Store Register A into 7143H, whose three low bits say whether the scan stands inside a string literal, a DATA or a REM, and which starts outside all three.
7A16
XOR A AF
Clear Register A to 00H again, a second time for a second cell, this routine making no assumption about what the store above left.
7A17
LD (72C5H),A 32 C5 72
Store Register A into 72C5H, which says what was written last and which starts saying nothing: no blank is wanted before the first thing on the line.
7A1A
Call 57E8H, which gives error 5, Illegal function call, when the flag at 72CBH says the program in memory is protected: this is why a protected program cannot be listed or edited.
7A1D
Jump to 7A23H, past the step below, which the first byte of the line does not want.
7A1F
INC BC 03
The step (7A1FH), which 7A80H and 7AB7H reach: increment Register Pair BC to the next place in the buffer.
7A20
INC HL 23
Increment Register Pair HL to the next byte of the tokenized line.
7A21
DEC D 15
Decrement Register D, one byte less room in the buffer.
7A22
RET Z C8
Return on Z, the buffer being full, which cuts the line off where it stood.
7A23
LD A,(HL) 7E
The byte weighed (7A23H), which 7A1DH, 7B5FH and 7BEDH all reach: load Register A with the byte Register Pair HL addresses, one byte of the tokenized line.
7A24
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that ends the line.
7A25
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, which writes that byte out before it is weighed, so that the 00H of the line becomes the 00H of the buffer with no instruction of its own.
7A26
RET Z C8
Return on Z, the whole of the line having been expanded.
7A27
CP 0BH FE 0B
Compare Register A with 0BH, the lowest of the tokens the tokenizer leaves in place of a number.
7A29
Jump to 7A50H on C, the byte standing below 0BH, which is a control character of the line and is written as it is.
7A2B
CP 20H FE 20
Compare Register A with 20H, the blank, above which stand the ordinary characters.
7A2D
LD E,A 5F
Load Register E from Register A, the byte, which the paths below all want kept while Register A is used for the flag cells.
7A2E
Jump to 7A61H on C, the byte standing between 0BH and 1FH and so being a number the tokenizer packed, which the blank test below and then 7B6DH take.
7A30
CP 22H FE 22
Compare Register A with 22H, a quotation mark, which opens and closes a string literal.
7A32
Jump to 7A3EH on NZ, the byte not being a quotation mark, which weighs it as a colon instead.
7A34
LD A,(7143H) 3A 43 71
Load Register A with the byte at 7143H, the three state bits.
7A37
XOR 01H EE 01
Exclusive Or Register A with 01H, which turns bit 0 over: a quotation mark opens a literal when the scan is outside one and closes it when it is inside.
7A39
LD (7143H),A 32 43 71
Store Register A into 7143H, the state bits with bit 0 changed.
7A3C
LD A,22H 3E 22
Load Register A with 22H, the quotation mark again, which the store above destroyed.
7A3E
CP 3AH FE 3A
A colon tested for (7A3EH), which 7A32H reaches: compare Register A with 3AH, a colon, which ends a statement and so ends a DATA.
7A40
Jump to 7A50H on NZ, the byte being neither a quotation mark nor a colon.
7A42
LD A,(7143H) 3A 43 71
Load Register A with the byte at 7143H, the three state bits.
7A45
RRA 1F
Rotate Register A right through the Carry Flag, which brings bit 0, the string literal bit, into the Carry Flag.
7A46
Jump to 7A4EH on C, the colon standing inside a string literal, where it is an ordinary character and ends nothing.
7A48
RLA 17
Rotate Register A left through the Carry Flag, which puts the three bits back as they were.
7A49
AND 0FDH E6 FD
And Register A with 0FDH, which clears bit 1, the DATA bit: a colon ends a DATA statement and the items after it are expanded as a statement again.
7A4B
LD (7143H),A 32 43 71
Store Register A into 7143H, the state bits with bit 1 cleared.
7A4E
LD A,3AH 3E 3A
The colon restored (7A4EH), which 7A46H reaches: load Register A with 3AH, the colon the stores above destroyed.
7A50
OR A B7
A plain character or a token (7A50H), which 7A29H and 7A40H reach: or Register A with itself, which sets the Sign Flag when the byte has bit 7 set and so is a token.
7A51
Jump to 7A83H on M, the byte being a token, which the expansion below takes.
7A54
LD E,A 5F
Load Register E from Register A, the character, which 7A75H reads back after the blank test.
7A55
CP 2EH FE 2E
Compare Register A with 2EH, a full stop, which stands inside a number and must not have a blank put in front of it.
7A57
Jump to 7A61H on Z, the character being that full stop.
7A59
Call 7B62H, which comes back with the Carry Flag clear when Register A holds a letter or a digit and set when it holds neither.
7A5C
Jump to 7A61H on NC, the character being a letter or a digit and so part of a name or a number.
7A5E
XOR A AF
Clear Register A to 00H, the value for a character that is neither, which says that nothing a blank could be wanted after has been written.
7A5F
Jump to 7A72H, which stores that 00H and writes the character with no blank in front of it.
7A61
LD A,(72C5H) 3A C5 72
The blank between two names (7A61H), which 7A2EH, 7A57H and 7A5CH all reach: load Register A with the byte at 72C5H, which says what was written last.
7A64
OR A B7
Or Register A with itself, which sets the Zero Flag when nothing that a blank could be wanted after has been written.
7A65
Jump to 7A70H on Z, nothing a blank could be wanted after having been written yet.
7A67
INC A 3C
Increment Register A, which sets the Zero Flag only for the 0FFH that says a keyword was written last.
7A68
Jump to 7A70H on NZ, the last thing written having been part of a name or a number, which needs no blank before another one.
7A6A
LD A,20H 3E 20
Load Register A with 20H, a blank, a keyword having been written and a name or a number being about to be: without it PRINT A would come out as PRINTA and would not be read back as the same line.
7A6C
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, the blank's place in the buffer.
7A6D
INC BC 03
Increment Register Pair BC past that blank, on to the place the name or the number goes.
7A6E
DEC D 15
Decrement Register D, the blank having taken one byte of the buffer's room.
7A6F
RET Z C8
Return on Z, the buffer having filled with the blank, which cuts the line off there.
7A70
LD A,01H 3E 01
A name character written (7A70H), which 7A65H and 7A68H reach: load Register A with 01H, the value that says a character of a name or a number was written last.
7A72
LD (72C5H),A 32 C5 72
The state stored (7A72H), which 7A5FH reaches: store Register A into 72C5H, which the blank test above reads for the byte after this one.
7A75
LD A,E 7B
Load Register A from Register E, the character or the number token 7A2DH or 7A54H kept.
7A76
CP 0BH FE 0B
Compare Register A with 0BH, the lowest of the number tokens.
7A78
Jump to 7A7FH on C, the byte being a control character below 0BH.
7A7A
CP 20H FE 20
Compare Register A with 20H, the blank, above which it is an ordinary character.
7A7C
Jump to 7B6DH on C, the byte being a number the tokenizer packed, which the detokenizer there turns back into digits.
7A7F
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, the character's place in the buffer, which is the plain case this whole routine is built around.
7A80
Jump to 7A1FH, the step, which takes the next byte of the line.
7A83
LD A,(7143H) 3A 43 71
A token (7A83H), which 7A51H reaches: load Register A with the byte at 7143H, the three state bits.
7A86
RRA 1F
Rotate Register A right through the Carry Flag, which brings bit 0, the string literal bit, into the Carry Flag.
7A87
Jump to 7AB7H on C, the token standing inside a string literal, where it is one of the characters of the string and is written out as it is.
7A89
RRA 1F
Rotate Register A right through the Carry Flag, which brings bit 1, the DATA bit, into the Carry Flag.
7A8A
RRA 1F
Rotate Register A right through the Carry Flag, which brings bit 2, the REM bit, into the Carry Flag.
7A8B
Jump to 7ACBH on NC, bit 2 being clear and the scan standing outside a REM, which takes the DATA bit the rotate above left in the Carry Flag with it.
7A8D
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the token, the scan standing inside a REM.
7A8E
CP 0DCH FE DC
Compare Register A with 0DCH, the token of the apostrophe, which the tokenizer writes after a colon and a REM for a remark that was typed with an apostrophe.
7A90
PUSH HL E5
Push Register Pair HL, the text pointer, which 7AADH or 7AB5H takes back.
7A91
PUSH BC C5
Push Register Pair BC, the place in the buffer, which 7AB4H takes back and which the four tests below walk backwards through.
7A92
LD HL,7AB4H 21 B4 7A
Load Register Pair HL with 7AB4H, the address that undoes the two pushes above and writes the token out as it is.
7A95
PUSH HL E5
Push Register Pair HL, that address, so that every return below goes to it.
7A96
RET NZ C0
Return on NZ, the token not being the apostrophe, which goes to 7AB4H and writes it out as an ordinary character of the remark.
7A97
DEC BC 0B
Decrement Register Pair BC to the last character written.
7A98
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, that character.
7A99
CP 4DH FE 4D
Compare Register A with 4DH, the letter M, the last letter of the REM this apostrophe must have been written after.
7A9B
RET NZ C0
Return on NZ, which goes to 7AB4H: the token is written as it is when the four characters before it are not the colon and REM the tokenizer puts there.
7A9C
DEC BC 0B
Decrement Register Pair BC to the character before it.
7A9D
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses.
7A9E
CP 45H FE 45
Compare Register A with 45H, the letter E, the middle letter of that REM.
7AA0
RET NZ C0
Return on NZ, which goes to the 7AB4H pushed at 7A95H and writes the token as it is.
7AA1
DEC BC 0B
Decrement Register Pair BC to the character before that.
7AA2
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses.
7AA3
CP 52H FE 52
Compare Register A with 52H, the letter R, the first letter of that REM.
7AA5
RET NZ C0
Return on NZ, which goes to the 7AB4H pushed at 7A95H, the four characters not matching.
7AA6
DEC BC 0B
Decrement Register Pair BC to the character before the R.
7AA7
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses.
7AA8
CP 3AH FE 3A
Compare Register A with 3AH, the colon the tokenizer writes in front of the REM.
7AAA
RET NZ C0
Return on NZ, which goes to the 7AB4H pushed at 7A95H, no colon standing in front of the REM.
7AAB
POP AF F1
Pop Register Pair AF, which throws away the 7AB4H pushed at 7A95H, the four characters having matched.
7AAC
POP AF F1
Pop Register Pair AF, which throws away the place in the buffer pushed at 7A91H, so that Register Pair BC stays where the four decrements left it, on the colon.
7AAD
POP HL E1
Pop Register Pair HL, the text pointer pushed at 7A90H.
7AAE
INC D 14
Increment Register D, one of the four bytes of room given back.
7AAF
INC D 14
Increment Register D, the second of the four bytes of room being given back.
7AB0
INC D 14
Increment Register D, the third of the four bytes of room being given back.
7AB1
INC D 14
Increment Register D, the fourth, so that the colon, the R, the E and the M are all unwritten and the apostrophe is about to stand where the colon stood.
7AB2
Jump to 7AD9H, the keyword expansion, which looks the token 0DCH up in the reserved word table and writes the one character it is stored as.
7AB4
POP BC C1
The token written as it is (7AB4H), which every return of the tests above goes to: pop Register Pair BC, the place in the buffer pushed at 7A91H.
7AB5
POP HL E1
Pop Register Pair HL, the text pointer pushed at 7A90H.
7AB6
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the token, which 7A98H and its fellows destroyed.
7AB7
The byte put down untouched (7AB7H), which 7A87H and 7ACCH reach: jump to 7A1FH, the step, the byte having already been stored by 7A25H.
7ABA
LD A,(7143H) 3A 43 71
The DATA bit set (7ABAH), which 7AD1H calls: load Register A with the byte at 7143H, the three state bits.
7ABD
OR 02H F6 02
Or Register A with 02H, which sets bit 1, the DATA bit.
7ABF
LD (7143H),A 32 43 71
The bits stored (7ABFH), which 7AC9H reaches: store Register A into 7143H, the state bits.
7AC2
XOR A AF
Clear Register A to 00H, which also sets the Zero Flag that 7AD4H and 7AD6H read, so that a DATA is not tested for a REM as well.
7AC3
RET C9
Return to the test that called this, with the Zero Flag set.
7AC4
LD A,(7143H) 3A 43 71
The REM bit set (7AC4H), which 7AD6H calls: load Register A with the byte at 7143H, the three state bits.
7AC7
OR 04H F6 04
Or Register A with 04H, which sets bit 2, the REM bit.
7AC9
Jump to 7ABFH, which stores them and returns with the Zero Flag set.
7ACB
RLA 17
Outside a REM (7ACBH), which 7A8BH reaches with the DATA bit in the Carry Flag: rotate Register A left through the Carry Flag, which is only there to put the Carry Flag back where the two rotates at 7A89H and 7A8AH found it.
7ACC
Jump to 7AB7H on C, bit 1 being set and the scan standing inside a DATA, where a token is one of the item's own bytes and is written out as it is.
7ACE
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the token, the scan standing outside all three.
7ACF
CP 84H FE 84
Compare Register A with 84H, the token of DATA, after which nothing in the statement is expanded.
7AD1
Call 7ABAH on Z, which sets bit 1 and comes back with the Zero Flag set so that the test below cannot fire as well.
7AD4
CP 8FH FE 8F
Compare Register A with 8FH, the token of REM, after which nothing in the line is expanded.
7AD6
Call 7AC4H on Z, which sets bit 2 and comes back with the Zero Flag set.
7AD9
LD A,(HL) 7E
A keyword expanded (7AD9H), which 7AB2H reaches: load Register A with the byte Register Pair HL addresses, the token.
7ADA
INC A 3C
Increment Register A, which sets the Zero Flag only for a token of 0FFH, the prefix of the two byte tokens.
7ADB
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses again, the token itself, which the increment above destroyed: a load changes no flag, so the test is still the one the jump below reads.
7ADC
Jump to 7AE2H on NZ, the token being a one byte one.
7ADE
INC HL 23
Increment Register Pair HL to the second byte of a two byte token.
7ADF
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, that second byte.
7AE0
AND 7FH E6 7F
And Register A with 7FH, which takes the high bit off it, the second byte of a two byte token carrying the token that is looked up.
7AE2
INC HL 23
The token in hand (7AE2H), which 7ADCH reaches: increment Register Pair HL past the token, on to the byte the line goes on with.
7AE3
CP 0A2H FE A2
Compare Register A with 0A2H, the token of ELSE, which the tokenizer always writes a colon in front of.
7AE5
Jump to 7AE9H on NZ, the token not being that ELSE.
7AE7
DEC BC 0B
Decrement Register Pair BC back over the colon already written, so that the line reads ELSE and not :ELSE as it is stored.
7AE8
INC D 14
Increment Register D, the byte of room that colon took being given back.
7AE9
CP 0B4H FE B4
WHILE tested for (7AE9H), which 7AE5H reaches: compare Register A with 0B4H, the token of WHILE, which is stored as two bytes.
7AEB
Jump to 7AF6H on NZ, the token not being that WHILE.
7AED
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the byte after the WHILE token.
7AEE
INC HL 23
Increment Register Pair HL past that byte, which the test below may send it back over.
7AEF
CP 0F3H FE F3
Compare Register A with 0F3H, the token of the plus sign, which is the second byte the tokenizer writes for WHILE at 5C2EH.
7AF1
LD A,0B4H 3E B4
Load Register A with 0B4H, the WHILE token again, which is what is looked up whichever way the test goes.
7AF3
Jump to 7AF6H on Z, the second byte having been that plus token, which is swallowed with the increment above and never written.
7AF5
DEC HL 2B
Decrement Register Pair HL back on to the byte that was not a plus token, which the line goes on with.
7AF6
PUSH HL E5
The reserved word table walked (7AF6H), which 7AEBH, 7AF3H and 7AE9H all reach: push Register Pair HL, the text pointer, which 7B5EH takes back and which 46D8H takes off for a buffer that has filled.
7AF7
PUSH BC C5
Push Register Pair BC, the place in the buffer, which 7B18H takes back.
7AF8
PUSH DE D5
Push Register Pair DE, the room in Register D, which 7B17H takes back.
7AF9
LD HL,68F6H 21 F6 68
Load Register Pair HL with 68F6H, the byte below the reserved word table at 68F7H, so that the increment at 7B00H lands on its first character.
7AFC
LD B,A 47
Load Register B from Register A, the token that is being looked for, which every word of the table is compared against.
7AFD
LD C,40H 0E 40
Load Register C with 40H, one below the letter A, which the increment below makes 41H for the table's first group.
7AFF
INC C 0C
The next letter (7AFFH), which 7B05H reaches: increment Register C, the first letter of the group the walk is now in, a 00H byte having ended the one before it.
7B00
INC HL 23
The next word (7B00H), which 7B0DH reaches: increment Register Pair HL to the first character of the next word of the table.
7B01
LD D,H 54
Load Register D from Register H, the high byte of that address.
7B02
LD E,L 5D
Load Register E from Register L, its low byte, so that Register Pair DE keeps the start of this word while Register Pair HL walks it.
7B03
LD A,(HL) 7E
The word walked (7B03H), which 7B08H goes back to: load Register A with the byte Register Pair HL addresses, one character of the word.
7B04
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that ends a group.
7B05
Jump to 7AFFH on Z, the group having ended, which takes the next letter of the alphabet.
7B07
INC HL 23
Increment Register Pair HL to the next byte of the word.
7B08
Jump to 7B03H on P, the character's high bit being clear and the word not having ended, which takes its next character.
7B0B
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, the token that stands after the word's last character.
7B0C
CP B B8
Compare Register A with Register B, the token that is being looked for.
7B0D
Jump to 7B00H on NZ, this word not being the one, which takes the next: the whole table is walked from its first byte, which is how a token is turned into a word without any index from one to the other.
7B0F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the start of the word's characters into Register Pair HL, the word having been found.
7B10
CP 0D3H FE D3
Compare Register A with 0D3H, the token of USR, whose own argument runs straight on after it.
7B12
Jump to 7B16H on Z, the token being that USR.
7B14
CP 0D4H FE D4
Compare Register A with 0D4H, the token of FN, whose name runs straight on after it as well.
7B16
LD A,C 79
The first letter taken (7B16H), which 7B12H reaches: load Register A from Register C, the letter of the group this word was found in, which is the word's own first letter and is not stored with it.
7B17
POP DE D1
Pop Register Pair DE, the room in Register D, pushed at 7AF8H.
7B18
POP BC C1
Pop Register Pair BC, the place in the buffer, pushed at 7AF7H.
7B19
LD E,A 5F
Load Register E from Register A, that first letter, where the loop below keeps the raw byte of each character.
7B1A
Jump to 7B27H on NZ, the token being neither USR nor FN.
7B1C
LD A,(72C5H) 3A C5 72
Load Register A with the byte at 72C5H, which says what was written last, the token being USR or FN.
7B1F
OR A B7
Or Register A with itself, which sets the Zero Flag when no blank is wanted in front of the word.
7B20
LD A,00H 3E 00
Load Register A with 00H, the value that says nothing a blank could be wanted after has been written: a name follows USR or FN with nothing between, so the word is treated as though it were not a keyword at all.
7B22
LD (72C5H),A 32 C5 72
Store Register A into 72C5H, that 00H, so that the name after USR or FN gets no blank.
7B25
Jump to 7B3AH, which writes a blank in front of the word when one was wanted and then writes the word.
7B27
CP 5BH FE 5B
The operator characters (7B27H), which 7B1AH reaches: compare Register A with 5BH, which is the value Register C reaches after the twenty-six letters of the reserved word table, the walk having run on into the operator table at 6B32H.
7B29
Jump to 7B31H on NZ, the word being an ordinary keyword of the letter groups.
7B2B
XOR A AF
Clear Register A to 00H, the value that says nothing a blank could be wanted after has been written: an operator character wants no blank on either side of it.
7B2C
LD (72C5H),A 32 C5 72
Store Register A into 72C5H, that 00H, so that neither side of the operator gets a blank.
7B2F
Jump to 7B47H, which writes the operator's own character out of the table and not the group's letter, the operator table holding the whole of each word.
7B31
LD A,(72C5H) 3A C5 72
An ordinary keyword (7B31H), which 7B29H reaches: load Register A with the byte at 72C5H, which says what was written last.
7B34
OR A B7
Or Register A with itself, which sets the Zero Flag when no blank is wanted in front of the word.
7B35
LD A,0FFH 3E FF
Load Register A with 0FFH, the value that says a keyword was written last, so that a name or a number after it has a blank put in front of it.
7B37
LD (72C5H),A 32 C5 72
Store Register A into 72C5H, that 0FFH, which asks for a blank before whatever name follows.
7B3A
The blank before a keyword (7B3AH), which 7B25H reaches: jump to 7B44H on Z, no blank being wanted.
7B3C
LD A,20H 3E 20
Load Register A with 20H, a blank, the last thing written having been part of a name or a number.
7B3E
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, the blank's place in the buffer.
7B3F
INC BC 03
Increment Register Pair BC past that blank, on to the place the keyword goes.
7B40
DEC D 15
Decrement Register D, the blank having taken one byte of the buffer's room.
7B41
Jump to 46D8H on Z, the buffer having filled: those two bytes are a POP AF and a RET, which throws away the text pointer 7AF6H pushed and returns to UNTOKE's own caller.
7B44
LD A,E 7B
The first letter written (7B44H), which 7B3AH reaches: load Register A from Register E, the group's letter, which is the word's first character.
7B45
Jump to 7B4AH, which writes that letter into the buffer like any other character.
7B47
LD A,(HL) 7E
The stored characters (7B47H), which 7B2FH and 7B53H reach: load Register A with the byte Register Pair HL addresses, one character of the word as the table holds it.
7B48
INC HL 23
Increment Register Pair HL to the next character of it.
7B49
LD E,A 5F
Load Register E from Register A, that raw byte, whose high bit the test below reads.
7B4A
AND 7FH E6 7F
A character written (7B4AH), which 7B45H reaches: and Register A with 7FH, which takes off the high bit the table sets on a word's last character.
7B4C
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, the character's place in the buffer.
7B4D
INC BC 03
Increment Register Pair BC past that character, on to the next place in the buffer.
7B4E
DEC D 15
Decrement Register D, the character having taken one byte of the buffer's room.
7B4F
Jump to 46D8H on Z, the buffer having filled, which throws away the pushed text pointer and returns.
7B52
OR E B3
Or Register A with Register E, the raw byte, which sets the Sign Flag when that byte had its high bit set and so was the word's last character.
7B53
Jump to 7B47H on P, the word not having ended, which takes its next character.
7B56
CP 0A8H FE A8
Compare Register A with 0A8H, which is an open parenthesis with the high bit set and so the last character of a keyword such as TAB(.
7B58
Jump to 7B5EH on NZ, the keyword not ending in a parenthesis.
7B5A
XOR A AF
Clear Register A to 00H, the value that says nothing a blank could be wanted after has been written, the keyword having ended in a parenthesis which its argument follows at once.
7B5B
LD (72C5H),A 32 C5 72
Store Register A into 72C5H, that 00H, so that the argument gets no blank after the parenthesis.
7B5E
POP HL E1
The keyword done (7B5EH), which 7B58H reaches: pop Register Pair HL, the text pointer pushed at 7AF6H, which 7AE2H left on the byte the line goes on with.
7B5F
Jump to 7A23H, which weighs that byte, the keyword having been written in full.
7B62
A letter or a digit (7B62H), which 7A59H calls and the tokenizer calls at 5BC9H: call 4474H, which loads Register A with nothing of its own and compares the character against 41H and 5BH, returning with the Carry Flag set when it is not one of the letters A to Z.
7B65
RET NC D0
Return on NC, the character being a letter, with the Carry Flag clear.
7B66
CP 30H FE 30
Compare Register A with 30H, the digit zero, the character not having been a letter.
7B68
RET C D8
Return on C, the character standing below it, with the Carry Flag set.
7B69
CP 3AH FE 3A
Compare Register A with 3AH, the character above the digit nine.
7B6B
CCF 3F
Complement the Carry Flag, which turns the clear flag of a digit into a set one and the set flag of anything above nine into a clear one, so that the two have to be read the other way round.
7B6C
RET C9
Return with the Carry Flag clear for a digit and set for every character from 3AH up that is not a letter: this is the test that tells a name or a number from a punctuation mark.
7B6D
DEC HL 2B
The number put back as digits (7B6DH), which 7A7CH reaches: decrement Register Pair HL so that the call below reads the number token the pointer already stands on.
7B6E
Call NXTCHAR at 5E93H, which unpacks the number the token stands for into 7149H, puts its token into 7147H, its width into 7148H and the place to carry on from into IPOS 7145H, and brings the token back in Register A.
7B71
PUSH DE D5
Push Register Pair DE, the room in Register D, which 7B8DH takes back.
7B72
PUSH BC C5
Push Register Pair BC, the place in the buffer, which 7B8CH takes back.
7B73
PUSH AF F5
Push Register Pair AF, that token, which 7B77H takes back.
7B74
Call 5F12H, which loads the accumulator at 72ECH with the number out of 7149H and sets 7142H to its type, which is what the formatter below works from.
7B77
POP AF F1
Pop Register Pair AF, the token, pushed at 7B73H.
7B78
LD BC,7B8CH 01 8C 7B
Load Register Pair BC with 7B8CH, the address the formatter is to return to.
7B7B
PUSH BC C5
Push Register Pair BC, that address, every one of the three doors below being reached with a jump.
7B7C
CP 0BH FE 0B
Compare Register A with 0BH, the token of an octal constant.
7B7E
Jump to OCT$ at 368BH on Z, which writes the digits of an octal number into the buffer at 72FEH.
7B81
CP 0CH FE 0C
Compare Register A with 0CH, the token of a hexadecimal constant.
7B83
Jump to HEX$ at 368EH on Z, which writes the digits of a hexadecimal number into that same buffer.
7B86
LD HL,(7149H) 2A 49 71
Load Register Pair HL with the word at 7149H, the value of the constant, which the integer door of the formatter takes in Register Pair HL.
7B89
Jump to 3147H, the formatter with no mask, which writes the digits of the number into the buffer at 72FEH and returns to the 7B8CH pushed above.
7B8C
POP BC C1
The digits taken out of the buffer (7B8CH), which all three doors return to: pop Register Pair BC, the place in INBUF, pushed at 7B72H.
7B8D
POP DE D1
Pop Register Pair DE, the room in Register D, pushed at 7B71H.
7B8E
LD A,(7147H) 3A 47 71
Load Register A with the byte at 7147H, the token of the constant.
7B91
LD E,4FH 1E 4F
Load Register E with 4FH, the letter O, which stands after the ampersand of an octal constant.
7B93
CP 0BH FE 0B
Compare Register A with 0BH, the token of an octal constant.
7B95
Jump to 7B9DH on Z, the constant being octal, which writes the ampersand and that letter.
7B97
CP 0CH FE 0C
Compare Register A with 0CH, the token of a hexadecimal constant.
7B99
LD E,48H 1E 48
Load Register E with 48H, the letter H, which stands after the ampersand of a hexadecimal one.
7B9B
Jump to 7BA8H on NZ, the constant being an ordinary decimal number with no prefix of its own.
7B9D
LD A,26H 3E 26
The ampersand prefix (7B9DH), which 7B95H reaches: load Register A with 26H, an ampersand, which begins both of the two radix forms.
7B9F
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, its place in the buffer.
7BA0
INC BC 03
Increment Register Pair BC past that ampersand, on to the place the letter goes.
7BA1
DEC D 15
Decrement Register D, the ampersand having taken one byte of the buffer's room.
7BA2
RET Z C8
Return on Z, the buffer being full, which cuts the line off there.
7BA3
LD A,E 7B
Load Register A from Register E, the letter O or the letter H.
7BA4
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, its place in the buffer.
7BA5
INC BC 03
Increment Register Pair BC past that letter, on to the place the digits go.
7BA6
DEC D 15
Decrement Register D, the letter having taken one byte of the buffer's room.
7BA7
RET Z C8
Return on Z, the buffer having filled, which cuts the line off after the prefix.
7BA8
LD A,(7148H) 3A 48 71
The type suffix chosen (7BA8H), which 7B9BH reaches: load Register A with the byte at 7148H, the width of the constant in bytes.
7BAB
CP 04H FE 04
Compare Register A with 04H, the width of a single precision number.
7BAD
LD E,00H 1E 00
Load Register E with 00H, the suffix for an integer, which is no suffix at all.
7BAF
Jump to 7BB7H on C, the width standing below four and the constant being an integer or a line reference.
7BB1
LD E,21H 1E 21
Load Register E with 21H, an exclamation mark, the suffix of a single precision constant.
7BB3
Jump to 7BB7H on Z, the width being exactly four.
7BB5
LD E,23H 1E 23
Load Register E with 23H, a number sign, the suffix of a double precision constant, the width being eight.
7BB7
LD A,(HL) 7E
The digits copied (7BB7H), which 7BAFH and 7BB3H reach: load Register A with the byte Register Pair HL addresses, the first character the formatter wrote.
7BB8
CP 20H FE 20
Compare Register A with 20H, a blank, which the formatter writes in front of a number that is not negative.
7BBA
Call 293CH on Z, two bytes of BASIC/OV1 that increment Register Pair HL and return, which steps over that blank: a number in a program line carries no leading blank.
7BBD
LD A,(HL) 7E
The next digit (7BBDH), which 7BCBH, 7BDCH and 7BE0H all reach: load Register A with the byte Register Pair HL addresses, one character of the number.
7BBE
INC HL 23
Increment Register Pair HL to the next character the formatter wrote.
7BBF
OR A B7
Or Register A with itself, which sets the Zero Flag for the 00H that ends what the formatter wrote.
7BC0
Jump to 7BE2H on Z, every digit having been copied, where the suffix is written.
7BC2
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, the digit's place in the buffer.
7BC3
INC BC 03
Increment Register Pair BC past that digit, on to the next place in the buffer.
7BC4
DEC D 15
Decrement Register D, the digit having taken one byte of the buffer's room.
7BC5
RET Z C8
Return on Z, the buffer having filled in the middle of the number's digits.
7BC6
LD A,(7148H) 3A 48 71
Load Register A with the byte at 7148H, the width of the constant again.
7BC9
CP 04H FE 04
Compare Register A with 04H, the width of a single precision number.
7BCB
Jump to 7BBDH on C, the constant being an integer, which needs no suffix and so no test of the digits.
7BCD
DEC BC 0B
Decrement Register Pair BC to the digit just written.
7BCE
LD A,(BC) 0A
Load Register A with the byte Register Pair BC addresses, that digit.
7BCF
INC BC 03
Increment Register Pair BC back to where it stood.
7BD0
Jump to 7BD6H on NZ, which is the Zero Flag of the comparison at 7BC9H and not of anything since, the two instructions above changing no flag: a double precision constant skips the full stop test below, where a single precision one makes it.
7BD2
CP 2EH FE 2E
Compare Register A with 2EH, a full stop, which in a single precision constant says the type without a suffix.
7BD4
Jump to 7BDEH on Z, the digits holding a full stop, which says the type by itself.
7BD6
CP 44H FE 44
Compare Register A with 44H, the letter D, which the formatter writes before the exponent of a double precision number.
7BD8
Jump to 7BDEH on Z, the digits holding that letter, which says the type by itself.
7BDA
CP 45H FE 45
Compare Register A with 45H, the letter E, which it writes before the exponent of a single precision one.
7BDC
Jump to 7BBDH on NZ, the digit being none of the three that say the type, which takes the next one.
7BDE
LD E,00H 1E 00
The suffix dropped (7BDEH), which 7BD4H and 7BD8H reach: load Register E with 00H, no suffix, the digits themselves having said what kind of number this is.
7BE0
Jump to 7BBDH, which copies the rest of the digits with the suffix now cleared.
7BE2
LD A,E 7B
The suffix written (7BE2H), which 7BC0H reaches: load Register A from Register E, the suffix or 00H.
7BE3
OR A B7
Or Register A with itself, which sets the Zero Flag when there is no suffix to write.
7BE4
Jump to 7BEAH on Z, no suffix being wanted, the digits having said the type themselves.
7BE6
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, the suffix's place in the buffer.
7BE7
INC BC 03
Increment Register Pair BC past that suffix, on to the next place in the buffer.
7BE8
DEC D 15
Decrement Register D, the suffix having taken one byte of the buffer's room.
7BE9
RET Z C8
Return on Z, the buffer having filled with the suffix, which cuts the line off there.
7BEA
LD HL,(7145H) 2A 45 71
The line taken up again (7BEAH), which 7BE4H reaches: load Register Pair HL with the word at IPOS 7145H, the place in the tokenized line that stands after the packed number.
7BED
Jump to 7A23H, which weighs the byte there, the number having been written in full.

7BF0H - DELETE and the Block Mover (7BF0H-7C2DH)

DELETE reads a line number range with 5A96H, the parser CHAIN's own DELETE parameter uses, and both ends of the range must exist: the first through FIND's fall through inside 5A96H and the second through the FIND at 7BFBH, and a range whose second line is not in the program gives Illegal function call rather than deleting as much of it as is there. 66B6H is called first for the same reason CHAIN calls it, so that the program's line references are in their stored form before any address is measured. Then the statement prints Ready from the text at 732DH, pushes 5A32H as its return and falls into the block mover at 7C15H, which is the routine CHAIN's ALL path also uses at 5672H: it copies the bytes from the address Register Pair DE names down to the address Register Pair BC names until Register Pair HL reaches the end, and then sets all three of VARTAB 719FH, the array table at 71A1H and the lowest free address at 71A3H to where the copy ended. So deleting lines throws every variable away, which is why DELETE prints Ready and goes to command level rather than returning to the statement loop.

7BF0
DELETE (7BF0H), the routine the statement address table holds for token 0AAH at 6815H: call 5A96H, the line number range parser, which reads line1 into Register Pair DE, insists on the minus token between the two, defaults line2 to 0FFFAH, leaves line2 on the stack and falls into FIND at 5AB4H, which returns the address of line1 in Register Pair BC.
7BF3
PUSH BC C5
Push Register Pair BC, the address of the first line of the range, which the POP BC at 7BF7H brings back.
7BF4
Call 66B6H, which returns at once when the pending line number flag at 7186H is 00H and otherwise goes on to 661EH, so that every resolved line reference in the program is turned back into a number before an address is measured.
7BF7
POP BC C1
Pop Register Pair BC, the address of the first line, pushed at 7BF3H.
7BF8
POP DE D1
Pop Register Pair DE, the second line number of the range, which 5A96H left on the stack at 5AB2H and 5AB3H.
7BF9
PUSH BC C5
Push Register Pair BC, the address of the first line, which the EX (SP),HL at 7C02H brings into Register Pair HL.
7BFA
PUSH BC C5
Push Register Pair BC a second time, so that the POP BC at 7C10H has the address of the first line to give the mover below.
7BFB
Call FIND at 5AB4H, which walks the program for the line number in Register Pair DE and returns the address of the line that follows it in Register Pair HL, with the Carry Flag set when a line of that number or beyond was reached.
7BFE
Jump to 7C07H on NC, no line of the program reaching the second number of the range, where the JP NC gives Illegal function call: the whole range must be there, and a DELETE whose last line does not exist deletes nothing.
7C00
LD D,H 54
Load Register D from Register H, the high byte of the address just past the last line of the range.
7C01
LD E,L 5D
Load Register E from Register L, its low byte, so that Register Pair DE holds where the block to be deleted ends.
7C02
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the address of the first line into Register Pair HL and puts the end address on the stack.
7C03
PUSH HL E5
Push Register Pair HL, the address of the first line, so that the comparison below leaves the stack as the mover wants it.
7C04
Call 434DH, which subtracts Register Pair DE from Register Pair HL to compare them, setting the Carry Flag when the first line of the block stands below the byte it ends at.
7C07
Jump to FUNCERR 5F95H on NC, which prints Illegal function call: the range is empty or runs backwards, and this is also where 7BFEH sends a range whose second line was never reached.
7C0A
LD HL,732DH 21 2D 73
Load Register Pair HL with 732DH, the Ready text, which is five characters and a carriage return ended by a 00H byte.
7C0D
Call 46A5H, which builds a descriptor for that 00H ended text and writes it a character at a time, so DELETE says Ready before it does the work.
7C10
POP BC C1
Pop Register Pair BC, the address of the first line of the block, pushed at 7BFAH, which is where the bytes above the block are to be moved down to.
7C11
LD HL,5A32H 21 32 5A
Load Register Pair HL with 5A32H, part of command level's own reset, which the exchange below makes the mover's return address.
7C14
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which leaves 5A32H on the stack and brings the address the block ends at into Register Pair HL, where the mover's own first instruction wants it.
7C15
EX DE,HL EB
The block mover (7C15H), which CHAIN's DELETE path calls at 5672H and the line entry at 59EDH: exchange Register Pair DE with Register Pair HL, which puts the address the bytes are to be taken from into Register Pair DE.
7C16
LD HL,(719FH) 2A 9F 71
Load Register Pair HL from the word at 719FH, VARTAB, the first byte above the program text, which is where the bytes being moved run out.
7C19
LD A,(DE) 1A
The copy loop (7C19H): load Register A with the byte Register Pair DE addresses, one byte of what stands above the block.
7C1A
LD (BC),A 02
Store Register A into the byte Register Pair BC addresses, which is that byte's new place, lower in memory by the length of the block.
7C1B
INC BC 03
Increment Register Pair BC onto the next byte of the destination.
7C1C
INC DE 13
Increment Register Pair DE onto the next byte of the source.
7C1D
Call 434DH, which compares Register Pair HL, the end of the program text, with Register Pair DE, the source pointer, setting the Zero Flag when the two have met.
7C20
Jump back to 7C19H on NZ, which copies the whole of what stood above the block down over it.
7C22
LD H,B 60
Load Register H from Register B, the high byte of the destination pointer, which now stands just past the last byte moved.
7C23
LD L,C 69
Load Register L from Register C, its low byte, so that Register Pair HL holds the new end of the program text.
7C24
LD (719FH),HL 22 9F 71
Store Register Pair HL into the word at 719FH, VARTAB, the start of the simple variables, which has moved down with the text.
7C27
LD (71A1H),HL 22 A1 71
Store Register Pair HL into the word at 71A1H, the start of the array table, which being set to VARTAB says that there are no simple variables.
7C2A
LD (71A3H),HL 22 A3 71
Store Register Pair HL into the word at 71A3H, the end of the arrays and the lowest free address, which says that there are no arrays either: a DELETE throws every variable away, which is why it goes to command level and not back to the statement loop.
7C2D
RET C9
Return to the address the caller left on the stack, which for DELETE is 5A32H and for CHAIN's ALL path is 5675H.

7C2EH - The Filespec Buffer, the DOS Error Code and the Write Protect Record (7C2EH-7C56H)

Forty-one bytes of working storage, all 00H in the file, that the disk statements and the error handler share. 7C2EH is the folded filespec, thirty-two bytes, which 50A2H and 50BEH build the name into and hand to @FSPEC so that the system call reads its text from here and not out of the program; thirty-one characters and the 03H that ends one is exactly what fits. 7C4EH is the DOS error code, the byte DERR at 5287H, 430DH and 614EH store and ERRS$ reads at 7F55H, which is how a program sees the system's own number for a failure after the handler has turned it into a BASIC one through the table at 529EH. 7C4FH to 7C56H is one byte for each of the eight drives, indexed by the drive number masked with 07H at 502EH and 51BDH, and bit 0 of each says that the diskette in that drive is write protected: 51B6H asks @CKDRV and 51C3H or 51C9H writes the answer in, and 5037H reads it back so that a write to a protected diskette is refused at 5862H before the system is asked at all.

7C2E-7C4D
DEFB 00H x 32 00 x 32
The folded filespec (7C2EH), thirty-two bytes: 50A2H and 50BEH move the name the program gave here with its case folded and the 03H that ends a filespec after it, and then have @FSPEC parse it into the file control block, which is why the buffer is thirty-two bytes and not thirty-one.
7C4E
DEFB 00H 00
The DOS error code (7C4EH): the system's own number for the last failure, stored by DERR at 5287H and by 430DH and 614EH, read by ERRS$ at 7F55H, and turned into a BASIC error number by the 44 byte table at 529EH before the handler at 5886H prints anything.
7C4F-7C56
DEFB 00H x 8 00 x 8
The write protect record (7C4FH), one byte for each of the eight drives: 51BDH adds the drive number to this address and 51C3H sets bit 0 or 51C9H clears it from what @CKDRV answered, and 5037H reads it so that a write to a protected diskette gives error 68, Disk write protected, at 5862H without asking the system again.

7C57H - The Command Aborted Text (7C57H-7C6AH)

The text the interpreter shows for a DOS error of 255, written out in full with its number in front of it rather than taken from the error message block at 6B7CH, whose error 51 holds the same two words without the number.

7C57-7C6A
DEFM "255-Command Aborted" / DEFB 00H 32 35 35 2D 43 6F 6D 6D 61 6E 64 20 41 62 6F 72 74 65 64 00
7C57H-7C6AH: the three digits 255, the hyphen, the words Command Aborted and the 00H that ends the text. The bytes above it, 7C6BH to 7C70H, are the three empty word cells the enhancement package fills with the addresses of KFLAG$, SFLAG$ and CFLAG$, and the bytes below it, 7C40H-7C56H, hold 00H.

7C6BH - The Three Flag Address Cells and a Hundred Bytes Nothing Reaches (7C6BH-7CD4H)

Module 1 reaches the DOS's own flag bytes through pointers, and these are the pointers. All three words are 0000H in the file and the enhancement package fills them during the start-up, BEGIN writing KFLAG$ 0074H at 84D6H, SFLAG$ 007CH at 84E2H and CFLAG$ 006CH at 84C9H, and that is why the base cannot be run without the package: the BREAK check at 7CFFH, the open at 5143H and the overlay loader at 7EF5H would all be reading through a pointer of 0000H. What follows them is the largest run of unreachable bytes in the file: no instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 names any address between 7C71H and 7CD4H, no relative jump of the four images reaches one, and every word of the images that matches one of them is a pair of bytes straddling two instructions, among them the RET at 434CH and the precedence table's own entries at 6B48H. A hundred bytes of 00H that nothing in the release can read.

7C6B-7C6C
DEFW 0000H 00 00
The KFLAG$ pointer (7C6BH), which BEGIN fills at 84D6H with 0074H: the BREAK check reads it at 7CFFH and the pause loop at 7D3AH, so a BREAK pressed while a program runs is found through this word.
7C6D-7C6E
DEFW 0000H 00 00
The SFLAG$ pointer (7C6DH), which BEGIN fills at 84E2H with 007CH: the open reads it at 5143H, 5155H, 51E8H and 5202H, and the enhancement package plants the same address in its own operands at 80B9H and 81BAH rather than go through this word.
7C6F-7C70
DEFW 0000H 00 00
The CFLAG$ pointer (7C6FH), which BEGIN fills at 84C9H with 006CH: the overlay loader reads it at 7EF5H and 7F83H, which is how it finds the bit that says the memory is frozen.
7C71-7CD4
DEFB 00H x 100 00 x 100
7C71H to 7CD4H: a hundred bytes of 00H that nothing in the release reaches or reads, standing between the three flag pointers above and the BREAK check below. No instruction of any of the four images names one of these addresses, no relative jump reaches one, and the words that appear to hold one are all byte pairs straddling two instructions.

7CD5H - The BREAK Check and the Key the Editor Waits For (7CD5H-7CFDH)

7CD5H is what the statement loop calls before every statement, and OPEN calls it at 5076H and LLIST at 79CFH. It asks 7CFEH about bits 0 and 1 of KFLAG$, BREAK and pause, and when either is set it clears Register A and jumps to STOP at 437FH, so that a program is broken into through the statement loop and not through an interrupt. 7CDFH is the key read, which EDIT calls from four places and INPUT$ from 4F08H, and it waits: round the loop at 7CE2H it asks 7CFEH about the BREAK bit alone and then asks @KBD for a character, and a BREAK 80H or a 03H read as a character is thrown away and the loop gone round again, so the only way out with a key is through 7CFAH. The four NOP instructions at 7CEEH are slack in the assembly and the code runs through them.

7CD5
LD A,03H 3E 03
The BREAK check (7CD5H), which the statement loop calls at 5E3BH, OPEN at 5076H and LLIST at 79CFH: load Register A with 03H, the mask of KFLAG$ bits 0 and 1, which are BREAK and pause.
7CD7
Call 7CFEH, which ands that mask with the byte KFLAG$ points at, waits out a pause, and returns the Zero Flag set when neither bit was set.
7CDA
RET Z C8
Return on Z, nothing being pending, which is what happens before all but a handful of the statements a program ever runs.
7CDB
XOR A AF
Exclusive or Register A with itself, which makes it 00H, the value STOP wants in Register A to know it was not reached by the statement itself.
7CDC
Jump to 437FH, STOP, which saves the line number and the text pointer, writes the Break message and takes the interpreter to command level.
7CDF
PUSH HL E5
The key read (7CDFH), which EDIT calls at 3D5FH, 3DE7H, 3E31H and 3E6FH and INPUT$ at 4F08H: push Register Pair HL, the caller's own pointer, which the supervisor call below may change.
7CE0
PUSH DE D5
Push Register Pair DE, the caller's own value, for the same reason.
7CE1
PUSH BC C5
Push Register Pair BC, the caller's own value, for the same reason.
7CE2
LD A,01H 3E 01
The wait (7CE2H), which 7CECH, 7CF4H and 7CF8H all go back to: load Register A with 01H, the mask of KFLAG$ bit 0, which is BREAK.
7CE4
Call 7CFEH, which ands that mask with the byte KFLAG$ points at and returns the Zero Flag reset when a BREAK is pending.
7CE7
Jump to 7CFAH on NZ, a BREAK having been pressed, which gives the caller the BREAK as the key it asked for.
7CE9
LD A,08H 3E 08
Load Register A with 08H, the number of @KBD, the supervisor call that looks for a character without waiting for one.
7CEB
RST 28H EF
Restart at 0028H, the supervisor call entry, which answers with the character in Register A and the Zero Flag reset when the keyboard has nothing.
7CEC
Jump to 7CE2H on NZ, nothing having been typed, which asks about BREAK and the keyboard again.
7CEE
NOP 00
A NOP, the first of four bytes of slack between the keyboard loop above and the two refusals below, which the code runs straight through.
7CEF
NOP 00
A NOP, the second of the four, standing where an instruction was once assembled and is no longer.
7CF0
NOP 00
A NOP, the third of the four, after which one byte of slack is left before the two refusals below.
7CF1
NOP 00
A NOP, the fourth of the four, after which the code reaches 7CF2H with the character in Register A.
7CF2
CP 80H FE 80
Compare Register A with 80H, the code @KBD gives for the BREAK key itself, which this routine will not hand on as a character.
7CF4
Jump to 7CE2H on Z, BREAK having been typed, which goes round and leaves it to the flag test above to report.
7CF6
CP 03H FE 03
Compare Register A with 03H, which is the code the DOS gives for a BREAK that a filter has turned into a character.
7CF8
Jump to 7CE2H on Z, that code having been read, which goes round for a character the caller can use.
7CFA
POP BC C1
The character given back (7CFAH), which 7CE7H also reaches: pop Register Pair BC, which brings the caller's own value back into that pair.
7CFB
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
7CFC
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back into that pair.
7CFD
RET C9
Return with the character in Register A, which is never 80H and never 03H.

7CFEH - The KFLAG$ Test and the Pause (7CFEH-7D54H)

7CFEH is three instructions and a fall through, and the fall through is where the pause lives. Register A comes in holding a mask of KFLAG$ bits and the routine ands it with the flag byte the pointer at 7C6BH names: nothing set and it returns at once with the Zero Flag set, which is the answer almost every call gets. Anything set and it falls into 7D07H, which is the pause and the BREAK together. It first waits for the key to be let go, @KBD answering with the Zero Flag set for as long as one is held, and then splits on bit 0: a BREAK clears bits 0, 1 and 3 of KFLAG$ and returns with the Zero Flag reset so that the caller acts on it, and a pause goes to 7D23H and sits there until a key other than 60H is pressed, returning with the Zero Flag set so that the caller carries on. A BREAK pressed during the pause is found at 7D24H and sends the code back round to the BREAK path. 7D39H is the part worth reading twice: it clears the bits named by the complement of Register C, waits through @PAUSE, and goes round again if the driver has set any of them since, which is how a key held down does not run the loop off its feet. The masks 0F4H and 0F5H both clear bit 3, which the flag byte's own documented layout gives no meaning to, and neither clears bit 2, ENTER, where the DOS's own library routine clears bits 1 and 2. 7D4FH is @CKBRKC, which the line reader calls at 7E2FH and the enhancement's start-up at 84F4H to throw away a BREAK that arrived before anyone was watching.

7CFE
PUSH HL E5
The KFLAG$ test (7CFEH), which 7CD7H and 7CE4H call with a mask of bits in Register A: push Register Pair HL, the caller's own pointer, which the load below destroys.
7CFF
LD HL,(7C6BH) 2A 6B 7C
Load Register Pair HL from the word at 7C6BH, the pointer BEGIN filled with the address of KFLAG$ 0074H.
7D02
AND (HL) A6
And Register A with the byte Register Pair HL stands on, the flag byte, which leaves the bits of the mask that are set.
7D03
Jump to 7D07H on NZ, one of them being set, which is the pause and BREAK handler below.
7D05
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back into that pair with the Zero Flag standing.
7D06
RET C9
Return with the Zero Flag set, nothing being pending, which is the answer almost every call to this routine gets.
7D07
PUSH DE D5
The pause and BREAK handler (7D07H), which 7D03H falls into: push Register Pair DE, the caller's own value, because the supervisor calls below use every register.
7D08
PUSH BC C5
Push Register Pair BC, the caller's own value, for the same reason.
7D09
PUSH AF F5
The key let go (7D09H), which 7D26H goes back to: push Register Pair AF, which holds the bits of the mask that were set and is wanted again at 7D11H.
7D0A
PUSH HL E5
Push Register Pair HL, the address of the flag byte, which the supervisor call below may change.
7D0B
LD A,08H 3E 08
Load Register A with 08H, the number of @KBD, the keyboard scan that does not wait.
7D0D
RST 28H EF
Restart at 0028H, the supervisor call entry, which answers with the Zero Flag set while a key is being held.
7D0E
Jump to 7D0BH on Z, a key still being held, which asks again, so that the pause below is not ended by the keystroke that began it.
7D10
POP HL E1
Pop Register Pair HL, which brings the address of the flag byte back into that pair.
7D11
POP AF F1
Pop Register Pair AF, which brings the bits that were set back into Register A.
7D12
AND 01H E6 01
And Register A with 01H, bit 0 of KFLAG$, which is BREAK.
7D14
Jump to 7D23H on Z, the bit set having been the pause and not BREAK, which waits there for a key.
7D16
LD C,0F4H 0E F4
A BREAK (7D16H): load Register C with 0F4H, the mask that clears bits 0, 1 and 3 of the flag byte and leaves the other five as they stand.
7D18
LD B,03H 06 03
Load Register B with 03H, a value that is not 00H, which 7D1DH tests to make the Zero Flag the caller reads.
7D1A
The bits cleared (7D1AH), which 7D37H jumps to: call 7D39H, which clears those bits and waits through a pause for as long as the driver keeps setting them again.
7D1D
LD A,B 78
Load Register A from Register B, 03H for a BREAK and 00H for a pause let go.
7D1E
OR A B7
Or Register A with itself, which sets the Zero Flag only for the pause, so the caller is told to carry on after a pause and to act after a BREAK.
7D1F
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
7D20
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
7D21
POP HL E1
Pop Register Pair HL, the caller's own pointer that 7CFEH pushed, which brings the stack back to where 7CFEH's caller left it.
7D22
RET C9
Return to 7CFEH's own caller with the Zero Flag reset after a BREAK and set after a pause.
7D23
LD A,(HL) 7E
The pause (7D23H), which 7D14H, 7D2DH and 7D31H all reach: load Register A with the byte Register Pair HL stands on, the flag byte as it now stands.
7D24
AND 01H E6 01
And Register A with 01H, bit 0 of it, which is BREAK.
7D26
Jump to 7D09H on NZ, a BREAK having arrived while the pause was being held, which goes round to the split at 7D12H and takes the BREAK path.
7D28
PUSH HL E5
Push Register Pair HL, the address of the flag byte, which the supervisor call below may change.
7D29
LD A,08H 3E 08
Load Register A with 08H, the number of @KBD, the keyboard scan that does not wait.
7D2B
RST 28H EF
Restart at 0028H, the supervisor call entry, which answers with the character in Register A and the Zero Flag reset when nothing was typed.
7D2C
POP HL E1
Pop Register Pair HL, which brings the address of the flag byte back into that pair.
7D2D
Jump to 7D23H on NZ, nothing having been typed, which goes round and holds the pause.
7D2F
CP 60H FE 60
Compare Register A with 60H, the one character that does not end a pause.
7D31
Jump to 7D23H on Z, that character having been typed, which goes round and holds the pause.
7D33
LD C,0F5H 0E F5
Load Register C with 0F5H, the mask that clears bits 1 and 3 of the flag byte and leaves bit 0, the BREAK, exactly as it stands.
7D35
LD B,00H 06 00
Load Register B with 00H, which 7D1DH tests to set the Zero Flag the caller reads as meaning that it may carry on.
7D37
Jump to 7D1AH, which clears those bits and waits for the key that ended the pause to be let go.
7D39
LD A,C 79
The bits cleared and the wait (7D39H), which 7D1AH and 7D4CH call: load Register A from Register C, the mask of bits that are to be left standing.
7D3A
LD HL,(7C6BH) 2A 6B 7C
Load Register Pair HL from the word at 7C6BH, the pointer BEGIN filled with the address of KFLAG$ 0074H.
7D3D
DI F3
Disable interrupts, so that the read, the and and the write below cannot be split by the keyboard task setting a bit between them.
7D3E
AND (HL) A6
And Register A with the byte Register Pair HL stands on, the flag byte, which leaves only the bits the mask keeps.
7D3F
LD (HL),A 77
Store Register A into the byte Register Pair HL stands on, which is the whole of the clearing.
7D40
EI FB
Enable interrupts again, the keyboard task being free to set the bits from here on.
7D41
PUSH BC C5
Push Register Pair BC, the mask and the answer flag, because the supervisor call below writes Register Pair BC.
7D42
LD BC,0548H 01 48 05
Load Register Pair BC with 0548H, the count @PAUSE counts down, which is about a tenth of a second on a Model 4.
7D45
LD A,10H 3E 10
Load Register A with 10H, the number of @PAUSE, the supervisor call that waits a counted time.
7D47
RST 28H EF
Restart at 0028H, the supervisor call entry, which waits that long with interrupts on so that the keyboard task runs.
7D48
POP BC C1
Pop Register Pair BC, which brings the mask and the answer flag back into that pair.
7D49
LD A,C 79
Load Register A from Register C, the mask of bits to be left standing.
7D4A
CPL 2F
Complement Register A, which turns it into the mask of the bits that were just cleared.
7D4B
AND (HL) A6
And Register A with the byte Register Pair HL stands on, the flag byte, which is not 00H when the keyboard task has set one of them again.
7D4C
Jump to 7D39H on NZ, a key still being held, which clears the bits and waits again.
7D4E
RET C9
Return with every bit the mask named clear and the key let go.
7D4F
PUSH AF F5
A pending BREAK thrown away (7D4FH), which the line reader calls at 7E2FH and the enhancement's start-up at 84F4H: push Register Pair AF, the caller's own value, which the supervisor call below writes.
7D50
LD A,6AH 3E 6A
Load Register A with 6AH, the number of @CKBRKC, the supervisor call that clears a BREAK the DOS has recorded.
7D52
RST 28H EF
Restart at 0028H, the supervisor call entry, which clears it.
7D53
POP AF F1
Pop Register Pair AF, which brings the caller's own value back into Register A and its flags.
7D54
RET C9
Return with no BREAK pending and nothing of the caller's changed.

7D55H - INKEY$ and the Display Output (7D55H-7D94H)

Eight bytes of slack and then two routines. INKEY$ 7D5DH is reached only from 754BH, the function dispatch, and it is the plainest function in the file: @KBD without waiting, and either a one character string built by 4641H or the empty string. The empty string is made by pointing the accumulator at 7D7EH, a single 00H byte that stands as a string descriptor whose length is nought, and the two bytes above it that would be its text address are the first two instructions of the routine below, which nothing reads because a length of nought is never followed. ERRS$ reaches the same three instructions from 7F59H. 7D7FH is the display output, which 418AH calls for every character that goes to the screen: @DSP writes it and then @VDCTL with Register B at 04H asks the video driver where the cursor now stands, which is what makes the display's column at 713CH free where the printer's at 6E91H has to be counted by hand.

7D55-7D5C
DEFB 00H x 8 00 x 8
7D55H to 7D5CH: eight bytes of 00H between the RET at 7D54H and INKEY$ below. No instruction of the four images names one of these addresses, no relative jump reaches one and no word of the images holds one, so they are slack in the assembly.
7D5D
INKEY$ (7D5DH), which the function dispatch jumps to from 754BH: call 5E93H, NXTCHAR, which steps the text pointer past the token so that the evaluator reads the character after the function.
7D60
PUSH HL E5
Push Register Pair HL, the text pointer, which the supervisor call below may change and which the caller must have back.
7D61
LD A,08H 3E 08
Load Register A with 08H, the number of @KBD, the keyboard scan that does not wait.
7D63
RST 28H EF
Restart at 0028H, the supervisor call entry, which answers with the character in Register A and the Zero Flag reset when nothing has been typed.
7D64
Jump to 7D71H on NZ, nothing having been typed, which answers with the empty string.
7D66
PUSH AF F5
Push Register Pair AF, the character read, because the allocation below writes Register A.
7D67
LD A,01H 3E 01
Load Register A with 01H, the length of the string that is about to be made.
7D69
Call 4641H, which takes one byte of string space and leaves a descriptor for it with its text address in Register Pair DE.
7D6C
POP AF F1
Pop Register Pair AF, which brings the character back into Register A.
7D6D
LD (DE),A 12
Store Register A into the byte Register Pair DE stands on, the one character of the new string.
7D6E
Jump to 467FH, which pops the text pointer this routine pushed, puts the descriptor's address in the accumulator and returns to the evaluator.
7D71
LD HL,7D7EH 21 7E 7D
The empty string (7D71H), which 7D64H reaches and ERRS$ jumps to from 7F59H: load Register Pair HL with 7D7EH, the single 00H byte below that stands as a descriptor of length nought.
7D74
LD (72ECH),HL 22 EC 72
Store Register Pair HL into the word at 72ECH, the accumulator, which for a string holds the address of its descriptor.
7D77
LD A,03H 3E 03
Load Register A with 03H, the interpreter's own code for the string type.
7D79
LD (7142H),A 32 42 71
Store Register A into the byte at 7142H, the type of the value in the accumulator.
7D7C
POP HL E1
Pop Register Pair HL, the text pointer this routine pushed at 7D60H.
7D7D
RET C9
Return to the evaluator with the empty string in the accumulator and the text pointer standing after the function.
7D7E
DEFB 00H 00
The empty string's descriptor (7D7EH), which 7D71H hands out: one byte of 00H, the length, and nothing more, the two bytes above it that a descriptor's text address would stand in being the PUSH HL and PUSH DE of the routine below, which a length of nought means nothing ever reads.
7D7F
PUSH HL E5
The display output (7D7FH), which 418AH calls: push Register Pair HL, the caller's own pointer, which the supervisor calls below change.
7D80
PUSH DE D5
Push Register Pair DE, the caller's own value, for the same reason.
7D81
PUSH BC C5
Push Register Pair BC, the caller's own value, for the same reason.
7D82
PUSH AF F5
Push Register Pair AF, the character to be written, which this routine gives back exactly as it came in.
7D83
LD C,A 4F
Load Register C from Register A, the character, which @DSP takes in that register.
7D84
LD A,02H 3E 02
Load Register A with 02H, the number of @DSP, the supervisor call that writes a character to the display.
7D86
RST 28H EF
Restart at 0028H, the supervisor call entry, which writes it through the video driver and moves the cursor.
7D87
LD B,04H 06 04
Load Register B with 04H, the function code of @VDCTL that asks where the cursor now stands.
7D89
LD A,0FH 3E 0F
Load Register A with 0FH, the number of @VDCTL, the video control supervisor call.
7D8B
RST 28H EF
Restart at 0028H, the supervisor call entry, which answers with the cursor's row in Register H and its column in Register L.
7D8C
LD A,L 7D
Load Register A from Register L, the column the driver gave back.
7D8D
LD (713CH),A 32 3C 71
Store Register A into the byte at 713CH, the display's column, so that the tab and width tests at 4168H and 417EH read it without asking the driver again.
7D90
POP AF F1
Pop Register Pair AF, which brings the character and its flags back exactly as the caller handed them in.
7D91
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
7D92
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
7D93
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back into that pair.
7D94
RET C9
Return with the character in Register A, written to the display, and its new column in 713CH.

7D95H - PRINT @, the Cursor Put Where the Program Says (7D95H-7DEFH)

PRINT calls this from 621AH when it meets the at sign, and it takes two forms. With a bracket after it the row and the column are given separately, the row refused at 18H and above and the column at 50H, which are the Model 4's twenty-four lines and eighty columns; without one a single position from 0 to 1919 is given and divided by eighty through the overlay's own integer division at 2C0FH and remainder at 2C70H to make the same pair. Either way the pair goes to @VDCTL with Register B at 03H, which sets the cursor, and the column is written into 713CH so that the tab and width tests agree with where the cursor now is. The comma after the position is demanded and not optional, 7DEBH asking 4353H for one, so PRINT @100 "X" is Syntax error where PRINT @100,"X" is not. Both forms refuse a negative value, 798DH and 7990H leaving the flags set from Register D and the three jumps to FUNCERR 5F95H acting on them.

7D95
PRINT @ (7D95H), which PRINT calls at 621AH: call 5E93H, NXTCHAR, which brings the character after the at sign into Register A.
7D98
CP 28H FE 28
Compare Register A with 28H, an opening bracket, which is the form that gives the row and the column separately.
7D9A
Jump to 7DC2H on NZ, no bracket standing there, which takes the single position form.
7D9C
Call 798DH, which steps the text pointer and works a numeric argument out into Register Pair DE with the flags set from Register D.
7D9F
Jump to 5F95H on NZ, FUNCERR, which gives error 5, Illegal function call, for a row that is negative or above 255.
7DA2
LD A,E 7B
Load Register A from Register E, the low byte of the row.
7DA3
CP 18H FE 18
Compare Register A with 18H, twenty-four, which is one more than the highest line of the Model 4's display.
7DA5
Jump to 5F95H on NC, FUNCERR, which refuses a row of twenty-four or more.
7DA8
LD D,E 53
Load Register D from Register E, so that the row stands in Register D where @VDCTL wants it.
7DA9
PUSH DE D5
Push Register Pair DE, the row, which the column below is to be joined to.
7DAA
Call 4353H, which compares the character of the line with the byte written after the call and gives Syntax error at 4362H when they differ.
7DAD
DEFB 2CH 2C
The comma 4353H demands between the row and the column, which is data and not an instruction: a decoder reading straight through shows it as INC L.
7DAE
Call 7990H, which works the column out into Register Pair DE with the flags set from Register D.
7DB1
Jump to 5F95H on NZ, FUNCERR, which refuses a column that is negative or above 255.
7DB4
LD A,E 7B
Load Register A from Register E, the low byte of the column.
7DB5
CP 50H FE 50
Compare Register A with 50H, eighty, which is one more than the highest column of the Model 4's display.
7DB7
Jump to 5F95H on NC, FUNCERR, which refuses a column of eighty or more.
7DBA
Call 4353H, which compares the character of the line with the byte written after the call and gives Syntax error at 4362H when they differ.
7DBD
DEFB 29H 29
The closing bracket 4353H demands after the column, which is data and not an instruction: a decoder reading straight through shows it as ADD HL,HL.
7DBE
EX (SP),HL E3
Exchange the word Register Pair HL holds with the word at the Stack Pointer, which puts the row into Register Pair HL and the text pointer on to the stack.
7DBF
LD L,E 6B
Load Register L from Register E, the column, so that Register Pair HL is the row in Register H and the column in Register L.
7DC0
Jump to 7DE1H, which sets the cursor from that pair.
7DC2
DEC HL 2B
The single position form (7DC2H), which 7D9AH reaches: decrement Register Pair HL, so that the call below reads the character the pointer already stands on.
7DC3
Call 798DH, which steps the text pointer and works the position out into Register Pair DE with the flags set from Register D.
7DC6
PUSH HL E5
Push Register Pair HL, the text pointer standing after the position, which the division below destroys.
7DC7
LD HL,077FH 21 7F 07
Load Register Pair HL with 077FH, 1919, which is one less than the twenty-four lines of eighty columns the display holds.
7DCA
Call 434DH, CPHLDE, which compares Register Pair HL with Register Pair DE and sets the Carry Flag when the position is above 1919.
7DCD
Jump to 5F95H on C, FUNCERR, which refuses a position past the last place on the display.
7DD0
PUSH DE D5
Push Register Pair DE, the position, which the division below destroys.
7DD1
LD HL,0050H 21 50 00
Load Register Pair HL with 0050H, eighty, the number of columns in a line and so the divisor for both the row and the column.
7DD4
PUSH HL E5
Push Register Pair HL, that divisor, which the remainder below wants again.
7DD5
Call 2C0FH of BASIC/OV1, the integer division the backslash operator reaches, which leaves the quotient in Register Pair HL.
7DD8
LD B,L 45
Load Register B from Register L, the low byte of that quotient, which is the row the position falls on.
7DD9
POP HL E1
Pop Register Pair HL, the divisor eighty, back into that pair.
7DDA
POP DE D1
Pop Register Pair DE, the position, back into that pair.
7DDB
PUSH BC C5
Push Register Pair BC, the row, because the remainder below writes Register Pair BC.
7DDC
Call 2C70H of BASIC/OV1, the remainder the MOD operator reaches, which leaves the position less eighty times the row in Register Pair HL.
7DDF
POP BC C1
Pop Register Pair BC, which brings the row back into Register B.
7DE0
LD H,B 60
Load Register H from Register B, the row, so that Register Pair HL is the row in Register H and the column in Register L.
7DE1
LD A,L 7D
The cursor set (7DE1H), which 7DC0H also reaches: load Register A from Register L, the column.
7DE2
LD (713CH),A 32 3C 71
Store Register A into the byte at 713CH, the display's column, so that the tab and width tests agree with where the cursor is about to stand.
7DE5
LD B,03H 06 03
Load Register B with 03H, the function code of @VDCTL that puts the cursor at the row in Register H and the column in Register L.
7DE7
LD A,0FH 3E 0F
Load Register A with 0FH, the number of @VDCTL, the video control supervisor call.
7DE9
RST 28H EF
Restart at 0028H, the supervisor call entry, which moves the cursor there.
7DEA
POP HL E1
Pop Register Pair HL, the text pointer that 7DBEH or 7DC6H put on the stack.
7DEB
Call 4353H, which compares the character of the line with the byte written after the call and gives Syntax error at 4362H when they differ.
7DEE
DEFB 2CH 2C
The comma 4353H demands after the position, which is data and not an instruction: a decoder reading straight through shows it as INC L. It is what makes the comma of PRINT @ n, item compulsory.
7DEF
RET C9
Return to PRINT at 621DH with the cursor where the program asked and the text pointer standing on the item to be written.

7DF0H - The Printer Output (7DF0H-7DFFH)

The last sixteen bytes of the band, and the printer's counterpart of 7D7FH. 4134H jumps here with the character and 413EH calls it with a carriage return, and the whole of it is @PRT with every register pair saved around it. The one thing it does that the display's routine does not is report a failure: @PRT answers with the Zero Flag reset when the printer is not ready or has no paper, and 7DF8H sends that straight to DERR at 5282H, which turns the DOS's own code into a BASIC error and prints it. There is no column to read back, which is why the printer's position at 6E91H has to be counted by the code at 40E8H.

7DF0
PUSH HL E5
The printer output (7DF0H), which 4134H jumps to and 413EH calls: push Register Pair HL, the caller's own pointer, which the supervisor call below may change.
7DF1
PUSH DE D5
Push Register Pair DE, the caller's own value, for the same reason.
7DF2
PUSH BC C5
Push Register Pair BC, the caller's own value, for the same reason.
7DF3
PUSH AF F5
Push Register Pair AF, the character to be written, which this routine gives back exactly as it came in.
7DF4
LD C,A 4F
Load Register C from Register A, the character, which @PRT takes in that register.
7DF5
LD A,06H 3E 06
Load Register A with 06H, the number of @PRT, the supervisor call that writes a character to the printer.
7DF7
RST 28H EF
Restart at 0028H, the supervisor call entry, which writes it and answers with the Zero Flag reset when the printer refused it.
7DF8
Jump to 5282H on NZ, DERR, which keeps the DOS's own code at 7C4EH, turns it into a BASIC error number through the table at 529EH and goes to the handler, so a printer that is not ready stops the program.
7DFB
POP AF F1
Pop Register Pair AF, which brings the character and its flags back exactly as the caller handed them in.
7DFC
POP BC C1
Pop Register Pair BC, which brings the caller's own value back into that pair.
7DFD
POP DE D1
Pop Register Pair DE, which brings the caller's own value back into that pair.
7DFE
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back into that pair.
7DFF
RET C9
Return with the character in Register A and the printer having taken it.

7E00H - CLS, and the Nine Spare Bytes After It (7E00H-7E10H)

CLS is the shortest statement of the interpreter: it asks the DOS to clear the screen with @CLS and then zeroes the print position, which is the one piece of its own state the interpreter keeps about the display. Nine bytes of 00H follow the return and nothing reaches them: they are the slack between this statement and the keyboard line reader that begins at 7E11H, which is where the enhancement package's IMMED takes over and where IMBACK 7E2AH, the address NEWB/EQU names, stands. CLS is called as well as dispatched: 42AEH runs it when a program is cleared and BEGIN runs it at 84F1H during the start-up, and the enhancement's IMMED reaches it at 8082H for SHIFT with CLEAR.

7E00
LD A,69H 3E 69
CLS (7E00H), the routine the statement address table holds for token 09FH at 67FFH and which 42AEH and BEGIN's 84F1H also call: load Register A with 69H, 105, the number of @CLS, the supervisor call that clears the screen.
7E02
RST 28H EF
Issue RST 28H, calling @CLS at 0545H, which clears the whole of the display and puts the cursor at the top left.
7E03
XOR A AF
Clear Register A with XOR A, making 00H, the value the print position is to be set to.
7E04
LD (713CH),A 32 3C 71
Store Register A into the byte at 713CH, the print position, which 41E9H reads to decide whether a carriage return is needed before a message: the screen being empty, nothing stands on the line.
7E07
RET C9
Return to the statement loop at 5E3BH, or to whichever of 42AEH, 84F1H and 8082H called.
7E08-7E10
DEFB 00H x 9 00 x 9
Nine bytes of 00H between CLS and the keyboard line reader at 7E11H. No instruction of module 1, module 2, BASIC/OV1 or BASIC/OV2 names any of these addresses, no word of the four images holds one, and no relative jump reaches them: they are slack in the assembly, not code and not data.

7E11H - The Line Reader, and the Semicolon the Prompt Code Swallows (7E11H-7E84H)

7E1BH is where every line BASIC takes from outside itself comes in: INPUT's reply at 6406H, LINE INPUT's at 636EH, the line typed at Ready through 5962H, and the enhancement package's own input at 80BDH. It has two halves and the test at 7E1EH decides which: 45DFH asks whether a file is in hand at FILEX 6E98H, and if one is, the line is read from that file a byte at a time instead of from the keyboard. That one test is how a LOAD or a MERGE of a program written as text has the keyboard code read the program's lines for it, which is why an ASCII program loads through the same path as a line typed by hand. 7E11H is the question mark, four instructions that write ? and fall into the reader, and INPUT repeats those same four at 63FCH to 6405H rather than calling them, because its own test of 72C6H has to come between them and the read. The keyboard half is one supervisor call, @KEYIN with Register Pair BC holding F900H, the buffer and a length of 249; the file half is a loop that stops on a carriage return, keeps tabs and line feeds and throws every other control character away, and counts its room in Register B from 01H upward so that the wrap to 00H at 255 characters is what a line too long is caught by, giving error 23, Line buffer overflow. Both halves return Register Pair HL holding 7038H, the byte below the buffer, which is what every caller reads from. 7E7FH is six bytes that have nothing to do with the reader and sit here because there was room: they step the text pointer past a semicolon when there is one, and INPUT at 63C6H and LINE at 6360H are the only two callers.

7E11
LD A,3FH 3E 3F
The question mark (7E11H), which 3139H does not reach but which INPUT's own four instructions at 63FCH copy: load Register A with 3FH, a question mark.
7E13
Call 40D8H, the character output, which sends Register A to whatever device the output is going to and keeps the print position at 713CH.
7E16
LD A,20H 3E 20
Load Register A with 20H, a blank, which follows the question mark so that the reply does not touch it.
7E18
Call 40D8H again, which writes that blank and leaves the display standing where the reply is to appear.
7E1B
LD HL,7039H 21 39 70
The line reader (7E1BH), which 636EH, 6406H, 5962H and 80BDH call: load Register Pair HL with 7039H, INBUF, the buffer the line is read into.
7E1E
Call 45DFH, the test for a file being in hand, which loads the word at FILEX 6E98H and sets the Zero Flag when there is none, leaving Register Pair HL untouched.
7E21
Jump to 7E42H on NZ, a file being in hand, which reads the line out of that file rather than from the keyboard: this is the whole of how a program stored as text is loaded.
7E23
LD BC,0F900H 01 00 F9
Load Register Pair BC with 0F900H, which gives Register B the length the supervisor call may read, 249 characters, and Register C the 00H it wants.
7E26
PUSH DE D5
Push Register Pair DE, the caller's, which the supervisor call is free to change and the pop at 7E2AH brings back.
7E27
LD A,09H 3E 09
Load Register A with 09H, the number of @KEYIN, the supervisor call that reads a whole line from the keyboard with its own editing.
7E29
RST 28H EF
Call the supervisor through restart 28H, which reads the line into the buffer Register Pair HL addresses and sets the Carry Flag when BREAK was pressed.
7E2A
POP DE D1
Pop Register Pair DE, the caller's, which 7E26H pushed.
7E2B
Jump to 5282H on NZ, DERR, which turns whatever error the supervisor returned into one of BASIC's own messages.
7E2E
PUSH AF F5
Push Register Pair AF, which keeps the Carry Flag that says whether BREAK was pressed across the three calls below.
7E2F
Call 7D4FH, which saves Register Pair AF, clears any pending BREAK through @CKBRKC, supervisor call 106, and brings Register Pair AF back: the BREAK this read answered must not be found again by the next test.
7E32
LD C,B 48
Load Register C with Register B, the count of characters the supervisor read.
7E33
LD B,00H 06 00
Load Register B with 00H, which makes Register Pair BC that count alone.
7E35
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which brings Register Pair HL to the byte just past what was typed.
7E36
LD (HL),B 70
Store Register B, which is 00H, into the byte Register Pair HL addresses, which ends the line as every caller expects to find it.
7E37
LD B,C 41
Load Register B with Register C, the count of characters, put back where the enhancement package's own input code looks for it.
7E38
INC B 04
Increment Register B, so that Register B counts the 00H as well as the characters.
7E39
LD HL,7038H 21 38 70
Load Register Pair HL with 7038H, the byte below the buffer, which is what every caller is given so that its first step on reaches the first character.
7E3C
XOR A AF
Clear Register A to 00H, the print position of the left of the display.
7E3D
LD (713CH),A 32 3C 71
Store Register A into the byte at 713CH, the print position, the line the user typed having ended with a carriage return the supervisor did not store.
7E40
POP AF F1
Pop Register Pair AF, which brings the Carry Flag of the BREAK back for the caller.
7E41
RET C9
Return with Register Pair HL holding 7038H and the Carry Flag set when BREAK was pressed.
7E42
LD B,01H 06 01
The line from a file (7E42H): load Register B with 01H, the room counted from one, which the wrap to 00H at 255 characters is what catches a line too long.
7E44
Call 5064H, the byte reader, which takes one byte of the file in hand through @GET, supervisor call 3, and sets the Carry Flag at the end of the file.
7E47
Jump to 7E53H on NC, a byte having been read, which weighs it below.
7E49
Call 41AAH, which finishes the load: it closes the file through 4CD0H and then takes up the chain at 5693H, or runs the program LOAD's flag at 6EA8H asked for, or goes to Ready, so the end of the file ends the load and not merely the line.
7E4C
LD HL,7039H 21 39 70
Load Register Pair HL with 7039H, the buffer, for the line this reader would hand back were 41AAH ever to return to it.
7E4F
LD B,01H 06 01
Load Register B with 01H, the room again, for the same reason.
7E51
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, so that the three instructions above and this one make the reader give back a line of no characters.
7E53
CP 0DH FE 0D
Compare Register A with 0DH, a carriage return, which is what ends a line in a file written as text.
7E55
Jump to 7E5DH on NZ, the byte not ending the line.
7E57
XOR A AF
Clear Register A to 00H, the byte that ends the line in the buffer.
7E58
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, which ends the line where it stopped.
7E59
LD HL,7038H 21 38 70
Load Register Pair HL with 7038H, the byte below the buffer, which is what the caller is given.
7E5C
RET C9
Return with Register Pair HL holding 7038H and the Carry Flag clear, a line having been read out of the file.
7E5D
CP 20H FE 20
Compare Register A with 20H, a blank, which is the lowest code that is an ordinary character.
7E5F
Jump to 7E69H on NC, the byte being an ordinary character, which stores it.
7E61
CP 09H FE 09
Compare Register A with 09H, a tab, which is kept although it is a control character.
7E63
Jump to 7E69H on Z, the byte being a tab, which is stored like any other.
7E65
CP 0AH FE 0A
Compare Register A with 0AH, a line feed, which is also kept.
7E67
Jump back to 7E44H on NZ, the byte being any other control character, which is thrown away and the next byte read: a text file's own formatting codes never reach a program line.
7E69
INC B 04
Increment Register B, the room, which the decrement below undoes so that the test is made on the room itself.
7E6A
DEC B 05
Decrement Register B, which sets the Zero Flag only when the room has wrapped to 00H, 255 characters having been stored.
7E6B
Jump to 7E72H on Z, the line being too long for the buffer.
7E6D
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, the character's place in the buffer.
7E6E
INC HL 23
Step Register Pair HL on to the next place in the buffer.
7E6F
INC B 04
Increment Register B, which counts the character and brings the room one nearer the wrap.
7E70
Jump back to 7E44H, which reads the next byte of the file.
7E72
LD HL,7039H 21 39 70
Load Register Pair HL with 7039H, the start of the buffer, so that the line's own number can be read for the message.
7E75
Call 5FA4H, the line reference test, which steps back one character, takes the next through NXTCHAR at 5E93H and brings the word at 7149H into Register Pair DE, stepping the text pointer past the reference when the character was one of the two reference tokens.
7E78
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings that word into Register Pair HL.
7E79
LD (6E9CH),HL 22 9C 6E
Store Register Pair HL into the word at 6E9CH, the number of the line being run, which is the number the message below names.
7E7C
Jump to 5D05H, which loads Register E with 17H and reaches the error handler: error 23, Line buffer overflow, which is what a text file holding a line of 255 characters or more gives.
7E7F
CP 3BH FE 3B
The semicolon step (7E7FH), which INPUT calls at 63C6H and LINE at 6360H: compare Register A with 3BH, a semicolon.
7E81
RET NZ C0
Return on NZ with Register A as it stands, there being no semicolon and nothing to step over.
7E82
Jump to NXTCHAR at 5E93H, which steps the text pointer past the semicolon and brings the character after it back in Register A, returning to this routine's own caller: nothing records that the semicolon was there.

7E85H - RANDOM, SOUND, TIME$ and DATE$, and ROW (7E85H-7ED3H)

Four small routines and a fifth that is two entry points in one instruction. RANDOM 7E85H is three instructions: it loads the Z80's own refresh register, which counts up with every instruction the processor executes, and keeps it at 713EH as the seed, so the sequence RND gives depends on how long the machine has been running since it was last asked. SOUND 7E8BH reads a tone from 0 to 7 and a duration below 32, and the arithmetic between them is worth seeing: the tone is complemented, incremented and raised by 7, which turns 0 to 7 into 7 to 0, so that the statement's own numbering runs the opposite way to the hardware's; the duration is then shifted up three places and the two are ORed into the one byte @SOUND wants. TIME$ 7EAFH and DATE$ 7EB0H are the tenth pair of entry points in this file that stand inside one instruction: 7EAFH is `OR 0AFH`, and its operand byte at 7EB0H is `XOR A` as an instruction, so the Zero Flag the two leave is the whole difference between them, and the POP AF at 7EBDH is what reads it: Z asks the DOS for the date with @DATE and NZ for the time with @TIME. Both make an eight character string through 4641H and hand it back as the accumulator's own string through 467FH. ROW 7ECBH is the function the statement address table does not hold, because it is a function and not a statement: the table that holds it is the function table at 685DH-68C2H, which keeps 51 words for tokens 01H to 33H in token order, and ROW is token 33H, whose word stands at 68C1H.

7E85
LD A,R ED 5F
RANDOM (7E85H), the routine the statement address table holds for token 0BBH at 6837H: load Register A from Register R, the Z80's own refresh register, which the processor steps with every instruction it executes and which is therefore unpredictable to a program.
7E87
LD (713EH),A 32 3E 71
Store Register A into the byte at 713EH, the seed the RND function works from, so that the sequence a program gets depends on when the statement was reached.
7E8A
RET C9
Return to the statement loop at 5E3BH, the seed set and nothing else of the statement's work left to do.
7E8B
SOUND (7E8BH), the routine the statement address table holds for token 0CDH at 685BH: call 799FH, which works the tone out into Register A and refuses anything above 255 with Illegal function call.
7E8E
CP 08H FE 08
Compare Register A with 08H, the first tone number the hardware has no setting for, there being eight tones from 0 to 7.
7E90
Jump to 7EA0H on NC, the tone standing at 8 or above, where the JP NC gives Illegal function call.
7E92
CPL 2F
Complement Register A, every bit of the tone, which with the two instructions below turns the statement's numbering round.
7E93
INC A 3C
Increment Register A, finishing the negation of the tone.
7E94
ADD A,07H C6 07
Add 07H to Register A, which makes a tone of 0 into 7 and a tone of 7 into 0: the statement's own numbering runs the opposite way to the byte @SOUND wants.
7E96
PUSH AF F5
Push Register Pair AF, the tone as the hardware wants it, which the POP BC at 7EA6H brings back into Register B.
7E97
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
7E9A
DEFB 2CH 2C
The comma between the tone and the duration, read as data by the routine the call at 7E97H reaches, not executed; the instruction after that call is the one at 7E9BH.
7E9B
Call 799FH, which works the duration out into Register A.
7E9E
CP 20H FE 20
Compare Register A with 20H, 32, the first duration the one byte has no room for, the duration taking the top five bits of it.
7EA0
Jump to FUNCERR 5F95H on NC, which prints Illegal function call: this is where 7E90H sends a tone of 8 or above as well as where a duration of 32 or above arrives.
7EA3
RLCA 07
Rotate Register A left, the duration, which doubles it.
7EA4
RLCA 07
Rotate Register A left a second time, making four times the duration.
7EA5
RLCA 07
Rotate Register A left a third time, making eight times it, which shifts the duration into the top five bits of the byte and leaves the bottom three for the tone.
7EA6
POP BC C1
Pop Register Pair BC, which brings the tone pushed at 7E96H back into Register B.
7EA7
OR B B0
OR Register A with Register B, the tone, which puts it into the three bits the shift left free, so that Register A now holds the whole of what @SOUND wants.
7EA8
LD B,A 47
Load Register B from Register A, the finished byte, because @SOUND takes it in Register B.
7EA9
PUSH HL E5
Push Register Pair HL, the text pointer, which the POP HL at 7EADH brings back: the supervisor call is free to use Register Pair HL.
7EAA
LD A,68H 3E 68
Load Register A with 68H, 104, the number of @SOUND, the supervisor call that drives the machine's own sound port.
7EAC
RST 28H EF
Issue RST 28H, calling @SOUND at 0392H, which makes the tone for the duration asked and does not return until it is over.
7EAD
POP HL E1
Pop Register Pair HL, the text pointer pushed at 7EA9H.
7EAE
RET C9
Return to the statement loop at 5E3BH, the sound having finished.
7EAF
OR 0AFH F6 AF
TIME$ (7EAFH), the function entry: OR Register A with 0AFH, which leaves Register A holding 0AFH and the Zero Flag clear, and whose operand byte at 7EB0H is DATE$'s own entry.
7EB1
PUSH AF F5
Push Register Pair AF, which keeps that flag over the work below, the POP AF at 7EBDH being what reads it to choose between the date and the time.
7EB2
Call NXTCHAR at 5E93H, which steps the text pointer past the function's own token.
7EB5
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which puts the text pointer away on the stack and brings the flags word into Register Pair HL.
7EB6
PUSH HL E5
Push Register Pair HL, that word again, so that the POP AF at 7EBDH has it to take.
7EB7
LD A,08H 3E 08
Load Register A with 08H, the length of the string both the date and the time are returned in, which is eight characters either way.
7EB9
Call 4641H, which takes eight bytes of string space, builds a descriptor for them in the three bytes at 7175H and leaves Register Pair HL addressing that descriptor.
7EBC
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address of the eight bytes into Register Pair HL, where the supervisor call is to write them.
7EBD
POP AF F1
Pop Register Pair AF, the flag the entry left, which says which of the two functions was asked for.
7EBE
Jump to 7EC6H on NZ, the function being TIME$, which entered at 7EAFH and left the Zero Flag clear.
7EC0
LD A,13H 3E 13
Load Register A with 13H, 19, the number of @TIME, the supervisor call that writes the time as eight characters.
7EC2
RST 28H EF
Issue RST 28H, calling @TIME at 078DH, which writes the time to the eight bytes Register Pair HL addresses.
7EC3
Jump to 467FH, which makes the descriptor at 7175H the accumulator's own string at 72ECH with type 03H at 7142H, and returns to the expression evaluator with the string as the function's value.
7EC6
LD A,12H 3E 12
DATE$ (7EC6H), reached from 7EBEH: load Register A with 12H, 18, the number of @DATE, the supervisor call that writes the date as eight characters.
7EC8
RST 28H EF
Issue RST 28H, calling @DATE at 1420H, which writes the date to the eight bytes Register Pair HL addresses.
7EC9
Jump back to 7EC3H, which hands the string back the same way the time does.
7ECB
LD B,04H 06 04
ROW (7ECBH), the function the function table at 685DH-68C2H holds for token 33H at 68C1H: load Register B with 04H, the code @VDCTL takes to mean that the cursor's position is wanted.
7ECD
LD A,0FH 3E 0F
Load Register A with 0FH, 15, the number of @VDCTL, the supervisor call that answers questions about the display.
7ECF
RST 28H EF
Issue RST 28H, calling @VDCTL at 0B99H, which returns the cursor's position in Register Pair HL.
7ED0
LD A,H 7C
Load Register A from Register H, the row of that position, which is the half of it this function gives.
7ED1
Jump to 770CH, which turns the byte in Register A into the accumulator's value as an integer and returns to the expression evaluator.

7ED4H - SYSTEM: Leave BASIC, or Give One Command to the DOS (7ED4H-7F1EH)

SYSTEM has two forms and they do quite different things. With nothing after it the statement closes every file through 4DB8H and issues @EXIT with Register Pair HL at 0000H, which gives the machine back to the DOS for good: BASIC does not come back and nothing of the program survives. With a string after it the string is handed to the DOS as one command through @CMNDR and BASIC carries on afterwards, which is what makes it useful inside a program. The careful part is the five instructions either side of the call. The string is not 00H ended, so 7EF3H writes 0DH over the byte that follows it and 7F10H puts the original byte back afterwards; and because @CMNDR may load a DOS overlay over the area BASIC keeps BASIC/OV1 in, bit 4 of CFLAG$ is set before the call and reset after it, both with interrupts off, and 7F0AH calls 7F1FH to read BASIC/OV1 back in. The error return is read at 7F11H to 7F19H: a result of 0000H is success, a low byte of 00H with a high byte that is not is turned into 0FFH, and anything else goes to DERR at 5282H, which turns the DOS's own code into a BASIC error. This is also where the error handler sends an error raised during the start-up: 5915H jumps to 7ED4H when the line number is 0FFFEH, so a failure while BASIC is starting up leaves the machine at the DOS rather than at a Ready prompt.

7ED4
SYSTEM (7ED4H), the routine the statement address table holds for token 0BDH at 683BH, and where 5915H sends an error raised during the start-up: jump to 7EDFH on NZ, something standing after the keyword and so a command to be given to the DOS.
7ED6
Call 4DB8H, which closes every open file, because the exit below does not come back and a file left open would lose whatever is still in its buffer.
7ED9
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the value @EXIT takes to mean that the program ended without an error.
7EDC
LD A,16H 3E 16
Load Register A with 16H, 22, the number of @EXIT, the supervisor call that gives the machine back to the DOS.
7EDE
RST 28H EF
Issue RST 28H, calling @EXIT at 1B0BH, which does not return: BASIC is gone and the DOS prompt follows.
7EDF
A command for the DOS (7EDFH): call the expression evaluator at 7345H, which works the string out and leaves it in the accumulator at 72ECH.
7EE2
PUSH HL E5
Push Register Pair HL, the text pointer standing after the string, which the POP HL at 7F1DH brings back.
7EE3
Call 481AH, which insists through 2AB0H that the value is a string and brings the address of its descriptor out of the accumulator in Register Pair HL.
7EE6
LD C,(HL) 4E
Load Register C with the byte Register Pair HL addresses, the length of the string, which the end test below works from.
7EE7
INC HL 23
Increment Register Pair HL onto the low byte of the descriptor's text address.
7EE8
LD E,(HL) 5E
Load Register E from the byte Register Pair HL addresses, that low byte.
7EE9
INC HL 23
Increment Register Pair HL onto the high byte.
7EEA
LD D,(HL) 56
Load Register D from the byte Register Pair HL addresses, so that Register Pair DE holds the address of the command's own characters.
7EEB
LD H,D 62
Load Register H from Register D, the high byte of that address.
7EEC
LD L,E 6B
Load Register L from Register E, its low byte, so that Register Pair HL holds the same address as Register Pair DE.
7EED
LD B,00H 06 00
Load Register B with 00H so that Register Pair BC holds the string's length as a sixteen bit number.
7EEF
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which makes Register Pair HL address the byte standing just past the end of the command.
7EF0
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, whatever stands after the command, which is not the command's own and has to be put back.
7EF1
PUSH HL E5
Push Register Pair HL, the address of that byte, which the POP DE at 7F0FH brings back for the restore.
7EF2
PUSH AF F5
Push Register Pair AF, the byte itself, which the POP AF at 7F0EH brings back.
7EF3
LD (HL),0DH 36 0D
Store 0DH into the byte Register Pair HL addresses, a carriage return, which is how the DOS knows where the command line ends: the string the program gave is not 00H ended and the DOS needs a terminator.
7EF5
LD HL,(7C6FH) 2A 6F 7C
Load Register Pair HL from the word at 7C6FH, the cell BEGIN filled at 84C9H with the address of CFLAG$ 006CH, so that this statement reaches the DOS's own flag byte through a pointer.
7EF8
PUSH HL E5
Push Register Pair HL, that address, which the EX (SP),HL at 7F03H brings back to reset the bit after the call.
7EF9
DI F3
Disable interrupts, so that the read, the alteration and the write below cannot be split by the clock task.
7EFA
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, CFLAG$ as it stands.
7EFB
OR 10H F6 10
OR Register A with 10H, which sets bit 4, the bit that tells the DOS the caller is a program that will want its memory back.
7EFD
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, CFLAG$, with the bit now set.
7EFE
EI FB
Enable interrupts again, the flag byte being whole.
7EFF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address of the command's characters into Register Pair HL, where @CMNDR takes it.
7F00
LD A,19H 3E 19
Load Register A with 19H, 25, the number of @CMNDR, the supervisor call that runs one DOS command and returns to the program that asked.
7F02
RST 28H EF
Issue RST 28H, calling @CMNDR at 197BH, which may load a DOS overlay over 1E00H and a library command over 2600H, where BASIC keeps BASIC/OV1.
7F03
EX (SP),HL E3
Exchange Register Pair HL with the word the Stack Pointer addresses, which brings the address of CFLAG$ back into Register Pair HL and puts @CMNDR's own answer on the stack.
7F04
DI F3
Disable interrupts again for the second alteration of the flag byte.
7F05
LD A,(HL) 7E
Load Register A with the byte Register Pair HL addresses, CFLAG$ as the DOS has left it.
7F06
AND 0EFH E6 EF
AND Register A with 0EFH, which resets bit 4 and leaves every other bit as it was.
7F08
LD (HL),A 77
Store Register A into the byte Register Pair HL addresses, CFLAG$, with the bit cleared.
7F09
EI FB
Enable interrupts again, the flag byte being whole, so that the clock task and the keyboard can be served while BASIC/OV1 is read back in.
7F0A
Call 7F1FH, the routine NEWB/EQU names OV1, which reads BASIC/OV1 back into 2600H: the command just run may have loaded a library command over it, and the interpreter cannot work out an expression without it.
7F0D
POP HL E1
Pop Register Pair HL, @CMNDR's own answer, which the EX (SP),HL at 7F03H put on the stack.
7F0E
POP AF F1
Pop Register Pair AF, the byte that stood after the command, pushed at 7EF2H.
7F0F
POP DE D1
Pop Register Pair DE, the address of that byte, pushed at 7EF1H.
7F10
LD (DE),A 12
Store Register A into the byte Register Pair DE addresses, which puts the byte the carriage return was written over back where it belongs.
7F11
LD A,H 7C
Load Register A from Register H, the high byte of @CMNDR's answer.
7F12
OR L B5
OR Register A with Register L, its low byte, so that the Zero Flag is set only when the answer was 0000H and the command succeeded.
7F13
Jump to 7F1DH on Z, the command having succeeded, so that the statement ends without an error.
7F15
LD A,L 7D
Load Register A from Register L, the low byte of the answer, which is the DOS's own error code.
7F16
OR A B7
OR Register A with itself, which sets the Zero Flag when that low byte is 00H although the answer as a whole was not.
7F17
Jump to 7F1AH on NZ, the low byte carrying a code DERR can read.
7F19
DEC A 3D
Decrement Register A, which turns the 00H into 0FFH, the code DERR takes to mean Command Aborted, so an answer whose high byte alone is set is reported rather than lost.
7F1A
Jump to DERR at 5282H, which keeps the code at 7C4EH, turns it into a BASIC error number through the table at 529FH and prints it.
7F1D
POP HL E1
The success return (7F1DH): pop Register Pair HL, the text pointer pushed at 7EE2H.
7F1E
RET C9
Return to the statement loop at 5E3BH, which goes on with the rest of the line after the SYSTEM statement.

7F1FH - OV1, the Arithmetic Overlay Read Back In (7F1FH-7F3BH)

Twenty-nine bytes, and the one routine that can put BASIC/OV1 back when something has loaded over it. NEWB/EQU names it OV1, 7F0AH calls it from SYSTEM and 8402H from BEGIN's start-up, and it is the whole reason the overlay can be treated as resident: module 1 cannot evaluate an expression without the package at 2600H, so anything that uses the overlay area, a DOS overlay through SVCUSR among them, has to be followed by a call here. The filespec it loads is the tail of its own error message. 7F47H is the twelfth character of the text at 7F3CH, where Can't load BASIC/OV1 becomes BASIC/OV1 with the 0DH at 7F50H ending it, so the nine characters of the name and the line ender serve twice over and the loader copies them into INBUF before it calls @LOAD. When the load fails the same text is shown whole with @DSPLY and the program is ended with @ABORT, which does not return.

7F1F
LD HL,7F47H 21 47 7F
OV1 (7F1FH), the name NEWB/EQU gives it, which SYSTEM calls at 7F0AH and BEGIN at 8402H: load Register Pair HL with 7F47H, the twelfth character of the error message below, where the name BASIC/OV1 begins.
7F22
LD DE,7039H 11 39 70
Load Register Pair DE with 7039H, INBUF, where @LOAD wants to find the filespec it is to read.
7F25
PUSH DE D5
Push Register Pair DE, that address, which the copy below steps and @LOAD must be given.
7F26
LD A,(HL) 7E
The copy (7F26H), which 7F2CH goes back to: load Register A with the byte Register Pair HL stands on, the next character of the name.
7F27
LD (DE),A 12
Store Register A into the byte Register Pair DE stands on, the matching place in INBUF.
7F28
INC HL 23
Increment Register Pair HL, so that it stands on the next character of the name.
7F29
INC DE 13
Increment Register Pair DE, so that it stands on the next place in the buffer.
7F2A
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return that ends the message and so ends the name.
7F2C
Jump to 7F26H on NZ, the 0DH not having been copied yet, which copies the next character.
7F2E
POP DE D1
Pop Register Pair DE, which brings the address of INBUF back into that pair with the name in it.
7F2F
LD A,4CH 3E 4C
Load Register A with 4CH, the number of @LOAD, the supervisor call that reads a load module file into memory at the addresses it names.
7F31
RST 28H EF
Restart at 0028H, the supervisor call entry, which reads BASIC/OV1 into 2600H and answers with the Zero Flag set when it succeeded.
7F32
RET Z C8
Return on Z, the overlay being in memory again, which is what every call to this routine expects.
7F33
LD HL,7F3CH 21 3C 7F
Load Register Pair HL with 7F3CH, the whole of the error message, the load having failed.
7F36
LD A,0AH 3E 0A
Load Register A with 0AH, the number of @DSPLY, the supervisor call that writes a 0DH ended line to the display.
7F38
RST 28H EF
Restart at 0028H, the supervisor call entry, which writes Can't load BASIC/OV1.
7F39
LD A,15H 3E 15
Load Register A with 15H, the number of @ABORT, the supervisor call that ends the program and returns to the DOS.
7F3B
RST 28H EF
Restart at 0028H, the supervisor call entry, which does not come back, so BASIC gives up rather than run on without the arithmetic it cannot do for itself.

7F3CH - The BASIC/OV1 Load Failure Text (7F3CH-7F50H)

The text the overlay loader shows when it cannot read BASIC/OV1 into 2600H. The three instructions above it at 7F35H to 7F3BH load Register Pair HL with this address and issue two supervisor calls, so the text is data standing inside the loader. Its tail is also the filespec the loader asks @LOAD for: 7F47H is the twelfth character, where Can't load BASIC/OV1 becomes BASIC/OV1, and the 0DH at 7F50H ends the name as well as the line, so 7F1FH copies the nine characters and the ender out of the middle of its own error message.

7F3C-7F50
DEFM "Can't load BASIC/OV1" / DEFB 0DH 43 61 6E 27 74 20 6C 6F 61 64 20 42 41 53 49 43 2F 4F 56 31 0D
7F3CH-7F50H: the words Can't load BASIC/OV1 and the 0DH that ends the line. There is no 00H after it, the text being shown by a supervisor call that takes a 0DH ended line, and OV1 at 7F1FH, which NEWB/EQU names as the entry that re-loads the overlay, is eleven instructions above it. The nine characters from 7F47H are the filespec that loader copies into INBUF.

7F51H - ERRS$ and the Record Number Reader (7F51H-7FC9H)

Two routines that have nothing to do with each other beyond standing together. ERRS$ 7F51H, the function behind token 0DFH, is reached only from 7555H and it hands back the DOS's own message for the last failure as a string. The code at 7C4EH is the key: 00H gives the empty string through 7D71H, 0FFH is the one error the interpreter words itself and is copied out of the text at 7C57H, and anything else is turned into nnn- by @HEXDEC and then has the DOS's own words put after it by @ERROR with bits 6 and 7 of Register C set, which is what makes that call write the message into the buffer instead of displaying it and returning. Bit 7 of CFLAG$ is set first, at 7F88H, because @ERROR reads it to decide how much of the message to give. The text is then ended with 00H wherever the 0DH is found, in no more than 249 bytes, the leading spaces are skipped and 4621H makes a string of what is left. 7FABH is the record number reader, which only PUT and GET use, from 4FEEH. Its two refusals are a negative number, which 28C4H of BASIC/OV1 reports in the Sign Flag, and an exponent of 91H or more at 72EFH, which is 65536 and above. 7FC7H is an entry hidden in an operand: it is the 37H of the LD A,37H at 7FC6H and stands as an SCF, so the two refusals set the Carry Flag and the one success leaves it clear, the XOR A at 7FC5H being there for nothing else.

7F51
ERRS$ (7F51H), which the function dispatch jumps to from 7555H: call 5E93H, NXTCHAR, which steps the text pointer past the token.
7F54
PUSH HL E5
Push Register Pair HL, the text pointer, which the supervisor calls below change and the caller must have back.
7F55
LD A,(7C4EH) 3A 4E 7C
Load Register A with the byte at 7C4EH, the DOS's own code for the last failure, which DERR stored at 5287H.
7F58
OR A B7
Or Register A with itself, which sets the Zero Flag when no failure has been recorded.
7F59
Jump to 7D71H on Z, nothing having failed, which answers with the empty string.
7F5C
CP 0FFH FE FF
Compare Register A with 0FFH, the code the interpreter uses for a command the user aborted, which the DOS has no message for.
7F5E
Jump to 7F71H on NZ, the code being a real DOS error, which asks the DOS for its words.
7F60
LD DE,7039H 11 39 70
The aborted command (7F60H): load Register Pair DE with 7039H, INBUF, where the text is to be built.
7F63
LD HL,7C57H 21 57 7C
Load Register Pair HL with 7C57H, the text 255-Command Aborted with the 00H after it.
7F66
LD A,(HL) 7E
The copy (7F66H), which 7F6FH goes back to: load Register A with the byte Register Pair HL stands on, the next character of that text.
7F67
CP 00H FE 00
Compare Register A with 00H, the byte that ends it.
7F69
Jump to 7F9BH on Z, the whole text having been copied, which ends the buffer and makes a string of it.
7F6C
LD (DE),A 12
Store Register A into the byte Register Pair DE stands on, the matching place in INBUF.
7F6D
INC DE 13
Increment Register Pair DE, so that it stands on the next place in the buffer.
7F6E
INC HL 23
Increment Register Pair HL, so that it stands on the next character of the text.
7F6F
Jump to 7F66H, which copies the next character.
7F71
PUSH AF F5
A real DOS error (7F71H), which 7F5EH reaches: push Register Pair AF, the code, which the conversion below destroys.
7F72
LD L,A 6F
Load Register L from Register A, the code, as the low byte of the value @HEXDEC is to write out.
7F73
LD H,00H 26 00
Load Register H with 00H, the high byte of it, the code being one byte.
7F75
LD DE,7039H 11 39 70
Load Register Pair DE with 7039H, INBUF, where @HEXDEC is to write the digits.
7F78
LD A,61H 3E 61
Load Register A with 61H, the number of @HEXDEC, the supervisor call that writes Register Pair HL out as decimal digits at Register Pair DE.
7F7A
RST 28H EF
Restart at 0028H, the supervisor call entry, which writes them and leaves Register Pair DE standing after them.
7F7B
LD A,2DH 3E 2D
Load Register A with 2DH, a minus sign, which stands between the number and the words.
7F7D
LD (DE),A 12
Store Register A into the byte Register Pair DE stands on.
7F7E
INC DE 13
Increment Register Pair DE, so that it stands where the DOS's own words are to go.
7F7F
POP AF F1
Pop Register Pair AF, which brings the error code back into Register A.
7F80
OR 0C0H F6 C0
Or Register A with 0C0H, bits 6 and 7, which is what tells @ERROR to write its message into the buffer Register Pair DE names rather than display it and return to the DOS.
7F82
LD C,A 4F
Load Register C from Register A, that code with the two bits in it, which is where @ERROR takes it.
7F83
LD HL,(7C6FH) 2A 6F 7C
Load Register Pair HL from the word at 7C6FH, the pointer BEGIN filled with the address of CFLAG$ 006CH.
7F86
DI F3
Disable interrupts, so that the read and the write below cannot be split by a task changing another bit of the flag.
7F87
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, the flag byte.
7F88
OR 80H F6 80
Or Register A with 80H, bit 7, which @ERROR reads to decide how much of its message to give.
7F8A
LD (HL),A 77
Store Register A into the byte Register Pair HL stands on, the flag byte with that bit set.
7F8B
EI FB
Enable interrupts again, the supervisor call below being free to run with the tasks going as usual.
7F8C
LD A,1AH 3E 1A
Load Register A with 1AH, the number of @ERROR, the supervisor call that turns a code into the DOS's own words.
7F8E
RST 28H EF
Restart at 0028H, the supervisor call entry, which writes those words at Register Pair DE with a 0DH after them.
7F8F
LD B,0F9H 06 F9
Load Register B with 0F9H, 249, the most characters this routine will look through for that 0DH.
7F91
LD A,(DE) 1A
The 0DH found (7F91H), which 7F98H goes back to: load Register A with the byte Register Pair DE stands on, the next character of the message.
7F92
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return @ERROR puts at the end of its words.
7F94
Jump to 7F9BH on Z, the end having been found, which writes a 00H over it.
7F96
INC DE 13
Increment Register Pair DE, so that it stands on the next character.
7F97
DEC B 05
Decrement Register B, the count of characters left to look at.
7F98
Jump to 7F91H on NZ, the count not being used up, which looks at the next character.
7F9B
XOR A AF
The text ended (7F9BH), which 7F69H and 7F94H both reach: exclusive or Register A with itself, which makes it 00H.
7F9C
LD (DE),A 12
Store Register A, 00H, into the byte Register Pair DE stands on, which ends the text where the 0DH stood or where the count ran out.
7F9D
LD HL,7038H 21 38 70
Load Register Pair HL with 7038H, the byte below INBUF, so that the loop below steps on to the first character.
7FA0
INC HL 23
The leading spaces skipped (7FA0H), which 7FA4H goes back to: increment Register Pair HL, so that it stands on the next character of the text.
7FA1
LD A,(HL) 7E
Load Register A with the byte Register Pair HL stands on, that character.
7FA2
CP 20H FE 20
Compare Register A with 20H, a space, which @ERROR puts in front of some of its messages.
7FA4
Jump to 7FA0H on Z, a space standing there, which steps past it.
7FA6
Call 4621H, which takes string space for the 00H ended text Register Pair HL stands on, copies it in and leaves its descriptor in the accumulator.
7FA9
POP HL E1
Pop Register Pair HL, the text pointer this routine pushed at 7F54H.
7FAA
RET C9
Return to the evaluator with the DOS's own message in the accumulator as a string.
7FAB
The record number reader (7FABH), which PUT and GET call at 4FEEH: call 5E93H, NXTCHAR, which steps the text pointer past the comma the statement has just matched.
7FAE
Call 7345H, the evaluator, which works the record number out into the accumulator.
7FB1
PUSH HL E5
Push Register Pair HL, the text pointer standing after it, which the conversions below destroy.
7FB2
Call 2A6AH of BASIC/OV1, which makes the value in the accumulator a single precision number and gives error 13, Type mismatch, through 5884H for a string.
7FB5
Call 28C4H of BASIC/OV1, which reads the exponent at 72EFH and the high byte at 72EEH and answers with the Sign Flag set for a negative value.
7FB8
Jump to 7FC7H on M, the number being negative, which is the SCF hidden in the operand below and so refuses it.
7FBB
LD A,(72EFH) 3A EF 72
Load Register A with the byte at 72EFH, the exponent of the value in the accumulator.
7FBE
CP 91H FE 91
Compare Register A with 91H, the exponent of 65536, which is one more than the largest record number a sixteen bit field can hold.
7FC0
Jump to 7FC7H on NC, the number being 65536 or more, which refuses it the same way.
7FC2
Call 2AB7H of BASIC/OV1, which turns the value into a sixteen bit number in Register Pair DE, answering 0000H at once when Register A, the exponent, is 00H.
7FC5
XOR A AF
Exclusive or Register A with itself, which clears the Carry Flag, the answer that says the number was taken.
7FC6
LD A,37H 3E 37
Load Register A with 37H, which changes no flag and is read for its operand byte: 7FC7H stands as an SCF and is where the two refusals above jump.
7FC8
POP HL E1
Pop Register Pair HL, the text pointer this routine pushed at 7FB1H.
7FC9
RET C9
Return with the record number in Register Pair DE and the Carry Flag clear, or with it set when 7FC7H was entered and the number is not to be used.

7FCAH - NAME: Rename a File on the Diskette (7FCAH-7FECH)

NAME is the shortest of the file statements and it does the whole of its work with two calls to the filespec reader and one supervisor call. The two filespecs are read into the buffers at 7037H and 7057H, which stand just below INBUF 7039H and give each name 32 bytes, and the word AS between them is spelled out letter by letter through 4353H exactly as FIELD spells it at 4DECH. Then @RENAME is given the first name in Register Pair DE and the second in Register Pair HL, the two addresses being 7039H and 7059H, two bytes into each buffer, because the first two bytes of each are the drive and flag bytes 508CH fills in. An error from the DOS goes to DERR at 5282H, so a name that is already taken or a file that is not there is reported as a BASIC error and not as a DOS message. The statement renames a file and nothing else: it cannot move a file between drives, because @RENAME takes one directory entry and one new name.

7FCA
LD BC,7037H 01 37 70
NAME (7FCAH), the routine the statement address table holds for token 0C7H at 684FH: load Register Pair BC with 7037H, the buffer the first filespec is to be read into, which lies just below INBUF 7039H.
7FCD
Call 508CH, the filespec reader, which works the string out, insists it is a string, and lays the name into the buffer Register Pair BC names with the drive and flag bytes in front of it.
7FD0
Call 4353H, which insists that the character the text pointer stands on is the one in the byte standing after this call and gives Syntax error at 4362H when it is not.
7FD3
DEFB 41H 41
The letter A, the first letter of the word AS, read as data by the routine the call at 7FD0H reaches, not executed; the instruction after that call is the one at 7FD4H.
7FD4
Call 4353H for the second letter of the keyword, after which the text pointer stands on the second filespec.
7FD7
DEFB 53H 53
The letter S, the second letter of AS, data for the call at 7FD4H and not an instruction; the instruction after that call is the one at 7FD8H.
7FD8
LD BC,7057H 01 57 70
Load Register Pair BC with 7057H, the buffer the second filespec is to be read into, 32 bytes above the first.
7FDB
Call 508CH again, which lays the new name into that buffer the same way.
7FDE
PUSH HL E5
Push Register Pair HL, the text pointer standing after the second filespec, which the POP HL at 7FEBH brings back.
7FDF
LD DE,7039H 11 39 70
Load Register Pair DE with 7039H, two bytes into the first buffer, which is where the name itself begins: the two bytes below it are what 508CH wrote for the drive.
7FE2
LD HL,7059H 21 59 70
Load Register Pair HL with 7059H, two bytes into the second buffer, where the new name begins.
7FE5
LD A,38H 3E 38
Load Register A with 38H, 56, the number of @RENAME, the supervisor call that writes a new name into a file's directory entry.
7FE7
RST 28H EF
Issue RST 28H, calling @RENAME at 1996H, which finds the file named by Register Pair DE and gives it the name Register Pair HL addresses.
7FE8
Jump to DERR at 5282H on NZ, which keeps the DOS's own code at 7C4EH and turns it into a BASIC error: a file that is not there, a name already taken or a protected diskette is reported this way.
7FEB
POP HL E1
Pop Register Pair HL, the text pointer pushed at 7FDEH.
7FEC
RET C9
Return to the statement loop at 5E3BH, the file having been renamed.

7FEDH - The File Buffers Measured and Laid Out (7FEDH-8027H)

Fifty-nine bytes that settle how much memory BASIC keeps for itself. A file buffer is 564 bytes, 0234H, and the interpreter takes one for each file the FILES parameter asked for and one more, which is the buffer a LOAD or a MERGE uses and which is why the count at 6ECEH is incremented in both routines here and in 4291H. 7FEDH measures, taking 564 off Register Pair HL once for each and answering with the Carry Flag set when they all fit below it, and CLEAR calls it at 44D0H and BEGIN at 8478H. 7FFBH lays them out, from the byte above BASEND upwards, writing each buffer's address into the table at 6EAEH as it goes, and CLEAR calls it at 44F0H and BEGIN at 84BEH. The address of the first is kept in 6EACH as well, which 4C58H and 5A55H read when they want the buffer the interpreter keeps for itself. 8017H is a third thing entirely, standing here because the bytes were to hand: it ors the byte 520AH left at 521DH into the protected program flag at 72CBH and clears 521DH, so a program loaded from a protected file is protected the moment the load ends, and the four places that call it are 41D2H, 41E5H, 4CC3H and 5693H.

7FED
LD BC,0FDCCH 01 CC FD
The file buffers measured (7FEDH), which CLEAR calls at 44D0H and BEGIN at 8478H: load Register Pair BC with 0FDCCH, which is 564 taken away, the length of one file buffer expressed as a negative number so that the addition below is a subtraction.
7FF0
LD A,(6ECEH) 3A CE 6E
Load Register A with the byte at 6ECEH, the count of file buffers the FILES parameter asked for.
7FF3
INC A 3C
Increment Register A, which adds the one buffer the interpreter keeps for a LOAD or a MERGE over and above the program's own.
7FF4
ADD HL,BC 09
The loop (7FF4H), which 7FF7H goes back to: add Register Pair BC to Register Pair HL, which takes 564 bytes off the address and sets the Carry Flag when the result is still above 0000H.
7FF5
RET NC D0
Return on NC, the subtraction having run below 0000H, with the Carry Flag clear, which is the answer that says the buffers will not fit.
7FF6
DEC A 3D
Decrement Register A, the count of buffers still to be taken off.
7FF7
Jump to 7FF4H on NZ, there being another buffer to allow for, which takes its 564 bytes off as well.
7FF9
SCF 37
Set the Carry Flag, every buffer having fitted, which is the answer CLEAR and BEGIN read as success.
7FFA
RET C9
Return with Register Pair HL standing 564 bytes times the count below where it came in and the Carry Flag set.
7FFB
LD HL,(6E9AH) 2A 9A 6E
The file buffers laid out (7FFBH), which CLEAR calls at 44F0H and BEGIN at 84BEH: load Register Pair HL from the word at 6E9AH, BASEND, the top of the memory BASIC was given.
7FFE
INC HL 23
Increment Register Pair HL, so that it stands on the byte above that top, which is where the first buffer begins.
7FFF
LD (6EACH),HL 22 AC 6E
Store Register Pair HL into the word at 6EACH, where 4C58H and 5A55H read the address of the buffer the interpreter keeps for itself.
8002
LD DE,6EAEH 11 AE 6E
Load Register Pair DE with 6EAEH, the table of buffer addresses, one word for each buffer.
8005
LD BC,0234H 01 34 02
Load Register Pair BC with 0234H, 564, the length of one file buffer, which steps the address from one to the next.
8008
LD A,(6ECEH) 3A CE 6E
Load Register A with the byte at 6ECEH, the count of file buffers the FILES parameter asked for.
800B
INC A 3C
Increment Register A, which adds the one the interpreter keeps for a LOAD or a MERGE, so the table holds one word more than the program asked for.
800C
EX DE,HL EB
The loop (800CH), which 8014H goes back to: exchange Register Pair DE with Register Pair HL, which puts the place in the table into Register Pair HL and the buffer's address into Register Pair DE.
800D
LD (HL),E 73
Store Register E into the byte Register Pair HL stands on, the low byte of this buffer's address.
800E
INC HL 23
Increment Register Pair HL, so that it stands on the high byte of this entry.
800F
LD (HL),D 72
Store Register D into the byte Register Pair HL stands on, the high byte of this buffer's address.
8010
INC HL 23
Increment Register Pair HL, so that it stands on the low byte of the next entry of the table.
8011
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL a second time, which puts the place in the table back into Register Pair DE and the buffer's address back into Register Pair HL.
8012
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, 564 bytes, which makes Register Pair HL the address of the next buffer.
8013
DEC A 3D
Decrement Register A, the count of buffers still to be written into the table.
8014
Jump to 800CH on NZ, there being another buffer, which writes its address in as well.
8016
RET C9
Return with every buffer's address in the table at 6EAEH and the first of them in 6EACH.
8017
PUSH AF F5
The protection carried over (8017H), which 41D2H, 41E5H, 4CC3H and 5693H call: push Register Pair AF, the caller's own value, which the arithmetic below writes.
8018
PUSH HL E5
Push Register Pair HL, the caller's own pointer, for the same reason.
8019
LD HL,72CBH 21 CB 72
Load Register Pair HL with 72CBH, the protected program flag, which 57E8H reads to refuse a LIST.
801C
LD A,(521DH) 3A 1D 52
Load Register A with the byte at 521DH, where 520AH kept bit 1 of SFLAG$ as a whole byte after a LOAD or a MERGE opened a file for input.
801F
OR (HL) B6
Or Register A with the byte Register Pair HL stands on, the protection flag as it stands, so that a protection already set is not lost.
8020
LD (HL),A 77
Store Register A into the byte Register Pair HL stands on, the protection flag with the open's own answer in it.
8021
XOR A AF
Exclusive or Register A with itself, which makes it 00H.
8022
LD (521DH),A 32 1D 52
Store Register A, 00H, into the byte at 521DH, which clears the open's answer so that the next load starts from nothing.
8025
POP HL E1
Pop Register Pair HL, which brings the caller's own pointer back into that pair.
8026
POP AF F1
Pop Register Pair AF, which brings the caller's own value back into Register A and its flags.
8027
RET C9
Return with the protection of the file just loaded standing in 72CBH.

8028H - STARTUP and the Last Four Bytes of Module 1 (8028H-8047H)

STARTUP 8028H is the name newb.asm gives the last piece of module 1's code, and it is where the start-up ends and the interpreter begins. Module 2's BEGIN reaches it after it has laid out memory, and it does three things: it clears the variables and closes the files through 42A4H, it puts a 00H in the byte below the program text so that an empty program reads as empty, and then it looks at the filespec pointer at 8046H. With nothing there it jumps to READY 5920H, which is the ordinary start of an interactive session. With a filespec there it plants a quote and jumps to 4C20H, LOAD's second entry, so that the program named on the DOS command line is loaded and run: that is the whole of how BASIC PROG/BAS works, and it is LOAD's own code that does it, not a routine of the start-up's. The four bytes at 8044H to 8047H are the last of module 1 and they are data, not code: DOSCLIN 8044H, which newb.asm names and which holds the pointer to the DOS command line as the start-up found it, and the filespec pointer at 8046H, which @FSPEC left when it read a program name off that line. Both are 0000H in the file. They are also why newb.asm calls 8048H the end of BASIC before the package: module 1's code stops at 8043H, these four bytes follow it, and from 8048H up is the start-up code that the enhancement is installed over.

8028
STARTUP (8028H), the name newb.asm gives it, which module 2's BEGIN reaches when the start-up is done: call 42A4H, which marks every file buffer unused through 4291H, closes every open file through 4DB8H, and falls into the program clear at 42B1H so that the variables and the program text both start empty.
802B
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL from the word at 6E9EH, PGMBGN, the address the program text begins at, which BEGIN pinned at 83EDH so that the user's program reclaims the start-up code.
802E
DEC HL 2B
Decrement Register Pair HL to the byte below the program text, which the statement loop and FIND both expect to hold 00H.
802F
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL addresses, which is the byte a text pointer stands on before the first line is read.
8031
LD HL,(8046H) 2A 46 80
Load Register Pair HL from the word at 8046H, the filespec pointer, which @FSPEC left at 808FH when the start-up read a program name off the DOS command line, and which is 0000H when the line named none.
8034
LD A,H 7C
Load Register A from Register H, the high byte of that pointer.
8035
OR L B5
OR Register A with Register L, its low byte, so that the Zero Flag is set only when no program was named.
8036
Jump to READY 5920H on Z, nothing having been named on the DOS command line, which prints the prompt and drops into command level: this is the ordinary interactive start of BASIC.
8039
LD (HL),00H 36 00
Store 00H into the byte Register Pair HL addresses, which ends the filespec in the command line buffer so that the load below reads only the name.
803B
LD HL,(8044H) 2A 44 80
Load Register Pair HL from the word at 8044H, DOSCLIN, the pointer to the DOS command line as the start-up found it.
803E
DEC HL 2B
Decrement Register Pair HL to the byte below the filespec on that line.
803F
LD (HL),22H 36 22
Store 22H into the byte Register Pair HL addresses, a quote, which makes the command line read as a quoted string so that LOAD's own filespec reader takes it exactly as it would take one typed in a program.
8041
Jump to 4C20H, LOAD's second entry, which is the operand byte of the OR at 4C20H and sets the run flag, so that a program named on the DOS command line is loaded and run. Nothing of this start-up does the loading: LOAD does all of it, and its tail at 4CC6H reads the run flag at 6EA8H and starts the program.
8044-8045
DEFW 0000H 00 00
DOSCLIN, the two bytes newb.asm names, which hold the pointer to the DOS command line as the start-up found it. The start-up at 8055H writes the Register Pair HL the DOS gave it here, 803BH reads it back, and the enhancement's own BEGIN reads it at 8341H and 833CH. 0000H in the file.
8046-8047
DEFW 0000H 00 00
The filespec pointer, which the start-up's @FSPEC writes at 808FH when a program name stands on the DOS command line, and which 8031H reads to choose between the prompt and a load. These are the last two bytes of module 1's own image: 8048H above them is the start-up code the enhancement package is installed over. 0000H in the file.

8048H - SVCUSR: the USR11 Supervisor Call

The enhancement package begins at 8048H, which is the transfer address the first module carried before MAKBAS/CMD wrote the package over it, so the package starts exactly where the first module's own start-up code stood. The routine here is SVCUSR, reached from the patch at 7715H, and it gives a BASIC program a way to issue any supervisor call of the DOS: USR11 with an integer array as its argument. The array holds the supervisor call number and the registers to pass in, SVCUSR loads the Z80 registers from the array, issues RST 28H and writes the registers the call returns back into the same array. The stack is moved twice while this happens, and the two addresses it is kept at, 80A0H-80A1H and 80A6H-80A7H, are the operand bytes of the LD SP instructions at 809FH and 80A5H, so this routine writes its own operands as it runs.

8048SVCUSR
SVCUSR (8048H), the first loaded byte of the NEWB module: call NXTCHAR at 5E93H, the first module's routine that takes the next character of the BASIC line being interpreted, so the character after the USR number has been read before anything else is done.
804B
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, which clears the value SVCUSR hands back to the interpreter as the result of the USR function when the call is not its own.
804E
PUSH AF F5
Push Register AF, saving the character NXTCHAR at 5E93H returned in Register A, because Register A is needed to hold the USR number next.
804F
LD A,(7149H) 3A 49 71
Load Register A from 7149H, the cell of the first module that holds the number of the USR function the program called.
8052
CP 0BH FE 0B
Compare Register A with 0BH, the number 11, which is the USR function the enhancement package answers.
8054
Jump to SVC1 at 805AH when Register A held 0BH, which is the call the package takes.
8056
POP AF F1
Pop Register AF, bringing back the character that NXTCHAR at 5E93H returned, because the first module expects it in Register A.
8057
Jump to 773AH, the point in the first module's USR dispatch that follows the three bytes this patch replaced at 7715H, so a USR number other than 11 is answered by the first module as it always was.
805ASVC1
POP AF F1
SVC1 (805AH): pop Register AF, which takes the saved character off the stack and leaves the stack as the interpreter left it.
805B
Call NXTCHAR at 5E93H a second time, taking the next character of the BASIC line, which is what the first module does at this point in a USR call.
805E
LD DE,8062H 11 62 80LD DE,SVCADDR
Load Register Pair DE with 8062H, the address of the word at SVCADDR that holds the address of the routine to execute.
8061
RET C9
Return to the first module's USR dispatch with Register Pair DE holding 8062H, from where the first module calls the routine whose address is stored there.
8062-8063SVCADDR
DEFW 8064H 64 80
SVCADDR (8062H-8063H): the address of SVCEXEC at 8064H, stored as a word because the first module's USR dispatch takes the address of the routine to run from the word that Register Pair DE points at.
8064SVCEXEC
PUSH DE D5
SVCEXEC (8064H): push Register Pair DE, saving the value the first module's USR dispatch left in it.
8065
PUSH HL E5
Push Register Pair HL, saving the pointer the first module left in it, which points at the word holding the address of the argument's value.
8066
LD E,(HL) 5E
Load Register E from the byte Register Pair HL points at, the low byte of the address of element zero of the integer array passed as the argument.
8067
INC HL 23
Increment Register Pair HL to point at the high byte of that address.
8068
LD D,(HL) 56
Load Register D from the byte Register Pair HL points at, the high byte of the address of element zero of the array.
8069
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, so Register Pair HL now points at element zero of the array and Register Pair DE holds the pointer that was in Register Pair HL.
806A
PUSH HL E5
Push Register Pair HL, saving the address of element zero of the array over the test of the array's type that follows.
806B
LD DE,0009H 11 09 00
Load Register Pair DE with 0009H, the distance back from element zero of an array to the byte that holds the array's type.
806E
OR A B7
Clear the Carry Flag with OR A on Register A, which the subtraction that follows needs.
806F
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL, leaving Register Pair HL pointing at the type byte nine bytes below element zero of the array.
8071
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the type of the array.
8072
POP HL E1
Pop Register Pair HL, bringing back the address of element zero of the array.
8073
CP 02H FE 02
Compare Register A with 02H, the type of an integer array, which is the only kind of array SVCEXEC accepts.
8075
Jump to FUNCERR at 5F95H when the type was not 02H, which prints Illegal function call and ends the statement. This jump is the end of the whole of SVCUSR's checking: the array's type has been weighed and its size has not, and the twelve bytes read and written from element zero up are taken on trust, which is B295.
8078
LD A,(0069H) 3A 69 00LD A,(OVRLY$)
Load Register A from OVRLY$ at 0069H, the cell that says which overlay is resident in the overlay area at 1E00H.
807B
CP 01H FE 01
Compare Register A with 01H, the value that says BASIC/OV2 is the image resident at 1E00H.
807D
Jump to SVC2 at 8083H when 0069H did not hold 01H, which leaves the cell alone.
807F
XOR A AF
Clear Register A with XOR A, making 00H, the value that says no overlay is resident at 1E00H.
8080
LD (0069H),A 32 69 00LD (OVRLY$),A
Store Register A in OVRLY$ at 0069H, so that BASIC/OV2 is no longer taken for resident: the supervisor call about to be issued may load a DOS overlay over it at 1E00H, and BASIC reads this cell to decide whether it must load BASIC/OV2 again.
8083SVC2
LD A,(HL) 7E
SVC2 (8083H): load Register A from the byte Register Pair HL points at, the low byte of element zero of the array, which holds the number of the supervisor call to issue.
8084
OR A B7
Test Register A with OR A, setting the Zero Flag when the supervisor call number is 00H, which is @IPL.
8085
Jump to FUNCERR at 5F95H when the number was 00H, so that a BASIC program cannot issue @IPL and restart the system.
8088
CP 80H FE 80
Compare Register A with 80H, one past the highest supervisor call number the DOS answers.
808A
Jump to FUNCERR at 5F95H when the number was 80H or more, which prints Illegal function call.
808D
LD (80A0H),SP ED 73 A0 80LD (STAK1),SP
Store the Stack Pointer in 80A0H, which is the operand of the LD SP instruction at 809FH: the interpreter's own stack is written into the instruction that will put it back.
8091
DI F3
Disable interrupts with DI, because the Stack Pointer is about to be moved into the array and an interrupt taken there would write over the array's elements.
8092
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, pointing the stack at element zero of the array so that the registers can be loaded from the array with POP instructions.
8093
POP HL E1
Pop Register Pair HL, which reads element zero, the supervisor call number, and steps past it; the value is discarded because Register A already holds the number.
8094
POP HL E1
Pop Register Pair HL, loading it from element one of the array.
8095
POP DE D1
Pop Register Pair DE, loading it from element two of the array.
8096
POP BC C1
Pop Register Pair BC, loading it from element three of the array.
8097
POP IY FD E1
Pop Index Register IY, loading it from element four of the array.
8099
POP IX DD E1
Pop Index Register IX, loading it from element five of the array, the last of the six words the array must hold.
809B
LD (80A6H),SP ED 73 A6 80LD (RETSTK),SP
Store the Stack Pointer in 80A6H, which is the operand of the LD SP instruction at 80A5H: the position reached in the array, just past element five, is written into the instruction that will come back to it.
809F
LD SP,0000H 31 00 00
Load the Stack Pointer with the word at 80A0H-80A1H, the interpreter's own stack saved there by the instruction at 808DH; the two operand bytes hold 0000H in the file and are written as the routine runs.
80A2
EI FB
Enable interrupts with EI, because the stack is the interpreter's again and the supervisor call must be issued with interrupts on.
80A3
RST 28H EF
RST 28H, the supervisor call of the DOS, which carries out the function numbered in Register A with the registers loaded from the array.
80A4
DI F3
Disable interrupts with DI, because the Stack Pointer is about to be moved back into the array.
80A5
LD SP,0000H 31 00 00
Load the Stack Pointer with the word at 80A6H-80A7H, the position in the array saved there by the instruction at 809BH; the two operand bytes hold 0000H in the file and are written as the routine runs.
80A8
PUSH IX DD E5
Push Index Register IX, writing it into element five of the array as the supervisor call returned it.
80AA
PUSH IY FD E5
Push Index Register IY, writing it into element four of the array.
80AC
PUSH BC C5
Push Register Pair BC, writing it into element three of the array.
80AD
PUSH DE D5
Push Register Pair DE, writing it into element two of the array.
80AE
PUSH HL E5
Push Register Pair HL, writing it into element one of the array.
80AF
PUSH AF F5
Push Register AF, writing it into element zero of the array, which the supervisor call number was read from: the number the program put there is replaced by the Accumulator and the flags the call returned.
80B0
LD SP,(80A0H) ED 7B A0 80LD SP,(STAK1)
Load the Stack Pointer with the word at 80A0H-80A1H, the interpreter's stack, which the instruction at 808DH saved there.
80B4
EI FB
Enable interrupts with EI, the stack being the interpreter's again.
80B5
POP HL E1
Pop Register Pair HL, bringing back the pointer saved at 8065H.
80B6
POP DE D1
Pop Register Pair DE, bringing back the value saved at 8064H.
80B7
RET C9
Return to the first module's USR dispatch with Register Pair BC holding 0000H from 804BH, which is the value the USR function gives back to the BASIC program.

80B8H - IMMED: the Immediate Commands

IMMED is reached from the patch at 5990H, which the enhancement package wrote over three bytes of the first module at the point where the first module is about to read a line from the keyboard at command level. IMMED reads one key with @KEY, supervisor call 1, instead of a whole line, so that a single keystroke can stand for a command: the up arrow 0BH lists the line before the current one, the down arrow 0AH the line after it, a full stop 2EH the current line, a comma 2CH edits the current line, the left arrow 08H lists the first line of the program and the right arrow 09H the last. A key that is none of those is put in the keyboard input buffer INBUF at 7039H and IMMED hands the rest of the line to @KEYIN, supervisor call 9, entered two bytes past its start so that the buffer pointer it is given is kept, with the return address set to IMBACK at 7E2AH, which is the instruction of the first module that follows its own @KEYIN call at 7E29H. IMMED steps aside in two cases: the byte at SFLAG$ has bit 5 set, which says a Job Control Language file is supplying the input, and the word at FILEX 6E98H is not 0000H, which says a file operation of the first module is in progress. The address IMMED reads the flag byte from is not in the file: the operand at 80B9H and 80BAH holds 0000H as the file is loaded, and BEGIN writes the address of SFLAG$ into it at 84E5H.

80B8IMMED
LD A,(0000H) 3A 00 00
IMMED (80B8H), the entry from the patch at 5990H: load Register A from the byte whose address stands in the operand at 80B9H and 80BAH, which is SFLAG$ at 007CH, the system flag byte. The two operand bytes hold 0000H in the file, because NEWB/ASM declares them as the label SFLAG1 with no address of their own, and BEGIN writes the address of SFLAG$ into them at 84E5H before any BASIC line is read.
80BB
BIT 5,A CB 6F
Test bit 5 of Register A, which is the bit of SFLAG$ that the DOS sets while a Job Control Language file is supplying the input in place of the keyboard.
80BD
Jump to 7E1BH when bit 5 of SFLAG$ was set, which is the first module's own line input path: it reads a whole line with @KEYIN, supervisor call 9, and takes no immediate command, because a Job Control Language file sends its lines a character at a time and a single keystroke would be read out of the file.
80C0
LD HL,7039H 21 39 70LD HL,INBUF
Load Register Pair HL with 7039H, the address of INBUF, the keyboard input buffer of the first module that a typed BASIC line is built in.
80C3
Call 45DFH, the routine of the first module that loads Register Pair HL from the word at FILEX 6E98H, sets the Zero Flag from Register H ORed with Register L and puts Register Pair HL back, so the Zero Flag comes back set when the word at 6E98H holds 0000H.
80C6
Jump to 7E42H when the word at FILEX 6E98H was not 0000H, which says the first module has a file control block in hand for a file operation, so the line is taken by the first module and no immediate command is read.
80C9
LD C,0EH 0E 0E
Load Register C with 0EH, the control code of the video driver that turns the cursor on, which @DSP at 0642H sends to the display.
80CB
LD A,02H 3E 02
Load Register A with 02H, the number of @DSP, the supervisor call that puts the character in Register C on the display.
80CD
RST 28H EF
Issue RST 28H, calling @DSP at 0642H with Register C holding 0EH, so the cursor is on the screen before the key is waited for.
80CE
LD BC,0F900H 01 00 F9
Load Register Pair BC with 0F900H, which gives Register B the buffer length 0F9H, 249 characters, that the line input routine is to accept, and Register C the value 00H.
80D1REDO
PUSH DE D5
REDO (80D1H), the point the code comes back to after the screen has been cleared: push Register Pair DE, saving the value the first module left in it over the supervisor call that follows.
80D2
LD A,01H 3E 01
Load Register A with 01H, the number of @KEY, the supervisor call that waits for one key and returns it in Register A.
80D4
RST 28H EF
Issue RST 28H, calling @KEY at 0628H, which waits for a single keystroke and comes back with the character in Register A and the Zero Flag reset on a device error.
80D5
POP DE D1
Pop Register Pair DE, bringing back the value saved at 80D1H, because the first module needs it when IMMED gives the line back.
80D6
Jump to DERR at 5282H when @KEY came back with the Zero Flag reset, which prints the error the supervisor call returned and ends the statement.
80D9
LD C,0DH 0E 0D
Load Register C with 0DH, the carriage return that stands as the character to display when the key read turns out to be a break.
80DB
CP 80H FE 80
Compare Register A with 80H, the value @KEY at 0628H returns for the BREAK key.
80DD
Jump to WASBC at 80EDH when Register A held 80H, which is the path that gives the break back to the first module.
80DF
LD C,A 4F
Load Register C from Register A, putting the character read into the register @DSP takes it from.
80E0
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return, which is ENTER pressed on its own with nothing typed before it.
80E2
Jump to WASBC at 80EDH when Register A held 0DH, so ENTER on its own is given back to the first module the same way a break is.
80E4
CP 1FH FE 1F
Compare Register A with 1FH, the character the keyboard driver returns for SHIFT with CLEAR, which is the request to clear the screen.
80E6
Jump to NOBRK@ at 80F4H when Register A was not 1FH, which is the test of the key against the six immediate commands.
80E8
LD A,69H 3E 69
Load Register A with 69H, 105, the number of @CLS, the supervisor call at 0545H that clears the display and homes the cursor.
80EA
RST 28H EF
Issue RST 28H, calling @CLS at 0545H, which clears the screen because SHIFT with CLEAR was pressed.
80EB
Jump back to REDO at 80D1H, which waits for another key, so SHIFT with CLEAR clears the screen and leaves IMMED waiting at the same point.
80EDWASBC
PUSH AF F5
WASBC (80EDH), reached from 80DDH on a break and from 80E2H on ENTER alone: push Register AF, saving the character in Register A and the flags over the supervisor call that follows.
80EE
LD A,02H 3E 02
Load Register A with 02H, the number of @DSP, the supervisor call that displays the character in Register C.
80F0
RST 28H EF
Issue RST 28H, calling @DSP at 0642H with Register C holding 0DH from 80D9H, which moves the cursor to the start of the next line.
80F1
POP AF F1
Pop Register AF, bringing back the character and the flags saved at 80EDH, because the first module reads the character from Register A.
80F2
SCF 37
Set the Carry Flag with SCF, which is how IMMED tells the first module that the line input ended in a break rather than a typed line.
80F3
RET C9
Return to the patch at 5990H with the Carry Flag set and Register A holding the character, so the first module takes the break as though its own line input had read it.
80F4NOBRK@
PUSH DE D5
NOBRK@ (80F4H), reached from 80E6H when the key is not SHIFT with CLEAR: push Register Pair DE, saving the value the first module left in it.
80F5
PUSH AF F5
Push Register AF, saving the character read in Register A together with the flags, which the code reads back from the stack at 8142H as Register Pair DE and at 8179H as Register Pair BC.
80F6
LD DE,(7192H) ED 5B 92 71LD DE,(CURLIN)
Load Register Pair DE from the word at CURLIN 7192H, the number of the line BASIC is positioned at. Every path that reaches FNDLIN at 813FH loads Register Pair DE again, CLINE at 813BH from the same word and 810EH with 0FFFFH, and the paths that do not reach FNDLIN pop Register Pair DE back, so the four bytes here leave nothing behind.
80FA
CP 0BH FE 0B
Compare Register A with 0BH, the character the keyboard driver returns for the up arrow, which asks for the line before the current one.
80FC
Jump to CLINE at 813BH when Register A held 0BH, which looks the current line up and then steps back to the line before it.
80FE
CP 0AH FE 0A
Compare Register A with 0AH, the character of the down arrow, which asks for the line after the current one.
8100
Jump to CLINE at 813BH when Register A held 0AH, which looks the current line up and then takes the line after it.
8102
CP 2EH FE 2E
Compare Register A with 2EH, the full stop, which asks for the current line to be listed.
8104
Jump to CLINE at 813BH when Register A held 2EH, which looks the current line up and lists it.
8106
CP 2CH FE 2C
Compare Register A with 2CH, the comma, which asks for the current line to be edited.
8108
Jump to CLINE at 813BH when Register A held 2CH, which looks the current line up and hands it to the editor at DOEDIT 3D27H.
810A
CP 08H FE 08
Compare Register A with 08H, the character of the left arrow, which asks for the first line of the program.
810C
Jump to DOFRST at 8136H when Register A held 08H, which takes the program start from PGMBGN 6E9EH without searching for a line number.
810E
LD DE,0FFFFH 11 FF FF
Load Register Pair DE with 0FFFFH, the highest line number BASIC allows, which makes the line search that follows run to the end of the program.
8111
CP 09H FE 09
Compare Register A with 09H, the character of the right arrow, which asks for the last line of the program.
8113
Jump to FNDLIN at 813FH when Register A held 09H, which searches for line number FFFFH and so stops at the end of the program.
8115
CP 20H FE 20
Compare Register A with 20H, the space, which is the lowest character that is not a control code.
8117
Jump to NCTRL at 811DH when Register A held 20H or more, which is the path that puts a typed character in the buffer and lets the line be typed out.
8119
POP AF F1
Pop Register AF, discarding the character saved at 80F5H, because a control code that is none of the six immediate commands is thrown away.
811A
POP DE D1
Pop Register Pair DE, bringing back the value saved at 80F4H, which leaves the stack as the first module left it.
811B
Jump back to REDO at 80D1H, which waits for another key, so a control code that means nothing here is ignored and the cursor stays where it is.
811DNCTRL
LD (HL),A 77
NCTRL (811DH), reached from 8117H with a character of 20H or more: store Register A in the byte Register Pair HL points at, the first position of INBUF at 7039H, so the character typed becomes the first character of the line.
811E
LD C,A 4F
Load Register C from Register A, putting the character into the register @DSP takes it from, so that it is shown on the screen at the place the cursor stands.
811F
LD A,02H 3E 02
Load Register A with 02H, the number of @DSP, the supervisor call that displays the character in Register C.
8121
RST 28H EF
Issue RST 28H, calling @DSP at 0642H, which puts the character typed on the display and moves the cursor one place on.
8122
POP AF F1
Pop Register AF, discarding the character and flags saved at 80F5H, which are no longer wanted now that the character is in the buffer.
8123
POP DE D1
Pop Register Pair DE, bringing back the value saved at 80F4H, which the first module needs when the line is handed back.
8124
LD C,B 48
Load Register C from Register B, giving Register C the buffer length 0F9H that 80CEH put in Register B, which is the count @KEYIN works from.
8125
DEC B 05
Decrement Register B to 0F8H, 248, because the first of the 249 characters the buffer holds has been typed and stored at 811DH.
8126
PUSH DE D5
Push Register Pair DE, putting the value the first module left in it on the stack, which is where the first module expects to find it when @KEYIN returns to IMBACK at 7E2AH.
8127
PUSH HL E5
Push Register Pair HL, saving the pointer to the first position of INBUF at 7039H over the loading of the return address.
8128
LD HL,7E2AH 21 2A 7ELD HL,IMBACK
Load Register Pair HL with 7E2AH, the address NEWB/ASM names IMBACK, which is the instruction of the first module that follows its own @KEYIN call at 7E29H.
812B
EX (SP),HL E3
Exchange the word at the top of the stack, the word the Stack Pointer addresses, with Register Pair HL, which leaves 7E2AH on the stack as the address @KEYIN is to return to and brings the INBUF pointer back into Register Pair HL.
812C
PUSH HL E5
Push Register Pair HL, putting the address of the first position of INBUF at 7039H on the stack, which is the pointer @KEYIN gives back in Register Pair HL when the line is complete.
812D
INC HL 23
Increment Register Pair HL to 703AH, the second position of INBUF, which is where the rest of the line is to be typed because the first character is already stored.
812E
PUSH HL E5
Push Register Pair HL, saving the pointer to 703AH over the reading of the @KEYIN address from the supervisor call table.
812F
LD HL,(0112H) 2A 12 01
Load Register Pair HL from the word at 0112H, which is word 9 of SVCTAB$ at 0100H and holds 0585H, the address of @KEYIN.
8132
INC HL 23
Increment Register Pair HL to 0586H, stepping past the PUSH HL at 0585H that @KEYIN uses to save the buffer pointer it is given.
8133
INC HL 23
Increment Register Pair HL to 0587H, stepping past the LD C,B at 0586H as well, so that the buffer pointer pushed at 812CH and the count loaded at 8124H are the ones @KEYIN works with.
8134
EX (SP),HL E3
Exchange the word at the top of the stack, the word the Stack Pointer addresses, with Register Pair HL, which leaves 0587H on the stack as the address to enter and brings the pointer to 703AH back into Register Pair HL.
8135
RET C9
Return, which takes 0587H off the stack and enters @KEYIN three bytes into the routine with Register Pair HL pointing at 703AH, Register C holding the count and the address of INBUF and IMBACK at 7E2AH below it on the stack.
8136DOFRST
LD HL,(6E9EH) 2A 9E 6ELD HL,(PGMBGN)
DOFRST (8136H), reached from 810CH when the left arrow was pressed: load Register Pair HL from the word at PGMBGN 6E9EH, the address of the first line of the BASIC program in memory.
8139
Jump to USEHL at 8179H, which takes the line Register Pair HL points at without any search, because the first line of the program is where PGMBGN already points.
813BCLINE
LD DE,(7192H) ED 5B 92 71LD DE,(CURLIN)
CLINE (813BH), reached from 80FCH, 8100H, 8104H and 8108H: load Register Pair DE from the word at CURLIN 7192H, the number of the line BASIC is positioned at, which is the line number the search that follows is given.
813FFNDLIN
FNDLIN (813FH), also reached from 8113H with Register Pair DE holding 0FFFFH: call FIND at 5AB4H, the routine of the first module that searches the program for the line number in Register Pair DE and comes back with the Carry Flag set and Register Pair HL and Register Pair BC pointing at the line when it is found.
8142
POP DE D1
Pop Register Pair DE, which takes off the stack the word pushed as Register AF at 80F5H, so Register D holds the character read and Register E the flags that went with it.
8143
PUSH DE D5
Push Register Pair DE, putting that word straight back on the stack, because the character is wanted again at 8179H and only Register D is read here.
8144
LD A,D 7A
Load Register A from Register D, the character that was read, which the tests that follow compare against the immediate commands.
8145
Jump to NOTFND at 815BH when FIND at 5AB4H came back with the Carry Flag reset, which says the line number searched for is not in the program.
8147
CP 2EH FE 2E
Compare Register A with 2EH, the full stop, which asked for the current line to be listed.
8149
Jump to USEBC at 8177H when Register A held 2EH, which takes the line FIND at 5AB4H left in Register Pair BC, the current line itself.
814B
CP 2CH FE 2C
Compare Register A with 2CH, the comma, which asked for the current line to be edited.
814D
Jump to USEBC at 8177H when Register A held 2CH, which takes the current line so that the editor at DOEDIT 3D27H is given it.
814F
CP 0AH FE 0A
Compare Register A with 0AH, the character of the down arrow, which asked for the line after the current one.
8151
Jump to CKUP at 815DH when Register A was not 0AH, which leaves only the up arrow to account for.
8153
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the low byte of the pointer to the next line that stands in the first two bytes of the line FIND at 5AB4H stopped on.
8154
INC HL 23
Increment Register Pair HL to point at the high byte of that pointer to the next line.
8155
OR (HL) B6
OR the byte Register Pair HL points at into Register A, which leaves the Zero Flag set when the pointer to the next line is 0000H, the mark of the end of the program.
8156
DEC HL 2B
Decrement Register Pair HL back to the first byte of the line, undoing the increment at 8154H.
8157
Jump to USEHL at 8179H when the pointer to the next line was not 0000H, so the down arrow lists the line that Register Pair HL points at, the one after the current line.
8159
Jump to USEBC at 8177H, which is reached when the current line is the last of the program, so the down arrow lists the current line again rather than running off the end.
815BNOTFND
NOTFND (815BH), reached from 8145H when FIND at 5AB4H did not find the line: jump to PREV at 8161H when FIND also set the Zero Flag, which it does when it stopped at the end of the program.
815DCKUP
CP 0BH FE 0B
CKUP (815DH): compare Register A with 0BH, the character of the up arrow, which asks for the line before the current one.
815F
Jump to USEBC at 8177H when Register A was not 0BH, which takes the line FIND at 5AB4H left in Register Pair BC.
8161PREV
LD HL,(6E9EH) 2A 9E 6ELD HL,(PGMBGN)
PREV (8161H), reached from 815BH and fallen into from 815FH: load Register Pair HL from the word at PGMBGN 6E9EH, the address of the first line of the program, which the test that follows compares against the line found.
8164
AND A A7
Clear the Carry Flag with AND A on Register A, which the subtraction at 8165H needs.
8165
SBC HL,BC ED 42
Subtract Register Pair BC from Register Pair HL, which leaves the Zero Flag set when the line FIND at 5AB4H stopped on is the first line of the program.
8167
Jump to USEBC at 8177H when the line found is the first line of the program, so the up arrow at the top of the program lists the first line again.
8169
ADD HL,BC 09
Add Register Pair BC back into Register Pair HL, which puts the address of the first line of the program back after the subtraction at 8165H.
816A
LD D,B 50
Load Register D from Register B, the high byte of the address of the line found, which the search that follows compares each line pointer against.
816B
LD E,C 59
Load Register E from Register C, the low byte of the address of the line found, so Register Pair DE holds the address the search is looking for.
816CSLOOP
LD B,H 44
SLOOP (816CH), the start of the walk down the program: load Register B from Register H, the high byte of the address of the line being looked at, which becomes the answer when the next line turns out to be the one wanted.
816D
LD C,L 4D
Load Register C from Register L, the low byte of that address, so Register Pair BC holds the address of the line before the one Register Pair HL is about to step to.
816E
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the low byte of this line's pointer to the next line.
816F
INC HL 23
Increment Register Pair HL to point at the high byte of the pointer to the next line.
8170
LD H,(HL) 66
Load Register H from the byte Register Pair HL points at, putting the high byte of the pointer to the next line into Register H.
8171
LD L,A 6F
Load Register L from Register A, which completes the move of the pointer to the next line into Register Pair HL.
8172
Call CPHLDE at 434DH, the routine of the first module that compares Register Pair HL with Register Pair DE and returns with the Zero Flag set when they are equal.
8175
Jump back to SLOOP at 816CH when the line Register Pair HL now points at is not the line wanted, which carries the walk on with Register Pair BC one line behind Register Pair HL.
8177USEBC
LD H,B 60
USEBC (8177H), reached from 8149H, 814DH, 8159H, 815FH and 8167H and fallen into from 8175H: load Register H from Register B, the high byte of the address of the line to be used.
8178
LD L,C 69
Load Register L from Register C, which completes the move of that address into Register Pair HL, the register pair the code that follows reads the line through.
8179USEHL
POP BC C1
USEHL (8179H), also reached from 8139H and 8157H: pop Register Pair BC, which takes off the stack the word pushed as Register AF at 80F5H, so Register B holds the character read and Register C the flags.
817A
POP AF F1
Pop Register AF, which takes off the stack the value pushed as Register Pair DE at 80F4H and discards it, because the code here ends in a jump and not a return.
817B
POP AF F1
Pop Register AF a second time, which takes the return address of the call from the patch at 5990H off the stack and discards it, so the stack is as the first module's command level left it.
817C
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the low byte of the pointer to the next line held in the first two bytes of the line to be used.
817D
INC HL 23
Increment Register Pair HL to point at the high byte of that pointer to the next line.
817E
OR (HL) B6
OR the byte Register Pair HL points at into Register A, which leaves the Zero Flag set when the pointer is 0000H and so there is no program in memory.
817F
INC HL 23
Increment Register Pair HL to point at the first byte of the line number, which is the word that follows the pointer to the next line.
8180
Jump to DOLINE at 8188H when the pointer to the next line was not 0000H, which says there is a line to list or edit.
8182
Call 41F5H, the routine of the first module that displays the carriage return 0DH through 40D8H and then tests the word at FILEX 6E98H, which moves the cursor to the start of the next line.
8185
Jump to 593BH, the point of the first module that resets MAXSPAC 6E9CH to FFFFH and goes back to command level, which is what happens when the program is empty.
8188DOLINE
LD E,(HL) 5E
DOLINE (8188H), reached from 8180H: load Register E from the byte Register Pair HL points at, the low byte of the number of the line to be used.
8189
INC HL 23
Increment Register Pair HL to point at the high byte of that line number.
818A
LD D,(HL) 56
Load Register D from the byte Register Pair HL points at, which completes the line number in Register Pair DE.
818B
INC HL 23
Increment Register Pair HL to point at the first byte of the tokenized text of the line, which follows the line number.
818C
LD A,B 78
Load Register A from Register B, the character that was read, which 8179H took off the stack.
818D
CP 2CH FE 2C
Compare Register A with 2CH, the comma, which asked for the line to be edited rather than listed.
818F
Jump to DOEDIT at 3D27H when Register A held 2CH, the routine of the first module that runs the line editor on the line whose number stands in Register Pair DE.
8192
Call 57E8H, the routine of the first module that reads the byte at 72CBH, which holds 0FEH for a program loaded with protection and 00H otherwise, and jumps to FUNCERR 5F95H to print Illegal function call when it is not 00H, so a protected program is not listed.
8195
LD (7192H),DE ED 53 92 71LD (CURLIN),DE
Store Register Pair DE in the word at CURLIN 7192H, which makes the line just found the line BASIC is positioned at, so that the next up or down arrow steps from here.
8199
Call LISTLIN@ at 819FH, the routine of the enhancement package that displays the line Register Pair HL points at with its line number and its keywords expanded.
819C
Jump to 593BH, the point of the first module that resets MAXSPAC 6E9CH to FFFFH and goes back to command level, which prints Ready and reads the next line.

819FH - LISTLIN@: Display One Program Line

LISTLIN@ displays a single line of the BASIC program, its number first and then its text with the keyword tokens expanded back into words. IMMED calls it at 8199H for the full stop and the two arrow keys that list a line, and NEWB/EQU exports the address 819FH under this name so that the BASIC/OV2 overlay can call it as well. It is given the line number in Register Pair DE and a pointer to the tokenized text of the line in Register Pair HL. A second entry LSTCAL at 81ADH displays the text alone, without a line number, for a caller that has already put the tokenized line in the buffer. The expansion is the first module's work: UNTOKE at 7A0DH writes the line out in full into INBUF at 7039H and 7A04H puts the characters on the display one at a time until it meets the 00H that ends the buffer.

819FLISTLIN@
PUSH HL E5
LISTLIN@ (819FH), the entry called from IMMED at 8199H and exported by NEWB/EQU: push Register Pair HL, saving the pointer to the tokenized text of the line over the display of the line number.
81A0
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the line number into Register Pair HL, where the number display routine takes it from, and the text pointer into Register Pair DE.
81A1
Call NUMDSP at 3139H, the routine of the first module that BMOVE/ASM names and that displays the number in Register Pair HL as decimal digits.
81A4
POP HL E1
Pop Register Pair HL, bringing back the pointer to the tokenized text of the line saved at 819FH.
81A5
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the first byte of the tokenized text of the line.
81A6
CP 09H FE 09
Compare Register A with 09H, the tab character, which stands at the front of a line that is already indented and so needs no space after its number.
81A8
LD A,20H 3E 20
Load Register A with 20H, a space, which is the character to put between the line number and the text. This instruction leaves the flags of the comparison at 81A6H as they are, so the call that follows acts on that comparison.
81AA
Call 40D8H when the first byte of the line was not 09H, the character output routine of the first module, which sends the space in Register A to the file in hand when the word at FILEX 6E98H is not 0000H and to the display otherwise.
81ADLSTCAL
LSTCAL (81ADH), the second entry, for a caller that wants the text without a line number: call UNTOKE at 7A0DH, the routine of the first module that writes the tokenized line Register Pair HL points at out into INBUF at 7039H with every keyword token expanded into its word.
81B0
LD HL,7039H 21 39 70LD HL,INBUF
Load Register Pair HL with 7039H, the address of INBUF, where UNTOKE at 7A0DH has just left the expanded text of the line.
81B3
Call 7A04H, the routine of the first module that displays the characters Register Pair HL points at one at a time through 4212H and returns when it reaches the 00H byte that ends the buffer.
81B6
Jump to 41F5H, the routine of the first module that displays the carriage return 0DH through 40D8H and returns, so the cursor moves to the start of the next line and the return takes the caller of LISTLIN@ back.

81B9H - ABBR and CKABBR: the Keyword Abbreviations

ABBR is reached from the patch at 59BFH, which the enhancement package wrote over three bytes of the first module at the point where a line that has been typed is about to be moved into the line buffer for the tokenizer. The package uses the chance to let a single letter stand for a whole command. CKABBR at 81E4H walks the line statement by statement, and for each statement it takes the first character and looks it up in ABBTBL at 83C7H, a table of letter and token pairs. A letter from the table counts as an abbreviation only when the statement holds nothing else: CKABBR scans to the end of the statement with INXT at 8222H and gives up on the letter if it meets 0F1H, the token of the equals sign, because that makes the letter a variable being given a value. When the letter does stand alone its character in the line is overwritten by the token from the table, which is what the tokenizer would have left there had the whole keyword been typed. ABBR then looks at the token it has put in: a value below 06H is one of the commands that live in the BASIC/OV2 overlay, and MORC at 8234H loads that overlay and gives the command to it; anything else is a keyword of the first module, so the line is written out again with UNTOKE at 7A0DH and handed back to the first module at TOBUFF 5AD3H. As in IMMED, the flag byte ABBR reads is not in the file: the operand at 81BAH and 81BBH holds 0000H as the file is loaded and BEGIN writes the address of SFLAG$ into it at 84E8H.

81B9ABBR
LD A,(0000H) 3A 00 00
ABBR (81B9H), the entry from the patch at 59BFH: load Register A from the byte whose address stands in the operand at 81BAH and 81BBH, which is SFLAG$ at 007CH, the system flag byte. The two operand bytes hold 0000H in the file, because NEWB/ASM declares them as the label SFLAG2 with no address of their own, and BEGIN writes the address of SFLAG$ into them at 84E8H.
81BC
BIT 5,A CB 6F
Test bit 5 of Register A, which is the bit of SFLAG$ that the DOS sets while a Job Control Language file is supplying the input in place of the keyboard.
81BE
Jump to TOBUFF at 5AD3H when bit 5 of SFLAG$ was set, the routine of the first module that upper cases the line and moves it to the line buffer at LBUF 6EF9H, so a line from a Job Control Language file is passed on with no abbreviation expanded.
81C1
Call TOBUFF at 5AD3H, which clears the flag bytes at 7143H and 7144H, sets Register Pair BC to 013BH as the count and Register Pair DE to 6EFAH as the destination, and moves the typed line into the line buffer in upper case.
81C4
Call CKABBR at 81E4H, which searches the line in the buffer for a letter that stands alone as a statement and matches ABBTBL at 83C7H, puts that letter's token in the line when it finds one and comes back with the Zero Flag reset when it did.
81C7
RET Z C8
Return to the patch at 59BFH when CKABBR at 81E4H came back with the Zero Flag set, which says no abbreviation was found and the line is to be tokenized by the first module as it stands.
81C8
INC HL 23
Increment Register Pair HL, stepping past the colon TOBUFF at 5AD3H puts at LBUF 6EF9H in front of the line, so Register Pair HL points at 6EFAH, the first token of the line.
81C9
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the token CKABBR at 81E4H has just put at the front of the line.
81CA
CP 06H FE 06
Compare Register A with 06H, which is one more than the highest token the BASIC/OV2 overlay answers to, so a token below it belongs to that overlay.
81CC
Jump to MORC at 8234H when Register A held less than 06H, which loads BASIC/OV2 into the DOS overlay area at 1E00H and gives it the command.
81CEDOBUF
DOBUF (81CEH), reached when the token belongs to the first module: call UNTOKE at 7A0DH, which writes the line in the buffer out into INBUF at 7039H with the token just put in expanded into its full keyword.
81D1
LD HL,7039H 21 39 70LD HL,INBUF
Load Register Pair HL with 7039H, the address of INBUF, where UNTOKE at 7A0DH has left the line with its keyword spelled out.
81D4
PUSH HL E5
Push Register Pair HL, saving the address of the start of the line over the search for a trailing exclamation mark.
81D5DOBUF1
INC HL 23
DOBUF1 (81D5H), the top of the search: increment Register Pair HL to the next character of the line in INBUF at 7039H.
81D6
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the character of the line being looked at.
81D7
OR A B7
Set the flags from Register A with OR A, which leaves the Zero Flag set when the character is 00H, the byte that ends the line in INBUF.
81D8
Jump to DOBUF2 at 81E0H when the end of the line was reached, which says there is no exclamation mark to take out.
81DA
CP 21H FE 21
Compare Register A with 21H, an exclamation mark, which UNTOKE at 7A0DH writes as the single precision mark after a line number above 32767 because the first module holds such a number as a negative integer.
81DC
Jump back to DOBUF1 at 81D5H when the character was not an exclamation mark, which carries the search on to the next character.
81DE
LD (HL),00H 36 00
Store 00H in the byte Register Pair HL points at, which ends the line at the exclamation mark and so takes the wrong single precision mark off it.
81E0DOBUF2
POP HL E1
DOBUF2 (81E0H), reached from 81D8H and fallen into from 81DEH: pop Register Pair HL, bringing back the address of the start of the line in INBUF at 7039H saved at 81D4H.
81E1
Jump to TOBUFF at 5AD3H, which upper cases the line Register Pair HL points at and moves it to the line buffer at LBUF 6EF9H, from where the first module tokenizes and runs it.

81E4H - CKABBR: Find a Letter that Stands for a Command

CKABBR is called by ABBR at 81C4H and works on the line as TOBUFF 5AD3H has just left it in the line buffer. Register B is the answer: 00H when no abbreviation was found and 01H when one was put in, and the two instructions at 821CH and 821DH turn that into the Zero Flag the caller reads. The walk is by statement, because a colon ends one statement and starts another, and EVALP at 81E9H is come back to for each one. INXT at 8222H is the step that moves along the line: it takes the next character through NXTCHAR 5E93H, returns with the Zero Flag set at the end of a statement, and when it meets a quotation mark it runs on to the closing quotation mark so that the contents of a string literal are never mistaken for code. Register Pair BC, Register Pair DE and Register Pair HL are all saved on entry and brought back at the end, so the caller's pointer into the line is untouched.

81E4CKABBR
PUSH BC C5
CKABBR (81E4H), the entry called from ABBR at 81C4H: push Register Pair BC, saving the value the caller left in it, because Register B is used here as the found or not found answer.
81E5
PUSH DE D5
Push Register Pair DE, saving the value the caller left in it, because Register Pair DE is used here to walk ABBTBL at 83C7H.
81E6
PUSH HL E5
Push Register Pair HL, saving the caller's pointer into the line, which is brought back at 821EH so that ABBR sees it unchanged.
81E7
LD B,00H 06 00
Load Register B with 00H, the value that says no abbreviation has been found, which 8211H changes to 01H when one is.
81E9EVALP
EVALP (81E9H), the top of the walk, come back to at 821AH for each further statement of the line: call NXTCHAR at 5E93H, the routine of the first module that takes the next character of the line and comes back with the Zero Flag set at the end of a statement.
81EC
Jump to NOTABB at 8219H when NXTCHAR at 5E93H came back with the Zero Flag set, which says the statement is empty and the walk is at a colon or at the end of the line.
81EE
CP 8FH FE 8F
Compare Register A with 8FH, the token of the REM keyword, after which the rest of the line is a remark and holds no command to expand.
81F0
Jump to DOREM at 821CH when Register A held 8FH, which leaves the rest of the line alone and goes to the exit with the answer Register B already holds.
81F2
LD DE,83C7H 11 C7 83LD DE,ABBTBL
Load Register Pair DE with 83C7H, the address of ABBTBL, the table of letter and token pairs that names every abbreviation the package knows.
81F5
LD C,A 4F
Load Register C from Register A, putting the first character of the statement into Register C, which is the letter the table is searched for.
81F6ABLP
LD A,(DE) 1A
ABLP (81F6H), the top of the table search: load Register A from the byte Register Pair DE points at, a letter of ABBTBL at 83C7H.
81F7
INC DE 13
Increment Register Pair DE to point at the token that follows that letter in the table.
81F8
OR A B7
Set the flags from Register A with OR A, which leaves the Zero Flag set when the byte read was 00H, the byte that ends ABBTBL at 83C7H.
81F9
Jump to NOTAB1 at 8214H when the end of the table was reached, which says the character in Register C is no abbreviation and the statement is walked past.
81FB
CP C B9
Compare Register A with Register C, the first character of the statement, which tests this entry of the table against it.
81FC
Jump to ABBMAT at 8201H when the table letter matched the character in Register C, which goes on to test whether the letter stands alone.
81FE
INC DE 13
Increment Register Pair DE past the token, so Register Pair DE points at the letter of the next pair of ABBTBL at 83C7H.
81FF
Jump back to ABLP at 81F6H, which tests the next letter of the table against the character in Register C.
8201ABBMAT
PUSH HL E5
ABBMAT (8201H), reached from 81FCH with Register Pair DE pointing at the token of the letter matched: push Register Pair HL, saving the position in the line of the letter itself, which 820DH brings back to overwrite it.
8202ABLP1
ABLP1 (8202H), the top of the scan to the end of the statement: call INXT at 8222H, which takes the next character of the line and steps over any string literal whole.
8205
Jump to ISME at 820DH when INXT at 8222H came back with the Zero Flag set, which says the statement ended right after the letter and so the letter is an abbreviation.
8207
CP 0F1H FE F1
Compare Register A with 0F1H, the token of the equals sign, which makes the letter the name of a variable being given a value rather than a command.
8209
Jump to NOTME at 8213H when Register A held 0F1H, which gives the letter up and leaves the line as it was typed.
820B
Jump back to ABLP1 at 8202H, which carries the scan on to the next character of the statement.
820DISME
POP HL E1
ISME (820DH), reached from 8205H: pop Register Pair HL, bringing back the position in the line of the letter saved at 8201H, which is the byte to be replaced.
820E
PUSH HL E5
Push Register Pair HL straight back, which keeps the stack as NOTME at 8213H expects to find it, because both paths leave through the pop there.
820F
LD A,(DE) 1A
Load Register A from the byte Register Pair DE points at, the token of the letter matched, which Register Pair DE was left pointing at by 81F7H.
8210
LD (HL),A 77
Store Register A in the byte Register Pair HL points at, which replaces the single letter in the line by the token of the keyword it stands for.
8211
LD B,01H 06 01
Load Register B with 01H, the value that says an abbreviation was put in, which the exit at 821CH turns into a reset Zero Flag for ABBR to read.
8213NOTME
POP HL E1
NOTME (8213H), reached from 8209H and fallen into from 8211H: pop Register Pair HL, taking off the stack the position of the letter that 8201H or 820EH pushed.
8214NOTAB1
NOTAB1 (8214H), also reached from 81F9H: call INXT at 8222H, which takes the next character of the line and comes back with the Zero Flag set at the end of the statement.
8217
Jump back to NOTAB1 at 8214H while INXT at 8222H comes back with the Zero Flag reset, which walks the rest of this statement past without looking at it.
8219NOTABB
OR A B7
NOTABB (8219H), also reached from 81ECH: set the flags from Register A with OR A, which leaves the Zero Flag set at the end of the line and reset when the character that ended the statement was a colon.
821A
Jump back to EVALP at 81E9H when the statement ended at a colon, which starts the search again on the statement that follows it.
821CDOREM
INC B 04
DOREM (821CH), also reached from 81F0H: increment Register B, which is the first of the two instructions that turn the found or not found count into the flags the caller reads.
821D
DEC B 05
Decrement Register B back to what it held, which leaves the Zero Flag set when Register B holds 00H and no abbreviation was found and reset when it holds 01H and one was.
821E
POP HL E1
Pop Register Pair HL, bringing back the caller's pointer into the line saved at 81E6H.
821F
POP DE D1
Pop Register Pair DE, bringing back the value saved at 81E5H.
8220
POP BC C1
Pop Register Pair BC, bringing back the value saved at 81E4H, which also takes the answer out of Register B now that it is held in the Zero Flag.
8221
RET C9
Return to ABBR at 81C7H with the Zero Flag set when no abbreviation was found and reset when one was put into the line.

8222H - INXT: Step Along the Line Past Strings

INXT is the one step of the two scans of CKABBR, the scan from 8202H that looks for the end of a statement after a matching letter and the scan from 8214H that walks a statement past. It takes the next character of the line through NXTCHAR 5E93H and returns it in Register A with the Zero Flag set when the statement has ended. Its one piece of work beyond that is the quotation mark: a string literal may hold a colon or an equals sign, either of which would be read as code by the scans that call INXT, so when the character taken is 22H the loop at INXT1 8229H runs on through the literal to its closing quotation mark and returns from there. A literal left open at the end of the line ends the scan too, because the 00H that ends the line sets the Zero Flag at 822DH.

8222INXT
INXT (8222H), the entry called from 8202H and 8214H: call NXTCHAR at 5E93H, the routine of the first module that takes the next character of the line and comes back with the Zero Flag set at the end of a statement.
8225
RET Z C8
Return to the caller with the Zero Flag set when NXTCHAR at 5E93H reached the end of the statement, which is the colon or the 00H that ends the line.
8226
CP 22H FE 22
Compare Register A with 22H, a quotation mark, which opens a string literal whose contents are not to be read as code.
8228
RET NZ C0
Return to the caller with the Zero Flag reset when the character was not a quotation mark, which gives the caller the ordinary character it asked for.
8229INXT1
INXT1 (8229H), the top of the run through a string literal: call NXTCHAR at 5E93H, taking the next character of the literal.
822C
OR A B7
Set the flags from Register A with OR A, which leaves the Zero Flag set when the character is 00H, the byte that ends the line.
822D
RET Z C8
Return to the caller with the Zero Flag set when the line ended inside the literal, which ends the caller's scan on an unclosed string.
822E
CP 22H FE 22
Compare Register A with 22H, a quotation mark, which is the one that closes the literal.
8230
Jump back to INXT1 at 8229H while the character is not a quotation mark, which carries the run through the literal on.
8232
OR A B7
Set the flags from Register A with OR A, which leaves the Zero Flag reset because Register A holds 22H, so the caller is told an ordinary character was taken.
8233
RET C9
Return to the caller with Register A holding 22H and the Zero Flag reset, the whole string literal having been stepped over.

8234H - MORC: Load BASIC/OV2 and Run an Extended Command

MORC is reached from ABBR at 81CCH when the token CKABBR put at the front of the line is below 06H, which marks it as one of the commands that the enhancement package keeps in a separate overlay rather than in BASIC itself. Those commands are MOVE, COPY and FIND, and BASIC/OV2 holds them. The file is a core image and not a load module, so there are no load records to obey: MORC opens it with @OPEN and reads it sector by sector straight into the DOS overlay area at 1E00H, stepping the buffer address in its own file control block up by 256 bytes a sector. The file control block it uses is FCB at 8281H, which is in the 32 bytes NEWB/ASM reserves and does not load, so the bytes there belong to the first module until MORC writes over them. OVRLY$ at 0069H is the DOS cell that says which overlay is resident: MORC reads it first and skips the whole load when it already holds 01H, the value the package uses for BASIC/OV2, puts 00H in it while the load is running so that an interrupted load is not taken for a good one, and sets it to 01H when the overlay is in. The command is given to the overlay in Register A, and that value travels through the operand of the instruction at 826FH, which 8234H writes before the load begins. The read is of six whole sectors whatever the file holds: BASIC/OV2 is 1376 bytes and ends at 235FH, so the sixth sector carries 160 bytes from beyond the end of the file into 2360H to 23FFH, and LOWBUF$ at 2300H, the DOS low memory disk buffer that the source of SPOOL names, lies inside the range the load writes.

8234MORC
LD (8270H),A 32 70 82LD (SAVA),A
MORC (8234H), the entry from ABBR at 81CCH with Register A holding the token of the command: store Register A in the byte at 8270H, which is the operand of the LD A instruction at 826FH, so the token is carried to the point where the overlay is entered.
8237
XOR A AF
Clear Register A with XOR A, which gives the CLEAR routine the value 00H it takes as the amount of string space to set aside.
8238
Call CLEAR at 447EH, the routine of the first module that carries out the CLEAR statement, which drops every variable and resets the string space so that the overlay has the memory below it free.
823B
Call NORMNUM at 661EH, the routine of the first module that walks the program and puts every line reference back into its plain number form, which the overlay needs because it may move lines about.
823E
LD A,(0069H) 3A 69 00LD A,(OVRLY$)
Load Register A from OVRLY$ at 0069H, the cell of the resident system that holds the number of the overlay now in the overlay area at 1E00H.
8241
CP 01H FE 01
Compare Register A with 01H, the number the enhancement package puts in OVRLY$ at 0069H for BASIC/OV2.
8243
Jump to DOOVR at 826FH when OVRLY$ at 0069H held 01H, which says BASIC/OV2 is already in the overlay area and the load can be passed over.
8245
LD DE,8281H 11 81 82LD DE,FCB
Load Register Pair DE with 8281H, the address of FCB, the file control block this load uses. It stands in the 32 bytes from 8281H to 82A0H that NEWB/ASM reserves and the load module does not carry, so the bytes there are the first module's until this load writes over them.
8248
LD HL,8277H 21 77 82LD HL,OVRLAY$
Load Register Pair HL with 8277H, the address of OVRLAY$, the file specification BASIC/OV2 followed by a carriage return.
824B
LD A,4EH 3E 4E
Load Register A with 4EH, 78, the number of @FSPEC, the supervisor call that reads a file specification into a file control block.
824D
RST 28H EF
Issue RST 28H, calling @FSPEC at 1981H, which builds the file control block at 8281H from the name at 8277H.
824E
XOR A AF
Clear Register A with XOR A, giving 00H, which is put in OVRLY$ next and is also wanted in Register B at 8255H.
824F
LD (0069H),A 32 69 00LD (OVRLY$),A
Store Register A in OVRLY$ at 0069H, which says no overlay is resident while the load runs, so that a load stopped by an error does not leave OVRLY$ claiming BASIC/OV2 is in.
8252
LD HL,1E00H 21 00 1ELD HL,DOSOVR@
Load Register Pair HL with 1E00H, DOSOVR@, the start of the DOS overlay area and the address the first sector of BASIC/OV2 is read to.
8255
LD B,A 47
Load Register B from Register A, giving Register B the value 00H, which @OPEN reads as a logical record length of 256 and so a whole sector a record.
8256
LD A,3BH 3E 3B
Load Register A with 3BH, 59, the number of @OPEN, the supervisor call that opens the file whose control block Register Pair DE points at.
8258
RST 28H EF
Issue RST 28H, calling @OPEN at 198AH, which opens BASIC/OV2 with the buffer at 1E00H and writes that buffer address into the file control block at 8284H and 8285H.
8259
Jump to DERR at 5282H when @OPEN came back with the Zero Flag reset, which prints the error the supervisor call returned and ends the statement.
825C
LD HL,8285H 21 85 82
Load Register Pair HL with 8285H, FCB+4, the high byte of the buffer address inside the file control block, which the loop steps up by one for each sector read.
825F
LD B,06H 06 06
Load Register B with 06H, the number of sectors read, which covers the 1376 bytes of BASIC/OV2 in five whole sectors and 96 bytes of a sixth. The count is fixed and the file's length is never asked, so the sixth read carries 160 bytes from beyond the end of the file into 2360H to 23FFH over LOWBUF$ at 2300H, which is B296.
8261MOC1
LD A,43H 3E 43
MOC1 (8261H), the top of the read loop: load Register A with 43H, 67, the number of @READ, the supervisor call that reads the next record of the file into the buffer named in the file control block.
8263
RST 28H EF
Issue RST 28H, calling @READ at 1513H, which reads 256 bytes of BASIC/OV2 to the address held at 8284H and 8285H.
8264
Jump to DERR at 5282H when @READ came back with the Zero Flag reset, which prints the error and ends the statement with the overlay only part loaded and OVRLY$ at 0069H holding 00H.
8267
INC (HL) 34
Increment the byte Register Pair HL points at, the high byte of the buffer address at 8285H, which moves the buffer on by 256 bytes so the next sector lands after the one just read.
8268
Decrement Register B and jump back to MOC1 at 8261H while it is not 00H, which reads the six sectors into 1E00H, 1F00H, 2000H, 2100H, 2200H and 2300H in turn.
826A
LD A,01H 3E 01
Load Register A with 01H, the number the enhancement package uses in OVRLY$ at 0069H for BASIC/OV2.
826C
LD (0069H),A 32 69 00LD (OVRLY$),A
Store Register A in OVRLY$ at 0069H, which records that BASIC/OV2 is the image resident in the overlay area, so a later extended command skips the load at 8243H and SVCUSR at 8078H knows it has to clear the cell before a supervisor call may load a DOS overlay there.
826FDOOVR
LD A,00H 3E 00
DOOVR (826FH), also reached from 8243H: load Register A with the byte at 8270H, which is the token of the command and which 8234H wrote into this instruction's operand. The operand holds 00H in the file.
8271
LD HL,7039H 21 39 70LD HL,INBUF
Load Register Pair HL with 7039H, the address of INBUF, where the line the extended command was typed on still stands, so the overlay can read the rest of the command from it.
8274
Jump to DOSOVR@ at 1E00H, the first instruction of BASIC/OV2, with Register A holding the command token and Register Pair HL pointing at the command line. BASIC/OV2 takes 05H as COPY and 02H as MOVE and treats any other value as FIND.
8277-8280OVRLAY$
DEFM "BASIC/OV2" / DEFB 0DH 42 41 53 49 43 2F 4F 56 32 0D
OVRLAY$, 8277H-8280H: the file specification of the overlay and the carriage return that ends it, read by @FSPEC at 824DH. NEWB/EQU exports this address, and the next byte, 8281H, begins the 32 reserved bytes the load module does not carry.

8281H - Module 1's Bytes Inside Module 2's Reserve (8281H-82A0H)

The one place in the file where the two modules do not meet. NEWB/ASM declares thirty-two bytes here under the name FCB and the load module does not carry them, so no 01H block of module 2 writes over 8281H to 82A0H and the bytes that stand there at run time are module 1's own, loaded by its 83rd block with everything else from 3000H to 82FFH. The page shows them as module 1's because that is whose bytes they are in the file, and the enhancement uses them as the file control block MORC opens BASIC/OV2 with, taking the address from the name at 8277H, which is why they are 00H: a file control block is built before it is used. OVRLAY$ 8277H stands just below, at the end of module 2's own body.

8281-82A0FCB
DEFB 00H x 32 00 x 32
8281H to 82A0H: thirty-two bytes of 00H, module 1's own, standing in the space NEWB/ASM reserves under the name FCB and the load module does not carry. MORC at 8234H uses them as the file control block it opens BASIC/OV2 with, taking the address out of the name at 8277H.

82A1H - FASTLD: Load a Program with Whole Sector Reads

FASTLD is reached from the patch at 4C91H, which the enhancement package wrote over five bytes of the first module's LOAD and RUN path. The first module read a tokenized program in a byte at a time through the DOS byte input routines; FASTLD reads it in whole sectors straight into the program area, which is why NEWB/ASM calls it fast. Register Pair IX is loaded from FILEX 6E98H and holds the address of the file control block less two, so every index here is two higher than the file control block offset it reaches: (IX+3) is FCB+1, the flag byte, (IX+5) and (IX+6) the low and high bytes of the buffer address at FCB+3 and FCB+4, (IX+7) is FCB+5, the next byte offset, (IX+10) is FCB+8, the end of file offset, and (IX+14) and (IX+15) are FCB+12 and FCB+13, the ending record number. Before it reads anything FASTLD makes sure the program will fit: the free space is the highest available byte in HIPT 7178H less 86 and less the program base in PGMBGN 6E9EH, and the file must hold fewer than 256 records and no more records than that space has pages, or the load gives Out of memory at OMERR 4CD9H. The first sector is already in the file control block's buffer, read by the first module to test the type byte, so FASTLD moves 255 bytes of it into place with LDIR and then points the file control block's buffer at the program area itself, so each following @READ lands where the program is to run. FASTLD comes back with Register Pair HL holding the address of the byte after the program, which the patch's jump to 4C98H stores in 719FH.

82A1FASTLD
LD IX,(6E98H) DD 2A 98 6ELD IX,(FILEX)
FASTLD (82A1H), the entry from the patch at 4C91H: load Index Register IX from the word at FILEX 6E98H, which holds the address of the file control block of the program file less two, so the index offsets used below are two higher than the file control block offsets they reach.
82A5
LD HL,(7178H) 2A 78 71LD HL,(HIPT)
Load Register Pair HL from the word at HIPT 7178H, which NEWB/ASM names as the highest byte available to a program during a load.
82A8
LD DE,0FFAAH 11 AA FF
Load Register Pair DE with 0FFAAH, which taken as a signed number is 86 less than zero and is added next to leave room below the highest available byte.
82AB
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which leaves Register Pair HL holding the highest available byte less 86.
82AC
LD DE,(6E9EH) ED 5B 9E 6ELD DE,(PGMBGN)
Load Register Pair DE from the word at PGMBGN 6E9EH, the address the program is loaded at, which is the bottom of the space the program may use.
82B0
XOR A AF
Clear Register A with XOR A, which gives 00H and resets the Carry Flag that the subtraction at 82B1H needs.
82B1
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL, which leaves Register Pair HL holding the space between the program base and the highest available byte less 86, and sets the Carry Flag when the base is above that point.
82B3
Jump to OMERR at 4CD9H when the subtraction at 82B1H set the Carry Flag, the routine of the first module that gives Out of memory for a program load.
82B6
OR (IX+0FH) DD B6 0F
OR the byte at (IX+0FH), which is FCB+13, the high byte of the ending record number, into Register A, which holds 00H, so the Zero Flag comes back set only when the file holds fewer than 256 records. Index Register IX holds the file control block address less two.
82B9
Jump to OMERR at 4CD9H when the high byte of the ending record number was not 00H, because a file of 256 records or more holds at least 65536 bytes and FASTLD counts its pages in one byte.
82BC
LD B,(IX+0EH) DD 46 0E
Load Register B from the byte at (IX+0EH), which is FCB+12, the low byte of the ending record number, so Register B holds the number of 256 byte records the file holds. Index Register IX holds the file control block address less two.
82BF
LD C,A 4F
Load Register C from Register A, which holds 00H, so Register Pair BC holds the file's length in bytes as the record count times 256.
82C0
SBC HL,BC ED 42
Subtract Register Pair BC from Register Pair HL, which sets the Carry Flag when the file is longer than the space worked out at 82B1H.
82C2
Jump to OMERR at 4CD9H when the file is longer than the space available, which gives Out of memory before any of it is read.
82C5
LD H,(IX+06H) DD 66 06
Load Register H from the byte at (IX+06H), which is FCB+4, the high byte of the buffer address the first module opened the file with and read its first sector into. Index Register IX holds the file control block address less two.
82C8
LD L,(IX+05H) DD 6E 05
Load Register L from the byte at (IX+05H), which is FCB+3, the low byte of that buffer address, so Register Pair HL points at the first sector of the file as it stands in the buffer. Index Register IX holds the file control block address less two.
82CB
INC HL 23
Increment Register Pair HL past the first byte of the buffer, the type byte 0FFH of a plain program or 0FEH of a protected one, which belongs to the file and not to the program.
82CC
LD B,C 41
Load Register B from Register C, which holds 00H, so Register B is the high byte of the count the move that follows uses.
82CD
DEC C 0D
Decrement Register C from 00H to 0FFH, which makes Register Pair BC hold 00FFH, the 255 bytes of the first sector that follow its type byte.
82CE
LDIR ED B0
Move the 255 bytes counted in Register Pair BC with LDIR from the buffer Register Pair HL points at to the program base Register Pair DE points at, which puts the first sector of the program where it is to run and leaves Register Pair DE pointing at the byte after it and Register Pair BC holding 0000H.
82D0
LD (IX+06H),D DD 72 06
Store Register D in the byte at (IX+06H), FCB+4, which makes the high byte of the file control block's buffer address point into the program area 255 bytes above its base. Index Register IX holds the file control block address less two.
82D3
LD (IX+05H),E DD 73 05
Store Register E in the byte at (IX+05H), FCB+3, which completes the new buffer address, so every @READ from here on puts its sector straight into the program area. Index Register IX holds the file control block address less two.
82D6
LD L,E 6B
Load Register L from Register E, the low byte of that buffer address. The loop below steps the buffer on by whole pages and so never changes its low byte, which is why 82F7H can bring the address back by loading Register H alone.
82D7
PUSH IX DD E5
Push Index Register IX, putting the address of the file control block less two on the stack so that it can be taken off into Register Pair DE.
82D9
POP DE D1
Pop Register Pair DE, which gives Register Pair DE the address of the file control block less two.
82DA
INC DE 13
Increment Register Pair DE, the first of the two steps that turn it into the address of the file control block itself.
82DB
INC DE 13
Increment Register Pair DE again, so Register Pair DE holds the address of the file control block, which is where @READ expects it.
82DC
LD (IX+07H),B DD 70 07
Store Register B, which holds 00H, in the byte at (IX+07H), FCB+5, the offset of the next byte within the buffer, so the reads that follow start at the front of each sector. Index Register IX holds the file control block address less two.
82DF
RES 7,(IX+03H) DD CB 03 BE
Reset bit 7 of the byte at (IX+03H), FCB+1, the flag the DOS reads as byte or logical record input when it is set and as sector input only when it is reset, so @READ hands over whole sectors in place of the byte at a time input the first module was using. Index Register IX holds the file control block address less two.
82E3LDLOOP
LD A,43H 3E 43
LDLOOP (82E3H), the top of the read loop: load Register A with 43H, 67, the number of @READ, the supervisor call that reads the next record of the file into the buffer the file control block names.
82E5
RST 28H EF
Issue RST 28H, calling @READ at 1513H, which reads 256 bytes of the program file straight into the program area.
82E6
Jump to LDERR at 82EEH when @READ came back with the Zero Flag reset, which is how the end of the file is reached as well as how a real error is reported.
82E9
INC (IX+06H) DD 34 06
Increment the byte at (IX+06H), FCB+4, the high byte of the buffer address, which moves the buffer on by 256 bytes so the next sector lands after the one just read. Index Register IX holds the file control block address less two.
82EC
Jump back to LDLOOP at 82E3H, which reads the next sector, the loop ending only when @READ returns an error.
82EELDERR
CP 1CH FE 1C
LDERR (82EEH), reached from 82E6H with the error code in Register A: compare Register A with 1CH, 28, the code of End of file encountered, which is the error that ends a good load.
82F0
Jump to LDEOF at 82F7H when the error was 28, the end of the file, which is the path that works out where the program ends.
82F2
CP 1DH FE 1D
Compare Register A with 1DH, 29, the code of Record number out of range, which the DOS gives for a read that starts past the end of the file.
82F4
Jump to DERR at 5282H when the error was neither 28 nor 29, which prints the error the supervisor call returned and ends the load.
82F7LDEOF
LD H,(IX+06H) DD 66 06
LDEOF (82F7H), reached from 82F0H and fallen into from 82F4H: load Register H from the byte at (IX+06H), FCB+4, the high byte of the buffer address, which with the low byte still in Register L from 82D6H gives the address the last sector was read to. Index Register IX holds the file control block address less two.
82FA
XOR A AF
Clear Register A with XOR A, giving 00H, which is wanted in Register D next.
82FB
LD D,A 57
Load Register D from Register A, giving Register D the value 00H, so Register Pair DE holds the end of file offset alone once Register E is loaded.
82FC
LD E,(IX+0AH) DD 5E 0A
Load Register E from the byte at (IX+0AH), FCB+8, the offset within the last sector of the byte after the last one the file holds. Index Register IX holds the file control block address less two.
82FF
DEC E 1D
Decrement Register E, which takes off the type byte that 82CBH stepped over, so the offset counts only bytes of the program.
8300
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, which leaves Register Pair HL holding the address of the byte after the program in memory.
8301
RET C9
Return to the patch at 4C91H, whose jump to 4C98H stores Register Pair HL in the word at 719FH as the end of the program.

8302H - FASTSAV: Save a Program with Whole Sector Writes

FASTSAV is reached from the patch at 4D76H and is the counterpart of FASTLD: where the first module wrote a tokenized program out a byte at a time, FASTSAV writes it in whole sectors straight out of the program area. It is given the program base in Register Pair HL and the address of the byte after the program in Register Pair DE, which the first module loads at 4D73H from PGMBGN 6E9EH and at 4D6FH from the word at 719FH that FASTLD left there. The type byte of a program file, 0FFH for a plain program and 0FEH for a protected one, has to go in front of the program on the diskette, and FASTSAV puts it in the byte below the program base so that the write can begin there; 8331H puts 00H back over it once it has gone out. The file control block's buffer is pointed at the program itself, so no copying is needed. Before writing the program FASTSAV positions to the last record and writes that one first: @POSN followed by @WRITE at the end of the file makes the DOS allocate the whole file in one step rather than a granule at a time as the write runs on, and bit 6 of FCB+1, which @POSN sets so that the end of file is moved only by a write at or past it, is reset at 831FH so that this write does set the ending record number. As in FASTLD, Register Pair IX holds the address of the file control block less two, so each index is two higher than the file control block offset it reaches.

8302FASTSAV
EX DE,HL EB
FASTSAV (8302H), the entry from the patch at 4D76H with Register Pair HL holding the program base and Register Pair DE the address of the byte after the program: exchange Register Pair DE with Register Pair HL, which puts the program base in Register Pair DE and the end in Register Pair HL.
8303
OR A B7
Set the flags from Register A with OR A, which resets the Carry Flag that the subtraction at 8304H needs and leaves Register A holding the type byte the first module put there, 0FFH for a plain program and 0FEH for a protected one.
8304
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL, which leaves Register Pair HL holding the length of the program in bytes.
8306
DEC DE 1B
Decrement Register Pair DE to the byte below the program base, which is where the type byte of the file is to stand so that it is written out in front of the program.
8307
LD (DE),A 12
Store Register A in the byte Register Pair DE points at, which puts the type byte of the file in the byte below the program base.
8308
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the address of the type byte in Register Pair HL and the length of the program in Register Pair DE.
8309
PUSH DE D5
Push Register Pair DE, saving the length of the program over the positioning and the first write, to be taken back at 832BH.
830A
LD C,D 4A
Load Register C from Register D, the high byte of the length, which is the number of whole 256 byte records the program fills.
830B
LD B,00H 06 00
Load Register B with 00H, so Register Pair BC holds that record count, which is the record @POSN is given next.
830D
LD IX,(6E98H) DD 2A 98 6ELD IX,(FILEX)
Load Index Register IX from the word at FILEX 6E98H, the address of the file control block of the program file less two.
8311
LD (IX+06H),H DD 74 06
Store Register H in the byte at (IX+06H), FCB+4, the high byte of the file control block's buffer address, which points the buffer at the type byte below the program base. Index Register IX holds the file control block address less two.
8314
LD (IX+05H),L DD 75 05
Store Register L in the byte at (IX+05H), FCB+3, the low byte of that buffer address, so the writes take their bytes straight out of the program area. Index Register IX holds the file control block address less two.
8317
PUSH IX DD E5
Push Index Register IX, putting the address of the file control block less two on the stack so that it can be taken off into Register Pair DE.
8319
POP DE D1
Pop Register Pair DE, which gives Register Pair DE the address of the file control block less two.
831A
INC DE 13
Increment Register Pair DE, the first of the two steps that turn it into the address of the file control block itself.
831B
INC DE 13
Increment Register Pair DE again, so Register Pair DE holds the address of the file control block, which is where @POSN and @WRITE expect it.
831C
LD A,42H 3E 42
Load Register A with 42H, 66, the number of @POSN, the supervisor call that positions a file to the record number in Register Pair BC.
831E
RST 28H EF
Issue RST 28H, calling @POSN at 145BH, which positions the file to its last record so that the write that follows allocates the whole file at once.
831F
RES 6,(IX+03H) DD CB 03 B6
Reset bit 6 of the byte at (IX+03H), FCB+1, the flag @POSN has just set to say the end of file is to be moved only by a write at or past it, so that the write of the last record does set the file's ending record number. Index Register IX holds the file control block address less two.
8323
LD A,4BH 3E 4B
Load Register A with 4BH, 75, the number of @WRITE, the supervisor call that writes a record of the file from the buffer the file control block names.
8325
RST 28H EF
Issue RST 28H, calling @WRITE at 1531H, which writes the last record of the file and so makes the DOS allocate every granule the program needs in one step.
8326
Jump to WRBAD at 8331H when @WRITE came back with the Zero Flag reset, which takes the type byte out of memory and then reports the error.
8328
LD A,44H 3E 44
Load Register A with 44H, 68, the number of @REW, the supervisor call that positions a file back to its first record.
832A
RST 28H EF
Issue RST 28H, calling @REW at 14C2H, which rewinds the file so that the program is written from its start.
832B
POP BC C1
Pop Register Pair BC, bringing back the length of the program saved at 8309H, so Register B holds its page count and Register C the bytes left over.
832C
INC C 0C
Increment Register C, which adds the type byte at the front of the file to the count of bytes in the last record.
832D
INC B 04
Increment Register B, which adds the part filled last record to the count of whole records, giving the number of records the loop writes.
832EWRITIT
LD A,4BH 3E 4B
WRITIT (832EH), the top of the write loop: load Register A with 4BH, 75, the number of @WRITE, the supervisor call that writes one record of the file.
8330
RST 28H EF
Issue RST 28H, calling @WRITE at 1531H, which writes 256 bytes from the address held at 8284H and 8285H out to the file.
8331WRBAD
LD (HL),00H 36 00
WRBAD (8331H), also reached from 8326H on a write error: store 00H in the byte Register Pair HL points at, the byte below the program base, which takes the type byte of the file back out of memory now that it has been written. The loop passes through here on every turn, and the byte is already 00H after the first.
8333
Jump to DERR at 5282H when the write came back with the Zero Flag reset, which prints the error the supervisor call returned and ends the save with the file part written.
8336
INC (IX+06H) DD 34 06
Increment the byte at (IX+06H), FCB+4, the high byte of the buffer address, which moves the buffer on by 256 bytes so the next record is taken from the next page of the program. Index Register IX holds the file control block address less two.
8339
Decrement Register B and jump back to WRITIT at 832EH while it is not 00H, which writes the whole program out a record at a time.
833B
LD (IX+0AH),C DD 71 0A
Store Register C in the byte at (IX+0AH), FCB+8, the end of file offset, which records how many bytes of the last record belong to the file. Index Register IX holds the file control block address less two.
833E
RET C9
Return to the patch at 4D76H, whose jump to 4CD0H carries the first module's save on to close the file.

833FH - RENA, RENB and RENC: the RENUM Intercepts

Three of the eight patches go into the first module's RENUM statement, and the three pieces of code they reach stand together here. RENA at 833FH is called from the patch at 658EH and does two things: it presets the end of the range to FFFFH so that RENUM with no last line given renumbers to the end of the program, and it loads Register Pair BC with 000AH, the default increment. That load is the three byte instruction the patch wrote over, and because LD BC does not touch the flags the test at 6594H still reads the flags as they stood before the call. RENB at 834AH is reached from the patch at 65B5H and checks the numbers the user gave: it finds the last line of the range, works out what the highest new line number would be by adding the increment once for every line in the range, and refuses the whole statement with Illegal function call at FUNCERR 5F95H when that number would reach the line that follows the range, because renumbering must not put a line out of order. The running total is kept in the alternate register set, Register Pair HL holding the new line number and Register Pair BC the increment, while the main set walks the program. RENC at 83B6H is reached from the patch at 6604H and is the test the renumbering loop makes on each line: it stops at 6618H once the walk has passed the last line of the range. Five instructions here are written as the code runs, and all five hold 0000H in the file: the operands at 8382H (OLDL), 838BH (INCRE), 838FH (ENDPOS), 83A7H (ENDCK) and 83B7H (LSTLIN), the last of which RENA and RENB both write.

833FRENA
LD BC,0FFFFH 01 FF FF
RENA (833FH), the entry called from the patch at 658EH: load Register Pair BC with 0FFFFH, the highest line number BASIC allows, which stands for a range that runs to the end of the program.
8342
LD (83B7H),BC ED 43 B7 83LD (LSTLIN),BC
Store Register Pair BC in the word at 83B7H, which is the operand of the LD DE instruction at 83B6H in RENC, so that with no last line given the test there never stops the renumbering before the end of the program.
8346
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, ten, the increment RENUM uses when none is given. These three bytes are what the patch at 658EH wrote over, and LD BC leaves the flags alone, so the first module's test at 6594H reads the flags as they stood before RENA was called.
8349
RET C9
Return to the patch at 658EH with Register Pair BC holding 000AH, which the first module pushes at 6591H as the increment in hand.
834ARENB
RENB (834AH), the entry jumped to from the patch at 65B5H: jump to RENRET at 83B3H when the Zero Flag is set, which the first module leaves set when nothing more was typed on the RENUM statement, so there are no numbers to check.
834C
EX (SP),HL E3
Exchange the word at the top of the stack, the word the Stack Pointer addresses, with Register Pair HL, which brings the old starting line number off the stack into Register Pair HL and puts the line pointer there in its place.
834D
LD (8382H),HL 22 82 83LD (OLDL),HL
Store Register Pair HL in the word at 8382H, which is the operand of the LD DE instruction at 8381H, so that the old starting line number is the one the search at 8384H is given.
8350
EX (SP),HL E3
Exchange the word at the top of the stack, the word the Stack Pointer addresses, with Register Pair HL again, which puts the old starting line number back on the stack and brings the line pointer back into Register Pair HL.
8351
PUSH HL E5
Push Register Pair HL, saving the line pointer, which RENB1 at 83B2H brings back before the first module carries on.
8352
PUSH DE D5
Push Register Pair DE, saving the increment the user gave, which RENB1 at 83B1H brings back.
8353
PUSH BC C5
Push Register Pair BC, saving the new starting line number, which RENB1 at 83B0H brings back and which 8379H and 8388H read off the stack meanwhile.
8354
LD (838BH),DE ED 53 8B 83LD (INCRE),DE
Store Register Pair DE in the word at 838BH, which is the operand of the LD BC instruction at 838AH, so that the increment the user gave is the one added up at 83A1H.
8358
Call 4353H, the routine of the first module that compares the character of the line in Register A with the byte that follows this call and steps the return address past it when they match, so the separator the statement must have is written in the next byte rather than passed in a register.
835B
DEFB 2CH 2C
835BH: the comma that 4353H requires between the line numbers of the RENUM statement. The routine reads this byte through the return address on the stack and returns to 835CH, the byte after it.
835C
Call 5FA4H, the routine of the first module that steps back one character, takes the next with NXTCHAR 5E93H and tests it against 0EH, the token of a line number reference, and 0DH, the carriage return, so the Zero Flag comes back reset when anything else follows the numbers.
835F
Jump to SYNERR at 586CH when something other than the end of the statement followed the line numbers, which prints Syntax error.
8362
Call FIND at 5AB4H, the routine of the first module that searches the program for the line number in Register Pair DE and comes back with Register Pair HL and Register Pair BC pointing at the line, which locates the last line of the range to be renumbered.
8365
LD (83B7H),BC ED 43 B7 83LD (LSTLIN),BC
Store Register Pair BC in the word at 83B7H, the operand of the LD DE instruction at 83B6H in RENC, which makes the address of the last line of the range the point the renumbering loop stops at.
8369
LD (838FH),HL 22 8F 83LD (ENDPOS),HL
Store Register Pair HL in the word at 838FH, the operand of the LD DE instruction at 838EH, which makes that same address the end the count at ENDLP 8391H walks to.
836C
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the low byte of the pointer to the next line held in the first two bytes of the last line of the range.
836D
INC HL 23
Increment Register Pair HL to point at the high byte of that pointer to the next line.
836E
OR (HL) B6
OR the byte Register Pair HL points at into Register A, which leaves the Zero Flag set when the pointer is 0000H and so the last line of the range is also the last line of the program.
836F
Jump to RENB1 at 83B0H when the range ends at the end of the program, because then no line follows it and no new number can be out of order.
8371
INC HL 23
Increment Register Pair HL to the first byte of the line number of the line that follows the range, stepping past the high byte of the pointer to the next line.
8372
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the low byte of that following line's number.
8373
INC HL 23
Increment Register Pair HL to point at the high byte of the following line's number.
8374
LD H,(HL) 66
Load Register H from the byte Register Pair HL points at, putting the high byte of the following line's number into Register H.
8375
LD L,A 6F
Load Register L from Register A, which completes the following line's number in Register Pair HL.
8376
LD (83A7H),HL 22 A7 83LD (ENDCK),HL
Store Register Pair HL in the word at 83A7H, the operand of the LD DE instruction at 83A6H, so that the number of the line after the range is what the highest new number is tested against at 83AAH.
8379
POP DE D1
Pop Register Pair DE, which takes the new starting line number off the stack, where 8353H put it.
837A
PUSH DE D5
Push Register Pair DE straight back, because RENB1 at 83B0H and the read at 8388H both still want it there.
837B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the number of the line after the range into Register Pair DE and the new starting line number into Register Pair HL.
837C
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL, which sets the Carry Flag only when the new starting line number is below the number of the line that follows the range.
837E
Jump to FUNCERR at 5F95H when the Carry Flag was not set, which prints Illegal function call, because a renumbering that starts at or above the following line's number would put the program out of order at once.
8381
LD DE,0000H 11 00 00
Load Register Pair DE with the word at 8382H, the old starting line number that 834DH wrote into this instruction's operand. The operand holds 0000H in the file.
8384
Call FIND at 5AB4H, which searches the program for the old starting line number in Register Pair DE and leaves Register Pair HL pointing at the first line of the range to be renumbered.
8387
EXX D9
Switch to the alternate register set with EXX, which stows the program pointer in Register Pair HL and takes up the alternate Register Pair HL and Register Pair BC for the running new line number and the increment.
8388
POP HL E1
Pop Register Pair HL, which takes the new starting line number off the stack into the alternate Register Pair HL, where it is the running total the increment is added to.
8389
PUSH HL E5
Push Register Pair HL straight back, because RENB1 at 83B0H still expects to find it on the stack.
838A
LD BC,0000H 01 00 00
Load Register Pair BC with the word at 838BH, the increment that 8354H wrote into this instruction's operand, so the alternate Register Pair BC holds the step between new line numbers. The operand holds 0000H in the file.
838D
EXX D9
Switch back from the alternate register set with EXX, which brings the program pointer back into Register Pair HL and stows the running total and the increment.
838E
LD DE,0000H 11 00 00
Load Register Pair DE with the word at 838FH, the address of the last line of the range that 8369H wrote into this instruction's operand, which the walk below stops at. The operand holds 0000H in the file.
8391ENDLP
PUSH HL E5
ENDLP (8391H), the top of the walk down the range: push Register Pair HL, saving the address of the line reached over the comparison that follows.
8392
OR A B7
Clear the Carry Flag with OR A on Register A, which the subtraction at 8393H needs.
8393
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL, which leaves the Zero Flag set when the line reached is the last line of the range.
8395
POP HL E1
Pop Register Pair HL, bringing back the address of the line reached, which the subtraction at 8393H changed.
8396
Jump to CKEND at 83A5H when the last line of the range has been reached, which is where the running total is tested.
8398
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, the low byte of this line's pointer to the next line.
8399
LD C,A 4F
Load Register C from Register A, keeping that low byte while Register A is used for the test of the whole pointer.
839A
INC HL 23
Increment Register Pair HL to point at the high byte of the pointer to the next line.
839B
OR (HL) B6
OR the byte Register Pair HL points at into Register A, which leaves the Zero Flag set when the pointer is 0000H and so the walk has reached the end of the program.
839C
Jump to CKEND at 83A5H when the end of the program was reached, which tests the running total as it stands.
839E
LD H,(HL) 66
Load Register H from the byte Register Pair HL points at, the high byte of the pointer to the next line.
839F
LD L,C 69
Load Register L from Register C, which completes the address of the next line in Register Pair HL.
83A0
EXX D9
Switch to the alternate register set with EXX, which brings the running new line number into Register Pair HL and the increment into Register Pair BC.
83A1
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which steps the running new line number on by one increment, one line of the range having been counted.
83A2
EXX D9
Switch back from the alternate register set with EXX, which brings the program pointer back into Register Pair HL.
83A3
Jump back to ENDLP at 8391H, which counts the next line of the range.
83A5CKEND
EXX D9
CKEND (83A5H), reached from 8396H and 839CH: switch to the alternate register set with EXX, which brings the highest new line number into Register Pair HL.
83A6
LD DE,0000H 11 00 00
Load Register Pair DE with the word at 83A7H, the number of the line after the range that 8376H wrote into this instruction's operand. The operand holds 0000H in the file, and it is still 0000H when the range ends at the end of the program, because 836FH jumps past 8376H in that case.
83A9
OR A B7
Clear the Carry Flag with OR A on Register A, which the subtraction at 83AAH needs.
83AA
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL, which sets the Carry Flag only when the highest new line number is below the number of the line that follows the range.
83AC
EXX D9
Switch back from the alternate register set with EXX, which leaves the flags of the subtraction as they are because EXX does not touch them.
83AD
Jump to FUNCERR at 5F95H when the Carry Flag was not set, which prints Illegal function call, because the renumbering would have carried a line of the range up to or past the number of the line after it.
83B0RENB1
POP BC C1
RENB1 (83B0H), reached from 836FH: pop Register Pair BC, bringing back the new starting line number that 8353H saved.
83B1
POP DE D1
Pop Register Pair DE, bringing back the increment that 8352H saved.
83B2
POP HL E1
Pop Register Pair HL, bringing back the line pointer that 8351H saved, which leaves the stack as the first module left it.
83B3RENRET
RENRET (83B3H), also reached from 834AH: jump to 65B8H, the point of the first module that follows the three bytes the patch at 65B5H wrote over, which tests the new starting line number for 0000H and carries the RENUM statement on.
83B6RENC
LD DE,0000H 11 00 00
RENC (83B6H), the entry jumped to from the patch at 6604H: load Register Pair DE with the word at 83B7H, the address of the last line of the range, which RENA wrote as 0FFFFH at 8342H or RENB as the real address at 8365H. The operand holds 0000H in the file.
83B9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the end of the range into Register Pair HL and the address the renumbering loop has reached into Register Pair DE.
83BA
OR A B7
Clear the Carry Flag with OR A on Register A, which the subtraction at 83BBH needs.
83BB
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL, which sets the Carry Flag when the address reached is past the end of the range. With the operand at 83B7H left at 0FFFFH by RENA the Carry Flag is never set, because no line of the program stands above FFFFH, so the renumbering runs to the end.
83BD
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL again, which brings the address the loop has reached back into Register Pair HL for the first module to go on with.
83BE
Jump to 6618H when the Carry Flag was set, the point of the first module that ends the renumbering and walks the program again to put the new numbers into the line references.
83C1
LD E,(HL) 5E
Load Register E from the byte Register Pair HL points at, the low byte of the link to the next line, which is the first of the four bytes that head a line and not its number.
83C2
INC HL 23
Increment Register Pair HL to point at the high byte of that link, which is where the first module expects to find it.
83C3
LD D,(HL) 56
Load Register D from the byte Register Pair HL points at, which completes the address of the next line in Register Pair DE; 6607H reads it as 0000H to know that the program has ended, and 6615H takes it off the stack as the line to go round the loop with.
83C4
Jump to 6607H, the point of the first module that follows the three bytes the patch at 6604H wrote over, which writes this line's new number into the two bytes at Register Pair HL plus one and plus two and goes round the loop again.

83C7H - ABBTBL and the Variables of the Package

ABBTBL is the table CKABBR at 81F6H searches: nine pairs of a letter and the keyword token it stands for, ended by a word of 0000H. Four of the tokens are below 06H and name commands that live in the BASIC/OV2 overlay rather than in BASIC itself, so ABBR at 81CCH sends those to MORC 8234H; the other five are tokens of the first module's own keywords and go back into the line for its tokenizer to find. The six cells that follow the table are the package's own storage, and NEWB/EQU exports every one of them so that BASIC/OV2 can read and write them: they are what makes a FIND or a SEARCH repeatable, because the overlay leaves in them the type of the last search, the line it stopped at, the line number and keyword it was looking for and the variable name it was given. All of them hold 00H in the file.

83C7-83C8ABBTBL
DEFM "A" / DEFB 0ABH 41 AB
ABBTBL (83C7H-83C8H), the first pair: the letter A and 0ABH, the token of the AUTO keyword of the first module.
83C9-83CA
DEFM "C" / DEFB 05H 43 05
83C9H-83CAH: the letter C and 05H, the request number BASIC/OV2 reads as COPY. The token is below 06H, so ABBR sends it to MORC at 8234H to load the overlay.
83CB-83CC
DEFM "D" / DEFB 0AAH 44 AA
83CBH-83CCH: the letter D and 0AAH, the token of the DELETE keyword of the first module.
83CD-83CE
DEFM "E" / DEFB 0A7H 45 A7
83CDH-83CEH: the letter E and 0A7H, the token of the EDIT keyword of the first module.
83CF-83D0
DEFM "F" / DEFB 04H 46 04
83CFH-83D0H: the letter F and 04H, the request number for FIND. BASIC/OV2 takes 05H as COPY and 02H as MOVE and treats every other value, 04H and 03H among them, as a find, telling the two apart by LSTTYP$ at 83DBH.
83D1-83D2
DEFM "L" / DEFB 93H 4C 93
83D1H-83D2H: the letter L and 93H, the token of the LIST keyword of the first module.
83D3-83D4
DEFM "M" / DEFB 02H 4D 02
83D3H-83D4H: the letter M and 02H, the request number BASIC/OV2 reads as MOVE.
83D5-83D6
DEFM "S" / DEFB 03H 53 03
83D5H-83D6H: the letter S and 03H, the request number for SEARCH, which BASIC/OV2 answers with its find code and separates from FIND by the type it leaves in LSTTYP$ at 83DBH.
83D7-83D8
DEFM "!" / DEFB 0BDH 21 BD
83D7H-83D8H: the exclamation mark and 0BDH, the token of the SYSTEM keyword of the first module, which is the one abbreviation that is not a letter.
83D9-83DA
DEFW 0000H 00 00
83D9H-83DAH: the word of 00H bytes that ends ABBTBL. CKABBR reads the first of the two at 81F6H and gives the search up at 81F9H when it is 00H, so only that byte is needed, and the second completes the pair the table is built of.
83DBLSTTYP$
DEFB 00H 00
LSTTYP$, 83DBH: the type of the last search BASIC/OV2 made, which is how it tells a FIND from a SEARCH when both reach it as a find request. NEWB/EQU exports the address. 00H in the file.
83DC-83DDLSTLIN$
DEFW 0000H 00 00
LSTLIN$, 83DCH-83DDH: the line BASIC/OV2 stopped at during the last find, which is where the next find of the same kind takes up. NEWB/EQU exports the address. 0000H in the file.
83DE-83DFLSTNUM$
DEFW 0000H 00 00
LSTNUM$, 83DEH-83DFH: the last line number BASIC/OV2 was asked to look for. NEWB/EQU exports the address. 0000H in the file.
83E0LSTKEY$
DEFB 00H 00
LSTKEY$, 83E0H: the last keyword token BASIC/OV2 was asked to look for. NEWB/EQU exports the address. 00H in the file.
83E1-83EBLSTVAR$
DEFB 00H x 11 00 x 11
LSTVAR$, 83E1H-83EBH: eleven bytes holding the last variable name BASIC/OV2 was asked to look for, which is a name of up to the length BASIC allows. NEWB/EQU exports the address. All eleven are 00H in the file.

83ECH - BEGIN: the Start-up of BASIC

BEGIN at 83ECH is the transfer address of BASIC/CMD, so this is where the DOS hands control over when BASIC is run, and it is the enhancement package and not the first module that gets it: MAKBAS/CMD wrote the package over the first module's own 02H transfer record, and the package's start-up stands here in place of the first module's. Register Pair HL holds the address of the rest of the DOS command line on entry, which 83F9H keeps in DOSCLIN 8044H. BEGIN loads BASIC/OV1, sets the pointers and the stack, reads HIGH$ to find the top of memory, takes a file specification and then the FILES and MEMORY parameters off the command line through @FSPEC and @PARAM, works out where the program area, the string space and the file buffers go, writes the addresses of three system flag bytes into cells of both modules, puts the sign-on message up and jumps to STARTUP 8028H in the first module. Two things about the memory it lays out are worth keeping in mind: the program area is set to begin at 83EDH, which is inside BEGIN's own first instruction, so the user's program reclaims the start-up code and the parameter tables once they have done their work, and STARTUP puts 00H in the byte below it, which is 83ECH, the first byte of BEGIN. The string space is an eighth of the free memory with a ceiling of 0200H bytes, and 564 bytes go to each file buffer. The one way out other than STARTUP is ABORT at 850CH, which shows the Bad Command Line Parameter(s) text at PRMERR$ 8515H and ends the program with @ABORT.

83ECBEGIN
LD A,(854DH) 3A 4D 85LD A,(STOR1$)
BEGIN (83ECH), the transfer address of BASIC/CMD and the first instruction the DOS gives control to: load Register A from the byte at STOR1$ 854DH, which is 00H in the file and which 83F6H sets to 01H once the start-up has been through.
83EF
OR A B7
Set the flags from Register A with OR A, which leaves the Zero Flag set when STOR1$ 854DH still holds the 00H the file was loaded with.
83F0
Jump to BEGINA at 83F5H when STOR1$ 854DH held 00H, which is the ordinary path through the start-up.
83F2
LD A,15H 3E 15
Load Register A with 15H, 21, the number of @ABORT, the supervisor call that ends the program and returns to the DOS with an abort code.
83F4
RST 28H EF
Issue RST 28H, calling @ABORT at 1B08H, which ends BASIC, because a start-up that finds STOR1$ 854DH already set has been entered a second time on the image in memory and must not lay the memory out again.
83F5BEGINA
INC A 3C
BEGINA (83F5H): increment Register A from 00H to 01H, the value that marks the start-up as done.
83F6
LD (854DH),A 32 4D 85LD (STOR1$),A
Store Register A in the byte at STOR1$ 854DH, which marks the start-up as done for the test at 83ECH.
83F9
LD (8044H),HL 22 44 80LD (DOSCLIN),HL
Store Register Pair HL in the word at DOSCLIN 8044H, which keeps the address of the rest of the DOS command line that the DOS left in Register Pair HL, read back at 8428H and 8438H.
83FC
LD HL,86A4H 21 A4 86
Load Register Pair HL with 86A4H, which is 202 bytes above 85DAH, the byte after the last one the file loads, and so stands clear of the whole of both modules.
83FF
LD (6E9AH),HL 22 9A 6ELD (BASEND),HL
Store Register Pair HL in the word at BASEND 6E9AH, the top of memory BASIC works to, as a first value that 84B0H replaces once the real top is known.
8402
Call 7F1FH, the routine of the first module that both NEWB/ASM and BMOVE/ASM name OV1 and that reads BASIC/OV1 in at 2600H, so the overlay is in memory before anything needs it.
8405
Call 4317H, the routine of the first module that takes its own return address off the stack into Register Pair BC, sets the pointers of the interpreter from BASEND 6E9AH, points the Stack Pointer at the top of memory and returns through the RET at 434CH to 8408H with one word of 0000H left on the new stack.
8408
LD A,3AH 3E 3A
Load Register A with 3AH, a colon, which is the character that stands in front of a line in the line buffer.
840A
LD (6EF9H),A 32 F9 6E
Store Register A in the byte at 6EF9H, the first byte of the line buffer the first module calls LBUF, so the colon ABBR steps over at 81C8H is there from the start.
840D
LD HL,0FFFEH 21 FE FF
Load Register Pair HL with 0FFFEH, which is the value given to the free string space count next.
8410
LD (6E9CH),HL 22 9C 6ELD (MAXSPAC),HL
Store Register Pair HL in the word at MAXSPAC 6E9CH, the count of string space free, which 8506H sets to FFFFH once the layout is settled.
8413
LD HL,71C1H 21 C1 71
Load Register Pair HL with 71C1H, a cell of the first module, which is the value stored next.
8416
LD (7229H),HL 22 29 72
Store Register Pair HL in the word at 7229H, a pointer of the first module that is to hold 71C1H as the start-up begins.
8419
LD A,03H 3E 03
Load Register A with 03H, the number of file buffers BASIC sets up when the FILES parameter is not given.
841B
LD (6ECEH),A 32 CE 6E
Store Register A in the byte at 6ECEH, the cell of the first module that holds the number of file buffers, which 845CH replaces when FILES was given on the command line.
841E
LD B,00H 06 00
Load Register B with 00H, which is the function code @HIGH$ reads as a request to report the current value rather than to set a new one.
8420
LD H,B 60
Load Register H from Register B, giving Register H the value 00H.
8421
LD L,B 68
Load Register L from Register B, so Register Pair HL holds 0000H, which with Register B at 00H asks @HIGH$ for the present top of user memory.
8422
LD A,64H 3E 64
Load Register A with 64H, 100, the number of @HIGH$, the supervisor call that reads or sets the highest address a program may use.
8424
RST 28H EF
Issue RST 28H, calling @HIGH$ at 1948H, which comes back with Register Pair HL holding the highest address available to BASIC.
8425
LD (7151H),HL 22 51 71LD (OLDHI),HL
Store Register Pair HL in the word at OLDHI 7151H, which NEWB/ASM names as the value of HIGH$ on entry to BASIC and which 845FH reads back.
8428
LD HL,(8044H) 2A 44 80LD HL,(DOSCLIN)
Load Register Pair HL from the word at DOSCLIN 8044H, the address of the rest of the DOS command line kept at 83F9H.
842B
LD DE,7039H 11 39 70LD DE,INBUF
Load Register Pair DE with 7039H, the address of INBUF, the buffer the file specification off the command line is built in.
842E
LD A,4EH 3E 4E
Load Register A with 4EH, 78, the number of @FSPEC, the supervisor call that reads a file specification from the line Register Pair HL points at into the control block Register Pair DE points at.
8430
RST 28H EF
Issue RST 28H, calling @FSPEC at 1981H, which builds a file specification in INBUF at 7039H from the DOS command line and comes back with the Zero Flag reset when there is none to read.
8431
Jump to M833C at 8438H when @FSPEC found no file specification, which starts the parameter scan at the front of the command line again.
8433
LD (8046H),HL 22 46 80
Store Register Pair HL in the word at 8046H, the point of the command line @FSPEC stopped at, which STARTUP 8028H reads at 8031H to run the file that was named.
8436
Jump to M833F at 843BH, which goes on to the parameter scan with Register Pair HL at the point the file specification ended.
8438M833C
LD HL,(8044H) 2A 44 80LD HL,(DOSCLIN)
M833C (8438H), reached from 8431H: load Register Pair HL from the word at DOSCLIN 8044H again, so the parameter scan reads the command line from its start when no file was named.
843BM833F
LD DE,8534H 11 34 85LD DE,PRMTBL
M833F (843BH), also fallen into from 8436H: load Register Pair DE with 8534H, the address of PRMTBL, the parameter table that names FILES and MEMORY.
843E
LD A,11H 3E 11
Load Register A with 11H, 17, the number of @PARAM, the supervisor call that reads a parenthesised parameter list against a table.
8440
RST 28H EF
Issue RST 28H, calling @PARAM at 1987H, which parses the parameters, stores each value at the address its table entry names and marks each entry's response byte, coming back with the Zero Flag reset when the list is bad.
8441
Jump to ABORT at 850CH when @PARAM came back with the Zero Flag reset, which shows the Bad Command Line Parameter(s) text and ends the program.
8444
LD A,(853BH) 3A 3B 85LD A,(M8464)
Load Register A from the byte at 853BH, the response byte of the FILES entry of PRMTBL, which @PARAM leaves at 00H when the parameter was not given, with bit 7 set when it was given a number and with bit 6 set when it was given as a switch.
8447
OR A B7
Set the flags from Register A with OR A, which leaves the Zero Flag set when FILES was not on the command line at all.
8448
Jump to M8363 at 845FH when FILES was not given, which leaves the three buffers 841BH set up.
844A
AND 80H E6 80
AND Register A with 80H, which keeps only the bit @PARAM sets when the parameter was given a numeric value.
844C
Jump to ABORT at 850CH when bit 7 of the response byte was clear, which is what happens when FILES was given as a switch or a string rather than a number.
844F
LD HL,(8549H) 2A 49 85LD HL,(STOR2$)
Load Register Pair HL from the word at STOR2$ 8549H, where @PARAM stored the value given for FILES because the table entry at 853CH names that address.
8452
LD DE,0010H 11 10 00
Load Register Pair DE with 0010H, sixteen, which is one more than the highest number of file buffers BASIC allows.
8455
Call CPHLDE at 434DH, the routine of the first module that compares Register Pair HL with Register Pair DE, so the Carry Flag comes back set only when the number given is below sixteen.
8458
Jump to ABORT at 850CH when the number given was sixteen or more, which shows the Bad Command Line Parameter(s) text and ends the program.
845B
LD A,L 7D
Load Register A from Register L, the low byte of the number of files given, the high byte being known to be 00H from the comparison at 8455H.
845C
LD (6ECEH),A 32 CE 6E
Store Register A in the byte at 6ECEH, the cell of the first module that holds the number of file buffers, replacing the 03H that 841BH put there.
845FM8363
LD HL,(7151H) 2A 51 71LD HL,(OLDHI)
M8363 (845FH), also reached from 8448H: load Register Pair HL from the word at OLDHI 7151H, the value of HIGH$ that 8425H kept, which is the top of memory the layout works down from.
8462
LD A,(8545H) 3A 45 85LD A,(M846E)
Load Register A from the byte at 8545H, the response byte of the MEMORY entry of PRMTBL, which @PARAM marks the same way as the FILES entry.
8465
OR A B7
Set the flags from Register A with OR A, which leaves the Zero Flag set when MEMORY was not on the command line.
8466
Jump to M837C at 8478H when MEMORY was not given, which leaves the top of memory at the value HIGH$ reported.
8468
AND 80H E6 80
AND Register A with 80H, which keeps only the bit @PARAM sets when the parameter was given a numeric value.
846A
Jump to ABORT at 850CH when bit 7 of the response byte was clear, which is what happens when MEMORY was given as a switch or a string rather than a number.
846D
LD DE,(854BH) ED 5B 4B 85LD DE,(STOR3$)
Load Register Pair DE from the word at STOR3$ 854BH, where @PARAM stored the value given for MEMORY because the table entry at 8546H names that address.
8471
Call CPHLDE at 434DH, which compares Register Pair HL, the top of memory HIGH$ reported, with Register Pair DE, the address given for MEMORY.
8474
Jump to ABORT at 850CH when the Carry Flag came back set, which says the address given for MEMORY stands above the top of memory HIGH$ reported.
8477
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which makes the address given for MEMORY the top of memory the layout works down from.
8478M837C
M837C (8478H), also reached from 8466H: call 7FEDH, the routine of the first module that takes 564 bytes off Register Pair HL once for each file buffer and once more, the count coming from 6ECEH, and comes back with the Carry Flag set when there was room and clear when the subtraction ran below zero.
847B
Jump to ABORT at 850CH when the Carry Flag came back clear, which says there is not enough memory for the file buffers asked for.
847E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the top of the space left below the file buffers into Register Pair DE.
847F
LD HL,83EDH 21 ED 83LD HL,M82F1
Load Register Pair HL with 83EDH, the second byte of BEGIN's own first instruction, which is where the BASIC program area is to start, so the program reclaims the start-up code and the parameter tables once they have done their work.
8482
LD (6E9EH),HL 22 9E 6E
Store Register Pair HL in the word at 6E9EH, PGMBGN, the pointer to the start of the BASIC program, which fixes the program area at 83EDH.
8485
LD A,E 7B
Load Register A from Register E, the low byte of the top of the space left, the first of the six instructions that subtract the program base from it.
8486
SUB L 95
Subtract Register L from Register A, the low byte of the program base at 83EDH.
8487
LD L,A 6F
Load Register L from Register A, keeping that low byte of the difference.
8488
LD A,D 7A
Load Register A from Register D, the high byte of the top of the space left.
8489
SBC A,H 9C
Subtract Register H from Register A with the borrow of the low byte, giving the high byte of the difference.
848A
LD H,A 67
Load Register H from Register A, so Register Pair HL holds the number of bytes between the program base and the top of the space left.
848B
Jump to ABORT at 850CH when that subtraction borrowed, which says the top of the space left stands below the program base at 83EDH and there is no room for a program at all.
848E
LD B,03H 06 03
Load Register B with 03H, the number of times the free space is halved to give an eighth of it.
8490M8394
OR A B7
M8394 (8490H), the top of the halving loop: clear the Carry Flag with OR A on Register A, so that the rotate at 8492H shifts a 0 into the high bit.
8491
LD A,H 7C
Load Register A from Register H, the high byte of the free space.
8492
RRA 1F
Rotate Register A right through the Carry Flag with RRA, which halves the high byte and puts its lowest bit into the Carry Flag.
8493
LD H,A 67
Load Register H from Register A, the halved high byte.
8494
LD A,L 7D
Load Register A from Register L, the low byte of the free space.
8495
RRA 1F
Rotate Register A right through the Carry Flag with RRA, which brings the bit from the high byte into the top of the low byte.
8496
LD L,A 6F
Load Register L from Register A, so Register Pair HL holds half of what it held at 8490H.
8497
DEC B 05
Decrement Register B, counting one halving off the three.
8498
Jump back to M8394 at 8490H while Register B is not 00H, so the free space is halved three times and Register Pair HL holds an eighth of it.
849B
LD A,H 7C
Load Register A from Register H, the high byte of that eighth, which is the whole number of pages it comes to.
849C
CP 02H FE 02
Compare Register A with 02H, two pages, which is 512 bytes and the most string space BASIC sets aside here.
849E
Jump to M83A7 at 84A3H when the eighth is below two pages, which keeps it as the string space.
84A0
LD HL,0200H 21 00 02
Load Register Pair HL with 0200H, 512, which is the ceiling put on the string space when an eighth of the free memory comes to more.
84A3M83A7
LD A,E 7B
M83A7 (84A3H), also reached from 849EH: load Register A from Register E, the low byte of the top of the space left, the first of the six instructions that take the string space off it.
84A4
SUB L 95
Subtract Register L from Register A, the low byte of the string space.
84A5
LD L,A 6F
Load Register L from Register A, keeping that low byte of the difference.
84A6
LD A,D 7A
Load Register A from Register D, the high byte of the top of the space left.
84A7
SBC A,H 9C
Subtract Register H from Register A with the borrow of the low byte, giving the high byte of the difference.
84A8
LD H,A 67
Load Register H from Register A, so Register Pair HL points at the byte below the string space, which is the top of the space the program and its variables may use.
84A9
LD (7153H),HL 22 53 71
Store Register Pair HL in the word at 7153H, a pointer of the first module that is to hold the top of the space below the string space.
84AC
LD (7178H),HL 22 78 71
Store Register Pair HL in the word at 7178H, the pointer NEWB/ASM names HIPT and that FASTLD reads at 82A5H to work out whether a program will fit.
84AF
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which brings the top of the space left below the file buffers back into Register Pair HL.
84B0
LD (6E9AH),HL 22 9A 6ELD (BASEND),HL
Store Register Pair HL in the word at BASEND 6E9AH, the top of memory BASIC works to, replacing the first value 83FFH put there.
84B3
LD SP,HL F9
Load the Stack Pointer from Register Pair HL, which puts the stack at the top of memory now that the layout is settled.
84B4
LD (718EH),HL 22 8E 71
Store Register Pair HL in the word at 718EH, a pointer of the first module that is to hold the top of memory as well.
84B7
LD HL,(6E9EH) 2A 9E 6E
Load Register Pair HL from the word at 6E9EH, PGMBGN, the start of the program area that 8482H fixed at 83EDH.
84BA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL, which puts the program base into Register Pair DE and the top of memory into Register Pair HL for the routine called next.
84BB
Call 426DH, the routine of the first module that checks the space between the pointers and jumps to the Out of memory entry at 425CH when there is not enough.
84BE
Call 7FFBH, the routine of the first module that lays out the file buffers from the word at BASEND 6E9AH upwards, 564 bytes to each, as many as the count at 6ECEH names.
84C1
LD A,65H 3E 65
Load Register A with 65H, 101, the number of @FLAGS, the supervisor call that comes back with Index Register IY pointing at the system flag table at FLGTAB$ 006AH.
84C3
RST 28H EF
Issue RST 28H, calling @FLAGS at 196AH, which leaves Index Register IY holding 006AH, the address of the first byte of the flag table.
84C4
PUSH IY FD E5
Push Index Register IY, putting the address of the flag table on the stack so that it can be taken off into Register Pair HL.
84C6
POP HL E1
Pop Register Pair HL, which gives Register Pair HL the value 006AH, the address of the flag table.
84C7
INC HL 23
Increment Register Pair HL to 006BH, the first of the two steps to the third byte of the flag table.
84C8
INC HL 23
Increment Register Pair HL to 006CH, the address of CFLAG$, the flag byte whose bit 0 the DOS reads as memory frozen.
84C9
LD (7C6FH),HL 22 6F 7C
Store Register Pair HL in the word at 7C6FH, one of three empty word cells of the first module at 7C6BH, 7C6DH and 7C6FH, all 0000H in the file, that the start-up fills with the addresses of the flag bytes so that the first module can reach them.
84CC
DI F3
Disable interrupts with DI, so that the read, change and write of the flag byte that follows cannot be cut into by a task.
84CD
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, CFLAG$ at 006CH.
84CE
OR 01H F6 01
OR Register A with 01H, which sets bit 0 of CFLAG$, the bit the DOS reads as memory frozen, so that nothing moves HIGH$ while BASIC is running.
84D0
LD (HL),A 77
Store Register A in the byte Register Pair HL points at, writing the changed CFLAG$ back to 006CH.
84D1
EI FB
Enable interrupts with EI, the change to CFLAG$ at 006CH being complete.
84D2
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the distance from CFLAG$ at 006CH to KFLAG$ at 0074H.
84D5
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which leaves Register Pair HL holding 0074H, the address of KFLAG$, the keyboard flag byte.
84D6
LD (7C6BH),HL 22 6B 7C
Store Register Pair HL in the word at 7C6BH, the second of the three cells of the first module that take the addresses of the flag bytes.
84D9
DI F3
Disable interrupts with DI, so that the read, change and write of KFLAG$ that follows cannot be cut into by the keyboard task.
84DA
LD A,(HL) 7E
Load Register A from the byte Register Pair HL points at, KFLAG$ at 0074H.
84DB
AND 0F8H E6 F8
AND Register A with 0F8H, which resets bits 0, 1 and 2 of KFLAG$, the bits the DOS sets for BREAK, for pause and for ENTER, so that none of the three is left pending as BASIC starts.
84DD
LD (HL),A 77
Store Register A in the byte Register Pair HL points at, writing the changed KFLAG$ back to 0074H.
84DE
EI FB
Enable interrupts with EI, the change to KFLAG$ at 0074H being complete.
84DF
LD C,08H 0E 08
Load Register C with 08H, the distance from KFLAG$ at 0074H to SFLAG$ at 007CH. Register B still holds 00H from 84D2H, so Register Pair BC holds 0008H.
84E1
ADD HL,BC 09
Add Register Pair BC to Register Pair HL, which leaves Register Pair HL holding 007CH, the address of SFLAG$, the flag byte whose bit 5 says a Job Control Language file is supplying the input.
84E2
LD (7C6DH),HL 22 6D 7C
Store Register Pair HL in the word at 7C6DH, the third of the three cells of the first module that take the addresses of the flag bytes.
84E5
LD (80B9H),HL 22 B9 80LD (SFLAG1),HL
Store Register Pair HL in the word at 80B9H, the operand of the LD A instruction at 80B8H, so that IMMED reads SFLAG$ at 007CH. The operand holds 0000H in the file.
84E8
LD (81BAH),HL 22 BA 81LD (SFLAG2),HL
Store Register Pair HL in the word at 81BAH, the operand of the LD A instruction at 81B9H, so that ABBR reads SFLAG$ at 007CH as well. That operand holds 0000H in the file too.
84EB
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, which @BREAK reads as a request to take the break vector away.
84EE
LD A,67H 3E 67
Load Register A with 67H, 103, the number of @BREAK, the supervisor call that sets or clears the address the DOS jumps to when BREAK is pressed.
84F0
RST 28H EF
Issue RST 28H, calling @BREAK at 196FH with Register Pair HL holding 0000H, which turns the vectored break off so that BASIC sees BREAK through KFLAG$ at 0074H instead.
84F1
Call 7E00H, the routine of the first module that clears the display with @CLS, supervisor call 105, and puts 00H in the byte at 713CH.
84F4
Call 7D4FH, the routine of the first module that saves Register AF, calls @CKBRKC, supervisor call 106, to clear any BREAK that is pending, and brings Register AF back.
84F7
LD HL,854EH 21 4E 85LD HL,SIGNON$
Load Register Pair HL with 854EH, the address of SIGNON$, the sign-on text of BASIC.
84FA
Call 46A5H, the routine of the first module that BMOVE/ASM names BASDSP and that displays the text Register Pair HL points at up to its 00H byte.
84FD
LD HL,46A5H 21 A5 46
Load Register Pair HL with 46A5H, the address of that same display routine of the first module.
8500
LD (5931H),HL 22 31 59
Store Register Pair HL in the word at 5931H, a cell of the first module that is to hold the address of the routine used to display a line.
8503
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with 0FFFFH, the value the free string space count is left at once the layout is settled.
8506
LD (6E9CH),HL 22 9C 6ELD (MAXSPAC),HL
Store Register Pair HL in the word at MAXSPAC 6E9CH, the count of string space free, replacing the FFFEH that 8410H put there.
8509
Jump to STARTUP at 8028H, the entry of the first module that NEWB/ASM names and that runs BASIC, reading at 8031H the command line pointer 8433H kept at 8046H so that a file named on the DOS command line is run. Its third instruction puts 00H in the byte below the program area, which is 83ECH, the first byte of BEGIN.
850CABORT
LD HL,8515H 21 15 85LD HL,PRMERR$
ABORT (850CH), reached from 8441H, 844CH, 8458H, 846AH, 8474H, 847BH and 848BH: load Register Pair HL with 8515H, the address of PRMERR$, the Bad Command Line Parameter(s) text.
850F
Call 46A5H, the display routine of the first module, which puts the Bad Command Line Parameter(s) text on the display.
8512
LD A,15H 3E 15
Load Register A with 15H, 21, the number of @ABORT, the supervisor call that ends the program and returns to the DOS with an abort code.
8514
RST 28H EF
Issue RST 28H, calling @ABORT at 1B08H, which ends BASIC, the command line having been wrong.

8515H - PRMERR$, PRMTBL, the Stores and SIGNON$

The last 197 bytes of the module are its text and its tables. PRMERR$ at 8515H is the one message the package shows for itself, put up by ABORT at 850FH when the command line is wrong. PRMTBL at 8534H is the table BEGIN hands to @PARAM at 8440H, in the version 6 form: a format byte, then an entry for each parameter made of a byte holding its type and the length of its name, the name, a response byte of 00H, and the address the value is to be stored at, and then a byte of 00H to end the table. @PARAM marks each response byte as it goes, setting bit 7 when the parameter was given a number, bit 6 when it was given as a switch and bit 5 with the length when it was given a string, which is why BEGIN tests those bytes at 8444H and 8462H for bit 7 and treats anything else as an error. The two values land in STOR2$ 8549H and STOR3$ 854BH, and STOR1$ 854DH is the byte BEGIN uses to catch a second entry to the start-up. SIGNON$ at 854EH is the text BASIC puts up when it starts, and it is worth reading: the interpreter is Microsoft's, licensed to Tandy, the version it gives is 01.01.02 where MAKBAS/CMD requires the module it is installed over to be 01.01.00, the system it names is TRSDOS Version 6 rather than LS-DOS, and the enhancement is credited to LSI, Logical Systems, Inc. Every byte from 8515H up is inside the program area, which BEGIN fixes at 83EDH, so a program of any size writes over all of it once the start-up has finished with it.

8515-8532PRMERR$
DEFM "Bad Command Line Parameter(s)" / DEFB 0DH 42 61 64 20 43 6F 6D 6D 61 6E 64 20 4C 69 6E 65 20 50 61 72 61 6D 65 74 65 72 28 73 29 0D
PRMERR$, 8515H-8532H: the message ABORT at 850CH shows when @PARAM fails or a parameter is out of range, ended by the carriage return 0DH. NEWB/EQU exports the address.
8533
DEFB 00H 00
8533H: the 00H byte that ends the PRMERR$ text for the display routine at 46A5H, which stops at the first 00H.
8534PRMTBL
DEFB 80H 80
PRMTBL, 8534H: the first byte of the parameter table, which @PARAM reads as the version 6 table format mark.
8535
DEFB 95H 95
8535H: the type and length byte of the FILES entry, 80H for a parameter that takes a value, 10H for a single value and 05H for the five characters of its name.
8536-853B
DEFM "FILES" / DEFB 00H 46 49 4C 45 53 00
8536H-853BH: the name FILES and its response byte. @PARAM sets bit 7 of 853BH when the parameter was given a number, and BEGIN reads that byte at 8444H.
853C-853D
DEFW 8549H 49 85
853CH-853DH: the address @PARAM stores the value of FILES at, which is STOR2$ 8549H, read by BEGIN at 844FH.
853E
DEFB 96H 96
853EH: the type and length byte of the MEMORY entry, 80H for a parameter that takes a value, 10H for a single value and 06H for the six characters of its name.
853F-8545
DEFM "MEMORY" / DEFB 00H 4D 45 4D 4F 52 59 00
853FH-8545H: the name MEMORY and its response byte. @PARAM sets bit 7 of 8545H when the parameter was given a number, and BEGIN reads that byte at 8462H.
8546-8547
DEFW 854BH 4B 85
8546H-8547H: the address @PARAM stores the value of MEMORY at, which is STOR3$ 854BH, read by BEGIN at 846DH.
8548
DEFB 00H 00
8548H: the 00H byte that ends PRMTBL, which @PARAM reads as the end of the table, so FILES and MEMORY are the only two parameters BASIC takes on its command line.
8549-854ASTOR2$
DEFW 0000H 00 00
STOR2$, 8549H-854AH: the word @PARAM writes the value of FILES into, read by BEGIN at 844FH and tested there against 0010H. NEWB/EQU exports the address. 0000H in the file.
854B-854CSTOR3$
DEFW 0000H 00 00
STOR3$, 854BH-854CH: the word @PARAM writes the value of MEMORY into, read by BEGIN at 846DH and tested there against the value HIGH$ reported. NEWB/EQU exports the address. 0000H in the file.
854DSTOR1$
DEFB 00H 00
STOR1$, 854DH: the byte BEGIN reads at 83ECH and sets to 01H at 83F6H, so that a second entry to the transfer address on the image already in memory ends the program with @ABORT instead of laying the memory out again. NEWB/EQU exports the address. 00H in the file.
854E-8571SIGNON$
DEFM "BASIC 01.01.02 for TRSDOS Version 6" / DEFB 0DH 42 41 53 49 43 20 30 31 2E 30 31 2E 30 32 20 66 6F 72 20 54 52 53 44 4F 53 20 56 65 72 73 69 6F 6E 20 36 0D
SIGNON$, 854EH-8571H: the first line of the sign-on text, put up by BEGIN at 84FAH. The version given is 01.01.02, where MAKBAS/CMD requires the module the package is installed over to carry the transfer address of version 01.01.00, and the system named is TRSDOS Version 6, the Tandy name of this DOS, rather than LS-DOS. NEWB/EQU exports the address.
8572-85B1
DEFM "Copyright (c) 1984 by Microsoft, licensed to Tandy Corporation." / DEFB 0DH 43 6F 70 79 72 69 67 68 74 20 28 63 29 20 31 39 38 34 20 62 79 20 4D 69 63 72 6F 73 6F 66 74 2C 20 6C 69 63 65 6E 73 65 64 20 74 6F 20 54 61 6E 64 79 20 43 6F 72 70 6F 72 61 74 69 6F 6E 2E 0D
8572H-85B1H: the second line of the sign-on text. The interpreter of the first module is Microsoft's, licensed to Tandy, which is why its error messages are the full English texts of Microsoft BASIC and stand at 6B80H and above rather than the two letter codes of the Model I and Model III ROM BASIC.
85B2-85D8
DEFM "All rights reserved. ENHANCED by LSI." / DEFB 0DH, 0DH 41 6C 6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65 64 2E 20 45 4E 48 41 4E 43 45 44 20 62 79 20 4C 53 49 2E 0D 0D
85B2H-85D8H: the third line of the sign-on text and the two carriage returns that follow it, which leave a blank line before the first Ready. LSI is Logical Systems, Inc., the author of the enhancement package whose source is NEWB/ASM.
85D9
DEFB 00H 00
85D9H, the last byte the file loads: the 00H that ends the SIGNON$ text for the display routine at 46A5H. The next address, 85DAH, is the one NEWB/ASM calls ENDLOC, and 86A4H, which BEGIN puts in BASEND at 83FCH, stands 202 bytes above it.