Split clock file to components
This commit is contained in:
parent
d0d0941a64
commit
865be55e66
2 changed files with 35 additions and 21 deletions
|
@ -2,16 +2,14 @@
|
||||||
; 2022-03-15, Karri Kaksonen
|
; 2022-03-15, Karri Kaksonen
|
||||||
;
|
;
|
||||||
; clock_t clock (void);
|
; clock_t clock (void);
|
||||||
; clock_t _clocks_per_sec (void);
|
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _clock, __clocks_per_sec, clock_count
|
.export _clock, clock_count
|
||||||
.interruptor update_clock, 2 ; (low priority)
|
.interruptor update_clock, 2 ; (low priority)
|
||||||
.constructor init_clock
|
.constructor init_clock
|
||||||
|
|
||||||
.import sreg: zp
|
.import sreg: zp
|
||||||
.import _zonecounter
|
.import _zonecounter
|
||||||
.import _paldetected
|
|
||||||
.include "atari7800.inc"
|
.include "atari7800.inc"
|
||||||
|
|
||||||
.macpack generic
|
.macpack generic
|
||||||
|
@ -33,24 +31,6 @@
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
|
||||||
; Return the number of clock ticks in one second.
|
|
||||||
;
|
|
||||||
.proc __clocks_per_sec
|
|
||||||
|
|
||||||
lda #0
|
|
||||||
tax
|
|
||||||
sta sreg ; return 32 bits
|
|
||||||
sta sreg+1
|
|
||||||
lda _paldetected
|
|
||||||
bne pal
|
|
||||||
lda #60 ; NTSC - 60Hz
|
|
||||||
rts
|
|
||||||
pal:
|
|
||||||
lda #50 ; PAL - 50Hz
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; This interrupt handler increments a 24-bit counter at every video
|
; This interrupt handler increments a 24-bit counter at every video
|
||||||
; vertical-blanking time.
|
; vertical-blanking time.
|
||||||
|
|
34
libsrc/atari7800/clocks_per_sec.s
Normal file
34
libsrc/atari7800/clocks_per_sec.s
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
;
|
||||||
|
; 2022-03-15, Karri Kaksonen
|
||||||
|
;
|
||||||
|
; clock_t _clocks_per_sec (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export __clocks_per_sec
|
||||||
|
|
||||||
|
.import sreg: zp
|
||||||
|
.import _paldetected
|
||||||
|
.include "atari7800.inc"
|
||||||
|
|
||||||
|
.macpack generic
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
; Return the number of clock ticks in one second.
|
||||||
|
;
|
||||||
|
.proc __clocks_per_sec
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
tax
|
||||||
|
sta sreg ; return 32 bits
|
||||||
|
sta sreg+1
|
||||||
|
lda _paldetected
|
||||||
|
bne pal
|
||||||
|
lda #60 ; NTSC - 60Hz
|
||||||
|
rts
|
||||||
|
pal:
|
||||||
|
lda #50 ; PAL - 50Hz
|
||||||
|
rts
|
||||||
|
.endproc
|
||||||
|
|
Loading…
Add table
Reference in a new issue