-
Notifications
You must be signed in to change notification settings - Fork 3
/
screenfill3.asm
133 lines (97 loc) · 2.16 KB
/
screenfill3.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
; FILL ZX SPECTRUM SCREEN GOING THROUGH EACH VISUAL LINE
;
; SCREEN ADDRESS
;
; H = 0 1 0 Y7 Y6 Y2 Y1 Y0
; L = Y5 Y4 Y3 X4 X3 X2 X1 X0
; pasmo --tapbas screenfill3.asm screenfill3.asm
ORG 50000
LD HL,$4000 ; SCREEN START
LOOP:
PUSH HL
LD B,32 ; 32 COLUMNS
X4_X0:
LD (HL),A
INC L
CALL W_DELAY
DJNZ X4_X0
POP HL
CALL P_DOWN
LD A,H
CP $58
JR NZ,LOOP
; need to return to lower screen
LD A,1 ; lower screen
CALL 5633 ; open channel
CALL $15DE ; WAIT-KEY1
RET
; Move HL one pixel line down
P_DOWN: INC H ; Go down onto the next pixel line
LD A,H ; Check if we have gone onto next character boundary
AND 7
RET NZ ; No, so skip the next bit
LD A,L ; Go onto the next character line
ADD A,32
LD L,A
RET C ; Check if we have gone onto next third of screen
LD A,H ; Yes, so go onto next third
SUB 8
LD H,A
RET
W_DELAY:
PUSH BC
LD B,255
WAIT: DJNZ WAIT
LD B,255
WAIT2: DJNZ WAIT2
POP BC
RET
END 50000
; FILL ZX SPECTRUM SCREEN GOING THROUGH EACH VISUAL LINE
;
; SCREEN ADDRESS
;
; H = 0 1 0 Y7 Y6 Y2 Y1 Y0
; L = Y5 Y4 Y3 X4 X3 X2 X1 X0
ORG 50000
LD HL,$4000 ; SCREEN START
LOOP:
PUSH HL
LD B,32 ; 32 COLUMNS
X4_X0:
LD (HL),A
INC L
CALL W_DELAY
DJNZ X4_X0
POP HL
CALL P_DOWN
LD A,H
CP $58
JR NZ,LOOP
; need to return to lower screen
LD A,1 ; lower screen
CALL 5633 ; open channel
CALL $15DE ; WAIT-KEY1
RET
; Move HL one pixel line down
P_DOWN: INC H ; Go down onto the next pixel line
LD A,H ; Check if we have gone onto next character boundary
AND 7
RET NZ ; No, so skip the next bit
LD A,L ; Go onto the next character line
ADD A,32
LD L,A
RET C ; Check if we have gone onto next third of screen
LD A,H ; Yes, so go onto next third
SUB 8
LD H,A
RET
W_DELAY:
PUSH BC
LD B,255
WAIT: DJNZ WAIT
LD B,255
WAIT2: DJNZ WAIT2
POP BC
RET
END 50000