Skip to content

Commit

Permalink
Renamed a couple of labels, changed all "mov pc,reg" to "bx reg" for …
Browse files Browse the repository at this point in the history
…consistency.
  • Loading branch information
FluBBaOfWard committed May 20, 2024
1 parent fbdfee8 commit 88c9bf2
Show file tree
Hide file tree
Showing 91 changed files with 1,360 additions and 1,382 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
4 changes: 2 additions & 2 deletions README.TXT
Original file line number Diff line number Diff line change
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
24 changes: 12 additions & 12 deletions arm9/include/equates.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ _m_ m6502_s,4
_m_ lastbank,4
_m_ nexttimeout,4
_m_ scanline,4
_m_ scanlinehook,4
_m_ scanlineHook,4
_m_ frame,4
_m_ cyclesperscanline,4
_m_ cyclesPerScanline,4
_m_ lastscanline,4
_m_ unused_align,4
@ppu.s
Expand Down Expand Up @@ -163,15 +163,15 @@ _m_ newframehook,4
_m_ endframehook,4
_m_ hblankhook,4
_m_ ppuchrlatch,4
_m_ mapperdata,96
_m_ rombase,4
_m_ mapperData,96
_m_ romBase,4

_m_ rommask,4 @ADDED
_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_ prgSize8k,4 @ADDED
_m_ prgSize16k,4 @ADDED
_m_ prgSize32k,4 @ADDED
_m_ emuFlags,4 @ADDED
_m_ prgcrc,4

_m_ lighty,4
Expand All @@ -183,7 +183,7 @@ _m_ loopy_v,4
_m_ loopy_shift,4
_m_ bglastline, 4
_m_ rendercount, 4
_m_ tempdata, 20*4
_m_ tempData, 20*4

_m_ nsfid, 5
_m_ nsfversion, 1
Expand Down Expand Up @@ -213,7 +213,7 @@ _m_ af_st, 4 @auto fire state
_m_ af_start, 4 @auto fire start
_m_ palsyncline, 4

_m_ cartflags,1 @ADDED
_m_ cartFlags,1 @ADDED
_m_ barcode, 1
_m_ barcode_out, 1
@_m_ ,1 @align @ADDED
Expand Down Expand Up @@ -262,7 +262,7 @@ DISKBIOS = 0x200000


@------------------------multi-players
@in everyframe, 64bit sould be transfered. 32bit = IPC_KEYS, 32bit = CONTROL_BIT
@in every frame, 64bit sould 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
80 changes: 40 additions & 40 deletions arm9/source/6502.s
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
.global __nsfsongno
.global __nsfsongmode

pcmirqbakup = mapperdata+24
pcmirqcount = mapperdata+28
pcmirqbakup = mapperData+24
pcmirqcount = mapperData+28
@---------------------------------------------------------------------------------
.section .itcm, "ax"
@---------------------------------------------------------------------------------
Expand Down Expand Up @@ -1039,17 +1039,17 @@ line0:
mov r0,#0
bl ppusync

ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
ldr_ r1,frame
tst r1,#1
subeq r0,r0,#CYCLE @Every other frame has 1/3 less CPU cycle.
add cycles,cycles,r0
adr r0,line1_to_119
str_ r0,nexttimeout
ldr_ pc,scanlinehook
ldr_ pc,scanlineHook
@---------------------------------------------------------------------------------
line1_to_119:
ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
add cycles,cycles,r0

ldr_ r0,scanline
Expand All @@ -1059,7 +1059,7 @@ line1_to_119:
beq line119

bl ppusync
ldr_ pc,scanlinehook
ldr_ pc,scanlineHook
@---------------------------------------------------------------------------------
line119:
bl ppusync
Expand All @@ -1069,10 +1069,10 @@ line119:

adr addy,line120_to_240
str_ addy,nexttimeout
ldr_ pc,scanlinehook
ldr_ pc,scanlineHook
@---------------------------------------------------------------------------------
line120_to_240:
ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
add cycles,cycles,r0

