// ================================
// Moscovium
//		divu load test
//		(c) 2021	1YEN Toru
// ================================
asm		"mcoc_irom.mem"
incl	"mcoc115.incl"
# ================================

// ================================
// divu
// ================================
sesr	sreg_b_dr
ldwi	r7,lab_load_data
loop:
ldw		r0,[r7]							// Den
addi	r7,2
ldw		r1,[r7]							// Dso
addi	r7,2
ldw		r2,[r7]							// Quo
addi	r7,2
ldw		r3,[r7]							// Rem
addi	r7,2
// check finish condition
mov		r1,r1
beq		tstpass
// divider test
divu	r0,r1
cmp		r0,r2
bne		tstfail
cmp		r1,r3
bne		tstfail
// loop
bra		loop

// ================================
tstpass:
ldwi	r0,simpass						// pass: LED=blue
bra		tstfnsh
tstfail:
ldwi	r0,simfail						// fail: LED=red
tstfnsh:
ldwi	r7,simfnsh
stw		[r7],r0
bra		pcnt-2
nop
// ================================


// ================================
// load test data & expected value
// ================================
load_data:
datw	0x4fda,0x02ee,0x001b,0x00c0
datw	0xd873,0x03a4,0x003b,0x01a7
datw	0xb141,0x005d,0x01e7,0x0056
datw	0x9600,0x0250,0x0040,0x0200
datw	0xf59c,0x0116,0x00e2,0x0030
datw	0x750d,0x019f,0x0048,0x0055
datw	0x80c0,0x0114,0x0077,0x0074
datw	0x39c2,0x0024,0x019a,0x001a
datw	0x4c81,0x0090,0x0088,0x0001
datw	0x7b81,0x012e,0x0068,0x00d1
datw	0xad93,0x0204,0x0056,0x003b
datw	0xd9be,0x006d,0x01ff,0x002b
datw	0x2a57,0x028f,0x0010,0x0167
datw	0x8ee9,0x004c,0x01e1,0x001d
datw	0x519e,0x0388,0x0017,0x0066
datw	0xf062,0x02ca,0x0056,0x0086
datw	0x7ed3,0x037b,0x0024,0x0187
datw	0x4c9a,0x02be,0x001b,0x0290
datw	0x8b56,0x0179,0x005e,0x00e8
datw	0xff8e,0x0365,0x004b,0x00f7
datw	0x1a7a,0x0385,0x0007,0x01d7
datw	0x1ce2,0x02b7,0x000a,0x01bc
datw	0x9432,0x035f,0x002b,0x033d
datw	0xa44a,0x018c,0x006a,0x0052
datw	0x8d8d,0x0069,0x0159,0x000c
datw	0x8985,0x00f0,0x0092,0x00a5
datw	0x983f,0x0374,0x002c,0x004f
datw	0xe017,0x0047,0x0327,0x0046
datw	0xf395,0x0193,0x009a,0x0127
datw	0xf508,0x031b,0x004e,0x02ce
datw	0x5104,0x038c,0x0016,0x02fc
datw	0x1333,0x0341,0x0005,0x02ee
datw	0x75e2,0x0212,0x0038,0x01f2
datw	0xe105,0x031a,0x0048,0x01b5
datw	0xb975,0x006a,0x01bf,0x005f
datw	0xcc1d,0x03ab,0x0037,0x0260
datw	0xc67c,0x0142,0x009d,0x0102
datw	0x6c78,0x0114,0x0064,0x00a8
datw	0x0512,0x0350,0x0001,0x01c2
datw	0x2412,0x01c8,0x0014,0x0072
datw	0x6387,0x039d,0x001b,0x01f8
datw	0x5f02,0x00aa,0x008f,0x000c
datw	0xf1a3,0x011c,0x00d9,0x00e7
datw	0x6d09,0x03d0,0x001c,0x0249
datw	0xc377,0x01e8,0x0066,0x0107
datw	0xcbec,0x0165,0x0092,0x0052
datw	0x4c0e,0x0364,0x0016,0x0176
datw	0x0f98,0x016b,0x000a,0x016a
datw	0x0c4f,0x02e7,0x0004,0x00b3
datw	0x474d,0x001a,0x02be,0x0001
datw	0x0cc8,0x0021,0x0063,0x0005
datw	0x326c,0x0123,0x002c,0x0068
datw	0x2ca0,0x00e3,0x0032,0x004a
datw	0x7337,0x01a0,0x0046,0x0177
datw	0x248b,0x02b2,0x000d,0x0181
datw	0x9dab,0x027e,0x003f,0x00a9
datw	0x3e19,0x0032,0x013d,0x002f
datw	0x324f,0x01c7,0x001c,0x008b
datw	0xbc39,0x009f,0x012f,0x0008
datw	0xe70b,0x0222,0x006c,0x00b3
datw	0xc40e,0x02a8,0x0049,0x0226
datw	0x191f,0x02d5,0x0008,0x0277
datw	0xc8db,0x03c1,0x0035,0x01e6
datw	0xa411,0x031b,0x0034,0x0295
#
# end of data
datw	0,0,0,0

