From dff0fe8be3a21903de0b3fdee738fa824ac16bdb Mon Sep 17 00:00:00 2001 From: Peter Gerwinski <peter.gerwinski@hs-bochum.de> Date: Tue, 25 May 2021 12:03:38 +0200 Subject: [PATCH] Beispiele 25.5.2021 --- 20210525/dwarf2.red | 17 +++++++++++++++++ 20210525/dwarf3.red | 17 +++++++++++++++++ 20210525/mice-jump.red | 13 +++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 20210525/dwarf2.red create mode 100644 20210525/dwarf3.red create mode 100644 20210525/mice-jump.red diff --git a/20210525/dwarf2.red b/20210525/dwarf2.red new file mode 100644 index 0000000..a8b92b9 --- /dev/null +++ b/20210525/dwarf2.red @@ -0,0 +1,17 @@ +;redcode +;name Dwarf +;author A. K. Dewdney, P. Gerwinski +;strategy Throw DAT bombs around memory, hitting every 4th memory cell. +;strategy This program was presented in the first Corewar article. + +; Variante, die bessere Chancen gegen Knirps hat + +bomb DAT #1 + DAT #0 ; Knirps-Falle +dwarf ADD #4, bomb + MOV bomb, @bomb + JMP dwarf + END dwarf ; Programs start at the first line unless + ; an "END start" pseudo-op appears to indicate + ; the first logical instruction. Also, nothing + ; after the END instruction will be assembled. diff --git a/20210525/dwarf3.red b/20210525/dwarf3.red new file mode 100644 index 0000000..f73203c --- /dev/null +++ b/20210525/dwarf3.red @@ -0,0 +1,17 @@ +;redcode +;name Dwarf +;author A. K. Dewdney, P. Gerwinski +;strategy Throw DAT bombs around memory, hitting every 4th memory cell. +;strategy This program was presented in the first Corewar article. + +; Variante, die noch bessere Chancen gegen Knirps hat ... oder auch nicht ... ?!? + +bomb DAT #1 + DAT #0 ; Knirps-Falle +dwarf ADD #5, bomb + MOV bomb, <bomb + JMP dwarf + END dwarf ; Programs start at the first line unless + ; an "END start" pseudo-op appears to indicate + ; the first logical instruction. Also, nothing + ; after the END instruction will be assembled. diff --git a/20210525/mice-jump.red b/20210525/mice-jump.red new file mode 100644 index 0000000..cf87490 --- /dev/null +++ b/20210525/mice-jump.red @@ -0,0 +1,13 @@ +;name Mice +;author Chip Wendell, P. Gerwinski +;assert 1 + +ptr dat #0 +start mov #12, ptr ; n = 12 +loop mov @ptr, <dest ; *dest = *(ptr+(*ptr)) + djn loop, ptr ; if(--ptr != 0) + ; goto loop + jmp @dest ; jump(*dest) +dest dat #833 + + end start -- GitLab