The initalisation code runs before BASIC really begins, and once BASIC has begun the memory that this init code occupies is reclaimed for program storage. It's first job is to do detect what ports the teletype and terminal are hooked in to. Quite how and why this works, I have absolutely no idea. Has anyone got an Altair manual?? After that, code resumes in the second part of initialisation (see next page) where the user is given a chance to specify some configuration options.
Set stack pointer and STACK_TOP to some bytes on from the top of this Initiliasation section. | ||||
0D21 | 211A0F | Init | LXI H,0F1A | |
0D24 | F9 | SPHL | ||
0D25 | 226301 | SHLD STACK_TOP | ||
0D28 | DB01 | IN 01 | ||
0D2A | 0EFF | MVI C,FF | ||
Set return address to ConfigIOcode, which is in the second part of Initialisation. | ||||
0D2C | 118E0D | LXI D,ConfigIOcode | ||
0D2F | D5 | PUSH D | ||
0D30 | 3AFF0F | LDA 0FFF | ||
0D33 | 47 | MOV B,A | ||
0D34 | DBFF | IN FF | ||
0D36 | 1F | RAR | ||
0D37 | DA410D | JC 0D41 | ||
0D3A | E60C | ANI 0C | ||
0D3C | CA420D | JZ 0D42 | ||
0D3F | 0610 | MVI B,10 | ||
0D41 | 78 | MOV A,B | ||
0D42 | 328C0D | STA 0D8C | ||
0D45 | DBFF | IN FF | ||
0D47 | 17 | RAL | ||
0D48 | 17 | RAL | ||
0D49 | 0620 | MVI B,20 | ||
0D4B | 1102CA | LXI D,CA02 | ||
0D4E | D8 | RC | ||
0D4F | 17 | RAL | ||
0D50 | 43 | MOV B,E | ||
0D51 | 1D | DCR E | ||
0D52 | D8 | RC | ||
0D53 | 17 | RAL | ||
0D54 | DA6F0D | JC 0D6F | ||
0D57 | 43 | MOV B,E | ||
0D58 | 1180C2 | LXI D,C280 | ||
0D5B | 17 | RAL | ||
0D5C | D0 | RNC | ||
0D5D | 17 | RAL | ||
0D5E | 3E03 | MVI A,03 | ||
0D60 | CD8B0D | CALL 0D8B | ||
0D63 | 3D | DCR A | ||
0D64 | 8F | ADC A | ||
0D65 | 87 | ADD A | ||
0D66 | 87 | ADD A | ||
0D67 | 3C | INR A | ||
0D68 | CD8B0D | CALL 0D8B | ||
0D6B | 37 | STC | ||
0D6C | C34B0D | JMP 0D4B | ||
0D6F | AF | XRA A | ||
0D70 | CD8B0D | CALL 0D8B | ||
0D73 | CD870D | CALL 0D87 | ||
0D76 | CD870D | CALL 0D87 | ||
0D79 | 4B | MOV C,E | ||
0D7A | 2F | CMA | ||
0D7B | CD870D | CALL 0D87 | ||
0D7E | 3E04 | MVI A,04 | ||
0D80 | 35 | DCR M | ||
0D81 | CD8B0D | CALL 0D8B | ||
0D84 | 35 | DCR M | ||
0D85 | 35 | DCR M | ||
0D86 | 35 | DCR M | ||
0D87 | 218C0D | LXI H,0D8C | ||
0D8A | 34 | INR M | ||
0D8B | D300 | OUT 00 | ||
0D8D | C9 | RET |