-
-
Notifications
You must be signed in to change notification settings - Fork 19
Illegal #126
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
Merged
Illegal #126
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5f54792
sax
omarandlorraine cb336ae
xaa
omarandlorraine 747e70c
alr
omarandlorraine f088898
anc
omarandlorraine 3e5faf9
bump version number
omarandlorraine eb1d6f7
illegal opcodes: lax, dcp, isc, slo, rla, sre, rra, arr, sbx, las, us…
204fc8b
fix: README doc tests hanging after illegal opcodes implementation
cb29892
fix: make euclid.bin example runnable as doc test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
Binary file not shown.
This file contains hidden or 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,33 +1,25 @@ | ||
| ; euclid.ca65 | ||
| ; A program to find the greatest common divisor of two numbers | ||
|
|
||
| .ORG $1000 | ||
| .segment "CODE" | ||
|
|
||
| ; .algo | ||
| LDA $00 ; Load from F to A | ||
| ; .algo_ | ||
| SEC ; Set carry flag | ||
| SBC $01 ; Subtract S from the number in A (from F) | ||
| BEQ end ; Jump to .end if the difference is zero | ||
| BMI swap ; Jump to .swap if the difference is negative | ||
| STA $00 ; Load A to F | ||
| JMP algo_ ; Jump to .algo_ | ||
| algo: | ||
| LDA $00 ; Load from F to A | ||
| algo_: | ||
| SEC ; Set carry flag | ||
| SBC $01 ; Subtract S from A | ||
| BEQ end ; Jump to end if zero | ||
| BMI swap ; Jump to swap if negative | ||
| STA $00 ; Store A to F | ||
| JMP algo_ ; Continue algorithm | ||
|
|
||
| ; .end | ||
| end: | ||
| LDA $00 ; Load from F to A | ||
| BRK ; Break (end program) | ||
| LDA $00 ; Load result to A | ||
| .byte $02 ; JAM - halt CPU | ||
|
|
||
| ; .swap | ||
| swap: | ||
| LDX $00 ; Load F to X | ||
| LDY $01 ; Load S to Y | ||
| STX $01 ; Store X to S | ||
| STY $00 ; Store Y to F | ||
| JMP algo ; Jump to .algo | ||
|
|
||
| algo: | ||
| JMP algo ; Infinite loop to prevent program from ending | ||
|
|
||
| algo_: | ||
| JMP algo_ ; Infinite loop to prevent program from ending | ||
| LDX $00 ; Load F to X | ||
| LDY $01 ; Load S to Y | ||
| STX $01 ; Store X to S | ||
| STY $00 ; Store Y to F | ||
| JMP algo ; Restart algorithm |
This file contains hidden or 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,32 +1,18 @@ | ||
| # Linker configuration for cc65 (ld65) | ||
| # Defines memory layout and segment placement for 6502 programs | ||
| # Outputs raw binary containing only the code segment | ||
|
|
||
| MEMORY { | ||
| # RAM: 32KB from $0000-$7FFF | ||
| # Used for zero page, stack, data, and code in this emulator config | ||
| RAM: start = $0000, size=$8000, type = rw, fill = yes, fillval = $FF, file = %O; | ||
|
|
||
| # ROM: Almost 32KB from $8000-$FFF9 | ||
| # Defined but not used in examples (code runs from RAM instead) | ||
| ROM: start = $8000, size=$7FFA, type = ro, fill = yes, fillval = $FF, file = %O; | ||
|
|
||
| # ROM_VECTORS: 6 bytes at $FFFA-$FFFF | ||
| # Holds the three 16-bit interrupt vectors: NMI, RESET, IRQ | ||
| ROM_VECTORS: start = $FFFA, size=6, type = ro, fill = yes, fillval = $FF, file = %O; | ||
| # Code region starting at $0010, matching README examples | ||
| CODE: start = $0010, size = $1000, type = rw, file = %O; | ||
| } | ||
|
|
||
| SEGMENTS { | ||
| # Zero page ($00-$FF): Fast access variables | ||
| ZEROPAGE: load=RAM, type=rw; | ||
|
|
||
| # Data segment: Starts at $0200 (page 2) | ||
| # Page 1 ($0100-$01FF) is reserved for the stack | ||
| DATA: load=RAM, type=rw, offset=$0200; | ||
| # Code segment: Contains the program | ||
| CODE: load = CODE, type = ro; | ||
|
|
||
| # Code segment: Starts at $0400 (page 4) | ||
| # Leaves room for zero page, stack, and data | ||
| CODE: load=RAM, type=rw, offset=$0400; | ||
|
|
||
| # Interrupt vectors at top of memory | ||
| VECTORS: load=ROM_VECTORS, type=ro; | ||
| } | ||
| # Optional segments | ||
| ZEROPAGE: load = CODE, type = rw, optional = yes; | ||
| DATA: load = CODE, type = rw, optional = yes; | ||
| RODATA: load = CODE, type = rw, optional = yes; | ||
| BSS: load = CODE, type = rw, optional = yes; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this, but it seems reasonable.