ldr_ r0,scanline
Expand All @@ -1084,7 +1084,7 @@ line120_to_240:
streq_ addy,nexttimeout
blne ppusync

ldr_ pc,scanlinehook
ldr_ pc,scanlineHook
@---------------------------------------------------------------------------------
line241:
NMIDELAY = CYCLE*21
Expand Down Expand Up @@ -1156,7 +1156,7 @@ NSF_Run:
ldr r2, =0x2000/4
bl filler
0:
ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
add cycles,cycles,r0, lsl#14

ldr addy, =0x4015
Expand Down Expand Up @@ -1184,33 +1184,33 @@ NSF_Run:

mov r0, #0
str_ r0, nsfinit
ldr_ pc,scanlinehook
ldr_ pc,scanlineHook

noinit:
ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
add cycles,cycles,r0, lsl#8

ldr_ r1,lastbank
sub m6502_pc,m6502_pc,r1
cmp m6502_pc, #0x4700
ldrne_ pc,scanlinehook
ldrne_ pc,scanlineHook

ldr m6502_pc, =0x4720
encodePC
ldr r0,=NES_RAM+0x100
str_ r0, m6502_s
mov m6502_a, #0
ldr_ pc,scanlinehook
ldr_ pc,scanlineHook

noplay:
ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
add cycles,cycles,r0, lsl#8

ldr m6502_pc, =0x4700
encodePC
ldr r0,=NES_RAM+0x100
str_ r0, m6502_s
ldr_ pc,scanlinehook
ldr_ pc,scanlineHook

nsf_out:
adr_ r2,cpuregs
Expand All @@ -1229,7 +1229,7 @@ EMU_Run:
ldmia r0,{m6502_nz-m6502_pc} @restore 6502 state


ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
add cycles,cycles,r0

mov r0,#241
Expand All @@ -1238,26 +1238,26 @@ EMU_Run:
adr r1,line242_to_end
str_ r1,nexttimeout

ldr_ r1,emuflags
ldr_ r1,emuFlags
tst r1, #NSFFILE
bne NSF_Run

ldr_ pc,scanlinehook
ldr_ pc,scanlineHook
@---------------------------------------------------------------------------------
line242_to_end:
ldr_ r0,cyclesperscanline
ldr_ r0,cyclesPerScanline
add cycles,cycles,r0

ldr_ r1,scanline
ldr_ r2,lastscanline
add r1,r1,#1
str_ r1,scanline
cmp r1,r2
ldrne_ pc,scanlinehook
ldrne_ pc,scanlineHook

adr addy,line0
str_ addy,nexttimeout
ldr_ pc,scanlinehook
ldr_ pc,scanlineHook
@---------------------------------------------------------------------------------
pcm_scanlinehook:
@---------------------------------------------------------------------------------
Expand All @@ -1268,7 +1268,7 @@ pcm_scanlinehook:
b hk0

ldr_ r0,pcmirqcount
@ ldr r1,cyclesperscanline
@ ldr r1,cyclesPerScanline
@ subs r0,r0,r1,lsr#4
subs r0,r0,#121 @Fire Hawk=122
str_ r0,pcmirqcount
Expand Down Expand Up @@ -1333,12 +1333,12 @@ ntsc_pal_reset:
mov r2, globalptr
ldr globalptr,=globals

ldr_ r0,emuflags
ldr_ r0,emuFlags
tst r0,#PALTIMING

