root/src/dps8/dps8_iefp.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. Read
  2. ReadAPUDataRead
  3. ReadOperandRead
  4. ReadOperandRMW
  5. ReadAPUDataRMW
  6. ReadInstructionFetch
  7. ReadIndirectWordFetch
  8. Read2
  9. Read2OperandRead
  10. Read2OperandRMW
  11. Read2InstructionFetch
  12. Read2RTCDOperandFetch
  13. Read2IndirectWordFetch
  14. Read8
  15. Read16
  16. ReadPage
  17. Write
  18. WriteAPUDataStore
  19. WriteOperandStore
  20. Write2
  21. Write2OperandStore
  22. Write1
  23. Write8
  24. Write16
  25. Write32
  26. WritePage
  27. ReadIndirect

   1 /*
   2  * vim: filetype=c:tabstop=4:ai:expandtab
   3  * SPDX-License-Identifier: ICU
   4  * SPDX-License-Identifier: Multics
   5  * scspell-id: 755f1556-f62e-11ec-8184-80ee73e9b8e7
   6  *
   7  * ---------------------------------------------------------------------------
   8  *
   9  * Copyright (c) 2007-2013 Michael Mondy
  10  * Copyright (c) 2012-2016 Harry Reed
  11  * Copyright (c) 2013-2016 Charles Anthony
  12  * Copyright (c) 2015 Eric Swenson
  13  * Copyright (c) 2017 Michal Tomek
  14  * Copyright (c) 2021-2025 The DPS8M Development Team
  15  *
  16  * This software is made available under the terms of the ICU License.
  17  * See the LICENSE.md file at the top-level directory of this distribution.
  18  *
  19  * ---------------------------------------------------------------------------
  20  *
  21  * This source file may contain code comments that adapt, include, and/or
  22  * incorporate Multics program code and/or documentation distributed under
  23  * the Multics License.  In the event of any discrepancy between code
  24  * comments herein and the original Multics materials, the original Multics
  25  * materials should be considered authoritative unless otherwise noted.
  26  * For more details and historical background, see the LICENSE.md file at
  27  * the top-level directory of this distribution.
  28  *
  29  * ---------------------------------------------------------------------------
  30  */
  31 
  32 //-V::536
  33 
  34 #include "dps8.h"
  35 #include "dps8_sys.h"
  36 #include "dps8_iom.h"
  37 #include "dps8_cable.h"
  38 #include "dps8_cpu.h"
  39 #include "dps8_faults.h"
  40 #include "dps8_scu.h"
  41 #include "dps8_append.h"
  42 #include "dps8_iefp.h"
  43 #include "dps8_addrmods.h"
  44 #include "dps8_utils.h"
  45 #include "dps8_cache.h"
  46 
  47 #define DBG_CTR cpu.cycleCnt
  48 
  49 // new Read/Write stuff ...
  50 
  51 #if defined(OLDAPP)
  52 void Read (cpu_state_t * cpup, word18 address, word36 * result, processor_cycle_type cyctyp)
     /* [previous][next][first][last][top][bottom][index][help] */
  53   {
  54     cpu.TPR.CA = cpu.iefpFinalAddress = address;
  55     bool isBAR = get_bar_mode (cpup);
  56 
  57     //if (get_went_appending () ||
  58     if (cpu.cu.XSF || (cyctyp != INSTRUCTION_FETCH && cpu.currentInstruction.b29))
  59       {
  60         goto B29;
  61       }
  62 
  63     switch (get_addr_mode (cpup))
  64       {
  65         case ABSOLUTE_mode:
  66           {
  67             if (isBAR)
  68               {
  69                 set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
  70                 cpu.iefpFinalAddress = get_BAR_address (cpup, address);
  71                 fauxDoAppendCycle (cpup, cyctyp);
  72 # if defined(LOCKLESS)
  73                 if (cyctyp == OPERAND_RMW || cyctyp == APU_DATA_RMW)
  74                   cache_read_lock (cpup, cpu.iefpFinalAddress, result, __func__);
  75                 else
  76                   cache_read (cpup, cpu.iefpFinalAddress, result, __func__);
  77 # else
  78                 cache_read (cpup, cpu.iefpFinalAddress, result, __func__);
  79 # endif
  80                 sim_debug (DBG_FINAL, & cpu_dev,
  81                            "Read (Actual) Read:       bar address=%08o  "
  82                            "readData=%012"PRIo64"\r\n", address, *result);
  83 # if defined(TESTING)
  84                 HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "Read ABS BAR");
  85                 HDBGMRead (cpu.iefpFinalAddress, * result, "Read ABS BAR");
  86 # endif
  87                 return;
  88               }
  89             else
  90               {
  91                 set_apu_status (cpup, apuStatus_FABS);
  92                 fauxDoAppendCycle (cpup, cyctyp);
  93 # if defined(LOCKLESS)
  94                 if (cyctyp == OPERAND_RMW || cyctyp == APU_DATA_RMW)
  95                   cache_read_lock (cpup, address, result, __func__);
  96                 else
  97                   cache_read (cpup, address, result, __func__);
  98 # else
  99                 cache_read (cpup, address, result, __func__);
 100 # endif
 101                 sim_debug (DBG_FINAL, & cpu_dev,
 102                            "Read (Actual) Read:       abs address=%08o  "
 103                            "readData=%012"PRIo64"\r\n", address, *result);
 104 # if defined(TESTING)
 105                 HDBGIEFP (hdbgIEFP_abs_read, 0, address, "Read ABS");
 106                 HDBGMRead (address, * result, "Read ABS");
 107 # endif
 108                 return;
 109               }
 110           }
 111 
 112         case APPEND_mode:
 113           {
 114 B29:;
 115             if (isBAR)
 116               {
 117                 cpu.TPR.CA = get_BAR_address (address);
 118                 cpu.TPR.TSR = cpu.PPR.PSR;
 119                 cpu.TPR.TRR = cpu.PPR.PRR;
 120                 cpu.iefpFinalAddress = do_append_cycle (cpup, cyctyp, result, 1);
 121                 sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 122                            "Read (Actual) Read:  bar iefpFinalAddress=%08o  "
 123                            "readData=%012"PRIo64"\r\n",
 124                            cpu.iefpFinalAddress, * result);
 125 # if defined(TESTING)
 126                 HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read BAR");
 127                 HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read BAR");
 128 # endif
 129 
 130                 return;
 131               }
 132             else
 133               {
 134                 cpu.iefpFinalAddress = do_append_cycle (cpup, cyctyp, result, 1);
 135                 // XXX Don't trace Multics idle loop
 136                 if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307)
 137                   {
 138                     sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 139                                "Read (Actual) Read:  iefpFinalAddress=%08o  "
 140                                "readData=%012"PRIo64"\r\n",
 141                                cpu.iefpFinalAddress, * result);
 142 # if defined(TESTING)
 143                     HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read");
 144                     HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read");
 145 # endif
 146                   }
 147               }
 148             return;
 149           }
 150       }
 151     return ;//SCPE_UNK;
 152   }
 153 #endif // OLDAPP
 154 
 155 #if !defined(OLDAPP)
 156 void ReadAPUDataRead (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 157   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 158   bool isBAR = get_bar_mode (cpup);
 159 
 160   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 161     goto B29;
 162 
 163   switch (get_addr_mode (cpup)) {
 164     case ABSOLUTE_mode: {
 165       if (isBAR) {
 166         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 167         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 168         fauxDoAppendCycle (cpup, APU_DATA_READ);
 169         cache_read (cpup, cpu.iefpFinalAddress, result, __func__);
 170         sim_debug (DBG_FINAL, & cpu_dev,
 171                    "ReadAPUDataRead (Actual) Read:       bar address=%08o  readData=%012"PRIo64"\r\n",
 172                    address, *result);
 173 # if defined(TESTING)
 174         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "ReadAPUDataRead ABS BAR");
 175         HDBGMRead (cpu.iefpFinalAddress, * result, "ReadAPUDataRead ABS BAR");
 176 # endif
 177         return;
 178       } else {
 179         set_apu_status (cpup, apuStatus_FABS);
 180         fauxDoAppendCycle (cpup, APU_DATA_READ);
 181         cache_read (cpup, address, result, __func__);
 182         sim_debug (DBG_FINAL, & cpu_dev,
 183                    "ReadAPUDataRead (Actual) Read:       abs address=%08o  readData=%012"PRIo64"\r\n",
 184                    address, *result);
 185 # if defined(TESTING)
 186         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "ReadAPUDataRead ABS");
 187         HDBGMRead (address, * result, "ReadAPUDataRead ABS");
 188 # endif
 189         return;
 190       }
 191     }
 192 
 193     case APPEND_mode: {
 194 B29:;
 195       if (isBAR) {
 196         cpu.TPR.CA = get_BAR_address (cpup, address);
 197         cpu.TPR.TSR = cpu.PPR.PSR;
 198         cpu.TPR.TRR = cpu.PPR.PRR;
 199         cpu.iefpFinalAddress = doAppendCycleAPUDataRead (cpup, result, 1);
 200         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 201                    "ReadAPUDataRead (Actual) Read:  bar iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 202                    cpu.iefpFinalAddress, * result);
 203 # if defined(TESTING)
 204         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "ReadAPUDataRead BAR");
 205         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadAPUDataRead BAR");
 206 # endif
 207         return;
 208       } else {
 209         cpu.iefpFinalAddress = doAppendCycleAPUDataRead (cpup, result, 1);
 210         // XXX Don't trace Multics idle loop
 211         if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307) {
 212           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 213                      "ReadAPUDataRead (Actual) Read:  iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 214                      cpu.iefpFinalAddress, * result);
 215 # if defined(TESTING)
 216           HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "ReadAPUDataRead");
 217           HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadAPUDataRead");
 218 # endif
 219         }
 220         return;
 221       }
 222     }
 223   }
 224 }
 225 
 226 void ReadOperandRead (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 227   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 228   bool isBAR = get_bar_mode (cpup);
 229 
 230   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 231     goto B29;
 232 
 233   switch (get_addr_mode (cpup)) {
 234     case ABSOLUTE_mode: {
 235       if (isBAR) {
 236         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 237         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 238         fauxDoAppendCycle (cpup, OPERAND_READ);
 239         cache_read (cpup, cpu.iefpFinalAddress, result, __func__);
 240         sim_debug (DBG_FINAL, & cpu_dev,
 241                    "readOperandRead (Actual) Read:       bar address=%08o  readData=%012"PRIo64"\r\n",
 242                    address, *result);
 243 # if defined(TESTING)
 244         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "readOperandRead ABS BAR");
 245         HDBGMRead (cpu.iefpFinalAddress, * result, "readOperandRead ABS BAR");
 246 # endif
 247         return;
 248       } else {
 249         set_apu_status (cpup, apuStatus_FABS);
 250         fauxDoAppendCycle (cpup, OPERAND_READ);
 251         cache_read (cpup, address, result, __func__);
 252         sim_debug (DBG_FINAL, & cpu_dev,
 253                    "readOperandRead (Actual) Read:       abs address=%08o  readData=%012"PRIo64"\r\n",
 254                    address, *result);
 255 # if defined(TESTING)
 256         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "readOperandRead ABS");
 257         HDBGMRead (address, * result, "readOperandRead ABS");
 258 # endif
 259         return;
 260       }
 261     }
 262 
 263     case APPEND_mode: {
 264 B29:;
 265       if (isBAR) {
 266         cpu.TPR.CA = get_BAR_address (cpup, address);
 267         cpu.TPR.TSR = cpu.PPR.PSR;
 268         cpu.TPR.TRR = cpu.PPR.PRR;
 269         cpu.iefpFinalAddress = doAppendCycleOperandRead (cpup, result, 1);
 270         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 271                    "readOperandRead (Actual) Read:  bar iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 272                    cpu.iefpFinalAddress, * result);
 273 # if defined(TESTING)
 274         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "readOperandRead BAR");
 275         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "readOperandRead BAR");
 276 # endif
 277 
 278         return;
 279       } else {
 280         cpu.iefpFinalAddress = doAppendCycleOperandRead (cpup, result, 1);
 281         // XXX Don't trace Multics idle loop
 282         if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307) {
 283           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 284                      "readOperandRead (Actual) Read:  iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 285                      cpu.iefpFinalAddress, * result);
 286 # if defined(TESTING)
 287           HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "readOperandRead");
 288           HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "readOperandRead");
 289 # endif
 290         }
 291         return;
 292       }
 293     }
 294   }
 295 }
 296 
 297 # if defined(LOCKLESS)
 298 void ReadOperandRMW (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 299   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 300   bool isBAR = get_bar_mode (cpup);
 301 
 302   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 303     goto B29;
 304 
 305   switch (get_addr_mode (cpup)) {
 306     case ABSOLUTE_mode: {
 307       if (isBAR) {
 308         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 309         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 310         fauxDoAppendCycle (cpup, OPERAND_RMW);
 311         cache_read_lock (cpup, cpu.iefpFinalAddress, result, __func__);
 312         sim_debug (DBG_FINAL, & cpu_dev,
 313                    "ReadOperandRMW (Actual) Read:       bar address=%08o  readData=%012"PRIo64"\r\n",
 314                    address, *result);
 315 #  if defined(TESTING)
 316         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "ReadOperandRMW ABS BAR");
 317         HDBGMRead (cpu.iefpFinalAddress, * result, "ReadOperandRMW ABS BAR");
 318 #  endif
 319         return;
 320       } else {
 321         set_apu_status (cpup, apuStatus_FABS);
 322         fauxDoAppendCycle (cpup, OPERAND_RMW);
 323         cache_read_lock (cpup, address, result, __func__);
 324         sim_debug (DBG_FINAL, & cpu_dev,
 325                    "ReadOperandRMW (Actual) Read:       abs address=%08o  readData=%012"PRIo64"\r\n",
 326                    address, *result);
 327 #  if defined(TESTING)
 328         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "ReadOperandRMW ABS");
 329         HDBGMRead (address, * result, "ReadOperandRMW ABS");
 330 #  endif
 331         return;
 332       }
 333     }
 334 
 335     case APPEND_mode: {
 336 B29:;
 337       if (isBAR) {
 338         cpu.TPR.CA = get_BAR_address (cpup, address);
 339         cpu.TPR.TSR = cpu.PPR.PSR;
 340         cpu.TPR.TRR = cpu.PPR.PRR;
 341         cpu.iefpFinalAddress = doAppendCycleOperandRMW (cpup, result, 1);
 342         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 343                    "ReadOperandRMW (Actual) Read:  bar iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 344                    cpu.iefpFinalAddress, * result);
 345 #  if defined(TESTING)
 346         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "ReadOperandRMW BAR");
 347         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadOperandRMW BAR");
 348 #  endif
 349         return;
 350       } else {
 351         cpu.iefpFinalAddress = doAppendCycleOperandRMW (cpup, result, 1);
 352         // XXX Don't trace Multics idle loop
 353         if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307) {
 354           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 355                      "ReadOperandRMW (Actual) Read:  iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 356                      cpu.iefpFinalAddress, * result);
 357 #  if defined(TESTING)
 358           HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "ReadOperandRMW");
 359           HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadOperandRMW");
 360 #  endif
 361         }
 362         return;
 363       }
 364     }
 365   }
 366 }
 367 
 368 void ReadAPUDataRMW (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 369   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 370   bool isBAR = get_bar_mode (cpup);
 371 
 372   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 373     goto B29;
 374 
 375   switch (get_addr_mode (cpup)) {
 376     case ABSOLUTE_mode: {
 377       if (isBAR) {
 378         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 379         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 380         fauxDoAppendCycle (cpup, APU_DATA_RMW);
 381         cache_read_lock (cpup, cpu.iefpFinalAddress, result, __func__);
 382         sim_debug (DBG_FINAL, & cpu_dev,
 383                    "ReadAPUDataRMW (Actual) Read:       bar address=%08o  readData=%012"PRIo64"\r\n",
 384                    address, *result);
 385 #  if defined(TESTING)
 386         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "ReadAPUDataRMW ABS BAR");
 387         HDBGMRead (cpu.iefpFinalAddress, * result, "ReadAPUDataRMW ABS BAR");
 388 #  endif
 389         return;
 390       } else {
 391         set_apu_status (cpup, apuStatus_FABS);
 392         fauxDoAppendCycle (cpup, APU_DATA_RMW);
 393         cache_read_lock (cpup, address, result, __func__);
 394         sim_debug (DBG_FINAL, & cpu_dev,
 395                    "ReadAPUDataRMW (Actual) Read:       abs address=%08o  readData=%012"PRIo64"\r\n",
 396                    address, *result);
 397 #  if defined(TESTING)
 398         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "ReadAPUDataRMW ABS");
 399         HDBGMRead (address, * result, "ReadAPUDataRMW ABS");
 400 #  endif
 401         return;
 402       }
 403     }
 404 
 405     case APPEND_mode: {
 406 B29:;
 407       if (isBAR) {
 408         cpu.TPR.CA = get_BAR_address (cpup, address);
 409         cpu.TPR.TSR = cpu.PPR.PSR;
 410         cpu.TPR.TRR = cpu.PPR.PRR;
 411         cpu.iefpFinalAddress = doAppendCycleAPUDataRMW (cpup, result, 1);
 412         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 413                    "ReadAPUDataRMW (Actual) Read:  bar iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 414                    cpu.iefpFinalAddress, * result);
 415 #  if defined(TESTING)
 416         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "ReadAPUDataRMW BAR");
 417         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadAPUDataRMW BAR");
 418 #  endif
 419         return;
 420       } else {
 421         cpu.iefpFinalAddress = doAppendCycleAPUDataRMW (cpup, result, 1);
 422         // XXX Don't trace Multics idle loop
 423         if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307) {
 424           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 425                      "ReadAPUDataRMW (Actual) Read:  iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 426                      cpu.iefpFinalAddress, * result);
 427 #  if defined(TESTING)
 428           HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "ReadAPUDataRMW");
 429           HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadAPUDataRMW");
 430 #  endif
 431         }
 432         return;
 433       }
 434     }
 435   }
 436   return ;//SCPE_UNK;
 437 }
 438 # endif
 439 
 440 void ReadInstructionFetch (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 441   cpu.cacheFetch = true; // the cache read below is an instruction fetch
 442   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 443   bool isBAR = get_bar_mode (cpup);
 444 
 445   if (cpu.cu.XSF)
 446     goto B29;
 447 
 448   switch (get_addr_mode (cpup)) {
 449     case ABSOLUTE_mode: {
 450       if (isBAR) {
 451         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 452         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 453         fauxDoAppendCycle (cpup, INSTRUCTION_FETCH);
 454         cache_read (cpup, cpu.iefpFinalAddress, result, __func__);
 455         sim_debug (DBG_FINAL, & cpu_dev,
 456                    "ReadInstructionFetch (Actual) Read:       bar address=%08o  readData=%012"PRIo64"\r\n",
 457                    address, *result);
 458 # if defined(TESTING)
 459         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "ReadInstructionFetch ABS BAR");
 460         HDBGMRead (cpu.iefpFinalAddress, * result, "ReadInstructionFetch ABS BAR");
 461 # endif
 462         return;
 463       } else {
 464         set_apu_status (cpup, apuStatus_FABS);
 465         fauxDoAppendCycle (cpup, INSTRUCTION_FETCH);
 466         cache_read (cpup, address, result, __func__);
 467         sim_debug (DBG_FINAL, & cpu_dev,
 468                    "ReadInstructionFetch (Actual) Read:       abs address=%08o  readData=%012"PRIo64"\r\n",
 469                    address, *result);
 470 # if defined(TESTING)
 471         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "ReadInstructionFetch ABS");
 472         HDBGMRead (address, * result, "ReadInstructionFetch ABS");
 473 # endif
 474         return;
 475       }
 476     }
 477 
 478     case APPEND_mode: {
 479 B29:;
 480       if (isBAR) {
 481         cpu.TPR.CA = get_BAR_address (cpup, address);
 482         cpu.TPR.TSR = cpu.PPR.PSR;
 483         cpu.TPR.TRR = cpu.PPR.PRR;
 484         cpu.iefpFinalAddress = doAppendCycleInstructionFetch (cpup, result, 1);
 485         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 486                    "ReadInstructionFetch (Actual) Read:  bar iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 487                    cpu.iefpFinalAddress, * result);
 488 # if defined(TESTING)
 489         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "ReadInstructionFetch BAR");
 490         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadInstructionFetch BAR");
 491 # endif
 492         return;
 493       } else {
 494         cpu.iefpFinalAddress = doAppendCycleInstructionFetch (cpup, result, 1);
 495         // XXX Don't trace Multics idle loop
 496         if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307) {
 497           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 498                      "ReadInstructionFetch (Actual) Read:  iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 499                      cpu.iefpFinalAddress, * result);
 500 # if defined(TESTING)
 501           HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "ReadInstructionFetch");
 502           HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadInstructionFetch");
 503 # endif
 504         }
 505         return;
 506       }
 507     }
 508   }
 509 }
 510 
 511 void ReadIndirectWordFetch (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 512   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 513   bool isBAR = get_bar_mode (cpup);
 514 
 515   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 516     goto B29;
 517 
 518   switch (get_addr_mode (cpup)) {
 519     case ABSOLUTE_mode: {
 520       if (isBAR) {
 521         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 522         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 523         fauxDoAppendCycle (cpup, INDIRECT_WORD_FETCH);
 524         cache_read (cpup, cpu.iefpFinalAddress, result, __func__);
 525         sim_debug (DBG_FINAL, & cpu_dev,
 526                    "ReadIndirectWordFetch (Actual) Read:       bar address=%08o  readData=%012"PRIo64"\r\n",
 527                    address, *result);
 528 # if defined(TESTING)
 529         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "ReadIndirectWordFetch ABS BAR");
 530         HDBGMRead (cpu.iefpFinalAddress, * result, "ReadIndirectWordFetch ABS BAR");
 531 # endif
 532         return;
 533       } else {
 534         set_apu_status (cpup, apuStatus_FABS);
 535         fauxDoAppendCycle (cpup, INDIRECT_WORD_FETCH);
 536         cache_read (cpup, address, result, __func__);
 537         sim_debug (DBG_FINAL, & cpu_dev,
 538                    "ReadIndirectWordFetch (Actual) Read:       abs address=%08o  readData=%012"PRIo64"\r\n",
 539                    address, *result);
 540 # if defined(TESTING)
 541         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "ReadIndirectWordFetch ABS");
 542         HDBGMRead (address, * result, "ReadIndirectWordFetch ABS");
 543 # endif
 544         return;
 545       }
 546   }
 547 
 548   case APPEND_mode: {
 549 B29:;
 550       if (isBAR) {
 551         cpu.TPR.CA = get_BAR_address (cpup, address);
 552         cpu.TPR.TSR = cpu.PPR.PSR;
 553         cpu.TPR.TRR = cpu.PPR.PRR;
 554         cpu.iefpFinalAddress = doAppendCycleIndirectWordFetch (cpup, result, 1);
 555         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 556                    "ReadIndirectWordFetch (Actual) Read:  bar iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 557                    cpu.iefpFinalAddress, * result);
 558 # if defined(TESTING)
 559         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "ReadIndirectWordFetch BAR");
 560         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadIndirectWordFetch BAR");
 561 # endif
 562         return;
 563       } else {
 564         cpu.iefpFinalAddress = doAppendCycleIndirectWordFetch (cpup, result, 1);
 565         // XXX Don't trace Multics idle loop
 566         if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307) {
 567           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 568                      "ReadIndirectWordFetch (Actual) Read:  iefpFinalAddress=%08o  readData=%012"PRIo64"\r\n",
 569                      cpu.iefpFinalAddress, * result);
 570 # if defined(TESTING)
 571             HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "ReadIndirectWordFetch");
 572             HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "ReadIndirectWordFetch");
 573 # endif
 574           }
 575           return;
 576         }
 577     }
 578   }
 579 }
 580 #endif // !OLDAPP
 581 
 582 #if defined(OLDAPP)
 583 void Read2 (cpu_state_t * cpup, word18 address, word36 * result, processor_cycle_type cyctyp) {
     /* [previous][next][first][last][top][bottom][index][help] */
 584   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 585 
 586   bool isBAR = get_bar_mode (cpup);
 587 
 588   if (cpu.cu.XSF || (cyctyp != INSTRUCTION_FETCH && cpu.currentInstruction.b29) || cyctyp == RTCD_OPERAND_FETCH) // ISOLTS-886
 589          // Another option would be to set_went_appending in ReadRTCDOp
 590     goto B29;
 591 
 592   switch (get_addr_mode (cpup)) {
 593     case ABSOLUTE_mode: {
 594       if (isBAR) {
 595         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 596         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 597 
 598         fauxDoAppendCycle (cpup, cyctyp);
 599         cache_read2 (cpup, cpu.iefpFinalAddress, result + 0, result + 1, __func__);
 600         if_sim_debug (DBG_FINAL, & cpu_dev) {
 601             for (uint i = 0; i < 2; i ++)
 602               sim_debug (DBG_FINAL, & cpu_dev,
 603                          "Read2 (Actual) Read:       bar address=%08o" "  readData=%012"PRIo64"\r\n",
 604                          address + i, result [i]);
 605         }
 606 # if defined(TESTING)
 607         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "Read2 ABBR");
 608         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2 ABBR evn");
 609         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2 ABBR odd");
 610 # endif
 611         return;
 612       } else {
 613         set_apu_status (cpup, apuStatus_FABS);
 614         fauxDoAppendCycle (cpup, cyctyp);
 615         cache_read2 (cpup, address, result + 0, result + 1, __func__);
 616         if_sim_debug (DBG_FINAL, & cpu_dev) {
 617           for (uint i = 0; i < 2; i ++)
 618             sim_debug (DBG_FINAL, & cpu_dev,
 619                        "Read2 (Actual) Read:       abs address=%08o" "  readData=%012"PRIo64"\r\n",
 620                        address + i, result [i]);
 621         }
 622 # if defined(TESTING)
 623         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "Read2 AB");
 624         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2 AB evn");
 625         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2 AB odd");
 626 # endif
 627         return;
 628       }
 629     }
 630 
 631     case APPEND_mode: {
 632 B29:;
 633       if (isBAR) {
 634         cpu.TPR.CA = get_BAR_address (cpup, address);
 635         cpu.TPR.TSR = cpu.PPR.PSR;
 636         cpu.TPR.TRR = cpu.PPR.PRR;
 637         cpu.iefpFinalAddress = do_append_cycle (cpup, cyctyp, result, 2);
 638         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 639           for (uint i = 0; i < 2; i ++)
 640            sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 641                       "Read2 (Actual) Read:  bar iefpFinalAddress=" "%08o  readData=%012"PRIo64"\r\n",
 642                       cpu.iefpFinalAddress + i, result [i]);
 643         }
 644 # if defined(TESTING)
 645         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read2 BR");
 646         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2 BR evn");
 647         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2 BR odd");
 648 # endif
 649         return;
 650       } else {
 651         cpu.iefpFinalAddress = do_append_cycle (cpup, cyctyp, result, 2);
 652         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 653           for (uint i = 0; i < 2; i ++)
 654             sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 655                        "Read2 (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
 656                        cpu.iefpFinalAddress + i, result [i]);
 657         }
 658         if_sim_debug (DBG_FINAL, & cpu_dev) {
 659           if (cyctyp == OPERAND_READ) {
 660             for (uint i = 0; i < 2; i ++)
 661               sim_debug (DBG_FINAL, & cpu_dev,
 662                          "Read2 (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
 663                          cpu.iefpFinalAddress + i, result [i]);
 664           }
 665         }
 666 # if defined(TESTING)
 667         HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read2");
 668         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2 evn");
 669         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2 odd");
 670 # endif
 671       }
 672       return;
 673     }
 674   }
 675 }
 676 #endif // OLDAPP
 677 
 678 #if !defined(OLDAPP)
 679 void Read2OperandRead (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 680   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 681 
 682   bool isBAR = get_bar_mode (cpup);
 683 
 684   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 685     goto B29;
 686 
 687   switch (get_addr_mode (cpup)) {
 688     case ABSOLUTE_mode: {
 689       if (isBAR) {
 690         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 691         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 692 
 693         fauxDoAppendCycle (cpup, OPERAND_READ);
 694         cache_read2 (cpup, cpu.iefpFinalAddress, result + 0, result + 1, __func__);
 695         if_sim_debug (DBG_FINAL, & cpu_dev) {
 696             for (uint i = 0; i < 2; i ++)
 697               sim_debug (DBG_FINAL, & cpu_dev,
 698                          "Read2OperandRead (Actual) Read:       bar address=%08o" "  readData=%012"PRIo64"\r\n",
 699                          address + i, result [i]);
 700         }
 701 # if defined(TESTING)
 702         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "Read2OperandRead ABBR");
 703         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2OperandRead ABBR evn");
 704         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2OperandRead ABBR odd");
 705 # endif
 706         return;
 707       } else {
 708         set_apu_status (cpup, apuStatus_FABS);
 709         fauxDoAppendCycle (cpup, OPERAND_READ);
 710         cache_read2 (cpup, address, result + 0, result + 1, __func__);
 711         if_sim_debug (DBG_FINAL, & cpu_dev) {
 712           for (uint i = 0; i < 2; i ++)
 713             sim_debug (DBG_FINAL, & cpu_dev,
 714                        "Read2OperandRead (Actual) Read:       abs address=%08o" "  readData=%012"PRIo64"\r\n",
 715                        address + i, result [i]);
 716         }
 717 # if defined(TESTING)
 718         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "Read2OperandRead AB");
 719         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2OperandRead AB evn");
 720         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2OperandRead AB odd");
 721 # endif
 722         return;
 723       }
 724     }
 725 
 726     case APPEND_mode: {
 727 B29:;
 728       if (isBAR) {
 729         cpu.TPR.CA = get_BAR_address (cpup, address);
 730         cpu.TPR.TSR = cpu.PPR.PSR;
 731         cpu.TPR.TRR = cpu.PPR.PRR;
 732         cpu.iefpFinalAddress = doAppendCycleOperandRead (cpup, result, 2);
 733         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 734           for (uint i = 0; i < 2; i ++)
 735            sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 736                       "Read2OperandRead (Actual) Read:  bar iefpFinalAddress=" "%08o  readData=%012"PRIo64"\r\n",
 737                       cpu.iefpFinalAddress + i, result [i]);
 738         }
 739 # if defined(TESTING)
 740         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read2OperandRead BR");
 741         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2OperandRead BR evn");
 742         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2OperandRead BR odd");
 743 # endif
 744         return;
 745       } else {
 746         cpu.iefpFinalAddress = doAppendCycleOperandRead (cpup, result, 2);
 747         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 748           for (uint i = 0; i < 2; i ++)
 749             sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 750                        "Read2OperandRead (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
 751                        cpu.iefpFinalAddress + i, result [i]);
 752         }
 753         if_sim_debug (DBG_FINAL, & cpu_dev) {
 754           for (uint i = 0; i < 2; i ++)
 755             sim_debug (DBG_FINAL, & cpu_dev,
 756                        "Read2OperandRead (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
 757                        cpu.iefpFinalAddress + i, result [i]);
 758         }
 759 # if defined(TESTING)
 760         HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read2OperandRead");
 761         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2OperandRead evn");
 762         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2OperandRead odd");
 763 # endif
 764         return;
 765       }
 766     }
 767   }
 768 }
 769 
 770 # if defined(LOCKLESS)
 771 void Read2OperandRMW (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 772   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 773 
 774   bool isBAR = get_bar_mode (cpup);
 775 
 776   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 777     goto B29;
 778 
 779   switch (get_addr_mode (cpup)) {
 780     case ABSOLUTE_mode: {
 781       if (isBAR) {
 782         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 783         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 784 
 785         fauxDoAppendCycle (cpup, OPERAND_RMW);
 786         cache_read2 (cpup, cpu.iefpFinalAddress, result + 0, result + 1, __func__);
 787         if_sim_debug (DBG_FINAL, & cpu_dev) {
 788             for (uint i = 0; i < 2; i ++)
 789               sim_debug (DBG_FINAL, & cpu_dev,
 790                          "Read2OperandRMW (Actual) Read:       bar address=%08o" "  readData=%012"PRIo64"\r\n",
 791                          address + i, result [i]);
 792         }
 793 #  if defined(TESTING)
 794         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "Read2OperandRMW ABBR");
 795         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2OperandRMW ABBR evn");
 796         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2OperandRMW ABBR odd");
 797 #  endif
 798         return;
 799       } else {
 800         set_apu_status (cpup, apuStatus_FABS);
 801         fauxDoAppendCycle (cpup, OPERAND_RMW);
 802         cache_read2 (cpup, address, result + 0, result + 1, __func__);
 803         if_sim_debug (DBG_FINAL, & cpu_dev) {
 804           for (uint i = 0; i < 2; i ++)
 805             sim_debug (DBG_FINAL, & cpu_dev,
 806                        "Read2OperandRMW (Actual) Read:       abs address=%08o" "  readData=%012"PRIo64"\r\n",
 807                        address + i, result [i]);
 808         }
 809 #  if defined(TESTING)
 810         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "Read2OperandRMW AB");
 811         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2OperandRMW AB evn");
 812         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2OperandRMW AB odd");
 813 #  endif
 814         return;
 815       }
 816     }
 817 
 818     case APPEND_mode: {
 819 B29:;
 820       if (isBAR) {
 821         cpu.TPR.CA = get_BAR_address (cpup, address);
 822         cpu.TPR.TSR = cpu.PPR.PSR;
 823         cpu.TPR.TRR = cpu.PPR.PRR;
 824         cpu.iefpFinalAddress = doAppendCycleOperandRMW (cpup, result, 2);
 825         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 826           for (uint i = 0; i < 2; i ++)
 827            sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 828                       "Read2OperandRMW (Actual) Read:  bar iefpFinalAddress=" "%08o  readData=%012"PRIo64"\r\n",
 829                       cpu.iefpFinalAddress + i, result [i]);
 830         }
 831 #  if defined(TESTING)
 832         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read2OperandRMW BR");
 833         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2OperandRMW BR evn");
 834         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2OperandRMW BR odd");
 835 #  endif
 836         return;
 837       } else {
 838         cpu.iefpFinalAddress = doAppendCycleOperandRMW (cpup, result, 2);
 839         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 840           for (uint i = 0; i < 2; i ++)
 841             sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 842                        "Read2OperandRMW (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
 843                        cpu.iefpFinalAddress + i, result [i]);
 844         }
 845 #  if defined(TESTING)
 846         HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read2OperandRMW");
 847         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2OperandRMW evn");
 848         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2OperandRMW odd");
 849 #  endif
 850         return;
 851       }
 852     }
 853   }
 854 }
 855 # endif
 856 
 857 void Read2InstructionFetch (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 858   cpu.cacheFetch = true; // the cache read below is an instruction fetch
 859   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 860 
 861   bool isBAR = get_bar_mode (cpup);
 862 
 863   if (cpu.cu.XSF)
 864     goto B29;
 865 
 866   switch (get_addr_mode (cpup)) {
 867     case ABSOLUTE_mode: {
 868       if (isBAR) {
 869         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 870         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 871 
 872         fauxDoAppendCycle (cpup, INSTRUCTION_FETCH);
 873         cache_read2 (cpup, cpu.iefpFinalAddress, result + 0, result + 1, __func__);
 874         if_sim_debug (DBG_FINAL, & cpu_dev) {
 875             for (uint i = 0; i < 2; i ++)
 876               sim_debug (DBG_FINAL, & cpu_dev,
 877                          "Read2InstructionFetch (Actual) Read:       bar address=%08o" "  readData=%012"PRIo64"\r\n",
 878                          address + i, result [i]);
 879         }
 880 # if defined(TESTING)
 881         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "Read2InstructionFetch ABBR");
 882         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2InstructionFetch ABBR evn");
 883         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2InstructionFetch ABBR odd");
 884 # endif
 885         return;
 886       } else {
 887         set_apu_status (cpup, apuStatus_FABS);
 888         fauxDoAppendCycle (cpup, INSTRUCTION_FETCH);
 889         cache_read2 (cpup, address, result + 0, result + 1, __func__);
 890         if_sim_debug (DBG_FINAL, & cpu_dev) {
 891           for (uint i = 0; i < 2; i ++)
 892             sim_debug (DBG_FINAL, & cpu_dev,
 893                        "Read2InstructionFetch (Actual) Read:       abs address=%08o" "  readData=%012"PRIo64"\r\n",
 894                        address + i, result [i]);
 895         }
 896 # if defined(TESTING)
 897         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "Read2InstructionFetch AB");
 898         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2InstructionFetch AB evn");
 899         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2InstructionFetch AB odd");
 900 # endif
 901         return;
 902       }
 903     }
 904 
 905     case APPEND_mode: {
 906 B29:;
 907       if (isBAR) {
 908         cpu.TPR.CA = get_BAR_address (cpup, address);
 909         cpu.TPR.TSR = cpu.PPR.PSR;
 910         cpu.TPR.TRR = cpu.PPR.PRR;
 911         cpu.iefpFinalAddress = doAppendCycleInstructionFetch (cpup, result, 2);
 912         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 913           for (uint i = 0; i < 2; i ++)
 914            sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 915                       "Read2InstructionFetch (Actual) Read:  bar iefpFinalAddress=" "%08o  readData=%012"PRIo64"\r\n",
 916                       cpu.iefpFinalAddress + i, result [i]);
 917         }
 918 # if defined(TESTING)
 919         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read2InstructionFetch BR");
 920         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2InstructionFetch BR evn");
 921         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2InstructionFetch BR odd");
 922 # endif
 923         return;
 924       } else {
 925         cpu.iefpFinalAddress = doAppendCycleInstructionFetch (cpup, result, 2);
 926         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 927           for (uint i = 0; i < 2; i ++)
 928             sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 929                        "Read2InstructionFetch (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
 930                        cpu.iefpFinalAddress + i, result [i]);
 931         }
 932 # if defined(TESTING)
 933         HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read2InstructionFetch");
 934         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2InstructionFetch evn");
 935         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2InstructionFetch odd");
 936 # endif
 937         return;
 938       }
 939     }
 940   }
 941 }
 942 
 943 void Read2RTCDOperandFetch (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 944   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 945 
 946   bool isBAR = get_bar_mode (cpup);
 947 
 948   if (isBAR) {
 949     cpu.TPR.CA = get_BAR_address (cpup, address);
 950     cpu.TPR.TSR = cpu.PPR.PSR;
 951     cpu.TPR.TRR = cpu.PPR.PRR;
 952     cpu.iefpFinalAddress = doAppendCycleRTCDOperandFetch (cpup, result, 2);
 953     if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 954       for (uint i = 0; i < 2; i ++)
 955        sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 956                   "Read2 (Actual) Read:  bar iefpFinalAddress=" "%08o  readData=%012"PRIo64"\r\n",
 957                   cpu.iefpFinalAddress + i, result [i]);
 958     }
 959 # if defined(TESTING)
 960     HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read2 BR");
 961     HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2 BR evn");
 962     HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2 BR odd");
 963 # endif
 964     return;
 965   } else {
 966     cpu.iefpFinalAddress = doAppendCycleRTCDOperandFetch (cpup, result, 2);
 967     if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
 968       for (uint i = 0; i < 2; i ++)
 969         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
 970                    "Read2 (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
 971                    cpu.iefpFinalAddress + i, result [i]);
 972     }
 973 # if defined(TESTING)
 974     HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read2");
 975     HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2 evn");
 976     HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2 odd");
 977 # endif
 978     return;
 979   }
 980 }
 981 
 982 void Read2IndirectWordFetch (cpu_state_t * cpup, word18 address, word36 * result) {
     /* [previous][next][first][last][top][bottom][index][help] */
 983   cpu.TPR.CA = cpu.iefpFinalAddress = address;
 984 
 985   bool isBAR = get_bar_mode (cpup);
 986 
 987   if (cpu.cu.XSF || cpu.currentInstruction.b29)
 988     goto B29;
 989 
 990   switch (get_addr_mode (cpup)) {
 991     case ABSOLUTE_mode: {
 992       if (isBAR) {
 993         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
 994         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
 995 
 996         fauxDoAppendCycle (cpup, INDIRECT_WORD_FETCH);
 997         cache_read2 (cpup, cpu.iefpFinalAddress, result + 0, result + 1, __func__);
 998         if_sim_debug (DBG_FINAL, & cpu_dev) {
 999             for (uint i = 0; i < 2; i ++)
1000               sim_debug (DBG_FINAL, & cpu_dev,
1001                          "Read2IndirectWordFetch (Actual) Read:       bar address=%08o" "  readData=%012"PRIo64"\r\n",
1002                          address + i, result [i]);
1003         }
1004 # if defined(TESTING)
1005         HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "Read2IndirectWordFetch ABBR");
1006         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2IndirectWordFetch ABBR evn");
1007         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2IndirectWordFetch ABBR odd");
1008 # endif
1009         return;
1010       } else {
1011         set_apu_status (cpup, apuStatus_FABS);
1012         fauxDoAppendCycle (cpup, INDIRECT_WORD_FETCH);
1013         cache_read2 (cpup, address, result + 0, result + 1, __func__);
1014         if_sim_debug (DBG_FINAL, & cpu_dev) {
1015           for (uint i = 0; i < 2; i ++)
1016             sim_debug (DBG_FINAL, & cpu_dev,
1017                        "Read2IndirectWordFetch (Actual) Read:       abs address=%08o" "  readData=%012"PRIo64"\r\n",
1018                        address + i, result [i]);
1019         }
1020 # if defined(TESTING)
1021         HDBGIEFP (hdbgIEFP_abs_read, 0, address, "Read2IndirectWordFetch AB");
1022         HDBGMRead (cpu.iefpFinalAddress, * result, "Read2IndirectWordFetch AB evn");
1023         HDBGMRead (cpu.iefpFinalAddress+1, * (result+1), "Read2IndirectWordFetch AB odd");
1024 # endif
1025         return;
1026       }
1027     }
1028 
1029     case APPEND_mode: {
1030 B29:;
1031       if (isBAR) {
1032         cpu.TPR.CA = get_BAR_address (cpup, address);
1033         cpu.TPR.TSR = cpu.PPR.PSR;
1034         cpu.TPR.TRR = cpu.PPR.PRR;
1035         cpu.iefpFinalAddress = doAppendCycleIndirectWordFetch (cpup, result, 2);
1036         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
1037           for (uint i = 0; i < 2; i ++)
1038            sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1039                       "Read2IndirectWordFetch (Actual) Read:  bar iefpFinalAddress=" "%08o  readData=%012"PRIo64"\r\n",
1040                       cpu.iefpFinalAddress + i, result [i]);
1041         }
1042 # if defined(TESTING)
1043         HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read2IndirectWordFetch BR");
1044         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2IndirectWordFetch BR evn");
1045         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2IndirectWordFetch BR odd");
1046 # endif
1047         return;
1048       } else {
1049         cpu.iefpFinalAddress = doAppendCycleIndirectWordFetch (cpup, result, 2);
1050         if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev) {
1051           for (uint i = 0; i < 2; i ++)
1052             sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1053                        "Read2IndirectWordFetch (Actual) Read:  iefpFinalAddress=%08o" "  readData=%012"PRIo64"\r\n",
1054                        cpu.iefpFinalAddress + i, result [i]);
1055         }
1056 # if defined(TESTING)
1057         HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read2IndirectWordFetch");
1058         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, * result, "Read2IndirectWordFetch evn");
1059         HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, * (result+1), "Read2IndirectWordFetch odd");
1060         return;
1061 # endif
1062       }
1063     }
1064   }
1065 }
1066 #endif // !OLDAPP
1067 
1068 void Read8 (cpu_state_t * cpup, word18 address, word36 * result, bool isAR)
     /* [previous][next][first][last][top][bottom][index][help] */
