Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Zx Spectrum] "DEF FN" Basic token problem...

134 views
Skip to first unread message

Gzavsnap

unread,
Aug 19, 2015, 12:30:53 PM8/19/15
to
Hi,
I had to debug the "Zmakebas" coded by Russell Marks.

C# Res available inclued in "Les Schroumpfs" Hebdogiciel#62-63:
ZmakeBas upadted to 1.1c :
<http://www.hebdogiciel.fr/hd-roms/spectrum/Schroumpfs.zip>

Problem:
The "DEF FN" function seem corrupt.

example:

10 DEF FN M(X,Y)=X-INT (X/Y)*Y



"Zmakebas": ---------------------------------
Offset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
00000016 00 0A 13 00 CE 4D 28 58
....ÎM(X
00000032 2C 59 29 3D 58 2D BA 28 58 2F 59 29 2A 59 0D
,Y)=X-º(X/Y)*Y.



"Spectrum": ---------------------------------
Offset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

00000016 00 0A 1F 00 CE 4D 28 58
....ÎM(X
00000032 0E 59 29 3D 58 58 2C 59 0E 3D 58 2D BA 59 29 3D
.Y)=XX,Y.=X-ºY)=
00000048 58 2D BA 28 58 2F 59 29 2A 59 0D X-º(X/Y)*Y.

Something wrong after the "OE" tags!
I don't know what it is...

Any ideas?

dott.Piergiorgio

unread,
Aug 20, 2015, 1:31:34 AM8/20/15
to
Il 19/08/2015 18:30, Gzavsnap ha scritto:
> Hi,
> I had to debug the "Zmakebas" coded by Russell Marks.
>
> C# Res available inclued in "Les Schroumpfs" Hebdogiciel#62-63:
> ZmakeBas upadted to 1.1c :
> <http://www.hebdogiciel.fr/hd-roms/spectrum/Schroumpfs.zip>
>
> Problem:
> The "DEF FN" function seem corrupt.
>
> example:
>
> 10 DEF FN M(X,Y)=X-INT (X/Y)*Y

on a 64b Linux box, gcc vomits some score of warning, all of the same type:

> zmakebas.c: In function ‘parse_options’:
> zmakebas.c:419:18: warning: pointer targets in passing argument 1 of ‘strcpy’ differ in signedness [-Wpointer-sign]
> strcpy(startlabel,optarg+1);
> ^
> In file included from /usr/include/features.h:364:0,
> from /usr/include/stdio.h:27,
> from zmakebas.c:11:
> /usr/include/x86_64-linux-gnu/bits/string3.h:108:1: note: expected ‘char * __restrict__’ but argument is of type ‘unsigned char *’
> __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
> ^
> In file included from /usr/include/string.h:634:0,
> from zmakebas.c:12:
> zmakebas.c: In function ‘grok_block’:
> zmakebas.c:504:14: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
> if(strncmp(ptr+1,*lptr,2)==0)
> ^
> In file included from zmakebas.c:12:0:
> /usr/include/string.h:398:15: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
> extern size_t strlen (const char *__s)

Dunno if you use winsozz or Linux, but I suspect is linked to your
reported bug, if I have enough time, I'll try to trudge into the source,
but no promises (Southern Italy's summer heat sap hack energy...)


Best regards from Italy,
dott. Piergiorgio.

Gzavsnap

unread,
Aug 20, 2015, 7:42:09 AM8/20/15
to
Le 20/08/2015 07:31, dott.Piergiorgio a écrit :
> on a 64b Linux box, gcc vomits some score of warning, all of the same type:

Juste open the *.dev file with WinDevC++...
Or use a make file directly with GCC


# makefile for zmakebas

# comment out the `-DHAVE_GETOPT' if, for some reason or other, you
# don't have getopt(). (This is mainly so it'll work on MS-DOG, though
# I'm not entirely sure why I bothered supporting that. :-))
#
CC=gcc
CFLAGS=-O -Wall -DHAVE_GETOPT

# these set where the executable and man page are installed
PREFIX=/usr/local

BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/man/man1


all: zmakebas

zmakebas: zmakebas.o
$(CC) $(CFLAGS) -o zmakebas zmakebas.o

installdirs:
/bin/sh ./mkinstalldirs $(BINDIR) $(MANDIR)

install: zmakebas installdirs
install -m 511 zmakebas $(BINDIR)
install -m 444 zmakebas.1 $(MANDIR)

uninstall:
$(RM) $(BINDIR)/zmakebas
$(RM) $(MANDIR)/zmakebas.1*

clean:
$(RM) *~ *.o zmakebas


# The stuff below makes the distribution tgz.

VERS=1.1

dist: tgz
tgz: ../zmakebas-$(VERS).tar.gz

../zmakebas-$(VERS).tar.gz: clean
$(RM) ../zmakebas-$(VERS)
@cd ..;ln -s zmakebas zmakebas-$(VERS)
cd ..;tar zchvf zmakebas-$(VERS).tar.gz zmakebas-$(VERS)
@cd ..;$(RM) zmakebas-$(VERS)



WinDev Make file:
# Project: ZmakeBas
# Makefile created by Dev-C++ 5.11

CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES = ZmakeBas_private.res
OBJ = zmakebas.o $(RES)
LINKOBJ = zmakebas.o $(RES)
LIBS = -L"C:/Program Files/Dev-Cpp/MinGW64/lib32" -L"C:/Program
Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc -m32
INCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program
Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program
Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program
Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program
Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
-I"C:/Program
Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = ../ZmakeBas.exe
CXXFLAGS = $(CXXINCS) -m32
CFLAGS = $(INCS) -m32
RM = rm.exe -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)

