11-07-2011, 08:26 PM
oops, i forgot to add a 'ulaplusgetpalette()' function - this is really important to get the palette values back - the example below illustrates the usage of it
library/ulaplus.bas
ulaplus_example.bas
library/ulaplus.bas
Code:
dim tmpv as uinteger
dim fdbkv as ubyte
function ulapluscheck():
tmpv=in(65339):pause 1:fdbkv=0
out 48955,0:out 65339,0:pause 1
if in(65339)<>tmpv then:fdbkv=1:out 48955,0:out 65339,tmpv:pause 1:end if
return fdbkv
end function
sub ulapluspalette(clv as ubyte, vlv as ubyte):
out 48955,(clv band 63):out 65339,vlv:pause 1
end sub
function ulaplusgetpalette(clv as ubyte)
out 48955,(clv band 63)
return in(65339)
pause 1
end function
sub ulaplusswitch(flgv as ubyte):
out 48955,64:out 65339,(flgv band 1):pause 1
end sub
ulaplus_example.bas
Code:
#include "library/ulaplus.bas"
ulaplusswitch(1):cls
a$="ULAplus is not present"
if ulapluscheck()<>0 then:a$="ULAplus is present":end if
print at 0,0;a$
for fl=0 to 1:flash fl
for hb=0 to 1:bright hb
for ik=0 to 7
ink ik:inverse 1:print " ";
next
for pa=0 to 7
paper pa:inverse 0:print " ";
next
next:next
for i=0 to 63
'ulapluspalette(i,int(rnd*255))
ulapluspalette(i,i)
next
print
ink 0:paper 7:bright 1
for i=0 to 63
print ulaplusgetpalette(i);",";
next i
pause 0