Code: Select all
task main()
{
byte dec = bcd2dec(101);
NumOut(0, LCD_LINE1,dec);
while(true);
}
Here is the generated NBC code, uploaded from the NXT.
Code: Select all
/*
testing bcd2dec.rxe
Header
----------------
FormatString = MindstormsNXT
Version = 6
DSCount = 24 (0x18)
DSSize = 72 (0x48)
DSStaticSize = 52 (0x34)
DSDefaultsSize = 26 (0x1A)
DynDSDefaultsOffset = 6 (0x6)
DynDSDefaultsSize = 20 (0x14)
MemMgrHead = 0 (0x0)
MemMgrTail = 1 (0x1)
DVArrayOffset = 52 (0x34)
ClumpCount = 2 (0x2)
CodespaceCount = 64 (0x40)
----------------
DataSpace
----------------
DSTOC
sl0000: 06 01 0000
sl0001: 06 01 0004
ul0002: 05 01 0008
sl0003: 06 01 000C
ul0004: 05 01 0010
sl0005: 06 01 0014
ub0006: 01 01 0018
sb0007: 02 00 0019
ub0008: 01 01 001A
ub0009: 01 01 001B
ub000A: 01 01 001C
ub000B: 01 01 001D
sb000C: 02 00 001E
ub000D: 01 01 001F
sb000E: 02 00 0020
sb000F: 02 00 0021
c0010: 08 00 0004
sb0011: 02 01 0024
c0012: 08 00 0002
sw0013: 04 01 0028
sw0014: 04 01 002A
a0015: 07 00 002C
ub0016: 01 00 0000
ul0017: 05 01 0030
Static DS Defaults
65 0A 10 07 01 00
Dynamic DS Defaults
Dope Vectors (offset, elem size, count, back ptr, link)
00 34 00 0A 00 02 FF FF 00 01
FF FF 00 01 00 00 00 2C FF FF
----------------
ClumpRecords
----------------
2 record(s) (Fire Cnt, Dependent Cnt, Code Start)
t000: 00 00 0000
t001: 01 00 003E
----------------
*/
; -------------- variable declarations --------------
dseg segment
;------- definitions -------
c0012_def struct
sw0013 sword
sw0014 sword
c0012_def ends
c0010_def struct
sb0011 sbyte
c0012 c0012_def
a0015 byte[]
ul0017 dword
c0010_def ends
;------- declarations -------
sl0000 sdword
sl0001 sdword
ul0002 dword
sl0003 sdword
ul0004 dword
sl0005 sdword
ub0006 byte
sb0007 sbyte 101
ub0008 byte
ub0009 byte
ub000A byte
ub000B byte
sb000C sbyte 10
ub000D byte
sb000E sbyte 16
sb000F sbyte 7
c0010 c0010_def
dseg ends
; -------------- program code --------------
thread t000
subcall t001, ub0008
set ub0006, 0x65
div ub000B, sb0007, sb000E
mod ub000A, ub0006, sb000E
mul sl0003, ub000B, sb000C
add sl0003, sl0003, ub000A
add ub0009, ul0004, sb000F
set sl0001, 0x0
set sl0005, 0x38
mov ul0002, ub0009
mov c0010.c0012.sw0013, sl0001
mov c0010.c0012.sw0014, sl0005
set c0010.ul0017, 0x0
numtostr c0010.a0015, ul0002
syscall DrawText, c0010
mov sl0000, c0010.sb0011
lbl0030: set sl0000, 0x1
tst NEQ, ub000D, sl0000
brtst EQ, lbl003B, ub000D
jmp lbl0030
lbl003B: exit -1, -1
endt
;-----------------------------------
thread t001
subret ub0008
endt