From 2f83a0bea9da444e3d70569eba3d6847ca02be03 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 21 Sep 2018 21:59:17 +0200 Subject: ... --- forth/forth/avr/asm2test.fs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 forth/forth/avr/asm2test.fs (limited to 'forth/forth/avr/asm2test.fs') 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 -- cgit v1.2.3