I'm working on my first project using gcbasic instead of asm, and discovered an assumption of mine isn't correct. (Assumptions, the root of all evil!)
I'm wanting to set a port to be an ASCII character via a subroutine, passing the ASCII character as a parameter to the subroutine. That all works fine, but when I try to use a constant rather than a variable it's not working as I expected, and I can't find anything obvious in the chm file or online about how to get what I want.
The compiler sticks in the code for string handling.
Some code: (just the bits relevent, lots removed for clarity...)
This works:
------------
PORTB="A"
------------
As does:
------------
OutChar="A"
PORTB=OutChar
------------
But this:
------------
SetPort "A"
sub SetPort (OutChar)
PORTB = OutChar
end sub
------------
Puts the code in for handling a string to pass to SetPort.
Is there a correct way to do this without using: ?
------------
TempChar="A"
SetPort TempChar
sub SetPort (OutChar)
PORTB = OutChar
end sub
------------
Cheers, Chris H.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That was a problem with the parameter handling code, which I've now just fixed. Thanks for letting me know.
The update is at http://gcbasic.sourceforge.net/newfiles . There are 3 files - one which contains an update from 0.9.3.0, one with contains an update from any update after 27/9/2007, and one which has just gcbasic.exe for updating the last patch.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi-ho,
I'm working on my first project using gcbasic instead of asm, and discovered an assumption of mine isn't correct. (Assumptions, the root of all evil!)
I'm wanting to set a port to be an ASCII character via a subroutine, passing the ASCII character as a parameter to the subroutine. That all works fine, but when I try to use a constant rather than a variable it's not working as I expected, and I can't find anything obvious in the chm file or online about how to get what I want.
The compiler sticks in the code for string handling.
Some code: (just the bits relevent, lots removed for clarity...)
This works:
------------
PORTB="A"
------------
As does:
------------
OutChar="A"
PORTB=OutChar
------------
But this:
------------
SetPort "A"
sub SetPort (OutChar)
PORTB = OutChar
end sub
------------
Puts the code in for handling a string to pass to SetPort.
Is there a correct way to do this without using: ?
------------
TempChar="A"
SetPort TempChar
sub SetPort (OutChar)
PORTB = OutChar
end sub
------------
Cheers, Chris H.
That was a problem with the parameter handling code, which I've now just fixed. Thanks for letting me know.
The update is at http://gcbasic.sourceforge.net/newfiles . There are 3 files - one which contains an update from 0.9.3.0, one with contains an update from any update after 27/9/2007, and one which has just gcbasic.exe for updating the last patch.
Thanks for that.
Wasn't a show-stopper, but did lead to quite a bit of head-scratching. :-).