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
+115
@@ -0,0 +1,115 @@
|
||||
#NO_APP
|
||||
.text
|
||||
.align 2
|
||||
.globl _conductor_init
|
||||
_conductor_init:
|
||||
clr.w _conductor_scrollTarget
|
||||
move.l a0,_conductor_instructions
|
||||
clr.w _conductor_instructionIndex
|
||||
tst.w (a0)
|
||||
jeq .L1
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jlt .L14
|
||||
.L9:
|
||||
move.l 6(a0),a1
|
||||
moveq #0,d0
|
||||
move.w 4(a0),d0
|
||||
jsr (a1)
|
||||
tst.w d0
|
||||
jeq .L1
|
||||
move.w _conductor_instructionIndex,a0
|
||||
addq.w #1,a0
|
||||
move.w a0,_conductor_instructionIndex
|
||||
moveq #0,d0
|
||||
move.w a0,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L1
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jge .L9
|
||||
.L1:
|
||||
rts
|
||||
.L14:
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_process
|
||||
_conductor_process:
|
||||
moveq #0,d0
|
||||
move.w _conductor_instructionIndex,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L15
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jlt .L28
|
||||
.L23:
|
||||
move.l 6(a0),a1
|
||||
moveq #0,d0
|
||||
move.w 4(a0),d0
|
||||
jsr (a1)
|
||||
tst.w d0
|
||||
jeq .L15
|
||||
move.w _conductor_instructionIndex,a0
|
||||
addq.w #1,a0
|
||||
move.w a0,_conductor_instructionIndex
|
||||
moveq #0,d0
|
||||
move.w a0,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L15
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jge .L23
|
||||
.L15:
|
||||
rts
|
||||
.L28:
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_complete
|
||||
_conductor_complete:
|
||||
moveq #0,d1
|
||||
move.w _conductor_instructionIndex,d1
|
||||
move.l d1,d0
|
||||
add.l d1,d0
|
||||
add.l d0,d0
|
||||
add.l d1,d0
|
||||
add.l d0,d0
|
||||
move.l _conductor_instructions,a0
|
||||
tst.w (a0,d0.l)
|
||||
seq d0
|
||||
ext.w d0
|
||||
neg.w d0
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_setScrollTarget
|
||||
_conductor_setScrollTarget:
|
||||
move.w d0,_conductor_scrollTarget
|
||||
rts
|
||||
.lcomm _conductor_instructions,4
|
||||
.comm _conductor_instructionIndex,2
|
||||
.comm _conductor_scrollTarget,2
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
|
||||
extern uint16_t conductor_scrollTarget;
|
||||
extern uint16_t conductor_instructionIndex;
|
||||
extern int16_t game_cameraX;
|
||||
|
||||
typedef enum {
|
||||
CONDUCTOR_INSTRUCTION_END = 0,
|
||||
CONDUCTOR_INSTRUCTION_CAMERAX = 1
|
||||
} conductor_instruction_type;
|
||||
|
||||
typedef struct {
|
||||
uint16_t type;
|
||||
uint16_t cameraX;
|
||||
uint16_t argument;
|
||||
int16_t (*callback)(uint16_t arg);
|
||||
} conductor_instruction_t;
|
||||
|
||||
void
|
||||
conductor_init(conductor_instruction_t* instructions);
|
||||
|
||||
void
|
||||
conductor_process();
|
||||
|
||||
uint16_t
|
||||
conductor_complete(void);
|
||||
|
||||
|
||||
uint16_t conductor_scrollTarget;
|
||||
uint16_t conductor_instructionIndex;
|
||||
static conductor_instruction_t* conductor_instructions;
|
||||
|
||||
void
|
||||
conductor_init(conductor_instruction_t* instructions)
|
||||
{
|
||||
conductor_scrollTarget = 0;
|
||||
conductor_instructions = instructions;
|
||||
conductor_instructionIndex = 0;
|
||||
conductor_process();
|
||||
}
|
||||
|
||||
void
|
||||
conductor_process(void)
|
||||
{
|
||||
for (; conductor_instructions[conductor_instructionIndex].type != CONDUCTOR_INSTRUCTION_END; conductor_instructionIndex++) {
|
||||
conductor_instruction_t *ptr = &conductor_instructions[conductor_instructionIndex];
|
||||
if (ptr->cameraX <= game_cameraX) {
|
||||
if (!ptr->callback(ptr->argument)) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t
|
||||
conductor_complete(void)
|
||||
{
|
||||
return conductor_instructions[conductor_instructionIndex].type == CONDUCTOR_INSTRUCTION_END;
|
||||
}
|
||||
|
||||
void
|
||||
conductor_setScrollTarget(uint16_t target)
|
||||
{
|
||||
conductor_scrollTarget = target;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
#NO_APP
|
||||
.text
|
||||
.align 2
|
||||
.globl _conductor_init
|
||||
_conductor_init:
|
||||
clr.w _conductor_scrollTarget
|
||||
move.l a0,_conductor_instructions
|
||||
clr.w _conductor_instructionIndex
|
||||
tst.w (a0)
|
||||
jeq .L1
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jlt .L14
|
||||
.L9:
|
||||
move.l 6(a0),a1
|
||||
moveq #0,d0
|
||||
move.w 4(a0),d0
|
||||
jsr (a1)
|
||||
tst.w d0
|
||||
jeq .L1
|
||||
move.w _conductor_instructionIndex,a0
|
||||
addq.w #1,a0
|
||||
move.w a0,_conductor_instructionIndex
|
||||
moveq #0,d0
|
||||
move.w a0,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L1
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jge .L9
|
||||
.L1:
|
||||
rts
|
||||
.L14:
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_process
|
||||
_conductor_process:
|
||||
moveq #0,d0
|
||||
move.w _conductor_instructionIndex,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L15
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jlt .L28
|
||||
.L23:
|
||||
move.l 6(a0),a1
|
||||
moveq #0,d0
|
||||
move.w 4(a0),d0
|
||||
jsr (a1)
|
||||
tst.w d0
|
||||
jeq .L15
|
||||
move.w _conductor_instructionIndex,a0
|
||||
addq.w #1,a0
|
||||
move.w a0,_conductor_instructionIndex
|
||||
moveq #0,d0
|
||||
move.w a0,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L15
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jge .L23
|
||||
.L15:
|
||||
rts
|
||||
.L28:
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_complete
|
||||
_conductor_complete:
|
||||
moveq #0,d1
|
||||
move.w _conductor_instructionIndex,d1
|
||||
move.l d1,d0
|
||||
add.l d1,d0
|
||||
add.l d0,d0
|
||||
add.l d1,d0
|
||||
add.l d0,d0
|
||||
move.l _conductor_instructions,a0
|
||||
tst.w (a0,d0.l)
|
||||
seq d0
|
||||
ext.w d0
|
||||
neg.w d0
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_setScrollTarget
|
||||
_conductor_setScrollTarget:
|
||||
move.w d0,_conductor_scrollTarget
|
||||
rts
|
||||
.lcomm _conductor_instructions,4
|
||||
.comm _conductor_instructionIndex,2
|
||||
.comm _conductor_scrollTarget,2
|
||||
@@ -0,0 +1,115 @@
|
||||
#NO_APP
|
||||
.text
|
||||
.align 2
|
||||
.globl _conductor_init
|
||||
_conductor_init:
|
||||
clr.w _conductor_scrollTarget
|
||||
move.l a0,_conductor_instructions
|
||||
clr.w _conductor_instructionIndex
|
||||
tst.w (a0)
|
||||
jeq .L1
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jlt .L14
|
||||
.L9:
|
||||
move.l 6(a0),a1
|
||||
moveq #0,d0
|
||||
move.w 4(a0),d0
|
||||
jsr (a1)
|
||||
tst.w d0
|
||||
jeq .L1
|
||||
move.w _conductor_instructionIndex,a0
|
||||
addq.w #1,a0
|
||||
move.w a0,_conductor_instructionIndex
|
||||
moveq #0,d0
|
||||
move.w a0,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L1
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jge .L9
|
||||
.L1:
|
||||
rts
|
||||
.L14:
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_process
|
||||
_conductor_process:
|
||||
moveq #0,d0
|
||||
move.w _conductor_instructionIndex,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L15
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jlt .L28
|
||||
.L23:
|
||||
move.l 6(a0),a1
|
||||
moveq #0,d0
|
||||
move.w 4(a0),d0
|
||||
jsr (a1)
|
||||
tst.w d0
|
||||
jeq .L15
|
||||
move.w _conductor_instructionIndex,a0
|
||||
addq.w #1,a0
|
||||
move.w a0,_conductor_instructionIndex
|
||||
moveq #0,d0
|
||||
move.w a0,d0
|
||||
move.l d0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l d0,a0
|
||||
add.l a0,a0
|
||||
add.l _conductor_instructions,a0
|
||||
tst.w (a0)
|
||||
jeq .L15
|
||||
moveq #0,d0
|
||||
move.w 2(a0),d0
|
||||
move.w _game_cameraX,a1
|
||||
cmp.l d0,a1
|
||||
jge .L23
|
||||
.L15:
|
||||
rts
|
||||
.L28:
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_complete
|
||||
_conductor_complete:
|
||||
moveq #0,d1
|
||||
move.w _conductor_instructionIndex,d1
|
||||
move.l d1,d0
|
||||
add.l d1,d0
|
||||
add.l d0,d0
|
||||
add.l d1,d0
|
||||
add.l d0,d0
|
||||
move.l _conductor_instructions,a0
|
||||
tst.w (a0,d0.l)
|
||||
seq d0
|
||||
ext.w d0
|
||||
neg.w d0
|
||||
rts
|
||||
.align 2
|
||||
.globl _conductor_setScrollTarget
|
||||
_conductor_setScrollTarget:
|
||||
move.w d0,_conductor_scrollTarget
|
||||
rts
|
||||
.lcomm _conductor_instructions,4
|
||||
.comm _conductor_instructionIndex,2
|
||||
.comm _conductor_scrollTarget,2
|
||||
Reference in New Issue
Block a user