* lib/x86_64-mes-gcc/exit-42.S: New file.
* lib/x86_64-mes-gcc/hello-mes.S: New file.
* lib/x86_64-mes/elf64-0exit-42.hex2: New file.
* lib/x86_64-mes/elf64-0hello-mes.hex2: New file.
* lib/x86_64-mes/elf64-body-exit-42.hex2: Rewrite..
* lib/x86_64-mes/elf64-body-hello-mes.hex2:
* lib/x86_64-mes/elf64-0header.hex2: Fix copyright header.
* lib/x86_64-mes/elf64-header.hex2: Likewise.
* lib/x86_64-mes/elf-0footer.hex2: Remove.
--- /dev/null
+/*
+ * GNU Mes --- Maxwell Equations of Software
+ * Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ *
+ * This file is part of GNU Mes.
+ *
+ * GNU Mes is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * GNU Mes is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** Commentary: */
+
+/* Using gdb, esp. GUD in GNU Emacs is recommended
+M-x gdb-display-disassembly-buffer
+M-x gdb-display-io-buffer
+set disassemble-next-line on
+break _start
+run
+info registers
+si
+p/x $rax
+RET
+...
+*/
+
+/** Code: */
+
+SYS_exit = 0x3c /* Linux syscall: exit. */
+ .globl _start /* Magic linker symbol: --entry-address. */
+
+ .text /* Program text. */
+_start:
+ movabs $SYS_exit,%rax /* System call function: exit, in %rax. */
+ movabs $42,%rdi /* First parameter: exit status, in %rdi. */
+ syscall /* Call system. */
+ hlt /* Should not be reached. */
--- /dev/null
+/*
+ * GNU Mes --- Maxwell Equations of Software
+ * Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ *
+ * This file is part of GNU Mes.
+ *
+ * GNU Mes is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * GNU Mes is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** Commentary: */
+
+/* Using gdb, esp. GUD in GNU Emacs is recommended
+M-x gdb-display-disassembly-buffer
+M-x gdb-display-io-buffer
+set disassemble-next-line on
+break _start
+run
+info registers
+si
+p/x $rax
+RET
+...
+*/
+
+/** Code: */
+
+SYS_exit = 0x3c /* Linux syscalls. */
+SYS_write = 0x01
+stdout = 1 /* File discriptor */
+ .globl _start /* Magic linker symbol: --entry-address. */
+
+ .text /* Program text. */
+_start:
+ movabs $SYS_write,%rax /* System call function: write, in %rax. */
+ movabs $stdout,%rdi /* 1st parameter: file descriptor, in %rdi. */
+ movabs $hello,%rsi /* 2nd parameter: address, in %rsi. */
+ movabs $(bye-hello),%rdx /* 3rd parameter: byte count %rdx. */
+ syscall /* Call system. */
+
+ movabs $SYS_exit,%rax /* System call function: exit, in %rax. */
+ movabs $0,%rdi /* 1st parameter: exit status, in %rdi. */
+ syscall /* Call system. */
+ hlt /* Should not be reached. */
+
+ .data
+hello: .ascii "Hello, GNU Mes!\n"
+bye: .byte 0
+++ /dev/null
-### Copyright (C) 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
-### This file is part of stage0.
-###
-### stage0 is free software: you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation, either version 3 of the License, or
-### (at your option) any later version.
-###
-### stage0 is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with stage0. If not, see <http://www.gnu.org/licenses/>.
-
-### stage0's hex2 format for x86_64
-### !<label> 1 byte relative
-### $<label> 2 byte address
-### @<label> 2 byte relative
-### &<label> 4 byte address
-### %<label> 4 byte relative
-### local_<label> function-local
-### string_<index> string #<index>
-
-:ELF_end
--- /dev/null
+### GNU Mes --- Maxwell Equations of Software
+### Copyright © 2017,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+###
+### This file is part of GNU Mes.
+###
+### GNU Mes is free software; you can redistribute it and/or modify it
+### under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 3 of the License, or (at
+### your option) any later version.
+###
+### GNU Mes is distributed in the hope that it will be useful, but
+### WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+# elf64-exit-42.hex2: `exit 42' for x86_64-linux written in hex2
+# assembly, for usage with elf64-0header.hex2. This produces a 160-byte
+# binary (a0 hex). Inspiration was taken from GNU Gcc output of
+# exit-42.S.
+
+### Code:
+
+# @80
+:ELF_text
+48 b8 3c 00 00 00 00 00 00 00 # movabs $0x3c,%rax
+48 bf 2a 00 00 00 00 00 00 00 # movabs $42,%rdi
+0f 05 # syscall
+f4 # hlt
+
+00 00 00 00 00 00 00 00 00 # align to @a0
+:ELF_end
### Copyright (C) 2016 Jeremiah Orians
-### Copyright (C) 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
-### This file is part of stage0.
+### Copyright (C) 2017,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
###
-### stage0 is free software: you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation, either version 3 of the License, or
-### (at your option) any later version.
+### This file is part of GNU Mes.
###
-### stage0 is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### GNU Mes is free software; you can redistribute it and/or modify it
+### under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 3 of the License, or (at
+### your option) any later version.
+###
+### GNU Mes is distributed in the hope that it will be useful, but
+### WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
-### along with stage0. If not, see <http://www.gnu.org/licenses/>.
+### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+# elf64-0header.hex2: Simplest 64 bit elf header in hex2. Only a text
+# segment, no data segment, no symbol tables.
-### stage0's hex2 format for x86_64
-### !<label> 1 byte relative
-### $<label> 2 byte address
-### @<label> 2 byte relative
-### &<label> 4 byte address
-### %<label> 4 byte relative
-### local_<label> function-local
-### string_<index> string #<index>
+# stage0's hex2 format for x86_64
+# !<label> 1 byte relative
+# $<label> 2 byte address
+# @<label> 2 byte relative
+# &<label> 4 byte address
+# %<label> 4 byte relative
+# local_<label> function-local
+# string_<index> string #<index>
+
+### Code:
:ELF_base
7F 45 4C 46 # e_ident[EI_MAG0-3] ELF's magic number
00 00 # e_shstrndx index of the section names
-# @34
-00 00 00 00
-00 00 00 00
-00 00 00 00
-
# @40
:ELF_program_headers
:ELF_program_header__text
%ELF_end>ELF_base 00 00 00 00 # ph_memsz
01 00 00 00 00 00 00 00 # ph_align
+00 00 00 00 00 00 00 00 # align to @80
+# @80
:ELF_text
--- /dev/null
+### GNU Mes --- Maxwell Equations of Software
+### Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+###
+### This file is part of GNU Mes.
+###
+### GNU Mes is free software; you can redistribute it and/or modify it
+### under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 3 of the License, or (at
+### your option) any later version.
+###
+### GNU Mes is distributed in the hope that it will be useful, but
+### WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+# elf64-hello-mes.hex2: `Hello, GNU Mes!' for x86_64-linux written in
+# hex2 assembly, for usage with elf64-0header.hex2. This produces a
+# 224-byte binary (e0 hex). Inspiration was taken from GNU Gcc output
+# of hello-mes.S.
+
+### Code:
+
+# @80
+:ELF_text
+ # print <hello>
+48 b8 01 00 00 00 00 00 00 00 # movabs $1,%rax
+48 bf 01 00 00 00 00 00 00 00 # movabs $1,%rdi
+48 be &hello 00 00 00 00 # movabs $<hello>,%rsi
+48 ba %bye>hello 00 00 00 00 # mov $(bye-hello),%rdx
+0f 05 # syscall
+
+ # exit 0
+48 b8 3c 00 00 00 00 00 00 00 # movabs $0x3c,%rax
+48 bf 00 00 00 00 00 00 00 00 # movabs $0,%rdi
+0f 05 # syscall
+f4 # hlt
+
+00 00 00 00 00 00 00 00 00 # align to @d0
+00 00 00 00 00 00
+
+# @d0
+:ELF_data
+:hello
+48 65 6c 6c 6f 2c 20 47 # Hello, G
+4e 55 20 4d 65 73 21 0a # NU Mes!\n
+:bye
+:ELF_end
-### Copyright (C) 2017, 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
-### This file is part of stage0.
+### GNU Mes --- Maxwell Equations of Software
+### Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
###
-### stage0 is free software: you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation, either version 3 of the License, or
-### (at your option) any later version.
+### This file is part of GNU Mes.
###
-### stage0 is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### GNU Mes is free software; you can redistribute it and/or modify it
+### under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 3 of the License, or (at
+### your option) any later version.
+###
+### GNU Mes is distributed in the hope that it will be useful, but
+### WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
-### along with stage0. If not, see <http://www.gnu.org/licenses/>.
+### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
-### stage0's hex2 format for x86_64
-### !<label> 1 byte relative
-### $<label> 2 byte address
-### @<label> 2 byte relative
-### &<label> 4 byte address
-### %<label> 4 byte relative
-### local_<label> function-local
-### string_<index> string #<index>
+# elf64-body-exit-42.hex2: `exit 42' for x86_64-linux written in hex2
+# assembly, for usage with generic elf64-header.hex2 and
+# elf64-footer-single-main.hex.
-### elf64-body-exit-42.hex2: 64 bit elf body in hex2 for `exit 42'
+# This ELF binary contains a symbol table, which means that objdump and
+# gdb can be used to inspect and debug.
-# @200
+### Code:
+
+# @300
:ELF_text
:_start
# exit(42)
-e8 %main # callq +11 <main>
+e8 %main # call +11 <main>
00 00 00
00 00 00 00
00 00 00 00
-# @210
+# @310
:main
-48 c7 c7 2a 00 00 00 # mov $42,%rdi
-48 c7 c0 3c 00 00 00 # mov $0x3c,%rax
+48 b8 3c 00 00 00 00 00 00 00 # movabs $0x3c,%rax
+48 bf 2a 00 00 00 00 00 00 00 # movabs $42,%rdi
0f 05 # syscall
+f4 # hlt
-00 00 00 00
+00 00 00 00 00 00 00 00 00 # align to 330
-# @220
+# @330
:ELF_data
65 78 69 74 34 32 20 64 61 74 61 20 68 65 72 65 # exit42 data here"
+00
--- /dev/null
+### GNU Mes --- Maxwell Equations of Software
+### Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+###
+### This file is part of GNU Mes.
+###
+### GNU Mes is free software; you can redistribute it and/or modify it
+### under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 3 of the License, or (at
+### your option) any later version.
+###
+### GNU Mes is distributed in the hope that it will be useful, but
+### WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+# elf64-body-hello-mes.hex2: `Hello, GNU Mes!' for x86_64-linux written
+# in hex2 assembly, for usage with generic elf64-header.hex2 and
+# elf64-footer-single-main.hex.
+
+# This ELF binary contains a symbol table which means that objdump and
+# gdb can be used to inspect and debug.
+
+### Code:
+
+# @300
+:ELF_text
+:_start
+# exit(42)
+e8 %main # call +11 <main>
+00 00 00
+00 00 00 00
+00 00 00 00
+
+# @310
+:main
+ # print <hello>
+48 b8 01 00 00 00 00 00 00 00 # movabs $1,%rax
+48 bf 01 00 00 00 00 00 00 00 # movabs $1,%rdi
+48 be &hello 00 00 00 00 # movabs $<hello>,%rsi
+48 ba %bye>hello 00 00 00 00 # mov $(bye-hello),%rdx
+0f 05 # syscall
+
+ # exit 0
+48 b8 3c 00 00 00 00 00 00 00 # movabs $0x3c,%rax
+48 bf 00 00 00 00 00 00 00 00 # movabs $0,%rdi
+0f 05 # syscall
+f4 # hlt
+
+00 00 00 00 00 00 00 00 00 # align to @360
+00 00 00 00 00 00
+
+# @360
+:ELF_data
+:hello
+48 65 6c 6c 6f 2c 20 47 # Hello, G
+4e 55 20 4d 65 73 21 0a # NU Mes!\n
+:bye
+:ELF_end
### Copyright (C) 2016 Jeremiah Orians
-### Copyright (C) 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
-### This file is part of stage0.
+### Copyright (C) 2017,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
###
-### stage0 is free software: you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation, either version 3 of the License, or
-### (at your option) any later version.
+### This file is part of GNU Mes.
###
-### stage0 is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### GNU Mes is free software; you can redistribute it and/or modify it
+### under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 3 of the License, or (at
+### your option) any later version.
+###
+### GNU Mes is distributed in the hope that it will be useful, but
+### WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
-### along with stage0. If not, see <http://www.gnu.org/licenses/>.
-
-### stage0's hex2 format for x86_64
-### !<label> 1 byte relative
-### $<label> 2 byte address
-### @<label> 2 byte relative
-### &<label> 4 byte address
-### %<label> 4 byte relative
-### local_<label> function-local
-### string_<index> string #<index>
+### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+# elf64-header.hex2: 64 bit elf header in hex2, with text segment, data
+# segment and symbol tables.
+
+# stage0's hex2 format for x86_64
+# !<label> 1 byte relative
+# $<label> 2 byte address
+# @<label> 2 byte relative
+# &<label> 4 byte address
+# %<label> 4 byte relative
+# local_<label> function-local
+# string_<index> string #<index>
+
+### Code:
:ELF_base
7F 45 4c 46 # e_ident[EI_MAG0-3] ELF's magic number