From 67d25d837ac55f28a366c0a3b262e439a6e75fc3 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 19 Aug 2017 12:15:28 +0200 Subject: Add AmForth --- amforth-6.5/msp430/words/compare.asm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 amforth-6.5/msp430/words/compare.asm (limited to 'amforth-6.5/msp430/words/compare.asm') diff --git a/amforth-6.5/msp430/words/compare.asm b/amforth-6.5/msp430/words/compare.asm new file mode 100644 index 0000000..75a8644 --- /dev/null +++ b/amforth-6.5/msp430/words/compare.asm @@ -0,0 +1,18 @@ + +HEADER(XT_COMPARE,7,"compare",DOCOLON) + +; : compare ( c-addr1 len1 c-addr2 len 2 -- f ) +; f == 0 if both strings are equal +; f <> 0 if strings differ, details are way more complex +; rot over <> if ( -- c-addr1 c-addr2 len2) +; \ string dont have the same length +; drop drop drop -1 exit then +; s= ; + + DW XT_ROT,XT_OVER,XT_NOTEQUAL + DW XT_DOCONDBRANCH + DEST(COMPARE_1) + DW XT_DROP,XT_2DROP, XT_MINUSONE,XT_EXIT +COMPARE_1: + DW XT_SEQUAL + DW XT_EXIT -- cgit v1.2.3