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

[KERNAL] implement native-capable jsrfar #283

Merged
merged 15 commits into from
Mar 8, 2024

Conversation

mooinglemur
Copy link
Collaborator

The native RAM code is 2 bytes shorter due to the savings in size from stack-relative addressing, even with the added SEP/REP

@mooinglemur mooinglemur marked this pull request as draft March 6, 2024 04:26
@mooinglemur mooinglemur marked this pull request as ready for review March 6, 2024 05:57
inc/jsrfar.inc Show resolved Hide resolved
inc/jsrfar.inc Outdated Show resolved Hide resolved
inc/jsrfar.inc Outdated Show resolved Hide resolved
inc/jsrfar.inc Outdated Show resolved Hide resolved
inc/jsrfar.inc Outdated Show resolved Hide resolved
kernal/drivers/x16/memory.s Show resolved Hide resolved
@mooinglemur mooinglemur merged commit 496d6ca into X16Community:65c816 Mar 8, 2024
1 check passed
mooinglemur added a commit that referenced this pull request Mar 8, 2024
* [KERNAL] implement native-capable jsrfar

* native jsrfar falls back to old code if in emulated mode

* fix off-by-one error

* fix up some logic, jmpfr need only be in one place

* Save a couple cycles here

* save a few more cycles w/ carry assumptions

* add assert for jsrfar3n

* saved one more cycle

* trivial changes

* trivial changes

* updates to comments

* updates to comments

* no need to preserve X in the native jsrfar

* fix stack misalignment issue in a 16-bit jsrfar call

* requested changes
mooinglemur added a commit that referenced this pull request Mar 11, 2024
* [KERNAL] implement native-capable jsrfar

* native jsrfar falls back to old code if in emulated mode

* fix off-by-one error

* fix up some logic, jmpfr need only be in one place

* Save a couple cycles here

* save a few more cycles w/ carry assumptions

* add assert for jsrfar3n

* saved one more cycle

* trivial changes

* trivial changes

* updates to comments

* updates to comments

* no need to preserve X in the native jsrfar

* fix stack misalignment issue in a 16-bit jsrfar call

* requested changes
mooinglemur added a commit that referenced this pull request Mar 11, 2024
* Proof of Concept for resolving the clash of UDTIM with the 65C816's NMIB vector.

At $FFEA in the ROM is the jump table entry for UDTIM aka `jmp clock_update`.
In native mode, the 65C816 reads its NMIB vector from $FFEA as well. By
hardcoding the address for `clock_update`, which is an alias for
`softclock_timer_update`, to an address with the low byte $XX, the NMIB
handler can be hardcoded to $XX4C, as $4C is the opcode for an absolute `jmp`.
This PoC uses $EEEE for `softclock_timer_update` and $EE4C for the NMIB handler
as example values.

* Add 65C816 support for NMI, IRQ and BRK

* Add support for COP

* Add native IRQ handler and make sure BASIC starts in emulation mode

* Replace low RAM 65C816 detection variable with a runtime detection macro

* SCREEN: Don't clobber Y

* Handle DP and SP in native IRQ

* Use 03 instead of 01 for CPU detection

* Add native interrupt and emulated COP vectors and fully implement all interrupt types

* Add native and emulated ABORT handler

* Reorder segments so that C816_ABORT_NATIVE can sit at address

* Add dedicated vectors in KVECTORS

* Move the KERNAL signature to the SIGNATURE section (see X16Community/x16-emulator@23f1f14

* Fix COP and ABORT trampolines not being in low RAM

* 65c816.s: Indent with tabs

* Remove now-unused KVEC816 segment

* Move 65c816.s to drivers/x16/65c816/interrupt.s

* Fix SCREEN and IOBASE interrupt dispatch logic

* Add first draft of stack API

* fixup! Fix SCREEN and IOBASE interrupt dispatch logic

* fixup! Fix SCREEN and IOBASE interrupt dispatch logic

* STACK: Use an extra byte that is always  for code simplification

* Rename STACK_foo to stack_foo

* Native IRQ: Call the KERNAL emulated IRQ code directly in native mode if the emulated IRQ vector hasn't been replaced

* Add missing newline at end of files

* Explicitely annotate 65C816 code with address & index width

* fix minor error while rebasing

* [KERNAL] add legacy/c816 extended APIs (#280)

* [KERNAL] refactor, comment 65C816 native stack API

* rewording comments

* [KERNAL] implement native-capable jsrfar (#283)

* [KERNAL] implement native-capable jsrfar

* native jsrfar falls back to old code if in emulated mode

* fix off-by-one error

* fix up some logic, jmpfr need only be in one place

* Save a couple cycles here

* save a few more cycles w/ carry assumptions

* add assert for jsrfar3n

* saved one more cycle

* trivial changes

* trivial changes

* updates to comments

* updates to comments

* no need to preserve X in the native jsrfar

* fix stack misalignment issue in a 16-bit jsrfar call

* requested changes

* [KERNAL] typo in 816 native jsrfar RAM routine

* [KERNAL] add extapi16 #0 test reflector call

* [CI/CD] the first unit tests

* [CI/CD] update build deps

* [MONITOR] 65C816 emulation mode stack unwinding (#292)

* [META] remove CODEX, move DIAG 16->7 (#293)

---------

Co-authored-by: George Tokmaji <[email protected]>
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.

2 participants