Posts: 357
Threads: 118
Joined: Oct 2004
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.
Posts: 6,419
Threads: 74
Joined: Mar 2002
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)
Posts: 1,439
Threads: 15
Joined: Apr 2003
Have you used the SCREEN command before setting the palette?
Posts: 357
Threads: 118
Joined: Oct 2004
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.
Posts: 3,279
Threads: 170
Joined: Nov 2003
Your blue element should be * 65536, not 65535. There's your first mistake.
I'd knock on wood, but my desk is particle board.
Posts: 357
Threads: 118
Joined: Oct 2004
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.