From 370a55aa3b2480f87a90a83d7b8127f9159af750 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Sat, 17 Oct 2020 18:24:54 +0300 Subject: Framework completed. =) --- main.sts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'main.sts') diff --git a/main.sts b/main.sts index b4cf8a9..8613909 100644 --- a/main.sts +++ b/main.sts @@ -5,34 +5,33 @@ set_entry ; read file into stack 0 do sys_read 0 = until swap 1 + - od as length + od drop as length local ciphertext ; -= MAIN LOOP BEGIN =- ; ; place password ontop of stack - 33 32 31 local password + 31 32 33 local password 3 as passlen ; decipher text (length is the same as for ciphertext) - 0 0 do dup length = until - 2 print_stack newline sys_write + passlen 1 - length do 1 - as pos local cipos - pos ciphertext + @ + pos word_size mul ciphertext + @ password passlen cipos cipher swap pos - 1 + od drop drop + dup 0 = untilod drop drop local plaintext ; todo: check deciphering attempt, exit if Ok ; -= MAIN LOOP END =- ; ; output text (todo: and language) - 0 do dup length = until - dup plaintext + @ sys_write - 1 + od + length do 1 - + dup word_size mul plaintext + @ sys_write + dup 0 = untilod sys_exit module ia32/elf/end.sts -- cgit v1.2.3