mirror of
https://frontier.innolan.net/github/amigaos-cross-toolchain6.git
synced 2024-10-19 10:29:55 +00:00
@T more tests
This commit is contained in:
Executable
+5
@@ -0,0 +1,5 @@
|
||||
m68k-amigaos-gcc -S -Ofast test.c -fomit-frame-pointer -noixemul -mcpu=68000 -m68000 -mregparm=2 || exit 1
|
||||
m68k-amigaos-gcc -S -Ofast test.c -fomit-frame-pointer -noixemul -mcpu=68000 -m68000 -mregparm=2 -otestno.s -fbbb=- || exit 1
|
||||
r="$(diff --brief test.s golden.s)"
|
||||
[ "$r" == "" ] || diff test.s golden.s
|
||||
[ "$r" == "" ] || exit 1
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#NO_APP
|
||||
.text
|
||||
.align 2
|
||||
.globl _sort5
|
||||
_sort5:
|
||||
movem.l #14398,-(sp)
|
||||
move.l (a0),a5
|
||||
move.w 20(a5),d3
|
||||
move.l 4(a0),a3
|
||||
move.w 20(a3),d1
|
||||
cmp.w d3,d1
|
||||
jle .L2
|
||||
move.w d3,d0
|
||||
move.w d1,d3
|
||||
move.w d0,d1
|
||||
move.l a5,d0
|
||||
move.l a3,a5
|
||||
move.l d0,a3
|
||||
.L2:
|
||||
move.l 12(a0),a2
|
||||
move.w 20(a2),a1
|
||||
move.l 16(a0),a6
|
||||
move.w 20(a6),d2
|
||||
cmp.w a1,d2
|
||||
jgt .L3
|
||||
move.w d2,d0
|
||||
move.w a1,d2
|
||||
move.w d0,a1
|
||||
move.l a6,d0
|
||||
move.l a2,a6
|
||||
move.l d0,a2
|
||||
.L3:
|
||||
move.l 8(a0),a4
|
||||
move.w 20(a4),d0
|
||||
cmp.w d0,d2
|
||||
jgt .L4
|
||||
move.w d0,d4
|
||||
move.w d2,d0
|
||||
move.w d4,d2
|
||||
move.l a6,d4
|
||||
move.l a4,a6
|
||||
move.l d4,a4
|
||||
.L4:
|
||||
cmp.w a1,d0
|
||||
jge .L5
|
||||
move.w d0,d4
|
||||
move.w a1,d0
|
||||
move.w d4,a1
|
||||
move.l a4,d4
|
||||
move.l a2,a4
|
||||
move.l d4,a2
|
||||
.L5:
|
||||
cmp.w d3,d2
|
||||
jgt .L6
|
||||
move.w d2,d3
|
||||
move.l a6,d2
|
||||
move.l a5,a6
|
||||
move.l d2,a5
|
||||
.L6:
|
||||
move.l a6,16(a0)
|
||||
cmp.w d1,d0
|
||||
jle .L7
|
||||
move.w d0,d2
|
||||
move.w d1,d0
|
||||
move.w d2,d1
|
||||
move.l a3,d2
|
||||
move.l a4,a3
|
||||
move.l d2,a4
|
||||
.L7:
|
||||
cmp.w a1,d0
|
||||
jlt .L8
|
||||
move.w d0,a1
|
||||
move.l a2,d0
|
||||
move.l a4,a2
|
||||
move.l d0,a4
|
||||
.L8:
|
||||
move.l a4,(a0)
|
||||
cmp.w d3,d1
|
||||
jle .L9
|
||||
move.w d3,d1
|
||||
move.l a5,d0
|
||||
move.l a3,a5
|
||||
move.l d0,a3
|
||||
.L9:
|
||||
move.l a5,12(a0)
|
||||
cmp.w a1,d1
|
||||
jlt .L10
|
||||
move.l a2,d0
|
||||
move.l a3,a2
|
||||
move.l d0,a3
|
||||
.L10:
|
||||
move.l a3,4(a0)
|
||||
move.l a2,8(a0)
|
||||
movem.l (sp)+,#31772
|
||||
rts
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
typedef enum {
|
||||
FACING_LEFT,
|
||||
FACING_RIGHT
|
||||
} object_direction_t;
|
||||
|
||||
typedef struct {
|
||||
int16_t start;
|
||||
int16_t stop;
|
||||
int16_t speed;
|
||||
object_direction_t facing;
|
||||
} object_animation_t;
|
||||
|
||||
typedef struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t w;
|
||||
int16_t h;
|
||||
int16_t dx;
|
||||
int16_t dy;
|
||||
} object_image_t;
|
||||
|
||||
typedef struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t dx;
|
||||
int16_t dy;
|
||||
int16_t ix;
|
||||
} object_velocity_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t w;
|
||||
int16_t h;
|
||||
} object_position_t;
|
||||
|
||||
typedef struct {
|
||||
object_position_t positions[2];
|
||||
object_position_t* position;
|
||||
} object_save_t;
|
||||
|
||||
typedef struct object {
|
||||
uint16_t id;
|
||||
uint16_t class;
|
||||
void* data;
|
||||
struct object* next;
|
||||
struct object* prev;
|
||||
int16_t _x;
|
||||
int16_t _y;
|
||||
int16_t _z;
|
||||
int16_t _px;
|
||||
int16_t _py;
|
||||
object_velocity_t velocity;
|
||||
int16_t imageIndex;
|
||||
object_image_t* image;
|
||||
uint16_t baseId;
|
||||
uint16_t animId;
|
||||
uint16_t actionId;
|
||||
object_animation_t* anim;
|
||||
object_save_t save;
|
||||
uint16_t frameCounter;
|
||||
uint16_t deadRenderCount;
|
||||
uint16_t _state;
|
||||
void (*update)(uint16_t deltaT, struct object* ptr);
|
||||
void (*freeData)(void* data);
|
||||
uint16_t visible;
|
||||
uint16_t tileRender;
|
||||
|
||||
uint16_t widthOffset;
|
||||
uint16_t width;
|
||||
|
||||
uint16_t collidable;
|
||||
} object_t;
|
||||
|
||||
|
||||
#define _min(a, b) (d[a]->_z<d[b]->_z?d[a]:d[b])
|
||||
#define _max(a, b) (d[a]->_z<d[b]->_z?d[b]:d[a])
|
||||
#define SWAP(x,y) { object_t* a = _min(x,y);object_t* b = _max(x,y); d[x] = a; d[y] = b; }
|
||||
|
||||
|
||||
void sort5(object_t **d){
|
||||
SWAP(0,1);
|
||||
SWAP(3,4);
|
||||
SWAP(2,4);
|
||||
SWAP(2,3);
|
||||
SWAP(1,4);
|
||||
SWAP(0,3);
|
||||
SWAP(0,2);
|
||||
SWAP(1,3);
|
||||
SWAP(1,2);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
#NO_APP
|
||||
.text
|
||||
.align 2
|
||||
.globl _sort5
|
||||
_sort5:
|
||||
movem.l #14398,-(sp)
|
||||
move.l (a0),a5
|
||||
move.w 20(a5),d3
|
||||
move.l 4(a0),a3
|
||||
move.w 20(a3),d1
|
||||
cmp.w d3,d1
|
||||
jle .L2
|
||||
move.w d3,d0
|
||||
move.w d1,d3
|
||||
move.w d0,d1
|
||||
move.l a5,d0
|
||||
move.l a3,a5
|
||||
move.l d0,a3
|
||||
.L2:
|
||||
move.l 12(a0),a2
|
||||
move.w 20(a2),a1
|
||||
move.l 16(a0),a6
|
||||
move.w 20(a6),d2
|
||||
cmp.w a1,d2
|
||||
jgt .L3
|
||||
move.w d2,d0
|
||||
move.w a1,d2
|
||||
move.w d0,a1
|
||||
move.l a6,d0
|
||||
move.l a2,a6
|
||||
move.l d0,a2
|
||||
.L3:
|
||||
move.l 8(a0),a4
|
||||
move.w 20(a4),d0
|
||||
cmp.w d0,d2
|
||||
jgt .L4
|
||||
move.w d0,d4
|
||||
move.w d2,d0
|
||||
move.w d4,d2
|
||||
move.l a6,d4
|
||||
move.l a4,a6
|
||||
move.l d4,a4
|
||||
.L4:
|
||||
cmp.w a1,d0
|
||||
jge .L5
|
||||
move.w d0,d4
|
||||
move.w a1,d0
|
||||
move.w d4,a1
|
||||
move.l a4,d4
|
||||
move.l a2,a4
|
||||
move.l d4,a2
|
||||
.L5:
|
||||
cmp.w d3,d2
|
||||
jgt .L6
|
||||
move.w d2,d3
|
||||
move.l a6,d2
|
||||
move.l a5,a6
|
||||
move.l d2,a5
|
||||
.L6:
|
||||
move.l a6,16(a0)
|
||||
cmp.w d1,d0
|
||||
jle .L7
|
||||
move.w d0,d2
|
||||
move.w d1,d0
|
||||
move.w d2,d1
|
||||
move.l a3,d2
|
||||
move.l a4,a3
|
||||
move.l d2,a4
|
||||
.L7:
|
||||
cmp.w a1,d0
|
||||
jlt .L8
|
||||
move.w d0,a1
|
||||
move.l a2,d0
|
||||
move.l a4,a2
|
||||
move.l d0,a4
|
||||
.L8:
|
||||
move.l a4,(a0)
|
||||
cmp.w d3,d1
|
||||
jle .L9
|
||||
move.w d3,d1
|
||||
move.l a5,d0
|
||||
move.l a3,a5
|
||||
move.l d0,a3
|
||||
.L9:
|
||||
move.l a5,12(a0)
|
||||
cmp.w a1,d1
|
||||
jlt .L10
|
||||
move.l a2,d0
|
||||
move.l a3,a2
|
||||
move.l d0,a3
|
||||
.L10:
|
||||
move.l a3,4(a0)
|
||||
move.l a2,8(a0)
|
||||
movem.l (sp)+,#31772
|
||||
rts
|
||||
@@ -0,0 +1,95 @@
|
||||
#NO_APP
|
||||
.text
|
||||
.align 2
|
||||
.globl _sort5
|
||||
_sort5:
|
||||
movem.l #14398,-(sp)
|
||||
move.l (a0),a5
|
||||
move.w 20(a5),d3
|
||||
move.l 4(a0),a3
|
||||
move.w 20(a3),d1
|
||||
cmp.w d3,d1
|
||||
jle .L2
|
||||
move.w d3,d0
|
||||
move.w d1,d3
|
||||
move.w d0,d1
|
||||
move.l a5,d0
|
||||
move.l a3,a5
|
||||
move.l d0,a3
|
||||
.L2:
|
||||
move.l 12(a0),a2
|
||||
move.w 20(a2),a1
|
||||
move.l 16(a0),a6
|
||||
move.w 20(a6),d2
|
||||
cmp.w a1,d2
|
||||
jgt .L3
|
||||
move.w d2,d0
|
||||
move.w a1,d2
|
||||
move.w d0,a1
|
||||
move.l a6,d0
|
||||
move.l a2,a6
|
||||
move.l d0,a2
|
||||
.L3:
|
||||
move.l 8(a0),a4
|
||||
move.w 20(a4),d0
|
||||
cmp.w d0,d2
|
||||
jgt .L4
|
||||
move.w d0,d4
|
||||
move.w d2,d0
|
||||
move.w d4,d2
|
||||
move.l a6,d4
|
||||
move.l a4,a6
|
||||
move.l d4,a4
|
||||
.L4:
|
||||
cmp.w a1,d0
|
||||
jge .L5
|
||||
move.w d0,d4
|
||||
move.w a1,d0
|
||||
move.w d4,a1
|
||||
move.l a4,d4
|
||||
move.l a2,a4
|
||||
move.l d4,a2
|
||||
.L5:
|
||||
cmp.w d3,d2
|
||||
jgt .L6
|
||||
move.w d2,d3
|
||||
move.l a6,d2
|
||||
move.l a5,a6
|
||||
move.l d2,a5
|
||||
.L6:
|
||||
move.l a6,16(a0)
|
||||
cmp.w d1,d0
|
||||
jle .L7
|
||||
move.w d0,d2
|
||||
move.w d1,d0
|
||||
move.w d2,d1
|
||||
move.l a3,d2
|
||||
move.l a4,a3
|
||||
move.l d2,a4
|
||||
.L7:
|
||||
cmp.w a1,d0
|
||||
jlt .L8
|
||||
move.w d0,a1
|
||||
move.l a2,d0
|
||||
move.l a4,a2
|
||||
move.l d0,a4
|
||||
.L8:
|
||||
move.l a4,(a0)
|
||||
cmp.w d3,d1
|
||||
jle .L9
|
||||
move.w d3,d1
|
||||
move.l a5,d0
|
||||
move.l a3,a5
|
||||
move.l d0,a3
|
||||
.L9:
|
||||
move.l a5,12(a0)
|
||||
cmp.w a1,d1
|
||||
jlt .L10
|
||||
move.l a2,d0
|
||||
move.l a3,a2
|
||||
move.l d0,a3
|
||||
.L10:
|
||||
move.l a3,4(a0)
|
||||
move.l a2,8(a0)
|
||||
movem.l (sp)+,#31772
|
||||
rts
|
||||
Reference in New Issue
Block a user