From 12fc566d92d9ebd0bf065d82be5c24a3b5fb600a Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Sun, 18 Oct 2020 00:12:29 +0300 Subject: It's time to debug. --- main.sts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'main.sts') diff --git a/main.sts b/main.sts index df91408..ad7c100 100644 --- a/main.sts +++ b/main.sts @@ -1,26 +1,28 @@ module ia32/elf/begin.sts +module ia32/float/float.sts module cipher.sts module keygen.sts +module freq.sts [ sd 0 swap drop ] defword nicedist - 1 float_iload 8 float_iload float_div + 1 float_iload 4 float_iload float_div exit -defword calcdist +defword calcdist ; distance from ideal as sqrt sum square diff top 1a - as calcdist.textfr local calcdist.fr 0 do dup 1a = until dup word_size mul as calcdist.i calcdist.i calcdist.fr + @ float_fload - calcdist.i calcdost.textfr + @ float_fload + calcdist.i calcdist.textfr + @ float_fload float_sub float_fstore dup float_fload float_fload - float_mul float_fstore calcdist.t calcdist.fr + ! - od drop - 0 as calcdist.i do calcdist.i 19 = until - float_fload float_fload float_add float_fstore - calcdist.i 1 + as calcdist.i od + float_mul float_fstore calcdist.i calcdist.fr + ! + 1 + od drop + 0 do dup 19 = until + swap float_fload swap float_fload float_add float_fstore swap + 1 + od drop float_fload float_sqrt nicedist float_less exit @@ -52,7 +54,7 @@ checktext.count 0 = if dup word_size mul checktext.fr + dup @ float_iload checktext.count float_iload float_div float_fstore swap ! - od drop + 1 + od drop ; Decide if text is real: freq_eng calcdist if 1 else 0 fi -- cgit v1.2.3