Tiny change to support compilers without snprintf(). Added Makefile for examples.

No change in functionality.



git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@65 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2015-08-16 20:19:00 +00:00
parent ba348db03e
commit 651b059e67
5 changed files with 39 additions and 6 deletions

View File

@ -169,4 +169,4 @@ I admit that this algorithm sounds complicated, but it hasn't failed
yet. :) And in everyday usage, it does exactly what one expects.
If you want to take a closer look at the algorithm, examine the
"calc_arg_size" function in the "sources/mnemo.c" file.
"calc_arg_size" function in the "src/mnemo.c" file.

22
examples/Makefile Normal file
View File

@ -0,0 +1,22 @@
ASSEMBLER6502 = acme
AS_FLAGS = -v9 -Wtype-mismatch
RM = rm
PROGS = ddrv128.prg ddrv64.prg macedit.o trigono.o
all: $(PROGS)
ddrv128.prg: ddrv.a
$(ASSEMBLER6502) $(AS_FLAGS) --outfile ddrv128.prg --format cbm -DSYSTEM=128 ddrv.a
ddrv64.prg: ddrv.a
$(ASSEMBLER6502) $(AS_FLAGS) --outfile ddrv64.prg --format cbm -DSYSTEM=64 ddrv.a
macedit.o: macedit.a
$(ASSEMBLER6502) $(AS_FLAGS) --outfile macedit.o --format cbm macedit.a
trigono.o: trigono.a
$(ASSEMBLER6502) $(AS_FLAGS) --outfile trigono.o --format cbm trigono.a
clean:
-$(RM) -f *.o *.tmp $(PROGS) *~ core

View File

@ -76,10 +76,12 @@
Sprite_HotspotX = 1
Sprite_HotspotY = 1
; address definitions
!addr {
; Locations to store button states, $ff = pressed, $00 = not pressed.
; Mouse uses both buttons, joystick only uses "LeftButton".
; Location to store pointer's current character coordinates.
!addr {
!if SYSTEM = 64 {
LeftButton = $a4
RightButton = $a5
@ -111,6 +113,10 @@
cia1_prb = $dc01
cia1_ddrb = $dc03
mmu_cr = $ff00 ; c128 only
; dummy value for self mod
MODIFIED16 = $ffff
};addr
; --- Label definitions
@ -422,7 +428,7 @@ StoreOF sta Sprites_OF ; set x overflow
; The initialisation routine sets the argument to the address of the
; previous IRQ routine.
mod16 = * + 1: jmp addr($ffff) ; (self-modifying)
mod16 = * + 1: jmp MODIFIED16 ; (self-modifying)
; This table is for part 8.
;OrTable !byte 0, 32, 64 ; VDC only

View File

@ -17,7 +17,7 @@
#define RELEASE "0.95.6" // update before release (FIXME)
#define CODENAME "Fenchurch" // update before release
#define CHANGE_DATE "20 Jun" // update before release
#define CHANGE_DATE "16 Aug" // update before release
#define CHANGE_YEAR "2015" // update before release
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" // FIXME
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME

View File

@ -55,12 +55,13 @@ void Input_new_file(const char *filename, FILE *fd)
// remember source code character for report generator
#define HEXBUFSIZE 9 // actually, 4+1 is enough, but for systems without snprintf(), let's be extra-safe.
#define IF_WANTED_REPORT_SRCCHAR(c) do { if (report->fd) report_srcchar(c); } while(0)
static void report_srcchar(char new_char)
{
static char prev_char = '\0';
int ii;
char hex_address[5];
char hex_address[HEXBUFSIZE];
char hexdump[2 * REPORT_BINBUFSIZE + 2]; // +2 for '.' and terminator
// if input has changed, insert explanation
@ -77,7 +78,11 @@ static void report_srcchar(char new_char)
fprintf(report->fd, "%6d ", Input_now->line_number - 1);
// prepare outbytes' start address
if (report->bin_used)
snprintf(hex_address, 5, "%04x", report->bin_address);
#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
snprintf(hex_address, HEXBUFSIZE, "%04x", report->bin_address);
#else
sprintf(hex_address, "%04x", report->bin_address);
#endif
else
hex_address[0] = '\0';
// prepare outbytes