Show ASCII table: Difference between revisions
Content added Content deleted
(Added BASIC256, Chipmunk Basic, MSX Basic, Run Basic, True BASIC, XBasic and Yabasic) |
|||
Line 1,239: | Line 1,239: | ||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
==={{header|BASIC256}}=== |
|||
<syntaxhighlight lang="vb">for i = 32 to 47 |
|||
for j = i to i + 80 step 16 |
|||
begin case |
|||
case j = 32 |
|||
s$ = "Spc" |
|||
case j = 127 |
|||
s$ = "Del" |
|||
else |
|||
s$ = chr(j) |
|||
end case |
|||
print rjust(" "+string(j),5); ": "; ljust(s$,3); |
|||
next j |
|||
print |
|||
next i</syntaxhighlight> |
|||
==={{header|Chipmunk Basic}}=== |
|||
{{works with|Chipmunk Basic|3.6.4}} |
|||
{{works with|QBasic}} |
|||
<syntaxhighlight lang="qbasic">10 cls |
|||
20 for r = 0 to 15 |
|||
30 for c = 1 to 6 |
|||
40 a = 16+r+c*16 |
|||
50 print right$(" "+str$(a),4)": " chr$(a)tab (10*c); |
|||
60 next c |
|||
70 print |
|||
80 next r</syntaxhighlight> |
|||
{{out}} |
|||
<pre> 32: 48: 0 64: @ 80: P 96: ` 112: p |
|||
33: ! 49: 1 65: A 81: Q 97: a 113: q |
|||
34: " 50: 2 66: B 82: R 98: b 114: r |
|||
35: # 51: 3 67: C 83: S 99: c 115: s |
|||
36: $ 52: 4 68: D 84: T 100: d 116: t |
|||
37: % 53: 5 69: E 85: U 101: e 117: u |
|||
38: & 54: 6 70: F 86: V 102: f 118: v |
|||
39: ' 55: 7 71: G 87: W 103: g 119: w |
|||
40: ( 56: 8 72: H 88: X 104: h 120: x |
|||
41: ) 57: 9 73: I 89: Y 105: i 121: y |
|||
42: * 58: : 74: J 90: Z 106: j 122: z |
|||
43: + 59: ; 75: K 91: [ 107: k 123: { |
|||
44: , 60: < 76: L 92: \ 108: l 124: | |
|||
45: - 61: = 77: M 93: ] 109: m 125: } |
|||
46: . 62: > 78: N 94: ^ 110: n 126: ~ |
|||
47: / 63: ? 79: O 95: _ 111: o 127: ⌂</pre> |
|||
==={{header|GW-BASIC}}=== |
==={{header|GW-BASIC}}=== |
||
{{works with|BASICA}} |
{{works with|BASICA}} |
||
Line 1,269: | Line 1,314: | ||
46: . 62: > 78: N 94: ^ 110: n 126: ~ |
46: . 62: > 78: N 94: ^ 110: n 126: ~ |
||
47: / 63: ? 79: O 95: _ 111: o 127: Del</pre> |
47: / 63: ? 79: O 95: _ 111: o 127: Del</pre> |
||
==={{header|MSX Basic}}=== |
|||
The [[#GW-BASIC|GW-BASIC]] solution works without any changes. |
|||
==={{header|QBasic}}=== |
|||
The [[#QB64|QB64]] solution works without any changes. |
|||
==={{header|Run BASIC}}=== |
|||
{{works with|Just BASIC}} |
|||
{{works with|Liberty BASIC}} |
|||
<syntaxhighlight lang="vb">for i = 32 to 47 |
|||
for j = i to i + 80 step 16 |
|||
select case j |
|||
case 32 |
|||
s$ = "Spc" |
|||
case 127 |
|||
s$ = "Del" |
|||
case else |
|||
s$ = chr$(j) |
|||
end select |
|||
print right$(" "+str$(j),4); ": "; s$; space$(3); |
|||
next j |
|||
print |
|||
next i</syntaxhighlight> |
|||
==={{header|True BASIC}}=== |
|||
<syntaxhighlight lang="qbasic">FOR i = 32 TO 47 |
|||
FOR j = i TO i+80 STEP 16 |
|||
SELECT CASE j |
|||
CASE 32 |
|||
LET s$ = "Spc" |
|||
CASE 127 |
|||
LET s$ = "Del" |
|||
CASE else |
|||
LET s$ = CHR$(j) |
|||
END SELECT |
|||
PRINT USING "###: ### ": j, s$; |
|||
NEXT j |
|||
PRINT |
|||
NEXT</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as QB64 entry.</pre> |
|||
==={{header|XBasic}}=== |
|||
{{works with|Windows XBasic}} |
|||
<syntaxhighlight lang="qbasic">PROGRAM "ASCII table" |
|||
VERSION "0.0000" |
|||
DECLARE FUNCTION Entry () |
|||
FUNCTION Entry () |
|||
FOR i = 32 TO 47 |
|||
FOR j = i TO i + 80 STEP 16 |
|||
SELECT CASE j |
|||
CASE 32 |
|||
s$ = "Spc" |
|||
CASE 127 |
|||
s$ = "Del" |
|||
CASE ELSE |
|||
s$ = CHR$(j) |
|||
END SELECT |
|||
PRINT RJUST$(" "+STRING(j),4); ": "; LJUST$(s$,3); |
|||
NEXT j |
|||
PRINT |
|||
NEXT i |
|||
END FUNCTION |
|||
END PROGRAM</syntaxhighlight> |
|||
==={{header|Yabasic}}=== |
|||
<syntaxhighlight lang="vb">for i = 32 to 47 |
|||
for j = i to i + 80 step 16 |
|||
s$ = chr$(j) |
|||
if j = 32 s$ = "Spc" |
|||
if j = 127 s$ = "Del" |
|||
print str$(j, "#####"), ": ", s$; |
|||
next j |
|||
print |
|||
next i</syntaxhighlight> |
|||
=={{header|BaCon}}== |
=={{header|BaCon}}== |