RASM (Assembly virtual machine)

Source: Internet
Author: User

2009/06 -- 2009/07

An assembly language interpreter that can run on both Windows and Linux.

Inspired by a foreign C language book, there are more than 2000 Lines added with comments and the name is RASM, which is not perfect yet and will be improved after time.

 

Guess. ASM:

Movstr 0, "Please input a number from 1 to 200 :"
Movstr 100, "It's too big! "
Movstr 200, "it's too small! "
Movstr 300, "you are right! Take"
Movstr 400, "seconds ."

Int 'C'
MoV CX, ax; Timing
Int 'R'
MoV dx, ax; Random Number
Add dx, 1
MoV Si, 0
Int's'
Int 'n'

Int 'I'
CMP ax, DX
Ja 30
JB 35

MoV Si, 300; correct
Int's'
Int 'C'
Sub ax, CX
Div ax, 1000
Int 'O'
Movsi, 400
Int's'
JMP 41

MoV Si, 100; too large
Int's'
Int 'n'
JMP 16

MoV Si, 200; too small
Int's'
Int 'n'
JMP 16

End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.