Source Code

000331,000001: # Copyright 2004 Ronald S. Burkey <info@sandroid.org> 000332,000002: # 000333,000003: # This file is part of yaAGC. 000334,000004: 000335,000005: # yaAGC is free software; you can redistribute it and/or modify 000336,000006: # it under the terms of the GNU General Public License as published by 000337,000007: # the Free Software Foundation; either version 2 of the License, or 000338,000008: # (at your option) any later version. 000339,000009: 000340,000010: # yaAGC is distributed in the hope that it will be useful, 000341,000011: # but WITHOUT ANY WARRANTY; without even the implied warranty of 000342,000012: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 000343,000013: # GNU General Public License for more details. 000344,000014: 000345,000015: # You should have received a copy of the GNU General Public License 000346,000016: # along with yaAGC; if not, write to the Free Software 000347,000017: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 000348,000018: 000349,000019: # Filename: ValidateDAS.agc 000350,000020: # Purpose: This is the portion of the Validation program that attempts 000351,000021: # to validate the DAS instruction 000352,000022: # Mod history: 07/04/04 RSB. Began. 000353,000023: 000354,000024: # (Test 6.) What we do here is just add 000355,000025: # various numbers and check the result, including some 000356,000026: # boundary cases that generate +- overflow. 000357,000027: 4256 24061 INCR ERRNUM 000358,000028: 000359,000029: 4257 00006 EXTEND 000360,000030: 4260 37462 DCA BIGRNUM # Get 123454321 * 14 (octal). 000361,000031: 4261 00006 EXTEND 000362,000032: 4262 40001 DCOM # 123454321 * -14. 000363,000033: 4263 52065 DXCH TEMPJ # Save at TEMPJ,TEMPK 000364,000034: 4264 37437 CA TWNTHREE # TEMPI is loop counter. 000365,000035: 000366,000036: # First check the normal case. 000367,000037: # The idea here is that we start with -14*123454321, go to 000368,000038: # -13*123454321, ..., -0, +1*123454321, ..., +14*123454321. 000369,000039: # Then we compare the results. 000370,000040: 4265 24062 INCR ERRSUB # 1 000371,000041: 4266 54063 DASLOOP TS TEMPI 000372,000042: 4267 00006 EXTEND # Update the running sum. 000373,000043: 4270 37460 DCA BIGNUM 000374,000044: 4271 20065 DAS TEMPJ 000375,000045: 4272 00006 EXTEND # Overflow? 000376,000046: 4273 14275 BZF DASNOV1 000377,000047: 4274 14572 TCF VDAERROR 000378,000048: 4275 30001 DASNOV1 CA L # L-reg 0? 000379,000049: 4276 00006 EXTEND 000380,000050: 4277 14301 BZF DASNOV1A 000381,000051: 4300 14572 TCF VDAERROR 000382,000052: 4301 10063 DASNOV1A CCS TEMPI 000383,000053: 4302 14266 TCF DASLOOP 000384,000054: 4303 24062 INCR ERRSUB # 2 000385,000055: 4304 00006 EXTEND # Compare. 000386,000056: 4305 37462 DCA BIGRNUM 000387,000057: 4306 00006 EXTEND 000388,000058: 4307 60064 SU TEMPJ 000389,000059: 4310 00006 EXTEND 000390,000060: 4311 14313 BZF DASOK1 000391,000061: 4312 14572 TCF VDAERROR 000392,000062: 4313 24062 DASOK1 INCR ERRSUB # 3 000393,000063: 4314 30001 CA L 000394,000064: 4315 00006 EXTEND 000395,000065: 4316 60065 SU TEMPK 000396,000066: 4317 00006 EXTEND 000397,000067: 4320 14322 BZF DASOK2 000398,000068: 4321 14572 TCF VDAERROR 000399,000069: 4322 DASOK2 000400,000070: 4322 30007 CA ZEROES 000401,000071: 4323 54062 TS ERRSUB 000402,000072: 000403,000073: # (Test 7.) Now we check boundary cases where +- overflow are 000404,000074: # generated. Also, we check that adding +-0 doesn't change 000405,000075: # the result. 000406,000076: 4324 24061 INCR ERRNUM 000407,000077: 4325 24062 INCR ERRSUB # 1 000408,000078: # Add +-0 to next-to-highest DP integer. 000409,000079: 4326 00006 EXTEND 000410,000080: 4327 37500 DCA DBMAXP-1 # Next-to-highest + DP. 000411,000081: 4330 52065 DXCH TEMPJ # Store in erasable. 000412,000082: # ... first, +0. 000413,000083: 4331 00006 EXTEND # Let's add +0 to it. 000414,000084: 4332 37464 DCA DBZERO 000415,000085: 4333 20065 DAS TEMPJ 000416,000086: 4334 00006 EXTEND # Overflow? 000417,000087: 4335 14337 BZF DASOK3 000418,000088: 4336 14572 TCF VDAERROR 000419,000089: 4337 24062 DASOK3 INCR ERRSUB # 2 000420,000090: 4340 00006 EXTEND 000421,000091: 4341 37500 DCA DBMAXP-1 # Check if unchanged. 000422,000092: 4342 00006 EXTEND # MS word first. 000423,000093: 4343 60064 SU TEMPJ 000424,000094: 4344 00006 EXTEND 000425,000095: 4345 14347 BZF DASOK4 000426,000096: 4346 14572 TCF VDAERROR 000427,000097: 4347 24062 DASOK4 INCR ERRSUB # 3 000428,000098: 4350 30001 CA L # LS word. 000429,000099: 4351 00006 EXTEND 000430,000100: 4352 60065 SU TEMPK 000431,000101: 4353 00006 EXTEND 000432,000102: 4354 14356 BZF DASOK5 000433,000103: 4355 14572 TCF VDAERROR 000434,000104: # ... now, -0. 000435,000105: 4356 24062 DASOK5 INCR ERRSUB # 4 000436,000106: 4357 00006 EXTEND # Let's add -0 to it. 000437,000107: 4360 37466 DCA DBMZERO 000438,000108: 4361 20065 DAS TEMPJ 000439,000109: 4362 00006 EXTEND # Overflow? 000440,000110: 4363 14365 BZF DASOK6 000441,000111: 4364 14572 TCF VDAERROR 000442,000112: 4365 24062 DASOK6 INCR ERRSUB # 5 000443,000113: 4366 00006 EXTEND 000444,000114: 4367 37500 DCA DBMAXP-1 # Check if unchanged. 000445,000115: 4370 00006 EXTEND # MS word first. 000446,000116: 4371 60064 SU TEMPJ 000447,000117: 4372 00006 EXTEND 000448,000118: 4373 14375 BZF DASOK7 000449,000119: 4374 14572 TCF VDAERROR 000450,000120: 4375 24062 DASOK7 INCR ERRSUB # 6 000451,000121: 4376 30001 CA L # LS word. 000452,000122: 4377 00006 EXTEND 000453,000123: 4400 60065 SU TEMPK 000454,000124: 4401 00006 EXTEND 000455,000125: 4402 14404 BZF DASOK8 000456,000126: 4403 14572 TCF VDAERROR 000457,000127: 4404 DASOK8 000458,000128: # Now add +1, and make sure no overflow. 000459,000129: 4404 24062 INCR ERRSUB # 7 000460,000130: 4405 00006 EXTEND # Let's add +1 to it. 000461,000131: 4406 37470 DCA DBONE 000462,000132: 4407 20065 DAS TEMPJ 000463,000133: 4410 00006 EXTEND # Overflow? 000464,000134: 4411 14413 BZF DASOK9 000465,000135: 4412 14572 TCF VDAERROR 000466,000136: 4413 24062 DASOK9 INCR ERRSUB # 10 octal 000467,000137: 4414 00006 EXTEND 000468,000138: 4415 37474 DCA DBMAXP # Check result. 000469,000139: 4416 00006 EXTEND # MS word first. 000470,000140: 4417 60064 SU TEMPJ 000471,000141: 4420 00006 EXTEND 000472,000142: 4421 14423 BZF DASOK10 000473,000143: 4422 14572 TCF VDAERROR 000474,000144: 4423 24062 DASOK10 INCR ERRSUB # 11 octal 000475,000145: 4424 30001 CA L # LS word. 000476,000146: 4425 00006 EXTEND 000477,000147: 4426 60065 SU TEMPK 000478,000148: 4427 00006 EXTEND 000479,000149: 4430 14432 BZF DASOK11 000480,000150: 4431 14572 TCF VDAERROR 000481,000151: 4432 DASOK11 000482,000152: # Now add +1 again, and make sure there is overflow and 000483,000153: # there is wraparound to +0. 000484,000154: 4432 24062 INCR ERRSUB # 12 000485,000155: 4433 00006 EXTEND # Let's add +1 to it. 000486,000156: 4434 37470 DCA DBONE 000487,000157: 4435 20065 DAS TEMPJ 000488,000158: 4436 67424 AD NEGONE # Positive overflow? 000489,000159: 4437 00006 EXTEND # Overflow? 000490,000160: 4440 14442 BZF DASOK12 000491,000161: 4441 14572 TCF VDAERROR 000492,000162: 4442 24062 DASOK12 INCR ERRSUB # 13 000493,000163: 4443 00006 EXTEND 000494,000164: 4444 37464 DCA DBZERO # Check result. 000495,000165: 4445 00006 EXTEND # MS word first. 000496,000166: 4446 60064 SU TEMPJ 000497,000167: 4447 00006 EXTEND 000498,000168: 4450 14452 BZF DASOK13 000499,000169: 4451 14572 TCF VDAERROR 000500,000170: 4452 24062 DASOK13 INCR ERRSUB # 14 000501,000171: 4453 30001 CA L # LS word. 000502,000172: 4454 00006 EXTEND 000503,000173: 4455 60065 SU TEMPK 000504,000174: 4456 00006 EXTEND 000505,000175: 4457 14461 BZF DASOK14 000506,000176: 4460 14572 TCF VDAERROR 000507,000177: 4461 DASOK14 000508,000178: # Same thing now, but with negative values. 000509,000179: 4461 24062 INCR ERRSUB # 15 000510,000180: 4462 00006 EXTEND 000511,000181: 4463 37502 DCA DBMAXN-1 000512,000182: 4464 52065 DXCH TEMPJ 000513,000183: # Now add -1, and make sure no overflow. 000514,000184: 4465 00006 EXTEND # Let's add -1 to it. 000515,000185: 4466 37472 DCA DBMONE 000516,000186: 4467 20065 DAS TEMPJ 000517,000187: 4470 00006 EXTEND # Overflow? 000518,000188: 4471 14473 BZF DASOK15 000519,000189: 4472 14572 TCF VDAERROR 000520,000190: 4473 24062 DASOK15 INCR ERRSUB # 16 000521,000191: 4474 00006 EXTEND 000522,000192: 4475 37476 DCA DBMAXN # Check result. 000523,000193: 4476 00006 EXTEND # MS word first. 000524,000194: 4477 60064 SU TEMPJ 000525,000195: 4500 00006 EXTEND 000526,000196: 4501 14503 BZF DASOK16 000527,000197: 4502 14572 TCF VDAERROR 000528,000198: 4503 24062 DASOK16 INCR ERRSUB # 17 000529,000199: 4504 30001 CA L # LS word. 000530,000200: 4505 00006 EXTEND 000531,000201: 4506 60065 SU TEMPK 000532,000202: 4507 00006 EXTEND 000533,000203: 4510 14512 BZF DASOK17 000534,000204: 4511 14572 TCF VDAERROR 000535,000205: 4512 DASOK17 000536,000206: # Now add -1 again, and make sure there is pos. overflow and 000537,000207: # there is wraparound to -0. 000538,000208: 4512 24062 INCR ERRSUB # 20 octal 000539,000209: 4513 00006 EXTEND # Let's add -1 to it. 000540,000210: 4514 37472 DCA DBMONE 000541,000211: 4515 20065 DAS TEMPJ 000542,000212: 4516 67430 AD ONE 000543,000213: 4517 00006 EXTEND # Overflow? 000544,000214: 4520 14522 BZF DASOK18 000545,000215: 4521 14572 TCF VDAERROR 000546,000216: 4522 24062 DASOK18 INCR ERRSUB # 21 octal 000547,000217: 4523 00006 EXTEND 000548,000218: 4524 37466 DCA DBMZERO # Check result. 000549,000219: 4525 00006 EXTEND # MS word first. 000550,000220: 4526 60064 SU TEMPJ 000551,000221: 4527 00006 EXTEND 000552,000222: 4530 14532 BZF DASOK19 000553,000223: 4531 14572 TCF VDAERROR 000554,000224: 4532 24062 DASOK19 INCR ERRSUB # 22 000555,000225: 4533 30001 CA L # LS word. 000556,000226: 4534 00006 EXTEND 000557,000227: 4535 60065 SU TEMPK 000558,000228: 4536 00006 EXTEND 000559,000229: 4537 14541 BZF DASOK20 000560,000230: 4540 14572 TCF VDAERROR 000561,000231: 4541 DASOK20 000562,000232: 000563,000233: 4541 30007 CA ZEROES 000564,000234: 4542 54062 TS ERRSUB 000565,000235: 000566,000236: # (Test 8.) Now we check cases where the signs of the more-significant 000567,000237: # and less-significant words disagree. 000568,000238: 4543 24061 INCR ERRNUM 000569,000239: 000570,000240: # Check that X + -X = -0. This isn't spec'd, but I've seen 000571,000241: # a comment somewhere that it is true. 000572,000242: 4544 24062 INCR ERRSUB # 1 000573,000243: 4545 00006 EXTEND 000574,000244: 4546 37460 DCA BIGNUM 000575,000245: 4547 00006 EXTEND 000576,000246: 4550 40001 DCOM 000577,000247: 4551 52065 DXCH TEMPJ 000578,000248: 4552 00006 EXTEND 000579,000249: 4553 37460 DCA BIGNUM 000580,000250: 4554 20065 DAS TEMPJ 000581,000251: 4555 30064 CA TEMPJ 000582,000252: 4556 10000 CCS A 000583,000253: 4557 14572 TCF VDAERROR 000584,000254: 4560 14572 TCF VDAERROR 000585,000255: 4561 14572 TCF VDAERROR 000586,000256: 4562 24062 INCR ERRSUB # 2 000587,000257: 4563 30065 CA TEMPK 000588,000258: 4564 10000 CCS A 000589,000259: 4565 14572 TCF VDAERROR 000590,000260: 4566 14572 TCF VDAERROR 000591,000261: 4567 14572 TCF VDAERROR 000592,000262: 000593,000263: 4570 14573 TCF +3 000594,000264: 4571 00010 TSTEIGHT DEC 8 B-14 000595,000265: 4572 07240 VDAERROR TC ERRORDSP 000596,000266: 4573 34571 CA TSTEIGHT 000597,000267: 4574 54061 TS ERRNUM 000598,000268: 4575 30007 CA ZEROES 000599,000269: 4576 54062 TS ERRSUB 000600,000270: End of include-file ValidateDAS.agc. Parent file is Validation.agc