Latest YouTube Video

My Projects

"ZX Spectrum Next BASIC - Slideshow"

A friend of mine, Andy Spencer, posted that he needed to run a slideshow with several bmp files on the ZX Spectrum Next. I came up with the following:
Here is my solution.

Line 10: l denotes the length of the CAT output

Line 20: 500 denotes how many images maximum can be loaded and 50 denotes the maximum filename length

The above 2 could be adjusted so that you could have a lower maximum number of images and a longer filename length, for example.

You could also adjust the output of CAT to go to a bank instead so you free up memory for your program. This program itself is around 700 bytes and once the program has been run you are left with just under 6K of normal BASIC memory to play with so in this current iteration this may be fine for your needs.

Hope it helps.

1 RUN AT 3
10 l=10000: DIM o$(l): OPEN # 2,"v>o$": CAT : CLOSE # 2
20 DIM a$(500,50):z=1:m=1:z$=""
100 FOR a=1 TO l
110 IF o$(a)= CHR$ 13 THEN z=z+1:m=1: ELSE a$(z,m)=o$(a):m=m+1
120 IF o$(a)= CHR$ 13 AND o$(a+1)= CHR$ 13 THEN z=z-1:a=l
200 NEXT a
300 FOR a=1 TO z: FOR b=1 TO LEN (a$(a))
310 IF a$(a,1)="." OR a$(a,1 TO 2)=".." THEN b= LEN (a$(a)): GO TO 330
320 IF a$(a,b)<> CHR$ 32 THEN z$=z$+a$(a,b): ELSE PROC bmpload():b= LEN (a$(a)):z$=""
330 NEXT b: NEXT a
400 GO TO 300
1000 DEFPROC bmpload()
1010 t$=z$( LEN z$-6 TO LEN z$-3):z$= z$(1 TO LEN z$-3)
1030 IF t$=".bmp" OR t$=".BMP" THEN : ELSE ENDPROC
1040 .$ bmpload z$

My Social Links