Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I change palette?
#1
neither PALETTE or OUT seems to do anything. This is the code that I am using

OPEN "pal.txt" FOR INPUT AS #1
'OUT &H3C7,0: OUT &H3C8, 0
FOR a = 0 TO 255
INPUT #1, R
INPUT #1, G
INPUT #1, B
PALETTE a, (b\4*65535 + g\4*256 + r\4)
'OUT &H3C9, R\4
'OUT &H3C9, G\4
'OUT &H3C9, B\4
NEXT
CLOSE

The OUTs were code that I was originally using in Qbasic, and they worked fine. I read that FreeBASIC has some bugs in OUT, so I tried PALETTE. Neither OUT or PALETTE seem to do anything to the palette.
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#2
Quote:neither PALETTE or OUT seems to do anything. This is the code that I am using

OPEN "pal.txt" FOR INPUT AS #1
'OUT &H3C7,0: OUT &H3C8, 0
FOR a = 0 TO 255
INPUT #1, R
INPUT #1, G
INPUT #1, B
PALETTE a, (b\4*65535 + g\4*256 + r\4)
'OUT &H3C9, R\4
'OUT &H3C9, G\4
'OUT &H3C9, B\4
NEXT
CLOSE

The OUTs were code that I was originally using in Qbasic, and they worked fine. I read that FreeBASIC has some bugs in OUT, so I tried PALETTE. Neither OUT or PALETTE seem to do anything to the palette.

Are R, G and B Integers? (I mean 32 bits integers)
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
Have you used the SCREEN command before setting the palette?
Reply
#4
Ok, that solved it a little bit. I also changed all of the values so that I don't divide by four anymore. But now I am getting a strange problem. r, g, and b are equal for part of the palette, in other words, shades of grey. They turn out blue here. In fact, the entire thing it blueshifted. What is causeing this and how do I fix it?

Exact code:

SCREEN 13,,2,1
OPEN "pal.vga" FOR INPUT AS #1
FOR a = 0 TO 255
INPUT #1, r
INPUT #1, g
INPUT #1, b
locate 1:print r,g,b:sleep
PALETTE a,(b * 65535 + g * 256 + r)
line(a,0)-(a,100),a
NEXT
CLOSE
sleep
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#5
Your blue element should be * 65536, not 65535. There's your first mistake. Big Grin
I'd knock on wood, but my desk is particle board.
Reply
#6
man that was stupid, now it works
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)