Jump to content
  • Advertisement
  • entries
    58
  • comments
    218
  • views
    114988

TV & ASM

Sign in to follow this  
Mike.Popoloski

536 views

There were a lot of questions about the interactions between Spin and ASM from the last entry. In case I wasn't clear, Spin does NOT compile down to Propeller ASM. It runs natively on the chip, through the use of a built in interpreter. Programs for the Propeller must use at least a few lines of Spin to get the program going, as the boot up sequence built into the Propeller can only start with Spin code.

In my last entry, I posted an example in Spin that blinks an LED connected to the Propeller on and off 5 times. Some of you may have wanted to see the same example in ASM, so here you are (this time I commented everything so you can see what is going on. Also note that this example will loop forever, instead of only 5 times.):


' defines the start of a constants block
CON

' sets the special clock mode constant to use crystal input one and a phase
' locked loop (PLL) multiplier of 16.
_clkmode = xtal1 + pll16x

' sets the input frequency of the clock to 5MHz
_xinfreq = 5_000_000

' defines a public function called Start. The first function in a
' file is the entry point for the program.
PUB Start

' starts a new cog (ie. a core) which will run instructions starting
' at the given address
cognew(@entry, 0)

' defines the start of a data section
DAT

' sets the origin of all ASM code to the first address
org 0

mov dira, 16 ' set pin 16 to output mode
mov time, cnt ' initialize the time variable with the current clock
add time, #9 ' add nine to the initial time variable

' create a label called :loop
:loop

xor outa, 16 ' toggle the state of pin 16 (high or low)

' wait until the clock equals time, and then add delay to time
waitcnt time, delay

xor outa, 16 ' toggle the state of pin 16 (high or low)

' wait until the clock equals time, and then add delay to time
waitcnt time, delay

' jump back to the loop label
jmp #:loop

' define a variable with a size of long with an initial value of 40,000,000
delay long 40_000_000

' reserve space for a variable with a size of one long
time res 1





On a different note, I purchased a handful of RCA connectors from Jameco so that I can connect the Propeller to the TV. Unfortunately, the leads don't fit into the breadboard, so I had to do a little hacking by adding some wire to the end of each lead.



I connected this to the Propeller through a four bit DAC (digital to analog converter) which allows me to blend the output of four separate pins into one composite NTSC signal. (I found a sample circuit for this on the Parallax website).

So now I have a TV output for my board. The next step is to get video going and to have something interesting to show for my efforts.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!