# HG changeset patch # User Paul Boddie # Date 1439757498 -7200 # Node ID cc3ca407a7d664c6d55bfcef0a21701a457cd02b # Parent 4f0db3c7456514a9558f8134f9668be46f824dfb Restructured the third "housekeeping" task to use an internal subroutine. diff -r 4f0db3c74565 -r cc3ca407a7d6 switcher.oph --- a/switcher.oph Sun Aug 16 21:49:17 2015 +0200 +++ b/switcher.oph Sun Aug 16 22:38:18 2015 +0200 @@ -415,23 +415,10 @@ .byte 0 ; saved flags .word third_task_start ; saved PC third_task_start: - ldx #2 -third_task_begin: - ldy #0 ; reset counter LSB - lda #0 ; reset counter MSB - sta $7021 -third_task_loop: - stx $7028 - sty $7020 - cpy #$ff - bne third_task_continue - clc - lda $7021 ; next MSB - adc #1 - sta $7021 - cmp #$ff - bne third_task_continue - txa + ldx #2 ; offset of first task to remove +* stx $7028 + .invoke call third_task_delay, + +* txa .invoke pushA .invoke call remove_task, + * .invoke pullA @@ -440,12 +427,26 @@ inx ; which is 2 locations away cpx #TASK_TABLE_LENGTH beq + - jmp third_task_begin + jmp --- * ldx #0 - jmp third_task_begin -third_task_continue: + jmp ---- +third_task_delay: + lda #0 ; reset counter MSB +* sta $7021 +* ldy #0 +* sty $7020 + cpy #$ff + beq + iny - jmp third_task_loop + jmp - +* clc + lda $7021 ; next MSB + adc #1 + sta $7021 + cmp #$ff + beq + + jmp --- +* .invoke return third_task_stack: .word 0 .word 0