Ray162K, the 16-bit computer

  • Schmolendevice
    15th Mar 2015 Member 1 Permalink

    @tjitte (View Post)

     I saw your ideas for 'embedded' labels and string handling. I'd guess that would be nice but to some extent when I think of it, variables and string memory allocation are things perhaps completely handled by the operating system and or your compiler as in all your high level code gets converted into all of the machine code and sub routines designed to 'emulate' those features. I guess it would be nice for this computer system to aid higher level features since it runs at 3.75 Hz. But hey, hang on there as lately I've just gotten through a break through in my present designs and am nearing completion of a 64 FILT 60 Hz FRAM. The magic of solid spark, DRAY and PSTN put together. I'd imagine that once we get into the world of multi-core single 1 to 2 instructions per frame (with my planned instruction set design) per core processing higher level compilers and string handling will be more viable. In fact my ambitions for TPT computing are to be able to have a full simplified operating system with keyboard and in system compiler. And yes, I am indeed working on the technology for a 50 frame update 120 by 100 pixel graphics display :D.

     

    I'm just setting up an initial demonstration right now that interfaces with the data input, read and write set plus the FILT output. I'm presently pleased with its theoretically robust operation that solely relies on the transfer of ctypes here and there. Once that's done I want to make a demonstration that allows the user to make multiple inputs and press a button to output all its contents in an 'inverse whopping' 64 frames or instead load random values into it. I've been struggling with this design for a while now until I came upon the magical idea to incorporate a solid spark ARAY 'reading head' onto the moving PSTN arm too. I'd say it's pretty compact for now and personally would work towards the development of highly compact CPU cores for multi-cored systems. 

     

    Good day thence.

     

    Schmolendevice,

    3/14/15 11:31 PM ET NA.

     

    There's that: id:1751002. Still yet to make smaller, specialized counters.

    Edited once by Schmolendevice. Last: 15th Mar 2015
  • LBPHacker
    15th Mar 2015 Developer 0 Permalink

    @tjitte (View Post)

    Thank you for you feedback, it is actually extremely useful. So, labels. Goddamn shame on me for forgetting that labels can be used like that in Assembler. I'm going to implement that in the assembler today. About strings ... yeah, generating the address of invidual characters in the string takes an additional add (or sub) instruction in Ray, but I could still do something with the assembler so it'd translate get bx, label+5 to two instructions. Heh, I might just do that.

     

    @Schmolendevice (View Post)

    Stop giving me ideas :D

     

     

    EDIT: The assembler now works with labels for addresses. The download link hasn't changed. See example below:

    ; * Calculates the first few numbers in the Fibonacci sequence
    ; * Outputs them on port #2
    ; * Stores them at 0x03FF and on lower addresses
    ;   * 0x03FF: 1
    ;   * 0x03FE: 1
    ;   * 0x03FD: 2
    ;   * and so on
    ; * Halts on overflow (so when there's no point continuing
    ;   execution due to the numbers reaching the 16-bit limit)
    ; * Turn deco off, you can see the result being written to memory

        mov ax, 1
        mov bx, 0
    fiboloop:
        out ax, 2
        get cx, o_pointer
        put ax, cx
        sub cx, 1
        put cx, o_pointer
        mov cx, ax
        add ax, bx
        mov bx, cx
        jnc fiboloop
        hlt
    o_pointer: dw 0x03FF

    Edited once by LBPHacker. Last: 15th Mar 2015
  • tjitte
    15th Mar 2015 Member 0 Permalink

    @LBPHacker (View Post)

     Great! that is a big improvement! and stupid me did not notice you can actualy just do this:

     

    GET BX,AX ; <-- that

     

    this worked just fine, so strings should work, kind of...

     

    the problem I encountered was that you cant store the adress of a label, only the contend of that adress.
    so

    GET AX,LABEL

    LABEL: dw 0xCAFE

     

    would set AX to 0xCAFE, were I would like to see the adress were 0xCAFE is stored. when reading the contend of LABEL, you could use GET AX,[LABEL]. this way you can,for example, store the adress of a string, do some calculations to get a specivic letter and print them to a port

    that would not work either :(, since you cant directly set register... maybe you should implement an instruction that could set the 8 least or most segnificant bits so we can shift a 16 value semi-imidiant

     

     

     

    Edited once by tjitte. Last: 15th Mar 2015
  • LBPHacker
    15th Mar 2015 Developer 0 Permalink

    There is a mov reg, imm but don't tell me I missed mov reg, label ... damn this is awkward ...

     

    A new patch is coming for RASM then.

     

    EDIT: You can do both mov reg, imm and mov reg, label now. Same download URL.

     

    EDIT #2: I have a feeling it's not as obvious as I think that the term operand may mean a register or an immediate value as well. The only difference between mov reg, reg and mov reg, imm are the secondary operand bits, they are 11 instead of 00, 01 or 10. The case is the same with all two-operand instructions; that's how eg. add ax, 1 works; primary operand is 00 (or some other register), secondary operand is 11.

     

    From the machine's point of view, the immediate is the 4th register. Take a look at the Ray162K: Parts save, you can see there that there're actually four registers, the bottommost being the "immediate register", one that always mirrors the lowest 16 bits of the value last read from memory. That's how the immediate value encoded in an instruction gets in there.

    Edited 5 times by LBPHacker. Last: 15th Mar 2015
  • tjitte
    15th Mar 2015 Member 0 Permalink

    the script now seems to have truble with looking for labels.. it says: label not found. only when I define the label befor I use it. I dont get this error

  • LBPHacker
    15th Mar 2015 Developer 0 Permalink

    @tjitte (View Post)

     Fixed. Check your messages.

  • silverknight108
    15th Mar 2015 Member 0 Permalink
    Finally figured out how to use it.Done some addition , but I don't fully understand how to write your own programs though.
  • RockerM4NHUN
    17th Mar 2015 Member 0 Permalink

    Az összegyúrást úgy gondoltam, hogy a te adatrendszered a filt-el kenterbe veri az enyémet bitszélességben, de a logikákat nem tudom mennyire könny? filttel megoldani. Az alapok, mint xor, meg ilyenek, azt ha jól tudom támogatja maga a filt is, de pl egy N bites összeadást (nem tudom a tiéd milyen gyors) az én rendszerem 6 frame alatt megoldja. Szóval igazából összegyúrni a logikákat lehetne, az adatbusz és memória az mindenképpen filt. Igaz nem valami optimális, de azért meg van építve a decimális I/O is. Meg a pipelinet az enyémr?l biztos le tudod koppintani, azon sem kell rágódnod. Annyi, hogy kell hozzá egy-két vezérl? szál. Talán ezt inst-el jól meg lehet oldani. Annyi pozitívum az enyém mellé, hogy a shifter egységet leszámítva abszolút glitch mentes 2 frames kapcsolókat használtam. (A filt-es technológiáról szinte fingom sincs.)

  • LBPHacker
    17th Mar 2015 Developer 0 Permalink

    Az adder nálam is jó gyors, kb. 8 frame N-bitnél (nagyon hasonlóan a Micro adderjéhez a Raynek is id?utazó Ripple-Carryje van; különben hogy lennék meg 16 bittel 16 frame alatt (+ még adatvándorlás ugye)). A pipelineon elgondolkoztam, és biztos, hogy legközelebb használni fogom. Ja, mert ez most csak egy próba volt (ehhez képest rákapott a nép); csak megpróbáltam építeni filttel egy gépet. És sikerült. De egyel?re most hagyom a powdert, akadt mit programoznom végre.

    Edited once by LBPHacker. Last: 17th Mar 2015
  • tjitte
    17th Mar 2015 Member 0 Permalink

    I made a text terminal for the ray16. now, with a litle bit of code you can print stings to a screen!. it prints about 1 char every second, geven you use 3 instructions per char.

     

    https://powdertoy.co.uk/Browse/View.html?ID=1751485

     

    here is a code that prints a text to port 7:

     


    start:
        mov cx, string
        get ax, cx;get length of the string
        add ax, cx;calculate last adress
    loop:
        get bx,cx
        out bx, 7
        add cx, 1
        jmp loop
        
    string:
        ds "HELLO WORLD  "
    anotherstring:
        ds "HOW ARE YOU"

     

     

    Its crude, but it works!

    Edited once by tjitte. Last: 17th Mar 2015