Senin, 03 Oktober 2011
09.02 | Diposting oleh
Expresi Of Love |
Edit Entri
Berikut ini listing program assembly:
; deklarasi parameter input
M EQU 8
N EQU 9
X EQU 10 ; variabel untuk iterasi
Y EQU 11
NODE EQU 12
OUTPUT EQU 20h ; alamat output array
; R0 sebagai index node
; R1 sebagai alamat output
start:
MOV SP,#80h ; pindahkan stack pointer supaya ada tempat untuk menaruh variabel
; inisialisasi data
MOV M,#4
MOV N,#4
; inisialisasi index output
MOV R1,#OUTPUT
; bikin loop variabel x
MOV Y,#0
LOOP_Y:
MOV X,#0
LOOP_X:
; hitung indeks nomor node (y * m + x)
MOV A,Y
MOV B,M
MUL AB
ADD A,X
; MOV R0,A ; simpan indeks di R0
MOV NODE,A ; simpan nomor node
; MOV @R1,A ; simpan nomor index
; INC R1
; kasus pertama bukan di sisi bawah (Y!=0)
; ada edge dengan tetangga yang di bawahnya
KASUS_1:
MOV A,Y
JZ KASUS_2
; lakukan perhitungan kasus 1
;neighbor = (y - 1) * m + x;
MOV A,Y ; Y => A
DEC A ;
MOV B,M ;
MUL AB ;
ADD A,X ;
; simpan hasil, pakai pointer R1
MOV @R1,NODE ; simpan dulu nomor node nya
INC R1 ; naikkan pointer untuk simpan node number
MOV @R1,A ; simpan nomor tetangganya
INC R1 ; siapkan untuk data berikut
; kasus kedua, bukan di sisi kanan (!(x == (m - 1)))
KASUS_2:
MOV A,M
DEC A
CLR C
SUBB A,X
JZ KASUS_3 ; bukan kasus 2, langsung cek kasus 3
; neighbor = y * m + (x + 1)
MOV A,Y
MOV B,M
MUL AB
ADD A,X
INC A
; simpan hasil , pakai pointer R1
MOV @R1,NODE ; simpan nomor node
INC R1
MOV @R1,A ; simpan neigbor
INC R1
; kasus ketiga, bukan di sisi atas (!(y == (n - 1)))
KASUS_3:
MOV A,N
DEC A
CLR C
SUBB A,Y
JZ KASUS_4
; hitung kasus ketiga: neighbor = (y + 1) * m + x;
MOV A,M
MOV B,X
MUL AB
ADD A,Y
INC A
MOV @R1,NODE
INC R1
MOV @R1,A
KASUS_4: ; kasus keempat, bukan di sisi kiri (x != 0)
MOV A,X
JZ AKHIR_CEK
; hitung kasus keempat: neighbor = y * m + (x - 1);
MOV A,Y
MOV B,M
MUL AB
ADD A,X
DEC A
MOV @R1,NODE
INC R1
MOV @R1,A
AKHIR_CEK:
INC X ; X++
MOV A,M ; cek apakah nilai X sudah sama dengan M
CJNE A,X,LOOP_X
INC Y ; Y++
MOV A,N ; cek apakah nilai Y sudah sama dengan N
CJNE A,Y,LOOP_Y
LOOP:
JMP LOOP
Puyeng ? Iya lah, namanya juga bahasa assembler Cara membacanya menyusul
0: 1 4
1: 2 5 0
2: 3 6 1
3: 7 2
4: 0 5 8
5: 1 6 9 4
6: 2 7 10 5
7: 3 11 6
8: 4 9 12
9: 5 10 13 8
10: 6 11 14 9
11: 7 15 10
12: 8 13
13: 9 14 12
14: 10 15 13
15: 11 14
Langganan:
Posting Komentar (Atom)
Blog Archive
-
▼
2011
(1035)
-
▼
Oktober
(812)
- Wayang Topeng or Wayang Gedog
- The Dalang
- gerah
- About Wayang Kulit
- Museum Wayang Kekayon
- Wayang Sadat
- Etymology of the word
- form•Z on the small and big screen
- Rendering
- Animation
- Modeling
- Overview
- Modeler
- Transporter
- History
- Product family
- Surfacing
- Animation tools
- Drafting Assistant
- Cobalt (CAD program)
- Current State of Design Methods
- Significance of Proliferation of Information Techn...
- Proliferation of Information Technologies
- Significance of Design Management
- Alternative View
- Design Management
- Significance of Role of Professional Design Practice
- Professional Design Practice
- Significance of Emergence of Design Research and D...
- Emergence of Design Research and Design Studies
- Where Process Meets Method
- Background of Design Methods
- Design methods
- Globalization and governance controversy
- Governors
- Formation and growth of the network
- Internet governance
- Elements
- Roles
- Additional principles exist where projects are mul...
- Additional and complementary principles of governa...
- Principle 4: Ensure separation of project governan...
- Principle 3: Ensure separation of stakeholder mana...
- Principle 2: Service delivery ownership determines...
- Principle 1: Ensure a single point of accountabili...
- Three pillars of project governance
- Project governance
- Professional certification
- Frameworks
- Problems with IT governance
- Background
- Definitions
- Corporate governance of information technology
- Domination by large organizations
- Membership
- Administration
- Recommendations and Certifications
- History
- World Wide Web Consortium
- Governance models
- Website management team
- Areas of responsibility
- Website governance
- Webmaster
- Reusability
- Flexible presentation
- Effective separation
- Template uses
- Web template
- Web syndication and e-commerce
- Web syndication as a commercial model
- History
- Motivation
- Web syndication
- Criticisms
- Automated design methodologies
- Representational state transfer (REST)
- Service-oriented architecture
- Remote procedure calls
- Web API
- Big Web services
- Web service
- Web document
- Security Considerations
- Advanced
- Basic
- Client Side + Server Side
- Server Side Coding
- Client Side Coding
- Web development as an industry
- Web development
- Changes and updates
- Best practices
- Web design
- Disadvantages
- Advantages
- Online processing (called "frying" systems)
- Capabilities
- Web content management system
- Role of information management
-
▼
Oktober
(812)
Pengikut
About Me
- Expresi Of Love
0 komentar:
Posting Komentar