26.08.2016, 21:16
WTF?! Just wanted to ask: Y_Less did it on purpose?!!111
IN "Usage of stack as temporary storage":
we see:
Did anyone get it? xD (Usually, in asm's it collects to PRI(As PRI is A, ALT is B, where a is accumulator register, b is base register))
IN "Finding the address of functions"
Doesn't work with public function, should it be or what?!(Compared with funcidx)
IN "Accessing elements of arrays that are arguments"
#emit LOAD.pri index FACEPALM x999
Also it's ok:
You are loading a value, NOT address!
I think, it should be:
And btw, write right sematics for IDXADDR:
Everyone can get it.
Change it to understandable(not everyone can understand it):
And where is wrong(who didn't get it):
I read until it, Gonna post more <s>bugs</s> easter eggs(maybe).
I see no the first time when Y_Less using trololo functions.
edit 1:
Just gonna wrote here. 8 is 2 symbols as cell is 4. u wouldn't understand maybe cos I wrote it.
IN "Usage of stack as temporary storage":
we see:
PHP Code:
#emit POP.pri //Pop the last pushed value into PRI
//last pushed was local, which had a value of 10 when pushed and hence PRI = 10
//by me: PRI is 10, ALT is 5
#emit CONST.alt 5 //ALT = 5
#emit SDIV //PRI = ALT / PRI (signed divide),ALT = ALT mod PRI
//by me: let's count, 5/10=0
// 5 mod 10= 5
//Now ALT = 0 since 5 divides 10 completely and leaves no remainder
//PRI = 2 since 10 divided by 5 gives 2 <=== WTF?!
IN "Finding the address of functions"
PHP Code:
new addr;
#emit CONST.pri func1
#emit STOR.S.pri addr
IN "Accessing elements of arrays that are arguments"
PHP Code:
public OnPlayerCommandText(playerid,cmdtext[])
{
new index = 2;
#emit LOAD.S.alt cmdtext
#emit LOAD.pri index //<==================== GOOD joke!
Also it's ok:
PHP Code:
#emit LOAD.S.alt cmdtext
I think, it should be:
PHP Code:
#emit CONST.pri cmdtext
PHP Code:
PRI = ALT + (PRI Ч cell size) (calculate indexed address)
Change it to understandable(not everyone can understand it):
PHP Code:
PRI = ALT + CELLSIZE * PRI
PHP Code:
public OnPlayerCommandText(playerid,cmdtext[])
{
new index = 2;
#emit CONST.alt cmdtext
#emit LOAD.S.pri index
#emit IDXADDR //PRI = ALT + (PRI * cell size) (calculate indexed address)
//Now PRI contains the address of the element stored in index 2 of cmdtext (cmdtext[2])
#emit LOAD.I //PRI = [PRI] //Since PRI contains the address of cmdtext[2], [PRI] will give the value stored at index 2
//Instead of using IDXADDR and then LOAD.I, you can do the same with just one instruction using LIDX
//LIDX = PRI = [ALT + (PRI x cell size)]
}
I see no the first time when Y_Less using trololo functions.
edit 1:
PHP Code:
main()
{
new a[] = "AMX Assembly";
new character;
#emit ADDR.pri a
#emit ADD.C 8
#emit LOAD.I
#emit STOR.S.pri character
printf("%c", character);
}
PHP Code:
#emit ADD.C 4*n //where n is amount of symbols