aboutsummaryrefslogtreecommitdiff
path: root/forth/forth/avr/asm2test.fs
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-09-21 21:59:17 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-09-21 21:59:17 +0200
commit2f83a0bea9da444e3d70569eba3d6847ca02be03 (patch)
tree20163bbd478f40679d22f5e964aef94c688639f0 /forth/forth/avr/asm2test.fs
parent125127ee67891e1813164e20aa848a80b9d2f2a0 (diff)
...
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