
Originally Posted by
LeonBlade
Heylo,
I'm working on a little something in the GPU.
Basically I'm having port3 input a number either 0 or 1 for the ON or OFF status.
I want to be able to cmp port3,1 and if it's 1 then I write ON on the screen with the color GREEN and if not then write OFF on the screen with the color RED.
I was thinking just use mov #onoffstr,"ON" but that doesn't work right...
And I also need to figure out how to change color too...
Thanks,
LeonBlade
Admittedly I'd have to check the comments in the lua to be completely sure of the order of arguments in some of the opcodes, but you probably know those and this will give you the basic idea despite any mistakes:
Code:
dcolor white
cmp port3,1
ce _on
cne _off // I don't think you have to use cmp twice, it stores the result I think.
dexit
_on:
dwrite pos,on
ret
_off:
dwrite pos,off
ret
color white,255,255,255
vec2f pos,255,255
string on,'on'
string off,'off'
The alternative would be to write ASCII values for the new string over the old one, but it seems overcomplicated for a simple on/off. You have to do it if you want to dynamically display data in strings.
EDIT: Come to think of it, you could use mcopy to overwrite the old string, but again it seems a bit complicated for on/off.
Bookmarks