Hello,
include "asm.inc"
Window 320,240,1
sys page1 = getMemory 320 * 240 * 3
sys page2 = getMemory 320 * 240 * 3
sys page, con=3
Sub FillPage1 (sys c)
byte r, g, b
mov esi,page1
xor ecx,ecx
.m2 xor edx,edx
.m1 imul edi,ecx,320
add edi,edx
imul edi,con
pushad
r = GetR(c)
popad
mov al,r
mov [esi+edi+0],al
pushad
g = GetG(c)
popad
mov al,g
mov [esi+edi+1],al
pushad
b = GetB(c)
popad
mov al,b
mov [esi+edi+2],al
inc edx
cmp edx,320
jnz m1
inc ecx
cmp ecx,240
jnz m2
End Sub
Sub FillPage2 (sys c)
byte r, g, b
mov esi,page2
xor ecx,ecx
.m2 xor edx,edx
.m1 imul edi,ecx,320
add edi,edx
imul edi,con
pushad
r = GetR(c)
popad
mov al,r
mov [esi+edi+0],al
pushad
g = GetG(c)
popad
mov al,g
mov [esi+edi+1],al
pushad
b = GetB(c)
popad
mov al,b
mov [esi+edi+2],al
inc edx
cmp edx,320
jnz m1
inc ecx
cmp ecx,240
jnz m2
End Sub
Sub ReadPage (sys addr)
sys con=3, byte r,g,b
mov esi,addr
xor ecx,ecx
.m2 xor edx,edx
.m1 imul edi,ecx,320
add edi,edx
imul edi,con
mov al,[esi+edi+0]
mov r,al
mov al,[esi+edi+1]
mov g,al
mov al,[esi+edi+2]
mov b,al
pushad
c = r+g*256+b*65536
PutPixel edx, ecx, c
popad
inc edx
cmp edx,320
jnz m1
inc ecx
cmp ecx,240
jnz m2
End Sub
FillPage1 RGB 0,255,255
FillPage2 RGB 255,255,0
while Key(27)=0
page=page xor 1
if page=0
ReadPage page1
end if
if page=1
ReadPage page2
end if
Color 0,0,255
Text 100,100,14,"SCREEN " + page
Redraw
Wait 80
wend
FreeMemory page1
FreeMemory page2
WinEnd
.