Shop OBEX P1 Docs P2 Docs Learn Events
But you can't do that in Pasm — Parallax Forums

But you can't do that in Pasm

Beau SchwabeBeau Schwabe Posts: 6,568
edited 2010-10-16 17:07 in Propeller 1
I hinted about the ability to do something like this in my last post, so I thought
why not, make the whole program that way.

This code requires the LED setup equivalent to that on a Propeller Demo Board.

Again, this is just an academic exercise that forces you to look at the code in a
different way. Assembly language is just a symbolic representation of what you see
below.

Makes you appreciate Assembly huh? ... When I started out with computers in the
late 70's early 80's, I would hard code stuff like this, only I worked it out on
paper first.
CON
  _CLKMODE = XTAL1 + PLL16X
  _XINFREQ = 5_000_000

PUB PasmTest
    cognew(@Entry,0)        

DAT
Entry   long  %01011000_11111111_11110000_11111000 
        long  %10100000_11111111_11110100_00000001
        byte  temp1 ,%11101100,%10111111,%10100000        
temp2   long  %10100000_11111111_11111000_00000000
temp3   cmp   temp4 ,    phsa    wc
        byte  temp3 ,%00000000,%01001100,%01011100
        byte  temp1 ,%11101000,%10111111,%10100000
        long  %10100000_11111111_11111000_00000000
Loop2   cmp   temp4 ,    phsa    wc
        byte  Loop2 ,%00000000,%01001100,%01011100
        long  %10100000_11111111_11101000_00000000
        byte  temp2 ,%00000000,%01111100,%01011100
temp1   long  %00000000_11111111_00000000_00000000
temp4   long  %00000010_00000000_00000000_00000000
«1

