diff --git a/sw/.gitignore b/sw/.gitignore new file mode 100644 index 0000000..c6127b3 --- /dev/null +++ b/sw/.gitignore @@ -0,0 +1,52 @@ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf diff --git a/sw/Makefile b/sw/Makefile new file mode 100644 index 0000000..85f9116 --- /dev/null +++ b/sw/Makefile @@ -0,0 +1,27 @@ +CC=cl65 +CFLAGS=-t none +LDFLAGS=-C link.ld + +NAME=main + +BIN=$(NAME).bin +HEX=$(NAME).hex + +SRCS=$(wildcard *.S) $(wildcard *.c) +OBJS+=$(patsubst %.S,%.o,$(filter %S,$(SRCS))) +OBJS+=$(patsubst %.c,%.o,$(filter %c,$(SRCS))) + +all: $(BIN) + objcopy --input-target=binary --output-target=ihex $(BIN) $(HEX) + + +$(BIN): $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + rm -rf $(OBJS) $(BIN) $(HEX) + diff --git a/sw/link.ld b/sw/link.ld new file mode 100644 index 0000000..f4ca7d7 --- /dev/null +++ b/sw/link.ld @@ -0,0 +1,10 @@ +MEMORY +{ + ROM: start=$8000, size=$8000, type=ro, define=yes, fill=yes, file=%O; +} + +SEGMENTS +{ + CODE: load=ROM, type=ro; + VECTORS: load=ROM, type=ro, offset=$7ffa; +} diff --git a/sw/main.S b/sw/main.S new file mode 100644 index 0000000..6a0ecb8 --- /dev/null +++ b/sw/main.S @@ -0,0 +1,10 @@ + .setcpu "6502" + .segment "VECTORS" + + .word loop + .word loop + .word loop + + .code +loop: lda #$12 + jmp loop