aboutsummaryrefslogtreecommitdiff
path: root/forth/forth/avr/asm2test.fs
diff options
context:
space:
mode:
Diffstat (limited to 'forth/forth/avr/asm2test.fs')
-rw-r--r--forth/forth/avr/asm2test.fs32
1 files changed, 32 insertions, 0 deletions
diff --git a/forth/forth/avr/asm2test.fs b/forth/forth/avr/asm2test.fs
new file mode 100644
index 0000000..976420b
--- /dev/null
+++ b/forth/forth/avr/asm2test.fs
@@ -0,0 +1,32 @@
+
+-asmtest
+marker -asmtest
+
+: qq
+ as: if eq
+ as: nop
+ as: then
+;
+
+: ww
+ as: begin
+ as: nop
+ as: until eq
+;
+\ square root of unsigned cell.
+: sqrt ( u --- u )
+ as: adiw r24 1
+ as: ldi r16 $00
+ as: ldi r17 $80
+ as: begin
+ as: eor r16 r17
+ as: mul r16 r16
+ as: cp r0 r24
+ as: cpc r1 r25
+ as: if sh
+ as: eor r16 r17
+ as: then
+ as: lsr r17
+ as: until eq
+ as: movw r24 r16
+; \ No newline at end of file