Introduction To Java - MFC 158 G

Week 2 Lecture notes - Fall 2000

 

 

 

 

 

 

 

 

 

 

 

 

 

·         Machine code:

§         +1300042774

§         +1400593419

§         +1200274027 (adds overtime pay to base pay and stores in gross pay)

 

·         Assembly code:

 

·         High level language code:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

--------------------------------------------------------------------------------------------------

 

Webopedia’s rather concise definition of Java:

 

http://webopedia.internet.com/TERM/J/Java.html

 

--------------------------------------------------------------------------------------------------

 

Comparison of High level vs. Low level program source code:

 

Sample of a 'hello' program, written in C, assembly and in machine code (represented as octal using the UNIX utility {od -b}

 

 

-rw-r--r--   1 fineberg       75 Sep  7 16:32 hello.c

-rw-r--r--   1 fineberg     1008 Sep  7 16:33 hello.s

-rwxr-xr-x   1 fineberg   678756 Sep  7 16:32 hello.exe

 

----Third generation language - C++----

#include <iostream.h>

 

int main()

{

cout << "hello";        

return 0;

}

----------------------------------------

 

 

-----Second generation language - Assembly language----

      .file "hello.c"

gcc2_compiled.:

      .global _Q_qtod

      .global __throw

.section    ".rodata"

      .align 8

.LLC0:

      .asciz      "hello"

.section    ".text"

      .align 4

      .global main

      .type main,#function

      .proc 04

main:

.LLFB1:

      !#PROLOGUE# 0

      save %sp,-112,%sp

.LLCFI0:

      !#PROLOGUE# 1

      sethi %hi(cout),%o1

      or %o1,%lo(cout),%o0

      sethi %hi(.LLC0),%o2

      or %o2,%lo(.LLC0),%o1

      call __ls__7ostreamPCc,0

      nop

      mov 0,%i0

      b .LL281

      nop

      mov 0,%i0

      b .LL281

      nop

.LL281:

      ret

      restore

.LLFE1:

.LLfe1:

      .size main,.LLfe1-main

 

.section    ".eh_frame",#alloc,#write

__FRAME_BEGIN__:

      .uaword     .LLECIE1-.LLSCIE1

.LLSCIE1:

      .uaword     0x0

      .byte 0x1

      .byte 0x0

      .byte 0x1

      .byte 0x7c

      .byte 0x65

      .byte 0xc

      .byte 0xe

      .byte 0x0

      .byte 0x9

      .byte 0x65

      .byte 0xf

      .align 4

.LLECIE1:

      .uaword     .LLEFDE1-.LLSFDE1

.LLSFDE1:

      .uaword     .LLSFDE1-__FRAME_BEGIN__

      .uaword     .LLFB1

      .uaword     .LLFE1-.LLFB1

      .byte 0x4

      .uaword     .LLCFI0-.LLFB1

      .byte 0xd

      .byte 0x1e

      .byte 0x2d

      .byte 0x9

      .byte 0x65

      .byte 0x1f

      .align 4

.LLEFDE1:

      .ident      "GCC: (GNU) 2.8.1"

 

-----------------------------------------

 

-----First generation language - Machine code language---

 

 

Portion of (c program) Hello executable

using  od -b  Interpret bytes in octal

 

0000000 177 105 114 106 001 002 001 000 000 000 000 000 000 000 000 000

0000020 000 002 000 002 000 000 000 001 000 001 234 144 000 000 000 064

0000040 000 012 122 124 000 000 000 000 000 064 000 040 000 005 000 050

0000060 000 072 000 067 000 000 000 006 000 000 000 064 000 001 000 064

0000100 000 000 000 000 000 000 000 240 000 000 000 240 000 000 000 005

0000120 000 000 000 000 000 000 000 003 000 000 000 324 000 000 000 000

0000140 000 000 000 000 000 000 000 021 000 000 000 000 000 000 000 004

0000160 000 000 000 000 000 000 000 001 000 000 000 000 000 001 000 000

 

...

 

0002040 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000

0002060 000 000 000 000 000 000 000 202 000 000 000 000 000 000 001 234

0002100 000 000 000 000 000 000 002 057 000 000 001 076 000 000 000 000

0002120 000 000 000 000 000 000 000 000 000 000 000 000 000 000 001 005

0002140 000 000 000 174 000 000 000 231 000 000 002 152 000 000 001 210

---end of sample----