01-20-2014, 12:35 AM
Hi boriel,
Here I show you the SPECTRA routines.
Selfexplaining... Line Height is the code for Attribute height: 0=8 pixel, 1=4 pixel, 2=2 pixel, 3=1 Pixel (unusable because attribute will overwrite system variables and not all attributes can have 1 line height, same problem with double byte flag and 2 pixel height)
It returns 1 if mode is available (SPECTRA present) or 0 if not
This set the Border (64 colour mode) based on RGB values (0-3 for each channel)
Should be easy to convert to inline Assembly
Demo:
Enhanced Border (15 Colour mode):
Also very easy to convert to inline Assembly
Demo:
More will come later.
Together with at least two games.
Here I show you the SPECTRA routines.
Code:
function SetSpectraMode(LineHeight as Ubyte,ExtraColours as ubyte,DoubleByteColour as ubyte,EnhancedBorder as ubyte,DisplayBank as ubyte,ShadowBank as ubyte,HalfCell as ubyte) as ubyte
dim mode,r as ubyte
mode=LineHeight|(ExtraColours<<2)|(DoubleByteColour<<3)|(EnhancedBorder<<4)|(DisplayBank<<5)|(ShadowBank<<6)|(HalfCell<<7)
out $7fdf,mode
if in($7fdf)<>mode
r=0
else
r=1
end if
return r
end function
It returns 1 if mode is available (SPECTRA present) or 0 if not
Code:
sub ExtendedBorder(red as ubyte,green as ubyte,blue as ubyte)
dim r,g,b as ubyte
b=((blue&1)<<5)|((blue&2)>>1)
r=((red&1)<<6)|((red&2))
g=((green&1)<<7)|((green&2)<<1)
out $fe,r|g|b
end sub
Should be easy to convert to inline Assembly
Demo:
Code:
if SetSpectraMode(0,1,0,1,0,0,0) 'Enable Enhanced Border with 64 Colours
BorderTest: 'Change Border Colours
print at 0,0;"Grey "
for a=0 to 3
ExtendedBorder(a,a,a)
pause 50
next a
for a=0 to 3
ExtendedBorder(3-a,3-a,3-a)
pause 50
next a
'Red
print at 0,0;"Red "
for a=0 to 3
ExtendedBorder(a,0,0)
pause 50
next a
for a=0 to 3
ExtendedBorder(3-a,0,0)
pause 50
next a
'Green
print at 0,0;"Green"
for a=0 to 3
ExtendedBorder(0,a,0)
pause 50
next a
for a=0 to 3
ExtendedBorder(0,3-a,0)
pause 50
next a
'Blue
print at 0,0;"Blue "
for a=0 to 3
ExtendedBorder(0,0,a)
pause 50
next a
for a=0 to 3
ExtendedBorder(0,0,3-a)
pause 50
next a
if inkey$<>" ":goto BorderTest:end if
end if
Enhanced Border (15 Colour mode):
Code:
sub ZXBorderEnhanced(BorderColor as ubyte,FlashWhite as ubyte,Bri as ubyte,Fla as ubyte)
out $fe,BorderColor|(FlashWhite<<5)|(Bri<<6)|(Fla<<7)
end sub
Demo:
Code:
if SetSpectraMode(0,0,0,1,0,0,0) 'Enable Enhanced Border with 15 Colours
print at 0,0;"Normal Colours"
for a=0 to 7
ZXBorderEnhanced(a,0,0,0)
pause 25
next a
print at 0,0;"Bright Colours"
for a=0 to 7
ZXBorderEnhanced(a,0,1,0)
pause 25
next a
print at 0,0;"Flash Bright Colours with black"
for a=0 to 7
ZXBorderEnhanced(a,0,1,1)
pause 100
next a
print at 0,0;"Flash Normal Colours with white"
for a=0 to 7
ZXBorderEnhanced(a,1,0,1)
pause 100
next a
print at 0,0;"And now to the 64 colours border"
pause 50
end if
Together with at least two games.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!