3static double test_fp_6502_add_op(
Environment * _environment,
double _first,
double _second ) {
7 sprintf( asmFileName,
"%s.asm", asmFileNameRoot );
9 _environment->
asmFile = fopen( asmFileName,
"wt");
10 deploy( vars, src_hw_atari_vars_asm);
12 deploy( startup, src_hw_atari_startup_asm);
43 outline0(
"FP1X: .byte $0, $0, $0, $0" );
47 v->
name = strdup(
"FP1X" );
49 fclose( _environment->
asmFile );
51 remove( asmFileName );
61 double result = test_fp_6502_add_op( environment, _first, _second );
63 if ( (result - _expected) < 0.01 ) {
66 printf(
"\n %f + %f = %f ... FAILED!", _first, _second, _expected );
67 printf(
" got: %f !\n", result);
72static double test_fp_6502_sub_op(
Environment * _environment,
double _first,
double _second ) {
76 sprintf( asmFileName,
"%s.asm", asmFileNameRoot );
78 _environment->
asmFile = fopen( asmFileName,
"wt");
79 deploy( vars, src_hw_atari_vars_asm);
81 deploy( startup, src_hw_atari_startup_asm);
100 outline1(
"LDA #$%2.2x", result[3] );
112 outline0(
"FP1X: .byte $0, $0, $0, $0" );
116 v->
name = strdup(
"FP1X" );
118 fclose( _environment->
asmFile );
120 remove( asmFileName );
131 double result = test_fp_6502_sub_op( environment, _first, _second );
133 if ( (result - _expected) < 0.01 ) {
136 printf(
"\n %f - %f = %f ... FAILED!", _first, _second, _expected );
137 printf(
" got: %f !\n", result);
void cpu_float_single_from_double_to_int_array(Environment *_environment, double _value, int _result[])
unsigned char src_hw_6502_fp_routines_asm[]
char * get_temporary_filename(Environment *_environment)
void buffered_output(Environment *_environment, FILE *_stream)
void setup_text_variables(Environment *_environment)
void test_fp_6502_add(Environment *_environment, double _first, double _second, double _expected)
void test_fp_6502_sub(Environment *_environment, double _first, double _second, double _expected)
void execute6502(Environment *_environment, char *_asm_filename, Variable *_variable)
#define MAX_TEMPORARY_STORAGE
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.