Debunking Drawing the line – part 4
In this post, I finally manage to reach what you might call “The Holy Grail” of actually drawing lines from one corner to the opposite corner of the C64 hires graphics screen! There has been a long interval since the previous post https://commodore64crap.wordpress.com/2013/10/18/drawing-the-line-part-3/ in this series. This is because I couldn’t work out how to do it for myself, so the program shown here has been adapted from a listing in the “Home Computer Advanced Course”, which I found in a private club library.
It’s never sensible to use other people’s code when you don’t understand it yourself dear reader… and calling it a “Holy Grail” is overselling the importance of being able to type in someone else’s publicly available listing by a huge distance!
I’m actually typing this in a public library, so this will probably affect the quality of my post.
There doesn’t seem to be any discernable lowering in quality, but it’s hard to tell considering how poor all of the author’s previous posts have been.
Of course, the point of this is to create graphics by programming, not just by using a graphics editor package. This is for a few different reasons…
- Almost every other computer already on sale when the C64 came out could do this easily
Of course this is a false argument dear reader; anybody doing something more than merely drawing a few lines on the screen with those other computers were using a graphics editor of some variety. We demonstrated that previously when the author brought up Spectrum artist David Thorpe, claiming that he “often programmed his screens using coordinates and in BASIC” despite the provided source being a video where said artist mentioned using Melbourne Draw.
- To save RAM
This is also a false argument; the BASIC program to create the image and the screen memory itself both take space away from the computer whilst an image created in a utility merely occupies the screen memory so is the more efficient approach. In BASIC terms, on the C64 it’s also possible to store a pre-drawn image in a place where it doesn’t take memory away from the program as well making that option better still.
Far more importantly, for practical purposes it’s far more efficient to use character-based display modes since they take less than half of the memory and, again, can be placed outside of BASIC RAM entirely.
- Not many people buying the Commodore 64 in the early days would have known it wasn’t straightforward doing this
And in 1982, very few people had any kind of expectation when purchasing a computer as well; some of the machines before the C64 had bespoke commands for drawing to bitmap but others didn’t. Sensible people did their research and, if that particular function was something they actually required, purchased accordingly.
- There were lots of books available exploring how to program graphics on the Commodore 64, indicating that there was a demand for it
There are similar numbers of books for every popular computer including the ones with bespoke BASIC commands for graphics. Again, a false argument because the C64 wasn’t alone in having that demand. On the topic of programming books, publishers Usborne have recently made PDF versions of their 1980s programming books for children available which the author might want to consider, although some may be rather advanced for him.
- If you can understand how to do this, then it could lead you to do anything at all on computers
Note the use of the words “it could lead you” (your correspondent’s emphasis) there dear reader because the author is at this point guessing without having any practical experience. And no, understanding how to draw lines doesn’t lead to a wider understanding in the way the author suggests it might and his own lack of understanding demonstrates this quite clearly.
Obviously, [your correspondent has] totally lost the plot, because my blog is all about “Why the Commodore 64’s BASIC V2 was crap and how some people managed to program the Commodore 64”, which was updated from the original “Why the Commodore 64’s 30th Anniversary is Nothing To Celebrate”. Obviously, making posts about existing Atari 8 bit demos, as well as how to program a new version of these demos from scratch in 6502 Machine Code/Assembly Language has absolutely nothing at all to do with the Commodore 64 being crap or not.
There have always been questions about your correspondent’s grip on the plot over the years with many of them being raised by your correspondent himself, but the author has always been in a far worse situation because he apparently can’t understand that, whilst his own blog might ostensibly have that topic, your correspondent has never been bound to the same restrictions. Anything interesting is fair game regardless of how tangential and, even if that weren’t the case, since the author has talked about other systems (which is, again, nothing to do with his declared topic so that’s another point on the Blatant-Hypocrisy-O-Meter) there’s nothing to stop your correspondent amusing himself with programs for those platforms since it in part demonstrates his own practical knowledge. something the author can’t claim to have.
All it shows is that the Atari 8 bit computers are amazing, with a lot more than 16 colours, but not how people managed to learn programming on the Atari 8 bit computers.
No dear reader, what it demonstrates is that the knowledge your correspondent picked up whilst learning to program on the VIC 20 in Commodore BASIC V2 and later in assembly language on the C64 can be applied to other computers like the Atari 8-bit, debunking previous claims about the one machine being significantly harder to learn than another. The author’s uneducated opinion is quite irrelevant since he has yet to become anywhere near proficient enough with the Atari 8-bit to understand what’s happening in what are almost embarassingly simple pieces of code.
The way that people would have learnt to program on Atari 8 bit computers is by starting out programming in a high level language, probably the standard Atari BASIC, which was usually supplied with those computers and was considered to be the standard programming language for them.
No dear reader, the author has been told by a couple of Atarians in the past that they started by directly learning assembly language so this is only true for some people. And since Turbo-BASIC XL has proved just as popular if not more so with Atari 8-bit users working in BASIC, there will be many whose programming started with the kind of BASIC extension that the author writes off on the C64.
And remember dear reader, learning to program doesn’t stop at BASIC.
This contains some kind of description that the C64 hires graphics screen is 320×200 pixels, divided into character cells of 8×8 pixels, it can display only 16 colours, but only two of those colours can be contained in each 8×8 character cell, one as foreground and one as background colour. This is the way it was designed, regardless of any tricks done by demo makers and games designers years later.
This is only true for the high resolution bitmap mode of course, different rules apply to other display modes. And the hypocrisy of the author complaining thus about tricks from demo or game coders when he was previously the one bringing the subject of circumventing these restrictions up when mentioning that he had spoken with a “former Spectrum user who said something like he tried to or actually did overcome the Spectrum attribute colour bleed” is substantial dear reader.
The whole thing is done by some mathematical equations, including division and multiplication. So there you go! How could people who aren’t good at maths make up equations or formulae like these? The answer is that they couldn’t, so f**k you Jack Tramiel!!!!
Your correspondent won’t delve into the entire listing dear reader and the author apparently doesn’t understand how it functions anyway, but it should be obvious to anybody over the age of twelve that the equations being performed aren’t difficult and that the author is merely trotting out his tired little “no good at maths” mantra repeatedly because he isn’t willing to put the effort or research in to properly understand what’s going on. He similarly doesn’t seem to grasp some standard BASIC keywords despite having spent several years “educating” people on why some dialects of BASIC are, in his blinkered personal view, better than others.
Having calculated in the previous line 450 that VB is an integer arrived at by dividing Y by 8, why would you then want to multiply it by 320?!
Because it’s working out where in screen memory the line is; the C64, like almost every other 8-bit, doesn’t have a linear bitmap so, whilst the specific calculation varies, a similar calculation is needed for other 8-bit systems such as the Apple II, Amstrad CPC or Sinclair Spectrum once a programmer moves away from merely drawing lines and wants instead to plot their own moving objects.
This demonstrates your correspondent’s point about BASIC commands such as LINE or PLOT; they’re all very well if you don’t plan on doing much more than drawing lines or plotting points but obfuscate the actual workings of the computer from would-be programmers.
A lot of people out there are probably thinking now that I should shut up and be satisfied creating artwork or music which they could use in a C64 demo, then be grateful to see my name mentioned in some demos as having created the graphics or the music, but I refuse to do this!
The author has shown no discernable talent in those fields previously, so why start now dear reader?
With the wealth of talent out there already and constantly churning out new work it would be difficult for the author as an unestablished player to find someone to work with, although it’s remarkably tempting for your correspondent to offer his own services for comedic effect at this juncture since he’s been known to code as a freelancer in the past.
Apart from this, I have no real idea how it works, because I’m not good at maths! My response to this is that where LT=Leonard Tramiel…
485 POKE LT,PEEK(LT) OR 85
I hope this makes Leonard Tramiel’s body phase out, like “The Traveler” in Star Trek: The Next Generation Season 1 Episode “Where No One Has Gone Before”, but I hope he stays like that!
OR doesn’t clear previously set bits within a byte so the contents will either be unaffected or added to; essentially, Leonard Tramiel will either remain the same or gain mass. The author is apparently too concerned with shoehorning in pointless and irrelevant science fiction references to let trivial things like actual logic get in the way.
This is because I’m not good at maths. If a nasty maths teacher like “Mr Wells” had said something to me in a classroom such as “Isn’t THAT it, laddie?” or “Now do you understand?”, or “I hope you’ve got it now”, then I would immediately have said “Yes”, “Oh, I SEE!”, or “Yes, I understand now”, so that I wouldn’t have had to stay in for half an hour after class staring at a page of problems. After that, I would’ve gone home and got my Dad to explain it to me, before forgetting how to do it a few weeks or months later, after this knowledge was deleted from my brain by some later maths techniques I was forced to study.
It’s not the fault of “Mr Wells”, the Tramiel family, the author’s father or indeed the C64 that the author is mathematically challenged in this way. And this is of course completely irrelevant to the author’s supposed topic of “why the Commodore 64’s BASIC V2 was crap and how some people managed to program the Commodore 64” and, if he’s planning on arrogantly complaining that your correspondent heads off at tangents, he should perhaps try sticking to it himself.
60 FOR I=1020 TO 2023:POKE I,10:NEXT I
This line has a mistake dear reader; the loop should start at 1024 because that’s the first byte of where the colour is being fetched from sits in memory. In this case locations 1020 to 1023 are safe enough since they’re unused, but writing to bytes that don’t need to be altered like this is bad practise.
There are 256 colour combinations, due to having 16 foreground colours and 16 background colours, and 16×16=256, although some of these would appear to be invisible. I’m not sure how many of the combinations would be invisible, because I’m useless at maths, but I’ll make a guess that it would be 16.
The only combinations with issues are where both foreground and background are set to the same value so that can only happen sixteen times; that really isn’t rocket science, dear reader.
That’s all for now! In the near future I plan to do another post in the series “Oh That Would Be VERY Difficult!”
So we’re apparently going to be “treated” to yet another post with absolutely no relevance to the author’s supposed topic of “why the Commodore 64’s BASIC V2 was crap and how some people managed to program the Commodore 64” dear reader, despite his unfounded and hypocritical complaints about your correspondent earlier in the same post. We shall of course look forward to the pointlessness as and when it happens.
 It’s a very literal command; if a specific bit in the original number OR the one being combined with it is set, the bit in the result will also be set.