zmakebas.o: zmakebas.c
$(CC) -c zmakebas.c -o zmakebas.o $(CFLAGS)

ZmakeBas_private.res: ZmakeBas_private.rc
$(WINDRES) -i ZmakeBas_private.rc -F pe-i386 --input-format=rc -o
ZmakeBas_private.res -O coff


Have fun!

Gzavsnap

unread,
Aug 20, 2015, 5:59:31 PM8/20/15
to
Better take this res...
I add a Tzx output files.
<http://zx81.ordi5.free.fr/tools/zmakebas-1.1.zip>

Gzavsnap

unread,
Aug 20, 2015, 11:12:50 PM8/20/15
to

> 10 DEF FN M(X,Y)=X-INT (X/Y)*Y
> "Zmakebas": ---------------------------------
> Offset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> 00000016 00 0A 13 00 CE 4D 28 58 ....ÎM(X
> 00000032 2C 59 29 3D 58 2D BA 28 58 2F 59 29 2A 59 0D ,Y)=X-º(X/Y)*Y.
> "Spectrum": ---------------------------------
> Offset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> 00000016 00 0A 1F 00 CE 4D 28 58 ....ÎM(X
> 00000032 0E 59 29 3D 58 58 2C 59 0E 3D 58 2D BA 59 29 3D
> .Y)=XX,Y.=X-ºY)=
> 00000048 58 2D BA 28 58 2F 59 29 2A 59 0D X-º(X/Y)*Y.

Seem to be :

10 DEF FN M(X {[0E][5b buffer]} , Y {{[0E][5b buffer]} )=X-INT (X/Y)*Y

The 5bit buffer may be the return value called by FN M(X,Y)...
I will try to set this value to a null buffer [0E:00:00:00:00:00]
Have fun.

Gzavsnap

unread,
Aug 21, 2015, 12:38:01 AM8/21/15
to
> Seem to be :
> 10 DEF FN M(X {[0E][5b buffer]} , Y {{[0E][5b buffer]} )=X-INT (X/Y)*Y
> The 5bit buffer may be the return value called by FN M(X,Y)...
> I will try to set this value to a null buffer [0E:00:00:00:00:00]
> Have fun.
???
It's better !
;-)

Gzavsnap

unread,
Aug 21, 2015, 12:43:18 AM8/21/15
to
Le 19/08/2015 18:30, Gzavsnap a écrit :
> Hi,
> I had to debug the "Zmakebas" coded by Russell Marks.
>
> C# Res available inclued in "Les Schroumpfs" Hebdogiciel#62-63:
> ZmakeBas upadted to 1.1c :
> Problem:
> The "DEF FN" function seem corrupt.
> 10 DEF FN M(X,Y)=X-INT (X/Y)*Y
> (...)

The new release add a variable buffer in this function.
<http://zx81.ordi5.free.fr/tools/zmakebas-1.1.zip>
Updated.

Have Fun.

Gzavsnap

unread,
Sep 2, 2015, 12:20:33 AM9/2/15
to
> The new release add a variable buffer in this function.
> <http://zx81.ordi5.free.fr/tools/zmakebas-1.1.zip>
Updated to 111d.
*added a tape merge function to add a Zx file in an existing TZX or a
TAP file.

> Have Fun.

Marcos Cruz

unread,
Oct 24, 2015, 2:32:47 PM10/24/15
to
En/Je/On 2015-08-19, Gzavsnap <**> escribió/skribis/wrote:

> I had to debug the "Zmakebas" coded by Russell Marks.
>
> C# Res available inclued in "Les Schroumpfs" Hebdogiciel#62-63:
> ZmakeBas upadted to 1.1c :
><http://www.hebdogiciel.fr/hd-roms/spectrum/Schroumpfs.zip>
>
> Problem:
> The "DEF FN" function seem corrupt.

> Any ideas?

I discovered this same bug some months ago (but it seems the bug was
known at least in 2013):

http://foro.speccy.org/viewtopic.php?f=6&t=4376
http://worldofspectrum.org/forums/discussion/comment/830868/

In those threads you can find links to the fixed version by Antonio
Villena.

--
Marcos Cruz
http://programandala.net

Gzavsnap

unread,
Oct 24, 2015, 5:27:40 PM10/24/15
to
Thanks Marcos!

My rerelease is host here:
<http://zx81.ordi5.free.fr/tools/zmakebas-1.1.zip>
(Just a blanck memory room to link variables values.)

0 new messages