Synergy Computer v.1.0 (29-bit, 1.5hz)

  • Synergy
    8th Apr 2015 Member 1 Permalink

    Created a cool little Fibonacci program with the assembler. It will just loop forever after it overflows, as I can't be bothered doing a for loop.

     

    DCO "@cTHIS PROGRAM WILL GENERATE THE FIBONACCInSEQUENCE...nn" ; ends at 14.
    DB 0x1, 0x0 ; puts 0 in RAM1
    DB 0x2, 0x1 ; puts 1 in RAM2
    LD 0x1, 0x1 ; loads RAM1 to register1
    LD 0x2, 0x2 ; loads RAM2 to register2
    ADD 0x1, 0x2 ; adds register 1 and register 2
    DIR 0x1, NUL ; displays the result from register 1
    DCO "@, " ;
    ADD 0x2, 0x1 ; adds register 2 and register 1
    DIR 0x2, NUL ; displays the result from register 2
    DCO "@, " ;
    JMP 0x7, 0x13 ; jumps back to the first addition

    Edited 2 times by Synergy. Last: 14th Apr 2015
  • Factorial
    8th Apr 2015 Banned 0 Permalink
    This post is hidden because the user is banned
  • Synergy
    8th Apr 2015 Member 0 Permalink

    Because saves can only be on frontpage for a week maximum. After that, they're taken off automatically. 

  • Factorial
    8th Apr 2015 Banned 0 Permalink
    This post is hidden because the user is banned
  • oldmud0
    8th Apr 2015 Member 0 Permalink

    Don't worry, just make a Synergy Computer v1.1!

     

    Also, you shouldn't use the 0x prefix where it's not needed. It looks very ugly and annoying when you do that. For instance, 0x1 is already equivalent to 1 in base 10. You should also add support for the 'h' suffix.

    Edited once by oldmud0. Last: 8th Apr 2015
  • drrs
    8th Apr 2015 Member 0 Permalink

    The support for the 'h' suffix was already in, I just forgot to add a check for it when the assembler was getting all the numbers from the file. I committed the new .exe to my github.

     

    I also added support for using no prefix or suffix when using the numbers 0-9 in hex.

     

    Those improvments to the IF statement would be pretty sweet...

    Edited 3 times by drrs. Last: 8th Apr 2015
  • Factorial
    9th Apr 2015 Banned 0 Permalink
    This post is hidden because the user is banned
  • Synergy
    9th Apr 2015 Member 0 Permalink

    I am going to update the original post with all of the information. I have one question though. Why is it that computers use hexadecimal for addressing, and not decimal? I understand that hex is a multiple of base 2, like binary, and thus conversion to binary is easier. However is that really a big deal when you're compiling/assembling the program beforehand, and it's all binary at runtime?

    Edited 2 times by Synergy. Last: 9th Apr 2015
  • Factorial
    9th Apr 2015 Banned 0 Permalink
    This post is hidden because the user is banned
  • drrs
    9th Apr 2015 Member 0 Permalink

    It has to do with being able to write one byte with 2 numbers (1 number for each 4 bits) intead of writing out 8 one's and zero's. Where your computer is 29 bit it doesn't cross over as well, but it still works.

     

    Programmers are lazy :P

     

    When I get the time I would like to add labels for the jumps so you don't have to figure out the line to jump to manually (The DCO commands screws up the lines since it has to add instructions for every four chars):

     

    LD 1, 1

    DB 1, EAX

    label:

    INC EAX, NUL

    JMP label

     

    Edited 4 times by drrs. Last: 9th Apr 2015