Login
Back to forumReply to this topicGo to last reply

Posted By

Charlemagne
on 2017-05-25
14:05:01
 There is something (or bug?) about YAPE (1.1.2b).

Write a simple BASIC program using graphics, but no run it:

10 GRAPHIC1,1
20 GETKEYA$
30 GRAPHIC0

Save as eg. "one.prg"...
Run it...
Save as eg. "two.prg"...
Reset (F11)
Load "two.prg"
List

(...nothing...)

The problem is that in the "Save as PRG" dialog "from address..." field.

The first when you save the address is OK: $1001 to $101c

BUT the second one (after running) the address is changed: $4001 to $401c

I understand when I changed to graphics screen (GRAPHIC), the address is changed, but why changed in "Save as PRG" dialog, too??? It's so puzzled because the program will be in the "two.prg" file, but the address is wrong and I don't believe that everybody will check the addresses everytime when he would like to save his program.

I have already lost some programs because of it. You have, haven't you?

Posted By

siz
on 2017-05-25
14:30:09
 Re: There is something (or bug?) about YAPE (1.1.2b).

That's not a YaPE bug. It's a well known (=documented bug?) of BASIC 3.5 with more than 16k RAM. When you enter graphics mode it will change memory allocation.
The GRAPHIC command sets color and luminance memory to $1800 and bitmap memory to $2000.
On a C16 (or C116) this means that the only remaining RAM is from $1000 to $17ff so it will set the end of BASIC memory to $1800. On a plus/4 (or any computer with more than 16k RAM) it will set the start of BASIC to $4001 and relocate the BASIC program there.
So when you save a BASIC program after using GRAPHIC command it will save it starting from $4001.
To load it back you either have to switch on graphics mode first to relocate BASIC to $4001 or load your program with DLOAD or LOAD"name",8 and NOT LOAD"name",8,1. I suspect you did the latter one.

EDIT: I reread your post and you are not using DISK I/O. You can recover your program if you enter POKE44,16:RENUMBER after loading it.

Posted By

SVS
on 2017-05-25
14:47:03
 Re: There is something (or bug?) about YAPE (1.1.2b).

In order to rescue your lost file "two.prg", you have to:
1) Just allocate the Graphic area (i.e. GRAPHIC 1: GRAPHIC 0)
2) LOAD the file (F8)

Note that in Yape F8 and SHIFT/F8 are not the same as LOAD and SAVE. On the contrary they load and save segments of memory, and their start address.

Posted By

Charlemagne
on 2017-06-01
14:08:00
 Re: There is something (or bug?) about YAPE (1.1.2b).

As I mentioned above I understand the memory changing when switch to graphical screen, but why YAPE doesn't save (F8) the programs (using GRAPHIC instruction) with the normal starting address ($1001)? Why do I have to make a trick (GRAPHIC1:GRAPHIC0)?

"POKE44,16:RENUMBER" doesn't work!

I realised another interesting (or bug?) thing about YAPE...
When I prepared a pair of my programs (assembly.d64 and ted.d64) to upload this site, I wanted to make a disk (.d64) for them, because both consist of more files.

I checked the box of "Create empty" in the "File / Attach disk image..." but when I tried to ask for a DIRECTORY with F3, YAPE didn't show "the second ID" and showed "only 257 blocks free", what's more the colors were changed to a kind of gray.

In the end I made a copy of an exist disk image and formating it with:
OPEN 1, 8, 15, "N0:CHARLEMAGNE,00,2A"
CLOSE 1

...and now I have tried to make a disk image with x86 version of YAPE and it was all right, so the bug is in the x64 version!

Posted By

Csabo
on 2017-06-01
14:41:30
 Re: There is something (or bug?) about YAPE (1.1.2b).

I'm really confused about what you're trying to describe. The YAPE "Save as PRG" dialog suggest the values from $2B/$2C - $2D/$2E as the start and end values of your program; and normally that's exactly where your program is. If you haven't allocated the GRAPHIC area, your program will be from $1001 - and YAPE will suggest that as the starting address. If you HAVE allocated the GRAPHIC area, then your program is from $4001 - and once again YAPE will correctly suggest that as the starting address. There's no tricks involved, as far as I can see.

