Program Menampilkan Gambar Animasi Helikopter Bahasa Assembly
Program Menampilkan Gambar Animasi Helikopter Pada Bahasa Assembly - Pada kesempatan kali ini kita akan membuat sebuah program kecil kecilan dimana ini sebenarnya adalah tugas kuliah saya karena menurut saya dapat bermanfaat kalau dibagikan ke temen temen semua maka saya memutuskan untuk membuatkan artikelnya.
Gambar helikopternya pun berbentuk 32 bit tidak mungkin kali yah kalau gambarnya beresolusi HD karena tau sendiri bahasa yang digunakan adalah bahasa assambly.
Baiklah langsung saja ke Script atau koding Cara membuat gambar animasi helikopter bergerak pada bahasa assembly.
Delay MACRO
LOCAL Ulang
PUSH CX
SUB CX,CX
Ulang :
LOOP Ulang
POP CX
ENDM
SetCRT MACRO Mode
MOV AH,00
MOV AL,Mode
INT 10h
ENDM
Pixel MACRO X,Y,Warna
Push AX
Push BX
Push CX
Push DX
MOV AH,12
MOV CX,X
MOV DX,Y
MOV AL,Warna
INT 10h
POP DX
POP CX
POP BX
POP AX
ENDM
HELI MACRO Gambar,Warna
LOCAL Ulang1,Ulang2,Ulang3,Nol
PUSH AX
PUSH BX
PUSH CX
PUSH DX
SUB BX,BX
MOV CX,32
Ulang1 :
PUSH CX
MOV CX,2
Ulang2 :
PUSH CX
MOV CX,16
MOV AX,1000000000000000b
Ulang3 :
PUSH AX
AND AX,Gambar[BX]
JZ Nol
Pixel PosX,PosY,Warna
Nol:
POP AX
SHR AX,1
INC PosX
LOOP Ulang3
ADD BX,2
POP CX
LOOP Ulang2
INC PosY
SUB PosX,32
POP CX
LOOP Ulang1
SUB PosY,32
POP DX
POP CX
POP BX
POP AX
ENDM
.MODEL SMALL
.CODE
ORG 100h
TData : JMP Proses
Heli1 DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000001110000000b
DW 0000000000000000b,0000000100000000b
DW 0000000011111111b,1111111111111110b
DW 0000000000000000b,0000000100000000b
DW 0000000000000000b,0111111111000000b
DW 1110000000000000b,1111111111100000b
DW 0100000000111111b,1111000100110000b
DW 0111111111111111b,1111000100011000b
DW 0000000000000011b,1111000111111000b
DW 0000000000000000b,0111111111100000b
DW 0000000000000000b,0000000100001000b
DW 0000000000111111b,1111111111110000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
Gambar DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000001110000000b
DW 0000000000000000b,0000000100000000b
DW 0000000011111111b,1111111111111110b
DW 0000000000000000b,0000000100000000b
DW 0000000000000000b,0111111111000000b
DW 1110000000000000b,1111111111100000b
DW 0100000000111111b,1111000100110000b
DW 0111111111111111b,1111000100011000b
DW 0000000000000011b,1111000111111000b
DW 0000000000000000b,0111111111100000b
DW 0000000000000000b,0000000100001000b
DW 0000000000111111b,1111111111110000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
PosX DW 00
PosY DW 50
Proses :
SetCRT 13h
MOV CX,0
Ulang :
HELI Heli1,50
Delay
HELI Heli1,00
INC PosX
INC CX
CMP CX,290
JE Exit
JMP Ulang
Exit :
SetCRT 03h
INT 20h
END TData
Jika Progrm diatas dijalankan akan menampilkan gambar helikopter warna hijau yang berjalan ke kanan. Helikopter ini berdasarkan data dari variabel Gambar. Semoga Bermanfaat.
Program Menampilkan Gambar Animasi Helikopter Bahasa Assembly
Sederhananya sih program ini menampilkan Animasi Helikopter berwarna hijau yang cuma sekedar lewat saja dibuat dengan bahasa assembly. Sebelumnya kita pernah membuat beberapa program sederhana menggunakan bahasa assembly yaitu Program Membuat Data Diri Dengan Assembly dan Cara Agar Bisa Baris Baru.Gambar helikopternya pun berbentuk 32 bit tidak mungkin kali yah kalau gambarnya beresolusi HD karena tau sendiri bahasa yang digunakan adalah bahasa assambly.
Baiklah langsung saja ke Script atau koding Cara membuat gambar animasi helikopter bergerak pada bahasa assembly.
Delay MACRO
LOCAL Ulang
PUSH CX
SUB CX,CX
Ulang :
LOOP Ulang
POP CX
ENDM
SetCRT MACRO Mode
MOV AH,00
MOV AL,Mode
INT 10h
ENDM
Pixel MACRO X,Y,Warna
Push AX
Push BX
Push CX
Push DX
MOV AH,12
MOV CX,X
MOV DX,Y
MOV AL,Warna
INT 10h
POP DX
POP CX
POP BX
POP AX
ENDM
HELI MACRO Gambar,Warna
LOCAL Ulang1,Ulang2,Ulang3,Nol
PUSH AX
PUSH BX
PUSH CX
PUSH DX
SUB BX,BX
MOV CX,32
Ulang1 :
PUSH CX
MOV CX,2
Ulang2 :
PUSH CX
MOV CX,16
MOV AX,1000000000000000b
Ulang3 :
PUSH AX
AND AX,Gambar[BX]
JZ Nol
Pixel PosX,PosY,Warna
Nol:
POP AX
SHR AX,1
INC PosX
LOOP Ulang3
ADD BX,2
POP CX
LOOP Ulang2
INC PosY
SUB PosX,32
POP CX
LOOP Ulang1
SUB PosY,32
POP DX
POP CX
POP BX
POP AX
ENDM
.MODEL SMALL
.CODE
ORG 100h
TData : JMP Proses
Heli1 DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000001110000000b
DW 0000000000000000b,0000000100000000b
DW 0000000011111111b,1111111111111110b
DW 0000000000000000b,0000000100000000b
DW 0000000000000000b,0111111111000000b
DW 1110000000000000b,1111111111100000b
DW 0100000000111111b,1111000100110000b
DW 0111111111111111b,1111000100011000b
DW 0000000000000011b,1111000111111000b
DW 0000000000000000b,0111111111100000b
DW 0000000000000000b,0000000100001000b
DW 0000000000111111b,1111111111110000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
Gambar DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000001110000000b
DW 0000000000000000b,0000000100000000b
DW 0000000011111111b,1111111111111110b
DW 0000000000000000b,0000000100000000b
DW 0000000000000000b,0111111111000000b
DW 1110000000000000b,1111111111100000b
DW 0100000000111111b,1111000100110000b
DW 0111111111111111b,1111000100011000b
DW 0000000000000011b,1111000111111000b
DW 0000000000000000b,0111111111100000b
DW 0000000000000000b,0000000100001000b
DW 0000000000111111b,1111111111110000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
DW 0000000000000000b,0000000000000000b
PosX DW 00
PosY DW 50
Proses :
SetCRT 13h
MOV CX,0
Ulang :
HELI Heli1,50
Delay
HELI Heli1,00
INC PosX
INC CX
CMP CX,290
JE Exit
JMP Ulang
Exit :
SetCRT 03h
INT 20h
END TData
Jika Progrm diatas dijalankan akan menampilkan gambar helikopter warna hijau yang berjalan ke kanan. Helikopter ini berdasarkan data dari variabel Gambar. Semoga Bermanfaat.