A little 'time ago I reported a version of a Commodore 64 emulator written in Adobe ActionScript 3.0, now in a new version :
Articles Tagged 'Commodore-64'
Commodore 64 emulator JavaScript
Undolog: workstations between past and present
The other day I came across some old photos with my first computer! So it occurred to me to photograph my current position and compare it with the "time" has passed. The pictures found are obviously of poor quality, compared to the current, another sign of the times!
Greetings Professor Falken
I have a tradition that I carry on for 25 years! That gladly celebrate! Since that day, 1983, the year of its release, I must once a year by watching WarGames (War Games), the film has decided that, somehow, my destiny work.
WarGames , in its "current" simplicity, at the time was a real success, especially among computer enthusiasts.
The arithmetic module
The "module" is one of the aritmentiche available on almost all programming languages (I used it the first time with the Basic Commodore 64) . May appear as a simple operator, as in the case of Actionscript or Javascript, which both use the character "percent" (% b), or as a method or instruction. For developers may be useful in contexts apparently different. Gskinner spoke recently, showing some classic but interesting examples.
Put simply, the operation returns two numbers form the rest of their division. For completeness, we say that the operation of the module is a very broad topic, which I discussed in the RSA encryption ! This time, however, not talk of codes or ciphers, but useful things much simpler.
Divisible by alternating ...
The first use we can make the operation of the module is to determine whether a number is divisible by a number b! If the risultatto of a% b (% I will use here the notation to indicate the operation of the module) is zero, a is divisible by b. I remember when I had to do with a problem like I did not know the operation of the module. On the Commodore 64 I needed to know if a number was divisible by 2. At the time I used this syntax (I found the code origionale - year 1983):
1 2 3 | 10 INPUT A 12 B = A / 2: IF B = INT (B) THEN PRINT "OK THE NUMBER" A "AND 'EQUAL": GOTO 10 14 PRINT "THE NUMBER" A "AND 'ODD": GOTO 10 |
The BASIC of the Commodore 64, however, did not have the operation module - at least that I remember!
Basically exactly what I was doing that by its nature makes the operation of module: 2 verified that the division had no rest, in this case, check that the result did not contain decimal ( IF B = INT(B) )! If the division operation is equal to its full, then the number is equal!
If a have our value to be tested, the same thing can be resolved by:
1 2 3 | a % 2 ) == 0 ) { if ((a% 2) == 0) { / / Even } |
Or, for 3, by:
1 2 3 | a % 3 ) == 0 ) { if ((a% 3) == 0) { / / Divisible by 3 } |
Small note: thanks to the track if you have to do with the powers of 2 annche there a faster way to check whether a number is odd or even. In binary notation, in fact, the numbers are all equal to zero the first bit! Thus, using the logical operators, you can know whether a number is odd or even simply "Protestant" the first bit:
1 2 3 | ! ( a & 1 ) ) { if ((a & 1)) { / / Even } |
In the Assembly, for example, this is bread and butter! It is even more immediate and simple (the Motorola 68020, for example, had an instruction BTST that "tested" just a single bit
). – moltiplicazione bit a bit) tra il nostro valore a e 1 (chiamato maschera ). The logical operations (AND, OR, NOT, XOR, etc ...), in fact, are known to be faster in terms of run, and then "time machine"! (a & 1) performs the logical operation of AND ( & - Multiplication bitwise) between our value a , and 1 (called mask). If a = 7 (00000111), for example:
1 2 3 | 00000111 AND = 00000001 00000001; odd |
If a = 8:
1 2 3 | 00001000 AND = 00000001 00000000, equal |
Not only can we check the numbers, that is, with the first bit to 0, and therefore divisible by 2, but can also occur if a number is divisible by 4, 8, 16, 32, 64, etc ... using the appropriate forms:
1 2 3 | ! ( a & 3 ) ) { if ((a & 3)) { / / Divisible by 4 (mask = 00000011 = 3), since 4 is 00000100) } |
If the last two bits are set to zero the number is divisible by 4! If the last 3 bits (mask 00,000,111) are to zero the number is divisible by 8! And so on ![]()
Gskinner shows the use of the module in cases of alternate generation of values. A classic example is to change the background of a list of items: a white and a gray. Gskinner offers:
1 2 3 4 5 | rowIndex % 2 == 0 ) { if (rowIndex% 2 == 0) { rowColor = 0xFFFFFF; { Else {} rowColor = 0xCCCCCC; } |
First of all, the code above can be solved with a single line of code:
1 | 2 == 0 ) ? 0xFFFFFF : 0xCCCCCC ; rowColor = (rowIndex% 2 == 0)? 0xFFFFFF: 0xCCCCCC; |
Moreover, in this specific case, I would avoid actually perform a "heavy" form of operation. This particular situation is often engaged in a loop, so it would be "good" not to waste clock cycles the machine. In these cases I like the cleanest (and logical) solution:
1 | fooIndex == false ) ) ? 0xFFFFFF : 0xCCCCCC ; rowColor = (fooIndex = (fooIndex == false))? 0xFFFFFF: 0xCCCCCC; |
o false , a seconda di come vogliamo impostare inizialmente il nostro colore sfondo. Where fooIndex precedentemete is a value set to true or false , depending on how we initially set our background color. This approach is more subtle, less immediate, at first, but faster because it performs logical true / false. la condizione (fooIndex == false) sarà falsa e di conseguenza fooIndex verrà impostato da true a false. If fooIndex is true, when the statement is executed (fooIndex = (fooIndex == false) ) the condition (fooIndex == false) is false and consequently fooIndex will be set from true to false. verrà impostato da false a true! The second time, however, the condition (fooIndex == false) is true and then fooIndex is set from false to true! And so on ...
Repetitions: to watch the behavior
The finite arithmetic, which is the basis of the functioning of the operation of the module, it is often referred to as clock arithmetic. A classic timepiece has a dial with hands divided into 12 hours (12 plus 12 day night!), Sufficient to indicate any one of 24 hours a day. At 08:00 AM If I asked you what time your watch will score between 18 hours, your answer would be 8 +18 = 26! But the 02:00 at night! Involuntarily and without knowing it, perhaps, perform operations conitnuamente form whenever we are dealing with times.
In Italy we are used to the system 24 hours (or mixed). When we point to 16:00 intend that hour than in other countries is indicated as 04:00 pm. Who uses the postfix am / pm to distinguish from those ofa night hours, even more often performs the operation of the module, module 12 in this case! We Italians, and others, however, being accustomed to consider the 24 hours, perform operations with Form 24!
When I'm 11 in the morning (11:00 for all) and think "in 5 hours", the Italians respond 5 +11 = 16 (four in the afternoon), a stranger could also answer 5 +11 = 4 pm. Since 5 + 11 classical arithmetic, is obviously 16, as did the stranger to meet 4 pm? He simply run the module 12 on the result: 5 + 11 = 16 mod 12 = 4. It is not necessary that you take a calculator to verify the accuracy of the calculation, but these steps are a bit 'all, displayed a face of a clock and place the hands on the 11 mentally, then add - always visually - 5 hours, such as if by magic you'll actually about 4! That's why they are called the four in the afternoon 16 ![]()
In Italy, instead, we use a Form 24, in fact: 11 +5 = 16 mod 24 = 16. When I am to 23:00 pm, 5 hours after the 28:00 will not be, because 28 modulo 12 = 4! 122514884225 Form 24 = 17! What happens is that the key result of the Form 24 will never exceed 24. But the most interesting thing is that the numbers are repeated indefinitely:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1% 24 = 1 2% 24 = 2 3% 24 = 3 ... 22% 24 = 22 23% 24 = 23 24% 24 = 0 25% 24 = 1 26% 24 = 2 27% 24 = 3 ... 48% 24 = 0 49% 24 = 1 50% 24 = 2 51% 24 = 3 ... |
This repetition is a disarming ease. Imagine, for example, they should have an object, a MovieClip, similar to a chessboard, in four columns. Create a MovieClip quandrato, 55 × 55 pixels and the properties panel esportiamolo as Simbolo . The following code will have four columns of our MovieClip and will "head" with the operation of module:
1 2 3 4 5 6 7 |
cresce in modo indefinito. As you can see from the code, the variable i cycle for growing indefinitely. But the coordinate x of our MovieClip never exceeds a certain value, and repeats indefinitely! Here is a concrete example:
Through the two knobs you can vary the number of columns (the form) and the total number of elements, using the algorithm above.
Development languages
I "revived" this article of mine wrote a little 'of years ago. I slightly revised, updating a little bit here and there, but I think it is still relevant and interesting.
INTRODUCTION
What is a development language? A computer, aka PC (Personal Computer), has a personal language. This language is called machine code, to mean that every machine, so any computer (PC compatible, Apple, Unix, etc ...), has a unique and proprietary. The programs that we see "run" on our PCs are mainly carried out by the mysterious object called a microprocessor. This is the heart, the intelligent module, each computer. In fact, only one application is not running but is supported by the microprocessor, so to speak, to what is called an operating system: a software layer supplied by the manufacturer of the machine (see, for example, the Apple Macintosh).
Once upon a time ...
"Once upon a time" a time when the word had no meaning Personal Computer. It was the time of the console, small gadgets that are connected to the TV, the precursors of the Playstation today. And really you could see in magazines of all colors: Intellivision, Atari , Philips, large machines - for the time - that guaranteed fun coupled with amazement. And here are the first journals, such as the yearbook of video games (pictured) in 1984. The ads, appealing for the time, showed a technology never seen before. There was the Colecovision, with its video game system, "a home console for video games on cartridges ColecoVision standards," the exceptional price of 485,000 lire.
Greeting

