Skip to content

Commit

Permalink
Merge pull request #13 from FluBBaOfWard/master
Browse files Browse the repository at this point in the history
Renamed a couple of labels, changed all "mov pc,reg" to "bx reg".
  • Loading branch information
NightScript370 authored May 23, 2024
2 parents 83ee790 + 26e8e72 commit a55cf9d
Show file tree
Hide file tree
Showing 98 changed files with 2,059 additions and 1,936 deletions.
4 changes: 2 additions & 2 deletions NOTES.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ IPC 27fff00 -> 2800000 (uncached)
scratch memory is (Image$$EWRAM$$ZI$$Limit -> 23f8000), used for file list storage, rom storage, game recording

other ptrs:
rombase = Image$$EWRAM$$ZI$$Limit
romBase = Image$$EWRAM$$ZI$$Limit
freemem_start = end of rom
freemem_end=23f8000
(all of freemem_start -> end is used for recording)
Expand All @@ -43,4 +43,4 @@ H=SUB BG 6200000-6207fff
I

6000000-605e000 MAIN CHR (#? chr banks)
605e000 MAIN SCR
605e000 MAIN SCR
6 changes: 3 additions & 3 deletions README.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dswifix(which is for nifi) src is added.
Mapper240 added.
fixed the tmpfile.
DPCM weakened, sounds better?
A bug with ppustat fixed. e.g.'teenage mutant ninja turtles'
A bug with ppuStat fixed. e.g.'teenage mutant ninja turtles'
A bug with palette fixed.
Patch update. Battleloads (Europe) <Double Dragons> added.
SRAM can be saved whatever a game supports.
Expand Down Expand Up @@ -452,7 +452,7 @@ IPC 27fff00 -> 2800000 (uncached)
scratch memory is (Image$$EWRAM$$ZI$$Limit -> 23f8000), used for file list storage, rom storage, game recording

other ptrs:
rombase = Image$$EWRAM$$ZI$$Limit
romBase = Image$$EWRAM$$ZI$$Limit
freemem_start = end of rom
freemem_end=23f8000
(all of freemem_start -> end is used for recording)
Expand All @@ -470,4 +470,4 @@ H=SUB BG 6200000-6207fff
I

6000000-605e000 MAIN CHR (#? chr banks)
605e000 MAIN SCR
605e000 MAIN SCR
2 changes: 1 addition & 1 deletion arm7/source/s_apu.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static const Uint32 spd_limit_table[8] =
0x787, 0x7C1, 0x7E0, 0x7F0,
};

static Uint32 dpcm_freq_table[16] =
static const Uint32 dpcm_freq_table[16] =
{
428, 380, 340, 320,
286, 254, 226, 214,
Expand Down
6 changes: 3 additions & 3 deletions arm9/include/6502mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ N = 0x80

.macro encodePC @translate from 6502 PC to rom offset
and r1,m6502_pc,#0xE000
adr_ r2,memmap_tbl
adr_ r2,m6502ReadTbl
ldr r0,[r2,r1,lsr#11]
str_ r0,lastbank
str_ r0,m6502LastBank
add m6502_pc,m6502_pc,r0
.endm

Expand Down Expand Up @@ -127,7 +127,7 @@ N = 0x80

.macro writememabs
and r1,addy,#0xe000
adr_ r2,writemem_tbl
adr_ r2,m6502WriteTbl
adr lr,0f
ldr pc,[r2,r1,lsr#11] @in: addy,r0=val(bits 8-31=?)
0: @out: r0,r1,r2,addy=?
Expand Down
104 changes: 49 additions & 55 deletions arm9/include/equates.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,21 @@ KEY_Y = 2048
KEY_TOUCH = 4096

@DMA buffers go in high RAM - stay below 27ffc00 (firmware settings)
.global nes_region
.global ct_buffer

DISPCNTBUFF = ct_buffer
BGCNTBUFF = DISPCNTBUFF + 512*4 @size is 240*16
BGCNTBUFFB = BGCNTBUFF + 256 * 16

@miscellaneous stuff

NES_RAM = nes_region @keep $400 byte aligned for 6502 stack
NES_SRAM = NES_RAM+0x0800 @***!!! also in c_defs.h
NES_VRAM = NES_SRAM+0x2000
NES_XRAM = NES_VRAM+0x3000
CHR_DECODE = NES_XRAM+0x2000
MAPPED_RGB = CHR_DECODE+0x400
NES_SPRAM = MAPPED_RGB+0x100 @mapped NES palette (for VS unisys)
MAPPED_RGB = CHR_DECODE+0x400 @mapped NES palette (for VS unisys)
NES_SPRAM = MAPPED_RGB+0x100
@? EQU MAPPED_RGB+64*3

NDS_PALETTE = 0x5000000
NDS_VRAM = 0x6000000
NDS_SRAM = 0xA000000
Expand Down Expand Up @@ -96,7 +93,7 @@ REG_BLDALPHA = 0x52

@r0,r1,r2=temp regs
m6502_nz .req r3 @bit 31=N, Z=1 if bits 0-7=0
m6502_rmem .req r4 @readmem_tbl
m6502_rmem .req r4 @m6502ReadTbl
m6502_a .req r5 @bits 0-23=0, also used to clear bytes in memory
m6502_x .req r6 @bits 0-23=0
m6502_y .req r7 @bits 0-23=0
Expand All @@ -120,70 +117,69 @@ addy .req r12 @keep this at r12 (scratch for APCS)

start_map 0,globalptr @6502.s
_m_ opz,256*4
_m_ readmem_tbl,8*4
_m_ writemem_tbl,8*4
_m_ memmap_tbl,8*4
_m_ m6502ReadTbl,8*4
_m_ m6502WriteTbl,8*4
_m_ m6502MemTbl,8*4
_m_ cpuregs,7*4
_m_ m6502_s,4
_m_ lastbank,4
_m_ m6502LastBank,4
_m_ nexttimeout,4
_m_ scanline,4
_m_ scanlinehook,4
_m_ scanlineHook,4
_m_ frame,4
_m_ cyclesperscanline,4
_m_ lastscanline,4
_m_ cyclesPerScanline,4
_m_ lastScanline,4
_m_ unused_align,4
@ppu.s
_m_ fpsvalue,4
_m_ adjustblend,4
_m_ fpsValue,4
_m_ adjustBlend,4
@ppustate:
_m_ vramaddr,4
_m_ vramaddr2,4
_m_ vramAddr,4
_m_ vramAddr2,4
_m_ scrollX,4
_m_ scrollY,4
_m_ scrollYtemp,4
_m_ sprite0y,4
_m_ readtemp,4
_m_ bg0cnt,4
_m_ readTemp,4
_m_ bg0Cnt,4
_m_ sprite0x,1
_m_ vramaddrinc,1
_m_ ppustat,1
_m_ vramAddrInc,1
_m_ ppuStat,1
_m_ toggle,1
_m_ ppuctrl0,1
_m_ ppuctrl0frame,1
_m_ ppuctrl1,1
_m_ ppuoamadr,1
_m_ nes_chr_map,16
_m_ ppuCtrl0,1
_m_ ppuCtrl0Frame,1
_m_ ppuCtrl1,1
_m_ ppuOamAdr,1
_m_ nesChrMap,16

_m_ vrommask,4
_m_ vrombase,4
_m_ vromMask,4
_m_ vromBase,4

@cart.s
_m_ newframehook,4
_m_ endframehook,4
_m_ hblankhook,4
_m_ ppuchrlatch,4
_m_ mapperdata,96
_m_ rombase,4

_m_ rommask,4 @ADDED
_m_ romnumber,4 @ADDED
_m_ prgsize8k,4 @ADDED
_m_ prgsize16k,4 @ADDED
_m_ prgsize32k,4 @ADDED
_m_ emuflags,4 @ADDED
_m_ newFrameHook,4
_m_ endFrameHook,4
_m_ hblankHook,4
_m_ ppuChrLatch,4
_m_ mapperData,96

_m_ romBase,4
_m_ romMask,4
_m_ prgSize8k,4
_m_ prgSize16k,4
_m_ prgSize32k,4
_m_ emuFlags,4
_m_ prgcrc,4

_m_ lighty,4
_m_ lightY,4

_m_ loopy_t,4
_m_ loopy_x,4
_m_ loopy_y,4
_m_ loopy_v,4
_m_ loopy_shift,4
_m_ bglastline, 4
_m_ rendercount, 4
_m_ tempdata, 20*4
_m_ renderCount, 4
_m_ tempData, 20*4

_m_ nsfid, 5
_m_ nsfversion, 1
Expand All @@ -206,14 +202,14 @@ _m_ nsfinit, 4
_m_ nsfsongno, 4
_m_ nsfsongmode, 4

_m_ pixstart, 4
_m_ pixend, 4
_m_ pixStart, 4
_m_ pixEnd, 4

_m_ af_st, 4 @auto fire state
_m_ af_state, 4 @auto fire state
_m_ af_start, 4 @auto fire start
_m_ palsyncline, 4

_m_ cartflags,1 @ADDED
_m_ cartFlags,1
_m_ barcode, 1
_m_ barcode_out, 1
@_m_ ,1 @align @ADDED
Expand All @@ -228,13 +224,13 @@ P2_ENABLE = 0x20000
B_A_SWAP = 0x80000
L_R_DISABLE = 0x100000
AUTOFIRE = 0x1000000
@-----------------------cartflags
@-----------------------cartFlags
MIRROR = 0x01 @horizontal mirroring
SRAM = 0x02 @save SRAM
TRAINER = 0x04 @trainer present
SCREEN4 = 0x08 @4way screen layout
VS = 0x10 @VS unisystem
@-----------------------emuflags (keep c_defs.h updated)
@-----------------------emuFlags (keep c_defs.h updated)

NOFLICKER = 1 @flags&3: 0=flicker 1=noflicker 2=alphalerp
ALPHALERP = 2
Expand All @@ -257,12 +253,10 @@ REWIND = 0x40000
ALLPIXELON = 0x80000
NSFFILE = 0x100000
DISKBIOS = 0x200000
@? EQU 64
@? EQU 128


@------------------------multi-players
@in everyframe, 64bit sould be transfered. 32bit = IPC_KEYS, 32bit = CONTROL_BIT
@in every frame, 64bit should be transfered. 32bit = IPC_KEYS, 32bit = CONTROL_BIT

MP_KEY_MSK = 0x0CFF @not all the keys can be transfered.
MP_HOST = (1 << 31) @whether I am a host.
Expand Down
Loading

0 comments on commit a55cf9d

Please sign in to comment.