From b48712f9c9d7a380fe6a494db7ec9580f9314558 Mon Sep 17 00:00:00 2001 From: pommicket Date: Tue, 16 Nov 2021 11:02:45 -0500 Subject: start 04 --- 04a/Makefile | 7 +++++ 04a/in03 | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 04a/in04a | 3 ++ 04b/Makefile | 7 +++++ 04b/in04 | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 4 +++ 6 files changed, 190 insertions(+) create mode 100644 04a/Makefile create mode 100644 04a/in03 create mode 100644 04a/in04a create mode 100644 04b/Makefile create mode 100644 04b/in04 diff --git a/04a/Makefile b/04a/Makefile new file mode 100644 index 0000000..e6187d4 --- /dev/null +++ b/04a/Makefile @@ -0,0 +1,7 @@ +all: out03 +out03: in03 ../03/out02 + ../03/out02 +%.html: %.md ../markdown + ../markdown $< +clean: + rm -f out* README.html diff --git a/04a/in03 b/04a/in03 new file mode 100644 index 0000000..acd18ab --- /dev/null +++ b/04a/in03 @@ -0,0 +1,74 @@ +I=8S +A=d3 +?I!A:usage_error +; open input file + J=S + ; argv[1] is at *(rsp+16) + J+=d16 + J=8J + I=d0 + syscall x2 + J=A + ?J<0:input_file_error +; open output file + J=S + ; argv[2] is at *(rsp+24) + J+=d24 + J=8J + I=x241 + D=x1ed + syscall x2 + J=A + ?J<0:output_file_error +J=d0 +syscall x3c + +:usage_error + B=:usage_error_message + call :error + +:usage_error_message + str Please provide an input and an output file. + xa + x0 + +:input_file_error + B=:input_file_error_message + !:error + +:input_file_error_message + str Couldn't open input file. + xa + x0 + +:output_file_error + B=:output_file_error_message + !:error + +:output_file_error_message + str Couldn't open output file. + xa + x0 + +:error + J=B + call :strlen + D=A + I=J + J=d2 + syscall x1 + J=d1 + syscall x3c + +:strlen + I=B + D=B + :strlen_loop + C=1I + ?C=0:strlen_ret + I+=d1 + !:strlen_loop + :strlen_ret + I-=D + A=I + return diff --git a/04a/in04a b/04a/in04a new file mode 100644 index 0000000..c08c184 --- /dev/null +++ b/04a/in04a @@ -0,0 +1,3 @@ +#define A 777 +#define B 226 +A+B diff --git a/04b/Makefile b/04b/Makefile new file mode 100644 index 0000000..e6187d4 --- /dev/null +++ b/04b/Makefile @@ -0,0 +1,7 @@ +all: out03 +out03: in03 ../03/out02 + ../03/out02 +%.html: %.md ../markdown + ../markdown $< +clean: + rm -f out* README.html diff --git a/04b/in04 b/04b/in04 new file mode 100644 index 0000000..1b362ad --- /dev/null +++ b/04b/in04 @@ -0,0 +1,95 @@ +// types: char, uchar, short, ushort, int, uint, long, ulong, *type +// declaration: +// static ; +// local ; +// :