[Phys-L] hardware, software, and counting
- From: John Denker <jsd@av8n.com>
- Date: Mon, 01 Sep 2014 22:54:50 -0700
On 09/01/2014 03:15 PM, Bernard Cleyet wrote:
> **More correctly, I suspect the “machine commands” were in the
> "wiring”.
Wiring is a lower level, lower even than machine code.
I've built computers from scratch, doing the wiring by
hand. I've also hacked the wiring on factory-built
computers ... even fairly recently.
> I’m from an older time. Machine was the lowest level.
>
> bc used machine w/ a PDP-8 **
I've programmed PDP-8s and PDP-10s in machine code. I
wrote in assembly language but compiled it by hand and
toggled the bits into the machine.
I've also disassembled many tens of thousands of lines
of machine code.
I did my share of that. Got paid for it, too. You
wanna know what I did with the money? I hired the
smartest guy in town and paid him to write a high-
level compiler, so I wouldn't have to write assembly
code any more (except for special occasions).
This supports the point I was making: I do *not*
recommend students start by building their own
hardware, or by reading or writing machine code,
or even writing low-level javascript. Folks should
start by learning the /concepts/ of a high-level
language. After they understand the concepts, they
can (maybe) discipline themselves to implement a
sound design in terms of lower-level resources.
If they started at the bottom, they would have to
re-invent 50 years of computer engineering, which
is unlikely to be a good use of their time.
Modern machines are designed to be compiler-friendly.
They are not meant to be hand-coded. The chance that
you can write machine code by hand that works better
than compiler-generated code is reeeally small.
At the very least, this requires extraordinarily
specialized skills. It is far removed from physics,
especially introductory-level physics.
===========================
Separate topic: Since people seem to be somewhat
interested in the countdown program: There is actually
one slightly tricky/interesting thing in the otherwise
straightforward code.
Taking the negative of a number does /not/ commute with
truncating insignificant trailing digits. This creates
a conceptual problem if you wanted to have a countdown
timer with fractional-second resolution. I've never
seen such a thing, and I reckon people would be very
likely to misinterpret it.
I quote from the comments in the current version of
https://www.av8n.com/computer/countdown.html
Post-launch, the display "00:07"
indicates 7 /or more/ seconds elapsed. This is the result you
would naturally get by truncating a more-detailed representation
such as 7.777. Pre-launch, the same display ("00:07") indicates 7
/or less/ seconds remaining. Alas, this is *not* the result you
would get by truncating a more-detailed representation such as
6.543. The post-launch case is easy, but we need to look closely
at the pre-launch case.
Pre-launch, during most of the interval in question, the time is
"minus 6 point something". That is, "7" is displayed during the
interval {-6.5 ± .5}. That gets you into trouble if you try to
display any resolution beyond the decimal point, e.g. -6.543 or
something like that. You cannot format the time as a decimal
fraction and then look only at the part in front of the decimal
point. Instead you have to start by taking the floor() of the
number, so that -6.543 becomes -7, and then display that. Any
sub-second resolution is lost.
For additional details, read the source.
==========================
Note that I have been using the word "concept" to refer to deep,
important, useful concepts. A discussion about the meaning of
numerals and numbers seems kinda deep IMHO. I mention this
because it offends me to see that the term "conceptual physics"
has become a synonym for "bonehead physics" -- more-or-less
devoid of anything I would recognize as physics concepts.