Write language name in 3D ASCII: Difference between revisions

Content added Content deleted
(→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details)
m (→‎{{header|ZX Spectrum Basic}}: fixed the first example)
Line 386: Line 386:
to cause a colour switch using a traditional space (ascii 32),
to cause a colour switch using a traditional space (ascii 32),
but the output would still look the same.
but the output would still look the same.
Fixed the error and removed the need for 2^z.

<lang zxbasic>10 LET s$="BASIC": REM our language name
<lang zxbasic> 10 DIM b(5,5): REM our bigmap characters
20 DIM b(5,5):REM our bigmap characters
20 FOR l=1 TO 5: REM 5 characters
30 FOR l = 1 TO 5: REM 5 characters
30 FOR m=1 TO 5: REM 5 rows
40 READ b(m,l)
40 FOR m = 1 TO 5: REM 5 rows
50 READ b(l,m)
50 NEXT m
60 NEXT m
60 NEXT l
70 PAPER 0: BORDER 0: REM black background and border
70 NEXT l
80 INK 2: REM our shadow will be red

90 CLS
100 PAPER 0: REM black background
110 INK 2: REM our shadow will be red
100 LET r=8: REM shadow will start on row 8
110 LET c=1: REM shadow will start at column 1
120 CLS
130 LET r=9: REM shadow will start on row 5
120 GO SUB 2000: REM draw shadow
140 LET c=2: REM shadow will start at column 2
130 INK 6: REM our foreground will be yellow
140 LET r=9: REM foreground will start on row 9
150 GO SUB 2000: REM draw shadow
160 INK 6: REM our forground will be yellow
150 LET c=2: REM foreground will start on column 2
160 GO SUB 2000: REM display the language name
170 LET r=10: REM foreground will start on row 6
999 STOP
180 LET c=3: REM foreground will start on column 3
190 GO SUB 2000: REM display the language name

999 STOP

1000 REM convert to binary bigmap
1000 REM convert to binary bigmap
1010 LET t=n: REM temporary variable
1010 LET z=16
1020 IF t>=z THEN PRINT AT r+l-1,c+c1;CHR$ (143);: LET t=t-z: REM 143 is a block
1020 LET g$="": REM this will contain our 5 character binary bigmap
1040 FOR z=5 TO 0 STEP -1
1040 LET c1=c1+1: LET z=z/2
1050 IF z>=1 THEN GO TO 1020
1050 LET d$=" ": REM assume next digit is zero (draw a space)
1060 RETURN
1060 IF t>=(2^z) THEN LET d$=CHR$(143): LET t=t-(2^z): LET sf=1: REM 143 is a block
1070 LET g$=g$+d$
1080 NEXT z
1090 RETURN

2000 REM display the big letters
2000 REM display the big letters
2010 FOR l=1 TO 5: REM our 5 rows
2010 FOR l=1 TO 5: LET c1=0: REM our 5 rows
2020 PRINT AT r+l-1,c;
2030 FOR m=1 TO 5: REM bigmap for each character
2030 FOR m=1 TO 5: REM bigmap for each character
2040 LET n=b(l,m)
2040 LET t=b(l,m)
2050 GO SUB 1000
2050 GO SUB 1000
2060 PRINT g$;: REM 5 character bigmap
2060 LET c1=c1+1: REM PRINT " ";: REM space between each letter
2070 NEXT m
2070 PRINT " ";: REM space between each letter
2080 NEXT m
2080 NEXT l
2090 NEXT l
2090 RETURN
2100 RETURN

9000 DATA 30,17,30,17,30: REM B
9000 DATA 30,17,30,17,30: REM B
9010 DATA 14,17,31,17,17: REM A
9010 DATA 14,17,31,17,17: REM A