Well, I'm not very familiar with it either. Also, I do not use QB64. I use the regular qbasic 1.1. I have basically no experience with HSV, only with RGB.
That having been said, I've written the following based on the wikipedia article i referred you to. i don't know if i got it right. it seems to work, but it'd be good for someone who knows this stuff to verify it.
DIM h AS SINGLE, s AS SINGLE, v AS SINGLE
DIM x AS SINGLE, c AS SINGLE, ht AS SINGLE
DIM rt AS SINGLE, gt AS SINGLE, bt AS SINGLE
DIM an AS STRING
INPUT "(0 to 360) h"; h
INPUT "(0 to 1) s"; s
INPUT "(0 to 1) v"; v
LOOP UNTIL (h >= 0) AND (h <= 360) AND (s >= 0) AND (s <= 1) AND (v >= 0) AND (v <= 1)
c = v * s
ht = h / 60
x = c * (1 - ABS((ht MOD 2) - 1))
SELECT CASE ht
CASE IS < 1: rt = c: gt = x: bt = 0
CASE IS < 2: rt = x: gt = c: bt = 0
CASE IS < 3: rt = 0: gt = c: bt = x
CASE IS < 4: rt = 0: gt = x: bt = c
CASE IS < 5: rt = x: gt = 0: bt = c
CASE IS < 6: rt = c: gt = 0: bt = x
m = v - c
r = INT((rt + m) * 63) 'qbasic rgb values are 0 to 63
g = INT((gt + m) * 63)
b = INT((bt + m) * 63)
PRINT r; ","; g; ","; b
PALETTE 0, r + (g * &H100) + (b * &H10000)
SLEEP: DO UNTIL LEN(INKEY$): LOOP
PRINT "(y/n) Another? "
an = LCASE$(INKEY$)
LOOP UNTIL (an = "y") OR (an = "n")
LOOP WHILE an = "y"
SCREEN 0: WIDTH 80, 25
I tried testing it by comparing it to the color selector in MSPaint. Paint seems to use values in the 0 to 240 range, instead of 0 to 360, 0 to 1, and 0 to 1.
As I said, I am not a QB64 user, but you are using INP and OUT, which are hardware I/O instructions. You are mixing these with QB64 specific functions. INP and OUT are used by DOS programs, as DOS allows direct hardware access. Windows does not (for applications). My understanding is that QB64 emulates these for backward compatibility. However, since your program is designed for QB64, and not a DOS program, I don't understand why you use them.
|Response Title||Author and Date|
|A better program.||on Jan 31|