Hah, great vision, it is indeed Notepad++, which I love.

I am now using XVI32 to 'try' to learn:

http://a.imageshack.us/img691/5035/makessensehex.png

Kerm, I'm having some succes with spaces after Disp's and Prompt's now:

http://codepad.org/hbfKpDRb
Better, but you're still creating literal strings containing the textual representation of the nibbles and bytes instead of a byte-based structure. Sad
KermMartian wrote:
Better, but you're still creating literal strings containing the textual representation of the nibbles and bytes instead of a byte-based structure. Sad


So, I should not be using $DE and $DD?
ScoutDavid wrote:
KermMartian wrote:
Better, but you're still creating literal strings containing the textual representation of the nibbles and bytes instead of a byte-based structure. Sad


So, I should not be using $DE and $DD?
No, you need the byte values $DE and $DD, not the literal strings "$DD" and "$DE".

Code:

buf = bytearray()
# ... do some stuff, find some tokens, whatever
buf.append(0xde)


This, right?
ScoutDavid wrote:

Code:

buf = bytearray()
# ... do some stuff, find some tokens, whatever
buf.append(0xde)


This, right?
Now you're talking.
KermMartian wrote:
Ouch, I didn't even notice that he had done that; thanks Kllrnohj. While we're on the subject, I find Python's handling of byte arrays and related byte-based structure handling way, way more awkward than it needs to be, and writing a script that works properly on both 2.7 and 3.x (namely BinPac8x) is an exercise in migraines.


Well it isn't really designed to, lol. Also, 3.0 was a breaking release, you shouldn't be trying to bridge 2.x and 3.x with a single script.

But bytes in python isn't too hard, it just isn't as nice as the rest of python. It also helps if you understand the difference between a byte and a string, which ScoutDavid doesn't seem to...
Yeah, I'm sure he'll get it eventually though. And I can certainly appreciate that you're not supposed to bridge 2.x and 3.x in a single script; it's quite a painful trial-and-error process in some cases.
i USE 2.6 and I think Python 3 is just stupid, I don't agree with some of the updates, and if I ever release a txt to 8xp, I'll make it an .exe so that the source is not stolen as easily and people don't need python 2.x.

Now, I know what a string is, example : "$DD".

I know a byte is not a string, but I don't know how to make a byte =P, now that I google it, it starts making more sense, but I don't have much free time atmoment.
Basically a string is made up of characters; $DD is three characters. The dollar sign is a character (0x24, as it happens) and each D is a character (0x44, if anyone's interested). Therefore, the string "$DD" is the three-byte sequence 0x24, 0x44, 0x44. That's not what you want. You want sequences of the single bytes $DD and $DE (an others), aka 0xDD and 0xDE and others.
http://codepad.org/GJ33uxPt

In my PC it works, the Python in codepad.org is just not mine.

Like it?
ScoutDavid wrote:
http://codepad.org/GJ33uxPt

In my PC it works, the Python in codepad.org is just not mine.

Like it?
Looks like you need to import the bytearray (or byte?) package; I'll have to look up what package it is. Also:


Code:
for i in tokens:
 if (i == disp):
  finaltext += "$DE"
  buf.append(0xde)
 if (i == prompt):
  finaltext += "$DD"
  buf.append(0xdd)


Why are you still creating finaltext? There's really no purpose unless you want to see a textual representation of what's in the bytearray, and you could still generate that at the end by iterating over the bytearray.
Finaltext variable is for testing purposes xD


I don't need to import it, codepad.org python is an older version, probably.

I use 2.6.

ANYWAYS, all left is add all tokens and a header and a checksum Smile
ScoutDavid wrote:
ANYWAYS, all left is add all tokens and a header and a checksum Smile
Well no, because you're still doing token delimiting based on spaces. How would your code tokenize 3X+2?
'3X+2' I'll have to create tokens for 3, x and 2. Be right back.
ScoutDavid wrote:
'3X+2' I'll have to create tokens for 3, x and 2. Be right back.
OK, but my point is that your separation code separates tokens based on spaces. There's no spaces there, so your current code will think "3X+2" is a single token, correct?
No, I think it checks for spaces when there are spaces, I'll try that, if that doesn't work, I gotta make a better way to get tokens :s

I tried submatching, with no luck, though.
ScoutDavid wrote:
No, I think it checks for spaces when there are spaces, I'll try that, if that doesn't work, I gotta make a better way to get tokens :s

I tried submatching, with no luck, though.
Can you show me the submatching code that you tried and that failed so I can give it a critique? Or do you no longer have it?
If I manage to redo it, I will.

Token for +, -, * and /??

http://omnimaga.pastebin.com/raw.php?i=3KQ3PRFe

I can't seem to find it :s
Are you asking me what the tokens for those four mathematical operators are?


Code:
tAdd            EQU       70h         ; 70h '+'
tSub            EQU       71h         ; 71h '-'
tMul            EQU       82h         ; 82h  '*'
tDiv            EQU       83h         ; 83h  '/'
  
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
» Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
» View previous topic :: View next topic  
Page 2 of 8
» 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