From d77453f48c9bd1a59938da815004feaf9f147d6a Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Wed, 22 May 2024 12:01:54 -0400 Subject: Switched to Native Byte Order from Big Endian --- README.md | 5 ++++- makefile | 4 ++-- qdme.c | 12 ------------ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index d7b8757..e5386d0 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,10 @@ ## Intro QDME is a simple MIPS emulator written in C. Currently the binary file must be -manually created, eventually this will change. +manually created, eventually this will change. QDME will use the native byte +order of the machine. [QDMA](https://github.com/JacobMcDonnell/QDMA), the +assembler written for this emulator, also assembles based on the host byte +order. ## Instructions |Instruction|Type|Action| diff --git a/makefile b/makefile index b021616..389b5c5 100755 --- a/makefile +++ b/makefile @@ -5,14 +5,14 @@ SRCS=qdme.c TARGET=qdme %.o: %.c %.h - $(CC) $(CFLAGS) -c $@ $< + $(CC) $(CFLAGS) -c $< all: $(TARGET) debug: $(SRCS) $(CC) $(CFLAGS) -g -o $(TARGET) $^ -mips: $(OBJS) +qdme: $(OBJS) $(CC) $(CFLAGS) -o $@ $^ clean: diff --git a/qdme.c b/qdme.c index 171bd0f..543f234 100755 --- a/qdme.c +++ b/qdme.c @@ -265,18 +265,6 @@ int LoadBinary(const char * const path) { } fclose(fp); - - /* Convert from Big Endian to Little Endian */ - uint32_t test = 10; - if (test != ntohl(test)) { - for (size_t j = 0; j < offset; j += WORD_SIZE) { - uint32_t word = 0; - memcpy(&word, memory + j, WORD_SIZE); - word = ntohl(word); - memcpy(memory + j, &word, WORD_SIZE); - } - } - return 0; } -- cgit v1.2.3