Prev: 47147 Up: Map Next: 47300
47179: Handler: Graphics Controller
Input
DE Screen cursor commands
HL Pointer to graphics data
Controller_Tile 47179 LD A,(HL) A=*HL.
47180 INC HL Increment HL by one.
47181 CP 128 If A is lower than 128 jump to Controller_Tile_Draw_Move_Down.
47183 JR C,Controller_Tile_Draw_Move_Down
Return if the terminator is reached.
47185 CP 255 Return if A is the terminator (255).
47187 RET Z
Check for the 254 control character. This signifies that the subsequent byte is the colour attribute.
47188 CP 254 If A is not 254 jump to Controller_Tile_Screen_Instructions.
47190 JR NZ,Controller_Tile_Screen_Instructions
47192 LD C,(HL) C=*HL (set the attribute).
47193 INC HL Increment HL by one.
47194 JR Controller_Tile Jump to Controller_Tile.
If the value is between 168-232 then it is screen co-ordinates.
Controller_Tile_Screen_Instructions 47196 CP 168 If A is lower than 168 jump to Controller_Tile_Draw_Move_Down.
47198 JR C,Controller_Tile_Draw_Move_Down
47200 CP 232 If A is higher than 232 jump to Controller_Tile_Bank.
47202 JR NC,Controller_Tile_Bank
Remove the control number, then we're left with the desired screen co-ordinate data updates.
47204 SUB 200 E=(A-200)+E.
47206 ADD A,E
47207 LD E,A
47208 LD A,D D+=*HL.
47209 ADD A,(HL)
47210 LD D,A
47211 INC HL Increment HL by one.
47212 JR Controller_Tile Jump to Controller_Tile.
Check for the 251 control character. This signifies that the following two bytes should be set as the sprite bank address.
Controller_Tile_Bank 47214 CP 251 If A is not 251 jump to Controller_Tile_Check_Move_Down.
47216 JR NZ,Controller_Tile_Check_Move_Down
47218 LD A,(HL) Write *HL to 47081.
47219 LD (47081),A
47222 INC HL Increment HL by one.
47223 LD A,(HL) Write *HL to 47082.
47224 LD (47082),A
47227 INC HL Increment HL by one.
47228 JR Controller_Tile Jump to Controller_Tile.
Check for the 241 control character. This signifies that the screen location should move down one block.
Controller_Tile_Check_Move_Down 47230 CP 241 If A is 241 jump to Controller_Tile_Move_Down.
47232 JR Z,Controller_Tile_Move_Down
Check for the 243 control character. This alters the current message pointer (HL).
47234 CP 243 If A is not 243 jump to Controller_Tile_Repeaters.
47236 JR NZ,Controller_Tile_Repeaters
47238 LD A,(HL) A=*HL.
47239 INC HL Increment HL by one.
47240 LD H,(HL) H=*HL.
47241 LD L,A L=A.
47242 JR Controller_Tile Jump to Controller_Tile.
Anything from here involves repetition.
Controller_Tile_Repeaters 47244 LD B,(HL) B=*HL (counter).
47245 INC HL Increment HL by one.
Check for the 240 control character. Tile sprite to the screen vertically, the number of times indicated in B.
47246 CP 240 If A is not 240 jump to Controller_Tile_0.
47248 JR NZ,Controller_Tile_0
47250 LD A,(HL) A=*HL.
47251 INC HL Increment HL by one.
Controller_Tile_Vertical_Loop 47252 CALL DrawSprite Call DrawSprite.
47255 INC D Increment D by one.
47256 DJNZ Controller_Tile_Vertical_Loop Decrease counter by one and loop back to Controller_Tile_Vertical_Loop until counter is zero.
47258 JR Controller_Tile Jump to Controller_Tile.
Check for the 242 control character.
Controller_Tile_0 47260 CP 242 If A is not 242 jump to Controller_Tile_Horizontal.
47262 JR NZ,Controller_Tile_Horizontal
Controller_Tile_1 47264 LD A,(HL)
47265 INC HL
47266 CALL DrawSprite
47269 LD A,(HL)
47270 INC E
47271 CALL DrawSprite
47274 INC E
47275 DEC HL
47276 DJNZ Controller_Tile_1
47278 INC HL
47279 INC HL
47280 JR Controller_Tile Jump to Controller_Tile.
Tile sprite to the screen horizontally, the number of times indicated in B.
Controller_Tile_Horizontal 47282 LD A,(HL) A=*HL.
47283 INC HL Increment HL by one.
Controller_Tile_Horizontal_Loop 47284 CALL DrawSprite Call DrawSprite.
Move to the next screen buffer column.
47287 INC E Increment E by one.
47288 DJNZ Controller_Tile_Horizontal_Loop Decrease counter by one and loop back to Controller_Tile_Horizontal_Loop until counter is zero.
47290 JP Controller_Tile Jump to Controller_Tile.
Draw a tile, and move the screen position down one character block.
Controller_Tile_Draw_Move_Down 47293 CALL DrawSprite Call DrawSprite.
Controller_Tile_Move_Down 47296 INC E Increment E by one.
47297 JP Controller_Tile Jump to Controller_Tile.
Prev: 47147 Up: Map Next: 47300