'Paint' a 22x18 character square with attributes stored in memory. It will behave like a double buffer routine but just for colour attributes. I wish to manipulate the attributes stored in memory using BASIC and then run my routine to rapidly update the attributes in display memory. Simples!
I had a machine code routine from ZX Computing for copying the entire graphics memory to and from memory. I used this routine in many BASIC programs back in the 80's to mask the terrible slow DRAW routines used in BASIC. I have shown the decimal codes because I will be using a READ a : POKE x,a in a FOR-NEXT loop to load the routine into memory.
Code: Select all
Decimal Mnemonics
17,x,x LD DE,26000 ;load de with address to copy from (24000)
33,0,64 LD HL,16384 ;load hl with address to copy to (16384)
6,27 LD B,27
197 PUSH BC
6,0 LD B,256
26 LD A,(DE)
119 LD (HL),A
19 INC DE
35 INC HL
16,249 DJNZ,-6
193 POP BC
16,244 DJNZ,-11
201 RET
Code: Select all
Decimal Mnemonics
17,24,246 LD DE,63000 ;load de with address to copy from (63000)
33,0,64 LD HL,22629 ;load hl with address to copy to (22629)
6,10 LD B,10 ;loop 600 times
197 PUSH BC
6,60 LD B,60
26 LD A,(DE)
119 LD (HL),A
19 INC DE
35 INC HL
16,249 DJNZ,-6
193 POP BC
16,244 DJNZ,-11
201 RET
Code: Select all
Decimal Mnemonics
17,24,246 LD DE,63000 ;load de with address to copy from (63000)
33,x,x LD HL,22629 ;load hl with address to copy to (22629)
6,10 LD B,18
197 PUSH BC
6,60 LD B,22
26 LD A,(DE)
119 LD (HL),A
19 INC DE
35 INC HL
16,249 DJNZ,-6
1,10,0 LD BC,10
9, ADD HL,BC
193 POP BC
16,240 DJNZ,-15
201 RET
Code: Select all
15 CLEAR 63999
20 REM LOAD *"m";1;"screen"SCREEN$
30 LET c=63000:LET d=0
40 FOR a=3 TO 20
50 FOR b=5 TO 26
60 PRINT AT a,b; PAPER d*2;" "
70 POKE c,d*16
80 LET d=NOT(d):LET c=c+1
90 NEXT b
95 LET d=NOT(d)
100 NEXT a
105 PLOT 39,152: DRAW PAPER 5;177,0: DRAW PAPER 5; 0,-145: DRAW PAPER 5;-177,0: DRAW PAPER 5;0,145
110 DEF FN b(x)=INT(x/256)
120 DEF FN a(x)=x-(INT(x/256)*256)
130 GO SUB 9000
140 RANDOMIZE USR 64000
145 PRINT AT 0,11;"PEEK ";PEEK 63000;" ";PEEK 63001;" ";PEEK 63002
150 PAUSE 0
160 STOP
9000 DIM p(2)
9010 LET p(1)=63000
9020 LET p(2)=62000
9030 FOR f=0 TO 1
9040 RESTORE 9100
9044 LET r=p(f+1)
9045 LET ra=FN a(r): LET rb=FN b(r)
9046 PRINT AT f,0;ra;" : ";rb
9050 FOR n=64000+(f*25) TO 64024+(f*25)
9060 READ q
9070 POKE n,q
9080 NEXT n
9085 NEXT f
9090 RETURN
9100 DATA 17,ra,rb
9110 DATA 33,FN a(22629),FN b(22629)
9120 DATA 6,18
9130 DATA 197
9140 DATA 6,22
9150 DATA 26,119,19,35
9160 DATA 16,249
9170 DATA 1,10,0
9180 DATA 9
9210 DATA 193
9220 DATA 16,240
9230 DATA 201
Can anyone help me? I may not have presented the question well, please tell me how I can improve if this is so.
Edit :
Link to the magazine article : Page 17
Edit :
Added parenthesis to LD A,(DE)