フォーラム: Forum of Decimal BASIC (スレッド #48109)

Paract Compiler and Interpreter Differ (2023-01-22 17:19 by toml12953 #93481)

When I run the following program to convert an Intel HEX file to a BIN file, the interpreter does it correctly and each byte in the output file is the binary representation of the data in the HEX file. When I compile and run the program with Paract, most of the bytes are OK but some are different. Below are the program and a sample data line

The resulting TEST.BIN file should have the 16 bytes
3E 03 D3 10 3E 11 D3 10 31 00 C0 21 08 F8 E5 CD
which is correct in the interpreter

but when the program is run in the compiler, the file has more bytes and some are incorrect
3E 03 C3 93 10 3E 11 C3 93 10 31 00 C3 80 21 08 C3 B8 C3 A5 C3 8D


Sample data file (test.hex)
:10F800003E03D3103E11D3103100C02108F8E5CDDE
:0000000000

Program:
DO
INPUT PROMPT "HEX file name (no extension): ":HexName$
WHEN EXCEPTION IN
OPEN #1: NAME HexName$ & ".HEX", ACCESS INPUT
LET FileFound = 1
USE
PRINT "No such HEX file. Try again."
LET FileFound = 0
END WHEN
LOOP UNTIL FileFound = 1

OPEN #2: NAME HexName$ & ".BIN"
ERASE #2

DO
LET OutLn$=""
LINE INPUT #1, IF MISSING THEN EXIT DO: record$
LET ByteCount = BVAL(record$(2:3),16)
IF ByteCount = 0 THEN EXIT DO
FOR I=1 TO ByteCount
LET OutLn$ = OutLn$ & CHR$(BVAL(record$(9+2*I-1:9+2*i),16))
NEXT I
PRINT #2: OutLn$;
LOOP

CLOSE #1
CLOSE #2

PRINT "File ";UCASE$(HexName$);".HEX converted."

END

メッセージ #93481 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Paract Compiler and Interpreter Differ (2023-01-22 17:59 by SHIRAISHI Kazuo #93482)

I wonder that was caused by the incompatibility between Decimal BASIC English version and BASICAcc in the default character.
Set Option-compatibility-behavior-"Unit of String Manipulation" to Byte
or white in each program unit
OPTION CHARACTER BYTE.


#93481 への返信

メッセージ #93482 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Paract Compiler and Interpreter Differ (2023-01-23 00:52 by toml12953 #93484)

Reply To Message #93482
> I wonder that was caused by the incompatibility between Decimal BASIC English version and BASICAcc in the default character.
> Set Option-compatibility-behavior-"Unit of String Manipulation" to Byte
> or white in each program unit
> OPTION CHARACTER BYTE.
>
>

Yes, that was it. When I changed to Byte rather than Character, it worked. Thanks!
#93482 への返信

メッセージ #93484 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする