My First Brainf*ck






36 thoughts on “My First Brainf*ck

  1. I learned programming in 6502 machine language on a KIM-1 microcomputer in the mid ’70s. Not Asembler, actual machine language. Then learned high level languages and spent 13 years as a mainframe programmer. Low level languages can be very rewarding. You learn the mechanics of the processor. Arduino is an ideal bridge between a technical understanding of the operation of a processor and real world applications.

    1. AVR’s bizarre architecture leaves little turds in your source code and encourages coding skills that are useless on any other processor. ARM is the natural successor to the 6502, its architecture is bog-standard, and a much better choice for the budding embedded developer.

        1. I had to program an AVR in machine code for a college course. I asked the professor that if, in order to save strings, I could put some bytes in the program memory and then point the stack pointer toward those bytes.

          Apparently, program memory and RAM are addressed seperately.

          This isn’t that uncommon in RISC processors, but I wouldn’t call AVR a RISC processor.

          1. Why wouldn’t you call the AVR a RISC processor?

            It is purely load and store, nearly all instructions are single cycle and there is no microcode. All very much RISC characteristics.

          2. PIC24 is the same, with separate program and RAM memory. A bit disappointing, as I would have like to have played with self-modifying code and JIT compilation in RAM. Storing data in FLASH is also a bit inefficient, using only 16 bits of each 24 bit word by default due to the difference in data/program bus sizes; unless stored and accessed in a nonstraightfoward way. But otherwise it has not proven to be a limitation.

            There are legitimate reasons to bash Arduino in my opinion. I have certainly done so on many occasions, and won’t do so again today. But I suspect [F] is just talking nonsense.

        2. This is known as “Harvard Architecture”. It has advantages, which are usually vastly outweighed by it’s disadvantages, so it’s almost never used any more. Von Neumann became the Plato of computer philsophy.

          It does have some advantages when you want speed and performance out of smaller cheaper hardware. But mostly yeah it’s goddam ugly. Tho many real-world Harvard-arch chips have an instruction or two to read data from program memory, if not often the other way round. This is known as “Modified Harvard” it’s a sticking plaster over the main arse-pain.

          1. AFAIK it’s other way around. Most of modern chips, including modern x86 processors and ARMv7 chips have modified Harvard architecture on the inside. With program and data memory being the instruction and data cache. On the other hand this is hidden from the user either by using microcode or some clever tricks with address space mapping. However the performance benefit is universal.

    2. To continue, Arduino’s poor design decisions mean that it’s very easy to write bad code and very hard to write good code. It’s great for fun and games and getting “hello world” off the ground but it very quickly turns into a big boat anchor that will weigh down your project and prevent it from achieving quality. Arduino is a bridge to nowhere.

  2. “While an introduction to computers is now just how to put a Raspberry Pi image on an SD card…”

    “…a few people are keeping the dream of memorizing opcodes alive.”

    “…perfect for such a minimal user interface…”

    I used to read the articles…

    Now, I just read the headline, look at the pictures/videos, and read the comments. I click links that seem interesting and then I move on. It’s not that I don’t have the time, but that the articles are becoming more silly as time goes on. I read this one and I cringed.

    Cool project, though and no personal offense meant towards anyone.

    I’ve been wanting to say this for ages, but feared getting anti-trolled and run out of town with pitchforks and torches. Do what you will.

    1. what are you here for? are you here to find ideas to steal? are you here for inspiration? do you like to see other people being creative? it’s not all about technology, it is also about the creative process, why people make the decisions they do, the balance between aesthetic and function. everyone has a different take and it’s fun to see what motivates people and how they apply the skills they have learned. it doesn’t matter so much whether the project is beer brewing or cutting metal or what.

    2. Baseless moaning is now the thing in the HaD comments I gather.

      OK then.

      ‘You know in the old days I went to HaD to get inspiration to cure cancer, now I just gaze at pictures and blank my mind and think about the youtube comments I can make blaming the jews for things’
      ‘Also they didn’t have all that hip-hop music that makes the kids crazy’

      How am I doing?

    3. I agree at least that drawing inference between memorizing real assembly opcodes, and a contrived and intentionally obfuscated language like Brainf*ck, is silly.

      There is no real world advantage or utility to Brainf*ck. It’s strictly a self-imposed challenge. So is Sudoku. While I might engage in either activity to avoid boredom when avoiding productive tasks, and it does exercise the grey matter, it’s quite a stretch to call it “very, very rewarding”.

      1. I think the Sudoku comparison is quite accurate! It is a self-imposed challenge that some people enjoy – while others consider it meaningless. It’s up to you to find out which category you belong to. However bf is not only a mental challenge, I think that you will also learn one or two things about programming and computers while playing with it.

        If you belong to category 1, you might want to understand what this program does (it’s written for My First Brainfuck and outputs binary, not ascii)

    4. I scrolled up to read what you have taken offense to, to read it in context. Hard to tell why you take offense. No grammar or spelling errors that I can see, but that doesn’t mean their are none. Do we need to assume you took offense at the message? Your none worry about running out of town leaves to the reader to wonder why you come to down in the first. Anyway no that you have broken your silence I home your tongue heals quickly.

  3. I find this a little miss leading as an Electrical Engineer I am required to know how to program in opcode and if I ever want a job with NVIDA or other similar companies I need to know how to program in opcode.

    1. LOL ;) I’m fairly certain written communications skills are important for Engineers is general as well. We should give you the benefit of the doubt by assuming you where trip up up by a spellchecker, because anyone says they haven’t may be a liar. I’m guessing in response to the typo misleading, to clicked on the suggestion miss leading while in a hurry and in a hurry means only a cursory proof read. Been there done that… often.

  4. Brainfuck’s sortof a joke language. I understand you could view it a really really simple machine code, with no number loading of any kind so relying on long chains of inc and dec to get any data in. Aren’t a lot of the few Brainfuck programs out there written with and by tools?

    I suppose a more minimal machine code with fewer features might help people learn the concept. But for that the 6502 is pretty simple, with just it’s paging quirks. I think Z80 is another good one. Lots of instructions, but they’re fairly orthogonal, just a few simple operations on different registers in different address modes.

    But no out-there wierdy ones like some of mainframes of the olden days, or the overhead of modern 32/64-bit CPUs that really need an OS to manage the chip itself and all it’s MMU / cache / virtualisation stuff. A lot of OS stuff seems like it’s dropped down into the chip itself, for performance, and to provide a use for the billion extra transistors.

    I think either the 7-segment / hex-keypad systems of old, or something that runs through a terminal session, with either an assembler or a cross-assembler, would do a better job. Although what the job is, I’ve no idea!

  5. I am interested in this idea as a toy to play around with from a programming perspective, but I have absolutely not background in electronics. Is there somewhere I could buy this instead of having to make it? I will do what I have to, but I would prefer not to build it, given that I would probably screw it up badly.

  6. Understanding that low cost is relative, but is this the lowest cost solution to get where this shield goes? An Arduino is going to cost more than $30 after S/H. IMO products that include a programmed micro processor installed on an assembled version, or included in a kit. Even a need for a way to supply power should keep the cost lower. Christmas is coming. A nerdy girl on Shanta’s knee. What to you want for Christmas “young lady?”; I want a brainfuck Santa. I’m pretty sure that’s not going to be a letter to Santa our small rural weekly would be printing.

    1. LOL, but I would like to see that ad!

      Many people here misunderstood one thing: The Arduino is only used as a proof of concept. The whole project is designed so it can use an 8-pin microprocessor (ATtiny, pic or similar) running on a 3v coin cell. Then it will be extremely low cost, since only a few LEDs and switches are required. In fact I don’t think that you can find or build any programmable computer cheaper than that…

      The Arduino proof of concept fulfills my need (now I know that it works). If more people find this interesting I can quite easily port the code to a tiny low cost platform. Let me know what you think!

Leave a Reply to Ross Hershberger Cancel reply

