Code: Select all
Const scrnW = 320
Const scrnH = 200
'''Dim As Ubyte RRam(320*200)
'''#include "fast_asm.bas"
#include once "fbgfx.bi"
Dim As Ubyte RRam(320*200)
sub ScrollUp (RRam2() as ubyte)
dim z as integer
dim Memry(320) as ubyte
For z = 0 To 319
Memry(z) = RRam2(z) 'Point(z, 0)
Next z
asm
mov ECX, 15920
mov EAX, [RRam2]
mov EAX, [EAX]
mov EDI, EAX
add EAX, 320
mov ESI, EAX
rep MOVSD
end asm
'for z = 0 to 63679
' RRam(z) = RRam2(z+320)
'next z
For z = 0 To 319
RRam2(z+320*199) = Memry(z)
Next z
end sub
sub ScrollDown (RRam2() as ubyte)
dim z as integer
dim Memry(320) as ubyte
For z = 0 To 319
Memry(z) = RRam2(z + 320*199) 'Point(z, 0)
Next z
asm
mov ECX, 15920
mov EAX, [RRam2]
mov EAX, [EAX]
add EAX, 63676
mov ESI, EAX
add EAX, 320
mov EDI, EAX
std
rep MOVSD
cld
end asm
'for z = 63679 to 0 step -1
' RRam2(z+320) = RRam2(z)
'next z
For z = 0 To 319
RRam2(z) = Memry(z)
Next z
end sub
sub ScrollLeft (RRam2() as ubyte)
dim clr as ubyte, z as integer
clr = RRam2(0)
asm
mov ECX, 16000
mov EAX, [RRam2]
mov EAX, [EAX]
mov EDI, EAX
add EAX, 1
mov ESI, EAX
rep MOVSD
mov ECX, 3
rep MOVSB
end asm
'for z = 1 to 63999
' RRam2(z-1) = RRam2(z)
'next z
For z = 199 To 1 Step -1
RRam2(320 * z+319) = RRam2(320 * (z-1) + 319)
Next z
RRam2(319) = clr
end sub
sub ScrollRight (RRam2() as ubyte)
dim clr as ubyte, z as integer
'''clr = RRam2(63999)
clr=RRam2(319)
asm
mov ECX, 16000
mov EAX, [RRam2]
mov EAX, [EAX]
add EAX, 63993
mov ESI, EAX
add EAX, 1
mov EDI, EAX
std
rep MOVSD
mov ECX, 3
rep MOVSB
cld
end asm
'for z = 63998 to 0 step -1
' RRam2(z+1) = RRam2(z)
'next z
For z = 0 To 198
RRam2(z*320) = RRam2((z+1) * 320)
Next z
'''RRam2(199 * 320) = clr
RRam2(0) = Clr
end sub
Sub saveScreen(RRam2() As Ubyte)
Dim As Integer v,r,g,b
Dim As Integer i
i = 0
For y As Integer = 0 To scrnH-1
For x As Integer = 0 To scrnW-1
v = Point(x,y)
r = v Shr 16 And 255
g = v Shr 8 And 255
b = v And 255
RRam2(i)= Int(r+g+b)/3
i = i + 1
Next x
Next y
End Sub
Sub displayScreen(RRam2() As Ubyte)
Dim As Integer i
i = 0
For y As Integer = 0 To scrnH-1
For x As Integer = 0 To scrnW-1
Pset(x,y),rgb(RRam2(i),RRam2(i),RRam2(i))
i = i + 1
Next x
Next y
End Sub
screenres scrnW,scrnH,32
Dim As Integer x,y,c,rad,r,g,b
'fill screen with data
For i As Integer = 0 To 100
x = Int(Rnd(1)*scrnW)
y = Int(Rnd(1)*scrnH)
r = Int(Rnd(1)*256)
g = Int(Rnd(1)*256)
b = Int(Rnd(1)*256)
c = rgb(r,g,b)
rad = Int(Rnd(1)*20)+5 'radius of circle
Circle (x,y),rad,c,,,,f
Next i
saveScreen(RRam())
displayScreen(RRam())
Do
If MULTIKEY(&h4B) Then scrollLeft(RRam())
If MULTIKEY(&h4D) Then scrollRight(RRam())
If MULTIKEY(&h48) Then scrollUp(RRam())
If MULTIKEY(&h50) Then scrollDown(RRam())
displayScreen(RRam())
ScreenSync
sleep 1,1
Loop Until multikey(&H01)
End
Ok, turns out that the scroll left & scroll right FB Basic routines were glitchy, fixed that, the ASM routines seem to be working great!
There is some small problem still, I'm trying to figure out where & why, but it put little 3 pixel glyph glitches on the scrolled data here & there at times, not sure why, if you sit there & scroll it in all directions for awhile, they start to appear.
:M
Thanks Vendan for helping with this, I meant to get back to this thread awhile ago to ask BasicCoder2 the same questions.
Please play with the demo program and see if you can figure out why the glitchy glyphs keep appearing.
I'll keep looking at it for another hour tonight.
[edit] seems if i hold right & tap down, the glitches appear alot.