0

Hello, fellow programmers!
I have a stupid (for your lvl) question:
Using "flat assembler" and debugging it using "ollydbg (v2.00.01)"

I have a following code:

format PE

org    100h

start:
       mov eax, 0    ; clear entire register
       mov edx, 0    ; clear entire register
       
       mov ah,  02h  ; define control character 
       mov dl,  'A'  ; character it needs to print to "standart output" (?)
       int      21h  ; interruption service call
       
       hlt

So, with the code above I have 2 problems:

  1. OllyDbg says "Access violation when reading [FFFFFFFF]" when it comes to the line with interruption service call.
  2. I rewrote the code above using mov ah, 05h control character. Still got an error from 1st item.

It would be kind of you to help me solve this two requirements:

  1. Understanding the difference between the "standart output" and "default printer".
  2. Writing a single character to console(?) without using ds register (and any previously defined data).

My greatest thanks to everyone, who reply!

Solved by...
As it comes out, you cannot use direct call of DOS services from Win32 executable.

fuz
  • 88,405
  • 25
  • 200
  • 352
Futman
  • 3
  • 3
  • 5
    Are you sure this is running as a DOS program in NTVDM? From the looks of your program (`format PE`) it appears that you assemble this into a Win32 executable. From such an executable, it is not possible to invoke DOS services. – fuz Feb 27 '21 at 22:24
  • @fuz , ahh, I see. Thank you! I'll try to find info about Win32's services. (Think it'll help) – Futman Feb 27 '21 at 22:28
  • Don't edit an answer into your question. If you want to answer your question, post an answer instead. And since you didn't do so already, now would be a good time to take the [tour]. – IInspectable Feb 28 '21 at 14:27

0 Answers0