Skip to content

Fearure/fix breakpoints#128

Open
SelvinPL wants to merge 4 commits intogbdev:masterfrom
SelvinPL:fearure/fix_breakpoints
Open

Fearure/fix breakpoints#128
SelvinPL wants to merge 4 commits intogbdev:masterfrom
SelvinPL:fearure/fix_breakpoints

Conversation

@SelvinPL
Copy link
Copy Markdown
Contributor

@SelvinPL SelvinPL commented Apr 7, 2026

Fixes #127

SelvinPL added 3 commits April 7, 2026 16:13
the problem was tha address inaddr_to_line was masked out and sometimes multiple source could point to given address
Comment thread js/compiler.js Outdated
file = file.substr(file.indexOf('_') + 1);
var line_nr = parseInt(sym.split('_')[1], 16);
addr = (addr & 0x3fff) | (bank_nr << 14);
addr = addr | (bank_nr << 14);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What the reason for this change @SelvinPL ?

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.

i know what was the problem ...
the other symbols fx from wram
add

SECTION "FUp", WRAM0[$c100]
fup:
  ds 2

before

SECTION "Header", ROM0[$100]

in https://gbdev.io/rgbds-live/ and try to set breakpoint at jp EntryPoint

now do the same in my version https://selvin.pl/rgbds-live-sameboy/ (I did applied there)

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.

moving copy in example to bank1

; Subroutine to copy bc bytes from de to hl
SECTION "Copy", ROMX[$4100]
Copy:
  ld a, [de]
  ld [hli], a
  inc de
  dec bc
  ld a, b
  or a, c
  jr nz, Copy
  ret

works on both ...
so using deduction: map file always uses 0000-3fff and adds bank number
so there is no need for & 3fff

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The problem here is that the AND was ensuring that the OR would basically be treating input like bitfields. Removing this AND looks wrong, since now 0:c000 and 3:0000 are identical addresses, for example. (The AND itself was making 0:0000 and 0:c000 be identical instead, which also looks wrong, and I don't have enough context on that code to know which is right.)

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.

There is no need to put into into addr_to_line when addr > $4000....it is used only for translating breakpoints to line of code, so for symbols sym.startsWith('_SEC') should be another check and not AND... I didn't notice 14 and though that it translates it to 24 bit address

Copy link
Copy Markdown
Contributor Author

@SelvinPL SelvinPL Apr 17, 2026

Choose a reason for hiding this comment

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

Hmmm no need for addr > $8000... Now I see

rationale
for addr >= 0x8000 we don't care about __SEC_xxx symbols
they are only needed for breakpoints and there is no code connected with address for something over 0x8000
yes, you can have code in wram or hram but you cannot link it to the source
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

3 participants