Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - yrinfish

Pages: 1 ... 4 5 [6] 7 8 ... 10
76
TI Z80 / Re: Happy programming!!
« on: June 15, 2011, 02:10:38 pm »
It doesn't support whitespace yet... And please give an example of 2?


How do I save the content of HL to a pointer?

77
TI Z80 / Re: Happy programming!!
« on: June 15, 2011, 11:08:47 am »
It is not hard (ok, sometimes it is) but it is A LOT of work (I really respect Quigibo, he made Axe YAY)

I placed a link to it, so you can test it...

78
TI Z80 / The Happy Parser
« on: June 15, 2011, 10:31:31 am »
This is my happy thread ;)

CURRENTLY REWRITING THE WHOLE THING.
Because it became a mess, and I got some new ideas to make it better. (Learn While Doing lol)

I am working on a programming language for the 83 etc, (But it is easily retargetable, so anyone who knows er, ti-nspire asm for example, could edit some strings and is ready!!)

I made it with JavaScript (I have a strange relation with that language)

working on a C++ version, so there is an exe for the winows guys coming!!

Current Features:
-Nice name (Happy)
-Operator Precedence
-Somewhat optimized expressions (Crenshaw hates me now)
-Really platform-independent because it's made with JS
-Nothing more yet...

To show what it is currently able to do:
Spoiler For Input and Output:
4+-(5+~3)

is translated to:

   ld hl, 4
   push hl
   ld hl, 5
   ld de, 3
   ld a,e
   cpl
   ld e,a
   ld a,d
   cpl
   ld d,a
   add hl, de
   pop de
   ex de,hl
   ld a,e
   cpl
   ld e,a
   ld a,d
   cpl
   ld d,a
   inc de
   add hl, de



That may seem much, but most of it is the super inefficient unary operator - and ~.
It is able to do * and / too, but that's not a z80 command, and I have no libs yet...


It also optimizes a VERY little bit: for example, it doesn't fall for this one:
(Which is also good to have no precedence)

((((2+3)*4)+5)/7)

is translated to:

   ld hl, 2
   ld de, 3
   add hl, de
   ld de, 4
   call multiply
   ld de, 5
   add hl, de
   ld de, 7
   call divide

Isn't that nice?

Spoiler For Log::
10-06-2011 Started development with a Crenshaw tutorial.
13-06-2011 Because of the horrible output quality, I started rewriting everything.
14-06-2011 Announced it here, posted a poll about precedence. Almost finished the expression parser the same day.
15-06-2011 Getting the pushes and pops right was harder than expected.
16-06-2011 Adding variables (sort-of) and function calls, Still fighting with pushes and pops.
17-06-2011 Still fighting with those #$%^pushes and pops, made a website for it. v0.0.2
18-06-2011 Assignments!! I think I finally fixed the pushes and pops. v0.0.3
19-06-2011 A few things that I want to make better, and going to make it MULTILINE YAY
Between:     v0.0.4
21-06-2011 It was slowly turning into a mess, so I decided to start over. REWRITING YAY
Until now: rewriting almost complete, rewriting it in C++ so it is more usable

Spoiler For Syntax:
var1,var2=nn-nn+(nn--nn)*~nn/var3

nn is a number 0<nn<65535
var is a variable

Link to test it yourself (Please do that!!)

79
TI Z80 / Re: Operator precedence...
« on: June 14, 2011, 07:34:02 am »
By partial I meant that 23+1/4 is 6 and not 23.25.

The syntax will be C-like

80
TI Z80 / Operator precedence...
« on: June 14, 2011, 02:16:14 am »
As some of you know I'm working on a programming language for the TI83/84 etc, but I've got a question:

Do you guys want operator precedence?

It would be less optimized (pushes and pops), but since the compiler is not on-calc, I can work on this. It would also mean more work for me (but that's not really bad)

81
Computer Projects and Ideas / Re: RulerOS
« on: May 25, 2011, 09:41:39 am »
You are actually following that? Wow... Is it hard, I already know lfs, but it seemed too hard for me...

82
Other / Re: Favorite Linux distro
« on: May 25, 2011, 09:31:40 am »
For me:

1: Fedora
2: Gentoo
3: Puppy

83
You did lol, but it does have the same content, so it doesn't matter

84
Other / Re: How to: Design a microprocessor
« on: May 24, 2011, 03:02:25 pm »
Bukkit and some redstone mods will help. but back to the topic, when are the next lessons ready? I'm hungry.

85
TI Z80 / Re: AXLE - 2011 Axe Platformer Contest
« on: May 24, 2011, 02:45:34 pm »
Wow, That's awesome.

86
Computer Projects and Ideas / Re: RulerOS
« on: May 24, 2011, 02:34:31 pm »
Er, wasn't this ruler's project?

and hint: (include an option for Openbox)

87
Computer Projects and Ideas / Re: RulerOS
« on: May 24, 2011, 10:07:15 am »
Ok, this is a little bit confusing. I'll try to explain it:
Gnome is (like KDE) a DE, which means Desktop Environment.
Gnome's Window Manager is called Metacity, it's KDE counterpart is called Kwin.

A Window manager is the program that shows the taskbar (if it has it) and to quote Wikipedia:
Quote from: Wikipedia
A window manager is system software that controls the placement and appearance of windows within a windowing system in a graphical user interface.
It draws your window borders, the desktop and so on.

A DE is a window manager packaged with various programs that are made to work with it. For example KDE:
  • Konsole
  • Konqueror
  • Kate

The heavier winmanagers are Kwin and Metacity, the lighter ones are fluxbox (a little bit ugly)
Openbox(less ugly and inside LXDE)
Xfwm(inside Xfce)

So for me, it is LXDE (Openbox) or Xfce(Xfwm)

88
TI Z80 / Re: Sort of 3D Platformer-Contest Entry
« on: May 24, 2011, 08:55:34 am »
Wow, nice!! 3D!! Isn't the speed an emulator issue? DionJump is faster on-calc than on-emu... (my very little experience)

89
I was bored, and I have a obsession with... Nevermind, here it is.

Made with my iPod Touch (no copy-paste used, everything is hand-codedthumb-coded)
Why js?
Because I hate Apple Waaah. Er, no, because I can't program in any other language with it thanks to Apple. (ok, it's jailbroken, but php is just ... not right for this and bash... There are still windows users here...

Why 4-bit?
To keep it simple, stupid.

And...?
42.





script.js
Code: [Select]
var RAM = [4, 3, 5, 9, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0];
var ip = 0;
var a = 0;
var b = 0;
var c = 0; // for easy xchg
var z = false;



function setFlags(num) {
    if(num == 0) {
        z = true;
    }else{
        z = false;
    }
}

function execOpCode(opCode, arg) {
    var opCodeLength=1;

    switch(opCode){
    case 0:
        break;
    case 1:
        opCodeLength = 0;
        ip = arg;
        break;
    case 2:
        opCodeLength = 2;
        if(!z){
            ip = arg;
            opCodeLength = 0;
        }
        break;
    case 3:
        opCodeLength = 2;
        if(z){
            ip = arg;
            opCodeLength = 0;
        }
        break;
    case 4:
        opCodeLength = 2;
        a = arg;
        break;
    case 5:
        opCodeLength = 2;
        b = arg;
        break;
    case 6:
        opCodeLength = 2;
        RAM[arg] = a;
        break;
    case 7:
        opCodeLength = 2;
        a = RAM[arg];
        break;
    case 8:
        a = abs(a+b);
        setFlags(a);
        break;
    case 9:
        a = abs(a|b);
        setFlags(a);
        break;
    case 10:
        a = abs(a^b);
        setFlags(a);
        break;
    case 11:
        a = abs(a&b);
        setFlags(a);
        break;
    case 12:
        a = abs(~a);
        setFlags(a);
        break;
    case 13:
        a = abs(-a);
        setFlags(a);
        break;
    case 14:
        c = b;
        b = a;
        a = c;
        break;
    case 15:
        a = abs(a-b);
        setFlags(a);
        break;
    default:
        break;
    }
    return opCodeLength;
}

function log(txt) {
    document.querySelector('div#log').innerHTML += txt;
}

function hex(num) {
    var string = num;
    var abcdef = ['a', 'b', 'c', 'd', 'e', 'f'];

    if(num>15) {
        num = abs(num);
    }

    if(num>9) {
        string = abcdef[num-10];
    }
    return string;
}

function abs(num) {
    return num < 0 ? (16-Math.abs(num%16))%16 : num%16;
}

function sanitize() {
    var j = 0;

    for(j=0;j<16;j++) {
        RAM[j] = abs(RAM[j]);
    }
    a = abs(a);
    b = abs(b);
}

function dumpRAM() {
    var k = 0;

    log('[');
    for(k=0;k<16;k++) {
        log(hex(RAM[k]));
    }
    log(']');
}

function parseRAMInputs() {
    var i = 0;
    for(i=0;i<16;i++) {
        RAM[i] = document.getElementById('RAM' + i).value;
/*        document.getElementById('RAM' + i).setAttribute('onclick', 'this.value = ''"');*/
    }
}

function start() {
    var i = 0;
    var counter=0;
    var maxCycles = document.getElementById('cycles').value;

    a = 0;
    b = 0;
    ip = 0;

    parseRAMInputs();
    sanitize();
    log('Starting…<br /> RAM: ');
    dumpRAM();
    log('<br />Cycles to simulate: '+maxCycles+' <br /><br />');
    i=0;
    while(ip<16 && counter<maxCycles) {
        log(hex(ip) + ':' + hex(RAM[ip]));
        ip = execOpCode(RAM[ip], RAM[abs(ip+1)]) + ip;
        log('   a=' + hex(a) + '   b=' + hex(b) + '<br />');
        counter++;
    }
    log('<br />');
    if(counter==maxCycles) {
        log('Stopped: max cycles reached.<br />');
    }
    log('RAM:       ');
    dumpRAM();
    log('<br />register a=                '+hex(a));
    log('<br />register b=                '+hex(b));
    log('<br />instruction pointer ip=    '+hex(ip));
    log('<br />zero flag z=            '+z+'<br />');
    return;
}


.html
Code: [Select]
<!DOCTYPE html>
<html>
    <head>
        <title>interpreter</title>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width" />
        <script src="script.js"></script>
    </head>
    <body onload="42">
        <form id="settings">
            <label for="cycles">Cycles</label>
            <input id="cycles" type="textbox" value="32" />
            
            <div id="RAM">
                <input id="RAM0" type="textbox" value="0" size="1" />
                <input id="RAM1" type="textbox" value="0" size="1" />
                <input id="RAM2" type="textbox" value="0" size="1" />
                <input id="RAM3" type="textbox" value="0" size="1" />

                <input id="RAM4" type="textbox" value="0" size="1" />
                <input id="RAM5" type="textbox" value="0" size="1" />
                <input id="RAM6" type="textbox" value="0" size="1" />
                <input id="RAM7" type="textbox" value="0" size="1" />

                <br />

                <input id="RAM8" type="textbox" value="0" size="1" />
                <input id="RAM9" type="textbox" value="0" size="1" />
                <input id="RAM10" type="textbox" value="0" size="1" />
                <input id="RAM11" type="textbox" value="0" size="1" />

                <input id="RAM12" type="textbox" value="0" size="1" />
                <input id="RAM13" type="textbox" value="0" size="1" />
                <input id="RAM14" type="textbox" value="0" size="1" />
                <input id="RAM15" type="textbox" value="0" size="1" />
            </div>
            
            <input id="submit" type="button" value="Simulate" onclick="start()" />
        </form>
        <tt><div id="log" style="white-space:pre;"></div></tt>
    </body>
</html>

90
Computer Projects and Ideas / Re: RulerOS
« on: May 24, 2011, 08:39:59 am »
Sorry Eeems, but I really want to help, and the 'spam' (which I hid in a spoiler) was just to show how incredibly good Torvalds is at flaming.

And what about Xfce? It is light-weight, but still visually appealing.

Pages: 1 ... 4 5 [6] 7 8 ... 10