Half Way Through Jim Butterfield's Book, What Next?
-
DerTrueForce
- Posts: 483
- Joined: 04 Jun 2016
- Location: Australia
Re: Half Way Through Jim Butterfield's Book, What Next?
Dr Jefyll wrote:
... Do you think maybe we're subconsciously just thrill seekers ? After all, premature optimization is fun -- and it's kinda exciting when things blow up. The alternative is so boring. The stuff just works. Unless some darn grue comes along and eats zero page, I mean. 
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Half Way Through Jim Butterfield's Book, What Next?
For many situations, I find my programs are more likely to work right the first time and less likely to show up bugs later if I take the time to optimize first and make it as short and clear as reasonably possible. When I've taken the attitude of "Just get it working," often those are the times I've ended up having to re-write it.
An hour-long video about the Oberon language has a couple of quotes I really liked (at around 36 minutes into in, give or take):
An hour-long video about the Oberon language has a couple of quotes I really liked (at around 36 minutes into in, give or take):
- Programs must not be regarded as code for computers, but as literature for humans.
- Reducing size and complexity is the triumph.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Half Way Through Jim Butterfield's Book, What Next?
BigDumbDinosaur wrote:
I see writing software, especially at the bare metal level, to be more like composing music.
In this context, not so much that writing was like composing music, but more that music doesn't sound like anything when written on a page, you have to hear it. Similarly, especially for end users, getting them involved early in the development process lets them see and feel what the system is doing, vs just getting a spec (however detailed), crunching on it, and delivering in 6 months a system that does exactly what they asked for, but not what they wanted.
Similarly, it reminds me of this quote from Amadeus:
Quote:
Emperor Joseph II: My dear young man, don't take it too hard. Your work is ingenious. It's quality work. And there are simply too many notes, that's all. Just cut a few and it will be perfect.
Wolfgang Amadeus Mozart: Which few did you have in mind, Majesty?
Wolfgang Amadeus Mozart: Which few did you have in mind, Majesty?
Re: Half Way Through Jim Butterfield's Book, What Next?
barrym95838 wrote:
I learned with Scanlon's "6502 Software Design" ISBN 0672216566 and the Apple ][+ built-in machine language monitor "CALL-151". My ][+ is gone (whereabouts unknown), but I still very much enjoy using the emulators. My book is still with me, but I no longer grab it first to look something up, because it's precariously held together by a vintage Apple black paper textbook cover, since the binding disintegrated many years ago from many hundreds of uses.
Re: Half Way Through Jim Butterfield's Book, What Next?
whartung wrote:
This isn't necessarily hard with a decent start using a tracing disassembler.
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Half Way Through Jim Butterfield's Book, What Next?
This topic might be helpful: Looking for a disassembler and suitable assembler
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Half Way Through Jim Butterfield's Book, What Next?
GARTHWILSON wrote:
This topic might be helpful: Looking for a disassembler and suitable assembler
-
White Flame
- Posts: 704
- Joined: 24 Jul 2012
Re: Half Way Through Jim Butterfield's Book, What Next?
load81 wrote:
How is a tracing disassembler different from an ordinary disassembler? Is there a good open source Linux friendly tracing disassassembler that is ideal for my use case with the C64?
Re: Half Way Through Jim Butterfield's Book, What Next?
In essence, a tracing disassembler uses known entry points to the code to search out which parts of the binary contain actual instructions, and which are just embedded data, following branches and jumps and subroutine calls. An ordinary disassembler just starts at the beginning and tries to guess, byte by byte, whether it's looking at a real instruction or not.
Neither type is perfect, but I think tracing disassemblers are potentially much more useful when used correctly. I've had good results with White Flame's interactive one, though it's annoying that it only supports displaying PETSCII text, rather than also supporting the far more common ASCII.
I've found two major sticking points with tracing disassemblers. One is indirect jumps through dynamically determined addresses, which the tracer can't follow; in that case you have to manually determine which addresses can be jumped to, and make sure a trace begins from each one. The other is subroutines and BRK handlers which alter the return address before the corresponding RTS or RTI, for example to use inline data placed immediately after the call. BBC BASIC uses BRK in this way as an exception mechanism to report errors, and encourages machine-code routines for the BBC Micro to do the same. I've seen JSR used similarly, possibly inspired by that, but the trace continues past the JSR and has to be manually corrected to skip over the inline data.
The reason for these limitations is that the tracer doesn't actually execute the code; it just determines the length of each instruction, identifies which ones are branches, and uses those to decide where to begin new traces and halt existing ones. This is enough to correctly trace "conventionally written" code without any indirect jumps in it, but can't use any information about the dynamic contents of RAM.
Neither type is perfect, but I think tracing disassemblers are potentially much more useful when used correctly. I've had good results with White Flame's interactive one, though it's annoying that it only supports displaying PETSCII text, rather than also supporting the far more common ASCII.
I've found two major sticking points with tracing disassemblers. One is indirect jumps through dynamically determined addresses, which the tracer can't follow; in that case you have to manually determine which addresses can be jumped to, and make sure a trace begins from each one. The other is subroutines and BRK handlers which alter the return address before the corresponding RTS or RTI, for example to use inline data placed immediately after the call. BBC BASIC uses BRK in this way as an exception mechanism to report errors, and encourages machine-code routines for the BBC Micro to do the same. I've seen JSR used similarly, possibly inspired by that, but the trace continues past the JSR and has to be manually corrected to skip over the inline data.
The reason for these limitations is that the tracer doesn't actually execute the code; it just determines the length of each instruction, identifies which ones are branches, and uses those to decide where to begin new traces and halt existing ones. This is enough to correctly trace "conventionally written" code without any indirect jumps in it, but can't use any information about the dynamic contents of RAM.
Re: Half Way Through Jim Butterfield's Book, What Next?
barrym95838 wrote:
I learned with Scanlon's "6502 Software Design" ISBN 0672216566
Both books have been with me since 1981. That seems like a very long time ago.
Bill
Re: Half Way Through Jim Butterfield's Book, What Next?
drogon wrote:
BigDumbDinosaur wrote:
All I see is blonde, brunette, red-head ...
Bill
Re: Half Way Through Jim Butterfield's Book, What Next?
It's not a virus - it's a worm!
Re: Half Way Through Jim Butterfield's Book, What Next?
On a slightly more serious note than my last post here..
I learned about the 6502 from "The Red Book" - aka the 1978 Apple II Reference Manual. I still have that - it's worn, torn and held together with tape... I also have the Synertek Programming manual. Those and nothing more than a CALL -151 and I was off... (I even used the Apple Mini-Assembler too; F666G)
I latterly bought the Wozpac II - hard to get in the UK in those days and I really don't recall how I managed to pay for it in US$ from the UK either - I suspect my bank charged me an arm and a leg for it, as they do today (so nothing changes there) I also had at about the same time The Rockwell R6500 Hardware Manual (although the binding glue is brittle in that one - interesting to open it at the breaks - the 6522 is prominent!
These books aren't really programming manuals though, although I did learn a lot from the assembly listing the the Red book and my early experiments were all to do with making some sound effects on the Apple II speaker from assembly code.
For the OP - I'd dive in and write some code. Just do it, play with it, see what happens and have some fun, then you can go back to the disassembly and see how you might do that in your code or style - everyone is different
-Gordon
I learned about the 6502 from "The Red Book" - aka the 1978 Apple II Reference Manual. I still have that - it's worn, torn and held together with tape... I also have the Synertek Programming manual. Those and nothing more than a CALL -151 and I was off... (I even used the Apple Mini-Assembler too; F666G)
I latterly bought the Wozpac II - hard to get in the UK in those days and I really don't recall how I managed to pay for it in US$ from the UK either - I suspect my bank charged me an arm and a leg for it, as they do today (so nothing changes there) I also had at about the same time The Rockwell R6500 Hardware Manual (although the binding glue is brittle in that one - interesting to open it at the breaks - the 6522 is prominent!
These books aren't really programming manuals though, although I did learn a lot from the assembly listing the the Red book and my early experiments were all to do with making some sound effects on the Apple II speaker from assembly code.
For the OP - I'd dive in and write some code. Just do it, play with it, see what happens and have some fun, then you can go back to the disassembly and see how you might do that in your code or style - everyone is different
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Half Way Through Jim Butterfield's Book, What Next?
At least you guys had reference manuals to work with. When I started with the 6502, manuals had yet to be written. I worked off typewritten notes gotten from MOS Technology.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Half Way Through Jim Butterfield's Book, What Next?
I think learning by doing is the best way for most people, it's a question of how much support you get, how much confidence you have, and how much effort it then takes.