My games are going to have this (self imposed) restrictions:
- I'm going to use ZX Spin to enter the code.
- They're going to be 100% BASIC programs, without any machine code.
- The games must seem to be "amateur", so they can't have optimizations beyond the obvious.
- They're going to have many common routines.
One of my first routines is a "big letter" drawing routine. The games must be slow (so BASIC use is obvious), but this routine is awfully slow.
This is my code:
Code: Select all
1 LET score=23: GO SUB 9998: GO SUB 9950
8999 GO TO 9999
9700 REM PLOT PRINT
9720 LET x1=x: FOR i=1 TO LEN s$: IF s$(i)=" " THEN GO TO 9840
9730 LET y1=192-17-y: LET dir=8*(CODE s$(i))+PEEK 23606+256*PEEK 23607
9740 FOR j=0 TO 7: LET byte=PEEK dir
9750 FOR k=7 TO 0 STEP -1: LET bit=2^k
9760 FOR l=1 TO ph: FOR m=1 TO pw
9780 IF byte>=bit THEN PLOT x1+8*pw-k*pw+m,y1-j*ph-l
9810 NEXT m: NEXT l: IF byte>=bit THEN LET byte=byte-bit
9820 NEXT k
9830 LET dir=dir+1: NEXT j
9840 LET x1=x1+8*pw: NEXT i
9850 RETURN
9950 REM GAME OVER
9951 BORDER 2: PAPER 2: INK 7: CLS
9952 LET s$="GAME OVER": LET pw=2: LET ph=3: LET y=50: LET x=(256-LEN s$*8*pw)/2: GO SUB 9970
9953 LET s$="Score: ": FOR i=1 TO 5-LEN STR$ score: LET s$=s$+" ": NEXT i
9954 LET s$=s$+STR$ score
9955 LET pw=2: LET ph=2: LET y=100: LET x=(256-LEN s$*8*pw)/2: GO SUB 9970
9956 RETURN
9970 GO TO 9700
9998 POKE 23672,0: POKE 23673,0: POKE 23674,0: RETURN
9999 LET time=PEEK 23672+256*PEEK 23673+65536*PEEK 23674: LET horas=INT (time/180000): LET time=time-horas*180000: LET minutos=INT (time/3000): LET time=time-minutos*3000: LET segundos=INT (time/50): LET time=time-segundos*50: PRINT AT 10,0;horas;"h:";minutos;"m:";segundos;"s.";time
- x,y: text coordinates, y being the TOP of the screen
- ph,pw: height and width multipliers
- s$: string to print
Is PLOT so slow or maybe the maths involved? I've uploaded my program to mediafire.