Earlier quoted context omitted.
They didn't work like modern interpreters, which basically compile the program into bytecode and then interpret the bytecode. They would do simple very simple parsing of the program, mostly just tokenising it, and then more or less execute each Basic statement directly. (Sinclair Basic's wacky keyword-at-a-time entry system meant they didn't need to ship a tokeniser.) So: 10 LET I = 10 20 LET I = I + 1 30 GOTO 10 The…
Oh my god - that's we we had line numbers ! To reduce parse complexity - FFS!!! That's amazing. Why am I so blind?
David Horne's 1K Chess on the ZX81 (2001)
121–130 of 154 posts
Re: David Horne's 1K Chess on the ZX81 (2001)
#122Earlier quoted context omitted.
Not seeing where you're arguing that the entire-point of computers is to do tedious calculations. That the first computers were used that way, I don't doubt. But not the same thing, I'd say. The first cars were horseless carriages.
don't be pedantic
I was responding to a point above that seemed to imply that code like this can't be considered great (or at least, no greater than a Rails website), because its not what computers are for. They are for calculating things humans can't. I disagree with that. And not on a pedantic, language level. It is a genuine confusion, i think, between why something was made and what it can do.
Though on re-reading, I may have misinterpreted the OP.
Re: David Horne's 1K Chess on the ZX81 (2001)
#123Earlier quoted context omitted.
There's a rather ahistoric perspective at work here. I wonder if there's a generational thing. ZX81 chess was so impressive because it was impossible (at least, I'd have bet real money on it). It was the thing programmers namechecked as the kind of thing you couldn't do on these newfangled cheap home computers. You need a 'real' computer to do it. There's just no way. I was writing programs for the ZX81, and the kind…
I strongly recommend playing with this sort of machine. It's an utter education. It will, literally, change the way you think about programming. Also, the ZX81 had the best cover art for any programming manual EVER: http://uknet.com/gallery2/d/16341-2/076_Sinclair_ZX81_Manual... (Paintings by John Harris. He sells prints! http://www.alisoneldred.com/thumbsJohnHarris-Prints-3-1.html ) However, you will be frustrated w…
Nope.
http://globalnerdy.com/wordpress/wp-content/uploads/2007/09/...
Re: David Horne's 1K Chess on the ZX81 (2001)
#124Earlier quoted context omitted.
The 4 minute mile was amazing because of the four minutes, not because someone managed to run a mile. Amazing feats in the face of incredible constraints are inherently worthy, I'd say.
A better analogy would be 'greatest movie ever made' was so because it was done on a budget of $1000. Better analogy in context of this thread that is
Maybe making an oscar winning movie with great CGI on $1000 is more appropriate
Re: David Horne's 1K Chess on the ZX81 (2001)
#125Earlier quoted context omitted.
Just for context, your comment: 1452 bytes, well over twice the size of this chess program.
I think it's helpful to consider that this program in 672 bytes of machine code rather than source code or assembler. That helps the comparisons to English text seem a little less jarring: if my words were expressed as 8bit bytes rather than a series of byte sized chars you'd see a lot of compression in my communication. He also 'cheats' a bit by keeping part of the program on tape and never loading it into memory so…
Re: David Horne's 1K Chess on the ZX81 (2001)
#126Earlier quoted context omitted.
I strongly recommend playing with this sort of machine. It's an utter education. It will, literally, change the way you think about programming. Also, the ZX81 had the best cover art for any programming manual EVER: http://uknet.com/gallery2/d/16341-2/076_Sinclair_ZX81_Manual... (Paintings by John Harris. He sells prints! http://www.alisoneldred.com/thumbsJohnHarris-Prints-3-1.html ) However, you will be frustrated w…
> Also, the ZX81 had the best cover art for any programming manual EVER: Nope. http://globalnerdy.com/wordpress/wp-content/uploads/2007/09/...
Re: David Horne's 1K Chess on the ZX81 (2001)
#127Earlier quoted context omitted.
I can't imagine being like you, so please understand how weird it must be for me to watch someone be so dedicated to being wrong.
please understand how weird it must be for me to watch someone be so dedicated to being wrong I sympathise, I'm having very much the same experience.
Re: David Horne's 1K Chess on the ZX81 (2001)
#128Earlier quoted context omitted.
How did BASIC work with just 1k of memory? A scripting language interpreter is quite complex, not?
They didn't work like modern interpreters, which basically compile the program into bytecode and then interpret the bytecode. They would do simple very simple parsing of the program, mostly just tokenising it, and then more or less execute each Basic statement directly. (Sinclair Basic's wacky keyword-at-a-time entry system meant they didn't need to ship a tokeniser.) So: 10 LET I = 10 20 LET I = I + 1 30 GOTO 10 The…
I expected that Sinclair Basic would have a rule that variable names have one significant character, and reserved space for 26 integers A% through Z%, 26 strings A$ through Z$, and forget about floating point, but reading http://www.worldofspectrum.org/ZX81BasicProgramming/chap06.h..., that isn't true; this language even allowed spaces in identifiers.
At the same time, we have (same link):
"You will get a report 2/0, & looking up 2 in appendix B, you will see that it means 'variable not found',
So. This enormous 8kB ROM wasn't large enough to hold error messages.
And, reading http://www.cs.columbia.edu/~%20sedwards/classes/2006/w4115-f..., it seems that loop and stir g variables had to be single-letter (yes, your program had at most 26 strings. Not that much of a limit if you have a few hundred bytes of RAM for your program and your data)
That PDF also gives some more limitations of the language, claiming that it wouldn't do complex expressions such as
10 let a = 2 * a + 1Re: David Horne's 1K Chess on the ZX81 (2001)
#129Earlier quoted context omitted.
In a way you're right, the executable is definitely within bounds and if that is your definition of the program, it's small enough. If you count resources that are necessary to make the program run, however, you'd use a different metric.
What do you mean? The program really plays chess against the user by running in the 1K RAM of the computer that is designed to spend 768 bytes of the said 1K just for the screen content. http://en.wikipedia.org/wiki/ZX81 24 lines of 32 characters. 768 bytes usually cleared and scrolled away as you type. The user just has to load the cassette and play. Even if the program was developed on the Cray (it was not) everyth…
No, it was designed to use up to 793 bytes (those 768 plus one byte for every line plus, it seems, one extra 'end of screen' byte) for the screen buffer. If you didn't write stuff, the size of the screen buffer was way smaller, down to 25 bytes for an empty screen (http://problemkaputt.de/zxdocs.htm#zx80zx81videomodetextandb...)
Also note that the main CPU drew the video from an interrupt handler. That's why one had fast and slow mode; fast mode disabled that interrupt, speeding up your program, but losing the screen display. I think it also means that one should interpret the expression 'halt instruction' as used in the description of the contents of video memory literally.
I also found this nugget in a disassembly listing:
"and although each interrupt interrupts the previous one, there are no stack problems as the 'return address' is discarded each time."
Re: David Horne's 1K Chess on the ZX81 (2001)
#130Earlier quoted context omitted.
don't be pedantic
I wasn't trying to be. I wasn't saying "yeah, but 'entire point' strictly means... fnar fnar". I was responding to a point above that seemed to imply that code like this can't be considered great (or at least, no greater than a Rails website), because its not what computers are for. They are for calculating things humans can't. I disagree with that. And not on a pedantic, language level. It is a genuine confusion, i…