Prev: B82B Up: Map Next: B8C4
B84B: Handler: Graphics Controller
Input
DE Screen cursor commands
HL Pointer to graphics data
Controller_Tile B84B LD A,(HL) A=*HL.
B84C INC HL Increment HL by one.
B84D CP $80 If A is lower than 80 jump to Controller_Tile_Draw_Move_Down.
B84F JR C,Controller_Tile_Draw_Move_Down
Return if the terminator is reached.
B851 CP $FF Return if A is the terminator (FF).
B853 RET Z
Check for the FE control character. This signifies that the subsequent byte is the colour attribute.
B854 CP $FE If A is not FE jump to Controller_Tile_Screen_Instructions.
B856 JR NZ,Controller_Tile_Screen_Instructions
B858 LD C,(HL) C=*HL (set the attribute).
B859 INC HL Increment HL by one.
B85A JR Controller_Tile Jump to Controller_Tile.
If the value is between A8-E8 then it is screen co-ordinates.
Controller_Tile_Screen_Instructions B85C CP $A8 If A is lower than A8 jump to Controller_Tile_Draw_Move_Down.
B85E JR C,Controller_Tile_Draw_Move_Down
B860 CP $E8 If A is higher than E8 jump to Controller_Tile_Bank.
B862 JR NC,Controller_Tile_Bank
Remove the control number, then we're left with the desired screen co-ordinate data updates.
B864 SUB $C8 E=(A-C8)+E.
B866 ADD A,E
B867 LD E,A
B868 LD A,D D+=*HL.
B869 ADD A,(HL)
B86A LD D,A
B86B INC HL Increment HL by one.
B86C JR Controller_Tile Jump to Controller_Tile.
Check for the FB control character. This signifies that the following two bytes should be set as the sprite bank address.
Controller_Tile_Bank B86E CP $FB If A is not FB jump to Controller_Tile_Check_Move_Down.
B870 JR NZ,Controller_Tile_Check_Move_Down
B872 LD A,(HL) Write *HL to B7E9.
B873 LD ($B7E9),A
B876 INC HL Increment HL by one.
B877 LD A,(HL) Write *HL to B7EA.
B878 LD ($B7EA),A
B87B INC HL Increment HL by one.
B87C JR Controller_Tile Jump to Controller_Tile.
Check for the F1 control character. This signifies that the screen location should move down one block.
Controller_Tile_Check_Move_Down B87E CP $F1 If A is F1 jump to Controller_Tile_Move_Down.
B880 JR Z,Controller_Tile_Move_Down
Check for the F3 control character. This alters the current message pointer (HL).
B882 CP $F3 If A is not F3 jump to Controller_Tile_Repeaters.
B884 JR NZ,Controller_Tile_Repeaters
B886 LD A,(HL) A=*HL.
B887 INC HL Increment HL by one.
B888 LD H,(HL) H=*HL.
B889 LD L,A L=A.
B88A JR Controller_Tile Jump to Controller_Tile.
Anything from here involves repetition.
Controller_Tile_Repeaters B88C LD B,(HL) B=*HL (counter).
B88D INC HL Increment HL by one.
Check for the F0 control character. Tile sprite to the screen vertically, the number of times indicated in B.
B88E CP $F0 If A is not F0 jump to Controller_Tile_0.
B890 JR NZ,Controller_Tile_0
B892 LD A,(HL) A=*HL.
B893 INC HL Increment HL by one.
Controller_Tile_Vertical_Loop B894 CALL DrawSprite Call DrawSprite.
B897 INC D Increment D by one.
B898 DJNZ Controller_Tile_Vertical_Loop Decrease counter by one and loop back to Controller_Tile_Vertical_Loop until counter is zero.
B89A JR Controller_Tile Jump to Controller_Tile.
Check for the F2 control character.
Controller_Tile_0 B89C CP $F2 If A is not F2 jump to Controller_Tile_Horizontal.
B89E JR NZ,Controller_Tile_Horizontal
Controller_Tile_1 B8A0 LD A,(HL)
B8A1 INC HL
B8A2 CALL DrawSprite
B8A5 LD A,(HL)
B8A6 INC E
B8A7 CALL DrawSprite
B8AA INC E
B8AB DEC HL
B8AC DJNZ Controller_Tile_1
B8AE INC HL
B8AF INC HL
B8B0 JR Controller_Tile Jump to Controller_Tile.
Tile sprite to the screen horizontally, the number of times indicated in B.
Controller_Tile_Horizontal B8B2 LD A,(HL) A=*HL.
B8B3 INC HL Increment HL by one.
Controller_Tile_Horizontal_Loop B8B4 CALL DrawSprite Call DrawSprite.
Move to the next screen buffer column.
B8B7 INC E Increment E by one.
B8B8 DJNZ Controller_Tile_Horizontal_Loop Decrease counter by one and loop back to Controller_Tile_Horizontal_Loop until counter is zero.
B8BA JP Controller_Tile Jump to Controller_Tile.
Draw a tile, and move the screen position down one character block.
Controller_Tile_Draw_Move_Down B8BD CALL DrawSprite Call DrawSprite.
Controller_Tile_Move_Down B8C0 INC E Increment E by one.
B8C1 JP Controller_Tile Jump to Controller_Tile.
Prev: B82B Up: Map Next: B8C4