elf32-0hello-mes.hex2 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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-0hello-mes.hex2: `Hello, GNU Mes!' for i686-linux written in
  20. # hex2 assembly, for usage with elf32-0header.hex2. This produces a
  21. # 160-byte binary (a0 hex). Inspiration was taken from GNU Gcc output
  22. # of hello-mes.S.
  23. ### Code:
  24. # @60
  25. :ELF_text
  26. # print <hello>
  27. b8 04 00 00 00 # mov $4,%eax
  28. bb 00 00 00 00 # mov $1,%ebx
  29. b9 &hello # mov $hello,%ecx
  30. ba %bye>hello # mov $(bye-hello),%edx
  31. cd 80 # int $0x80
  32. # exit 0
  33. b8 01 00 00 00 # mov $1,%eax
  34. bb 00 00 00 00 # mov $0,%ebx
  35. cd 80 # int $0x80
  36. f4 # hlt
  37. 00 00 00 00 00 00 00 00 00 00 # align to @90
  38. 00 00 00
  39. # @90
  40. :ELF_data
  41. :hello
  42. 48 65 6c 6c 6f 2c 20 47 # Hello, G
  43. 4e 55 20 4d 65 73 21 0a # NU Mes!\n
  44. :bye
  45. :ELF_end