Prev: 02CA Up: Map Next: 043A
0328: init_variables: Initialize BASIC system variables in a similar way to the BASIC ROM 'NEW' routine and initialize own variables in printer buffer.
Used by the routines at init_48k and init_16k.
init_variables 0328 LD DE,(warm_start_pointer) Set jump destination in warm_start_vector to warm_start_pointer.
032C LD ($5BCD),DE
0330 LD HL,(exit_pointer) Copy exit_pointer to backup_exit_pointer.
0333 LD (backup_exit_pointer),HL
0336 LD A,$C3 Write 'JP' instruction to warm_start_vector.
0338 LD (warm_start_vector),A
033B LD HL,warm_start_routine Copy warm_start_routine to warm_start_pointer.
033E LD BC,$0035
0341 LDIR
0343 LD HL,($5CB4) Clear 168 bytes to zero downwards from P-RAMT system variable (last byte of physical RAM).
0346 LD E,L
0347 LD D,H
0348 DEC HL
0349 LD BC,$00A8
034C EX DE,HL
034D LD (HL),$00
034F LDDR
0351 EX DE,HL Set UDG system variable (address of first user defined graphic) to start of cleared block.
0352 INC HL
0353 LD ($5C7B),HL
0356 DEC HL
0357 LD BC,$0040 Set RASP system variable (length of warning buzz) to 64.
035A LD ($5C38),BC
035E LD ($5CB2),HL Set RAMTOP system variable below UDG system variable.
0361 LD HL,$3C00 Set CHARS system variable to $3C00 (256 bytes before BASIC ROM font data).
0364 LD ($5C36),HL
0367 LD HL,($5CB2) Reset stack below RAMTOP system variable.
036A LD (HL),$3E
036C DEC HL
036D LD SP,HL
036E DEC HL Set ERR-SP system variable (Address of item on machine stack to use as error return).
036F DEC HL
0370 LD ($5C3D),HL
0373 IM 1 Switch to interrupt mode 1.
0375 LD IY,$5C3A Set IY register to address of ERR-NR system variable.
0379 LD HL,$5CB6 Set CHANS system variable to CHINFO (address of channel information).
037C LD ($5C4F),HL
037F LD DE,initial_CHINFO Copy 21 bytes from initial_CHINFO to CHINFO.
0382 LD BC,$0015
0385 EX DE,HL
0386 LDIR
0388 EX DE,HL Set DATADD system variable (Address of terminator of last DATA item) to end of channel info.
0389 DEC HL
038A LD ($5C57),HL
038D INC HL
038E LD ($5C53),HL Set PROG and VARS system variables to following address ($5CCB).
0391 LD ($5C4B),HL
0394 LD (HL),$80 Set that byte to $80.
0396 INC HL Set E-LINE variable (Address of command being typed in) to following address and write $0D, $80 at that location.
0397 LD ($5C59),HL
039A LD (HL),$0D
039C INC HL
039D LD (HL),$80
039F INC HL Set WORKSP, STKBOT, and STKEND system variables to next address.
03A0 LD ($5C61),HL
03A3 LD ($5C63),HL
03A6 LD ($5C65),HL
03A9 LD A,$38 Set ATTR-P, ATTR-T, and BORDCR system variables to black on white attributes.
03AB LD ($5C8D),A
03AE LD ($5C8F),A
03B1 LD ($5C48),A
03B4 LD HL,$0523 Initialize REPDEL and REPPER system variables.
03B7 LD ($5C09),HL
03BA LD A,$FF Set KSTATE and LAST-K variables to $FF.
03BC LD ($5C00),A
03BF LD ($5C04),A
03C2 LD HL,initial_STRMS Copy 14 bytes from initial_STRMS to STRMS system variable (addresses of channels attached to streams).
03C5 LD DE,$5C10
03C8 LD BC,$000E
03CB LDIR
03CD LD HL,$5C3C Set bit 5 of TV-FLAG system variable.
03D0 SET 5,(HL)
03D2 LD A,$02 Set DF-SZ system variable (number of lower screen lines) to 2.
03D4 LD ($5C6B),A
03D7 LD A,$F8 Set the border colour to black, and EAR and MIC bits high.
03D9 OUT ($FE),A
03DB LD A,$07 Set colour_attr to 7 (black paper, white ink).
03DD LD (colour_attr),A
03E0 XOR A Set bright_attr to 0 (not bright).
03E1 LD (bright_attr),A
03E4 LD (skip_next_row_flag),A Clear skip_next_row_flag.
03E7 LD (page_found_flag),A Clear page_found_flag.
03EA LD (page_tens),A Set page_tens and page_units to 0.
03ED LD (page_units),A
03F0 LD (subpage_search_flag),A Clear subpage_search_flag.
03F3 LD (disable_rolling_headers),A Set disable_rolling_headers to 0.
03F6 LD A,$01 Set magazine_number and interrupt reset variables to 1.
03F8 LD (magazine_number),A
03FB LD (interrupt_reset_flag),A
03FE CALL init_mosaics Initialize mosaic character sets.
0401 CALL init_hamming_table Initialize Hamming 8/4 decoding lookup table.
0404 LD HL,(page_display_buffer_pointer) Write "P100" to start of page display buffer.
0407 LD (HL),$50
0409 INC HL
040A LD (HL),$31
040C INC HL
040D LD (HL),$30
040F INC HL
0410 LD (HL),$30
0412 LD HL,exit_routine Copy 50 bytes of code from exit_routine to exit_pointer.
0415 LD DE,(exit_pointer)
0419 LD BC,$0032
041C LDIR
041E LD HL,save_routine Copy 294 bytes of code from save_routine to save_page_pointer.
0421 LD DE,(save_page_pointer)
0425 LD BC,$0126
0428 LDIR
042A CALL display_menu Display the menu screen.
042D XOR A Clear ignore_packets_flag.
042E LD (ignore_packets_flag),A
0431 LD (reveal_flag),A Clear reveal_flag.
0434 CALL set_hardware_counter Set hardware line counter ready for next video field.
0437 JP wait_and_decode_page Jump to wait for page loop.
Prev: 02CA Up: Map Next: 043A