composing/merging definitions of other definitions (as possible in C). Extension of #v(<value>) construct
example:</value>
#define REG_CONF1_SPEED_SHIFT 1
#define REG_CONF1_SPEED_MASK 7
#define SETFIELD(reg,field,value) ((value& REG_##reg##_##field##_MASK)<<REG_##reg##_##field##_SHIFT)
movlw SETFIELD(CONF1,SPEED,13) ; equal movlw 10
Anonymous
Diff:
The #v(expr) outputs a decimal formatted string, e.g. #v(12+13) yields string '25'
What I would love to see is :
h(expr) outputs a hexadecimal formatted string.
Even better, #h(expr, 4) could output a 4-digit hex value, like #h(1023,4) yielding string '03FF'
likewise, #v(12+13, 5) could yield string '00025'
a(nn) to output ascii character nn.
another wish of me is support for #v() constructs at the left side of the = character like:
fc_#v($ >>11)0 = fc_#v($ >> 11)0 + 1
to increment a variable called fc_00, fc_10 or fc_20 depending on #v() value.
mpasm supports this way of variable assignments; gpasm not yet...
sorry; I mis-typed my post..
please read #h(expr) for h(expr),
and #a(nn) for a(nn)