Propeller Tool ASM CON byte breakdown Request (or maybe there is a trick I don'
Timothy D. Swieter
Posts: 1,613
While working on some driver code I came across something that could be valuable in the ASM compiling. In the CON section I have many, many, many definitions. For example _S0_MR = $0400. Now, I can't use this definition in ASM because obviously it exceeds $1FF. (For those that aren't familiar with ASM the second register has to be 9 bits or less). So because _S0_MR is larger than $1FF I can't do the following.
But I would like to be able to do soemthing without breaking all the definitions down since the definitions are what are described in the data sheet. I was thinking I would try the following, but it doesn't compile. Maybe something like this already exist, but if it doesn't maybe it could get added in the compiler?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
mov reg, #_S0_MR
But I would like to be able to do soemthing without breaking all the definitions down since the definitions are what are described in the data sheet. I was thinking I would try the following, but it doesn't compile. Maybe something like this already exist, but if it doesn't maybe it could get added in the compiler?
mov reg, #_S0_MR.byte[noparse][[/noparse]0] shl reg, #8 or reg, #_S0_MR.byte
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
Except the way I have shown only uses one instruction for each reference to the constant in your PASM.
I'm not sure there is any way to load a long constant without consuming the LONG for it.
By the way .byte[noparse][[/noparse] 0 ] and .byte[noparse][[/noparse] 1 ] etc aren't really necessary as you can always use SHIFTS and ANDs when loading a constant:
MOV low_byte, big_constant & $FF
MOV high_byte, (big_constant >> 8) & $FF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Post Edited (heater) : 3/3/2010 11:35:40 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
This has two advantages:
1) Large constants in DAT are available for use in both Spin and PASM automatically.
2) Makes the program smaller when using large constants.
The following code goes from 17 program LONGs to 11 if I change the start method to use the "b" constant in DAT rather than the "a" constant definition.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Heater, with your last example, what is it about the way that SPIN handles a CON vs a DAT that causes 6 less longs?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
Post Edited (Bean) : 3/3/2010 2:11:07 PM GMT
The Prop. is the only architecture + language system I've seen that is both big endian and little endian at the same time.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
I also assume that CON was not assigned any memory but merely put labels on constants used during
compile time, but obviously if a label is used more than once it would be part of each instruction
that used the same labeled constant.
DAT still seems hard to accurately find and point to when used as data storage, with labels there not
easily evaluated consistently, and @ tending to always miss them by 16 or some random number. Has
it ever been conveniently solved to determine the address of a label in DAT? I seem to invent a lot of
wheels every time I need to access DAT space, and I just thought of searching HUBRAM for strings at
the beginning of DAT such as "DAT0", but that makes a long, which you say the endianness is not
consistent, so longs like $F000000F and $FF0000FF would might work as palindromes but may not be
unique and rare enough to use, like $F5A00A5F or $B0DA_AB0D. (Which a small loop would search
for and when found, result in a reliable pointer to a DAT block in both spin and pasm). What method
is simpler than such contrivances and also consistent?
edit: endianness in longs can be so variational that this new strange way might require them to be
more like $FF0000FF and $00FFFF00 until they are exactly specified, with those two non-unique
examples possibly being the only generally valid ones until it is known how they are stored in
every possible case. When, if ever, does a long or a string appear backwards or mixed up in DAT
if it is used or changed by both spin and pasm? I only noticed this problem with the internal font
before, and assumed that only the video generator was shifting the less obvious way.
Post Edited (VIRAND) : 3/3/2010 4:34:20 PM GMT
It takes no more room than the movs/movd tango and is quicker to execute and more readable. (I typically write constant labels using all caps to distinguish them from variables.)
For plain numeric constants that don't need a descriptive name, I use something like this:
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 3/3/2010 5:18:43 PM GMT