1069   {
1070     cpu.TPR.CA = cpu.iefpFinalAddress = address;
1071 
1072     bool isBAR = get_bar_mode (cpup);
1073 
1074     if (isAR || cpu.cu.XSF /*get_went_appending ()*/)
1075       {
1076         goto B29;
1077       }
1078 
1079     switch (get_addr_mode (cpup))
1080       {
1081         case ABSOLUTE_mode:
1082           {
1083             if (isBAR)
1084               {
1085                 set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1086                 cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1087 
1088                 fauxDoAppendCycle (cpup, APU_DATA_READ);
1089                 cache_readN (cpup, cpu.iefpFinalAddress, result, 8, __func__);
1090                 if_sim_debug (DBG_FINAL, & cpu_dev)
1091                   {
1092                     for (uint i = 0; i < 8; i ++)
1093                       sim_debug (DBG_FINAL, & cpu_dev,
1094                                  "Read8 (Actual) Read:       bar address=%08o"
1095                                  "  readData=%012"PRIo64"\r\n",
1096                                  address + i, result [i]);
1097                   }
1098 #if defined(TESTING)
1099                 HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "Read8 ABBR");
1100                 for (uint i = 0; i < 8; i ++)
1101                   HDBGMRead (cpu.iefpFinalAddress + i, result [i], "Read8 ABBR");
1102 #endif
1103                 return;
1104               }
1105             else
1106               {
1107                 set_apu_status (cpup, apuStatus_FABS);
1108                 fauxDoAppendCycle (cpup, APU_DATA_READ);
1109                 cache_readN (cpup, address, result, 8, __func__);
1110                 if_sim_debug (DBG_FINAL, & cpu_dev)
1111                   {
1112                     for (uint i = 0; i < 8; i ++)
1113                       sim_debug (DBG_FINAL, & cpu_dev,
1114                                  "Read8 (Actual) Read:       abs address=%08o"
1115                                  "  readData=%012"PRIo64"\r\n",
1116                                  address + i, result [i]);
1117                   }
1118 #if defined(TESTING)
1119                 HDBGIEFP (hdbgIEFP_abs_read, 0, address, "Read8 ABS");
1120                 for (uint i = 0; i < 8; i ++)
1121                   HDBGMRead (address + i, result [i], "Read8 ABS");
1122 #endif
1123                 return;
1124               }
1125           }
1126 
1127         case APPEND_mode:
1128           {
1129 B29:;
1130             if (isBAR)
1131               {
1132                 cpu.TPR.CA = get_BAR_address (cpup, address);
1133                 cpu.TPR.TSR = cpu.PPR.PSR;
1134                 cpu.TPR.TRR = cpu.PPR.PRR;
1135                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_READ, result, 8);
1136                 cpu.iefpFinalAddress = doAppendCycleAPUDataRead (cpup, result, 8);
1137                 if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1138                   {
1139                     for (uint i = 0; i < 8; i ++)
1140                      sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1141                                 "Read8 (Actual) Read:  bar iefpFinalAddress="
1142                                 "%08o  readData=%012"PRIo64"\r\n",
1143                                 cpu.iefpFinalAddress + i, result [i]);
1144                   }
1145 #if defined(TESTING)
1146                 HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "Read8 BAR");
1147                 for (uint i = 0; i < 8; i ++)
1148                   HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, result[i], "Read8 BAR");
1149 #endif
1150                 return;
1151               }
1152             else
1153               {
1154                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_READ, result, 8);
1155                 cpu.iefpFinalAddress = doAppendCycleAPUDataRead (cpup, result, 8);
1156                 // XXX Don't trace Multics idle loop
1157                 if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307)
1158                   {
1159                     if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1160                       {
1161                         for (uint i = 0; i < 8; i ++)
1162                           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1163                                      "Read8 (Actual) Read:  iefpFinalAddress="
1164                                      "%08o  readData=%012"PRIo64"\r\n",
1165                                      cpu.iefpFinalAddress + i, result [i]);
1166                       }
1167 #if defined(TESTING)
1168                     HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "Read8");
1169                     for (uint i = 0; i < 8; i ++)
1170                       HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, result [i], "Read8");
1171 #endif
1172                   }
1173                 return;
1174               }
1175           }
1176       }
1177   }
1178 
1179 void Read16 (cpu_state_t * cpup, word18 address, word36 * result)
     /* [previous][next][first][last][top][bottom][index][help] */
1180   {
1181     address &= paragraphMask; // Round to 8 word boundary
1182     Read8 (cpup, address, result, cpu.currentInstruction.b29);
1183     Read8 (cpup, address + 8, result + 8, cpu.currentInstruction.b29);
1184     return;
1185   }
1186 
1187 void ReadPage (cpu_state_t * cpup, word18 address, word36 * result, bool isAR)
     /* [previous][next][first][last][top][bottom][index][help] */
1188   {
1189     if ((address & PGMK) != 0)
1190       {
1191         sim_warn ("ReadPage not on boundary %06o\r\n", address);
1192       }
1193     address &= (word18) ~PGMK; // Round to page boundary
1194     cpu.TPR.CA = cpu.iefpFinalAddress = address;
1195 
1196     bool isBAR = get_bar_mode (cpup);
1197 
1198     if (isAR || cpu.cu.XSF /*get_went_appending ()*/)
1199       {
1200         goto B29;
1201       }
1202 
1203     switch (get_addr_mode (cpup))
1204       {
1205         case ABSOLUTE_mode:
1206           {
1207             if (isBAR)
1208               {
1209                 set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1210                 cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1211 
1212                 fauxDoAppendCycle (cpup, APU_DATA_READ);
1213                 cache_readN (cpup, cpu.iefpFinalAddress, result, PGSZ, __func__);
1214                 if_sim_debug (DBG_FINAL, & cpu_dev)
1215                   {
1216                     for (uint i = 0; i < PGSZ; i ++)
1217                       sim_debug (DBG_FINAL, & cpu_dev,
1218                                  "ReadPage (Actual) Read:       bar address="
1219                                  "%08o  readData=%012"PRIo64"\r\n",
1220                                   address + i, result [i]);
1221                   }
1222 #if defined(TESTING)
1223                 HDBGIEFP (hdbgIEFP_abs_bar_read, 0, address, "ReadPage AB");
1224                 for (uint i = 0; i < PGSZ; i ++)
1225                   HDBGMRead (cpu.iefpFinalAddress + i, result [i], "ReadPage AB");
1226 #endif
1227                 return;
1228               }
1229             else
1230               {
1231                 set_apu_status (cpup, apuStatus_FABS);
1232                 fauxDoAppendCycle (cpup, APU_DATA_READ);
1233                 cache_readN (cpup, address, result, PGSZ, __func__);
1234                 if_sim_debug (DBG_FINAL, & cpu_dev)
1235                   {
1236                     for (uint i = 0; i < PGSZ; i ++)
1237                       sim_debug (DBG_FINAL, & cpu_dev,
1238                                  "ReadPage (Actual) Read:       abs address="
1239                                  "%08o  readData=%012"PRIo64"\r\n",
1240                                  address + i, result [i]);
1241                   }
1242 #if defined(TESTING)
1243                 HDBGIEFP (hdbgIEFP_abs_read, 0, address, "ReadPage ABS");
1244                 for (uint i = 0; i < PGSZ; i ++)
1245                   HDBGMRead (address + i, result [i], "ReadPage ABS");
1246 #endif
1247                 return;
1248               }
1249           }
1250 
1251         case APPEND_mode:
1252           {
1253 B29:;
1254             if (isBAR)
1255               {
1256                 cpu.TPR.CA = get_BAR_address (cpup, address);
1257                 cpu.TPR.TSR = cpu.PPR.PSR;
1258                 cpu.TPR.TRR = cpu.PPR.PRR;
1259                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_READ, result, PGSZ);
1260                 cpu.iefpFinalAddress = doAppendCycleAPUDataRead (cpup, result, PGSZ);
1261                 if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1262                   {
1263                     for (uint i = 0; i < PGSZ; i ++)
1264                      sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1265                                 "ReadPage (Actual) Read:  bar iefpFinalAddress="
1266                                 "%08o  readData=%012"PRIo64"\r\n",
1267                                 cpu.iefpFinalAddress + i, result [i]);
1268                   }
1269 #if defined(TESTING)
1270                 HDBGIEFP (hdbgIEFP_bar_read, cpu.TPR.TSR, address, "ReadPage B");
1271                 for (uint i = 0; i < PGSZ; i ++)
1272                   HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, result [i], "ReadPage B");
1273 #endif
1274 
1275                 return;
1276               }
1277             else
1278               {
1279                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_READ, result, PGSZ);
1280                 cpu.iefpFinalAddress = doAppendCycleAPUDataRead (cpup, result, PGSZ);
1281                 // XXX Don't trace Multics idle loop
1282                 if (cpu.PPR.PSR != 061 && cpu.PPR.IC != 0307)
1283                   {
1284                     if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1285                       {
1286                         for (uint i = 0; i < PGSZ; i ++)
1287                           sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1288                                      "ReadPage (Actual) Read:  iefpFinalAddress"
1289                                      "=%08o  readData=%012"PRIo64"\r\n",
1290                                      cpu.iefpFinalAddress + i, result [i]);
1291                       }
1292 #if defined(TESTING)
1293                     HDBGIEFP (hdbgIEFP_read, cpu.TPR.TSR, address, "ReadPage");
1294                     for (uint i = 0; i < PGSZ; i ++)
1295                       HDBGAPURead (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, result [i], "ReadPage");
1296 #endif
1297                   }
1298                 return;
1299               }
1300           }
1301       }
1302   }
1303 
1304 #if defined(OLDAPP)
1305 void Write (cpu_state_t * cpup, word18 address, word36 data, processor_cycle_type cyctyp) {
     /* [previous][next][first][last][top][bottom][index][help] */
1306   cpu.TPR.CA = cpu.iefpFinalAddress = address;
1307 
1308   bool isBAR = get_bar_mode ();
1309 
1310   if (cpu.cu.XSF || (cyctyp != INSTRUCTION_FETCH && cpu.currentInstruction.b29))
1311     goto B29;
1312 
1313   switch (get_addr_mode ()) {
1314     case ABSOLUTE_mode: {
1315       if (isBAR) {
1316         cpu.iefpFinalAddress = get_BAR_address (address);
1317         set_apu_status (apuStatus_FABS); // XXX maybe...
1318         fauxDoAppendCycle (cyctyp);
1319         if (cyctyp == OPERAND_STORE && cpu.useZone)
1320           cache_write_zone (cpu.iefpFinalAddress, data, __func__);
1321         else
1322           cache_write (cpu.iefpFinalAddress, data, __func__);
1323         sim_debug (DBG_FINAL, & cpu_dev, "Write(Actual) Write:      bar address=%08o writeData=%012"PRIo64"\r\n", address, data);
1324 # if defined(TESTING)
1325         HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "Write ABBR");
1326         HDBGMWrite (cpu.iefpFinalAddress, data, "Write ABBR");
1327 # endif
1328         return;
1329       } else {
1330         set_apu_status (apuStatus_FABS);
1331         fauxDoAppendCycle (cyctyp);
1332         if (cyctyp == OPERAND_STORE && cpu.useZone)
1333           cache_write_zone (address, data, __func__);
1334         else
1335           cache_write (address, data, __func__);
1336         sim_debug (DBG_FINAL, & cpu_dev,
1337                    "Write(Actual) Write:      abs address=%08o writeData=%012"PRIo64"\r\n",
1338                    address, data);
1339 # if defined(TESTING)
1340         HDBGIEFP (hdbgIEFP_abs_write, 0, address, "Write AB");
1341         HDBGMWrite (address, data, "Write AB");
1342 # endif
1343         return;
1344       }
1345     }
1346 
1347     case APPEND_mode: {
1348 B29:
1349       if (isBAR) {
1350         cpu.TPR.CA = get_BAR_address (cpup, address);
1351         cpu.TPR.TSR = cpu.PPR.PSR;
1352         cpu.TPR.TRR = cpu.PPR.PRR;
1353         cpu.iefpFinalAddress = do_append_cycle (cpup, cyctyp, & data, 1);
1354         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1355                    "Write(Actual) Write: bar iefpFinalAddress=%08o writeData=%012"PRIo64"\r\n",
1356                    cpu.iefpFinalAddress, data);
1357 # if defined(TESTING)
1358         HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "Write BR");
1359         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "Write BR");
1360 # endif
1361         return;
1362       } else {
1363         cpu.iefpFinalAddress = do_append_cycle (cpup, cyctyp, & data, 1);
1364         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1365                    "Write(Actual) Write: iefpFinalAddress=%08o " "writeData=%012"PRIo64"\r\n",
1366                    cpu.iefpFinalAddress, data);
1367 # if defined(TESTING)
1368         HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "Write");
1369         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "Write");
1370 # endif
1371         return;
1372       }
1373     }
1374   }
1375 }
1376 #endif // OLDAPP
1377 
1378 #if !defined(OLDAPP)
1379 void WriteAPUDataStore (cpu_state_t * cpup, word18 address, word36 data) {
     /* [previous][next][first][last][top][bottom][index][help] */
1380   cpu.TPR.CA = cpu.iefpFinalAddress = address;
1381 
1382   bool isBAR = get_bar_mode (cpup);
1383 
1384   if (cpu.cu.XSF || cpu.currentInstruction.b29)
1385     goto B29;
1386 
1387   switch (get_addr_mode (cpup)) {
1388     case ABSOLUTE_mode: {
1389       if (isBAR) {
1390         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1391         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1392         fauxDoAppendCycle (cpup, APU_DATA_STORE);
1393         if (! sdpap_store (cpup, cpu.iefpFinalAddress, & data, 1))
1394           cache_write (cpup, cpu.iefpFinalAddress, data, __func__);
1395         sim_debug (DBG_FINAL, & cpu_dev,
1396                    "WriteAPUDataStore(Actual) Write:      bar address=%08o writeData=%012"PRIo64"\r\n",
1397                    address, data);
1398 # if defined(TESTING)
1399         HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "WriteAPUDataStore ABBR");
1400         HDBGMWrite (cpu.iefpFinalAddress, data, "WriteAPUDataStore ABBR");
1401 # endif
1402         return;
1403       } else {
1404         set_apu_status (cpup, apuStatus_FABS);
1405         fauxDoAppendCycle (cpup, APU_DATA_STORE);
1406         if (! sdpap_store (cpup, address, & data, 1))
1407           cache_write (cpup, address, data, __func__);
1408         sim_debug (DBG_FINAL, & cpu_dev,
1409                    "WriteAPUDataStore(Actual) Write:      abs address=%08o writeData=%012"PRIo64"\r\n",
1410                    address, data);
1411 # if defined(TESTING)
1412         HDBGIEFP (hdbgIEFP_abs_write, 0, address, "WriteAPUDataStore AB");
1413         HDBGMWrite (address, data, "WriteAPUDataStore AB");
1414 # endif
1415         return;
1416       }
1417     }
1418 
1419     case APPEND_mode: {
1420 B29:
1421       if (isBAR) {
1422         cpu.TPR.CA = get_BAR_address (cpup, address);
1423         cpu.TPR.TSR = cpu.PPR.PSR;
1424         cpu.TPR.TRR = cpu.PPR.PRR;
1425         cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, & data, 1);
1426         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1427                    "WriteAPUDataStore(Actual) Write: bar iefpFinalAddress=%08o writeData=%012"PRIo64"\r\n",
1428                    cpu.iefpFinalAddress, data);
1429 # if defined(TESTING)
1430         HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "WriteAPUDataStore BR");
1431         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "WriteAPUDataStore BR");
1432 # endif
1433         return;
1434       } else {
1435         cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, & data, 1);
1436         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1437                    "WriteAPUDataStore(Actual) Write: iefpFinalAddress=%08o " "writeData=%012"PRIo64"\r\n",
1438                    cpu.iefpFinalAddress, data);
1439 # if defined(TESTING)
1440         HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "WriteAPUDataStore");
1441         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "WriteAPUDataStore");
1442 # endif
1443         return;
1444       }
1445     }
1446   }
1447 }
1448 
1449 void WriteOperandStore (cpu_state_t * cpup, word18 address, word36 data) {
     /* [previous][next][first][last][top][bottom][index][help] */
1450   cpu.TPR.CA = cpu.iefpFinalAddress = address;
1451 
1452   bool isBAR = get_bar_mode (cpup);
1453 
1454   if (cpu.cu.XSF || cpu.currentInstruction.b29)
1455     goto B29;
1456 
1457   switch (get_addr_mode (cpup)) {
1458     case ABSOLUTE_mode: {
1459       if (isBAR) {
1460         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1461         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1462         fauxDoAppendCycle (cpup, OPERAND_STORE);
1463         if (cpu.useZone)
1464           { if (! sdpap_store (cpup, cpu.iefpFinalAddress, & data, 1)) cache_write_zone (cpup, cpu.iefpFinalAddress, data, __func__); }
1465         else
1466           { if (! sdpap_store (cpup, cpu.iefpFinalAddress, & data, 1)) cache_write (cpup, cpu.iefpFinalAddress, data, __func__); }
1467         sim_debug (DBG_FINAL, & cpu_dev,
1468                    "WriteOperandStore(Actual) Write:      bar address=%08o writeData=%012"PRIo64"\r\n",
1469                    address, data);
1470 # if defined(TESTING)
1471         HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "WriteOperandStore ABBR");
1472         HDBGMWrite (cpu.iefpFinalAddress, data, "WriteOperandStore ABBR");
1473 # endif
1474         return;
1475       } else {
1476         set_apu_status (cpup, apuStatus_FABS);
1477         fauxDoAppendCycle (cpup, OPERAND_STORE);
1478         if (cpu.useZone)
1479           { if (! sdpap_store (cpup, address, & data, 1)) cache_write_zone (cpup, address, data, __func__); }
1480         else
1481           { if (! sdpap_store (cpup, address, & data, 1)) cache_write (cpup, address, data, __func__); }
1482         sim_debug (DBG_FINAL, & cpu_dev,
1483                    "WriteOperandStore(Actual) Write:      abs address=%08o writeData=%012"PRIo64"\r\n",
1484                    address, data);
1485 # if defined(TESTING)
1486         HDBGIEFP (hdbgIEFP_abs_write, 0, address, "WriteOperandStore AB");
1487         HDBGMWrite (address, data, "WriteOperandStore AB");
1488 # endif
1489         return;
1490       }
1491     }
1492 
1493     case APPEND_mode: {
1494 B29:
1495       if (isBAR) {
1496         cpu.TPR.CA = get_BAR_address (cpup, address);
1497         cpu.TPR.TSR = cpu.PPR.PSR;
1498         cpu.TPR.TRR = cpu.PPR.PRR;
1499         cpu.iefpFinalAddress = doAppendCycleOperandStore (cpup, & data, 1);
1500         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1501                    "WriteOperandStore(Actual) Write: bar iefpFinalAddress=%08o writeData=%012"PRIo64"\r\n",
1502                    cpu.iefpFinalAddress, data);
1503 # if defined(TESTING)
1504         HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "WriteOperandStore BR");
1505         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "WriteOperandStore BR");
1506 # endif
1507         return;
1508       } else {
1509         cpu.iefpFinalAddress = doAppendCycleOperandStore (cpup, & data, 1);
1510         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1511                    "WriteOperandStore(Actual) Write: iefpFinalAddress=%08o " "writeData=%012"PRIo64"\r\n",
1512                    cpu.iefpFinalAddress, data);
1513 # if defined(TESTING)
1514         HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "WriteOperandStore");
1515         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "WriteOperandStore");
1516 # endif
1517         return;
1518       }
1519     }
1520   }
1521 }
1522 #endif // !OLDAPP
1523 
1524 #if defined(OLDAPP)
1525 void Write2 (cpu_state_t * cpup, word18 address, word36 * data, processor_cycle_type cyctyp)
     /* [previous][next][first][last][top][bottom][index][help] */
