|
@@ -342,8 +342,8 @@ stack_init:
|
342
|
342
|
.loop_buff_init:
|
343
|
343
|
stosd
|
344
|
344
|
loop .loop_buff_init
|
345
|
|
- mov al, 7 * 4
|
346
|
|
- mov [tosp], al
|
|
345
|
+ mov eax, (STACK_SZ - 1) * 4
|
|
346
|
+ mov [tosp], eax
|
347
|
347
|
|
348
|
348
|
sdl_init:
|
349
|
349
|
mov rdi, 0x0000FFFF
|
|
@@ -597,7 +597,7 @@ run_glitch:
|
597
|
597
|
jmp .loop
|
598
|
598
|
.end_glitch:
|
599
|
599
|
xor rbx, rbx
|
600
|
|
- mov bl, [tosp]
|
|
600
|
+ mov ebx, [tosp]
|
601
|
601
|
lea rdi, [stack_buff + rbx]
|
602
|
602
|
mov eax, [rdi]
|
603
|
603
|
; DEBUG
|
|
@@ -626,13 +626,13 @@ OP:
|
626
|
626
|
; push rdi (edi) on stack_buff
|
627
|
627
|
mov eax, edi
|
628
|
628
|
xor rbx, rbx
|
629
|
|
- mov bl, [tosp]
|
630
|
|
- add bl, 4
|
631
|
|
- cmp bl, 8 * 4
|
|
629
|
+ mov ebx, [tosp]
|
|
630
|
+ add ebx, 4
|
|
631
|
+ cmp ebx, STACK_SZ * 4
|
632
|
632
|
jl .go_push
|
633
|
|
- mov bl, 0
|
|
633
|
+ mov ebx, 0
|
634
|
634
|
.go_push:
|
635
|
|
- mov [tosp], bl
|
|
635
|
+ mov [tosp], ebx
|
636
|
636
|
lea rdi, [stack_buff+rbx]
|
637
|
637
|
stosd
|
638
|
638
|
ret
|
|
@@ -641,18 +641,18 @@ OP:
|
641
|
641
|
._pop:
|
642
|
642
|
; pop eax from stack_buff
|
643
|
643
|
xor rbx, rbx
|
644
|
|
- mov bl, [tosp]
|
|
644
|
+ mov ebx, [tosp]
|
645
|
645
|
lea rsi, [stack_buff+rbx]
|
646
|
646
|
xor rax, rax
|
647
|
647
|
lodsd
|
648
|
|
- test bl, bl
|
|
648
|
+ test ebx, ebx
|
649
|
649
|
jz .pop_no_dec
|
650
|
|
- sub bl, 4
|
|
650
|
+ sub ebx, 4
|
651
|
651
|
jmp .pop_end
|
652
|
652
|
.pop_no_dec:
|
653
|
|
- mov bl, 7 * 4
|
|
653
|
+ mov ebx, (STACK_SZ-1) * 4
|
654
|
654
|
.pop_end:
|
655
|
|
- mov [tosp], bl
|
|
655
|
+ mov [tosp], ebx
|
656
|
656
|
ret
|
657
|
657
|
|
658
|
658
|
|
|
@@ -666,7 +666,7 @@ OP:
|
666
|
666
|
cld
|
667
|
667
|
xor rbx, rbx
|
668
|
668
|
xor rax, rax
|
669
|
|
- mov bl, [tosp]
|
|
669
|
+ mov ebx, [tosp]
|
670
|
670
|
lea rsi, [stack_buff+rbx]
|
671
|
671
|
lodsd
|
672
|
672
|
and eax, 0xFF
|
|
@@ -765,7 +765,7 @@ OP:
|
765
|
765
|
ret
|
766
|
766
|
.not:
|
767
|
767
|
call OP._pop
|
768
|
|
- neg eax
|
|
768
|
+ not eax
|
769
|
769
|
mov edi, eax
|
770
|
770
|
call OP._push
|
771
|
771
|
ret
|
|
@@ -781,8 +781,19 @@ OP:
|
781
|
781
|
call OP._pop
|
782
|
782
|
inc eax
|
783
|
783
|
and eax, 0xFF
|
784
|
|
- neg eax
|
785
|
|
- lea rsi, [stack_buff+eax]
|
|
784
|
+ mov ebx, 4
|
|
785
|
+ mov ecx, [tosp]
|
|
786
|
+ mul ebx ; mul by data size
|
|
787
|
+ cmp eax, [tosp]
|
|
788
|
+ jg .pick_loop
|
|
789
|
+ sub ecx, eax
|
|
790
|
+ jmp .pick_lea
|
|
791
|
+ .pick_loop: ; eax > tosp
|
|
792
|
+ sub eax, ecx
|
|
793
|
+ mov ecx, (STACK_SZ - 1) * 4
|
|
794
|
+ sub ecx, eax
|
|
795
|
+ .pick_lea:
|
|
796
|
+ lea rsi, [stack_buff+ecx]
|
786
|
797
|
lodsd
|
787
|
798
|
push rax
|
788
|
799
|
call OP._pop
|