Prev: 5F10 Up: Map Next: 5F80
5F22: Change Background
Takes the background reference from Background_Reference and executes the appropriate routine to copy the background data addresses to the buffer at Background_Data_Buffer.
Used by the routine at 9200.
Blanks the screen.
Change_Background 5F22 LD HL,$5800 Writes 3F to all 0300 locations of the attributes buffer.
Value Ink Paper Bright
3F 07 07 00
This is white ink on white paper.
5F25 LD E,L
5F26 LD D,H
5F27 INC DE
5F28 LD (HL),$3F
5F2A LD BC,$02FF
5F2D LDIR
5F2F LD HL,$4000 Writes 00 to all 1800 locations of the screen buffer.
5F32 LD E,L
5F33 LD D,H
5F34 INC DE
5F35 LD BC,$17FF
5F38 LD (HL),$00
5F3A LDIR
Fetch the background reference from Background_Reference and use it to calculate the address for the copy-to-buffer routine.
5F3C LD HL,$5F00 Loads A with the contents of Background_Reference.
5F3F LD A,(HL)
5F40 DEC A Decrease it by one, then double it.
5F41 ADD A,A
5F42 LD C,A Store it as the LSB of BC (MSB is 00).
5F43 LD B,$00
5F45 LD (HL),B Write 00 to Background_Reference.
5F46 LD HL,$5F0A HL=The beginning of three address references for the copy routines which populate Background_Data_Buffer at $5F0A.
5F49 ADD HL,BC Add BC to HL.
5F4A LD E,(HL) DE=One of the three background address references;
Background_Reference Address Reference
01 $5F0A
02 $5F0C
03 $5F0E
5F4B INC HL
5F4C LD D,(HL)
5F4D EX DE,HL Swap the DE and HL registers.
5F4E CALL Indirect_Jump Call Indirect_Jump.
5F51 RET Return.
Indirect jump to copy-to-buffer routine.
Indirect_Jump 5F52 JP (HL) Indirect jump to address held by HL.
Background_Reference Jumps To...
01 5F53
02 5F62
03 5F71
Set up background 1.
5F53 LD HL,$602B Copies 12 bytes of data from Background_1_Addresses to Background_Data_Buffer.
5F56 LD DE,$5F10
5F59 LD BC,$0012
5F5C LDIR
5F5E CALL Create_Background Call Create_Background.
5F61 RET Return.
Set up background 2.
5F62 LD HL,$603D Copies 12 bytes of data from Background_2_Addresses to Background_Data_Buffer.
5F65 LD DE,$5F10
5F68 LD BC,$0012
5F6B LDIR
5F6D CALL Create_Background Call Create_Background.
5F70 RET Return.
Set up background 3.
5F71 LD HL,$604F Copies 12 bytes of data from Background_3_Addresses to Background_Data_Buffer.
5F74 LD DE,$5F10
5F77 LD BC,$0012
5F7A LDIR
5F7C CALL Create_Background Call Create_Background.
5F7F RET Return.
Prev: 5F10 Up: Map Next: 5F80