Accessing bytes within words and longs etc may be required when you are creating your solution. This can be done with some ease.
You can access the bytes within word and longs variables using the following as a guide:
Dim workvariable as long
workvariable = 21845
Dim lowb as byte
Dim highb as byte
Dim upperb as byte
Dim lastb as byte
lowb = workvariable
highb = workvariable_H
upperb = workvariable_U
lastb = workvariable_E
To extract the bytes from a LONG of 32 bits, where
Dim rB as Byte
Dim sW as Word
Dim tL as Long
‘ For bits 7-0 [lowest byte #0]
rB = tL
‘ For bits 15-8 [lower middle byte #1]
rB = tL_H
‘ For bits 23-16 [upper middle byte #2]
rB = tL_U
‘ For bits 31-24 [highest byte #3]
rB = tL_E
~~~~
To extract nibbles from variables
In Great Cow Basic you have byte variables, word variables, long variables and integer variables. See http://gcbasic.sourceforge.net/help/_setting_variables.html for the help file.
Accessing bytes within words and longs etc may be required when you are creating your solution. This can be done with some ease.
You can access the bytes within word and longs variables using the following as a guide:
Just to confirm, where
To extract the bytes from a WORD of 16 bits
To extract the bytes from a LONG of 32 bits, where
~~~~~
This FAQ was first created by Perry (OFUZZY1), Thank You!!
Last edit: Anobium 2017-09-16
Thanks Anobium , good info. I have printed and put in my notes of GCB.
Paul