Subleq: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Added BASIC25, Gambas6 and Yabasic. Moved FreeBASIC to section BASIC)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(2 intermediate revisions by 2 users not shown)
Line 1,202:
{{works with|GW-BASIC}}
{{works with|QBasic}}
<syntaxhighlight lang="gwbasicbasic">10 DEFINT A-Z: DIM M(8192)
20 INPUT "Filename";F$
30 OPEN "I",1,F$
Line 1,335:
 
End</syntaxhighlight>
 
==={{header|GW-BASIC}}===
The [[#BASIC|BASIC]] solution works without any changes.
 
==={{header|QBasic}}===
The [[#BASIC|BASIC]] solution works without any changes.
 
==={{header|Yabasic}}===
Line 3,357 ⟶ 3,363:
 
=={{header|RPL}}==
{{works with|HP|4848G}}
« 0'Ram' ""DUP ROT ptr←ptr stdout+ GET 1 + GET
» '<span style="color:blue">PEEKind</span>' STO <span style="color:grey">@ ''( n → Ram[Ram[←ptr + n]] )''</span>
« { } + RDM
'''WHILE''' ptr 0 ≥ '''REPEAT'''
« 0 "" → ←ptr stdout
« { } + RDM 'Ram' STO
'''WHILE''' ptr←ptr 0 ≥ '''REPEAT'''
'''CASE'''
DUP'Ram' ptr←ptr 1 + GET -1 == '''THEN'''
DUP ptr'Ram' 2 + GET 1<span +style="color:blue">PEEKind</span> '''DO UNTIL''' KEY '''END''' PUT '''END'''
DUP'Ram' ptr←ptr 2 + GET -1 == '''THEN'''
'stdout' OVER DUP ptr 1 + GET 1 +<span GETstyle="color:blue">PEEKind</span> CHR STO+ '''END'''
2 <span style="color:blue">PEEKind</span> 1 <span style="color:blue">PEEKind</span> -
DUP DUP ptr 2 + GET 1 + GET
OVER'Ram' DUP ptr←ptr 12 + GET 1 + GET3 PICK -PUT
SWAP DUP ptr 2 + GET 1 + 3 PICK PUT SWAP
0 ≤ '''THEN'''
1 SF '''END'''
Line 3,374 ⟶ 3,382:
'''END'''
'''IF''' 1 FS? '''THEN'''
DUP'Ram' ptr←ptr 3 + GET 'ptr←ptr' STO
'''ELSE'''
3 'ptr←ptr' STO+
'''END'''
'''END'''
stdout
» » '<span style="color:blue">SUBLEQ</span>' STO <span style="color:grey">@ ''( [ program ] mem_size → stdout ] )''</span>
 
[ 15 17 -1 17 -1 -1 16 1 -1 16 3 -1 15 15 0 0 -1 72 101 108 108 111 44 32 119 111 114 108 100 33 10 0 ] 256 <span style="color:blue">SUBLEQ</span>
Line 3,850 ⟶ 3,858:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="ecmascriptwren">import "io" for Stdin, Stdout
 
var subleq = Fn.new { |program|
9,482

edits