AS2 Push
So I was arguing a long time ago with one of the mods here how push works, and I kind of had to look it up to work on a new aob, so I figured I would finally write up how push works in AS2/AVM1(0?) if for no reason other than to have it written down in one easy to find spot.
lets just dive into a sample push
push 65535
96 05 00 07 ff ff 00 00 0cSo, what does these numbers mean?
op -len-- ----data------
96 =push
05 00 = 5 {00 05}(length of data, short)
07 = int {signed} (datatype)
ff ff 00 00 = 65535 {00 00 ff ff} (data)
pay special attention to that 07. It is a flag that tells flash that an integer object is being pushed onto the stack. there are 9 different object flags for push.
00 - string
01 - float
02 - null
03 - undefined or NaN or something like that
04 - variable/constant pool item
05 - boolean
06 - double
07 - integer
08 - dictionary item
Each of these flags has a set datalength except string which is null terminated, youll need to know these for the length part of the push instruction
flag--# of bytes
00 -- strlen+1
01 -- 8 (?unsure here)
02 -- 0
03 -- 0
04 -- 1
05 -- 1
06 -- 8
07 -- 4
08 -- 1
[hr:kgotpf7h][/hr:kgotpf7h][hr:kgotpf7h][/hr:kgotpf7h]
ok so lets see push in action
c_pistol_score=so.data.c_pistol_score
//96 04 00 08 17 08 04thats no fun, i need 50 000 for the badge, lets make it
_push "c_pistol_score" "so"
//1c
_getVariable
//96 02 00 08 08
_push "data"
//4e
_getMember
//96 02 00 08 17
_push "c_pistol_score"
//4e
_getMember
//1d
_setVariable
c_pistol_score=50000;//50000==0x0000c350
//96 07 00 08 17 07 50 c3 00 00painless.
_push "c_pistol_score" 50000
//1d
_setVariable
//02 02 02 02 02 02 02 02 02 02
NOP NOP NOP NOP NOP ... NOP
oh and here is string. its tricky, because the null termination is 00 not 02. so dont get snagged.
op -len- str_k _o _l _o _n _e _l _k _a _d _a _t null-termination
96 0e 00 00 6B 6F 6C 6F 6E 65 6C 6B 61 64 61 74 00
_push "kolonelkadat"
happy hacking.
I use this AoB tool to make all the AoBs I post. Try the online version if you dont feel like downloading it.
"Obviously, windows are central to Windows. They are so important that they named the operating system after them. But what is a window?"
