// ================================
//	Moscovium
//		divsr load test
//		(c) 2025	1YEN Toru
// ================================
asm		"mcoc_irom.mem"
incl	"mcoc115.incl"
# ================================


// ================================
// initialize
ldwi	r7,princtl
ldbiu	r0,prin_nld
ldbih	r0,asc_spc
stw		[r7],r0
ldwi	r5,prinhex
ldwi	r4,princhr
ldbiu	r6,asc_lf


// ================================
// divsr
// ================================
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
cmpi	r1,0
beq		tstpass
// print expected
stw		[r5],r0
stw		[r5],r1
stw		[r5],r2
stw		[r5],r3
// divider test
divsr	r0,r1
// print results
stw		[r5],r0
stw		[r5],r1
stw		[r4],r6
// check
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
//		divsr data: Den,Dso,Quo,Rem
// ================================
load_data:
datw	0xFF9D,0x0118,0x0000,0xFF9D
datw	0x2FFA,0x024F,0x0014,0x01CE
datw	0x604E,0xFF2F,0xFF8B,0x00C9
datw	0xEDDD,0xFC7C,0x0005,0xFF71
datw	0x33FE,0xFD76,0xFFEC,0x0136
datw	0x428F,0xFE01,0xFFDF,0x00B0
datw	0x87C4,0x028D,0xFFD1,0xFFA7
datw	0x98B1,0x025E,0xFFD5,0xFE7B
datw	0x301A,0x03CE,0x000C,0x0272
datw	0xDCCF,0xFFD4,0x00CC,0xFFDF
datw	0xBDC6,0xFCB0,0x0013,0xFCB6
datw	0xDFD5,0xFDEC,0x000F,0xFF01
datw	0x15A5,0x0008,0x02B4,0x0005
datw	0xDCA7,0xFFE4,0x0143,0xFFFB
datw	0xA776,0x027C,0xFFDD,0xFE6A
datw	0x9043,0x022D,0xFFCD,0xFF3A
datw	0x67F8,0x037A,0x001D,0x0326
datw	0x3B19,0x00B8,0x0052,0x0029
datw	0x6089,0x01A3,0x003A,0x019B
datw	0x6FB6,0x01E2,0x003B,0x00A0
datw	0xA869,0x0395,0xFFE8,0xFE61
datw	0xB5FA,0x0270,0xFFE2,0xFF1A
datw	0x154D,0xFD0B,0xFFF9,0x009A
datw	0x3AB1,0x0140,0x002E,0x0131
datw	0x177C,0x027C,0x0009,0x0120
datw	0x77B4,0x03B2,0x0020,0x0174
datw	0xCDC0,0x030B,0xFFF0,0xFE70
datw	0x8202,0xFEC7,0x0067,0xFFF1
datw	0xE5ED,0xFC26,0x0006,0xFD09
datw	0x2AE3,0x0334,0x000D,0x013F
datw	0x86A0,0x0149,0xFFA2,0xFF6E
datw	0x3AC4,0xFD69,0xFFEA,0x01CA
datw	0x5AD8,0x01FB,0x002D,0x01B9
datw	0x7B6F,0x01EF,0x003F,0x019E
datw	0xA485,0xFDBA,0x0028,0xFF75
datw	0xEDB8,0x0324,0xFFFB,0xFD6C
datw	0xAB2B,0xFE77,0x0037,0xFF9A
datw	0x43CA,0xFC6B,0xFFEE,0x0350
datw	0x3198,0x0268,0x0014,0x0178
datw	0x47B3,0x03C8,0x0012,0x03A3
datw	0x316F,0x0292,0x0013,0x0099
datw	0x2E77,0xFD22,0xFFF0,0x0097
datw	0xA1B6,0xFE4A,0x0037,0xFFD0
datw	0xBE0F,0x0237,0xFFE3,0xFE4A
datw	0x7C49,0x00FE,0x007D,0x0043
datw	0x7AE2,0xFEE1,0xFF93,0x00AF
datw	0x2A3B,0x02C7,0x000F,0x0092
datw	0xBF7F,0xFD4F,0x0017,0xFD66
datw	0x345A,0x033F,0x0010,0x006A
datw	0x3FE6,0x0055,0x00C0,0x0026
datw	0x8080,0xFFFB,0x1980,0x0000
datw	0xE5FE,0xFC9F,0x0007,0xFDA5
datw	0x3220,0x026F,0x0014,0x0174
datw	0xD481,0x00B0,0xFFC1,0xFFD1
datw	0x4E69,0x026C,0x0020,0x00E9
datw	0x8B56,0xFDF4,0x0038,0xFDF6
datw	0x0875,0xFFA7,0xFFE8,0x001D
datw	0xFF38,0xFEA1,0x0000,0xFF38
datw	0x9007,0x0021,0xFC9C,0xFFEB
datw	0x6093,0x037D,0x001B,0x0264
datw	0xFE05,0x0310,0x0000,0xFE05
datw	0x9A33,0x01DE,0xFFCA,0xFF07
datw	0xA207,0x0334,0xFFE3,0xFEEB
datw	0x5A33,0xFDCD,0xFFD7,0x0008
datw	0x1D47,0x0266,0x000C,0x007F
datw	0x4297,0xFDD0,0xFFE2,0x00F7
datw	0x8646,0xFFA1,0x0148,0xFFFE
datw	0x4168,0xFDBA,0xFFE4,0x01C0
datw	0x1866,0x037B,0x0007,0x0009
datw	0x266E,0x0155,0x001C,0x0122
datw	0xD45F,0xFDA5,0x0012,0xFEC5
datw	0x592A,0xFC16,0xFFEA,0x030E
datw	0xF6F7,0x0280,0xFFFD,0xFE77
datw	0xB609,0x0285,0xFFE3,0xFF1A
datw	0xD224,0xFD09,0x000F,0xFE9D
datw	0x7FBF,0xFCEA,0xFFD7,0x0139
datw	0x4856,0xFEDD,0xFFC1,0x00B9
datw	0xF1D1,0x017B,0xFFF7,0xFF24
datw	0x70D6,0xFFD7,0xFD40,0x0016
datw	0x5BE4,0xFF99,0xFF1C,0x0028
datw	0x83C4,0x0040,0xFE10,0xFFC4
datw	0xF82C,0x0076,0xFFF0,0xFF8C
datw	0xD12B,0xFE0A,0x0017,0xFE45
datw	0xC087,0xFCD7,0x0014,0xFFBB
datw	0x68FE,0x0281,0x0029,0x0255
datw	0xA60C,0x0212,0xFFD5,0xFF12
datw	0x14B5,0x0181,0x000D,0x0128
datw	0x8F92,0xFFD8,0x02CF,0xFFEA
datw	0xCF8C,0xFD85,0x0013,0xFEAD
datw	0xA2C6,0x0262,0xFFD9,0xFFB4
datw	0x4E60,0x0179,0x0035,0x0053
datw	0x356F,0x0309,0x0011,0x01D6
datw	0x1172,0xFD0D,0xFFFB,0x02B3
datw	0x2696,0xFC17,0xFFF7,0x0365
datw	0x9E11,0x00DD,0xFF8F,0xFF9E
datw	0xB1BB,0x0079,0xFF5B,0xFFB8
datw	0xC951,0xFCFB,0x0012,0xFFAB
datw	0xE3C4,0xFCA1,0x0008,0xFEBC
datw	0xF5B3,0x0204,0xFFFB,0xFFC7
datw	0x46D7,0x03C5,0x0012,0x02FD
datw	0x13EA,0x0026,0x0086,0x0006
datw	0xD955,0xFE6D,0x0018,0xFF1D
datw	0x482A,0xFD41,0xFFE6,0x00C4
datw	0x0C6E,0x03CA,0x0003,0x0110
datw	0xAE03,0xFF1F,0x005D,0xFFC0
datw	0x19A3,0xFF96,0xFFC3,0x0061
datw	0xAFEF,0xFE5A,0x0030,0xFF0F
datw	0x2A9E,0x0339,0x000D,0x00B9
datw	0x0E28,0xFF2D,0xFFEF,0x0025
datw	0xECC0,0xFDFC,0x0009,0xFEE4
datw	0x5BDC,0xFD73,0xFFDC,0x0008
datw	0x98ED,0xFCA6,0x001E,0xFD79
datw	0x483F,0xFEDD,0xFFC1,0x00A2
datw	0x9D86,0xFE38,0x0037,0xFF7E
datw	0xBE7B,0x02EB,0xFFEA,0xFEAD
datw	0x2E67,0xFC24,0xFFF4,0x0017
datw	0x55A3,0xFFFC,0xEA98,0x0003
datw	0xD2C2,0x03DA,0xFFF5,0xFD20
datw	0x68E6,0x00D7,0x007C,0x00C2
datw	0x1C34,0x009C,0x002E,0x002C
datw	0xA33A,0x0291,0xFFDC,0xFF9E
datw	0xD35C,0x02E1,0xFFF1,0xFE8B
datw	0xFC08,0x0030,0xFFEB,0xFFF8
datw	0xC4EF,0x0010,0xFC4F,0xFFFF
datw	0xF83B,0x02FF,0xFFFE,0xFE39
datw	0x4655,0x0043,0x010C,0x0031
datw	0xBF4A,0x0380,0xFFEE,0xFE4A
datw	0xAB23,0x03EF,0xFFEB,0xFDBE
datw	0x4C1D,0xFEBE,0xFFC4,0x00A5
datw	0x1344,0x0261,0x0008,0x003C
datw	0x1C59,0xFD5F,0xFFF6,0x020F
datw	0xDE8B,0x01F7,0xFFEF,0xFFF2
datw	0x8410,0x00DF,0xFF72,0xFFC2
datw	0xDF4F,0x02D9,0xFFF5,0xFEA2
datw	0xB807,0x0171,0xFFCF,0xFEA8
datw	0xB756,0x01D8,0xFFD9,0xFF3E
datw	0xF355,0x003A,0xFFC9,0xFFCB
datw	0x58E3,0x0180,0x003B,0x0063
datw	0x1664,0xFEF1,0xFFEB,0x0029
datw	0x89DC,0xFF38,0x0097,0xFFD4
datw	0x73B3,0xFDDA,0xFFCB,0x01D5
datw	0x17FE,0x02C7,0x0008,0x01C6
datw	0xA072,0xFE73,0x003D,0xFF0B
datw	0x70AF,0xFDE7,0xFFCB,0x0182
datw	0xA479,0xFD10,0x001F,0xFF89
datw	0xDCEA,0x0054,0xFF96,0xFFB2
datw	0x32A7,0x003A,0x00DF,0x0021
datw	0x265D,0xFC3B,0xFFF6,0x00AB
datw	0xA6AE,0x0186,0xFFC6,0xFF0A
datw	0x7409,0xFF98,0xFEE3,0x0041
datw	0x95C1,0xFC6D,0x001D,0xFD68
datw	0x1C50,0x034A,0x0008,0x0200
datw	0x6EEB,0x0341,0x0022,0x0049
datw	0xCE9B,0xFDA3,0x0014,0xFDDF
datw	0x7431,0x00F8,0x0077,0x00E9
datw	0xE4FC,0x03B6,0xFFF9,0xFEF6
datw	0xFE31,0x0017,0xFFEC,0xFFFD
datw	0x3F95,0x0331,0x0013,0x02F2
datw	0xB995,0xFE82,0x002F,0xFFB7
datw	0x6A28,0x028F,0x0029,0x0141
datw	0x3AB5,0x0155,0x002C,0x0019
datw	0x7CEA,0x019F,0x004D,0x0017
datw	0x6D9B,0x0064,0x0118,0x003B
datw	0xFBA7,0x0243,0xFFFF,0xFDEA
datw	0x94A9,0x0216,0xFFCD,0xFF0B
datw	0xB5D9,0xFCB4,0x0016,0xFE61
datw	0xCE5E,0xFEF6,0x002F,0xFF34
datw	0xE1EB,0x00D5,0xFFDC,0xFFDF
datw	0xC844,0x011A,0xFFCE,0xFF58
datw	0xD74E,0x0009,0xFB7B,0xFFFB
datw	0x4F1E,0xFE7D,0xFFCC,0x0082
datw	0x353F,0x00FB,0x0036,0x004D
datw	0x5383,0xFEFA,0xFFAF,0x009D
datw	0x0F3A,0x03EC,0x0003,0x0376
datw	0x914B,0x00DD,0xFF80,0xFFCB
datw	0x590E,0x0046,0x0145,0x0030
datw	0x9A95,0x0186,0xFFBE,0xFF21
datw	0x5ECB,0xFFD1,0xFDFC,0x000F
datw	0xA8A8,0x0098,0xFF6D,0xFFF0
datw	0xA7B5,0xFE06,0x002C,0xFEAD
datw	0x6060,0x0162,0x0045,0x00F6
datw	0xB388,0x005E,0xFF30,0xFFE8
datw	0x9D1B,0xFF34,0x007C,0xFFEB
datw	0x6B7F,0xFDD6,0xFFCF,0x0175
datw	0xDBF0,0xFDE4,0x0011,0xFFCC
datw	0x9853,0xFDAE,0x002C,0xFE6B
datw	0x0A17,0x02B6,0x0003,0x01F5
datw	0xEC2C,0xFC4D,0x0005,0xFEAB
datw	0x03A0,0x0037,0x0010,0x0030
datw	0xFA3C,0x00C8,0xFFF9,0xFFB4
datw	0x77D0,0x02B1,0x002C,0x0164
datw	0x7BD9,0x0009,0x0DC2,0x0007
datw	0x16D1,0xFF91,0xFFCC,0x0045
datw	0x8750,0xFFA1,0x0145,0xFFEB
datw	0x4266,0xFDBE,0xFFE3,0x00EC
datw	0x3B92,0xFFCD,0xFED5,0x0001
datw	0xB3DD,0xFC2C,0x0013,0xFC99
datw	0xA0AD,0xFD73,0x0025,0xFF0E
datw	0xDC30,0xFCEF,0x000B,0xFDEB
datw	0x4350,0x00E3,0x004B,0x00CF
datw	0x634E,0x036E,0x001C,0x0346
datw	0x728C,0x0112,0x006B,0x0006
datw	0x6AA2,0x03AA,0x001D,0x0060
datw	0x7AF4,0xFCD5,0xFFDA,0x0292
datw	0x876B,0x035F,0xFFDD,0xFD68
datw	0x3285,0x0003,0x10D7,0x0000
datw	0x951F,0xFD7F,0x002A,0xFE49
datw	0xA3B9,0xFC10,0x0017,0xFE49
datw	0xAEE3,0xFE83,0x0036,0xFF41
datw	0x9170,0x008D,0xFF38,0xFF98
datw	0x4DE8,0x0144,0x003D,0x00B4
datw	0x8175,0xFF73,0x00E5,0xFF96
datw	0x9F02,0xFD0C,0x0020,0xFD82
datw	0xD8D3,0xFE96,0x001B,0xFF01
datw	0x40EB,0xFFC6,0xFEE2,0x001F
datw	0xAC47,0x00D3,0xFF9B,0xFF86
datw	0x62D0,0x0051,0x0138,0x0018
datw	0x73BA,0xFC4D,0xFFE1,0x010D
datw	0x4B3F,0x015A,0x0037,0x00E9
datw	0x938C,0xFFEE,0x0606,0xFFF8
datw	0x57D7,0x01AE,0x0034,0x007F
datw	0x307B,0xFD42,0xFFEF,0x01DD
datw	0xBF78,0xFC84,0x0012,0xFE30
datw	0x0016,0x02FB,0x0000,0x0016
datw	0x5779,0xFFCD,0xFE49,0x0004
datw	0xA41B,0x00F2,0xFF9F,0xFFCD
datw	0x3E76,0xFCCB,0xFFED,0x0187
datw	0xF32B,0x03E4,0xFFFD,0xFED7
datw	0x7068,0x02BA,0x0029,0x009E
datw	0xBBF6,0xFF16,0x004A,0xFF9A
datw	0x00FE,0x0266,0x0000,0x00FE
datw	0x805A,0xFE8D,0x0058,0xFFE2
datw	0x468F,0x013A,0x0039,0x00A5
datw	0x6A35,0x00E7,0x0075,0x00A2
datw	0x545D,0xFDB4,0xFFDC,0x01AD
datw	0x895A,0xFC9A,0x0022,0xFCE6
datw	0x690A,0xFD5D,0xFFD9,0x0235
datw	0xEB87,0xFF1A,0x0016,0xFF4B
datw	0xC06E,0xFDD5,0x001D,0xFF4D
datw	0xEBE6,0x0275,0xFFF8,0xFF8E
datw	0x694A,0x0194,0x0042,0x0122
datw	0x443F,0xFC75,0xFFED,0x00EE
datw	0x0473,0x01EA,0x0002,0x009F
datw	0xF15F,0xFEFB,0x000E,0xFFA5
datw	0x00E8,0x0353,0x0000,0x00E8
datw	0x968E,0xFE3C,0x003B,0xFEBA
datw	0xF254,0xFD2F,0x0004,0xFD98
datw	0x9803,0xFC8A,0x001E,0xFFD7
datw	0x0A26,0xFD40,0xFFFD,0x01E6
datw	0xEBC8,0xFE92,0x000E,0xFFCC
datw	0xF57F,0xFEDB,0x0009,0xFFCC
datw	0x56CB,0xFEE2,0xFFB3,0x00C5
datw	0x10C0,0x00A0,0x001A,0x0080
datw	0xD673,0xFF5A,0x0040,0xFFF3
datw	0x0737,0xFF60,0xFFF5,0x0057
datw	0x8AEF,0xFC9D,0x0022,0xFE15
#
# end of data
datw	0,0,0,0

