6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat May 04, 2024 8:20 am

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Tue Jun 10, 2014 8:11 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8430
Location: Southern California
Quote:
GARTHWILSON wrote:
FWIW, my assembler does not need a separate vocabulary.

I would really like to see it. Is it somewhere online?

Not yet. It's a small part of all the material that would triple the size of my website if time were no object. The sub-Reader's Digest version is that you have all these words like LDA#, LDA_abs, LDA_ZP,X, etc. which lay down the op code, then you comma-in the operand, so it's the normal order (mnemonic before operand) but there's no parsing required. These are not immediate words, so you can easily form macros with them. There's no conflict with similar words like AND, because you always put the addressing mode on the assembly one, like AND#, so it won't be confused with Forth's AND. Branching is only slightly more complicated, but it does not lend itself to assembling whole applications, only things like primitives, ISRs, and runtimes, which is really all you need if you have Forth running. As they say, "A little assembly goes a long way." The assembler initially took me an evening to write, then later I improved the branching stuff, and I have ideas to further improve it when I get around to it.

_________________
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: Tue Jun 10, 2014 8:56 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8430
Location: Southern California
barrym95838 wrote:
GARTHWILSON wrote:
... and it was over 100 lines for one word. Looking at it though, I couldn't really see any way to factor it and give the factors meaningful names that were any shorter or more descriptive than the code and comments in it. You would have ended up with code that was more unreadable, and more inefficient because of calling all these single-use "subroutines". I seem to remember it had a giant CASE statement that was very clear. I seem to remember Chuck Moore doesn't like CASE statements. Jump tables are good if the input numbers are consecutive and without big gaps; but that's not always the situation.

Global optimization is an inexact science, and you were probably correct that the word in question was optimal. The question I would ask: "If you step way back and look at the entire picture, is there a clever way to avoid having to code that particular word in the first place?"

Sometimes the answer is yes; but there have been times that I've seen someone advocate for something simpler when clearly they didn't realize why their solution would not work. (This was usually in circuits, not software, but the principle still applies.) After much time spent to try to communicate it, the light finally goes on, and they realize why it won't work. Other times, I could not convince them. That's usually the boss, so instead of arguing, I built up something the way he was so sure would work, and demonstrated it, and then he goes away scratching his head, muttering something about, "I don't understand it. I was so sure it would work!" (and his respect for his engineers increases.) Other times, it was the other way around, and I went through with it to prove it does work.

Attachment:
Dilbert1.jpg
Dilbert1.jpg [ 55.1 KiB | Viewed 1019 times ]

Anyway, although shorter code is usually clearer and more efficient, that's not always the situation. In the case of factoring carried too far, the code is not actually shorter, just more chopped up, and may require a lot of looking up of what the ingredients do to figure it out.

Quote:
It reminds me of a joke that I heard on the radio years ago that still makes me laugh. An astronaut and a cosmonaut were talking at a bar over a couple of drinks, and the astronaut pulled out a fancy ink pen that could survive extreme cold and heat, and write upside down and in zero G. He bragged about how NASA had spent hundreds of thousands of dollars developing it and the ink that it used, and that it was an example of what was possible in the 'free' world. The cosmonaut instantly recognized this dig at his country, but had a perfect reply: "On Soyuz, we use pencil."

You can see where my analogy is clumsily headed, right? Is the routine you mentioned the 'INK' for the pen?

I agree, although I will also comment that in a place I worked in the mid-1980's, I sometimes had to go into the cleanroom where they did the wafer fab, and everything had to be lint-free and dust-free; so you had to wear special clothes, use special lint-free paper, and so on. A pencil which would produce graphite dust was definitely out, but a common pen would be fine. (I'm sure a normal pencil would have been fine in the spacecraft though.)

_________________
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: Wed Jun 11, 2014 1:00 pm 
Offline

Joined: Tue Jan 07, 2014 8:40 am
Posts: 91
Actually, pencils were undesirable in spacecraft because of that graphite dust, and also broken tips which would float around in zero-G. Also, graphite and wood are flammable. It turns out that NASA didn't fund the Space Pen development; that was a private initiative on the part of the Fisher Pen Co. Fisher then sent some samples of the pen to NASA, and NASA adopted it. http://www.snopes.com/business/genius/spacepen.asp

We now return you to your regularly scheduled topic...

_________________
Because there are never enough Forth implementations: http://www.camelforth.com


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 11, 2014 8:55 pm 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 672
Also, from what I heard, they tend to use grease pencils in space, because of the aforementioned graphite dust & broken tip problems.

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


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

All times are UTC


Who is online

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