6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 1:27 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Feb 15, 2019 6:47 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
I downloaded the (what I think) original source code from two different sites. Here I found this:

LAB_2DB6
LDA Itempl ; get temporary integer low byte
LDY Itemph ; get temporary integer high byte
CPY #<Ram_base+1 ; compare with start of RAM+$100 high byte
BCC LAB_GMEM ; if too small go try again

It is the line starting with CPY that puzzles me, shouldn't it have been:

CPY #>Ram_base+1 ; compare with start of RAM+$100 high byte

???

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 15, 2019 8:46 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
It looks like you're right.

Ruud, to keep the white space, you need to put [code] and [/code] around the code. Also, replace tabs with spaces, since the forum software messes them up sometimes. You might need to copy and paste into a text editor to see what you're doing better, then copy from there and paste to the forum when you're happy with it. What you'll get is as shown here:
Code:
LAB_2DB6
        LDA     Itempl          ; get temporary integer low byte
        LDY     Itemph          ; get temporary integer high byte
        CPY     #<Ram_base+1    ; compare with start of RAM+$100 high byte
        BCC     LAB_GMEM        ; if too small go try again

It is the line starting with CPY that puzzles me, shouldn't it have been:

        CPY     #>Ram_base+1    ; compare with start of RAM+$100 high byte

???

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 16, 2019 8:53 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
This section of the code is supposed to prevent the user from doing really stupid things:
1. Ram_top is configured smaller then Ram_base
2. The memory test does not find any memory above Ram_base
3. The user enters too little memory at the "Memory size ?" prompt

Since Ram_base should be page aligned the compare is with $01 and should always fall through which means the bug disables the sanity check.

I will fix the code in my patched up version with credit to Ruud.

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


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 17, 2019 5:00 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
GARTHWILSON wrote:
Ruud, to keep the white space, you need to put [code] and [/code] around the code. ....

You are never too old to learn something. Thank you!

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 17, 2019 5:07 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
Klaus2m5 wrote:
I will fix the code in my patched up version with credit to Ruud.

Herzlichen Dank!

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 13, 2020 1:40 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Fixed as proposed in my patched up version of EhBASIC 2.22p5 on GitHub.
https://github.com/Klaus2m5/6502_EhBASI ... er/patched

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 22 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: