B29K1QS60

  • unnick
    21st Jun 2019 Member 3 Permalink

    its my first time posting, and english isnt my native language, so im sorry for any formatting or grammatical

    errors (like misplaced/missing commas and periods), and yes, i know i should be using apostrophes for words like "isn't" and stuff, im just lazy. anyways heres the post:

     

    hello, i made my first computer (which is very similar to arK's advanced programmer in his AEC 2 save):



    features:
    • a single 29-bit register (hence the B29 in the name)
    • 256 words of memory (or a quarter of 1024, which is what the K1Q part means)
    • its subframe and runs at 60hz with the default fps cap (S60)
    • an output for controlling whatever electronics you might want to control
    • memory mapped io (just put ldtc on the ram)

     

    how to program it:
      i havent written an assembler or anything yet, and probably wont any time soon because really, its a bad

      computer that cant even increment numbers by itself, but you probably dont care and still want to program

      it. so the only way currently available to program this is using the prop tool and optionally short scripts to

      write parts of the program.

     

      anyways heres how it works:


      each instruction is a column of 6 filt particles, and this is what they do:


      the uppermost (1st) filt particle sets individual bits of the 29-bit register, while
      the 2nd filt particle unsets individual bits.


      the 5th filt particle controls whether the instruction does nothing except change bits,
      or jumps unconditionally to some address, or writes to memory, or reads from memory, or does everything at

      once.
      the 1st bit (lsb) controls if the instruction jumps (either conditionally or unconditionally), if its set it first

      checks if

      for every set bit of the 3rd particle, the corresponding bit in the register is also set, if thats true, then it

      jumps to the address specified by the 4th particle.
      if the 3rd bit doesnt have any bits set, then its an unconditional jump.

     

      the 2nd bit controls if the instruction reads from memory, if its set then it uses the first 8 bits of the register

      as an address and then reads the memory value at that address, it then sets bits of the register specified by

      the 3rd particle to the value.

      the 3rd bit controls if the instruction writes to memory, if its set then it uses the first 8 bits as an address

      (again)

      and writes the entire register to memory.

     

      the 3rd and 4th particles are used only by the instructions specified above, the 3rd particle roughly translates

      to a bitmask, and the 4th to a jump address (but its NOT used by the memory r/w instructions)

     

      the 6th particle doesnt do anything, its just used as the output for the computer (which in the save is

      connected to a printer that isnt really used by any of the demos)

     

      and thats it. the only other things to talk about is how to use the number input and output devices in the

      save, and what happens when you set/unset some bits and have a conditional jump that depends on those

      bits in the same instruction.

     

      the number input and number output are memory-mapped to the 0th and 255th word in ram respectively.

      the num input uses the 29th bit as a signal the computer is ready for another number, and when the user

      types in a number its unset, and the num output uses the bits 8-29 as a number and displays it as a decimal

      number.

     

    and heres the (rough) order in which things happen inside the cpu when an ambiguous instruction for example set/unsets some bits and conditionally jumps depending on those bits:

     

    1. an instruction is fetched from the program rom
    2. if theres a conditional jump then the cpu computes whether the jump is taken or not
    3. we copy the register using ldtc (which will be used as a value for writing to memory)
    4. if the previous instruction executed read from memory, then it copies over bits of the read value to the register
    5. bits in the register get set/unset
    6. the memory gets read from and then written to (the value that gets written is from the copied register before bits have been set/unset, but the address which its written to is from the register after bits have been set/unset)
    Edited 2 times by unnick. Last: 22nd Jun 2019