Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
index2
;File: index2.asm ; ;This program demonstrates the use of an indexed addressing mode ;to access array elements ; ;This program has no I/O. Use the debugger to examine its effects ; ;nasm -felf64 -g index2.asm -o index2.o ;ld -o index2 index2.o ; section .data ;simulates a 2-dim array twodim: row1: dd 00,01,02,03,04,05,06,07,08,09 row2: dd 10,11,12,13,14,15,16,17,18,19 dd 20,21,22,23,24,25,26,27,28,29 dd 30,31,32,33,34,35,36,37,38,39 dd 40,41,42,43,44,45,46,47,48,49 dd 50,51,52,53,54,55,56,57,58,59 dd 60,61,62,63,64,65,66,67,68,69 dd 70,71,72,73,74,75,76,77,78,79 dd 80,81,82,83,84,85,86,87,88,89 dd 90,91,92,93,94,95,96,97,98,99 rowlen: equ row2-row1 section .text global _start _start: ;Add 5 to each element of the array stored in arr ;Simulate ; ; for (i=0; i<10 i++) { ; twodim[i][7] += 5; ; } init: mov rcx,0 ;rcx simulates i mov rax,4 mov rdx,6 mul rdx ; offset of twodim[0][7] rax = rax * rdx jc alldone ; if cf=1 (too big) loop1: cmp rcx,10 ; i<10 jge done1 add [rax+twodim], dword 5 ; twodim[i][7] += 5 inc rcx ; i++ add rax,rowlen jmp loop1 done1: alldone: mov rax,60 xor rdi,rdi syscall
run
|
edit
|
history
|
help
0
dfhgjfsdsff
lab2_2.asm
FirstProgramLab
The Code
FirstProgramGroupLab_aNavaid_lCannon_tAmjad
lec4bb.asm
ASCII to HEX and display again
Pass
Что нужно знать Java программисту
MPassignment1