Could be totally wrong, but try making that a __declspec(naked) function
I tried making an alt. cls other than using
system("cls");
so i made this, but it crashes when it is supposed to clear the screen.
[php]
//lets make the asm section live dabid !!
#include <iostream>
using namespace std;
void clearScr()
{
__asm
{
MOV AH,6h
MOV AL,0
MOV BH,7
MOV CH,0
MOV CL,0
MOV DH,24
MOV DL,79
INT 10h
}
}
int main()
{
cout << "Press enter to clear the screen using a BIOS interrupt\n";
cin.get();
/*------------------------------------------------*/
clearScr(); //crashes D:
/*------------------------------------------------*/
return 0;
}[/php]
未来が見えなくて怖いから
未来が見えてしまって悲しいから
目を閉じて優しい思い出に浸ってしまう
Could be totally wrong, but try making that a __declspec(naked) function
Languages: C, C++, x86 ASM, PHP, Lua
therofl (11-01-2010)
Neither, I just tried playing around but I can't get any int 0x10's to work o_O
I've only ever needed int 3 =D
Languages: C, C++, x86 ASM, PHP, Lua
I was able to use int 10 here: https://www.mpgh.net/forum/34-assembl...-assembly.html
But that was all done in assembly and assembling in 16bit wasn't a problem for me. |:
Idk what could be wrong with this. D:
therofl (11-01-2010)
daum /
Could i link a seperate .com and call it with C++?
未来が見えなくて怖いから
未来が見えてしまって悲しいから
目を閉じて優しい思い出に浸ってしまう
therofl (11-01-2010)
Wait isn't this being run in protected mode flat model? Doesn't protected mode have certain issues with certain interrupts. What I am saying could be irrelevant but I'm reading a book that mentioned something of that nature.
What assembler is that syntax for? Also what linker. MAYBE that could be messing with it?
Last edited by hobosrock696; 10-21-2010 at 10:04 PM.
Actually, I've used interrupt 10 in protected mode before. See here: https://www.mpgh.net/forum/34-assembl...-assembly.html
I eventually got it to work, but I didn't use inline assembly ( meaning I didn't use a C/C++ compiler ).
therofl (11-01-2010)
Ah... I miss BA. I don't program assembly so, and if I do it's 32 bit, so I have no idea what's going on.
I only think its curious that some of your numbers are in hex and the rest in decimal. That might be the problem but only a guess...
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
therofl (11-01-2010)
Hey void wait did you solve that last problem in the thread you linked by using the segmented model? I did a char by char program for dos with a certain char meaning next line and i thought i had to use segmented to gain control of the segment registers....
Also change your first two lines of asm to
mov ax, 600H
That will move 6 into ah and 0 into all in one swift move
also yea add the h at the end
MOV CH,0
MOV CL,0
change to
mov cx, 0h
and this
MOV DH,24
MOV DL,79
to
mov dx, 2479h
Thatl make for less and slightly faster code XD (as if it was slow before...)
Thats true but in that case comment your lines
The rule for assembly is MINIMUM 1 comment per line but good practice is a comment per line plus a comment per block of code.
Yeah and from what I have read that code should work perfectly... Please post back if you fix it. I would like to know whats wrong here. Personally I would write a function that doesn't use a call. If you want such a function I have written some code that does exactly that but you might have to modify it slightly to clear the screen I'd be happy to share as soon as I can get my assembly off of my dos machine which will be when I get my pc with a floppy drive running so I will have a way of transferring my code.
Last edited by hobosrock696; 10-22-2010 at 08:57 PM.