-5

I want the exact binary opcodes executable to CPU directly.

 [BITS 16]      ; 16 bit code generation
[ORG 0x7C00]   ; Origin location

; Main program
main:       ; Label for the start of the main program

 mov ax,0x0000  ; Setup the Data Segment register
        ; Location of data is DS:Offset
 mov ds,ax  ; This can not be loaded directly it has to be in two steps.
        ; 'mov ds, 0x0000' will NOT work due to limitations on the CPU

 mov si, HelloWorld ; Load the string into position for the procedure.
 call PutStr    ; Call/start the procedure

jmp $       ; Never ending loop

; Procedures
PutStr:     ; Procedure label/start
 ; Set up the registers for the interrupt call
 mov ah,0x0E    ; The function to display a chacter (teletype)
 mov bh,0x00    ; Page number
 mov bl,0x07    ; Normal text attribute

.nextchar   ; Internal label (needed to loop round for the next character)
 lodsb      ; I think of this as LOaD String Block 
        ; (Not sure if thats the real meaning though)
        ; Loads [SI] into AL and increases SI by one
 ; Check for end of string '0' 
 or al,al   ; Sets the zero flag if al = 0 
        ; (OR outputs 0's where there is a zero bit in the register)
 jz .return ; If the zero flag has been set go to the end of the procedure.
        ; Zero flag gets set when an instruction returns 0 as the answer.
 int 0x10   ; Run the BIOS video interrupt 
 jmp .nextchar  ; Loop back round tothe top
.return     ; Label at the end to jump to when complete
 ret        ; Return to main program

; Data

HelloWorld db 'Hello World',13,10,0

; End Matter
times 510-($-$$) db 0   ; Fill the rest with zeros
dw 0xAA55       ; Boot loader signature

opcodes for x86 Intel Architecture; must be 16-bit opcodes ONLY.

4
  • 1
    What's wrong with using an assembler? – NirIzr Jun 8 '13 at 19:37
  • What are you talking about? Define "binary opcode" precisely. – Rolf Rolles Jun 8 '13 at 19:41
  • 1
    Can you, please, explain us why you cannot use an assembler and a disassembler to get back the opcodes? Really, I cannot understand what's the point of the question. – joxeankoret Jun 8 '13 at 20:41
  • This site is to ask about principles of Reverse Engineering, but we are not here perform work solicited in this manner. Sorry about the confusion, but I have to close this as off topic. – Robert Cartaino Jun 9 '13 at 1:39
1
C:\>debug
-a
1448:0100 mov ax,0
1448:0103
-u 100 102
1448:0100 B80000        MOV     AX,0000
-q

C:>echo opcode for mov ax,0000 is b80000 and so on

**opcode for mov ax,0000 is b80000 and so on**

C:>

@till

tool Debug.exe
method assembled and disassembled the mnemonic

@nomik ollydbg will not output 16 bit opcodes since it is 32bit debugger you wold need a 16 bit application that assembles and disassembles the mnemonic to output 16 bit opcodes like Debug.Exe(inbox),Td.exe(ex borland),grdb.exe(ladSoft),trw2000.exe (google site:tuts4you) etc

1
  • Even though this would also match what I made out of this question, providing some more details on what you were doing, which tool you were using etc. could improve this answer a lot. – Till Jun 9 '13 at 0:10
1

An easy way, is to use OllyDbg to write the assembly instructions you want by editing an executable being debugged.The opcodes are shown between the address and the assembly instructions.

I hope i understood the (god make it a) question (better called 'request').

Not the answer you're looking for? Browse other questions tagged or ask your own question.