From df0d6a4503a26508553510b4050eaa79f52e4e4e Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Sun, 18 Oct 2020 18:22:31 +0300 Subject: Another step to release. --- Makefile | 22 +- README | 17 +- base/smack.c | 579 +++++++++ base/strans.c | 652 ++++++++++ bifreq.sts | 685 ----------- cipher.sts | 12 - common/common.sts | 3 - common/const.sts | 95 -- common/macro.sts | 9 - common/print.sts | 30 - cryptrobber.sts | 213 ++++ encrypt.sts | 6 +- enki/smack.c | 579 --------- enki/strans.c | 652 ---------- freq.sts | 35 - ia32/bitwise.sts | 27 - ia32/branch.sts | 11 - ia32/const.sts | 3 - ia32/core.sts | 17 - ia32/elf/begin.sts | 129 -- ia32/elf/end.sts | 21 - ia32/elf/syscall.sts | 41 - ia32/float/control.sts | 19 - ia32/float/float.sts | 3 - ia32/float/math.sts | 32 - ia32/float/stack.sts | 25 - ia32/ia32.sts | 8 - ia32/macro.sts | 86 -- ia32/math.sts | 68 -- ia32/memory.sts | 10 - ia32/stack.sts | 41 - kernel-options.txt | 884 -------------- keygen.sts | 34 - main.sts | 210 ---- man.txt | 96 -- orwell.txt | 2850 -------------------------------------------- samples/kernel-options.txt | 884 ++++++++++++++ samples/man.txt | 96 ++ samples/orwell.txt | 2850 ++++++++++++++++++++++++++++++++++++++++++++ samples/speculation.txt | 90 ++ samples/spinlocks.txt | 167 +++ speculation.txt | 90 -- spinlocks.txt | 167 --- sts/bifreq.sts | 685 +++++++++++ sts/cipher.sts | 12 + sts/common/.print.sts.swp | Bin 0 -> 12288 bytes sts/common/common.sts | 3 + sts/common/const.sts | 95 ++ sts/common/macro.sts | 9 + sts/common/print.sts | 30 + sts/freq.sts | 35 + sts/ia32/bitwise.sts | 27 + sts/ia32/branch.sts | 11 + sts/ia32/const.sts | 3 + sts/ia32/core.sts | 17 + sts/ia32/elf/begin.sts | 129 ++ sts/ia32/elf/end.sts | 21 + sts/ia32/elf/syscall.sts | 41 + sts/ia32/float/control.sts | 19 + sts/ia32/float/float.sts | 3 + sts/ia32/float/math.sts | 32 + sts/ia32/float/stack.sts | 25 + sts/ia32/ia32.sts | 8 + sts/ia32/macro.sts | 86 ++ sts/ia32/math.sts | 68 ++ sts/ia32/memory.sts | 10 + sts/ia32/stack.sts | 41 + sts/keygen.sts | 34 + test.sts | 10 - 69 files changed, 7002 insertions(+), 7000 deletions(-) create mode 100644 base/smack.c create mode 100644 base/strans.c delete mode 100644 bifreq.sts delete mode 100644 cipher.sts delete mode 100644 common/common.sts delete mode 100644 common/const.sts delete mode 100644 common/macro.sts delete mode 100644 common/print.sts create mode 100644 cryptrobber.sts delete mode 100644 enki/smack.c delete mode 100644 enki/strans.c delete mode 100644 freq.sts delete mode 100644 ia32/bitwise.sts delete mode 100644 ia32/branch.sts delete mode 100644 ia32/const.sts delete mode 100644 ia32/core.sts delete mode 100644 ia32/elf/begin.sts delete mode 100644 ia32/elf/end.sts delete mode 100644 ia32/elf/syscall.sts delete mode 100644 ia32/float/control.sts delete mode 100644 ia32/float/float.sts delete mode 100644 ia32/float/math.sts delete mode 100644 ia32/float/stack.sts delete mode 100644 ia32/ia32.sts delete mode 100644 ia32/macro.sts delete mode 100644 ia32/math.sts delete mode 100644 ia32/memory.sts delete mode 100644 ia32/stack.sts delete mode 100644 kernel-options.txt delete mode 100644 keygen.sts delete mode 100644 main.sts delete mode 100644 man.txt delete mode 100644 orwell.txt create mode 100644 samples/kernel-options.txt create mode 100644 samples/man.txt create mode 100644 samples/orwell.txt create mode 100644 samples/speculation.txt create mode 100644 samples/spinlocks.txt delete mode 100644 speculation.txt delete mode 100644 spinlocks.txt create mode 100644 sts/bifreq.sts create mode 100644 sts/cipher.sts create mode 100644 sts/common/.print.sts.swp create mode 100644 sts/common/common.sts create mode 100644 sts/common/const.sts create mode 100644 sts/common/macro.sts create mode 100644 sts/common/print.sts create mode 100644 sts/freq.sts create mode 100644 sts/ia32/bitwise.sts create mode 100644 sts/ia32/branch.sts create mode 100644 sts/ia32/const.sts create mode 100644 sts/ia32/core.sts create mode 100644 sts/ia32/elf/begin.sts create mode 100644 sts/ia32/elf/end.sts create mode 100644 sts/ia32/elf/syscall.sts create mode 100644 sts/ia32/float/control.sts create mode 100644 sts/ia32/float/float.sts create mode 100644 sts/ia32/float/math.sts create mode 100644 sts/ia32/float/stack.sts create mode 100644 sts/ia32/ia32.sts create mode 100644 sts/ia32/macro.sts create mode 100644 sts/ia32/math.sts create mode 100644 sts/ia32/memory.sts create mode 100644 sts/ia32/stack.sts create mode 100644 sts/keygen.sts delete mode 100644 test.sts diff --git a/Makefile b/Makefile index 823e0f2..c0230f2 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,19 @@ -all: cryptrobber encrypt test -.PHONY: all clean cryptrobber encrypt test +all: cryptrobber encrypt +.PHONY: all clean cryptrobber encrypt -cryptrobber: enki/smack enki/strans - enki/smack main.sts | enki/strans > $@ +cryptrobber: base/smack base/strans + base/smack cryptrobber.sts | base/strans > $@ chmod 0755 $@ -encrypt: enki/smack enki/strans - enki/smack encrypt.sts | enki/strans > $@ +encrypt: base/smack base/strans + base/smack encrypt.sts | base/strans > $@ chmod 0755 $@ -test: enki/smack enki/strans - enki/smack test.sts | enki/strans > $@ - chmod 0755 $@ - -enki/smack: enki/smack.c +base/smack: base/smack.c gcc $< -o $@ -enki/strans: enki/strans.c +base/strans: base/strans.c gcc $< -o $@ clean: - rm -f enki/smack enki/strans cryptrobber encrypt test + rm -f base/smack base/strans cryptrobber encrypt diff --git a/README b/README index f8eda72..88213dc 100644 --- a/README +++ b/README @@ -1,3 +1,5 @@ +-= Overview + This program will work only on Linux. To build everything run 'make'. @@ -7,9 +9,20 @@ Simple test can be done with ./encrpyt < README | ./cryptrobber > README.copy The test should show that original text is written in english -and that default key is 31 32 33 in hex or 123 as ASCII. +and that default key is 31 32 in hex. Since the key can be anything +it is printted in hex, but you can lookup ASCII to find what string it is. Decrypted README will be in README.copy. +-= Project Structure + +'base' directory contains strans translator and smack macro processor. +STS files in project root directory are main files of corresponding programs. +'encrypt' will encrypt its input with hardcoded key. You can use it as: + + ./encrpyt < file_to_your_file > path_to_save_encrypted_data +'cryptrobber' will try different keys on it input, and if deciphered text +will met requirements cryptrobber will output predicted language and key. +So the thing is breaking encrypted files, use it as: -Following text is added for stability: + ./cryptrobber < path_to_encrypted_data > path_to_save_decrypted_data diff --git a/base/smack.c b/base/smack.c new file mode 100644 index 0000000..f6f9f30 --- /dev/null +++ b/base/smack.c @@ -0,0 +1,579 @@ +/* + Simple Macro Generator + created by exegete +*/ + +#include +#include +#include + +struct macro +{ + const char *lexem; + unsigned long long param_count; + const char *text; + struct macro *next; +}; + +struct macro_parameter +{ + char *lexem; + struct macro_parameter *next; +}; + +struct input_stream +{ + FILE *fd; + const struct macro *macro; + unsigned long long text_offset; + struct macro_parameter *param_list; + struct input_stream *next; +}; + +struct module +{ + const char *file_name; + struct module *next; +}; + +#define ERROR_STATUS_ARG 1 +#define ERROR_STATUS_OPEN 2 +#define ERROR_STATUS_CHDIR 3 +#define ERROR_STATUS_MALLOC 4 +#define ERROR_STATUS_EMPTY_STREAM_LIST 5 +#define ERROR_STATUS_INVALID_STREAM 6 +#define ERROR_STATUS_INVALID_MACRO 7 +#define ERROR_STATUS_INVALID_PARAMETER 8 +#define ERROR_STATUS_INVALID_CALL 9 +#define ERROR_STATUS_INVALID_INCLUDE 10 +#define ERROR_STATUS_INVALID_SHIELD 11 + +const char *error_msgs[] = +{ + "Please, specify input file", + "Unable to open file: ", + "Unable to change working directory: ", + "Unable to allocate memory", + "Input stream list is empty", + "Input stream is invalid", + "Macro definition is invalid", + "Macro parameter is invalid", + "Macro call is invalid", + "Invalid include/module argument", + "Invalid '#' argument" +}; + +void exit_error(int status, const char *msg) +{ + if(msg) + fprintf(stderr, "Error: %s%s\n", error_msgs[status - 1], msg); + else + fprintf(stderr, "Error: %s\n", error_msgs[status - 1]); + exit(status); +} + +void add_input_stream(struct input_stream **stream_list, + FILE *fd, const struct macro *macro) +{ + struct input_stream *head = *stream_list; + *stream_list = malloc(sizeof(struct input_stream)); + if(!*stream_list) + exit_error(ERROR_STATUS_MALLOC, NULL); + (*stream_list)->fd = fd; + (*stream_list)->macro = macro; + (*stream_list)->text_offset = 0; + (*stream_list)->param_list = NULL; + (*stream_list)->next = head; +} + +int delete_input_stream(struct input_stream **stream_list) +{ + struct input_stream *head = *stream_list; + if(!head) + exit_error(ERROR_STATUS_EMPTY_STREAM_LIST, NULL); + *stream_list = (*stream_list)->next; + if(head->fd) + fclose(head->fd); + while(head->param_list) + { + struct macro_parameter *param_head = head->param_list; + head->param_list = param_head->next; + free(param_head->lexem); + free(param_head); + } + free(head); + return *stream_list != NULL; +} + +void add_input_stream_parameter(struct input_stream *stream_list, char *lexem) +{ + struct macro_parameter **param = &stream_list->param_list; + while(*param) + param = &(*param)->next; + *param = malloc(sizeof(struct macro_parameter)); + if(!*param) + exit_error(ERROR_STATUS_MALLOC, NULL); + (*param)->lexem = lexem; + (*param)->next = NULL; +} + +const char *get_input_stream_parameter(struct input_stream *stream_list, + unsigned long long chosen) +{ + struct macro_parameter *param = stream_list->param_list; + if(!chosen) + return stream_list->macro->lexem; + chosen--; + for(; param && chosen > 0; chosen--) + param = param->next; + if(!param) + exit_error(ERROR_STATUS_INVALID_CALL, NULL); + return param->lexem; +} + +#define BUFFER_INITIAL_SIZE 4 + +int double_buffer(char **buffer, unsigned long long *buffer_size) +{ + char *tmp_pointer = *buffer; + unsigned long long tmp_size = *buffer_size; + + if(*buffer_size == 0) + *buffer_size = BUFFER_INITIAL_SIZE; + else + *buffer_size *= 2; + + *buffer = malloc(*buffer_size); + if(!*buffer) + return 0; + + for(; tmp_size > 0; tmp_size--) + (*buffer)[tmp_size - 1] = tmp_pointer[tmp_size - 1]; + + free(tmp_pointer); + return 1; +} + +int read_symb_from_text(struct input_stream *stream_list) +{ + char symb; + if(!stream_list->macro) + exit_error(ERROR_STATUS_INVALID_STREAM, NULL); + if(!stream_list->macro->text) + exit_error(ERROR_STATUS_INVALID_STREAM, NULL); + symb = stream_list->macro->text[stream_list->text_offset]; + if(!symb) + return EOF; + stream_list->text_offset++; + return symb; +} + +#define COMMENT_SYMB ';' + +int read_real_symb(struct input_stream *stream_list) +{ + int symb; + + if(!stream_list) + exit_error(ERROR_STATUS_EMPTY_STREAM_LIST, NULL); + + if(stream_list->fd) + symb = fgetc(stream_list->fd); + else + symb = read_symb_from_text(stream_list); + + if(symb == COMMENT_SYMB) + { + for(; symb != '\n' && symb != EOF; + symb = fgetc(stream_list->fd)) + {} + } + return symb; +} + +#define SHIELD_SYMB '\\' + +int read_symb(struct input_stream *stream_list, int *shield) +{ + int symb = read_real_symb(stream_list); + if(shield) + { + *shield = 0; + if(symb == SHIELD_SYMB) + { + symb = read_real_symb(stream_list); + *shield = 1; + } + } + return symb; +} + +int is_symb_hex(char symb) +{ + if(symb >= '0' && symb <= '9') + return symb - '0'; + else + if(symb >= 'A' && symb <= 'F') + return symb - 'A' + 10; + else + if(symb >= 'a' && symb <= 'f') + return symb - 'a' + 10; + else + return -1; +} + +int is_lexem_hex(const char *lexem, unsigned long long *dest) +{ + int sign = 0; + unsigned long long hex = 0; + if(*lexem == '-' && *(lexem + 1)) + { + sign = 1; + lexem++; + } + + for(; *lexem; lexem++) + { + int num = is_symb_hex(*lexem); + if(num != -1) + hex = (hex << 4) + num; + else + return 0; + } + hex = sign ? ~hex + 1 : hex; + if(dest) + *dest = hex; + return 1; +} + +int compare_lexems(const char *lexem_one, const char *lexem_two) +{ + for(; *lexem_one && *lexem_two; lexem_one++, lexem_two++) + if(*lexem_one != *lexem_two) + return 0; + return *lexem_one == *lexem_two; +} + +char *copy_lexem(const char *lexem) +{ + char *buffer = NULL; + unsigned long long buffer_size = 0; + unsigned long long index; + + for(index = 0;; index++) + { + if(index == buffer_size) + if(!double_buffer(&buffer, &buffer_size)) + exit_error(ERROR_STATUS_MALLOC, NULL); + buffer[index] = lexem[index]; + if(!lexem[index]) + break; + } + return buffer; +} + +#define EVAL_SYMB '%' + +unsigned long long get_eval_end(const char *lexem) +{ + unsigned long long counter = 0; + + for(; *lexem && *lexem != EVAL_SYMB; lexem++, counter++) + {} + if(!*lexem) + exit_error(ERROR_STATUS_INVALID_CALL, NULL); + return counter; +} + +char *param_eval(struct input_stream *stream_list, char *lexem) +{ + char *input_lexem = lexem; + char *buffer = NULL; + unsigned long long buffer_size = 0; + const char *param = NULL; + unsigned long long index = 0; + + for(;;) + { + char symb = param && *param ? *param : *lexem++; + param = !param || !*param ? NULL : param + 1; + if(symb == EVAL_SYMB) + { + unsigned long long param_offset = get_eval_end(lexem); + unsigned long long param_num; + *(lexem + param_offset) = 0; + if(!is_lexem_hex(lexem, ¶m_num)) + exit_error(ERROR_STATUS_INVALID_CALL, NULL); + lexem += param_offset + 1; + param = get_input_stream_parameter(stream_list, + param_num); + continue; + } + if(index == buffer_size) + if(!double_buffer(&buffer, &buffer_size)) + exit_error(ERROR_STATUS_MALLOC, NULL); + buffer[index] = symb; + if(!symb) + break; + index++; + } + free(input_lexem); + return buffer; +} + +int is_separator(int symb) +{ + return symb == ' ' || symb == '\n' || symb == '\t' || symb == '\r'; +} + +char *read_lexem(struct input_stream *stream_list) +{ + char *buffer = NULL; + unsigned long long buffer_size = 0; + int symb; + int shield; + unsigned long long index; + + for(;;) + { + symb = read_symb(stream_list, &shield); + if(is_separator(symb) && !shield) + continue; + if(symb == EOF) + return NULL; + break; + } + + for(index = 0;; index++) + { + if(index == buffer_size) + if(!double_buffer(&buffer, &buffer_size)) + exit_error(ERROR_STATUS_MALLOC, NULL); + if(symb == EOF || (is_separator(symb) && !shield)) + { + buffer[index] = 0; + break; + } + buffer[index] = symb; + symb = read_symb(stream_list, &shield); + } + buffer = param_eval(stream_list, buffer); + return buffer; +} + +#define MACRO_END_SYMB ']' + +const char *read_macro_text(struct input_stream *stream_list) +{ + char *buffer = NULL; + unsigned long long buffer_size = 0; + unsigned long long index; + + for(index = 0;; index++) + { + int shield; + int symb = read_symb(stream_list, &shield); + if(index == buffer_size) + if(!double_buffer(&buffer, &buffer_size)) + exit_error(ERROR_STATUS_MALLOC, NULL); + if(symb == EOF || (symb == MACRO_END_SYMB && !shield)) + { + buffer[index] = 0; + break; + } + buffer[index] = symb; + } + return buffer; +} + +void create_macro(struct input_stream *stream_list, struct macro **macro_list) +{ + char *param_count_lexem; + struct macro *head = *macro_list; + *macro_list = malloc(sizeof(struct macro)); + if(!*macro_list) + exit_error(ERROR_STATUS_MALLOC, NULL); + (*macro_list)->lexem = read_lexem(stream_list); + if(!(*macro_list)->lexem) + exit_error(ERROR_STATUS_INVALID_MACRO, NULL); + param_count_lexem = read_lexem(stream_list); + if(!param_count_lexem || !is_lexem_hex(param_count_lexem, + &(*macro_list)->param_count)) + exit_error(ERROR_STATUS_INVALID_MACRO, NULL); + free(param_count_lexem); + (*macro_list)->text = read_macro_text(stream_list); + (*macro_list)->next = head; +} + +int find_module(struct module *module_list, const char *file_name) +{ + for(; module_list; module_list = module_list->next) + if(compare_lexems(module_list->file_name, file_name)) + return 1; + return 0; +} + +void add_module(struct module **module_list, const char *file_name) +{ + struct module *head = *module_list; + *module_list = malloc(sizeof(struct module)); + if(!*module_list) + exit_error(ERROR_STATUS_MALLOC, NULL); + (*module_list)->file_name = file_name; + (*module_list)->next = head; +} + +void include_file(struct input_stream **stream_list, + struct module **module_list) +{ + char *file_name = read_lexem(*stream_list); + FILE *fd; + if(!file_name) + exit_error(ERROR_STATUS_INVALID_INCLUDE, NULL); + if(module_list && find_module(*module_list, file_name)) + { + free(file_name); + return; + } + fd = fopen(file_name, "r"); + if(!fd) + exit_error(ERROR_STATUS_OPEN, file_name); + if(module_list) + add_module(module_list, file_name); + else + free(file_name); + add_input_stream(stream_list, fd, NULL); +} + +void push_parameter(struct input_stream *input_stream, + struct input_stream *actual_stream) +{ + char *lexem = read_lexem(input_stream); + if(!lexem) + exit_error(ERROR_STATUS_INVALID_PARAMETER, NULL); + add_input_stream_parameter(actual_stream, lexem); +} + +int find_macro(struct input_stream **stream_list, struct macro *macro_list, + const char *lexem) +{ + for(; macro_list; macro_list = macro_list->next) + { + if(compare_lexems(macro_list->lexem, lexem)) + { + struct input_stream *old_stream = *stream_list; + unsigned long long param_count = + macro_list->param_count; + add_input_stream(stream_list, NULL, macro_list); + for(; param_count > 0; param_count--) + push_parameter(old_stream, *stream_list); + return 1; + } + } + return 0; +} + +#define DIRECTORY_SEPARATOR_SYMB '/' + +unsigned long long find_last_dir_separator_pos(const char *file_name) +{ + const char *orig_file_name = file_name; + unsigned long long pos = 0; + for(; *file_name; file_name++) + if(*file_name == DIRECTORY_SEPARATOR_SYMB) + pos = file_name - orig_file_name; + return pos; +} + +void initialize_stream(struct input_stream **stream_list, + const char *file_name) +{ + char *dir_path = copy_lexem(file_name); + unsigned long long dir_sep_pos = find_last_dir_separator_pos(dir_path); + FILE *fd = fopen(file_name, "r"); + if(!fd) + exit_error(ERROR_STATUS_OPEN, file_name); + add_input_stream(stream_list, fd, NULL); + if(dir_sep_pos) + { + dir_path[dir_sep_pos] = 0; + if(chdir(dir_path) == -1) + exit_error(ERROR_STATUS_CHDIR, NULL); + } + free(dir_path); +} + +void print_lexem(const char *lexem) +{ + printf("%s ", lexem); +} + +#define MACRO_SHIELD_LEXEM "#" +#define MACRO_START_LEXEM "[" +#define MACRO_INCLUDE_LEXEM "include" +#define MACRO_MODULE_LEXEM "module" +#define MACRO_LIT_LEXEM "literal" + +int main(int argc, char **argv) +{ + struct input_stream *stream_list = NULL; + struct macro *macro_list = NULL; + struct module *module_list = NULL; + char *lexem; + + if(argc <= 1) + exit_error(ERROR_STATUS_ARG, NULL); + else + initialize_stream(&stream_list, argv[1]); + + for(;; free(lexem)) + { + lexem = read_lexem(stream_list); + if(!lexem) + { + if(delete_input_stream(&stream_list)) + continue; + else + break; + } + if(compare_lexems(lexem, MACRO_SHIELD_LEXEM)) + { + free(lexem); + lexem = read_lexem(stream_list); + if(!lexem) + exit_error(ERROR_STATUS_INVALID_SHIELD, NULL); + print_lexem(lexem); + continue; + } + if(compare_lexems(lexem, MACRO_START_LEXEM)) + { + create_macro(stream_list, ¯o_list); + continue; + } + if(compare_lexems(lexem, MACRO_INCLUDE_LEXEM)) + { + include_file(&stream_list, NULL); + continue; + } + if(compare_lexems(lexem, MACRO_MODULE_LEXEM)) + { + include_file(&stream_list, &module_list); + continue; + } + if(is_lexem_hex(lexem, NULL)) + { + if(find_macro(&stream_list, macro_list, + MACRO_LIT_LEXEM)) + { + add_input_stream_parameter(stream_list, + copy_lexem(lexem)); + continue; + } + } + if(find_macro(&stream_list, macro_list, lexem)) + continue; + print_lexem(lexem); + } + + return 0; +} diff --git a/base/strans.c b/base/strans.c new file mode 100644 index 0000000..e3d834d --- /dev/null +++ b/base/strans.c @@ -0,0 +1,652 @@ +/* + Simple Stack Translator + created by exegete +*/ + +#include +#include + +struct stack_elem +{ + unsigned long long value; + struct stack_elem *next; +}; + +struct identifier +{ + const char *lexem; + unsigned long long value; + struct identifier *next; +}; + +struct segment +{ + char *buffer; + unsigned long long real_size; + unsigned long long size; + unsigned long long pointer_address; + unsigned long long base_address; + unsigned long long base_offset; + int data_size; + int data_endianness; + struct segment *next; +}; + +struct environment +{ + struct stack_elem *stack; + struct identifier *id_list; + struct segment *seg_list; + unsigned long long chosen_segment; +}; + +struct operator +{ + void (*func)(struct environment *env); + const char *lexem; +}; + +#define ERROR_STATUS_STACK_OVERFLOW 1 +#define ERROR_STATUS_STACK_EMPTY 2 +#define ERROR_STATUS_ID_LIST_OVERFLOW 3 +#define ERROR_STATUS_SEG_LIST_OVERFLOW 4 +#define ERROR_STATUS_INVALID_SEGMENT 5 +#define ERROR_STATUS_WORD_BUFFER_OVERFLOW 6 +#define ERROR_STATUS_LEXEM_OVERFLOW 7 +#define ERROR_STATUS_UNDEFINED 8 +#define ERROR_STATUS_INVALID_ACCESS 9 +#define ERROR_STATUS_INVALID_WORD_SIZE 10 +#define ERROR_STATUS_WORD_ENDIANNESS_INVALID 11 + +const char *error_msgs[] = +{ + "Stack overflow", + "Stack is empty", + "Identifier list overflow", + "Segment list overflow", + "Invalid chosen segment", + "Word buffer overflow", + "Lexem is too big", + "Undefined lexem: ", + "Invalid segment access", + "Invalid segment data size", + "Invalid segment data endianness" +}; + +void exit_error(int status, const char *lexem) +{ + if(lexem) + fprintf(stderr, "Error: %s%s\n", error_msgs[status - 1], + lexem); + else + fprintf(stderr, "Error: %s\n", error_msgs[status - 1]); + exit(status); +} + +unsigned long long create_segment(struct environment *env) +{ + struct segment **chosen_segment = &env->seg_list; + unsigned long long segment_counter = 0; + for(; *chosen_segment; chosen_segment = &(*chosen_segment)->next) + segment_counter++; + *chosen_segment = malloc(sizeof(struct segment)); + if(!*chosen_segment) + exit_error(ERROR_STATUS_SEG_LIST_OVERFLOW, NULL); + (*chosen_segment)->buffer = NULL; + (*chosen_segment)->real_size = 0; + (*chosen_segment)->size = 0; + (*chosen_segment)->pointer_address = 0; + (*chosen_segment)->base_address = 0; + (*chosen_segment)->base_offset = 0; + (*chosen_segment)->data_size = 1; + (*chosen_segment)->data_endianness = 0; + (*chosen_segment)->next = NULL; + return segment_counter; +} + +struct segment *get_segment(struct environment *env) +{ + struct segment *chosen_segment = env->seg_list; + unsigned long long segment_counter = env->chosen_segment; + while(chosen_segment && segment_counter--) + chosen_segment = chosen_segment->next; + if(!chosen_segment) + exit_error(ERROR_STATUS_INVALID_SEGMENT, NULL); + return chosen_segment; +} + +void initialize_environment(struct environment *env) +{ + env->stack = NULL; + env->id_list = NULL; + env->seg_list = NULL; + env->chosen_segment = 0; +} + +int is_separator(int symb) +{ + return symb == ' ' || symb == '\n' || symb == '\t' || symb == '\r'; +} + +#define BUFFER_INITIAL_SIZE 4 + +int double_buffer(char **buffer, unsigned long long *buffer_size) +{ + char *tmp_pointer = *buffer; + unsigned long long tmp_size = *buffer_size; + + if(*buffer_size == 0) + *buffer_size = BUFFER_INITIAL_SIZE; + else + *buffer_size *= 2; + + *buffer = malloc(*buffer_size); + if(!*buffer) + return 0; + + for(; tmp_size > 0; tmp_size--) + (*buffer)[tmp_size - 1] = tmp_pointer[tmp_size - 1]; + + free(tmp_pointer); + return 1; +} + +char *read_lexem() +{ + char *buffer = NULL; + unsigned long long buffer_size = 0; + int symb; + unsigned long long index; + + while(is_separator(symb = getchar())) + {} + + if(symb == EOF) + return NULL; + + for(index = 0;; index++) + { + if(index == buffer_size) + if(!double_buffer(&buffer, &buffer_size)) + exit_error(ERROR_STATUS_LEXEM_OVERFLOW, NULL); + if(symb == EOF || is_separator(symb)) + { + buffer[index] = 0; + break; + } + buffer[index] = symb; + symb = getchar(); + } + return buffer; +} + +void push_stack_elem(struct stack_elem **stack, unsigned long long value) +{ + struct stack_elem *head = *stack; + *stack = malloc(sizeof(struct stack_elem)); + if(!*stack) + exit_error(ERROR_STATUS_STACK_OVERFLOW, NULL); + (*stack)->value = value; + (*stack)->next = head; +} + +unsigned long long pop_stack_elem(struct stack_elem **stack) +{ + struct stack_elem *head = *stack; + unsigned long long value; + if(!head) + exit_error(ERROR_STATUS_STACK_EMPTY, NULL); + value = head->value; + *stack = head->next; + free(head); + return value; +} + +int is_symb_hex(char symb) +{ + if(symb >= '0' && symb <= '9') + return symb - '0'; + else + if(symb >= 'A' && symb <= 'F') + return symb - 'A' + 10; + else + if(symb >= 'a' && symb <= 'f') + return symb - 'a' + 10; + else + return -1; +} + +int is_lexem_hex(struct environment *env, const char *lexem) +{ + int sign = 0; + unsigned long long hex = 0; + if(*lexem == '-' && *(lexem + 1)) + { + sign = 1; + lexem++; + } + + for(; *lexem; lexem++) + { + int num = is_symb_hex(*lexem); + if(num != -1) + hex = (hex << 4) + num; + else + return 0; + } + hex = sign ? ~hex + 1 : hex; + push_stack_elem(&env->stack, hex); + return 1; +} + +int compare_lexems(const char *lexem_one, const char *lexem_two) +{ + for(; *lexem_one && *lexem_two; lexem_one++, lexem_two++) + if(*lexem_one != *lexem_two) + return 0; + return *lexem_one == *lexem_two; +} + +void add_identifier(struct identifier **id_list, const char *lexem, + unsigned long long value) +{ + struct identifier *head = *id_list; + *id_list = malloc(sizeof(struct identifier)); + if(!id_list) + exit_error(ERROR_STATUS_ID_LIST_OVERFLOW, NULL); + (*id_list)->lexem = lexem; + (*id_list)->value = value; + (*id_list)->next = head; +} + +int find_identifier(struct environment *env, const char *lexem) +{ + struct identifier *id_list = env->id_list; + for(; id_list; id_list = id_list->next) + { + if(compare_lexems(lexem, id_list->lexem)) + { + push_stack_elem(&env->stack, id_list->value); + return 1; + } + } + return 0; +} + +void segment_compile_byte(struct environment *env, char byte) +{ + unsigned long long index = get_segment(env)->size; + if(index == get_segment(env)->real_size) + if(!double_buffer(&get_segment(env)->buffer, + &get_segment(env)->real_size)) + exit_error(ERROR_STATUS_WORD_BUFFER_OVERFLOW, NULL); + get_segment(env)->buffer[index] = byte; + get_segment(env)->size++; + get_segment(env)->pointer_address++; +} + +void segment_compile(struct environment *env, unsigned long long value, + int size) +{ + int dir = get_segment(env)->data_endianness ? -1 : 1; + int index = get_segment(env)->data_endianness * (size - 1); + for(; index < size && index >= 0; index += dir) + segment_compile_byte(env, value >> index * 8); +} + +unsigned long long convert_address(struct environment *env, + unsigned long long address, int size) +{ + unsigned long long pointer_address = + get_segment(env)->pointer_address; + unsigned long long base_address = get_segment(env)->base_address; + unsigned long long base_offset = get_segment(env)->base_offset; + if(address < base_address || address + size > pointer_address) + exit_error(ERROR_STATUS_INVALID_ACCESS, NULL); + return address - base_address + base_offset; +} + +unsigned long long segment_read(struct environment *env, + unsigned long long address, int size) +{ + unsigned long long value = 0; + int dir = get_segment(env)->data_endianness ? 1 : -1; + int index = get_segment(env)->data_endianness ? 0 : (size - 1); + address = convert_address(env, address, size); + for(; index < size && index >= 0; index += dir) + value = (value << 8) + + (get_segment(env)->buffer[address + index] & 0xFF); + return value; +} + +void segment_write(struct environment *env, unsigned long long value, + unsigned long long address, int size) +{ + int dir = get_segment(env)->data_endianness ? -1 : 1; + int index = get_segment(env)->data_endianness * (size - 1); + address = convert_address(env, address, size); + for(; index < size && index >= 0; index += dir) + { + get_segment(env)->buffer[address + index] = value; + value >>= 8; + } +} + +void translator_drop(struct environment *env) +{ + pop_stack_elem(&env->stack); +} + +void translator_dup(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, value); + push_stack_elem(&env->stack, value); +} + +void translator_over(struct environment *env) +{ + unsigned long long value_one = pop_stack_elem(&env->stack); + unsigned long long value_two = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, value_two); + push_stack_elem(&env->stack, value_one); + push_stack_elem(&env->stack, value_two); +} + +void translator_swap(struct environment *env) +{ + unsigned long long value_one = pop_stack_elem(&env->stack); + unsigned long long value_two = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, value_one); + push_stack_elem(&env->stack, value_two); +} + +void translator_add(struct environment *env) +{ + unsigned long long first = pop_stack_elem(&env->stack); + unsigned long long second = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, second + first); +} + +void translator_sub(struct environment *env) +{ + unsigned long long first = pop_stack_elem(&env->stack); + unsigned long long second = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, second - first); +} + +void translator_mul(struct environment *env) +{ + unsigned long long first = pop_stack_elem(&env->stack); + unsigned long long second = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, second * first); +} + +void translator_div(struct environment *env) +{ + unsigned long long first = pop_stack_elem(&env->stack); + unsigned long long second = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, second / first); +} + +void translator_mod(struct environment *env) +{ + unsigned long long first = pop_stack_elem(&env->stack); + unsigned long long second = pop_stack_elem(&env->stack); + push_stack_elem(&env->stack, second % first); +} + +void translator_define_identifier(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + add_identifier(&env->id_list, read_lexem(), value); +} + +void translator_compile_one(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + segment_compile(env, value, 1); +} + +void translator_compile_two(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + segment_compile(env, value, 2); +} + +void translator_compile_four(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + segment_compile(env, value, 4); +} + +void translator_compile_eight(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + segment_compile(env, value, 8); +} + +void translator_compile(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + segment_compile(env, value, get_segment(env)->data_size); +} + +void translator_reserve(struct environment *env) +{ + unsigned long long count = pop_stack_elem(&env->stack); + while(count--) + segment_compile(env, 0, 1); +} + +void translator_read_one(struct environment *env) +{ + unsigned long long value = segment_read(env, + pop_stack_elem(&env->stack), 1); + push_stack_elem(&env->stack, value); +} + +void translator_read_two(struct environment *env) +{ + unsigned long long value = segment_read(env, + pop_stack_elem(&env->stack), 2); + push_stack_elem(&env->stack, value); +} + +void translator_read_four(struct environment *env) +{ + unsigned long long value = segment_read(env, + pop_stack_elem(&env->stack), 4); + push_stack_elem(&env->stack, value); +} + +void translator_read_eight(struct environment *env) +{ + unsigned long long value = segment_read(env, + pop_stack_elem(&env->stack), 8); + push_stack_elem(&env->stack, value); +} + +void translator_read(struct environment *env) +{ + unsigned long long value = segment_read(env, + pop_stack_elem(&env->stack), get_segment(env)->data_size); + push_stack_elem(&env->stack, value); +} + +void translator_write_one(struct environment *env) +{ + unsigned long long address = pop_stack_elem(&env->stack); + unsigned long long value = pop_stack_elem(&env->stack); + segment_write(env, value, address, 1); +} + +void translator_write_two(struct environment *env) +{ + unsigned long long address = pop_stack_elem(&env->stack); + unsigned long long value = pop_stack_elem(&env->stack); + segment_write(env, value, address, 2); +} + +void translator_write_four(struct environment *env) +{ + unsigned long long address = pop_stack_elem(&env->stack); + unsigned long long value = pop_stack_elem(&env->stack); + segment_write(env, value, address, 4); +} + +void translator_write_eight(struct environment *env) +{ + unsigned long long address = pop_stack_elem(&env->stack); + unsigned long long value = pop_stack_elem(&env->stack); + segment_write(env, value, address, 8); +} + +void translator_write(struct environment *env) +{ + unsigned long long address = pop_stack_elem(&env->stack); + unsigned long long value = pop_stack_elem(&env->stack); + segment_write(env, value, address, get_segment(env)->data_size); +} + +void translator_create_segment(struct environment *env) +{ + push_stack_elem(&env->stack, create_segment(env)); +} + +void translator_choose_segment(struct environment *env) +{ + env->chosen_segment = pop_stack_elem(&env->stack); +} + +void translator_set_base(struct environment *env) +{ + get_segment(env)->base_address = pop_stack_elem(&env->stack); + get_segment(env)->pointer_address = get_segment(env)->base_address; + get_segment(env)->base_offset = get_segment(env)->size; +} + +#define WORD_SIZE_MAX 8 + +void translator_set_data_size(struct environment *env) +{ + int target_size = pop_stack_elem(&env->stack); + if(target_size <= 0 || target_size > WORD_SIZE_MAX) + exit_error(ERROR_STATUS_INVALID_WORD_SIZE, NULL); + get_segment(env)->data_size = target_size; +} + +void translator_set_data_endianness(struct environment *env) +{ + int endianness = pop_stack_elem(&env->stack); + if(endianness > 1) + exit_error(ERROR_STATUS_WORD_ENDIANNESS_INVALID, NULL); + get_segment(env)->data_endianness = endianness; +} + +void translator_get_offset(struct environment *env) +{ + push_stack_elem(&env->stack, get_segment(env)->pointer_address); +} + +void translator_get_base(struct environment *env) +{ + push_stack_elem(&env->stack, get_segment(env)->base_address); +} + +void translator_print(struct environment *env) +{ + unsigned long long value = pop_stack_elem(&env->stack); + fprintf(stderr, "%llx\n", value); +} + +const struct operator translator_operators[] = +{ + { &translator_drop, "?drop" }, + { &translator_dup, "?dup" }, + { &translator_over, "?over" }, + { &translator_swap, "?swap" }, + { &translator_add, "?+" }, + { &translator_sub, "?-" }, + { &translator_mul, "?*" }, + { &translator_div, "?/" }, + { &translator_mod, "?mod" }, + { &translator_define_identifier, "??" }, + { &translator_compile_one, "?'" }, + { &translator_compile_one, "?1." }, + { &translator_compile_two, "?2." }, + { &translator_compile_four, "?4." }, + { &translator_compile_eight, "?8." }, + { &translator_compile, "?." }, + { &translator_reserve, "?res" }, + { &translator_read_one, "?1@" }, + { &translator_read_two, "?2@" }, + { &translator_read_four, "?4@" }, + { &translator_read_eight, "?8@" }, + { &translator_read, "?@" }, + { &translator_write_one, "?1!" }, + { &translator_write_two, "?2!" }, + { &translator_write_four, "?4!" }, + { &translator_write_eight, "?8!" }, + { &translator_write, "?!" }, + { &translator_create_segment, "?create" }, + { &translator_choose_segment, "?choose" }, + { &translator_set_base, "?org" }, + { &translator_set_data_size, "?size" }, + { &translator_set_data_endianness, "?endianness" }, + { &translator_get_offset, "?$" }, + { &translator_get_base, "?$$" }, + { &translator_print, "?print" }, +}; + +int execute_operator(struct environment *env, const char *lexem) +{ + int operators_count = + sizeof(translator_operators) / sizeof(*translator_operators); + int index; + + for(index = 0; index < operators_count; index++) + { + if(compare_lexems(lexem, translator_operators[index].lexem)) + { + (*translator_operators[index].func)(env); + break; + } + } + + return index != operators_count; +} + +void print_target_buffer(struct environment *env) +{ + struct segment *seg_list; + unsigned long long index; + for(seg_list = env->seg_list; seg_list; seg_list = seg_list->next) + for(index = 0; index < seg_list->size; index++) + putchar(seg_list->buffer[index]); +} + +int main() +{ + struct environment env; + char *lexem; + + initialize_environment(&env); + + for(;; free(lexem)) + { + lexem = read_lexem(); + if(!lexem) + break; + if(find_identifier(&env, lexem)) + continue; + if(is_lexem_hex(&env, lexem)) + continue; + if(!execute_operator(&env, lexem)) + exit_error(ERROR_STATUS_UNDEFINED, lexem); + } + + print_target_buffer(&env); + + return 0; +} diff --git a/bifreq.sts b/bifreq.sts deleted file mode 100644 index dcf4858..0000000 --- a/bifreq.sts +++ /dev/null @@ -1,685 +0,0 @@ -[ bifreq_push_eng 1 - %1% float_iload - 1 01bcf4a2 float_dload - float_div - float_fstore -] - -defword bifreq_eng - bifreq_push_eng 1a4337 - bifreq_push_eng 85e79e - bifreq_push_eng 111342b - bifreq_push_eng e30232 - bifreq_push_eng c735b - bifreq_push_eng 5703a7 - bifreq_push_eng 866b32 - bifreq_push_eng 21f476 - bifreq_push_eng d53d87 - bifreq_push_eng d4776 - bifreq_push_eng 4e639f - bifreq_push_eng 2471000 - bifreq_push_eng f3c62d - bifreq_push_eng 428af4b - bifreq_push_eng b6ffe - bifreq_push_eng 8285b7 - bifreq_push_eng 4cebc - bifreq_push_eng 286426e - bifreq_push_eng 2406236 - bifreq_push_eng 2e09c84 - bifreq_push_eng 4a86c8 - bifreq_push_eng 7e7a75 - bifreq_push_eng 3bcc70 - bifreq_push_eng a155a - bifreq_push_eng afd558 - bifreq_push_eng bb967 - bifreq_push_eng 874e85 - bifreq_push_eng a8406 - bifreq_push_eng 4e37c - bifreq_push_eng 229b8 - bifreq_push_eng 12910c9 - bifreq_push_eng 12658 - bifreq_push_eng 9e44 - bifreq_push_eng 25b79 - bifreq_push_eng 42796e - bifreq_push_eng 44ff0 - bifreq_push_eng 6971 - bifreq_push_eng 69e974 - bifreq_push_eng 2ed3f - bifreq_push_eng 19e8d - bifreq_push_eng 7cb36b - bifreq_push_eng 1c1d9 - bifreq_push_eng 1589 - bifreq_push_eng 468318 - bifreq_push_eng 158288 - bifreq_push_eng 688f4 - bifreq_push_eng 7bcc77 - bifreq_push_eng 1d511 - bifreq_push_eng 2239d - bifreq_push_eng bcd - bifreq_push_eng 4fd5ca - bifreq_push_eng 1fc4 - bifreq_push_eng 1301e82 - bifreq_push_eng 48c45 - bifreq_push_eng 2e2e3c - bifreq_push_eng 57823 - bifreq_push_eng 12e2de3 - bifreq_push_eng 4156e - bifreq_push_eng 2c556 - bifreq_push_eng 133338e - bifreq_push_eng 80e084 - bifreq_push_eng a236 - bifreq_push_eng 6df0e3 - bifreq_push_eng 56b804 - bifreq_push_eng 45cf6 - bifreq_push_eng 2de8e - bifreq_push_eng 197f9cd - bifreq_push_eng 5d7cb - bifreq_push_eng 2676a - bifreq_push_eng 54246b - bifreq_push_eng 1514e8 - bifreq_push_eng b56870 - bifreq_push_eng 46408d - bifreq_push_eng 17010 - bifreq_push_eng 3ece5 - bifreq_push_eng 14b4 - bifreq_push_eng 1179e4 - bifreq_push_eng e23a - bifreq_push_eng 10c4fb7 - bifreq_push_eng 5d2e5f - bifreq_push_eng 39b751 - bifreq_push_eng 3d0dfb - bifreq_push_eng 19c714b - bifreq_push_eng 3d8d56 - bifreq_push_eng 25439b - bifreq_push_eng 45f925 - bifreq_push_eng 14ab80e - bifreq_push_eng c3286 - bifreq_push_eng 805b0 - bifreq_push_eng 2e8dc1 - bifreq_push_eng 361749 - bifreq_push_eng 2b57ca - bifreq_push_eng c83342 - bifreq_push_eng 2ffd53 - bifreq_push_eng 452b2 - bifreq_push_eng 5700f7 - bifreq_push_eng 9f25bf - bifreq_push_eng f07939 - bifreq_push_eng 596fbf - bifreq_push_eng 12e625 - bifreq_push_eng 4adf3e - bifreq_push_eng 6b15 - bifreq_push_eng 21d838 - bifreq_push_eng 17ef6 - bifreq_push_eng 2952912 - bifreq_push_eng 949a2e - bifreq_push_eng 1894eb6 - bifreq_push_eng 2c7ca98 - bifreq_push_eng 11a4196 - bifreq_push_eng ca3683 - bifreq_push_eng 7e70ff - bifreq_push_eng 7357e5 - bifreq_push_eng f48d23 - bifreq_push_eng 132e21 - bifreq_push_eng 24cc77 - bifreq_push_eng 1605c18 - bifreq_push_eng 114e00e - bifreq_push_eng 2eb8c2c - bifreq_push_eng ce5cda - bifreq_push_eng d5feb9 - bifreq_push_eng 164cbc - bifreq_push_eng 498fa2e - bifreq_push_eng 366d375 - bifreq_push_eng 1f59868 - bifreq_push_eng 381012 - bifreq_push_eng a158bb - bifreq_push_eng e17856 - bifreq_push_eng 5633d3 - bifreq_push_eng 72df96 - bifreq_push_eng 71a3a - bifreq_push_eng 7f8829 - bifreq_push_eng d8d5b - bifreq_push_eng 17f7e7 - bifreq_push_eng b69fb - bifreq_push_eng 822589 - bifreq_push_eng 5cdb8f - bifreq_push_eng 9bb3e - bifreq_push_eng 170114 - bifreq_push_eng b702e9 - bifreq_push_eng 41e29 - bifreq_push_eng 37e29 - bifreq_push_eng 2c1c57 - bifreq_push_eng 1317f0 - bifreq_push_eng 8275a - bifreq_push_eng 120c0fc - bifreq_push_eng 124ee5 - bifreq_push_eng b990 - bifreq_push_eng 7f3fb0 - bifreq_push_eng 1f3db8 - bifreq_push_eng d0fc4e - bifreq_push_eng 2fe554 - bifreq_push_eng 3bbcd - bifreq_push_eng f594f - bifreq_push_eng 4b71 - bifreq_push_eng c0dc9 - bifreq_push_eng 79d2 - bifreq_push_eng ab816c - bifreq_push_eng 121279 - bifreq_push_eng 13d455 - bifreq_push_eng d6cb0 - bifreq_push_eng dc1bbf - bifreq_push_eng 165bca - bifreq_push_eng 16677e - bifreq_push_eng 96c34f - bifreq_push_eng 6c62a4 - bifreq_push_eng 2b333 - bifreq_push_eng 27ff6 - bifreq_push_eng 275193 - bifreq_push_eng 11fb8f - bifreq_push_eng 25063d - bifreq_push_eng 7cf324 - bifreq_push_eng 128ae4 - bifreq_push_eng e966 - bifreq_push_eng 6aa88b - bifreq_push_eng 3bd323 - bifreq_push_eng 701f16 - bifreq_push_eng 39806e - bifreq_push_eng 2d999 - bifreq_push_eng 17ecf7 - bifreq_push_eng 39ba - bifreq_push_eng ef35c - bifreq_push_eng 6f62 - bifreq_push_eng 224e301 - bifreq_push_eng f78f4 - bifreq_push_eng 15fd21 - bifreq_push_eng ca553 - bifreq_push_eng 600656f - bifreq_push_eng cbaec - bifreq_push_eng 68e27 - bifreq_push_eng 144b4e - bifreq_push_eng 1a38bae - bifreq_push_eng 2e5d2 - bifreq_push_eng 335d1 - bifreq_push_eng 11d83c - bifreq_push_eng 14a529 - bifreq_push_eng 151e16 - bifreq_push_eng 12d0a82 - bifreq_push_eng eeed9 - bifreq_push_eng 18b79 - bifreq_push_eng 3aa3b9 - bifreq_push_eng 25914a - bifreq_push_eng 7f6f3f - bifreq_push_eng 2a4b76 - bifreq_push_eng 303a3 - bifreq_push_eng 156957 - bifreq_push_eng 1d66 - bifreq_push_eng 161233 - bifreq_push_eng 90ca - bifreq_push_eng 989e5c - bifreq_push_eng 27a62c - bifreq_push_eng 14794fc - bifreq_push_eng c4ca13 - bifreq_push_eng bed1ca - bifreq_push_eng 57977e - bifreq_push_eng 916cce - bifreq_push_eng 9517b - bifreq_push_eng 94394 - bifreq_push_eng 357f8 - bifreq_push_eng 277224 - bifreq_push_eng 110ca60 - bifreq_push_eng a0e526 - bifreq_push_eng 539cc92 - bifreq_push_eng 143a430 - bifreq_push_eng 33188d - bifreq_push_eng 47333 - bifreq_push_eng b23e49 - bifreq_push_eng 239ea5d - bifreq_push_eng 242e566 - bifreq_push_eng 8ccab - bifreq_push_eng 8b4d10 - bifreq_push_eng e11cb - bifreq_push_eng d6b00 - bifreq_push_eng 18039 - bifreq_push_eng 1c784a - bifreq_push_eng 1a227b - bifreq_push_eng 4bb4 - bifreq_push_eng 60c2 - bifreq_push_eng 558f - bifreq_push_eng 16b1f4 - bifreq_push_eng 3160 - bifreq_push_eng 2ef7 - bifreq_push_eng 51e0 - bifreq_push_eng 574c9 - bifreq_push_eng 3ed5 - bifreq_push_eng 368f - bifreq_push_eng 2f75 - bifreq_push_eng 5742 - bifreq_push_eng 3874 - bifreq_push_eng 298641 - bifreq_push_eng 86d8 - bifreq_push_eng 2d2 - bifreq_push_eng 13a57 - bifreq_push_eng 999e - bifreq_push_eng 4fb8 - bifreq_push_eng 2ca10f - bifreq_push_eng 22dd - bifreq_push_eng 3ed3 - bifreq_push_eng 2eb - bifreq_push_eng 165b - bifreq_push_eng b2b - bifreq_push_eng 2b3a8e - bifreq_push_eng 6fc84 - bifreq_push_eng 668b1 - bifreq_push_eng 43dde - bifreq_push_eng a2842e - bifreq_push_eng 832fe - bifreq_push_eng 33172 - bifreq_push_eng 9eb6f - bifreq_push_eng 58b855 - bifreq_push_eng 12c10 - bifreq_push_eng 1d01b - bifreq_push_eng ce9e5 - bifreq_push_eng 768f1 - bifreq_push_eng 1d0cdc - bifreq_push_eng 1ad331 - bifreq_push_eng 5bb65 - bifreq_push_eng 3651 - bifreq_push_eng 7bc8c - bifreq_push_eng 313ec5 - bifreq_push_eng 160891 - bifreq_push_eng 7bafa - bifreq_push_eng 11de0 - bifreq_push_eng afb11 - bifreq_push_eng 13db - bifreq_push_eng 87150 - bifreq_push_eng 2bb8 - bifreq_push_eng 161ac4d - bifreq_push_eng 2597cd - bifreq_push_eng 2385ff - bifreq_push_eng 9c55cb - bifreq_push_eng 1cf9c9e - bifreq_push_eng 293cba - bifreq_push_eng e2308 - bifreq_push_eng 1370c0 - bifreq_push_eng 1636521 - bifreq_push_eng 354fa - bifreq_push_eng 11c39a - bifreq_push_eng 177edcb - bifreq_push_eng 21d242 - bifreq_push_eng b7abc - bifreq_push_eng edfb16 - bifreq_push_eng 26d155 - bifreq_push_eng 12d5c - bifreq_push_eng 16f744 - bifreq_push_eng 84607c - bifreq_push_eng 6805f9 - bifreq_push_eng 432efc - bifreq_push_eng 12e50f - bifreq_push_eng 1c070b - bifreq_push_eng 3c6b - bifreq_push_eng d1afcf - bifreq_push_eng dfe2 - bifreq_push_eng 14d131a - bifreq_push_eng 3ee4a4 - bifreq_push_eng 10cf9f - bifreq_push_eng 75766 - bifreq_push_eng 19f9d65 - bifreq_push_eng ae94f - bifreq_push_eng 459cd - bifreq_push_eng ad8d0 - bifreq_push_eng b9aef0 - bifreq_push_eng 20c77 - bifreq_push_eng 1b1c1 - bifreq_push_eng 74d40 - bifreq_push_eng 38ec4c - bifreq_push_eng 8853d - bifreq_push_eng c59cf0 - bifreq_push_eng 778e24 - bifreq_push_eng 536e - bifreq_push_eng a148b - bifreq_push_eng 3bdba7 - bifreq_push_eng 2ea14a - bifreq_push_eng 394f3a - bifreq_push_eng 2147a - bifreq_push_eng e4e95 - bifreq_push_eng 37aa - bifreq_push_eng 1dbdc9 - bifreq_push_eng 475f - bifreq_push_eng 1674e84 - bifreq_push_eng 36f904 - bifreq_push_eng e8281f - bifreq_push_eng 2c0de82 - bifreq_push_eng 1a10c5b - bifreq_push_eng 4b893d - bifreq_push_eng 24c7dc5 - bifreq_push_eng 3bbe92 - bifreq_push_eng 10a4c48 - bifreq_push_eng 147d0f - bifreq_push_eng 2e6f80 - bifreq_push_eng 3859b9 - bifreq_push_eng 39efc0 - bifreq_push_eng 4f0de3 - bifreq_push_eng 1204d1f - bifreq_push_eng 2d4a3e - bifreq_push_eng 3514e - bifreq_push_eng 2485ec - bifreq_push_eng 1451c35 - bifreq_push_eng 305a31c - bifreq_push_eng 38f47a - bifreq_push_eng 217c66 - bifreq_push_eng 40549f - bifreq_push_eng 1245c - bifreq_push_eng 4245fa - bifreq_push_eng 410dd - bifreq_push_eng 64026d - bifreq_push_eng 5ecba0 - bifreq_push_eng 74aee8 - bifreq_push_eng 741f66 - bifreq_push_eng 27ebf4 - bifreq_push_eng 1d20468 - bifreq_push_eng 3f8636 - bifreq_push_eng 31a983 - bifreq_push_eng 516e28 - bifreq_push_eng a165a - bifreq_push_eng 33d7c2 - bifreq_push_eng d1731b - bifreq_push_eng 14171ac - bifreq_push_eng 3647534 - bifreq_push_eng 9b2a18 - bifreq_push_eng 9f993f - bifreq_push_eng 1df35 - bifreq_push_eng 2b9b607 - bifreq_push_eng cf7669 - bifreq_push_eng 13284f0 - bifreq_push_eng 1dabc5c - bifreq_push_eng 7026fe - bifreq_push_eng deeffd - bifreq_push_eng 9eb5e - bifreq_push_eng 1d7e5c - bifreq_push_eng 37ccc - bifreq_push_eng b82765 - bifreq_push_eng 5a2b8 - bifreq_push_eng 61bb4 - bifreq_push_eng 42b0a - bifreq_push_eng eda146 - bifreq_push_eng 66178 - bifreq_push_eng 338bd - bifreq_push_eng 2b1c80 - bifreq_push_eng 54d3aa - bifreq_push_eng b7c3 - bifreq_push_eng 14449 - bifreq_push_eng 95b902 - bifreq_push_eng e3599 - bifreq_push_eng 2023d - bifreq_push_eng b5d8df - bifreq_push_eng 4a5cb1 - bifreq_push_eng 48af - bifreq_push_eng c9480e - bifreq_push_eng 24454c - bifreq_push_eng 3a2c7b - bifreq_push_eng 3adee4 - bifreq_push_eng bbe9 - bifreq_push_eng 817eb - bifreq_push_eng 1a9e - bifreq_push_eng 60b73 - bifreq_push_eng 25e1 - bifreq_push_eng 11f37 - bifreq_push_eng 6aab - bifreq_push_eng 29ab - bifreq_push_eng 21e6 - bifreq_push_eng 1784 - bifreq_push_eng 224a - bifreq_push_eng a07 - bifreq_push_eng 2ff1 - bifreq_push_eng 11eab - bifreq_push_eng 53e - bifreq_push_eng 7e7 - bifreq_push_eng 2583 - bifreq_push_eng 301b - bifreq_push_eng ee0 - bifreq_push_eng 24b2 - bifreq_push_eng 17ae - bifreq_push_eng 9c3 - bifreq_push_eng 1757 - bifreq_push_eng 516f - bifreq_push_eng 4212 - bifreq_push_eng 3f9ed0 - bifreq_push_eng 1074 - bifreq_push_eng 876d - bifreq_push_eng 2fd - bifreq_push_eng 11cd - bifreq_push_eng 118 - bifreq_push_eng 1b518c9 - bifreq_push_eng 330f24 - bifreq_push_eng 6a6a6f - bifreq_push_eng 89b865 - bifreq_push_eng 3a19ed0 - bifreq_push_eng 346ec8 - bifreq_push_eng 46e432 - bifreq_push_eng 2d4c82 - bifreq_push_eng 1a5abd3 - bifreq_push_eng 7e80d - bifreq_push_eng 448888 - bifreq_push_eng 494aae - bifreq_push_eng 709445 - bifreq_push_eng 6bcc3b - bifreq_push_eng 1be06b2 - bifreq_push_eng 36c05c - bifreq_push_eng 26505 - bifreq_push_eng 59f814 - bifreq_push_eng 1440e0b - bifreq_push_eng 14764bb - bifreq_push_eng 51567d - bifreq_push_eng 29155d - bifreq_push_eng 331625 - bifreq_push_eng 96fe - bifreq_push_eng 861a3b - bifreq_push_eng 1bb18 - bifreq_push_eng 1cafc83 - bifreq_push_eng 54be14 - bifreq_push_eng a4cdfc - bifreq_push_eng 3aa0ca - bifreq_push_eng 1e124f0 - bifreq_push_eng 5cae8b - bifreq_push_eng 1f2f7a - bifreq_push_eng fff007 - bifreq_push_eng 1890c79 - bifreq_push_eng abfba - bifreq_push_eng 236de0 - bifreq_push_eng 4bc294 - bifreq_push_eng 5527d3 - bifreq_push_eng 3f7226 - bifreq_push_eng 16cbd8f - bifreq_push_eng a14b82 - bifreq_push_eng c365a - bifreq_push_eng 359dd0 - bifreq_push_eng 120a170 - bifreq_push_eng 338415f - bifreq_push_eng 990f9d - bifreq_push_eng d75a3 - bifreq_push_eng 8457d2 - bifreq_push_eng c71f - bifreq_push_eng 21c97e - bifreq_push_eng 137e0 - bifreq_push_eng 18efb09 - bifreq_push_eng 3a3823 - bifreq_push_eng 4f4c11 - bifreq_push_eng 23ce14 - bifreq_push_eng 2856205 - bifreq_push_eng 336604 - bifreq_push_eng 1758bd - bifreq_push_eng 6f93ed4 - bifreq_push_eng 28e6dda - bifreq_push_eng 88971 - bifreq_push_eng 9501d - bifreq_push_eng 527201 - bifreq_push_eng 395ef5 - bifreq_push_eng 1b3167 - bifreq_push_eng 2bfa974 - bifreq_push_eng 2ed9db - bifreq_push_eng 26d87 - bifreq_push_eng f169aa - bifreq_push_eng 120bc1a - bifreq_push_eng 1278630 - bifreq_push_eng 815b37 - bifreq_push_eng aa726 - bifreq_push_eng 87f5ae - bifreq_push_eng 6dfc - bifreq_push_eng 7a34d6 - bifreq_push_eng 445c7 - bifreq_push_eng 4609ad - bifreq_push_eng 2da314 - bifreq_push_eng 579f31 - bifreq_push_eng 35660f - bifreq_push_eng 4b315d - bifreq_push_eng ab5c4 - bifreq_push_eng 49bc45 - bifreq_push_eng 52d8d - bifreq_push_eng 351f8a - bifreq_push_eng 15868 - bifreq_push_eng 7db39 - bifreq_push_eng 9b3c1c - bifreq_push_eng 42fb58 - bifreq_push_eng e88243 - bifreq_push_eng 9eab2 - bifreq_push_eng 50fa44 - bifreq_push_eng 5b5a - bifreq_push_eng 1089d15 - bifreq_push_eng ef8d99 - bifreq_push_eng e6f991 - bifreq_push_eng f643 - bifreq_push_eng 33c53 - bifreq_push_eng 561dc - bifreq_push_eng 235ae - bifreq_push_eng 81df8 - bifreq_push_eng 25888 - bifreq_push_eng 3ebc0f - bifreq_push_eng 7208 - bifreq_push_eng e690 - bifreq_push_eng 14e6b - bifreq_push_eng 1bf670d - bifreq_push_eng 6dba - bifreq_push_eng 63f1 - bifreq_push_eng 75fb - bifreq_push_eng 8f20c5 - bifreq_push_eng 2ca8 - bifreq_push_eng 2ccd - bifreq_push_eng bf88 - bifreq_push_eng 88d0 - bifreq_push_eng 813a - bifreq_push_eng 2261ec - bifreq_push_eng f471 - bifreq_push_eng 5d0 - bifreq_push_eng 178a0 - bifreq_push_eng 31d3d - bifreq_push_eng f5c0 - bifreq_push_eng 1438e - bifreq_push_eng 5739 - bifreq_push_eng b228 - bifreq_push_eng c78 - bifreq_push_eng 38e7a - bifreq_push_eng a49 - bifreq_push_eng 100f08a - bifreq_push_eng 60644 - bifreq_push_eng 6d78a - bifreq_push_eng 69a06 - bifreq_push_eng c9305c - bifreq_push_eng 52155 - bifreq_push_eng 22272 - bifreq_push_eng b4dc6d - bifreq_push_eng e821da - bifreq_push_eng 1846b - bifreq_push_eng 245e4 - bifreq_push_eng a0976 - bifreq_push_eng 7b757 - bifreq_push_eng 37b04f - bifreq_push_eng 8af4d7 - bifreq_push_eng 4e8d2 - bifreq_push_eng 3f75 - bifreq_push_eng 12b803 - bifreq_push_eng 1e5877 - bifreq_push_eng 13db2d - bifreq_push_eng 2c294 - bifreq_push_eng f9ba - bifreq_push_eng a4b32 - bifreq_push_eng 1246 - bifreq_push_eng 872af - bifreq_push_eng ce64 - bifreq_push_eng dcbd4 - bifreq_push_eng 16f59 - bifreq_push_eng aa68b - bifreq_push_eng eac5 - bifreq_push_eng 9fa7b - bifreq_push_eng 1b987 - bifreq_push_eng 9979 - bifreq_push_eng 28ac7 - bifreq_push_eng fa2e0 - bifreq_push_eng 2985 - bifreq_push_eng 3553 - bifreq_push_eng e8c1 - bifreq_push_eng 1f204 - bifreq_push_eng 87ae - bifreq_push_eng 338e5 - bifreq_push_eng 1c1638 - bifreq_push_eng 1528 - bifreq_push_eng 15fbe - bifreq_push_eng 25aeb - bifreq_push_eng 170a51 - bifreq_push_eng 2404d - bifreq_push_eng 798d - bifreq_push_eng 1d21a - bifreq_push_eng 88ec - bifreq_push_eng 17079 - bifreq_push_eng 822 - bifreq_push_eng 6e777c - bifreq_push_eng 292652 - bifreq_push_eng 2fbaf5 - bifreq_push_eng 206261 - bifreq_push_eng 632be9 - bifreq_push_eng 232cdc - bifreq_push_eng 1001fa - bifreq_push_eng 22f649 - bifreq_push_eng 44129e - bifreq_push_eng 5c737 - bifreq_push_eng 5fb11 - bifreq_push_eng 1ebaf3 - bifreq_push_eng 266531 - bifreq_push_eng 16ab57 - bifreq_push_eng 8aadf1 - bifreq_push_eng 276567 - bifreq_push_eng 15791 - bifreq_push_eng 1eda33 - bifreq_push_eng 730ba5 - bifreq_push_eng 667327 - bifreq_push_eng a9cd8 - bifreq_push_eng 6475f - bifreq_push_eng 338f78 - bifreq_push_eng 4231 - bifreq_push_eng 514ad - bifreq_push_eng 131c9 - bifreq_push_eng e2d5f - bifreq_push_eng c5dc - bifreq_push_eng a04d - bifreq_push_eng 808a - bifreq_push_eng 1a172f - bifreq_push_eng 6ff2 - bifreq_push_eng 6701 - bifreq_push_eng 1a477 - bifreq_push_eng 9d3c3 - bifreq_push_eng 1bff - bifreq_push_eng 5ec6 - bifreq_push_eng 138a7 - bifreq_push_eng b3d2 - bifreq_push_eng 5eb1 - bifreq_push_eng 67850 - bifreq_push_eng 76b5 - bifreq_push_eng 168d - bifreq_push_eng 7fad - bifreq_push_eng 17311 - bifreq_push_eng de7b - bifreq_push_eng 1bb82 - bifreq_push_eng 3803 - bifreq_push_eng 10d01 - bifreq_push_eng 99f - bifreq_push_eng 19d8f - bifreq_push_eng 3605b -exit diff --git a/cipher.sts b/cipher.sts deleted file mode 100644 index c87b67a..0000000 --- a/cipher.sts +++ /dev/null @@ -1,12 +0,0 @@ -defword cipher - 3 ref as cipher.byte - 2 get as cipher.password - 1 get as cipher.len - 0 get as cipher.pos - cipher.pos @ word_size mul cipher.password + @ - cipher.byte @ xor - cipher.byte ! - cipher.pos @ 0 = if cipher.len cipher.pos ! fi - cipher.pos @ 1 - cipher.pos ! - drop drop drop -exit diff --git a/common/common.sts b/common/common.sts deleted file mode 100644 index 8a7f835..0000000 --- a/common/common.sts +++ /dev/null @@ -1,3 +0,0 @@ -module common/macro.sts -module common/const.sts -module common/print.sts diff --git a/common/const.sts b/common/const.sts deleted file mode 100644 index b1a08b0..0000000 --- a/common/const.sts +++ /dev/null @@ -1,95 +0,0 @@ -defconst newline 0a -defconst space 20 -defconst '!' 21 -defconst '"' 22 -defconst '#' 23 -defconst '$' 24 -defconst percent 25 ; '%' (25) symbol is reserved by smack -defconst '&' 26 -defconst ''' 27 -defconst '(' 28 -defconst ')' 29 -defconst '*' 2a -defconst '+' 2b -defconst ',' 2c -defconst '-' 2d -defconst '.' 2e -defconst '/' 2f -defconst '0' 30 -defconst '1' 31 -defconst '2' 32 -defconst '3' 33 -defconst '4' 34 -defconst '5' 35 -defconst '6' 36 -defconst '7' 37 -defconst '8' 38 -defconst '9' 39 -defconst ':' 3a -defconst '<' 3c -defconst '=' 3d -defconst '>' 3e -defconst '?' 3f -defconst '@' 40 -defconst 'A' 41 -defconst 'B' 42 -defconst 'C' 43 -defconst 'D' 44 -defconst 'E' 45 -defconst 'F' 46 -defconst 'G' 47 -defconst 'H' 48 -defconst 'I' 49 -defconst 'J' 4a -defconst 'K' 4b -defconst 'L' 4c -defconst 'M' 4d -defconst 'N' 4e -defconst 'O' 4f -defconst 'P' 50 -defconst 'Q' 51 -defconst 'R' 52 -defconst 'S' 53 -defconst 'T' 54 -defconst 'U' 55 -defconst 'V' 56 -defconst 'W' 57 -defconst 'X' 58 -defconst 'Y' 59 -defconst 'Z' 5a -defconst '[' 5b -defconst '\' 5c -defconst ']' 5d -defconst '^' 5e -defconst '_' 5f -defconst '`' 60 -defconst 'a' 61 -defconst 'b' 62 -defconst 'c' 63 -defconst 'd' 64 -defconst 'e' 65 -defconst 'f' 66 -defconst 'g' 67 -defconst 'h' 68 -defconst 'i' 69 -defconst 'j' 6a -defconst 'k' 6b -defconst 'l' 6c -defconst 'm' 6d -defconst 'n' 6e -defconst 'o' 6f -defconst 'p' 70 -defconst 'q' 71 -defconst 'r' 72 -defconst 's' 73 -defconst 't' 74 -defconst 'u' 75 -defconst 'v' 76 -defconst 'w' 77 -defconst 'x' 78 -defconst 'y' 79 -defconst 'z' 7a -defconst '{' 7b -defconst '|' 7c -defconst '}' 7d -defconst '~' 7e diff --git a/common/macro.sts b/common/macro.sts deleted file mode 100644 index 162bf2f..0000000 --- a/common/macro.sts +++ /dev/null @@ -1,9 +0,0 @@ -[ local 1 - top as %1% -] - -[ change 0 - 1 + dup get - swap 2 get swap set - swap drop -] diff --git a/common/print.sts b/common/print.sts deleted file mode 100644 index a3bea56..0000000 --- a/common/print.sts +++ /dev/null @@ -1,30 +0,0 @@ -defword get_hex - f and - dup 9 > if - a - 'a' + - else - '0' + - fi -exit - -defword print_hex - dup 1c shr get_hex sys_write - dup 18 shr get_hex sys_write - dup 14 shr get_hex sys_write - dup 10 shr get_hex sys_write - dup c shr get_hex sys_write - dup 8 shr get_hex sys_write - dup 4 shr get_hex sys_write - get_hex sys_write -exit - -defword print_stack - dup - do - over over - 2 + get print_hex - 1 - dup 0 = until - space sys_write - od newline sys_write - drop - drop -exit diff --git a/cryptrobber.sts b/cryptrobber.sts new file mode 100644 index 0000000..b8b120d --- /dev/null +++ b/cryptrobber.sts @@ -0,0 +1,213 @@ +module sts/ia32/elf/begin.sts +module sts/ia32/float/float.sts +module sts/cipher.sts +module sts/keygen.sts +module sts/freq.sts +module sts/bifreq.sts + +[ sd 0 swap drop ] + +defword nicedist + 1 float_iload a float_iload float_div +exit + +defword zeros + do dup 0 = until + 0 swap + 1 - od drop +exit + +defword clear + do dup 0 = until + swap drop + 1 - od drop +exit + +defword calcdist ; distance from ideal as sqrt sum square diff + 2c1 ref as calcdist.textfr + local calcdist.fr + 0 do dup 2be = until + dup word_size mul dup dup + calcdist.fr + @ float_fload + calcdist.textfr + @ float_fload + float_sub float_fstore dup float_fload float_fload + float_mul float_fstore swap calcdist.fr + ! + 1 + od + 0 do dup 2bd = until + swap float_fload swap float_fload float_add float_fstore swap + 1 + od drop + float_fload float_sqrt nicedist float_less +exit + +defword checktext + as checktext.length + local checktext.text + ; Count frequencies: + ; 676 latin bigrams: + 2a4 zeros local checktext.bifr + ; 26 latin letters: + 1a zeros local checktext.fr + ; count how much of each letter is in text: + 0 local checktext.hadalpha + 0 local checktext.bicount + 0 local checktext.count + checktext.length do 1 - + dup word_size mul checktext.text + @ + dup dup 'z' > 0 = swap 'a' < 0 = mul if + dup 'z' swap - word_size mul local checktext.i + checktext.i @ checktext.fr + @ 1 + checktext.i @ checktext.fr + ! + checktext.count @ 1 + checktext.count ! + checktext.hadalpha @ if + checktext.bicount @ 1 + checktext.bicount ! + checktext.hadalpha @ 1 - 1a mul checktext.i @ + + checktext.bifr + + dup @ 1 + swap ! + fi + 1 + checktext.hadalpha ! + else dup dup 'Z' > 0 = swap 'A' < 0 = mul if + dup 'Z' swap - word_size mul local checktext.i + checktext.i @ checktext.fr + @ 1 + checktext.i @ checktext.fr + ! + checktext.count @ 1 + checktext.count ! + checktext.hadalpha @ if + checktext.bicount @ 1 + checktext.bicount ! + checktext.hadalpha @ 1 - 1a mul checktext.i @ + + checktext.bifr + + dup @ 1 + swap ! + fi + 1 + checktext.hadalpha ! + else 0 checktext.hadalpha ! dup dup 8 > 0 = swap 1 < 0 = mul if + 2c3 clear + 0 exit fi dup dup 1f > 0 = swap e < 0 = mul if + 2c3 clear + 0 exit fi fi fi drop + dup 0 = untilod drop + ; At least 1/4 characters in text should be alphabetical: + checktext.count @ float_iload checktext.length float_iload float_div + 1 float_iload 4 float_iload float_div float_less if + 2c1 clear + 0 exit fi + ; Division by zero shall not pass: + checktext.bicount 0 = if 2c1 clear 0 exit fi + ; normalize: + 0 do dup 1a = until + dup word_size mul checktext.fr + dup @ float_iload + checktext.count @ float_iload + float_div float_fstore swap ! + 1 + od drop + 0 do dup 2a4 = until + dup word_size mul checktext.bifr + dup @ float_iload + checktext.bicount @ float_iload + float_div float_fstore swap ! + 1 + od drop + ; Decide if text is real: + bifreq_eng freq_eng calcdist if 1 else + 0 fi + ; Remove frequencies from stack: + 2c1 set + 2c1 clear +exit + +set_entry float_init ; this is program with floats + ; read file into stack + 0 do sys_read 0 = until + swap 1 + + od drop as length + local ciphertext + + 0 ; initial key is empty + do + ; generate next key to try + keygen as keylen local key + '.' sys_write_err + + ; decipher text (length is the same as for ciphertext) + keylen 1 - length do 1 - + as textpos local pos + textpos word_size mul ciphertext + @ + key + keylen + pos + cipher + swap textpos + dup 0 = untilod drop drop + local plaintext + + ; check deciphering attempt, exit if Ok or keylen = max (3) + keylen 3 = if eeeee else length checktext fi dup until drop + ; else remove the text from stack and place keylen back + 0 do dup length = until + swap drop 1 + + od drop keylen + od as langcode drop + + ; output language + langcode 1 = if + 'e' sys_write_err + 'n' sys_write_err + 'g' sys_write_err + 'l' sys_write_err + 'i' sys_write_err + 's' sys_write_err + 'h' sys_write_err + fi langcode 2 = if + 'd' sys_write_err + 'u' sys_write_err + 't' sys_write_err + 'c' sys_write_err + 'h' sys_write_err + fi langcode 3 = if + 'g' sys_write_err + 'e' sys_write_err + 'r' sys_write_err + 'm' sys_write_err + 'a' sys_write_err + 'n' sys_write_err + fi langcode 4 = if + 'f' sys_write_err + 'r' sys_write_err + 'e' sys_write_err + 'n' sys_write_err + 'c' sys_write_err + 'h' sys_write_err + fi langcode 5 = if + 's' sys_write_err + 'p' sys_write_err + 'a' sys_write_err + 'n' sys_write_err + 'i' sys_write_err + 's' sys_write_err + 'h' sys_write_err + fi langcode 6 = if + 'i' sys_write_err + 't' sys_write_err + 'a' sys_write_err + 'l' sys_write_err + 'i' sys_write_err + 'a' sys_write_err + 'n' sys_write_err + fi langcode eeeee = if + 'e' sys_write_err + 'r' sys_write_err + 'r' sys_write_err + 'o' sys_write_err + 'r' sys_write_err + fi newline sys_write_err + + ; output text + length do 1 - + dup word_size mul plaintext + @ sys_write + dup 1 = untilod drop + length do 1 - + swap drop + dup 1 = untilod drop + + ; output key + keylen do 1 - + dup word_size mul key + @ + dup 4 shr get_hex sys_write_err get_hex sys_write_err + dup 0 = until + space sys_write_err + od drop newline sys_write_err +sys_exit + +module sts/ia32/elf/end.sts diff --git a/encrypt.sts b/encrypt.sts index 2422e66..fa105a8 100644 --- a/encrypt.sts +++ b/encrypt.sts @@ -1,5 +1,5 @@ -module ia32/elf/begin.sts -module cipher.sts +module sts/ia32/elf/begin.sts +module sts/cipher.sts set_entry 31 32 local password @@ -10,4 +10,4 @@ set_entry od sys_exit -module ia32/elf/end.sts +module sts/ia32/elf/end.sts diff --git a/enki/smack.c b/enki/smack.c deleted file mode 100644 index f6f9f30..0000000 --- a/enki/smack.c +++ /dev/null @@ -1,579 +0,0 @@ -/* - Simple Macro Generator - created by exegete -*/ - -#include -#include -#include - -struct macro -{ - const char *lexem; - unsigned long long param_count; - const char *text; - struct macro *next; -}; - -struct macro_parameter -{ - char *lexem; - struct macro_parameter *next; -}; - -struct input_stream -{ - FILE *fd; - const struct macro *macro; - unsigned long long text_offset; - struct macro_parameter *param_list; - struct input_stream *next; -}; - -struct module -{ - const char *file_name; - struct module *next; -}; - -#define ERROR_STATUS_ARG 1 -#define ERROR_STATUS_OPEN 2 -#define ERROR_STATUS_CHDIR 3 -#define ERROR_STATUS_MALLOC 4 -#define ERROR_STATUS_EMPTY_STREAM_LIST 5 -#define ERROR_STATUS_INVALID_STREAM 6 -#define ERROR_STATUS_INVALID_MACRO 7 -#define ERROR_STATUS_INVALID_PARAMETER 8 -#define ERROR_STATUS_INVALID_CALL 9 -#define ERROR_STATUS_INVALID_INCLUDE 10 -#define ERROR_STATUS_INVALID_SHIELD 11 - -const char *error_msgs[] = -{ - "Please, specify input file", - "Unable to open file: ", - "Unable to change working directory: ", - "Unable to allocate memory", - "Input stream list is empty", - "Input stream is invalid", - "Macro definition is invalid", - "Macro parameter is invalid", - "Macro call is invalid", - "Invalid include/module argument", - "Invalid '#' argument" -}; - -void exit_error(int status, const char *msg) -{ - if(msg) - fprintf(stderr, "Error: %s%s\n", error_msgs[status - 1], msg); - else - fprintf(stderr, "Error: %s\n", error_msgs[status - 1]); - exit(status); -} - -void add_input_stream(struct input_stream **stream_list, - FILE *fd, const struct macro *macro) -{ - struct input_stream *head = *stream_list; - *stream_list = malloc(sizeof(struct input_stream)); - if(!*stream_list) - exit_error(ERROR_STATUS_MALLOC, NULL); - (*stream_list)->fd = fd; - (*stream_list)->macro = macro; - (*stream_list)->text_offset = 0; - (*stream_list)->param_list = NULL; - (*stream_list)->next = head; -} - -int delete_input_stream(struct input_stream **stream_list) -{ - struct input_stream *head = *stream_list; - if(!head) - exit_error(ERROR_STATUS_EMPTY_STREAM_LIST, NULL); - *stream_list = (*stream_list)->next; - if(head->fd) - fclose(head->fd); - while(head->param_list) - { - struct macro_parameter *param_head = head->param_list; - head->param_list = param_head->next; - free(param_head->lexem); - free(param_head); - } - free(head); - return *stream_list != NULL; -} - -void add_input_stream_parameter(struct input_stream *stream_list, char *lexem) -{ - struct macro_parameter **param = &stream_list->param_list; - while(*param) - param = &(*param)->next; - *param = malloc(sizeof(struct macro_parameter)); - if(!*param) - exit_error(ERROR_STATUS_MALLOC, NULL); - (*param)->lexem = lexem; - (*param)->next = NULL; -} - -const char *get_input_stream_parameter(struct input_stream *stream_list, - unsigned long long chosen) -{ - struct macro_parameter *param = stream_list->param_list; - if(!chosen) - return stream_list->macro->lexem; - chosen--; - for(; param && chosen > 0; chosen--) - param = param->next; - if(!param) - exit_error(ERROR_STATUS_INVALID_CALL, NULL); - return param->lexem; -} - -#define BUFFER_INITIAL_SIZE 4 - -int double_buffer(char **buffer, unsigned long long *buffer_size) -{ - char *tmp_pointer = *buffer; - unsigned long long tmp_size = *buffer_size; - - if(*buffer_size == 0) - *buffer_size = BUFFER_INITIAL_SIZE; - else - *buffer_size *= 2; - - *buffer = malloc(*buffer_size); - if(!*buffer) - return 0; - - for(; tmp_size > 0; tmp_size--) - (*buffer)[tmp_size - 1] = tmp_pointer[tmp_size - 1]; - - free(tmp_pointer); - return 1; -} - -int read_symb_from_text(struct input_stream *stream_list) -{ - char symb; - if(!stream_list->macro) - exit_error(ERROR_STATUS_INVALID_STREAM, NULL); - if(!stream_list->macro->text) - exit_error(ERROR_STATUS_INVALID_STREAM, NULL); - symb = stream_list->macro->text[stream_list->text_offset]; - if(!symb) - return EOF; - stream_list->text_offset++; - return symb; -} - -#define COMMENT_SYMB ';' - -int read_real_symb(struct input_stream *stream_list) -{ - int symb; - - if(!stream_list) - exit_error(ERROR_STATUS_EMPTY_STREAM_LIST, NULL); - - if(stream_list->fd) - symb = fgetc(stream_list->fd); - else - symb = read_symb_from_text(stream_list); - - if(symb == COMMENT_SYMB) - { - for(; symb != '\n' && symb != EOF; - symb = fgetc(stream_list->fd)) - {} - } - return symb; -} - -#define SHIELD_SYMB '\\' - -int read_symb(struct input_stream *stream_list, int *shield) -{ - int symb = read_real_symb(stream_list); - if(shield) - { - *shield = 0; - if(symb == SHIELD_SYMB) - { - symb = read_real_symb(stream_list); - *shield = 1; - } - } - return symb; -} - -int is_symb_hex(char symb) -{ - if(symb >= '0' && symb <= '9') - return symb - '0'; - else - if(symb >= 'A' && symb <= 'F') - return symb - 'A' + 10; - else - if(symb >= 'a' && symb <= 'f') - return symb - 'a' + 10; - else - return -1; -} - -int is_lexem_hex(const char *lexem, unsigned long long *dest) -{ - int sign = 0; - unsigned long long hex = 0; - if(*lexem == '-' && *(lexem + 1)) - { - sign = 1; - lexem++; - } - - for(; *lexem; lexem++) - { - int num = is_symb_hex(*lexem); - if(num != -1) - hex = (hex << 4) + num; - else - return 0; - } - hex = sign ? ~hex + 1 : hex; - if(dest) - *dest = hex; - return 1; -} - -int compare_lexems(const char *lexem_one, const char *lexem_two) -{ - for(; *lexem_one && *lexem_two; lexem_one++, lexem_two++) - if(*lexem_one != *lexem_two) - return 0; - return *lexem_one == *lexem_two; -} - -char *copy_lexem(const char *lexem) -{ - char *buffer = NULL; - unsigned long long buffer_size = 0; - unsigned long long index; - - for(index = 0;; index++) - { - if(index == buffer_size) - if(!double_buffer(&buffer, &buffer_size)) - exit_error(ERROR_STATUS_MALLOC, NULL); - buffer[index] = lexem[index]; - if(!lexem[index]) - break; - } - return buffer; -} - -#define EVAL_SYMB '%' - -unsigned long long get_eval_end(const char *lexem) -{ - unsigned long long counter = 0; - - for(; *lexem && *lexem != EVAL_SYMB; lexem++, counter++) - {} - if(!*lexem) - exit_error(ERROR_STATUS_INVALID_CALL, NULL); - return counter; -} - -char *param_eval(struct input_stream *stream_list, char *lexem) -{ - char *input_lexem = lexem; - char *buffer = NULL; - unsigned long long buffer_size = 0; - const char *param = NULL; - unsigned long long index = 0; - - for(;;) - { - char symb = param && *param ? *param : *lexem++; - param = !param || !*param ? NULL : param + 1; - if(symb == EVAL_SYMB) - { - unsigned long long param_offset = get_eval_end(lexem); - unsigned long long param_num; - *(lexem + param_offset) = 0; - if(!is_lexem_hex(lexem, ¶m_num)) - exit_error(ERROR_STATUS_INVALID_CALL, NULL); - lexem += param_offset + 1; - param = get_input_stream_parameter(stream_list, - param_num); - continue; - } - if(index == buffer_size) - if(!double_buffer(&buffer, &buffer_size)) - exit_error(ERROR_STATUS_MALLOC, NULL); - buffer[index] = symb; - if(!symb) - break; - index++; - } - free(input_lexem); - return buffer; -} - -int is_separator(int symb) -{ - return symb == ' ' || symb == '\n' || symb == '\t' || symb == '\r'; -} - -char *read_lexem(struct input_stream *stream_list) -{ - char *buffer = NULL; - unsigned long long buffer_size = 0; - int symb; - int shield; - unsigned long long index; - - for(;;) - { - symb = read_symb(stream_list, &shield); - if(is_separator(symb) && !shield) - continue; - if(symb == EOF) - return NULL; - break; - } - - for(index = 0;; index++) - { - if(index == buffer_size) - if(!double_buffer(&buffer, &buffer_size)) - exit_error(ERROR_STATUS_MALLOC, NULL); - if(symb == EOF || (is_separator(symb) && !shield)) - { - buffer[index] = 0; - break; - } - buffer[index] = symb; - symb = read_symb(stream_list, &shield); - } - buffer = param_eval(stream_list, buffer); - return buffer; -} - -#define MACRO_END_SYMB ']' - -const char *read_macro_text(struct input_stream *stream_list) -{ - char *buffer = NULL; - unsigned long long buffer_size = 0; - unsigned long long index; - - for(index = 0;; index++) - { - int shield; - int symb = read_symb(stream_list, &shield); - if(index == buffer_size) - if(!double_buffer(&buffer, &buffer_size)) - exit_error(ERROR_STATUS_MALLOC, NULL); - if(symb == EOF || (symb == MACRO_END_SYMB && !shield)) - { - buffer[index] = 0; - break; - } - buffer[index] = symb; - } - return buffer; -} - -void create_macro(struct input_stream *stream_list, struct macro **macro_list) -{ - char *param_count_lexem; - struct macro *head = *macro_list; - *macro_list = malloc(sizeof(struct macro)); - if(!*macro_list) - exit_error(ERROR_STATUS_MALLOC, NULL); - (*macro_list)->lexem = read_lexem(stream_list); - if(!(*macro_list)->lexem) - exit_error(ERROR_STATUS_INVALID_MACRO, NULL); - param_count_lexem = read_lexem(stream_list); - if(!param_count_lexem || !is_lexem_hex(param_count_lexem, - &(*macro_list)->param_count)) - exit_error(ERROR_STATUS_INVALID_MACRO, NULL); - free(param_count_lexem); - (*macro_list)->text = read_macro_text(stream_list); - (*macro_list)->next = head; -} - -int find_module(struct module *module_list, const char *file_name) -{ - for(; module_list; module_list = module_list->next) - if(compare_lexems(module_list->file_name, file_name)) - return 1; - return 0; -} - -void add_module(struct module **module_list, const char *file_name) -{ - struct module *head = *module_list; - *module_list = malloc(sizeof(struct module)); - if(!*module_list) - exit_error(ERROR_STATUS_MALLOC, NULL); - (*module_list)->file_name = file_name; - (*module_list)->next = head; -} - -void include_file(struct input_stream **stream_list, - struct module **module_list) -{ - char *file_name = read_lexem(*stream_list); - FILE *fd; - if(!file_name) - exit_error(ERROR_STATUS_INVALID_INCLUDE, NULL); - if(module_list && find_module(*module_list, file_name)) - { - free(file_name); - return; - } - fd = fopen(file_name, "r"); - if(!fd) - exit_error(ERROR_STATUS_OPEN, file_name); - if(module_list) - add_module(module_list, file_name); - else - free(file_name); - add_input_stream(stream_list, fd, NULL); -} - -void push_parameter(struct input_stream *input_stream, - struct input_stream *actual_stream) -{ - char *lexem = read_lexem(input_stream); - if(!lexem) - exit_error(ERROR_STATUS_INVALID_PARAMETER, NULL); - add_input_stream_parameter(actual_stream, lexem); -} - -int find_macro(struct input_stream **stream_list, struct macro *macro_list, - const char *lexem) -{ - for(; macro_list; macro_list = macro_list->next) - { - if(compare_lexems(macro_list->lexem, lexem)) - { - struct input_stream *old_stream = *stream_list; - unsigned long long param_count = - macro_list->param_count; - add_input_stream(stream_list, NULL, macro_list); - for(; param_count > 0; param_count--) - push_parameter(old_stream, *stream_list); - return 1; - } - } - return 0; -} - -#define DIRECTORY_SEPARATOR_SYMB '/' - -unsigned long long find_last_dir_separator_pos(const char *file_name) -{ - const char *orig_file_name = file_name; - unsigned long long pos = 0; - for(; *file_name; file_name++) - if(*file_name == DIRECTORY_SEPARATOR_SYMB) - pos = file_name - orig_file_name; - return pos; -} - -void initialize_stream(struct input_stream **stream_list, - const char *file_name) -{ - char *dir_path = copy_lexem(file_name); - unsigned long long dir_sep_pos = find_last_dir_separator_pos(dir_path); - FILE *fd = fopen(file_name, "r"); - if(!fd) - exit_error(ERROR_STATUS_OPEN, file_name); - add_input_stream(stream_list, fd, NULL); - if(dir_sep_pos) - { - dir_path[dir_sep_pos] = 0; - if(chdir(dir_path) == -1) - exit_error(ERROR_STATUS_CHDIR, NULL); - } - free(dir_path); -} - -void print_lexem(const char *lexem) -{ - printf("%s ", lexem); -} - -#define MACRO_SHIELD_LEXEM "#" -#define MACRO_START_LEXEM "[" -#define MACRO_INCLUDE_LEXEM "include" -#define MACRO_MODULE_LEXEM "module" -#define MACRO_LIT_LEXEM "literal" - -int main(int argc, char **argv) -{ - struct input_stream *stream_list = NULL; - struct macro *macro_list = NULL; - struct module *module_list = NULL; - char *lexem; - - if(argc <= 1) - exit_error(ERROR_STATUS_ARG, NULL); - else - initialize_stream(&stream_list, argv[1]); - - for(;; free(lexem)) - { - lexem = read_lexem(stream_list); - if(!lexem) - { - if(delete_input_stream(&stream_list)) - continue; - else - break; - } - if(compare_lexems(lexem, MACRO_SHIELD_LEXEM)) - { - free(lexem); - lexem = read_lexem(stream_list); - if(!lexem) - exit_error(ERROR_STATUS_INVALID_SHIELD, NULL); - print_lexem(lexem); - continue; - } - if(compare_lexems(lexem, MACRO_START_LEXEM)) - { - create_macro(stream_list, ¯o_list); - continue; - } - if(compare_lexems(lexem, MACRO_INCLUDE_LEXEM)) - { - include_file(&stream_list, NULL); - continue; - } - if(compare_lexems(lexem, MACRO_MODULE_LEXEM)) - { - include_file(&stream_list, &module_list); - continue; - } - if(is_lexem_hex(lexem, NULL)) - { - if(find_macro(&stream_list, macro_list, - MACRO_LIT_LEXEM)) - { - add_input_stream_parameter(stream_list, - copy_lexem(lexem)); - continue; - } - } - if(find_macro(&stream_list, macro_list, lexem)) - continue; - print_lexem(lexem); - } - - return 0; -} diff --git a/enki/strans.c b/enki/strans.c deleted file mode 100644 index e3d834d..0000000 --- a/enki/strans.c +++ /dev/null @@ -1,652 +0,0 @@ -/* - Simple Stack Translator - created by exegete -*/ - -#include -#include - -struct stack_elem -{ - unsigned long long value; - struct stack_elem *next; -}; - -struct identifier -{ - const char *lexem; - unsigned long long value; - struct identifier *next; -}; - -struct segment -{ - char *buffer; - unsigned long long real_size; - unsigned long long size; - unsigned long long pointer_address; - unsigned long long base_address; - unsigned long long base_offset; - int data_size; - int data_endianness; - struct segment *next; -}; - -struct environment -{ - struct stack_elem *stack; - struct identifier *id_list; - struct segment *seg_list; - unsigned long long chosen_segment; -}; - -struct operator -{ - void (*func)(struct environment *env); - const char *lexem; -}; - -#define ERROR_STATUS_STACK_OVERFLOW 1 -#define ERROR_STATUS_STACK_EMPTY 2 -#define ERROR_STATUS_ID_LIST_OVERFLOW 3 -#define ERROR_STATUS_SEG_LIST_OVERFLOW 4 -#define ERROR_STATUS_INVALID_SEGMENT 5 -#define ERROR_STATUS_WORD_BUFFER_OVERFLOW 6 -#define ERROR_STATUS_LEXEM_OVERFLOW 7 -#define ERROR_STATUS_UNDEFINED 8 -#define ERROR_STATUS_INVALID_ACCESS 9 -#define ERROR_STATUS_INVALID_WORD_SIZE 10 -#define ERROR_STATUS_WORD_ENDIANNESS_INVALID 11 - -const char *error_msgs[] = -{ - "Stack overflow", - "Stack is empty", - "Identifier list overflow", - "Segment list overflow", - "Invalid chosen segment", - "Word buffer overflow", - "Lexem is too big", - "Undefined lexem: ", - "Invalid segment access", - "Invalid segment data size", - "Invalid segment data endianness" -}; - -void exit_error(int status, const char *lexem) -{ - if(lexem) - fprintf(stderr, "Error: %s%s\n", error_msgs[status - 1], - lexem); - else - fprintf(stderr, "Error: %s\n", error_msgs[status - 1]); - exit(status); -} - -unsigned long long create_segment(struct environment *env) -{ - struct segment **chosen_segment = &env->seg_list; - unsigned long long segment_counter = 0; - for(; *chosen_segment; chosen_segment = &(*chosen_segment)->next) - segment_counter++; - *chosen_segment = malloc(sizeof(struct segment)); - if(!*chosen_segment) - exit_error(ERROR_STATUS_SEG_LIST_OVERFLOW, NULL); - (*chosen_segment)->buffer = NULL; - (*chosen_segment)->real_size = 0; - (*chosen_segment)->size = 0; - (*chosen_segment)->pointer_address = 0; - (*chosen_segment)->base_address = 0; - (*chosen_segment)->base_offset = 0; - (*chosen_segment)->data_size = 1; - (*chosen_segment)->data_endianness = 0; - (*chosen_segment)->next = NULL; - return segment_counter; -} - -struct segment *get_segment(struct environment *env) -{ - struct segment *chosen_segment = env->seg_list; - unsigned long long segment_counter = env->chosen_segment; - while(chosen_segment && segment_counter--) - chosen_segment = chosen_segment->next; - if(!chosen_segment) - exit_error(ERROR_STATUS_INVALID_SEGMENT, NULL); - return chosen_segment; -} - -void initialize_environment(struct environment *env) -{ - env->stack = NULL; - env->id_list = NULL; - env->seg_list = NULL; - env->chosen_segment = 0; -} - -int is_separator(int symb) -{ - return symb == ' ' || symb == '\n' || symb == '\t' || symb == '\r'; -} - -#define BUFFER_INITIAL_SIZE 4 - -int double_buffer(char **buffer, unsigned long long *buffer_size) -{ - char *tmp_pointer = *buffer; - unsigned long long tmp_size = *buffer_size; - - if(*buffer_size == 0) - *buffer_size = BUFFER_INITIAL_SIZE; - else - *buffer_size *= 2; - - *buffer = malloc(*buffer_size); - if(!*buffer) - return 0; - - for(; tmp_size > 0; tmp_size--) - (*buffer)[tmp_size - 1] = tmp_pointer[tmp_size - 1]; - - free(tmp_pointer); - return 1; -} - -char *read_lexem() -{ - char *buffer = NULL; - unsigned long long buffer_size = 0; - int symb; - unsigned long long index; - - while(is_separator(symb = getchar())) - {} - - if(symb == EOF) - return NULL; - - for(index = 0;; index++) - { - if(index == buffer_size) - if(!double_buffer(&buffer, &buffer_size)) - exit_error(ERROR_STATUS_LEXEM_OVERFLOW, NULL); - if(symb == EOF || is_separator(symb)) - { - buffer[index] = 0; - break; - } - buffer[index] = symb; - symb = getchar(); - } - return buffer; -} - -void push_stack_elem(struct stack_elem **stack, unsigned long long value) -{ - struct stack_elem *head = *stack; - *stack = malloc(sizeof(struct stack_elem)); - if(!*stack) - exit_error(ERROR_STATUS_STACK_OVERFLOW, NULL); - (*stack)->value = value; - (*stack)->next = head; -} - -unsigned long long pop_stack_elem(struct stack_elem **stack) -{ - struct stack_elem *head = *stack; - unsigned long long value; - if(!head) - exit_error(ERROR_STATUS_STACK_EMPTY, NULL); - value = head->value; - *stack = head->next; - free(head); - return value; -} - -int is_symb_hex(char symb) -{ - if(symb >= '0' && symb <= '9') - return symb - '0'; - else - if(symb >= 'A' && symb <= 'F') - return symb - 'A' + 10; - else - if(symb >= 'a' && symb <= 'f') - return symb - 'a' + 10; - else - return -1; -} - -int is_lexem_hex(struct environment *env, const char *lexem) -{ - int sign = 0; - unsigned long long hex = 0; - if(*lexem == '-' && *(lexem + 1)) - { - sign = 1; - lexem++; - } - - for(; *lexem; lexem++) - { - int num = is_symb_hex(*lexem); - if(num != -1) - hex = (hex << 4) + num; - else - return 0; - } - hex = sign ? ~hex + 1 : hex; - push_stack_elem(&env->stack, hex); - return 1; -} - -int compare_lexems(const char *lexem_one, const char *lexem_two) -{ - for(; *lexem_one && *lexem_two; lexem_one++, lexem_two++) - if(*lexem_one != *lexem_two) - return 0; - return *lexem_one == *lexem_two; -} - -void add_identifier(struct identifier **id_list, const char *lexem, - unsigned long long value) -{ - struct identifier *head = *id_list; - *id_list = malloc(sizeof(struct identifier)); - if(!id_list) - exit_error(ERROR_STATUS_ID_LIST_OVERFLOW, NULL); - (*id_list)->lexem = lexem; - (*id_list)->value = value; - (*id_list)->next = head; -} - -int find_identifier(struct environment *env, const char *lexem) -{ - struct identifier *id_list = env->id_list; - for(; id_list; id_list = id_list->next) - { - if(compare_lexems(lexem, id_list->lexem)) - { - push_stack_elem(&env->stack, id_list->value); - return 1; - } - } - return 0; -} - -void segment_compile_byte(struct environment *env, char byte) -{ - unsigned long long index = get_segment(env)->size; - if(index == get_segment(env)->real_size) - if(!double_buffer(&get_segment(env)->buffer, - &get_segment(env)->real_size)) - exit_error(ERROR_STATUS_WORD_BUFFER_OVERFLOW, NULL); - get_segment(env)->buffer[index] = byte; - get_segment(env)->size++; - get_segment(env)->pointer_address++; -} - -void segment_compile(struct environment *env, unsigned long long value, - int size) -{ - int dir = get_segment(env)->data_endianness ? -1 : 1; - int index = get_segment(env)->data_endianness * (size - 1); - for(; index < size && index >= 0; index += dir) - segment_compile_byte(env, value >> index * 8); -} - -unsigned long long convert_address(struct environment *env, - unsigned long long address, int size) -{ - unsigned long long pointer_address = - get_segment(env)->pointer_address; - unsigned long long base_address = get_segment(env)->base_address; - unsigned long long base_offset = get_segment(env)->base_offset; - if(address < base_address || address + size > pointer_address) - exit_error(ERROR_STATUS_INVALID_ACCESS, NULL); - return address - base_address + base_offset; -} - -unsigned long long segment_read(struct environment *env, - unsigned long long address, int size) -{ - unsigned long long value = 0; - int dir = get_segment(env)->data_endianness ? 1 : -1; - int index = get_segment(env)->data_endianness ? 0 : (size - 1); - address = convert_address(env, address, size); - for(; index < size && index >= 0; index += dir) - value = (value << 8) + - (get_segment(env)->buffer[address + index] & 0xFF); - return value; -} - -void segment_write(struct environment *env, unsigned long long value, - unsigned long long address, int size) -{ - int dir = get_segment(env)->data_endianness ? -1 : 1; - int index = get_segment(env)->data_endianness * (size - 1); - address = convert_address(env, address, size); - for(; index < size && index >= 0; index += dir) - { - get_segment(env)->buffer[address + index] = value; - value >>= 8; - } -} - -void translator_drop(struct environment *env) -{ - pop_stack_elem(&env->stack); -} - -void translator_dup(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, value); - push_stack_elem(&env->stack, value); -} - -void translator_over(struct environment *env) -{ - unsigned long long value_one = pop_stack_elem(&env->stack); - unsigned long long value_two = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, value_two); - push_stack_elem(&env->stack, value_one); - push_stack_elem(&env->stack, value_two); -} - -void translator_swap(struct environment *env) -{ - unsigned long long value_one = pop_stack_elem(&env->stack); - unsigned long long value_two = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, value_one); - push_stack_elem(&env->stack, value_two); -} - -void translator_add(struct environment *env) -{ - unsigned long long first = pop_stack_elem(&env->stack); - unsigned long long second = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, second + first); -} - -void translator_sub(struct environment *env) -{ - unsigned long long first = pop_stack_elem(&env->stack); - unsigned long long second = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, second - first); -} - -void translator_mul(struct environment *env) -{ - unsigned long long first = pop_stack_elem(&env->stack); - unsigned long long second = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, second * first); -} - -void translator_div(struct environment *env) -{ - unsigned long long first = pop_stack_elem(&env->stack); - unsigned long long second = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, second / first); -} - -void translator_mod(struct environment *env) -{ - unsigned long long first = pop_stack_elem(&env->stack); - unsigned long long second = pop_stack_elem(&env->stack); - push_stack_elem(&env->stack, second % first); -} - -void translator_define_identifier(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - add_identifier(&env->id_list, read_lexem(), value); -} - -void translator_compile_one(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - segment_compile(env, value, 1); -} - -void translator_compile_two(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - segment_compile(env, value, 2); -} - -void translator_compile_four(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - segment_compile(env, value, 4); -} - -void translator_compile_eight(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - segment_compile(env, value, 8); -} - -void translator_compile(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - segment_compile(env, value, get_segment(env)->data_size); -} - -void translator_reserve(struct environment *env) -{ - unsigned long long count = pop_stack_elem(&env->stack); - while(count--) - segment_compile(env, 0, 1); -} - -void translator_read_one(struct environment *env) -{ - unsigned long long value = segment_read(env, - pop_stack_elem(&env->stack), 1); - push_stack_elem(&env->stack, value); -} - -void translator_read_two(struct environment *env) -{ - unsigned long long value = segment_read(env, - pop_stack_elem(&env->stack), 2); - push_stack_elem(&env->stack, value); -} - -void translator_read_four(struct environment *env) -{ - unsigned long long value = segment_read(env, - pop_stack_elem(&env->stack), 4); - push_stack_elem(&env->stack, value); -} - -void translator_read_eight(struct environment *env) -{ - unsigned long long value = segment_read(env, - pop_stack_elem(&env->stack), 8); - push_stack_elem(&env->stack, value); -} - -void translator_read(struct environment *env) -{ - unsigned long long value = segment_read(env, - pop_stack_elem(&env->stack), get_segment(env)->data_size); - push_stack_elem(&env->stack, value); -} - -void translator_write_one(struct environment *env) -{ - unsigned long long address = pop_stack_elem(&env->stack); - unsigned long long value = pop_stack_elem(&env->stack); - segment_write(env, value, address, 1); -} - -void translator_write_two(struct environment *env) -{ - unsigned long long address = pop_stack_elem(&env->stack); - unsigned long long value = pop_stack_elem(&env->stack); - segment_write(env, value, address, 2); -} - -void translator_write_four(struct environment *env) -{ - unsigned long long address = pop_stack_elem(&env->stack); - unsigned long long value = pop_stack_elem(&env->stack); - segment_write(env, value, address, 4); -} - -void translator_write_eight(struct environment *env) -{ - unsigned long long address = pop_stack_elem(&env->stack); - unsigned long long value = pop_stack_elem(&env->stack); - segment_write(env, value, address, 8); -} - -void translator_write(struct environment *env) -{ - unsigned long long address = pop_stack_elem(&env->stack); - unsigned long long value = pop_stack_elem(&env->stack); - segment_write(env, value, address, get_segment(env)->data_size); -} - -void translator_create_segment(struct environment *env) -{ - push_stack_elem(&env->stack, create_segment(env)); -} - -void translator_choose_segment(struct environment *env) -{ - env->chosen_segment = pop_stack_elem(&env->stack); -} - -void translator_set_base(struct environment *env) -{ - get_segment(env)->base_address = pop_stack_elem(&env->stack); - get_segment(env)->pointer_address = get_segment(env)->base_address; - get_segment(env)->base_offset = get_segment(env)->size; -} - -#define WORD_SIZE_MAX 8 - -void translator_set_data_size(struct environment *env) -{ - int target_size = pop_stack_elem(&env->stack); - if(target_size <= 0 || target_size > WORD_SIZE_MAX) - exit_error(ERROR_STATUS_INVALID_WORD_SIZE, NULL); - get_segment(env)->data_size = target_size; -} - -void translator_set_data_endianness(struct environment *env) -{ - int endianness = pop_stack_elem(&env->stack); - if(endianness > 1) - exit_error(ERROR_STATUS_WORD_ENDIANNESS_INVALID, NULL); - get_segment(env)->data_endianness = endianness; -} - -void translator_get_offset(struct environment *env) -{ - push_stack_elem(&env->stack, get_segment(env)->pointer_address); -} - -void translator_get_base(struct environment *env) -{ - push_stack_elem(&env->stack, get_segment(env)->base_address); -} - -void translator_print(struct environment *env) -{ - unsigned long long value = pop_stack_elem(&env->stack); - fprintf(stderr, "%llx\n", value); -} - -const struct operator translator_operators[] = -{ - { &translator_drop, "?drop" }, - { &translator_dup, "?dup" }, - { &translator_over, "?over" }, - { &translator_swap, "?swap" }, - { &translator_add, "?+" }, - { &translator_sub, "?-" }, - { &translator_mul, "?*" }, - { &translator_div, "?/" }, - { &translator_mod, "?mod" }, - { &translator_define_identifier, "??" }, - { &translator_compile_one, "?'" }, - { &translator_compile_one, "?1." }, - { &translator_compile_two, "?2." }, - { &translator_compile_four, "?4." }, - { &translator_compile_eight, "?8." }, - { &translator_compile, "?." }, - { &translator_reserve, "?res" }, - { &translator_read_one, "?1@" }, - { &translator_read_two, "?2@" }, - { &translator_read_four, "?4@" }, - { &translator_read_eight, "?8@" }, - { &translator_read, "?@" }, - { &translator_write_one, "?1!" }, - { &translator_write_two, "?2!" }, - { &translator_write_four, "?4!" }, - { &translator_write_eight, "?8!" }, - { &translator_write, "?!" }, - { &translator_create_segment, "?create" }, - { &translator_choose_segment, "?choose" }, - { &translator_set_base, "?org" }, - { &translator_set_data_size, "?size" }, - { &translator_set_data_endianness, "?endianness" }, - { &translator_get_offset, "?$" }, - { &translator_get_base, "?$$" }, - { &translator_print, "?print" }, -}; - -int execute_operator(struct environment *env, const char *lexem) -{ - int operators_count = - sizeof(translator_operators) / sizeof(*translator_operators); - int index; - - for(index = 0; index < operators_count; index++) - { - if(compare_lexems(lexem, translator_operators[index].lexem)) - { - (*translator_operators[index].func)(env); - break; - } - } - - return index != operators_count; -} - -void print_target_buffer(struct environment *env) -{ - struct segment *seg_list; - unsigned long long index; - for(seg_list = env->seg_list; seg_list; seg_list = seg_list->next) - for(index = 0; index < seg_list->size; index++) - putchar(seg_list->buffer[index]); -} - -int main() -{ - struct environment env; - char *lexem; - - initialize_environment(&env); - - for(;; free(lexem)) - { - lexem = read_lexem(); - if(!lexem) - break; - if(find_identifier(&env, lexem)) - continue; - if(is_lexem_hex(&env, lexem)) - continue; - if(!execute_operator(&env, lexem)) - exit_error(ERROR_STATUS_UNDEFINED, lexem); - } - - print_target_buffer(&env); - - return 0; -} diff --git a/freq.sts b/freq.sts deleted file mode 100644 index 9935d72..0000000 --- a/freq.sts +++ /dev/null @@ -1,35 +0,0 @@ -[ freq_push_eng 1 - %1% float_iload - 1 04b7e520 float_dload - float_div - float_fstore -] - -defword freq_eng - freq_push_eng 164bbb40 ; 'A' - freq_push_eng 42f1a72 ; 'B' - freq_push_eng 8401143 ; 'C' - freq_push_eng a17c760 ; 'D' - freq_push_eng 1f89b0b5 ; 'E' - freq_push_eng 5b00667 ; 'F' - freq_push_eng 5708064 ; 'G' - freq_push_eng ceba1cf ; 'H' - freq_push_eng 131911c9 ; 'I' - freq_push_eng 92b062 ; 'J' - freq_push_eng 21bc198 ; 'K' - freq_push_eng af78ee2 ; 'L' - freq_push_eng 6962a60 ; 'M' - freq_push_eng 12b2fedc ; 'N' - freq_push_eng 1377f19c ; 'O' - freq_push_eng 5630a2b ; 'P' - freq_push_eng 456e16 ; 'Q' - freq_push_eng 1082b289 ; 'R' - freq_push_eng 118aaa32 ; 'S' - freq_push_eng 174da771 ; 'T' - freq_push_eng 6fdcaa4 ; 'U' - freq_push_eng 2c30c89 ; 'V' - freq_push_eng 4c25150 ; 'W' - freq_push_eng 7fb6fb ; 'X' - freq_push_eng 47ce733 ; 'Y' - freq_push_eng 4bece7 ; 'Z' -exit diff --git a/ia32/bitwise.sts b/ia32/bitwise.sts deleted file mode 100644 index 205e618..0000000 --- a/ia32/bitwise.sts +++ /dev/null @@ -1,27 +0,0 @@ -defasm xor - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 31 ?' # d8 ?' ; xor eax, ebx - # 50 ?' ; push eax -next - -defasm and - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 21 ?' # d8 ?' ; and eax, ebx - # 50 ?' ; push eax -next - -defasm shr - # 59 ?' ; pop ecx - # 58 ?' ; pop eax - # d3 ?' # e8 ?' ; shr eax, cl - # 50 ?' ; push eax -next - -defasm shl - # 59 ?' ; pop ecx - # 58 ?' ; pop eax - # d3 ?' # e0 ?' ; shl eax, cl - # 50 ?' ; push eax -next diff --git a/ia32/branch.sts b/ia32/branch.sts deleted file mode 100644 index 35177f6..0000000 --- a/ia32/branch.sts +++ /dev/null @@ -1,11 +0,0 @@ -defasm branch - # 8b ?' # 36 ?' ; mov esi, [esi] -next - -defasm 0branch - # 58 ?' ; pop eax - # 83 ?' # c6 ?' # 4 ?' ; add esi, 4 - # 83 ?' # f8 ?' # 0 ?' ; cmp eax, 0 - # 75 ?' # 3 ?' ; jne +3 - # 8b ?' # 76 ?' # fc ?' ; mov esi, [esi - 4] -next diff --git a/ia32/const.sts b/ia32/const.sts deleted file mode 100644 index 31f8041..0000000 --- a/ia32/const.sts +++ /dev/null @@ -1,3 +0,0 @@ -defconst word_size 4 -defconst word_max ffffffff -defconst word_endianness 0 diff --git a/ia32/core.sts b/ia32/core.sts deleted file mode 100644 index 4a5e692..0000000 --- a/ia32/core.sts +++ /dev/null @@ -1,17 +0,0 @@ -defasm docol - # 83 ?' # ed ?' # 4 ?' ; sub ebp, 4 - # 89 ?' # 75 ?' # 0 ?' ; mov [ebp], esi - # 83 ?' # c0 ?' # 4 ?' ; add eax, 4 - # 89 ?' # c6 ?' ; mov esi, eax - # ad ?' # ff ?' # 20 ?' ; go next -next - -defasm exit - # 8b ?' # 75 ?' # 0 ?' ; mov esi, [ebp] - # 83 ?' # c5 ?' # 4 ?' ; add ebp, 4 -next - -defasm lit - # ad ?' ; lodsd - # 50 ?' ; push eax -next diff --git a/ia32/elf/begin.sts b/ia32/elf/begin.sts deleted file mode 100644 index 8dab930..0000000 --- a/ia32/elf/begin.sts +++ /dev/null @@ -1,129 +0,0 @@ -?create ?? _code_segment -_code_segment ?choose - -# 08048000 ?org -# 4 ?size -# 0 ?endianness - -?create ?? _data_segment -_data_segment ?choose - -# 09048000 ?org -# 4 ?size -# 0 ?endianness - -_code_segment ?choose - -; ELF header -; EI_MAG - ELF magic number -# 7f ?' # 45 ?' # 4c ?' # 46 ?' -; EI_CLASS - 32-bit format -# 1 ?' -; EI_DATA - little-endiann -# 1 ?' -; EI_VERSION - current ELF header version -# 1 ?' -; EI_OSABI - Linux ABI -# 3 ?' -; EI_ABIVERSION - none -# 0 ?' -; EI_PAD - padding -# 7 ?res -; Executable file type -# 2 ?2. -; IA-32 architecture -# 3 ?2. -; ELF version -# 1 ?4. -; Entry point -?$ ?? _elf_entry -# 0 ?4. -; Program headers offset -# 34 ?4. -; Section headers offset -# 0 ?4. -; Extra flags -# 0 ?4. -; ELF header size -# 34 ?2. -; Program header size -# 20 ?2. -; Number of program headers -# 2 ?2. -; Section header size -# 28 ?2. -; Number of section headers -# 0 ?2. -; Section name section index -# 0 ?2. - -; ELF CODE PROGRAM HEADER -; Segment type -# 1 ?4. -; Segment offset -# 0 ?4. -; Segment virtual address -?$$ ?4. -; Segment physical address -?$$ ?4. -; Segment file size -?$ ?? _code_segment_file_size -# 0 ?4. -; Segment memory size -?$ ?? _code_segment_memory_size -# 0 ?4. -; Segment flags -# 5 ?4. -; Segment alignment -# 1000 ?4. - -; ELF DATA PROGRAM HEADER -; Segment type -# 1 ?4. -; Segment offset -?$ ?? _data_segment_offset -# 0 ?4. -; Segment virtual address -_data_segment ?choose -?$$ -_code_segment ?choose -?4. -; Segment physical address -_data_segment ?choose -?$$ -_code_segment ?choose -?4. -; Segment file size -?$ ?? _data_segment_file_size -# 0 ?4. -; Segment memory size -?$ ?? _data_segment_memory_size -# 0 ?4. -; Segment flags -# 6 ?4. -; Segment alignment -# 1000 ?4. - -; Return stack -_data_segment ?choose -1000 ?res -?$ ?dup ?? _return_stack -_code_segment ?choose - -; PROGRAM ENTRY CODE -?$ _elf_entry ?! -; mov ebp, _return_stack -# bd ?' -_return_stack ?. -; mov esi, _threaded_code_entry -# be ?' -?$ ?? _threaded_code_entry -# 0 ?. -; lodsd -# ad ?' -; jmp dword [eax] -# ff ?' # 20 ?' - -module ia32/ia32.sts -module ia32/elf/syscall.sts -module common/common.sts diff --git a/ia32/elf/end.sts b/ia32/elf/end.sts deleted file mode 100644 index 7c80eec..0000000 --- a/ia32/elf/end.sts +++ /dev/null @@ -1,21 +0,0 @@ -; Code segment alignment -# 1000 ?$ # 1000 ?mod ?- ?dup ?res - -; Code segment ELF sizes -?$ ?$$ ?- _code_segment_file_size ?! -?$ ?$$ ?- _code_segment_memory_size ?! - -; Data segment ELF offset -?$ ?$$ ?- -_code_segment ?choose -_data_segment_offset ?! - -; Data segment ELF sizes -_data_segment ?choose -?$ ?$$ ?- -_code_segment ?choose -_data_segment_file_size ?! -_data_segment ?choose -?$ ?$$ ?- -_code_segment ?choose -_data_segment_memory_size ?! diff --git a/ia32/elf/syscall.sts b/ia32/elf/syscall.sts deleted file mode 100644 index 3acfef2..0000000 --- a/ia32/elf/syscall.sts +++ /dev/null @@ -1,41 +0,0 @@ -defasm sys_exit - # b8 ?' # 1 ?. ; mov eax, 1 - # 31 ?' # db ?' ; xor ebx, ebx - # cd ?' # 80 ?' ; int 0x80 -; no need in next since this is the last instruction - -_data_segment ?choose - ?$ ?? _iobuf # 0 ?. -_code_segment ?choose - -defasm sys_read - # b8 ?' # 3 ?. ; mov eax, 3 - # 31 ?' # db ?' ; xor ebx, ebx - # b9 ?' _iobuf ?. ; mov ecx, _iobuf - # ba ?' # 1 ?. ; mov edx, 1 - # cd ?' # 80 ?' ; int 0x80 - # 31 ?' # db ?' ; xor ebx, ebx - # 8a ?' # 1d ?' _iobuf ?. ; mov bl, [_iobuf] - # 53 ?' ; push ebx - # 50 ?' ; push eax -next - -defasm sys_write - # 58 ?' ; pop eax - # a2 ?' _iobuf ?. ; mov [_iobuf], al - # b8 ?' # 4 ?. ; mov eax, 4 - # bb ?' # 1 ?. ; mov ebx, 1 - # b9 ?' _iobuf ?. ; mov ecx, _iobuf - # ba ?' # 1 ?. ; mov edx, 1 - # cd ?' # 80 ?' ; int 0x80 -next - -defasm sys_write_err - # 58 ?' ; pop eax - # a2 ?' _iobuf ?. ; mov [_iobuf], al - # b8 ?' # 4 ?. ; mov eax, 4 - # bb ?' # 2 ?. ; mov ebx, 2 - # b9 ?' _iobuf ?. ; mov ecx, _iobuf - # ba ?' # 1 ?. ; mov edx, 1 - # cd ?' # 80 ?' ; int 0x80 -next diff --git a/ia32/float/control.sts b/ia32/float/control.sts deleted file mode 100644 index 3863f5f..0000000 --- a/ia32/float/control.sts +++ /dev/null @@ -1,19 +0,0 @@ -defasm float_init - # 9b ?' ; wait - # db ?' # e3 ?' ; fninit -next - -defasm float_cload - # d9 ?' # 2c ?' # 24 ?' ; fldcw [esp] - # 58 ?' ; pop eax -next - -defasm float_sstore - # 9b ?' # df ?' # e0 ?' ; fstsw ax - # 50 ?' ; push eax -next - -defasm float_cstore - # 50 ?' ; push eax - # d9 ?' # 3c ?' # 24 ?' ; fstcw [esp] -next diff --git a/ia32/float/float.sts b/ia32/float/float.sts deleted file mode 100644 index d6907ca..0000000 --- a/ia32/float/float.sts +++ /dev/null @@ -1,3 +0,0 @@ -module ia32/float/control.sts -module ia32/float/stack.sts -module ia32/float/math.sts diff --git a/ia32/float/math.sts b/ia32/float/math.sts deleted file mode 100644 index d02b491..0000000 --- a/ia32/float/math.sts +++ /dev/null @@ -1,32 +0,0 @@ -defasm float_add - # de ?' # c1 ?' ; faddp st1, st0 -next - -defasm float_sub - # de ?' # e9 ?' ; fsubp st1, st0 -next - -defasm float_mul - # de ?' # c9 ?' ; fmullp st1, st0 -next - -defasm float_div - # de ?' # f9 ?' ; fdivp st1, st0 -next - -defasm float_sqrt - # d9 ?' # fa ?' ; fsqrt -next - -defasm float_more - # de ?' # d9 ?' ; fcompp - # 9b ?' # df ?' # e0 ?' ; fstsw ax - # 25 ?' # 100 ?. ; and eax, 0x100 - # c1 ?' # e8 ?' # 8 ?' ; shr eax, 8 - # 50 ?' ; push eax -next - -defword float_less - float_more - 0 = -exit diff --git a/ia32/float/stack.sts b/ia32/float/stack.sts deleted file mode 100644 index 8c16fef..0000000 --- a/ia32/float/stack.sts +++ /dev/null @@ -1,25 +0,0 @@ -defasm float_fload - # d9 ?' # 04 ?' # 24 ?' ; fld dword [esp] - # 58 ?' ; pop eax -next - -defasm float_iload - # db ?' # 04 ?' # 24 ?' ; fild dword [esp] - # 58 ?' ; pop eax -next - -defasm float_dload - # df ?' # 2c ?' # 24 ?' ; fild qword [esp] - # 58 ?' ; pop eax - # 58 ?' ; pop eax -next - -defasm float_fstore - # 50 ?' ; push eax - # d9 ?' # 1c ?' # 24 ?' ; fstp dword [esp] -next - -defasm float_istore - # 50 ?' ; push eax - # db ?' # 1c ?' # 24 ?' ; fistp dword [esp] -next diff --git a/ia32/ia32.sts b/ia32/ia32.sts deleted file mode 100644 index 38b5919..0000000 --- a/ia32/ia32.sts +++ /dev/null @@ -1,8 +0,0 @@ -module ia32/macro.sts -module ia32/const.sts -module ia32/core.sts -module ia32/stack.sts -module ia32/branch.sts -module ia32/memory.sts -module ia32/math.sts -module ia32/bitwise.sts diff --git a/ia32/macro.sts b/ia32/macro.sts deleted file mode 100644 index fa9510b..0000000 --- a/ia32/macro.sts +++ /dev/null @@ -1,86 +0,0 @@ -[ next 0 - # ad ?' # ff ?' # 20 ?' -] - -[ defasm 1 - [ %1% 0 - _%0% ?. - \] - ?$ ?? _%1% - ?$ # 4 ?+ ?. -] - -[ defword 1 - [ %1% 0 - _%0% ?. - \] - ?$ ?? _%1% - _docol # 4 ?+ ?. -] - -[ defconst 2 - defasm %1% - # 68 ?' # %2% ?. ; push %2% - next -] - -[ defarr 2 - _data_segment ?choose - ?$ ?? _%1%_arr - # %2% # 4 ?* ?res - _code_segment ?choose - defasm %1% - # 68 ?' _%1%_arr ?. ; push _%1%_arr - next -] - -[ defvar 1 - defarr %1% 1 -] - -[ as 1 - _data_segment ?choose - defword %1% - lit ?$ # 0 ?. - exit - _code_segment ?choose - lit ?. ! -] - -[ literal 0 - lit # %1% ?. -] - -[ set_entry 0 - ?$ _threaded_code_entry ?! -] - -[ if 0 - 0branch ?$ # 0 ?. -] - -[ fi 0 - ?$ ?swap ?! -] - -[ else 0 - branch ?$ # 0 ?. - ?swap ?$ ?swap ?! -] - -[ do 0 - ?$ -] - -[ untilod 0 - 0branch ?. -] - -[ until 0 - 0 = 0branch ?$ # 0 ?. -] - -[ od 0 - branch ?swap ?. - ?$ ?swap ?! -] diff --git a/ia32/math.sts b/ia32/math.sts deleted file mode 100644 index 609a21a..0000000 --- a/ia32/math.sts +++ /dev/null @@ -1,68 +0,0 @@ -defasm + - # 58 ?' ; pop eax - # 01 ?' # 04 ?' # 24 ?' ; add [esp], eax -next - -defasm - - # 58 ?' ; pop eax - # 29 ?' # 04 ?' # 24 ?' ; sub [esp], eax -next - -defasm mul - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # f7 ?' # e3 ?' ; mul ebx - # 50 ?' ; push eax -next - -defasm mod - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 31 ?' # d2 ?' ; xor edx, edx - # f7 ?' # f3 ?' ; div ebx - # 52 ?' ; push edx -next - -defasm div - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 31 ?' # d2 ?' ; xor edx, edx - # f7 ?' # f3 ?' ; div ebx - # 50 ?' ; push eax -next - -defasm = - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 39 ?' # d8 ?' ; cmp eax, ebx - # 0f ?' # 94 ?' # c0 ?' ; sete al - # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al - # 50 ?' ; push eax -next - -defasm != - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 39 ?' # d8 ?' ; cmp eax, ebx - # 0f ?' # 95 ?' # c0 ?' ; setne al - # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al - # 50 ?' ; push eax -next - -defasm < - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 39 ?' # d8 ?' ; cmp eax, ebx - # 0f ?' # 92 ?' # c0 ?' ; setb al - # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al - # 50 ?' ; push eax -next - -defasm > - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 39 ?' # d8 ?' ; cmp eax, ebx - # 0f ?' # 97 ?' # c0 ?' ; seta al - # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al - # 50 ?' ; push eax -next diff --git a/ia32/memory.sts b/ia32/memory.sts deleted file mode 100644 index 240c598..0000000 --- a/ia32/memory.sts +++ /dev/null @@ -1,10 +0,0 @@ -defasm @ - # 58 ?' ; pop eax - # ff ?' # 30 ?' ; push dword [eax] -next - -defasm ! - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 89 ?' # 03 ?' ; mov [ebx], eax -next diff --git a/ia32/stack.sts b/ia32/stack.sts deleted file mode 100644 index e884098..0000000 --- a/ia32/stack.sts +++ /dev/null @@ -1,41 +0,0 @@ -defasm top - # 54 ?' ; push esp -next - -defasm ref - # 58 ?' ; pop eax - # c1 ?' # e0 ?' # 2 ?' ; shl eax, 2 - # 01 ?' # e0 ?' ; add eax, esp - # 50 ?' ; push eax -next - -defasm get - # 58 ?' ; pop eax - # 8b ?' # 4 ?' # 84 ?' ; mov eax, [esp + 4 * eax] - # 50 ?' ; push eax -next - -defasm set - # 5b ?' ; pop ebx - # 58 ?' ; pop eax - # 89 ?' # 04 ?' # 9c ?' ; mov [esp + 4 * ebx], eax -next - -defasm drop - # 58 ?' ; pop eax -next - -defasm dup - # ff ?' # 34 ?' # 24 ?' ; push dword [esp] -next - -defasm over - # ff ?' # 74 ?' # 24 ?' # 4 ?' ; push dword [esp + 4] -next - -defasm swap - # 58 ?' ; pop eax - # 5b ?' ; pop ebx - # 50 ?' ; push eax - # 53 ?' ; push ebx -next diff --git a/kernel-options.txt b/kernel-options.txt deleted file mode 100644 index eaf32a1..0000000 --- a/kernel-options.txt +++ /dev/null @@ -1,884 +0,0 @@ - - - Command Line Options for Linux/m68k - =================================== - -Last Update: 2 May 1999 -Linux/m68k version: 2.2.6 -Author: Roman.Hodek@informatik.uni-erlangen.de (Roman Hodek) -Update: jds@kom.auc.dk (Jes Sorensen) and faq@linux-m68k.org (Chris Lawrence) - -0) Introduction -=============== - - Often I've been asked which command line options the Linux/m68k -kernel understands, or how the exact syntax for the ... option is, or -... about the option ... . I hope, this document supplies all the -answers... - - Note that some options might be outdated, their descriptions being -incomplete or missing. Please update the information and send in the -patches. - - -1) Overview of the Kernel's Option Processing -============================================= - -The kernel knows three kinds of options on its command line: - - 1) kernel options - 2) environment settings - 3) arguments for init - -To which of these classes an argument belongs is determined as -follows: If the option is known to the kernel itself, i.e. if the name -(the part before the '=') or, in some cases, the whole argument string -is known to the kernel, it belongs to class 1. Otherwise, if the -argument contains an '=', it is of class 2, and the definition is put -into init's environment. All other arguments are passed to init as -command line options. - - This document describes the valid kernel options for Linux/m68k in -the version mentioned at the start of this file. Later revisions may -add new such options, and some may be missing in older versions. - - In general, the value (the part after the '=') of an option is a -list of values separated by commas. The interpretation of these values -is up to the driver that "owns" the option. This association of -options with drivers is also the reason that some are further -subdivided. - - -2) General Kernel Options -========================= - -2.1) root= ----------- - -Syntax: root=/dev/ - or: root= - -This tells the kernel which device it should mount as the root -filesystem. The device must be a block device with a valid filesystem -on it. - - The first syntax gives the device by name. These names are converted -into a major/minor number internally in the kernel in an unusual way. -Normally, this "conversion" is done by the device files in /dev, but -this isn't possible here, because the root filesystem (with /dev) -isn't mounted yet... So the kernel parses the name itself, with some -hardcoded name to number mappings. The name must always be a -combination of two or three letters, followed by a decimal number. -Valid names are: - - /dev/ram: -> 0x0100 (initial ramdisk) - /dev/hda: -> 0x0300 (first IDE disk) - /dev/hdb: -> 0x0340 (second IDE disk) - /dev/sda: -> 0x0800 (first SCSI disk) - /dev/sdb: -> 0x0810 (second SCSI disk) - /dev/sdc: -> 0x0820 (third SCSI disk) - /dev/sdd: -> 0x0830 (forth SCSI disk) - /dev/sde: -> 0x0840 (fifth SCSI disk) - /dev/fd : -> 0x0200 (floppy disk) - - The name must be followed by a decimal number, that stands for the -partition number. Internally, the value of the number is just -added to the device number mentioned in the table above. The -exceptions are /dev/ram and /dev/fd, where /dev/ram refers to an -initial ramdisk loaded by your bootstrap program (please consult the -instructions for your bootstrap program to find out how to load an -initial ramdisk). As of kernel version 2.0.18 you must specify -/dev/ram as the root device if you want to boot from an initial -ramdisk. For the floppy devices, /dev/fd, the number stands for the -floppy drive number (there are no partitions on floppy disks). I.e., -/dev/fd0 stands for the first drive, /dev/fd1 for the second, and so -on. Since the number is just added, you can also force the disk format -by adding a number greater than 3. If you look into your /dev -directory, use can see the /dev/fd0D720 has major 2 and minor 16. You -can specify this device for the root FS by writing "root=/dev/fd16" on -the kernel command line. - -[Strange and maybe uninteresting stuff ON] - - This unusual translation of device names has some strange -consequences: If, for example, you have a symbolic link from /dev/fd -to /dev/fd0D720 as an abbreviation for floppy driver #0 in DD format, -you cannot use this name for specifying the root device, because the -kernel cannot see this symlink before mounting the root FS and it -isn't in the table above. If you use it, the root device will not be -set at all, without an error message. Another example: You cannot use a -partition on e.g. the sixth SCSI disk as the root filesystem, if you -want to specify it by name. This is, because only the devices up to -/dev/sde are in the table above, but not /dev/sdf. Although, you can -use the sixth SCSI disk for the root FS, but you have to specify the -device by number... (see below). Or, even more strange, you can use the -fact that there is no range checking of the partition number, and your -knowledge that each disk uses 16 minors, and write "root=/dev/sde17" -(for /dev/sdf1). - -[Strange and maybe uninteresting stuff OFF] - - If the device containing your root partition isn't in the table -above, you can also specify it by major and minor numbers. These are -written in hex, with no prefix and no separator between. E.g., if you -have a CD with contents appropriate as a root filesystem in the first -SCSI CD-ROM drive, you boot from it by "root=0b00". Here, hex "0b" = -decimal 11 is the major of SCSI CD-ROMs, and the minor 0 stands for -the first of these. You can find out all valid major numbers by -looking into include/linux/major.h. - -In addition to major and minor numbers, if the device containing your -root partition uses a partition table format with unique partition -identifiers, then you may use them. For instance, -"root=PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF". It is also -possible to reference another partition on the same device using a -known partition UUID as the starting point. For example, -if partition 5 of the device has the UUID of -00112233-4455-6677-8899-AABBCCDDEEFF then partition 3 may be found as -follows: - PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF/PARTNROFF=-2 - -Authoritative information can be found in -"Documentation/kernel-parameters.txt". - - -2.2) ro, rw ------------ - -Syntax: ro - or: rw - -These two options tell the kernel whether it should mount the root -filesystem read-only or read-write. The default is read-only, except -for ramdisks, which default to read-write. - - -2.3) debug ----------- - -Syntax: debug - -This raises the kernel log level to 10 (the default is 7). This is the -same level as set by the "dmesg" command, just that the maximum level -selectable by dmesg is 8. - - -2.4) debug= ------------ - -Syntax: debug= - -This option causes certain kernel messages be printed to the selected -debugging device. This can aid debugging the kernel, since the -messages can be captured and analyzed on some other machine. Which -devices are possible depends on the machine type. There are no checks -for the validity of the device name. If the device isn't implemented, -nothing happens. - - Messages logged this way are in general stack dumps after kernel -memory faults or bad kernel traps, and kernel panics. To be exact: all -messages of level 0 (panic messages) and all messages printed while -the log level is 8 or more (their level doesn't matter). Before stack -dumps, the kernel sets the log level to 10 automatically. A level of -at least 8 can also be set by the "debug" command line option (see -2.3) and at run time with "dmesg -n 8". - -Devices possible for Amiga: - - - "ser": built-in serial port; parameters: 9600bps, 8N1 - - "mem": Save the messages to a reserved area in chip mem. After - rebooting, they can be read under AmigaOS with the tool - 'dmesg'. - -Devices possible for Atari: - - - "ser1": ST-MFP serial port ("Modem1"); parameters: 9600bps, 8N1 - - "ser2": SCC channel B serial port ("Modem2"); parameters: 9600bps, 8N1 - - "ser" : default serial port - This is "ser2" for a Falcon, and "ser1" for any other machine - - "midi": The MIDI port; parameters: 31250bps, 8N1 - - "par" : parallel port - The printing routine for this implements a timeout for the - case there's no printer connected (else the kernel would - lock up). The timeout is not exact, but usually a few - seconds. - - -2.6) ramdisk_size= -------------- - -Syntax: ramdisk_size= - - This option instructs the kernel to set up a ramdisk of the given -size in KBytes. Do not use this option if the ramdisk contents are -passed by bootstrap! In this case, the size is selected automatically -and should not be overwritten. - - The only application is for root filesystems on floppy disks, that -should be loaded into memory. To do that, select the corresponding -size of the disk as ramdisk size, and set the root device to the disk -drive (with "root="). - - -2.7) swap= -2.8) buff= ------------ - - I can't find any sign of these options in 2.2.6. - - -3) General Device Options (Amiga and Atari) -=========================================== - -3.1) ether= ------------ - -Syntax: ether=[[,[,[,]]]], - - is the name of a net driver, as specified in -drivers/net/Space.c in the Linux source. Most prominent are eth0, ... -eth3, sl0, ... sl3, ppp0, ..., ppp3, dummy, and lo. - - The non-ethernet drivers (sl, ppp, dummy, lo) obviously ignore the -settings by this options. Also, the existing ethernet drivers for -Linux/m68k (ariadne, a2065, hydra) don't use them because Zorro boards -are really Plug-'n-Play, so the "ether=" option is useless altogether -for Linux/m68k. - - -3.2) hd= --------- - -Syntax: hd=,, - - This option sets the disk geometry of an IDE disk. The first hd= -option is for the first IDE disk, the second for the second one. -(I.e., you can give this option twice.) In most cases, you won't have -to use this option, since the kernel can obtain the geometry data -itself. It exists just for the case that this fails for one of your -disks. - - -3.3) max_scsi_luns= -------------------- - -Syntax: max_scsi_luns= - - Sets the maximum number of LUNs (logical units) of SCSI devices to -be scanned. Valid values for are between 1 and 8. Default is 8 if -"Probe all LUNs on each SCSI device" was selected during the kernel -configuration, else 1. - - -3.4) st= --------- - -Syntax: st=,[,[]] - - Sets several parameters of the SCSI tape driver. is -the number of 512-byte buffers reserved for tape operations for each -device. sets the number of blocks which must be filled -to start an actual write operation to the tape. Maximum value is the -total number of buffers. limits the total number of -buffers allocated for all tape devices. - - -3.5) dmasound= --------------- - -Syntax: dmasound=[,[,]] - - This option controls some configurations of the Linux/m68k DMA sound -driver (Amiga and Atari): is the number of buffers you want -to use (minimum 4, default 4), is the size of each -buffer in kilobytes (minimum 4, default 32) and says -how much percent of error will be tolerated when setting a frequency -(maximum 10, default 0). For example with 3% you can play 8000Hz -AU-Files on the Falcon with its hardware frequency of 8195Hz and thus -don't need to expand the sound. - - - -4) Options for Atari Only -========================= - -4.1) video= ------------ - -Syntax: video=: - -The parameter specifies the name of the frame buffer, -eg. most atari users will want to specify `atafb' here. The - is a comma-separated list of the sub-options listed -below. - -NB: Please notice that this option was renamed from `atavideo' to - `video' during the development of the 1.3.x kernels, thus you - might need to update your boot-scripts if upgrading to 2.x from - an 1.2.x kernel. - -NBB: The behavior of video= was changed in 2.1.57 so the recommended -option is to specify the name of the frame buffer. - -4.1.1) Video Mode ------------------ - -This sub-option may be any of the predefined video modes, as listed -in atari/atafb.c in the Linux/m68k source tree. The kernel will -activate the given video mode at boot time and make it the default -mode, if the hardware allows. Currently defined names are: - - - stlow : 320x200x4 - - stmid, default5 : 640x200x2 - - sthigh, default4: 640x400x1 - - ttlow : 320x480x8, TT only - - ttmid, default1 : 640x480x4, TT only - - tthigh, default2: 1280x960x1, TT only - - vga2 : 640x480x1, Falcon only - - vga4 : 640x480x2, Falcon only - - vga16, default3 : 640x480x4, Falcon only - - vga256 : 640x480x8, Falcon only - - falh2 : 896x608x1, Falcon only - - falh16 : 896x608x4, Falcon only - - If no video mode is given on the command line, the kernel tries the -modes names "default" in turn, until one is possible with the -hardware in use. - - A video mode setting doesn't make sense, if the external driver is -activated by a "external:" sub-option. - -4.1.2) inverse --------------- - -Invert the display. This affects both, text (consoles) and graphics -(X) display. Usually, the background is chosen to be black. With this -option, you can make the background white. - -4.1.3) font ------------ - -Syntax: font: - -Specify the font to use in text modes. Currently you can choose only -between `VGA8x8', `VGA8x16' and `PEARL8x8'. `VGA8x8' is default, if the -vertical size of the display is less than 400 pixel rows. Otherwise, the -`VGA8x16' font is the default. - -4.1.4) hwscroll_ ----------------- - -Syntax: hwscroll_ - -The number of additional lines of video memory to reserve for -speeding up the scrolling ("hardware scrolling"). Hardware scrolling -is possible only if the kernel can set the video base address in steps -fine enough. This is true for STE, MegaSTE, TT, and Falcon. It is not -possible with plain STs and graphics cards (The former because the -base address must be on a 256 byte boundary there, the latter because -the kernel doesn't know how to set the base address at all.) - - By default, is set to the number of visible text lines on the -display. Thus, the amount of video memory is doubled, compared to no -hardware scrolling. You can turn off the hardware scrolling altogether -by setting to 0. - -4.1.5) internal: ----------------- - -Syntax: internal:;[;;;] - -This option specifies the capabilities of some extended internal video -hardware, like e.g. OverScan. and give the (extended) -dimensions of the screen. - - If your OverScan needs a black border, you have to write the last -three arguments of the "internal:". is the maximum line -length the hardware allows, the maximum number of lines. - is the offset of the visible part of the screen memory to its -physical start, in bytes. - - Often, extended interval video hardware has to be activated somehow. -For this, see the "sw_*" options below. - -4.1.6) external: ----------------- - -Syntax: - external:;;;;[;[;\ - [;[;[;]]]]] - -[I had to break this line...] - - This is probably the most complicated parameter... It specifies that -you have some external video hardware (a graphics board), and how to -use it under Linux/m68k. The kernel cannot know more about the hardware -than you tell it here! The kernel also is unable to set or change any -video modes, since it doesn't know about any board internal. So, you -have to switch to that video mode before you start Linux, and cannot -switch to another mode once Linux has started. - - The first 3 parameters of this sub-option should be obvious: , - and give the dimensions of the screen and the number of -planes (depth). The depth is the logarithm to base 2 of the number -of colors possible. (Or, the other way round: The number of colors is -2^depth). - - You have to tell the kernel furthermore how the video memory is -organized. This is done by a letter as parameter: - - 'n': "normal planes", i.e. one whole plane after another - 'i': "interleaved planes", i.e. 16 bit of the first plane, than 16 bit - of the next, and so on... This mode is used only with the - built-in Atari video modes, I think there is no card that - supports this mode. - 'p': "packed pixels", i.e. consecutive bits stand for all - planes of one pixel; this is the most common mode for 8 planes - (256 colors) on graphic cards - 't': "true color" (more or less packed pixels, but without a color - lookup table); usually depth is 24 - -For monochrome modes (i.e., is 1), the letter has a -different meaning: - - 'n': normal colors, i.e. 0=white, 1=black - 'i': inverted colors, i.e. 0=black, 1=white - - The next important information about the video hardware is the base -address of the video memory. That is given in the parameter, -as a hexadecimal number with a "0x" prefix. You have to find out this -address in the documentation of your hardware. - - The next parameter, , tells the kernel about the size of the -video memory. If it's missing, the size is calculated from , -, and . For now, it is not useful to write a value here. -It would be used only for hardware scrolling (which isn't possible -with the external driver, because the kernel cannot set the video base -address), or for virtual resolutions under X (which the X server -doesn't support yet). So, it's currently best to leave this field -empty, either by ending the "external:" after the video address or by -writing two consecutive semicolons, if you want to give a -(it is allowed to leave this parameter empty). - - The parameter is optional. If it is not given, the kernel -cannot read or write any color registers of the video hardware, and -thus you have to set appropriate colors before you start Linux. But if -your card is somehow VGA compatible, you can tell the kernel the base -address of the VGA register set, so it can change the color lookup -table. You have to look up this address in your board's documentation. -To avoid misunderstandings: is the _base_ address, i.e. a 4k -aligned address. For read/writing the color registers, the kernel -uses the addresses vgabase+0x3c7...vgabase+0x3c9. The -parameter is written in hexadecimal with a "0x" prefix, just as -. - - is meaningful only if is specified. It tells the -kernel how wide each of the color register is, i.e. the number of bits -per single color (red/green/blue). Default is 6, another quite usual -value is 8. - - Also is used together with . It tells the kernel -about the color register model of your gfx board. Currently, the types -"vga" (which is also the default) and "mv300" (SANG MV300) are -implemented. - - Parameter is required for ProMST or ET4000 cards where -the physical linelength differs from the visible length. With ProMST, -xres_virtual must be set to 2048. For ET4000, xres_virtual depends on the -initialisation of the video-card. -If you're missing a corresponding yres_virtual: the external part is legacy, -therefore we don't support hardware-dependent functions like hardware-scroll, -panning or blanking. - -4.1.7) eclock: --------------- - -The external pixel clock attached to the Falcon VIDEL shifter. This -currently works only with the ScreenWonder! - -4.1.8) monitorcap: -------------------- - -Syntax: monitorcap:;;; - -This describes the capabilities of a multisync monitor. Don't use it -with a fixed-frequency monitor! For now, only the Falcon frame buffer -uses the settings of "monitorcap:". - - and are the minimum and maximum, resp., vertical frequencies -your monitor can work with, in Hz. and are the same for -the horizontal frequency, in kHz. - - The defaults are 58;62;31;32 (VGA compatible). - - The defaults for TV/SC1224/SC1435 cover both PAL and NTSC standards. - -4.1.9) keep ------------- - -If this option is given, the framebuffer device doesn't do any video -mode calculations and settings on its own. The only Atari fb device -that does this currently is the Falcon. - - What you reach with this: Settings for unknown video extensions -aren't overridden by the driver, so you can still use the mode found -when booting, when the driver doesn't know to set this mode itself. -But this also means, that you can't switch video modes anymore... - - An example where you may want to use "keep" is the ScreenBlaster for -the Falcon. - - -4.2) atamouse= --------------- - -Syntax: atamouse=,[] - - With this option, you can set the mouse movement reporting threshold. -This is the number of pixels of mouse movement that have to accumulate -before the IKBD sends a new mouse packet to the kernel. Higher values -reduce the mouse interrupt load and thus reduce the chance of keyboard -overruns. Lower values give a slightly faster mouse responses and -slightly better mouse tracking. - - You can set the threshold in x and y separately, but usually this is -of little practical use. If there's just one number in the option, it -is used for both dimensions. The default value is 2 for both -thresholds. - - -4.3) ataflop= -------------- - -Syntax: ataflop=[,[,[,]]] - - The drive type may be 0, 1, or 2, for DD, HD, and ED, resp. This - setting affects how many buffers are reserved and which formats are - probed (see also below). The default is 1 (HD). Only one drive type - can be selected. If you have two disk drives, select the "better" - type. - - The second parameter tells the kernel whether to use - track buffering (1) or not (0). The default is machine-dependent: - no for the Medusa and yes for all others. - - With the two following parameters, you can change the default - steprate used for drive A and B, resp. - - -4.4) atascsi= -------------- - -Syntax: atascsi=[,[,[,[,]]]] - - This option sets some parameters for the Atari native SCSI driver. -Generally, any number of arguments can be omitted from the end. And -for each of the numbers, a negative value means "use default". The -defaults depend on whether TT-style or Falcon-style SCSI is used. -Below, defaults are noted as n/m, where the first value refers to -TT-SCSI and the latter to Falcon-SCSI. If an illegal value is given -for one parameter, an error message is printed and that one setting is -ignored (others aren't affected). - - : - This is the maximum number of SCSI commands queued internally to the - Atari SCSI driver. A value of 1 effectively turns off the driver - internal multitasking (if it causes problems). Legal values are >= - 1. can be as high as you like, but values greater than - times the number of SCSI targets (LUNs) you have - don't make sense. Default: 16/8. - - : - Maximum number of SCSI commands issued to the driver for one - logical unit (LUN, usually one SCSI target). Legal values start - from 1. If tagged queuing (see below) is not used, values greater - than 2 don't make sense, but waste memory. Otherwise, the maximum - is the number of command tags available to the driver (currently - 32). Default: 8/1. (Note: Values > 1 seem to cause problems on a - Falcon, cause not yet known.) - - The value at a great part determines the amount of - memory SCSI reserves for itself. The formula is rather - complicated, but I can give you some hints: - no scatter-gather : cmd_per_lun * 232 bytes - full scatter-gather: cmd_per_lun * approx. 17 Kbytes - - : - Size of the scatter-gather table, i.e. the number of requests - consecutive on the disk that can be merged into one SCSI command. - Legal values are between 0 and 255. Default: 255/0. Note: This - value is forced to 0 on a Falcon, since scatter-gather isn't - possible with the ST-DMA. Not using scatter-gather hurts - performance significantly. - - : - The SCSI ID to be used by the initiator (your Atari). This is - usually 7, the highest possible ID. Every ID on the SCSI bus must - be unique. Default: determined at run time: If the NV-RAM checksum - is valid, and bit 7 in byte 30 of the NV-RAM is set, the lower 3 - bits of this byte are used as the host ID. (This method is defined - by Atari and also used by some TOS HD drivers.) If the above - isn't given, the default ID is 7. (both, TT and Falcon). - - : - 0 means turn off tagged queuing support, all other values > 0 mean - use tagged queuing for targets that support it. Default: currently - off, but this may change when tagged queuing handling has been - proved to be reliable. - - Tagged queuing means that more than one command can be issued to - one LUN, and the SCSI device itself orders the requests so they - can be performed in optimal order. Not all SCSI devices support - tagged queuing (:-(). - -4.5 switches= -------------- - -Syntax: switches= - - With this option you can switch some hardware lines that are often -used to enable/disable certain hardware extensions. Examples are -OverScan, overclocking, ... - - The is a comma-separated list of the following -items: - - ikbd: set RTS of the keyboard ACIA high - midi: set RTS of the MIDI ACIA high - snd6: set bit 6 of the PSG port A - snd7: set bit 6 of the PSG port A - -It doesn't make sense to mention a switch more than once (no -difference to only once), but you can give as many switches as you -want to enable different features. The switch lines are set as early -as possible during kernel initialization (even before determining the -present hardware.) - - All of the items can also be prefixed with "ov_", i.e. "ov_ikbd", -"ov_midi", ... These options are meant for switching on an OverScan -video extension. The difference to the bare option is that the -switch-on is done after video initialization, and somehow synchronized -to the HBLANK. A speciality is that ov_ikbd and ov_midi are switched -off before rebooting, so that OverScan is disabled and TOS boots -correctly. - - If you give an option both, with and without the "ov_" prefix, the -earlier initialization ("ov_"-less) takes precedence. But the -switching-off on reset still happens in this case. - -5) Options for Amiga Only: -========================== - -5.1) video= ------------ - -Syntax: video=: - -The parameter specifies the name of the frame buffer, valid -options are `amifb', `cyber', 'virge', `retz3' and `clgen', provided -that the respective frame buffer devices have been compiled into the -kernel (or compiled as loadable modules). The behavior of the -option was changed in 2.1.57 so it is now recommended to specify this -option. - -The is a comma-separated list of the sub-options listed -below. This option is organized similar to the Atari version of the -"video"-option (4.1), but knows fewer sub-options. - -5.1.1) video mode ------------------ - -Again, similar to the video mode for the Atari (see 4.1.1). Predefined -modes depend on the used frame buffer device. - -OCS, ECS and AGA machines all use the color frame buffer. The following -predefined video modes are available: - -NTSC modes: - - ntsc : 640x200, 15 kHz, 60 Hz - - ntsc-lace : 640x400, 15 kHz, 60 Hz interlaced -PAL modes: - - pal : 640x256, 15 kHz, 50 Hz - - pal-lace : 640x512, 15 kHz, 50 Hz interlaced -ECS modes: - - multiscan : 640x480, 29 kHz, 57 Hz - - multiscan-lace : 640x960, 29 kHz, 57 Hz interlaced - - euro36 : 640x200, 15 kHz, 72 Hz - - euro36-lace : 640x400, 15 kHz, 72 Hz interlaced - - euro72 : 640x400, 29 kHz, 68 Hz - - euro72-lace : 640x800, 29 kHz, 68 Hz interlaced - - super72 : 800x300, 23 kHz, 70 Hz - - super72-lace : 800x600, 23 kHz, 70 Hz interlaced - - dblntsc-ff : 640x400, 27 kHz, 57 Hz - - dblntsc-lace : 640x800, 27 kHz, 57 Hz interlaced - - dblpal-ff : 640x512, 27 kHz, 47 Hz - - dblpal-lace : 640x1024, 27 kHz, 47 Hz interlaced - - dblntsc : 640x200, 27 kHz, 57 Hz doublescan - - dblpal : 640x256, 27 kHz, 47 Hz doublescan -VGA modes: - - vga : 640x480, 31 kHz, 60 Hz - - vga70 : 640x400, 31 kHz, 70 Hz - -Please notice that the ECS and VGA modes require either an ECS or AGA -chipset, and that these modes are limited to 2-bit color for the ECS -chipset and 8-bit color for the AGA chipset. - -5.1.2) depth ------------- - -Syntax: depth: - -Specify the number of bit-planes for the selected video-mode. - -5.1.3) inverse --------------- - -Use inverted display (black on white). Functionally the same as the -"inverse" sub-option for the Atari. - -5.1.4) font ------------ - -Syntax: font: - -Specify the font to use in text modes. Functionally the same as the -"font" sub-option for the Atari, except that `PEARL8x8' is used instead -of `VGA8x8' if the vertical size of the display is less than 400 pixel -rows. - -5.1.5) monitorcap: -------------------- - -Syntax: monitorcap:;;; - -This describes the capabilities of a multisync monitor. For now, only -the color frame buffer uses the settings of "monitorcap:". - - and are the minimum and maximum, resp., vertical frequencies -your monitor can work with, in Hz. and are the same for -the horizontal frequency, in kHz. - - The defaults are 50;90;15;38 (Generic Amiga multisync monitor). - - -5.2) fd_def_df0= ----------------- - -Syntax: fd_def_df0= - -Sets the df0 value for "silent" floppy drives. The value should be in -hexadecimal with "0x" prefix. - - -5.3) wd33c93= -------------- - -Syntax: wd33c93= - -These options affect the A590/A2091, A3000 and GVP Series II SCSI -controllers. - -The is a comma-separated list of the sub-options listed -below. - -5.3.1) nosync -------------- - -Syntax: nosync:bitmask - - bitmask is a byte where the 1st 7 bits correspond with the 7 -possible SCSI devices. Set a bit to prevent sync negotiation on that -device. To maintain backwards compatibility, a command-line such as -"wd33c93=255" will be automatically translated to -"wd33c93=nosync:0xff". The default is to disable sync negotiation for -all devices, eg. nosync:0xff. - -5.3.2) period -------------- - -Syntax: period:ns - - `ns' is the minimum # of nanoseconds in a SCSI data transfer -period. Default is 500; acceptable values are 250 - 1000. - -5.3.3) disconnect ------------------ - -Syntax: disconnect:x - - Specify x = 0 to never allow disconnects, 2 to always allow them. -x = 1 does 'adaptive' disconnects, which is the default and generally -the best choice. - -5.3.4) debug ------------- - -Syntax: debug:x - - If `DEBUGGING_ON' is defined, x is a bit mask that causes various -types of debug output to printed - see the DB_xxx defines in -wd33c93.h. - -5.3.5) clock ------------- - -Syntax: clock:x - - x = clock input in MHz for WD33c93 chip. Normal values would be from -8 through 20. The default value depends on your hostadapter(s), -default for the A3000 internal controller is 14, for the A2091 it's 8 -and for the GVP hostadapters it's either 8 or 14, depending on the -hostadapter and the SCSI-clock jumper present on some GVP -hostadapters. - -5.3.6) next ------------ - - No argument. Used to separate blocks of keywords when there's more -than one wd33c93-based host adapter in the system. - -5.3.7) nodma ------------- - -Syntax: nodma:x - - If x is 1 (or if the option is just written as "nodma"), the WD33c93 -controller will not use DMA (= direct memory access) to access the -Amiga's memory. This is useful for some systems (like A3000's and -A4000's with the A3640 accelerator, revision 3.0) that have problems -using DMA to chip memory. The default is 0, i.e. to use DMA if -possible. - - -5.4) gvp11= ------------ - -Syntax: gvp11= - - The earlier versions of the GVP driver did not handle DMA -address-mask settings correctly which made it necessary for some -people to use this option, in order to get their GVP controller -running under Linux. These problems have hopefully been solved and the -use of this option is now highly unrecommended! - - Incorrect use can lead to unpredictable behavior, so please only use -this option if you *know* what you are doing and have a reason to do -so. In any case if you experience problems and need to use this -option, please inform us about it by mailing to the Linux/68k kernel -mailing list. - - The address mask set by this option specifies which addresses are -valid for DMA with the GVP Series II SCSI controller. An address is -valid, if no bits are set except the bits that are set in the mask, -too. - - Some versions of the GVP can only DMA into a 24 bit address range, -some can address a 25 bit address range while others can use the whole -32 bit address range for DMA. The correct setting depends on your -controller and should be autodetected by the driver. An example is the -24 bit region which is specified by a mask of 0x00fffffe. - - -/* Local Variables: */ -/* mode: text */ -/* End: */ diff --git a/keygen.sts b/keygen.sts deleted file mode 100644 index 6067c0d..0000000 --- a/keygen.sts +++ /dev/null @@ -1,34 +0,0 @@ -defword keygen - ; Increment - 0 - do - over over = until - dup 2 + get - dup ff < if - 1 + over 2 + set - drop - exit - fi - drop 0 over 2 + set - 1 + - od - drop - - ; Clean old stack data - dup - do - dup 0 = until - 1 get 2 set swap drop - 1 - - od - drop - - 1 + - 0 - do - over over = until - dup 2 get 1 set 0 2 set - 1 + - od - drop -exit diff --git a/main.sts b/main.sts deleted file mode 100644 index f112c30..0000000 --- a/main.sts +++ /dev/null @@ -1,210 +0,0 @@ -module ia32/elf/begin.sts -module ia32/float/float.sts -module cipher.sts -module keygen.sts -module freq.sts -module bifreq.sts - -[ sd 0 swap drop ] - -defword nicedist - 1 float_iload a float_iload float_div -exit - -defword zeros - do dup 0 = until - 0 swap - 1 - od drop -exit - -defword clear - do dup 0 = until - swap drop - 1 - od drop -exit - -defword calcdist ; distance from ideal as sqrt sum square diff - 2c1 ref as calcdist.textfr - local calcdist.fr - 0 do dup 2be = until - dup word_size mul dup dup - calcdist.fr + @ float_fload - calcdist.textfr + @ float_fload - float_sub float_fstore dup float_fload float_fload - float_mul float_fstore swap calcdist.fr + ! - 1 + od - 0 do dup 2bd = until - swap float_fload swap float_fload float_add float_fstore swap - 1 + od drop - float_fload float_sqrt nicedist float_less -exit - -defword checktext - as checktext.length - local checktext.text - ; Count frequencies: - ; 676 latin bigrams: - 2a4 zeros local checktext.bifr - ; 26 latin letters: - 1a zeros local checktext.fr - ; count how much of each letter is in text: - 0 local checktext.hadalpha - 0 local checktext.bicount - 0 local checktext.count - checktext.length do 1 - - dup word_size mul checktext.text + @ - dup dup 'z' > 0 = swap 'a' < 0 = mul if - dup 'z' swap - word_size mul local checktext.i - checktext.i @ checktext.fr + @ 1 + checktext.i @ checktext.fr + ! - checktext.count @ 1 + checktext.count ! - checktext.hadalpha @ if - checktext.bicount @ 1 + checktext.bicount ! - checktext.hadalpha @ 1 - 1a mul checktext.i @ + - checktext.bifr + - dup @ 1 + swap ! - fi - 1 + checktext.hadalpha ! - else dup dup 'Z' > 0 = swap 'A' < 0 = mul if - dup 'Z' swap - word_size mul local checktext.i - checktext.i @ checktext.fr + @ 1 + checktext.i @ checktext.fr + ! - checktext.count @ 1 + checktext.count ! - checktext.hadalpha @ if - checktext.bicount @ 1 + checktext.bicount ! - checktext.hadalpha @ 1 - 1a mul checktext.i @ + - checktext.bifr + - dup @ 1 + swap ! - fi - 1 + checktext.hadalpha ! - else 0 checktext.hadalpha ! dup dup 8 > 0 = swap 1 < 0 = mul if - 2c3 clear - 0 exit fi dup dup 1f > 0 = swap e < 0 = mul if - 2c3 clear - 0 exit fi fi fi drop - dup 0 = untilod drop - ; At least 1/4 characters in text should be alphabetical: - checktext.count @ float_iload checktext.length float_iload float_div - 1 float_iload 4 float_iload float_div float_less if - 2c1 clear - 0 exit fi - ; Division by zero shall not pass: - checktext.bicount 0 = if 2c1 clear 0 exit fi - ; normalize: - 0 do dup 1a = until - dup word_size mul checktext.fr + dup @ float_iload - checktext.count @ float_iload - float_div float_fstore swap ! - 1 + od drop - 0 do dup 2a4 = until - dup word_size mul checktext.bifr + dup @ float_iload - checktext.bicount @ float_iload - float_div float_fstore swap ! - 1 + od drop - ; Decide if text is real: - bifreq_eng freq_eng calcdist if 1 else - 0 fi - ; Remove frequencies from stack: - 2c1 set - 2c1 clear -exit - -set_entry float_init ; this is program with floats - ; read file into stack - 0 do sys_read 0 = until - swap 1 + - od drop as length - local ciphertext - - 0 ; initial key is empty - do - ; generate next key to try - keygen as keylen local key - '.' sys_write_err - - ; decipher text (length is the same as for ciphertext) - keylen 1 - length do 1 - - as textpos local pos - textpos word_size mul ciphertext + @ - key - keylen - pos - cipher - swap textpos - dup 0 = untilod drop drop - local plaintext - - ; check deciphering attempt, exit if Ok or keylen = max (3) - keylen 3 = if eeeee else length checktext fi dup until drop - ; else remove the text from stack and place keylen back - 0 do dup length = until - swap drop 1 + - od drop keylen - od as langcode drop - - ; output language - langcode 1 = if - 'e' sys_write_err - 'n' sys_write_err - 'g' sys_write_err - 'l' sys_write_err - 'i' sys_write_err - 's' sys_write_err - 'h' sys_write_err - fi langcode 2 = if - 'd' sys_write_err - 'u' sys_write_err - 't' sys_write_err - 'c' sys_write_err - 'h' sys_write_err - fi langcode 3 = if - 'g' sys_write_err - 'e' sys_write_err - 'r' sys_write_err - 'm' sys_write_err - 'a' sys_write_err - 'n' sys_write_err - fi langcode 4 = if - 'f' sys_write_err - 'r' sys_write_err - 'e' sys_write_err - 'n' sys_write_err - 'c' sys_write_err - 'h' sys_write_err - fi langcode 5 = if - 's' sys_write_err - 'p' sys_write_err - 'a' sys_write_err - 'n' sys_write_err - 'i' sys_write_err - 's' sys_write_err - 'h' sys_write_err - fi langcode 6 = if - 'i' sys_write_err - 't' sys_write_err - 'a' sys_write_err - 'l' sys_write_err - 'i' sys_write_err - 'a' sys_write_err - 'n' sys_write_err - fi langcode eeeee = if - 'e' sys_write_err - 'r' sys_write_err - 'r' sys_write_err - 'o' sys_write_err - 'r' sys_write_err - fi newline sys_write_err - - ; output text - length do 1 - - dup word_size mul plaintext + @ sys_write - dup 1 = untilod drop - length do 1 - - swap drop - dup 1 = untilod drop - - ; output key - keylen do 1 - - dup word_size mul key + @ sys_write_err - dup 0 = untilod drop newline sys_write_err -sys_exit - -module ia32/elf/end.sts diff --git a/man.txt b/man.txt deleted file mode 100644 index 919f62c..0000000 --- a/man.txt +++ /dev/null @@ -1,96 +0,0 @@ -IOCTL-XFS-INUMBERS(2) System Calls Manual IOCTL-XFS-INUMBERS(2) - - - -NAME - ioctl_xfs_inumbers - query allocation information for groups of XFS - inodes - -SYNOPSIS - #include - - int ioctl(int fd, XFS_IOC_INUMBERS, struct xfs_inumbers_req *arg); - -DESCRIPTION - Query inode allocation information for groups of XFS inodes. This - ioctl uses struct xfs_inumbers_req to set up a bulk transfer from the - kernel: - - struct xfs_inumbers_req { - struct xfs_bulk_ireq hdr; - struct xfs_inumbers inumbers[]; - }; - - See below for the xfs_inumbers structure definition. - - struct xfs_bulk_ireq { - uint64_t ino; - uint32_t flags; - uint32_t icount; - uint32_t ocount; - uint32_t agno; - uint64_t reserved[5]; - }; - - hdr describes the information to query. The layout and behavior are - documented in the ioctl_xfs_bulkstat(2) manpage and will not be - discussed further here. - - - inumbers is an array of struct xfs_inumbers which is described below. - The array must have at least icount elements. - - struct xfs_inumbers { - uint64_t xi_startino; - uint64_t xi_allocmask; - uint8_t xi_alloccount; - uint8_t xi_version; - uint8_t xi_padding[6]; - }; - - This structure describes inode usage information for a group of 64 - consecutive inode numbers. - - xi_startino is the first inode number of this group. - - xi_allocmask is a bitmask telling which inodes in this group are - allocated. To clarify, bit N is set if inode xi_startino+N is - allocated. - - xi_alloccount is the number of inodes in this group that are allocated. - This should be equal to popcnt(xi_allocmask). - - xi_version is the version of this data structure. This will be set to - XFS_INUMBERS_VERSION_V5 by the kernel. - - xi_padding[6] is zeroed. - -RETURN VALUE - On error, -1 is returned, and errno is set to indicate the error. - -ERRORS - Error codes can be one of, but are not limited to, the following: - - EFAULT The kernel was not able to copy into the userspace buffer. - - EFSBADCRC - Metadata checksum validation failed while performing the query. - - EFSCORRUPTED - Metadata corruption was encountered while performing the query. - - EINVAL One of the arguments was not valid. - - EIO An I/O error was encountered while performing the query. - - ENOMEM There was insufficient memory to perform the query. - -CONFORMING TO - This API is specific to XFS filesystem on the Linux kernel. - -SEE ALSO - ioctl(2), ioctl_xfs_bulkstat(2). - - - -XFS 2019-05-23 IOCTL-XFS-INUMBERS(2) diff --git a/orwell.txt b/orwell.txt deleted file mode 100644 index da65e79..0000000 --- a/orwell.txt +++ /dev/null @@ -1,2850 +0,0 @@ - - - - _ _ ______ - /\ (_) | | | ____| - / \ _ __ _ _ __ ___ __ _| | | |__ __ _ _ __ _ __ ___ - / /\ \ | '_ \| | '_ ` _ \ / _` | | | __/ _` | '__| '_ ` _ \ - / ____ \| | | | | | | | | | (_| | | | | | (_| | | | | | | | | - /_/ \_\_| |_|_|_| |_| |_|\__,_|_| |_| \__,_|_| |_| |_| |_| - by George Orwell - - - - Chapter I - - - -Mr. Jones, of the Manor Farm, had locked the hen-houses for the night, but -was too drunk to remember to shut the pop-holes. With the ring of light -from his lantern dancing from side to side, he lurched across the yard, -kicked off his boots at the back door, drew himself a last glass of beer -from the barrel in the scullery, and made his way up to bed, where -Mrs. Jones was already snoring. - -As soon as the light in the bedroom went out there was a stirring and a -fluttering all through the farm buildings. Word had gone round during the -day that old Major, the prize Middle White boar, had had a strange dream -on the previous night and wished to communicate it to the other animals. -It had been agreed that they should all meet in the big barn as soon as -Mr. Jones was safely out of the way. Old Major (so he was always called, -though the name under which he had been exhibited was Willingdon Beauty) -was so highly regarded on the farm that everyone was quite ready to lose -an hour's sleep in order to hear what he had to say. - -At one end of the big barn, on a sort of raised platform, Major was -already ensconced on his bed of straw, under a lantern which hung from a -beam. He was twelve years old and had lately grown rather stout, but he -was still a majestic-looking pig, with a wise and benevolent appearance in -spite of the fact that his tushes had never been cut. Before long the -other animals began to arrive and make themselves comfortable after their -different fashions. First came the three dogs, Bluebell, Jessie, and -Pincher, and then the pigs, who settled down in the straw immediately in -front of the platform. The hens perched themselves on the window-sills, -the pigeons fluttered up to the rafters, the sheep and cows lay down -behind the pigs and began to chew the cud. The two cart-horses, Boxer and -Clover, came in together, walking very slowly and setting down their vast -hairy hoofs with great care lest there should be some small animal -concealed in the straw. Clover was a stout motherly mare approaching -middle life, who had never quite got her figure back after her fourth foal. -Boxer was an enormous beast, nearly eighteen hands high, and as strong as -any two ordinary horses put together. A white stripe down his nose gave -him a somewhat stupid appearance, and in fact he was not of first-rate -intelligence, but he was universally respected for his steadiness of -character and tremendous powers of work. After the horses came Muriel, -the white goat, and Benjamin, the donkey. Benjamin was the oldest animal -on the farm, and the worst tempered. He seldom talked, and when he did, it -was usually to make some cynical remark--for instance, he would say that -God had given him a tail to keep the flies off, but that he would sooner -have had no tail and no flies. Alone among the animals on the farm he -never laughed. If asked why, he would say that he saw nothing to laugh at. -Nevertheless, without openly admitting it, he was devoted to Boxer; the -two of them usually spent their Sundays together in the small paddock -beyond the orchard, grazing side by side and never speaking. - -The two horses had just lain down when a brood of ducklings, which had -lost their mother, filed into the barn, cheeping feebly and wandering from -side to side to find some place where they would not be trodden on. Clover -made a sort of wall round them with her great foreleg, and the ducklings -nestled down inside it and promptly fell asleep. At the last moment -Mollie, the foolish, pretty white mare who drew Mr. Jones's trap, came -mincing daintily in, chewing at a lump of sugar. She took a place near the -front and began flirting her white mane, hoping to draw attention to the -red ribbons it was plaited with. Last of all came the cat, who looked -round, as usual, for the warmest place, and finally squeezed herself in -between Boxer and Clover; there she purred contentedly throughout Major's -speech without listening to a word of what he was saying. - -All the animals were now present except Moses, the tame raven, who slept -on a perch behind the back door. When Major saw that they had all made -themselves comfortable and were waiting attentively, he cleared his throat -and began: - -"Comrades, you have heard already about the strange dream that I had last -night. But I will come to the dream later. I have something else to say -first. I do not think, comrades, that I shall be with you for many months -longer, and before I die, I feel it my duty to pass on to you such wisdom -as I have acquired. I have had a long life, I have had much time for -thought as I lay alone in my stall, and I think I may say that I -understand the nature of life on this earth as well as any animal now -living. It is about this that I wish to speak to you. - -"Now, comrades, what is the nature of this life of ours? Let us face it: -our lives are miserable, laborious, and short. We are born, we are given -just so much food as will keep the breath in our bodies, and those of us -who are capable of it are forced to work to the last atom of our strength; -and the very instant that our usefulness has come to an end we are -slaughtered with hideous cruelty. No animal in England knows the meaning -of happiness or leisure after he is a year old. No animal in England is -free. The life of an animal is misery and slavery: that is the plain truth. - -"But is this simply part of the order of nature? Is it because this land -of ours is so poor that it cannot afford a decent life to those who dwell -upon it? No, comrades, a thousand times no! The soil of England is -fertile, its climate is good, it is capable of affording food in abundance -to an enormously greater number of animals than now inhabit it. This -single farm of ours would support a dozen horses, twenty cows, hundreds of -sheep--and all of them living in a comfort and a dignity that are now -almost beyond our imagining. Why then do we continue in this miserable -condition? Because nearly the whole of the produce of our labour is stolen -from us by human beings. There, comrades, is the answer to all our -problems. It is summed up in a single word--Man. Man is the only real -enemy we have. Remove Man from the scene, and the root cause of hunger and -overwork is abolished for ever. - -"Man is the only creature that consumes without producing. He does not -give milk, he does not lay eggs, he is too weak to pull the plough, he -cannot run fast enough to catch rabbits. Yet he is lord of all the -animals. He sets them to work, he gives back to them the bare minimum that -will prevent them from starving, and the rest he keeps for himself. Our -labour tills the soil, our dung fertilises it, and yet there is not one of -us that owns more than his bare skin. You cows that I see before me, how -many thousands of gallons of milk have you given during this last year? -And what has happened to that milk which should have been breeding up -sturdy calves? Every drop of it has gone down the throats of our enemies. -And you hens, how many eggs have you laid in this last year, and how many -of those eggs ever hatched into chickens? The rest have all gone to market -to bring in money for Jones and his men. And you, Clover, where are those -four foals you bore, who should have been the support and pleasure of your -old age? Each was sold at a year old--you will never see one of them -again. In return for your four confinements and all your labour in the -fields, what have you ever had except your bare rations and a stall? - -"And even the miserable lives we lead are not allowed to reach their -natural span. For myself I do not grumble, for I am one of the lucky ones. -I am twelve years old and have had over four hundred children. Such is the -natural life of a pig. But no animal escapes the cruel knife in the end. -You young porkers who are sitting in front of me, every one of you will -scream your lives out at the block within a year. To that horror we all -must come--cows, pigs, hens, sheep, everyone. Even the horses and the dogs -have no better fate. You, Boxer, the very day that those great muscles of -yours lose their power, Jones will sell you to the knacker, who will cut -your throat and boil you down for the foxhounds. As for the dogs, when -they grow old and toothless, Jones ties a brick round their necks and -drowns them in the nearest pond. - -"Is it not crystal clear, then, comrades, that all the evils of this life -of ours spring from the tyranny of human beings? Only get rid of Man, and -the produce of our labour would be our own. Almost overnight we could -become rich and free. What then must we do? Why, work night and day, body -and soul, for the overthrow of the human race! That is my message to you, -comrades: Rebellion! I do not know when that Rebellion will come, it might -be in a week or in a hundred years, but I know, as surely as I see this -straw beneath my feet, that sooner or later justice will be done. Fix your -eyes on that, comrades, throughout the short remainder of your lives! And -above all, pass on this message of mine to those who come after you, so -that future generations shall carry on the struggle until it is victorious. - -"And remember, comrades, your resolution must never falter. No argument -must lead you astray. Never listen when they tell you that Man and the -animals have a common interest, that the prosperity of the one is the -prosperity of the others. It is all lies. Man serves the interests of no -creature except himself. And among us animals let there be perfect unity, -perfect comradeship in the struggle. All men are enemies. All animals are -comrades." - -At this moment there was a tremendous uproar. While Major was speaking -four large rats had crept out of their holes and were sitting on their -hindquarters, listening to him. The dogs had suddenly caught sight of -them, and it was only by a swift dash for their holes that the rats saved -their lives. Major raised his trotter for silence. - -"Comrades," he said, "here is a point that must be settled. The wild -creatures, such as rats and rabbits--are they our friends or our enemies? -Let us put it to the vote. I propose this question to the meeting: Are -rats comrades?" - -The vote was taken at once, and it was agreed by an overwhelming majority -that rats were comrades. There were only four dissentients, the three dogs -and the cat, who was afterwards discovered to have voted on both sides. -Major continued: - -"I have little more to say. I merely repeat, remember always your duty of -enmity towards Man and all his ways. Whatever goes upon two legs is an -enemy. Whatever goes upon four legs, or has wings, is a friend. And -remember also that in fighting against Man, we must not come to resemble -him. Even when you have conquered him, do not adopt his vices. No animal -must ever live in a house, or sleep in a bed, or wear clothes, or drink -alcohol, or smoke tobacco, or touch money, or engage in trade. All the -habits of Man are evil. And, above all, no animal must ever tyrannise over -his own kind. Weak or strong, clever or simple, we are all brothers. No -animal must ever kill any other animal. All animals are equal. - -"And now, comrades, I will tell you about my dream of last night. I cannot -describe that dream to you. It was a dream of the earth as it will be when -Man has vanished. But it reminded me of something that I had long -forgotten. Many years ago, when I was a little pig, my mother and the -other sows used to sing an old song of which they knew only the tune and -the first three words. I had known that tune in my infancy, but it had -long since passed out of my mind. Last night, however, it came back to me -in my dream. And what is more, the words of the song also came back-words, -I am certain, which were sung by the animals of long ago and have been -lost to memory for generations. I will sing you that song now, comrades. -I am old and my voice is hoarse, but when I have taught you the tune, you -can sing it better for yourselves. It is called 'Beasts of England'." - -Old Major cleared his throat and began to sing. As he had said, his voice -was hoarse, but he sang well enough, and it was a stirring tune, something -between 'Clementine' and 'La Cucaracha'. The words ran: - -Beasts of England, beasts of Ireland, -Beasts of every land and clime, -Hearken to my joyful tidings -Of the golden future time. - -Soon or late the day is coming, -Tyrant Man shall be o'erthrown, -And the fruitful fields of England -Shall be trod by beasts alone. - -Rings shall vanish from our noses, -And the harness from our back, -Bit and spur shall rust forever, -Cruel whips no more shall crack. - -Riches more than mind can picture, -Wheat and barley, oats and hay, -Clover, beans, and mangel-wurzels -Shall be ours upon that day. - -Bright will shine the fields of England, -Purer shall its waters be, -Sweeter yet shall blow its breezes -On the day that sets us free. - -For that day we all must labour, -Though we die before it break; -Cows and horses, geese and turkeys, -All must toil for freedom's sake. - -Beasts of England, beasts of Ireland, -Beasts of every land and clime, -Hearken well and spread my tidings -Of the golden future time. - - -The singing of this song threw the animals into the wildest excitement. -Almost before Major had reached the end, they had begun singing it for -themselves. Even the stupidest of them had already picked up the tune and -a few of the words, and as for the clever ones, such as the pigs and dogs, -they had the entire song by heart within a few minutes. And then, after a -few preliminary tries, the whole farm burst out into 'Beasts of England' in -tremendous unison. The cows lowed it, the dogs whined it, the sheep -bleated it, the horses whinnied it, the ducks quacked it. They were so -delighted with the song that they sang it right through five times in -succession, and might have continued singing it all night if they had not -been interrupted. - -Unfortunately, the uproar awoke Mr. Jones, who sprang out of bed, making -sure that there was a fox in the yard. He seized the gun which always -stood in a corner of his bedroom, and let fly a charge of number 6 shot -into the darkness. The pellets buried themselves in the wall of the barn -and the meeting broke up hurriedly. Everyone fled to his own -sleeping-place. The birds jumped on to their perches, the animals settled -down in the straw, and the whole farm was asleep in a moment. - - - - - Chapter II - - - -Three nights later old Major died peacefully in his sleep. His body was -buried at the foot of the orchard. - -This was early in March. During the next three months there was much -secret activity. Major's speech had given to the more intelligent animals -on the farm a completely new outlook on life. They did not know when the -Rebellion predicted by Major would take place, they had no reason for -thinking that it would be within their own lifetime, but they saw clearly -that it was their duty to prepare for it. The work of teaching and -organising the others fell naturally upon the pigs, who were generally -recognised as being the cleverest of the animals. Pre-eminent among the -pigs were two young boars named Snowball and Napoleon, whom Mr. Jones was -breeding up for sale. Napoleon was a large, rather fierce-looking -Berkshire boar, the only Berkshire on the farm, not much of a talker, but -with a reputation for getting his own way. Snowball was a more vivacious -pig than Napoleon, quicker in speech and more inventive, but was not -considered to have the same depth of character. All the other male pigs on -the farm were porkers. The best known among them was a small fat pig named -Squealer, with very round cheeks, twinkling eyes, nimble movements, and a -shrill voice. He was a brilliant talker, and when he was arguing some -difficult point he had a way of skipping from side to side and whisking -his tail which was somehow very persuasive. The others said of Squealer -that he could turn black into white. - -These three had elaborated old Major's teachings into a complete system of -thought, to which they gave the name of Animalism. Several nights a week, -after Mr. Jones was asleep, they held secret meetings in the barn and -expounded the principles of Animalism to the others. At the beginning they -met with much stupidity and apathy. Some of the animals talked of the duty -of loyalty to Mr. Jones, whom they referred to as "Master," or made -elementary remarks such as "Mr. Jones feeds us. If he were gone, we should -starve to death." Others asked such questions as "Why should we care what -happens after we are dead?" or "If this Rebellion is to happen anyway, -what difference does it make whether we work for it or not?", and the pigs -had great difficulty in making them see that this was contrary to the -spirit of Animalism. The stupidest questions of all were asked by Mollie, -the white mare. The very first question she asked Snowball was: "Will -there still be sugar after the Rebellion?" - -"No," said Snowball firmly. "We have no means of making sugar on this -farm. Besides, you do not need sugar. You will have all the oats and hay -you want." - -"And shall I still be allowed to wear ribbons in my mane?" asked Mollie. - -"Comrade," said Snowball, "those ribbons that you are so devoted to are -the badge of slavery. Can you not understand that liberty is worth more -than ribbons?" - -Mollie agreed, but she did not sound very convinced. - -The pigs had an even harder struggle to counteract the lies put about by -Moses, the tame raven. Moses, who was Mr. Jones's especial pet, was a spy -and a tale-bearer, but he was also a clever talker. He claimed to know of -the existence of a mysterious country called Sugarcandy Mountain, to which -all animals went when they died. It was situated somewhere up in the sky, -a little distance beyond the clouds, Moses said. In Sugarcandy Mountain it -was Sunday seven days a week, clover was in season all the year round, and -lump sugar and linseed cake grew on the hedges. The animals hated Moses -because he told tales and did no work, but some of them believed in -Sugarcandy Mountain, and the pigs had to argue very hard to persuade them -that there was no such place. - -Their most faithful disciples were the two cart-horses, Boxer and Clover. -These two had great difficulty in thinking anything out for themselves, -but having once accepted the pigs as their teachers, they absorbed -everything that they were told, and passed it on to the other animals by -simple arguments. They were unfailing in their attendance at the secret -meetings in the barn, and led the singing of 'Beasts of England', with -which the meetings always ended. - -Now, as it turned out, the Rebellion was achieved much earlier and more -easily than anyone had expected. In past years Mr. Jones, although a hard -master, had been a capable farmer, but of late he had fallen on evil days. -He had become much disheartened after losing money in a lawsuit, and had -taken to drinking more than was good for him. For whole days at a time he -would lounge in his Windsor chair in the kitchen, reading the newspapers, -drinking, and occasionally feeding Moses on crusts of bread soaked in -beer. His men were idle and dishonest, the fields were full of weeds, the -buildings wanted roofing, the hedges were neglected, and the animals were -underfed. - -June came and the hay was almost ready for cutting. On Midsummer's Eve, -which was a Saturday, Mr. Jones went into Willingdon and got so drunk at -the Red Lion that he did not come back till midday on Sunday. The men had -milked the cows in the early morning and then had gone out rabbiting, -without bothering to feed the animals. When Mr. Jones got back he -immediately went to sleep on the drawing-room sofa with the News of the -World over his face, so that when evening came, the animals were still -unfed. At last they could stand it no longer. One of the cows broke in the -door of the store-shed with her horn and all the animals began to help -themselves from the bins. It was just then that Mr. Jones woke up. The -next moment he and his four men were in the store-shed with whips in their -hands, lashing out in all directions. This was more than the hungry -animals could bear. With one accord, though nothing of the kind had been -planned beforehand, they flung themselves upon their tormentors. Jones and -his men suddenly found themselves being butted and kicked from all sides. -The situation was quite out of their control. They had never seen animals -behave like this before, and this sudden uprising of creatures whom they -were used to thrashing and maltreating just as they chose, frightened them -almost out of their wits. After only a moment or two they gave up trying -to defend themselves and took to their heels. A minute later all five of -them were in full flight down the cart-track that led to the main road, -with the animals pursuing them in triumph. - -Mrs. Jones looked out of the bedroom window, saw what was happening, -hurriedly flung a few possessions into a carpet bag, and slipped out of -the farm by another way. Moses sprang off his perch and flapped after her, -croaking loudly. Meanwhile the animals had chased Jones and his men out on -to the road and slammed the five-barred gate behind them. And so, almost -before they knew what was happening, the Rebellion had been successfully -carried through: Jones was expelled, and the Manor Farm was theirs. - -For the first few minutes the animals could hardly believe in their good -fortune. Their first act was to gallop in a body right round the -boundaries of the farm, as though to make quite sure that no human being -was hiding anywhere upon it; then they raced back to the farm buildings to -wipe out the last traces of Jones's hated reign. The harness-room at the -end of the stables was broken open; the bits, the nose-rings, the -dog-chains, the cruel knives with which Mr. Jones had been used to -castrate the pigs and lambs, were all flung down the well. The reins, the -halters, the blinkers, the degrading nosebags, were thrown on to the -rubbish fire which was burning in the yard. So were the whips. All the -animals capered with joy when they saw the whips going up in flames. -Snowball also threw on to the fire the ribbons with which the horses' -manes and tails had usually been decorated on market days. - -"Ribbons," he said, "should be considered as clothes, which are the mark -of a human being. All animals should go naked." - -When Boxer heard this he fetched the small straw hat which he wore in -summer to keep the flies out of his ears, and flung it on to the fire with -the rest. - -In a very little while the animals had destroyed everything that reminded -them of Mr. Jones. Napoleon then led them back to the store-shed and -served out a double ration of corn to everybody, with two biscuits for -each dog. Then they sang 'Beasts of England' from end to end seven times -running, and after that they settled down for the night and slept as they -had never slept before. - -But they woke at dawn as usual, and suddenly remembering the glorious -thing that had happened, they all raced out into the pasture together. A -little way down the pasture there was a knoll that commanded a view of -most of the farm. The animals rushed to the top of it and gazed round them -in the clear morning light. Yes, it was theirs--everything that they could -see was theirs! In the ecstasy of that thought they gambolled round and -round, they hurled themselves into the air in great leaps of excitement. -They rolled in the dew, they cropped mouthfuls of the sweet summer grass, -they kicked up clods of the black earth and snuffed its rich scent. Then -they made a tour of inspection of the whole farm and surveyed with -speechless admiration the ploughland, the hayfield, the orchard, the pool, -the spinney. It was as though they had never seen these things before, and -even now they could hardly believe that it was all their own. - -Then they filed back to the farm buildings and halted in silence outside -the door of the farmhouse. That was theirs too, but they were frightened -to go inside. After a moment, however, Snowball and Napoleon butted the -door open with their shoulders and the animals entered in single file, -walking with the utmost care for fear of disturbing anything. They tiptoed -from room to room, afraid to speak above a whisper and gazing with a kind -of awe at the unbelievable luxury, at the beds with their feather -mattresses, the looking-glasses, the horsehair sofa, the Brussels carpet, -the lithograph of Queen Victoria over the drawing-room mantelpiece. They -were just coming down the stairs when Mollie was discovered to be missing. -Going back, the others found that she had remained behind in the best -bedroom. She had taken a piece of blue ribbon from Mrs. Jones's -dressing-table, and was holding it against her shoulder and admiring -herself in the glass in a very foolish manner. The others reproached her -sharply, and they went outside. Some hams hanging in the kitchen were -taken out for burial, and the barrel of beer in the scullery was stove in -with a kick from Boxer's hoof, otherwise nothing in the house was touched. -A unanimous resolution was passed on the spot that the farmhouse should be -preserved as a museum. All were agreed that no animal must ever live there. - -The animals had their breakfast, and then Snowball and Napoleon called -them together again. - -"Comrades," said Snowball, "it is half-past six and we have a long day -before us. Today we begin the hay harvest. But there is another matter -that must be attended to first." - -The pigs now revealed that during the past three months they had taught -themselves to read and write from an old spelling book which had belonged -to Mr. Jones's children and which had been thrown on the rubbish heap. -Napoleon sent for pots of black and white paint and led the way down to -the five-barred gate that gave on to the main road. Then Snowball (for it -was Snowball who was best at writing) took a brush between the two -knuckles of his trotter, painted out MANOR FARM from the top bar of the -gate and in its place painted ANIMAL FARM. This was to be the name of the -farm from now onwards. After this they went back to the farm buildings, -where Snowball and Napoleon sent for a ladder which they caused to be set -against the end wall of the big barn. They explained that by their studies -of the past three months the pigs had succeeded in reducing the principles -of Animalism to Seven Commandments. These Seven Commandments would now be -inscribed on the wall; they would form an unalterable law by which all the -animals on Animal Farm must live for ever after. With some difficulty -(for it is not easy for a pig to balance himself on a ladder) Snowball -climbed up and set to work, with Squealer a few rungs below him holding -the paint-pot. The Commandments were written on the tarred wall in great -white letters that could be read thirty yards away. They ran thus: - - -THE SEVEN COMMANDMENTS - -1. Whatever goes upon two legs is an enemy. -2. Whatever goes upon four legs, or has wings, is a friend. -3. No animal shall wear clothes. -4. No animal shall sleep in a bed. -5. No animal shall drink alcohol. -6. No animal shall kill any other animal. -7. All animals are equal. - - -It was very neatly written, and except that "friend" was written "freind" -and one of the "S's" was the wrong way round, the spelling was correct all -the way through. Snowball read it aloud for the benefit of the others. All -the animals nodded in complete agreement, and the cleverer ones at once -began to learn the Commandments by heart. - -"Now, comrades," cried Snowball, throwing down the paint-brush, "to the -hayfield! Let us make it a point of honour to get in the harvest more -quickly than Jones and his men could do." - -But at this moment the three cows, who had seemed uneasy for some time -past, set up a loud lowing. They had not been milked for twenty-four -hours, and their udders were almost bursting. After a little thought, the -pigs sent for buckets and milked the cows fairly successfully, their -trotters being well adapted to this task. Soon there were five buckets of -frothing creamy milk at which many of the animals looked with considerable -interest. - -"What is going to happen to all that milk?" said someone. - -"Jones used sometimes to mix some of it in our mash," said one of the hens. - -"Never mind the milk, comrades!" cried Napoleon, placing himself in front -of the buckets. "That will be attended to. The harvest is more important. -Comrade Snowball will lead the way. I shall follow in a few minutes. -Forward, comrades! The hay is waiting." - -So the animals trooped down to the hayfield to begin the harvest, and when -they came back in the evening it was noticed that the milk had disappeared. - - - - - Chapter III - - - -How they toiled and sweated to get the hay in! But their efforts were -rewarded, for the harvest was an even bigger success than they had hoped. - -Sometimes the work was hard; the implements had been designed for human -beings and not for animals, and it was a great drawback that no animal was -able to use any tool that involved standing on his hind legs. But the pigs -were so clever that they could think of a way round every difficulty. As -for the horses, they knew every inch of the field, and in fact understood -the business of mowing and raking far better than Jones and his men had -ever done. The pigs did not actually work, but directed and supervised the -others. With their superior knowledge it was natural that they should -assume the leadership. Boxer and Clover would harness themselves to the -cutter or the horse-rake (no bits or reins were needed in these days, of -course) and tramp steadily round and round the field with a pig walking -behind and calling out "Gee up, comrade!" or "Whoa back, comrade!" as the -case might be. And every animal down to the humblest worked at turning the -hay and gathering it. Even the ducks and hens toiled to and fro all day in -the sun, carrying tiny wisps of hay in their beaks. In the end they -finished the harvest in two days' less time than it had usually taken -Jones and his men. Moreover, it was the biggest harvest that the farm had -ever seen. There was no wastage whatever; the hens and ducks with their -sharp eyes had gathered up the very last stalk. And not an animal on the -farm had stolen so much as a mouthful. - -All through that summer the work of the farm went like clockwork. The -animals were happy as they had never conceived it possible to be. Every -mouthful of food was an acute positive pleasure, now that it was truly -their own food, produced by themselves and for themselves, not doled out -to them by a grudging master. With the worthless parasitical human beings -gone, there was more for everyone to eat. There was more leisure too, -inexperienced though the animals were. They met with many difficulties--for -instance, later in the year, when they harvested the corn, they had to -tread it out in the ancient style and blow away the chaff with their -breath, since the farm possessed no threshing machine--but the pigs with -their cleverness and Boxer with his tremendous muscles always pulled them -through. Boxer was the admiration of everybody. He had been a hard worker -even in Jones's time, but now he seemed more like three horses than one; -there were days when the entire work of the farm seemed to rest on his -mighty shoulders. From morning to night he was pushing and pulling, always -at the spot where the work was hardest. He had made an arrangement with -one of the cockerels to call him in the mornings half an hour earlier than -anyone else, and would put in some volunteer labour at whatever seemed to -be most needed, before the regular day's work began. His answer to every -problem, every setback, was "I will work harder!"--which he had adopted as -his personal motto. - -But everyone worked according to his capacity. The hens and ducks, for -instance, saved five bushels of corn at the harvest by gathering up the -stray grains. Nobody stole, nobody grumbled over his rations, the -quarrelling and biting and jealousy which had been normal features of life -in the old days had almost disappeared. Nobody shirked--or almost nobody. -Mollie, it was true, was not good at getting up in the mornings, and had a -way of leaving work early on the ground that there was a stone in her -hoof. And the behaviour of the cat was somewhat peculiar. It was soon -noticed that when there was work to be done the cat could never be found. -She would vanish for hours on end, and then reappear at meal-times, or in -the evening after work was over, as though nothing had happened. But she -always made such excellent excuses, and purred so affectionately, that it -was impossible not to believe in her good intentions. Old Benjamin, the -donkey, seemed quite unchanged since the Rebellion. He did his work in the -same slow obstinate way as he had done it in Jones's time, never shirking -and never volunteering for extra work either. About the Rebellion and its -results he would express no opinion. When asked whether he was not happier -now that Jones was gone, he would say only "Donkeys live a long time. None -of you has ever seen a dead donkey," and the others had to be content with -this cryptic answer. - -On Sundays there was no work. Breakfast was an hour later than usual, and -after breakfast there was a ceremony which was observed every week without -fail. First came the hoisting of the flag. Snowball had found in the -harness-room an old green tablecloth of Mrs. Jones's and had painted on it -a hoof and a horn in white. This was run up the flagstaff in the farmhouse -garden every Sunday morning. The flag was green, Snowball explained, to -represent the green fields of England, while the hoof and horn signified -the future Republic of the Animals which would arise when the human race -had been finally overthrown. After the hoisting of the flag all the -animals trooped into the big barn for a general assembly which was known -as the Meeting. Here the work of the coming week was planned out and -resolutions were put forward and debated. It was always the pigs who put -forward the resolutions. The other animals understood how to vote, but -could never think of any resolutions of their own. Snowball and Napoleon -were by far the most active in the debates. But it was noticed that these -two were never in agreement: whatever suggestion either of them made, the -other could be counted on to oppose it. Even when it was resolved--a thing -no one could object to in itself--to set aside the small paddock behind -the orchard as a home of rest for animals who were past work, there was a -stormy debate over the correct retiring age for each class of animal. The -Meeting always ended with the singing of 'Beasts of England', and the -afternoon was given up to recreation. - -The pigs had set aside the harness-room as a headquarters for themselves. -Here, in the evenings, they studied blacksmithing, carpentering, and other -necessary arts from books which they had brought out of the farmhouse. -Snowball also busied himself with organising the other animals into what -he called Animal Committees. He was indefatigable at this. He formed the -Egg Production Committee for the hens, the Clean Tails League for the -cows, the Wild Comrades' Re-education Committee (the object of this was to -tame the rats and rabbits), the Whiter Wool Movement for the sheep, and -various others, besides instituting classes in reading and writing. On the -whole, these projects were a failure. The attempt to tame the wild -creatures, for instance, broke down almost immediately. They continued to -behave very much as before, and when treated with generosity, simply took -advantage of it. The cat joined the Re-education Committee and was very -active in it for some days. She was seen one day sitting on a roof and -talking to some sparrows who were just out of her reach. She was telling -them that all animals were now comrades and that any sparrow who chose -could come and perch on her paw; but the sparrows kept their distance. - -The reading and writing classes, however, were a great success. By the -autumn almost every animal on the farm was literate in some degree. - -As for the pigs, they could already read and write perfectly. The dogs -learned to read fairly well, but were not interested in reading anything -except the Seven Commandments. Muriel, the goat, could read somewhat -better than the dogs, and sometimes used to read to the others in the -evenings from scraps of newspaper which she found on the rubbish heap. -Benjamin could read as well as any pig, but never exercised his faculty. -So far as he knew, he said, there was nothing worth reading. Clover learnt -the whole alphabet, but could not put words together. Boxer could not get -beyond the letter D. He would trace out A, B, C, D, in the dust with his -great hoof, and then would stand staring at the letters with his ears -back, sometimes shaking his forelock, trying with all his might to -remember what came next and never succeeding. On several occasions, -indeed, he did learn E, F, G, H, but by the time he knew them, it was -always discovered that he had forgotten A, B, C, and D. Finally he decided -to be content with the first four letters, and used to write them out once -or twice every day to refresh his memory. Mollie refused to learn any but -the six letters which spelt her own name. She would form these very neatly -out of pieces of twig, and would then decorate them with a flower or two -and walk round them admiring them. - -None of the other animals on the farm could get further than the letter A. -It was also found that the stupider animals, such as the sheep, hens, and -ducks, were unable to learn the Seven Commandments by heart. After much -thought Snowball declared that the Seven Commandments could in effect be -reduced to a single maxim, namely: "Four legs good, two legs bad." This, -he said, contained the essential principle of Animalism. Whoever had -thoroughly grasped it would be safe from human influences. The birds at -first objected, since it seemed to them that they also had two legs, but -Snowball proved to them that this was not so. - -"A bird's wing, comrades," he said, "is an organ of propulsion and not of -manipulation. It should therefore be regarded as a leg. The distinguishing -mark of man is the HAND, the instrument with which he does all his -mischief." - -The birds did not understand Snowball's long words, but they accepted his -explanation, and all the humbler animals set to work to learn the new -maxim by heart. FOUR LEGS GOOD, TWO LEGS BAD, was inscribed on the end -wall of the barn, above the Seven Commandments and in bigger letters. When -they had once got it by heart, the sheep developed a great liking for this -maxim, and often as they lay in the field they would all start bleating -"Four legs good, two legs bad! Four legs good, two legs bad!" and keep it -up for hours on end, never growing tired of it. - -Napoleon took no interest in Snowball's committees. He said that the -education of the young was more important than anything that could be done -for those who were already grown up. It happened that Jessie and Bluebell -had both whelped soon after the hay harvest, giving birth between them to -nine sturdy puppies. As soon as they were weaned, Napoleon took them away -from their mothers, saying that he would make himself responsible for -their education. He took them up into a loft which could only be reached -by a ladder from the harness-room, and there kept them in such seclusion -that the rest of the farm soon forgot their existence. - -The mystery of where the milk went to was soon cleared up. It was mixed -every day into the pigs' mash. The early apples were now ripening, and the -grass of the orchard was littered with windfalls. The animals had assumed -as a matter of course that these would be shared out equally; one day, -however, the order went forth that all the windfalls were to be collected -and brought to the harness-room for the use of the pigs. At this some of -the other animals murmured, but it was no use. All the pigs were in full -agreement on this point, even Snowball and Napoleon. Squealer was sent to -make the necessary explanations to the others. - -"Comrades!" he cried. "You do not imagine, I hope, that we pigs are doing -this in a spirit of selfishness and privilege? Many of us actually dislike -milk and apples. I dislike them myself. Our sole object in taking these -things is to preserve our health. Milk and apples (this has been proved by -Science, comrades) contain substances absolutely necessary to the -well-being of a pig. We pigs are brainworkers. The whole management and -organisation of this farm depend on us. Day and night we are watching over -your welfare. It is for YOUR sake that we drink that milk and eat those -apples. Do you know what would happen if we pigs failed in our duty? Jones -would come back! Yes, Jones would come back! Surely, comrades," cried -Squealer almost pleadingly, skipping from side to side and whisking his -tail, "surely there is no one among you who wants to see Jones come back?" - -Now if there was one thing that the animals were completely certain of, it -was that they did not want Jones back. When it was put to them in this -light, they had no more to say. The importance of keeping the pigs in good -health was all too obvious. So it was agreed without further argument that -the milk and the windfall apples (and also the main crop of apples when -they ripened) should be reserved for the pigs alone. - - - - - Chapter IV - - - -By the late summer the news of what had happened on Animal Farm had spread -across half the county. Every day Snowball and Napoleon sent out flights -of pigeons whose instructions were to mingle with the animals on -neighbouring farms, tell them the story of the Rebellion, and teach them -the tune of 'Beasts of England'. - -Most of this time Mr. Jones had spent sitting in the taproom of the Red -Lion at Willingdon, complaining to anyone who would listen of the -monstrous injustice he had suffered in being turned out of his property by -a pack of good-for-nothing animals. The other farmers sympathised in -principle, but they did not at first give him much help. At heart, each of -them was secretly wondering whether he could not somehow turn Jones's -misfortune to his own advantage. It was lucky that the owners of the two -farms which adjoined Animal Farm were on permanently bad terms. One of -them, which was named Foxwood, was a large, neglected, old-fashioned farm, -much overgrown by woodland, with all its pastures worn out and its hedges -in a disgraceful condition. Its owner, Mr. Pilkington, was an easy-going -gentleman farmer who spent most of his time in fishing or hunting -according to the season. The other farm, which was called Pinchfield, was -smaller and better kept. Its owner was a Mr. Frederick, a tough, shrewd -man, perpetually involved in lawsuits and with a name for driving hard -bargains. These two disliked each other so much that it was difficult for -them to come to any agreement, even in defence of their own interests. - -Nevertheless, they were both thoroughly frightened by the rebellion on -Animal Farm, and very anxious to prevent their own animals from learning -too much about it. At first they pretended to laugh to scorn the idea of -animals managing a farm for themselves. The whole thing would be over in a -fortnight, they said. They put it about that the animals on the Manor Farm -(they insisted on calling it the Manor Farm; they would not tolerate the -name "Animal Farm") were perpetually fighting among themselves and were -also rapidly starving to death. When time passed and the animals had -evidently not starved to death, Frederick and Pilkington changed their -tune and began to talk of the terrible wickedness that now flourished on -Animal Farm. It was given out that the animals there practised cannibalism, -tortured one another with red-hot horseshoes, and had their females in -common. This was what came of rebelling against the laws of Nature, -Frederick and Pilkington said. - -However, these stories were never fully believed. Rumours of a wonderful -farm, where the human beings had been turned out and the animals managed -their own affairs, continued to circulate in vague and distorted forms, -and throughout that year a wave of rebelliousness ran through the -countryside. Bulls which had always been tractable suddenly turned savage, -sheep broke down hedges and devoured the clover, cows kicked the pail -over, hunters refused their fences and shot their riders on to the other -side. Above all, the tune and even the words of 'Beasts of England' were -known everywhere. It had spread with astonishing speed. The human beings -could not contain their rage when they heard this song, though they -pretended to think it merely ridiculous. They could not understand, they -said, how even animals could bring themselves to sing such contemptible -rubbish. Any animal caught singing it was given a flogging on the spot. -And yet the song was irrepressible. The blackbirds whistled it in the -hedges, the pigeons cooed it in the elms, it got into the din of the -smithies and the tune of the church bells. And when the human beings -listened to it, they secretly trembled, hearing in it a prophecy of their -future doom. - -Early in October, when the corn was cut and stacked and some of it was -already threshed, a flight of pigeons came whirling through the air and -alighted in the yard of Animal Farm in the wildest excitement. Jones and -all his men, with half a dozen others from Foxwood and Pinchfield, had -entered the five-barred gate and were coming up the cart-track that led to -the farm. They were all carrying sticks, except Jones, who was marching -ahead with a gun in his hands. Obviously they were going to attempt the -recapture of the farm. - -This had long been expected, and all preparations had been made. Snowball, -who had studied an old book of Julius Caesar's campaigns which he had -found in the farmhouse, was in charge of the defensive operations. He gave -his orders quickly, and in a couple of minutes every animal was at his -post. - -As the human beings approached the farm buildings, Snowball launched his -first attack. All the pigeons, to the number of thirty-five, flew to and -fro over the men's heads and muted upon them from mid-air; and while the -men were dealing with this, the geese, who had been hiding behind the -hedge, rushed out and pecked viciously at the calves of their legs. -However, this was only a light skirmishing manoeuvre, intended to create a -little disorder, and the men easily drove the geese off with their sticks. -Snowball now launched his second line of attack. Muriel, Benjamin, and all -the sheep, with Snowball at the head of them, rushed forward and prodded -and butted the men from every side, while Benjamin turned around and -lashed at them with his small hoofs. But once again the men, with their -sticks and their hobnailed boots, were too strong for them; and suddenly, -at a squeal from Snowball, which was the signal for retreat, all the -animals turned and fled through the gateway into the yard. - -The men gave a shout of triumph. They saw, as they imagined, their enemies -in flight, and they rushed after them in disorder. This was just what -Snowball had intended. As soon as they were well inside the yard, the -three horses, the three cows, and the rest of the pigs, who had been lying -in ambush in the cowshed, suddenly emerged in their rear, cutting them -off. Snowball now gave the signal for the charge. He himself dashed -straight for Jones. Jones saw him coming, raised his gun and fired. The -pellets scored bloody streaks along Snowball's back, and a sheep dropped -dead. Without halting for an instant, Snowball flung his fifteen stone -against Jones's legs. Jones was hurled into a pile of dung and his gun -flew out of his hands. But the most terrifying spectacle of all was Boxer, -rearing up on his hind legs and striking out with his great iron-shod -hoofs like a stallion. His very first blow took a stable-lad from Foxwood -on the skull and stretched him lifeless in the mud. At the sight, several -men dropped their sticks and tried to run. Panic overtook them, and the -next moment all the animals together were chasing them round and round the -yard. They were gored, kicked, bitten, trampled on. There was not an -animal on the farm that did not take vengeance on them after his own -fashion. Even the cat suddenly leapt off a roof onto a cowman's shoulders -and sank her claws in his neck, at which he yelled horribly. At a moment -when the opening was clear, the men were glad enough to rush out of the -yard and make a bolt for the main road. And so within five minutes of -their invasion they were in ignominious retreat by the same way as they -had come, with a flock of geese hissing after them and pecking at their -calves all the way. - -All the men were gone except one. Back in the yard Boxer was pawing with -his hoof at the stable-lad who lay face down in the mud, trying to turn -him over. The boy did not stir. - -"He is dead," said Boxer sorrowfully. "I had no intention of doing that. -I forgot that I was wearing iron shoes. Who will believe that I did not do -this on purpose?" - -"No sentimentality, comrade!" cried Snowball from whose wounds the blood -was still dripping. "War is war. The only good human being is a dead one." - -"I have no wish to take life, not even human life," repeated Boxer, and -his eyes were full of tears. - -"Where is Mollie?" exclaimed somebody. - -Mollie in fact was missing. For a moment there was great alarm; it was -feared that the men might have harmed her in some way, or even carried her -off with them. In the end, however, she was found hiding in her stall with -her head buried among the hay in the manger. She had taken to flight as -soon as the gun went off. And when the others came back from looking for -her, it was to find that the stable-lad, who in fact was only stunned, had -already recovered and made off. - -The animals had now reassembled in the wildest excitement, each recounting -his own exploits in the battle at the top of his voice. An impromptu -celebration of the victory was held immediately. The flag was run up and -'Beasts of England' was sung a number of times, then the sheep who had been -killed was given a solemn funeral, a hawthorn bush being planted on her -grave. At the graveside Snowball made a little speech, emphasising the -need for all animals to be ready to die for Animal Farm if need be. - -The animals decided unanimously to create a military decoration, "Animal -Hero, First Class," which was conferred there and then on Snowball and -Boxer. It consisted of a brass medal (they were really some old -horse-brasses which had been found in the harness-room), to be worn on -Sundays and holidays. There was also "Animal Hero, Second Class," which -was conferred posthumously on the dead sheep. - -There was much discussion as to what the battle should be called. In the -end, it was named the Battle of the Cowshed, since that was where the -ambush had been sprung. Mr. Jones's gun had been found lying in the mud, -and it was known that there was a supply of cartridges in the farmhouse. -It was decided to set the gun up at the foot of the Flagstaff, like a -piece of artillery, and to fire it twice a year--once on October the -twelfth, the anniversary of the Battle of the Cowshed, and once on -Midsummer Day, the anniversary of the Rebellion. - - - - - Chapter V - - - -As winter drew on, Mollie became more and more troublesome. She was late -for work every morning and excused herself by saying that she had -overslept, and she complained of mysterious pains, although her appetite -was excellent. On every kind of pretext she would run away from work and -go to the drinking pool, where she would stand foolishly gazing at her own -reflection in the water. But there were also rumours of something more -serious. One day, as Mollie strolled blithely into the yard, flirting her -long tail and chewing at a stalk of hay, Clover took her aside. - -"Mollie," she said, "I have something very serious to say to you. This -morning I saw you looking over the hedge that divides Animal Farm from -Foxwood. One of Mr. Pilkington's men was standing on the other side of the -hedge. And--I was a long way away, but I am almost certain I saw this--he -was talking to you and you were allowing him to stroke your nose. What -does that mean, Mollie?" - -"He didn't! I wasn't! It isn't true!" cried Mollie, beginning to prance -about and paw the ground. - -"Mollie! Look me in the face. Do you give me your word of honour that that -man was not stroking your nose?" - -"It isn't true!" repeated Mollie, but she could not look Clover in the -face, and the next moment she took to her heels and galloped away into the -field. - -A thought struck Clover. Without saying anything to the others, she went -to Mollie's stall and turned over the straw with her hoof. Hidden under -the straw was a little pile of lump sugar and several bunches of ribbon of -different colours. - -Three days later Mollie disappeared. For some weeks nothing was known of -her whereabouts, then the pigeons reported that they had seen her on the -other side of Willingdon. She was between the shafts of a smart dogcart -painted red and black, which was standing outside a public-house. A fat -red-faced man in check breeches and gaiters, who looked like a publican, -was stroking her nose and feeding her with sugar. Her coat was newly -clipped and she wore a scarlet ribbon round her forelock. She appeared to -be enjoying herself, so the pigeons said. None of the animals ever -mentioned Mollie again. - -In January there came bitterly hard weather. The earth was like iron, and -nothing could be done in the fields. Many meetings were held in the big -barn, and the pigs occupied themselves with planning out the work of the -coming season. It had come to be accepted that the pigs, who were -manifestly cleverer than the other animals, should decide all questions of -farm policy, though their decisions had to be ratified by a majority vote. -This arrangement would have worked well enough if it had not been for the -disputes between Snowball and Napoleon. These two disagreed at every point -where disagreement was possible. If one of them suggested sowing a bigger -acreage with barley, the other was certain to demand a bigger acreage of -oats, and if one of them said that such and such a field was just right -for cabbages, the other would declare that it was useless for anything -except roots. Each had his own following, and there were some violent -debates. At the Meetings Snowball often won over the majority by his -brilliant speeches, but Napoleon was better at canvassing support for -himself in between times. He was especially successful with the sheep. Of -late the sheep had taken to bleating "Four legs good, two legs bad" both -in and out of season, and they often interrupted the Meeting with this. It -was noticed that they were especially liable to break into "Four legs -good, two legs bad" at crucial moments in Snowball's speeches. Snowball -had made a close study of some back numbers of the 'Farmer and -Stockbreeder' which he had found in the farmhouse, and was full of plans -for innovations and improvements. He talked learnedly about field drains, -silage, and basic slag, and had worked out a complicated scheme for all -the animals to drop their dung directly in the fields, at a different spot -every day, to save the labour of cartage. Napoleon produced no schemes of -his own, but said quietly that Snowball's would come to nothing, and -seemed to be biding his time. But of all their controversies, none was so -bitter as the one that took place over the windmill. - -In the long pasture, not far from the farm buildings, there was a small -knoll which was the highest point on the farm. After surveying the ground, -Snowball declared that this was just the place for a windmill, which could -be made to operate a dynamo and supply the farm with electrical power. -This would light the stalls and warm them in winter, and would also run a -circular saw, a chaff-cutter, a mangel-slicer, and an electric milking -machine. The animals had never heard of anything of this kind before -(for the farm was an old-fashioned one and had only the most primitive -machinery), and they listened in astonishment while Snowball conjured up -pictures of fantastic machines which would do their work for them while -they grazed at their ease in the fields or improved their minds with -reading and conversation. - -Within a few weeks Snowball's plans for the windmill were fully worked -out. The mechanical details came mostly from three books which had -belonged to Mr. Jones--'One Thousand Useful Things to Do About the House', -'Every Man His Own Bricklayer', and 'Electricity for Beginners'. Snowball -used as his study a shed which had once been used for incubators and had a -smooth wooden floor, suitable for drawing on. He was closeted there for -hours at a time. With his books held open by a stone, and with a piece of -chalk gripped between the knuckles of his trotter, he would move rapidly -to and fro, drawing in line after line and uttering little whimpers of -excitement. Gradually the plans grew into a complicated mass of cranks and -cog-wheels, covering more than half the floor, which the other animals -found completely unintelligible but very impressive. All of them came to -look at Snowball's drawings at least once a day. Even the hens and ducks -came, and were at pains not to tread on the chalk marks. Only Napoleon -held aloof. He had declared himself against the windmill from the start. -One day, however, he arrived unexpectedly to examine the plans. He walked -heavily round the shed, looked closely at every detail of the plans and -snuffed at them once or twice, then stood for a little while contemplating -them out of the corner of his eye; then suddenly he lifted his leg, -urinated over the plans, and walked out without uttering a word. - -The whole farm was deeply divided on the subject of the windmill. Snowball -did not deny that to build it would be a difficult business. Stone would -have to be carried and built up into walls, then the sails would have to -be made and after that there would be need for dynamos and cables. (How -these were to be procured, Snowball did not say.) But he maintained that -it could all be done in a year. And thereafter, he declared, so much -labour would be saved that the animals would only need to work three days -a week. Napoleon, on the other hand, argued that the great need of the -moment was to increase food production, and that if they wasted time on -the windmill they would all starve to death. The animals formed themselves -into two factions under the slogan, "Vote for Snowball and the three-day -week" and "Vote for Napoleon and the full manger." Benjamin was the only -animal who did not side with either faction. He refused to believe either -that food would become more plentiful or that the windmill would save -work. Windmill or no windmill, he said, life would go on as it had always -gone on--that is, badly. - -Apart from the disputes over the windmill, there was the question of the -defence of the farm. It was fully realised that though the human beings -had been defeated in the Battle of the Cowshed they might make another and -more determined attempt to recapture the farm and reinstate Mr. Jones. -They had all the more reason for doing so because the news of their defeat -had spread across the countryside and made the animals on the neighbouring -farms more restive than ever. As usual, Snowball and Napoleon were in -disagreement. According to Napoleon, what the animals must do was to -procure firearms and train themselves in the use of them. According to -Snowball, they must send out more and more pigeons and stir up rebellion -among the animals on the other farms. The one argued that if they could -not defend themselves they were bound to be conquered, the other argued -that if rebellions happened everywhere they would have no need to defend -themselves. The animals listened first to Napoleon, then to Snowball, and -could not make up their minds which was right; indeed, they always found -themselves in agreement with the one who was speaking at the moment. - -At last the day came when Snowball's plans were completed. At the Meeting -on the following Sunday the question of whether or not to begin work on -the windmill was to be put to the vote. When the animals had assembled in -the big barn, Snowball stood up and, though occasionally interrupted by -bleating from the sheep, set forth his reasons for advocating the building -of the windmill. Then Napoleon stood up to reply. He said very quietly -that the windmill was nonsense and that he advised nobody to vote for it, -and promptly sat down again; he had spoken for barely thirty seconds, and -seemed almost indifferent as to the effect he produced. At this Snowball -sprang to his feet, and shouting down the sheep, who had begun bleating -again, broke into a passionate appeal in favour of the windmill. Until now -the animals had been about equally divided in their sympathies, but in a -moment Snowball's eloquence had carried them away. In glowing sentences he -painted a picture of Animal Farm as it might be when sordid labour was -lifted from the animals' backs. His imagination had now run far beyond -chaff-cutters and turnip-slicers. Electricity, he said, could operate -threshing machines, ploughs, harrows, rollers, and reapers and binders, -besides supplying every stall with its own electric light, hot and cold -water, and an electric heater. By the time he had finished speaking, there -was no doubt as to which way the vote would go. But just at this moment -Napoleon stood up and, casting a peculiar sidelong look at Snowball, -uttered a high-pitched whimper of a kind no one had ever heard him utter -before. - -At this there was a terrible baying sound outside, and nine enormous dogs -wearing brass-studded collars came bounding into the barn. They dashed -straight for Snowball, who only sprang from his place just in time to -escape their snapping jaws. In a moment he was out of the door and they -were after him. Too amazed and frightened to speak, all the animals -crowded through the door to watch the chase. Snowball was racing across -the long pasture that led to the road. He was running as only a pig can -run, but the dogs were close on his heels. Suddenly he slipped and it -seemed certain that they had him. Then he was up again, running faster -than ever, then the dogs were gaining on him again. One of them all but -closed his jaws on Snowball's tail, but Snowball whisked it free just in -time. Then he put on an extra spurt and, with a few inches to spare, -slipped through a hole in the hedge and was seen no more. - -Silent and terrified, the animals crept back into the barn. In a moment -the dogs came bounding back. At first no one had been able to imagine -where these creatures came from, but the problem was soon solved: they -were the puppies whom Napoleon had taken away from their mothers and -reared privately. Though not yet full-grown, they were huge dogs, and as -fierce-looking as wolves. They kept close to Napoleon. It was noticed that -they wagged their tails to him in the same way as the other dogs had been -used to do to Mr. Jones. - -Napoleon, with the dogs following him, now mounted on to the raised -portion of the floor where Major had previously stood to deliver his -speech. He announced that from now on the Sunday-morning Meetings would -come to an end. They were unnecessary, he said, and wasted time. In future -all questions relating to the working of the farm would be settled by a -special committee of pigs, presided over by himself. These would meet in -private and afterwards communicate their decisions to the others. The -animals would still assemble on Sunday mornings to salute the flag, sing -'Beasts of England', and receive their orders for the week; but there would -be no more debates. - -In spite of the shock that Snowball's expulsion had given them, the -animals were dismayed by this announcement. Several of them would have -protested if they could have found the right arguments. Even Boxer was -vaguely troubled. He set his ears back, shook his forelock several times, -and tried hard to marshal his thoughts; but in the end he could not think -of anything to say. Some of the pigs themselves, however, were more -articulate. Four young porkers in the front row uttered shrill squeals of -disapproval, and all four of them sprang to their feet and began speaking -at once. But suddenly the dogs sitting round Napoleon let out deep, -menacing growls, and the pigs fell silent and sat down again. Then the -sheep broke out into a tremendous bleating of "Four legs good, two legs -bad!" which went on for nearly a quarter of an hour and put an end to any -chance of discussion. - -Afterwards Squealer was sent round the farm to explain the new arrangement -to the others. - -"Comrades," he said, "I trust that every animal here appreciates the -sacrifice that Comrade Napoleon has made in taking this extra labour upon -himself. Do not imagine, comrades, that leadership is a pleasure! On the -contrary, it is a deep and heavy responsibility. No one believes more -firmly than Comrade Napoleon that all animals are equal. He would be only -too happy to let you make your decisions for yourselves. But sometimes you -might make the wrong decisions, comrades, and then where should we be? -Suppose you had decided to follow Snowball, with his moonshine of -windmills--Snowball, who, as we now know, was no better than a criminal?" - -"He fought bravely at the Battle of the Cowshed," said somebody. - -"Bravery is not enough," said Squealer. "Loyalty and obedience are more -important. And as to the Battle of the Cowshed, I believe the time will -come when we shall find that Snowball's part in it was much exaggerated. -Discipline, comrades, iron discipline! That is the watchword for today. -One false step, and our enemies would be upon us. Surely, comrades, you do -not want Jones back?" - -Once again this argument was unanswerable. Certainly the animals did not -want Jones back; if the holding of debates on Sunday mornings was liable -to bring him back, then the debates must stop. Boxer, who had now had time -to think things over, voiced the general feeling by saying: "If Comrade -Napoleon says it, it must be right." And from then on he adopted the -maxim, "Napoleon is always right," in addition to his private motto of "I -will work harder." - -By this time the weather had broken and the spring ploughing had begun. -The shed where Snowball had drawn his plans of the windmill had been shut -up and it was assumed that the plans had been rubbed off the floor. Every -Sunday morning at ten o'clock the animals assembled in the big barn to -receive their orders for the week. The skull of old Major, now clean of -flesh, had been disinterred from the orchard and set up on a stump at the -foot of the flagstaff, beside the gun. After the hoisting of the flag, the -animals were required to file past the skull in a reverent manner before -entering the barn. Nowadays they did not sit all together as they had done -in the past. Napoleon, with Squealer and another pig named Minimus, who -had a remarkable gift for composing songs and poems, sat on the front of -the raised platform, with the nine young dogs forming a semicircle round -them, and the other pigs sitting behind. The rest of the animals sat -facing them in the main body of the barn. Napoleon read out the orders for -the week in a gruff soldierly style, and after a single singing of 'Beasts -of England', all the animals dispersed. - -On the third Sunday after Snowball's expulsion, the animals were somewhat -surprised to hear Napoleon announce that the windmill was to be built -after all. He did not give any reason for having changed his mind, but -merely warned the animals that this extra task would mean very hard work, -it might even be necessary to reduce their rations. The plans, however, -had all been prepared, down to the last detail. A special committee of -pigs had been at work upon them for the past three weeks. The building of -the windmill, with various other improvements, was expected to take two -years. - -That evening Squealer explained privately to the other animals that -Napoleon had never in reality been opposed to the windmill. On the -contrary, it was he who had advocated it in the beginning, and the plan -which Snowball had drawn on the floor of the incubator shed had actually -been stolen from among Napoleon's papers. The windmill was, in fact, -Napoleon's own creation. Why, then, asked somebody, had he spoken so -strongly against it? Here Squealer looked very sly. That, he said, was -Comrade Napoleon's cunning. He had SEEMED to oppose the windmill, simply -as a manoeuvre to get rid of Snowball, who was a dangerous character and a -bad influence. Now that Snowball was out of the way, the plan could go -forward without his interference. This, said Squealer, was something -called tactics. He repeated a number of times, "Tactics, comrades, -tactics!" skipping round and whisking his tail with a merry laugh. The -animals were not certain what the word meant, but Squealer spoke so -persuasively, and the three dogs who happened to be with him growled so -threateningly, that they accepted his explanation without further -questions. - - - - - Chapter VI - - - -All that year the animals worked like slaves. But they were happy in their -work; they grudged no effort or sacrifice, well aware that everything that -they did was for the benefit of themselves and those of their kind who -would come after them, and not for a pack of idle, thieving human beings. - -Throughout the spring and summer they worked a sixty-hour week, and in -August Napoleon announced that there would be work on Sunday afternoons -as well. This work was strictly voluntary, but any animal who absented -himself from it would have his rations reduced by half. Even so, it was -found necessary to leave certain tasks undone. The harvest was a little -less successful than in the previous year, and two fields which should -have been sown with roots in the early summer were not sown because the -ploughing had not been completed early enough. It was possible to foresee -that the coming winter would be a hard one. - -The windmill presented unexpected difficulties. There was a good quarry of -limestone on the farm, and plenty of sand and cement had been found in one -of the outhouses, so that all the materials for building were at hand. But -the problem the animals could not at first solve was how to break up the -stone into pieces of suitable size. There seemed no way of doing this -except with picks and crowbars, which no animal could use, because no -animal could stand on his hind legs. Only after weeks of vain effort did -the right idea occur to somebody-namely, to utilise the force of gravity. -Huge boulders, far too big to be used as they were, were lying all over -the bed of the quarry. The animals lashed ropes round these, and then all -together, cows, horses, sheep, any animal that could lay hold of the -rope--even the pigs sometimes joined in at critical moments--they dragged -them with desperate slowness up the slope to the top of the quarry, where -they were toppled over the edge, to shatter to pieces below. Transporting -the stone when it was once broken was comparatively simple. The horses -carried it off in cart-loads, the sheep dragged single blocks, even Muriel -and Benjamin yoked themselves into an old governess-cart and did their -share. By late summer a sufficient store of stone had accumulated, and -then the building began, under the superintendence of the pigs. - -But it was a slow, laborious process. Frequently it took a whole day of -exhausting effort to drag a single boulder to the top of the quarry, and -sometimes when it was pushed over the edge it failed to break. Nothing -could have been achieved without Boxer, whose strength seemed equal to -that of all the rest of the animals put together. When the boulder began -to slip and the animals cried out in despair at finding themselves dragged -down the hill, it was always Boxer who strained himself against the rope -and brought the boulder to a stop. To see him toiling up the slope inch by -inch, his breath coming fast, the tips of his hoofs clawing at the ground, -and his great sides matted with sweat, filled everyone with admiration. -Clover warned him sometimes to be careful not to overstrain himself, but -Boxer would never listen to her. His two slogans, "I will work harder" -and "Napoleon is always right," seemed to him a sufficient answer to all -problems. He had made arrangements with the cockerel to call him -three-quarters of an hour earlier in the mornings instead of half an hour. -And in his spare moments, of which there were not many nowadays, he would -go alone to the quarry, collect a load of broken stone, and drag it down -to the site of the windmill unassisted. - -The animals were not badly off throughout that summer, in spite of the -hardness of their work. If they had no more food than they had had in -Jones's day, at least they did not have less. The advantage of only having -to feed themselves, and not having to support five extravagant human -beings as well, was so great that it would have taken a lot of failures to -outweigh it. And in many ways the animal method of doing things was more -efficient and saved labour. Such jobs as weeding, for instance, could be -done with a thoroughness impossible to human beings. And again, since no -animal now stole, it was unnecessary to fence off pasture from arable -land, which saved a lot of labour on the upkeep of hedges and gates. -Nevertheless, as the summer wore on, various unforeseen shortages began to -make them selves felt. There was need of paraffin oil, nails, string, dog -biscuits, and iron for the horses' shoes, none of which could be produced -on the farm. Later there would also be need for seeds and artificial -manures, besides various tools and, finally, the machinery for the -windmill. How these were to be procured, no one was able to imagine. - -One Sunday morning, when the animals assembled to receive their orders, -Napoleon announced that he had decided upon a new policy. From now onwards -Animal Farm would engage in trade with the neighbouring farms: not, of -course, for any commercial purpose, but simply in order to obtain certain -materials which were urgently necessary. The needs of the windmill must -override everything else, he said. He was therefore making arrangements to -sell a stack of hay and part of the current year's wheat crop, and later -on, if more money were needed, it would have to be made up by the sale of -eggs, for which there was always a market in Willingdon. The hens, said -Napoleon, should welcome this sacrifice as their own special contribution -towards the building of the windmill. - -Once again the animals were conscious of a vague uneasiness. Never to have -any dealings with human beings, never to engage in trade, never to make -use of money--had not these been among the earliest resolutions passed at -that first triumphant Meeting after Jones was expelled? All the animals -remembered passing such resolutions: or at least they thought that they -remembered it. The four young pigs who had protested when Napoleon -abolished the Meetings raised their voices timidly, but they were promptly -silenced by a tremendous growling from the dogs. Then, as usual, the sheep -broke into "Four legs good, two legs bad!" and the momentary awkwardness -was smoothed over. Finally Napoleon raised his trotter for silence and -announced that he had already made all the arrangements. There would be no -need for any of the animals to come in contact with human beings, which -would clearly be most undesirable. He intended to take the whole burden -upon his own shoulders. A Mr. Whymper, a solicitor living in Willingdon, -had agreed to act as intermediary between Animal Farm and the outside -world, and would visit the farm every Monday morning to receive his -instructions. Napoleon ended his speech with his usual cry of "Long live -Animal Farm!" and after the singing of 'Beasts of England' the animals -were dismissed. - -Afterwards Squealer made a round of the farm and set the animals' minds at -rest. He assured them that the resolution against engaging in trade and -using money had never been passed, or even suggested. It was pure -imagination, probably traceable in the beginning to lies circulated by -Snowball. A few animals still felt faintly doubtful, but Squealer asked -them shrewdly, "Are you certain that this is not something that you have -dreamed, comrades? Have you any record of such a resolution? Is it written -down anywhere?" And since it was certainly true that nothing of the kind -existed in writing, the animals were satisfied that they had been mistaken. - -Every Monday Mr. Whymper visited the farm as had been arranged. He was a -sly-looking little man with side whiskers, a solicitor in a very small way -of business, but sharp enough to have realised earlier than anyone else -that Animal Farm would need a broker and that the commissions would be -worth having. The animals watched his coming and going with a kind of -dread, and avoided him as much as possible. Nevertheless, the sight of -Napoleon, on all fours, delivering orders to Whymper, who stood on two -legs, roused their pride and partly reconciled them to the new -arrangement. Their relations with the human race were now not quite the -same as they had been before. The human beings did not hate Animal Farm -any less now that it was prospering; indeed, they hated it more than ever. -Every human being held it as an article of faith that the farm would go -bankrupt sooner or later, and, above all, that the windmill would be a -failure. They would meet in the public-houses and prove to one another by -means of diagrams that the windmill was bound to fall down, or that if it -did stand up, then that it would never work. And yet, against their will, -they had developed a certain respect for the efficiency with which the -animals were managing their own affairs. One symptom of this was that they -had begun to call Animal Farm by its proper name and ceased to pretend -that it was called the Manor Farm. They had also dropped their championship -of Jones, who had given up hope of getting his farm back and gone to live -in another part of the county. Except through Whymper, there was as yet no -contact between Animal Farm and the outside world, but there were constant -rumours that Napoleon was about to enter into a definite business agreement -either with Mr. Pilkington of Foxwood or with Mr. Frederick of -Pinchfield--but never, it was noticed, with both simultaneously. - -It was about this time that the pigs suddenly moved into the farmhouse and -took up their residence there. Again the animals seemed to remember that a -resolution against this had been passed in the early days, and again -Squealer was able to convince them that this was not the case. It was -absolutely necessary, he said, that the pigs, who were the brains of the -farm, should have a quiet place to work in. It was also more suited to the -dignity of the Leader (for of late he had taken to speaking of Napoleon -under the title of "Leader") to live in a house than in a mere sty. -Nevertheless, some of the animals were disturbed when they heard that the -pigs not only took their meals in the kitchen and used the drawing-room -as a recreation room, but also slept in the beds. Boxer passed it off as -usual with "Napoleon is always right!", but Clover, who thought she -remembered a definite ruling against beds, went to the end of the barn and -tried to puzzle out the Seven Commandments which were inscribed there. -Finding herself unable to read more than individual letters, she fetched -Muriel. - -"Muriel," she said, "read me the Fourth Commandment. Does it not say -something about never sleeping in a bed?" - -With some difficulty Muriel spelt it out. - -"It says, 'No animal shall sleep in a bed with sheets,"' she announced -finally. - -Curiously enough, Clover had not remembered that the Fourth Commandment -mentioned sheets; but as it was there on the wall, it must have done so. -And Squealer, who happened to be passing at this moment, attended by two -or three dogs, was able to put the whole matter in its proper perspective. - -"You have heard then, comrades," he said, "that we pigs now sleep in the -beds of the farmhouse? And why not? You did not suppose, surely, that -there was ever a ruling against beds? A bed merely means a place to sleep -in. A pile of straw in a stall is a bed, properly regarded. The rule was -against sheets, which are a human invention. We have removed the sheets -from the farmhouse beds, and sleep between blankets. And very comfortable -beds they are too! But not more comfortable than we need, I can tell you, -comrades, with all the brainwork we have to do nowadays. You would not rob -us of our repose, would you, comrades? You would not have us too tired to -carry out our duties? Surely none of you wishes to see Jones back?" - -The animals reassured him on this point immediately, and no more was said -about the pigs sleeping in the farmhouse beds. And when, some days -afterwards, it was announced that from now on the pigs would get up an -hour later in the mornings than the other animals, no complaint was made -about that either. - -By the autumn the animals were tired but happy. They had had a hard year, -and after the sale of part of the hay and corn, the stores of food for the -winter were none too plentiful, but the windmill compensated for -everything. It was almost half built now. After the harvest there was a -stretch of clear dry weather, and the animals toiled harder than ever, -thinking it well worth while to plod to and fro all day with blocks of -stone if by doing so they could raise the walls another foot. Boxer would -even come out at nights and work for an hour or two on his own by the -light of the harvest moon. In their spare moments the animals would walk -round and round the half-finished mill, admiring the strength and -perpendicularity of its walls and marvelling that they should ever have -been able to build anything so imposing. Only old Benjamin refused to grow -enthusiastic about the windmill, though, as usual, he would utter nothing -beyond the cryptic remark that donkeys live a long time. - -November came, with raging south-west winds. Building had to stop because -it was now too wet to mix the cement. Finally there came a night when the -gale was so violent that the farm buildings rocked on their foundations -and several tiles were blown off the roof of the barn. The hens woke up -squawking with terror because they had all dreamed simultaneously of -hearing a gun go off in the distance. In the morning the animals came out -of their stalls to find that the flagstaff had been blown down and an elm -tree at the foot of the orchard had been plucked up like a radish. They -had just noticed this when a cry of despair broke from every animal's -throat. A terrible sight had met their eyes. The windmill was in ruins. - -With one accord they dashed down to the spot. Napoleon, who seldom moved -out of a walk, raced ahead of them all. Yes, there it lay, the fruit of -all their struggles, levelled to its foundations, the stones they had -broken and carried so laboriously scattered all around. Unable at first to -speak, they stood gazing mournfully at the litter of fallen stone. Napoleon -paced to and fro in silence, occasionally snuffing at the ground. His tail -had grown rigid and twitched sharply from side to side, a sign in him of -intense mental activity. Suddenly he halted as though his mind were -made up. - -"Comrades," he said quietly, "do you know who is responsible for this? Do -you know the enemy who has come in the night and overthrown our windmill? -SNOWBALL!" he suddenly roared in a voice of thunder. "Snowball has done -this thing! In sheer malignity, thinking to set back our plans and avenge -himself for his ignominious expulsion, this traitor has crept here under -cover of night and destroyed our work of nearly a year. Comrades, here -and now I pronounce the death sentence upon Snowball. 'Animal Hero, Second -Class,' and half a bushel of apples to any animal who brings him to -justice. A full bushel to anyone who captures him alive!" - -The animals were shocked beyond measure to learn that even Snowball could -be guilty of such an action. There was a cry of indignation, and everyone -began thinking out ways of catching Snowball if he should ever come back. -Almost immediately the footprints of a pig were discovered in the grass at -a little distance from the knoll. They could only be traced for a few -yards, but appeared to lead to a hole in the hedge. Napoleon snuffed -deeply at them and pronounced them to be Snowball's. He gave it as his -opinion that Snowball had probably come from the direction of Foxwood Farm. - -"No more delays, comrades!" cried Napoleon when the footprints had been -examined. "There is work to be done. This very morning we begin rebuilding -the windmill, and we will build all through the winter, rain or shine. We -will teach this miserable traitor that he cannot undo our work so easily. -Remember, comrades, there must be no alteration in our plans: they shall -be carried out to the day. Forward, comrades! Long live the windmill! Long -live Animal Farm!" - - - - - Chapter VII - - - -It was a bitter winter. The stormy weather was followed by sleet and snow, -and then by a hard frost which did not break till well into February. The -animals carried on as best they could with the rebuilding of the windmill, -well knowing that the outside world was watching them and that the envious -human beings would rejoice and triumph if the mill were not finished -on time. - -Out of spite, the human beings pretended not to believe that it was -Snowball who had destroyed the windmill: they said that it had fallen down -because the walls were too thin. The animals knew that this was not the -case. Still, it had been decided to build the walls three feet thick this -time instead of eighteen inches as before, which meant collecting much -larger quantities of stone. For a long time the quarry was full of -snowdrifts and nothing could be done. Some progress was made in the dry -frosty weather that followed, but it was cruel work, and the animals could -not feel so hopeful about it as they had felt before. They were always -cold, and usually hungry as well. Only Boxer and Clover never lost heart. -Squealer made excellent speeches on the joy of service and the dignity of -labour, but the other animals found more inspiration in Boxer's strength -and his never-failing cry of "I will work harder!" - -In January food fell short. The corn ration was drastically reduced, and -it was announced that an extra potato ration would be issued to make up -for it. Then it was discovered that the greater part of the potato crop -had been frosted in the clamps, which had not been covered thickly enough. -The potatoes had become soft and discoloured, and only a few were edible. -For days at a time the animals had nothing to eat but chaff and mangels. -Starvation seemed to stare them in the face. - -It was vitally necessary to conceal this fact from the outside world. -Emboldened by the collapse of the windmill, the human beings were -inventing fresh lies about Animal Farm. Once again it was being put about -that all the animals were dying of famine and disease, and that they were -continually fighting among themselves and had resorted to cannibalism and -infanticide. Napoleon was well aware of the bad results that might follow -if the real facts of the food situation were known, and he decided to make -use of Mr. Whymper to spread a contrary impression. Hitherto the animals -had had little or no contact with Whymper on his weekly visits: now, -however, a few selected animals, mostly sheep, were instructed to remark -casually in his hearing that rations had been increased. In addition, -Napoleon ordered the almost empty bins in the store-shed to be filled -nearly to the brim with sand, which was then covered up with what remained -of the grain and meal. On some suitable pretext Whymper was led through -the store-shed and allowed to catch a glimpse of the bins. He was -deceived, and continued to report to the outside world that there was no -food shortage on Animal Farm. - -Nevertheless, towards the end of January it became obvious that it would -be necessary to procure some more grain from somewhere. In these days -Napoleon rarely appeared in public, but spent all his time in the -farmhouse, which was guarded at each door by fierce-looking dogs. When he -did emerge, it was in a ceremonial manner, with an escort of six dogs who -closely surrounded him and growled if anyone came too near. Frequently he -did not even appear on Sunday mornings, but issued his orders through one -of the other pigs, usually Squealer. - -One Sunday morning Squealer announced that the hens, who had just come in -to lay again, must surrender their eggs. Napoleon had accepted, through -Whymper, a contract for four hundred eggs a week. The price of these would -pay for enough grain and meal to keep the farm going till summer came on -and conditions were easier. - -When the hens heard this, they raised a terrible outcry. They had been -warned earlier that this sacrifice might be necessary, but had not -believed that it would really happen. They were just getting their -clutches ready for the spring sitting, and they protested that to take the -eggs away now was murder. For the first time since the expulsion of Jones, -there was something resembling a rebellion. Led by three young Black -Minorca pullets, the hens made a determined effort to thwart Napoleon's -wishes. Their method was to fly up to the rafters and there lay their -eggs, which smashed to pieces on the floor. Napoleon acted swiftly and -ruthlessly. He ordered the hens' rations to be stopped, and decreed that -any animal giving so much as a grain of corn to a hen should be punished -by death. The dogs saw to it that these orders were carried out. For five -days the hens held out, then they capitulated and went back to their -nesting boxes. Nine hens had died in the meantime. Their bodies were -buried in the orchard, and it was given out that they had died of -coccidiosis. Whymper heard nothing of this affair, and the eggs were duly -delivered, a grocer's van driving up to the farm once a week to take them -away. - -All this while no more had been seen of Snowball. He was rumoured to be -hiding on one of the neighbouring farms, either Foxwood or Pinchfield. -Napoleon was by this time on slightly better terms with the other farmers -than before. It happened that there was in the yard a pile of timber which -had been stacked there ten years earlier when a beech spinney was cleared. -It was well seasoned, and Whymper had advised Napoleon to sell it; both -Mr. Pilkington and Mr. Frederick were anxious to buy it. Napoleon was -hesitating between the two, unable to make up his mind. It was noticed -that whenever he seemed on the point of coming to an agreement with -Frederick, Snowball was declared to be in hiding at Foxwood, while, when -he inclined toward Pilkington, Snowball was said to be at Pinchfield. - -Suddenly, early in the spring, an alarming thing was discovered. Snowball -was secretly frequenting the farm by night! The animals were so disturbed -that they could hardly sleep in their stalls. Every night, it was said, he -came creeping in under cover of darkness and performed all kinds of -mischief. He stole the corn, he upset the milk-pails, he broke the eggs, -he trampled the seedbeds, he gnawed the bark off the fruit trees. Whenever -anything went wrong it became usual to attribute it to Snowball. If a -window was broken or a drain was blocked up, someone was certain to say -that Snowball had come in the night and done it, and when the key of the -store-shed was lost, the whole farm was convinced that Snowball had thrown -it down the well. Curiously enough, they went on believing this even after -the mislaid key was found under a sack of meal. The cows declared -unanimously that Snowball crept into their stalls and milked them in their -sleep. The rats, which had been troublesome that winter, were also said to -be in league with Snowball. - -Napoleon decreed that there should be a full investigation into Snowball's -activities. With his dogs in attendance he set out and made a careful tour -of inspection of the farm buildings, the other animals following at a -respectful distance. At every few steps Napoleon stopped and snuffed the -ground for traces of Snowball's footsteps, which, he said, he could detect -by the smell. He snuffed in every corner, in the barn, in the cow-shed, -in the henhouses, in the vegetable garden, and found traces of Snowball -almost everywhere. He would put his snout to the ground, give several deep -sniffs, ad exclaim in a terrible voice, "Snowball! He has been here! I can -smell him distinctly!" and at the word "Snowball" all the dogs let out -blood-curdling growls and showed their side teeth. - -The animals were thoroughly frightened. It seemed to them as though -Snowball were some kind of invisible influence, pervading the air about -them and menacing them with all kinds of dangers. In the evening Squealer -called them together, and with an alarmed expression on his face told -them that he had some serious news to report. - -"Comrades!" cried Squealer, making little nervous skips, "a most terrible -thing has been discovered. Snowball has sold himself to Frederick of -Pinchfield Farm, who is even now plotting to attack us and take our farm -away from us! Snowball is to act as his guide when the attack begins. But -there is worse than that. We had thought that Snowball's rebellion was -caused simply by his vanity and ambition. But we were wrong, comrades. Do -you know what the real reason was? Snowball was in league with Jones from -the very start! He was Jones's secret agent all the time. It has all been -proved by documents which he left behind him and which we have only just -discovered. To my mind this explains a great deal, comrades. Did we not -see for ourselves how he attempted--fortunately without success--to get us -defeated and destroyed at the Battle of the Cowshed?" - -The animals were stupefied. This was a wickedness far outdoing Snowball's -destruction of the windmill. But it was some minutes before they could -fully take it in. They all remembered, or thought they remembered, how -they had seen Snowball charging ahead of them at the Battle of the -Cowshed, how he had rallied and encouraged them at every turn, and how he -had not paused for an instant even when the pellets from Jones's gun had -wounded his back. At first it was a little difficult to see how this -fitted in with his being on Jones's side. Even Boxer, who seldom asked -questions, was puzzled. He lay down, tucked his fore hoofs beneath him, -shut his eyes, and with a hard effort managed to formulate his thoughts. - -"I do not believe that," he said. "Snowball fought bravely at the Battle -of the Cowshed. I saw him myself. Did we not give him 'Animal Hero, first -Class,' immediately afterwards?" - -"That was our mistake, comrade. For we know now--it is all written down in -the secret documents that we have found--that in reality he was trying to -lure us to our doom." - -"But he was wounded," said Boxer. "We all saw him running with blood." - -"That was part of the arrangement!" cried Squealer. "Jones's shot only -grazed him. I could show you this in his own writing, if you were able to -read it. The plot was for Snowball, at the critical moment, to give the -signal for flight and leave the field to the enemy. And he very nearly -succeeded--I will even say, comrades, he WOULD have succeeded if it had -not been for our heroic Leader, Comrade Napoleon. Do you not remember how, -just at the moment when Jones and his men had got inside the yard, -Snowball suddenly turned and fled, and many animals followed him? And do -you not remember, too, that it was just at that moment, when panic was -spreading and all seemed lost, that Comrade Napoleon sprang forward with a -cry of 'Death to Humanity!' and sank his teeth in Jones's leg? Surely you -remember THAT, comrades?" exclaimed Squealer, frisking from side to side. - -Now when Squealer described the scene so graphically, it seemed to the -animals that they did remember it. At any rate, they remembered that at -the critical moment of the battle Snowball had turned to flee. But Boxer -was still a little uneasy. - -"I do not believe that Snowball was a traitor at the beginning," he said -finally. "What he has done since is different. But I believe that at the -Battle of the Cowshed he was a good comrade." - -"Our Leader, Comrade Napoleon," announced Squealer, speaking very slowly -and firmly, "has stated categorically--categorically, comrade--that -Snowball was Jones's agent from the very beginning--yes, and from long -before the Rebellion was ever thought of." - -"Ah, that is different!" said Boxer. "If Comrade Napoleon says it, it must -be right." - -"That is the true spirit, comrade!" cried Squealer, but it was noticed he -cast a very ugly look at Boxer with his little twinkling eyes. He turned -to go, then paused and added impressively: "I warn every animal on this -farm to keep his eyes very wide open. For we have reason to think that -some of Snowball's secret agents are lurking among us at this moment!" - -Four days later, in the late afternoon, Napoleon ordered all the animals -to assemble in the yard. When they were all gathered together, Napoleon -emerged from the farmhouse, wearing both his medals (for he had recently -awarded himself "Animal Hero, First Class", and "Animal Hero, Second -Class"), with his nine huge dogs frisking round him and uttering growls -that sent shivers down all the animals' spines. They all cowered silently -in their places, seeming to know in advance that some terrible thing was -about to happen. - -Napoleon stood sternly surveying his audience; then he uttered a -high-pitched whimper. Immediately the dogs bounded forward, seized four of -the pigs by the ear and dragged them, squealing with pain and terror, to -Napoleon's feet. The pigs' ears were bleeding, the dogs had tasted blood, -and for a few moments they appeared to go quite mad. To the amazement of -everybody, three of them flung themselves upon Boxer. Boxer saw them -coming and put out his great hoof, caught a dog in mid-air, and pinned -him to the ground. The dog shrieked for mercy and the other two fled with -their tails between their legs. Boxer looked at Napoleon to know whether -he should crush the dog to death or let it go. Napoleon appeared to change -countenance, and sharply ordered Boxer to let the dog go, whereat Boxer -lifted his hoof, and the dog slunk away, bruised and howling. - -Presently the tumult died down. The four pigs waited, trembling, with -guilt written on every line of their countenances. Napoleon now called -upon them to confess their crimes. They were the same four pigs as had -protested when Napoleon abolished the Sunday Meetings. Without any further -prompting they confessed that they had been secretly in touch with -Snowball ever since his expulsion, that they had collaborated with him in -destroying the windmill, and that they had entered into an agreement with -him to hand over Animal Farm to Mr. Frederick. They added that Snowball -had privately admitted to them that he had been Jones's secret agent for -years past. When they had finished their confession, the dogs promptly -tore their throats out, and in a terrible voice Napoleon demanded whether -any other animal had anything to confess. - -The three hens who had been the ringleaders in the attempted rebellion -over the eggs now came forward and stated that Snowball had appeared to -them in a dream and incited them to disobey Napoleon's orders. They, too, -were slaughtered. Then a goose came forward and confessed to having -secreted six ears of corn during the last year's harvest and eaten them in -the night. Then a sheep confessed to having urinated in the drinking -pool--urged to do this, so she said, by Snowball--and two other sheep -confessed to having murdered an old ram, an especially devoted follower of -Napoleon, by chasing him round and round a bonfire when he was suffering -from a cough. They were all slain on the spot. And so the tale of -confessions and executions went on, until there was a pile of corpses -lying before Napoleon's feet and the air was heavy with the smell of -blood, which had been unknown there since the expulsion of Jones. - -When it was all over, the remaining animals, except for the pigs and dogs, -crept away in a body. They were shaken and miserable. They did not know -which was more shocking--the treachery of the animals who had leagued -themselves with Snowball, or the cruel retribution they had just -witnessed. In the old days there had often been scenes of bloodshed -equally terrible, but it seemed to all of them that it was far worse now -that it was happening among themselves. Since Jones had left the farm, -until today, no animal had killed another animal. Not even a rat had been -killed. They had made their way on to the little knoll where the -half-finished windmill stood, and with one accord they all lay down as -though huddling together for warmth--Clover, Muriel, Benjamin, the cows, -the sheep, and a whole flock of geese and hens--everyone, indeed, except -the cat, who had suddenly disappeared just before Napoleon ordered the -animals to assemble. For some time nobody spoke. Only Boxer remained on -his feet. He fidgeted to and fro, swishing his long black tail against his -sides and occasionally uttering a little whinny of surprise. Finally he -said: - -"I do not understand it. I would not have believed that such things could -happen on our farm. It must be due to some fault in ourselves. The -solution, as I see it, is to work harder. From now onwards I shall get up -a full hour earlier in the mornings." - -And he moved off at his lumbering trot and made for the quarry. Having got -there, he collected two successive loads of stone and dragged them down to -the windmill before retiring for the night. - -The animals huddled about Clover, not speaking. The knoll where they were -lying gave them a wide prospect across the countryside. Most of Animal -Farm was within their view--the long pasture stretching down to the main -road, the hayfield, the spinney, the drinking pool, the ploughed fields -where the young wheat was thick and green, and the red roofs of the farm -buildings with the smoke curling from the chimneys. It was a clear spring -evening. The grass and the bursting hedges were gilded by the level rays -of the sun. Never had the farm--and with a kind of surprise they -remembered that it was their own farm, every inch of it their own -property--appeared to the animals so desirable a place. As Clover looked -down the hillside her eyes filled with tears. If she could have spoken her -thoughts, it would have been to say that this was not what they had aimed -at when they had set themselves years ago to work for the overthrow of the -human race. These scenes of terror and slaughter were not what they had -looked forward to on that night when old Major first stirred them to -rebellion. If she herself had had any picture of the future, it had been -of a society of animals set free from hunger and the whip, all equal, each -working according to his capacity, the strong protecting the weak, as she -had protected the lost brood of ducklings with her foreleg on the night of -Major's speech. Instead--she did not know why--they had come to a time -when no one dared speak his mind, when fierce, growling dogs roamed -everywhere, and when you had to watch your comrades torn to pieces after -confessing to shocking crimes. There was no thought of rebellion or -disobedience in her mind. She knew that, even as things were, they were -far better off than they had been in the days of Jones, and that before -all else it was needful to prevent the return of the human beings. -Whatever happened she would remain faithful, work hard, carry out the -orders that were given to her, and accept the leadership of Napoleon. But -still, it was not for this that she and all the other animals had hoped -and toiled. It was not for this that they had built the windmill and faced -the bullets of Jones's gun. Such were her thoughts, though she lacked the -words to express them. - -At last, feeling this to be in some way a substitute for the words she was -unable to find, she began to sing 'Beasts of England'. The other animals -sitting round her took it up, and they sang it three times over--very -tunefully, but slowly and mournfully, in a way they had never sung it -before. - -They had just finished singing it for the third time when Squealer, -attended by two dogs, approached them with the air of having something -important to say. He announced that, by a special decree of Comrade -Napoleon, 'Beasts of England' had been abolished. From now onwards it was -forbidden to sing it. - -The animals were taken aback. - -"Why?" cried Muriel. - -"It's no longer needed, comrade," said Squealer stiffly. "'Beasts of -England' was the song of the Rebellion. But the Rebellion is now -completed. The execution of the traitors this afternoon was the final act. -The enemy both external and internal has been defeated. In 'Beasts of -England' we expressed our longing for a better society in days to come. -But that society has now been established. Clearly this song has no longer -any purpose." - -Frightened though they were, some of the animals might possibly have -protested, but at this moment the sheep set up their usual bleating of -"Four legs good, two legs bad," which went on for several minutes and put -an end to the discussion. - -So 'Beasts of England' was heard no more. In its place Minimus, the poet, -had composed another song which began: - - -Animal Farm, Animal Farm, -Never through me shalt thou come to harm! - - -and this was sung every Sunday morning after the hoisting of the flag. -But somehow neither the words nor the tune ever seemed to the animals to -come up to 'Beasts of England'. - - - - - Chapter VIII - - - -A few days later, when the terror caused by the executions had died down, -some of the animals remembered--or thought they remembered--that the Sixth -Commandment decreed "No animal shall kill any other animal." And though no -one cared to mention it in the hearing of the pigs or the dogs, it was -felt that the killings which had taken place did not square with this. -Clover asked Benjamin to read her the Sixth Commandment, and when -Benjamin, as usual, said that he refused to meddle in such matters, she -fetched Muriel. Muriel read the Commandment for her. It ran: "No animal -shall kill any other animal WITHOUT CAUSE." Somehow or other, the last two -words had slipped out of the animals' memory. But they saw now that the -Commandment had not been violated; for clearly there was good reason for -killing the traitors who had leagued themselves with Snowball. - -Throughout the year the animals worked even harder than they had worked in -the previous year. To rebuild the windmill, with walls twice as thick as -before, and to finish it by the appointed date, together with the regular -work of the farm, was a tremendous labour. There were times when it seemed -to the animals that they worked longer hours and fed no better than they -had done in Jones's day. On Sunday mornings Squealer, holding down a long -strip of paper with his trotter, would read out to them lists of figures -proving that the production of every class of foodstuff had increased by -two hundred per cent, three hundred per cent, or five hundred per cent, -as the case might be. The animals saw no reason to disbelieve him, -especially as they could no longer remember very clearly what conditions -had been like before the Rebellion. All the same, there were days when -they felt that they would sooner have had less figures and more food. - -All orders were now issued through Squealer or one of the other pigs. -Napoleon himself was not seen in public as often as once in a fortnight. -When he did appear, he was attended not only by his retinue of dogs but by -a black cockerel who marched in front of him and acted as a kind of -trumpeter, letting out a loud "cock-a-doodle-doo" before Napoleon spoke. -Even in the farmhouse, it was said, Napoleon inhabited separate apartments -from the others. He took his meals alone, with two dogs to wait upon him, -and always ate from the Crown Derby dinner service which had been in the -glass cupboard in the drawing-room. It was also announced that the gun -would be fired every year on Napoleon's birthday, as well as on the other -two anniversaries. - -Napoleon was now never spoken of simply as "Napoleon." He was always -referred to in formal style as "our Leader, Comrade Napoleon," and this -pigs liked to invent for him such titles as Father of All Animals, Terror -of Mankind, Protector of the Sheep-fold, Ducklings' Friend, and the like. -In his speeches, Squealer would talk with the tears rolling down his -cheeks of Napoleon's wisdom the goodness of his heart, and the deep love -he bore to all animals everywhere, even and especially the unhappy animals -who still lived in ignorance and slavery on other farms. It had become -usual to give Napoleon the credit for every successful achievement and -every stroke of good fortune. You would often hear one hen remark to -another, "Under the guidance of our Leader, Comrade Napoleon, I have laid -five eggs in six days"; or two cows, enjoying a drink at the pool, would -exclaim, "Thanks to the leadership of Comrade Napoleon, how excellent this -water tastes!" The general feeling on the farm was well expressed in a -poem entitled Comrade Napoleon, which was composed by Minimus and which -ran as follows: - - -Friend of fatherless! -Fountain of happiness! -Lord of the swill-bucket! Oh, how my soul is on -Fire when I gaze at thy -Calm and commanding eye, -Like the sun in the sky, -Comrade Napoleon! - -Thou are the giver of -All that thy creatures love, -Full belly twice a day, clean straw to roll upon; -Every beast great or small -Sleeps at peace in his stall, -Thou watchest over all, -Comrade Napoleon! - -Had I a sucking-pig, -Ere he had grown as big -Even as a pint bottle or as a rolling-pin, -He should have learned to be -Faithful and true to thee, -Yes, his first squeak should be -"Comrade Napoleon!" - - -Napoleon approved of this poem and caused it to be inscribed on the wall -of the big barn, at the opposite end from the Seven Commandments. It was -surmounted by a portrait of Napoleon, in profile, executed by Squealer in -white paint. - -Meanwhile, through the agency of Whymper, Napoleon was engaged in -complicated negotiations with Frederick and Pilkington. The pile of timber -was still unsold. Of the two, Frederick was the more anxious to get hold -of it, but he would not offer a reasonable price. At the same time there -were renewed rumours that Frederick and his men were plotting to attack -Animal Farm and to destroy the windmill, the building of which had aroused -furious jealousy in him. Snowball was known to be still skulking on -Pinchfield Farm. In the middle of the summer the animals were alarmed to -hear that three hens had come forward and confessed that, inspired by -Snowball, they had entered into a plot to murder Napoleon. They were -executed immediately, and fresh precautions for Napoleon's safety were -taken. Four dogs guarded his bed at night, one at each corner, and a young -pig named Pinkeye was given the task of tasting all his food before he ate -it, lest it should be poisoned. - -At about the same time it was given out that Napoleon had arranged to sell -the pile of timber to Mr. Pilkington; he was also going to enter into a -regular agreement for the exchange of certain products between Animal Farm -and Foxwood. The relations between Napoleon and Pilkington, though they -were only conducted through Whymper, were now almost friendly. The animals -distrusted Pilkington, as a human being, but greatly preferred him to -Frederick, whom they both feared and hated. As the summer wore on, and the -windmill neared completion, the rumours of an impending treacherous attack -grew stronger and stronger. Frederick, it was said, intended to bring -against them twenty men all armed with guns, and he had already bribed the -magistrates and police, so that if he could once get hold of the -title-deeds of Animal Farm they would ask no questions. Moreover, terrible -stories were leaking out from Pinchfield about the cruelties that -Frederick practised upon his animals. He had flogged an old horse to -death, he starved his cows, he had killed a dog by throwing it into the -furnace, he amused himself in the evenings by making cocks fight with -splinters of razor-blade tied to their spurs. The animals' blood boiled -with rage when they heard of these things being done to their comrades, -and sometimes they clamoured to be allowed to go out in a body and attack -Pinchfield Farm, drive out the humans, and set the animals free. But -Squealer counselled them to avoid rash actions and trust in Comrade -Napoleon's strategy. - -Nevertheless, feeling against Frederick continued to run high. One Sunday -morning Napoleon appeared in the barn and explained that he had never at -any time contemplated selling the pile of timber to Frederick; he -considered it beneath his dignity, he said, to have dealings with -scoundrels of that description. The pigeons who were still sent out to -spread tidings of the Rebellion were forbidden to set foot anywhere on -Foxwood, and were also ordered to drop their former slogan of "Death to -Humanity" in favour of "Death to Frederick." In the late summer yet -another of Snowball's machinations was laid bare. The wheat crop was full -of weeds, and it was discovered that on one of his nocturnal visits -Snowball had mixed weed seeds with the seed corn. A gander who had been -privy to the plot had confessed his guilt to Squealer and immediately -committed suicide by swallowing deadly nightshade berries. The animals -now also learned that Snowball had never--as many of them had believed -hitherto--received the order of "Animal Hero, First Class." This was -merely a legend which had been spread some time after the Battle of the -Cowshed by Snowball himself. So far from being decorated, he had been -censured for showing cowardice in the battle. Once again some of the -animals heard this with a certain bewilderment, but Squealer was soon able -to convince them that their memories had been at fault. - -In the autumn, by a tremendous, exhausting effort--for the harvest had to -be gathered at almost the same time--the windmill was finished. The -machinery had still to be installed, and Whymper was negotiating the -purchase of it, but the structure was completed. In the teeth of every -difficulty, in spite of inexperience, of primitive implements, of bad luck -and of Snowball's treachery, the work had been finished punctually to the -very day! Tired out but proud, the animals walked round and round their -masterpiece, which appeared even more beautiful in their eyes than when it -had been built the first time. Moreover, the walls were twice as thick as -before. Nothing short of explosives would lay them low this time! And when -they thought of how they had laboured, what discouragements they had -overcome, and the enormous difference that would be made in their lives -when the sails were turning and the dynamos running--when they thought of -all this, their tiredness forsook them and they gambolled round and round -the windmill, uttering cries of triumph. Napoleon himself, attended by his -dogs and his cockerel, came down to inspect the completed work; he -personally congratulated the animals on their achievement, and announced -that the mill would be named Napoleon Mill. - -Two days later the animals were called together for a special meeting in -the barn. They were struck dumb with surprise when Napoleon announced that -he had sold the pile of timber to Frederick. Tomorrow Frederick's wagons -would arrive and begin carting it away. Throughout the whole period of his -seeming friendship with Pilkington, Napoleon had really been in secret -agreement with Frederick. - -All relations with Foxwood had been broken off; insulting messages had -been sent to Pilkington. The pigeons had been told to avoid Pinchfield -Farm and to alter their slogan from "Death to Frederick" to "Death to -Pilkington." At the same time Napoleon assured the animals that the -stories of an impending attack on Animal Farm were completely untrue, and -that the tales about Frederick's cruelty to his own animals had been -greatly exaggerated. All these rumours had probably originated with -Snowball and his agents. It now appeared that Snowball was not, after all, -hiding on Pinchfield Farm, and in fact had never been there in his life: -he was living--in considerable luxury, so it was said--at Foxwood, and had -in reality been a pensioner of Pilkington for years past. - -The pigs were in ecstasies over Napoleon's cunning. By seeming to be -friendly with Pilkington he had forced Frederick to raise his price by -twelve pounds. But the superior quality of Napoleon's mind, said Squealer, -was shown in the fact that he trusted nobody, not even Frederick. -Frederick had wanted to pay for the timber with something called a cheque, -which, it seemed, was a piece of paper with a promise to pay written upon -it. But Napoleon was too clever for him. He had demanded payment in real -five-pound notes, which were to be handed over before the timber was -removed. Already Frederick had paid up; and the sum he had paid was just -enough to buy the machinery for the windmill. - -Meanwhile the timber was being carted away at high speed. When it was all -gone, another special meeting was held in the barn for the animals to -inspect Frederick's bank-notes. Smiling beatifically, and wearing both his -decorations, Napoleon reposed on a bed of straw on the platform, with the -money at his side, neatly piled on a china dish from the farmhouse -kitchen. The animals filed slowly past, and each gazed his fill. And Boxer -put out his nose to sniff at the bank-notes, and the flimsy white things -stirred and rustled in his breath. - -Three days later there was a terrible hullabaloo. Whymper, his face deadly -pale, came racing up the path on his bicycle, flung it down in the yard -and rushed straight into the farmhouse. The next moment a choking roar of -rage sounded from Napoleon's apartments. The news of what had happened -sped round the farm like wildfire. The banknotes were forgeries! Frederick -had got the timber for nothing! - -Napoleon called the animals together immediately and in a terrible voice -pronounced the death sentence upon Frederick. When captured, he said, -Frederick should be boiled alive. At the same time he warned them that -after this treacherous deed the worst was to be expected. Frederick and -his men might make their long-expected attack at any moment. Sentinels -were placed at all the approaches to the farm. In addition, four pigeons -were sent to Foxwood with a conciliatory message, which it was hoped might -re-establish good relations with Pilkington. - -The very next morning the attack came. The animals were at breakfast when -the look-outs came racing in with the news that Frederick and his -followers had already come through the five-barred gate. Boldly enough the -animals sallied forth to meet them, but this time they did not have the -easy victory that they had had in the Battle of the Cowshed. There were -fifteen men, with half a dozen guns between them, and they opened fire as -soon as they got within fifty yards. The animals could not face the -terrible explosions and the stinging pellets, and in spite of the efforts -of Napoleon and Boxer to rally them, they were soon driven back. A number -of them were already wounded. They took refuge in the farm buildings and -peeped cautiously out from chinks and knot-holes. The whole of the big -pasture, including the windmill, was in the hands of the enemy. For the -moment even Napoleon seemed at a loss. He paced up and down without a -word, his tail rigid and twitching. Wistful glances were sent in the -direction of Foxwood. If Pilkington and his men would help them, the day -might yet be won. But at this moment the four pigeons, who had been sent -out on the day before, returned, one of them bearing a scrap of paper from -Pilkington. On it was pencilled the words: "Serves you right." - -Meanwhile Frederick and his men had halted about the windmill. The animals -watched them, and a murmur of dismay went round. Two of the men had -produced a crowbar and a sledge hammer. They were going to knock the -windmill down. - -"Impossible!" cried Napoleon. "We have built the walls far too thick for -that. They could not knock it down in a week. Courage, comrades!" - -But Benjamin was watching the movements of the men intently. The two with -the hammer and the crowbar were drilling a hole near the base of the -windmill. Slowly, and with an air almost of amusement, Benjamin nodded his -long muzzle. - -"I thought so," he said. "Do you not see what they are doing? In another -moment they are going to pack blasting powder into that hole." - -Terrified, the animals waited. It was impossible now to venture out of the -shelter of the buildings. After a few minutes the men were seen to be -running in all directions. Then there was a deafening roar. The pigeons -swirled into the air, and all the animals, except Napoleon, flung -themselves flat on their bellies and hid their faces. When they got up -again, a huge cloud of black smoke was hanging where the windmill had -been. Slowly the breeze drifted it away. The windmill had ceased to exist! - -At this sight the animals' courage returned to them. The fear and despair -they had felt a moment earlier were drowned in their rage against this -vile, contemptible act. A mighty cry for vengeance went up, and without -waiting for further orders they charged forth in a body and made straight -for the enemy. This time they did not heed the cruel pellets that swept -over them like hail. It was a savage, bitter battle. The men fired again -and again, and, when the animals got to close quarters, lashed out with -their sticks and their heavy boots. A cow, three sheep, and two geese were -killed, and nearly everyone was wounded. Even Napoleon, who was directing -operations from the rear, had the tip of his tail chipped by a pellet. But -the men did not go unscathed either. Three of them had their heads broken -by blows from Boxer's hoofs; another was gored in the belly by a cow's -horn; another had his trousers nearly torn off by Jessie and Bluebell. And -when the nine dogs of Napoleon's own bodyguard, whom he had instructed to -make a detour under cover of the hedge, suddenly appeared on the men's -flank, baying ferociously, panic overtook them. They saw that they were in -danger of being surrounded. Frederick shouted to his men to get out while -the going was good, and the next moment the cowardly enemy was running for -dear life. The animals chased them right down to the bottom of the field, -and got in some last kicks at them as they forced their way through the -thorn hedge. - -They had won, but they were weary and bleeding. Slowly they began to limp -back towards the farm. The sight of their dead comrades stretched upon the -grass moved some of them to tears. And for a little while they halted in -sorrowful silence at the place where the windmill had once stood. Yes, it -was gone; almost the last trace of their labour was gone! Even the -foundations were partially destroyed. And in rebuilding it they could not -this time, as before, make use of the fallen stones. This time the stones -had vanished too. The force of the explosion had flung them to distances -of hundreds of yards. It was as though the windmill had never been. - -As they approached the farm Squealer, who had unaccountably been absent -during the fighting, came skipping towards them, whisking his tail and -beaming with satisfaction. And the animals heard, from the direction of -the farm buildings, the solemn booming of a gun. - -"What is that gun firing for?" said Boxer. - -"To celebrate our victory!" cried Squealer. - -"What victory?" said Boxer. His knees were bleeding, he had lost a shoe -and split his hoof, and a dozen pellets had lodged themselves in his hind -leg. - -"What victory, comrade? Have we not driven the enemy off our soil--the -sacred soil of Animal Farm?" - -"But they have destroyed the windmill. And we had worked on it for two -years!" - -"What matter? We will build another windmill. We will build six windmills -if we feel like it. You do not appreciate, comrade, the mighty thing that -we have done. The enemy was in occupation of this very ground that we -stand upon. And now--thanks to the leadership of Comrade Napoleon--we have -won every inch of it back again!" - -"Then we have won back what we had before," said Boxer. - -"That is our victory," said Squealer. - -They limped into the yard. The pellets under the skin of Boxer's leg -smarted painfully. He saw ahead of him the heavy labour of rebuilding the -windmill from the foundations, and already in imagination he braced -himself for the task. But for the first time it occurred to him that he -was eleven years old and that perhaps his great muscles were not quite -what they had once been. - -But when the animals saw the green flag flying, and heard the gun firing -again--seven times it was fired in all--and heard the speech that Napoleon -made, congratulating them on their conduct, it did seem to them after all -that they had won a great victory. The animals slain in the battle were -given a solemn funeral. Boxer and Clover pulled the wagon which served as -a hearse, and Napoleon himself walked at the head of the procession. Two -whole days were given over to celebrations. There were songs, speeches, -and more firing of the gun, and a special gift of an apple was bestowed on -every animal, with two ounces of corn for each bird and three biscuits for -each dog. It was announced that the battle would be called the Battle of -the Windmill, and that Napoleon had created a new decoration, the Order -of the Green Banner, which he had conferred upon himself. In the general -rejoicings the unfortunate affair of the banknotes was forgotten. - -It was a few days later than this that the pigs came upon a case of whisky -in the cellars of the farmhouse. It had been overlooked at the time when -the house was first occupied. That night there came from the farmhouse the -sound of loud singing, in which, to everyone's surprise, the strains of -'Beasts of England' were mixed up. At about half past nine Napoleon, -wearing an old bowler hat of Mr. Jones's, was distinctly seen to emerge -from the back door, gallop rapidly round the yard, and disappear indoors -again. But in the morning a deep silence hung over the farmhouse. Not a -pig appeared to be stirring. It was nearly nine o'clock when Squealer made -his appearance, walking slowly and dejectedly, his eyes dull, his tail -hanging limply behind him, and with every appearance of being seriously -ill. He called the animals together and told them that he had a terrible -piece of news to impart. Comrade Napoleon was dying! - -A cry of lamentation went up. Straw was laid down outside the doors of the -farmhouse, and the animals walked on tiptoe. With tears in their eyes they -asked one another what they should do if their Leader were taken away from -them. A rumour went round that Snowball had after all contrived to -introduce poison into Napoleon's food. At eleven o'clock Squealer came -out to make another announcement. As his last act upon earth, Comrade -Napoleon had pronounced a solemn decree: the drinking of alcohol was to be -punished by death. - -By the evening, however, Napoleon appeared to be somewhat better, and the -following morning Squealer was able to tell them that he was well on the -way to recovery. By the evening of that day Napoleon was back at work, and -on the next day it was learned that he had instructed Whymper to purchase -in Willingdon some booklets on brewing and distilling. A week later -Napoleon gave orders that the small paddock beyond the orchard, which it -had previously been intended to set aside as a grazing-ground for animals -who were past work, was to be ploughed up. It was given out that the -pasture was exhausted and needed re-seeding; but it soon became known that -Napoleon intended to sow it with barley. - -About this time there occurred a strange incident which hardly anyone was -able to understand. One night at about twelve o'clock there was a loud -crash in the yard, and the animals rushed out of their stalls. It was a -moonlit night. At the foot of the end wall of the big barn, where the -Seven Commandments were written, there lay a ladder broken in two pieces. -Squealer, temporarily stunned, was sprawling beside it, and near at hand -there lay a lantern, a paint-brush, and an overturned pot of white paint. -The dogs immediately made a ring round Squealer, and escorted him back to -the farmhouse as soon as he was able to walk. None of the animals could -form any idea as to what this meant, except old Benjamin, who nodded his -muzzle with a knowing air, and seemed to understand, but would say nothing. - -But a few days later Muriel, reading over the Seven Commandments to -herself, noticed that there was yet another of them which the animals had -remembered wrong. They had thought the Fifth Commandment was "No animal -shall drink alcohol," but there were two words that they had forgotten. -Actually the Commandment read: "No animal shall drink alcohol TO EXCESS." - - - - - Chapter IX - - - -Boxer's split hoof was a long time in healing. They had started the -rebuilding of the windmill the day after the victory celebrations were -ended. Boxer refused to take even a day off work, and made it a point of -honour not to let it be seen that he was in pain. In the evenings he would -admit privately to Clover that the hoof troubled him a great deal. Clover -treated the hoof with poultices of herbs which she prepared by chewing -them, and both she and Benjamin urged Boxer to work less hard. "A horse's -lungs do not last for ever," she said to him. But Boxer would not listen. -He had, he said, only one real ambition left--to see the windmill well -under way before he reached the age for retirement. - -At the beginning, when the laws of Animal Farm were first formulated, -the retiring age had been fixed for horses and pigs at twelve, for cows at -fourteen, for dogs at nine, for sheep at seven, and for hens and geese at -five. Liberal old-age pensions had been agreed upon. As yet no animal had -actually retired on pension, but of late the subject had been discussed -more and more. Now that the small field beyond the orchard had been set -aside for barley, it was rumoured that a corner of the large pasture was -to be fenced off and turned into a grazing-ground for superannuated -animals. For a horse, it was said, the pension would be five pounds of -corn a day and, in winter, fifteen pounds of hay, with a carrot or -possibly an apple on public holidays. Boxer's twelfth birthday was due in -the late summer of the following year. - -Meanwhile life was hard. The winter was as cold as the last one had been, -and food was even shorter. Once again all rations were reduced, except -those of the pigs and the dogs. A too rigid equality in rations, Squealer -explained, would have been contrary to the principles of Animalism. In any -case he had no difficulty in proving to the other animals that they were -NOT in reality short of food, whatever the appearances might be. For the -time being, certainly, it had been found necessary to make a readjustment -of rations (Squealer always spoke of it as a "readjustment," never as a -"reduction"), but in comparison with the days of Jones, the improvement -was enormous. Reading out the figures in a shrill, rapid voice, he proved -to them in detail that they had more oats, more hay, more turnips than -they had had in Jones's day, that they worked shorter hours, that their -drinking water was of better quality, that they lived longer, that a -larger proportion of their young ones survived infancy, and that they had -more straw in their stalls and suffered less from fleas. The animals -believed every word of it. Truth to tell, Jones and all he stood for had -almost faded out of their memories. They knew that life nowadays was harsh -and bare, that they were often hungry and often cold, and that they were -usually working when they were not asleep. But doubtless it had been worse -in the old days. They were glad to believe so. Besides, in those days they -had been slaves and now they were free, and that made all the difference, -as Squealer did not fail to point out. - -There were many more mouths to feed now. In the autumn the four sows had -all littered about simultaneously, producing thirty-one young pigs between -them. The young pigs were piebald, and as Napoleon was the only boar on -the farm, it was possible to guess at their parentage. It was announced -that later, when bricks and timber had been purchased, a schoolroom would -be built in the farmhouse garden. For the time being, the young pigs were -given their instruction by Napoleon himself in the farmhouse kitchen. They -took their exercise in the garden, and were discouraged from playing with -the other young animals. About this time, too, it was laid down as a rule -that when a pig and any other animal met on the path, the other animal -must stand aside: and also that all pigs, of whatever degree, were to have -the privilege of wearing green ribbons on their tails on Sundays. - -The farm had had a fairly successful year, but was still short of money. -There were the bricks, sand, and lime for the schoolroom to be purchased, -and it would also be necessary to begin saving up again for the machinery -for the windmill. Then there were lamp oil and candles for the house, -sugar for Napoleon's own table (he forbade this to the other pigs, on the -ground that it made them fat), and all the usual replacements such as -tools, nails, string, coal, wire, scrap-iron, and dog biscuits. A stump of -hay and part of the potato crop were sold off, and the contract for eggs -was increased to six hundred a week, so that that year the hens barely -hatched enough chicks to keep their numbers at the same level. Rations, -reduced in December, were reduced again in February, and lanterns in the -stalls were forbidden to save oil. But the pigs seemed comfortable enough, -and in fact were putting on weight if anything. One afternoon in late -February a warm, rich, appetising scent, such as the animals had never -smelt before, wafted itself across the yard from the little brew-house, -which had been disused in Jones's time, and which stood beyond the -kitchen. Someone said it was the smell of cooking barley. The animals -sniffed the air hungrily and wondered whether a warm mash was being -prepared for their supper. But no warm mash appeared, and on the following -Sunday it was announced that from now onwards all barley would be reserved -for the pigs. The field beyond the orchard had already been sown with -barley. And the news soon leaked out that every pig was now receiving a -ration of a pint of beer daily, with half a gallon for Napoleon himself, -which was always served to him in the Crown Derby soup tureen. - -But if there were hardships to be borne, they were partly offset by the -fact that life nowadays had a greater dignity than it had had before. -There were more songs, more speeches, more processions. Napoleon had -commanded that once a week there should be held something called a -Spontaneous Demonstration, the object of which was to celebrate the -struggles and triumphs of Animal Farm. At the appointed time the animals -would leave their work and march round the precincts of the farm in -military formation, with the pigs leading, then the horses, then the cows, -then the sheep, and then the poultry. The dogs flanked the procession and -at the head of all marched Napoleon's black cockerel. Boxer and Clover -always carried between them a green banner marked with the hoof and the -horn and the caption, "Long live Comrade Napoleon!" Afterwards there were -recitations of poems composed in Napoleon's honour, and a speech by -Squealer giving particulars of the latest increases in the production of -foodstuffs, and on occasion a shot was fired from the gun. The sheep were -the greatest devotees of the Spontaneous Demonstration, and if anyone -complained (as a few animals sometimes did, when no pigs or dogs were near) -that they wasted time and meant a lot of standing about in the cold, the -sheep were sure to silence him with a tremendous bleating of "Four legs -good, two legs bad!" But by and large the animals enjoyed these -celebrations. They found it comforting to be reminded that, after all, -they were truly their own masters and that the work they did was for their -own benefit. So that, what with the songs, the processions, Squealer's -lists of figures, the thunder of the gun, the crowing of the cockerel, -and the fluttering of the flag, they were able to forget that their -bellies were empty, at least part of the time. - -In April, Animal Farm was proclaimed a Republic, and it became necessary -to elect a President. There was only one candidate, Napoleon, who was -elected unanimously. On the same day it was given out that fresh documents -had been discovered which revealed further details about Snowball's -complicity with Jones. It now appeared that Snowball had not, as the -animals had previously imagined, merely attempted to lose the Battle of -the Cowshed by means of a stratagem, but had been openly fighting on -Jones's side. In fact, it was he who had actually been the leader of the -human forces, and had charged into battle with the words "Long live -Humanity!" on his lips. The wounds on Snowball's back, which a few of the -animals still remembered to have seen, had been inflicted by Napoleon's -teeth. - -In the middle of the summer Moses the raven suddenly reappeared on the -farm, after an absence of several years. He was quite unchanged, still did -no work, and talked in the same strain as ever about Sugarcandy Mountain. -He would perch on a stump, flap his black wings, and talk by the hour to -anyone who would listen. "Up there, comrades," he would say solemnly, -pointing to the sky with his large beak--"up there, just on the other side -of that dark cloud that you can see--there it lies, Sugarcandy Mountain, -that happy country where we poor animals shall rest for ever from our -labours!" He even claimed to have been there on one of his higher flights, -and to have seen the everlasting fields of clover and the linseed cake and -lump sugar growing on the hedges. Many of the animals believed him. Their -lives now, they reasoned, were hungry and laborious; was it not right and -just that a better world should exist somewhere else? A thing that was -difficult to determine was the attitude of the pigs towards Moses. They -all declared contemptuously that his stories about Sugarcandy Mountain -were lies, and yet they allowed him to remain on the farm, not working, -with an allowance of a gill of beer a day. - -After his hoof had healed up, Boxer worked harder than ever. Indeed, all -the animals worked like slaves that year. Apart from the regular work of -the farm, and the rebuilding of the windmill, there was the schoolhouse -for the young pigs, which was started in March. Sometimes the long hours -on insufficient food were hard to bear, but Boxer never faltered. In -nothing that he said or did was there any sign that his strength was not -what it had been. It was only his appearance that was a little altered; -his hide was less shiny than it had used to be, and his great haunches -seemed to have shrunken. The others said, "Boxer will pick up when the -spring grass comes on"; but the spring came and Boxer grew no fatter. -Sometimes on the slope leading to the top of the quarry, when he braced -his muscles against the weight of some vast boulder, it seemed that -nothing kept him on his feet except the will to continue. At such times -his lips were seen to form the words, "I will work harder"; he had no -voice left. Once again Clover and Benjamin warned him to take care of his -health, but Boxer paid no attention. His twelfth birthday was approaching. -He did not care what happened so long as a good store of stone was -accumulated before he went on pension. - -Late one evening in the summer, a sudden rumour ran round the farm that -something had happened to Boxer. He had gone out alone to drag a load of -stone down to the windmill. And sure enough, the rumour was true. A few -minutes later two pigeons came racing in with the news; "Boxer has fallen! -He is lying on his side and can't get up!" - -About half the animals on the farm rushed out to the knoll where the -windmill stood. There lay Boxer, between the shafts of the cart, his neck -stretched out, unable even to raise his head. His eyes were glazed, his -sides matted with sweat. A thin stream of blood had trickled out of his -mouth. Clover dropped to her knees at his side. - -"Boxer!" she cried, "how are you?" - -"It is my lung," said Boxer in a weak voice. "It does not matter. I think -you will be able to finish the windmill without me. There is a pretty good -store of stone accumulated. I had only another month to go in any case. -To tell you the truth, I had been looking forward to my retirement. And -perhaps, as Benjamin is growing old too, they will let him retire at the -same time and be a companion to me." - -"We must get help at once," said Clover. "Run, somebody, and tell Squealer -what has happened." - -All the other animals immediately raced back to the farmhouse to give -Squealer the news. Only Clover remained, and Benjamin who lay down at -Boxer's side, and, without speaking, kept the flies off him with his long -tail. After about a quarter of an hour Squealer appeared, full of sympathy -and concern. He said that Comrade Napoleon had learned with the very -deepest distress of this misfortune to one of the most loyal workers on -the farm, and was already making arrangements to send Boxer to be treated -in the hospital at Willingdon. The animals felt a little uneasy at this. -Except for Mollie and Snowball, no other animal had ever left the farm, -and they did not like to think of their sick comrade in the hands of human -beings. However, Squealer easily convinced them that the veterinary -surgeon in Willingdon could treat Boxer's case more satisfactorily than -could be done on the farm. And about half an hour later, when Boxer had -somewhat recovered, he was with difficulty got on to his feet, and managed -to limp back to his stall, where Clover and Benjamin had prepared a good -bed of straw for him. - -For the next two days Boxer remained in his stall. The pigs had sent out a -large bottle of pink medicine which they had found in the medicine chest -in the bathroom, and Clover administered it to Boxer twice a day after -meals. In the evenings she lay in his stall and talked to him, while -Benjamin kept the flies off him. Boxer professed not to be sorry for what -had happened. If he made a good recovery, he might expect to live another -three years, and he looked forward to the peaceful days that he would -spend in the corner of the big pasture. It would be the first time that he -had had leisure to study and improve his mind. He intended, he said, to -devote the rest of his life to learning the remaining twenty-two letters -of the alphabet. - -However, Benjamin and Clover could only be with Boxer after working hours, -and it was in the middle of the day when the van came to take him away. -The animals were all at work weeding turnips under the supervision of a -pig, when they were astonished to see Benjamin come galloping from the -direction of the farm buildings, braying at the top of his voice. It was -the first time that they had ever seen Benjamin excited--indeed, it was -the first time that anyone had ever seen him gallop. "Quick, quick!" he -shouted. "Come at once! They're taking Boxer away!" Without waiting for -orders from the pig, the animals broke off work and raced back to the farm -buildings. Sure enough, there in the yard was a large closed van, drawn by -two horses, with lettering on its side and a sly-looking man in a -low-crowned bowler hat sitting on the driver's seat. And Boxer's stall was -empty. - -The animals crowded round the van. "Good-bye, Boxer!" they chorused, -"good-bye!" - -"Fools! Fools!" shouted Benjamin, prancing round them and stamping the -earth with his small hoofs. "Fools! Do you not see what is written on the -side of that van?" - -That gave the animals pause, and there was a hush. Muriel began to spell -out the words. But Benjamin pushed her aside and in the midst of a deadly -silence he read: - -"'Alfred Simmonds, Horse Slaughterer and Glue Boiler, Willingdon. Dealer -in Hides and Bone-Meal. Kennels Supplied.' Do you not understand what that -means? They are taking Boxer to the knacker's!" - -A cry of horror burst from all the animals. At this moment the man on the -box whipped up his horses and the van moved out of the yard at a smart -trot. All the animals followed, crying out at the tops of their voices. -Clover forced her way to the front. The van began to gather speed. Clover -tried to stir her stout limbs to a gallop, and achieved a canter. "Boxer!" -she cried. "Boxer! Boxer! Boxer!" And just at this moment, as though he -had heard the uproar outside, Boxer's face, with the white stripe down his -nose, appeared at the small window at the back of the van. - -"Boxer!" cried Clover in a terrible voice. "Boxer! Get out! Get out -quickly! They're taking you to your death!" - -All the animals took up the cry of "Get out, Boxer, get out!" But the van -was already gathering speed and drawing away from them. It was uncertain -whether Boxer had understood what Clover had said. But a moment later his -face disappeared from the window and there was the sound of a tremendous -drumming of hoofs inside the van. He was trying to kick his way out. The -time had been when a few kicks from Boxer's hoofs would have smashed the -van to matchwood. But alas! his strength had left him; and in a few -moments the sound of drumming hoofs grew fainter and died away. In -desperation the animals began appealing to the two horses which drew the -van to stop. "Comrades, comrades!" they shouted. "Don't take your own -brother to his death!" But the stupid brutes, too ignorant to realise -what was happening, merely set back their ears and quickened their pace. -Boxer's face did not reappear at the window. Too late, someone thought of -racing ahead and shutting the five-barred gate; but in another moment the -van was through it and rapidly disappearing down the road. Boxer was never -seen again. - -Three days later it was announced that he had died in the hospital at -Willingdon, in spite of receiving every attention a horse could have. -Squealer came to announce the news to the others. He had, he said, been -present during Boxer's last hours. - -"It was the most affecting sight I have ever seen!" said Squealer, lifting -his trotter and wiping away a tear. "I was at his bedside at the very -last. And at the end, almost too weak to speak, he whispered in my ear -that his sole sorrow was to have passed on before the windmill was -finished. 'Forward, comrades!' he whispered. 'Forward in the name of the -Rebellion. Long live Animal Farm! Long live Comrade Napoleon! Napoleon is -always right.' Those were his very last words, comrades." - -Here Squealer's demeanour suddenly changed. He fell silent for a moment, -and his little eyes darted suspicious glances from side to side before he -proceeded. - -It had come to his knowledge, he said, that a foolish and wicked rumour -had been circulated at the time of Boxer's removal. Some of the animals -had noticed that the van which took Boxer away was marked "Horse -Slaughterer," and had actually jumped to the conclusion that Boxer was -being sent to the knacker's. It was almost unbelievable, said Squealer, -that any animal could be so stupid. Surely, he cried indignantly, whisking -his tail and skipping from side to side, surely they knew their beloved -Leader, Comrade Napoleon, better than that? But the explanation was really -very simple. The van had previously been the property of the knacker, and -had been bought by the veterinary surgeon, who had not yet painted the old -name out. That was how the mistake had arisen. - -The animals were enormously relieved to hear this. And when Squealer went -on to give further graphic details of Boxer's death-bed, the admirable -care he had received, and the expensive medicines for which Napoleon had -paid without a thought as to the cost, their last doubts disappeared and -the sorrow that they felt for their comrade's death was tempered by the -thought that at least he had died happy. - -Napoleon himself appeared at the meeting on the following Sunday morning -and pronounced a short oration in Boxer's honour. It had not been -possible, he said, to bring back their lamented comrade's remains for -interment on the farm, but he had ordered a large wreath to be made from -the laurels in the farmhouse garden and sent down to be placed on Boxer's -grave. And in a few days' time the pigs intended to hold a memorial -banquet in Boxer's honour. Napoleon ended his speech with a reminder of -Boxer's two favourite maxims, "I will work harder" and "Comrade Napoleon -is always right"--maxims, he said, which every animal would do well to -adopt as his own. - -On the day appointed for the banquet, a grocer's van drove up from -Willingdon and delivered a large wooden crate at the farmhouse. That night -there was the sound of uproarious singing, which was followed by what -sounded like a violent quarrel and ended at about eleven o'clock with a -tremendous crash of glass. No one stirred in the farmhouse before noon on -the following day, and the word went round that from somewhere or other -the pigs had acquired the money to buy themselves another case of whisky. - - - - - Chapter X - - - -Years passed. The seasons came and went, the short animal lives fled by. -A time came when there was no one who remembered the old days before the -Rebellion, except Clover, Benjamin, Moses the raven, and a number of the -pigs. - -Muriel was dead; Bluebell, Jessie, and Pincher were dead. Jones too was -dead--he had died in an inebriates' home in another part of the country. -Snowball was forgotten. Boxer was forgotten, except by the few who had -known him. Clover was an old stout mare now, stiff in the joints and with -a tendency to rheumy eyes. She was two years past the retiring age, but in -fact no animal had ever actually retired. The talk of setting aside a -corner of the pasture for superannuated animals had long since been -dropped. Napoleon was now a mature boar of twenty-four stone. Squealer was -so fat that he could with difficulty see out of his eyes. Only old -Benjamin was much the same as ever, except for being a little greyer about -the muzzle, and, since Boxer's death, more morose and taciturn than ever. - -There were many more creatures on the farm now, though the increase was -not so great as had been expected in earlier years. Many animals had been -born to whom the Rebellion was only a dim tradition, passed on by word of -mouth, and others had been bought who had never heard mention of such a -thing before their arrival. The farm possessed three horses now besides -Clover. They were fine upstanding beasts, willing workers and good -comrades, but very stupid. None of them proved able to learn the alphabet -beyond the letter B. They accepted everything that they were told about -the Rebellion and the principles of Animalism, especially from Clover, for -whom they had an almost filial respect; but it was doubtful whether they -understood very much of it. - -The farm was more prosperous now, and better organised: it had even been -enlarged by two fields which had been bought from Mr. Pilkington. The -windmill had been successfully completed at last, and the farm possessed a -threshing machine and a hay elevator of its own, and various new buildings -had been added to it. Whymper had bought himself a dogcart. The windmill, -however, had not after all been used for generating electrical power. It -was used for milling corn, and brought in a handsome money profit. The -animals were hard at work building yet another windmill; when that one was -finished, so it was said, the dynamos would be installed. But the luxuries -of which Snowball had once taught the animals to dream, the stalls with -electric light and hot and cold water, and the three-day week, were no -longer talked about. Napoleon had denounced such ideas as contrary to the -spirit of Animalism. The truest happiness, he said, lay in working hard -and living frugally. - -Somehow it seemed as though the farm had grown richer without making the -animals themselves any richer-except, of course, for the pigs and the -dogs. Perhaps this was partly because there were so many pigs and so many -dogs. It was not that these creatures did not work, after their fashion. -There was, as Squealer was never tired of explaining, endless work in the -supervision and organisation of the farm. Much of this work was of a kind -that the other animals were too ignorant to understand. For example, -Squealer told them that the pigs had to expend enormous labours every day -upon mysterious things called "files," "reports," "minutes," and -"memoranda". These were large sheets of paper which had to be closely -covered with writing, and as soon as they were so covered, they were burnt -in the furnace. This was of the highest importance for the welfare of the -farm, Squealer said. But still, neither pigs nor dogs produced any food by -their own labour; and there were very many of them, and their appetites -were always good. - -As for the others, their life, so far as they knew, was as it had always -been. They were generally hungry, they slept on straw, they drank from the -pool, they laboured in the fields; in winter they were troubled by the -cold, and in summer by the flies. Sometimes the older ones among them -racked their dim memories and tried to determine whether in the early -days of the Rebellion, when Jones's expulsion was still recent, things had -been better or worse than now. They could not remember. There was nothing -with which they could compare their present lives: they had nothing to go -upon except Squealer's lists of figures, which invariably demonstrated -that everything was getting better and better. The animals found the -problem insoluble; in any case, they had little time for speculating on -such things now. Only old Benjamin professed to remember every detail of -his long life and to know that things never had been, nor ever could be -much better or much worse--hunger, hardship, and disappointment being, so -he said, the unalterable law of life. - -And yet the animals never gave up hope. More, they never lost, even for an -instant, their sense of honour and privilege in being members of Animal -Farm. They were still the only farm in the whole county--in all -England!--owned and operated by animals. Not one of them, not even the -youngest, not even the newcomers who had been brought from farms ten or -twenty miles away, ever ceased to marvel at that. And when they heard the -gun booming and saw the green flag fluttering at the masthead, their -hearts swelled with imperishable pride, and the talk turned always towards -the old heroic days, the expulsion of Jones, the writing of the Seven -Commandments, the great battles in which the human invaders had been -defeated. None of the old dreams had been abandoned. The Republic of the -Animals which Major had foretold, when the green fields of England should -be untrodden by human feet, was still believed in. Some day it was coming: -it might not be soon, it might not be with in the lifetime of any animal -now living, but still it was coming. Even the tune of 'Beasts of England' -was perhaps hummed secretly here and there: at any rate, it was a fact -that every animal on the farm knew it, though no one would have dared to -sing it aloud. It might be that their lives were hard and that not all of -their hopes had been fulfilled; but they were conscious that they were not -as other animals. If they went hungry, it was not from feeding tyrannical -human beings; if they worked hard, at least they worked for themselves. -No creature among them went upon two legs. No creature called any other -creature "Master." All animals were equal. - -One day in early summer Squealer ordered the sheep to follow him, and led -them out to a piece of waste ground at the other end of the farm, which -had become overgrown with birch saplings. The sheep spent the whole day -there browsing at the leaves under Squealer's supervision. In the evening -he returned to the farmhouse himself, but, as it was warm weather, told -the sheep to stay where they were. It ended by their remaining there for a -whole week, during which time the other animals saw nothing of them. -Squealer was with them for the greater part of every day. He was, he said, -teaching them to sing a new song, for which privacy was needed. - -It was just after the sheep had returned, on a pleasant evening when the -animals had finished work and were making their way back to the farm -buildings, that the terrified neighing of a horse sounded from the yard. -Startled, the animals stopped in their tracks. It was Clover's voice. She -neighed again, and all the animals broke into a gallop and rushed into the -yard. Then they saw what Clover had seen. - -It was a pig walking on his hind legs. - -Yes, it was Squealer. A little awkwardly, as though not quite used to -supporting his considerable bulk in that position, but with perfect -balance, he was strolling across the yard. And a moment later, out from -the door of the farmhouse came a long file of pigs, all walking on their -hind legs. Some did it better than others, one or two were even a trifle -unsteady and looked as though they would have liked the support of a -stick, but every one of them made his way right round the yard -successfully. And finally there was a tremendous baying of dogs and a -shrill crowing from the black cockerel, and out came Napoleon himself, -majestically upright, casting haughty glances from side to side, and with -his dogs gambolling round him. - -He carried a whip in his trotter. - -There was a deadly silence. Amazed, terrified, huddling together, the -animals watched the long line of pigs march slowly round the yard. It was -as though the world had turned upside-down. Then there came a moment when -the first shock had worn off and when, in spite of everything-in spite of -their terror of the dogs, and of the habit, developed through long years, -of never complaining, never criticising, no matter what happened--they -might have uttered some word of protest. But just at that moment, as -though at a signal, all the sheep burst out into a tremendous bleating of-- - -"Four legs good, two legs BETTER! Four legs good, two legs BETTER! Four -legs good, two legs BETTER!" - -It went on for five minutes without stopping. And by the time the sheep -had quieted down, the chance to utter any protest had passed, for the pigs -had marched back into the farmhouse. - -Benjamin felt a nose nuzzling at his shoulder. He looked round. It was -Clover. Her old eyes looked dimmer than ever. Without saying anything, she -tugged gently at his mane and led him round to the end of the big barn, -where the Seven Commandments were written. For a minute or two they stood -gazing at the tatted wall with its white lettering. - -"My sight is failing," she said finally. "Even when I was young I could -not have read what was written there. But it appears to me that that wall -looks different. Are the Seven Commandments the same as they used to be, -Benjamin?" - -For once Benjamin consented to break his rule, and he read out to her what -was written on the wall. There was nothing there now except a single -Commandment. It ran: - -ALL ANIMALS ARE EQUAL -BUT SOME ANIMALS ARE MORE EQUAL THAN OTHERS - -After that it did not seem strange when next day the pigs who were -supervising the work of the farm all carried whips in their trotters. It -did not seem strange to learn that the pigs had bought themselves a -wireless set, were arranging to install a telephone, and had taken out -subscriptions to 'John Bull', 'Tit-Bits', and the 'Daily Mirror'. It did -not seem strange when Napoleon was seen strolling in the farmhouse garden -with a pipe in his mouth--no, not even when the pigs took Mr. Jones's -clothes out of the wardrobes and put them on, Napoleon himself appearing -in a black coat, ratcatcher breeches, and leather leggings, while his -favourite sow appeared in the watered silk dress which Mrs. Jones had been -used to wearing on Sundays. - -A week later, in the afternoon, a number of dog-carts drove up to the farm. -A deputation of neighbouring farmers had been invited to make a tour of -inspection. They were shown all over the farm, and expressed great -admiration for everything they saw, especially the windmill. The animals -were weeding the turnip field. They worked diligently hardly raising their -faces from the ground, and not knowing whether to be more frightened of -the pigs or of the human visitors. - -That evening loud laughter and bursts of singing came from the farmhouse. -And suddenly, at the sound of the mingled voices, the animals were -stricken with curiosity. What could be happening in there, now that for -the first time animals and human beings were meeting on terms of equality? -With one accord they began to creep as quietly as possible into the -farmhouse garden. - -At the gate they paused, half frightened to go on but Clover led the way -in. They tiptoed up to the house, and such animals as were tall enough -peered in at the dining-room window. There, round the long table, sat half -a dozen farmers and half a dozen of the more eminent pigs, Napoleon -himself occupying the seat of honour at the head of the table. The pigs -appeared completely at ease in their chairs. The company had been enjoying -a game of cards but had broken off for the moment, evidently in order to -drink a toast. A large jug was circulating, and the mugs were being -refilled with beer. No one noticed the wondering faces of the animals that -gazed in at the window. - -Mr. Pilkington, of Foxwood, had stood up, his mug in his hand. In a -moment, he said, he would ask the present company to drink a toast. But -before doing so, there were a few words that he felt it incumbent upon him -to say. - -It was a source of great satisfaction to him, he said--and, he was sure, -to all others present--to feel that a long period of mistrust and -misunderstanding had now come to an end. There had been a time--not that -he, or any of the present company, had shared such sentiments--but there -had been a time when the respected proprietors of Animal Farm had been -regarded, he would not say with hostility, but perhaps with a certain -measure of misgiving, by their human neighbours. Unfortunate incidents had -occurred, mistaken ideas had been current. It had been felt that the -existence of a farm owned and operated by pigs was somehow abnormal and -was liable to have an unsettling effect in the neighbourhood. Too many -farmers had assumed, without due enquiry, that on such a farm a spirit of -licence and indiscipline would prevail. They had been nervous about the -effects upon their own animals, or even upon their human employees. But -all such doubts were now dispelled. Today he and his friends had visited -Animal Farm and inspected every inch of it with their own eyes, and what -did they find? Not only the most up-to-date methods, but a discipline and -an orderliness which should be an example to all farmers everywhere. He -believed that he was right in saying that the lower animals on Animal Farm -did more work and received less food than any animals in the county. -Indeed, he and his fellow-visitors today had observed many features which -they intended to introduce on their own farms immediately. - -He would end his remarks, he said, by emphasising once again the friendly -feelings that subsisted, and ought to subsist, between Animal Farm and its -neighbours. Between pigs and human beings there was not, and there need -not be, any clash of interests whatever. Their struggles and their -difficulties were one. Was not the labour problem the same everywhere? -Here it became apparent that Mr. Pilkington was about to spring some -carefully prepared witticism on the company, but for a moment he was too -overcome by amusement to be able to utter it. After much choking, during -which his various chins turned purple, he managed to get it out: "If you -have your lower animals to contend with," he said, "we have our lower -classes!" This BON MOT set the table in a roar; and Mr. Pilkington once -again congratulated the pigs on the low rations, the long working hours, -and the general absence of pampering which he had observed on Animal Farm. - -And now, he said finally, he would ask the company to rise to their feet -and make certain that their glasses were full. "Gentlemen," concluded -Mr. Pilkington, "gentlemen, I give you a toast: To the prosperity of -Animal Farm!" - -There was enthusiastic cheering and stamping of feet. Napoleon was so -gratified that he left his place and came round the table to clink his -mug against Mr. Pilkington's before emptying it. When the cheering had -died down, Napoleon, who had remained on his feet, intimated that he too -had a few words to say. - -Like all of Napoleon's speeches, it was short and to the point. He too, -he said, was happy that the period of misunderstanding was at an end. For -a long time there had been rumours--circulated, he had reason to think, -by some malignant enemy--that there was something subversive and even -revolutionary in the outlook of himself and his colleagues. They had been -credited with attempting to stir up rebellion among the animals on -neighbouring farms. Nothing could be further from the truth! Their sole -wish, now and in the past, was to live at peace and in normal business -relations with their neighbours. This farm which he had the honour to -control, he added, was a co-operative enterprise. The title-deeds, which -were in his own possession, were owned by the pigs jointly. - -He did not believe, he said, that any of the old suspicions still -lingered, but certain changes had been made recently in the routine of the -farm which should have the effect of promoting confidence still further. -Hitherto the animals on the farm had had a rather foolish custom of -addressing one another as "Comrade." This was to be suppressed. There had -also been a very strange custom, whose origin was unknown, of marching -every Sunday morning past a boar's skull which was nailed to a post in the -garden. This, too, would be suppressed, and the skull had already been -buried. His visitors might have observed, too, the green flag which flew -from the masthead. If so, they would perhaps have noted that the white -hoof and horn with which it had previously been marked had now been -removed. It would be a plain green flag from now onwards. - -He had only one criticism, he said, to make of Mr. Pilkington's excellent -and neighbourly speech. Mr. Pilkington had referred throughout to -"Animal Farm." He could not of course know--for he, Napoleon, was only -now for the first time announcing it--that the name "Animal Farm" -had been abolished. Henceforward the farm was to be known as "The Manor -Farm"--which, he believed, was its correct and original name. - -"Gentlemen," concluded Napoleon, "I will give you the same toast as -before, but in a different form. Fill your glasses to the brim. Gentlemen, -here is my toast: To the prosperity of The Manor Farm!" - -There was the same hearty cheering as before, and the mugs were emptied to -the dregs. But as the animals outside gazed at the scene, it seemed to -them that some strange thing was happening. What was it that had altered -in the faces of the pigs? Clover's old dim eyes flitted from one face to -another. Some of them had five chins, some had four, some had three. But -what was it that seemed to be melting and changing? Then, the applause -having come to an end, the company took up their cards and continued the -game that had been interrupted, and the animals crept silently away. - -But they had not gone twenty yards when they stopped short. An uproar of -voices was coming from the farmhouse. They rushed back and looked through -the window again. Yes, a violent quarrel was in progress. There were -shoutings, bangings on the table, sharp suspicious glances, furious -denials. The source of the trouble appeared to be that Napoleon and -Mr. Pilkington had each played an ace of spades simultaneously. - -Twelve voices were shouting in anger, and they were all alike. No question, -now, what had happened to the faces of the pigs. The creatures outside -looked from pig to man, and from man to pig, and from pig to man again; -but already it was impossible to say which was which. diff --git a/samples/kernel-options.txt b/samples/kernel-options.txt new file mode 100644 index 0000000..eaf32a1 --- /dev/null +++ b/samples/kernel-options.txt @@ -0,0 +1,884 @@ + + + Command Line Options for Linux/m68k + =================================== + +Last Update: 2 May 1999 +Linux/m68k version: 2.2.6 +Author: Roman.Hodek@informatik.uni-erlangen.de (Roman Hodek) +Update: jds@kom.auc.dk (Jes Sorensen) and faq@linux-m68k.org (Chris Lawrence) + +0) Introduction +=============== + + Often I've been asked which command line options the Linux/m68k +kernel understands, or how the exact syntax for the ... option is, or +... about the option ... . I hope, this document supplies all the +answers... + + Note that some options might be outdated, their descriptions being +incomplete or missing. Please update the information and send in the +patches. + + +1) Overview of the Kernel's Option Processing +============================================= + +The kernel knows three kinds of options on its command line: + + 1) kernel options + 2) environment settings + 3) arguments for init + +To which of these classes an argument belongs is determined as +follows: If the option is known to the kernel itself, i.e. if the name +(the part before the '=') or, in some cases, the whole argument string +is known to the kernel, it belongs to class 1. Otherwise, if the +argument contains an '=', it is of class 2, and the definition is put +into init's environment. All other arguments are passed to init as +command line options. + + This document describes the valid kernel options for Linux/m68k in +the version mentioned at the start of this file. Later revisions may +add new such options, and some may be missing in older versions. + + In general, the value (the part after the '=') of an option is a +list of values separated by commas. The interpretation of these values +is up to the driver that "owns" the option. This association of +options with drivers is also the reason that some are further +subdivided. + + +2) General Kernel Options +========================= + +2.1) root= +---------- + +Syntax: root=/dev/ + or: root= + +This tells the kernel which device it should mount as the root +filesystem. The device must be a block device with a valid filesystem +on it. + + The first syntax gives the device by name. These names are converted +into a major/minor number internally in the kernel in an unusual way. +Normally, this "conversion" is done by the device files in /dev, but +this isn't possible here, because the root filesystem (with /dev) +isn't mounted yet... So the kernel parses the name itself, with some +hardcoded name to number mappings. The name must always be a +combination of two or three letters, followed by a decimal number. +Valid names are: + + /dev/ram: -> 0x0100 (initial ramdisk) + /dev/hda: -> 0x0300 (first IDE disk) + /dev/hdb: -> 0x0340 (second IDE disk) + /dev/sda: -> 0x0800 (first SCSI disk) + /dev/sdb: -> 0x0810 (second SCSI disk) + /dev/sdc: -> 0x0820 (third SCSI disk) + /dev/sdd: -> 0x0830 (forth SCSI disk) + /dev/sde: -> 0x0840 (fifth SCSI disk) + /dev/fd : -> 0x0200 (floppy disk) + + The name must be followed by a decimal number, that stands for the +partition number. Internally, the value of the number is just +added to the device number mentioned in the table above. The +exceptions are /dev/ram and /dev/fd, where /dev/ram refers to an +initial ramdisk loaded by your bootstrap program (please consult the +instructions for your bootstrap program to find out how to load an +initial ramdisk). As of kernel version 2.0.18 you must specify +/dev/ram as the root device if you want to boot from an initial +ramdisk. For the floppy devices, /dev/fd, the number stands for the +floppy drive number (there are no partitions on floppy disks). I.e., +/dev/fd0 stands for the first drive, /dev/fd1 for the second, and so +on. Since the number is just added, you can also force the disk format +by adding a number greater than 3. If you look into your /dev +directory, use can see the /dev/fd0D720 has major 2 and minor 16. You +can specify this device for the root FS by writing "root=/dev/fd16" on +the kernel command line. + +[Strange and maybe uninteresting stuff ON] + + This unusual translation of device names has some strange +consequences: If, for example, you have a symbolic link from /dev/fd +to /dev/fd0D720 as an abbreviation for floppy driver #0 in DD format, +you cannot use this name for specifying the root device, because the +kernel cannot see this symlink before mounting the root FS and it +isn't in the table above. If you use it, the root device will not be +set at all, without an error message. Another example: You cannot use a +partition on e.g. the sixth SCSI disk as the root filesystem, if you +want to specify it by name. This is, because only the devices up to +/dev/sde are in the table above, but not /dev/sdf. Although, you can +use the sixth SCSI disk for the root FS, but you have to specify the +device by number... (see below). Or, even more strange, you can use the +fact that there is no range checking of the partition number, and your +knowledge that each disk uses 16 minors, and write "root=/dev/sde17" +(for /dev/sdf1). + +[Strange and maybe uninteresting stuff OFF] + + If the device containing your root partition isn't in the table +above, you can also specify it by major and minor numbers. These are +written in hex, with no prefix and no separator between. E.g., if you +have a CD with contents appropriate as a root filesystem in the first +SCSI CD-ROM drive, you boot from it by "root=0b00". Here, hex "0b" = +decimal 11 is the major of SCSI CD-ROMs, and the minor 0 stands for +the first of these. You can find out all valid major numbers by +looking into include/linux/major.h. + +In addition to major and minor numbers, if the device containing your +root partition uses a partition table format with unique partition +identifiers, then you may use them. For instance, +"root=PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF". It is also +possible to reference another partition on the same device using a +known partition UUID as the starting point. For example, +if partition 5 of the device has the UUID of +00112233-4455-6677-8899-AABBCCDDEEFF then partition 3 may be found as +follows: + PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF/PARTNROFF=-2 + +Authoritative information can be found in +"Documentation/kernel-parameters.txt". + + +2.2) ro, rw +----------- + +Syntax: ro + or: rw + +These two options tell the kernel whether it should mount the root +filesystem read-only or read-write. The default is read-only, except +for ramdisks, which default to read-write. + + +2.3) debug +---------- + +Syntax: debug + +This raises the kernel log level to 10 (the default is 7). This is the +same level as set by the "dmesg" command, just that the maximum level +selectable by dmesg is 8. + + +2.4) debug= +----------- + +Syntax: debug= + +This option causes certain kernel messages be printed to the selected +debugging device. This can aid debugging the kernel, since the +messages can be captured and analyzed on some other machine. Which +devices are possible depends on the machine type. There are no checks +for the validity of the device name. If the device isn't implemented, +nothing happens. + + Messages logged this way are in general stack dumps after kernel +memory faults or bad kernel traps, and kernel panics. To be exact: all +messages of level 0 (panic messages) and all messages printed while +the log level is 8 or more (their level doesn't matter). Before stack +dumps, the kernel sets the log level to 10 automatically. A level of +at least 8 can also be set by the "debug" command line option (see +2.3) and at run time with "dmesg -n 8". + +Devices possible for Amiga: + + - "ser": built-in serial port; parameters: 9600bps, 8N1 + - "mem": Save the messages to a reserved area in chip mem. After + rebooting, they can be read under AmigaOS with the tool + 'dmesg'. + +Devices possible for Atari: + + - "ser1": ST-MFP serial port ("Modem1"); parameters: 9600bps, 8N1 + - "ser2": SCC channel B serial port ("Modem2"); parameters: 9600bps, 8N1 + - "ser" : default serial port + This is "ser2" for a Falcon, and "ser1" for any other machine + - "midi": The MIDI port; parameters: 31250bps, 8N1 + - "par" : parallel port + The printing routine for this implements a timeout for the + case there's no printer connected (else the kernel would + lock up). The timeout is not exact, but usually a few + seconds. + + +2.6) ramdisk_size= +------------- + +Syntax: ramdisk_size= + + This option instructs the kernel to set up a ramdisk of the given +size in KBytes. Do not use this option if the ramdisk contents are +passed by bootstrap! In this case, the size is selected automatically +and should not be overwritten. + + The only application is for root filesystems on floppy disks, that +should be loaded into memory. To do that, select the corresponding +size of the disk as ramdisk size, and set the root device to the disk +drive (with "root="). + + +2.7) swap= +2.8) buff= +----------- + + I can't find any sign of these options in 2.2.6. + + +3) General Device Options (Amiga and Atari) +=========================================== + +3.1) ether= +----------- + +Syntax: ether=[[,[,[,]]]], + + is the name of a net driver, as specified in +drivers/net/Space.c in the Linux source. Most prominent are eth0, ... +eth3, sl0, ... sl3, ppp0, ..., ppp3, dummy, and lo. + + The non-ethernet drivers (sl, ppp, dummy, lo) obviously ignore the +settings by this options. Also, the existing ethernet drivers for +Linux/m68k (ariadne, a2065, hydra) don't use them because Zorro boards +are really Plug-'n-Play, so the "ether=" option is useless altogether +for Linux/m68k. + + +3.2) hd= +-------- + +Syntax: hd=,, + + This option sets the disk geometry of an IDE disk. The first hd= +option is for the first IDE disk, the second for the second one. +(I.e., you can give this option twice.) In most cases, you won't have +to use this option, since the kernel can obtain the geometry data +itself. It exists just for the case that this fails for one of your +disks. + + +3.3) max_scsi_luns= +------------------- + +Syntax: max_scsi_luns= + + Sets the maximum number of LUNs (logical units) of SCSI devices to +be scanned. Valid values for are between 1 and 8. Default is 8 if +"Probe all LUNs on each SCSI device" was selected during the kernel +configuration, else 1. + + +3.4) st= +-------- + +Syntax: st=,[,[]] + + Sets several parameters of the SCSI tape driver. is +the number of 512-byte buffers reserved for tape operations for each +device. sets the number of blocks which must be filled +to start an actual write operation to the tape. Maximum value is the +total number of buffers. limits the total number of +buffers allocated for all tape devices. + + +3.5) dmasound= +-------------- + +Syntax: dmasound=[,[,]] + + This option controls some configurations of the Linux/m68k DMA sound +driver (Amiga and Atari): is the number of buffers you want +to use (minimum 4, default 4), is the size of each +buffer in kilobytes (minimum 4, default 32) and says +how much percent of error will be tolerated when setting a frequency +(maximum 10, default 0). For example with 3% you can play 8000Hz +AU-Files on the Falcon with its hardware frequency of 8195Hz and thus +don't need to expand the sound. + + + +4) Options for Atari Only +========================= + +4.1) video= +----------- + +Syntax: video=: + +The parameter specifies the name of the frame buffer, +eg. most atari users will want to specify `atafb' here. The + is a comma-separated list of the sub-options listed +below. + +NB: Please notice that this option was renamed from `atavideo' to + `video' during the development of the 1.3.x kernels, thus you + might need to update your boot-scripts if upgrading to 2.x from + an 1.2.x kernel. + +NBB: The behavior of video= was changed in 2.1.57 so the recommended +option is to specify the name of the frame buffer. + +4.1.1) Video Mode +----------------- + +This sub-option may be any of the predefined video modes, as listed +in atari/atafb.c in the Linux/m68k source tree. The kernel will +activate the given video mode at boot time and make it the default +mode, if the hardware allows. Currently defined names are: + + - stlow : 320x200x4 + - stmid, default5 : 640x200x2 + - sthigh, default4: 640x400x1 + - ttlow : 320x480x8, TT only + - ttmid, default1 : 640x480x4, TT only + - tthigh, default2: 1280x960x1, TT only + - vga2 : 640x480x1, Falcon only + - vga4 : 640x480x2, Falcon only + - vga16, default3 : 640x480x4, Falcon only + - vga256 : 640x480x8, Falcon only + - falh2 : 896x608x1, Falcon only + - falh16 : 896x608x4, Falcon only + + If no video mode is given on the command line, the kernel tries the +modes names "default" in turn, until one is possible with the +hardware in use. + + A video mode setting doesn't make sense, if the external driver is +activated by a "external:" sub-option. + +4.1.2) inverse +-------------- + +Invert the display. This affects both, text (consoles) and graphics +(X) display. Usually, the background is chosen to be black. With this +option, you can make the background white. + +4.1.3) font +----------- + +Syntax: font: + +Specify the font to use in text modes. Currently you can choose only +between `VGA8x8', `VGA8x16' and `PEARL8x8'. `VGA8x8' is default, if the +vertical size of the display is less than 400 pixel rows. Otherwise, the +`VGA8x16' font is the default. + +4.1.4) hwscroll_ +---------------- + +Syntax: hwscroll_ + +The number of additional lines of video memory to reserve for +speeding up the scrolling ("hardware scrolling"). Hardware scrolling +is possible only if the kernel can set the video base address in steps +fine enough. This is true for STE, MegaSTE, TT, and Falcon. It is not +possible with plain STs and graphics cards (The former because the +base address must be on a 256 byte boundary there, the latter because +the kernel doesn't know how to set the base address at all.) + + By default, is set to the number of visible text lines on the +display. Thus, the amount of video memory is doubled, compared to no +hardware scrolling. You can turn off the hardware scrolling altogether +by setting to 0. + +4.1.5) internal: +---------------- + +Syntax: internal:;[;;;] + +This option specifies the capabilities of some extended internal video +hardware, like e.g. OverScan. and give the (extended) +dimensions of the screen. + + If your OverScan needs a black border, you have to write the last +three arguments of the "internal:". is the maximum line +length the hardware allows, the maximum number of lines. + is the offset of the visible part of the screen memory to its +physical start, in bytes. + + Often, extended interval video hardware has to be activated somehow. +For this, see the "sw_*" options below. + +4.1.6) external: +---------------- + +Syntax: + external:;;;;[;[;\ + [;[;[;]]]]] + +[I had to break this line...] + + This is probably the most complicated parameter... It specifies that +you have some external video hardware (a graphics board), and how to +use it under Linux/m68k. The kernel cannot know more about the hardware +than you tell it here! The kernel also is unable to set or change any +video modes, since it doesn't know about any board internal. So, you +have to switch to that video mode before you start Linux, and cannot +switch to another mode once Linux has started. + + The first 3 parameters of this sub-option should be obvious: , + and give the dimensions of the screen and the number of +planes (depth). The depth is the logarithm to base 2 of the number +of colors possible. (Or, the other way round: The number of colors is +2^depth). + + You have to tell the kernel furthermore how the video memory is +organized. This is done by a letter as parameter: + + 'n': "normal planes", i.e. one whole plane after another + 'i': "interleaved planes", i.e. 16 bit of the first plane, than 16 bit + of the next, and so on... This mode is used only with the + built-in Atari video modes, I think there is no card that + supports this mode. + 'p': "packed pixels", i.e. consecutive bits stand for all + planes of one pixel; this is the most common mode for 8 planes + (256 colors) on graphic cards + 't': "true color" (more or less packed pixels, but without a color + lookup table); usually depth is 24 + +For monochrome modes (i.e., is 1), the letter has a +different meaning: + + 'n': normal colors, i.e. 0=white, 1=black + 'i': inverted colors, i.e. 0=black, 1=white + + The next important information about the video hardware is the base +address of the video memory. That is given in the parameter, +as a hexadecimal number with a "0x" prefix. You have to find out this +address in the documentation of your hardware. + + The next parameter, , tells the kernel about the size of the +video memory. If it's missing, the size is calculated from , +, and . For now, it is not useful to write a value here. +It would be used only for hardware scrolling (which isn't possible +with the external driver, because the kernel cannot set the video base +address), or for virtual resolutions under X (which the X server +doesn't support yet). So, it's currently best to leave this field +empty, either by ending the "external:" after the video address or by +writing two consecutive semicolons, if you want to give a +(it is allowed to leave this parameter empty). + + The parameter is optional. If it is not given, the kernel +cannot read or write any color registers of the video hardware, and +thus you have to set appropriate colors before you start Linux. But if +your card is somehow VGA compatible, you can tell the kernel the base +address of the VGA register set, so it can change the color lookup +table. You have to look up this address in your board's documentation. +To avoid misunderstandings: is the _base_ address, i.e. a 4k +aligned address. For read/writing the color registers, the kernel +uses the addresses vgabase+0x3c7...vgabase+0x3c9. The +parameter is written in hexadecimal with a "0x" prefix, just as +. + + is meaningful only if is specified. It tells the +kernel how wide each of the color register is, i.e. the number of bits +per single color (red/green/blue). Default is 6, another quite usual +value is 8. + + Also is used together with . It tells the kernel +about the color register model of your gfx board. Currently, the types +"vga" (which is also the default) and "mv300" (SANG MV300) are +implemented. + + Parameter is required for ProMST or ET4000 cards where +the physical linelength differs from the visible length. With ProMST, +xres_virtual must be set to 2048. For ET4000, xres_virtual depends on the +initialisation of the video-card. +If you're missing a corresponding yres_virtual: the external part is legacy, +therefore we don't support hardware-dependent functions like hardware-scroll, +panning or blanking. + +4.1.7) eclock: +-------------- + +The external pixel clock attached to the Falcon VIDEL shifter. This +currently works only with the ScreenWonder! + +4.1.8) monitorcap: +------------------- + +Syntax: monitorcap:;;; + +This describes the capabilities of a multisync monitor. Don't use it +with a fixed-frequency monitor! For now, only the Falcon frame buffer +uses the settings of "monitorcap:". + + and are the minimum and maximum, resp., vertical frequencies +your monitor can work with, in Hz. and are the same for +the horizontal frequency, in kHz. + + The defaults are 58;62;31;32 (VGA compatible). + + The defaults for TV/SC1224/SC1435 cover both PAL and NTSC standards. + +4.1.9) keep +------------ + +If this option is given, the framebuffer device doesn't do any video +mode calculations and settings on its own. The only Atari fb device +that does this currently is the Falcon. + + What you reach with this: Settings for unknown video extensions +aren't overridden by the driver, so you can still use the mode found +when booting, when the driver doesn't know to set this mode itself. +But this also means, that you can't switch video modes anymore... + + An example where you may want to use "keep" is the ScreenBlaster for +the Falcon. + + +4.2) atamouse= +-------------- + +Syntax: atamouse=,[] + + With this option, you can set the mouse movement reporting threshold. +This is the number of pixels of mouse movement that have to accumulate +before the IKBD sends a new mouse packet to the kernel. Higher values +reduce the mouse interrupt load and thus reduce the chance of keyboard +overruns. Lower values give a slightly faster mouse responses and +slightly better mouse tracking. + + You can set the threshold in x and y separately, but usually this is +of little practical use. If there's just one number in the option, it +is used for both dimensions. The default value is 2 for both +thresholds. + + +4.3) ataflop= +------------- + +Syntax: ataflop=[,[,[,]]] + + The drive type may be 0, 1, or 2, for DD, HD, and ED, resp. This + setting affects how many buffers are reserved and which formats are + probed (see also below). The default is 1 (HD). Only one drive type + can be selected. If you have two disk drives, select the "better" + type. + + The second parameter tells the kernel whether to use + track buffering (1) or not (0). The default is machine-dependent: + no for the Medusa and yes for all others. + + With the two following parameters, you can change the default + steprate used for drive A and B, resp. + + +4.4) atascsi= +------------- + +Syntax: atascsi=[,[,[,[,]]]] + + This option sets some parameters for the Atari native SCSI driver. +Generally, any number of arguments can be omitted from the end. And +for each of the numbers, a negative value means "use default". The +defaults depend on whether TT-style or Falcon-style SCSI is used. +Below, defaults are noted as n/m, where the first value refers to +TT-SCSI and the latter to Falcon-SCSI. If an illegal value is given +for one parameter, an error message is printed and that one setting is +ignored (others aren't affected). + + : + This is the maximum number of SCSI commands queued internally to the + Atari SCSI driver. A value of 1 effectively turns off the driver + internal multitasking (if it causes problems). Legal values are >= + 1. can be as high as you like, but values greater than + times the number of SCSI targets (LUNs) you have + don't make sense. Default: 16/8. + + : + Maximum number of SCSI commands issued to the driver for one + logical unit (LUN, usually one SCSI target). Legal values start + from 1. If tagged queuing (see below) is not used, values greater + than 2 don't make sense, but waste memory. Otherwise, the maximum + is the number of command tags available to the driver (currently + 32). Default: 8/1. (Note: Values > 1 seem to cause problems on a + Falcon, cause not yet known.) + + The value at a great part determines the amount of + memory SCSI reserves for itself. The formula is rather + complicated, but I can give you some hints: + no scatter-gather : cmd_per_lun * 232 bytes + full scatter-gather: cmd_per_lun * approx. 17 Kbytes + + : + Size of the scatter-gather table, i.e. the number of requests + consecutive on the disk that can be merged into one SCSI command. + Legal values are between 0 and 255. Default: 255/0. Note: This + value is forced to 0 on a Falcon, since scatter-gather isn't + possible with the ST-DMA. Not using scatter-gather hurts + performance significantly. + + : + The SCSI ID to be used by the initiator (your Atari). This is + usually 7, the highest possible ID. Every ID on the SCSI bus must + be unique. Default: determined at run time: If the NV-RAM checksum + is valid, and bit 7 in byte 30 of the NV-RAM is set, the lower 3 + bits of this byte are used as the host ID. (This method is defined + by Atari and also used by some TOS HD drivers.) If the above + isn't given, the default ID is 7. (both, TT and Falcon). + + : + 0 means turn off tagged queuing support, all other values > 0 mean + use tagged queuing for targets that support it. Default: currently + off, but this may change when tagged queuing handling has been + proved to be reliable. + + Tagged queuing means that more than one command can be issued to + one LUN, and the SCSI device itself orders the requests so they + can be performed in optimal order. Not all SCSI devices support + tagged queuing (:-(). + +4.5 switches= +------------- + +Syntax: switches= + + With this option you can switch some hardware lines that are often +used to enable/disable certain hardware extensions. Examples are +OverScan, overclocking, ... + + The is a comma-separated list of the following +items: + + ikbd: set RTS of the keyboard ACIA high + midi: set RTS of the MIDI ACIA high + snd6: set bit 6 of the PSG port A + snd7: set bit 6 of the PSG port A + +It doesn't make sense to mention a switch more than once (no +difference to only once), but you can give as many switches as you +want to enable different features. The switch lines are set as early +as possible during kernel initialization (even before determining the +present hardware.) + + All of the items can also be prefixed with "ov_", i.e. "ov_ikbd", +"ov_midi", ... These options are meant for switching on an OverScan +video extension. The difference to the bare option is that the +switch-on is done after video initialization, and somehow synchronized +to the HBLANK. A speciality is that ov_ikbd and ov_midi are switched +off before rebooting, so that OverScan is disabled and TOS boots +correctly. + + If you give an option both, with and without the "ov_" prefix, the +earlier initialization ("ov_"-less) takes precedence. But the +switching-off on reset still happens in this case. + +5) Options for Amiga Only: +========================== + +5.1) video= +----------- + +Syntax: video=: + +The parameter specifies the name of the frame buffer, valid +options are `amifb', `cyber', 'virge', `retz3' and `clgen', provided +that the respective frame buffer devices have been compiled into the +kernel (or compiled as loadable modules). The behavior of the +option was changed in 2.1.57 so it is now recommended to specify this +option. + +The is a comma-separated list of the sub-options listed +below. This option is organized similar to the Atari version of the +"video"-option (4.1), but knows fewer sub-options. + +5.1.1) video mode +----------------- + +Again, similar to the video mode for the Atari (see 4.1.1). Predefined +modes depend on the used frame buffer device. + +OCS, ECS and AGA machines all use the color frame buffer. The following +predefined video modes are available: + +NTSC modes: + - ntsc : 640x200, 15 kHz, 60 Hz + - ntsc-lace : 640x400, 15 kHz, 60 Hz interlaced +PAL modes: + - pal : 640x256, 15 kHz, 50 Hz + - pal-lace : 640x512, 15 kHz, 50 Hz interlaced +ECS modes: + - multiscan : 640x480, 29 kHz, 57 Hz + - multiscan-lace : 640x960, 29 kHz, 57 Hz interlaced + - euro36 : 640x200, 15 kHz, 72 Hz + - euro36-lace : 640x400, 15 kHz, 72 Hz interlaced + - euro72 : 640x400, 29 kHz, 68 Hz + - euro72-lace : 640x800, 29 kHz, 68 Hz interlaced + - super72 : 800x300, 23 kHz, 70 Hz + - super72-lace : 800x600, 23 kHz, 70 Hz interlaced + - dblntsc-ff : 640x400, 27 kHz, 57 Hz + - dblntsc-lace : 640x800, 27 kHz, 57 Hz interlaced + - dblpal-ff : 640x512, 27 kHz, 47 Hz + - dblpal-lace : 640x1024, 27 kHz, 47 Hz interlaced + - dblntsc : 640x200, 27 kHz, 57 Hz doublescan + - dblpal : 640x256, 27 kHz, 47 Hz doublescan +VGA modes: + - vga : 640x480, 31 kHz, 60 Hz + - vga70 : 640x400, 31 kHz, 70 Hz + +Please notice that the ECS and VGA modes require either an ECS or AGA +chipset, and that these modes are limited to 2-bit color for the ECS +chipset and 8-bit color for the AGA chipset. + +5.1.2) depth +------------ + +Syntax: depth: + +Specify the number of bit-planes for the selected video-mode. + +5.1.3) inverse +-------------- + +Use inverted display (black on white). Functionally the same as the +"inverse" sub-option for the Atari. + +5.1.4) font +----------- + +Syntax: font: + +Specify the font to use in text modes. Functionally the same as the +"font" sub-option for the Atari, except that `PEARL8x8' is used instead +of `VGA8x8' if the vertical size of the display is less than 400 pixel +rows. + +5.1.5) monitorcap: +------------------- + +Syntax: monitorcap:;;; + +This describes the capabilities of a multisync monitor. For now, only +the color frame buffer uses the settings of "monitorcap:". + + and are the minimum and maximum, resp., vertical frequencies +your monitor can work with, in Hz. and are the same for +the horizontal frequency, in kHz. + + The defaults are 50;90;15;38 (Generic Amiga multisync monitor). + + +5.2) fd_def_df0= +---------------- + +Syntax: fd_def_df0= + +Sets the df0 value for "silent" floppy drives. The value should be in +hexadecimal with "0x" prefix. + + +5.3) wd33c93= +------------- + +Syntax: wd33c93= + +These options affect the A590/A2091, A3000 and GVP Series II SCSI +controllers. + +The is a comma-separated list of the sub-options listed +below. + +5.3.1) nosync +------------- + +Syntax: nosync:bitmask + + bitmask is a byte where the 1st 7 bits correspond with the 7 +possible SCSI devices. Set a bit to prevent sync negotiation on that +device. To maintain backwards compatibility, a command-line such as +"wd33c93=255" will be automatically translated to +"wd33c93=nosync:0xff". The default is to disable sync negotiation for +all devices, eg. nosync:0xff. + +5.3.2) period +------------- + +Syntax: period:ns + + `ns' is the minimum # of nanoseconds in a SCSI data transfer +period. Default is 500; acceptable values are 250 - 1000. + +5.3.3) disconnect +----------------- + +Syntax: disconnect:x + + Specify x = 0 to never allow disconnects, 2 to always allow them. +x = 1 does 'adaptive' disconnects, which is the default and generally +the best choice. + +5.3.4) debug +------------ + +Syntax: debug:x + + If `DEBUGGING_ON' is defined, x is a bit mask that causes various +types of debug output to printed - see the DB_xxx defines in +wd33c93.h. + +5.3.5) clock +------------ + +Syntax: clock:x + + x = clock input in MHz for WD33c93 chip. Normal values would be from +8 through 20. The default value depends on your hostadapter(s), +default for the A3000 internal controller is 14, for the A2091 it's 8 +and for the GVP hostadapters it's either 8 or 14, depending on the +hostadapter and the SCSI-clock jumper present on some GVP +hostadapters. + +5.3.6) next +----------- + + No argument. Used to separate blocks of keywords when there's more +than one wd33c93-based host adapter in the system. + +5.3.7) nodma +------------ + +Syntax: nodma:x + + If x is 1 (or if the option is just written as "nodma"), the WD33c93 +controller will not use DMA (= direct memory access) to access the +Amiga's memory. This is useful for some systems (like A3000's and +A4000's with the A3640 accelerator, revision 3.0) that have problems +using DMA to chip memory. The default is 0, i.e. to use DMA if +possible. + + +5.4) gvp11= +----------- + +Syntax: gvp11= + + The earlier versions of the GVP driver did not handle DMA +address-mask settings correctly which made it necessary for some +people to use this option, in order to get their GVP controller +running under Linux. These problems have hopefully been solved and the +use of this option is now highly unrecommended! + + Incorrect use can lead to unpredictable behavior, so please only use +this option if you *know* what you are doing and have a reason to do +so. In any case if you experience problems and need to use this +option, please inform us about it by mailing to the Linux/68k kernel +mailing list. + + The address mask set by this option specifies which addresses are +valid for DMA with the GVP Series II SCSI controller. An address is +valid, if no bits are set except the bits that are set in the mask, +too. + + Some versions of the GVP can only DMA into a 24 bit address range, +some can address a 25 bit address range while others can use the whole +32 bit address range for DMA. The correct setting depends on your +controller and should be autodetected by the driver. An example is the +24 bit region which is specified by a mask of 0x00fffffe. + + +/* Local Variables: */ +/* mode: text */ +/* End: */ diff --git a/samples/man.txt b/samples/man.txt new file mode 100644 index 0000000..919f62c --- /dev/null +++ b/samples/man.txt @@ -0,0 +1,96 @@ +IOCTL-XFS-INUMBERS(2) System Calls Manual IOCTL-XFS-INUMBERS(2) + + + +NAME + ioctl_xfs_inumbers - query allocation information for groups of XFS + inodes + +SYNOPSIS + #include + + int ioctl(int fd, XFS_IOC_INUMBERS, struct xfs_inumbers_req *arg); + +DESCRIPTION + Query inode allocation information for groups of XFS inodes. This + ioctl uses struct xfs_inumbers_req to set up a bulk transfer from the + kernel: + + struct xfs_inumbers_req { + struct xfs_bulk_ireq hdr; + struct xfs_inumbers inumbers[]; + }; + + See below for the xfs_inumbers structure definition. + + struct xfs_bulk_ireq { + uint64_t ino; + uint32_t flags; + uint32_t icount; + uint32_t ocount; + uint32_t agno; + uint64_t reserved[5]; + }; + + hdr describes the information to query. The layout and behavior are + documented in the ioctl_xfs_bulkstat(2) manpage and will not be + discussed further here. + + + inumbers is an array of struct xfs_inumbers which is described below. + The array must have at least icount elements. + + struct xfs_inumbers { + uint64_t xi_startino; + uint64_t xi_allocmask; + uint8_t xi_alloccount; + uint8_t xi_version; + uint8_t xi_padding[6]; + }; + + This structure describes inode usage information for a group of 64 + consecutive inode numbers. + + xi_startino is the first inode number of this group. + + xi_allocmask is a bitmask telling which inodes in this group are + allocated. To clarify, bit N is set if inode xi_startino+N is + allocated. + + xi_alloccount is the number of inodes in this group that are allocated. + This should be equal to popcnt(xi_allocmask). + + xi_version is the version of this data structure. This will be set to + XFS_INUMBERS_VERSION_V5 by the kernel. + + xi_padding[6] is zeroed. + +RETURN VALUE + On error, -1 is returned, and errno is set to indicate the error. + +ERRORS + Error codes can be one of, but are not limited to, the following: + + EFAULT The kernel was not able to copy into the userspace buffer. + + EFSBADCRC + Metadata checksum validation failed while performing the query. + + EFSCORRUPTED + Metadata corruption was encountered while performing the query. + + EINVAL One of the arguments was not valid. + + EIO An I/O error was encountered while performing the query. + + ENOMEM There was insufficient memory to perform the query. + +CONFORMING TO + This API is specific to XFS filesystem on the Linux kernel. + +SEE ALSO + ioctl(2), ioctl_xfs_bulkstat(2). + + + +XFS 2019-05-23 IOCTL-XFS-INUMBERS(2) diff --git a/samples/orwell.txt b/samples/orwell.txt new file mode 100644 index 0000000..da65e79 --- /dev/null +++ b/samples/orwell.txt @@ -0,0 +1,2850 @@ + + + + _ _ ______ + /\ (_) | | | ____| + / \ _ __ _ _ __ ___ __ _| | | |__ __ _ _ __ _ __ ___ + / /\ \ | '_ \| | '_ ` _ \ / _` | | | __/ _` | '__| '_ ` _ \ + / ____ \| | | | | | | | | | (_| | | | | | (_| | | | | | | | | + /_/ \_\_| |_|_|_| |_| |_|\__,_|_| |_| \__,_|_| |_| |_| |_| + by George Orwell + + + + Chapter I + + + +Mr. Jones, of the Manor Farm, had locked the hen-houses for the night, but +was too drunk to remember to shut the pop-holes. With the ring of light +from his lantern dancing from side to side, he lurched across the yard, +kicked off his boots at the back door, drew himself a last glass of beer +from the barrel in the scullery, and made his way up to bed, where +Mrs. Jones was already snoring. + +As soon as the light in the bedroom went out there was a stirring and a +fluttering all through the farm buildings. Word had gone round during the +day that old Major, the prize Middle White boar, had had a strange dream +on the previous night and wished to communicate it to the other animals. +It had been agreed that they should all meet in the big barn as soon as +Mr. Jones was safely out of the way. Old Major (so he was always called, +though the name under which he had been exhibited was Willingdon Beauty) +was so highly regarded on the farm that everyone was quite ready to lose +an hour's sleep in order to hear what he had to say. + +At one end of the big barn, on a sort of raised platform, Major was +already ensconced on his bed of straw, under a lantern which hung from a +beam. He was twelve years old and had lately grown rather stout, but he +was still a majestic-looking pig, with a wise and benevolent appearance in +spite of the fact that his tushes had never been cut. Before long the +other animals began to arrive and make themselves comfortable after their +different fashions. First came the three dogs, Bluebell, Jessie, and +Pincher, and then the pigs, who settled down in the straw immediately in +front of the platform. The hens perched themselves on the window-sills, +the pigeons fluttered up to the rafters, the sheep and cows lay down +behind the pigs and began to chew the cud. The two cart-horses, Boxer and +Clover, came in together, walking very slowly and setting down their vast +hairy hoofs with great care lest there should be some small animal +concealed in the straw. Clover was a stout motherly mare approaching +middle life, who had never quite got her figure back after her fourth foal. +Boxer was an enormous beast, nearly eighteen hands high, and as strong as +any two ordinary horses put together. A white stripe down his nose gave +him a somewhat stupid appearance, and in fact he was not of first-rate +intelligence, but he was universally respected for his steadiness of +character and tremendous powers of work. After the horses came Muriel, +the white goat, and Benjamin, the donkey. Benjamin was the oldest animal +on the farm, and the worst tempered. He seldom talked, and when he did, it +was usually to make some cynical remark--for instance, he would say that +God had given him a tail to keep the flies off, but that he would sooner +have had no tail and no flies. Alone among the animals on the farm he +never laughed. If asked why, he would say that he saw nothing to laugh at. +Nevertheless, without openly admitting it, he was devoted to Boxer; the +two of them usually spent their Sundays together in the small paddock +beyond the orchard, grazing side by side and never speaking. + +The two horses had just lain down when a brood of ducklings, which had +lost their mother, filed into the barn, cheeping feebly and wandering from +side to side to find some place where they would not be trodden on. Clover +made a sort of wall round them with her great foreleg, and the ducklings +nestled down inside it and promptly fell asleep. At the last moment +Mollie, the foolish, pretty white mare who drew Mr. Jones's trap, came +mincing daintily in, chewing at a lump of sugar. She took a place near the +front and began flirting her white mane, hoping to draw attention to the +red ribbons it was plaited with. Last of all came the cat, who looked +round, as usual, for the warmest place, and finally squeezed herself in +between Boxer and Clover; there she purred contentedly throughout Major's +speech without listening to a word of what he was saying. + +All the animals were now present except Moses, the tame raven, who slept +on a perch behind the back door. When Major saw that they had all made +themselves comfortable and were waiting attentively, he cleared his throat +and began: + +"Comrades, you have heard already about the strange dream that I had last +night. But I will come to the dream later. I have something else to say +first. I do not think, comrades, that I shall be with you for many months +longer, and before I die, I feel it my duty to pass on to you such wisdom +as I have acquired. I have had a long life, I have had much time for +thought as I lay alone in my stall, and I think I may say that I +understand the nature of life on this earth as well as any animal now +living. It is about this that I wish to speak to you. + +"Now, comrades, what is the nature of this life of ours? Let us face it: +our lives are miserable, laborious, and short. We are born, we are given +just so much food as will keep the breath in our bodies, and those of us +who are capable of it are forced to work to the last atom of our strength; +and the very instant that our usefulness has come to an end we are +slaughtered with hideous cruelty. No animal in England knows the meaning +of happiness or leisure after he is a year old. No animal in England is +free. The life of an animal is misery and slavery: that is the plain truth. + +"But is this simply part of the order of nature? Is it because this land +of ours is so poor that it cannot afford a decent life to those who dwell +upon it? No, comrades, a thousand times no! The soil of England is +fertile, its climate is good, it is capable of affording food in abundance +to an enormously greater number of animals than now inhabit it. This +single farm of ours would support a dozen horses, twenty cows, hundreds of +sheep--and all of them living in a comfort and a dignity that are now +almost beyond our imagining. Why then do we continue in this miserable +condition? Because nearly the whole of the produce of our labour is stolen +from us by human beings. There, comrades, is the answer to all our +problems. It is summed up in a single word--Man. Man is the only real +enemy we have. Remove Man from the scene, and the root cause of hunger and +overwork is abolished for ever. + +"Man is the only creature that consumes without producing. He does not +give milk, he does not lay eggs, he is too weak to pull the plough, he +cannot run fast enough to catch rabbits. Yet he is lord of all the +animals. He sets them to work, he gives back to them the bare minimum that +will prevent them from starving, and the rest he keeps for himself. Our +labour tills the soil, our dung fertilises it, and yet there is not one of +us that owns more than his bare skin. You cows that I see before me, how +many thousands of gallons of milk have you given during this last year? +And what has happened to that milk which should have been breeding up +sturdy calves? Every drop of it has gone down the throats of our enemies. +And you hens, how many eggs have you laid in this last year, and how many +of those eggs ever hatched into chickens? The rest have all gone to market +to bring in money for Jones and his men. And you, Clover, where are those +four foals you bore, who should have been the support and pleasure of your +old age? Each was sold at a year old--you will never see one of them +again. In return for your four confinements and all your labour in the +fields, what have you ever had except your bare rations and a stall? + +"And even the miserable lives we lead are not allowed to reach their +natural span. For myself I do not grumble, for I am one of the lucky ones. +I am twelve years old and have had over four hundred children. Such is the +natural life of a pig. But no animal escapes the cruel knife in the end. +You young porkers who are sitting in front of me, every one of you will +scream your lives out at the block within a year. To that horror we all +must come--cows, pigs, hens, sheep, everyone. Even the horses and the dogs +have no better fate. You, Boxer, the very day that those great muscles of +yours lose their power, Jones will sell you to the knacker, who will cut +your throat and boil you down for the foxhounds. As for the dogs, when +they grow old and toothless, Jones ties a brick round their necks and +drowns them in the nearest pond. + +"Is it not crystal clear, then, comrades, that all the evils of this life +of ours spring from the tyranny of human beings? Only get rid of Man, and +the produce of our labour would be our own. Almost overnight we could +become rich and free. What then must we do? Why, work night and day, body +and soul, for the overthrow of the human race! That is my message to you, +comrades: Rebellion! I do not know when that Rebellion will come, it might +be in a week or in a hundred years, but I know, as surely as I see this +straw beneath my feet, that sooner or later justice will be done. Fix your +eyes on that, comrades, throughout the short remainder of your lives! And +above all, pass on this message of mine to those who come after you, so +that future generations shall carry on the struggle until it is victorious. + +"And remember, comrades, your resolution must never falter. No argument +must lead you astray. Never listen when they tell you that Man and the +animals have a common interest, that the prosperity of the one is the +prosperity of the others. It is all lies. Man serves the interests of no +creature except himself. And among us animals let there be perfect unity, +perfect comradeship in the struggle. All men are enemies. All animals are +comrades." + +At this moment there was a tremendous uproar. While Major was speaking +four large rats had crept out of their holes and were sitting on their +hindquarters, listening to him. The dogs had suddenly caught sight of +them, and it was only by a swift dash for their holes that the rats saved +their lives. Major raised his trotter for silence. + +"Comrades," he said, "here is a point that must be settled. The wild +creatures, such as rats and rabbits--are they our friends or our enemies? +Let us put it to the vote. I propose this question to the meeting: Are +rats comrades?" + +The vote was taken at once, and it was agreed by an overwhelming majority +that rats were comrades. There were only four dissentients, the three dogs +and the cat, who was afterwards discovered to have voted on both sides. +Major continued: + +"I have little more to say. I merely repeat, remember always your duty of +enmity towards Man and all his ways. Whatever goes upon two legs is an +enemy. Whatever goes upon four legs, or has wings, is a friend. And +remember also that in fighting against Man, we must not come to resemble +him. Even when you have conquered him, do not adopt his vices. No animal +must ever live in a house, or sleep in a bed, or wear clothes, or drink +alcohol, or smoke tobacco, or touch money, or engage in trade. All the +habits of Man are evil. And, above all, no animal must ever tyrannise over +his own kind. Weak or strong, clever or simple, we are all brothers. No +animal must ever kill any other animal. All animals are equal. + +"And now, comrades, I will tell you about my dream of last night. I cannot +describe that dream to you. It was a dream of the earth as it will be when +Man has vanished. But it reminded me of something that I had long +forgotten. Many years ago, when I was a little pig, my mother and the +other sows used to sing an old song of which they knew only the tune and +the first three words. I had known that tune in my infancy, but it had +long since passed out of my mind. Last night, however, it came back to me +in my dream. And what is more, the words of the song also came back-words, +I am certain, which were sung by the animals of long ago and have been +lost to memory for generations. I will sing you that song now, comrades. +I am old and my voice is hoarse, but when I have taught you the tune, you +can sing it better for yourselves. It is called 'Beasts of England'." + +Old Major cleared his throat and began to sing. As he had said, his voice +was hoarse, but he sang well enough, and it was a stirring tune, something +between 'Clementine' and 'La Cucaracha'. The words ran: + +Beasts of England, beasts of Ireland, +Beasts of every land and clime, +Hearken to my joyful tidings +Of the golden future time. + +Soon or late the day is coming, +Tyrant Man shall be o'erthrown, +And the fruitful fields of England +Shall be trod by beasts alone. + +Rings shall vanish from our noses, +And the harness from our back, +Bit and spur shall rust forever, +Cruel whips no more shall crack. + +Riches more than mind can picture, +Wheat and barley, oats and hay, +Clover, beans, and mangel-wurzels +Shall be ours upon that day. + +Bright will shine the fields of England, +Purer shall its waters be, +Sweeter yet shall blow its breezes +On the day that sets us free. + +For that day we all must labour, +Though we die before it break; +Cows and horses, geese and turkeys, +All must toil for freedom's sake. + +Beasts of England, beasts of Ireland, +Beasts of every land and clime, +Hearken well and spread my tidings +Of the golden future time. + + +The singing of this song threw the animals into the wildest excitement. +Almost before Major had reached the end, they had begun singing it for +themselves. Even the stupidest of them had already picked up the tune and +a few of the words, and as for the clever ones, such as the pigs and dogs, +they had the entire song by heart within a few minutes. And then, after a +few preliminary tries, the whole farm burst out into 'Beasts of England' in +tremendous unison. The cows lowed it, the dogs whined it, the sheep +bleated it, the horses whinnied it, the ducks quacked it. They were so +delighted with the song that they sang it right through five times in +succession, and might have continued singing it all night if they had not +been interrupted. + +Unfortunately, the uproar awoke Mr. Jones, who sprang out of bed, making +sure that there was a fox in the yard. He seized the gun which always +stood in a corner of his bedroom, and let fly a charge of number 6 shot +into the darkness. The pellets buried themselves in the wall of the barn +and the meeting broke up hurriedly. Everyone fled to his own +sleeping-place. The birds jumped on to their perches, the animals settled +down in the straw, and the whole farm was asleep in a moment. + + + + + Chapter II + + + +Three nights later old Major died peacefully in his sleep. His body was +buried at the foot of the orchard. + +This was early in March. During the next three months there was much +secret activity. Major's speech had given to the more intelligent animals +on the farm a completely new outlook on life. They did not know when the +Rebellion predicted by Major would take place, they had no reason for +thinking that it would be within their own lifetime, but they saw clearly +that it was their duty to prepare for it. The work of teaching and +organising the others fell naturally upon the pigs, who were generally +recognised as being the cleverest of the animals. Pre-eminent among the +pigs were two young boars named Snowball and Napoleon, whom Mr. Jones was +breeding up for sale. Napoleon was a large, rather fierce-looking +Berkshire boar, the only Berkshire on the farm, not much of a talker, but +with a reputation for getting his own way. Snowball was a more vivacious +pig than Napoleon, quicker in speech and more inventive, but was not +considered to have the same depth of character. All the other male pigs on +the farm were porkers. The best known among them was a small fat pig named +Squealer, with very round cheeks, twinkling eyes, nimble movements, and a +shrill voice. He was a brilliant talker, and when he was arguing some +difficult point he had a way of skipping from side to side and whisking +his tail which was somehow very persuasive. The others said of Squealer +that he could turn black into white. + +These three had elaborated old Major's teachings into a complete system of +thought, to which they gave the name of Animalism. Several nights a week, +after Mr. Jones was asleep, they held secret meetings in the barn and +expounded the principles of Animalism to the others. At the beginning they +met with much stupidity and apathy. Some of the animals talked of the duty +of loyalty to Mr. Jones, whom they referred to as "Master," or made +elementary remarks such as "Mr. Jones feeds us. If he were gone, we should +starve to death." Others asked such questions as "Why should we care what +happens after we are dead?" or "If this Rebellion is to happen anyway, +what difference does it make whether we work for it or not?", and the pigs +had great difficulty in making them see that this was contrary to the +spirit of Animalism. The stupidest questions of all were asked by Mollie, +the white mare. The very first question she asked Snowball was: "Will +there still be sugar after the Rebellion?" + +"No," said Snowball firmly. "We have no means of making sugar on this +farm. Besides, you do not need sugar. You will have all the oats and hay +you want." + +"And shall I still be allowed to wear ribbons in my mane?" asked Mollie. + +"Comrade," said Snowball, "those ribbons that you are so devoted to are +the badge of slavery. Can you not understand that liberty is worth more +than ribbons?" + +Mollie agreed, but she did not sound very convinced. + +The pigs had an even harder struggle to counteract the lies put about by +Moses, the tame raven. Moses, who was Mr. Jones's especial pet, was a spy +and a tale-bearer, but he was also a clever talker. He claimed to know of +the existence of a mysterious country called Sugarcandy Mountain, to which +all animals went when they died. It was situated somewhere up in the sky, +a little distance beyond the clouds, Moses said. In Sugarcandy Mountain it +was Sunday seven days a week, clover was in season all the year round, and +lump sugar and linseed cake grew on the hedges. The animals hated Moses +because he told tales and did no work, but some of them believed in +Sugarcandy Mountain, and the pigs had to argue very hard to persuade them +that there was no such place. + +Their most faithful disciples were the two cart-horses, Boxer and Clover. +These two had great difficulty in thinking anything out for themselves, +but having once accepted the pigs as their teachers, they absorbed +everything that they were told, and passed it on to the other animals by +simple arguments. They were unfailing in their attendance at the secret +meetings in the barn, and led the singing of 'Beasts of England', with +which the meetings always ended. + +Now, as it turned out, the Rebellion was achieved much earlier and more +easily than anyone had expected. In past years Mr. Jones, although a hard +master, had been a capable farmer, but of late he had fallen on evil days. +He had become much disheartened after losing money in a lawsuit, and had +taken to drinking more than was good for him. For whole days at a time he +would lounge in his Windsor chair in the kitchen, reading the newspapers, +drinking, and occasionally feeding Moses on crusts of bread soaked in +beer. His men were idle and dishonest, the fields were full of weeds, the +buildings wanted roofing, the hedges were neglected, and the animals were +underfed. + +June came and the hay was almost ready for cutting. On Midsummer's Eve, +which was a Saturday, Mr. Jones went into Willingdon and got so drunk at +the Red Lion that he did not come back till midday on Sunday. The men had +milked the cows in the early morning and then had gone out rabbiting, +without bothering to feed the animals. When Mr. Jones got back he +immediately went to sleep on the drawing-room sofa with the News of the +World over his face, so that when evening came, the animals were still +unfed. At last they could stand it no longer. One of the cows broke in the +door of the store-shed with her horn and all the animals began to help +themselves from the bins. It was just then that Mr. Jones woke up. The +next moment he and his four men were in the store-shed with whips in their +hands, lashing out in all directions. This was more than the hungry +animals could bear. With one accord, though nothing of the kind had been +planned beforehand, they flung themselves upon their tormentors. Jones and +his men suddenly found themselves being butted and kicked from all sides. +The situation was quite out of their control. They had never seen animals +behave like this before, and this sudden uprising of creatures whom they +were used to thrashing and maltreating just as they chose, frightened them +almost out of their wits. After only a moment or two they gave up trying +to defend themselves and took to their heels. A minute later all five of +them were in full flight down the cart-track that led to the main road, +with the animals pursuing them in triumph. + +Mrs. Jones looked out of the bedroom window, saw what was happening, +hurriedly flung a few possessions into a carpet bag, and slipped out of +the farm by another way. Moses sprang off his perch and flapped after her, +croaking loudly. Meanwhile the animals had chased Jones and his men out on +to the road and slammed the five-barred gate behind them. And so, almost +before they knew what was happening, the Rebellion had been successfully +carried through: Jones was expelled, and the Manor Farm was theirs. + +For the first few minutes the animals could hardly believe in their good +fortune. Their first act was to gallop in a body right round the +boundaries of the farm, as though to make quite sure that no human being +was hiding anywhere upon it; then they raced back to the farm buildings to +wipe out the last traces of Jones's hated reign. The harness-room at the +end of the stables was broken open; the bits, the nose-rings, the +dog-chains, the cruel knives with which Mr. Jones had been used to +castrate the pigs and lambs, were all flung down the well. The reins, the +halters, the blinkers, the degrading nosebags, were thrown on to the +rubbish fire which was burning in the yard. So were the whips. All the +animals capered with joy when they saw the whips going up in flames. +Snowball also threw on to the fire the ribbons with which the horses' +manes and tails had usually been decorated on market days. + +"Ribbons," he said, "should be considered as clothes, which are the mark +of a human being. All animals should go naked." + +When Boxer heard this he fetched the small straw hat which he wore in +summer to keep the flies out of his ears, and flung it on to the fire with +the rest. + +In a very little while the animals had destroyed everything that reminded +them of Mr. Jones. Napoleon then led them back to the store-shed and +served out a double ration of corn to everybody, with two biscuits for +each dog. Then they sang 'Beasts of England' from end to end seven times +running, and after that they settled down for the night and slept as they +had never slept before. + +But they woke at dawn as usual, and suddenly remembering the glorious +thing that had happened, they all raced out into the pasture together. A +little way down the pasture there was a knoll that commanded a view of +most of the farm. The animals rushed to the top of it and gazed round them +in the clear morning light. Yes, it was theirs--everything that they could +see was theirs! In the ecstasy of that thought they gambolled round and +round, they hurled themselves into the air in great leaps of excitement. +They rolled in the dew, they cropped mouthfuls of the sweet summer grass, +they kicked up clods of the black earth and snuffed its rich scent. Then +they made a tour of inspection of the whole farm and surveyed with +speechless admiration the ploughland, the hayfield, the orchard, the pool, +the spinney. It was as though they had never seen these things before, and +even now they could hardly believe that it was all their own. + +Then they filed back to the farm buildings and halted in silence outside +the door of the farmhouse. That was theirs too, but they were frightened +to go inside. After a moment, however, Snowball and Napoleon butted the +door open with their shoulders and the animals entered in single file, +walking with the utmost care for fear of disturbing anything. They tiptoed +from room to room, afraid to speak above a whisper and gazing with a kind +of awe at the unbelievable luxury, at the beds with their feather +mattresses, the looking-glasses, the horsehair sofa, the Brussels carpet, +the lithograph of Queen Victoria over the drawing-room mantelpiece. They +were just coming down the stairs when Mollie was discovered to be missing. +Going back, the others found that she had remained behind in the best +bedroom. She had taken a piece of blue ribbon from Mrs. Jones's +dressing-table, and was holding it against her shoulder and admiring +herself in the glass in a very foolish manner. The others reproached her +sharply, and they went outside. Some hams hanging in the kitchen were +taken out for burial, and the barrel of beer in the scullery was stove in +with a kick from Boxer's hoof, otherwise nothing in the house was touched. +A unanimous resolution was passed on the spot that the farmhouse should be +preserved as a museum. All were agreed that no animal must ever live there. + +The animals had their breakfast, and then Snowball and Napoleon called +them together again. + +"Comrades," said Snowball, "it is half-past six and we have a long day +before us. Today we begin the hay harvest. But there is another matter +that must be attended to first." + +The pigs now revealed that during the past three months they had taught +themselves to read and write from an old spelling book which had belonged +to Mr. Jones's children and which had been thrown on the rubbish heap. +Napoleon sent for pots of black and white paint and led the way down to +the five-barred gate that gave on to the main road. Then Snowball (for it +was Snowball who was best at writing) took a brush between the two +knuckles of his trotter, painted out MANOR FARM from the top bar of the +gate and in its place painted ANIMAL FARM. This was to be the name of the +farm from now onwards. After this they went back to the farm buildings, +where Snowball and Napoleon sent for a ladder which they caused to be set +against the end wall of the big barn. They explained that by their studies +of the past three months the pigs had succeeded in reducing the principles +of Animalism to Seven Commandments. These Seven Commandments would now be +inscribed on the wall; they would form an unalterable law by which all the +animals on Animal Farm must live for ever after. With some difficulty +(for it is not easy for a pig to balance himself on a ladder) Snowball +climbed up and set to work, with Squealer a few rungs below him holding +the paint-pot. The Commandments were written on the tarred wall in great +white letters that could be read thirty yards away. They ran thus: + + +THE SEVEN COMMANDMENTS + +1. Whatever goes upon two legs is an enemy. +2. Whatever goes upon four legs, or has wings, is a friend. +3. No animal shall wear clothes. +4. No animal shall sleep in a bed. +5. No animal shall drink alcohol. +6. No animal shall kill any other animal. +7. All animals are equal. + + +It was very neatly written, and except that "friend" was written "freind" +and one of the "S's" was the wrong way round, the spelling was correct all +the way through. Snowball read it aloud for the benefit of the others. All +the animals nodded in complete agreement, and the cleverer ones at once +began to learn the Commandments by heart. + +"Now, comrades," cried Snowball, throwing down the paint-brush, "to the +hayfield! Let us make it a point of honour to get in the harvest more +quickly than Jones and his men could do." + +But at this moment the three cows, who had seemed uneasy for some time +past, set up a loud lowing. They had not been milked for twenty-four +hours, and their udders were almost bursting. After a little thought, the +pigs sent for buckets and milked the cows fairly successfully, their +trotters being well adapted to this task. Soon there were five buckets of +frothing creamy milk at which many of the animals looked with considerable +interest. + +"What is going to happen to all that milk?" said someone. + +"Jones used sometimes to mix some of it in our mash," said one of the hens. + +"Never mind the milk, comrades!" cried Napoleon, placing himself in front +of the buckets. "That will be attended to. The harvest is more important. +Comrade Snowball will lead the way. I shall follow in a few minutes. +Forward, comrades! The hay is waiting." + +So the animals trooped down to the hayfield to begin the harvest, and when +they came back in the evening it was noticed that the milk had disappeared. + + + + + Chapter III + + + +How they toiled and sweated to get the hay in! But their efforts were +rewarded, for the harvest was an even bigger success than they had hoped. + +Sometimes the work was hard; the implements had been designed for human +beings and not for animals, and it was a great drawback that no animal was +able to use any tool that involved standing on his hind legs. But the pigs +were so clever that they could think of a way round every difficulty. As +for the horses, they knew every inch of the field, and in fact understood +the business of mowing and raking far better than Jones and his men had +ever done. The pigs did not actually work, but directed and supervised the +others. With their superior knowledge it was natural that they should +assume the leadership. Boxer and Clover would harness themselves to the +cutter or the horse-rake (no bits or reins were needed in these days, of +course) and tramp steadily round and round the field with a pig walking +behind and calling out "Gee up, comrade!" or "Whoa back, comrade!" as the +case might be. And every animal down to the humblest worked at turning the +hay and gathering it. Even the ducks and hens toiled to and fro all day in +the sun, carrying tiny wisps of hay in their beaks. In the end they +finished the harvest in two days' less time than it had usually taken +Jones and his men. Moreover, it was the biggest harvest that the farm had +ever seen. There was no wastage whatever; the hens and ducks with their +sharp eyes had gathered up the very last stalk. And not an animal on the +farm had stolen so much as a mouthful. + +All through that summer the work of the farm went like clockwork. The +animals were happy as they had never conceived it possible to be. Every +mouthful of food was an acute positive pleasure, now that it was truly +their own food, produced by themselves and for themselves, not doled out +to them by a grudging master. With the worthless parasitical human beings +gone, there was more for everyone to eat. There was more leisure too, +inexperienced though the animals were. They met with many difficulties--for +instance, later in the year, when they harvested the corn, they had to +tread it out in the ancient style and blow away the chaff with their +breath, since the farm possessed no threshing machine--but the pigs with +their cleverness and Boxer with his tremendous muscles always pulled them +through. Boxer was the admiration of everybody. He had been a hard worker +even in Jones's time, but now he seemed more like three horses than one; +there were days when the entire work of the farm seemed to rest on his +mighty shoulders. From morning to night he was pushing and pulling, always +at the spot where the work was hardest. He had made an arrangement with +one of the cockerels to call him in the mornings half an hour earlier than +anyone else, and would put in some volunteer labour at whatever seemed to +be most needed, before the regular day's work began. His answer to every +problem, every setback, was "I will work harder!"--which he had adopted as +his personal motto. + +But everyone worked according to his capacity. The hens and ducks, for +instance, saved five bushels of corn at the harvest by gathering up the +stray grains. Nobody stole, nobody grumbled over his rations, the +quarrelling and biting and jealousy which had been normal features of life +in the old days had almost disappeared. Nobody shirked--or almost nobody. +Mollie, it was true, was not good at getting up in the mornings, and had a +way of leaving work early on the ground that there was a stone in her +hoof. And the behaviour of the cat was somewhat peculiar. It was soon +noticed that when there was work to be done the cat could never be found. +She would vanish for hours on end, and then reappear at meal-times, or in +the evening after work was over, as though nothing had happened. But she +always made such excellent excuses, and purred so affectionately, that it +was impossible not to believe in her good intentions. Old Benjamin, the +donkey, seemed quite unchanged since the Rebellion. He did his work in the +same slow obstinate way as he had done it in Jones's time, never shirking +and never volunteering for extra work either. About the Rebellion and its +results he would express no opinion. When asked whether he was not happier +now that Jones was gone, he would say only "Donkeys live a long time. None +of you has ever seen a dead donkey," and the others had to be content with +this cryptic answer. + +On Sundays there was no work. Breakfast was an hour later than usual, and +after breakfast there was a ceremony which was observed every week without +fail. First came the hoisting of the flag. Snowball had found in the +harness-room an old green tablecloth of Mrs. Jones's and had painted on it +a hoof and a horn in white. This was run up the flagstaff in the farmhouse +garden every Sunday morning. The flag was green, Snowball explained, to +represent the green fields of England, while the hoof and horn signified +the future Republic of the Animals which would arise when the human race +had been finally overthrown. After the hoisting of the flag all the +animals trooped into the big barn for a general assembly which was known +as the Meeting. Here the work of the coming week was planned out and +resolutions were put forward and debated. It was always the pigs who put +forward the resolutions. The other animals understood how to vote, but +could never think of any resolutions of their own. Snowball and Napoleon +were by far the most active in the debates. But it was noticed that these +two were never in agreement: whatever suggestion either of them made, the +other could be counted on to oppose it. Even when it was resolved--a thing +no one could object to in itself--to set aside the small paddock behind +the orchard as a home of rest for animals who were past work, there was a +stormy debate over the correct retiring age for each class of animal. The +Meeting always ended with the singing of 'Beasts of England', and the +afternoon was given up to recreation. + +The pigs had set aside the harness-room as a headquarters for themselves. +Here, in the evenings, they studied blacksmithing, carpentering, and other +necessary arts from books which they had brought out of the farmhouse. +Snowball also busied himself with organising the other animals into what +he called Animal Committees. He was indefatigable at this. He formed the +Egg Production Committee for the hens, the Clean Tails League for the +cows, the Wild Comrades' Re-education Committee (the object of this was to +tame the rats and rabbits), the Whiter Wool Movement for the sheep, and +various others, besides instituting classes in reading and writing. On the +whole, these projects were a failure. The attempt to tame the wild +creatures, for instance, broke down almost immediately. They continued to +behave very much as before, and when treated with generosity, simply took +advantage of it. The cat joined the Re-education Committee and was very +active in it for some days. She was seen one day sitting on a roof and +talking to some sparrows who were just out of her reach. She was telling +them that all animals were now comrades and that any sparrow who chose +could come and perch on her paw; but the sparrows kept their distance. + +The reading and writing classes, however, were a great success. By the +autumn almost every animal on the farm was literate in some degree. + +As for the pigs, they could already read and write perfectly. The dogs +learned to read fairly well, but were not interested in reading anything +except the Seven Commandments. Muriel, the goat, could read somewhat +better than the dogs, and sometimes used to read to the others in the +evenings from scraps of newspaper which she found on the rubbish heap. +Benjamin could read as well as any pig, but never exercised his faculty. +So far as he knew, he said, there was nothing worth reading. Clover learnt +the whole alphabet, but could not put words together. Boxer could not get +beyond the letter D. He would trace out A, B, C, D, in the dust with his +great hoof, and then would stand staring at the letters with his ears +back, sometimes shaking his forelock, trying with all his might to +remember what came next and never succeeding. On several occasions, +indeed, he did learn E, F, G, H, but by the time he knew them, it was +always discovered that he had forgotten A, B, C, and D. Finally he decided +to be content with the first four letters, and used to write them out once +or twice every day to refresh his memory. Mollie refused to learn any but +the six letters which spelt her own name. She would form these very neatly +out of pieces of twig, and would then decorate them with a flower or two +and walk round them admiring them. + +None of the other animals on the farm could get further than the letter A. +It was also found that the stupider animals, such as the sheep, hens, and +ducks, were unable to learn the Seven Commandments by heart. After much +thought Snowball declared that the Seven Commandments could in effect be +reduced to a single maxim, namely: "Four legs good, two legs bad." This, +he said, contained the essential principle of Animalism. Whoever had +thoroughly grasped it would be safe from human influences. The birds at +first objected, since it seemed to them that they also had two legs, but +Snowball proved to them that this was not so. + +"A bird's wing, comrades," he said, "is an organ of propulsion and not of +manipulation. It should therefore be regarded as a leg. The distinguishing +mark of man is the HAND, the instrument with which he does all his +mischief." + +The birds did not understand Snowball's long words, but they accepted his +explanation, and all the humbler animals set to work to learn the new +maxim by heart. FOUR LEGS GOOD, TWO LEGS BAD, was inscribed on the end +wall of the barn, above the Seven Commandments and in bigger letters. When +they had once got it by heart, the sheep developed a great liking for this +maxim, and often as they lay in the field they would all start bleating +"Four legs good, two legs bad! Four legs good, two legs bad!" and keep it +up for hours on end, never growing tired of it. + +Napoleon took no interest in Snowball's committees. He said that the +education of the young was more important than anything that could be done +for those who were already grown up. It happened that Jessie and Bluebell +had both whelped soon after the hay harvest, giving birth between them to +nine sturdy puppies. As soon as they were weaned, Napoleon took them away +from their mothers, saying that he would make himself responsible for +their education. He took them up into a loft which could only be reached +by a ladder from the harness-room, and there kept them in such seclusion +that the rest of the farm soon forgot their existence. + +The mystery of where the milk went to was soon cleared up. It was mixed +every day into the pigs' mash. The early apples were now ripening, and the +grass of the orchard was littered with windfalls. The animals had assumed +as a matter of course that these would be shared out equally; one day, +however, the order went forth that all the windfalls were to be collected +and brought to the harness-room for the use of the pigs. At this some of +the other animals murmured, but it was no use. All the pigs were in full +agreement on this point, even Snowball and Napoleon. Squealer was sent to +make the necessary explanations to the others. + +"Comrades!" he cried. "You do not imagine, I hope, that we pigs are doing +this in a spirit of selfishness and privilege? Many of us actually dislike +milk and apples. I dislike them myself. Our sole object in taking these +things is to preserve our health. Milk and apples (this has been proved by +Science, comrades) contain substances absolutely necessary to the +well-being of a pig. We pigs are brainworkers. The whole management and +organisation of this farm depend on us. Day and night we are watching over +your welfare. It is for YOUR sake that we drink that milk and eat those +apples. Do you know what would happen if we pigs failed in our duty? Jones +would come back! Yes, Jones would come back! Surely, comrades," cried +Squealer almost pleadingly, skipping from side to side and whisking his +tail, "surely there is no one among you who wants to see Jones come back?" + +Now if there was one thing that the animals were completely certain of, it +was that they did not want Jones back. When it was put to them in this +light, they had no more to say. The importance of keeping the pigs in good +health was all too obvious. So it was agreed without further argument that +the milk and the windfall apples (and also the main crop of apples when +they ripened) should be reserved for the pigs alone. + + + + + Chapter IV + + + +By the late summer the news of what had happened on Animal Farm had spread +across half the county. Every day Snowball and Napoleon sent out flights +of pigeons whose instructions were to mingle with the animals on +neighbouring farms, tell them the story of the Rebellion, and teach them +the tune of 'Beasts of England'. + +Most of this time Mr. Jones had spent sitting in the taproom of the Red +Lion at Willingdon, complaining to anyone who would listen of the +monstrous injustice he had suffered in being turned out of his property by +a pack of good-for-nothing animals. The other farmers sympathised in +principle, but they did not at first give him much help. At heart, each of +them was secretly wondering whether he could not somehow turn Jones's +misfortune to his own advantage. It was lucky that the owners of the two +farms which adjoined Animal Farm were on permanently bad terms. One of +them, which was named Foxwood, was a large, neglected, old-fashioned farm, +much overgrown by woodland, with all its pastures worn out and its hedges +in a disgraceful condition. Its owner, Mr. Pilkington, was an easy-going +gentleman farmer who spent most of his time in fishing or hunting +according to the season. The other farm, which was called Pinchfield, was +smaller and better kept. Its owner was a Mr. Frederick, a tough, shrewd +man, perpetually involved in lawsuits and with a name for driving hard +bargains. These two disliked each other so much that it was difficult for +them to come to any agreement, even in defence of their own interests. + +Nevertheless, they were both thoroughly frightened by the rebellion on +Animal Farm, and very anxious to prevent their own animals from learning +too much about it. At first they pretended to laugh to scorn the idea of +animals managing a farm for themselves. The whole thing would be over in a +fortnight, they said. They put it about that the animals on the Manor Farm +(they insisted on calling it the Manor Farm; they would not tolerate the +name "Animal Farm") were perpetually fighting among themselves and were +also rapidly starving to death. When time passed and the animals had +evidently not starved to death, Frederick and Pilkington changed their +tune and began to talk of the terrible wickedness that now flourished on +Animal Farm. It was given out that the animals there practised cannibalism, +tortured one another with red-hot horseshoes, and had their females in +common. This was what came of rebelling against the laws of Nature, +Frederick and Pilkington said. + +However, these stories were never fully believed. Rumours of a wonderful +farm, where the human beings had been turned out and the animals managed +their own affairs, continued to circulate in vague and distorted forms, +and throughout that year a wave of rebelliousness ran through the +countryside. Bulls which had always been tractable suddenly turned savage, +sheep broke down hedges and devoured the clover, cows kicked the pail +over, hunters refused their fences and shot their riders on to the other +side. Above all, the tune and even the words of 'Beasts of England' were +known everywhere. It had spread with astonishing speed. The human beings +could not contain their rage when they heard this song, though they +pretended to think it merely ridiculous. They could not understand, they +said, how even animals could bring themselves to sing such contemptible +rubbish. Any animal caught singing it was given a flogging on the spot. +And yet the song was irrepressible. The blackbirds whistled it in the +hedges, the pigeons cooed it in the elms, it got into the din of the +smithies and the tune of the church bells. And when the human beings +listened to it, they secretly trembled, hearing in it a prophecy of their +future doom. + +Early in October, when the corn was cut and stacked and some of it was +already threshed, a flight of pigeons came whirling through the air and +alighted in the yard of Animal Farm in the wildest excitement. Jones and +all his men, with half a dozen others from Foxwood and Pinchfield, had +entered the five-barred gate and were coming up the cart-track that led to +the farm. They were all carrying sticks, except Jones, who was marching +ahead with a gun in his hands. Obviously they were going to attempt the +recapture of the farm. + +This had long been expected, and all preparations had been made. Snowball, +who had studied an old book of Julius Caesar's campaigns which he had +found in the farmhouse, was in charge of the defensive operations. He gave +his orders quickly, and in a couple of minutes every animal was at his +post. + +As the human beings approached the farm buildings, Snowball launched his +first attack. All the pigeons, to the number of thirty-five, flew to and +fro over the men's heads and muted upon them from mid-air; and while the +men were dealing with this, the geese, who had been hiding behind the +hedge, rushed out and pecked viciously at the calves of their legs. +However, this was only a light skirmishing manoeuvre, intended to create a +little disorder, and the men easily drove the geese off with their sticks. +Snowball now launched his second line of attack. Muriel, Benjamin, and all +the sheep, with Snowball at the head of them, rushed forward and prodded +and butted the men from every side, while Benjamin turned around and +lashed at them with his small hoofs. But once again the men, with their +sticks and their hobnailed boots, were too strong for them; and suddenly, +at a squeal from Snowball, which was the signal for retreat, all the +animals turned and fled through the gateway into the yard. + +The men gave a shout of triumph. They saw, as they imagined, their enemies +in flight, and they rushed after them in disorder. This was just what +Snowball had intended. As soon as they were well inside the yard, the +three horses, the three cows, and the rest of the pigs, who had been lying +in ambush in the cowshed, suddenly emerged in their rear, cutting them +off. Snowball now gave the signal for the charge. He himself dashed +straight for Jones. Jones saw him coming, raised his gun and fired. The +pellets scored bloody streaks along Snowball's back, and a sheep dropped +dead. Without halting for an instant, Snowball flung his fifteen stone +against Jones's legs. Jones was hurled into a pile of dung and his gun +flew out of his hands. But the most terrifying spectacle of all was Boxer, +rearing up on his hind legs and striking out with his great iron-shod +hoofs like a stallion. His very first blow took a stable-lad from Foxwood +on the skull and stretched him lifeless in the mud. At the sight, several +men dropped their sticks and tried to run. Panic overtook them, and the +next moment all the animals together were chasing them round and round the +yard. They were gored, kicked, bitten, trampled on. There was not an +animal on the farm that did not take vengeance on them after his own +fashion. Even the cat suddenly leapt off a roof onto a cowman's shoulders +and sank her claws in his neck, at which he yelled horribly. At a moment +when the opening was clear, the men were glad enough to rush out of the +yard and make a bolt for the main road. And so within five minutes of +their invasion they were in ignominious retreat by the same way as they +had come, with a flock of geese hissing after them and pecking at their +calves all the way. + +All the men were gone except one. Back in the yard Boxer was pawing with +his hoof at the stable-lad who lay face down in the mud, trying to turn +him over. The boy did not stir. + +"He is dead," said Boxer sorrowfully. "I had no intention of doing that. +I forgot that I was wearing iron shoes. Who will believe that I did not do +this on purpose?" + +"No sentimentality, comrade!" cried Snowball from whose wounds the blood +was still dripping. "War is war. The only good human being is a dead one." + +"I have no wish to take life, not even human life," repeated Boxer, and +his eyes were full of tears. + +"Where is Mollie?" exclaimed somebody. + +Mollie in fact was missing. For a moment there was great alarm; it was +feared that the men might have harmed her in some way, or even carried her +off with them. In the end, however, she was found hiding in her stall with +her head buried among the hay in the manger. She had taken to flight as +soon as the gun went off. And when the others came back from looking for +her, it was to find that the stable-lad, who in fact was only stunned, had +already recovered and made off. + +The animals had now reassembled in the wildest excitement, each recounting +his own exploits in the battle at the top of his voice. An impromptu +celebration of the victory was held immediately. The flag was run up and +'Beasts of England' was sung a number of times, then the sheep who had been +killed was given a solemn funeral, a hawthorn bush being planted on her +grave. At the graveside Snowball made a little speech, emphasising the +need for all animals to be ready to die for Animal Farm if need be. + +The animals decided unanimously to create a military decoration, "Animal +Hero, First Class," which was conferred there and then on Snowball and +Boxer. It consisted of a brass medal (they were really some old +horse-brasses which had been found in the harness-room), to be worn on +Sundays and holidays. There was also "Animal Hero, Second Class," which +was conferred posthumously on the dead sheep. + +There was much discussion as to what the battle should be called. In the +end, it was named the Battle of the Cowshed, since that was where the +ambush had been sprung. Mr. Jones's gun had been found lying in the mud, +and it was known that there was a supply of cartridges in the farmhouse. +It was decided to set the gun up at the foot of the Flagstaff, like a +piece of artillery, and to fire it twice a year--once on October the +twelfth, the anniversary of the Battle of the Cowshed, and once on +Midsummer Day, the anniversary of the Rebellion. + + + + + Chapter V + + + +As winter drew on, Mollie became more and more troublesome. She was late +for work every morning and excused herself by saying that she had +overslept, and she complained of mysterious pains, although her appetite +was excellent. On every kind of pretext she would run away from work and +go to the drinking pool, where she would stand foolishly gazing at her own +reflection in the water. But there were also rumours of something more +serious. One day, as Mollie strolled blithely into the yard, flirting her +long tail and chewing at a stalk of hay, Clover took her aside. + +"Mollie," she said, "I have something very serious to say to you. This +morning I saw you looking over the hedge that divides Animal Farm from +Foxwood. One of Mr. Pilkington's men was standing on the other side of the +hedge. And--I was a long way away, but I am almost certain I saw this--he +was talking to you and you were allowing him to stroke your nose. What +does that mean, Mollie?" + +"He didn't! I wasn't! It isn't true!" cried Mollie, beginning to prance +about and paw the ground. + +"Mollie! Look me in the face. Do you give me your word of honour that that +man was not stroking your nose?" + +"It isn't true!" repeated Mollie, but she could not look Clover in the +face, and the next moment she took to her heels and galloped away into the +field. + +A thought struck Clover. Without saying anything to the others, she went +to Mollie's stall and turned over the straw with her hoof. Hidden under +the straw was a little pile of lump sugar and several bunches of ribbon of +different colours. + +Three days later Mollie disappeared. For some weeks nothing was known of +her whereabouts, then the pigeons reported that they had seen her on the +other side of Willingdon. She was between the shafts of a smart dogcart +painted red and black, which was standing outside a public-house. A fat +red-faced man in check breeches and gaiters, who looked like a publican, +was stroking her nose and feeding her with sugar. Her coat was newly +clipped and she wore a scarlet ribbon round her forelock. She appeared to +be enjoying herself, so the pigeons said. None of the animals ever +mentioned Mollie again. + +In January there came bitterly hard weather. The earth was like iron, and +nothing could be done in the fields. Many meetings were held in the big +barn, and the pigs occupied themselves with planning out the work of the +coming season. It had come to be accepted that the pigs, who were +manifestly cleverer than the other animals, should decide all questions of +farm policy, though their decisions had to be ratified by a majority vote. +This arrangement would have worked well enough if it had not been for the +disputes between Snowball and Napoleon. These two disagreed at every point +where disagreement was possible. If one of them suggested sowing a bigger +acreage with barley, the other was certain to demand a bigger acreage of +oats, and if one of them said that such and such a field was just right +for cabbages, the other would declare that it was useless for anything +except roots. Each had his own following, and there were some violent +debates. At the Meetings Snowball often won over the majority by his +brilliant speeches, but Napoleon was better at canvassing support for +himself in between times. He was especially successful with the sheep. Of +late the sheep had taken to bleating "Four legs good, two legs bad" both +in and out of season, and they often interrupted the Meeting with this. It +was noticed that they were especially liable to break into "Four legs +good, two legs bad" at crucial moments in Snowball's speeches. Snowball +had made a close study of some back numbers of the 'Farmer and +Stockbreeder' which he had found in the farmhouse, and was full of plans +for innovations and improvements. He talked learnedly about field drains, +silage, and basic slag, and had worked out a complicated scheme for all +the animals to drop their dung directly in the fields, at a different spot +every day, to save the labour of cartage. Napoleon produced no schemes of +his own, but said quietly that Snowball's would come to nothing, and +seemed to be biding his time. But of all their controversies, none was so +bitter as the one that took place over the windmill. + +In the long pasture, not far from the farm buildings, there was a small +knoll which was the highest point on the farm. After surveying the ground, +Snowball declared that this was just the place for a windmill, which could +be made to operate a dynamo and supply the farm with electrical power. +This would light the stalls and warm them in winter, and would also run a +circular saw, a chaff-cutter, a mangel-slicer, and an electric milking +machine. The animals had never heard of anything of this kind before +(for the farm was an old-fashioned one and had only the most primitive +machinery), and they listened in astonishment while Snowball conjured up +pictures of fantastic machines which would do their work for them while +they grazed at their ease in the fields or improved their minds with +reading and conversation. + +Within a few weeks Snowball's plans for the windmill were fully worked +out. The mechanical details came mostly from three books which had +belonged to Mr. Jones--'One Thousand Useful Things to Do About the House', +'Every Man His Own Bricklayer', and 'Electricity for Beginners'. Snowball +used as his study a shed which had once been used for incubators and had a +smooth wooden floor, suitable for drawing on. He was closeted there for +hours at a time. With his books held open by a stone, and with a piece of +chalk gripped between the knuckles of his trotter, he would move rapidly +to and fro, drawing in line after line and uttering little whimpers of +excitement. Gradually the plans grew into a complicated mass of cranks and +cog-wheels, covering more than half the floor, which the other animals +found completely unintelligible but very impressive. All of them came to +look at Snowball's drawings at least once a day. Even the hens and ducks +came, and were at pains not to tread on the chalk marks. Only Napoleon +held aloof. He had declared himself against the windmill from the start. +One day, however, he arrived unexpectedly to examine the plans. He walked +heavily round the shed, looked closely at every detail of the plans and +snuffed at them once or twice, then stood for a little while contemplating +them out of the corner of his eye; then suddenly he lifted his leg, +urinated over the plans, and walked out without uttering a word. + +The whole farm was deeply divided on the subject of the windmill. Snowball +did not deny that to build it would be a difficult business. Stone would +have to be carried and built up into walls, then the sails would have to +be made and after that there would be need for dynamos and cables. (How +these were to be procured, Snowball did not say.) But he maintained that +it could all be done in a year. And thereafter, he declared, so much +labour would be saved that the animals would only need to work three days +a week. Napoleon, on the other hand, argued that the great need of the +moment was to increase food production, and that if they wasted time on +the windmill they would all starve to death. The animals formed themselves +into two factions under the slogan, "Vote for Snowball and the three-day +week" and "Vote for Napoleon and the full manger." Benjamin was the only +animal who did not side with either faction. He refused to believe either +that food would become more plentiful or that the windmill would save +work. Windmill or no windmill, he said, life would go on as it had always +gone on--that is, badly. + +Apart from the disputes over the windmill, there was the question of the +defence of the farm. It was fully realised that though the human beings +had been defeated in the Battle of the Cowshed they might make another and +more determined attempt to recapture the farm and reinstate Mr. Jones. +They had all the more reason for doing so because the news of their defeat +had spread across the countryside and made the animals on the neighbouring +farms more restive than ever. As usual, Snowball and Napoleon were in +disagreement. According to Napoleon, what the animals must do was to +procure firearms and train themselves in the use of them. According to +Snowball, they must send out more and more pigeons and stir up rebellion +among the animals on the other farms. The one argued that if they could +not defend themselves they were bound to be conquered, the other argued +that if rebellions happened everywhere they would have no need to defend +themselves. The animals listened first to Napoleon, then to Snowball, and +could not make up their minds which was right; indeed, they always found +themselves in agreement with the one who was speaking at the moment. + +At last the day came when Snowball's plans were completed. At the Meeting +on the following Sunday the question of whether or not to begin work on +the windmill was to be put to the vote. When the animals had assembled in +the big barn, Snowball stood up and, though occasionally interrupted by +bleating from the sheep, set forth his reasons for advocating the building +of the windmill. Then Napoleon stood up to reply. He said very quietly +that the windmill was nonsense and that he advised nobody to vote for it, +and promptly sat down again; he had spoken for barely thirty seconds, and +seemed almost indifferent as to the effect he produced. At this Snowball +sprang to his feet, and shouting down the sheep, who had begun bleating +again, broke into a passionate appeal in favour of the windmill. Until now +the animals had been about equally divided in their sympathies, but in a +moment Snowball's eloquence had carried them away. In glowing sentences he +painted a picture of Animal Farm as it might be when sordid labour was +lifted from the animals' backs. His imagination had now run far beyond +chaff-cutters and turnip-slicers. Electricity, he said, could operate +threshing machines, ploughs, harrows, rollers, and reapers and binders, +besides supplying every stall with its own electric light, hot and cold +water, and an electric heater. By the time he had finished speaking, there +was no doubt as to which way the vote would go. But just at this moment +Napoleon stood up and, casting a peculiar sidelong look at Snowball, +uttered a high-pitched whimper of a kind no one had ever heard him utter +before. + +At this there was a terrible baying sound outside, and nine enormous dogs +wearing brass-studded collars came bounding into the barn. They dashed +straight for Snowball, who only sprang from his place just in time to +escape their snapping jaws. In a moment he was out of the door and they +were after him. Too amazed and frightened to speak, all the animals +crowded through the door to watch the chase. Snowball was racing across +the long pasture that led to the road. He was running as only a pig can +run, but the dogs were close on his heels. Suddenly he slipped and it +seemed certain that they had him. Then he was up again, running faster +than ever, then the dogs were gaining on him again. One of them all but +closed his jaws on Snowball's tail, but Snowball whisked it free just in +time. Then he put on an extra spurt and, with a few inches to spare, +slipped through a hole in the hedge and was seen no more. + +Silent and terrified, the animals crept back into the barn. In a moment +the dogs came bounding back. At first no one had been able to imagine +where these creatures came from, but the problem was soon solved: they +were the puppies whom Napoleon had taken away from their mothers and +reared privately. Though not yet full-grown, they were huge dogs, and as +fierce-looking as wolves. They kept close to Napoleon. It was noticed that +they wagged their tails to him in the same way as the other dogs had been +used to do to Mr. Jones. + +Napoleon, with the dogs following him, now mounted on to the raised +portion of the floor where Major had previously stood to deliver his +speech. He announced that from now on the Sunday-morning Meetings would +come to an end. They were unnecessary, he said, and wasted time. In future +all questions relating to the working of the farm would be settled by a +special committee of pigs, presided over by himself. These would meet in +private and afterwards communicate their decisions to the others. The +animals would still assemble on Sunday mornings to salute the flag, sing +'Beasts of England', and receive their orders for the week; but there would +be no more debates. + +In spite of the shock that Snowball's expulsion had given them, the +animals were dismayed by this announcement. Several of them would have +protested if they could have found the right arguments. Even Boxer was +vaguely troubled. He set his ears back, shook his forelock several times, +and tried hard to marshal his thoughts; but in the end he could not think +of anything to say. Some of the pigs themselves, however, were more +articulate. Four young porkers in the front row uttered shrill squeals of +disapproval, and all four of them sprang to their feet and began speaking +at once. But suddenly the dogs sitting round Napoleon let out deep, +menacing growls, and the pigs fell silent and sat down again. Then the +sheep broke out into a tremendous bleating of "Four legs good, two legs +bad!" which went on for nearly a quarter of an hour and put an end to any +chance of discussion. + +Afterwards Squealer was sent round the farm to explain the new arrangement +to the others. + +"Comrades," he said, "I trust that every animal here appreciates the +sacrifice that Comrade Napoleon has made in taking this extra labour upon +himself. Do not imagine, comrades, that leadership is a pleasure! On the +contrary, it is a deep and heavy responsibility. No one believes more +firmly than Comrade Napoleon that all animals are equal. He would be only +too happy to let you make your decisions for yourselves. But sometimes you +might make the wrong decisions, comrades, and then where should we be? +Suppose you had decided to follow Snowball, with his moonshine of +windmills--Snowball, who, as we now know, was no better than a criminal?" + +"He fought bravely at the Battle of the Cowshed," said somebody. + +"Bravery is not enough," said Squealer. "Loyalty and obedience are more +important. And as to the Battle of the Cowshed, I believe the time will +come when we shall find that Snowball's part in it was much exaggerated. +Discipline, comrades, iron discipline! That is the watchword for today. +One false step, and our enemies would be upon us. Surely, comrades, you do +not want Jones back?" + +Once again this argument was unanswerable. Certainly the animals did not +want Jones back; if the holding of debates on Sunday mornings was liable +to bring him back, then the debates must stop. Boxer, who had now had time +to think things over, voiced the general feeling by saying: "If Comrade +Napoleon says it, it must be right." And from then on he adopted the +maxim, "Napoleon is always right," in addition to his private motto of "I +will work harder." + +By this time the weather had broken and the spring ploughing had begun. +The shed where Snowball had drawn his plans of the windmill had been shut +up and it was assumed that the plans had been rubbed off the floor. Every +Sunday morning at ten o'clock the animals assembled in the big barn to +receive their orders for the week. The skull of old Major, now clean of +flesh, had been disinterred from the orchard and set up on a stump at the +foot of the flagstaff, beside the gun. After the hoisting of the flag, the +animals were required to file past the skull in a reverent manner before +entering the barn. Nowadays they did not sit all together as they had done +in the past. Napoleon, with Squealer and another pig named Minimus, who +had a remarkable gift for composing songs and poems, sat on the front of +the raised platform, with the nine young dogs forming a semicircle round +them, and the other pigs sitting behind. The rest of the animals sat +facing them in the main body of the barn. Napoleon read out the orders for +the week in a gruff soldierly style, and after a single singing of 'Beasts +of England', all the animals dispersed. + +On the third Sunday after Snowball's expulsion, the animals were somewhat +surprised to hear Napoleon announce that the windmill was to be built +after all. He did not give any reason for having changed his mind, but +merely warned the animals that this extra task would mean very hard work, +it might even be necessary to reduce their rations. The plans, however, +had all been prepared, down to the last detail. A special committee of +pigs had been at work upon them for the past three weeks. The building of +the windmill, with various other improvements, was expected to take two +years. + +That evening Squealer explained privately to the other animals that +Napoleon had never in reality been opposed to the windmill. On the +contrary, it was he who had advocated it in the beginning, and the plan +which Snowball had drawn on the floor of the incubator shed had actually +been stolen from among Napoleon's papers. The windmill was, in fact, +Napoleon's own creation. Why, then, asked somebody, had he spoken so +strongly against it? Here Squealer looked very sly. That, he said, was +Comrade Napoleon's cunning. He had SEEMED to oppose the windmill, simply +as a manoeuvre to get rid of Snowball, who was a dangerous character and a +bad influence. Now that Snowball was out of the way, the plan could go +forward without his interference. This, said Squealer, was something +called tactics. He repeated a number of times, "Tactics, comrades, +tactics!" skipping round and whisking his tail with a merry laugh. The +animals were not certain what the word meant, but Squealer spoke so +persuasively, and the three dogs who happened to be with him growled so +threateningly, that they accepted his explanation without further +questions. + + + + + Chapter VI + + + +All that year the animals worked like slaves. But they were happy in their +work; they grudged no effort or sacrifice, well aware that everything that +they did was for the benefit of themselves and those of their kind who +would come after them, and not for a pack of idle, thieving human beings. + +Throughout the spring and summer they worked a sixty-hour week, and in +August Napoleon announced that there would be work on Sunday afternoons +as well. This work was strictly voluntary, but any animal who absented +himself from it would have his rations reduced by half. Even so, it was +found necessary to leave certain tasks undone. The harvest was a little +less successful than in the previous year, and two fields which should +have been sown with roots in the early summer were not sown because the +ploughing had not been completed early enough. It was possible to foresee +that the coming winter would be a hard one. + +The windmill presented unexpected difficulties. There was a good quarry of +limestone on the farm, and plenty of sand and cement had been found in one +of the outhouses, so that all the materials for building were at hand. But +the problem the animals could not at first solve was how to break up the +stone into pieces of suitable size. There seemed no way of doing this +except with picks and crowbars, which no animal could use, because no +animal could stand on his hind legs. Only after weeks of vain effort did +the right idea occur to somebody-namely, to utilise the force of gravity. +Huge boulders, far too big to be used as they were, were lying all over +the bed of the quarry. The animals lashed ropes round these, and then all +together, cows, horses, sheep, any animal that could lay hold of the +rope--even the pigs sometimes joined in at critical moments--they dragged +them with desperate slowness up the slope to the top of the quarry, where +they were toppled over the edge, to shatter to pieces below. Transporting +the stone when it was once broken was comparatively simple. The horses +carried it off in cart-loads, the sheep dragged single blocks, even Muriel +and Benjamin yoked themselves into an old governess-cart and did their +share. By late summer a sufficient store of stone had accumulated, and +then the building began, under the superintendence of the pigs. + +But it was a slow, laborious process. Frequently it took a whole day of +exhausting effort to drag a single boulder to the top of the quarry, and +sometimes when it was pushed over the edge it failed to break. Nothing +could have been achieved without Boxer, whose strength seemed equal to +that of all the rest of the animals put together. When the boulder began +to slip and the animals cried out in despair at finding themselves dragged +down the hill, it was always Boxer who strained himself against the rope +and brought the boulder to a stop. To see him toiling up the slope inch by +inch, his breath coming fast, the tips of his hoofs clawing at the ground, +and his great sides matted with sweat, filled everyone with admiration. +Clover warned him sometimes to be careful not to overstrain himself, but +Boxer would never listen to her. His two slogans, "I will work harder" +and "Napoleon is always right," seemed to him a sufficient answer to all +problems. He had made arrangements with the cockerel to call him +three-quarters of an hour earlier in the mornings instead of half an hour. +And in his spare moments, of which there were not many nowadays, he would +go alone to the quarry, collect a load of broken stone, and drag it down +to the site of the windmill unassisted. + +The animals were not badly off throughout that summer, in spite of the +hardness of their work. If they had no more food than they had had in +Jones's day, at least they did not have less. The advantage of only having +to feed themselves, and not having to support five extravagant human +beings as well, was so great that it would have taken a lot of failures to +outweigh it. And in many ways the animal method of doing things was more +efficient and saved labour. Such jobs as weeding, for instance, could be +done with a thoroughness impossible to human beings. And again, since no +animal now stole, it was unnecessary to fence off pasture from arable +land, which saved a lot of labour on the upkeep of hedges and gates. +Nevertheless, as the summer wore on, various unforeseen shortages began to +make them selves felt. There was need of paraffin oil, nails, string, dog +biscuits, and iron for the horses' shoes, none of which could be produced +on the farm. Later there would also be need for seeds and artificial +manures, besides various tools and, finally, the machinery for the +windmill. How these were to be procured, no one was able to imagine. + +One Sunday morning, when the animals assembled to receive their orders, +Napoleon announced that he had decided upon a new policy. From now onwards +Animal Farm would engage in trade with the neighbouring farms: not, of +course, for any commercial purpose, but simply in order to obtain certain +materials which were urgently necessary. The needs of the windmill must +override everything else, he said. He was therefore making arrangements to +sell a stack of hay and part of the current year's wheat crop, and later +on, if more money were needed, it would have to be made up by the sale of +eggs, for which there was always a market in Willingdon. The hens, said +Napoleon, should welcome this sacrifice as their own special contribution +towards the building of the windmill. + +Once again the animals were conscious of a vague uneasiness. Never to have +any dealings with human beings, never to engage in trade, never to make +use of money--had not these been among the earliest resolutions passed at +that first triumphant Meeting after Jones was expelled? All the animals +remembered passing such resolutions: or at least they thought that they +remembered it. The four young pigs who had protested when Napoleon +abolished the Meetings raised their voices timidly, but they were promptly +silenced by a tremendous growling from the dogs. Then, as usual, the sheep +broke into "Four legs good, two legs bad!" and the momentary awkwardness +was smoothed over. Finally Napoleon raised his trotter for silence and +announced that he had already made all the arrangements. There would be no +need for any of the animals to come in contact with human beings, which +would clearly be most undesirable. He intended to take the whole burden +upon his own shoulders. A Mr. Whymper, a solicitor living in Willingdon, +had agreed to act as intermediary between Animal Farm and the outside +world, and would visit the farm every Monday morning to receive his +instructions. Napoleon ended his speech with his usual cry of "Long live +Animal Farm!" and after the singing of 'Beasts of England' the animals +were dismissed. + +Afterwards Squealer made a round of the farm and set the animals' minds at +rest. He assured them that the resolution against engaging in trade and +using money had never been passed, or even suggested. It was pure +imagination, probably traceable in the beginning to lies circulated by +Snowball. A few animals still felt faintly doubtful, but Squealer asked +them shrewdly, "Are you certain that this is not something that you have +dreamed, comrades? Have you any record of such a resolution? Is it written +down anywhere?" And since it was certainly true that nothing of the kind +existed in writing, the animals were satisfied that they had been mistaken. + +Every Monday Mr. Whymper visited the farm as had been arranged. He was a +sly-looking little man with side whiskers, a solicitor in a very small way +of business, but sharp enough to have realised earlier than anyone else +that Animal Farm would need a broker and that the commissions would be +worth having. The animals watched his coming and going with a kind of +dread, and avoided him as much as possible. Nevertheless, the sight of +Napoleon, on all fours, delivering orders to Whymper, who stood on two +legs, roused their pride and partly reconciled them to the new +arrangement. Their relations with the human race were now not quite the +same as they had been before. The human beings did not hate Animal Farm +any less now that it was prospering; indeed, they hated it more than ever. +Every human being held it as an article of faith that the farm would go +bankrupt sooner or later, and, above all, that the windmill would be a +failure. They would meet in the public-houses and prove to one another by +means of diagrams that the windmill was bound to fall down, or that if it +did stand up, then that it would never work. And yet, against their will, +they had developed a certain respect for the efficiency with which the +animals were managing their own affairs. One symptom of this was that they +had begun to call Animal Farm by its proper name and ceased to pretend +that it was called the Manor Farm. They had also dropped their championship +of Jones, who had given up hope of getting his farm back and gone to live +in another part of the county. Except through Whymper, there was as yet no +contact between Animal Farm and the outside world, but there were constant +rumours that Napoleon was about to enter into a definite business agreement +either with Mr. Pilkington of Foxwood or with Mr. Frederick of +Pinchfield--but never, it was noticed, with both simultaneously. + +It was about this time that the pigs suddenly moved into the farmhouse and +took up their residence there. Again the animals seemed to remember that a +resolution against this had been passed in the early days, and again +Squealer was able to convince them that this was not the case. It was +absolutely necessary, he said, that the pigs, who were the brains of the +farm, should have a quiet place to work in. It was also more suited to the +dignity of the Leader (for of late he had taken to speaking of Napoleon +under the title of "Leader") to live in a house than in a mere sty. +Nevertheless, some of the animals were disturbed when they heard that the +pigs not only took their meals in the kitchen and used the drawing-room +as a recreation room, but also slept in the beds. Boxer passed it off as +usual with "Napoleon is always right!", but Clover, who thought she +remembered a definite ruling against beds, went to the end of the barn and +tried to puzzle out the Seven Commandments which were inscribed there. +Finding herself unable to read more than individual letters, she fetched +Muriel. + +"Muriel," she said, "read me the Fourth Commandment. Does it not say +something about never sleeping in a bed?" + +With some difficulty Muriel spelt it out. + +"It says, 'No animal shall sleep in a bed with sheets,"' she announced +finally. + +Curiously enough, Clover had not remembered that the Fourth Commandment +mentioned sheets; but as it was there on the wall, it must have done so. +And Squealer, who happened to be passing at this moment, attended by two +or three dogs, was able to put the whole matter in its proper perspective. + +"You have heard then, comrades," he said, "that we pigs now sleep in the +beds of the farmhouse? And why not? You did not suppose, surely, that +there was ever a ruling against beds? A bed merely means a place to sleep +in. A pile of straw in a stall is a bed, properly regarded. The rule was +against sheets, which are a human invention. We have removed the sheets +from the farmhouse beds, and sleep between blankets. And very comfortable +beds they are too! But not more comfortable than we need, I can tell you, +comrades, with all the brainwork we have to do nowadays. You would not rob +us of our repose, would you, comrades? You would not have us too tired to +carry out our duties? Surely none of you wishes to see Jones back?" + +The animals reassured him on this point immediately, and no more was said +about the pigs sleeping in the farmhouse beds. And when, some days +afterwards, it was announced that from now on the pigs would get up an +hour later in the mornings than the other animals, no complaint was made +about that either. + +By the autumn the animals were tired but happy. They had had a hard year, +and after the sale of part of the hay and corn, the stores of food for the +winter were none too plentiful, but the windmill compensated for +everything. It was almost half built now. After the harvest there was a +stretch of clear dry weather, and the animals toiled harder than ever, +thinking it well worth while to plod to and fro all day with blocks of +stone if by doing so they could raise the walls another foot. Boxer would +even come out at nights and work for an hour or two on his own by the +light of the harvest moon. In their spare moments the animals would walk +round and round the half-finished mill, admiring the strength and +perpendicularity of its walls and marvelling that they should ever have +been able to build anything so imposing. Only old Benjamin refused to grow +enthusiastic about the windmill, though, as usual, he would utter nothing +beyond the cryptic remark that donkeys live a long time. + +November came, with raging south-west winds. Building had to stop because +it was now too wet to mix the cement. Finally there came a night when the +gale was so violent that the farm buildings rocked on their foundations +and several tiles were blown off the roof of the barn. The hens woke up +squawking with terror because they had all dreamed simultaneously of +hearing a gun go off in the distance. In the morning the animals came out +of their stalls to find that the flagstaff had been blown down and an elm +tree at the foot of the orchard had been plucked up like a radish. They +had just noticed this when a cry of despair broke from every animal's +throat. A terrible sight had met their eyes. The windmill was in ruins. + +With one accord they dashed down to the spot. Napoleon, who seldom moved +out of a walk, raced ahead of them all. Yes, there it lay, the fruit of +all their struggles, levelled to its foundations, the stones they had +broken and carried so laboriously scattered all around. Unable at first to +speak, they stood gazing mournfully at the litter of fallen stone. Napoleon +paced to and fro in silence, occasionally snuffing at the ground. His tail +had grown rigid and twitched sharply from side to side, a sign in him of +intense mental activity. Suddenly he halted as though his mind were +made up. + +"Comrades," he said quietly, "do you know who is responsible for this? Do +you know the enemy who has come in the night and overthrown our windmill? +SNOWBALL!" he suddenly roared in a voice of thunder. "Snowball has done +this thing! In sheer malignity, thinking to set back our plans and avenge +himself for his ignominious expulsion, this traitor has crept here under +cover of night and destroyed our work of nearly a year. Comrades, here +and now I pronounce the death sentence upon Snowball. 'Animal Hero, Second +Class,' and half a bushel of apples to any animal who brings him to +justice. A full bushel to anyone who captures him alive!" + +The animals were shocked beyond measure to learn that even Snowball could +be guilty of such an action. There was a cry of indignation, and everyone +began thinking out ways of catching Snowball if he should ever come back. +Almost immediately the footprints of a pig were discovered in the grass at +a little distance from the knoll. They could only be traced for a few +yards, but appeared to lead to a hole in the hedge. Napoleon snuffed +deeply at them and pronounced them to be Snowball's. He gave it as his +opinion that Snowball had probably come from the direction of Foxwood Farm. + +"No more delays, comrades!" cried Napoleon when the footprints had been +examined. "There is work to be done. This very morning we begin rebuilding +the windmill, and we will build all through the winter, rain or shine. We +will teach this miserable traitor that he cannot undo our work so easily. +Remember, comrades, there must be no alteration in our plans: they shall +be carried out to the day. Forward, comrades! Long live the windmill! Long +live Animal Farm!" + + + + + Chapter VII + + + +It was a bitter winter. The stormy weather was followed by sleet and snow, +and then by a hard frost which did not break till well into February. The +animals carried on as best they could with the rebuilding of the windmill, +well knowing that the outside world was watching them and that the envious +human beings would rejoice and triumph if the mill were not finished +on time. + +Out of spite, the human beings pretended not to believe that it was +Snowball who had destroyed the windmill: they said that it had fallen down +because the walls were too thin. The animals knew that this was not the +case. Still, it had been decided to build the walls three feet thick this +time instead of eighteen inches as before, which meant collecting much +larger quantities of stone. For a long time the quarry was full of +snowdrifts and nothing could be done. Some progress was made in the dry +frosty weather that followed, but it was cruel work, and the animals could +not feel so hopeful about it as they had felt before. They were always +cold, and usually hungry as well. Only Boxer and Clover never lost heart. +Squealer made excellent speeches on the joy of service and the dignity of +labour, but the other animals found more inspiration in Boxer's strength +and his never-failing cry of "I will work harder!" + +In January food fell short. The corn ration was drastically reduced, and +it was announced that an extra potato ration would be issued to make up +for it. Then it was discovered that the greater part of the potato crop +had been frosted in the clamps, which had not been covered thickly enough. +The potatoes had become soft and discoloured, and only a few were edible. +For days at a time the animals had nothing to eat but chaff and mangels. +Starvation seemed to stare them in the face. + +It was vitally necessary to conceal this fact from the outside world. +Emboldened by the collapse of the windmill, the human beings were +inventing fresh lies about Animal Farm. Once again it was being put about +that all the animals were dying of famine and disease, and that they were +continually fighting among themselves and had resorted to cannibalism and +infanticide. Napoleon was well aware of the bad results that might follow +if the real facts of the food situation were known, and he decided to make +use of Mr. Whymper to spread a contrary impression. Hitherto the animals +had had little or no contact with Whymper on his weekly visits: now, +however, a few selected animals, mostly sheep, were instructed to remark +casually in his hearing that rations had been increased. In addition, +Napoleon ordered the almost empty bins in the store-shed to be filled +nearly to the brim with sand, which was then covered up with what remained +of the grain and meal. On some suitable pretext Whymper was led through +the store-shed and allowed to catch a glimpse of the bins. He was +deceived, and continued to report to the outside world that there was no +food shortage on Animal Farm. + +Nevertheless, towards the end of January it became obvious that it would +be necessary to procure some more grain from somewhere. In these days +Napoleon rarely appeared in public, but spent all his time in the +farmhouse, which was guarded at each door by fierce-looking dogs. When he +did emerge, it was in a ceremonial manner, with an escort of six dogs who +closely surrounded him and growled if anyone came too near. Frequently he +did not even appear on Sunday mornings, but issued his orders through one +of the other pigs, usually Squealer. + +One Sunday morning Squealer announced that the hens, who had just come in +to lay again, must surrender their eggs. Napoleon had accepted, through +Whymper, a contract for four hundred eggs a week. The price of these would +pay for enough grain and meal to keep the farm going till summer came on +and conditions were easier. + +When the hens heard this, they raised a terrible outcry. They had been +warned earlier that this sacrifice might be necessary, but had not +believed that it would really happen. They were just getting their +clutches ready for the spring sitting, and they protested that to take the +eggs away now was murder. For the first time since the expulsion of Jones, +there was something resembling a rebellion. Led by three young Black +Minorca pullets, the hens made a determined effort to thwart Napoleon's +wishes. Their method was to fly up to the rafters and there lay their +eggs, which smashed to pieces on the floor. Napoleon acted swiftly and +ruthlessly. He ordered the hens' rations to be stopped, and decreed that +any animal giving so much as a grain of corn to a hen should be punished +by death. The dogs saw to it that these orders were carried out. For five +days the hens held out, then they capitulated and went back to their +nesting boxes. Nine hens had died in the meantime. Their bodies were +buried in the orchard, and it was given out that they had died of +coccidiosis. Whymper heard nothing of this affair, and the eggs were duly +delivered, a grocer's van driving up to the farm once a week to take them +away. + +All this while no more had been seen of Snowball. He was rumoured to be +hiding on one of the neighbouring farms, either Foxwood or Pinchfield. +Napoleon was by this time on slightly better terms with the other farmers +than before. It happened that there was in the yard a pile of timber which +had been stacked there ten years earlier when a beech spinney was cleared. +It was well seasoned, and Whymper had advised Napoleon to sell it; both +Mr. Pilkington and Mr. Frederick were anxious to buy it. Napoleon was +hesitating between the two, unable to make up his mind. It was noticed +that whenever he seemed on the point of coming to an agreement with +Frederick, Snowball was declared to be in hiding at Foxwood, while, when +he inclined toward Pilkington, Snowball was said to be at Pinchfield. + +Suddenly, early in the spring, an alarming thing was discovered. Snowball +was secretly frequenting the farm by night! The animals were so disturbed +that they could hardly sleep in their stalls. Every night, it was said, he +came creeping in under cover of darkness and performed all kinds of +mischief. He stole the corn, he upset the milk-pails, he broke the eggs, +he trampled the seedbeds, he gnawed the bark off the fruit trees. Whenever +anything went wrong it became usual to attribute it to Snowball. If a +window was broken or a drain was blocked up, someone was certain to say +that Snowball had come in the night and done it, and when the key of the +store-shed was lost, the whole farm was convinced that Snowball had thrown +it down the well. Curiously enough, they went on believing this even after +the mislaid key was found under a sack of meal. The cows declared +unanimously that Snowball crept into their stalls and milked them in their +sleep. The rats, which had been troublesome that winter, were also said to +be in league with Snowball. + +Napoleon decreed that there should be a full investigation into Snowball's +activities. With his dogs in attendance he set out and made a careful tour +of inspection of the farm buildings, the other animals following at a +respectful distance. At every few steps Napoleon stopped and snuffed the +ground for traces of Snowball's footsteps, which, he said, he could detect +by the smell. He snuffed in every corner, in the barn, in the cow-shed, +in the henhouses, in the vegetable garden, and found traces of Snowball +almost everywhere. He would put his snout to the ground, give several deep +sniffs, ad exclaim in a terrible voice, "Snowball! He has been here! I can +smell him distinctly!" and at the word "Snowball" all the dogs let out +blood-curdling growls and showed their side teeth. + +The animals were thoroughly frightened. It seemed to them as though +Snowball were some kind of invisible influence, pervading the air about +them and menacing them with all kinds of dangers. In the evening Squealer +called them together, and with an alarmed expression on his face told +them that he had some serious news to report. + +"Comrades!" cried Squealer, making little nervous skips, "a most terrible +thing has been discovered. Snowball has sold himself to Frederick of +Pinchfield Farm, who is even now plotting to attack us and take our farm +away from us! Snowball is to act as his guide when the attack begins. But +there is worse than that. We had thought that Snowball's rebellion was +caused simply by his vanity and ambition. But we were wrong, comrades. Do +you know what the real reason was? Snowball was in league with Jones from +the very start! He was Jones's secret agent all the time. It has all been +proved by documents which he left behind him and which we have only just +discovered. To my mind this explains a great deal, comrades. Did we not +see for ourselves how he attempted--fortunately without success--to get us +defeated and destroyed at the Battle of the Cowshed?" + +The animals were stupefied. This was a wickedness far outdoing Snowball's +destruction of the windmill. But it was some minutes before they could +fully take it in. They all remembered, or thought they remembered, how +they had seen Snowball charging ahead of them at the Battle of the +Cowshed, how he had rallied and encouraged them at every turn, and how he +had not paused for an instant even when the pellets from Jones's gun had +wounded his back. At first it was a little difficult to see how this +fitted in with his being on Jones's side. Even Boxer, who seldom asked +questions, was puzzled. He lay down, tucked his fore hoofs beneath him, +shut his eyes, and with a hard effort managed to formulate his thoughts. + +"I do not believe that," he said. "Snowball fought bravely at the Battle +of the Cowshed. I saw him myself. Did we not give him 'Animal Hero, first +Class,' immediately afterwards?" + +"That was our mistake, comrade. For we know now--it is all written down in +the secret documents that we have found--that in reality he was trying to +lure us to our doom." + +"But he was wounded," said Boxer. "We all saw him running with blood." + +"That was part of the arrangement!" cried Squealer. "Jones's shot only +grazed him. I could show you this in his own writing, if you were able to +read it. The plot was for Snowball, at the critical moment, to give the +signal for flight and leave the field to the enemy. And he very nearly +succeeded--I will even say, comrades, he WOULD have succeeded if it had +not been for our heroic Leader, Comrade Napoleon. Do you not remember how, +just at the moment when Jones and his men had got inside the yard, +Snowball suddenly turned and fled, and many animals followed him? And do +you not remember, too, that it was just at that moment, when panic was +spreading and all seemed lost, that Comrade Napoleon sprang forward with a +cry of 'Death to Humanity!' and sank his teeth in Jones's leg? Surely you +remember THAT, comrades?" exclaimed Squealer, frisking from side to side. + +Now when Squealer described the scene so graphically, it seemed to the +animals that they did remember it. At any rate, they remembered that at +the critical moment of the battle Snowball had turned to flee. But Boxer +was still a little uneasy. + +"I do not believe that Snowball was a traitor at the beginning," he said +finally. "What he has done since is different. But I believe that at the +Battle of the Cowshed he was a good comrade." + +"Our Leader, Comrade Napoleon," announced Squealer, speaking very slowly +and firmly, "has stated categorically--categorically, comrade--that +Snowball was Jones's agent from the very beginning--yes, and from long +before the Rebellion was ever thought of." + +"Ah, that is different!" said Boxer. "If Comrade Napoleon says it, it must +be right." + +"That is the true spirit, comrade!" cried Squealer, but it was noticed he +cast a very ugly look at Boxer with his little twinkling eyes. He turned +to go, then paused and added impressively: "I warn every animal on this +farm to keep his eyes very wide open. For we have reason to think that +some of Snowball's secret agents are lurking among us at this moment!" + +Four days later, in the late afternoon, Napoleon ordered all the animals +to assemble in the yard. When they were all gathered together, Napoleon +emerged from the farmhouse, wearing both his medals (for he had recently +awarded himself "Animal Hero, First Class", and "Animal Hero, Second +Class"), with his nine huge dogs frisking round him and uttering growls +that sent shivers down all the animals' spines. They all cowered silently +in their places, seeming to know in advance that some terrible thing was +about to happen. + +Napoleon stood sternly surveying his audience; then he uttered a +high-pitched whimper. Immediately the dogs bounded forward, seized four of +the pigs by the ear and dragged them, squealing with pain and terror, to +Napoleon's feet. The pigs' ears were bleeding, the dogs had tasted blood, +and for a few moments they appeared to go quite mad. To the amazement of +everybody, three of them flung themselves upon Boxer. Boxer saw them +coming and put out his great hoof, caught a dog in mid-air, and pinned +him to the ground. The dog shrieked for mercy and the other two fled with +their tails between their legs. Boxer looked at Napoleon to know whether +he should crush the dog to death or let it go. Napoleon appeared to change +countenance, and sharply ordered Boxer to let the dog go, whereat Boxer +lifted his hoof, and the dog slunk away, bruised and howling. + +Presently the tumult died down. The four pigs waited, trembling, with +guilt written on every line of their countenances. Napoleon now called +upon them to confess their crimes. They were the same four pigs as had +protested when Napoleon abolished the Sunday Meetings. Without any further +prompting they confessed that they had been secretly in touch with +Snowball ever since his expulsion, that they had collaborated with him in +destroying the windmill, and that they had entered into an agreement with +him to hand over Animal Farm to Mr. Frederick. They added that Snowball +had privately admitted to them that he had been Jones's secret agent for +years past. When they had finished their confession, the dogs promptly +tore their throats out, and in a terrible voice Napoleon demanded whether +any other animal had anything to confess. + +The three hens who had been the ringleaders in the attempted rebellion +over the eggs now came forward and stated that Snowball had appeared to +them in a dream and incited them to disobey Napoleon's orders. They, too, +were slaughtered. Then a goose came forward and confessed to having +secreted six ears of corn during the last year's harvest and eaten them in +the night. Then a sheep confessed to having urinated in the drinking +pool--urged to do this, so she said, by Snowball--and two other sheep +confessed to having murdered an old ram, an especially devoted follower of +Napoleon, by chasing him round and round a bonfire when he was suffering +from a cough. They were all slain on the spot. And so the tale of +confessions and executions went on, until there was a pile of corpses +lying before Napoleon's feet and the air was heavy with the smell of +blood, which had been unknown there since the expulsion of Jones. + +When it was all over, the remaining animals, except for the pigs and dogs, +crept away in a body. They were shaken and miserable. They did not know +which was more shocking--the treachery of the animals who had leagued +themselves with Snowball, or the cruel retribution they had just +witnessed. In the old days there had often been scenes of bloodshed +equally terrible, but it seemed to all of them that it was far worse now +that it was happening among themselves. Since Jones had left the farm, +until today, no animal had killed another animal. Not even a rat had been +killed. They had made their way on to the little knoll where the +half-finished windmill stood, and with one accord they all lay down as +though huddling together for warmth--Clover, Muriel, Benjamin, the cows, +the sheep, and a whole flock of geese and hens--everyone, indeed, except +the cat, who had suddenly disappeared just before Napoleon ordered the +animals to assemble. For some time nobody spoke. Only Boxer remained on +his feet. He fidgeted to and fro, swishing his long black tail against his +sides and occasionally uttering a little whinny of surprise. Finally he +said: + +"I do not understand it. I would not have believed that such things could +happen on our farm. It must be due to some fault in ourselves. The +solution, as I see it, is to work harder. From now onwards I shall get up +a full hour earlier in the mornings." + +And he moved off at his lumbering trot and made for the quarry. Having got +there, he collected two successive loads of stone and dragged them down to +the windmill before retiring for the night. + +The animals huddled about Clover, not speaking. The knoll where they were +lying gave them a wide prospect across the countryside. Most of Animal +Farm was within their view--the long pasture stretching down to the main +road, the hayfield, the spinney, the drinking pool, the ploughed fields +where the young wheat was thick and green, and the red roofs of the farm +buildings with the smoke curling from the chimneys. It was a clear spring +evening. The grass and the bursting hedges were gilded by the level rays +of the sun. Never had the farm--and with a kind of surprise they +remembered that it was their own farm, every inch of it their own +property--appeared to the animals so desirable a place. As Clover looked +down the hillside her eyes filled with tears. If she could have spoken her +thoughts, it would have been to say that this was not what they had aimed +at when they had set themselves years ago to work for the overthrow of the +human race. These scenes of terror and slaughter were not what they had +looked forward to on that night when old Major first stirred them to +rebellion. If she herself had had any picture of the future, it had been +of a society of animals set free from hunger and the whip, all equal, each +working according to his capacity, the strong protecting the weak, as she +had protected the lost brood of ducklings with her foreleg on the night of +Major's speech. Instead--she did not know why--they had come to a time +when no one dared speak his mind, when fierce, growling dogs roamed +everywhere, and when you had to watch your comrades torn to pieces after +confessing to shocking crimes. There was no thought of rebellion or +disobedience in her mind. She knew that, even as things were, they were +far better off than they had been in the days of Jones, and that before +all else it was needful to prevent the return of the human beings. +Whatever happened she would remain faithful, work hard, carry out the +orders that were given to her, and accept the leadership of Napoleon. But +still, it was not for this that she and all the other animals had hoped +and toiled. It was not for this that they had built the windmill and faced +the bullets of Jones's gun. Such were her thoughts, though she lacked the +words to express them. + +At last, feeling this to be in some way a substitute for the words she was +unable to find, she began to sing 'Beasts of England'. The other animals +sitting round her took it up, and they sang it three times over--very +tunefully, but slowly and mournfully, in a way they had never sung it +before. + +They had just finished singing it for the third time when Squealer, +attended by two dogs, approached them with the air of having something +important to say. He announced that, by a special decree of Comrade +Napoleon, 'Beasts of England' had been abolished. From now onwards it was +forbidden to sing it. + +The animals were taken aback. + +"Why?" cried Muriel. + +"It's no longer needed, comrade," said Squealer stiffly. "'Beasts of +England' was the song of the Rebellion. But the Rebellion is now +completed. The execution of the traitors this afternoon was the final act. +The enemy both external and internal has been defeated. In 'Beasts of +England' we expressed our longing for a better society in days to come. +But that society has now been established. Clearly this song has no longer +any purpose." + +Frightened though they were, some of the animals might possibly have +protested, but at this moment the sheep set up their usual bleating of +"Four legs good, two legs bad," which went on for several minutes and put +an end to the discussion. + +So 'Beasts of England' was heard no more. In its place Minimus, the poet, +had composed another song which began: + + +Animal Farm, Animal Farm, +Never through me shalt thou come to harm! + + +and this was sung every Sunday morning after the hoisting of the flag. +But somehow neither the words nor the tune ever seemed to the animals to +come up to 'Beasts of England'. + + + + + Chapter VIII + + + +A few days later, when the terror caused by the executions had died down, +some of the animals remembered--or thought they remembered--that the Sixth +Commandment decreed "No animal shall kill any other animal." And though no +one cared to mention it in the hearing of the pigs or the dogs, it was +felt that the killings which had taken place did not square with this. +Clover asked Benjamin to read her the Sixth Commandment, and when +Benjamin, as usual, said that he refused to meddle in such matters, she +fetched Muriel. Muriel read the Commandment for her. It ran: "No animal +shall kill any other animal WITHOUT CAUSE." Somehow or other, the last two +words had slipped out of the animals' memory. But they saw now that the +Commandment had not been violated; for clearly there was good reason for +killing the traitors who had leagued themselves with Snowball. + +Throughout the year the animals worked even harder than they had worked in +the previous year. To rebuild the windmill, with walls twice as thick as +before, and to finish it by the appointed date, together with the regular +work of the farm, was a tremendous labour. There were times when it seemed +to the animals that they worked longer hours and fed no better than they +had done in Jones's day. On Sunday mornings Squealer, holding down a long +strip of paper with his trotter, would read out to them lists of figures +proving that the production of every class of foodstuff had increased by +two hundred per cent, three hundred per cent, or five hundred per cent, +as the case might be. The animals saw no reason to disbelieve him, +especially as they could no longer remember very clearly what conditions +had been like before the Rebellion. All the same, there were days when +they felt that they would sooner have had less figures and more food. + +All orders were now issued through Squealer or one of the other pigs. +Napoleon himself was not seen in public as often as once in a fortnight. +When he did appear, he was attended not only by his retinue of dogs but by +a black cockerel who marched in front of him and acted as a kind of +trumpeter, letting out a loud "cock-a-doodle-doo" before Napoleon spoke. +Even in the farmhouse, it was said, Napoleon inhabited separate apartments +from the others. He took his meals alone, with two dogs to wait upon him, +and always ate from the Crown Derby dinner service which had been in the +glass cupboard in the drawing-room. It was also announced that the gun +would be fired every year on Napoleon's birthday, as well as on the other +two anniversaries. + +Napoleon was now never spoken of simply as "Napoleon." He was always +referred to in formal style as "our Leader, Comrade Napoleon," and this +pigs liked to invent for him such titles as Father of All Animals, Terror +of Mankind, Protector of the Sheep-fold, Ducklings' Friend, and the like. +In his speeches, Squealer would talk with the tears rolling down his +cheeks of Napoleon's wisdom the goodness of his heart, and the deep love +he bore to all animals everywhere, even and especially the unhappy animals +who still lived in ignorance and slavery on other farms. It had become +usual to give Napoleon the credit for every successful achievement and +every stroke of good fortune. You would often hear one hen remark to +another, "Under the guidance of our Leader, Comrade Napoleon, I have laid +five eggs in six days"; or two cows, enjoying a drink at the pool, would +exclaim, "Thanks to the leadership of Comrade Napoleon, how excellent this +water tastes!" The general feeling on the farm was well expressed in a +poem entitled Comrade Napoleon, which was composed by Minimus and which +ran as follows: + + +Friend of fatherless! +Fountain of happiness! +Lord of the swill-bucket! Oh, how my soul is on +Fire when I gaze at thy +Calm and commanding eye, +Like the sun in the sky, +Comrade Napoleon! + +Thou are the giver of +All that thy creatures love, +Full belly twice a day, clean straw to roll upon; +Every beast great or small +Sleeps at peace in his stall, +Thou watchest over all, +Comrade Napoleon! + +Had I a sucking-pig, +Ere he had grown as big +Even as a pint bottle or as a rolling-pin, +He should have learned to be +Faithful and true to thee, +Yes, his first squeak should be +"Comrade Napoleon!" + + +Napoleon approved of this poem and caused it to be inscribed on the wall +of the big barn, at the opposite end from the Seven Commandments. It was +surmounted by a portrait of Napoleon, in profile, executed by Squealer in +white paint. + +Meanwhile, through the agency of Whymper, Napoleon was engaged in +complicated negotiations with Frederick and Pilkington. The pile of timber +was still unsold. Of the two, Frederick was the more anxious to get hold +of it, but he would not offer a reasonable price. At the same time there +were renewed rumours that Frederick and his men were plotting to attack +Animal Farm and to destroy the windmill, the building of which had aroused +furious jealousy in him. Snowball was known to be still skulking on +Pinchfield Farm. In the middle of the summer the animals were alarmed to +hear that three hens had come forward and confessed that, inspired by +Snowball, they had entered into a plot to murder Napoleon. They were +executed immediately, and fresh precautions for Napoleon's safety were +taken. Four dogs guarded his bed at night, one at each corner, and a young +pig named Pinkeye was given the task of tasting all his food before he ate +it, lest it should be poisoned. + +At about the same time it was given out that Napoleon had arranged to sell +the pile of timber to Mr. Pilkington; he was also going to enter into a +regular agreement for the exchange of certain products between Animal Farm +and Foxwood. The relations between Napoleon and Pilkington, though they +were only conducted through Whymper, were now almost friendly. The animals +distrusted Pilkington, as a human being, but greatly preferred him to +Frederick, whom they both feared and hated. As the summer wore on, and the +windmill neared completion, the rumours of an impending treacherous attack +grew stronger and stronger. Frederick, it was said, intended to bring +against them twenty men all armed with guns, and he had already bribed the +magistrates and police, so that if he could once get hold of the +title-deeds of Animal Farm they would ask no questions. Moreover, terrible +stories were leaking out from Pinchfield about the cruelties that +Frederick practised upon his animals. He had flogged an old horse to +death, he starved his cows, he had killed a dog by throwing it into the +furnace, he amused himself in the evenings by making cocks fight with +splinters of razor-blade tied to their spurs. The animals' blood boiled +with rage when they heard of these things being done to their comrades, +and sometimes they clamoured to be allowed to go out in a body and attack +Pinchfield Farm, drive out the humans, and set the animals free. But +Squealer counselled them to avoid rash actions and trust in Comrade +Napoleon's strategy. + +Nevertheless, feeling against Frederick continued to run high. One Sunday +morning Napoleon appeared in the barn and explained that he had never at +any time contemplated selling the pile of timber to Frederick; he +considered it beneath his dignity, he said, to have dealings with +scoundrels of that description. The pigeons who were still sent out to +spread tidings of the Rebellion were forbidden to set foot anywhere on +Foxwood, and were also ordered to drop their former slogan of "Death to +Humanity" in favour of "Death to Frederick." In the late summer yet +another of Snowball's machinations was laid bare. The wheat crop was full +of weeds, and it was discovered that on one of his nocturnal visits +Snowball had mixed weed seeds with the seed corn. A gander who had been +privy to the plot had confessed his guilt to Squealer and immediately +committed suicide by swallowing deadly nightshade berries. The animals +now also learned that Snowball had never--as many of them had believed +hitherto--received the order of "Animal Hero, First Class." This was +merely a legend which had been spread some time after the Battle of the +Cowshed by Snowball himself. So far from being decorated, he had been +censured for showing cowardice in the battle. Once again some of the +animals heard this with a certain bewilderment, but Squealer was soon able +to convince them that their memories had been at fault. + +In the autumn, by a tremendous, exhausting effort--for the harvest had to +be gathered at almost the same time--the windmill was finished. The +machinery had still to be installed, and Whymper was negotiating the +purchase of it, but the structure was completed. In the teeth of every +difficulty, in spite of inexperience, of primitive implements, of bad luck +and of Snowball's treachery, the work had been finished punctually to the +very day! Tired out but proud, the animals walked round and round their +masterpiece, which appeared even more beautiful in their eyes than when it +had been built the first time. Moreover, the walls were twice as thick as +before. Nothing short of explosives would lay them low this time! And when +they thought of how they had laboured, what discouragements they had +overcome, and the enormous difference that would be made in their lives +when the sails were turning and the dynamos running--when they thought of +all this, their tiredness forsook them and they gambolled round and round +the windmill, uttering cries of triumph. Napoleon himself, attended by his +dogs and his cockerel, came down to inspect the completed work; he +personally congratulated the animals on their achievement, and announced +that the mill would be named Napoleon Mill. + +Two days later the animals were called together for a special meeting in +the barn. They were struck dumb with surprise when Napoleon announced that +he had sold the pile of timber to Frederick. Tomorrow Frederick's wagons +would arrive and begin carting it away. Throughout the whole period of his +seeming friendship with Pilkington, Napoleon had really been in secret +agreement with Frederick. + +All relations with Foxwood had been broken off; insulting messages had +been sent to Pilkington. The pigeons had been told to avoid Pinchfield +Farm and to alter their slogan from "Death to Frederick" to "Death to +Pilkington." At the same time Napoleon assured the animals that the +stories of an impending attack on Animal Farm were completely untrue, and +that the tales about Frederick's cruelty to his own animals had been +greatly exaggerated. All these rumours had probably originated with +Snowball and his agents. It now appeared that Snowball was not, after all, +hiding on Pinchfield Farm, and in fact had never been there in his life: +he was living--in considerable luxury, so it was said--at Foxwood, and had +in reality been a pensioner of Pilkington for years past. + +The pigs were in ecstasies over Napoleon's cunning. By seeming to be +friendly with Pilkington he had forced Frederick to raise his price by +twelve pounds. But the superior quality of Napoleon's mind, said Squealer, +was shown in the fact that he trusted nobody, not even Frederick. +Frederick had wanted to pay for the timber with something called a cheque, +which, it seemed, was a piece of paper with a promise to pay written upon +it. But Napoleon was too clever for him. He had demanded payment in real +five-pound notes, which were to be handed over before the timber was +removed. Already Frederick had paid up; and the sum he had paid was just +enough to buy the machinery for the windmill. + +Meanwhile the timber was being carted away at high speed. When it was all +gone, another special meeting was held in the barn for the animals to +inspect Frederick's bank-notes. Smiling beatifically, and wearing both his +decorations, Napoleon reposed on a bed of straw on the platform, with the +money at his side, neatly piled on a china dish from the farmhouse +kitchen. The animals filed slowly past, and each gazed his fill. And Boxer +put out his nose to sniff at the bank-notes, and the flimsy white things +stirred and rustled in his breath. + +Three days later there was a terrible hullabaloo. Whymper, his face deadly +pale, came racing up the path on his bicycle, flung it down in the yard +and rushed straight into the farmhouse. The next moment a choking roar of +rage sounded from Napoleon's apartments. The news of what had happened +sped round the farm like wildfire. The banknotes were forgeries! Frederick +had got the timber for nothing! + +Napoleon called the animals together immediately and in a terrible voice +pronounced the death sentence upon Frederick. When captured, he said, +Frederick should be boiled alive. At the same time he warned them that +after this treacherous deed the worst was to be expected. Frederick and +his men might make their long-expected attack at any moment. Sentinels +were placed at all the approaches to the farm. In addition, four pigeons +were sent to Foxwood with a conciliatory message, which it was hoped might +re-establish good relations with Pilkington. + +The very next morning the attack came. The animals were at breakfast when +the look-outs came racing in with the news that Frederick and his +followers had already come through the five-barred gate. Boldly enough the +animals sallied forth to meet them, but this time they did not have the +easy victory that they had had in the Battle of the Cowshed. There were +fifteen men, with half a dozen guns between them, and they opened fire as +soon as they got within fifty yards. The animals could not face the +terrible explosions and the stinging pellets, and in spite of the efforts +of Napoleon and Boxer to rally them, they were soon driven back. A number +of them were already wounded. They took refuge in the farm buildings and +peeped cautiously out from chinks and knot-holes. The whole of the big +pasture, including the windmill, was in the hands of the enemy. For the +moment even Napoleon seemed at a loss. He paced up and down without a +word, his tail rigid and twitching. Wistful glances were sent in the +direction of Foxwood. If Pilkington and his men would help them, the day +might yet be won. But at this moment the four pigeons, who had been sent +out on the day before, returned, one of them bearing a scrap of paper from +Pilkington. On it was pencilled the words: "Serves you right." + +Meanwhile Frederick and his men had halted about the windmill. The animals +watched them, and a murmur of dismay went round. Two of the men had +produced a crowbar and a sledge hammer. They were going to knock the +windmill down. + +"Impossible!" cried Napoleon. "We have built the walls far too thick for +that. They could not knock it down in a week. Courage, comrades!" + +But Benjamin was watching the movements of the men intently. The two with +the hammer and the crowbar were drilling a hole near the base of the +windmill. Slowly, and with an air almost of amusement, Benjamin nodded his +long muzzle. + +"I thought so," he said. "Do you not see what they are doing? In another +moment they are going to pack blasting powder into that hole." + +Terrified, the animals waited. It was impossible now to venture out of the +shelter of the buildings. After a few minutes the men were seen to be +running in all directions. Then there was a deafening roar. The pigeons +swirled into the air, and all the animals, except Napoleon, flung +themselves flat on their bellies and hid their faces. When they got up +again, a huge cloud of black smoke was hanging where the windmill had +been. Slowly the breeze drifted it away. The windmill had ceased to exist! + +At this sight the animals' courage returned to them. The fear and despair +they had felt a moment earlier were drowned in their rage against this +vile, contemptible act. A mighty cry for vengeance went up, and without +waiting for further orders they charged forth in a body and made straight +for the enemy. This time they did not heed the cruel pellets that swept +over them like hail. It was a savage, bitter battle. The men fired again +and again, and, when the animals got to close quarters, lashed out with +their sticks and their heavy boots. A cow, three sheep, and two geese were +killed, and nearly everyone was wounded. Even Napoleon, who was directing +operations from the rear, had the tip of his tail chipped by a pellet. But +the men did not go unscathed either. Three of them had their heads broken +by blows from Boxer's hoofs; another was gored in the belly by a cow's +horn; another had his trousers nearly torn off by Jessie and Bluebell. And +when the nine dogs of Napoleon's own bodyguard, whom he had instructed to +make a detour under cover of the hedge, suddenly appeared on the men's +flank, baying ferociously, panic overtook them. They saw that they were in +danger of being surrounded. Frederick shouted to his men to get out while +the going was good, and the next moment the cowardly enemy was running for +dear life. The animals chased them right down to the bottom of the field, +and got in some last kicks at them as they forced their way through the +thorn hedge. + +They had won, but they were weary and bleeding. Slowly they began to limp +back towards the farm. The sight of their dead comrades stretched upon the +grass moved some of them to tears. And for a little while they halted in +sorrowful silence at the place where the windmill had once stood. Yes, it +was gone; almost the last trace of their labour was gone! Even the +foundations were partially destroyed. And in rebuilding it they could not +this time, as before, make use of the fallen stones. This time the stones +had vanished too. The force of the explosion had flung them to distances +of hundreds of yards. It was as though the windmill had never been. + +As they approached the farm Squealer, who had unaccountably been absent +during the fighting, came skipping towards them, whisking his tail and +beaming with satisfaction. And the animals heard, from the direction of +the farm buildings, the solemn booming of a gun. + +"What is that gun firing for?" said Boxer. + +"To celebrate our victory!" cried Squealer. + +"What victory?" said Boxer. His knees were bleeding, he had lost a shoe +and split his hoof, and a dozen pellets had lodged themselves in his hind +leg. + +"What victory, comrade? Have we not driven the enemy off our soil--the +sacred soil of Animal Farm?" + +"But they have destroyed the windmill. And we had worked on it for two +years!" + +"What matter? We will build another windmill. We will build six windmills +if we feel like it. You do not appreciate, comrade, the mighty thing that +we have done. The enemy was in occupation of this very ground that we +stand upon. And now--thanks to the leadership of Comrade Napoleon--we have +won every inch of it back again!" + +"Then we have won back what we had before," said Boxer. + +"That is our victory," said Squealer. + +They limped into the yard. The pellets under the skin of Boxer's leg +smarted painfully. He saw ahead of him the heavy labour of rebuilding the +windmill from the foundations, and already in imagination he braced +himself for the task. But for the first time it occurred to him that he +was eleven years old and that perhaps his great muscles were not quite +what they had once been. + +But when the animals saw the green flag flying, and heard the gun firing +again--seven times it was fired in all--and heard the speech that Napoleon +made, congratulating them on their conduct, it did seem to them after all +that they had won a great victory. The animals slain in the battle were +given a solemn funeral. Boxer and Clover pulled the wagon which served as +a hearse, and Napoleon himself walked at the head of the procession. Two +whole days were given over to celebrations. There were songs, speeches, +and more firing of the gun, and a special gift of an apple was bestowed on +every animal, with two ounces of corn for each bird and three biscuits for +each dog. It was announced that the battle would be called the Battle of +the Windmill, and that Napoleon had created a new decoration, the Order +of the Green Banner, which he had conferred upon himself. In the general +rejoicings the unfortunate affair of the banknotes was forgotten. + +It was a few days later than this that the pigs came upon a case of whisky +in the cellars of the farmhouse. It had been overlooked at the time when +the house was first occupied. That night there came from the farmhouse the +sound of loud singing, in which, to everyone's surprise, the strains of +'Beasts of England' were mixed up. At about half past nine Napoleon, +wearing an old bowler hat of Mr. Jones's, was distinctly seen to emerge +from the back door, gallop rapidly round the yard, and disappear indoors +again. But in the morning a deep silence hung over the farmhouse. Not a +pig appeared to be stirring. It was nearly nine o'clock when Squealer made +his appearance, walking slowly and dejectedly, his eyes dull, his tail +hanging limply behind him, and with every appearance of being seriously +ill. He called the animals together and told them that he had a terrible +piece of news to impart. Comrade Napoleon was dying! + +A cry of lamentation went up. Straw was laid down outside the doors of the +farmhouse, and the animals walked on tiptoe. With tears in their eyes they +asked one another what they should do if their Leader were taken away from +them. A rumour went round that Snowball had after all contrived to +introduce poison into Napoleon's food. At eleven o'clock Squealer came +out to make another announcement. As his last act upon earth, Comrade +Napoleon had pronounced a solemn decree: the drinking of alcohol was to be +punished by death. + +By the evening, however, Napoleon appeared to be somewhat better, and the +following morning Squealer was able to tell them that he was well on the +way to recovery. By the evening of that day Napoleon was back at work, and +on the next day it was learned that he had instructed Whymper to purchase +in Willingdon some booklets on brewing and distilling. A week later +Napoleon gave orders that the small paddock beyond the orchard, which it +had previously been intended to set aside as a grazing-ground for animals +who were past work, was to be ploughed up. It was given out that the +pasture was exhausted and needed re-seeding; but it soon became known that +Napoleon intended to sow it with barley. + +About this time there occurred a strange incident which hardly anyone was +able to understand. One night at about twelve o'clock there was a loud +crash in the yard, and the animals rushed out of their stalls. It was a +moonlit night. At the foot of the end wall of the big barn, where the +Seven Commandments were written, there lay a ladder broken in two pieces. +Squealer, temporarily stunned, was sprawling beside it, and near at hand +there lay a lantern, a paint-brush, and an overturned pot of white paint. +The dogs immediately made a ring round Squealer, and escorted him back to +the farmhouse as soon as he was able to walk. None of the animals could +form any idea as to what this meant, except old Benjamin, who nodded his +muzzle with a knowing air, and seemed to understand, but would say nothing. + +But a few days later Muriel, reading over the Seven Commandments to +herself, noticed that there was yet another of them which the animals had +remembered wrong. They had thought the Fifth Commandment was "No animal +shall drink alcohol," but there were two words that they had forgotten. +Actually the Commandment read: "No animal shall drink alcohol TO EXCESS." + + + + + Chapter IX + + + +Boxer's split hoof was a long time in healing. They had started the +rebuilding of the windmill the day after the victory celebrations were +ended. Boxer refused to take even a day off work, and made it a point of +honour not to let it be seen that he was in pain. In the evenings he would +admit privately to Clover that the hoof troubled him a great deal. Clover +treated the hoof with poultices of herbs which she prepared by chewing +them, and both she and Benjamin urged Boxer to work less hard. "A horse's +lungs do not last for ever," she said to him. But Boxer would not listen. +He had, he said, only one real ambition left--to see the windmill well +under way before he reached the age for retirement. + +At the beginning, when the laws of Animal Farm were first formulated, +the retiring age had been fixed for horses and pigs at twelve, for cows at +fourteen, for dogs at nine, for sheep at seven, and for hens and geese at +five. Liberal old-age pensions had been agreed upon. As yet no animal had +actually retired on pension, but of late the subject had been discussed +more and more. Now that the small field beyond the orchard had been set +aside for barley, it was rumoured that a corner of the large pasture was +to be fenced off and turned into a grazing-ground for superannuated +animals. For a horse, it was said, the pension would be five pounds of +corn a day and, in winter, fifteen pounds of hay, with a carrot or +possibly an apple on public holidays. Boxer's twelfth birthday was due in +the late summer of the following year. + +Meanwhile life was hard. The winter was as cold as the last one had been, +and food was even shorter. Once again all rations were reduced, except +those of the pigs and the dogs. A too rigid equality in rations, Squealer +explained, would have been contrary to the principles of Animalism. In any +case he had no difficulty in proving to the other animals that they were +NOT in reality short of food, whatever the appearances might be. For the +time being, certainly, it had been found necessary to make a readjustment +of rations (Squealer always spoke of it as a "readjustment," never as a +"reduction"), but in comparison with the days of Jones, the improvement +was enormous. Reading out the figures in a shrill, rapid voice, he proved +to them in detail that they had more oats, more hay, more turnips than +they had had in Jones's day, that they worked shorter hours, that their +drinking water was of better quality, that they lived longer, that a +larger proportion of their young ones survived infancy, and that they had +more straw in their stalls and suffered less from fleas. The animals +believed every word of it. Truth to tell, Jones and all he stood for had +almost faded out of their memories. They knew that life nowadays was harsh +and bare, that they were often hungry and often cold, and that they were +usually working when they were not asleep. But doubtless it had been worse +in the old days. They were glad to believe so. Besides, in those days they +had been slaves and now they were free, and that made all the difference, +as Squealer did not fail to point out. + +There were many more mouths to feed now. In the autumn the four sows had +all littered about simultaneously, producing thirty-one young pigs between +them. The young pigs were piebald, and as Napoleon was the only boar on +the farm, it was possible to guess at their parentage. It was announced +that later, when bricks and timber had been purchased, a schoolroom would +be built in the farmhouse garden. For the time being, the young pigs were +given their instruction by Napoleon himself in the farmhouse kitchen. They +took their exercise in the garden, and were discouraged from playing with +the other young animals. About this time, too, it was laid down as a rule +that when a pig and any other animal met on the path, the other animal +must stand aside: and also that all pigs, of whatever degree, were to have +the privilege of wearing green ribbons on their tails on Sundays. + +The farm had had a fairly successful year, but was still short of money. +There were the bricks, sand, and lime for the schoolroom to be purchased, +and it would also be necessary to begin saving up again for the machinery +for the windmill. Then there were lamp oil and candles for the house, +sugar for Napoleon's own table (he forbade this to the other pigs, on the +ground that it made them fat), and all the usual replacements such as +tools, nails, string, coal, wire, scrap-iron, and dog biscuits. A stump of +hay and part of the potato crop were sold off, and the contract for eggs +was increased to six hundred a week, so that that year the hens barely +hatched enough chicks to keep their numbers at the same level. Rations, +reduced in December, were reduced again in February, and lanterns in the +stalls were forbidden to save oil. But the pigs seemed comfortable enough, +and in fact were putting on weight if anything. One afternoon in late +February a warm, rich, appetising scent, such as the animals had never +smelt before, wafted itself across the yard from the little brew-house, +which had been disused in Jones's time, and which stood beyond the +kitchen. Someone said it was the smell of cooking barley. The animals +sniffed the air hungrily and wondered whether a warm mash was being +prepared for their supper. But no warm mash appeared, and on the following +Sunday it was announced that from now onwards all barley would be reserved +for the pigs. The field beyond the orchard had already been sown with +barley. And the news soon leaked out that every pig was now receiving a +ration of a pint of beer daily, with half a gallon for Napoleon himself, +which was always served to him in the Crown Derby soup tureen. + +But if there were hardships to be borne, they were partly offset by the +fact that life nowadays had a greater dignity than it had had before. +There were more songs, more speeches, more processions. Napoleon had +commanded that once a week there should be held something called a +Spontaneous Demonstration, the object of which was to celebrate the +struggles and triumphs of Animal Farm. At the appointed time the animals +would leave their work and march round the precincts of the farm in +military formation, with the pigs leading, then the horses, then the cows, +then the sheep, and then the poultry. The dogs flanked the procession and +at the head of all marched Napoleon's black cockerel. Boxer and Clover +always carried between them a green banner marked with the hoof and the +horn and the caption, "Long live Comrade Napoleon!" Afterwards there were +recitations of poems composed in Napoleon's honour, and a speech by +Squealer giving particulars of the latest increases in the production of +foodstuffs, and on occasion a shot was fired from the gun. The sheep were +the greatest devotees of the Spontaneous Demonstration, and if anyone +complained (as a few animals sometimes did, when no pigs or dogs were near) +that they wasted time and meant a lot of standing about in the cold, the +sheep were sure to silence him with a tremendous bleating of "Four legs +good, two legs bad!" But by and large the animals enjoyed these +celebrations. They found it comforting to be reminded that, after all, +they were truly their own masters and that the work they did was for their +own benefit. So that, what with the songs, the processions, Squealer's +lists of figures, the thunder of the gun, the crowing of the cockerel, +and the fluttering of the flag, they were able to forget that their +bellies were empty, at least part of the time. + +In April, Animal Farm was proclaimed a Republic, and it became necessary +to elect a President. There was only one candidate, Napoleon, who was +elected unanimously. On the same day it was given out that fresh documents +had been discovered which revealed further details about Snowball's +complicity with Jones. It now appeared that Snowball had not, as the +animals had previously imagined, merely attempted to lose the Battle of +the Cowshed by means of a stratagem, but had been openly fighting on +Jones's side. In fact, it was he who had actually been the leader of the +human forces, and had charged into battle with the words "Long live +Humanity!" on his lips. The wounds on Snowball's back, which a few of the +animals still remembered to have seen, had been inflicted by Napoleon's +teeth. + +In the middle of the summer Moses the raven suddenly reappeared on the +farm, after an absence of several years. He was quite unchanged, still did +no work, and talked in the same strain as ever about Sugarcandy Mountain. +He would perch on a stump, flap his black wings, and talk by the hour to +anyone who would listen. "Up there, comrades," he would say solemnly, +pointing to the sky with his large beak--"up there, just on the other side +of that dark cloud that you can see--there it lies, Sugarcandy Mountain, +that happy country where we poor animals shall rest for ever from our +labours!" He even claimed to have been there on one of his higher flights, +and to have seen the everlasting fields of clover and the linseed cake and +lump sugar growing on the hedges. Many of the animals believed him. Their +lives now, they reasoned, were hungry and laborious; was it not right and +just that a better world should exist somewhere else? A thing that was +difficult to determine was the attitude of the pigs towards Moses. They +all declared contemptuously that his stories about Sugarcandy Mountain +were lies, and yet they allowed him to remain on the farm, not working, +with an allowance of a gill of beer a day. + +After his hoof had healed up, Boxer worked harder than ever. Indeed, all +the animals worked like slaves that year. Apart from the regular work of +the farm, and the rebuilding of the windmill, there was the schoolhouse +for the young pigs, which was started in March. Sometimes the long hours +on insufficient food were hard to bear, but Boxer never faltered. In +nothing that he said or did was there any sign that his strength was not +what it had been. It was only his appearance that was a little altered; +his hide was less shiny than it had used to be, and his great haunches +seemed to have shrunken. The others said, "Boxer will pick up when the +spring grass comes on"; but the spring came and Boxer grew no fatter. +Sometimes on the slope leading to the top of the quarry, when he braced +his muscles against the weight of some vast boulder, it seemed that +nothing kept him on his feet except the will to continue. At such times +his lips were seen to form the words, "I will work harder"; he had no +voice left. Once again Clover and Benjamin warned him to take care of his +health, but Boxer paid no attention. His twelfth birthday was approaching. +He did not care what happened so long as a good store of stone was +accumulated before he went on pension. + +Late one evening in the summer, a sudden rumour ran round the farm that +something had happened to Boxer. He had gone out alone to drag a load of +stone down to the windmill. And sure enough, the rumour was true. A few +minutes later two pigeons came racing in with the news; "Boxer has fallen! +He is lying on his side and can't get up!" + +About half the animals on the farm rushed out to the knoll where the +windmill stood. There lay Boxer, between the shafts of the cart, his neck +stretched out, unable even to raise his head. His eyes were glazed, his +sides matted with sweat. A thin stream of blood had trickled out of his +mouth. Clover dropped to her knees at his side. + +"Boxer!" she cried, "how are you?" + +"It is my lung," said Boxer in a weak voice. "It does not matter. I think +you will be able to finish the windmill without me. There is a pretty good +store of stone accumulated. I had only another month to go in any case. +To tell you the truth, I had been looking forward to my retirement. And +perhaps, as Benjamin is growing old too, they will let him retire at the +same time and be a companion to me." + +"We must get help at once," said Clover. "Run, somebody, and tell Squealer +what has happened." + +All the other animals immediately raced back to the farmhouse to give +Squealer the news. Only Clover remained, and Benjamin who lay down at +Boxer's side, and, without speaking, kept the flies off him with his long +tail. After about a quarter of an hour Squealer appeared, full of sympathy +and concern. He said that Comrade Napoleon had learned with the very +deepest distress of this misfortune to one of the most loyal workers on +the farm, and was already making arrangements to send Boxer to be treated +in the hospital at Willingdon. The animals felt a little uneasy at this. +Except for Mollie and Snowball, no other animal had ever left the farm, +and they did not like to think of their sick comrade in the hands of human +beings. However, Squealer easily convinced them that the veterinary +surgeon in Willingdon could treat Boxer's case more satisfactorily than +could be done on the farm. And about half an hour later, when Boxer had +somewhat recovered, he was with difficulty got on to his feet, and managed +to limp back to his stall, where Clover and Benjamin had prepared a good +bed of straw for him. + +For the next two days Boxer remained in his stall. The pigs had sent out a +large bottle of pink medicine which they had found in the medicine chest +in the bathroom, and Clover administered it to Boxer twice a day after +meals. In the evenings she lay in his stall and talked to him, while +Benjamin kept the flies off him. Boxer professed not to be sorry for what +had happened. If he made a good recovery, he might expect to live another +three years, and he looked forward to the peaceful days that he would +spend in the corner of the big pasture. It would be the first time that he +had had leisure to study and improve his mind. He intended, he said, to +devote the rest of his life to learning the remaining twenty-two letters +of the alphabet. + +However, Benjamin and Clover could only be with Boxer after working hours, +and it was in the middle of the day when the van came to take him away. +The animals were all at work weeding turnips under the supervision of a +pig, when they were astonished to see Benjamin come galloping from the +direction of the farm buildings, braying at the top of his voice. It was +the first time that they had ever seen Benjamin excited--indeed, it was +the first time that anyone had ever seen him gallop. "Quick, quick!" he +shouted. "Come at once! They're taking Boxer away!" Without waiting for +orders from the pig, the animals broke off work and raced back to the farm +buildings. Sure enough, there in the yard was a large closed van, drawn by +two horses, with lettering on its side and a sly-looking man in a +low-crowned bowler hat sitting on the driver's seat. And Boxer's stall was +empty. + +The animals crowded round the van. "Good-bye, Boxer!" they chorused, +"good-bye!" + +"Fools! Fools!" shouted Benjamin, prancing round them and stamping the +earth with his small hoofs. "Fools! Do you not see what is written on the +side of that van?" + +That gave the animals pause, and there was a hush. Muriel began to spell +out the words. But Benjamin pushed her aside and in the midst of a deadly +silence he read: + +"'Alfred Simmonds, Horse Slaughterer and Glue Boiler, Willingdon. Dealer +in Hides and Bone-Meal. Kennels Supplied.' Do you not understand what that +means? They are taking Boxer to the knacker's!" + +A cry of horror burst from all the animals. At this moment the man on the +box whipped up his horses and the van moved out of the yard at a smart +trot. All the animals followed, crying out at the tops of their voices. +Clover forced her way to the front. The van began to gather speed. Clover +tried to stir her stout limbs to a gallop, and achieved a canter. "Boxer!" +she cried. "Boxer! Boxer! Boxer!" And just at this moment, as though he +had heard the uproar outside, Boxer's face, with the white stripe down his +nose, appeared at the small window at the back of the van. + +"Boxer!" cried Clover in a terrible voice. "Boxer! Get out! Get out +quickly! They're taking you to your death!" + +All the animals took up the cry of "Get out, Boxer, get out!" But the van +was already gathering speed and drawing away from them. It was uncertain +whether Boxer had understood what Clover had said. But a moment later his +face disappeared from the window and there was the sound of a tremendous +drumming of hoofs inside the van. He was trying to kick his way out. The +time had been when a few kicks from Boxer's hoofs would have smashed the +van to matchwood. But alas! his strength had left him; and in a few +moments the sound of drumming hoofs grew fainter and died away. In +desperation the animals began appealing to the two horses which drew the +van to stop. "Comrades, comrades!" they shouted. "Don't take your own +brother to his death!" But the stupid brutes, too ignorant to realise +what was happening, merely set back their ears and quickened their pace. +Boxer's face did not reappear at the window. Too late, someone thought of +racing ahead and shutting the five-barred gate; but in another moment the +van was through it and rapidly disappearing down the road. Boxer was never +seen again. + +Three days later it was announced that he had died in the hospital at +Willingdon, in spite of receiving every attention a horse could have. +Squealer came to announce the news to the others. He had, he said, been +present during Boxer's last hours. + +"It was the most affecting sight I have ever seen!" said Squealer, lifting +his trotter and wiping away a tear. "I was at his bedside at the very +last. And at the end, almost too weak to speak, he whispered in my ear +that his sole sorrow was to have passed on before the windmill was +finished. 'Forward, comrades!' he whispered. 'Forward in the name of the +Rebellion. Long live Animal Farm! Long live Comrade Napoleon! Napoleon is +always right.' Those were his very last words, comrades." + +Here Squealer's demeanour suddenly changed. He fell silent for a moment, +and his little eyes darted suspicious glances from side to side before he +proceeded. + +It had come to his knowledge, he said, that a foolish and wicked rumour +had been circulated at the time of Boxer's removal. Some of the animals +had noticed that the van which took Boxer away was marked "Horse +Slaughterer," and had actually jumped to the conclusion that Boxer was +being sent to the knacker's. It was almost unbelievable, said Squealer, +that any animal could be so stupid. Surely, he cried indignantly, whisking +his tail and skipping from side to side, surely they knew their beloved +Leader, Comrade Napoleon, better than that? But the explanation was really +very simple. The van had previously been the property of the knacker, and +had been bought by the veterinary surgeon, who had not yet painted the old +name out. That was how the mistake had arisen. + +The animals were enormously relieved to hear this. And when Squealer went +on to give further graphic details of Boxer's death-bed, the admirable +care he had received, and the expensive medicines for which Napoleon had +paid without a thought as to the cost, their last doubts disappeared and +the sorrow that they felt for their comrade's death was tempered by the +thought that at least he had died happy. + +Napoleon himself appeared at the meeting on the following Sunday morning +and pronounced a short oration in Boxer's honour. It had not been +possible, he said, to bring back their lamented comrade's remains for +interment on the farm, but he had ordered a large wreath to be made from +the laurels in the farmhouse garden and sent down to be placed on Boxer's +grave. And in a few days' time the pigs intended to hold a memorial +banquet in Boxer's honour. Napoleon ended his speech with a reminder of +Boxer's two favourite maxims, "I will work harder" and "Comrade Napoleon +is always right"--maxims, he said, which every animal would do well to +adopt as his own. + +On the day appointed for the banquet, a grocer's van drove up from +Willingdon and delivered a large wooden crate at the farmhouse. That night +there was the sound of uproarious singing, which was followed by what +sounded like a violent quarrel and ended at about eleven o'clock with a +tremendous crash of glass. No one stirred in the farmhouse before noon on +the following day, and the word went round that from somewhere or other +the pigs had acquired the money to buy themselves another case of whisky. + + + + + Chapter X + + + +Years passed. The seasons came and went, the short animal lives fled by. +A time came when there was no one who remembered the old days before the +Rebellion, except Clover, Benjamin, Moses the raven, and a number of the +pigs. + +Muriel was dead; Bluebell, Jessie, and Pincher were dead. Jones too was +dead--he had died in an inebriates' home in another part of the country. +Snowball was forgotten. Boxer was forgotten, except by the few who had +known him. Clover was an old stout mare now, stiff in the joints and with +a tendency to rheumy eyes. She was two years past the retiring age, but in +fact no animal had ever actually retired. The talk of setting aside a +corner of the pasture for superannuated animals had long since been +dropped. Napoleon was now a mature boar of twenty-four stone. Squealer was +so fat that he could with difficulty see out of his eyes. Only old +Benjamin was much the same as ever, except for being a little greyer about +the muzzle, and, since Boxer's death, more morose and taciturn than ever. + +There were many more creatures on the farm now, though the increase was +not so great as had been expected in earlier years. Many animals had been +born to whom the Rebellion was only a dim tradition, passed on by word of +mouth, and others had been bought who had never heard mention of such a +thing before their arrival. The farm possessed three horses now besides +Clover. They were fine upstanding beasts, willing workers and good +comrades, but very stupid. None of them proved able to learn the alphabet +beyond the letter B. They accepted everything that they were told about +the Rebellion and the principles of Animalism, especially from Clover, for +whom they had an almost filial respect; but it was doubtful whether they +understood very much of it. + +The farm was more prosperous now, and better organised: it had even been +enlarged by two fields which had been bought from Mr. Pilkington. The +windmill had been successfully completed at last, and the farm possessed a +threshing machine and a hay elevator of its own, and various new buildings +had been added to it. Whymper had bought himself a dogcart. The windmill, +however, had not after all been used for generating electrical power. It +was used for milling corn, and brought in a handsome money profit. The +animals were hard at work building yet another windmill; when that one was +finished, so it was said, the dynamos would be installed. But the luxuries +of which Snowball had once taught the animals to dream, the stalls with +electric light and hot and cold water, and the three-day week, were no +longer talked about. Napoleon had denounced such ideas as contrary to the +spirit of Animalism. The truest happiness, he said, lay in working hard +and living frugally. + +Somehow it seemed as though the farm had grown richer without making the +animals themselves any richer-except, of course, for the pigs and the +dogs. Perhaps this was partly because there were so many pigs and so many +dogs. It was not that these creatures did not work, after their fashion. +There was, as Squealer was never tired of explaining, endless work in the +supervision and organisation of the farm. Much of this work was of a kind +that the other animals were too ignorant to understand. For example, +Squealer told them that the pigs had to expend enormous labours every day +upon mysterious things called "files," "reports," "minutes," and +"memoranda". These were large sheets of paper which had to be closely +covered with writing, and as soon as they were so covered, they were burnt +in the furnace. This was of the highest importance for the welfare of the +farm, Squealer said. But still, neither pigs nor dogs produced any food by +their own labour; and there were very many of them, and their appetites +were always good. + +As for the others, their life, so far as they knew, was as it had always +been. They were generally hungry, they slept on straw, they drank from the +pool, they laboured in the fields; in winter they were troubled by the +cold, and in summer by the flies. Sometimes the older ones among them +racked their dim memories and tried to determine whether in the early +days of the Rebellion, when Jones's expulsion was still recent, things had +been better or worse than now. They could not remember. There was nothing +with which they could compare their present lives: they had nothing to go +upon except Squealer's lists of figures, which invariably demonstrated +that everything was getting better and better. The animals found the +problem insoluble; in any case, they had little time for speculating on +such things now. Only old Benjamin professed to remember every detail of +his long life and to know that things never had been, nor ever could be +much better or much worse--hunger, hardship, and disappointment being, so +he said, the unalterable law of life. + +And yet the animals never gave up hope. More, they never lost, even for an +instant, their sense of honour and privilege in being members of Animal +Farm. They were still the only farm in the whole county--in all +England!--owned and operated by animals. Not one of them, not even the +youngest, not even the newcomers who had been brought from farms ten or +twenty miles away, ever ceased to marvel at that. And when they heard the +gun booming and saw the green flag fluttering at the masthead, their +hearts swelled with imperishable pride, and the talk turned always towards +the old heroic days, the expulsion of Jones, the writing of the Seven +Commandments, the great battles in which the human invaders had been +defeated. None of the old dreams had been abandoned. The Republic of the +Animals which Major had foretold, when the green fields of England should +be untrodden by human feet, was still believed in. Some day it was coming: +it might not be soon, it might not be with in the lifetime of any animal +now living, but still it was coming. Even the tune of 'Beasts of England' +was perhaps hummed secretly here and there: at any rate, it was a fact +that every animal on the farm knew it, though no one would have dared to +sing it aloud. It might be that their lives were hard and that not all of +their hopes had been fulfilled; but they were conscious that they were not +as other animals. If they went hungry, it was not from feeding tyrannical +human beings; if they worked hard, at least they worked for themselves. +No creature among them went upon two legs. No creature called any other +creature "Master." All animals were equal. + +One day in early summer Squealer ordered the sheep to follow him, and led +them out to a piece of waste ground at the other end of the farm, which +had become overgrown with birch saplings. The sheep spent the whole day +there browsing at the leaves under Squealer's supervision. In the evening +he returned to the farmhouse himself, but, as it was warm weather, told +the sheep to stay where they were. It ended by their remaining there for a +whole week, during which time the other animals saw nothing of them. +Squealer was with them for the greater part of every day. He was, he said, +teaching them to sing a new song, for which privacy was needed. + +It was just after the sheep had returned, on a pleasant evening when the +animals had finished work and were making their way back to the farm +buildings, that the terrified neighing of a horse sounded from the yard. +Startled, the animals stopped in their tracks. It was Clover's voice. She +neighed again, and all the animals broke into a gallop and rushed into the +yard. Then they saw what Clover had seen. + +It was a pig walking on his hind legs. + +Yes, it was Squealer. A little awkwardly, as though not quite used to +supporting his considerable bulk in that position, but with perfect +balance, he was strolling across the yard. And a moment later, out from +the door of the farmhouse came a long file of pigs, all walking on their +hind legs. Some did it better than others, one or two were even a trifle +unsteady and looked as though they would have liked the support of a +stick, but every one of them made his way right round the yard +successfully. And finally there was a tremendous baying of dogs and a +shrill crowing from the black cockerel, and out came Napoleon himself, +majestically upright, casting haughty glances from side to side, and with +his dogs gambolling round him. + +He carried a whip in his trotter. + +There was a deadly silence. Amazed, terrified, huddling together, the +animals watched the long line of pigs march slowly round the yard. It was +as though the world had turned upside-down. Then there came a moment when +the first shock had worn off and when, in spite of everything-in spite of +their terror of the dogs, and of the habit, developed through long years, +of never complaining, never criticising, no matter what happened--they +might have uttered some word of protest. But just at that moment, as +though at a signal, all the sheep burst out into a tremendous bleating of-- + +"Four legs good, two legs BETTER! Four legs good, two legs BETTER! Four +legs good, two legs BETTER!" + +It went on for five minutes without stopping. And by the time the sheep +had quieted down, the chance to utter any protest had passed, for the pigs +had marched back into the farmhouse. + +Benjamin felt a nose nuzzling at his shoulder. He looked round. It was +Clover. Her old eyes looked dimmer than ever. Without saying anything, she +tugged gently at his mane and led him round to the end of the big barn, +where the Seven Commandments were written. For a minute or two they stood +gazing at the tatted wall with its white lettering. + +"My sight is failing," she said finally. "Even when I was young I could +not have read what was written there. But it appears to me that that wall +looks different. Are the Seven Commandments the same as they used to be, +Benjamin?" + +For once Benjamin consented to break his rule, and he read out to her what +was written on the wall. There was nothing there now except a single +Commandment. It ran: + +ALL ANIMALS ARE EQUAL +BUT SOME ANIMALS ARE MORE EQUAL THAN OTHERS + +After that it did not seem strange when next day the pigs who were +supervising the work of the farm all carried whips in their trotters. It +did not seem strange to learn that the pigs had bought themselves a +wireless set, were arranging to install a telephone, and had taken out +subscriptions to 'John Bull', 'Tit-Bits', and the 'Daily Mirror'. It did +not seem strange when Napoleon was seen strolling in the farmhouse garden +with a pipe in his mouth--no, not even when the pigs took Mr. Jones's +clothes out of the wardrobes and put them on, Napoleon himself appearing +in a black coat, ratcatcher breeches, and leather leggings, while his +favourite sow appeared in the watered silk dress which Mrs. Jones had been +used to wearing on Sundays. + +A week later, in the afternoon, a number of dog-carts drove up to the farm. +A deputation of neighbouring farmers had been invited to make a tour of +inspection. They were shown all over the farm, and expressed great +admiration for everything they saw, especially the windmill. The animals +were weeding the turnip field. They worked diligently hardly raising their +faces from the ground, and not knowing whether to be more frightened of +the pigs or of the human visitors. + +That evening loud laughter and bursts of singing came from the farmhouse. +And suddenly, at the sound of the mingled voices, the animals were +stricken with curiosity. What could be happening in there, now that for +the first time animals and human beings were meeting on terms of equality? +With one accord they began to creep as quietly as possible into the +farmhouse garden. + +At the gate they paused, half frightened to go on but Clover led the way +in. They tiptoed up to the house, and such animals as were tall enough +peered in at the dining-room window. There, round the long table, sat half +a dozen farmers and half a dozen of the more eminent pigs, Napoleon +himself occupying the seat of honour at the head of the table. The pigs +appeared completely at ease in their chairs. The company had been enjoying +a game of cards but had broken off for the moment, evidently in order to +drink a toast. A large jug was circulating, and the mugs were being +refilled with beer. No one noticed the wondering faces of the animals that +gazed in at the window. + +Mr. Pilkington, of Foxwood, had stood up, his mug in his hand. In a +moment, he said, he would ask the present company to drink a toast. But +before doing so, there were a few words that he felt it incumbent upon him +to say. + +It was a source of great satisfaction to him, he said--and, he was sure, +to all others present--to feel that a long period of mistrust and +misunderstanding had now come to an end. There had been a time--not that +he, or any of the present company, had shared such sentiments--but there +had been a time when the respected proprietors of Animal Farm had been +regarded, he would not say with hostility, but perhaps with a certain +measure of misgiving, by their human neighbours. Unfortunate incidents had +occurred, mistaken ideas had been current. It had been felt that the +existence of a farm owned and operated by pigs was somehow abnormal and +was liable to have an unsettling effect in the neighbourhood. Too many +farmers had assumed, without due enquiry, that on such a farm a spirit of +licence and indiscipline would prevail. They had been nervous about the +effects upon their own animals, or even upon their human employees. But +all such doubts were now dispelled. Today he and his friends had visited +Animal Farm and inspected every inch of it with their own eyes, and what +did they find? Not only the most up-to-date methods, but a discipline and +an orderliness which should be an example to all farmers everywhere. He +believed that he was right in saying that the lower animals on Animal Farm +did more work and received less food than any animals in the county. +Indeed, he and his fellow-visitors today had observed many features which +they intended to introduce on their own farms immediately. + +He would end his remarks, he said, by emphasising once again the friendly +feelings that subsisted, and ought to subsist, between Animal Farm and its +neighbours. Between pigs and human beings there was not, and there need +not be, any clash of interests whatever. Their struggles and their +difficulties were one. Was not the labour problem the same everywhere? +Here it became apparent that Mr. Pilkington was about to spring some +carefully prepared witticism on the company, but for a moment he was too +overcome by amusement to be able to utter it. After much choking, during +which his various chins turned purple, he managed to get it out: "If you +have your lower animals to contend with," he said, "we have our lower +classes!" This BON MOT set the table in a roar; and Mr. Pilkington once +again congratulated the pigs on the low rations, the long working hours, +and the general absence of pampering which he had observed on Animal Farm. + +And now, he said finally, he would ask the company to rise to their feet +and make certain that their glasses were full. "Gentlemen," concluded +Mr. Pilkington, "gentlemen, I give you a toast: To the prosperity of +Animal Farm!" + +There was enthusiastic cheering and stamping of feet. Napoleon was so +gratified that he left his place and came round the table to clink his +mug against Mr. Pilkington's before emptying it. When the cheering had +died down, Napoleon, who had remained on his feet, intimated that he too +had a few words to say. + +Like all of Napoleon's speeches, it was short and to the point. He too, +he said, was happy that the period of misunderstanding was at an end. For +a long time there had been rumours--circulated, he had reason to think, +by some malignant enemy--that there was something subversive and even +revolutionary in the outlook of himself and his colleagues. They had been +credited with attempting to stir up rebellion among the animals on +neighbouring farms. Nothing could be further from the truth! Their sole +wish, now and in the past, was to live at peace and in normal business +relations with their neighbours. This farm which he had the honour to +control, he added, was a co-operative enterprise. The title-deeds, which +were in his own possession, were owned by the pigs jointly. + +He did not believe, he said, that any of the old suspicions still +lingered, but certain changes had been made recently in the routine of the +farm which should have the effect of promoting confidence still further. +Hitherto the animals on the farm had had a rather foolish custom of +addressing one another as "Comrade." This was to be suppressed. There had +also been a very strange custom, whose origin was unknown, of marching +every Sunday morning past a boar's skull which was nailed to a post in the +garden. This, too, would be suppressed, and the skull had already been +buried. His visitors might have observed, too, the green flag which flew +from the masthead. If so, they would perhaps have noted that the white +hoof and horn with which it had previously been marked had now been +removed. It would be a plain green flag from now onwards. + +He had only one criticism, he said, to make of Mr. Pilkington's excellent +and neighbourly speech. Mr. Pilkington had referred throughout to +"Animal Farm." He could not of course know--for he, Napoleon, was only +now for the first time announcing it--that the name "Animal Farm" +had been abolished. Henceforward the farm was to be known as "The Manor +Farm"--which, he believed, was its correct and original name. + +"Gentlemen," concluded Napoleon, "I will give you the same toast as +before, but in a different form. Fill your glasses to the brim. Gentlemen, +here is my toast: To the prosperity of The Manor Farm!" + +There was the same hearty cheering as before, and the mugs were emptied to +the dregs. But as the animals outside gazed at the scene, it seemed to +them that some strange thing was happening. What was it that had altered +in the faces of the pigs? Clover's old dim eyes flitted from one face to +another. Some of them had five chins, some had four, some had three. But +what was it that seemed to be melting and changing? Then, the applause +having come to an end, the company took up their cards and continued the +game that had been interrupted, and the animals crept silently away. + +But they had not gone twenty yards when they stopped short. An uproar of +voices was coming from the farmhouse. They rushed back and looked through +the window again. Yes, a violent quarrel was in progress. There were +shoutings, bangings on the table, sharp suspicious glances, furious +denials. The source of the trouble appeared to be that Napoleon and +Mr. Pilkington had each played an ace of spades simultaneously. + +Twelve voices were shouting in anger, and they were all alike. No question, +now, what had happened to the faces of the pigs. The creatures outside +looked from pig to man, and from man to pig, and from pig to man again; +but already it was impossible to say which was which. diff --git a/samples/speculation.txt b/samples/speculation.txt new file mode 100644 index 0000000..e9e6cba --- /dev/null +++ b/samples/speculation.txt @@ -0,0 +1,90 @@ +This document explains potential effects of speculation, and how undesirable +effects can be mitigated portably using common APIs. + +=========== +Speculation +=========== + +To improve performance and minimize average latencies, many contemporary CPUs +employ speculative execution techniques such as branch prediction, performing +work which may be discarded at a later stage. + +Typically speculative execution cannot be observed from architectural state, +such as the contents of registers. However, in some cases it is possible to +observe its impact on microarchitectural state, such as the presence or +absence of data in caches. Such state may form side-channels which can be +observed to extract secret information. + +For example, in the presence of branch prediction, it is possible for bounds +checks to be ignored by code which is speculatively executed. Consider the +following code: + + int load_array(int *array, unsigned int index) + { + if (index >= MAX_ARRAY_ELEMS) + return 0; + else + return array[index]; + } + +Which, on arm64, may be compiled to an assembly sequence such as: + + CMP , #MAX_ARRAY_ELEMS + B.LT less + MOV , #0 + RET + less: + LDR , [, ] + RET + +It is possible that a CPU mis-predicts the conditional branch, and +speculatively loads array[index], even if index >= MAX_ARRAY_ELEMS. This +value will subsequently be discarded, but the speculated load may affect +microarchitectural state which can be subsequently measured. + +More complex sequences involving multiple dependent memory accesses may +result in sensitive information being leaked. Consider the following +code, building on the prior example: + + int load_dependent_arrays(int *arr1, int *arr2, int index) + { + int val1, val2, + + val1 = load_array(arr1, index); + val2 = load_array(arr2, val1); + + return val2; + } + +Under speculation, the first call to load_array() may return the value +of an out-of-bounds address, while the second call will influence +microarchitectural state dependent on this value. This may provide an +arbitrary read primitive. + +==================================== +Mitigating speculation side-channels +==================================== + +The kernel provides a generic API to ensure that bounds checks are +respected even under speculation. Architectures which are affected by +speculation-based side-channels are expected to implement these +primitives. + +The array_index_nospec() helper in can be used to +prevent information from being leaked via side-channels. + +A call to array_index_nospec(index, size) returns a sanitized index +value that is bounded to [0, size) even under cpu speculation +conditions. + +This can be used to protect the earlier load_array() example: + + int load_array(int *array, unsigned int index) + { + if (index >= MAX_ARRAY_ELEMS) + return 0; + else { + index = array_index_nospec(index, MAX_ARRAY_ELEMS); + return array[index]; + } + } diff --git a/samples/spinlocks.txt b/samples/spinlocks.txt new file mode 100644 index 0000000..97eaf57 --- /dev/null +++ b/samples/spinlocks.txt @@ -0,0 +1,167 @@ +Lesson 1: Spin locks + +The most basic primitive for locking is spinlock. + +static DEFINE_SPINLOCK(xxx_lock); + + unsigned long flags; + + spin_lock_irqsave(&xxx_lock, flags); + ... critical section here .. + spin_unlock_irqrestore(&xxx_lock, flags); + +The above is always safe. It will disable interrupts _locally_, but the +spinlock itself will guarantee the global lock, so it will guarantee that +there is only one thread-of-control within the region(s) protected by that +lock. This works well even under UP also, so the code does _not_ need to +worry about UP vs SMP issues: the spinlocks work correctly under both. + + NOTE! Implications of spin_locks for memory are further described in: + + Documentation/memory-barriers.txt + (5) LOCK operations. + (6) UNLOCK operations. + +The above is usually pretty simple (you usually need and want only one +spinlock for most things - using more than one spinlock can make things a +lot more complex and even slower and is usually worth it only for +sequences that you _know_ need to be split up: avoid it at all cost if you +aren't sure). + +This is really the only really hard part about spinlocks: once you start +using spinlocks they tend to expand to areas you might not have noticed +before, because you have to make sure the spinlocks correctly protect the +shared data structures _everywhere_ they are used. The spinlocks are most +easily added to places that are completely independent of other code (for +example, internal driver data structures that nobody else ever touches). + + NOTE! The spin-lock is safe only when you _also_ use the lock itself + to do locking across CPU's, which implies that EVERYTHING that + touches a shared variable has to agree about the spinlock they want + to use. + +---- + +Lesson 2: reader-writer spinlocks. + +If your data accesses have a very natural pattern where you usually tend +to mostly read from the shared variables, the reader-writer locks +(rw_lock) versions of the spinlocks are sometimes useful. They allow multiple +readers to be in the same critical region at once, but if somebody wants +to change the variables it has to get an exclusive write lock. + + NOTE! reader-writer locks require more atomic memory operations than + simple spinlocks. Unless the reader critical section is long, you + are better off just using spinlocks. + +The routines look the same as above: + + rwlock_t xxx_lock = __RW_LOCK_UNLOCKED(xxx_lock); + + unsigned long flags; + + read_lock_irqsave(&xxx_lock, flags); + .. critical section that only reads the info ... + read_unlock_irqrestore(&xxx_lock, flags); + + write_lock_irqsave(&xxx_lock, flags); + .. read and write exclusive access to the info ... + write_unlock_irqrestore(&xxx_lock, flags); + +The above kind of lock may be useful for complex data structures like +linked lists, especially searching for entries without changing the list +itself. The read lock allows many concurrent readers. Anything that +_changes_ the list will have to get the write lock. + + NOTE! RCU is better for list traversal, but requires careful + attention to design detail (see Documentation/RCU/listRCU.txt). + +Also, you cannot "upgrade" a read-lock to a write-lock, so if you at _any_ +time need to do any changes (even if you don't do it every time), you have +to get the write-lock at the very beginning. + + NOTE! We are working hard to remove reader-writer spinlocks in most + cases, so please don't add a new one without consensus. (Instead, see + Documentation/RCU/rcu.txt for complete information.) + +---- + +Lesson 3: spinlocks revisited. + +The single spin-lock primitives above are by no means the only ones. They +are the most safe ones, and the ones that work under all circumstances, +but partly _because_ they are safe they are also fairly slow. They are slower +than they'd need to be, because they do have to disable interrupts +(which is just a single instruction on a x86, but it's an expensive one - +and on other architectures it can be worse). + +If you have a case where you have to protect a data structure across +several CPU's and you want to use spinlocks you can potentially use +cheaper versions of the spinlocks. IFF you know that the spinlocks are +never used in interrupt handlers, you can use the non-irq versions: + + spin_lock(&lock); + ... + spin_unlock(&lock); + +(and the equivalent read-write versions too, of course). The spinlock will +guarantee the same kind of exclusive access, and it will be much faster. +This is useful if you know that the data in question is only ever +manipulated from a "process context", ie no interrupts involved. + +The reasons you mustn't use these versions if you have interrupts that +play with the spinlock is that you can get deadlocks: + + spin_lock(&lock); + ... + <- interrupt comes in: + spin_lock(&lock); + +where an interrupt tries to lock an already locked variable. This is ok if +the other interrupt happens on another CPU, but it is _not_ ok if the +interrupt happens on the same CPU that already holds the lock, because the +lock will obviously never be released (because the interrupt is waiting +for the lock, and the lock-holder is interrupted by the interrupt and will +not continue until the interrupt has been processed). + +(This is also the reason why the irq-versions of the spinlocks only need +to disable the _local_ interrupts - it's ok to use spinlocks in interrupts +on other CPU's, because an interrupt on another CPU doesn't interrupt the +CPU that holds the lock, so the lock-holder can continue and eventually +releases the lock). + +Note that you can be clever with read-write locks and interrupts. For +example, if you know that the interrupt only ever gets a read-lock, then +you can use a non-irq version of read locks everywhere - because they +don't block on each other (and thus there is no dead-lock wrt interrupts. +But when you do the write-lock, you have to use the irq-safe version. + +For an example of being clever with rw-locks, see the "waitqueue_lock" +handling in kernel/sched/core.c - nothing ever _changes_ a wait-queue from +within an interrupt, they only read the queue in order to know whom to +wake up. So read-locks are safe (which is good: they are very common +indeed), while write-locks need to protect themselves against interrupts. + + Linus + +---- + +Reference information: + +For dynamic initialization, use spin_lock_init() or rwlock_init() as +appropriate: + + spinlock_t xxx_lock; + rwlock_t xxx_rw_lock; + + static int __init xxx_init(void) + { + spin_lock_init(&xxx_lock); + rwlock_init(&xxx_rw_lock); + ... + } + + module_init(xxx_init); + +For static initialization, use DEFINE_SPINLOCK() / DEFINE_RWLOCK() or +__SPIN_LOCK_UNLOCKED() / __RW_LOCK_UNLOCKED() as appropriate. diff --git a/speculation.txt b/speculation.txt deleted file mode 100644 index e9e6cba..0000000 --- a/speculation.txt +++ /dev/null @@ -1,90 +0,0 @@ -This document explains potential effects of speculation, and how undesirable -effects can be mitigated portably using common APIs. - -=========== -Speculation -=========== - -To improve performance and minimize average latencies, many contemporary CPUs -employ speculative execution techniques such as branch prediction, performing -work which may be discarded at a later stage. - -Typically speculative execution cannot be observed from architectural state, -such as the contents of registers. However, in some cases it is possible to -observe its impact on microarchitectural state, such as the presence or -absence of data in caches. Such state may form side-channels which can be -observed to extract secret information. - -For example, in the presence of branch prediction, it is possible for bounds -checks to be ignored by code which is speculatively executed. Consider the -following code: - - int load_array(int *array, unsigned int index) - { - if (index >= MAX_ARRAY_ELEMS) - return 0; - else - return array[index]; - } - -Which, on arm64, may be compiled to an assembly sequence such as: - - CMP , #MAX_ARRAY_ELEMS - B.LT less - MOV , #0 - RET - less: - LDR , [, ] - RET - -It is possible that a CPU mis-predicts the conditional branch, and -speculatively loads array[index], even if index >= MAX_ARRAY_ELEMS. This -value will subsequently be discarded, but the speculated load may affect -microarchitectural state which can be subsequently measured. - -More complex sequences involving multiple dependent memory accesses may -result in sensitive information being leaked. Consider the following -code, building on the prior example: - - int load_dependent_arrays(int *arr1, int *arr2, int index) - { - int val1, val2, - - val1 = load_array(arr1, index); - val2 = load_array(arr2, val1); - - return val2; - } - -Under speculation, the first call to load_array() may return the value -of an out-of-bounds address, while the second call will influence -microarchitectural state dependent on this value. This may provide an -arbitrary read primitive. - -==================================== -Mitigating speculation side-channels -==================================== - -The kernel provides a generic API to ensure that bounds checks are -respected even under speculation. Architectures which are affected by -speculation-based side-channels are expected to implement these -primitives. - -The array_index_nospec() helper in can be used to -prevent information from being leaked via side-channels. - -A call to array_index_nospec(index, size) returns a sanitized index -value that is bounded to [0, size) even under cpu speculation -conditions. - -This can be used to protect the earlier load_array() example: - - int load_array(int *array, unsigned int index) - { - if (index >= MAX_ARRAY_ELEMS) - return 0; - else { - index = array_index_nospec(index, MAX_ARRAY_ELEMS); - return array[index]; - } - } diff --git a/spinlocks.txt b/spinlocks.txt deleted file mode 100644 index 97eaf57..0000000 --- a/spinlocks.txt +++ /dev/null @@ -1,167 +0,0 @@ -Lesson 1: Spin locks - -The most basic primitive for locking is spinlock. - -static DEFINE_SPINLOCK(xxx_lock); - - unsigned long flags; - - spin_lock_irqsave(&xxx_lock, flags); - ... critical section here .. - spin_unlock_irqrestore(&xxx_lock, flags); - -The above is always safe. It will disable interrupts _locally_, but the -spinlock itself will guarantee the global lock, so it will guarantee that -there is only one thread-of-control within the region(s) protected by that -lock. This works well even under UP also, so the code does _not_ need to -worry about UP vs SMP issues: the spinlocks work correctly under both. - - NOTE! Implications of spin_locks for memory are further described in: - - Documentation/memory-barriers.txt - (5) LOCK operations. - (6) UNLOCK operations. - -The above is usually pretty simple (you usually need and want only one -spinlock for most things - using more than one spinlock can make things a -lot more complex and even slower and is usually worth it only for -sequences that you _know_ need to be split up: avoid it at all cost if you -aren't sure). - -This is really the only really hard part about spinlocks: once you start -using spinlocks they tend to expand to areas you might not have noticed -before, because you have to make sure the spinlocks correctly protect the -shared data structures _everywhere_ they are used. The spinlocks are most -easily added to places that are completely independent of other code (for -example, internal driver data structures that nobody else ever touches). - - NOTE! The spin-lock is safe only when you _also_ use the lock itself - to do locking across CPU's, which implies that EVERYTHING that - touches a shared variable has to agree about the spinlock they want - to use. - ----- - -Lesson 2: reader-writer spinlocks. - -If your data accesses have a very natural pattern where you usually tend -to mostly read from the shared variables, the reader-writer locks -(rw_lock) versions of the spinlocks are sometimes useful. They allow multiple -readers to be in the same critical region at once, but if somebody wants -to change the variables it has to get an exclusive write lock. - - NOTE! reader-writer locks require more atomic memory operations than - simple spinlocks. Unless the reader critical section is long, you - are better off just using spinlocks. - -The routines look the same as above: - - rwlock_t xxx_lock = __RW_LOCK_UNLOCKED(xxx_lock); - - unsigned long flags; - - read_lock_irqsave(&xxx_lock, flags); - .. critical section that only reads the info ... - read_unlock_irqrestore(&xxx_lock, flags); - - write_lock_irqsave(&xxx_lock, flags); - .. read and write exclusive access to the info ... - write_unlock_irqrestore(&xxx_lock, flags); - -The above kind of lock may be useful for complex data structures like -linked lists, especially searching for entries without changing the list -itself. The read lock allows many concurrent readers. Anything that -_changes_ the list will have to get the write lock. - - NOTE! RCU is better for list traversal, but requires careful - attention to design detail (see Documentation/RCU/listRCU.txt). - -Also, you cannot "upgrade" a read-lock to a write-lock, so if you at _any_ -time need to do any changes (even if you don't do it every time), you have -to get the write-lock at the very beginning. - - NOTE! We are working hard to remove reader-writer spinlocks in most - cases, so please don't add a new one without consensus. (Instead, see - Documentation/RCU/rcu.txt for complete information.) - ----- - -Lesson 3: spinlocks revisited. - -The single spin-lock primitives above are by no means the only ones. They -are the most safe ones, and the ones that work under all circumstances, -but partly _because_ they are safe they are also fairly slow. They are slower -than they'd need to be, because they do have to disable interrupts -(which is just a single instruction on a x86, but it's an expensive one - -and on other architectures it can be worse). - -If you have a case where you have to protect a data structure across -several CPU's and you want to use spinlocks you can potentially use -cheaper versions of the spinlocks. IFF you know that the spinlocks are -never used in interrupt handlers, you can use the non-irq versions: - - spin_lock(&lock); - ... - spin_unlock(&lock); - -(and the equivalent read-write versions too, of course). The spinlock will -guarantee the same kind of exclusive access, and it will be much faster. -This is useful if you know that the data in question is only ever -manipulated from a "process context", ie no interrupts involved. - -The reasons you mustn't use these versions if you have interrupts that -play with the spinlock is that you can get deadlocks: - - spin_lock(&lock); - ... - <- interrupt comes in: - spin_lock(&lock); - -where an interrupt tries to lock an already locked variable. This is ok if -the other interrupt happens on another CPU, but it is _not_ ok if the -interrupt happens on the same CPU that already holds the lock, because the -lock will obviously never be released (because the interrupt is waiting -for the lock, and the lock-holder is interrupted by the interrupt and will -not continue until the interrupt has been processed). - -(This is also the reason why the irq-versions of the spinlocks only need -to disable the _local_ interrupts - it's ok to use spinlocks in interrupts -on other CPU's, because an interrupt on another CPU doesn't interrupt the -CPU that holds the lock, so the lock-holder can continue and eventually -releases the lock). - -Note that you can be clever with read-write locks and interrupts. For -example, if you know that the interrupt only ever gets a read-lock, then -you can use a non-irq version of read locks everywhere - because they -don't block on each other (and thus there is no dead-lock wrt interrupts. -But when you do the write-lock, you have to use the irq-safe version. - -For an example of being clever with rw-locks, see the "waitqueue_lock" -handling in kernel/sched/core.c - nothing ever _changes_ a wait-queue from -within an interrupt, they only read the queue in order to know whom to -wake up. So read-locks are safe (which is good: they are very common -indeed), while write-locks need to protect themselves against interrupts. - - Linus - ----- - -Reference information: - -For dynamic initialization, use spin_lock_init() or rwlock_init() as -appropriate: - - spinlock_t xxx_lock; - rwlock_t xxx_rw_lock; - - static int __init xxx_init(void) - { - spin_lock_init(&xxx_lock); - rwlock_init(&xxx_rw_lock); - ... - } - - module_init(xxx_init); - -For static initialization, use DEFINE_SPINLOCK() / DEFINE_RWLOCK() or -__SPIN_LOCK_UNLOCKED() / __RW_LOCK_UNLOCKED() as appropriate. diff --git a/sts/bifreq.sts b/sts/bifreq.sts new file mode 100644 index 0000000..dcf4858 --- /dev/null +++ b/sts/bifreq.sts @@ -0,0 +1,685 @@ +[ bifreq_push_eng 1 + %1% float_iload + 1 01bcf4a2 float_dload + float_div + float_fstore +] + +defword bifreq_eng + bifreq_push_eng 1a4337 + bifreq_push_eng 85e79e + bifreq_push_eng 111342b + bifreq_push_eng e30232 + bifreq_push_eng c735b + bifreq_push_eng 5703a7 + bifreq_push_eng 866b32 + bifreq_push_eng 21f476 + bifreq_push_eng d53d87 + bifreq_push_eng d4776 + bifreq_push_eng 4e639f + bifreq_push_eng 2471000 + bifreq_push_eng f3c62d + bifreq_push_eng 428af4b + bifreq_push_eng b6ffe + bifreq_push_eng 8285b7 + bifreq_push_eng 4cebc + bifreq_push_eng 286426e + bifreq_push_eng 2406236 + bifreq_push_eng 2e09c84 + bifreq_push_eng 4a86c8 + bifreq_push_eng 7e7a75 + bifreq_push_eng 3bcc70 + bifreq_push_eng a155a + bifreq_push_eng afd558 + bifreq_push_eng bb967 + bifreq_push_eng 874e85 + bifreq_push_eng a8406 + bifreq_push_eng 4e37c + bifreq_push_eng 229b8 + bifreq_push_eng 12910c9 + bifreq_push_eng 12658 + bifreq_push_eng 9e44 + bifreq_push_eng 25b79 + bifreq_push_eng 42796e + bifreq_push_eng 44ff0 + bifreq_push_eng 6971 + bifreq_push_eng 69e974 + bifreq_push_eng 2ed3f + bifreq_push_eng 19e8d + bifreq_push_eng 7cb36b + bifreq_push_eng 1c1d9 + bifreq_push_eng 1589 + bifreq_push_eng 468318 + bifreq_push_eng 158288 + bifreq_push_eng 688f4 + bifreq_push_eng 7bcc77 + bifreq_push_eng 1d511 + bifreq_push_eng 2239d + bifreq_push_eng bcd + bifreq_push_eng 4fd5ca + bifreq_push_eng 1fc4 + bifreq_push_eng 1301e82 + bifreq_push_eng 48c45 + bifreq_push_eng 2e2e3c + bifreq_push_eng 57823 + bifreq_push_eng 12e2de3 + bifreq_push_eng 4156e + bifreq_push_eng 2c556 + bifreq_push_eng 133338e + bifreq_push_eng 80e084 + bifreq_push_eng a236 + bifreq_push_eng 6df0e3 + bifreq_push_eng 56b804 + bifreq_push_eng 45cf6 + bifreq_push_eng 2de8e + bifreq_push_eng 197f9cd + bifreq_push_eng 5d7cb + bifreq_push_eng 2676a + bifreq_push_eng 54246b + bifreq_push_eng 1514e8 + bifreq_push_eng b56870 + bifreq_push_eng 46408d + bifreq_push_eng 17010 + bifreq_push_eng 3ece5 + bifreq_push_eng 14b4 + bifreq_push_eng 1179e4 + bifreq_push_eng e23a + bifreq_push_eng 10c4fb7 + bifreq_push_eng 5d2e5f + bifreq_push_eng 39b751 + bifreq_push_eng 3d0dfb + bifreq_push_eng 19c714b + bifreq_push_eng 3d8d56 + bifreq_push_eng 25439b + bifreq_push_eng 45f925 + bifreq_push_eng 14ab80e + bifreq_push_eng c3286 + bifreq_push_eng 805b0 + bifreq_push_eng 2e8dc1 + bifreq_push_eng 361749 + bifreq_push_eng 2b57ca + bifreq_push_eng c83342 + bifreq_push_eng 2ffd53 + bifreq_push_eng 452b2 + bifreq_push_eng 5700f7 + bifreq_push_eng 9f25bf + bifreq_push_eng f07939 + bifreq_push_eng 596fbf + bifreq_push_eng 12e625 + bifreq_push_eng 4adf3e + bifreq_push_eng 6b15 + bifreq_push_eng 21d838 + bifreq_push_eng 17ef6 + bifreq_push_eng 2952912 + bifreq_push_eng 949a2e + bifreq_push_eng 1894eb6 + bifreq_push_eng 2c7ca98 + bifreq_push_eng 11a4196 + bifreq_push_eng ca3683 + bifreq_push_eng 7e70ff + bifreq_push_eng 7357e5 + bifreq_push_eng f48d23 + bifreq_push_eng 132e21 + bifreq_push_eng 24cc77 + bifreq_push_eng 1605c18 + bifreq_push_eng 114e00e + bifreq_push_eng 2eb8c2c + bifreq_push_eng ce5cda + bifreq_push_eng d5feb9 + bifreq_push_eng 164cbc + bifreq_push_eng 498fa2e + bifreq_push_eng 366d375 + bifreq_push_eng 1f59868 + bifreq_push_eng 381012 + bifreq_push_eng a158bb + bifreq_push_eng e17856 + bifreq_push_eng 5633d3 + bifreq_push_eng 72df96 + bifreq_push_eng 71a3a + bifreq_push_eng 7f8829 + bifreq_push_eng d8d5b + bifreq_push_eng 17f7e7 + bifreq_push_eng b69fb + bifreq_push_eng 822589 + bifreq_push_eng 5cdb8f + bifreq_push_eng 9bb3e + bifreq_push_eng 170114 + bifreq_push_eng b702e9 + bifreq_push_eng 41e29 + bifreq_push_eng 37e29 + bifreq_push_eng 2c1c57 + bifreq_push_eng 1317f0 + bifreq_push_eng 8275a + bifreq_push_eng 120c0fc + bifreq_push_eng 124ee5 + bifreq_push_eng b990 + bifreq_push_eng 7f3fb0 + bifreq_push_eng 1f3db8 + bifreq_push_eng d0fc4e + bifreq_push_eng 2fe554 + bifreq_push_eng 3bbcd + bifreq_push_eng f594f + bifreq_push_eng 4b71 + bifreq_push_eng c0dc9 + bifreq_push_eng 79d2 + bifreq_push_eng ab816c + bifreq_push_eng 121279 + bifreq_push_eng 13d455 + bifreq_push_eng d6cb0 + bifreq_push_eng dc1bbf + bifreq_push_eng 165bca + bifreq_push_eng 16677e + bifreq_push_eng 96c34f + bifreq_push_eng 6c62a4 + bifreq_push_eng 2b333 + bifreq_push_eng 27ff6 + bifreq_push_eng 275193 + bifreq_push_eng 11fb8f + bifreq_push_eng 25063d + bifreq_push_eng 7cf324 + bifreq_push_eng 128ae4 + bifreq_push_eng e966 + bifreq_push_eng 6aa88b + bifreq_push_eng 3bd323 + bifreq_push_eng 701f16 + bifreq_push_eng 39806e + bifreq_push_eng 2d999 + bifreq_push_eng 17ecf7 + bifreq_push_eng 39ba + bifreq_push_eng ef35c + bifreq_push_eng 6f62 + bifreq_push_eng 224e301 + bifreq_push_eng f78f4 + bifreq_push_eng 15fd21 + bifreq_push_eng ca553 + bifreq_push_eng 600656f + bifreq_push_eng cbaec + bifreq_push_eng 68e27 + bifreq_push_eng 144b4e + bifreq_push_eng 1a38bae + bifreq_push_eng 2e5d2 + bifreq_push_eng 335d1 + bifreq_push_eng 11d83c + bifreq_push_eng 14a529 + bifreq_push_eng 151e16 + bifreq_push_eng 12d0a82 + bifreq_push_eng eeed9 + bifreq_push_eng 18b79 + bifreq_push_eng 3aa3b9 + bifreq_push_eng 25914a + bifreq_push_eng 7f6f3f + bifreq_push_eng 2a4b76 + bifreq_push_eng 303a3 + bifreq_push_eng 156957 + bifreq_push_eng 1d66 + bifreq_push_eng 161233 + bifreq_push_eng 90ca + bifreq_push_eng 989e5c + bifreq_push_eng 27a62c + bifreq_push_eng 14794fc + bifreq_push_eng c4ca13 + bifreq_push_eng bed1ca + bifreq_push_eng 57977e + bifreq_push_eng 916cce + bifreq_push_eng 9517b + bifreq_push_eng 94394 + bifreq_push_eng 357f8 + bifreq_push_eng 277224 + bifreq_push_eng 110ca60 + bifreq_push_eng a0e526 + bifreq_push_eng 539cc92 + bifreq_push_eng 143a430 + bifreq_push_eng 33188d + bifreq_push_eng 47333 + bifreq_push_eng b23e49 + bifreq_push_eng 239ea5d + bifreq_push_eng 242e566 + bifreq_push_eng 8ccab + bifreq_push_eng 8b4d10 + bifreq_push_eng e11cb + bifreq_push_eng d6b00 + bifreq_push_eng 18039 + bifreq_push_eng 1c784a + bifreq_push_eng 1a227b + bifreq_push_eng 4bb4 + bifreq_push_eng 60c2 + bifreq_push_eng 558f + bifreq_push_eng 16b1f4 + bifreq_push_eng 3160 + bifreq_push_eng 2ef7 + bifreq_push_eng 51e0 + bifreq_push_eng 574c9 + bifreq_push_eng 3ed5 + bifreq_push_eng 368f + bifreq_push_eng 2f75 + bifreq_push_eng 5742 + bifreq_push_eng 3874 + bifreq_push_eng 298641 + bifreq_push_eng 86d8 + bifreq_push_eng 2d2 + bifreq_push_eng 13a57 + bifreq_push_eng 999e + bifreq_push_eng 4fb8 + bifreq_push_eng 2ca10f + bifreq_push_eng 22dd + bifreq_push_eng 3ed3 + bifreq_push_eng 2eb + bifreq_push_eng 165b + bifreq_push_eng b2b + bifreq_push_eng 2b3a8e + bifreq_push_eng 6fc84 + bifreq_push_eng 668b1 + bifreq_push_eng 43dde + bifreq_push_eng a2842e + bifreq_push_eng 832fe + bifreq_push_eng 33172 + bifreq_push_eng 9eb6f + bifreq_push_eng 58b855 + bifreq_push_eng 12c10 + bifreq_push_eng 1d01b + bifreq_push_eng ce9e5 + bifreq_push_eng 768f1 + bifreq_push_eng 1d0cdc + bifreq_push_eng 1ad331 + bifreq_push_eng 5bb65 + bifreq_push_eng 3651 + bifreq_push_eng 7bc8c + bifreq_push_eng 313ec5 + bifreq_push_eng 160891 + bifreq_push_eng 7bafa + bifreq_push_eng 11de0 + bifreq_push_eng afb11 + bifreq_push_eng 13db + bifreq_push_eng 87150 + bifreq_push_eng 2bb8 + bifreq_push_eng 161ac4d + bifreq_push_eng 2597cd + bifreq_push_eng 2385ff + bifreq_push_eng 9c55cb + bifreq_push_eng 1cf9c9e + bifreq_push_eng 293cba + bifreq_push_eng e2308 + bifreq_push_eng 1370c0 + bifreq_push_eng 1636521 + bifreq_push_eng 354fa + bifreq_push_eng 11c39a + bifreq_push_eng 177edcb + bifreq_push_eng 21d242 + bifreq_push_eng b7abc + bifreq_push_eng edfb16 + bifreq_push_eng 26d155 + bifreq_push_eng 12d5c + bifreq_push_eng 16f744 + bifreq_push_eng 84607c + bifreq_push_eng 6805f9 + bifreq_push_eng 432efc + bifreq_push_eng 12e50f + bifreq_push_eng 1c070b + bifreq_push_eng 3c6b + bifreq_push_eng d1afcf + bifreq_push_eng dfe2 + bifreq_push_eng 14d131a + bifreq_push_eng 3ee4a4 + bifreq_push_eng 10cf9f + bifreq_push_eng 75766 + bifreq_push_eng 19f9d65 + bifreq_push_eng ae94f + bifreq_push_eng 459cd + bifreq_push_eng ad8d0 + bifreq_push_eng b9aef0 + bifreq_push_eng 20c77 + bifreq_push_eng 1b1c1 + bifreq_push_eng 74d40 + bifreq_push_eng 38ec4c + bifreq_push_eng 8853d + bifreq_push_eng c59cf0 + bifreq_push_eng 778e24 + bifreq_push_eng 536e + bifreq_push_eng a148b + bifreq_push_eng 3bdba7 + bifreq_push_eng 2ea14a + bifreq_push_eng 394f3a + bifreq_push_eng 2147a + bifreq_push_eng e4e95 + bifreq_push_eng 37aa + bifreq_push_eng 1dbdc9 + bifreq_push_eng 475f + bifreq_push_eng 1674e84 + bifreq_push_eng 36f904 + bifreq_push_eng e8281f + bifreq_push_eng 2c0de82 + bifreq_push_eng 1a10c5b + bifreq_push_eng 4b893d + bifreq_push_eng 24c7dc5 + bifreq_push_eng 3bbe92 + bifreq_push_eng 10a4c48 + bifreq_push_eng 147d0f + bifreq_push_eng 2e6f80 + bifreq_push_eng 3859b9 + bifreq_push_eng 39efc0 + bifreq_push_eng 4f0de3 + bifreq_push_eng 1204d1f + bifreq_push_eng 2d4a3e + bifreq_push_eng 3514e + bifreq_push_eng 2485ec + bifreq_push_eng 1451c35 + bifreq_push_eng 305a31c + bifreq_push_eng 38f47a + bifreq_push_eng 217c66 + bifreq_push_eng 40549f + bifreq_push_eng 1245c + bifreq_push_eng 4245fa + bifreq_push_eng 410dd + bifreq_push_eng 64026d + bifreq_push_eng 5ecba0 + bifreq_push_eng 74aee8 + bifreq_push_eng 741f66 + bifreq_push_eng 27ebf4 + bifreq_push_eng 1d20468 + bifreq_push_eng 3f8636 + bifreq_push_eng 31a983 + bifreq_push_eng 516e28 + bifreq_push_eng a165a + bifreq_push_eng 33d7c2 + bifreq_push_eng d1731b + bifreq_push_eng 14171ac + bifreq_push_eng 3647534 + bifreq_push_eng 9b2a18 + bifreq_push_eng 9f993f + bifreq_push_eng 1df35 + bifreq_push_eng 2b9b607 + bifreq_push_eng cf7669 + bifreq_push_eng 13284f0 + bifreq_push_eng 1dabc5c + bifreq_push_eng 7026fe + bifreq_push_eng deeffd + bifreq_push_eng 9eb5e + bifreq_push_eng 1d7e5c + bifreq_push_eng 37ccc + bifreq_push_eng b82765 + bifreq_push_eng 5a2b8 + bifreq_push_eng 61bb4 + bifreq_push_eng 42b0a + bifreq_push_eng eda146 + bifreq_push_eng 66178 + bifreq_push_eng 338bd + bifreq_push_eng 2b1c80 + bifreq_push_eng 54d3aa + bifreq_push_eng b7c3 + bifreq_push_eng 14449 + bifreq_push_eng 95b902 + bifreq_push_eng e3599 + bifreq_push_eng 2023d + bifreq_push_eng b5d8df + bifreq_push_eng 4a5cb1 + bifreq_push_eng 48af + bifreq_push_eng c9480e + bifreq_push_eng 24454c + bifreq_push_eng 3a2c7b + bifreq_push_eng 3adee4 + bifreq_push_eng bbe9 + bifreq_push_eng 817eb + bifreq_push_eng 1a9e + bifreq_push_eng 60b73 + bifreq_push_eng 25e1 + bifreq_push_eng 11f37 + bifreq_push_eng 6aab + bifreq_push_eng 29ab + bifreq_push_eng 21e6 + bifreq_push_eng 1784 + bifreq_push_eng 224a + bifreq_push_eng a07 + bifreq_push_eng 2ff1 + bifreq_push_eng 11eab + bifreq_push_eng 53e + bifreq_push_eng 7e7 + bifreq_push_eng 2583 + bifreq_push_eng 301b + bifreq_push_eng ee0 + bifreq_push_eng 24b2 + bifreq_push_eng 17ae + bifreq_push_eng 9c3 + bifreq_push_eng 1757 + bifreq_push_eng 516f + bifreq_push_eng 4212 + bifreq_push_eng 3f9ed0 + bifreq_push_eng 1074 + bifreq_push_eng 876d + bifreq_push_eng 2fd + bifreq_push_eng 11cd + bifreq_push_eng 118 + bifreq_push_eng 1b518c9 + bifreq_push_eng 330f24 + bifreq_push_eng 6a6a6f + bifreq_push_eng 89b865 + bifreq_push_eng 3a19ed0 + bifreq_push_eng 346ec8 + bifreq_push_eng 46e432 + bifreq_push_eng 2d4c82 + bifreq_push_eng 1a5abd3 + bifreq_push_eng 7e80d + bifreq_push_eng 448888 + bifreq_push_eng 494aae + bifreq_push_eng 709445 + bifreq_push_eng 6bcc3b + bifreq_push_eng 1be06b2 + bifreq_push_eng 36c05c + bifreq_push_eng 26505 + bifreq_push_eng 59f814 + bifreq_push_eng 1440e0b + bifreq_push_eng 14764bb + bifreq_push_eng 51567d + bifreq_push_eng 29155d + bifreq_push_eng 331625 + bifreq_push_eng 96fe + bifreq_push_eng 861a3b + bifreq_push_eng 1bb18 + bifreq_push_eng 1cafc83 + bifreq_push_eng 54be14 + bifreq_push_eng a4cdfc + bifreq_push_eng 3aa0ca + bifreq_push_eng 1e124f0 + bifreq_push_eng 5cae8b + bifreq_push_eng 1f2f7a + bifreq_push_eng fff007 + bifreq_push_eng 1890c79 + bifreq_push_eng abfba + bifreq_push_eng 236de0 + bifreq_push_eng 4bc294 + bifreq_push_eng 5527d3 + bifreq_push_eng 3f7226 + bifreq_push_eng 16cbd8f + bifreq_push_eng a14b82 + bifreq_push_eng c365a + bifreq_push_eng 359dd0 + bifreq_push_eng 120a170 + bifreq_push_eng 338415f + bifreq_push_eng 990f9d + bifreq_push_eng d75a3 + bifreq_push_eng 8457d2 + bifreq_push_eng c71f + bifreq_push_eng 21c97e + bifreq_push_eng 137e0 + bifreq_push_eng 18efb09 + bifreq_push_eng 3a3823 + bifreq_push_eng 4f4c11 + bifreq_push_eng 23ce14 + bifreq_push_eng 2856205 + bifreq_push_eng 336604 + bifreq_push_eng 1758bd + bifreq_push_eng 6f93ed4 + bifreq_push_eng 28e6dda + bifreq_push_eng 88971 + bifreq_push_eng 9501d + bifreq_push_eng 527201 + bifreq_push_eng 395ef5 + bifreq_push_eng 1b3167 + bifreq_push_eng 2bfa974 + bifreq_push_eng 2ed9db + bifreq_push_eng 26d87 + bifreq_push_eng f169aa + bifreq_push_eng 120bc1a + bifreq_push_eng 1278630 + bifreq_push_eng 815b37 + bifreq_push_eng aa726 + bifreq_push_eng 87f5ae + bifreq_push_eng 6dfc + bifreq_push_eng 7a34d6 + bifreq_push_eng 445c7 + bifreq_push_eng 4609ad + bifreq_push_eng 2da314 + bifreq_push_eng 579f31 + bifreq_push_eng 35660f + bifreq_push_eng 4b315d + bifreq_push_eng ab5c4 + bifreq_push_eng 49bc45 + bifreq_push_eng 52d8d + bifreq_push_eng 351f8a + bifreq_push_eng 15868 + bifreq_push_eng 7db39 + bifreq_push_eng 9b3c1c + bifreq_push_eng 42fb58 + bifreq_push_eng e88243 + bifreq_push_eng 9eab2 + bifreq_push_eng 50fa44 + bifreq_push_eng 5b5a + bifreq_push_eng 1089d15 + bifreq_push_eng ef8d99 + bifreq_push_eng e6f991 + bifreq_push_eng f643 + bifreq_push_eng 33c53 + bifreq_push_eng 561dc + bifreq_push_eng 235ae + bifreq_push_eng 81df8 + bifreq_push_eng 25888 + bifreq_push_eng 3ebc0f + bifreq_push_eng 7208 + bifreq_push_eng e690 + bifreq_push_eng 14e6b + bifreq_push_eng 1bf670d + bifreq_push_eng 6dba + bifreq_push_eng 63f1 + bifreq_push_eng 75fb + bifreq_push_eng 8f20c5 + bifreq_push_eng 2ca8 + bifreq_push_eng 2ccd + bifreq_push_eng bf88 + bifreq_push_eng 88d0 + bifreq_push_eng 813a + bifreq_push_eng 2261ec + bifreq_push_eng f471 + bifreq_push_eng 5d0 + bifreq_push_eng 178a0 + bifreq_push_eng 31d3d + bifreq_push_eng f5c0 + bifreq_push_eng 1438e + bifreq_push_eng 5739 + bifreq_push_eng b228 + bifreq_push_eng c78 + bifreq_push_eng 38e7a + bifreq_push_eng a49 + bifreq_push_eng 100f08a + bifreq_push_eng 60644 + bifreq_push_eng 6d78a + bifreq_push_eng 69a06 + bifreq_push_eng c9305c + bifreq_push_eng 52155 + bifreq_push_eng 22272 + bifreq_push_eng b4dc6d + bifreq_push_eng e821da + bifreq_push_eng 1846b + bifreq_push_eng 245e4 + bifreq_push_eng a0976 + bifreq_push_eng 7b757 + bifreq_push_eng 37b04f + bifreq_push_eng 8af4d7 + bifreq_push_eng 4e8d2 + bifreq_push_eng 3f75 + bifreq_push_eng 12b803 + bifreq_push_eng 1e5877 + bifreq_push_eng 13db2d + bifreq_push_eng 2c294 + bifreq_push_eng f9ba + bifreq_push_eng a4b32 + bifreq_push_eng 1246 + bifreq_push_eng 872af + bifreq_push_eng ce64 + bifreq_push_eng dcbd4 + bifreq_push_eng 16f59 + bifreq_push_eng aa68b + bifreq_push_eng eac5 + bifreq_push_eng 9fa7b + bifreq_push_eng 1b987 + bifreq_push_eng 9979 + bifreq_push_eng 28ac7 + bifreq_push_eng fa2e0 + bifreq_push_eng 2985 + bifreq_push_eng 3553 + bifreq_push_eng e8c1 + bifreq_push_eng 1f204 + bifreq_push_eng 87ae + bifreq_push_eng 338e5 + bifreq_push_eng 1c1638 + bifreq_push_eng 1528 + bifreq_push_eng 15fbe + bifreq_push_eng 25aeb + bifreq_push_eng 170a51 + bifreq_push_eng 2404d + bifreq_push_eng 798d + bifreq_push_eng 1d21a + bifreq_push_eng 88ec + bifreq_push_eng 17079 + bifreq_push_eng 822 + bifreq_push_eng 6e777c + bifreq_push_eng 292652 + bifreq_push_eng 2fbaf5 + bifreq_push_eng 206261 + bifreq_push_eng 632be9 + bifreq_push_eng 232cdc + bifreq_push_eng 1001fa + bifreq_push_eng 22f649 + bifreq_push_eng 44129e + bifreq_push_eng 5c737 + bifreq_push_eng 5fb11 + bifreq_push_eng 1ebaf3 + bifreq_push_eng 266531 + bifreq_push_eng 16ab57 + bifreq_push_eng 8aadf1 + bifreq_push_eng 276567 + bifreq_push_eng 15791 + bifreq_push_eng 1eda33 + bifreq_push_eng 730ba5 + bifreq_push_eng 667327 + bifreq_push_eng a9cd8 + bifreq_push_eng 6475f + bifreq_push_eng 338f78 + bifreq_push_eng 4231 + bifreq_push_eng 514ad + bifreq_push_eng 131c9 + bifreq_push_eng e2d5f + bifreq_push_eng c5dc + bifreq_push_eng a04d + bifreq_push_eng 808a + bifreq_push_eng 1a172f + bifreq_push_eng 6ff2 + bifreq_push_eng 6701 + bifreq_push_eng 1a477 + bifreq_push_eng 9d3c3 + bifreq_push_eng 1bff + bifreq_push_eng 5ec6 + bifreq_push_eng 138a7 + bifreq_push_eng b3d2 + bifreq_push_eng 5eb1 + bifreq_push_eng 67850 + bifreq_push_eng 76b5 + bifreq_push_eng 168d + bifreq_push_eng 7fad + bifreq_push_eng 17311 + bifreq_push_eng de7b + bifreq_push_eng 1bb82 + bifreq_push_eng 3803 + bifreq_push_eng 10d01 + bifreq_push_eng 99f + bifreq_push_eng 19d8f + bifreq_push_eng 3605b +exit diff --git a/sts/cipher.sts b/sts/cipher.sts new file mode 100644 index 0000000..c87b67a --- /dev/null +++ b/sts/cipher.sts @@ -0,0 +1,12 @@ +defword cipher + 3 ref as cipher.byte + 2 get as cipher.password + 1 get as cipher.len + 0 get as cipher.pos + cipher.pos @ word_size mul cipher.password + @ + cipher.byte @ xor + cipher.byte ! + cipher.pos @ 0 = if cipher.len cipher.pos ! fi + cipher.pos @ 1 - cipher.pos ! + drop drop drop +exit diff --git a/sts/common/.print.sts.swp b/sts/common/.print.sts.swp new file mode 100644 index 0000000..d3a74a8 Binary files /dev/null and b/sts/common/.print.sts.swp differ diff --git a/sts/common/common.sts b/sts/common/common.sts new file mode 100644 index 0000000..e0e33cf --- /dev/null +++ b/sts/common/common.sts @@ -0,0 +1,3 @@ +module sts/common/macro.sts +module sts/common/const.sts +module sts/common/print.sts diff --git a/sts/common/const.sts b/sts/common/const.sts new file mode 100644 index 0000000..b1a08b0 --- /dev/null +++ b/sts/common/const.sts @@ -0,0 +1,95 @@ +defconst newline 0a +defconst space 20 +defconst '!' 21 +defconst '"' 22 +defconst '#' 23 +defconst '$' 24 +defconst percent 25 ; '%' (25) symbol is reserved by smack +defconst '&' 26 +defconst ''' 27 +defconst '(' 28 +defconst ')' 29 +defconst '*' 2a +defconst '+' 2b +defconst ',' 2c +defconst '-' 2d +defconst '.' 2e +defconst '/' 2f +defconst '0' 30 +defconst '1' 31 +defconst '2' 32 +defconst '3' 33 +defconst '4' 34 +defconst '5' 35 +defconst '6' 36 +defconst '7' 37 +defconst '8' 38 +defconst '9' 39 +defconst ':' 3a +defconst '<' 3c +defconst '=' 3d +defconst '>' 3e +defconst '?' 3f +defconst '@' 40 +defconst 'A' 41 +defconst 'B' 42 +defconst 'C' 43 +defconst 'D' 44 +defconst 'E' 45 +defconst 'F' 46 +defconst 'G' 47 +defconst 'H' 48 +defconst 'I' 49 +defconst 'J' 4a +defconst 'K' 4b +defconst 'L' 4c +defconst 'M' 4d +defconst 'N' 4e +defconst 'O' 4f +defconst 'P' 50 +defconst 'Q' 51 +defconst 'R' 52 +defconst 'S' 53 +defconst 'T' 54 +defconst 'U' 55 +defconst 'V' 56 +defconst 'W' 57 +defconst 'X' 58 +defconst 'Y' 59 +defconst 'Z' 5a +defconst '[' 5b +defconst '\' 5c +defconst ']' 5d +defconst '^' 5e +defconst '_' 5f +defconst '`' 60 +defconst 'a' 61 +defconst 'b' 62 +defconst 'c' 63 +defconst 'd' 64 +defconst 'e' 65 +defconst 'f' 66 +defconst 'g' 67 +defconst 'h' 68 +defconst 'i' 69 +defconst 'j' 6a +defconst 'k' 6b +defconst 'l' 6c +defconst 'm' 6d +defconst 'n' 6e +defconst 'o' 6f +defconst 'p' 70 +defconst 'q' 71 +defconst 'r' 72 +defconst 's' 73 +defconst 't' 74 +defconst 'u' 75 +defconst 'v' 76 +defconst 'w' 77 +defconst 'x' 78 +defconst 'y' 79 +defconst 'z' 7a +defconst '{' 7b +defconst '|' 7c +defconst '}' 7d +defconst '~' 7e diff --git a/sts/common/macro.sts b/sts/common/macro.sts new file mode 100644 index 0000000..162bf2f --- /dev/null +++ b/sts/common/macro.sts @@ -0,0 +1,9 @@ +[ local 1 + top as %1% +] + +[ change 0 + 1 + dup get + swap 2 get swap set + swap drop +] diff --git a/sts/common/print.sts b/sts/common/print.sts new file mode 100644 index 0000000..a3bea56 --- /dev/null +++ b/sts/common/print.sts @@ -0,0 +1,30 @@ +defword get_hex + f and + dup 9 > if + a - 'a' + + else + '0' + + fi +exit + +defword print_hex + dup 1c shr get_hex sys_write + dup 18 shr get_hex sys_write + dup 14 shr get_hex sys_write + dup 10 shr get_hex sys_write + dup c shr get_hex sys_write + dup 8 shr get_hex sys_write + dup 4 shr get_hex sys_write + get_hex sys_write +exit + +defword print_stack + dup + do + over over - 2 + get print_hex + 1 - dup 0 = until + space sys_write + od newline sys_write + drop + drop +exit diff --git a/sts/freq.sts b/sts/freq.sts new file mode 100644 index 0000000..9935d72 --- /dev/null +++ b/sts/freq.sts @@ -0,0 +1,35 @@ +[ freq_push_eng 1 + %1% float_iload + 1 04b7e520 float_dload + float_div + float_fstore +] + +defword freq_eng + freq_push_eng 164bbb40 ; 'A' + freq_push_eng 42f1a72 ; 'B' + freq_push_eng 8401143 ; 'C' + freq_push_eng a17c760 ; 'D' + freq_push_eng 1f89b0b5 ; 'E' + freq_push_eng 5b00667 ; 'F' + freq_push_eng 5708064 ; 'G' + freq_push_eng ceba1cf ; 'H' + freq_push_eng 131911c9 ; 'I' + freq_push_eng 92b062 ; 'J' + freq_push_eng 21bc198 ; 'K' + freq_push_eng af78ee2 ; 'L' + freq_push_eng 6962a60 ; 'M' + freq_push_eng 12b2fedc ; 'N' + freq_push_eng 1377f19c ; 'O' + freq_push_eng 5630a2b ; 'P' + freq_push_eng 456e16 ; 'Q' + freq_push_eng 1082b289 ; 'R' + freq_push_eng 118aaa32 ; 'S' + freq_push_eng 174da771 ; 'T' + freq_push_eng 6fdcaa4 ; 'U' + freq_push_eng 2c30c89 ; 'V' + freq_push_eng 4c25150 ; 'W' + freq_push_eng 7fb6fb ; 'X' + freq_push_eng 47ce733 ; 'Y' + freq_push_eng 4bece7 ; 'Z' +exit diff --git a/sts/ia32/bitwise.sts b/sts/ia32/bitwise.sts new file mode 100644 index 0000000..205e618 --- /dev/null +++ b/sts/ia32/bitwise.sts @@ -0,0 +1,27 @@ +defasm xor + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 31 ?' # d8 ?' ; xor eax, ebx + # 50 ?' ; push eax +next + +defasm and + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 21 ?' # d8 ?' ; and eax, ebx + # 50 ?' ; push eax +next + +defasm shr + # 59 ?' ; pop ecx + # 58 ?' ; pop eax + # d3 ?' # e8 ?' ; shr eax, cl + # 50 ?' ; push eax +next + +defasm shl + # 59 ?' ; pop ecx + # 58 ?' ; pop eax + # d3 ?' # e0 ?' ; shl eax, cl + # 50 ?' ; push eax +next diff --git a/sts/ia32/branch.sts b/sts/ia32/branch.sts new file mode 100644 index 0000000..35177f6 --- /dev/null +++ b/sts/ia32/branch.sts @@ -0,0 +1,11 @@ +defasm branch + # 8b ?' # 36 ?' ; mov esi, [esi] +next + +defasm 0branch + # 58 ?' ; pop eax + # 83 ?' # c6 ?' # 4 ?' ; add esi, 4 + # 83 ?' # f8 ?' # 0 ?' ; cmp eax, 0 + # 75 ?' # 3 ?' ; jne +3 + # 8b ?' # 76 ?' # fc ?' ; mov esi, [esi - 4] +next diff --git a/sts/ia32/const.sts b/sts/ia32/const.sts new file mode 100644 index 0000000..31f8041 --- /dev/null +++ b/sts/ia32/const.sts @@ -0,0 +1,3 @@ +defconst word_size 4 +defconst word_max ffffffff +defconst word_endianness 0 diff --git a/sts/ia32/core.sts b/sts/ia32/core.sts new file mode 100644 index 0000000..4a5e692 --- /dev/null +++ b/sts/ia32/core.sts @@ -0,0 +1,17 @@ +defasm docol + # 83 ?' # ed ?' # 4 ?' ; sub ebp, 4 + # 89 ?' # 75 ?' # 0 ?' ; mov [ebp], esi + # 83 ?' # c0 ?' # 4 ?' ; add eax, 4 + # 89 ?' # c6 ?' ; mov esi, eax + # ad ?' # ff ?' # 20 ?' ; go next +next + +defasm exit + # 8b ?' # 75 ?' # 0 ?' ; mov esi, [ebp] + # 83 ?' # c5 ?' # 4 ?' ; add ebp, 4 +next + +defasm lit + # ad ?' ; lodsd + # 50 ?' ; push eax +next diff --git a/sts/ia32/elf/begin.sts b/sts/ia32/elf/begin.sts new file mode 100644 index 0000000..16d3355 --- /dev/null +++ b/sts/ia32/elf/begin.sts @@ -0,0 +1,129 @@ +?create ?? _code_segment +_code_segment ?choose + +# 08048000 ?org +# 4 ?size +# 0 ?endianness + +?create ?? _data_segment +_data_segment ?choose + +# 09048000 ?org +# 4 ?size +# 0 ?endianness + +_code_segment ?choose + +; ELF header +; EI_MAG - ELF magic number +# 7f ?' # 45 ?' # 4c ?' # 46 ?' +; EI_CLASS - 32-bit format +# 1 ?' +; EI_DATA - little-endiann +# 1 ?' +; EI_VERSION - current ELF header version +# 1 ?' +; EI_OSABI - Linux ABI +# 3 ?' +; EI_ABIVERSION - none +# 0 ?' +; EI_PAD - padding +# 7 ?res +; Executable file type +# 2 ?2. +; IA-32 architecture +# 3 ?2. +; ELF version +# 1 ?4. +; Entry point +?$ ?? _elf_entry +# 0 ?4. +; Program headers offset +# 34 ?4. +; Section headers offset +# 0 ?4. +; Extra flags +# 0 ?4. +; ELF header size +# 34 ?2. +; Program header size +# 20 ?2. +; Number of program headers +# 2 ?2. +; Section header size +# 28 ?2. +; Number of section headers +# 0 ?2. +; Section name section index +# 0 ?2. + +; ELF CODE PROGRAM HEADER +; Segment type +# 1 ?4. +; Segment offset +# 0 ?4. +; Segment virtual address +?$$ ?4. +; Segment physical address +?$$ ?4. +; Segment file size +?$ ?? _code_segment_file_size +# 0 ?4. +; Segment memory size +?$ ?? _code_segment_memory_size +# 0 ?4. +; Segment flags +# 5 ?4. +; Segment alignment +# 1000 ?4. + +; ELF DATA PROGRAM HEADER +; Segment type +# 1 ?4. +; Segment offset +?$ ?? _data_segment_offset +# 0 ?4. +; Segment virtual address +_data_segment ?choose +?$$ +_code_segment ?choose +?4. +; Segment physical address +_data_segment ?choose +?$$ +_code_segment ?choose +?4. +; Segment file size +?$ ?? _data_segment_file_size +# 0 ?4. +; Segment memory size +?$ ?? _data_segment_memory_size +# 0 ?4. +; Segment flags +# 6 ?4. +; Segment alignment +# 1000 ?4. + +; Return stack +_data_segment ?choose +1000 ?res +?$ ?dup ?? _return_stack +_code_segment ?choose + +; PROGRAM ENTRY CODE +?$ _elf_entry ?! +; mov ebp, _return_stack +# bd ?' +_return_stack ?. +; mov esi, _threaded_code_entry +# be ?' +?$ ?? _threaded_code_entry +# 0 ?. +; lodsd +# ad ?' +; jmp dword [eax] +# ff ?' # 20 ?' + +module sts/ia32/ia32.sts +module sts/ia32/elf/syscall.sts +module sts/common/common.sts diff --git a/sts/ia32/elf/end.sts b/sts/ia32/elf/end.sts new file mode 100644 index 0000000..7c80eec --- /dev/null +++ b/sts/ia32/elf/end.sts @@ -0,0 +1,21 @@ +; Code segment alignment +# 1000 ?$ # 1000 ?mod ?- ?dup ?res + +; Code segment ELF sizes +?$ ?$$ ?- _code_segment_file_size ?! +?$ ?$$ ?- _code_segment_memory_size ?! + +; Data segment ELF offset +?$ ?$$ ?- +_code_segment ?choose +_data_segment_offset ?! + +; Data segment ELF sizes +_data_segment ?choose +?$ ?$$ ?- +_code_segment ?choose +_data_segment_file_size ?! +_data_segment ?choose +?$ ?$$ ?- +_code_segment ?choose +_data_segment_memory_size ?! diff --git a/sts/ia32/elf/syscall.sts b/sts/ia32/elf/syscall.sts new file mode 100644 index 0000000..3acfef2 --- /dev/null +++ b/sts/ia32/elf/syscall.sts @@ -0,0 +1,41 @@ +defasm sys_exit + # b8 ?' # 1 ?. ; mov eax, 1 + # 31 ?' # db ?' ; xor ebx, ebx + # cd ?' # 80 ?' ; int 0x80 +; no need in next since this is the last instruction + +_data_segment ?choose + ?$ ?? _iobuf # 0 ?. +_code_segment ?choose + +defasm sys_read + # b8 ?' # 3 ?. ; mov eax, 3 + # 31 ?' # db ?' ; xor ebx, ebx + # b9 ?' _iobuf ?. ; mov ecx, _iobuf + # ba ?' # 1 ?. ; mov edx, 1 + # cd ?' # 80 ?' ; int 0x80 + # 31 ?' # db ?' ; xor ebx, ebx + # 8a ?' # 1d ?' _iobuf ?. ; mov bl, [_iobuf] + # 53 ?' ; push ebx + # 50 ?' ; push eax +next + +defasm sys_write + # 58 ?' ; pop eax + # a2 ?' _iobuf ?. ; mov [_iobuf], al + # b8 ?' # 4 ?. ; mov eax, 4 + # bb ?' # 1 ?. ; mov ebx, 1 + # b9 ?' _iobuf ?. ; mov ecx, _iobuf + # ba ?' # 1 ?. ; mov edx, 1 + # cd ?' # 80 ?' ; int 0x80 +next + +defasm sys_write_err + # 58 ?' ; pop eax + # a2 ?' _iobuf ?. ; mov [_iobuf], al + # b8 ?' # 4 ?. ; mov eax, 4 + # bb ?' # 2 ?. ; mov ebx, 2 + # b9 ?' _iobuf ?. ; mov ecx, _iobuf + # ba ?' # 1 ?. ; mov edx, 1 + # cd ?' # 80 ?' ; int 0x80 +next diff --git a/sts/ia32/float/control.sts b/sts/ia32/float/control.sts new file mode 100644 index 0000000..3863f5f --- /dev/null +++ b/sts/ia32/float/control.sts @@ -0,0 +1,19 @@ +defasm float_init + # 9b ?' ; wait + # db ?' # e3 ?' ; fninit +next + +defasm float_cload + # d9 ?' # 2c ?' # 24 ?' ; fldcw [esp] + # 58 ?' ; pop eax +next + +defasm float_sstore + # 9b ?' # df ?' # e0 ?' ; fstsw ax + # 50 ?' ; push eax +next + +defasm float_cstore + # 50 ?' ; push eax + # d9 ?' # 3c ?' # 24 ?' ; fstcw [esp] +next diff --git a/sts/ia32/float/float.sts b/sts/ia32/float/float.sts new file mode 100644 index 0000000..acaf3a0 --- /dev/null +++ b/sts/ia32/float/float.sts @@ -0,0 +1,3 @@ +module sts/ia32/float/control.sts +module sts/ia32/float/stack.sts +module sts/ia32/float/math.sts diff --git a/sts/ia32/float/math.sts b/sts/ia32/float/math.sts new file mode 100644 index 0000000..d02b491 --- /dev/null +++ b/sts/ia32/float/math.sts @@ -0,0 +1,32 @@ +defasm float_add + # de ?' # c1 ?' ; faddp st1, st0 +next + +defasm float_sub + # de ?' # e9 ?' ; fsubp st1, st0 +next + +defasm float_mul + # de ?' # c9 ?' ; fmullp st1, st0 +next + +defasm float_div + # de ?' # f9 ?' ; fdivp st1, st0 +next + +defasm float_sqrt + # d9 ?' # fa ?' ; fsqrt +next + +defasm float_more + # de ?' # d9 ?' ; fcompp + # 9b ?' # df ?' # e0 ?' ; fstsw ax + # 25 ?' # 100 ?. ; and eax, 0x100 + # c1 ?' # e8 ?' # 8 ?' ; shr eax, 8 + # 50 ?' ; push eax +next + +defword float_less + float_more + 0 = +exit diff --git a/sts/ia32/float/stack.sts b/sts/ia32/float/stack.sts new file mode 100644 index 0000000..8c16fef --- /dev/null +++ b/sts/ia32/float/stack.sts @@ -0,0 +1,25 @@ +defasm float_fload + # d9 ?' # 04 ?' # 24 ?' ; fld dword [esp] + # 58 ?' ; pop eax +next + +defasm float_iload + # db ?' # 04 ?' # 24 ?' ; fild dword [esp] + # 58 ?' ; pop eax +next + +defasm float_dload + # df ?' # 2c ?' # 24 ?' ; fild qword [esp] + # 58 ?' ; pop eax + # 58 ?' ; pop eax +next + +defasm float_fstore + # 50 ?' ; push eax + # d9 ?' # 1c ?' # 24 ?' ; fstp dword [esp] +next + +defasm float_istore + # 50 ?' ; push eax + # db ?' # 1c ?' # 24 ?' ; fistp dword [esp] +next diff --git a/sts/ia32/ia32.sts b/sts/ia32/ia32.sts new file mode 100644 index 0000000..dc3d06f --- /dev/null +++ b/sts/ia32/ia32.sts @@ -0,0 +1,8 @@ +module sts/ia32/macro.sts +module sts/ia32/const.sts +module sts/ia32/core.sts +module sts/ia32/stack.sts +module sts/ia32/branch.sts +module sts/ia32/memory.sts +module sts/ia32/math.sts +module sts/ia32/bitwise.sts diff --git a/sts/ia32/macro.sts b/sts/ia32/macro.sts new file mode 100644 index 0000000..fa9510b --- /dev/null +++ b/sts/ia32/macro.sts @@ -0,0 +1,86 @@ +[ next 0 + # ad ?' # ff ?' # 20 ?' +] + +[ defasm 1 + [ %1% 0 + _%0% ?. + \] + ?$ ?? _%1% + ?$ # 4 ?+ ?. +] + +[ defword 1 + [ %1% 0 + _%0% ?. + \] + ?$ ?? _%1% + _docol # 4 ?+ ?. +] + +[ defconst 2 + defasm %1% + # 68 ?' # %2% ?. ; push %2% + next +] + +[ defarr 2 + _data_segment ?choose + ?$ ?? _%1%_arr + # %2% # 4 ?* ?res + _code_segment ?choose + defasm %1% + # 68 ?' _%1%_arr ?. ; push _%1%_arr + next +] + +[ defvar 1 + defarr %1% 1 +] + +[ as 1 + _data_segment ?choose + defword %1% + lit ?$ # 0 ?. + exit + _code_segment ?choose + lit ?. ! +] + +[ literal 0 + lit # %1% ?. +] + +[ set_entry 0 + ?$ _threaded_code_entry ?! +] + +[ if 0 + 0branch ?$ # 0 ?. +] + +[ fi 0 + ?$ ?swap ?! +] + +[ else 0 + branch ?$ # 0 ?. + ?swap ?$ ?swap ?! +] + +[ do 0 + ?$ +] + +[ untilod 0 + 0branch ?. +] + +[ until 0 + 0 = 0branch ?$ # 0 ?. +] + +[ od 0 + branch ?swap ?. + ?$ ?swap ?! +] diff --git a/sts/ia32/math.sts b/sts/ia32/math.sts new file mode 100644 index 0000000..609a21a --- /dev/null +++ b/sts/ia32/math.sts @@ -0,0 +1,68 @@ +defasm + + # 58 ?' ; pop eax + # 01 ?' # 04 ?' # 24 ?' ; add [esp], eax +next + +defasm - + # 58 ?' ; pop eax + # 29 ?' # 04 ?' # 24 ?' ; sub [esp], eax +next + +defasm mul + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # f7 ?' # e3 ?' ; mul ebx + # 50 ?' ; push eax +next + +defasm mod + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 31 ?' # d2 ?' ; xor edx, edx + # f7 ?' # f3 ?' ; div ebx + # 52 ?' ; push edx +next + +defasm div + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 31 ?' # d2 ?' ; xor edx, edx + # f7 ?' # f3 ?' ; div ebx + # 50 ?' ; push eax +next + +defasm = + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 39 ?' # d8 ?' ; cmp eax, ebx + # 0f ?' # 94 ?' # c0 ?' ; sete al + # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al + # 50 ?' ; push eax +next + +defasm != + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 39 ?' # d8 ?' ; cmp eax, ebx + # 0f ?' # 95 ?' # c0 ?' ; setne al + # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al + # 50 ?' ; push eax +next + +defasm < + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 39 ?' # d8 ?' ; cmp eax, ebx + # 0f ?' # 92 ?' # c0 ?' ; setb al + # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al + # 50 ?' ; push eax +next + +defasm > + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 39 ?' # d8 ?' ; cmp eax, ebx + # 0f ?' # 97 ?' # c0 ?' ; seta al + # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al + # 50 ?' ; push eax +next diff --git a/sts/ia32/memory.sts b/sts/ia32/memory.sts new file mode 100644 index 0000000..240c598 --- /dev/null +++ b/sts/ia32/memory.sts @@ -0,0 +1,10 @@ +defasm @ + # 58 ?' ; pop eax + # ff ?' # 30 ?' ; push dword [eax] +next + +defasm ! + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 89 ?' # 03 ?' ; mov [ebx], eax +next diff --git a/sts/ia32/stack.sts b/sts/ia32/stack.sts new file mode 100644 index 0000000..e884098 --- /dev/null +++ b/sts/ia32/stack.sts @@ -0,0 +1,41 @@ +defasm top + # 54 ?' ; push esp +next + +defasm ref + # 58 ?' ; pop eax + # c1 ?' # e0 ?' # 2 ?' ; shl eax, 2 + # 01 ?' # e0 ?' ; add eax, esp + # 50 ?' ; push eax +next + +defasm get + # 58 ?' ; pop eax + # 8b ?' # 4 ?' # 84 ?' ; mov eax, [esp + 4 * eax] + # 50 ?' ; push eax +next + +defasm set + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 89 ?' # 04 ?' # 9c ?' ; mov [esp + 4 * ebx], eax +next + +defasm drop + # 58 ?' ; pop eax +next + +defasm dup + # ff ?' # 34 ?' # 24 ?' ; push dword [esp] +next + +defasm over + # ff ?' # 74 ?' # 24 ?' # 4 ?' ; push dword [esp + 4] +next + +defasm swap + # 58 ?' ; pop eax + # 5b ?' ; pop ebx + # 50 ?' ; push eax + # 53 ?' ; push ebx +next diff --git a/sts/keygen.sts b/sts/keygen.sts new file mode 100644 index 0000000..6067c0d --- /dev/null +++ b/sts/keygen.sts @@ -0,0 +1,34 @@ +defword keygen + ; Increment + 0 + do + over over = until + dup 2 + get + dup ff < if + 1 + over 2 + set + drop + exit + fi + drop 0 over 2 + set + 1 + + od + drop + + ; Clean old stack data + dup + do + dup 0 = until + 1 get 2 set swap drop + 1 - + od + drop + + 1 + + 0 + do + over over = until + dup 2 get 1 set 0 2 set + 1 + + od + drop +exit diff --git a/test.sts b/test.sts deleted file mode 100644 index 2d234e3..0000000 --- a/test.sts +++ /dev/null @@ -1,10 +0,0 @@ -module ia32/elf/begin.sts -module ia32/float/float.sts -module bifreq.sts - -set_entry - bifreq_eng - 300 print_stack -sys_exit - -module ia32/elf/end.sts -- cgit v1.2.3