Comments

  • AleAle Posts: 2,363
    edited 2010-09-10 00:05
    I cheated ohne-Ende and used pPropellerSim :blush:;) hahaha... nice example Beau !
  • Heater.Heater. Posts: 21,230
    edited 2010-09-10 00:27
    When I started out with computers in the late 70's early 80's, I would hard code stuff like this, only I worked it out on paper first.

    I once worked at a place with a system like this:

    1) Think of what you want your program to do.
    2) Write your program on paper in pseudo code, looks like ALGOL.
    3) Convert that pseudo code to assembler, on paper.
    4) Convert that assembler to HEX opcodes, data etc. On printed paper coding sheets.
    5) Have a data entry girl type that into a machine and make a paper tape from it.
    6) Blow PROMS from tape, insert PROMS to target and test.
    7) Find bugs, fix code and start again at step 1, 2, 3, 4, 5, 6 as appropriate.

    For production code most of those steps had to be reviewed and signed off by 2 other engineers and then slipped through the quality control department.

    That's forgetting step 0) where you have to work up a design specification document first but that's a whole other nightmare.

    "And you try and tell the young people of today that ..... they won't believe you."
  • BaggersBaggers Posts: 3,019
    edited 2010-09-10 01:26
    Some of my first games were hand assembled on paper into hex numbers, I can still recall off the top of my head most Z80 asm to Hex numbers after over 25 years ago. lol

    Nice example Beau btw! and yes, it does make you appreciate assembly!
    I also noticed, you did sneak a couple of CMPs in there lol
  • JavalinJavalin Posts: 892
    edited 2010-09-10 01:37
    we had to do a very brief bit of x86 (486-DX?) at college, and yes high level languages, or even PASM is wonderful in comparison!

    Good example Beau.

    J
  • potatoheadpotatohead Posts: 10,261
    edited 2010-09-10 02:38
    Yep. Me too. First few programs hand assembled on 6502, in class, on paper, when I was supposed to be learning about cold war nations, or some other rather useless thing.

    I'm surprised nobody has invoked the term "machine language", which is what this is. Assembly language is one layer up, where a program ASSEMBLES human mnemonics into machine language, which is the numbers shown.
  • LeonLeon Posts: 7,620
    edited 2010-09-10 04:02
    My first "computer" was a Motorola D2 kit:

    http://www.computermuseumgroningen.nl/motorola/mek6800d2.html

    It cost me £209 (quite a lot of money in 1976), and I had to put it together myself. I wrote my programs in assembler and hand-assembled them. I wrote a little program to calculate relative branch offsets, which made things easier.
  • wjsteelewjsteele Posts: 697
    edited 2010-09-10 04:06
    Reminds me of the ZX81! All assembler programs were actually hand coded into the basic REM statement as random characters.

    There would normally only be two lines of code:
    10 A=USR(addr)
    20 REM A_3*$ PRINT #!#zZT FOR [.a....
    

    That last line would sometimes fill up the screen with seemingly random characters and even words (actually BASIC commands.)

    Bill
  • ihmechihmech Posts: 179
    edited 2010-09-10 08:18
    Heater. wrote: »
    "And you try and tell the young people of today that ..... they won't believe you."

    Heater,

    I'm 30 and I believe you. Of course I tended to enjoy learning about all kinds of tech stuff thanks to my grandpa. I grew up looking at all of his old tv and radio repair equipment in his garage. I'm probably the only 30yr old that has a vaccum tube tester and knows what it is.

    I do like the fact that I never had to stuff a paper reel into a computer in order to run a program though.

    So, I tip my hat and have a lot of respect of those that have worked on the earlier computers ie...building, programing, and such. New computers and lots of handy software has made thing a lot eaiser these days.
  • Heater.Heater. Posts: 21,230
    edited 2010-09-10 09:23
    ihmech,

    Well I like to think I'm not so ancient yet:)

    I just happened to enter the scene at the tail end of the glorious times of mini/mainframe computers, mechanical teletypes, punched cards and tapes, 300 baud modems, 8 inch floppy drives. The micro-processors were just on the verge of taking over everything. Those were Motorola 6809s we were using in the description above after all.

    However I am old enough to actually want to get my hands on a paper tape punch and perhaps a high speed optical reader to load up my Propellers:)
  • ihmechihmech Posts: 179
    edited 2010-09-10 09:54
    Heater,

    I remember me and a friend in high school saying that when we got out of school, we were going to have our own computer with 8Mb of ram! It's amazing how technology has changed. I was telling my friends dad about the propeller and it's languages. He was pretty impressed with it. He programed back in 70's with his job. I told him I wanted to learn ASM and he keeps telling me how easy it is. Of course, he knows how to write machine code too. That may be why he's telling me ASM is easy. :)
  • JimInCAJimInCA Posts: 80
    edited 2010-09-10 10:13
    Leon wrote: »
    My first "computer" was a Motorola D2 kit:

    Leon,
    The first programming language I learned was 6800 on a D2. It was a great system to really learn how hardware and software interact. Just hearing D2 brings back a lot of fond memories.
    Jim...
  • bill190bill190 Posts: 769
    edited 2010-09-10 10:44
    Heater. wrote: »
    ...However I am old enough to actually want to get my hands on a paper tape punch and perhaps a high speed optical reader to load up my Propellers:)

    You might be interested as well in the following where someone was using "magnetic core memory" with his microcontroller...
    http://forum.sparkfun.com/viewtopic.php?f=14&t=23070


    FYI - Magnetic core memory...
    http://en.wikipedia.org/wiki/Magnetic_core_memory
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-10 11:06
    I started programming right out of college in 1973 at General Electric.
    My boss told stories about entering programs in machine code on GE's Univac computer.
    GE was the first business sale of the Univac (1954).

    When I started, GE still had GE 400 computers with no disk drives - just tape. We wrote Cobol, RPG or assembler programs on coding pads which where sent to another building (via hand delivered office mail) to be keypunched, loaded and compiled. You might manage two compiles a day.
    For emergencies fixes, my boss would patch the object deck with punch cards and fix the source code deck later.

    They also had a new Honeywell and soon we got terminals with read/write casssettes to replace paper tape punch terminals.

    Ah, the good ol' days - NOT!
  • Heater.Heater. Posts: 21,230
    edited 2010-09-10 11:35
    We so often end up dredging up old history on this forum. Must be quite frustrating for the likes of Beau who are trying to make something new:)

    All this reminds me of my father explaining to me how core memory worked when I was 10 years old. I had just been reading a book from the childrens library that described how to build some kind of calculating device from rotary telephone dials and such. So that was fascinating for me at the time. Much to the chagrin of my mother who would have preferred I picked up something more literary at that library.

    All this talk makes me want to pick up some FRAMs. Saves all that stitching...
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-09-10 12:15
    I did exactly once have to enter a program into a mainframe using the front panel switches (it was a special exercise to make us appreciate Hollerith cards). I never even got close to doing it right, though most of the folks in class did get theirs running (spending half the night doing it).
  • ihmechihmech Posts: 179
    edited 2010-09-10 13:12
    Heater. wrote: »
    We so often end up dredging up old history on this forum. Must be quite frustrating for the likes of Beau who are trying to make something new:)

    All this reminds me of my father explaining to me how core memory worked when I was 10 years old.

    I love all of the "old history" talk. I learn lots from it. For instance...this talk of "core memory" got me wondering and I looked it up. WOW! It's pretty impressive. I never new what it was or what it looked like until today. Thank's guys, you taught a new guy some more good stuff. It makes you appreciate what we have today to work with. Although, after reading about core memory and what it's capable of as far as being non-volitile and resistant to EMP makes it look better than what we have today.
  • w8anw8an Posts: 176
    edited 2010-09-10 14:41
    Gee whiz...

    What ever happenend to magnetic bubble memory? I thought that was cool.

    -Steve
  • localrogerlocalroger Posts: 3,452
    edited 2010-09-10 16:32
    ihmech, the first computer I ever saw was a Hewlett Packard 2100A minicomputer at my Dad's physics lab. It had binary button data entry, a teletype machine, and 4k by 16 bits of core memory. It had a feature called "power fail auto restart" which would detect that the power was failing by an interrupt generated by a voltage divider in the power supply, and you could have the interrupt save the CPU state to the core memory. This meant you could walk up to it at any time and PULL THE PLUG (it actually used a cylindrical key for the power switch), without warning, and leave it sitting there for a year and if you came back and turned it on it would instantly pick up running right where it left off as if nothing had happened.

    Oh, and if it ever crashed HP would send out a technician who would figure out what was wrong with it and fixed it. Too bad it cost almost $40,000 in 1974.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-10 17:46
    Wow, i am so glad i was born into the modern computer age, haha....Actually i think it is cool to talk about older computers. You didn't have to worry about a EMP attack destroying your computer built with relays and punched cards.....
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-09-11 00:35
    This was one of my earlier computer experiences, which could very well explain a few things :smilewinkgrin: ...

    http://old-computers.com/history/detail.asp?n=9&t=3

    I had the 'luxury' of playing with one of the 5110's only because my dad had one at the office.
  • yarisboyyarisboy Posts: 245
    edited 2010-09-12 13:02
    Back when I was involved in building the worlds largest crawler tractor you had to have the tool room deliver the bits and paper tape needed to run the CNC machines of the day. After that American company was sold over seas I got to punch cards for the IBM 360 in college. My senior year they stepped up to IBM 3270 color terminals and a 370. As of '82 they still didn't have color graphics but Apple changed all that. I was the only senior with a televideo terminal and a 300 baud modem in my dorm room. You could barter for anything ;) when the big projects were due and the campus labs were closed. There are people out there that will know who I am just from that story.
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-09-12 21:42
    The Friden/Singer/ICL mini I worked on from 1974 was always booted by engineers using machine code to find faults. I can still rattle off instructions in machine code. Somewhat similar to the Prop in many respects.

    I wrote an emulation which was fully validated to run on hand-coded 486 33MHz. Sometime soon I will convert/rewrite the emulation to run on my RamBlade Prop. Imagine my $40 prop running faster that my $200,000 garage-length mini.

    Leon: I started micros on a D1 then D2. I recall I bought an assembler rom which made life simpler before I wrote a cross-compiler on my mini. I bought my own 18mth old mini in 1977 - it was the length of my garage and I housed it there in an airconditioned room I built. It was fully operational and used regularly until 2000. My first micro exposure was actually an 8008 although by the time I gathered all the part to build a micro based on this the 6800 was so much simpler.
  • LeonLeon Posts: 7,620
    edited 2010-09-13 03:45
    A friend of mine built his D2 up into a complete computer with memory expansion, a floppy disk drive, and a display and keyboard. I subsequently got a TRS-80 Model I and started building my own controller boards using the Z80, developing software on the TRS-80. I then moved on to the 8086 and then the 68000, in terms of home-made stuff. I wrote a book about my 68000 system and I occasionally get people contacting me about it, 30 years on.
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-09-13 21:10
    Leon: I am moving so cleanup time. Guess what.. I paid $192.72 for my D1 Kit on 19 March 1976. I built the D2 into a box with 8KB RAM, 4" Motorola monitor and a keyboard. I then interfaced it into the ICL mini and used it to develop micro interfaces to the ICL mini which I sold to ICL and also their customers.

    From memory, the D1 had an ACIA (6850) for 20mA current loop serial interface, a PIA (6820) for 20 parallel I/Os, and 128B RAM (6810).. yes 128 Bytes in a chip. All for $192 and don't forget money is 20x that today.

    So, the Prop ProtoBoard is a steal !!!!

    Apologies Beau - this is way OT.
  • wmosscropwmosscrop Posts: 409
    edited 2010-10-15 20:53
    This was one of my earlier computer experiences, which could very well explain a few things :smilewinkgrin: ...

    http://old-computers.com/history/detail.asp?n=9&t=3

    I had the 'luxury' of playing with one of the 5110's only because my dad had one at the office.

    Ah, the 5110. My first job was programming its predecessor... the 5100.

    In BASIC. 2 character (max) variable names... and the 2nd could only be a digit.

    Extremely unfond memory: for some (unknown) reason, IBM decided that character variables (strings) were to be all the same length... 18 characters. The story I heard was that this was the "average" length of character variables in some analysis they did (may or may not be true).

    This made string handling VERY interesting. Say you needed up to 50 characters for a report title... so you'd use 3 variables (18, 18, and 14 characters of the last variable). Now write the code to center that 1 to 50 character title on a report... Bonus points for clear and concise comments on how it works.

    Of course, comments used up your ram... so when you started to run out of memory (easy to do with only 32K) they were the first thing to go...

    That was one of the major issues that IBM fixed when they came out with the 5110. Of course, by that time my mind was already warped.
  • davejamesdavejames Posts: 4,047
    edited 2010-10-15 21:10
    @w8an - I had the pleasure of observing a Intel 7110 magnetic-bubble memory module with its cap off under a microscope lighted with polarized light. The magnetic domains were visible and you could watch them march through the chevron guides.

    Pretty wild.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-15 21:29
    One of my professors in undergraduate school worked as a graduate assistant on the Princeton Institute for Advanced Study Computer which had 1K 40-bit words. His job was to sit in front of the machine and watch the 40 Williams tubes (one for each bit) for any sign of pin-point bright spots indicating that a particular bit in a particular location was being written too often (or read too often ... memory reads were destructive and had to be rewritten). That increased the temperature at that spot on the tube and the phosphor layer could be damaged there. There was a chart on the wall showing which bits of which words were stuck at a particular value (0 or 1). Instructions had a bit in them that advanced the program counter and people occasionally forgot to set that bit which would cause the instruction to be fetched repeatedly and potentially cause damage. Other program bugs could also damage the memory.
  • AleAle Posts: 2,363
    edited 2010-10-16 00:15
    @wjsteele:

    Those REM lines used to drive me crazy when I did not know what they were for. I also thought they were random... no they were not ! :). The ZX81 hat a "LET" keycode :)

    Some games where quite clever and did not let you see the "code" in those lines...

    I came late to the game because my first computer (1985) was a brazilian TK-85 with 16 KB RAM (a ZX-81 clone) without ULA, the brazilians had replaced it with discrete logic !

    Ale
  • wjsteelewjsteele Posts: 697
    edited 2010-10-16 02:57
    Ale wrote: »
    Some games where quite clever and did not let you see the "code" in those lines...

    Yep, you could drop in the equivalent of a CR-LF sequence in there and the editor would stop displaying the code, but it would still execute. The only problem with that technique was that you had to modify it after the program was 100% working, otherwise, you'd have to type it all back in by hand again. (Or load from cassette from your previous save.)

    Also, you're right about the LET... the first line should be 10 LET A=USR...

    Bill
  • CampeckCampeck Posts: 111
    edited 2010-10-16 07:03
    haha.
    Just think. When all us young-uns are old geezers we will be telling the young-uns about the 2 TB platters hard drives and how we used to have to actually type code in languages and hook up wires to peripherals, and view everything on a monitor.
Sign In or Register to comment.