.COM executable

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Ycep
Member
Member
Posts: 401
Joined: Mon Dec 28, 2015 11:11 am

Re: .COM executable

Post by Ycep »

I'm 100% sure I'm not running in user mode.
Starting to get headache from this...
Whoops, sorry, I'm telling you wrong:
This works

Code: Select all

CLI
HLT
This works too:

Code: Select all

x:
nop
jmp x
But this does not (releases GPF):

Code: Select all

lea ebx, [str1]
mov eax, 2
int 0x5F
ret
str1: db "This is a test.",0x00
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: .COM executable

Post by Kevin »

Then I guess you don't have a valid handler for interrupt 0x5f.
Developer of tyndur - community OS of Lowlevel (German)
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: .COM executable

Post by SpyderTL »

Try removing this line first:

Code: Select all

lea ebx, [str1]
Then try replacing that line, and removing this line:

Code: Select all

int 0x5F
Then try replacing the "ret" at the end with a x: jmp x line like your other code.

These are the only three lines that could possibly cause a GPF. (I believe)

This should tell you which of these three lines is causing the problem, and give you a hint how to fix it.

My guess is that the code is not being loaded to the memory location that you think it is, or this code is being jumped to instead of called, meaning your "ret" instruction is returning to "nowhere".
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
Ycep
Member
Member
Posts: 401
Joined: Mon Dec 28, 2015 11:11 am

Re: .COM executable

Post by Ycep »

Hurray! I fixed it! It works!
Thanks to everybody who helped me.

The problem was in my system calls interrupt. It's fixed now! :D
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Re: .COM executable

Post by trolly »

you need to do relocation, or write a Position independent code in the com executable
Post Reply