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:
daum /
Could i link a seperate .com and call it with C++?
Originally Posted by Kallisti
daum /
Could i link a seperate .com and call it with C++?
Why would you do that? If you want to create a COM file from C++ and assembly, compile them both in 16 bit and use a 16 bit linker to link them using the tiny model.
Originally Posted by Void
Why would you do that? If you want to create a COM file from C++ and assembly, compile them both in 16 bit and use a 16 bit linker to link them using the tiny model.
I mean make a COM from an ASM file
[php].i386
.model small
.stack
.data
.code
main proc
MOV AH,6h
MOV AL,0
MOV BH,7
MOV CH,0
MOV CL,0
MOV DH,24
MOV DL,79
INT 10h
main endp
end main[/php]
and call it from C++?
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?
Originally Posted by hobosrock696
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?
I eventually got it to work, but I didn't use inline assembly ( meaning I didn't use a C/C++ compiler ).
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...
Originally Posted by why06
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...
I didn't notice that.
Patrick, if you want the assembler to assume those numbers as hex you have to use the suffix 'h' at the end. Otherwise it assumes them to be of base 10. If you want the assembler to see it as binary for any reason, use the 'b' suffix.
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...)
Originally Posted by hobosrock696
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...)
Yeah, but my way is much easier to follow. I'm not a super pro at asm \:
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.