Regardless, the suggested start/end values are just defaults for convenience, you can change them to whatever you like, in case you want to save other stuff from the memory.

The other issue you've found I could duplicate. Does appear to be a bug in the x64 version only. I've notified Gaia (though he probably sees this post too).

Posted By

Gaia
on 2017-06-02
02:14:38
 Re: There is something (or bug?) about YAPE (1.1.2b).

Thanks for the explanation Csabo. The way save PRG works is indeed intentional. As for the D64 related issue: the problem arises only in the binary built with the MINGW compiler and not in the one built with the Visual C++ compiler and that I am using for normal development. Alas, releases are built with the MINGW compiler so I need to check what goes wrong...

Posted By

MMS
on 2017-06-02
10:02:30
 Re: There is something (or bug?) about YAPE (1.1.2b).

Hi,
in fact when I made a technical demo in BASIC (comparing snail speed soft sprite emulation in BASIC with GSHAPE, DRAW and POKE methods) I definitely switched to Graphic3 mode, and after some successful tests I saved the program to HDD as PRG.
Next day I reload the saved program, and there was nothing to list.

So I also noticed this (definitely known rule) that after mode change the BASIC reallocates to $4001. But first it was a very confusing and irritating moment, I though I lost 3-4 hours of work.

But in fact, just loading the program as a PRG from menu, will load the PRG to it1s save address, and it is $4001, but if not set to GFX mode in advance, the BASIC will look for the loaded PRG at $1001, and will list nothing after load.
Loading from Disc or Tape is a different matter, as you can use the LOAD"",8 or DLOAD"" method.

So I learned those thsick, for me the solution was to transfer it to a D64 with Disc tool, then load it with DLOAD from D64.

I do not know, is it not possible to identify, if the PRG is a BASIC one, and based on the expetcetd know BASIC start address, load to THAT address the PRG?

Posted By

JamesC
on 2017-06-02
12:45:05
 Re: There is something (or bug?) about YAPE (1.1.2b).

In reply to MMS -
I do not know, is it not possible to identify, if the PRG is a BASIC one, and based on the [expected] know BASIC start address, load to THAT address the PRG?

If this change were made within the emulator proper (typing on the white screen), it would break compatibility with actual machines. It is the programmer's responsibility to keep in mind where BASIC memory space starts and ends, and ensure that they don't overwrite any other code when they load a file into memory.

For example, if I have a GRAPHIC program active (BASIC starting at $4001), I may want to load data to $1001; as long as it's under 2K then I won't overwrite an active screen. But if YAPE changes BASIC memory pointers on my behalf, I can no longer see my code at $4001.

YAPE already has a function to load to a specific memory address -- the .PRG simply has to be visible to the host OS (for most of us, the Windows file system). File > Load PRG (or press F8), tick the Custom Load box at the bottom of the dialogue window.

Anything stored as .D64 should work exactly as the actual hardware. When I want to load from a 1541/1551, I need to use DLOAD or LOAD ,8,1 as appropriate. YAPE should work identically. happy

Having said that: if you intended "can a programmer look at a file on disk, and know if it would normally load to $1001 or $4001?" .... yes. Look at the filetype (PRG) and the first two bytes of the file itself (either $1001 or $4001 for a Plus/4).

While this does not guarantee the file is a BASIC program (it could be a character set or other data), it would help the programmer determine if it -might- be executable code. But then we're back to the programmer knowing what they do with their code to begin with. wink

Posted By

MMS
on 2017-06-02
17:13:16
 Re: There is something (or bug?) about YAPE (1.1.2b).

@JamesC:
I said: B A S I C happy

I mean with basic programming skills. happy

Posted By

Charlemagne
on 2017-06-03
16:28:10
 Re: There is something (or bug?) about YAPE (1.1.2b).

WoW! What a "quarrel" or a "battle of words" about GRAPHIC! happy

The solution is (as JamesC is right):
1.: Load PRG... F8
2.: Checking the box of "Custom load from address $..."
(and it's interesting that the default address is $1001)

BUT, I can image a future improvement of a YAPE that can detect whether the loaded PRG uses the GRAPHIC instruction. It will be a little AI! happy

The code of GRAPHIC instruction is $DE (222)

(and it's easy to detect the given PRG is a BASIC one or not, eg. numbers of lines are in PRG, too)



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024