12-21-2011, 03:26 AM
Some people here may know that zx-spectrum stuff can run on sam coupé machines, and these stuff can write on its palette as well.
This is based on the library i added to support ULAplus, and did the enough changes for the SamCoupé - i didn't test it yet.
There are differences - while ULAplus has 64 palette colours from 256, SamCoupé has 16 from 128, and arranged in a different way. And anyway, SamCoupé palette seems to be simpler to use, since there are no need for tricky subroutines like "ulaplusattr(ikv as ubyte,pav as ubyte)"
Besides the ULAplus version, i don't know or i have no way to get the palette values back, or test if the machine uses SamCoupé palette
I didn't test this code yet - SimCoupé seems to be a good emulator for testing it:
library/samcoupepalette.bas
the information on the code above is based on the reply i got from Velesoft at <!-- m --><a class="postlink" href="http://www.worldofspectrum.org/forums/showthread.php?p=583022#post583022">http://www.worldofspectrum.org/forums/s ... post583022</a><!-- m -->
This is based on the library i added to support ULAplus, and did the enough changes for the SamCoupé - i didn't test it yet.
There are differences - while ULAplus has 64 palette colours from 256, SamCoupé has 16 from 128, and arranged in a different way. And anyway, SamCoupé palette seems to be simpler to use, since there are no need for tricky subroutines like "ulaplusattr(ikv as ubyte,pav as ubyte)"
Besides the ULAplus version, i don't know or i have no way to get the palette values back, or test if the machine uses SamCoupé palette
I didn't test this code yet - SimCoupé seems to be a good emulator for testing it:
library/samcoupepalette.bas
Code:
dim tmpv as uinteger
sub samcoupepalette(clv as ubyte, vlv as ubyte):
out (clv*256)bor 248,vlv:pause 1
end sub
function samcoupehexcolour(hxcv as uinteger):
tmpv=(hxcv band 4)/4
tmpv=tmpv bor ((hxcv band 64)/16)
tmpv=tmpv bor ((hxcv band 8)*2)
tmpv=tmpv bor ((hxcv band 128)/2)
tmpv=tmpv bor ((hxcv band 32)/4)
hxcv=int(hxcv/256)
tmpv=tmpv bor ((hxcv band 64)/16)
tmpv=tmpv bor ((hxcv band 8)*2)
return tmpv
end function
the information on the code above is based on the reply i got from Velesoft at <!-- m --><a class="postlink" href="http://www.worldofspectrum.org/forums/showthread.php?p=583022#post583022">http://www.worldofspectrum.org/forums/s ... post583022</a><!-- m -->