Shortened URL:

  1. LICENSE - (CC0) Creative Commons Zero:
  2. http://creativecommons.org/publicdomain/zero/1.0/
  3.  
  4. To the extent possible under law the author has waived all copyright and
  5. related or neighboring rights to the Hexabootable program.
  6.  
  7. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13. THE SOFTWARE.
  14.  
  15. ________________________________________________________________________
  16.  
  17. ljmp   $0x7c0,$0x5
  18. mov    %cs,%ax
  19. mov    %ax,%ds
  20. mov    %ax,%es
  21. xor    %di,%di
  22. cld    
  23. mov    $0x1000,%sp
  24. add    $0x120,%ax
  25. mov    %ax,%ss
  26. mov    $0x3,%ax
  27. int    $0x10
  28. xor    %dx,%dx
  29. mov    $0x2,%ah
  30. mov    $0x0,%bh
  31. int    $0x10
  32. push   %di
  33. push   %es
  34. mov    $0x19,%cx
  35. mov    $0xe,%ah
  36. jmp    0x35
  37. mov    $0xe0d,%ax
  38. int    $0x10
  39. mov    $0xa,%al
  40. int    $0x10
  41. mov    $0x20,%al
  42. int    $0x10
  43. pusha  
  44. push   %ds
  45. mov    %es,%bx
  46. mov    %di,%dx
  47. mov    $0x2,%cx
  48. jmp    0x48
  49. mov    $0x3a,%al
  50. int    $0x10
  51. mov    %bh,%al
  52. call   0x1dc
  53. mov    %bl,%al
  54. call   0x1dc
  55. xchg   %dx,%bx
  56. loop   0x44
  57. call   0x1be
  58. mov    %bx,%ds
  59. mov    %dx,%si
  60. mov    $0x10,%cx
  61. jmp    0x66
  62. mov    $0x20,%al
  63. int    $0x10
  64. lods   %ds:(%si),%al
  65. call   0x1dc
  66. loop   0x62
  67. call   0x1be
  68. mov    %bx,%ds
  69. mov    %dx,%si
  70. mov    $0x10,%cx
  71. lods   %ds:(%si),%al
  72. cmp    $0x20,%al
  73. jae    0x7d
  74. mov    $0xfa,%al
  75. int    $0x10
  76. loop   0x76
  77. pop    %ds
  78. popa  
  79. mov    $0x10,%ax
  80. call   0x1cb
  81. loop   0x2c
  82. pop    %es
  83. pop    %di
  84. mov    0x1fb,%dx
  85. push   %dx
  86. and    $0xf,%dl
  87. mov    0x1fd,%bl
  88. cmp    $0x0,%bl
  89. je     0xb0
  90. mov    $0x3,%al
  91. mul    %dl
  92. mov    $0xd,%dl
  93. cmp    $0xf,%bl
  94. je     0xac
  95. add    $0x1,%dl
  96. add    %al,%dl
  97. jmp    0xb5
  98. add    $0x3f,%dl
  99. mov    $0xf0,%cl
  100. pop    %ax
  101. shr    $0x4,%ax
  102. mov    %al,%dh
  103. pusha  
  104. mov    $0x2,%ah
  105. mov    $0x0,%bh
  106. int    $0x10
  107. popa  
  108. call   0xc9
  109. jmp    0x1b
  110. mov    $0x0,%ah
  111. int    $0x16
  112. cmp    $0x9,%al
  113. jne    0xd6
  114. mov    %cl,0x1fd
  115. ret    
  116. cmp    $0x1b,%al
  117. jne    0xef
  118. mov    $0x0,%cl
  119. push   %di
  120. add    0x1fb,%di
  121. mov    %es:(%di),%dx
  122. cmp    $0x0,%cl
  123. ja     0x179
  124. pop    %di
  125. mov    %dx,%es
  126. ret    
  127. mov    0x1fb,%dx
  128. cmp    $0x49,%ah
  129. je     0x1a9
  130. cmp    $0x51,%ah
  131. jne    0x106
  132. mov    $0x180,%ax
  133. call   0x1cb
  134. ret    
  135. cmp    $0x47,%ah
  136. jne    0x10f
  137. mov    $0x0,%di
  138. ret    
  139. cmp    $0x4f,%ah
  140. jne    0x118
  141. mov    $0xfe70,%di
  142. ret    
  143. cmp    $0x8,%al
  144. je     0x11f
  145. cmp    $0x4b,%ah
  146. je     0x19d
  147. cmp    $0x4d,%ah
  148. je     0x189
  149. cmp    $0x48,%ah
  150. jne    0x13b
  151. cmp    $0xf,%dx
  152. jg     0x135
  153. mov    $0x10,%ax
  154. jmp    0x1ac
  155. subw   $0x10,0x1fb
  156. ret    
  157. cmp    $0x50,%ah
  158. jne    0x153
  159. cmp    $0x180,%dx
  160. jl     0x14d
  161. mov    $0x10,%ax
  162. call   0x1cb
  163. ret    
  164. addw   $0x10,0x1fb
  165. ret    
  166. cmp    $0x42,%ah
  167. jne    0x15f
  168. add    0x1fb,%di
  169. push   %es
  170. push   %di
  171. lret  
  172. cmp    $0x0,%cl
  173. jne    0xdc
  174. clc    
  175. sub    $0x30,%al
  176. jae    0x16c
  177. ret    
  178. cmp    $0x10,%al
  179. jl     0x174
  180. and    $0xf,%al
  181. add    $0x9,%al
  182. mov    $0x1,%cl
  183. jmp    0xdc
  184. cmp    $0xf,%bl
  185. ja     0x183
  186. jb     0x187
  187. shl    $0x4,%al
  188. and    %bl,%dl
  189. or     %dl,%al
  190. stos   %al,%es:(%di)
  191. pop    %di
  192. cmp    $0xf,%bl
  193. je     0x193
  194. addw   $0x1,0x1fb
  195. cmp    $0x0,%cl
  196. jl     0x19c
  197. notb   0x1fd
  198. ret    
  199. cmp    $0xf0,%bl
  200. je     0x193
  201. subw   $0x1,0x1fb
  202. jmp    0x193
  203. mov    $0x180,%ax
  204. clc    
  205. sub    %ax,%di
  206. jb     0x1b2
  207. ret    
  208. mov    %es,%ax
  209. sub    $0x100,%ax
  210. mov    %ax,%es
  211. add    $0x1000,%di
  212. ret    
  213. mov    $0x20,%al
  214. int    $0x10
  215. mov    $0xb3,%al
  216. int    $0x10
  217. mov    $0x20,%al
  218. int    $0x10
  219. ret    
  220. clc    
  221. add    %ax,%di
  222. jae    0x1db
  223. mov    %es,%ax
  224. add    $0x100,%ax
  225. mov    %ax,%es
  226. sub    $0x1000,%di
  227. ret    
  228. pusha  
  229. mov    %al,%bl
  230. mov    $0x2,%cx
  231. mov    $0xe,%ah
  232. shr    $0x4,%al
  233. jmp    0x1ed
  234. mov    %bl,%al
  235. and    $0xf,%al
  236. add    $0x30,%al
  237. cmp    $0x39,%al
  238. jle    0x1f5
  239. add    $0x7,%al
  240. int    $0x10
  241. loop   0x1e9
  242. popa  
  243. ret    
  244. .byte 0x00
  245. .byte 0x00
  246. .byte 0x0f
  247. .byte 0x55
  248. .byte 0xaa
  249.  
  250. ________________________________________________________________________
  251.  
  252. USAGE
  253.  
  254.   To compile this program save the above text as hexboot.s then:
  255.     gcc -c -o hexboot.o hexboot.s
  256.     ld -Ttext 0 --oformat binary -o hexboot.img hexboot.o
  257.  
  258.   To run this program write the image to the MBR of a disk and boot it.
  259.   The boot image can be executed via x86 virtual machines as a RAW disk.
  260.  
  261.   The following command can be used to write the boot image to a disk:
  262.     dd if=hexboot.img of=/dev/sda
  263.   Substitute /dev/sda with the desired hard/floppy/flash drive.
  264.  
  265.   However, the above will destroy any existing partition tables. It may
  266.   be preferable to use another bootloader (like GRUB) to create a multi-
  267.   boot setup.  The Hexabootable image can then be copied to the first
  268.   sector of a partition instead of the master boot record of the drive
  269.   in order to preserve the partition tables.
  270.  
  271.   See your boot loader manual for multi-boot configuration options.
  272.  
  273. ________________________________________________________________________
  274.  
  275. WARNING
  276.  
  277.   This software is ammunition for foot snipers.  You will be editing the
  278.   system's memory matrix directly, in real time, as it is running. It is
  279.   strongly suggested that you first use an artificial construct such as a
  280.   Virtual Machine to familiarize yourself with using Hexabootable.
  281.  
  282.   If you edit a program as it is running a hung CPU is the most likely,
  283.   but not the worst thing that can happen by far;  Editing a working
  284.   stack is just as dangerous.  Your firmware and/or hardware could be
  285.   seriously damaged if you are not very careful in there...
  286.  
  287.   The first page that appears (address 07C0:0000) contains the editor
  288.   program that is displaying the text.  You may be able to see memory
  289.   changing as you scroll near the end of the program.  Try not to tamper
  290.   with live machine code unless you're ready to face the consequences.
  291.  
  292.   See the Memory Map for your system for regions to watch out for.
  293.  
  294. ________________________________________________________________________
  295.  
  296. KEYBOARD CONTROLS
  297.  
  298.   [0] [1] [2] [3]  These replace the nybble under the cursor with the
  299.   [4] [5] [6] [7]  corresponding hexadecimal digit.  Note: Other keys
  300.   [8] [9] [A] [B]  also produce values; Their behavior is undefined.
  301.   [C] [D] [E] [F]  Half a byte is written at a time. This could lead to
  302.                    incomplete instructions being executed if editing
  303.                    code while it is running.
  304.  
  305.             [Tab]  Switch between Hex and Text edit modes. While in text
  306.                    keys other than those listed below store their ASCII
  307.                    codes at the current cursor location.
  308.  
  309.   [Up]     [Down]  The arrow keys move the cursor.  Moving off the left
  310.   [Left]  [Right]  or right wraps around to the previous or next line.
  311.                    Moving beyond the top or bottom scrolls the display.
  312.  
  313.      [Back Space]  Moves the cursor left.  Alias for [Left] arrow key.
  314.  
  315.         [Page Up]  These change the displayed address by 384 bytes at a
  316.       [Page Down]  time.  Be careful not to exceed system memory bounds.
  317.  
  318.            [Home]  Navigate to the beginning of the segment.  This sets
  319.                    the first byte displayed to offset zero.
  320.  
  321.             [End]  Navigate to the end of the segment.  This sets the
  322.                    last byte displayed to offset 0xFFFFF.
  323.  
  324.          [Escape]  Jump to the 16 bit segment address under the cursor.
  325.                    Eg: Pressing [Esc] while positioned on CO in: _C0_ 07
  326.                    will change the segment address to 07C0.  To Jump to
  327.                    any segment: Enter the desired address in unused
  328.                    memory (in LSB), then use the [Escape] key on it.
  329.  
  330.                    It may be helpful to keep your available Exits listed
  331.                    in a common location for faster escapes.
  332.  
  333.  
  334.              [F8]  Execute code at the cursor; Use with extreme caution.
  335.                    To resume the hex editor execute the following jump:
  336.                      _EA_ 00  00  C0  07
  337.  
  338.   Note:
  339.     When scrolling or paging across a segment boundary, Hexabootable
  340.     adjusts the segment:offset address to remain visibly consistent.
  341.     However, segment addresses will overflow near memory boundaries.
  342.  
  343. ________________________________________________________________________
  344.  
  345. BASE 64 ENCODED BINARY
  346.  
  347.   For your convenience I've provided the compiled image in Base64:
  348.  
  349. 6gUAwAeMyI7YjsAx//y8ABAFIAGO0LgDAM0QMdK0ArcAzRBXBrkZALQO6wm4DQ7NELAKzRCwIM0Q
  350. YB6Mw4n6uQIA6wSwOs0QiPjojwGI2OiKAYfT4u7oZQGO24nWuRAA6wSwIM0QrOhyAeL26E8BjtuJ
  351. 1rkQAKw8IHMCsPrNEOL1H2G4EADoQgHioQdfixb7AVKA4g+KHv0BgPsAdBKwA/bisg2A+w90A4DC
  352. AQDC6wWAwj+x8FjB6ASIxmC0ArcAzRBh6AMA6VL/tADNFjwJdQWIDv0BwzwbdRWxAFcDPvsBJosV
  353. gPkAD4eOAF+OwsOLFvsBgPxJD4SvAID8UXUHuIAB6MYAw4D8R3UEvwAAw4D8T3UEv3D+wzwIdAOA
  354. /Et0fID8TXRjgPxIdRCD+g9/BbgQAOt3gy77ARDDgPxQdROB+oABfAe4EADofwDDgwb7ARDDgPxC
  355. dQcDPvsBBlfLgPkAD4V2//gsMHMBwzwQfAQkDwQJsQHpY/+A+w93BXIHwOAEINoI0KpfgPsPdAWD
  356. BvsBAYD5AHwE9hb9AcOA+/B08YMu+wEB6+q4gAH4KcdyAcOMwC0AAY7AgccAEMOwIM0QsLPNELAg
  357. zRDD+AHHcwuMwAUAAY7Age8AEMNgiMO5AgC0DsDoBOsEiNgkDwQwPDl+AgQHzRDi8GHDAAAPVao=
  358.  
  359.   Save the above b64 blob as hexboot.b64 then:
  360.     base64 -d hexboot.b64 > hexboot.img
  361.  
  362.   Happy Hacking!

Posted by Lain at 18 Aug 2015, 11:10:53 UTC
Language: text


Powered by Sticky Notes. Using Fedora skin.
"Sticky Notes" (the web application) is released under the BSD license, Copyright © 2012 Sayak Banerjee.

"Fedora" and the Fedora logo are trademarks of Red Hat, Inc. The Fedora project is maintained and driven by the community. This is a community maintained site. Red Hat is not responsible for content.

Sponsors | Legal | Trademark Guidelines