Giter Site home page Giter Site logo

carlosrafaelgn / asm86 Goto Github PK

View Code? Open in Web Editor NEW
141.0 12.0 20.0 449 KB

A JavaScript assembly x86 compiler + emulator for educational purposes

Home Page: https://carlosrafaelgn.github.io/Asm86/

License: Other

JavaScript 100.00%
emulator intel assembly x86-assembly javascript

asm86's People

Contributors

carlosrafaelgn avatar nidaegwyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asm86's Issues

imul flags on particular case of 2 x maxint

Looks to me like imul is not setting flags properly on this particular case! Thanks, Erik

mov eax, 0x2
mov ebx, 0x7FFFFFFF
mov edx, 0xDEADBEAF  
imul ebx                                        ; <----- after this CF & OF should be set/true/1 but they are cleared

mov eax, 0x4
mov ebx, 0x7FFFFFFF
mov edx, 0xDEADBEAF
imul ebx                                        ; CF & OF properly set to true/1

mov eax, 0xFFFFFFFF
mov ebx, 0xFFFFFFFF
mov edx, 0xDEADBEAF
imul ebx                                       ; CF & OF properly set to false/0


mov ebx, 0xDEADBEAF
ret

how it work?

for the assembly x86 emulator, how it work? can you share the tutorial etc. Why it differ with NASM assembly code?

SAR bug

Hi,
here's the issue.

"Using the SAR instruction to perform a division operation does not produce the same result as the IDIV instruction. The quotient from the IDIV instruction is rounded toward zero, whereas the “quotient” of the SAR instruction is rounded toward negative infinity. This difference is apparent only for negative numbers. For example, when the IDIV instruction is used to divide -9 by 4, the result is -2 with a remainder of -1. If the SAR instruction is used to shift -9 right by two bits, the result is -3 and the “remainder” is +3; however, the SAR instruction stores only the most significant bit of the remainder (in the CF flag)."
[https://software.intel.com/sites/default/files/managed/39/c5/325462-sdm-vol-1-2abcd-3abcd.pdf]

When I run this code
mov al, -9
sar al, 2
the result stored in al is 0x3D but it should be 0xFD(-3)
Tested on my local machine.

Question on syntax

The below snippet is from the book "Practical Reverse Engineering"

mov   dword ptr [eax], 1
mov   ecx, [eax]
mov   [eax], ebx
mov   [esi+0x34], eax
mov   eax, [esi+0x34]
mov   edx, [ecx+eax]

This fails to step through with:

Invalid writing address: 0x00000000

Is there a specific syntax I need to use? Thank you.

About neg

I compile and run this asm on my linux:

mov al, -128
neg al

Overflow flag will be 1 after neg al
But in this emulator, overflow flag is 0 after neg al
Is this a bug? I'm not very familiar with asm.

Thanks!

print value of variable at console

can you help me, how to print value of variable at console after summation of the variables value?

example:
MOV AL, NUM1 ; NUM1=15d
ADD AL, NUM2 ; NUM2=34d
ADD AL, NUM3 ; NUM3=56d

how i can print the total value in console? I'm very stuck even I refer the load example. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.