~ubuntu-branches/ubuntu/raring/simh/raring

« back to all changes in this revision

Viewing changes to PDP11/pdp11_cis.c

  • Committer: Bazaar Package Importer
  • Author(s): Vince Mulhollon
  • Date: 2007-04-13 20:16:15 UTC
  • mfrom: (1.1.7 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20070413201615-jiar46bgkrs0dw2h
Tags: 3.7.0-1
* New upstream released 03-Feb-2007
* i7094 added which emulates the IBM 7090/7094
* Upstream has converted almost entirely to pdf format for docs
* All manpages updated
* All docs are registered with the doc-base system

Show diffs side-by-side

added added

removed removed

Lines of Context:
700
700
        fpd = 1;                                        /* set FPD */
701
701
        R[4] = R[4] & 0377;                             /* mask fill */
702
702
        c = t = 0;
703
 
        for (i = 0; (R[0] || R[2]); ) {                   /* until cnts == 0 */
 
703
        for (i = 0; (R[0] || R[2]); ) {                 /* until cnts == 0 */
704
704
            if (R[0]) c = ReadB (R[1] | dsenable);      /* get src1 or fill */
705
705
            else c = R[4];
706
706
            if (R[2]) t = ReadB (R[3] | dsenable);      /* get src2 or fill */
1192
1192
        dsrc    =       decimal string descriptor
1193
1193
        src     =       decimal string structure
1194
1194
        flag    =       numeric/packed flag
 
1195
 
1195
1196
   PSW.NZ are also set to their proper values
1196
1197
   PSW.V will be set on overflow; it must be initialized elsewhere
1197
 
        (to allow for external overflow calculations)
 
1198
   (to allow for external overflow calculations)
1198
1199
 
1199
1200
   The rules for the stored sign and the PSW sign are:
1200
 
        - Stored sign is negative if input is negative, string type
1201
 
          is signed, and the result is non-zero or there was overflow
1202
 
        - PSW sign is negative if input is negative, string type is
1203
 
          signed, and the result is non-zero
 
1201
 
 
1202
   - Stored sign is negative if input is negative, string type
 
1203
     is signed, and the result is non-zero or there was overflow
 
1204
   - PSW sign is negative if input is negative, string type is
 
1205
     signed, and the result is non-zero
 
1206
 
1204
1207
   Thus, the stored sign and the PSW sign will differ in one case:
1205
1208
   a negative zero generated by overflow is stored with a negative
1206
1209
   sign, but PSW.N is clear
1265
1268
        cy      =       carry in
1266
1269
   Output       =       1 if carry, 0 if no carry
1267
1270
 
1268
 
   This algorithm courtesy Anton Chernoff, circa 1992 or even earlier
 
1271
   This algorithm courtesy Anton Chernoff, circa 1992 or even earlier.
1269
1272
 
1270
1273
   We trace the history of a pair of adjacent digits to see how the
1271
1274
   carry is fixed; each parenthesized item is a 4b digit.
1272
1275
 
1273
1276
   Assume we are adding:
 
1277
 
1274
1278
        (a)(b)  I
1275
1279
   +    (x)(y)  J
1276
1280
 
1277
1281
   First compute I^J:
 
1282
 
1278
1283
        (a^x)(b^y)      TMP
1279
1284
 
1280
1285
   Note that the low bit of each digit is the same as the low bit of
1283
1288
 
1284
1289
   Now compute I+J+66 to get decimal addition with carry forced left
1285
1290
   one digit:
 
1291
 
1286
1292
        (a+x+6+carry mod 16)(b+y+6 mod 16)      SUM
1287
1293
 
1288
1294
   Note that if there was a carry from b+y+6, then the low bit of the
1357
1363
 
1358
1364
   Arguments:
1359
1365
        dsrc    =       decimal string structure
 
1366
 
1360
1367
   Returns the non-zero length of the string, in int32 units
1361
1368
   If the string is zero, the sign is cleared
1362
1369
*/
1395
1402
        mtable[10] =    array of decimal string structures
1396
1403
 
1397
1404
   Note that dsrc has a high order zero nibble; this
1398
 
        guarantees that the largest multiple won't overflow
1399
 
   Also note that mtable[0] is not filled in
 
1405
   guarantees that the largest multiple won't overflow.
 
1406
   Also note that mtable[0] is not filled in.
1400
1407
*/
1401
1408
 
1402
1409
void CreateTable (DSTR *dsrc, DSTR mtable[10])
1560
1567
return;
1561
1568
}
1562
1569
    
1563
 
/* Test for CIS mid-instruction interrupt - stub for now */
 
1570
/* Test for CIS mid-instruction interrupt */
1564
1571
 
1565
1572
t_bool cis_int_test (int32 cycles, int32 oldpc, t_stat *st)
1566
1573
{