View Full Version : Propel (Propeller Assembler Helper)

09-07-2007, 10:09 AM
I wrote a short program to allow people to change a line like this:

] DIRA = #0005

into a MOV command

It uses python - so the code should be sorta readable by spinners. If you would like to use it install python, and then replace your MOV commands with a prefix "]" and then use any symbols or registers you'd like.

Let me know what you think. I'm going to improve on it when I can to make loops easier to read and write.

import sys
import os
# file to help people write prop assembly.
# I call it PROP - hELper or propel
# 2007 - Matthew Karas
# Creative Commons Licence
# This work is licensed under a
#Creative Commons Attribution 3.0 License
#Some Rights Reserved
input = sys.argv
registers = ['DIRA','DIRB','INA','INB','OUTA','OUTB','CNT',\
widths = ['LONG','WORD','BYTE']
symbols = []

def propel(line):
tokline = line.split(' ')
if (tokline in registers) or (tokline in symbols) \
and tokline == '=':
outline = "\tMOV\t"+tokline+","+tokline
#error if can't find symbol, register, or = sign
#error is making the line a comment
outline = "'Error" + line
return outline
def addsymbol(line):
tokline = line.split(' ')
if tokline in widths:
datseg = False
#first pass
for line in open(input, 'r'):

if 'DAT' in line:
datseg = True
# add symbols
if datseg:
#second pass
for line in open(input, 'r'):
line = line.strip()
if not line.startswith(']'):
print line # ignore non helper lines
line = propel(line)
print line

09-07-2007, 10:10 AM
for some reason the indents aren't showing up properly.

09-07-2007, 10:03 PM
Very interesting. Will you be making the obvious extensions? E.g.:
] x += 1 ' add
] x -= 1 ' sub
] x &= 1 ' and
etc., etc.
Does your code handle if_z, if_c, etc. and wc, wz, nr?
I always liked alternative assembly languages. I'll be interested to see what you come up with for loops.