Oleg-N-Cher / XDev

XDev is open and free set of compilers, additional tools, libraries and design patterns for cross-platform and embedded development in Oberon-2 language. DosDev, WinDev, LinDev, NesDev, MsxDev and ZXDev are XDev's subsystems for target platforms MS-DOS, Windows 32/64bit, Linux, Nintendo/NES, MSX and ZX Spectrum.
http://sourceforge.net/projects/bb-xdev/
Other
38 stars 3 forks source link

string compare #3

Open keiashford opened 1 year ago

keiashford commented 1 year ago

when trying to compare 2 strings on zx spectrum it says strcmp needs 6 arguments instead of 2

Oleg-N-Cher commented 1 year ago

Locally, you can do the following. Find the line in ZXDev/Lib/C/SYSTEM.oh:

#define __STRCMPCC(src, src_len, dst, dst_len, mod, pos) SYSTEM_STRCMPCC(src, dst)

And replace it with:

#define __STRCMPCC(a, b) SYSTEM_STRCMPCC(a, b)

This can certainly be improved by replacing the implementation of the SYSTEM_STRCMPCC function with an assembly language rewrite. But there's a lot of room for improvement there without it ;-)

I'll do a new release of XDev and ZXDev with this edit a little later on.

P.S. I'd be interested to know how you use ZXDev. Please write to me at allot (a) bk.ru or @olegcher in Telegram.

keiashford commented 1 year ago

hi i sent an email to allot aat bk.ru

im trying to make a text based game.

Im having another trouble now, im trying to get these procedures to compile: here is the source of the whole file:

MODULE pointerprocedures;
IMPORT Basic,SYSTEM;

PROCEDURE resetOptions;
VAR 
c:INT8;

BEGIN
FOR c:=1 TO maxoptions DO
availableoptions[c]:=0
options[c]:=''
END
END resetOptions;

PROCEDURE printPointer
VAR
c:INT8;
BEGIN
 FOR c:=1 TO maxoptions DO
 Basic.AT(0,optionsy+c)
 Basic.PRSTR(" ")
 END
 Basic.AT(0,optionsy+optionspointer)
 Basic.PRSTR(">")
END printPointer

PROCEDURE optionsdown;
VAR
c:INT8;
BEGIN
FOR c:=1 TO maxoptions DO
optionspointer:=optionspointer+1
IF optionspointer>maxoptions THEN
optionspointer:=1
END
IF availableoptions[optionspointer]=1 THEN 
RETURN
END
END
END optionsdown;

PROCEDURE optionsup
VAR
c:INT8;
BEGIN
FOR c:=1 TO maxoptions DO
optionspointer:=optionspointer-1
IF optionspointer<1 THEN
optionspointer:=maxoptions
END
IF availableoptions[optionspointer]=1 THEN
RETURN
END
END
END optionsup; 

PROCEDURE updatedecide(l:ARRAY OF CHAR)
BEGIN

IF l$="q" THEN
 optionsup()
 printPointer()
END
IF l$="a" THEN
 optionsdown()
 printPointer()

END
END updatedecide;

END pointerprocedures.

it says INT8 is not recognised identifier.

Oleg-N-Cher commented 1 year ago

You need to decide on the dialect of Oberon to use. INT8 is a type from my own Oberon-3 dialect. To enable O3 support, you should save the module with the .ob3 extension or call Ofront+ (XDev) with the -3 option (you can add this option to your YourProject/Obj/Ofront+.par file). You can also use YourProject/Lib/Obj/Ofront+.par , which has higher priority. See ZXDev//Lib/Obj/Ofront+.par as an example.

There is no INT8 type in other Oberon dialects, but there are analogs:

I see other problems in your source. The following ids are not defined:

maxoptions, availableoptions, options, optionsy, optionspointer

keiashford commented 1 year ago

Hi I am trying to create a new project folder. I have a file that uses Basic, but it says symbol file not found for the Basic Import. I tried putting Basic,sym in /lib/sym and I put Basic.def in /Lib

Oleg-N-Cher commented 1 year ago

I tried putting Basic,sym in /lib/sym

Yes, that's exactly what you should do. I even write a script in the Sym folder that can update the .sym-files in a project from ZXDev/Lib/Sym (useful when they are updated). Something like this (UpdateSym.bat):

@IF NOT "%XDev%"=="" GOTO XDev
@ECHO Please set system variable XDev=X:\Path\To\XDev
@PAUSE
@EXIT

:XDev

@FOR %%i IN (*.sym) DO COPY /B /Y %XDev%\ZXDev\Lib\Sym\%%i

But you don't need to put Basic.def into the folder of your project, leave it inside ZXDev folder.

keiashford commented 1 year ago

ok why does it say symbol file not found?

Oleg-N-Cher commented 1 year ago

It doesn't have to be that way. Maybe you have folders lib/sym named lowcase? Anyway, I offered you my Telegram contact to deal with such issues. I also have facebook https://www.facebook.com/oleg.n.cher