Skip to content

Commit

Permalink
Cleanup/fix C tools compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Konamiman committed Oct 9, 2019
1 parent cf0cc8a commit fefbb2f
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 126 deletions.
2 changes: 1 addition & 1 deletion source/tools/C/compfsize.bat
@@ -1,6 +1,6 @@
@echo off
cls
sdcc --code-loc 0x180 --data-loc 0 -mz80 --disable-warning 196 --no-std-crt0 crt0msx_msxdos_advanced.rel msxchar.lib asm.lib fsize.c
sdcc --code-loc 0x180 --data-loc 0 -mz80 --disable-warning 196 --disable-warning 85 --no-std-crt0 crt0msx_msxdos_advanced.rel fsize.c
if errorlevel 1 goto :end
hex2bin -e com fsize.ihx
copy fsize.com ..\..\..\bin\tools\
Expand Down
2 changes: 1 addition & 1 deletion source/tools/C/compvsft.bat
@@ -1,6 +1,6 @@
@echo off
cls
sdcc --code-loc 0x180 --data-loc 0 -mz80 --disable-warning 196 --no-std-crt0 crt0msx_msxdos_advanced.rel msxchar.lib asm.lib vsft.c
sdcc --code-loc 0x180 --data-loc 0 -mz80 --disable-warning 196 --disable-warning 85 --no-std-crt0 crt0msx_msxdos_advanced.rel vsft.c
if errorlevel 1 goto :end
hex2bin -e com vsft.ihx
copy vsft.com ..\..\..\bin\tools\
Expand Down
7 changes: 7 additions & 0 deletions source/tools/C/dos.h
Expand Up @@ -100,6 +100,10 @@ typedef struct {
#define _TERM0 0
#define _DIRIO 0x06
#define _BUFIN 0x0A
#define _SETDTA 0x1A
#define _ALLOC 0x1B
#define _RDABS 0x2F
#define _WRABS 0x30
#define _DPARM 0x31
#define _FFIRST 0x40
#define _FNEXT 0x41
Expand All @@ -108,11 +112,14 @@ typedef struct {
#define _CLOSE 0x45
#define _READ 0x48
#define _WRITE 0x49
#define _SEEK 0x4A
#define _PARSE 0x5B
#define _WPATH 0x5E
#define _TERM 0x62
#define _EXPLAIN 0x66
#define _DOSVER 0x6F
#define _RDDRV 0x73
#define _WRDRV 0x74
#define _GDRVR 0x78
#define _GPART 0x7A
#define _CDRVR 0x7B
Expand Down
7 changes: 1 addition & 6 deletions source/tools/C/emufile.c
Expand Up @@ -4,8 +4,7 @@
Compilation command line:
sdcc --code-loc 0x180 --data-loc 0 -mz80 --disable-warning 196
--no-std-crt0 crt0_msxdos_advanced.rel msxchar.rel
emufile.c
--no-std-crt0 crt0_msxdos_advanced.rel emufile.c
hex2bin -e com emufile.ihx
*/

Expand Down Expand Up @@ -41,10 +40,6 @@ typedef struct {

/* Defines */

#define false (0)
#define true (!(false))
#define null ((void*)0)

#define IS_NEXTOR (1 << 7)
#define IS_DEVICE_BASED (1)

Expand Down
49 changes: 14 additions & 35 deletions source/tools/C/fsize.c
Expand Up @@ -4,18 +4,9 @@
Compilation command line:
sdcc --code-loc 0x180 --data-loc 0 -mz80 --disable-warning 196
--no-std-crt0 crt0_msxdos_advanced.rel msxchar.rel
asm.lib fsize.c
--no-std-crt0 crt0_msxdos_advanced.rel
fsize.c
hex2bin -e com fsize.ihx
ASM.LIB, MSXCHAR.LIB and crt0msx_msxdos_advanced.rel
are available at www.konamiman.com
(You don't need MSXCHAR.LIB if you manage to put proper PUTCHAR.REL,
GETCHAR.REL and PRINTF.REL in the standard Z80.LIB... I couldn't manage to
do it, I get a "Library not created with SDCCLIB" error)
Comments are welcome: konamiman@konamiman.com
*/


Expand All @@ -26,33 +17,14 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "asmcall.h"
#include "types.h"
#include "dos.h"

//These are available at www.konamiman.com
#include "asm.h"

/* Typedefs */

typedef unsigned char bool;
typedef unsigned long ulong;

/* Defines */

#define false (0)
#define true (!(false))
#define null ((void*)0)
/* Defines */

#define Buffer 0x9000

#define _TERM0 0
#define _FFIRST 0x40
#define _OPEN 0x43
#define _CREATE 0x44
#define _CLOSE 0x45
#define _WRITE 0x49
#define _SEEK 0x4A
#define _TERM 0x62
#define _DOSVER 0x6F

/* Strings */

const char* strTitle=
Expand All @@ -78,6 +50,8 @@ const char* strCRLF = "\r\n";

/* Global variables */

byte ASMRUT[4];
byte OUT_FLAGS;
Z80_registers regs;
char* fileName;
bool isAbsoluteSize;
Expand Down Expand Up @@ -110,6 +84,7 @@ int main(char** argv, int argc)
byte fileHandle;
ulong oldSize;

ASMRUT[0] = 0xC3;
fileName = (char*)0x8000;

print(strTitle);
Expand Down Expand Up @@ -253,7 +228,7 @@ bool FileExists(char* fileName)
{
regs.Bytes.B = 0;
regs.Words.DE = (int)fileName;
regs.Words.IX = Buffer;
regs.Words.IX = (int)Buffer;
DosCall(_FFIRST, &regs, REGS_ALL, REGS_AF);
return regs.Bytes.A == 0;
}
Expand Down Expand Up @@ -334,3 +309,7 @@ void WriteOneByte(byte fileHandle, byte value)
TerminateWithDosError(regs.Bytes.A);
}
}

#define COM_FILE
#include "printf.c"
#include "asmcall.c"
9 changes: 2 additions & 7 deletions source/tools/C/nexboot.c
Expand Up @@ -4,8 +4,8 @@
Compilation command line:
sdcc --code-loc 0x180 --data-loc 0 -mz80 --disable-warning 196
--no-std-crt0 crt0_msxdos_advanced.rel msxchar.rel
nexboot.c
--no-std-crt0 crt0_msxdos_advanced.rel msxchar.rel
nexboot.c
hex2bin -e com emufile.ihx
*/

Expand All @@ -17,14 +17,9 @@
#include "system.h"
#include "dos.h"
#include "asmcall.h"
#include "strcmpi.h"

/* Defines */

#define false (0)
#define true (!(false))
#define null ((void*)0)

#define RamKeysAddress ((byte*)0xA100)

/* Strings */
Expand Down
16 changes: 12 additions & 4 deletions source/tools/C/types.h
Expand Up @@ -13,12 +13,20 @@ typedef unsigned char byte;
typedef unsigned long ulong;
#endif

#ifndef null
#define null ((void*)0)
#ifndef bool
typedef unsigned char bool;
#endif

typedef unsigned char bool;
#ifndef false
#define false (0)
#endif

#ifndef true
#define true (!(false))
#endif

#ifndef null
#define null ((void*)0)
#endif

#endif //__TYPES_H
#endif //__TYPES_H

0 comments on commit fefbb2f

Please sign in to comment.