1526   {
1527     cpu.TPR.CA = cpu.iefpFinalAddress = address;
1528     bool isBAR = get_bar_mode ();
1529 
1530     if (cpu.cu.XSF /*get_went_appending ()*/ || (cyctyp != INSTRUCTION_FETCH && cpu.currentInstruction.b29))
1531       goto B29;
1532 
1533     switch (get_addr_mode ())
1534       {
1535         case ABSOLUTE_mode:
1536           {
1537             if (isBAR)
1538               {
1539                 cpu.iefpFinalAddress = get_BAR_address (address);
1540                 set_apu_status (apuStatus_FABS); // XXX maybe...
1541                 fauxDoAppendCycle (cyctyp);
1542                 cache_write2 (cpu.iefpFinalAddress, data [0], data [1],
1543                               __func__);
1544 # if defined(TESTING)
1545                 HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "Write2 ABBR");
1546                 HDBGMWrite (cpu.iefpFinalAddress, data [0], "Write2 ABBR evn");
1547                 HDBGMWrite (cpu.iefpFinalAddress+1, data [1], "Write2 ABBR odd");
1548 # endif
1549                 sim_debug (DBG_FINAL, & cpu_dev,
1550                            "Write2 (Actual) Write:      bar address=%08o "
1551                            "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1552                            address, data [0], data [1]);
1553                 return;
1554               }
1555             else
1556               {
1557                 set_apu_status (apuStatus_FABS);
1558                 fauxDoAppendCycle (cyctyp);
1559                 cache_write2 (address, data [0], data [1], __func__);
1560                 sim_debug (DBG_FINAL, & cpu_dev,
1561                            "Write2 (Actual) Write:      abs address=%08o "
1562                            "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1563                            address, data [0], data [1]);
1564 # if defined(TESTING)
1565                 HDBGIEFP (hdbgIEFP_abs_write, 0, address, "Write2 AB");
1566                 HDBGMWrite (address, data [0], "Write2 AB evn");
1567                 HDBGMWrite (address+1, data [1], "Write2 AB odd");
1568 # endif
1569                 return;
1570               }
1571           }
1572 
1573         case APPEND_mode:
1574           {
1575 B29:
1576             if (isBAR)
1577               {
1578                 cpu.TPR.CA = get_BAR_address (address);
1579                 cpu.TPR.TSR = cpu.PPR.PSR;
1580                 cpu.TPR.TRR = cpu.PPR.PRR;
1581                 cpu.iefpFinalAddress = do_append_cycle (cyctyp, data, 2);
1582                 sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1583                            "Write2 (Actual) Write: bar iefpFinalAddress=%08o "
1584                            "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1585                            address, data [0], data [1]);
1586 # if defined(TESTING)
1587                 HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "Write2 BR");
1588                 HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data[0], "Write2 BR evn");
1589                 HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, data[1], "Write2 BR odd");
1590 # endif
1591                 return;
1592               }
1593             else
1594               {
1595                 cpu.iefpFinalAddress = do_append_cycle (cyctyp, data, 2);
1596                 sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1597                            "Write2 (Actual) Write: iefpFinalAddress=%08o "
1598                            "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1599                            address, data [0], data [1]);
1600 # if defined(TESTING)
1601                 HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "Write2");
1602                 HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data[0], "Write2 evn");
1603                 HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, data[1], "Write2 odd");
1604 # endif
1605                 return;
1606               }
1607           }
1608       }
1609   }
1610 #endif // OLDAPP
1611 
1612 #if !defined(OLDAPP)
1613 void Write2OperandStore (cpu_state_t * cpup, word18 address, word36 * data) {
     /* [previous][next][first][last][top][bottom][index][help] */
1614   cpu.TPR.CA = cpu.iefpFinalAddress = address;
1615   bool isBAR = get_bar_mode (cpup);
1616 
1617   if (cpu.cu.XSF || cpu.currentInstruction.b29)
1618     goto B29;
1619 
1620   switch (get_addr_mode (cpup)) {
1621     case ABSOLUTE_mode: {
1622       if (isBAR) {
1623         cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1624         set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1625         fauxDoAppendCycle (cpup, OPERAND_STORE);
1626         if (! sdpap_store (cpup, cpu.iefpFinalAddress, data, 2))
1627           cache_write2 (cpup, cpu.iefpFinalAddress, data [0], data [1], __func__);
1628 # if defined(TESTING)
1629         HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "Write2OperandStore ABBR");
1630         HDBGMWrite (cpu.iefpFinalAddress, data [0], "Write2OperandStore ABBR evn");
1631         HDBGMWrite (cpu.iefpFinalAddress+1, data [1], "Write2OperandStore ABBR odd");
1632 # endif
1633         sim_debug (DBG_FINAL, & cpu_dev,
1634                    "Write2OperandStore (Actual) Write:      bar address=%08o " "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1635                    address, data [0], data [1]);
1636         return;
1637       } else {
1638         set_apu_status (cpup, apuStatus_FABS);
1639         fauxDoAppendCycle (cpup, OPERAND_STORE);
1640         if (! sdpap_store (cpup, address, data, 2))
1641           cache_write2 (cpup, address, data [0], data [1], __func__);
1642         sim_debug (DBG_FINAL, & cpu_dev,
1643                    "Write2OperandStore (Actual) Write:      abs address=%08o " "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1644                    address, data [0], data [1]);
1645 # if defined(TESTING)
1646         HDBGIEFP (hdbgIEFP_abs_write, 0, address, "Write2OperandStore AB");
1647         HDBGMWrite (address, data [0], "Write2OperandStore AB evn");
1648         HDBGMWrite (address+1, data [1], "Write2OperandStore AB odd");
1649 # endif
1650         return;
1651       }
1652     }
1653 
1654     case APPEND_mode: {
1655 B29:
1656       if (isBAR) {
1657         cpu.TPR.CA = get_BAR_address (cpup, address);
1658         cpu.TPR.TSR = cpu.PPR.PSR;
1659         cpu.TPR.TRR = cpu.PPR.PRR;
1660         cpu.iefpFinalAddress = doAppendCycleOperandStore (cpup, data, 2);
1661         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1662                    "Write2OperandStore (Actual) Write: bar iefpFinalAddress=%08o " "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1663                    address, data [0], data [1]);
1664 # if defined(TESTING)
1665         HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "Write2OperandStore BR");
1666         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data[0], "Write2OperandStore BR evn");
1667         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, data[1], "Write2OperandStore BR odd");
1668 # endif
1669         return;
1670       } else {
1671         cpu.iefpFinalAddress = doAppendCycleOperandStore (cpup, data, 2);
1672         sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1673                    "Write2OperandStore (Actual) Write: iefpFinalAddress=%08o " "writeData=%012"PRIo64" %012"PRIo64"\r\n",
1674                    address, data [0], data [1]);
1675 # if defined(TESTING)
1676         HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "Write2OperandStore");
1677         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data[0], "Write2OperandStore evn");
1678         HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + 1, cpu.iefpFinalAddress + 1, data[1], "Write2OperandStore odd");
1679 # endif
1680         return;
1681       }
1682     }
1683   }
1684 }
1685 #endif // !OLDAPP
1686 
1687 void Write1 (cpu_state_t * cpup, word18 address, word36 data, bool isAR)
     /* [previous][next][first][last][top][bottom][index][help] */
