Skip to main content

Posts

The Additon & Subtraction in Assembly

There is not much difficulty when it comes to addition and subtraction in assembly programming. Simply, additon and substraction breaks down to the following: add eax , ecx ; eax = eax + ecx, result in eax add eax , DWORD [ ebp - 4 ] ; eax = eax + localVar1, result in eax add DWORD [ ebp - 4 ] , DWORD [ ebp -4 ] ; illegal, with all instruction both operands can never be memory add DWORD [ ebp - 4 ] , eax ; [ebp-4] = [ebp-4] + eax sub eax , ecx ; eax = eax - ecx, result in eax sub eax , DWORD [ ebp - 4 ] ; eax = eax - localVar1, result in eax sub DWORD [ ebp - 4 ] , DWORD [ ebp -4 ] ; illegal, with all instruction both operands can never be memory sub DWORD [ ebp - 4 ] , eax ; [ebp-4] = [ebp-4] - eax A simple program to display the message about an arithetic operation like "Math: 8 + 4 = ?" can be achived b

Please Support My Android Game

Hey everyone, I wrote a game for android called Space Cosmos Defender. Please check it out here  or just type "Space cosmos adventure" on your Google/Play market. Thank you all in advance. Here are some of the the screen-shots of my game. Main menu In game action More Action

Important Lessons to Remember from Assembly Language programming

Okay, so I have been writing assembly language programs for a little bit now and to be honest with everyone, not like it is not obvious, assembly can be very frustrating especially when you write code and it seems to make logical sense.  However, when you run the program, it either says segmentation fault, memory corruption issues, or the program displays a bunch of random text to the screen. Okay so, recently I have been trying to write an application that does something simple using assembly.  The goal was to write a program with Nasm and have it display the number of arguments passed to our program. From my previous posts, we know that ebp+4 contains the return address after the main method is executed.  We also now that ebp+8 is the first parameter passed to main,  ebp+12 is the second parameter, and so on and so on with 4 added to each time.  This is because from the C programming language the main method has a header declaration that is of the following syntax: int main(in
I wrote, with the help of  The Art of Java by Herbert Schildt and James Holmes , a custom parser that evaluates a numerical expression like: "10+32/2".  So the following is the code:   package com.soliduscode.eleanya; import java.util.logging.Handler; /** * * * @author ukaku * */ public class Parser { final int NONE =0; final int DELIMITER =1; final int VARIABLE = 2; final int NUMBER = 3; final int SYNTAX = 0; final int UNBALPARENS=1; final int NOEXP = 2; final int DIVBYZERO=3; final String EOE = "\0"; /**the expression*/ private String exp; /** expression index */ private int expIndex; /**Current token*/ private String token; /**The token type*/ private int tokenType; /** * Return the next token in the expression */ private void getToken(){ //clear values initially tokenType = NONE; token = ""; //check for endl of expression if(expIndex == exp.length()){ token = EOE; return; } //ski