Skip to content

banked breakpoints#135

Open
SelvinPL wants to merge 1 commit into
gbdev:masterfrom
SelvinPL:feature/banked_breakpoints
Open

banked breakpoints#135
SelvinPL wants to merge 1 commit into
gbdev:masterfrom
SelvinPL:feature/banked_breakpoints

Conversation

@SelvinPL
Copy link
Copy Markdown
Contributor

@SelvinPL SelvinPL commented May 6, 2026

Fixes #127

Temporary i've added back patching binjgb source 'till my PR would be accepted there.

Comment thread js/compiler.js
file = file.substr(file.indexOf('_') + 1);
var line_nr = parseInt(sym.split('_')[1], 16);
addr = (addr & 0x3fff) | (bank_nr << 14);
addr = addr | (bank_nr << 16);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

now, we are using fully 24 bit address which contains bank

Comment thread js/emulator.js
export function setPC(pc) {
Module._emulator_set_PC(e, pc);
}
export function getBankedPC() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we need new getPC which would take bank into account

Comment thread js/text-editor.js
editors[0].focus();
updateErrors();
updateCpuLine();
updateBreakpoints();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is needed to fix the "switching file error"

Comment thread patches/binjgb.patch
const size_t s_emulator_state_size = sizeof(EmulatorState);
-
+#ifdef RGBDS_LIVE
+#ifndef BREAKPOINTS_MAX_BANKS_NUMBER
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

those constants are for calculating shifts and sizes
lookup bitfield should be fast with em

Comment thread patches/binjgb.patch
+#ifndef BREAKPOINTS_MAX_BANKS_NUMBER
+#define BREAKPOINTS_MAX_BANKS_NUMBER 1
+#endif
+typedef uint32_t breakpoints_type;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you can redefine breakpoint type if we would move to fx 64 bit emscripten
you can aslo check what it does if we would use uint8_t

Comment thread patches/binjgb.patch
-
+#ifdef RGBDS_LIVE
+#ifndef BREAKPOINTS_MAX_BANKS_NUMBER
+#define BREAKPOINTS_MAX_BANKS_NUMBER 1
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

if we do not pass BREAKPOINTS_MAX_BANKS_NUMBER=256 it should works as it does (but instead using bool array now it is using bitfields)

Comment thread patches/binjgb.patch
}

+#ifdef RGBDS_LIVE
+static inline uint32_t emulator_get_banked_PC_inline(Emulator *e) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

since there is no such thing as current bank in binjgb we need to calculate bank from what we have and current address ... the code was "invented" from code used to set those bank

@ISSOtm
Copy link
Copy Markdown
Member

ISSOtm commented May 6, 2026

I'm not seeing any PRs on binjgb's repo?

@SelvinPL
Copy link
Copy Markdown
Contributor Author

SelvinPL commented May 7, 2026

I'm not seeing any PRs on binjgb's repo?

binji/binjgb#68

@ISSOtm
Copy link
Copy Markdown
Member

ISSOtm commented May 8, 2026

Haha, that PR seems to have been created after I checked. Though, it has also been merged! So this PR can remove the patching of binjgb.

@SelvinPL
Copy link
Copy Markdown
Contributor Author

SelvinPL commented May 8, 2026

Is don't know ... maybe i should make a new one after you would accept the cmake build's one, as:

cmake -E env \
    LDFLAGS='-s EXPORT_ES6=1 -s EXPORTED_RUNTIME_METHODS=['HEAP8']' \
    CFLAGS='-DBREAKPOINTS_MAX_BANKS_NUMBER=256' \
    cmake \

should be moved to CMakeLists.txt then

...also accepting this PR will mess up cmake build's PR where I removed build-xxxx.sh files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breakpoint not working corectly for mulifiles

2 participants