Prev: DAE7 Up: Map Next: DC5C
DB7E: Print Helper Preview Image
Used by the routine at DemoEntryPoint.
Takes the generated image at Buffer_Image, and creates a preview image from it.
Level 01
helper-image-1
Print_HelperPreviewImage DB7E LD B,$04 Set the initial X co-ordinate in B.
DB80 LD C,$16 Set the initial Y co-ordinate in C.
Print_HelperPreviewImage_0 DB82 PUSH BC Stash the co-ordinates on the stack.
DB83 CALL Calculate_ScreenBlockAddress Call Calculate_ScreenBlockAddress.
DB86 LD B,$08 Set a counter in B for 08.
Print_HelperPreviewImage_1 DB88 PUSH BC Stash the counter on the stack.
DB89 LD B,$0A Set a counter in B for 0A.
DB8B PUSH HL Stash the screen buffer address pointer on the stack.
Print_HelperPreviewImage_2 DB8C LD (HL),$00 Write 00 to *HL.
DB8E INC HL Increment the screen buffer address pointer by one.
DB8F DJNZ Print_HelperPreviewImage_2 Decrease the counter by one and loop back to Print_HelperPreviewImage_2 until the counter is zero.
DB91 POP HL Restore the original screen buffer address from the stack.
DB92 INC H Move down one line.
DB93 POP BC Restore the counter from the stack.
DB94 DJNZ Print_HelperPreviewImage_1 Decrease the counter by one and loop back to Print_HelperPreviewImage_1 until the counter is zero.
DB96 POP BC Restore the original co-ordinates from the stack.
DB97 INC B Increment B by one.
DB98 LD A,$0C Jump to Print_HelperPreviewImage_0 if B is not equal to 0C.
DB9A CP B
DB9B JR NZ,Print_HelperPreviewImage_0
DB9D LD A,$B0 Write B0 to *DB7A.
DB9F LD ($DB7A),A
DBA2 LD A,$20 Write 20 to *DB7B.
DBA4 LD ($DB7B),A
DBA7 LD HL,$A0E3 Write Buffer_Image to *DB7C.
DBAA LD ($DB7C),HL
DBAD LD B,$40 B=40.
Print_HelperPreviewImage_3 DBAF PUSH BC Stash BC on the stack.
DBB0 LD A,($DB7A) H=*DB7A.
DBB3 LD H,A
DBB4 LD A,($DB7B) L=*DB7B.
DBB7 LD L,A
DBB8 CALL $DC5C Call DC5C.
DBBB PUSH DE Load the screen buffer address into IX (using the stack).
DBBC POP IX
DBBE LD B,$02 Set a counter in B for 02.
Print_HelperPreviewImage_4 DBC0 PUSH BC Stash the counter and the screen buffer address on the stack.
DBC1 PUSH IX
DBC3 LD HL,($DB7C) HL=*DB7C.
DBC6 LD B,$0A B=0A.
Print_HelperPreviewImage_5 DBC8 XOR A A=00.
DBC9 LD D,(HL) D=*HL.
DBCA INC HL Increment HL by one.
DBCB LD E,(HL) E=*HL.
DBCC INC HL Increment HL by one.
DBCD CALL Print_HelperPreviewImage_6 Call Print_HelperPreviewImage_6.
DBD0 LD D,(IX+$00) D=*IX+00.
DBD3 OR D Set the bits from D.
DBD4 LD (IX+$00),A Write A to *IX+00.
DBD7 INC IX Increment IX by one.
DBD9 DJNZ Print_HelperPreviewImage_5 Decrease counter by one and loop back to Print_HelperPreviewImage_5 until counter is zero.
DBDB POP IX Restore IX from the stack.
DBDD LD ($DB7C),HL Write HL to *DB7C.
DBE0 POP BC Restore BC from the stack.
DBE1 DJNZ Print_HelperPreviewImage_4 Decrease counter by one and loop back to Print_HelperPreviewImage_4 until counter is zero.
DBE3 LD HL,$DB7B HL=DB7B.
DBE6 INC (HL) Increment *HL by one.
DBE7 POP BC Restore BC from the stack.
DBE8 DJNZ Print_HelperPreviewImage_3 Decrease counter by one and loop back to Print_HelperPreviewImage_3 until counter is zero.
DBEA RET Return.
Magic.
Print_HelperPreviewImage_6 DBEB RLC D Rotate D left (through the carry flag).
DBED JP NC,Print_HelperPreviewImage_7 Jump to Print_HelperPreviewImage_7 if the carry flag isn't set (if the leftmost bit was 0).
DBF0 OR %10000000 Set bit 7.
Print_HelperPreviewImage_7 DBF2 RLC D Rotate D left (through the carry flag).
DBF4 JP NC,Print_HelperPreviewImage_8 Jump to Print_HelperPreviewImage_8 if the carry flag isn't set (if the leftmost bit was 0).
DBF7 OR %10000000 Set bit 7.
Print_HelperPreviewImage_8 DBF9 RLC D Rotate D left (through the carry flag).
DBFB JP NC,Print_HelperPreviewImage_9 Jump to Print_HelperPreviewImage_9 if the carry flag isn't set (if the leftmost bit was 0).
DBFE OR %01000000 Set bit 6.
Print_HelperPreviewImage_9 DC00 RLC D Rotate D left (through the carry flag).
DC02 JP NC,Print_HelperPreviewImage_10 Jump to Print_HelperPreviewImage_10 if the carry flag isn't set (if the leftmost bit was 0).
DC05 OR %01000000 Set bit 6.
Print_HelperPreviewImage_10 DC07 RLC D Rotate D left (through the carry flag).
DC09 JP NC,Print_HelperPreviewImage_11 Jump to Print_HelperPreviewImage_11 if the carry flag isn't set (if the leftmost bit was 0).
DC0C OR %00100000 Set bit 5.
Print_HelperPreviewImage_11 DC0E RLC D Rotate D left (through the carry flag).
DC10 JP NC,Print_HelperPreviewImage_12 Jump to Print_HelperPreviewImage_12 if the carry flag isn't set (if the leftmost bit was 0).
DC13 OR %00100000 Set bit 5.
Print_HelperPreviewImage_12 DC15 RLC D Rotate D left (through the carry flag).
DC17 JP NC,Print_HelperPreviewImage_13 Jump to Print_HelperPreviewImage_13 if the carry flag isn't set (if the leftmost bit was 0).
DC1A OR %00010000 Set bit 4.
Print_HelperPreviewImage_13 DC1C RLC D Rotate D left (through the carry flag).
DC1E JP NC,Print_HelperPreviewImage_14 Jump to Print_HelperPreviewImage_14 if the carry flag isn't set (if the leftmost bit was 0).
DC21 OR %00010000 Set bit 4.
Print_HelperPreviewImage_14 DC23 RLC E Rotate E left (through the carry flag).
DC25 JP NC,Print_HelperPreviewImage_15 Jump to Print_HelperPreviewImage_15 if the carry flag isn't set (if the leftmost bit was 0).
DC28 OR %00001000 Set bit 3.
Print_HelperPreviewImage_15 DC2A RLC E Rotate E left (through the carry flag).
DC2C JP NC,Print_HelperPreviewImage_16 Jump to Print_HelperPreviewImage_16 if the carry flag isn't set (if the leftmost bit was 0).
DC2F OR %00001000 Set bit 3.
Print_HelperPreviewImage_16 DC31 RLC E Rotate E left (through the carry flag).
DC33 JP NC,Print_HelperPreviewImage_17 Jump to Print_HelperPreviewImage_17 if the carry flag isn't set (if the leftmost bit was 0).
DC36 OR %00000100 Set bit 2.
Print_HelperPreviewImage_17 DC38 RLC E Rotate E left (through the carry flag).
DC3A JP NC,Print_HelperPreviewImage_18 Jump to Print_HelperPreviewImage_18 if the carry flag isn't set (if the leftmost bit was 0).
DC3D OR %00000100 Set bit 2.
Print_HelperPreviewImage_18 DC3F RLC E Rotate E left (through the carry flag).
DC41 JP NC,Print_HelperPreviewImage_19 Jump to Print_HelperPreviewImage_19 if the carry flag isn't set (if the leftmost bit was 0).
DC44 OR %00000010 Set bit 1.
Print_HelperPreviewImage_19 DC46 RLC E Rotate E left (through the carry flag).
DC48 JP NC,Print_HelperPreviewImage_20 Jump to Print_HelperPreviewImage_20 if the carry flag isn't set (if the leftmost bit was 0).
DC4B OR %00000010 Set bit 1.
Print_HelperPreviewImage_20 DC4D RLC E Rotate E left (through the carry flag).
DC4F JP NC,Print_HelperPreviewImage_21 Jump to Print_HelperPreviewImage_21 if the carry flag isn't set (if the leftmost bit was 0).
DC52 OR %00000001 Set bit 0.
Print_HelperPreviewImage_21 DC54 RLC E Rotate E left (through the carry flag).
DC56 JP NC,Print_HelperPreviewImage_22 Jump to Print_HelperPreviewImage_22 if the carry flag isn't set (if the leftmost bit was 0).
DC59 OR %00000001 Set bit 0.
Print_HelperPreviewImage_22 DC5B RET Return.
Prev: DAE7 Up: Map Next: DC5C