This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; (c) 2021 - Febriyanto Nugroho | |
global _start | |
section .text | |
_start: | |
; sqrt(n); | |
mov ebx, 5 ; n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (c) 2021 - Febriyanto Nugroho | |
// compile dengan : gcc -o sqrt-SSE sqrt-SSE.c -masm=intel | |
#include <stdio.h> | |
int main(void) { | |
int nilai = 5; | |
__asm__ __volatile__("cvtsi2sd xmm0, ebx\n" | |
"sqrtsd xmm0, xmm0\n" | |
"cvttsd2si ebx, xmm0\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org 100h | |
mov di, 4 | |
inc al | |
add al, 30h | |
mov ah, 0eh | |
jmp _cetak | |
_loop: | |
inc al | |
_cetak: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ini contoh modulus, contoh p % i | |
; | |
; hasilnya di edx | |
global _start | |
section .text | |
_start: | |
mov ebx, 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; test code di : https://schweigi.github.io/assembler-simulator/index.html | |
; | |
; Febriyanto Nugroho | |
MOV A, 0x32 | |
MOV B, 20 | |
MOV C, 14 | |
MOV D, 232 | |
loop: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JMP start | |
ibu_kota_negara: DB "minsk" ; <-- nama ibu kota negara, harus huruf kecil semua | |
DB 0 | |
start: | |
MOV C, ibu_kota_negara | |
MOV D, 232 | |
.loop: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.model tiny | |
.code | |
org 100h | |
mulai: | |
mov ax, 10 | |
cetak_nilai: | |
mov bx, 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org 100h | |
mov cx, 5 | |
push cx | |
mov ah, 0eh | |
_loop: | |
mov al, "*" | |
int 10h | |
dec cx | |
test cx, cx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cbw | |
dec ax | |
; instruksi di atas sama kaya dec al |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; feel like jump into the abyss | |
global _start | |
section .text | |
_start: | |
mov byte [esp+0], 0x90 ; simpan instruksi nop di register esp | |
jmp esp ; lompat ke instruksi nop |