forked from pfaure/CrossAssembleur
CrossAssembler OKKKKKKKKKKKKKK
This commit is contained in:
parent
1cb970ec2d
commit
85452d879d
11 changed files with 309 additions and 367 deletions
15
as.tab.h
15
as.tab.h
|
@ -1,9 +1,8 @@
|
|||
/* A Bison parser, made by GNU Bison 3.5.1. */
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
|
||||
Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,9 +30,6 @@
|
|||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Undocumented macros, especially those whose name start with YY_,
|
||||
are private implementation details. Do not rely on them. */
|
||||
|
||||
#ifndef YY_YY_AS_TAB_H_INCLUDED
|
||||
# define YY_YY_AS_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
|
@ -74,15 +70,16 @@ extern int yydebug;
|
|||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 1 "as.y"
|
||||
#line 1 "as.y" /* yacc.c:1909 */
|
||||
|
||||
int nombre;
|
||||
|
||||
#line 84 "as.tab.h"
|
||||
|
||||
#line 81 "as.tab.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
|
BIN
as.tab.o
BIN
as.tab.o
Binary file not shown.
1
as.y
1
as.y
|
@ -91,6 +91,7 @@ Instruction : tAFCA tNB tNB {increment_time();
|
|||
int reg_aux = get_reg_write(-1, &added_instruction);
|
||||
add_instruction(AFC, reg_aux, $3, 0);
|
||||
add_instruction(STOREA, $2, reg_aux, 0);
|
||||
unlink($2);
|
||||
new_instruction(added_instruction + 2);};
|
||||
|
||||
|
||||
|
|
BIN
lex.yy.o
BIN
lex.yy.o
Binary file not shown.
|
@ -1 +1 @@
|
|||
"00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "10101000000000000000000000000" & "10001000000110000000000000000" & "01101000000110000001100000000" & "00001000000110000000000000011" & "00010000000110000000100000011" & "01001000000010000000100000000" & "01110000001010000000100000000" & "01001000000010000000000000000" & "01011000001100000000100000000" & "01001000000110000000000000000" & "01100000000100000000000000000" & "01001000000000000110000000000" & "01011000000100000000000000000" & "00001000000100000001100000010" & "00010000000100000000100000010" & "01001000000010000000100000000" & "01110000001000000000100000000" & "01001000000010000000000000000" & "01011000001010000000100000000" & "01001000000100000000100000000" & "01100000000000000001100000000" & "01001000000110000000100000000" & "00001000000000000001000000000" & "01010000000100000001100000000" & "00010000000000000000100000000" & "01001000000010000000100000000" & "01110000000110000000100000000" & "01001000000010000000000000000" & "01001000000000000000000000000" & "01111000000010000000000000000" &
|
||||
"00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "00000000000000000000000000000" & "10101000000000000000000000000" & "10001000000000000000000000000" & "01100000000000000000000000000" & "00001000000000000001000000000" & "01010000000100000010100000000" & "00010000000000000000100000000" & "01001000000010000000100000000" & "01110000001010000000100000000" & "01001000000010000000000000000" & "01001000000000000000000000000" & "10011000101110000010000000000" & "01011000001010000001100000000" & "01011000000110000001000000000" & "01110000001000000000100000000" & "01001000000010000000000000000" & "01011000001100000000100000000" & "01101000000100000001100000000" & "01001000000110000110000000000" & "00001000000100000000000000010" & "01010000000000000010000000000" & "01011000000100000000000000000" & "00010000000100000000100000010" & "01001000000010000000100000000" & "01110000001000000000100000000" & "01001000000010000000000000000" & "01011000001010000000100000000" & "01001000000100000000100000000" & "01101000000000000001100000000" & "01001000000110000000100000000" & "00001000000000000001000000000" & "01010000000100000001100000000" & "00010000000000000000100000000" & "01001000000010000000100000000" & "01110000000110000000100000000" & "01001000000010000000000000000" & "01001000000000000000000000000" & "10100000000000000000000000000" & "01011000000010000000000000000" & "01011000000000000000100000000" & "01000000000010000000000000000" & "01001000000000000000100000000" & "10011000000010000000100000000" & "01011000000110000001100000000" & "01011000000100000001000000000" & "01011000000010000000000000000" & "01000000000000000000100000000" & "01101000000000000001000000000" & "01001000000100000101000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01001000000000000000100000000" & "10001000000000000000000000000" & "01100000000000000000000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01010000000010000000000000000" & "01001000000000000000000000000" & "10100000000000000000000000000" & "01011000000110000001100000000" & "01011000000100000001000000000" & "01011000000010000000000000000" & "01011000000000000000100000000" & "01000000000010000000000000000" & "01001000000000000001000000000" & "01101000000000000001000000000" & "01001000000100000111000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01001000000000000000000000000" & "10001000000000000000000000000" & "01100000000000000000000000000" & "00001000000000000001000000000" & "00010000000000000001100000000" & "01001000000110000000100000000" & "01000000000100000000100000000" & "01010000000010000000000000000" & "01001000000000000000100000000" & "01111001100000000000000000000" &
|
Binary file not shown.
3
tables.c
3
tables.c
|
@ -282,6 +282,9 @@ int get_reg_read(int adresse, int * added_instruction) {
|
|||
}
|
||||
}
|
||||
|
||||
void unlink(int adresse) {
|
||||
set_registre(adresse, -1);
|
||||
}
|
||||
|
||||
int flush_and_init() {
|
||||
int i;
|
||||
|
|
1
tables.h
1
tables.h
|
@ -25,6 +25,7 @@ void print();
|
|||
void increment_time();
|
||||
int get_reg_read(int adresse, int * added_instruction);
|
||||
int get_reg_write(int adresse, int * added_instruction);
|
||||
void unlink(int adresse);
|
||||
int flush_and_init();
|
||||
void new_instruction(int nb_inst);
|
||||
void write_asm(FILE * file);
|
||||
|
|
BIN
tables.o
BIN
tables.o
Binary file not shown.
41
toto.asm
41
toto.asm
|
@ -1,4 +1,40 @@
|
|||
JMP 1
|
||||
JMP 37
|
||||
AFC 1 1
|
||||
COP 2 0
|
||||
AFC 3 1
|
||||
MUL 1 3 1
|
||||
ADD 1 2 1
|
||||
READ 1 1
|
||||
PRI 1
|
||||
AFC 1 0
|
||||
COP 2 0
|
||||
AFC 3 1
|
||||
MUL 1 3 1
|
||||
ADD 1 2 1
|
||||
AFC 2 14
|
||||
WR 1 2
|
||||
AFC 1 2
|
||||
COP 0 1
|
||||
RET
|
||||
AFC 1 0
|
||||
COP 2 0
|
||||
AFC 3 1
|
||||
MUL 1 3 1
|
||||
ADD 1 2 1
|
||||
READ 1 1
|
||||
PRI 1
|
||||
AFC 1 1
|
||||
COP 2 0
|
||||
AFC 3 1
|
||||
MUL 1 3 1
|
||||
ADD 1 2 1
|
||||
AFC 2 10
|
||||
WR 1 2
|
||||
COP 1 0
|
||||
CALL 1 1
|
||||
AFC 1 1
|
||||
COP 0 1
|
||||
RET
|
||||
AFC 2 0
|
||||
AFCA 3 0
|
||||
AFC 5 1
|
||||
|
@ -13,6 +49,8 @@ MUL 3 6 3
|
|||
ADD 3 4 3
|
||||
AFC 5 12
|
||||
WR 3 5
|
||||
AFCA 4 0
|
||||
CALL 18 4
|
||||
AFC 4 0
|
||||
AFCA 5 0
|
||||
AFC 6 1
|
||||
|
@ -21,3 +59,4 @@ ADD 4 5 4
|
|||
READ 4 4
|
||||
PRI 4
|
||||
STOP 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue