今朝方、懐かしい夢を見た。ので、それを作った。
折角なので手頃な終了スレに捨てておく。
一応(c)TEIJIROと書いとく。たしかこの名前だったと思う。
#define locate( %1 , %2 ) pos %1*16 , %2*16
#module "PF_X"
#deffunc PF_X_STATUS_CREAR
for i,0,40 : for o,0,30 : PF_X_STATUS( i , o ) = -1 : next : next
return
#defcfunc hex str OneBytes
d="00"+OneBytes:d=strmid(d,-1,2)
hh=peek( d , 0 )-'0':hh-=((hh>9)*7)+((hh>24)*32):hh=hh*((hh>0)and(hh<16))
hl=peek( d , 1 )-'0':hl-=((hl>9)*7)+((hl>24)*32):hl=hl*((hl>0)and(hl<16))
return ( hh << 4 ) + hl
#defcfunc VramAddress int x , int y
return ((SpriteScreenHeight-1-y)*(((SpriteScreenWidth*3)+3)&0xfffffffc))+(x*3)
#deffunc writeCHRLine int sID , int plane , int sLine , int sData
x = sID << 3 : y = sLine : s = sData
poke VRAM , VramAddress( x + 7 , y ) + RGBPLANE( plane ) , 0
for o,0,8
if ( s and tbit( o ) ) != 0 : poke VRAM , VramAddress( x + taddress( o ) , y ) + RGBPLANE( plane ) , 0xff
next
return
#deffunc RBYTE int sID , str sData
SpriteData = sData
for i , 0 , 24
writeCHRline sID , i / 8 , i \ 8 , hex( strmid( SpriteData , i << 1 , 2 ) )
next
return
#deffunc WBYTE int sx , int sy , int sID
PF_X_STATUS( sx , sy ) = sID
pos sx * 16 , sy * 16
gzoom 16 , 16 , SpriteID , sID << 3 , 0 , 8 , 8
return
#defcfunc STATUS int sx , int sy
return PF_X_STATUS( sx , sy )
#deffunc init_PF_X int mId , int sMax , int RGBFLG
SpriteID = mID
SpriteMax = sMax
SpriteScreenWidth = sMAX << 3
SpriteScreenHeight = 8
baseID = ginfo(2)
buffer SpriteID , SpriteScreenWidth , SpriteScreenHeight , 0
color : boxf : mref VRAM,66
gsel baseID
if RGBFLG = 0 :{ RGBPLANE(0) = 0 : RGBPLANE(1) = 2 : RGBPLANE(2) = 1 }
else { RGBPLANE(0) = 2 : RGBPLANE(1) = 1 : RGBPLANE(2) = 0 }
dim PF_X_STATUS , 40 , 30 : PF_X_STATUS_CREAR
tbit = 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80
taddress = 7,6,5,4,3,2,1,0
return
#global
#define YEN 10
randomize
// 画面初期化 作成
screen 0 , 32 * 16 , 24 * 16 : color:boxf:color 255,255,255 : init_PF_X 1 , 256 , 0
RBYTE 0 , "000000000000000000000000000000000000000000000000" // 背景
RBYTE 1 , "00040200000000003c7effffffff7e3c3c7effffffff7e3c" // ponpon
RBYTE 2 , "0000000000000000dfdfdf00fdfdfd000000000000000000" // 壁
RBYTE 3 , "00000000000000004428107c107c10004428107c107c1000" // お金
RBYTE 4 , "925438fe38549200925438fe38549200925438fe38549200" // イガイガ
*start:g=0:px=5:py=1:pv=1
for i,0,32 :for o,0,24
t=0 : if(o=0 || o = 23 || i=0 || i=31 || ((o+1)\6=0 && (i!=5 && i!=26))) : t=2
WBYTE i,o,t:next:next
for p,0,YEN
*haichi
i=(rnd(16)+8)&254:o=rnd(4)*6+4:if STATUS(i-1,o)+STATUS(i,o)+STATUS(i+1,o)!=0 :goto *haichi
WBYTE i-1,o,4:WBYTE i,o,3:WBYTE i+1,o,4:next
*mainloop:WBYTE px,py,0
stick s,5:px += -( (s&0x01) != 0 & STATUS(px-1,py) = 0 ) + ( (s&0x04) !=0 & STATUS(px+1,py) = 0 )
py+=pv:t=STATUS(px,py)
if t=2 : py-=pv:pv*=-1
if t=3 : g+=1
if t=4 : gosub *go
if g=YEN: gosub *cl
WBYTE px,py,1:await 50: goto *mainloop
*go:WBYTE px,py,1:locate 12,11:print "GameOver":goto *lp
*cl:WBYTE px,py,1:locate 13,11:print "CLEAR!"
*lp:stick st,15,0:if (st and 16)!=0:goto *start
await 50 : goto *lp