Jump to content

  • Log In with Google      Sign In   
  • Create Account

Assembler Causes Crashes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 DoomAddict   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 September 1999 - 02:08 PM

I am having this problem with assembler code. I am following an assembler tutorial from http://skyscraper.fortunecity.com/compiler/379/assemble.html, and my computer keeps locking up(the computer does not actually lock up, but the screen goes black, and stays that way), when trying to display a white pixel at (100,100) under 320 X 200 X 256. I know that this probably is not the place where to post this, but it's the only place that I can think of.
I am using VisualC++6, and this is the code:

int main()
{
__asm {
MOV AH, 0
MOV AX, 19
INT 10h

MOV AH, Ch
MOV CX, 100
MOV DX, 100
MOV AL, 15
INT 10h

MOV AH, 0
MOV AX, 3
INT 10h

}

return 0;
}

Any ideas about what's happening?
Thanx

------------------
DoomAddict
WHAT CAN I SAY, DOOM STARTED IT!!!!
:o


Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 19 September 1999 - 05:35 PM

Yup thats a really big problem you should punch the computer several times in rapid succession in order to get the thing to work. If it does not work, punch the monitor several times in rapid sucession. It that still doesnt work, send it all back to the computer sotre to get it repaired from the punching and popefully by then it should work.

FAGary http://fagary.cjb.net


#3 Queasy   Members   -  Reputation: 157

Like
Likes
Like

Posted 19 September 1999 - 06:06 PM

what type of app are you buliding? if you are building a win32-type (even if it's console style) app then it most likely won't work at all since windows won't let you call 'em interrupts.

however, if you compile as some sort of dos executable, then it should work fine (provided your interrupt calls are correct [i didn't check those.... i assume they're right ])

hope that helps!

~Queasy.


#4 bosjoh   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 September 1999 - 06:50 PM

Hey! I wrote that article.
Now here is the problem:
In win32 or DPMI applications you can't call real-mode interrupts.

Try searching in the helpfile for something like int86x or dpmi_int.
Or use an MS-DOS realmode compiler.


#5 bit   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 September 1999 - 06:53 PM

Queasy is on the right track. Except ... VC6 does not do DOS apps at all. You will need to get an older compiler, or go grab a free one.

No Interrupts in Win32. There are some minor exceptions ... but that is way beyond what you are trying to do.

My advice ... if you want to program for Windows ... follow my article series here on GameDev. Part 2 should be up in a few days. However, if you still want to do DOS go get the A86 assembler (freeware), or find an old version of MASM or even TASM.

- Chris


#6 Queasy   Members   -  Reputation: 157

Like
Likes
Like

Posted 19 September 1999 - 06:56 PM

You're kidding???

VC6 does NOT do dos apps??? WHAT!?

So is it strictly a win32 compiler? It does nt right?

//i use wc11.0 which compiles for many platforms...


#7 bit   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 September 1999 - 07:11 PM

I kid about many things ... this is not one of them.

- Chris


#8 FlyFire   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 September 1999 - 09:13 PM

Good work, Queasy, i'm using Watcom too
my watcom stuff: http://codexorg.webjump.com

------------------
FlyFire/CodeX
http://codexorg.webjump.com


#9 DoomAddict   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 September 1999 - 07:13 AM

Thaks a lot for all your help, I think I figured it out though. First VC6 on my computer can only make Win 32 progs, I think there are addons that can make it make pure dos progs, somewhere on the microsoft website. I was looking through the help file, and I could not find those registers anywhere. What has happened I think, is that they changed the registers to work with Win 32. With all due respect to the person who wrote the assembler tutorial, I think it is a little outdated. From what I can make of it, the new registers are the same as the old ones except with an E in front of them EAX, EAH and so on...

Thanx for all of your help


#10 bosjoh   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 September 1999 - 08:17 AM

I've just started DPMI programming (already quite experienced), that's because it's so outdated.

I will update my article then.


#11 foofightr   Members   -  Reputation: 130

Like
Likes
Like

Posted 20 September 1999 - 09:05 AM

bosjoh, you mention you can't call realmode interrupts in DPMI applications. does this mean that the extender handles interrupts transparently to the application? even if you use a software interrupt called via asm file?

it's because i'm having problems with a 32bit dos app, when calling an interrupt to set the video mode (vbe 2.0). my instinct tells me it's a segment register assumed wrongly or something, which causes the interrupt to execute garbage code and soon after, crash.

the weird thing is, sometimes it works, sometimes it doesn't (a successful compile & link produces and executable that always works or always crashes). i've traced the crash to "int 10h" in the function that sets the video mode. and yes, the video mode is valid at the point where the interrupt is called. as i said, my instinct says it's wrongly assumed segment registers (since the interrupt executes in v86 mode, it relies on CS, DS, SS and stuff...) but how the hell do you fix this? (or even detect it)

i can send the source files if someone thinks they might know the solution or wants to investigate further (at this point, it's all or nothing, so i don't care if some of these files have code that i otherwise wouldn't give out). the compiler is watcom v11.0 and the assembler is TASM 4.1 (could just use WASM if you want). one file, vgovbe20.asm is not written by me (and it contains the mode setting code and crash, go figure)

(crash on line 593 of vgovbe20.asm)


#12 Queasy   Members   -  Reputation: 157

Like
Likes
Like

Posted 20 September 1999 - 10:12 AM

I think there is a 'simulate real-mode call' function for dpmi.
[oops forgot to tell you the interrupt! 0x31 is the int]

ax=0x300
bl=interrupt number you want to call
cx=words to copy from pm stack to rm stack... so i guess you pass params that way.
es:edi -> is the call structure with all your params...
byte desc
===========
0x0 edi
0x4 esi
ox8 ebp
oxc reserved
ox10 ebx
ox14 edx
.. ecx
.. eax
0x20 flags
0x22 es
0x24 ds
0x26 fs
ox28 gs
ox2a ip
ox2c cs
ox2e sp
ox30 ss

after you call.. .this struct will be filled with return values too.

*I THINK* so i may be (might be, mostly likely am?) wrong

[This message has been edited by Queasy (edited September 20, 1999).]


#13 bosjoh   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 September 1999 - 08:57 PM

To make things clear:
You can't call real-mode interrupts directly with DPMI. But there is a 'simulate real mode interrupt' function (search the compiler's help file).

Using registers in DPMI is also different.
ax, bx, cx and dx becomes eax, ebx, ecx and edx.
These are 32 bit instead of 16 bit.

The memory mode is flat so realmode programmers: forget about the segment offset.

You can't write for example directly to adres 0xA0000 (0xA000:0=0xA0000). You must first map the memory and add the segment base offset.

Hope this will help out all DPMI programmers.

Foofightr: I've sent an E-mail to you.

[This message has been edited by bosjoh (edited September 21, 1999).]

[This message has been edited by bosjoh (edited September 21, 1999).]


#14 foofightr   Members   -  Reputation: 130

Like
Likes
Like

Posted 21 September 1999 - 02:08 PM

Here is the file containing all the source of the program in question:

Mapedit ... hmm, click this link, it will tell you page not available. enter the same url again and it'll work.

for watcom 11. buildmap.bat is for building the release version, and debugmap.bat to build the debug version.

FYI on my computer, it crashes on line 593 of vgovbe20.asm (not written by me!)

thanks for any help (i still say it's a problem with segment registers for when it executes realmode code for the INT 10H)

[This message has been edited by foofightr (edited September 21, 1999).]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS