PicoMite V6.01.00 betas


Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2807
Posted: 02:58pm 02 Sep 2025      

Thanks. MMbasic is so dynamic it's hard to keep up  
I tried a test prog, 16 "sprites" 16x16 pixel bouncing around the screen.
Actually blits. I tried box erase each sprite then blit in new position then tried frame F and cls and no box erase just blit 16 "sprites" and copy F,N.
interesting to compare. stan


OPTION BASE 0        ' 0 based arrays
option DEFAULT INTEGER
OPTION EXPLICIT
mode 2
dim dx(15),dy(15),spx(15),spy(15)
dim cannon(119),missile(15),oldspx(15),oldspy(15)
dim ptr,hiscore,spw,spht,temp,frame,frame_count,spdata,sp1
hiscore=0

'colour shortcuts
const WH =RGB(255,  255,  255) 'WHITE
const YE =RGB(255,  255,    0) 'YELLOW
const LI =RGB(255,  128,  255) 'LILAC
const BR =RGB(255,  128,    0) 'BROWN
const FU =RGB(255,  64,   255) 'FUCHSIA
const RU =RGB(255,  64,     0) 'RUST
const MA =RGB(255,  0,    255) 'MAGENTA
const RE =RGB(255,  0,      0) 'RED
const CY =RGB(0,    255,  255) 'CYAN
const GR =RGB(0,    255,    0) 'GREEN
const CE =RGB(0,    128,  255) 'CERULEAN
const MI =RGB(0,    128,    0) 'MIDGREEN
const CO =RGB(0,    64,   255) 'COBALT
const MY =RGB(0,    64,     0) 'MYRTLE
const BL =RGB(0,    0,    255) 'BLUE
const Bk =RGB(0,    0,      0) 'BLACK
const Gy =RGB(128,  128,  128) 'GREY
const Lg =RGB(210,  210,  210) 'LITEGREY
const Og =RGB(255,  165,    0) 'ORANGE
const PK =RGB(255,  160,  171) 'PINK
const Gd =RGB(255,  215,    0) 'GOLD
const SA =RGB(250,  128,  114) 'SALMON
const BE =RGB(245,  245,  220) 'BEIGE
'
restore

cls
udg1 'draws sprite1 on screen at 10,10
blit READ 1,10,10,16,16 'reads sprite1 from screen to blit buffer1
udg1 'draws sprite2 on screen at 10,10
blit read 2,10,10,16,16 'reads sprite2 from screen to blit buffer2
cls
blit read 3,10,10,16,16 'reads 16x16 background to blit buffer3
'
for temp=0 to 15 'set up start sprite positions and directions
do
 dx(temp)=(int(rnd*4)+1)-(int(rnd*8)+1)
loop until dx(temp)<>0
do
 dy(temp)=(int(rnd*4)+1)-(int(rnd*8)+1)
loop until dy(temp)<>0
 spx(temp)=104+((rnd*64)+1)
 spy(temp)=144+((rnd*64)+1)    
next temp
'
FRAMEBUFFER CREATE F
FRAMEBUFFER WRITE f

do 'demo moving sprite
cls
   for temp=0 to 15
'        if sprite_status(temp)=1 then 'is sprite active
           if spx(temp)> 300 then 'check right edge
             dx(temp)= 0-dx(temp)
           elseif spx(temp)<8 then 'check left edge
             dx(temp)= 0-dx(temp)
           end if
           if spy(temp)>220 then 'check bottom edge
             dy(temp)= 0-dy(temp)
           elseif spy(temp)<8 then 'check top edge
             dy(temp)= 0-dy(temp)
           end if
     '
           'oldspx(temp)=spx(temp):oldspy(temp)=spy(temp) 'get last position for erase
           spx(temp)=spx(temp)+dx(temp):spy(temp)=spy(temp)+dy(temp) 'get new position for draw
     '
     
               if frame=0 then'which sprite to draw
                 'box oldspx(temp),oldspy(temp),16,16,0,bk,1 'erase sprite at last position
                 'BLIT WRITE 3,oldspx(temp),oldspy(temp), 16, 16 'erase sprite at last position
                 blit WRITE 1,spx(temp),spy(temp) 'draw sprite1 at new position
               else
'box oldspx(temp),oldspy(temp),16,16,0,bk,1 'erase sprite at last position
                 'BLIT WRITE 3,oldspx(temp),oldspy(temp), 16, 16 'erase sprite at last position
                 blit WRITE 2,spx(temp),spy(temp) 'draw sprite2 at new position
               end if
   next temp
 '
FRAMEBUFFER COPY f,N
   frame_count=frame_count+1 'when to change sprite
   if frame_count=10 then
     frame=not frame
     frame_count=0
   end if
   pause 20
loop
'
sub udg1 'draws 16x16 data for blit to copy
 for spht=0 to 15
   for spw=0 to 15
     read sp1
     pixel spw+10,spht+10,sp1
   next spw
 next spht
end sub
'
'sprite1
data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
'sprite2
data bl,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,bl
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bl,wh,wh,re,bl,bk,bk,bl,re,wh,wh,bl,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,b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