The assembler seems to have some interesting/useful features.
DC.B R2 | G1
DC.B R2 | G1
DC.B R2 | G1
could simply be replaced with
DC.B [3] R2 | G1
It's also possible to pass parameters into macros.
SEQ9 MACRO red,redyellow
DC.B [red ] R2
DC.B [redyellow] R2 | Y2
ENDM
SEQ9 4,2
would do the same as four lines of "DC.B R2",We could as well pass the constants for the colour through:
SEQ8 MACRO col1,num1,col2,num2
DC.B [num1] col1
DC.B [num2] col2
ENDM
SEQ8 R2, 4, R2|Y2, 2
Now for something peculiar/weird:
SEQ7 MACRO col1,col2,total,num2percent
DC.B [100-(total/100)*num2percent] col1
DC.B [ (total/100)*num2percent] col2
ENDM
SEQ7 R2, R2|Y2, 200, 5
What gives us 200 Bytes:
Only one output Bit left.
What, if we need another traffic light ?
DC.W defines a 16 Bit constant (Word),
DC.L defines a 32 Bit constant (Long).
But when using them, we have to be aware,
what end of the egg the assembler opens for breakfast... just kidding.
"Little endian format" means, the little end of a value in memory
is at the lowest memory address (as known from 80x86).
A 32 Bit constant like $12345678 would end up as $78 $56 $34 $12 in memory.
"Big endian format" means, that the big end of a value in memory
is at the lowest memory address (as known from 68000).
$12345678 would give $12 $34 $56 $78 in memory.
At the moment, we are using big endian.
Some EPROM programming tools support Byte splitting, some don't.
In that case, we have to write our own tool to split 32 Bit values into 4
Bytes.
A little C program that uses fgetc() and fputc() should do it.
Just be aware of the Byte_order/endianess.
[HOME] [UP]/ [BACK] [2] [2] [3] [4] [5] [6] [7] [8] [NEXT]
(c) Dieter Mueller 2005