require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&__M88K_ASM_H__)) {
    eval 'sub __M88K_ASM_H__ () {1;}' unless defined(&__M88K_ASM_H__);
    if(defined(&__STDC__)) {
	eval 'sub _C_LABEL {
	    my($name) = @_;
    	    eval q( &_  $name);
	}' unless defined(&_C_LABEL);
    } else {
	eval 'sub _C_LABEL {
	    my($name) = @_;
    	    eval q( &_ $name);
	}' unless defined(&_C_LABEL);
    }
    eval 'sub _ASM_LABEL {
        my($name) = @_;
	    eval q($name);
    }' unless defined(&_ASM_LABEL);
    eval 'sub _ENTRY {
        my($name) = @_;
	    eval q(. &text; . &align 8; . &globl $name; $name:);
    }' unless defined(&_ENTRY);
    eval 'sub ENTRY {
        my($name) = @_;
	    eval q( &_ENTRY( &_C_LABEL($name)));
    }' unless defined(&ENTRY);
    eval 'sub ASENTRY {
        my($name) = @_;
	    eval q( &_ENTRY( &_ASM_LABEL($name)));
    }' unless defined(&ASENTRY);
    eval 'sub GLOBAL {
        my($name) = @_;
	    eval q(. &globl  &_C_LABEL($name);  &_C_LABEL($name):);
    }' unless defined(&GLOBAL);
    eval 'sub ASGLOBAL {
        my($name) = @_;
	    eval q(. &globl  &_ASM_LABEL($name);  &_ASM_LABEL($name):);
    }' unless defined(&ASGLOBAL);
    eval 'sub LOCAL {
        my($name) = @_;
	    eval q( &_C_LABEL($name):);
    }' unless defined(&LOCAL);
    eval 'sub ASLOCAL {
        my($name) = @_;
	    eval q( &_ASM_LABEL($name):);
    }' unless defined(&ASLOCAL);
    eval 'sub BSS {
        my($name, $size) = @_;
	    eval q(. &comm  &_C_LABEL($name), $size);
    }' unless defined(&BSS);
    eval 'sub ASBSS {
        my($name, $size) = @_;
	    eval q(. &comm  &_ASM_LABEL($name), $size);
    }' unless defined(&ASBSS);
    if(defined(&__ELF__)) {
	eval 'sub WEAK_ALIAS {
	    my($alias,$sym) = @_;
    	    eval q(. &weak $alias; $alias = $sym);
	}' unless defined(&WEAK_ALIAS);
    } else {
	if(defined(&__STDC__)) {
	    eval 'sub WEAK_ALIAS {
	        my($alias,$sym) = @_;
    		eval q(. &weak  &_$alias;  &_$alias =  &_$sym);
	    }' unless defined(&WEAK_ALIAS);
	} else {
	    eval 'sub WEAK_ALIAS {
	        my($alias,$sym) = @_;
    		eval q(. &weak  &_ $alias;  &_ $alias =  &_ $sym);
	    }' unless defined(&WEAK_ALIAS);
	}
    }
    if(defined(&_KERNEL)) {
	if(defined(&_LOCORE)) {
	    eval 'sub PID () { &cr0;}' unless defined(&PID);
	    eval 'sub PSR () { &cr1;}' unless defined(&PSR);
	    eval 'sub EPSR () { &cr2;}' unless defined(&EPSR);
	    eval 'sub SSBR () { &cr3;}' unless defined(&SSBR);
	    eval 'sub SXIP () { &cr4;}' unless defined(&SXIP);
	    eval 'sub SNIP () { &cr5;}' unless defined(&SNIP);
	    eval 'sub SFIP () { &cr6;}' unless defined(&SFIP);
	    eval 'sub VBR () { &cr7;}' unless defined(&VBR);
	    eval 'sub DMT0 () { &cr8;}' unless defined(&DMT0);
	    eval 'sub DMD0 () { &cr9;}' unless defined(&DMD0);
	    eval 'sub DMA0 () { &cr10;}' unless defined(&DMA0);
	    eval 'sub DMT1 () { &cr11;}' unless defined(&DMT1);
	    eval 'sub DMD1 () { &cr12;}' unless defined(&DMD1);
	    eval 'sub DMA1 () { &cr13;}' unless defined(&DMA1);
	    eval 'sub DMT2 () { &cr14;}' unless defined(&DMT2);
	    eval 'sub DMD2 () { &cr15;}' unless defined(&DMD2);
	    eval 'sub DMA2 () { &cr16;}' unless defined(&DMA2);
	    eval 'sub SR0 () { &cr17;}' unless defined(&SR0);
	    eval 'sub SR1 () { &cr18;}' unless defined(&SR1);
	    eval 'sub SR2 () { &cr19;}' unless defined(&SR2);
	    eval 'sub SR3 () { &cr20;}' unless defined(&SR3);
	    eval 'sub SRX () { &cr16;}' unless defined(&SRX);
	    eval 'sub EXIP () { &cr4;}' unless defined(&EXIP);
	    eval 'sub ENIP () { &cr5;}' unless defined(&ENIP);
	    eval 'sub ICMD () { &cr25;}' unless defined(&ICMD);
	    eval 'sub ICTL () { &cr26;}' unless defined(&ICTL);
	    eval 'sub ISAR () { &cr27;}' unless defined(&ISAR);
	    eval 'sub ISAP () { &cr28;}' unless defined(&ISAP);
	    eval 'sub IUAP () { &cr29;}' unless defined(&IUAP);
	    eval 'sub IIR () { &cr30;}' unless defined(&IIR);
	    eval 'sub IBP () { &cr31;}' unless defined(&IBP);
	    eval 'sub IPPU () { &cr32;}' unless defined(&IPPU);
	    eval 'sub IPPL () { &cr33;}' unless defined(&IPPL);
	    eval 'sub ISR () { &cr34;}' unless defined(&ISR);
	    eval 'sub ILAR () { &cr35;}' unless defined(&ILAR);
	    eval 'sub IPAR () { &cr36;}' unless defined(&IPAR);
	    eval 'sub DCMD () { &cr40;}' unless defined(&DCMD);
	    eval 'sub DCTL () { &cr41;}' unless defined(&DCTL);
	    eval 'sub DSAR () { &cr42;}' unless defined(&DSAR);
	    eval 'sub DSAP () { &cr43;}' unless defined(&DSAP);
	    eval 'sub DUAP () { &cr44;}' unless defined(&DUAP);
	    eval 'sub DIR () { &cr45;}' unless defined(&DIR);
	    eval 'sub DBP () { &cr46;}' unless defined(&DBP);
	    eval 'sub DPPU () { &cr47;}' unless defined(&DPPU);
	    eval 'sub DPPL () { &cr48;}' unless defined(&DPPL);
	    eval 'sub DSR () { &cr49;}' unless defined(&DSR);
	    eval 'sub DLAR () { &cr50;}' unless defined(&DLAR);
	    eval 'sub DPAR () { &cr51;}' unless defined(&DPAR);
	    eval 'sub FPECR () { &fcr0;}' unless defined(&FPECR);
	    eval 'sub FPHS1 () { &fcr1;}' unless defined(&FPHS1);
	    eval 'sub FPLS1 () { &fcr2;}' unless defined(&FPLS1);
	    eval 'sub FPHS2 () { &fcr3;}' unless defined(&FPHS2);
	    eval 'sub FPLS2 () { &fcr4;}' unless defined(&FPLS2);
	    eval 'sub FPPT () { &fcr5;}' unless defined(&FPPT);
	    eval 'sub FPRH () { &fcr6;}' unless defined(&FPRH);
	    eval 'sub FPRL () { &fcr7;}' unless defined(&FPRL);
	    eval 'sub FPIT () { &fcr8;}' unless defined(&FPIT);
	    eval 'sub FPSR () { &fcr62;}' unless defined(&FPSR);
	    eval 'sub FPCR () { &fcr63;}' unless defined(&FPCR);
	    eval 'sub FLUSH_PIPELINE () { &tb1 0,  &r0, 0;}' unless defined(&FLUSH_PIPELINE);
	    eval 'sub NOP () { &or  &r0,  &r0,  &r0;}' unless defined(&NOP);
	    eval 'sub RTE () { &NOP ;  &rte;}' unless defined(&RTE);
	    eval 'sub PSR_SHADOW_FREEZE_BIT () {0;}' unless defined(&PSR_SHADOW_FREEZE_BIT);
	    eval 'sub PSR_INTERRUPT_DISABLE_BIT () {1;}' unless defined(&PSR_INTERRUPT_DISABLE_BIT);
	    eval 'sub PSR_FPU_DISABLE_BIT () {3;}' unless defined(&PSR_FPU_DISABLE_BIT);
	    eval 'sub PSR_BIG_ENDIAN_MODE () {30;}' unless defined(&PSR_BIG_ENDIAN_MODE);
	    eval 'sub PSR_SUPERVISOR_MODE_BIT () {31;}' unless defined(&PSR_SUPERVISOR_MODE_BIT);
	    eval 'sub PSR_GRAPHICS_DISABLE_BIT () {4;}' unless defined(&PSR_GRAPHICS_DISABLE_BIT);
	    eval 'sub PSR_SERIAL_MODE_BIT () {29;}' unless defined(&PSR_SERIAL_MODE_BIT);
	    eval 'sub PSR_CARRY_BIT () {28;}' unless defined(&PSR_CARRY_BIT);
	    eval 'sub PSR_SERIALIZE_BIT () {25;}' unless defined(&PSR_SERIALIZE_BIT);
	    eval 'sub VECTOR {
	        my($x) = @_;
    		eval q( &word  &_C_LABEL($x));
	    }' unless defined(&VECTOR);
	    eval 'sub CPU () { &SR0;}' unless defined(&CPU);
	}
	eval 'sub FLUSH_PIPELINE_STRING () {"tb1	0, r0, 0";}' unless defined(&FLUSH_PIPELINE_STRING);
	eval 'sub RTE_VALID_BIT () {1;}' unless defined(&RTE_VALID_BIT);
	eval 'sub RTE_ERROR_BIT () {0;}' unless defined(&RTE_ERROR_BIT);
	eval 'sub DMT_VALID_BIT () {0;}' unless defined(&DMT_VALID_BIT);
	eval 'sub DMT_WRITE_BIT () {1;}' unless defined(&DMT_WRITE_BIT);
	eval 'sub DMT_LOCK_BIT () {12;}' unless defined(&DMT_LOCK_BIT);
	eval 'sub DMT_DOUBLE_BIT () {13;}' unless defined(&DMT_DOUBLE_BIT);
	eval 'sub DMT_DAS_BIT () {14;}' unless defined(&DMT_DAS_BIT);
	eval 'sub DMT_DREG_OFFSET () {7;}' unless defined(&DMT_DREG_OFFSET);
	eval 'sub DMT_DREG_WIDTH () {5;}' unless defined(&DMT_DREG_WIDTH);
    }
}
1;
