| |
Darkus
Registered: Apr 2007 Posts: 8 |
Coding for beginners
I`ve been searching the net for assembler guides and applications but I hoping someone can recommend the best guides and programs I should use for starting out - plus are there any issues with using emulators only ? Anyone who may answer these questions, please bare in mind I know very little about the C64 platform at this stage :) |
|
... 122 posts hidden. Click here to view all posts.... |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Say you want to create a balloon and have it float around the sky. The
balloon could be designed as in the 24 by 21 grid:
SERIES |SERIES |SERIES
1 | 2 | 3
| |
1 1 1
2631 2631 2631
842684218426842184268421
+------------------------+
1 |.........#######........|
2 |.......###########......|
3 |......#############.....|
4 |......#####...#####.....|
5 |.....#####.###..####....|
6 |.....#####.###.#####....|
7 |.....#####.###..####....|
8 |......#####...#####.....|
9 |......#############.....|
R 10 |......#############.....|
O 11 |......#.#########.#.....|
W 12 |.......#.#######.#......|
13 |.......#..#####..#......|
14 |........#..###..#.......|
15 |........#..###..#.......|
16 |.........#..#..#........|
17 |.........#..#..#........|
18 |..........#####.........|
19 |..........#####.........|
20 |..........#####.........|
21 |...........###..........|
+------------------------+
1 1 2 2
1 5 0 5 0 4
COLUMN
The next step is to convert the graphic design into data the computer
can use. Get a piece of notebook or graph paper and set up a sample grid
that is 21 spaces down and 24 spaces across. Across the top write 128,
64, 32, 16, 8, 4, 2, 1, three times (as shown) for each of the 24
squares. Number down the left side of the grid 1-21 for each row. Write
the word DATA at the end of each row. Now fill in the grid with any
design or use the balloon that we have. It's easiest to outline the shape
first and then go back and fill in the grid.
Now if you think of all the squares you filled in as "ON" then
substitute a 1 for each filled square. For the one's that aren't filled
in, they're "OFF" so put a zero.
Starting on the first row, you need to convert the dots into three
separate pieces of data the computer can read. Each set of 8 squares is
equal to one piece of data called a byte in our balloon. Working from the
left, the first 8 squares are blank, or 0, so the value for that series
of numbers is 0.
The middle series looks like this (again a 1 indicates a dot, 0 is a
space):
128 64 32 16 8 4 2 1
+-----+-----+-----+-----+-----+-----+-----+-----+
| 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
+-----+-----+-----+-----+-----+-----+-----+-----+
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | |
0 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127
The third series on the first row also contains blanks, so it, too,
equals zero. Thus, the data for the first line is:
DATA 0, 127, 0
The series that make up row two are calculated like this:
+-----+-----+-----+-----+-----+-----+-----+-----+
Series 1: | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
+-----+-----+-----+-----+-----+-----+-----+-----+
1 = 1
+-----+-----+-----+-----+-----+-----+-----+-----+
Series 2: | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
+-----+-----+-----+-----+-----+-----+-----+-----+
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | |
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
+-----+-----+-----+-----+-----+-----+-----+-----+
Series 3: | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
+-----+-----+-----+-----+-----+-----+-----+-----+
^ ^
| |
128 + 64 = 192
For row 2, the data would be:
DATA 1, 255, 192
In the same way, the three series that make up each remaining row would
be converted into their decimal value. Take the time to do the remainder
of the conversion in this example.
Now that you have the data for your object, how can it be put to use?
Type in the following program and see what happens.
unlikely? lol :) you havent seen the user manual so far? you can pretty much do anything without knowing hex or binary as the above and my own example shows. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
yeah sure. that example clearly doesnt explain how to convert a binary number to decimal. ofcourse.
you really love to argue, even if there is no point AND beyond =) |
| |
T.M.R Account closed
Registered: Dec 2001 Posts: 749 |
Quote: yeah sure. that example clearly doesnt explain how to convert a binary number to decimal. ofcourse.
you really love to argue, even if there is no point AND beyond =)
It does illustrate my point though, it introduces only enough[/b] knowledge to get the job of putting a sprite, something visual, on the screen done, nothing more and it doesn't even say that it's converting binary to decimal even if that's what is actually going on.
i've always felt that the best educational texts introduce just about everything in a way that the reader can get something happening on the screen so that they get a sense of progress; the balloon example in the manual does that, the majority of readers will think "i got a sprite on the screen" rather than "i can convert binary to decimal" even if they learnt both at the same time. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
yes ofcourse, but that wasnt my point. the point is that there is NO way to convert a sprite to the data you have to poke in memory other than either looking up the numbers in a huge table - or learning to convert binary to decimal. wether you call it so, now thats a completely different question and it doesnt really matter at all. |
| |
T.M.R Account closed
Registered: Dec 2001 Posts: 749 |
i know it wasn't your point and never said that... just that your previous point about people learning hex and so forth is at odds to what i believe makes a good tutorial and the C64 manual, weak as it is generally, goes in the same direction. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Quote: yeah sure. that example clearly doesnt explain how to convert a binary number to decimal. ofcourse.
you really love to argue, even if there is no point AND beyond =)
thats exactly what YOU did in this case. after implicitly calling me a liar, instead of simply admitting you were wrong, you couldnt resist kicking into me a last one. well done. how your friends used to say? "groepaz is a good and friendly scener" yeah my ass =) |
| |
Archmage
Registered: Aug 2006 Posts: 185 |
@Burglar: yes, of course. But understanding the concept of hex and binary, which of course is mandatory when coding on the C64, differs from being able to do instant conversions off the top of your head. So my post was mainly directed at Martin Piper. Basically I just want to say that it is possible to do at least _some_ coding without being very good at maths - as in calculation - because a lot of it is conceptual. Like for instance _how_ $d016 works.
And spinning on from this with regards to the topic of this thread being "coding for beginners", how interested is the scene in seeing simple stuff like demos/intros without any fancy stuff at all? Just displaying a logo, playing music, a scroller and perhaps some sprites? After all, this is where coders begin I would think. I for one think that anything goes as long as there is serious effort behind it, but you veterans might have another view? |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
I give a shit what people do, as long as they have some kind of fun when doing it AND as long as there is at least some kind of effort put into it. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Quote: yes ofcourse, but that wasnt my point. the point is that there is NO way to convert a sprite to the data you have to poke in memory other than either looking up the numbers in a huge table - or learning to convert binary to decimal. wether you call it so, now thats a completely different question and it doesnt really matter at all.
nopes. _I_ made a point that one can make sprites and stuff without KNOWING binary or hex, which you attacked.
"you have created a sprite bitmap and calculated the right numbers to poke in memory without knowing binary?"
yes I did.
the proof is above the text from the user manual. anyone following that process will not understand or know binary numbers. (if he didnt knew them before..) he will just see a weird process with numbers, but that doesnt mean he has the slightest idea of binary numbers. |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Now, let's see... yes! LET'S SPEND THE DAY ARGUING!!! :)
|
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 - Next |