My mind gets all messed up when thinking about the memory organization of the PIC, so forgive me if this is off track. Trying to port some assembly code that uses a lot of 16 bit/word variables, and its been a struggle.
In GCBasic it would be nice to deal with the Low byte of a word variable by being able to address its particular general purpose register, just as you would say, WordVariable_H. So like in assembler, using WordVariable_L would reduce unnecessary math (deconstruction of the word) and dummy variables (ram). With the current GCBasic interpretation, WordVariable is the Low byte in the GPR's. Unfortunately, the WordVariable (Low byte) also implies the 16bit/word value, when used with math operations, or Print/LCD display functions, and the like.
Comments?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It could be very useful when the word variables created in the asm code where called: "variable_L" and "variable_H", then we could use "variable" for the whole word variable, "variable_L" for the low byte and "variable_H" for the high byte.
Now in the generated asm there are: "variable" for low byte and "variable_H" for high byte; is possible managing low byte from GCBasic, but using asm instrucctions...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes of course, can see now, that using the banksel asm instruction could be a solution. Assembly.... still learning....:-).
Well, its possible using the "variable" as the low byte register has its advantages. Say like, when the compiler is parsing out the GCBasic commands. I try not to think about that, or more like, avoid thinking about that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My mind gets all messed up when thinking about the memory organization of the PIC, so forgive me if this is off track. Trying to port some assembly code that uses a lot of 16 bit/word variables, and its been a struggle.
In GCBasic it would be nice to deal with the Low byte of a word variable by being able to address its particular general purpose register, just as you would say, WordVariable_H. So like in assembler, using WordVariable_L would reduce unnecessary math (deconstruction of the word) and dummy variables (ram). With the current GCBasic interpretation, WordVariable is the Low byte in the GPR's. Unfortunately, the WordVariable (Low byte) also implies the 16bit/word value, when used with math operations, or Print/LCD display functions, and the like.
Comments?
I agree with the idea.
It could be very useful when the word variables created in the asm code where called: "variable_L" and "variable_H", then we could use "variable" for the whole word variable, "variable_L" for the low byte and "variable_H" for the high byte.
Now in the generated asm there are: "variable" for low byte and "variable_H" for high byte; is possible managing low byte from GCBasic, but using asm instrucctions...
There is a way to do this manually, but it's not properly documented yet. You can use an alias to combine 2 byte variables into a word, like so:
Dim BigVar As Word Alias HighByte, LowByte
HighByte = 2
LowByte = 100
if BigVar = 612 Then something
Yes of course, can see now, that using the banksel asm instruction could be a solution. Assembly.... still learning....:-).
Well, its possible using the "variable" as the low byte register has its advantages. Say like, when the compiler is parsing out the GCBasic commands. I try not to think about that, or more like, avoid thinking about that.
Weirdness happening with the forum postings being out of order.
Thanks Hugh, the Alias high and low bytes will work just great. Vague memory of seeing that in a-d.h, now that you have mentioned it.