Add test code and top level Makefile
This commit is contained in:
39
sw/test_code/loop_test/Makefile
Normal file
39
sw/test_code/loop_test/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
CC=../../toolchain/cc65/bin/cl65
|
||||
LD=../../toolchain/cc65/bin/cl65
|
||||
CFLAGS=-T -t none -I. --cpu "65C02"
|
||||
LDFLAGS=-C link.ld -m $(NAME).map
|
||||
|
||||
NAME=loop_test
|
||||
|
||||
BIN=$(NAME).bin
|
||||
HEX=$(NAME).hex
|
||||
|
||||
LISTS=lists
|
||||
|
||||
SRCS=$(wildcard *.s) $(wildcard *.c)
|
||||
SRCS+=$(wildcard **/*.s) $(wildcard **/*.c)
|
||||
OBJS+=$(patsubst %.s,%.o,$(filter %s,$(SRCS)))
|
||||
OBJS+=$(patsubst %.c,%.o,$(filter %c,$(SRCS)))
|
||||
|
||||
# Make sure the kernel linked to correct address, no relocation!
|
||||
all: $(HEX)
|
||||
|
||||
$(HEX): $(BIN)
|
||||
objcopy --input-target=binary --output-target=verilog $(BIN) $(HEX)
|
||||
|
||||
$(BIN): $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
|
||||
|
||||
%.o: %.c $(LISTS)
|
||||
$(CC) $(CFLAGS) -l $(LISTS)/$<.list -c $< -o $@
|
||||
|
||||
%.o: %.s $(LISTS)
|
||||
$(CC) $(CFLAGS) -l $(LISTS)/$<.list -c $< -o $@
|
||||
|
||||
$(LISTS):
|
||||
mkdir -p $(addprefix $(LISTS)/,$(sort $(dir $(SRCS))))
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(OBJS) $(BIN) $(HEX) $(LISTS) $(NAME).map
|
||||
|
||||
30
sw/test_code/loop_test/link.ld
Normal file
30
sw/test_code/loop_test/link.ld
Normal file
@@ -0,0 +1,30 @@
|
||||
MEMORY
|
||||
{
|
||||
RAM: start = $0000, size = $200;
|
||||
ROM: start = $FF00, size = $100, file = %O;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = RAM, type = zp, define = yes;
|
||||
DATA: load = ROM, type = rw, define = yes;
|
||||
CODE: load = ROM, type = ro;
|
||||
RODATA: load = ROM, type = ro;
|
||||
VECTORS: load = ROM, type = ro, start = $FFFA;
|
||||
}
|
||||
|
||||
FEATURES {
|
||||
CONDES: segment = STARTUP,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = STARTUP,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
}
|
||||
|
||||
SYMBOLS {
|
||||
# Define the stack size for the application
|
||||
__STACKSIZE__: value = $0200, type = weak;
|
||||
__STACKSTART__: type = weak, value = $0800; # 2k stack
|
||||
}
|
||||
31
sw/test_code/loop_test/lists/main.s.list
Normal file
31
sw/test_code/loop_test/lists/main.s.list
Normal file
@@ -0,0 +1,31 @@
|
||||
ca65 V2.19 - Git 71b58f796
|
||||
Main file : main.s
|
||||
Current file: main.s
|
||||
|
||||
000000r 1 .export _init, _nmi_int, _irq_int
|
||||
000000r 1
|
||||
000000r 1
|
||||
000000r 1 SDRAM = $200
|
||||
000000r 1
|
||||
000000r 1 .segment "VECTORS"
|
||||
000000r 1
|
||||
000000r 1 rr rr .addr _nmi_int ; NMI vector
|
||||
000002r 1 rr rr .addr _init ; Reset vector
|
||||
000004r 1 rr rr .addr _irq_int ; IRQ/BRK vector
|
||||
000006r 1
|
||||
000006r 1 .code
|
||||
000000r 1
|
||||
000000r 1 _nmi_int:
|
||||
000000r 1 _irq_int:
|
||||
000000r 1
|
||||
000000r 1 _init:
|
||||
000000r 1 A9 00 lda #$00
|
||||
000002r 1 @start:
|
||||
000002r 1 8D 00 02 sta SDRAM
|
||||
000005r 1 CD 00 02 cmp SDRAM
|
||||
000008r 1 D0 03 bne @end
|
||||
00000Ar 1 1A ina
|
||||
00000Br 1 80 F5 bra @start
|
||||
00000Dr 1
|
||||
00000Dr 1 80 FE @end: bra @end
|
||||
00000Dr 1
|
||||
BIN
sw/test_code/loop_test/loop_test.bin
Normal file
BIN
sw/test_code/loop_test/loop_test.bin
Normal file
Binary file not shown.
28
sw/test_code/loop_test/loop_test.map
Normal file
28
sw/test_code/loop_test/loop_test.map
Normal file
@@ -0,0 +1,28 @@
|
||||
Modules list:
|
||||
-------------
|
||||
main.o:
|
||||
CODE Offs=000000 Size=00000F Align=00001 Fill=0000
|
||||
VECTORS Offs=000000 Size=000006 Align=00001 Fill=0000
|
||||
|
||||
|
||||
Segment list:
|
||||
-------------
|
||||
Name Start End Size Align
|
||||
----------------------------------------------------
|
||||
CODE 00FF00 00FF0E 00000F 00001
|
||||
VECTORS 00FFFA 00FFFF 000006 00001
|
||||
|
||||
|
||||
Exports list by name:
|
||||
---------------------
|
||||
|
||||
|
||||
|
||||
Exports list by value:
|
||||
----------------------
|
||||
|
||||
|
||||
|
||||
Imports list:
|
||||
-------------
|
||||
|
||||
BIN
sw/test_code/loop_test/main.o
Normal file
BIN
sw/test_code/loop_test/main.o
Normal file
Binary file not shown.
26
sw/test_code/loop_test/main.s
Normal file
26
sw/test_code/loop_test/main.s
Normal file
@@ -0,0 +1,26 @@
|
||||
.export _init, _nmi_int, _irq_int
|
||||
|
||||
.segment "VECTORS"
|
||||
|
||||
.addr _nmi_int ; NMI vector
|
||||
.addr _init ; Reset vector
|
||||
.addr _irq_int ; IRQ/BRK vector
|
||||
|
||||
.zeropage
|
||||
tmp: .res 1
|
||||
|
||||
.code
|
||||
|
||||
_nmi_int:
|
||||
_irq_int:
|
||||
|
||||
_init:
|
||||
lda #$00
|
||||
@start:
|
||||
sta tmp
|
||||
cmp tmp
|
||||
bne @end
|
||||
ina
|
||||
bra @start
|
||||
|
||||
@end: bra @end
|
||||
1
sw/toolchain/cc65
Submodule
1
sw/toolchain/cc65
Submodule
Submodule sw/toolchain/cc65 added at 71b58f7967
Reference in New Issue
Block a user