/* * fp_decode.h * * Copyright Roman Zippel, 1997. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * ALTERNATIVELY, this product may be distributed under the terms of * the GNU General Public License, in which case the provisions of the GPL are * required INSTEAD OF the above restrictions. (This clause is * necessary due to a potential bad interaction between the GPL and * the restrictions contained in a BSD-style copyright.) * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FP_DECODE_H #define _FP_DECODE_H
/* These macros do the dirty work of the instr decoding, several variables * can be defined in the source file to modify the work of these macros, * currently the following variables are used: * ... * The register usage: * d0 - will contain source operand for data direct mode, * otherwise scratch register * d1 - upper 16bit are reserved for caller * lower 16bit may contain further arguments, * is destroyed during decoding * d2 - contains first two instruction words, * first word will be used for extension word * a0 - will point to source/dest operand for any indirect mode * otherwise scratch register * a1 - scratch register * a2 - base addr to the task structure * * the current implementation doesn't check for every disallowed * addressing mode (e.g. pc relative modes as destination), as long * as it only means a new addressing mode, which should not appear * in a program and that doesn't crash the emulation, I think it's * not a problem to allow these modes.
*/
| first decoding of the instr type
| this separates the conditional instr
.macro fp_decode_cond_instr_type
bfextu %d2{#8,#2},%d0
jmp ([0f:w,%pc,%d0*4])
| extract the addressing mode
| it depends on the instr which of the modes is valid
.macro fp_decode_addr_mode
bfextu %d2{#10,#3},%d0
jmp ([0f:w,%pc,%d0*4])
| get the extension word and test for brief or full extension type
.macro fp_get_test_extword label
fp_get_instr_word %d2,fp_err_ua1
btst #8,%d2
jne \label
.endm
| test if %pc is the base registerfor the indirect addr mode
.macro fp_test_basereg_d16 label
btst #20,%d2
jeq \label
.endm
| test if %pc is the base registerfor one of the extended modes
.macro fp_test_basereg_ext label
btst #19,%d2
jeq \label
.endm
.macro fp_test_suppr_index label
btst #6,%d2
jne \label
.endm
| addressing mode: data register direct
.macro fp_mode_data_direct
fp_decode_addr_reg
printf PDECODE,"d%d",1,%d0
.endm
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.