Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Non sense results (or error) working with defm strings
#1
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 Sub
You will not get the expected result. Instead of it, you will get a white screen.
If you delete the lines:
Code:
        defm "HASTA MUCHO TIEMPO DESPUES"
        db 0
Program shows a correct behaviour.

I 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.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)