1688   {
1689     cpu.TPR.CA = cpu.iefpFinalAddress = address;
1690     bool isBAR = get_bar_mode (cpup);
1691     if (isAR || cpu.cu.XSF /*get_went_appending ()*/)
1692       goto B29;
1693     switch (get_addr_mode (cpup))
1694       {
1695         case ABSOLUTE_mode:
1696           {
1697             if (isBAR)
1698              {
1699                 cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1700                 set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1701                 fauxDoAppendCycle (cpup, APU_DATA_STORE);
1702                 if (! sdpap_store (cpup, cpu.iefpFinalAddress, & data, 1))
1703                   cache_write (cpup, cpu.iefpFinalAddress, data, __func__);
1704                 sim_debug (DBG_FINAL, & cpu_dev,
1705                            "Write1(Actual) Write:      bar address=%08o "
1706                            "writeData=%012"PRIo64"\r\n",
1707                            address, data);
1708 #if defined(TESTING)
1709                 HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "Write1 ABBR");
1710                 HDBGMWrite (cpu.iefpFinalAddress, data, "Write1 ABBR");
1711 #endif
1712                 return;
1713               }
1714             else
1715               {
1716                 set_apu_status (cpup, apuStatus_FABS);
1717                 fauxDoAppendCycle (cpup, APU_DATA_STORE);
1718                 if (! sdpap_store (cpup, address, & data, 1))
1719                   cache_write (cpup, address, data, __func__);
1720                 sim_debug (DBG_FINAL, & cpu_dev,
1721                            "Write1(Actual) Write:      abs address=%08o "
1722                            "writeData=%012"PRIo64"\r\n",
1723                            address, data);
1724 #if defined(TESTING)
1725                 HDBGIEFP (hdbgIEFP_abs_write, 0, address, "Write1 AB");
1726                 HDBGMWrite (address, data, "Write1 AB");
1727 #endif
1728                 return;
1729               }
1730           }
1731 
1732         case APPEND_mode:
1733           {
1734 B29:
1735             if (isBAR)
1736               {
1737                 cpu.TPR.CA = get_BAR_address (cpup, address);
1738                 cpu.TPR.TSR = cpu.PPR.PSR;
1739                 cpu.TPR.TRR = cpu.PPR.PRR;
1740                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_STORE, & data, 1);
1741                 cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, & data, 1);
1742                 sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1743                            "Write8(Actual) Write: bar iefpFinalAddress="
1744                            "%08o writeData=%012"PRIo64"\r\n",
1745                            cpu.iefpFinalAddress, data);
1746 #if defined(TESTING)
1747                 HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "Write1 BR");
1748                 HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "Write1 BR");
1749 #endif
1750                 return;
1751               }
1752             else
1753               {
1754                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_STORE, & data, 1);
1755                 cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, & data, 1);
1756                 sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1757                            "Write(Actual) Write: iefpFinalAddress=%08o "
1758                            "writeData=%012"PRIo64"\r\n",
1759                            cpu.iefpFinalAddress, data);
1760 #if defined(TESTING)
1761                 HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "Write1");
1762                 HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA, cpu.iefpFinalAddress, data, "Write1");
1763 #endif
1764                 return;
1765               }
1766           }
1767       }
1768   }
1769 
1770 void Write8 (cpu_state_t * cpup, word18 address, word36 * data, bool isAR)
     /* [previous][next][first][last][top][bottom][index][help] */
