6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 8:07 am

All times are UTC




Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Mon Nov 28, 2016 9:23 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Quote:
One last issue I've got, FRE(0) reports a negative number (-24xxx something) when I give EhBasic more RAM than configured now.
The problem is in LAB_AYFC. The resulting unsigned 16 bit integer is converted as a 16 bit signed integer to a 32 bit float. I will fix that later. I have to go now!

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 28, 2016 4:17 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
ArnoldLayne wrote:
... One last issue I've got, FRE(0) reports a negative number (-24xxx something) when I give EhBasic more RAM than configured now.

No worries, mate! Like Klaus said, it's just a signed 16-bit integer thing.

Attachment:
fre0.JPG
fre0.JPG [ 42.18 KiB | Viewed 5502 times ]


Mike B.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 28, 2016 7:40 pm 
Offline

Joined: Sun Dec 28, 2014 11:04 pm
Posts: 82
Location: Munich, Germany
Alright, I'll crank it up! :-)


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 29, 2016 10:51 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
The first version of this patch did not work, as it made logical operations with compare result = true (-1) impossible. To print the proper value for free bytes you should use
Code:
? FRE(0)-(FRE(0)<0)*$10000
When FRE(0) returns a negative value $10000 is added.

If you really want to deviate from the beaten path, you can add a routine to convert unsigned integers and jump to it from the functions that you want to respond with an unsigned number. Possible candidates are FRE(), SADD(), VARPTR() and DEEK().
Code:
; save and convert unsigned integer AY to FAC1

LAB_UAYFC
      LSR   Dtypef            ; clear data type flag, $FF=string, $00=numeric
      STA   FAC1_1            ; save FAC1 mantissa1
      STY   FAC1_2            ; save FAC1 mantissa2
      LDX   #$90              ; set exponent=2^16 (integer)
      SEC                     ; always positive
      JMP   LAB_STFA          ; set exp=X, clear FAC1_3, normalise and return


_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 11, 2016 8:13 pm 
Offline

Joined: Sun Dec 28, 2014 11:04 pm
Posts: 82
Location: Munich, Germany
Ok, since it's only a signedness thing, I'm ok with as it is. I was initially concerned that FRE(0) returning a negative value might be because something in my memory configuration is still broken. However, I am happy that this is not the case and the weird behaviour I got from EhBasic were due to some strange hardware issues which are fixed (well, sort of) now.

So, thank you very much for helping me out.
I'll be moving on and implementing LOAD and SAVE. There will be questions. :-)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: