Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,69 @@
|
|||
option casemap:none
|
||||
|
||||
printf proto :qword, :vararg
|
||||
exit proto :dword
|
||||
|
||||
ROW_LEN equ (4*4)
|
||||
MEM_SIZE equ 4
|
||||
|
||||
.data
|
||||
;; A 2d array - 2 rows, 4 columns
|
||||
;; int twodimen[2][4] = { {0,1,2,3},
|
||||
;; {4,5,6,7}};
|
||||
twodimen db 48 dup (0)
|
||||
tpl db "%d",13,10,0
|
||||
|
||||
.code
|
||||
main proc
|
||||
local cols:qword
|
||||
|
||||
lea rbx, twodimen
|
||||
mov cols, 0
|
||||
;; Forgive me for the multiple loops, I'm just to lazy to
|
||||
;; do the conditional jumps required for 2 for loops. -.-
|
||||
@1:
|
||||
mov rcx, cols
|
||||
mov dword ptr [rbx+0*ROW_LEN + rcx*MEM_SIZE], ecx ;; first row, rcx column
|
||||
inc cols
|
||||
cmp cols, 3
|
||||
jle @1
|
||||
|
||||
mov cols, 0
|
||||
mov rdx, 4
|
||||
@2:
|
||||
mov rcx, cols
|
||||
mov dword ptr [rbx+1*ROW_LEN + rcx*MEM_SIZE], edx ;; second row, rcx column
|
||||
inc cols
|
||||
inc edx
|
||||
cmp cols, 3
|
||||
jle @2
|
||||
|
||||
invoke printf, CSTR("--> Printing columns in row 1",10)
|
||||
mov cols, 0
|
||||
@3:
|
||||
mov rcx, cols
|
||||
mov esi, dword ptr [rbx+0*ROW_LEN + rcx*MEM_SIZE]
|
||||
lea rdi, tpl
|
||||
call printf
|
||||
inc cols
|
||||
cmp cols, 3
|
||||
jle @3
|
||||
|
||||
invoke printf, CSTR("--> Printing columns in row 2",10)
|
||||
mov cols, 0
|
||||
@4:
|
||||
mov rcx, cols
|
||||
mov esi, dword ptr [rbx+1*ROW_LEN + rcx*MEM_SIZE]
|
||||
lea rdi, tpl
|
||||
call printf
|
||||
inc cols
|
||||
cmp cols, 3
|
||||
jle @4
|
||||
|
||||
|
||||
mov rax, 0
|
||||
xor edi, edi
|
||||
call exit
|
||||
leave
|
||||
ret
|
||||
main endp
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
mov dword ptr [rbp-48], 0
|
||||
mov dword ptr [rbp-44], 1
|
||||
.....
|
||||
mov ecx, dword ptr [rbp-48]
|
||||
Loading…
Add table
Add a link
Reference in a new issue