#define _REENTRANT
#define _CODE
+#define _SDCC_MANGLES_SUPPORT_FUNS 1
+
#endif
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
+#include <sdcc-lib.h>
+
+#if _SDCC_MANGLES_SUPPORT_FUNS
+unsigned long _divulong (unsigned long a, unsigned long b);
+#endif
+
long _divslong (long a, long b)
{
long r;
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
+
+#include <sdcc-lib.h>
+
+#if _SDCC_MANGLES_SUPPORT_FUNS
+unsigned long _modulong (unsigned long a, unsigned long b);
+#endif
+
long _modslong (long a, long b)
{
long r;
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
+
+#include <sdcc-lib.h>
+
+#if _SDCC_MANGLES_SUPPORT_FUNS
+unsigned long _mululong (unsigned long a, unsigned long b);
+#endif
+
long _mulslong (long a, long b)
{
long r;
} ;
#if defined(SDCC_MODEL_LARGE) || defined (SDCC_ds390)
#define bcast(x) ((union bil _xdata *)&(x))
+#elif defined(__z80) || defined(__gbz80)
+#define bcast(x) ((union bil *)&(x))
#else
#define bcast(x) ((union bil _near *)&(x))
#endif
SCC = $(TOPDIR)/bin/sdcc -mz80
SAS = $(TOPDIR)/bin/as-z80
-OBJ = div.o mul.o putchar.o printf.o shift.o # asm_strings.o string.s
+OBJ = div.o mul.o putchar.o printf.o shift.o stubs.o # asm_strings.o string.s
LIB = z80.lib
CC = $(SCC)
AS = $(SAS)
return (int)floatFromVal(constVal(getStringArg(szStart, argv, pi, argc)));
}
+static void
+verifyShortOption(const char *opt)
+{
+ if (strlen(opt) != 2)
+ {
+ werror (W_EXCESS_SHORT_OPTIONS, opt);
+ }
+}
+
static bool
tryHandleUnsupportedOpt(char **argv, int *pi)
{
}
for (i = 0; i < LENGTH(optionsTable); i++)
- {
- if (optionsTable[i].shortOpt == shortOpt ||
- (longOpt && optionsTable[i].longOpt && strcmp(optionsTable[i].longOpt, longOpt) == 0))
- {
- // If it is a flag then we can handle it here
- if (optionsTable[i].pparameter != NULL)
- {
- (*optionsTable[i].pparameter)++;
- return 1;
- }
- else {
- // Not a flag. Handled manually later.
- return 0;
- }
- }
- }
+ {
+ if (optionsTable[i].shortOpt == shortOpt ||
+ (longOpt && optionsTable[i].longOpt &&
+ strcmp(optionsTable[i].longOpt, longOpt) == 0))
+ {
+
+ // If it is a flag then we can handle it here
+ if (optionsTable[i].pparameter != NULL)
+ {
+ if (optionsTable[i].shortOpt == shortOpt)
+ {
+ verifyShortOption(argv[*pi]);
+ }
+
+ (*optionsTable[i].pparameter)++;
+ return 1;
+ }
+ else {
+ // Not a flag. Handled manually later.
+ return 0;
+ }
+ }
+ }
// Didn't find in the table
return 0;
}
switch (argv[i][1])
{
case 'h':
+ verifyShortOption(argv[i]);
+
printUsage ();
exit (0);
break;
break;
case 'c':
+ verifyShortOption(argv[i]);
+
options.cc_only = 1;
break;
break;
case 'v':
+ verifyShortOption(argv[i]);
+
printVersionInfo ();
exit (0);
break;
wassert (0);
}
+/*-----------------------------------------------------------------*/
+/* genGetHbit - generates code get highest order bit */
+/*-----------------------------------------------------------------*/
+static void
+genGetHbit (iCode * ic)
+{
+ operand *left, *result;
+ left = IC_LEFT (ic);
+ result = IC_RESULT (ic);
+ aopOp (left, ic, FALSE, FALSE);
+ aopOp (result, ic, FALSE, FALSE);
+
+ /* get the highest order byte into a */
+ emit2("ld a,%s", aopGet (AOP (left), AOP_SIZE (left) - 1, FALSE));
+
+ if (AOP_TYPE (result) == AOP_CRY)
+ {
+ emit2 ("rl a");
+ outBitC (result);
+ }
+ else
+ {
+ emit2 ("rlc a");
+ /* PENDING: For re-target. */
+ emit2 ("and a,#1");
+ outAcc (result);
+ }
+
+
+ freeAsmop (left, NULL, ic);
+ freeAsmop (result, NULL, ic);
+}
+
/*-----------------------------------------------------------------*/
/* shiftR2Left2Result - shift right two bytes from left to result */
/*-----------------------------------------------------------------*/
break;
case GETHBIT:
- emit2 ("; genHBIT");
- wassert (0);
+ emit2 ("; genGetHBIT");
+ genGetHbit (ic);
+ break;
case LEFT_OP:
emit2 ("; genLeftShift");
{REG_GPR, B_IDX, "b", 1},
{REG_GPR, E_IDX, "e", 1},
{REG_GPR, D_IDX, "d", 1},
- /* { REG_GPR, L_IDX , "l", 1 },
- { REG_GPR, H_IDX , "h", 1 }, */
#if DEBUG_FAKE_EXTRA_REGS
{REG_GPR, M_IDX, "m", 1},
{REG_GPR, N_IDX, "n", 1},
"newline in string constant" },
{ E_CANNOT_USE_GENERIC_POINTER, ERROR_LEVEL_ERROR,
"cannot use generic pointer %s to initialize %s" },
+{ W_EXCESS_SHORT_OPTIONS, ERROR_LEVEL_WARNING,
+ "Only one short option can be specified at a time. Rest of %s ignored." }
};
/*
#define W_STRAY_BACKSLASH 149
#define W_NEWLINE_IN_STRING 150
#define E_CANNOT_USE_GENERIC_POINTER 151
+#define W_EXCESS_SHORT_OPTIONS 152
/** Describes the maximum error level that will be logged. Any level
* includes all of the levels listed after it.
/** Simple test for the mul/div/mod operations.
- type: int, char, short
+ type: int, char, short, long
storage: static,
attr: volatile,
*/