c64-livecoding/wip-hugo/macros/timer.s

34 lines
751 B
ArmAsm

;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
;; Max 0.9s
;; Exempel i kod:
;;
;; time_start
;; ...
;; time_stop
;;
;; Läs tiden genom att undersöka värdet i $f1 (BSD-format)
time = $f1
.macro time_start
PHA
LDA $DC08 ; Bit 0..3: Tenth seconds in BCD-format, others may be 0 or 1
;;;;Clear all time data and set time =1.
AND #%11110000
STA $DC08
INC $DC08
LDA $DC08
;;Time is only at bit 0 ..3
AND #%00001111
STA time
PLA
.endmacro
.macro time_stop
PHA
LDA $DC08 ; Bit 0..3: Tenth seconds in BCD-format, others may be 0 or 1
AND #%00001111
SEC
SBC time
STA time
PLA
.endmacro