1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 20:29:34 +00:00

make sure clocktick starts at zero

This commit is contained in:
mrdudz 2015-07-16 16:54:40 +02:00
parent 21d7729ad1
commit d229d51be5
2 changed files with 23 additions and 13 deletions

View File

@ -2,20 +2,30 @@
; clock_t clock (void);
;
.include "pce.inc"
.include "pce.inc"
.export _clock
.importzp sreg
;; .importzp tickcount
.export _clock
.importzp sreg
;; .importzp tickcount
.proc _clock
lda tickcount+3
sta sreg+1
lda tickcount+2
sta sreg
ldx tickcount+1
lda tickcount
rts
lda tickcount+3
sta sreg+1
lda tickcount+2
sta sreg
ldx tickcount+1
lda tickcount
rts
.endproc
.constructor initclock, 24
initclock:
lda #0
ldx #3
@lp: sta tickcount,x
dex
bpl @lp
rts

View File

@ -88,8 +88,6 @@ start:
lda #$05
sta IRQ_MASK ; IRQ1=on
cli
; Clear the BSS data
jsr zerobss
@ -141,6 +139,8 @@ start:
; Call module constructors
jsr initlib
cli ; allow IRQ only after constructors have run
; Pass an empty command line
jsr push0 ; argc
jsr push0 ; argv