思い付きで作った。記憶だけで作った。
・・・手頃な終了スレに捨てる事にした。
#module "PF_XforHSP"
#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
if ( s and 0x01 ) != 0 : poke VRAM , VramAddress( x + 7 , y ) + RGBPLANE( plane ) , 0xff
if ( s and 0x02 ) != 0 : poke VRAM , VramAddress( x + 6 , y ) + RGBPLANE( plane ) , 0xff
if ( s and 0x04 ) != 0 : poke VRAM , VramAddress( x + 5 , y ) + RGBPLANE( plane ) , 0xff
if ( s and 0x08 ) != 0 : poke VRAM , VramAddress( x + 4 , y ) + RGBPLANE( plane ) , 0xff
if ( s and 0x10 ) != 0 : poke VRAM , VramAddress( x + 3 , y ) + RGBPLANE( plane ) , 0xff
if ( s and 0x20 ) != 0 : poke VRAM , VramAddress( x + 2 , y ) + RGBPLANE( plane ) , 0xff
if ( s and 0x40 ) != 0 : poke VRAM , VramAddress( x + 1 , y ) + RGBPLANE( plane ) , 0xff
if ( s and 0x80 ) != 0 : poke VRAM , VramAddress( x + 0 , y ) + RGBPLANE( plane ) , 0xff
return
#deffunc RBYTE int sID , str sData
SpriteData = sData
for i , 0 , 24 // BRGの順
writeCHRline sID , i / 8 , i \ 8 , hex( strmid( SpriteData , i << 1 , 2 ) )
next
return
#deffunc WBYTE int sx , int sy , int sID
pos sx * 16 , sy * 16
gzoom 16 , 16 , SpriteID , sID << 3 , 0 , 8 , 8
return
#deffunc init_PF_X int mId , int sMax
SpriteID = mID
SpriteMax = sMax
SpriteScreenWidth = sMAX << 3
SpriteScreenHeight = 8
baseID = ginfo(2)
buffer SpriteID , SpriteScreenWidth , SpriteScreenHeight , 0
color : boxf : mref VRAM,66 : gsel baseID
RGBPLANE(0) = 0 : RGBPLANE(1) = 2 : RGBPLANE(2) = 1
return
#global
color:boxf:color 255,255,255
// binary
// □□□□ = 0 : □■□□ = 4 : □■□■ = 5 : □■■□ = 6
// □□□■ = 1 : □■■■ = 7 : ■□□□ = 8 : ■□□■ = 9
// □□■□ = 2 : ■□■□ = a : ■□■■ = b : ■■□□ = c
// □□■■ = 3 : ■■□■ = d : ■■■□ = e : ■■■■ = f
// Blue Plain Red Plain Green Plain
// □□□□□□□□ = 00 : □□■□□■□□ = 24 : □□■□□■□□ = 24
// □□□□□□□□ = 00 : □■■■■■■□ = 7e : □■■■■■■□ = 7e
// □□□□□□□□ = 00 : ■■■■■■■■ = ff : ■■■■■■■■ = ff
// □□■□□■□□ = 24 : ■■□■■□■■ = db : ■■□■■□■■ = db
// □□□□□□□□ = 00 : □■■■■■■□ = 7e : □■■■■■■□ = 7e
// □□□■■□□□ = 18 : ■□■■■■□■ = bd : ■□■■■■□■ = bd
// □□□■■□□□ = 18 : □□■■■■□□ = 3c : □□■■■■□□ = 3c
// □□□□□□□□ = 00 : ■■■□□■■■ = e7 : ■■■□□■■■ = e7
init_PF_X 1 , 256
// B R G
// 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
RBYTE 0 , "000000000000000000000000000000000000000000000000"
RBYTE 1 , "0000002400181800247effdb7ebd3ce7247effdb7ebd3ce7"
RBYTE 2 , "0000000000000000dfdfdf00fdfdfd000000000000000000"
for i,0,3
WBYTE i,1,i
next
stop