make sure clocktick starts at zero
This commit is contained in:
@@ -2,20 +2,30 @@
|
|||||||
; clock_t clock (void);
|
; clock_t clock (void);
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
|
|
||||||
.export _clock
|
.export _clock
|
||||||
.importzp sreg
|
.importzp sreg
|
||||||
;; .importzp tickcount
|
;; .importzp tickcount
|
||||||
|
|
||||||
.proc _clock
|
.proc _clock
|
||||||
|
|
||||||
lda tickcount+3
|
lda tickcount+3
|
||||||
sta sreg+1
|
sta sreg+1
|
||||||
lda tickcount+2
|
lda tickcount+2
|
||||||
sta sreg
|
sta sreg
|
||||||
ldx tickcount+1
|
ldx tickcount+1
|
||||||
lda tickcount
|
lda tickcount
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
.constructor initclock, 24
|
||||||
|
|
||||||
|
initclock:
|
||||||
|
lda #0
|
||||||
|
ldx #3
|
||||||
|
@lp: sta tickcount,x
|
||||||
|
dex
|
||||||
|
bpl @lp
|
||||||
|
rts
|
||||||
@@ -88,8 +88,6 @@ start:
|
|||||||
lda #$05
|
lda #$05
|
||||||
sta IRQ_MASK ; IRQ1=on
|
sta IRQ_MASK ; IRQ1=on
|
||||||
|
|
||||||
cli
|
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data
|
||||||
jsr zerobss
|
jsr zerobss
|
||||||
|
|
||||||
@@ -141,6 +139,8 @@ start:
|
|||||||
; Call module constructors
|
; Call module constructors
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
|
cli ; allow IRQ only after constructors have run
|
||||||
|
|
||||||
; Pass an empty command line
|
; Pass an empty command line
|
||||||
jsr push0 ; argc
|
jsr push0 ; argc
|
||||||
jsr push0 ; argv
|
jsr push0 ; argv
|
||||||
|
|||||||
Reference in New Issue
Block a user