Easiest BASIC to port?

Building your first 6502-based project? We'll help you get started here.
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Easiest BASIC to port?

Post by Chromatix »

Quote:
May it be that the terminal client software get's confused about the missing $0D characters causing that garbage to appear?
In that case, you'd see the text coming down a line and continuing right, instead of going back to the left margin - not hash.
/RESET
Posts: 33
Joined: 12 Apr 2018
Location: RS/Brazil

Re: Easiest BASIC to port?

Post by /RESET »

Isn't that what happens right after "Enhanced BASIC 2.22" ?

Could also be that the $00 isn't catched and output continues fetching characters beyond the text.

Switching terminal output mode to HEX could leverage the mystery what these characters are ore come from.

Just a thought.
Quote:
LAB_MSZM
!raw $0D,$0A,"Memory size ",$00

LAB_SMSG
!raw " Bytes free",$0D,$0A,$0A
!raw "Enhanced BASIC 2.22",$0A,$00

; numeric constants and series

; constants and series for LOG(n)
LAB_25A0
!8 $02 ; counter
!8 $80,$19,$56,$62 ; 0.59898
!8 $80,$76,$22,$F3 ; 0.96147
;## !8 $80,$76,$22,$F1 ; 0.96147
!8 $82,$38,$AA,$40 ; 2.88539
;## !8 $82,$38,$AA,$45 ; 2.88539
Chromatix wrote:
Quote:
May it be that the terminal client software get's confused about the missing $0D characters causing that garbage to appear?
In that case, you'd see the text coming down a line and continuing right, instead of going back to the left margin - not hash.
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Easiest BASIC to port?

Post by Chromatix »

I think some of those strings are meant to be printed as-is, and some after going through a translator. Sort-of like the difference between OSWRCH and OSASCI in Acorn MOS.

Bizarrely, a "print null terminated string" routine appears to redirect to a "print quote terminated string" routine. Yet the hash contains a quote character. This makes no sense whatsoever.
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Easiest BASIC to port?

Post by barrym95838 »

I think I can see the numeric constants for LOG(n) being printed as ASCII, especially the $56, $62 and the $76, $22 and the $38 and the $40. Does anyone else see it?

Mike B.
User avatar
GaBuZoMeu
Posts: 660
Joined: 01 Mar 2017
Location: North-Germany

Re: Easiest BASIC to port?

Post by GaBuZoMeu »

These 4 byte sequences are normalized floating point representations with a "biased exponent" and a "hidden bit" in the matissa.

The first byte holds the "biased" exponent. Bias is simply an add of $80 to the value of the exponent. In the case of "$80,$19,$56,$62" the exponent is $80-$80=0.
The next three bytes are the normalized 24 bit mantissa with a hidden bit. This hidden bit is the topmost bit of that 24 bits that is always 1 due to normalization (which means the mantissa has a value between 0.5 and <1). As the topmost bit is always 1 it is removed to hold the sign bit of the mantissa. In this case the bit is 0 so the matissa is positive and has a value of $995662 / 2^24 = 10,049,122/16,777,216 = 0.59897435

The last number $82,$38,$AA,$40 is $B8AA40 / 2^24 * 2^($82-80) = 12102208/16777216 * 2^2 = 2,8853912
Atlantis
Posts: 122
Joined: 19 Jun 2018

Re: Easiest BASIC to port?

Post by Atlantis »

Problem solved. It turned out to be an effect of using the X register inside I/O TX routine.
Is it possible to hardcode memory amount for cold boot, to not be asked about it every time?
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Easiest BASIC to port?

Post by barrym95838 »

GaBuZoMeu wrote:
These 4 byte sequences are normalized floating point representations with a "biased exponent" and a "hidden bit" in the matissa.

[ excellent and detailed explanation snipped ]
Yeah, but what happens if your print string routine doesn't know when to stop, and just plows through those binaries as if they were ASCII? A unique and repeatable type of "hash", right? :wink:

Mike B.
User avatar
GaBuZoMeu
Posts: 660
Joined: 01 Mar 2017
Location: North-Germany

Re: Easiest BASIC to port?

Post by GaBuZoMeu »

Well, printing beginning @E338 on the badge (with EhBasic2.22) gives:

Code: Select all

>e330.e3ffq

E330 - ...r....Memory s
E340 - ize . Bytes free
E350 - ...Enhanced BASI
E360 - C 2.22.....Vb.v"
E370 - s.8*@.5.s.5.s...
E380 - ..1r..COx.t#w.t$
E390 - ..8*;.tc..w#.+z.
E3A0 - ..|cB.~u~P.1r...
E3B0 - ...I.[...W{..&e.
E3C0 - #4X.%]a.I.[.x:E7
E3D0 - {."\|.]M}.0.}Ym$
E3E0 - ~.r.~L9s.**S....
E3F0 - .............. .

:roll:
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Easiest BASIC to port?

Post by barrym95838 »

So you can see it too?
eh1.JPG
eh1.JPG (16.18 KiB) Viewed 3637 times
eh2.JPG
Mike B.
User avatar
GaBuZoMeu
Posts: 660
Joined: 01 Mar 2017
Location: North-Germany

Re: Easiest BASIC to port?

Post by GaBuZoMeu »

barrym95838 wrote:
So you can see it too?
Sure. It is not identical, but who can estimate what a galloping X register might cause. :lol:
Klaus2m5
Posts: 442
Joined: 28 Jul 2012
Location: Wiesbaden, Germany

Re: Easiest BASIC to port?

Post by Klaus2m5 »

Atlantis wrote:
Is it possible to hardcode memory amount for cold boot, to not be asked about it every time?
Yes, but you would no longer be able to reserve RAM space for machine code to be called by CALL or USR() statements. After all it takes only a hit to the [ENTER] key entering an empty line to take the default from Ram_top.
6502 sources on GitHub: https://github.com/Klaus2m5
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Easiest BASIC to port?

Post by Chromatix »

Since he has an area of banked RAM that isn't included in the BASIC memory area, I think he can safely hard-code the latter.
Post Reply