Skool Daze Routines
24832: Print a character square
Used by the routine at 25830.
D screen row number (152-172)
E screen column number (0-95)
24832 LD A,(32512) A=column at far left of screen (0-64)
24835 CP E Continue into 24843 unless E corresponds to a column that is off-screen
24836 JR Z,24843
24838 RET NC
24839 ADD A,31
24841 CP E
24842 RET C
This entry point is used by the routines at 24576 and 27026.
24843 LD A,E A=screen column number (0-95)
24844 AND 96 Now H is one of:
128 if 0<=E<32
136 if 32<=E<64
144 if 64<=E<96
24846 RRCA
24847 INC A
24848 RRCA
24849 LD H,A
24850 LD A,(DE) A=UDG reference (0-238) for character square at (D,E)
24851 PUSH DE
24852 LD L,A HL=base address of UDG bytes for character square at (D,E)
24853 LD BC,2048 B=8, C=0
24856 LD DE,32513 Copy the 8 bytes of the skool UDG into 32513-32520
24859 LD A,(HL)
24860 LD (DE),A
24861 INC H
24862 INC E
24863 DJNZ 24859
24865 NOP
24866 POP DE Restore (row,column) to (D,E)
24867 LD B,21 There are 21 characters to consider
24869 LD H,152 152=little boy no. 1
24871 LD L,98 Byte 98 of the character's buffer holds his x-coordinate
24873 LD A,E A=screen column number (0-95)
24874 SUB (HL) Subtract the character's x-coordinate
24875 DEC HL Byte 97 of the character's buffer holds his y-coordinate
24876 JR C,24926 Jump if no part of this character appears in this screen column
24878 CP 3
24880 JR NC,24926
24882 ADD A,A Now C is 0, 4 or 8, corresponding to the column (left, middle or right) of the character's sprite that overlaps column E
24883 ADD A,A
24884 LD C,A
24885 LD A,D A=screen row number (152-172)
24886 SUB (HL) Subtract the character's y-coordinate
24887 JR C,24926 Jump if no part of this character appears in this screen row
24889 CP 4
24891 JR NC,24926
24893 ADD A,C A=0-11, corresponding to the sprite square that appears at (D,E)
24894 EXX
24895 ADD A,173
24897 LD H,A H'=173-184
24898 EXX
24899 LD L,96 Pick up character's animatory state in A
24901 LD A,(HL)
24902 EXX
24903 LD L,A L'=character's animatory state
24904 LD A,(HL) A=UDG reference for sprite square
24905 AND A Is it the blank UDG?
24906 JR Z,24925 Jump if so
24908 CALL 27914 Get base address of sprite UDG bytes in H'L'
24911 LD B,8 8 bytes in the UDG
24913 LD DE,32513
24916 LD A,(DE) A=display area UDG byte
24917 OR (HL) OR in the sprite UDG byte
24918 INC H
24919 AND (HL) AND in the sprite UDG mask
24920 INC H
24921 LD (DE),A
24922 INC E
24923 DJNZ 24916 Jump back unless UDG is done
24925 EXX
24926 INC H Next character
24927 DJNZ 24871 Jump back to consider next character
24929 LD HL,32512 32512 stores column at far left of screen (0-64)
24932 LD A,D A=screen row number (152-172)
24933 AND 7
24935 RRCA
24936 RRCA
24937 RRCA
24938 LD C,A
24939 LD A,E A=screen column number (0-95)
24940 SUB (HL) Subtract column at far left of screen
24941 ADD A,C
24942 LD L,A Point HL at the relevant display file address
24943 LD A,D
24944 SUB 152
24946 AND 24
24948 ADD A,64
24950 LD H,A
24951 LD B,8 Copy the UDG to the screen
24953 LD DE,32513
24956 LD A,(DE)
24957 LD (HL),A
24958 INC H
24959 INC E
24960 DJNZ 24956
24962 RET