I would like to copy a block of 16 x 16 pixels (screen 5) twice as big. So the new 'new' block will be 32 x 32 pixels.
Is there a simple basic solution to achieve this?
Entrar ou registrar-se para comentar
I would like to copy a block of 16 x 16 pixels (screen 5) twice as big. So the new 'new' block will be 32 x 32 pixels.
Is there a simple basic solution to achieve this?
No, not really. Either use 32 LMMM copies to stretch horizontally, and then 32 more HMMM copies to stretch vertically. Or do it with the CPU in combination with a 32x32 HMMC or VRAM access. The latter is probably much faster.
If I understand your question correctly, you are searching for a way to enlarge an image times 2.
how about this?
Presuming the 16x16 starts at point 0,0
1 screen5
2 c=0:d=0:fory=0to16
3 forx=0to16
4 copy(x,y)-(x,y),0to(32+c,d),0
5 copy(x,y)-(x,y),0to(32+c+1,d),0
6 copy(x,y)-(x,y),0to(32+c,d+1),0
7 copy(x,y)-(x,y),0to(32+c+1,d+1),0
8 c=c+2:nextx
9 c=0:d=d+2:nexty
10 goto 10
32 being the starting point of the 32x32
More faster method:
10 SCREEN 5
20 CIRCLE(8,8),7,15
30 FOR Y=0 TO 15
40 FOR T=0 TO 1:COPY(0,Y)-(15,Y),0TO(0,Y*2+T+16),0
50 NEXT T,Y
60 FOR X=0 TO 15
70 FOR T=0 TO 1:COPY(X,16)-(X,48),0TO(X*2+T,64),0
80 NEXT T,X
90 GOTO 90
T loop mean scale factor (by 2 in example)
Free scale factor (T1), with using second screen page as buffer:
10 SCREEN 5
20 T1=2.6:CIRCLE(8,8),7,15
30 FOR Y=0 TO 15
40 FOR T=0 TO T1:COPY(0,Y)-(15,Y),0TO(0,Y*T1+T),1
50 NEXT T,Y
60 FOR X=0 TO 15
70 FOR T=0 TO T1:COPY(X,0)-(X,16*T1),1TO(X*T1+T,0),0
80 NEXT T,X
90 GOTO 90
Other examples that work on itself and with a timer to compare the speed.
10 SCREEN 5: DEFINT A-Z: X=0: Y=0 20 CIRCLE(X+7,Y+7),7,15 30 IF STRIG(0)=0 THEN 40 40 TIME=0 50 FOR H=15 TO 0 STEP-1 60 COPY(X,Y+H)-STEP(15,0) TO(X,Y+H*2) 70 COPY(X,Y+H)-STEP(15,0) TO(X,Y+H*2+1) 80 NEXT H 90 FOR W=15 TO 0 STEP-1 100 COPY(X+W,Y)-STEP(0,32) TO(X+W*2,Y) 110 COPY(X+W,Y)-STEP(0,32) TO(X+W*2+1,Y) 120 NEXT W 130 T=TIME 140 IF STRIG(0)=0 THEN 140 150 SCREEN0: PRINT T
10 SCREEN 5: DEFINT A-Z: X=0: Y=0 20 CIRCLE(X+7,Y+7),7,15 30 IF STRIG(0)=0 THEN 30 40 TIME=0 50 VDP(33)=X: VDP(34)=0: VDP(37)=X: VDP(38)=0: VDP(41)=16:VDP(40)=0: VDP(42)=0: VDP(44)=0: VDP(45)=0: VDP(46)=0 60 FOR H=15 TO 0 STEP -1 70 IF VDP(-2)AND1 THEN 70 80 VDP(35)=Y+H: VDP(36)=0: VDP(39)=Y+H*2: VDP(43)=1: VDP(47)=&HD0 90 IF VDP(-2)AND1 THEN 90 100 VDP(35)=Y+H: VDP(36)=0: VDP(39)=Y+H*2+1: VDP(43)=1: VDP(47)=&HD0 110 NEXT H 120 VDP(41)=1 130 FOR W=15 TO 0 STEP -1 140 IF VDP(-2)AND1 THEN 140 150 VDP(33)=X+W:VDP(35)=Y: VDP(37)=X+W*2: VDP(39)=Y: VDP(43)=32: VDP(47)=&H90 160 IF VDP(-2)AND1 THEN 160 170 VDP(33)=X+W:VDP(35)=Y: VDP(37)=X+W*2+1: VDP(39)=Y: VDP(43)=32: VDP(47)=&H90 180 NEXT W 190 T=TIME 200 IF STRIG(0)=0 THEN 200 210 SCREEN0: PRINT T
Better using H+H, W+W
Mult more slow in Basic
Also try OUT, its faster than VDP()
Good idea except for the OUTs because if an interrupt occurs between the sending of the data and the register number, the VDP will no longer be able to work properly.
Yep
Use Kun-Basic! )
Don't you have an account yet? Become an MSX-friend and register an account!