July 11, 2020, 02:06:35 pm

The shoutbox is currently out of service. Join us on Discord instead.
You can help CodeWalrus stay online by donating here.

WARNING: DO NOT UPGRADE your TI-83 Premium CE or TI-84 Plus CE to OS 5.5.1 and higher. It removes all compatibility with most games and removes ASM/C programming! DOWNGRADING IS IMPOSSIBLE. BE WARNED! Likewise, do NOT update your TI-Nspire CX past OS 4.5.0, else using Ndless and ASM/C programs will be impossible.

Some super crappy Axe code...

Started by p2, August 24, 2016, 11:41:43 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

p2

Quote from: Hayleia on August 28, 2016, 05:13:13 pm
Quote from: p2 on August 26, 2016, 05:50:59 pm
{{L1+123}}^r+Var->Var This would actually just double the value and store it again as {{L1+123}} is the memory position that "Var" is pointing at
Well, no, why do you double the "{}"? Var is the same as {°Var}^r which is {L1+123}^r, not {{L1+123}}^r.

I'm sorry I thought for a moment it was {{ }} not { }...  9_9 But if it all would have been correct otherwise, I just understood another part about Axe  :love:

And about modifying code: You say you should either write super modified code from the beginning or stay with your crappy code? No modifications afterwards? ^^
Guess for you it's rater the 1st not the 2nd xD

As for the bug I'm guessing it's not in the .borders nor in the main loop.... since it was still functional after I modified these sections... which leaves the main collision codes for interactions with the player... At least all those concerning the Y-axis ^^ still gonna be enough work :P
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

E37

Instead of doing:

L1->°BposX
L1+2->°BposY
L1+4->°BmovX
L1+6->°BmovY
L1+8->°BdirX
L1+10->°BdirY

You could do:

L1->°BposX+2->°BposY+2->°BmovX+2->°BmovY+2->°BdirX+2->°BdirY

Which in my opinion is more readable and prevents errors like defining two variables to the same spot.
It wouldn't  change the size or speed of the compiled program though.
Don't worry too much about how readable your code is if no one else is going to read though. (as long as you can!)
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

p2

It stopped being readable even to me a long time ago lol
I already started to only code when having my laptop by and then typing the exact same stuff I do on the calc on my laptop, too, so I end up with a text file of my code xD So I don't have to read the stuff on my calc anymore but instead read the source on my laptop screen ^^ Works great this way  :thumbsup:
Gonna add that, too (thx E37!), and do the debugging tomorrow I guess :)
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Hayleia

Quote from: E37 on August 28, 2016, 09:51:44 pm
Instead of doing:

L1->°BposX
L1+2->°BposY
L1+4->°BmovX
L1+6->°BmovY
L1+8->°BdirX
L1+10->°BdirY

You could do:

L1->°BposX+2->°BposY+2->°BmovX+2->°BmovY+2->°BdirX+2->°BdirY

Which in my opinion is more readable and prevents errors like defining two variables to the same spot.
It wouldn't  change the size or speed of the compiled program though.
Don't worry too much about how readable your code is if no one else is going to read though. (as long as you can!)

I don't find it more readable (to each their own :P) but I agree that's a great way to avoid defining two variables to the same spot. I asked Runer if it would be possible to do this on several lines like L1-2:+2->°Meh:+2->°Toast etc, which seems impossible just like this (due to being preprocessor directives) but with a character that would say "ignore the following character", it could work, like L1-2':+2->°Meh':+2->°Toast etc, where the ' tells the parser to ignore the newline.
I don't remember his answer but at worst, that's just for a bit more readability so it doesn't matter that much.

p2

Quote from: Hayleia on August 29, 2016, 07:26:22 am
Quote from: E37 on August 28, 2016, 09:51:44 pm
Instead of doing:

L1->°BposX
L1+2->°BposY
L1+4->°BmovX
L1+6->°BmovY
L1+8->°BdirX
L1+10->°BdirY

You could do:

L1->°BposX+2->°BposY+2->°BmovX+2->°BmovY+2->°BdirX+2->°BdirY

Which in my opinion is more readable and prevents errors like defining two variables to the same spot.
It wouldn't  change the size or speed of the compiled program though.
Don't worry too much about how readable your code is if no one else is going to read though. (as long as you can!)

I don't find it more readable (to each their own :P) but I agree that's a great way to avoid defining two variables to the same spot. I asked Runer if it would be possible to do this on several lines like L1-2:+2->°Meh:+2->°Toast etc, which seems impossible just like this (due to being preprocessor directives) but with a character that would say "ignore the following character", it could work, like L1-2':+2->°Meh':+2->°Toast etc, where the ' tells the parser to ignore the newline.
I don't remember his answer but at worst, that's just for a bit more readability so it doesn't matter that much.



Okey now I'm really confised because I remember someone having told me that this would NOT work:
L1->°BposX:+2->°BposY
since it'd have nothing to do with the HL register... ???
Then why would whis be so different?
it's just the "new line" symbol missing... O.o
L1->°BposX:+2->°BposY    //won't work
L1->°BposX+2->°BposY     //will work
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Hayleia

Quote from: p2 on August 29, 2016, 08:16:41 am
Quote from: Hayleia on August 29, 2016, 07:26:22 am
I don't find it more readable (to each their own :P) but I agree that's a great way to avoid defining two variables to the same spot. I asked Runer if it would be possible to do this on several lines like L1-2:+2->°Meh:+2->°Toast etc, which seems impossible just like this (due to being preprocessor directives) but with a character that would say "ignore the following character", it could work, like L1-2':+2->°Meh':+2->°Toast etc, where the ' tells the parser to ignore the newline.
I don't remember his answer but at worst, that's just for a bit more readability so it doesn't matter that much.

Okey now I'm really confised because I remember someone having told me that this would NOT work:
L1->°BposX:+2->°BposY
since it'd have nothing to do with the HL register... ???
Then why would whis be so different?
it's just the "new line" symbol missing... O.o
L1->°BposX:+2->°BposY    //won't work
L1->°BposX+2->°BposY     //will work


Well yes, it won't work, I didn't say the contrary in my post (or at least if I did, I didn't mean it at all).
That's why I asked Runer for a workaround, to be able to insert newlines and tell the parser to ignore them.

p2

But isn't teh user forced to do L1+0->°BposX:°BposX+2->°BposY because °BposX is never moved to HL in the first place since it's something the compiler replaces with some other tuff without even touching HL...? Or did I misunderstand that...? :/
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Hayleia

Quote from: p2 on August 29, 2016, 10:24:04 am
But isn't teh user forced to do L1+0->°BposX:°BposX+2->°BposY because °BposX is never moved to HL in the first place since it's something the compiler replaces with some other tuff without even touching HL...? Or did I misunderstand that...? :/
Yes, he is forced to do that. And I still never said the contrary (or never meant to).

p2

ooooh
so that means that 0->A+2->B is NOT the exact same as 0-A:+2->B  O.O
so if I undestood it corrctly it means that THIS one is gonna use the HL register:
0->A:+0->B:+2->C
while this one does NOT use it:
0->A->B+2->C

(I know that code makes no sence but I just wasnt sure if 0->A:->B woud be correct) xD
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Hayleia

Quote from: p2 on August 29, 2016, 11:35:28 am
ooooh
so that means that 0->A+2->B is NOT the exact same as 0-A:+2->B  O.O
so if I undestood it corrctly it means that THIS one is gonna use the HL register:
0->A:+0->B:+2->C
while this one does NOT use it:
0->A->B+2->C

(I know that code makes no sence but I just wasnt sure if 0->A:->B woud be correct) xD
No, I don't know what you think you understood today but really no, it was better yesterday :P
0->A+2->B is the exact same as 0->A:+2->B.
0->A:+0->B:+2->C uses the HL register and 0->A->B+2->C too, everything does anyway.

p2

okeeeey then I think I know now what it was that I misunderstood:

Quote from: Hayleia on August 26, 2016, 07:13:45 am
And to answer your question on IRC, no, you can't do L1->°Wat:+2->°Lol, because they are preprocessor directives (which isn't an excuse actually, but it explains why A->B:+2->C works and not L1->°Wat:+2->°Lol).


After that I thought every time you decleared a new var with the ° you didnt use HL for some reason which appears to be wrong...

Or am I wrong again  ???

I am confused...  :P
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Hayleia

Quote from: p2 on August 29, 2016, 12:02:38 pm
okeeeey then I think I know now what it was that I misunderstood:

Quote from: Hayleia on August 26, 2016, 07:13:45 am
And to answer your question on IRC, no, you can't do L1->°Wat:+2->°Lol, because they are preprocessor directives (which isn't an excuse actually, but it explains why A->B:+2->C works and not L1->°Wat:+2->°Lol).


After that I thought every time you decleared a new var with the ° you didnt use HL for some reason which appears to be wrong...

Or am I wrong again  ???

I am confused...  :P

Well I really don't know what's happening, because it's true that there is no HL involved in a variable declaration with ° :P
Because this isn't even code actually, you're only telling the compiler "well, I'm too lazy to write L1+123 every time and wonder what it is so I'm going to write °Lolwat instead", but you never wrote any code. To convince you of this, just make a stupid program with only variable declarations in it, then make another stupid program with absolutely nothing. Notice that they're the same size once compiled (if their names are the same length).

E37

Think of it this way:
When you declare a variable, that code is never included in the compiled code. That is just to tell the compiler to replace VarName with what ever it stands for.
When you store values into variables, like 5->A, that is in the compiled code and does affect HL. Since VarName is never run in the compiled code, it won't affect HL.
To prove that variable declarations don't affect HL try this:
:5
:->A
:Disp A>Dec
and it will display 5. Then try this:
:5
:L1_>°AAA
:->A
:Disp A>Dec
Will display 5.
There is a interesting way to get that value though:
:L1+234->°QQQ+27->°ASDF->X
X will then hold the same value as °ASDF
This can be useful if you chained the names like I mentioned above, as you then can :Fill(L1,X-L1,0) to zero all the variables
(which also points out one of the disadvantages of chaining variable declarations: you don't know where they end)
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

p2

allright then, stupid phase is over again I guess ^.^

As long as I only use integers, it should be 2 bytes by default,
8.8 is two bytes, too
X hex long tiles will be X bytes (16, 64, ...)
Aaaand strings are strange but they always were ^^

Actually I think it's super cool to use this method since you can easily access all your vars using some kind of counter now (the adress) which means if I do it correctly I can even work with it as if it was tables ^.^
(like {10*X+Y*2+L1} will be the 2-byte integer at pos X,Y inside this "Table")   :thumbsup:

But I guess I should stick to using thses declarations at the beginning of the program ^^
Quote from: E37 on August 29, 2016, 06:21:46 pm:L1+234->°QQQ+27->°ASDF->X
X will then hold the same value as °ASDF
cause this is just weird xD (It makes sense now but I'd never write it like that ^^)
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

E37

8.8 variables? I don't think I have ever used them outside of experimentation...
yes, there is 8 bytes between each (8x8) sprite. That doesn't mean that you MUST access them in multiples of 8 though... try and find out!
(Or don't and wonder forever...)
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Powered by EzPortal