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.


Topics - yrinfish

Pages: [1]
1
TI Z80 / TinyCraft [Axe]
« on: January 05, 2012, 05:09:49 pm »
Vote for it ^ or post a suggestion here.

I' ve made a temporary project home page, but there's not really a lot to see there yet.
No mini competition please, teamwork is better :D

Details
Language: Axe
Platform: TI 83+

Things we'll need to do/make
Draw the sprites. saintrunner
A save file format. yrinfish
A level generator.
A Tilemapper.
Some sort of AI.
Crafting system.

People on it (AFAIK)
annoyingcalc
saintrunner
Hayleia (your avatar is really cool btw)
epic7
Blue Raven
yrinfish
leafiness0

Useful info
For those who are going to work on this
General Program Structure
Spoiler For Spoiler:

:.Sprite Data
:.Other Data
:
:.Main menu
:.Option Start Game->init
:.Option How To Play->help
:.Option About->crdt
:
:.BEGIN init
:.Save file is present?
:.yes->strt
:.no->lgen
:.END init
:
:.BEGIN lgen
:.Make appvar appvMCSAVE
:.create 7 levels
:.edit for sky, mines, deep mines, nether
:.END lgen
:
:.BEGIN strt

~~~~ working on this ~~~~

Save file/Maps
Spoiler For Spoiler:
I was thinking about making them 32x32 (x2 for the depth) = 2KiB per map. If I'm right there are 5 seperate height maps, so that would be 10KiB in total.
We could also make it fit within the 16KiB boundary, and then we have space for another 2 maps (and some space (2 KiB should be enough) for inventory, entity etc data), so that we can have 1 Nether, 2 Deep Mines, 2 Mines, 1 Surface, 1 Sky.
Tiles
Spoiler For Spoiler:
Wheat
Water
Tree
Stone
Stairs
Sapling
Sand
Rock
Ore
Lava
InfiniteFall
Hole
HardRock
Grass
Flower
Farm
Dirt
Cloud
CloudCactus
Cactus

Biomes
Spoiler For Spoiler:
--Sky
Cloud
--Surface
Forest
Meadow
Plains
Cliffs
Mountain
Desert
Ocean
--Underground
Mines
Deep Mines
Nether

Items
Spoiler For Spoiler:
--Tools
Pick
Axe
Hoe
Shovel
--Weapon
Sword
--Utilities
Pow Glove
Workbench
Furnace
Lantern
Anvil
Oven
Chest
--Resources
Apple
Bread
Cloth
Slime
Wood
Seeds
Wheat
Acorn
Cactus
Flower
Cloud
Dirt
Stone
Sand
Coal
Iron Ore
Gold Ore
Gem
Glass
Iron
Gold

Recipes
Spoiler For Spoiler:
Lantern: 5 wood, 10 slime, 4 glass
Oven: 15 stone
Furnace: 20 stone
Workbench: 20 wood
Chest: 20 wood
Anvil: 5 iron ingots
Iron ingot: 4 iron ore, 1 coal
Gold ingot: 4 gold ore, 1 coal
Glass: 4 sand, 1 coal
Bread: 4 wheat

Wooden:
Sword: 5 wood
Axe: 5 wood
Hoe: 5 wood
Pickaxe: 5 wood
Shovel: 5 wood

Stone:
Sword: 5 wood, 5 stone
Axe: 5 wood, 5 stone
Hoe: 5 wood, 5 stone
Pickaxe: 5 wood, 5 stone
Shovel: 5 wood, 5 stone

Iron:
Sword: 5 wood, 5 iron ingot
Axe: 5 wood, 5 iron ingot
Hoe: 5 wood, 5 iron ingot
Pickaxe: 5 wood, 5 iron ingot
Shovel: 5 wood, 5 iron ingot

Gold:
Sword: 5 wood, 5 gold ingots
Axe: 5 wood, 5 gold ingots
Hoe: 5 wood, 5 gold ingots
Pickaxe: 5 wood, 5 gold ingots
Shovel: 5 wood, 5 gold ingots

Diamond:
Sword: 5 wood, 50 gem
Axe: 5 wood, 50 gem
Hoe: 5 wood, 50 gem
Pickaxe: 5 wood, 50 gem
Shovel: 5 wood, 50 gem

2
Computer Programming / File reading with c/c++
« on: August 18, 2011, 03:09:10 am »
I want to be able to do this on a file:

Code: [Select]
myChar = getTheNthCharOrSomething(9);
that for example in pseudo-code, getTheNthCharOrSomething() is this:

Code: [Select]
char getTheNthCharOrSomething(where) {
    return file.charAt(where);
}

file is a global var.

3
Computer Projects and Ideas / Designing Happy - OOP
« on: July 16, 2011, 05:25:10 am »
Ok, I'm trying to add OOP to Happy.
I only have a small problem:

Where do I place te objects, and how big?

It is simple with objects like this:

Code: [Select]
type point[2] {
    ubyte x;
    ubyte y;
}

// And in the program or global declarations:

point lol;


I can place this with the other vars after the code, and I know I need 2 bytes of space

But even this approach gives problems:
For example, how do I give it initial values? 

Amd when using the stack, How do I know the amount of space left?

And this gives even more problems:

Code: [Select]
type string[] { // Yup, no native support
    ubyte[] value;
    
    empty create(ubyte[] in) { // empty is a subroutine type
        // Loop and copy the string
    }
}

This one doesn't make sense, because we have the same data twice in RAM.

Code: [Select]
type enemy[10] {
    ubyte x;
    ubyte y;
    ubyte[8] sprite; // The monochtome sprite data

    empty move(sbyte dx, sbyte dy) {
        x = x + dx;
        y = y + dy; // update the pos
    }
}

To make it short:
1. Happy doesn't always know how big it is
2. How can initial values be set?
3. How do I stop the program from corrupting things in RAM, with a ever-growing stack?

4
Minecraft Discussion / Omnimaga minecraft server
« on: June 18, 2011, 05:21:25 am »
What about an omnimaga minecraft server??

We have to think about a few things then:
Survival or freebuild?
Vanilla or Bukkit?
Who's going to host it?
Whitelist?
Omnimaga-only?


Whoa, a lot of questions!!
I am good with bukkit mods etc, but I can't host it...

5
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!!)

6
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)

7
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>

8
ASM / Assembler
« on: April 19, 2011, 10:47:17 am »
OK, I want to learn z80 assembly, but TASM isn't compatible with my shiny amd64 laptop.

And it is OLD.

Are there better assemblers out there?

PS: I've used some NASM for Linux, so that one would be great

9
Axe / getKey question
« on: March 17, 2011, 10:11:51 am »
I'm trying to make a key remapping function for DionJump, in Settings, users can edit the keys and the number is saved to an appvar.

But when I try to check the keys, it doesn't work...
Code: [Select]
:If getKey({K+2}) // K is the pointer to the appvar.
: ...
:End

Here is my source, the getKey is changed back to getKey(41), to make the game work. Please don't ask questions about the rest of the code, it isn't really good code, I know that...
WHOA, that's BIG, BIIIIIIIIIIIIIIIIIIIG, did I make that in 4 days ???
Spoiler For Spoiler:
:.NEWJUMP
:DiagnosticOff
:Fix 5
:.---------DATA
:[30]→Pic0
:[8CFC22A5E121A2FCFCA221E1A522FC8C1C62898581621C10020505050505050208151715151715080002050205020502]
:"vsnewJump→Str0
:"vinewJump→Str1
:det(128)→GDB0:
:.--------START
:sub(IN,1,Str0,1,6,Pic0,Str1)
:GetCalc(Str1)→L:GetCalc(Str0)→K:ClrDraw
:ClrHome
:.---------MENU
:Lbl RE
:Normal
:0→D→F→H→M→N→O→P→R→W→X→Y→Z→θ
:Fix 1
:Text(9,9,"DionJump"
:Line(40,20,89,20)
:Line(39,21,39,61)
:Line(40,62,89,62)
:Line(90,61,90,21)
:Text(42,22,"Easy")
:Text(42,30,"Normal")
:Text(42,38,"Hard")
:Text(42,46,"Insane")
:Text(42,54,"Settings")
:DispGraph
:Repeat getKey(9)
: If getKey(1) and (M<4)
:  M+1→M
:  1
: ElseIf getKey(4) and (M>0)
:  M-1→M
:  1
: Else
:  0
: End
: If
:  rref(40,8*M+21,50,9)
:  DispGraph
:  Pause 400
:  rref(40,8*M+21,50,9)
: End
:End
:Fix 0
:Pause 500
:.--------APPLY
:If M=0
: 125→R
:ElseIf M=1
: 080→R
:ElseIf M=2
: 040→R
:ElseIf M=3
: 020→R
:Else
: Goto HLP
:End
:If Full
: R*3→R
:End
:{K+2}→N
:{K+3}→O
:{K+4}→P
:.----INIT GAME
:3→{GDB0+56}
:1→{GDB0+57}
:For(I,0,10)
: rand^27*2+GDB0→M
: 3→{M}
: rand^96→{M+1}
: rand^27*2+58+GDB0→M
: 3→{M}
: rand^96→{M+1}
:End
:32→Y:16→X
:.----GAME LOOP
:While 1
:Pause R
:.---------KEYS
:If getKey(49)
: Return
:End
:0→θ
:If getKey(54)
: -3→θ
: 0→F
:ElseIf getKey(41)
: 3→θ
: 8→F
:End
:.----DATA EDIT
:Z-1→Z
:Y+θ+4^64-4→Y
:For(I,0,63)
: 2*I+GDB0→M
: If {M+1}>95 or ({M+1}=0)
:  0→{M}r
: End
:End
:
:.---COLLISSION
:For(I,0,12)
: Y+I-6*2+GDB0→M: If X<<0
:  Text(2,14,"Luckily we've got doctors..."
:  Text(5,26,"Otherwise you'd be pretty")
:  Text(32,32,"dead now.")
:  Text(7,57,"Press [ENTER] to restart.")
:  DispGraphClrDraw
:  Repeat getKey:  End
:  If getKey(9)
:   Pause 1000
:   Goto RE
:  End
:  ClrHome
:  Fix 4
:  Return
: ElseIf {M+1}+8+1000>(X+Z+1000) and ({M+1}+1000<(X+992)
:  If {M}<6 and ({M}>2)
:   {M+1}+8→X
:   0→Z
:  End
: ElseIf {M+1}=(X-8)
:  If {M}=3
:   8→Z
:  ElseIf {M}=4
:   10→Z
:  ElseIf {M}=5
:   0→{M}r
:  End
: End
:End
:
:
:
:
:.----DATA EDIT
:X+Z→X
:If X>70 and (X<100)
: X-70→M
: X-M→X
: H+M→H
: For(I,0,63)
:  {I*2+GDB0+1}-M→{I*2+GDB0+1}
: End
: !If rand^20
:  sub(GEN,4,M)
:  H→D
: Else!If rand^15
:  sub(GEN,5,M)
: ElseIf H-D>25
:  sub(GEN,3,0,95)
:  H→D
: End
:End
:
:.------DRAWING
:For(I,0,64)
: If {2*I+GDB0}
:  Pt-On({2*I+GDB0+1},I,8*{2*I+GDB0}+L)
: End
:End
:Text(74,0,H►Dec:Pt-On(X,Y,L+F)
:
:DispGraphClrDraw
:End
:
:prgmLINIT
:
:
:.-------BARGEN
:Lbl GEN
:While {rand^64*2+GDB0→A}
:End
:r1→{A}
:If r2
: 95-(rand^r2)→{A+1}
:Else
: r3→{A+1}
:End
:Return
:
:Lbl HLP
:ClrDraw
:Fix 1
:Text(9,9,"Settings"
:Line(40,20,89,20)
:Line(39,21,39,61)
:Line(40,62,89,62)
:Line(90,61,90,21)
:Text(42,22,"Change")
:Text(42,30,"Controls")
:Text(42,38,"About")
:Text(42,46,"You lost")
:Text(42,54,"Back")
:DispGraph
:sub(CHS)
:!If M
: 9→A
:ElseIf M=1
: ClrDraw
: Fix 0
: Text(9,9,"Press the key to go left.")
: DispGraph
: sub(PCK)→{K+2}: Text(66,9,"right.")
: DispGraph
: sub(PCK)→{K+3}: Text(60,9,"quit.           ")
: DispGraph
: sub(PCK)→{K+4}:ElseIf M=2
: 11→A
:ElseIf M=3
: 0→M
:Else
: Goto RE
:End
:Text(45,57,"Press a key...")
:DispGraphClrDraw
:Pause 1000
:Repeat getKey
:End
:Goto RE
:
:Lbl CHS
:Repeat getKey(9)
: If getKey(1) and (M<4)
:  M+1→M
:  1
: ElseIf getKey(4) and (M>0)
:  M-1→M
:  1
: Else
:  0
: End
: If
:  rref(40,8*M+21,50,9)
:  DispGraph
:  Pause 400
:  rref(40,8*M+21,50,9)
: End
:End
:Fix 0
:Pause 500
:M
:Return
:
:Lbl PCK
:Pause 1000
:Repeat getKey
:End
:getKey

10
TI Z80 / DionJump: a DoodleJump clone for the calcs
« on: March 12, 2011, 09:03:31 am »
I've made too, with Axe (where is my cheerleader smiley? ;D)


Uploaded it

11
Introduce Yourself! / Hello everybody
« on: March 11, 2011, 04:12:27 pm »
A little introduction.
I started programming in Axe about three months ago, and haven't written a single line of TI-BASIC since then. I am also able to program in some computer languages: Java, PHP, (a little bit) C, (X)HTML and JS, but those two aren't really computer languages. I live in the Netherlands, so if I make any language mistakes, correct me.
I have written a Doodle Jump clone called DionJump in Axe. Currently I'm adding functions to it. I'm also making a clone of Angry Birds, but that one isn't doing anything useful yet.

I hope I'm going to learn much here.

Yrnfsh

Edit1: added the word "language"
Edit2: whoa, got some sort of ninja'd on my FIRST post :o

Pages: [1]