Prev: 02B7 Up: Map Next: 0328
02CA: init_memory: Main initialization routine.
Used by the routine at START.
init_memory 02CA LD DE,NMI_JUMP Copy NMI_VECTOR to NMI_JUMP.
02CD LD HL,NMI_VECTOR
02D0 LD BC,$0003
02D3 LDIR
02D5 LD A,$01 Set ignore_packets_flag.
02D7 LD (ignore_packets_flag),A
02DA DEC A Clear field_header_flag and inhibit_display flag.
02DB LD (field_header_flag),A
02DE LD (inhibit_display),A
02E1 LD HL,telesoftware_jump Set telesoftware_pointer to telesoftware_jump. This address is different in the OEL Issue 2.3 ROM.
02E4 LD (telesoftware_pointer),HL
02E7 LD HL,$2240 Set counter_reset_address to $2240. This causes the gate array to only store the first 12 teletext lines of the VBI.
02EA LD (counter_reset_address),HL
02ED LD HL,print Set print_pointer to print.
02F0 LD (print_pointer),HL
02F3 LD SP,$7D00 Relocate stack to $7D00.
02F6 LD A,$3F Set I register to $3F.
02F8 LD I,A
02FA LD A,$04 Wait 24 t-states and output $04 to control register and store in control_register. (sets channel 1 and enables automatic frequency control).
02FC NOP
02FD NOP
02FE NOP
02FF NOP
0300 NOP
0301 NOP
0302 OUT ($7F),A
0304 LD (control_register),A
0307 LD HL,$5C00 Clear from VARS to end of memory.
030A LD DE,$5C01
030D LD BC,$A3FE
0310 LD (HL),$00
0312 LDIR
0314 LD HL,$FFFF write $55 at address $FFFF and read it back.
0317 LD A,$55
0319 LD (HL),A
031A CP (HL)
031B JR NZ,init_memory_0 If result matches, invert the bits and repeat the test.
031D CPL
031E LD (HL),A
031F CP (HL)
0320 JR NZ,init_memory_0 If result matches again jump to init_48k to setup pointers for 48k available memory.
0322 JP init_48k
init_memory_0 0325 JP init_16k If either test failed, jump to init_16k to set up pointers for 16k available memory.
Prev: 02B7 Up: Map Next: 0328