elf32-body-hello-mes.hex2 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ### GNU Mes --- Maxwell Equations of Software
  2. ### Copyright © 2017,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  3. ###
  4. ### This file is part of GNU Mes.
  5. ###
  6. ### GNU Mes is free software; you can redistribute it and/or modify it
  7. ### under the terms of the GNU General Public License as published by
  8. ### the Free Software Foundation; either version 3 of the License, or (at
  9. ### your option) any later version.
  10. ###
  11. ### GNU Mes is distributed in the hope that it will be useful, but
  12. ### WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ### GNU General Public License for more details.
  15. ###
  16. ### You should have received a copy of the GNU General Public License
  17. ### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  18. ### Commentary:
  19. # elf32-body-hello-mes.hex2: `Hello, GNU Mes!' for i686-linux written in
  20. # hex2 assembly, for usage with generic elf32-header.hex2 and
  21. # elf32-footer-single-main.hex.
  22. # This ELF binary contains a symbol table which means that objdump and
  23. # gdb can be used to inspect and debug.
  24. ### Code:
  25. # @200
  26. :ELF_text
  27. :_start
  28. e8 %main # call +11 <main>
  29. 00 00 00
  30. 00 00 00 00
  31. 00 00 00 00
  32. # @210
  33. :main
  34. # print <hello>
  35. b8 04 00 00 00 # mov $4, %eax
  36. bb 00 00 00 00 # mov $1, %ebx
  37. b9 &hello # mov $hello,%ecx
  38. ba %bye>hello # mov $(bye-hello),%edx
  39. cd 80 # int $0x80
  40. # exit 0
  41. b8 01 00 00 00 # mov $0x1,%eax
  42. bb 00 00 00 00 # mov $0,%ebx
  43. cd 80 # int $0x80
  44. f4 # hlt
  45. 00 00 00 00 00 00 00 00 00 00 # align to @240
  46. 00 00 00
  47. # @240
  48. :ELF_data
  49. :hello
  50. 48 65 6c 6c 6f 2c 20 47 # Hello, G
  51. 4e 55 20 4d 65 73 21 0a # NU Mes!\n
  52. :bye
  53. 00