multisection.asm 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. ;Testname=aout; Arguments=-faout -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  2. ;Testname=aoutb; Arguments=-faoutb -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  3. ;Testname=as86; Arguments=-fas86 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  4. ;Testname=elf32; Arguments=-felf32 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  5. ;Testname=elf64; Arguments=-felf64 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  6. ;Testname=obj; Arguments=-fobj -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  7. ;Testname=rdf; Arguments=-frdf -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  8. ;Testname=win32; Arguments=-fwin32 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  9. ;Testname=win64; Arguments=-fwin64 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
  10. ; To test where code that is placed before any explicit SECTION
  11. ; gets placed, and what happens if a .text section has an ORG
  12. ;statement, uncomment the following lines.
  13. ;
  14. ; times 10h nop
  15. ;
  16. ;section .text
  17. ;org 0x300
  18. ; times 20h inc ax
  19. ; let's see which of these sections can be placed in the specified order.
  20. section .appspecific
  21. section .data
  22. section .stringdata
  23. section .mytext
  24. section .code
  25. section .extra_code
  26. section .stringdata
  27. mystr1: db "Hello, this is string 1", 13, 10, '$'
  28. section .extra_code
  29. org 0x200
  30. bits 16
  31. more:
  32. mov si, asciz1
  33. mov ah, 0x0E
  34. xor bx, bx
  35. .print:
  36. lodsb
  37. test al, al
  38. jz .end
  39. int 0x10
  40. jmp short .print
  41. .end:
  42. xor ax, ax
  43. int 0x16
  44. mov ax, 0x4c00
  45. int 0x21
  46. section .appspecific
  47. asciz1: db "This is string 2", 0
  48. section .code
  49. org 0x100
  50. bits 16
  51. start:
  52. mov dx, mystr1
  53. mov ah, 9
  54. int 0x21
  55. xor ax, ax
  56. int 0x16
  57. jmp more
  58. section .text
  59. xor eax,eax
  60. times 50h nop
  61. section .mytext
  62. xor ebx,ebx
  63. section .data
  64. db 95h,95h,95h,95h,95h,95h,95h,95h
  65. section .hmm
  66. resd 2
  67. section .bss
  68. resd 8
  69. section .final1
  70. inc ax
  71. section .final2
  72. inc bx
  73. section .final3
  74. inc cx