It all started from here ... best wishes to my first personal computer, as it was advertised at the time that, although it is now technically over, will always remain unsurpassed in soul and memory of many!
Emulator Assembler 6502
While we're on the subject of nostalgia, here's a nice emulation of the historic 6502 microprocessor , mounted in the 80s in the console and computers as the Apple, Commodore NS and the Nintendo 64 (then at step 6510, ...). This cute little gem is written entirely in JavaScript, running on virtually all browsers (Safari Opera), with the only downside being a little slow. But worth it. On the website ( http://www.6502asm.com/ ) found some nice examples, but curious lens.
Code for Commodore 64
I recovered my block to see the Commodore 64 port dell'emultatore FC64 proposed Quach Post it! Unfortunately, some features of the keyboard are not quite managed to make them work, so I could try and put some interesting lists (old nostalgic memories). If you remember the Commodore 64 had special combinations used when writing BASIC code, as the symbol of the negative R (reverse) or the little heart, always negative, to wipe the screen.
Commodore 64 Emulator Web
If you read the last two posts I wrote ( Net Software and Web Amiga Emulator ), this seems to be the direct consequence. Apropos, then, of emulators and Flash 9 with ActionScript 3.0, here is something really great, except for nostalgia. The project is called FC64 and wants to be low-level emulation of the glorious Commodore 64! It was written in ActionScript 3.0, and then to see the movie (I feel weird to call this movie a thing like that ...), you should install version 9 of the Adobe plugin.









Latest Comments
Simon : It annoys disturbed again and use that space for these things ... however it does not work ...
Giovambattista Fazioli : @ Simon: what could be due to the syntax I used, specifically for PHP 5 +,...
Simon : I tried last night putting everything into functions.php, okay, jquery forms, and tabs jQueryUI them ...
Giovambattista Fazioli : @ Simon: I recommend cleaning to enter a code like that in ...
Simon : @ Giovambattista Fazioli: Thank you for your patience, it's all clear ... now I feel now, ...