Mercurial > repos > blastem
comparison m68k_core.c @ 1027:276cd582b728
Fix PC value pushed to stack for A and F line traps
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 10 May 2016 21:26:27 -0700 |
parents | 261995d06897 |
children | 2ec5e6eaf81d |
comparison
equal
deleted
inserted
replaced
1026:7267bc1ab547 | 1027:276cd582b728 |
---|---|
332 } | 332 } |
333 | 333 |
334 void translate_m68k_trap(m68k_options *opts, m68kinst *inst) | 334 void translate_m68k_trap(m68k_options *opts, m68kinst *inst) |
335 { | 335 { |
336 code_info *code = &opts->gen.code; | 336 code_info *code = &opts->gen.code; |
337 uint32_t vector; | 337 uint32_t vector, pc = inst->address; |
338 switch (inst->op) | 338 switch (inst->op) |
339 { | 339 { |
340 case M68K_TRAP: | 340 case M68K_TRAP: |
341 vector = inst->src.params.immed + VECTOR_TRAP_0; | 341 vector = inst->src.params.immed + VECTOR_TRAP_0; |
342 pc += 2; | |
342 break; | 343 break; |
343 case M68K_A_LINE_TRAP: | 344 case M68K_A_LINE_TRAP: |
344 vector = VECTOR_LINE_1010; | 345 vector = VECTOR_LINE_1010; |
345 break; | 346 break; |
346 case M68K_F_LINE_TRAP: | 347 case M68K_F_LINE_TRAP: |
347 vector = VECTOR_LINE_1111; | 348 vector = VECTOR_LINE_1111; |
348 break; | 349 break; |
349 } | 350 } |
350 ldi_native(opts, vector, opts->gen.scratch2); | 351 ldi_native(opts, vector, opts->gen.scratch2); |
351 ldi_native(opts, inst->address+2, opts->gen.scratch1); | 352 ldi_native(opts, pc, opts->gen.scratch1); |
352 jmp(code, opts->trap); | 353 jmp(code, opts->trap); |
353 } | 354 } |
354 | 355 |
355 void translate_m68k_illegal(m68k_options *opts, m68kinst *inst) | 356 void translate_m68k_illegal(m68k_options *opts, m68kinst *inst) |
356 { | 357 { |