calling MSX UNAPI (ethernet API) from C?
calling MSX UNAPI (ethernet API) from C?
Would it be possible, to call this API from C,
https://www.konamiman.com/msx/unapi/tcp-ip-unapi-10.pdf
without needing to make a full binding for it? or would I need to wrap all of these calls?
-Thom
https://www.konamiman.com/msx/unapi/tcp-ip-unapi-10.pdf
without needing to make a full binding for it? or would I need to wrap all of these calls?
-Thom
Looks like a potential pain in the arse,
https://www.konamiman.com/msx/networkin ... tcpcon.asm
note CALL_UNAPI, it's doing some paging in and out...
-Thom
https://www.konamiman.com/msx/networkin ... tcpcon.asm
note CALL_UNAPI, it's doing some paging in and out...
-Thom
hmm, Nestor pointed me to this:
https://github.com/Konamiman/MSX/tree/m ... DCC/asmlib
Would this work as is with z88dk?
-Thom
https://github.com/Konamiman/MSX/tree/m ... DCC/asmlib
Would this work as is with z88dk?
-Thom
What's causing this to barf?
https://github.com/Konamiman/MSX/blob/m ... /AsmCall.c
-Thom
https://github.com/Konamiman/MSX/blob/m ... /AsmCall.c
Code: Select all
mkdir -p build/./src/msx/
zcc +msx -D__MSX__ -c src/msx/AsmCall.c -o build/./src/msx/AsmCall.c.o
Error at file 'src/msx/AsmCall.c' line 29: syntax error
Error at file 'src/msx/AsmCall.c' line 30: syntax error
Error at file 'src/msx/AsmCall.c' line 31: syntax error
Error at file 'src/msx/AsmCall.c' line 33: syntax error
Error at file 'src/msx/AsmCall.c' line 35: syntax error
Error at file 'src/msx/AsmCall.c' line 45: syntax error
Error at file 'src/msx/AsmCall.c' line 49: syntax error
Error at file 'src/msx/AsmCall.c' line 50: syntax error
Error at file 'src/msx/AsmCall.c' line 51: syntax error
Error at file 'src/msx/AsmCall.c' line 52: syntax error
Error at file 'src/msx/AsmCall.c' line 53: syntax error
Error at file 'src/msx/AsmCall.c' line 54: syntax error
Error at file 'src/msx/AsmCall.c' line 58: syntax error
Error at file 'src/msx/AsmCall.c' line 59: syntax error
Error at file 'src/msx/AsmCall.c' line 60: syntax error
Error at file 'src/msx/AsmCall.c' line 61: syntax error
Error at file 'src/msx/AsmCall.c' line 82: syntax error
Error at file 'src/msx/AsmCall.c' line 87: syntax error
Error at file 'src/msx/AsmCall.c' line 88: syntax error
Error at file 'src/msx/AsmCall.c' line 89: syntax error
Error at file 'src/msx/AsmCall.c' line 90: syntax error
Error at file 'src/msx/AsmCall.c' line 91: syntax error
Error at file 'src/msx/AsmCall.c' line 92: syntax error
Error at file 'src/msx/AsmCall.c' line 97: syntax error
Error at file 'src/msx/AsmCall.c' line 98: syntax error
Error at file 'src/msx/AsmCall.c' line 101: syntax error
Error at file 'src/msx/AsmCall.c' line 102: syntax error
Errors in source file src/msx/AsmCall.c:
Error at file 'src/msx/AsmCall.c' line 29: syntax error
^ ----
Error at file 'src/msx/AsmCall.c' line 30: syntax error
^ ---- exx
Error at file 'src/msx/AsmCall.c' line 31: syntax error
^ ---- ld l,(ix)
Error at file 'src/msx/AsmCall.c' line 33: syntax error
^ ---- dec a
Error at file 'src/msx/AsmCall.c' line 35: syntax error
^ ---- exx
Error at file 'src/msx/AsmCall.c' line 45: syntax error
^ ---- jr z,ASMRUT_DOAF
Error at file 'src/msx/AsmCall.c' line 49: syntax error
^ ---- ld e,10(ix) ;IY
Error at file 'src/msx/AsmCall.c' line 50: syntax error
^ ---- ld d,11(ix)
Error at file 'src/msx/AsmCall.c' line 51: syntax error
^ ---- push de
Error at file 'src/msx/AsmCall.c' line 52: syntax error
^ ---- push bc
Error at file 'src/msx/AsmCall.c' line 53: syntax error
^ ---- pop ix
Error at file 'src/msx/AsmCall.c' line 54: syntax error
^ ---- pop iy
Error at file 'src/msx/AsmCall.c' line 58: syntax error
^ ---- pop af
Error at file 'src/msx/AsmCall.c' line 59: syntax error
^ ---- exx
Error at file 'src/msx/AsmCall.c' line 60: syntax error
^ ----
Error at file 'src/msx/AsmCall.c' line 61: syntax error
^ ---- ret ;Execute code, then CONT (both in stack)
Error at file 'src/msx/AsmCall.c' line 82: syntax error
^ ---- ld 2(ix),c ;BC, DE, HL
Error at file 'src/msx/AsmCall.c' line 87: syntax error
^ ---- ld 7(ix),h
Error at file 'src/msx/AsmCall.c' line 88: syntax error
^ ---- dec a
Error at file 'src/msx/AsmCall.c' line 89: syntax error
^ ---- jr z,CALL_END
Error at file 'src/msx/AsmCall.c' line 90: syntax error
^ ----
Error at file 'src/msx/AsmCall.c' line 91: syntax error
^ ---- exx ;Alternate HLDEBC
Error at file 'src/msx/AsmCall.c' line 92: syntax error
^ ---- pop hl
Error at file 'src/msx/AsmCall.c' line 97: syntax error
^ ---- ld 10(ix),l ;IY
Error at file 'src/msx/AsmCall.c' line 98: syntax error
^ ---- ld 11(ix),h
Error at file 'src/msx/AsmCall.c' line 101: syntax error
^ ---- ex af,af
Error at file 'src/msx/AsmCall.c' line 102: syntax error
^ ---- pop ix
Makefile.msx:23: recipe for target 'build/./src/msx/AsmCall.c.o' failed
make: *** [build/./src/msx/AsmCall.c.o] Error 1
-Thom
I suspect the code is going into space because it's written for sdcc's calling convention rather than sccz80.
It's easy to fix, just:
1. Add #include <sys/compiler.h>
2. Annotate the prototype with __z88dk_sdccdecl
And then the function will work with both compilers (details are here: https://github.com/z88dk/z88dk/wiki/CallingConventions)
It's easy to fix, just:
1. Add #include <sys/compiler.h>
2. Annotate the prototype with __z88dk_sdccdecl
And then the function will work with both compilers (details are here: https://github.com/z88dk/z88dk/wiki/CallingConventions)
I'm in the process of incorporating the library into the MSX port since it seems to be quite useful.
I've just run it on a non-MSX target and found a very subtle problem that's probably causing your problem: remove the # from the line that reads ld de,#CONT
If you don't, then the call executes but you end up returning to 0x5d which will probably run onto 0x100 and restart the program.
I've just run it on a non-MSX target and found a very subtle problem that's probably causing your problem: remove the # from the line that reads ld de,#CONT
If you don't, then the call executes but you end up returning to 0x5d which will probably run onto 0x100 and restart the program.
Returning to this thread,
Given the following code:
It is currently returning:
Really need this code to work, it's pivotal for MSX support of PLATOTERM, as it is the only emulatable I/O that I have in BlueMSX.
-Thom
Given the following code:
Code: Select all
#include <msx.h>
#include <arch/msx/asm.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
int count;
printf("Testing Harness\r\n");
printf("---------------\r\n\r\n");
count=UnapiGetCount("TCP/IP");
printf("UNAPIGetCount(TCP/IP) - %d",count);
printf("end\n\n");
return 0;
}
Really need this code to work, it's pivotal for MSX support of PLATOTERM, as it is the only emulatable I/O that I have in BlueMSX.
-Thom
Getting closer, but now UnapiCall may be mangling things a bit.
In my code:
https://github.com/tschak909/platotermz ... /io.c#L105
I am calling an UNAPI call: TCPIP_GET_CAPAB, which is defined here in section 4.1.2:
https://github.com/Konamiman/MSX/blob/m ... api-10.pdf
Bit 3 gives whether active TCP connections are possible, which are required by this program.
It's failing, and it shouldn't, because INL is literally the canonical implementation of UNAPI TCP/IP on the MSX, and this is used by more than a few of the test programs (tweeter.c, etc.)
*scratch-head*
-Thom
In my code:
https://github.com/tschak909/platotermz ... /io.c#L105
I am calling an UNAPI call: TCPIP_GET_CAPAB, which is defined here in section 4.1.2:
https://github.com/Konamiman/MSX/blob/m ... api-10.pdf
Bit 3 gives whether active TCP connections are possible, which are required by this program.
It's failing, and it shouldn't, because INL is literally the canonical implementation of UNAPI TCP/IP on the MSX, and this is used by more than a few of the test programs (tweeter.c, etc.)
*scratch-head*
-Thom