Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Music inside HiROM mapped rom example and mouse support bug fixes #280

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pvsneslib/source/input.asm
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,9 @@ _10:
jsr speed_change
stz connect_st+1

bra _30

_20:
dex
lda REG_JOY1L ; Joy1

jsr mouse_data

lda connect_st
Expand All @@ -718,6 +715,13 @@ _20:
stz connect_st

_30:

lda mouseConnect
ora mouseConnect+1
bne +
stz snes_mouse ; Disable mouse flag if no mouse connected

+:
ply
plx
plb
Expand All @@ -738,8 +742,6 @@ mouse_data:
stz mouse_x,x
stz mouse_y,x

stz snes_mouse

rts

_m10:
Expand Down
38 changes: 38 additions & 0 deletions snes-examples/audio/musicHiROM/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ifeq ($(strip $(PVSNESLIB_HOME)),)
$(error "Please create an environment variable PVSNESLIB_HOME by following this guide: https://github.com/alekmaul/pvsneslib/wiki/Installation")
endif

HIROM := 1

# BEFORE including snes_rules :
# list in AUDIOFILES all your .it files in the right order. It will build to generate soundbank file
AUDIOFILES := res/whatislove.it
# then define the path to generate soundbank data. The name can be different but do not forget to update your include in .c file !
export SOUNDBANK := res/soundbank

include ${PVSNESLIB_HOME}/devkitsnes/snes_rules

.PHONY: bitmaps all

#---------------------------------------------------------------------------------
# ROMNAME is used in snes_rules file
export ROMNAME := musicHiROM

# to build musics, define SMCONVFLAGS with parameters you want, for HiROM use -i
SMCONVFLAGS := -s -o $(SOUNDBANK) -i -V -b 3
musics: $(SOUNDBANK).obj

all: musics bitmaps $(ROMNAME).sfc

clean: cleanBuildRes cleanRom cleanGfx cleanAudio

#---------------------------------------------------------------------------------
pvsneslibfont.pic: pvsneslibfont.bmp
@echo convert font with no tile reduction ... $(notdir $@)
$(GFXCONV) -s 8 -o 2 -u 16 -p -e 1 -t bmp -i $<

dancer.pic: dancer.png
@echo convert font with no tile reduction ... $(notdir $@)
$(GFXCONV) -s 32 -o 4 -u 16 -p -t png -i $<

bitmaps : pvsneslibfont.pic dancer.pic
Binary file added snes-examples/audio/musicHiROM/dancer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions snes-examples/audio/musicHiROM/data.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.include "hdr.asm"

.section ".rodata1" superfree

snesfont:
.incbin "pvsneslibfont.pic"

snespal:
.incbin "pvsneslibfont.pal"

dancermap:
.incbin "dancer.pic"

dancerpal:
.incbin "dancer.pal"

.ends


49 changes: 49 additions & 0 deletions snes-examples/audio/musicHiROM/hdr.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
;==HiRom== ; We'll get to HiRom some other time.

.MEMORYMAP ; Begin describing the system architecture.
SLOTSIZE $10000 ; The slot is $10000 bytes in size. More details on slots later.
DEFAULTSLOT 0 ; There's only 1 slot in SNES, there are more in other consoles.
SLOT 0 $0000 ; Defines Slot 0's starting address.
SLOT 1 $0 $2000
SLOT 2 $2000 $E000
SLOT 3 $0 $10000
SLOT 4 $6000
.ENDME ; End MemoryMap definition

.ROMBANKSIZE $10000 ; Every ROM bank is 32 KBytes in size
.ROMBANKS 4 ; 2 Mbits - Tell WLA we want to use 4 ROM Banks

.SNESHEADER
ID "SNES" ; 1-4 letter string, just leave it as "SNES"

NAME "LIBSNES MUSIC DEMO HR" ; Program Title - can't be over 21 bytes,
; "123456789012345678901" ; use spaces for unused bytes of the name.

SLOWROM
HIROM

CARTRIDGETYPE $00 ; $00 = ROM only $02 = ROM+SRAM, see WLA documentation for others
ROMSIZE $08 ; $08 = 2 Mbits, see WLA doc for more..
SRAMSIZE $00 ; $00 = No Sram, $01 = 16 kbits, see WLA doc for more..
COUNTRY $01 ; $01 = U.S. $00 = Japan, that's all I know
LICENSEECODE $00 ; Just use $00
VERSION $00 ; $00 = 1.00, $01 = 1.01, etc.
.ENDSNES

.SNESNATIVEVECTOR ; Define Native Mode interrupt vector table
COP EmptyHandler
BRK EmptyHandler
ABORT EmptyHandler
NMI VBlank
IRQ EmptyHandler
.ENDNATIVEVECTOR

.SNESEMUVECTOR ; Define Emulation Mode interrupt vector table
COP EmptyHandler
ABORT EmptyHandler
NMI EmptyHandler
RESET tcc__start ; where execution starts
IRQBRK EmptyHandler
.ENDEMUVECTOR

.BASE $40
Loading