Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fill Routine
#3
I'm having problems. A call to the routine seems to mess up something (maybe some register should be preserved?). My routine is simple, quoting the interesting bit:

Code:
    While (endOfDrawing > binAddress)
        cmd = Peek (binAddress)
        binAddress = binAddress + 1
        
        If cmd < 192 Then
            x = Peek (binAddress)
            binAddress = binAddress + 1
            y = 191 - cmd
            dx = x: dx = dx - cx ' ZX Basic doesn't like type mix
            dy = y: dy = dy - cy ' ZX Basic doesn't like type mix
            Draw dx, dy
            cx = x
            cy = y
        ElseIf cmd = 192 Then
            x = Peek (binAddress)
            y = 191 - Peek (binAddress + 1)
            binAddress = binAddress + 2
            Plot x, y
            cx = x
            cy = y
        ElseIf cmd = 193 Then
            x = Peek (binAddress)
            y = Peek (binAddress + 1)
            ex = Peek (binAddress + 2)
            binAddress = binAddress + 3
            SPPFill (x, y, @gpPatterns + (ex << 3))
        End If
    Wend

Notice the call to SPPFill towards the end of the code. If I comment that line, the vector drawing renders OK (albeit, without fills), but if I leave it uncommented, it somehow messes something so binAddress goes elsewhere and it draws random lines until the program crashes.

I've found that somehow ZX Basic doens't like IX messed with, so if I do:

Code:
Asm
   push ix
End Asm
SPPFill (x, y, @gpPatterns + (ex << 3))
Asm
   pop ix
End Asm

It just works! Not a big deal, but I just wanted you to know.

I might have something to publish very soon Smile
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)