Пример #1
0
 public static function unit_lea()
 {
     if (($address = parent::$cpu->address()) === null) {
         parent::exception(PLATO_EX_UNIT_LEA);
     }
     parent::$register->write(parent::$mod['code'], $address);
     return 0;
 }
Пример #2
0
 public static function unit_jmp()
 {
     switch (parent::$opcode) {
         /* EB cb */
         case 0xeb:
             parent::$cpu->jump(parent::$imm, false, 1);
             break;
             /* JMP rel16 */
             /* JMP rel32 */
         /* JMP rel16 */
         /* JMP rel32 */
         case 0xe9:
             parent::$cpu->jump(parent::$imm, false);
             break;
             /* JMP r/m16 */
             /* JMP r/m32 */
         /* JMP r/m16 */
         /* JMP r/m32 */
         case 0xff:
             parent::$cpu->jump(parent::$cpu->read_address());
             break;
             /* JMP ptr16:16 */
             /* JMP ptr16:32 */
         /* JMP ptr16:16 */
         /* JMP ptr16:32 */
         case 0xea:
             /* cs */
             parent::$code->next_word();
             parent::$cpu->jump(parent::$imm);
             break;
             /* JMP m16:16 */
             /* JMP m16:32 */
         /* JMP m16:16 */
         /* JMP m16:32 */
         case 0xff:
             if (($address = parent::$cpu->address()) === null) {
                 parent::exception(PLATO_EX_UNIT_JUMP);
             }
             parent::$cpu->jump(parent::$cpu->read_address($address));
             break;
     }
     return 0;
 }
 public static function initialize($ldr)
 {
     self::$ldr = $ldr;
     self::$cpu = $ldr->cpu;
     self::$decoder = $ldr->cpu->decoder;
     self::$register = $ldr->cpu->register;
     self::$alu = $ldr->cpu->alu;
     self::$info =& $ldr->cpu->decoder->info;
     self::$opcode =& $ldr->cpu->decoder->opcode;
     self::$opbase =& $ldr->cpu->decoder->opbase;
     self::$opsize =& $ldr->cpu->decoder->opsize;
     self::$mod =& $ldr->cpu->decoder->mod;
     self::$imm =& $ldr->cpu->decoder->imm;
     self::$direction =& $ldr->cpu->decoder->direction;
     self::$condition =& $ldr->cpu->decoder->condition;
     if (!empty(self::$module)) {
         $prefix = dirname(__FILE__) . '/module/class.';
         foreach (self::$module as $item) {
             require_once $prefix . $item . '.php';
         }
         self::$module = false;
     }
 }
Пример #4
0
 public static function unit_ud2()
 {
     parent::exception(PLATO_EX_UNIT_UD3);
 }
Пример #5
0
 public static function unit_cpuid()
 {
     parent::exception(PLATO_EX_UNIT_CPUID);
 }
Пример #6
0
 public static function unit_int()
 {
     switch (parent::$opcode) {
         /* INT 3 */
         case 0xcc:
             parent::exception(PLATO_EX_UNIT_INT3);
             /* INT imm8 */
         /* INT imm8 */
         case 0xcd:
             parent::exception(PLATO_EX_UNIT_INT);
             /* INTO */
         /* INTO */
         case 0xce:
             if (parent::$register->OF) {
                 parent::exception(PLATO_EX_UNIT_INTO);
             }
             break;
     }
     return 0;
 }