Author Topic: Proto typing with JWASM  (Read 217 times)

Gunther

  • Member
  • *****
  • Posts: 3830
  • Forgive your enemies, but never forget their names
Proto typing with JWASM
« on: November 19, 2021, 06:15:58 PM »
I'm currently working on an embedded DOS system. The processor is an 80386 without FPU. My floating point emulation is not finished yet, but essential parts are already working.
One challenge is that everything should run in 32 bit protected mode. I use JWASM for DOS and Japhet's rock solid HX DOS Extender. This is working very well so far.

I've a near procedure with the following stack layout:
Code: [Select]
[ebp+8]  = parameter1
[ebp+12] = parameter2

I call the procedure in that way:
Code: [Select]
push    parameter2
push    parameter1
call    procedure

I think that should also work with invoke, but it needs some proto typing. Has anyone ever done this with JWASM for DOS? Any help is appreciated. Thanks in advance.
Get your facts first, and then you can distort them.

_japheth

  • Member
  • **
  • Posts: 52
Re: Proto typing with JWASM
« Reply #1 on: November 19, 2021, 09:00:15 PM »
>Has anyone ever done this with JWASM for DOS?

Yes - there's no special requirement for DOS.

However, you need to know who's to "clean" the stack AFTER the call:

Code: [Select]
xxx proto c :dword, :dword  ; the caller is supposed to clean
xxx proto stdcall :dword, :dword ; the proc itself has to do it - sam as in win32
The road to hell is paved with good intentions.

Gunther

  • Member
  • *****
  • Posts: 3830
  • Forgive your enemies, but never forget their names
Re: Proto typing with JWASM
« Reply #2 on: November 20, 2021, 08:48:18 AM »
Thanks for your help, Andreas. Can you please give a small example (function definition, prototyping, calling) - let's say STDCALL? In the folder Samples I did not find a DOS example for that.
Thank you very much.

Get your facts first, and then you can distort them.