Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread tom ehlert
> I’m currently trying to make a function in a separate assembly > file, but I’m having problems linking it with a C program. it always helps to take the time to describe the problem you are facing, like what compiler, assembler, linker WHAT KIND OF PROBLEMS Tom

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Danilo Pecher
Oh dear, if you really want an answer for that, you need to give more infos, like which linker are you using, which memory model? On Thu, 12 Jan 2023 at 20:45, Knedlik wrote: > > Hello, > I’m currently trying to make a function in a separate assembly file, but I’m > having problems linking it

[Freedos-devel] Fw: Linking asm with C

2023-01-13 Thread Samuel V. via Freedos-devel
Go to http://master.dl.sourceforge.net/project/api-simple-completa/api.7z?viasf=1 Look at api\bin\OS\v2020\vDPMI Run bmain.batYou need DJGPP and NASM, and set paths accordingly to execute binaries everywhere. It's an example of linking DJGPP C and NASM in an ever-growing application.

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Steve Nickolas
On Fri, 13 Jan 2023, Knedlik wrote: To be fair, I myself am not sure about this. It’s the default options, so I would assume the watcom linker and whatever memory model open watcom is using. The default for OpenWatcom is the small model. I happen to know how to do this only for the specific

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Knedlik
I think I’ll stick to inline assembly. Now onto solving my divide by zero problem which I managed to create somehow. Help there would be appreciated as well, even if getting a bit off topic. Mainly knowledge on how to debug on dos will be appreciated.

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Knedlik
To be fair, I myself am not sure about this. It’s the default options, so I would assume the watcom linker and whatever memory model open watcom is using. ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Mercury Thirteen via Freedos-devel
Watcom's Debugger is amazing for that. You can single-step your code, set breakpoints, monitor variable names, everything. It'll even work (albeit a little less robustly) on applications not made in Watcom C. Sent with Proton Mail secure email. --- Original Message --- On Friday,

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread E. Auer
hi! if you are using a protected mode model, it may be impossible to call int 10 directly and you may have to use dpmi for that. all compilers for DOS offer ways to call BIOS and other interrupts directly from C, which is a lot more foolproof than using ASM here. the next problem is whether

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Louis Santillan
OpenWatcom uses ``, `union REGS` type, and `int86()` when using a DOS Real Mode Memory Model. See: Page 405 - https://web.archive.org/web/20220507185907/http://ftp.openwatcom.org/manuals/current/clib.pdf

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Steve Nickolas
On Fri, 13 Jan 2023, Knedlik wrote: void clearScreen(char color) { int i; for (i = 0xa000; i < 0xfa00; i++) { char* byte = i; *byte = color; } } This is completely wrong. Mode 0x13, right? void clearScreen (char color) { char far *screen; unsigned int i;

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Knedlik
Okay, this is just weird. I can’t for the love of god figure out why this is throwing the divide by zero interrupt. void setMCGA() { _asm { mov al, 0x13 int 0x10 ret } } void setText() { _asm { mov al, 0x03 int 0x10 ret } } void

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread tom ehlert
> Okay, this is just weird. > I can’t for the love of god figure out why this is throwing the divide by > zero interrupt. a) learn to use a debugger. single step this stuff. you will likely see that 'ret' is not a good idea in inline assembly in general. also WDIS graphic.obj >

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Danilo Pecher
Accepting the danger of sounding somewhat arrogant, but you seem to lack some basic knowledge of system programming. Are you sure you need assembler programming in the first place? Everything you've set out so far is perfectly doable in C. On Fri, 13 Jan 2023 at 17:35, Knedlik wrote: > > Okay,

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Steve Nickolas
On Fri, 13 Jan 2023, Knedlik wrote: To be honest, I’m just following a tutorial that said it’s better to do it in asm - but it’s in Pascal, so I’m translating it into C. Only reason you'd want to use ASM rather than C is to try to optimize it beyond what the compiler can do.

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Knedlik
To be honest, I’m just following a tutorial that said it’s better to do it in asm - but it’s in Pascal, so I’m translating it into C. ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Danilo Pecher
If you are comfortable programming in Pascal, stay with it. In fact Turbo-Pascal has pretty much the best integration of inline assembler of all the languages I encountered in 30 years. And in general, just don't follow tutorials blindly, collect your own experience. Maybe it would help if you

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Robert Riebisch
Hi Knedlik, > I’m trying to learn graphics programming in DOS. It’s really hard to get > resources on this topic... Fixing a few broken links on my page , you get this: 256-Color VGA Programming in C http://www.brackeen.com/vga/ Graphics

Re: [Freedos-devel] Linking asm with C

2023-01-13 Thread Knedlik
I’m trying to learn graphics programming in DOS. It’s really hard to get resources on this topic... ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel