home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
RiscOS
/
APP
/
DEVS
/
FORTH
/
BEETLE
/
BEETLE.ZIP
/
Beetle
/
runt.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-22
|
1KB
|
64 lines
/* RUNT.C
Vrsn Date Comment
----|-------|---------------------------------------------------------------
0.00 24mar95
Reuben Thomas
Test that run works, and that the return value of the HALT instruction is
correctly returned.
*/
#include <stdio.h>
#include <stdlib.h>
#include "beetle.h" /* main header */
#include "btests.h" /* Beetle tests header */
#include "opcodes.h" /* opcode enumeration */
#include "debug.h" /* debugging functions */
int main(void)
{
int i;
CELL ret;
i = init_beetle((BYTE *)malloc(1024), 256, 16);
if (i != 0) {
printf("Error in RunT: init_beetle with valid parameters failed\n");
exit(1);
}
for (i = 0; i < 1024; i++) M0[i] = 0;
here = (CELL *)(M0 + 52);
start_ass();
ass(O_LITERALI); ilit(37);
ass(O_HALT);
end_ass();
NEXT;
ret = run();
#ifdef B_DEBUG
printf("Return value should be 37 and is %ld\n", ret);
#endif
if (ret != 37) {
printf("Error in RunT: incorrect return value from run\n");
exit(1);
}
#ifdef B_DEBUG
printf("EP should now be 56\n");
#endif
if (val_EP() != 60) {
printf("Error in RunT: EP = %ld\n", val_EP());
exit(1);
}
printf("RunT ran OK\n");
return 0;
}