1771   {
1772     address &= paragraphMask; // Round to 8 word boundarryt
1773     cpu.TPR.CA = cpu.iefpFinalAddress = address;
1774 
1775     bool isBAR = get_bar_mode (cpup);
1776 
1777     if (isAR || cpu.cu.XSF /*get_went_appending ()*/)
1778       goto B29;
1779 
1780     switch (get_addr_mode (cpup))
1781      {
1782         case ABSOLUTE_mode:
1783           {
1784             if (isBAR)
1785              {
1786                 cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1787                 set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1788                 fauxDoAppendCycle (cpup, APU_DATA_STORE);
1789                 if (! sdpap_store (cpup, cpu.iefpFinalAddress, data, 8))
1790                   cache_writeN (cpup, cpu.iefpFinalAddress, data, 8, __func__);
1791                 if_sim_debug (DBG_FINAL, & cpu_dev)
1792                   {
1793                     for (uint i = 0; i < 8; i ++)
1794                       sim_debug (DBG_FINAL, & cpu_dev,
1795                                  "Write8(Actual) Write:      bar address=%08o "
1796                                  "writeData=%012"PRIo64"\r\n",
1797                                  address + i, data [i]);
1798                   }
1799 #if defined(TESTING)
1800                 HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "Write8 ABBR");
1801                 for (uint i = 0; i < 8; i ++)
1802                   HDBGMWrite (cpu.iefpFinalAddress + i, data [i], "Write8 ABBR");
1803 #endif
1804                 return;
1805               }
1806             else
1807               {
1808                 set_apu_status (cpup, apuStatus_FABS);
1809                 fauxDoAppendCycle (cpup, APU_DATA_STORE);
1810                 if (! sdpap_store (cpup, address, data, 8))
1811                   cache_writeN (cpup, address, data, 8, __func__);
1812                 if_sim_debug (DBG_FINAL, & cpu_dev)
1813                   {
1814                     for (uint i = 0; i < 8; i ++)
1815                       sim_debug (DBG_FINAL, & cpu_dev,
1816                                  "Write8(Actual) Write:      abs address=%08o "
1817                                  "writeData=%012"PRIo64"\r\n",
1818                                   address + i, data [i]);
1819                   }
1820 #if defined(TESTING)
1821                 HDBGIEFP (hdbgIEFP_abs_write, 0, address, "Write8 AB");
1822                 for (uint i = 0; i < 8; i ++)
1823                   HDBGMWrite (address + i, data [i], "Write8 AB");
1824 #endif
1825                 return;
1826               }
1827           }
1828 
1829         case APPEND_mode:
1830           {
1831 B29:
1832             if (isBAR)
1833               {
1834                 cpu.TPR.CA = get_BAR_address (cpup, address);
1835                 cpu.TPR.TSR = cpu.PPR.PSR;
1836                 cpu.TPR.TRR = cpu.PPR.PRR;
1837                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_STORE, data, 8);
1838                 cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, data, 8);
1839                 if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1840                   {
1841                     for (uint i = 0; i < 8; i ++)
1842                       sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1843                                  "Write8(Actual) Write: bar iefpFinalAddress="
1844                                  "%08o writeData=%012"PRIo64"\r\n",
1845                                  cpu.iefpFinalAddress + i, data [i]);
1846                   }
1847 #if defined(TESTING)
1848                 HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "Write8 BR");
1849                 for (uint i = 0; i < 8; i ++)
1850                   HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, data [i], "Write8 BR");
1851 #endif
1852 
1853                 return;
1854               }
1855             else
1856               {
1857                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_STORE, data, 8);
1858                 cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, data, 8);
1859                 if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1860                   {
1861                     for (uint i = 0; i < 8; i ++)
1862                       sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1863                                  "Write8(Actual) Write: iefpFinalAddress=%08o "
1864                                  "writeData=%012"PRIo64"\r\n",
1865                                  cpu.iefpFinalAddress + i, data [i]);
1866                   }
1867 #if defined(TESTING)
1868                 HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "Write8");
1869                 for (uint i = 0; i < 8; i ++)
1870                   HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, data [i], "Write8");
1871 #endif
1872 
1873                 return;
1874               }
1875           }
1876       }
1877   }
1878 
1879 void Write16 (cpu_state_t * cpup, word18 address, word36 * data)
     /* [previous][next][first][last][top][bottom][index][help] */
