Просмотр исходного кода

Makefile improvement; remove optimizer; minor tweaks.

master
Ben Kurtovic 9 лет назад
Родитель
Сommit
dbec3feb75
7 измененных файлов: 7 добавлений и 16 удалений
  1. +3
    -2
      makefile
  2. +1
    -2
      src/assembler/directives.h
  3. +2
    -4
      src/assembler/errors.c
  4. +0
    -4
      src/assembler/preprocessor.c
  5. +0
    -1
      src/assembler/state.c
  6. +0
    -1
      src/assembler/state.h
  7. +1
    -2
      tests/_header.asm

+ 3
- 2
makefile Просмотреть файл

@@ -2,7 +2,7 @@
# Released under the terms of the MIT License. See LICENSE for details.

PROGRAM = crater
SOURCES = src src/assembler
SOURCES = src
BUILD = build
DEVEXT = -dev

@@ -15,7 +15,8 @@ RM = rm -rf

MODE = release
BNRY = $(PROGRAM)
SRCS = $(filter-out %.inc.c,$(foreach d,. $(SOURCES),$(wildcard $(addprefix $(d)/*,.c))))
SDRS = $(shell find $(SOURCES) -type d | xargs echo)
SRCS = $(filter-out %.inc.c,$(foreach d,. $(SDRS),$(wildcard $(addprefix $(d)/*,.c))))
OBJS = $(patsubst %.c,%.o,$(addprefix $(BUILD)/$(MODE)/,$(SRCS)))
DEPS = $(OBJS:%.o=%.d)
DIRS = $(sort $(dir $(OBJS)))


+ 1
- 2
src/assembler/directives.h Просмотреть файл

@@ -6,11 +6,10 @@
#include <string.h>

#define DIRECTIVE_MARKER '.'
#define NUM_DIRECTIVES 16
#define NUM_DIRECTIVES 15

#define DIR_INCLUDE ".include"

#define DIR_OPTIMIZER ".optimizer"
#define DIR_ROM_SIZE ".rom_size"
#define DIR_ROM_HEADER ".rom_header"
#define DIR_ROM_CHECKSUM ".rom_checksum"


+ 2
- 4
src/assembler/errors.c Просмотреть файл

@@ -8,9 +8,6 @@
#include "../assembler.h"
#include "../logging.h"

#define ERROR_TYPE(err_info) (asm_error_types[err_info->type])
#define ERROR_DESC(err_info) (asm_error_descs[err_info->desc])

/* Error strings */

static const char *asm_error_types[] = {
@@ -132,7 +129,8 @@ void error_info_print(const ErrorInfo *einfo, FILE *file)
{
ASMErrorLine *line = einfo->line;

fprintf(file, "error: %s: %s\n", ERROR_TYPE(einfo), ERROR_DESC(einfo));
fprintf(file, "error: %s: %s\n", asm_error_types[einfo->type],
asm_error_descs[einfo->desc]);
while (line) {
fprintf(file, "%s:%zu:\n", line->filename, line->lineno);
fprintf(file, " %.*s\n", (int) line->length, line->data);


+ 0
- 4
src/assembler/preprocessor.c Просмотреть файл

@@ -429,10 +429,6 @@ ErrorInfo* preprocess(AssemblerState *state, const LineBuffer *source)

BEGIN_DIRECTIVE_BLOCK

BEGIN_DIRECTIVE(DIR_OPTIMIZER, bool, state->optimizer, false)
USE_PARSER(bool)
END_DIRECTIVE

BEGIN_DIRECTIVE(DIR_ROM_SIZE, size_t, state->rom_size, 0)
PARSER_BRANCH(uint32_t, {}, {
USE_PARSER(uint32_t, rom_size)


+ 0
- 1
src/assembler/state.c Просмотреть файл

@@ -18,7 +18,6 @@ void state_init(AssemblerState *state)
state->header.version = 0;
state->header.region = DEFAULT_REGION;
state->header.rom_size = DEFAULT_DECLSIZE;
state->optimizer = false;
state->cross_blocks = false;
state->rom_size = 0;



+ 0
- 1
src/assembler/state.h Просмотреть файл

@@ -77,7 +77,6 @@ typedef struct {

typedef struct {
ASMHeaderInfo header;
bool optimizer;
bool cross_blocks;
size_t rom_size;
ASMLine *lines;


+ 1
- 2
tests/_header.asm Просмотреть файл

@@ -7,8 +7,6 @@
; testing suite. It sets values for the ROM header, and contains basic test
; runner code.

.optimizer off ; Generate faithful rather than fast code

.rom_size auto ; Smallest possible ROM size >= 32 KB
.rom_header auto ; Standard header location (0x7FF0)
.rom_checksum off ; Don't write a ROM checksum to the header
@@ -16,6 +14,7 @@
.rom_version 0 ; Zero version number
.rom_region "GG Export" ; Common region code for Western ROMs
.rom_declsize auto ; Set declared size to actual ROM size
.cross_blocks auto ; Do not allow data to cross between blocks

; Main routine (execution begins here)
.org $0000


Загрузка…
Отмена
Сохранить