Hello again. I come with completed routine. All works like a charm and I'm satisfied with it. However I'm always open to any improvement so if you find something that can be done better, please do not hesitate to suggest it here.
The AMOS' code is very simple and doesn't need any explanation except Screen Copy so I commented it in the code.
Procedure _WORD_MAP
Rem // Up Left corner of zoom (viewing area is 200x176 pixels)
X1=WORLD_X-100
Y1=WORLD_Y-88
Rem // Dn Right corner of zoom
X2=WORLD_X+100
Y2=WORLD_Y+88
Dim WORLD(5,5)
For CHUNK_X=0 To 5
For CHUNK_Y=0 To 5
WORLD(CHUNK_X,CHUNK_Y)=False
'// UP Left corner X1,Y1
If X1>CHUNK_X*400 and X1<(CHUNK_X+1)*400 and Y1>CHUNK_Y*240 and Y1<(CHUNK_Y+1)*240
WORLD(CHUNK_X,CHUNK_Y)=True
TX=X1-(CHUNK_X*400) : TY=Y1-(CHUNK_Y*240)
BX=X2-(CHUNK_X*400) : BY=Y2-(CHUNK_Y*240)
If BX>400 Then MX=BX mod 400 : BX=BX-MX
If BY>240 Then MY=BY mod 240 : BY=BY-MY
TMPX$=Str$(CHUNK_X) : TMPY$=Str$(CHUNK_Y)
_FNAME$="world_x"+TMPX$+"_y"+TMPY$+".iff"
Load Iff _FNAME$,3
Screen Copy 3,TX,TY,BX,BY To 1,0,0 : Rem // Screen #3 is a temporary buffer and #1 is the visible screen
Rem // Screen Copy (source screen),top x,top y,bottom x,bottom y To (destination screen),top x,top y
End If
'// UP Right corner X2,Y1
If X2>CHUNK_X*400 and X2<(CHUNK_X+1)*400 and Y1>CHUNK_Y*240 and Y1<(CHUNK_Y+1)*240
If WORLD(CHUNK_X,CHUNK_Y)<>True
TMPX$=Str$(CHUNK_X) : TMPY$=Str$(CHUNK_Y)
_FNAME$="world_x"+TMPX$+"_y"+TMPY$+".iff"
Load Iff _FNAME$,3
Screen Copy 3,0,TY,MX,BY To 1,(400-TX),0
End If
End If
'// DN Left corner X1,Y2
If X1>CHUNK_X*400 and X1<(CHUNK_X+1)*400 and Y2>CHUNK_Y*240 and Y2<(CHUNK_Y+1)*240
If WORLD(CHUNK_X,CHUNK_Y)<>True
TMPX$=Str$(CHUNK_X) : TMPY$=Str$(CHUNK_Y)
_FNAME$="world_x"+TMPX$+"_y"+TMPY$+".iff"
Load Iff _FNAME$,3
Screen Copy 3,TX,0,BX,MY To 1,0,(240-TY)
End If
End If
'// DN Right corner X2,Y2
If X2>CHUNK_X*400 and X2<(CHUNK_X+1)*400 and Y2>CHUNK_Y*240 and Y2<(CHUNK_Y+1)*240
If WORLD(CHUNK_X,CHUNK_Y)<>True
TMPX$=Str$(CHUNK_X) : TMPY$=Str$(CHUNK_Y)
_FNAME$="world_x"+TMPX$+"_y"+TMPY$+".iff"
Load Iff _FNAME$,3
Screen Copy 3,0,0,MX,MY To 1,(400-TX),(240-TY)
End If
End If
Next CHUNK_Y
Next CHUNK_X
End Proc
As I mentioned before I am going to use this method on just 2MB RAM Amigas. On those with extended memory I'll load the whole map into it so there will be no disk seeking.
Comments, suggestions - I'm around.
And let me thank again to those I quoted before and made use of their suggestions