-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc6c527
commit fc931b1
Showing
2 changed files
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
variable handler 0 handler ! | ||
|
||
code sp@ w stx, tsx, txa, w ldx, | ||
w ldy, ' pushya jmp, end-code | ||
: catch | ||
[ txa, ' pushya jsr, ] \ sp@ | ||
>r handler @ >r | ||
[ w stx, tsx, txa, w ldx, | ||
' pushya jsr, ] \ rp@ | ||
handler ! execute | ||
r> handler ! r> drop 0 ; | ||
|
||
: catch ( xt -- e|0 ) | ||
handler @ >r sp@ handler ! | ||
execute r> handler ! r> drop 0 ; | ||
: throw | ||
?dup if handler @ | ||
[ w stx, lsb lda,x tax, txs, | ||
w ldx, inx, ] \ rp! | ||
r> handler ! r> swap >r | ||
[ lsb lda,x tax, ] \ sp! | ||
drop r> then ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters