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

Add Feature - BSX Loading #89

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/fpga/ap_core.qsf
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ set_global_assignment -name SYSTEMVERILOG_FILE core/rtl/mister_top/sync_fifo.sv
set_global_assignment -name MIF_FILE core/rtl/chip/DSP/dsp11b23410_p.mif
set_global_assignment -name MIF_FILE core/rtl/chip/DSP/dsp11b23410_d.mif
set_global_assignment -name MIF_FILE core/rtl/chip/CX4/drom.mif
set_global_assignment -name MIF_FILE core/rtl/chip/BSX/bsx121-124.mif
set_global_assignment -name SYSTEMVERILOG_FILE core/rtl/mister_top/sound_i2s.sv
set_global_assignment -name SYSTEMVERILOG_FILE core/rtl/mister_top/rom_parser.sv
set_global_assignment -name SYSTEMVERILOG_FILE core/rtl/mister_top/data_unloader.sv
Expand Down Expand Up @@ -792,4 +793,4 @@ set_global_assignment -name QIP_FILE core/mf_pllbase_pal.qip
set_global_assignment -name SIP_FILE core/mf_pllbase_pal.sip
set_parameter -name PAL_PLL '0 -entity core_top
set_global_assignment -name SLD_FILE db/stp1_auto_stripped.stp
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
43 changes: 23 additions & 20 deletions src/fpga/core/rtl/chip/BSX/bsx121-124.mif
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file contains the config data for the bsx bios which you can edit with tools like sat wave - https://github.com/LuigiBlood/sat_wave/releases
//The file has been changed to read " Welcome to Analogue Pocket satellaview support! from 000 - 03A


WIDTH=8;
DEPTH=550;
Expand Down Expand Up @@ -28,20 +31,20 @@ CONTENT BEGIN
013 : 74;
014 : 6F;
015 : 20;
016 : 4D;
017 : 69;
018 : 53;
019 : 54;
01A : 65;
01B : 72;
01C : 21;
016 : 41;
017 : 6E;
018 : 6C;
019 : 6F;
01A : 67;
01B : 75;
01C : 65;
01D : 20;
01E : 20;
01F : 20;
020 : 20;
021 : 20;
022 : 20;
023 : 20;
01E : 50;
01F : 6F;
020 : 63;
021 : 6B;
022 : 65;
023 : 74;
024 : 0D;
025 : 20;
026 : 53;
Expand All @@ -65,13 +68,13 @@ CONTENT BEGIN
038 : 74;
039 : 21;
03A : 00;
03B : 00;
03C : 00;
03D : 00;
03E : 00;
03F : 00;
040 : 00;
041 : 00;
03B : 20;
03C : 45;
03D : 6E;
03E : 6A;
03F : 6F;
040 : 79;
041 : 21;
042 : 00;
043 : 00;
044 : 00;
Expand Down
43 changes: 43 additions & 0 deletions src/support/check_header.asm
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only added BSX bios check. To run bsx roms on pocket the end user has to concatenate the bs rom on top of the BSX bios and edit the header of the bs rom if its needed. Im in the process of making a script to do this.

MiSTer uses the filename extension "bs" to detect when a bs rom is loaded and im not sure that is do-able on pocket plus even if it were possible you would then need to load the BSX bios at offset 0x10000000 and swap the bs rom to 0x10100000 which i have not been able to make happen.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

managed to add .BS extension detection and auto load data slot 1 bsx bios into address 0x10000000 once a .bs rom is loaded. Works quite well now haha , Code probably looks a bit of a mess lol.....I think the only thing wrong now is it doesnt want to save any data for BSX roms or the bios which can get annoying keep having to input your name.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How big is the BSX BIOS? I would prefer to not load it every time and slow down ROM loading for everyone else. However, that would mean we'd have to use the file read API, which may not be easy.

Copy link
Author

@terminator2k2 terminator2k2 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is 1MB and doesnt it only load the bios when a .bs is loaded

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is selectively loading the BIOS, isn't it? It checks the ROM extension, and if so loads the BIOS, then the ROM at the offset you specified?

Copy link
Author

@terminator2k2 terminator2k2 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes thats how it should be working if its correct , it checks for the .bs extension when a file is loaded then if it matches, loads the bios and sets the core, then loads the bios @ 0x10000000 and then loads the inital .bs rom at 0x10100000

Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ macro check_header(variable base_address_input, variable output_address_input) {
validate_mapping_mode(base_address_input)
call validate_simple_values
call choose_ramsz
call check_bsx
call choose_chip_type
call choose_region

Expand Down Expand Up @@ -398,6 +399,48 @@ choose_region:
log_string("Finished region:")
hex.b r10
ret

check_bsx:
check_value_equality(header_start_mem, 0x53) // Check if 's'
jp nz, not_bsx
check_value_equality(header_start_mem + 1, 0x61) // Check if 'a'
jp nz, not_bsx
check_value_equality(header_start_mem + 2, 0x74) // Check if 't'
jp nz, not_bsx
check_value_equality(header_start_mem + 3, 0x65) // Check if 'e'
jp nz, not_bsx
check_value_equality(header_start_mem + 4, 0x6C) // Check if 'l'
jp nz, not_bsx
check_value_equality(header_start_mem + 5, 0x6C) // Check if 'l'
jp nz, not_bsx
check_value_equality(header_start_mem + 6, 0x61) // Check if 'a'
jp nz, not_bsx
check_value_equality(header_start_mem + 7, 0x76) // Check if 'v'
jp nz, not_bsx
check_value_equality(header_start_mem + 8, 0x69) // Check if 'i'
jp nz, not_bsx
check_value_equality(header_start_mem + 9, 0x65) // Check if 'e'
jp nz, not_bsx
check_value_equality(header_start_mem + 0x0A, 0x77) // Check if 'w'
jp nz, not_bsx
check_value_equality(header_start_mem + 0x0B, 0x20) // Check if ' '
jp nz, not_bsx
check_value_equality(header_start_mem + 0x0C, 0x42) // Check if 'B'
jp nz, not_bsx
check_value_equality(header_start_mem + 0x0D, 0x53) // Check if 'S'
jp nz, not_bsx
check_value_equality(header_start_mem + 0x0E, 0x2D) // Check if '-'
jp nz, not_bsx
check_value_equality(header_start_mem + 0x0F, 0x58) // Check if 'X'
jp nz, is_bsx

is_bsx:
or r12,#0x30

not_bsx:
log_string("Finished BSX:")
hex.b r12
ret

// Load all header values from file into memory
load_header_values_into_mem:
Expand Down
2 changes: 1 addition & 1 deletion src/support/loader.asm
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bit_bsx:
cmp r4,#0x30 // Check if BSX
jp nz, check_pal
log_string("Using BSX")
// It's BSX
jp expansion_core // It's BSX

expansion_core:
ld r8,#1
Expand Down