VGA_Text.Out($08) not working??
MacTuxLin
Posts: 821
Hello All,
I need to do up a mini station using PPB with VGA & PS2 KB/Mouse real quick but seems to hit a problem & its 2nd day now :frown: My code is:
Instead of getting a backspace, I got a "E" with a comma on top? (picture). Am I overlooking something?
Thanks a lot!!
I need to do up a mini station using PPB with VGA & PS2 KB/Mouse real quick but seems to hit a problem & its 2nd day now :frown: My code is:
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000 ' use 5MHz crystal
_ConClkFreq = ((_clkmode - xtal1) >> 6) * _xinfreq
_Ms_001 = _ConClkFreq / 1_000
_Us_001 = _ConClkFreq / 1_000_000
OBJ
KB : "Keyboard"
VGA : "VGA_Text"
PUB Main
'--- --- --- --- --- --- --- --- ---
'--- --- VGA Cog --- ---
'--- --- --- --- --- --- --- --- ---
ifnot(VGA.Start(16))
reboot
'--- --- --- --- --- --- --- --- ---
'--- --- Keyboard Cog --- ---
'--- --- --- --- --- --- --- --- ---
ifnot(KB.start(26, 27))
reboot
VGA.Out($00)
VGA.Str(String($C,6))
repeat
result := VGA.Out(KB.GetKey)
if result == $C8
VGA.Out($08)
VGA.Str(13)
Instead of getting a backspace, I got a "E" with a comma on top? (picture). Am I overlooking something?
Thanks a lot!!

Comments
(Slapping my forehead) >< Thanks Kuroneko. Thought could do this mini-guy within a few days ... OK, let me do a sanity-check.
repeat result := KB.GetKey if result == $C8 result := $08 Str.putCharacter(result) VGA.Out(result) VGA.Str(String($C,8)) VGA.Out($20) else if result <> $D VGA.Str(String($C,6)) VGA.Out(result) Str.putCharacter(result) else VGA.Str(String($C,8)) VGA.Str(Str.trimString(Str.getCharacters(true))) quitThanks a lot!!
Added: I should not have added the space . But hmm... how do I change the colour for those on the right of the "invisible" cursor??
xPtr := 0 repeat result := KB.GetKey if result == $C8 result := $08 Str.putCharacter(result) VGA.Out(result) if xPtr xPtr-- VGA.Out($A) VGA.Out(xPtr) VGA.Out($B) VGA.Out($0) VGA.Str(String($C,8)) repeat i from 0 to 31-xPtr VGA.Out($20) VGA.Out($A) VGA.Out(xPtr) VGA.Out($B) VGA.Out($0) else if result <> $D VGA.Str(String($C,6)) VGA.Out(result) Str.putCharacter(result) xPtr++ else VGA.Str(String($C,8)) VGA.Str(Str.trimString(Str.getCharacters(true))) quitI mean, the Backspacing portion doesn't seems to look efficient so may I know is there a better way to do this instead?
Thanks a lot!
if result == $C8 Str.putCharacter([COLOR="blue"]8[/COLOR]) VGA.str(string([COLOR="blue"]8[/COLOR],[COLOR="red"]12,8[/COLOR],[COLOR="blue"]32[/COLOR],[COLOR="red"]12,6[/COLOR],[COLOR="blue"]8[/COLOR])) else if result <> $DWhat this does is issue a backspace (8), print a space (32) in color 8 (12,8), change colour back to 6 (12,6) and finally issue another backspace to counter the effect of the space.Edit: Just re-checked, backspace only affects the current column, i.e. it is confined to the current row.