Replica of QB's 256 color palette for sB

Post Reply
User avatar
Dav
Posts: 279
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

Replica of QB's 256 color palette for sB

Post by Dav »

I've found that many Qbasic/QB64 programs easily convert over to smart basic, except the ones written specifically for QB's 256 color palette. So I made this to help me use those QB programs in sB without having to rewrite a bunch of code. I'll post it here in case someone else may like it to help get QB programs looking the same way in smart basic.

It's kind of funny, I use to wish for more than 256 colors,now there are millions to choose from trying to go back to 256? :P

- Dav

Code: Select all

'256 color palette of QB/QB64.
'For easily adapting QB programs
'that use the 256 color palette.
'Coded for smart basic by Dav

'arrays to hold QB palette values
dim _r(256), _g(256), _b(256)

'read palette data
restore to qbpalette
for c = 0 to 255
   read _r(c) ! read _g(c) ! read _b(c)
next c

graphics

'example to show all 256 colors

main:

sw = screen_width()
sh = screen_height()

do
  c=0
  for x = 0 to sw
    for y = 0 to sh step (sh/256)
     fill color _r(c)/255,_g(c)/255,_b(c)/255
     fill rect 0,y to screen_width(), y+(sh/256)
     c= c+1!if c>255 then c =0
    next y
    if screen_width()<>sw then main
  next x
until 0



qbpalette:
DATA 0,0,0,0,0,170,0,170,0,0,170,170,170
DATA 0,0,170,0,170,170,85,0,170,170,170
DATA 85,85,85,85,85,255,85,255,85,85,255
DATA 255,255,85,85,255,85,255,255,255,85
DATA 255,255,255,0,0,0,20,20,20,32,32,32
DATA 45,45,45,57,57,57,69,69,69,81,81,81
DATA 97,97,97,113,113,113,130,130,130,146
DATA 146,146,162,162,162,182,182,182,202
DATA 202,202,227,227,227,255,255,255,0,0
DATA 255,65,0,255,125,0,255,190,0,255,255
DATA 0,255,255,0,190,255,0,125,255,0,65
DATA 255,0,0,255,65,0,255,125,0,255,190,0
DATA 255,255,0,190,255,0,125,255,0,65,255
DATA 0,0,255,0,0,255,65,0,255,125,0,255
DATA 190,0,255,255,0,190,255,0,125,255,0
DATA 65,255,125,125,255,158,125,255,190
DATA 125,255,223,125,255,255,125,255,255
DATA 125,223,255,125,190,255,125,158,255
DATA 125,125,255,158,125,255,190,125,255
DATA 223,125,255,255,125,223,255,125,190
DATA 255,125,158,255,125,125,255,125,125
DATA 255,158,125,255,190,125,255,223,125
DATA 255,255,125,223,255,125,190,255,125
DATA 158,255,182,182,255,198,182,255,219
DATA 182,255,235,182,255,255,182,255,255
DATA 182,235,255,182,219,255,182,198,255
DATA 182,182,255,198,182,255,219,182,255
DATA 235,182,255,255,182,235,255,182,219
DATA 255,182,198,255,182,182,255,182,182
DATA 255,198,182,255,219,182,255,235,182
DATA 255,255,182,235,255,182,219,255,182
DATA 198,255,0,0,113,28,0,113,57,0,113,85
DATA 0,113,113,0,113,113,0,85,113,0,57
DATA 113,0,28,113,0,0,113,28,0,113,57,0
DATA 113,85,0,113,113,0,85,113,0,57,113
DATA 0,28,113,0,0,113,0,0,113,28,0,113,57
DATA 0,113,85,0,113,113,0,85,113,0,57,113
DATA 0,28,113,57,57,113,69,57,113,85,57
DATA 113,97,57,113,113,57,113,113,57,97
DATA 113,57,85,113,57,69,113,57,57,113,69
DATA 57,113,85,57,113,97,57,113,113,57,97
DATA 113,57,85,113,57,69,113,57,57,113,57
DATA 57,113,69,57,113,85,57,113,97,57,113
DATA 113,57,97,113,57,85,113,57,69,113,81
DATA 81,113,89,81,113,97,81,113,105,81,113
DATA 113,81,113,113,81,105,113,81,97,113
DATA 81,89,113,81,81,113,89,81,113,97,81
DATA 113,105,81,113,113,81,105,113,81,97
DATA 113,81,89,113,81,81,113,81,81,113,89
DATA 81,113,97,81,113,105,81,113,113,81
DATA 105,113,81,97,113,81,89,113,0,0,65,16
DATA 0,65,32,0,65,49,0,65,65,0,65,65,0,49
DATA 65,0,32,65,0,16,65,0,0,65,16,0,65,32
DATA 0,65,49,0,65,65,0,49,65,0,32,65,0,16
DATA 65,0,0,65,0,0,65,16,0,65,32,0,65,49,0
DATA 65,65,0,49,65,0,32,65,0,16,65,32,32
DATA 65,40,32,65,49,32,65,57,32,65,65,32
DATA 65,65,32,57,65,32,49,65,32,40,65,32
DATA 32,65,40,32,65,49,32,65,57,32,65,65
DATA 32,57,65,32,49,65,32,40,65,32,32,65
DATA 32,32,65,40,32,65,49,32,65,57,32,65
DATA 65,32,57,65,32,49,65,32,40,65,45,45
DATA 65,49,45,65,53,45,65,61,45,65,65,45
DATA 65,65,45,61,65,45,53,65,45,49,65,45
DATA 45,65,49,45,65,53,45,65,61,45,65,65
DATA 45,61,65,45,53,65,45,49,65,45,45,65
DATA 45,45,65,49,45,65,53,45,65,61,45,65
DATA 65,45,61,65,45,53,65,45,49,65,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0
Attachments
qbpal.jpg
qbpal.jpg (65.84 KiB) Viewed 3271 times

Post Reply