Assembly Forum>
SFA:The Offline Reader
...compressed...
Slayer
But the 80386/48ûdo allow flat addressing. 4 GB ûof it. You just have to give the USE32ûdirective. If you use DOS, you'll have to use an extender, cause DOS don't like anything ûbigger than 64kThe protected mode on the û386/486 is basically a flatû space. Technically, there are no segments, but you ûcan use segments in your assembler, they just don't make t past the linker.
Ian
Slayer, are you smoking crack, or did you just not read eugene's message?
Take a look at Microsoft Windows 3.0 or later running in 386 Enhanced mode.
What you will find is that the computer is running in protected mode on an 80386, but with segments.
And, trust me, writing protected mode programs is a little bit more involved than just setting USE32 in your assembler.
Lord Vader
Can someone help me? I'm trying to recompile Future Crew's demo "Mental Surgery" that comes with the Scream Tracker addition or something kit, and when I do what the batch file says (it goes into Link, which i don't have, and don't KNOW what it is) it says it's adding the file intothe other file. It said to compile the main, and include the other ASM files... Can someone help me here? I'm using TASM version 3.0 if it's needed...
StraitJacket
Linking is a fital part of any compilation process...
darth puppy
whats wrong with smokng crack anyway
John
Linking isn't any part of the compilation process. Linking is part of the linking process.
JayDee
and I have no idea what the fital process is
someone gimme a clue...
StraitJacket
Phtt.. Ok... linking is a vital part of the Source -> executable process...
Ian
Lord Vader: The linker that comes with Borland's TASM is named TLINK.EXE.
What it looks like is happening is you have several .ASM files, all of which get assembled separately by TASM. After everything is assembled, you link all of the resulting object (*.OBJ) files with TLINK to make a finished product.
JayDee
Phtting isn't going to help, SJ
they will tear you to bits...
Lord Vader
No, the docs say that only MAIN.ASM get's compiled, and the others (yes, there are several .ASM files) get included into it... Hmm... I'll have to look again...
StraitJacket
I just don't care.
Ian
Lord Vader: While perfectly legal, it is quite nonstandard to include all of the other .ASM files into MAIN.ASM. Check MAIN.ASM for lines that say something like "include poop.asm" (I forgot the exact syntax).
If there are none, then they all get compiled separately.
If the lines are there, then you only have to assembly MAIN.ASM, of course.
Either way, you have to use your linker (TLINK) to make an executable program out of the output of TASM.
TLINK main (then any other files you assembled separately, if you did assemble any others separately)
John
You'll need an assembler like MASM or TASM. You'll also need to create a .H file identifying which assembly functions you intend to call from your C code. You probably need to tackle calling conventions, but I'm hazy on the details here. Finally, you need to tell your linker about the OBJ of the assembly code created by MASM or TASM. It will resolve calls in the C code to these asm functions.
That's the rough outline. We can go from there.
Ian
The calling conventions part of it might be a big problem if your assembly function was not created to be called by C.
You might need to build a small assembly function that translates the C calling convention to whatever it is your desired assembly function uses, and call this other function.
the c calling convention is basically: push all parameters on the stack, from right to left. call the function (which pushes the return value onto the stack). the caller is responsible for cleaning up the stack (that is, taking all parameters off of it).
with most c compilers you can specify the pascal calling convention: push all parameters on the stack, from left to right. call the function (which pushes the return value onto the stack). the called function is responsible for cleaning up the stack.
If the assembly function does not take any parameters, then it is compatible with both of these conventions.
another problem you might run into if your assembly function was not written to be called from c is that is might change some registers that the calling function assumes will not change. these registers (di, si, probably ds depending on the memory model) are used for register variables.
basically, as with most programming things, there are many possible cases involved, which is why this topic in a book would take several pages.
Perhaps it would be better if you had a specific example in mind, so we don't have to duplicate those several pages, which would be no more helpful for you than if you just read them yourself.
Aries Baggins
I'm knowledgeable up to that point, John... it's more detailed stuff that confuses me. How would I reference a block of asm commands compiled into the .obj file with my C code?
Slayer
By the name of the PROC. In older versions of MSC, you have to stick a "_" in front of the procedure name.
darth puppy
Like this, aris baggies,
.model large, c
my_proc PROC
ARG X:WORD Y:BYTE
push bp
mov bp, sp
mov AX, 5
pop bp
ret
my_proc ENDP
END
like that will work so goodo, remeber to push bp and pop bp and also mov bp, sp or else you will die. If you are using masm, maybe you cant do that and you have to eat arguments anothe rway that I dont remember cause I stopped doing it on account of I have tasm, ha
/* stupid.H */
int my_proc(int x, char y); //a procedure that returns five,
//this is handy in case you forget
//what five is.
Aries Baggins
Okay, I'll be really specific about what I'm trying to do... but it'll require a little download. Go to the Graphics room in the Files hallway of Mixed Reality. There you'll find a file called JCLPLASM.ARJ. Download it. Within it is the assembly source for a very nice plasma routine, along with a C program that generates a file required for the plasma routine. I'm working on a compilation of graphics displays, both my own work and the work of other people, all in one EXE file. What I'd like to do is make the asm source, called jclplasm.asm, accessible through C code (in TurboC) so that they can be linked.
Thanks for your help...
Lab Rat
Also Aries > what do you mean by, "how to access the entirety of an assembly file with a C command"?
Aries Baggins
What I mean by that is that I don't need to access individual blocks of code within the ASM program... I just want one function [plasma() or something like that] to access all of the assembly code. Then I just want to compile and link the two to get an operable program.
Slayer
Thanks for the prog. I always forget what five is :)
MASM and TASM also have high level procedure calling shit if you put that .model c in your code. I forget how to do it since I usually either write in straight assembly or use the in-line assembly for TP.
golden spud
Especially when there is no such thing as a C command :)
Ren
ARGH@!!! I'm taking an assembly class at college and it SUCKS!!
Lab Rat
Aries >
Thanks. It is much clearer.
I think the best thing you could do is pitch all the code into asm_main(...) and call that from the C code (usually there's plenty of helpfiles documenting how to do such a thing...) or, alternatively (although there are many programmers who would smack me for saying such a thing) inline the assembly directly into your C file.
but then this is what everyone's been saying all along.
Ian
Aries Baggins: It is very unlikely that I will download that file from MixEd ReaLity, as I don't know the phone number (and probably wouldn't do it anyway -- at 2400 baud, a download of any significant amount of source could be expensive. how big is it?).
golden spud
Ren> what platform?
Aries Baggins
Well, Ian, it's about... 100K, or thereabouts. And the number is (214)298-2838. Anyway, I've pretty much got all the info I need anyway.
darth puppy
aries what you say doesnt make any sense. Did you know there is a store in lynen named aries? I bet you didnt.
Assembly Forum> _