Jump to content

MrFish's Photo

MrFish

Member Since 3 Feb 2005
OFFLINE Last Active Today, 2:57 AM

Topics I've Started

PL65 Problem - WRTSTR/WRTLN

Mon Dec 26, 2011 9:00 PM

I'm doing some coding in PL65 using the 2nd cracked version (where compiling actually produces run-able code). I'm having a problem getting several related library procedures to execute properly when being called from a procedure that has a STRING passed as one of it's parameters.

The following code example produces an executable in which the PROC WRTSTR (from 'Terminal.lib') in the PROC PrintText does not print the string A$. At this point during execution the program continuously prints to the screen what looks like the contents of memory.

INCLUDE D:Terminal.lib

!--------------------------------------

PROC PrintText (STRING A$[20])

	 INT I

BEGIN

	 FOR I=1 TO 50000 DO
	 NEXT

	 WRTSTR (A$)

	 REPEAT
	 FOREVER

END

!--------------------------------------

MAIN ()

	 STRING A$[20]

BEGIN

	 A$ = "Main Proc "
	 WRTSTR (A$)

	 A$ = "PrintText Proc "
	 PrintText (A$)

END


If I code the PROC PrintText without a STRING as a parameter I can then execute a WRTSTR without any problems. This example will work whether I have no parameters or if any parameters that are passed are not STRINGs.


INCLUDE D:Terminal.lib

!--------------------------------------

PROC PrintText ()

	 INT I
	 STRING A$[20] DATA "PrintText Proc ";

BEGIN

	 FOR I=1 TO 50000 DO
	 NEXT

	 WRTSTR (A$)

	 REPEAT
	 FOREVER

END

!--------------------------------------

MAIN ()

	 STRING A$[20]

BEGIN

	 A$ = "Main Proc "
	 WRTSTR (A$)

	 PrintText ()

END


Also, WRTSTR will fail in PROC PrintText if I pass a STRING parameter even if I don't use the passed parameter in the WRTSTR statement. This problem persists with the WRTLN function as well, which is just a variant that sends an EOL at the end of the string being printed to the screen. Using PCHAR (and altering the code accordingly) instead of WRTSTR cures the problem, but I'm still wondering why WRTSTR and WRTLN will not function properly in this particular case?

I'm running the compiler off a DOS 2.5 disk rather than the uploaded SpartaDOS disk. I've tried compiling and running it under SpartaDOS X using the original disk and the DOS 2.5 disk as well and it doesn't change the outcome. I've run the executables under emulation and with real hardware and I've compiled it using real hardware. There are no examples of using WRTSTR or WRTLN in the sample game program that Noahsoft included on the PL65 disk. It uses PCHAR for it's title screen.

Normally I would post this in the programming forum, but since the cracked disk was posted on the main forum and since this may be a problem with the cracked compiler or an associated library file, I'm posting it here.

Here are the files for the above example, including a copy of PL65 on a DOS 2.5 disk:

Attached File  PL65 Example.zip   56.21K   9 downloads

Any help is appreciated.

Thanks,
MF

Miniature 8-Bit?

Sat Jul 30, 2011 10:30 PM

A little late to the party, I just found this on 5200 forums today: Compact 5200 System

He claims to also be working on an 8-Bit version of similar proportions.