Iris J1-6 G12 documentaion

  • Lansea
    29th November Member 0 Permalink
    3453919View Save 3453919

    What is it?

    Iris
    J1-6 G12 is a 16-bit computer with six J1 CPU cores, a single ROM cartridge, 12 graphical cores and include a peripheral 160x90 16:9 display and a tactile buffered-input keyboard.

    Using Iris
    By default it is loaded with the spinning cube cartridge. Not every program will use the keyboard.
    To swap a cartridge, copy it and paste it overtop the existing cartridge. It should line up easily with arrow keys.

    How J1 works
    The J1 core puts values on a data stack. The following instructions ADD will not need values specified and assume the last two numbers on the stack.

    Example: LIT 3, LIT 4, ADD

    The first two instruction push values to the stack and the last instruction consumes them (YUM), thus removing them from that stack.

    DUP, OVER, SWAP, DROP and NIP make it easy to organise and rearrange values on the stack

    The CPU also has a return stack. When CALL jumps to a subroutine, it saves where the program should pick up from and resume execution there. Subroutines can call other routines in the same way

    All six cores start at work zero in the ROM and a program can run

    LIT 0 > IN to read its core number (0-5)

    then use that to divide up work.

    Each core has 64 bytes of 'private' RAM for 384 in total.

    FETCH and STORE use byte addresses from 0x00 to 0x3E, Jumps and calls use the ROM word addresses.
    JMP jumps directly and JZ consumes to top value and branches if it was zero.
    LIT can push an immediate from 0 through 32,767

    Supports labels, words with .WORD and combined ops like ADD.RET


    How does the display work?
    The GPU's 12 engines all prepare vertical slices. Each J1 core can select between two engines and all 12 feed a shared raster writer that accepts one 'packet' per sim tick. In the cube demo the J1 code supplies the span coords and face colours.

    It writes in the the buffers and get pushed. I love watching this.

    Ports
    0x000 + colour
    Draws a pixel coloumn 1x2, the low byte is x and the high byre is the vertical band

    0x008 + colour 
    Draws an aligned 4x4 tiles using the same coord format


    0x200 + 8 x strip + colour
    Draws an absolute span. bits 0-5 are the start band and bit 6-11 are the end (exclusive end "<") 
    Bits 12 and 13 clamp a negative start to Zero.
    Bit 15 selects the core's span engine 

    Colour format: 
    0-7.. That's all you get

    0x700 prints ASCII, low byte first. EMIT also sends text here.
    The text engine use 5x7 chars. ASCII 10 or 13 is a carriage return
    And ASCII 8 moves cursor left.

    0x703 clears draw buffer and resets curso,
    0x704 turns on buffer presentation

    0x705 shows the current draw buffer

    0x706 shows it automatically between drawing.

    0x708 acknowledges keyboard events and removes it from the queue (send it from core 0)

    0x710 marks a worker as finished.
    Each core sends 1 << core_id when all six bit have arrives Iris shows the the frame then toggles acknowledgement.
     
    To read input use LIT 0  followed by KEY.
    bits 0-6 are the char code with 0 meaning the queue is empty.
    Bit 8 changes as the queue so programs can distinguish consecutive presses of the same key. 
    Bit 9 changes when the six worker frame finished.

    Example

        Lit 0
        IN
        JZ DRAW
    IDLE:
        JMP IDLE
    DRAW:
        LIT 0
        LIT 0x704
        CALL SEND

        LIT 0
        LIT 0x703
        CALL SEND


        LIT 1288
        LIT 0x267
        CALL SEND

        LIT 0
        LIT 0x705
        CALL SEND

     

        JMP IDLE

     

    SEND:
        OUT

        DROP

        RET

    This programs runs on core 0 and leaves the other 5 idle.
    It clears the buffer, draws a bar in colour 7 and then presents

    Iris is a proof of concept for the J1 instruction set in TPT.
    There is a lot of low hanging fruit in regards to changes.
    But I just wanted to see what six little stack cores could do together, and have some fun making it

    Edited 3 times by Lansea. Last: 29th November