DIV ARENA FORUMS

Read lpt or com

Vortigano - 26-2-2018 at 09:18 PM

Would it be possible to send or receive data by the com/lpt ports?

[Edited on 26-2-2018 by Vortigano]

MikeDX - 26-2-2018 at 11:33 PM

You may be able to do fopen on these as normal file io but if not we could add them. I'm pretty sure I've used it in the past

Vortigano - 27-2-2018 at 05:42 AM

i don't know how to do that, that would be great!!!! . how i could pass the parameters to fopen()?

CicTec - 27-2-2018 at 09:50 AM

Currently not possible, FOPEN does not work for serial ports in the latest versions of windows, you need to use a set of windows API specific, also in windows you can open a door indicating "COM1" for example, in Linux (or generic Unix) you have to indicate it as "/dev/ttys1" which does not make the program portable between platforms.

Vortigano - 27-2-2018 at 02:19 PM

I had imagined being able to monitor the div variables using LEDs on the parallel or serial ports,etc.

Me había imaginado el poder monitorear las variables de div con leds sobre el puerto paralelo o serie,etc.

Si fuera posible quisiera saber que otras cosas debería continuar investigando al respecto.

MikeDX - 27-2-2018 at 06:28 PM

You could write a simple dll to do this. and export a platform specific variant for each mode

Vortigano - 28-2-2018 at 04:39 AM

Oh, i don't know how to make a windows dll. I barely know pascal language, i think it's a long way to achieve that for me right now. I must know more about it. I think I only have the Bennu osk manual, explaining how to make a dll for bennu and old div1 / 2 magazines, I'm not sure.

No sé como hacer una dll. Apenas conozco el lenguaje pascal, creo que es un camino largo para mí hasta lograr eso ahora mismo. Tengo que saber más sobre el tema. Creo que solo tengo el manual de Bennu de osk, explicando como hacer una dll para bennu y revistas antiguas de div1/2 , no estoy seguro.

CicTec - 2-3-2018 at 11:16 AM

Each DIV/DIV-Like engine has its own library development SDK, so reading manuals from other SDKs would not help developing DIV libraries.

The libraries for DIV should be written in C/C++/Assembly, unfortunately there is no complete SDK manual, just a leame/readme.txt with general instructions and some examples.

Here the complete package that you can consult to try to create libraries.


Attachment: DIV-Libraries.zip (36kB)
This file has been downloaded 1702 times


Vortigano - 2-3-2018 at 07:07 PM

Oooh, muchas gracias por eso CicTec!!!, cuanto antes empezaré a estudiar eso.
-----------------------------------
Thank you very much for that CicTec!, soon I will start studying that.

Vortigano - 4-3-2018 at 05:19 PM

Hi, i'm using openn watcom 1.9 but i don't know how to make the obj files. I would be very grateful if you can write a basic tutorial or some example.
--
Hola, estoy usando open watcom 1.9 pero no sé como crear los ficheros obj. Agradecería si pudieran escribir un tutorial básico o algún ejemplo. Saludos!!!

CicTec - 4-3-2018 at 05:57 PM

Watcom was used by the original DIV at the time of DOS, today it has been replaced by the GCC / MinGW / CLang / MSVC / etc ...

If you are programming from windows the best option is to install MSYS2:
http://www.msys2.org/

Here some tutorials on how to create DLL for windows with MinGW (install from MSYS2):
http://www.mingw.org/wiki/sampledll
https://www.transmissionzero.co.uk/computing/building-dlls-w...
http://www.adp-gmbh.ch/win/misc/mingw/dll.html


First, you can try to generate a library from the examples provided in the pack.

The .CPP files are the originals of DIV2 for DOS, the ones in .c are the new versions for DIVDX brought by Mike.

In your case what you are most interested in should be a DLL like demo02.c (only additional functions/variables).

Once you can generate a DLL and successfully import it into DIV, you can work on this basis to try building your function library.

Remember to be patient, creating DLLs is an advanced task and it may be difficult to get something initially, especially if you do not have much experience with C and/or creating libraries.

Vortigano - 4-3-2018 at 06:04 PM

Thank you very much, I will try to be the best student possible ^_^

Vortigano - 7-3-2018 at 08:42 PM

i have made a dll, water.dll. But i'm having the error code "Use of an invalid external Dll".
i'm based on the mikedx tips from other topic,
"gcc dll.c -o dll.dll -fPIC -funsigned-char -shared"
(http://div-arena.co.uk/forum2/viewthread.php?tid=64&goto...)

[Edited on 7-3-2018 by Vortigano]

MikeDX - 7-3-2018 at 09:14 PM

Water.dll is an autoload dll so just putting it in your div dir is enough, no need to use import

Vortigano - 7-3-2018 at 10:14 PM

i can't make it work without import, anyway the dll that i need to learn to use is demo2.
I created it by the same way, but div doesn't recognize "addsqrt()" as a function, if i import the dll i receive the error code "use of an invalid external dll" too.

MikeDX - 8-3-2018 at 08:23 AM

Could be possible you are trying to use a 64bit dll on a 32bit div. What architecture GCC did you get?

Vortigano - 12-3-2018 at 08:28 PM

You are right, i was trying to use a 64bit dll... i followed the cictec tip and i downloaded msys2, but where i installed it, i didn't have internet access, so i had to use mingw folder of devc++, and i didn't find the way to make 32bits dll... so i installed there codeblocks, and solved the problem.
Hboy.dll needed sdl.h to compile, and water.dll doesn't works unless i use some other library using import, and sometimes the program crashes. Then i'll make a report about it.
The important thing is that I'm compiling dlls like demo2, and it works fine. Now the second mission is to learn better the syntax of C, the use of structures, etc. You are the geniuses of div studio, thank you very much!!!