Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.sinclair > #3909 > unrolled thread

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

Started byGzavsnap <**..NOSPAM..**@nospam.somewere>
First post2015-08-19 18:30 +0200
Last post2015-10-24 23:27 +0200
Articles 10 — 3 participants

Back to article view | Back to comp.sys.sinclair


Contents

  [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-08-19 18:30 +0200
    Re: [Zx Spectrum] "DEF FN" Basic token problem... "dott.Piergiorgio" <dott.piergiorgio@gmail.com> - 2015-08-20 07:31 +0200
      Re: [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-08-20 13:40 +0200
        Re: [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-08-20 23:58 +0200
    Re: [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-08-21 05:11 +0200
      Re: [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-08-21 06:36 +0200
    Re: [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-08-21 06:42 +0200
      Re: [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-09-02 06:21 +0200
    Re: [Zx Spectrum] "DEF FN" Basic token problem... Marcos Cruz <use_the_contact_page@programandala.net> - 2015-10-24 18:32 +0000
      Re: [Zx Spectrum] "DEF FN" Basic token problem... Gzavsnap <**..NOSPAM..**@nospam.somewere> - 2015-10-24 23:27 +0200

#3909 — [Zx Spectrum] "DEF FN" Basic token problem...

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-08-19 18:30 +0200
Subject[Zx Spectrum] "DEF FN" Basic token problem...
Message-ID<55d4af3c$0$3066$426a74cc@news.free.fr>
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?

[toc] | [next] | [standalone]


#3911

From"dott.Piergiorgio" <dott.piergiorgio@gmail.com>
Date2015-08-20 07:31 +0200
Message-ID<mr3oke$i3f$1@dont-email.me>
In reply to#3909
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.

[toc] | [prev] | [next] | [standalone]


#3912

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-08-20 13:40 +0200
Message-ID<55d5bd10$0$3185$426a34cc@news.free.fr>
In reply to#3911
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!

[toc] | [prev] | [next] | [standalone]


#3914

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-08-20 23:58 +0200
Message-ID<55d64dc2$0$3328$426a74cc@news.free.fr>
In reply to#3912
Better take this res...
I add a Tzx output files.
<http://zx81.ordi5.free.fr/tools/zmakebas-1.1.zip>

[toc] | [prev] | [next] | [standalone]


#3915

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-08-21 05:11 +0200
Message-ID<55d69731$0$4574$426a74cc@news.free.fr>
In reply to#3909
> 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.

[toc] | [prev] | [next] | [standalone]


#3916

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-08-21 06:36 +0200
Message-ID<55d6ab28$0$3158$426a74cc@news.free.fr>
In reply to#3915
> 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 !
;-)

[toc] | [prev] | [next] | [standalone]


#3917

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-08-21 06:42 +0200
Message-ID<55d6ac65$0$3361$426a74cc@news.free.fr>
In reply to#3909
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.

[toc] | [prev] | [next] | [standalone]


#3942

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-09-02 06:21 +0200
Message-ID<55e67910$0$3157$426a74cc@news.free.fr>
In reply to#3917
> 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.

[toc] | [prev] | [next] | [standalone]


#4014

FromMarcos Cruz <use_the_contact_page@programandala.net>
Date2015-10-24 18:32 +0000
Message-ID<n0gisa$eln$1@speranza.aioe.org>
In reply to#3909
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

[toc] | [prev] | [next] | [standalone]


#4015

FromGzavsnap <**..NOSPAM..**@nospam.somewere>
Date2015-10-24 23:27 +0200
Message-ID<562bf7ca$0$3185$426a74cc@news.free.fr>
In reply to#4014
Le 24/10/2015 20:32, Marcos Cruz a écrit :
> En/Je/On 2015-08-19, Gzavsnap <**> escribió/skribis/wrote:
>> 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.

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.)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.sinclair


csiph-web