Would someone mind giving suggestions for this new assembly language?

Posted by Noctis Skytower on Stack Overflow See other posts from Stack Overflow or by Noctis Skytower
Published on 2010-05-25T00:34:36Z Indexed on 2010/05/25 0:41 UTC
Read the original article Hit count: 322

Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, and a sample program was written with the given assembly mnemonics.

Now that it is summer, a new project has begun with the objective being to rewrite the interpreter and assembler for Whitespace 0.3, with further developments coming afterwards. Since there is so much extra time than before to work on its design, you are presented here with an outline that provides a revised set of mnemonics for the assembly language. This post is marked as a wiki for their discussion.

Have you ever had any experience with assembly languages in the past? Were there some instructions that you thought should have been renamed to something different? Did you find yourself thinking outside the box and with a different paradigm than in which the mnemonics were named? If you can answer yes to any of those questions, you are most welcome here. Subjective answers are appreciated!


hold N       Push the number onto the stack
copy         Duplicate the top item on the stack
copy N       Copy the nth item on the stack (given by the argument) onto the top of the stack
swap         Swap the top two items on the stack
drop         Discard the top item on the stack
drop N       Slide n items off the stack, keeping the top item

add          Addition
sub          Subtraction
mul          Multiplication
div          Integer Division
mod          Modulo

save         Store
load         Retrieve

L:           Mark a location in the program
call L       Call a subroutine
goto L       Jump unconditionally to a label
if=0 L       Jump to a label if the top of the stack is zero
if<0 L       Jump to a label if the top of the stack is negative
return       End a subroutine and transfer control back to the caller
exit         End the program

print chr    Output the character at the top of the stack
print int    Output the number at the top of the stack
input chr    Read a character and place it in the location given by the top of the stack
input int    Read a number and place it in the location given by the top of the stack

Question: How would you redesign, rewrite, or rename the previous mnemonics and for what reasons?

© Stack Overflow or respective owner

Related posts about python

Related posts about assembly