![]() |
|
Non sense results (or error) working with defm strings - Printable Version +- Boriel Basic Forum (https://forum.boriel.com) +-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11) +---- Forum: Help & Support (https://forum.boriel.com/forumdisplay.php?fid=16) +---- Thread: Non sense results (or error) working with defm strings (/showthread.php?tid=514) |
Non sense results (or error) working with defm strings - wilco2009 - 2012-12-15 Just to save space, I'm coding some strings in inline Asm sentences, and I found a bug. If you execute the following code: Code: Dim x as byte = 1
Dim y as byte = 5
Dim c as byte
textdata:
Asm
defm " BILBO GUARDO EL TESORO Y EL "
db 0
defm " ANILLO POR MUCHO TIEMPO, SIN"
db 0
defm " SOSPECHAR SU VERDADERA"
db 0
defm "NATURALEZA Y SU TERRIBLE PODER"
db 0
defm "HASTA MUCHO TIEMPO DESPUES"
db 0
defm "PERO ESO YA ES OTRA HISTORIA.."
defb $FF
End Asm
Border 0: Paper 0: Ink 6: Bright 1: Cls
dir = @textdata
Do
c = Peek dir
If c <> 255 Then
if c <> 0 Then
print at y, x; Chr$(c)
x = x 1
Else
x = 1
y = y 2
End If
dir = dir 1
End If
If Inkey$ <> "" Then Exit Do: End If
Loop
Pause 1000
End SubIf you delete the lines: Code: defm "HASTA MUCHO TIEMPO DESPUES"
db 0I think the bug have relation with the memory reserved by the asm lines, because deleting or adding lines you get differents errors, sometimes you get an "Out of Memory" message or shows the correct result but paper white instead black. Re: Non sense results (or error) working with defm strings - wilco2009 - 2012-12-17 I`m sorry. Previous code have an evident bug. I writted the data in first position and the program was running the data as instructions. Due to it the behaviour was inpredictible. Re: Non sense results (or error) working with defm strings - boriel - 2012-12-17 wilco2009 Wrote:I`m sorry. Previous code have an evident bug.I've been rather busy, but glad to see you fixed it. 8) I usually put a STOP or END just before the ASM to avoid this problem (many other users have this problem before ).
|