-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#MAKEFLAGS= -j8 | ||
|
||
CC65_HOME = E:/devtools/cc65 | ||
SYS = nes | ||
|
||
croper = $(CC65_HOME)/bin/croper | ||
CL = $(CC65_HOME)/bin/cl65 | ||
CC = $(CC65_HOME)/bin/cc65 | ||
AS = $(CC65_HOME)/bin/ca65 | ||
LD = $(CC65_HOME)/bin/ld65 | ||
|
||
INC = $(CC65_HOME)/include | ||
ASMINC = $(CC65_HOME)/asminc | ||
# This one comes with VICE | ||
|
||
# --static-locals | ||
CFLAGS := -O | ||
AFLAGS := -t $(SYS) | ||
BDIR :=build | ||
|
||
vpath %.o $(BDIR)/ | ||
|
||
|
||
SRC_S := crt0.s everdrive_asm.s | ||
SRC_C := $(wildcard *.c) | ||
#SRC_C := $(filter-out app-%.c, $(SRC_C)) | ||
|
||
OBJ = $(SRC_S:.s=.o) | ||
OBJ += $(SRC_C:.c=.o) | ||
OFILES = $(OBJ:%.o=$(BDIR)/%.o) | ||
|
||
# -------------------------------------------------------------------------- | ||
all: $(OBJ) | ||
$(LD) -C nes.cfg -o edio-n8.nes $(OFILES) nes.lib -m $(BDIR)/mem.map | ||
|
||
|
||
%.o: %.s | ||
$(AS) $(AFLAGS) -o $(basename $(BDIR)/$<).o $< | ||
|
||
%.o: %.c | ||
$(CC) $(CFLAGS) -o $(basename $(BDIR)/$<).s $< | ||
$(AS) $(AFLAGS) $(basename $(BDIR)/$<).s | ||
|
||
|
||
|
||
clean: | ||
$(RM) $(BDIR)/*.o | ||
$(RM) $(BDIR)/*.s | ||
$(RM) $(APDIR)/*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
|
||
NES_MAPPER = 0;mapper number | ||
NES_PRG_BANKS = 2;number of 16K PRG banks, change to 2 for NROM256 | ||
NES_CHR_BANKS = 1;number of 8K CHR banks | ||
NES_MIRRORING = 1;0 horizontal, 1 vertical, 8 four screen | ||
|
||
PPU_CTRL =$2000 | ||
PPU_MASK =$2001 | ||
PPU_STATUS =$2002 | ||
PPU_OAM_ADDR =$2003 | ||
PPU_OAM_DATA =$2004 | ||
PPU_SCROLL =$2005 | ||
PPU_ADDR =$2006 | ||
PPU_DATA =$2007 | ||
PPU_OAM_DMA =$4014 | ||
PPU_FRAMECNT =$4017 | ||
DMC_FREQ =$4010 | ||
CTRL_PORT1 =$4016 | ||
CTRL_PORT2 =$4017 | ||
|
||
OS_ZRAM = $90 | ||
GFX_PTR = OS_ZRAM+2 | ||
PRG_PTR = OS_ZRAM+4 | ||
CTR1 = OS_ZRAM+6 | ||
CTR2 = OS_ZRAM+7 | ||
|
||
|
||
.define cmd_addr1 $4400 | ||
.define cmd_data1 $4401 | ||
.define cmd_addr2 $4402 | ||
.define cmd_data2 $4403 | ||
|
||
.define reg_spi 0 | ||
.define reg_usb 1 | ||
.define reg_cfg 2 | ||
.define reg_state 3 | ||
.define reg_key 4 | ||
.define reg_fpga 5 | ||
.define reg_fpga_nc 6 | ||
.define reg_map 7 | ||
.define reg_bios_cfg 9 | ||
|
||
.define freg_srm_map 129 | ||
|
||
.define srm_bank_os 7 | ||
.define srm_bank_tileset 8 | ||
|
||
.export start,__STARTUP__:absolute=1 | ||
.import __RAM_START__ ,__RAM_SIZE__ | ||
.import __ROM0_START__ ,__ROM0_SIZE__ | ||
.import __STARTUP_LOAD__,__STARTUP_RUN__,__STARTUP_SIZE__ | ||
.import __CODE_LOAD__ ,__CODE_RUN__ ,__CODE_SIZE__ | ||
.import __RODATA_LOAD__ ,__RODATA_RUN__ ,__RODATA_SIZE__ | ||
|
||
FT_BASE_ADR = $0100;page in RAM, should be $xx00 | ||
.include "zeropage.inc" | ||
.import initlib, push0, popa, popax, _main, zerobss, copydata | ||
.import _main | ||
|
||
.segment "HEADER" | ||
|
||
.byte $4e,$45,$53,$1a | ||
.byte NES_PRG_BANKS | ||
.byte NES_CHR_BANKS | ||
.byte NES_MIRRORING|((NES_MAPPER & 15)<<4) | ||
.byte NES_MAPPER&$f0 | ||
.res 8,0 | ||
|
||
.segment "STARTUP" | ||
start: | ||
|
||
sei | ||
ldx #$ff | ||
txs | ||
|
||
lda #0 | ||
sta $5100 | ||
|
||
ldx #0 | ||
stx PPU_MASK | ||
stx PPU_CTRL | ||
|
||
ldy #0 | ||
lda #0 | ||
clram: | ||
sta $0000, y | ||
sta $0100, y | ||
sta $0200, y | ||
sta $0300, y | ||
sta $0400, y | ||
sta $0500, y | ||
sta $0600, y | ||
sta $0700, y | ||
iny | ||
bne clram | ||
|
||
|
||
jsr zerobss | ||
jsr copydata | ||
|
||
lda #<(__RAM_START__+__RAM_SIZE__) | ||
sta sp | ||
lda #>(__RAM_START__+__RAM_SIZE__) | ||
sta sp+1 ; Set argument stack ptr | ||
|
||
jsr initlib | ||
|
||
jmp _main | ||
|
||
|
||
nmi: | ||
rti | ||
irq: | ||
rti | ||
|
||
.segment "VECTORS" | ||
|
||
.word nmi ;$fffa vblank nmi | ||
.word start ;$fffc reset | ||
.word irq ;$fffe irq / brk | ||
|
||
.segment "CHARS" | ||
.incbin "font.chr" |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* File: errors.h | ||
* Author: igor | ||
* | ||
* Created on April 4, 2019, 12:37 AM | ||
*/ | ||
|
||
#ifndef ERRORS_H | ||
#define ERRORS_H | ||
|
||
//****************************************************************************** | ||
#define ERR_UNXP_STAT 0x40 | ||
#define ERR_UNK_ROM_FORMAT 0x41 | ||
#define ERR_PATH_SIZE 0x42 | ||
#define ERR_NAME_SIZE 0x43 | ||
#define ERR_OUT_OF_MEMORY 0x44 | ||
#define ERR_GAME_NOT_SEL 0x45 | ||
#define ERR_REGI_CRC 0x46 | ||
#define ERR_MAP_NOT_SUPP 0x47 | ||
#define ERR_MAP_NOT_FOUND 0x48 | ||
#define ERR_INCORRECT_GG 0x49 | ||
#define ERR_NULL_PATH 0x4A | ||
#define ERR_USB_GAME 0x4B | ||
#define ERR_FDS_SIZE 0x4C | ||
#define ERR_BAT_RDY 0x4D | ||
#define ERR_BAD_NSF 0x4E | ||
#define ERR_BAD_FILE 0x4F | ||
#define ERR_ROM_SIZE 0x50 | ||
#define ERR_FBUFF_SIZE 0x51 | ||
#define ERR_NO_REST_POINT 0x52 | ||
|
||
|
||
//mcu errors | ||
#define ERR_EFU_BAD_FILE 0x70 | ||
#define ERR_EFU_NO_FILE 0x71 | ||
|
||
#define ERR_STR_SIZE 0x80 | ||
#define ERR_OUT_OF_DIR 0x81 | ||
#define ERR_OUT_OF_PAGE 0x82 | ||
#define ERR_BOOT_FAULT 0x83 | ||
#define ERR_FPGA_INIT 0x84 | ||
#define ERR_SPI_STATE 0x85 | ||
|
||
#define ERR_LINK_TOUT 0x86 | ||
#define ERR_UPD_SIZE 0x87 | ||
#define ERR_UPD_SAME 0x88 | ||
#define ERR_UPD_CORUPT 0x89 | ||
#define ERR_UPD_BT_CRC 0x8A | ||
#define ERR_UPD_VERIFY 0x8B | ||
#define ERR_WDG_TOUT 0x8C | ||
#define ERR_SIG_NBLA 0x8D | ||
|
||
#define DISK_ERR_INIT 0xC0 //0xCx disk init errors | ||
#define DISK_ERR_IO 0xD0 //0xDx disk io errors | ||
#define DISK_ERR_RD1 0xD0 | ||
#define DISK_ERR_RD2 0xD1 | ||
#define DISK_ERR_RD3 0xD2 | ||
#define DISK_ERR_RD4 0xD3 | ||
|
||
#define DISK_ERR_WR1 0xD4 | ||
#define DISK_ERR_WR2 0xD5 | ||
#define DISK_ERR_WR3 0xD6 | ||
#define DISK_ERR_WR4 0xD7 | ||
#define DISK_ERR_WR5 0xD8 | ||
|
||
#define DISK_ERR_CTO 0xD9//cmd timeout | ||
#define DISK_ERR_CCR 0xDA//cmd crc error | ||
|
||
#define FAT_DISK_ERR 0x01 | ||
#define FAT_NOT_READY 0x03 | ||
#define FAT_NO_FILE 0x04 | ||
#define FAT_NO_PATH 0x05 | ||
#define FAT_NO_FS 0x0D | ||
|
||
|
||
#endif /* ERRORS_H */ |
Oops, something went wrong.