require '_h2ph_pre.ph';

unless(defined(&_MAC68K_BUS_H_)) {
    eval 'sub _MAC68K_BUS_H_ () {1;}' unless defined(&_MAC68K_BUS_H_);
    eval 'sub MAC68K_BUS_SPACE_MEM () {0;}' unless defined(&MAC68K_BUS_SPACE_MEM);
    eval 'sub BUS_SPACE_MAP_CACHEABLE () {0x01;}' unless defined(&BUS_SPACE_MAP_CACHEABLE);
    eval 'sub BUS_SPACE_MAP_LINEAR () {0x02;}' unless defined(&BUS_SPACE_MAP_LINEAR);
    eval 'sub bus_space_read_1 {
        local($t, $h, $o) = @_;
	    eval q(( $t, (*(($h) + ($o)))));
    }' unless defined(&bus_space_read_1);
    eval 'sub bus_space_read_2 {
        local($t, $h, $o) = @_;
	    eval q(( $t, (*(($h) + ($o)))));
    }' unless defined(&bus_space_read_2);
    eval 'sub bus_space_read_4 {
        local($t, $h, $o) = @_;
	    eval q(( $t, (*(($h) + ($o)))));
    }' unless defined(&bus_space_read_4);
    if(0) {
	eval 'sub bus_space_read_8 {
	    local($t, $h, $o) = @_;
    	    eval q(!!!  &bus_space_read_8  &unimplemented !!!);
	}' unless defined(&bus_space_read_8);
    }
    eval 'sub bus_space_read_multi_1 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movb	a0@,a1@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_read_multi_1);
    eval 'sub bus_space_read_multi_2 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movw	a0@,a1@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_read_multi_2);
    eval 'sub bus_space_read_multi_4 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movl	a0@,a1@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_read_multi_4);
    if(0) {
	eval 'sub bus_space_read_multi_8 () {!!!  &bus_space_read_multi_8  &unimplemented !!!;}' unless defined(&bus_space_read_multi_8);
    }
    eval 'sub bus_space_read_region_1 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movb	a0@+,a1@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_read_region_1);
    eval 'sub bus_space_read_region_2 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movw	a0@+,a1@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_read_region_2);
    eval 'sub bus_space_read_region_4 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movl	a0@+,a1@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_read_region_4);
    if(0) {
	eval 'sub bus_space_read_region_8 () {!!!  &bus_space_read_region_8  &unimplemented !!!;}' unless defined(&bus_space_read_region_8);
    }
    eval 'sub bus_space_write_1 {
        local($t, $h, $o, $v) = @_;
	    eval q(( $t, ((*(($h) + ($o)) = ($v)))));
    }' unless defined(&bus_space_write_1);
    eval 'sub bus_space_write_2 {
        local($t, $h, $o, $v) = @_;
	    eval q(( $t, ((*(($h) + ($o)) = ($v)))));
    }' unless defined(&bus_space_write_2);
    eval 'sub bus_space_write_4 {
        local($t, $h, $o, $v) = @_;
	    eval q(( $t, ((*(($h) + ($o)) = ($v)))));
    }' unless defined(&bus_space_write_4);
    if(0) {
	eval 'sub bus_space_write_8 () {!!!  &bus_space_write_8  &not  &implemented !!!;}' unless defined(&bus_space_write_8);
    }
    eval 'sub bus_space_write_multi_1 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movb	a1@+,a0@				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_write_multi_1);
    eval 'sub bus_space_write_multi_2 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movw	a1@+,a0@				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_write_multi_2);
    eval 'sub bus_space_write_multi_4 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movl	a1@+,a0@				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_write_multi_4);
    if(0) {
	eval 'sub bus_space_write_multi_8 {
	    local($t, $h, $o, $a, $c) = @_;
    	    eval q(!!!  &bus_space_write_multi_8  &unimplimented !!!);
	}' unless defined(&bus_space_write_multi_8);
    }
    eval 'sub bus_space_write_region_1 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movb	a1@+,a0@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_write_region_1);
    eval 'sub bus_space_write_region_2 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movw	a1@+,a0@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_write_region_2);
    eval 'sub bus_space_write_region_4 {
        local($t, $h, $o, $a, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,a1					;			movl	%2,d0					;		1:	movl	a1@+,a0@+				;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($a), \\"g\\" ($c) : \\"a0\\",\\"a1\\",\\"d0\\"); }  &while (0););
    }' unless defined(&bus_space_write_region_4);
    if(0) {
	eval 'sub bus_space_write_region_8 () {!!!  &bus_space_write_region_8  &unimplemented !!!;}' unless defined(&bus_space_write_region_8);
    }
    eval 'sub bus_space_set_multi_1 {
        local($t, $h, $o, $val, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,d1					;			movl	%2,d0					;		1:	movb	d1,a0@					;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($val), \\"g\\" ($c) : \\"a0\\",\\"d0\\",\\"d1\\"); }  &while (0););
    }' unless defined(&bus_space_set_multi_1);
    eval 'sub bus_space_set_multi_2 {
        local($t, $h, $o, $val, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,d1					;			movl	%2,d0					;		1:	movw	d1,a0@					;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($val), \\"g\\" ($c) : \\"a0\\",\\"d0\\",\\"d1\\"); }  &while (0););
    }' unless defined(&bus_space_set_multi_2);
    eval 'sub bus_space_set_multi_4 {
        local($t, $h, $o, $val, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,d1					;			movl	%2,d0					;		1:	movl	d1,a0@					;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($val), \\"g\\" ($c) : \\"a0\\",\\"d0\\",\\"d1\\"); }  &while (0););
    }' unless defined(&bus_space_set_multi_4);
    if(0) {
	eval 'sub bus_space_set_multi_8 () {!!!  &bus_space_set_multi_8  &unimplemented !!!;}' unless defined(&bus_space_set_multi_8);
    }
    eval 'sub bus_space_set_region_1 {
        local($t, $h, $o, $val, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,d1					;			movl	%2,d0					;		1:	movb	d1,a0@+					;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($val), \\"g\\" ($c) : \\"a0\\",\\"d0\\",\\"d1\\"); }  &while (0););
    }' unless defined(&bus_space_set_region_1);
    eval 'sub bus_space_set_region_2 {
        local($t, $h, $o, $val, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,d1					;			movl	%2,d0					;		1:	movw	d1,a0@+					;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($val), \\"g\\" ($c) : \\"a0\\",\\"d0\\",\\"d1\\"); }  &while (0););
    }' unless defined(&bus_space_set_region_2);
    eval 'sub bus_space_set_region_4 {
        local($t, $h, $o, $val, $c) = @_;
	    eval q( &do { $t;  &__asm  &__volatile (\\"								movl	%0,a0					;			movl	%1,d1					;			movl	%2,d0					;		1:	movl	d1,a0@+					;			subql	#1,d0					;			jne	1b\\" : : \\"r\\" (($h) + ($o)), \\"g\\" ($val), \\"g\\" ($c) : \\"a0\\",\\"d0\\",\\"d1\\"); }  &while (0););
    }' unless defined(&bus_space_set_region_4);
    if(0) {
	eval 'sub bus_space_set_region_8 () {!!!  &bus_space_set_region_8  &unimplemented !!!;}' unless defined(&bus_space_set_region_8);
    }
    eval 'sub __MAC68K_copy_region_N {
        local($BYTES) = @_;
	    eval q( &static  &__inline  &void  &__CONCAT( &bus_space_copy_region_,$BYTES)  &__P(( &bus_space_tag_t,  &bus_space_handle_t  &bsh1,  &bus_size_t  &off1,  &bus_space_handle_t  &bsh2,  &bus_size_t  &off2,  &bus_size_t  &count));  &static  &__inline  &void  &__CONCAT( &bus_space_copy_region_,$BYTES)( &t,  &h1,  &o1,  &h2,  &o2,  &c)  &bus_space_tag_t  &t;  &bus_space_handle_t  &h1,  &h2;  &bus_size_t  &o1,  &o2,  &c; {  &bus_size_t  &o;  &if (( &h1 +  &o1) >= ( &h2 +  &o2)) {  &for ( &o = 0;  &c != 0;  &c--,  &o += $BYTES)  &__CONCAT( &bus_space_write_,$BYTES)( &t,  &h2,  &o2 +  &o,  &__CONCAT( &bus_space_read_,$BYTES)( &t,  &h1,  &o1 +  &o)); }  &else {  &for ( &o = ( &c - 1) * $BYTES;  &c != 0;  &c--,  &o -= $BYTES)  &__CONCAT( &bus_space_write_,$BYTES)( &t,  &h2,  &o2 +  &o,  &__CONCAT( &bus_space_read_,$BYTES)( &t,  &h1,  &o1 +  &o)); } });
    }' unless defined(&__MAC68K_copy_region_N);
    if(0) {
	eval 'sub bus_space_copy_8 () {!!!  &bus_space_copy_8  &unimplemented !!!;}' unless defined(&bus_space_copy_8);
    }
    undef(&__MAC68K_copy_region_N) if defined(&__MAC68K_copy_region_N);
    eval 'sub bus_space_barrier {
        local($t, $h, $o, $l, $f) = @_;
	    eval q(((, , , , ($f))));
    }' unless defined(&bus_space_barrier);
    eval 'sub BUS_SPACE_BARRIER_READ () {0x01;}' unless defined(&BUS_SPACE_BARRIER_READ);
    eval 'sub BUS_SPACE_BARRIER_WRITE () {0x02;}' unless defined(&BUS_SPACE_BARRIER_WRITE);
}
1;
