aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/words/f_cpu.asm
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/common/words/f_cpu.asm')
-rw-r--r--amforth-6.5/common/words/f_cpu.asm22
1 files changed, 22 insertions, 0 deletions
diff --git a/amforth-6.5/common/words/f_cpu.asm b/amforth-6.5/common/words/f_cpu.asm
new file mode 100644
index 0000000..3632b0c
--- /dev/null
+++ b/amforth-6.5/common/words/f_cpu.asm
@@ -0,0 +1,22 @@
+; ( -- d )
+; System
+; put the cpu frequency in Hz on stack
+.if cpu_msp430==1
+ HEADER(XT_F_CPU,5,"f_cpu",DOCOLON)
+.endif
+
+.if cpu_avr8==1
+VE_F_CPU:
+ .dw $ff05
+ .db "f_cpu",0
+ .dw VE_HEAD
+ .set VE_HEAD = VE_F_CPU
+XT_F_CPU:
+ .dw DO_COLON
+PFA_F_CPU:
+.endif
+ .dw XT_DOLITERAL
+ .dw (F_CPU % 65536)
+ .dw XT_DOLITERAL
+ .dw (F_CPU / 65536)
+ .dw XT_EXIT