base:variable_speedcode_runlength
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
base:variable_speedcode_runlength [2016-04-16 11:43] – bitbreaker | base:variable_speedcode_runlength [2022-01-14 12:45] (current) – bitbreaker | ||
---|---|---|---|
Line 6: | Line 6: | ||
< | < | ||
+ | ;<- enter here | ||
sta $0400 | sta $0400 | ||
sta $0401 | sta $0401 | ||
Line 15: | Line 16: | ||
sta $0407 | sta $0407 | ||
sta $0408 | sta $0408 | ||
+ | ;<- leave here | ||
sta $0409 | sta $0409 | ||
sta $040a | sta $040a | ||
Line 24: | Line 26: | ||
</ | </ | ||
- | So given the above example, we might want to enter at sta $0400 and leave after sta $0408, to do so we can modify the code and transform the upcoming sta to an rts command. After exiting the speedcode we then modify the rts back to a sta. Pretty | + | So given the above example, we might want to enter at sta $0400 and leave after sta $0408, to do so we can modify the code and transform the upcoming sta to an rts command. After exiting the speedcode we then modify the rts back to a sta. Pretty |
- | If we speedocde | + | |
+ | We need speedcode | ||
All you need is setting up a IRQ/NMI handler once beforehand as the exit point of your routine, setup the timer with 2 writes to e.g. $dd04/$dd05 and start a single shot timer run by setting $dd0e to $09. | All you need is setting up a IRQ/NMI handler once beforehand as the exit point of your routine, setup the timer with 2 writes to e.g. $dd04/$dd05 and start a single shot timer run by setting $dd0e to $09. | ||
Line 36: | Line 39: | ||
lda #$08 | lda #$08 | ||
sta $dd0e | sta $dd0e | ||
+ | lda #$00 | ||
+ | sta $dd04 | ||
+ | sta $dd05 | ||
lda $dd0d | lda $dd0d | ||
lda #$81 | lda #$81 | ||
Line 49: | Line 55: | ||
sta $dd04 | sta $dd04 | ||
;this can even be ommitted if we do not run more than 255 cycles | ;this can even be ommitted if we do not run more than 255 cycles | ||
- | lda runlength_hi, | + | |
- | sta $dd05 | + | |
+ | |||
+ | tsx | ||
| | ||
lda #$09 | lda #$09 | ||
Line 80: | Line 88: | ||
!byte $00, | !byte $00, | ||
exit | exit | ||
- | tsx | ||
- | txa | ||
- | sbx #$03 | ||
txs | txs | ||
cli | cli | ||
Line 90: | Line 95: | ||
Regarding the cli instruction: | Regarding the cli instruction: | ||
- |
base/variable_speedcode_runlength.txt · Last modified: 2022-01-14 12:45 by bitbreaker