Code:
BB 6D EF 40 45 02
10 10 00 EF 07 45 0E F7
24 09 C9
I'm not seeing the problem. 2 == 02, 14 = 0E, etc...
My original code was:


Code:

EF4045
210100
EF0745
EF7249
C9
Then that's a problem with your ASCII-to-integer code, that it's ready 210100 as 2, 10, 10, 0.
Do you think to_binary() should take something like ["21","01","00"] as argument?
ScoutDavid wrote:
Do you think to_binary() should take something like ["21","01","00"] as argument?
Yeah, I think that that would be cleaner, but that still doesn't explain why your current to_binary() function is failing.
KermMartian wrote:
ScoutDavid wrote:
Do you think to_binary() should take something like ["21","01","00"] as argument?
Yeah, I think that that would be cleaner, but that still doesn't explain why your current to_binary() function is failing.


Maybe because it really takes an array as an argument? I have to try that later.

I know what the problem was: line breaks.

Code:

programData = self.inputText.GetValue().replace('\n','').replace(' ','').replace('\r','').upper()


This solved it all and creating files is now errorless and works perfectly!
You could run that same s/[^A-Fa-f0-9]+//g RegEx pattern on this to strip out the newlines, if you wanted.
KermM: I need to remove all line breaks and spaces in a ReGex for my online disassembler (if you check it, it's not working).
ScoutDavid wrote:
KermM: I need to remove all line breaks and spaces in a ReGex for my online disassembler (if you check it, it's not working).
You can still use that exact same regex pattern that I gave you. Smile It basically only keeps A-F, a-f, and 0-9. If you instead want to discard only whitespace and keep everything else, use:

s/\s+//

Code:
inputText = inputText.replace(/[^A-Fa-f0-9]+/g,'').toUpperCase();


This is not removing line breaks.

If you check davidgom.co.cc/main.html you'll see it doesn't work with line breaks Sad
Is inputText an array or a single string? If it's an array split on line breaks, you'll have to join it with empty strings.
KermMartian wrote:
Is inputText an array or a single string? If it's an array split on line breaks, you'll have to join it with empty strings.


It is a string.
It seems to me we got this all straightened out?
Yes we did =D
ScoutDavid wrote:
Yes we did =D
Very good, glad to hear it. I guess this topic has been usurped by your Online z80 Disassembler thread? Although I thought that this thread had a different purpose originally. Did you ever get your checksumming routine working?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 6 of 6
» All times are UTC - 5 Hours
 
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 vote in polls in this forum

 

Advertisement