ldreq r1,=341*CYCLE @NTSC (113+2/3)*3
ldrne r1,=320*CYCLE @PAL (106+9/16)*3
str_ r1,cyclesperscanline
str_ r1,cyclesPerScanline
ldreq r1,=261 @NTSC
ldrne r1,=311 @PAL
str_ r1,lastscanline
Expand Down Expand Up @@ -1423,10 +1423,10 @@ op_table:
.word PPU_W @$2000
.word IO_W @$4000
.word sram_W @$6000
.word rom_W80 @$8000
.word rom_WA0 @$A000
.word rom_WC0 @$C000
.word rom_WE0 @$E000
.word mem_W80 @$8000
.word mem_WA0 @$A000
.word mem_WC0 @$C000
.word mem_WE0 @$E000
@memmap_tbl
__memmap_tbl:
.word NES_RAM @$0000 0000-7fff
Expand Down Expand Up @@ -1458,10 +1458,10 @@ __lastbank:
.word 0 @nexttimeout: jump here when cycles runs out
__scanline:
.word 0 @scanline
.word 0 @scanlinehook
.word 0 @scanlineHook
frametotal: @let ui.c see frame count for savestates
.word 0 @frame
.word 0 @cyclesperscanline (341*CYCLE or 320*CYCLE)
.word 0 @cyclesPerScanline (341*CYCLE or 320*CYCLE)
.word 0 @lastscanline (261 or 311)

.word 0 @(unused, for alignment)
Expand Down Expand Up @@ -1506,21 +1506,21 @@ __hblankhook:
.word void @hblankhook, for games that need to do something when h-blank occurs.
.word void @ppuchrlatch
mapperstate:
.skip 96 @mapperdata
.skip 96 @mapperData

romstart:
__rombase:
.word 0 @rombase
.word 0 @romBase

@add others
.word 0 @rommask
.word 0 @romMask
.word 0 @romnumber
.word 0 @prgsize8k
.word 0 @prgSize8k
__prgsize16k:
.word 0 @prgsize16k
.word 0 @prgsize32k
.word 0 @prgSize16k
.word 0 @prgSize32k
__emuflags:
.word 0 @emuflags
.word 0 @emuFlags
.word 0 @prgcrc

.word 0 @lighty
Expand All @@ -1534,7 +1534,7 @@ softrdata:
.word 0 @bglastline
__rendercount:
.word 0 @rendercount
@tempdata
@tempData
.word 0 @tileofs
.word 0 @ntbladr
.word 0 @attradr
Expand Down Expand Up @@ -1573,7 +1573,7 @@ __af_start:
__palsyncline:
.word 0
__cartflags:
.byte 0 @cartflags
.byte 0 @cartFlags
__barcode:
.byte 0
__barcode_out:
Expand Down
10 changes: 5 additions & 5 deletions arm9/source/arm9main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void showversion()
* description: NTSC for 60fps, PAL for 50fps. Call this function to sync with NES emulation.
******************************/
void vblankinterrupt() {
debuginfo[6]++;
debuginfo[VBLS]++;
EMU_VBlank();
irqDisable(IRQ_VCOUNT); //we should disable this...
}
Expand Down Expand Up @@ -157,8 +157,8 @@ int main(int _argc, char **_argv) {
}
if(debuginfo[VBLS]>59) {
debuginfo[VBLS]-=60;
debuginfo[1] = debuginfo[0];
debuginfo[0] = 0;
debuginfo[ERR1] = debuginfo[ERR0];
debuginfo[ERR0] = 0;
debuginfo[FPS]=framecount;
framecount=0;
}
Expand Down Expand Up @@ -269,7 +269,7 @@ void play() {
}
} else {
if (__emuflags & SOFTRENDER) {
if (!(forward) && (fcount >= debuginfo[6] && fcount - debuginfo[6] < 10) ) // disable VBlank to speed up emulation.
if (!(forward) && (fcount >= debuginfo[VBLS] && fcount - debuginfo[VBLS] < 10) ) // disable VBlank to speed up emulation.
swiWaitForVBlank();
} else {
if(!(forward)) {
Expand Down Expand Up @@ -330,4 +330,4 @@ void play() {
fcount = 0;

__emuflags &= ~(FASTFORWARD | REWIND);
}
}
Loading

0 comments on commit 88c9bf2

Please sign in to comment.