17
17
inc (hl) ;hl = firstRow
20
jr nz,tK_skip ;if firstRow!=8, we can exit
20
jr nz,tK_skip ;if firstRow!=6 (the next row), we can exit
22
22
ld (hl),a ;reset firstRow to 0
23
23
;shift gbuf up 6 pixels
40
40
add a,8 ;current line + 8: we want to draw the text below
41
41
ld c,a ;b should still be 0 from ldir
43
44
ld hl,newLineStorage
44
45
add hl,bc ;newLineStorage + currentLine+7: find position of the text stored below
72
64
dec (hl) ;scroll up
73
65
or a ;if firstRow was 0, we need to load a new line of text
75
ld (hl),7 ;reset firstRow
67
ld (hl),5 ;reset firstRow to 5
76
68
;shift gbuf down 6 pixels
78
ld de,gbuf+(10*6)*8 ;last byte of gbuf
69
ld hl,gbuf+((10*6)*8)-1
70
ld de,gbuf+((10*6)*9)-1 ;last byte of gbuf, remember there is one row drawn offscreen
79
71
ld bc,(6*10)*8 ;each row is 6 pixels tall, there are 8 rows of text
81
73
;clear bottom part of gbuf
82
; ld c,6*10 ;b=0 from ldir
86
; ld (hl),a ;byte to copy
87
; ldir ;erase the space where we'll draw the text
74
ld c,(6*10)-1 ;b=0 from ldir
77
ld (hl),a ;byte to copy (a should = 0)
78
ldir ;erase the space where we'll draw the text
89
ld (hl),0 ;fill in the text at row 49
90
ld hl,currentLine ;advance a line
80
ld (hl),1 ;fill in the text at row 1
92
84
dec (hl) ;push pointer back one line
94
add hl,bc ;newLineStorage + currentLine-1: find position of the text stored below
85
ld c,(hl) ;if currentline = 0, we need bc to equal $FFFF (-1)
86
dec bc ; the byte before newlinestorage was set to 0 at the start of the program
95
bit 2,a ;normally up would be bit 3, but we have the rra
101
99
;##########################
103
101
;#Wait for the 2nd key to be pressed.