Code: Select all
1 REM LOAD "image" CODE 40000,6912
10 LET c=23295
20 LET n=16384: LET i=40000
30 FOR x=1 TO c: POKE n,PEEK
40 LET n=n+1: LET i=i+1: PRINT AT 0,0;n: NEXT x
Code: Select all
1 REM LOAD "image" CODE 40000,6912
10 LET c=23295
20 LET n=16384: LET i=40000
30 FOR x=1 TO c: POKE n,PEEK
40 LET n=n+1: LET i=i+1: PRINT AT 0,0;n: NEXT x
Code: Select all
zxbc screenfill.txt --tzx --BASIC -S 40000 --autorun
Code: Select all
5 PRINT "Insert Game Tape":PAUSE 0
6 LOAD "" CODE 32000
8 CLS
10 FOR Y=0 TO 23
20 FOR L=0 TO 7
30 FOR X=0 TO 31
40 LET ADDRESS=16384+32*(56*INT(Y/8)+Y)+X+L*256
45 LET C=ADDRESS + 15616
50 POKE ADDRESS,PEEK C
60 NEXT X
70 NEXT L
80 NEXT Y
100 FOR A=22528 TO 23295
110 POKE A,PEEK (A+15616)
120 NEXT A
130 PAUSE 0
Code: Select all
10 SAVE ! "image" CODE 40000,6912
20 LOAD ! "image" CODE 16384
Code: Select all
5 PRINT "Insert Game Tape":PAUSE 0
6 LOAD "" CODE 32000
8 CLS
10 FOR A=16384 TO 20480 STEP 2048
20 FOR B=A TO A+255 STEP 32
30 FOR C=B TO B+2015 STEP 256
40 FOR D=C TO C+31
50 POKE D,PEEK (D + 15616)
60 NEXT D
70 NEXT C
80 NEXT B
90 NEXT A
100 FOR A=22528 TO 23295
110 POKE A,PEEK (A+15616)
120 NEXT A
130 PAUSE 0
Code: Select all
9000 LET u = 65535-12 : LET v = 40000
9010 POKE u,1:POKE u+1,0:POKE u+2,27:POKE u+3,17:POKE u+4,0:POKE u+5,64:POKE u+6,33:POKE u+7,v-256*INT(v/256):POKE u+8,INT(v/256):POKE u+9,237:POKE u+10,176:POKE u+11,201
9020 RANDOMIZE USR u
OK, i don't get it - not hard for me.Red Zebra wrote: ↑Tue Dec 05, 2023 11:57 am Thought I'd have a crack at this.
It's a bit of BASIC that will POKE a super simple bit of machine code that LDIR's 6912 bytes from a location in memory to screen/attribute memory.
The variable U specifies where to POKE the routine (12 bytes needed), and V specifies where to copy data from.
I've set the defaults to be 65535-12 (top of memory) for the routine location and 40000 (as per your example snippet) as the source data location.Code: Select all
9000 LET u = 65535-12 : LET v = 40000 9010 POKE u,1:POKE u+1,0:POKE u+2,27:POKE u+3,17:POKE u+4,0:POKE u+5,64:POKE u+6,33:POKE u+7,v-256*INT(v/256):POKE u+8,INT(v/256):POKE u+9,237:POKE u+10,176:POKE u+11,201 9020 RANDOMIZE USR u
Code: Select all
Ld BC 001b (27)?
ld DE 00,40 (start of the screen memory?)
ld HL with some part of the image - the start?
ldir
ret
As @ParadigmShifter said the byte order is reversed. The Z80 is "little endian" so it stores addresses "back-to-front".Jbizzel wrote: ↑Tue Jan 09, 2024 11:15 pmCode: Select all
ld HL with some part of the image - the start?
Code: Select all
POKE u+7,v-256*INT(v/256)
POKE u+8,INT(v/256)
Code: Select all
5 CLEAR 39999
6 LET v=40000: LET o=49152
10 LOAD "" CODE 40000,13824
200 REM POKE 23739,111
210 OUT 32765,21
220 GO SUB 9000
230 OUT 32765,23
240 LET v=46912
250 GO SUB 9000
430 PAUSE 1
440 OUT 32765,16
450 PAUSE 1
460 OUT 32765,24
470 IF INKEY$<>"" THEN STOP
480 GO TO 4308000 STOP
9000 LET u=65535-12
9010 POKE u,1: POKE u+1,0: POKE u+2,27: POKE u+3,17: POKE u+4,0: POKE u+5,192: POKE u+6,33: POKE u+7,v-256*INT (v/256): POKE u+8,INT (v/256): POKE u+9,237: POKE u+10,176: POKE u+11,2019020 RANDOMIZE USR u
9030 RETURN
Code: Select all
370 CLEAR 49151
380 POKE 23739,111
390 OUT 32765,21
400 LOAD "" CODE 49152
410 OUT 32765,23
420 LOAD "" CODE 49152
430 PAUSE 1
440 OUT 32765,16
450 PAUSE 1
460 OUT 32765,24
470 IF INKEY$<>"" THEN GO TO 370
480 GO TO 430
Code: Select all
5 CLEAR 34999
6 LET v=35000: LET o=49152
10 LOAD "" CODE v,13824
200 REM POKE 23739,111
210 OUT 32765,21
220 GO SUB 9000
230 OUT 32765,23
240 LET v=v+6912
250 GO SUB 9000
430 PAUSE 1
440 OUT 32765,16
450 PAUSE 1
460 OUT 32765,24
470 IF INKEY$<>"" THEN STOP
480 GO TO 430
8000 STOP
9000 LET u=49100-12
9010 POKE u,1: POKE u+1,0: POKE u+2,27: POKE u+3,17: POKE u+4,0: POKE u+5,192: POKE u+6,33: POKE u+7,v-256*INT (v/256): POKE u+8,INT (v/256): POKE u+9,237: POKE u+10,176: POKE u+11,201
9020 RANDOMIZE USR u
9030 RETURN
9999 LET o=49152: PRINT o-256*INT (o/256)
I'm sure you don't have to poke everything at the beginning of the subroutine.
You can't arrange the memory such that both screens are contiguous (each one occupies the first 6912 bytes of a RAM bank, either page 5 or 7 depending on the screen) so you will always need to do two separate copies to locate the results in the correct location.ParadigmShifter wrote: ↑Thu Jan 11, 2024 7:47 pm
You can probably tweak it so it copies 6912*2 bytes instead of 6912 and make the data contiguous.
I don't know anything about paging on the 128K though so I may be wrong.