1880   {
1881     address &= paragraphMask; // Round to 8 word boundary
1882     Write8 (cpup, address, data, cpu.currentInstruction.b29);
1883     Write8 (cpup, address + 8, data + 8, cpu.currentInstruction.b29);
1884   }
1885 
1886 void Write32 (cpu_state_t * cpup, word18 address, word36 * data)
     /* [previous][next][first][last][top][bottom][index][help] */
1887   {
1888 //#define paragraphMask 077777770
1889     //address &= paragraphMask; // Round to 8 word boundary
1890     address &= 077777740; // Round to 32 word boundary
1891     Write8 (cpup, address, data, cpu.currentInstruction.b29);
1892     Write8 (cpup, address + 8, data + 8, cpu.currentInstruction.b29);
1893     Write8 (cpup, address + 16, data + 16, cpu.currentInstruction.b29);
1894     Write8 (cpup, address + 24, data + 24, cpu.currentInstruction.b29);
1895   }
1896 
1897 void WritePage (cpu_state_t * cpup, word18 address, word36 * data, bool isAR)
     /* [previous][next][first][last][top][bottom][index][help] */
1898   {
1899     if ((address & PGMK) != 0)
1900       {
1901         sim_warn ("WritePage not on boundary %06o\r\n", address);
1902       }
1903     address &= (word18) ~PGMK; // Round to page boundary
1904     cpu.TPR.CA = cpu.iefpFinalAddress = address;
1905 
1906     bool isBAR = get_bar_mode (cpup);
1907 
1908     if (isAR || cpu.cu.XSF /*get_went_appending ()*/)
1909       goto B29;
1910 
1911     switch (get_addr_mode (cpup))
1912      {
1913         case ABSOLUTE_mode:
1914           {
1915             if (isBAR)
1916              {
1917                 cpu.iefpFinalAddress = get_BAR_address (cpup, address);
1918                 set_apu_status (cpup, apuStatus_FABS); // XXX maybe...
1919                 fauxDoAppendCycle (cpup, APU_DATA_STORE);
1920                 if (! sdpap_store (cpup, cpu.iefpFinalAddress, data, PGSZ))
1921                   cache_writeN (cpup, cpu.iefpFinalAddress, data, PGSZ, __func__);
1922                 if_sim_debug (DBG_FINAL, & cpu_dev)
1923                   {
1924                     for (uint i = 0; i < PGSZ; i ++)
1925                       sim_debug (DBG_FINAL, & cpu_dev,
1926                                  "WritePage(Actual) Write:      bar address="
1927                                  "%08o writeData=%012"PRIo64"\r\n",
1928                                  address + i, data [i]);
1929                   }
1930 #if defined(TESTING)
1931                 HDBGIEFP (hdbgIEFP_abs_bar_write, 0, address, "WritePage ABBR");
1932                 for (uint i = 0; i < PGSZ; i ++)
1933                   HDBGMWrite (cpu.iefpFinalAddress + i, data [i], "WritePage ABBR");
1934 #endif
1935                 return;
1936               }
1937             else
1938               {
1939                 set_apu_status (cpup, apuStatus_FABS);
1940                 fauxDoAppendCycle (cpup, APU_DATA_STORE);
1941                 if (! sdpap_store (cpup, address, data, PGSZ))
1942                   cache_writeN (cpup, address, data, PGSZ, __func__);
1943                 if_sim_debug (DBG_FINAL, & cpu_dev)
1944                   {
1945                     for (uint i = 0; i < PGSZ; i ++)
1946                       sim_debug (DBG_FINAL, & cpu_dev,
1947                                  "WritePage(Actual) Write:      abs address="
1948                                  "%08o writeData=%012"PRIo64"\r\n",
1949                                  address + i, data [i]);
1950                   }
1951 #if defined(TESTING)
1952                 HDBGIEFP (hdbgIEFP_abs_write, 0, address, "WritePage AB");
1953                 for (uint i = 0; i < PGSZ; i ++)
1954                   HDBGMWrite (address + i, data [i], "WritePage AB");
1955 #endif
1956                 return;
1957               }
1958           }
1959 
1960         case APPEND_mode:
1961           {
1962 B29:
1963             if (isBAR)
1964               {
1965                 cpu.TPR.CA = get_BAR_address (cpup, address);
1966                 cpu.TPR.TSR = cpu.PPR.PSR;
1967                 cpu.TPR.TRR = cpu.PPR.PRR;
1968                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_STORE, data, PGSZ);
1969                 cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, data, PGSZ);
1970                 if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1971                   {
1972                     for (uint i = 0; i < PGSZ; i ++)
1973                       sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1974                                  "WritePage(Actual) Write: bar "
1975                                  "iefpFinalAddress=%08o writeData=%012"PRIo64
1976                                  "\r\n",
1977                                  cpu.iefpFinalAddress + i, data [i]);
1978                   }
1979 #if defined(TESTING)
1980                 HDBGIEFP (hdbgIEFP_bar_write, cpu.TPR.TSR, address, "WritePage BR");
1981                 for (uint i = 0; i < PGSZ; i ++)
1982                   HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, data [i], "WritePage BR");
1983 #endif
1984                 return;
1985               }
1986             else
1987               {
1988                 //cpu.iefpFinalAddress = do_append_cycle (APU_DATA_STORE, data, PGSZ);
1989                 cpu.iefpFinalAddress = doAppendCycleAPUDataStore (cpup, data, PGSZ);
1990                 if_sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev)
1991                   {
1992                     for (uint i = 0; i < PGSZ; i ++)
1993                       sim_debug (DBG_APPENDING | DBG_FINAL, & cpu_dev,
1994                                  "WritePage(Actual) Write: iefpFinalAddress="
1995                                  "%08o writeData=%012"PRIo64"\r\n",
1996                                  cpu.iefpFinalAddress + i, data [i]);
1997                   }
1998 #if defined(TESTING)
1999                 HDBGIEFP (hdbgIEFP_write, cpu.TPR.TSR, address, "WritePage");
2000                 for (uint i = 0; i < PGSZ; i ++)
2001                   HDBGAPUWrite (cpu.TPR.TSR, cpu.TPR.CA + i, cpu.iefpFinalAddress + i, data [i], "WritePage");
2002 #endif
2003 
2004                 return;
2005               }
2006           }
2007       }
2008   }
2009 
2010 void ReadIndirect (cpu_state_t * cpup)
     /* [previous][next][first][last][top][bottom][index][help] */
2011   {
2012     if (cpu.TPR.CA & 1) // is odd?
2013       {
2014         ReadIndirectWordFetch (cpup, cpu.TPR.CA, cpu.itxPair);
2015         cpu.itxPair[1] = MASK36; // fill with ones for debugging
2016       }
2017     else
2018       {
2019         Read2IndirectWordFetch (cpup, cpu.TPR.CA, cpu.itxPair);
2020       }
2021   }

/* [previous][next][first][last][top][bottom][index][help] */