Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

Please accept the use of cookies on our site

At PEmicro we use web browser cookies in order to provide you with an enhanced experience and in order to be able to do things like shopping cart processing and identify you when you login to our website.

Click here to accept

   Home P&E Customer Support FAQs - Frequently Asked Questions FAQ ID # 43
FAQ ID # 43
Does PEmicro's CASM assembler optimize the code generation for variables defined in the first page?
Yes. If the assembler knows the address of a variable when the variable is referenced by an instruction, PEmicro will allocate the least number of address bytes it can when assembling this instruction. If the variable has not yet been defined, PEmicro's assembler will allocate the maximum number of address bytes to make sure that when the variable address is resolved, the instruction will operate properly. The following examples show assembly code for the 68HC08 device: If the variable is defined before the instruction being assembled, the assembler will use 8-bit direct addressing mode automatically if the variable is within the first page as such:
0000 33 2 dfg db 33
0001 [01] 9D 4 nop
0002 [01] 9D 5 nop
0003 [01] 9D 6 nop
0004 [03] B600 7 lda dfg

If the variable has not yet been defined when the instruction is being assembled then the assembler automatically uses 16-bit direct as it does not know where the variable is (it allocates two bytes of address).
 0000 [01] 9D           1     nop 
0001 [01] 9D 2 nop
0002 [01] 9D 3 nop
0003 [04] C60006 4 lda dfg
0006 33 7 dfg db 33

For some of PEmicro's assemblers, including CASM08Z, the user can force an instruction to use 8 bit direct, even if the variable referenced is not yet defined, by preceding the label in the instruction with a '‹' character as follows:
 0000 [01] 9D           1     nop 
0001 [01] 9D 2 nop
0002 [01] 9D 3 nop
0003 [03] B605 4 lda ‹dfg
0005 33 7 dfg db 33

Related Downloads
Architectures Categories Products
HC08, HCS08 IDE - Integrated Development Environment, Assembler KIT908AB-USB, AEVM05, CASM05Z, MMDS0508Z, MMEVS0508Z, WINIDE05Z, CASM08Z, WINIDE08Z, KIT-HCS08GB, KIT-HCS08GB-USB, PKGHCS08-USB, CASMHCS08, WINIDEHCS08
Please rate this FAQ to help us improve our support
0 means "not helpful"
10 means "very helpful"
0 1 2 3 4 5 6 7 8 9 10

© 2018 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement