Subleq: Difference between revisions

968 bytes added ,  3 years ago
Subleq en FreeBASIC
m (→‎{{header|Phix}}: added syntax colouring the hard way)
(Subleq en FreeBASIC)
Line 1,736:
</pre>
And the linefeed (character(10)) had been sent forth, but is not apparent because it just ended the line.
 
 
=={{header|FreeBASIC}}==
<lang freebasic>
Dim As Integer memoria(255), contador = 0
Dim As String codigo, caracter
 
Input "SUBLEQ> ", codigo
 
While Instr(codigo, " ")
memoria(contador) = Val(Left(codigo, Instr(codigo, " ") - 1))
codigo = Mid(codigo, Instr(codigo, " ") + 1)
contador += 1
Wend
 
memoria(contador) = Val(codigo)
contador = 0
Do
Dim As Integer a = memoria(contador)
Dim As Integer b = memoria(contador + 1)
Dim As Integer c = memoria(contador + 2)
contador += 3
If a = -1 Then
Input "SUBLEQ> ", caracter
memoria(b) = Asc(caracter)
Else
If b = -1 Then
Print Chr(memoria(a));
Else
memoria(b) -= memoria(a)
If memoria(b) <= 0 Then contador = c
End If
End If
Loop Until contador < 0
Sleep
</lang>
{{out}}
<pre>
SUBLEQ> 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
Hello, world!
</pre>
 
 
=={{header|Go}}==
2,169

edits