Posts tonen met het label TV. Alle posts tonen
Posts tonen met het label TV. Alle posts tonen

zondag 1 februari 2009

IF...THEN

Instead of FOR...NEXT I thought IF...THEN might be a much better option. As shown, IF...THEN now works. It can do comparisons <, =, >, <>, <=, >=, and, as a bonus, == (same as =, obviously). As my parser only checks for positive cases and not for negative cases, you can also write IF...GOTO. Because this work was done during the weekend, and therefore during the day, you can even see me taking the picture in the reflection of the television as well as my messy desk on the background. I discovered several things still need to improve: number printing should leave out leading zeroes, and it should handle negative numbers, as these might show up soon. Regardless, this introduces the important concept of flow control into the system which means it might actually start doing something useful in the near future.

donderdag 29 januari 2009

Addition!

As you can see from this screen shot, addition now works. In fact, I now have a CMRreadexpression routine that reads an expression, parses it and executes it. It can differentiate between variable names and numbers, as well as handle the + symbol. It can be easily extended to handle other operations as well, though parentheses will be another hurdle, if I am going to implement those at all. Making it a separate function will make it very easy to include it in the next challenge, the FOR instruction. So hopefully I will be able to say things like:

FOR a%=b%+1 TO 0 STEP -1
...
NEXT a%

In the screen shot you can see additional debug statements that identify the operator ('+') but this will be removed soon, probably. Despite what the screen shot seems to imply, the print bug of virtual semicolons has not been fixed: I just added a few spaces to the end of the line.

zondag 25 januari 2009

ZX-jen screen shot

Here is a screenshot from the "ZX-jen" project, or the Drake-TV mentioned earlier in this blog. The cursor is '>' and the screen continues at the top after it ends at the bottom, instead of scrolling. The square block is the cursor and indicates the current position. Before that is the executing of the program, which is:

10 print "Hello world!"
20 let a%=3

As you can see the result of the execution is:

pHello world!
l%

The "Hello world!" is the actual output, the "p" and "l" are debug indicators: they are the first letter of the command being executed, so "print" and "let". The % sign is the type of variable being read, in this case an integer, which indicates that the let statement was correctly interpreted. The only other command that is currently available is "goto". The "Esc" key can be used to interrupt a program. The next step will be to allow printing of a%, although for that to happen the assignment should actually store the value in memory. After this various simple operations, like + and - should be implemented. After this I will consider the "for" and "next" statements.

As you can see the system supports "run" and "list" commands, but also "new" to wipe the memory. The program is stored in an external 24LC512, so even if the power fails the program will be available. Program lines can be entered by just preceding something with a line number, and deleted by providing a line number with no data. Overwriting is possible too.

woensdag 10 december 2008

TV card output



The output to the TV from the PIC microcontroller is a very simple circuit. For the audio, it is merely a 0.47uF capacitor, to avoid DC current bias. For the video, it is two resistors. The actual values should be 450 Ohm and 900 Ohm, but 1k Ohm and 470 Ohm are close enough, and work really well. These are used to generate the appropriate voltages (low threshold, black, white and gray). Gray could be used for two levels of output, but due to the speed limitations of the microcontroller this state is not used. Basically the 1k Ohm pin is used the generate the threshold voltages for syncing, and the 470 Ohm pin is used to generate the actual black and white values in the output. The circuit assumes the TV has an internal resistance of 50-75 Ohm, which is generally the case, to generate 0V, 0.4V and 1.2V levels.