| |
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.... |
| |
Conjuror
Registered: Aug 2004 Posts: 168 |
Quote: Being able to mentally convert bases, especially decimal to binary or hex, is very useful while coding low level languages. I've been disappointed by the number of times I've interviewed job applicants for programming positions and found they couldn't convert the hex numbers in programming tests or understand the concept of bit masks.
I think thats a bit harsh. Ok I can do it (sometimes), but don't need it in my every day job. (Java Developer.)
Maybe it shows a mind set or an extra interest in how computers work, so is a bonus.
My maths generally is not that good, but rarely do I need it at work. Recently I had to do coding to calculate the decay of radionuclides which wasn't too bad but calculating expiry dates was tricker. I had to reverse calculations which were exponential using logarithms. Didn't have a clue, but have friends with the knowledge so still managed to give the client what they needed.
Steve
Conjuror/TF |
| |
Sander
Registered: Jan 2002 Posts: 496 |
Hehe, though i'm not a coder... i had a similar experience.
In primairy school, the teacher and the kids were in awe when i had to double the numbers and said these numbers in a row without a second of thought: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048. (ok, mine ended just there.. soz i became pikseler) |
| |
Archmage
Registered: Aug 2006 Posts: 185 |
I'm with Sander on this one. Still I am convinced that it is possible to do some ok coding without being able to do decimal to binary to hex conversion standing on one foot. It's not all about the records either. A screens with some graphics displayed and a tasteful simple effect plus a scroller can be nice too. |
| |
Burglar
Registered: Dec 2004 Posts: 1101 |
Quote: I'm with Sander on this one. Still I am convinced that it is possible to do some ok coding without being able to do decimal to binary to hex conversion standing on one foot. It's not all about the records either. A screens with some graphics displayed and a tasteful simple effect plus a scroller can be nice too.
that maybe true, but even for a simple scroller you need to know hex or binary. you need to understand how $d016 (smooth scroll register) works and what to store in it... doing that in decimal is more difficult ;) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
I have made a "smooth" upscroll in basic I knew how to use d011 (trial and error) and print statements to scroll up a charline when needed.
I have made my own charset in basic including data lines, poking them to mem, switching it on, etc. without a char editor, by drawing the chars on paper and calculating them by hand.
I have made a sprite editor in basic, which even saved the sprites as seq.
I have made a little animated (different phases for directions, animated turns) airplane sprite flying around the screen, being able to takeoff/touchdown to a runway, dropping bombs, etc in basic.
all this without knowing shit about hex or binary. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
you have created a sprite bitmap and calculated the right numbers to poke in memory without knowing binary? somehow that seems unlikely =P you might have not known that you did indeed know about it at this point =P |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
there was a book explaining the process(edit: chapter 6.2 in the user manual, it explains it without introducing binary or bytes). I had another book explaining all the "pokes" of the sid/vic/cia with examples. fex.: poke 53265,(peek(53265) and 248)+yscroll |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
Quote:
there was a book explaining the process.
it had a table with all possible combinations of the sprite bitmap and the corrosponding bitmap?
or did it explain the process of converting a row of pixels (== a binary number) to decimal?
i dont know, but somehow one of these seems unlikely =) |
| |
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 =) |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 - Next |