Re: [Freedos-devel] Linking asm with C

2023-01-14 Thread Ralf Quint
On 1/13/2023 12:49 PM, Knedlik wrote: I’m trying to learn graphics programming in DOS. It’s really hard to get resources on this topic... I think you are trying to run before you can walk. Try to program in DOS first. Things are a bit different than programming in today's multi-GB GUI

Re: [Freedos-devel] Linking asm with C

2023-01-14 Thread Ralf Quint
On 1/13/2023 8:33 AM, Knedlik wrote: void clearScreen(char color) { int i; for (i = 0xa000; i < 0xfa00; i++) { char* byte = i; *byte = color; } } What the hell are you trying to do here? Seriously, it doesn't help just to blindly follow some tutorial without

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

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 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
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: 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 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 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 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 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 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 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 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
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 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

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-12 Thread Louis Santillan
The tools you are using do matter. Which C Compiler, which Assembler, which Linker? On Thu, Jan 12, 2023 at 3:39 PM Ralf Quint wrote: > > On 1/12/2023 11:43 AM, Knedlik wrote: > > Hello, > > I’m currently trying to make a function in a separate assembly file, but > > I’m having problems

Re: [Freedos-devel] Linking asm with C

2023-01-12 Thread Ralf Quint
On 1/12/2023 11:43 AM, Knedlik wrote: Hello, I’m currently trying to make a function in a separate assembly file, but I’m having problems linking it with a C program. Are there any guides that show how to do this? Thanks in advance, Yes, follow the documentation of your C compiler for this,