Friday, January 4, 2013

CompiLer in NaNo EditoR .

Re-arrange my files in shell . Flashing back all the tutorial.

what i do .?

     [dora@localhost ~]$ ls
     BNC.docx  chrome-mac.zip  public_html  smf_2-0-2_install.tar.bz2

     [dora@localhost ~]$ cd public_html
     [dora@localhost public_html]$ ls
     project1  project1.tar.bz2  rnd  smf

     [dora@localhost public_html]$ cd ..

     [dora@localhost ~]$ ls
     BNC.docx  chrome-mac.zip  public_html  smf_2-0-2_install.tar.bz2
     [dora@localhost ~]$ rm -rf chrome-mac.zip
     [dora@localhost ~]$ ls
     BNC.docx  public_html  smf_2-0-2_install.tar.bz2

     [dora@localhost ~]$ cd public_html
     [dora@localhost public_html]$ ls
     project1  project1.tar.bz2  rnd  smf
     [dora@localhost public_html]$ rm -rf project1.tar.bz2
     [dora@localhost public_html]$ ls
     project1  rnd  smf

= deleting un-neccessary files.

i think i want to separate the code with compiler that i have save
in folder rnd. It's mixed. So i create one new folder for that.

     [dora@localhost public_html]$ mkdir test
     [dora@localhost public_html]$ ls
     project1  rnd  smf  test

     [dora@localhost public_html]$ cd rnd
     [dora@localhost rnd]$ ls
     a.asm  a.s          testcode.php   testcode2.php  testcode4.php  
     testcode6.php a.c    iframe.html  testcode1.php  testcode3.php  
     testcode5.php

it's so mixed.! :X

after test and error many cmd .. and googling -
i found this 

     [dora@localhost rnd]$ mv a.s a.c a.asm ../
     [dora@localhost rnd]$ ls
     iframe.html   testcode1.php  testcode3.php  testcode5.php
     testcode.php  testcode2.php  testcode4.php  testcode6.php

     [dora@localhost public_html]$ ls
     a.asm  a.c  a.s  project1  rnd  smf  test

now only i can use this ::

     [dora@localhost public_html]$ mv a.asm a.s a.c test/
     [dora@localhost public_html]$ ls
     project1  rnd  smf  test

     [dora@localhost public_html]$ cd test
     [dora@localhost test]$ ls
     a.asm  a.c  a.s

ok done.

try and error to use gcc. :X

** noted : it's (.s) for assembler. not (.asm)  :P

     [dora@localhost test]$ nano -w a.c

      

#include [stdio.h] main() { printf("Hello World!"); }

[dora@localhost test]$ gcc -o a a.c [dora@localhost test]$ ls -a . .. a a.asm a.c a.s [dora@localhost test]$ ./a Hello World![dora@localhost test]$ c is done . Im just trying using the same cmd for the assembly coding. In my last post.. i have do the assembly code in windows and i use "Visual Studio Express 2010" now i want to take the code and try to see how it will compile in nano. [dora@localhost test]$ nano -w a.s

TITLE Question6 assignment1 (main.asm) ; Description: ; This progam adds and subtracts 32-bit unsigned ; integers and stores the sum in a variable ; Revision date: INCLUDE Irvine32.inc main PROC mov eax,1 call DumpRegs ;1st value call DumpRegs ;2nd value mov ebx,0 ; initial setup mov edx,1 mov ecx,6 ; count L1: mov eax,ebx ; eax = ebx + edx add eax,edx call DumpRegs ; display eax mov ebx,edx mov edx,eax Loop L1 exit main ENDP END main

[dora@localhost test]$ gcc -o a a.s a.s: Assembler messages: a.s:1: Error: no such instruction: `title Question6 assignment1 (main.asm)' a.s:4: Error: no such instruction: `this progam adds and subtracts 32-bit unsigned' a.s:5: Error: no such instruction: `integers and stores the sum in a variable' a.s:6: Error: no such instruction: `revision date:' a.s:8: Error: no such instruction: `include Irvine32.inc' a.s:10: Error: no such instruction: `main PROC' a.s:11: Error: too many memory references for `mov' a.s:12: Error: junk at end of line, first unrecognized character is `1' a.s:13: Error: junk at end of line, first unrecognized character is `2' a.s:15: Error: too many memory references for `mov' a.s:15: Error: no such instruction: `initial setup' a.s:16: Error: too many memory references for `mov' a.s:17: Error: too many memory references for `mov' a.s:17: Error: no such instruction: `count' a.s:20: Error: too many memory references for `mov' a.s:21: Error: too many memory references for `add' a.s:22: Error: no such instruction: `display eax' a.s:23: Error: too many memory references for `mov' a.s:24: Error: too many memory references for `mov' a.s:27: Error: no such instruction: `exit' a.s:28: Error: no such instruction: `main ENDP' a.s:29: Error: no such instruction: `end main' [dora@localhost test]$ ouch .! stuck ...... dunno whut to do. i must change the coding.. i will googling for that. 09/01/2013 the new code.... [dora@localhost test]$ nano -w a.s

#TITLE Test #Description: #This progam adds and subtracts 32-bit unsigned #integers and stores the sum in a variable #Revision date: INCLUDE "Irvine32.inc" main: mov eax,1 call DumpRegs ;1st value call DumpRegs ;2nd value mov ebx,0 ; initial setup mov edx,1 mov ecx,6 ; count L1: mov eax,ebx ; eax = ebx + edx add eax,edx call DumpRegs ; display eax mov ebx,edx mov edx,eax Loop L1

I have modified a bit. now it look smooth in upper. I must replace the coding to more simple one. [dora@localhost test]$ gcc -o a a.s a.s: Assembler messages: a.s:10: Error: too many memory references for `mov' a.s:14: Error: too many memory references for `mov' a.s:17: Error: expecting operand after ','; got nothing a.s:18: Error: too many memory references for `add' a.s:19: Error: junk `eax' after expression a.s:20: Error: too many memory references for `mov' a.s:21: Error: too many memory references for `mov' [dora@localhost test]$