Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 3050

programming • Re: Parsing web address (http(s)://) in 6502 getting extra /

$
0
0
Hi Greg thanks for the ideas
Being sensitive to the last character of the link suggests that the bug occurs only when the end of the link is reached, so I'm ignoring calls to HyperlinkDIRAddSlash coming from HyperlinkFollowMatch, for the moment.
The bug occurs when a hyperlink is selected that contains either a full URL www.website.com/about or a relative URL with a / eg /about. If the local URL is just about.html this is fine and a / added i.e. /about.html. For the full URL hyperlinks they need to be split in to the domain and directory for telnet, e.g. [www.website.com] and [/about]. As relative links do not contain the domain, the current stored domain is retained and just the directory is updated (working fine). So the bug is occurring after the domain has been separated from the full url at the start of placing the directory in to the directory address space.
Then it jumps to HyperlinkFollowMatchDIRZero where Y is reset to zero. X still points to a slash in urlstorage. The branch is not taken and it jumps to HyperlinkFollowMatchDIR.
Yes Y is reset to zero because here it is now starting to load in to the directory address space starting at 0, rather than continuing from the address address space (i.e. dir,Y instead of address, Y). If the URL was a full URL (including domain) then the first character of dir,Y should be the / from urlstorage,X.
There it reads urlstorage,X again and compares with 2. This isn't the ASCII code for a slash so we fall through to this line:

Code:

  STA dir,Y;If not store the current character from urlstorage in the directory string
2 is used as the terminator for the URL so it is searching for the end of the url, not the next / as it has already detected the first / as the end of the domain. For example www.example.com/pictures/of/cats needs to be split in to [www.example.com] and [/pictures/of/cats] so searching for the next / isn't what I'd want to do instead I'm searching for the URL terminator which is 2 if it is not the end of the URL it should continue storing urlstorage,X into dir,Y...until it encounters 2 in urlstorage,X ...as the URL is stored in urlstorage as 1 (start of a URL) A (hyperlink label A-z) www.example.com/pictures/of/cats 2 (Not the number 2, but the value 2 to signify the end of the link).

If that make sense?

I've tried a dirty hack of adding a INX to get past the / before loading the directory from the urlstorage in to the directory space

Code:

.HyperlinkFollowMatchDIRZero  LDY #0  LDA urlstorage,X  CMP #47  BNE HyperlinkDIRAddSlash  INX  JMP HyperlinkFollowMatchDIR   
But then as expected instead of /pictures/of/cats I get pictures/of/cats and when I take the hack out it goes back to //pictures/of/cats

It's almost as if the Beeb wasn't designed to have a web browser :lol:

Statistics: Posted by vela025 — Fri Apr 25, 2025 7:13 pm



Viewing all articles
Browse latest Browse all 3050

Trending Articles