School Commit Init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
;An unsigned number a on 32 bits is given. Print the hexadecimal
|
||||
;representation of a, but also the results of the circular permutations
|
||||
;of its hex digits.
|
||||
|
||||
bits 32
|
||||
global start
|
||||
|
||||
extern exit,printf
|
||||
import exit msvcrt.dll
|
||||
import printf msvcrt.dll
|
||||
|
||||
%include "subprogram.asm"
|
||||
|
||||
segment data use32 class=data
|
||||
format db "%X ",0
|
||||
a dd 12ABCDEFh
|
||||
permutations resd 8
|
||||
|
||||
segment code use32 class=code
|
||||
start:
|
||||
push dword [a]
|
||||
push dword permutations
|
||||
call subprogram
|
||||
add ESP,4*2
|
||||
mov ECX,8
|
||||
label:
|
||||
push ECX
|
||||
push dword [permutations+ECX*8]
|
||||
push dword format
|
||||
call [printf]
|
||||
add ESP,4*2
|
||||
pop ECX
|
||||
loop label
|
||||
push dword 0
|
||||
call [exit]
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
%ifndef _SUBPROGRAM_ASM_
|
||||
%define _SUBPROGRAM_ASM_
|
||||
subprogram:
|
||||
mov ECX,8
|
||||
mov EBX,[ESP+4]
|
||||
mov EAX,[ESP+8]
|
||||
.label:
|
||||
mov [EBX+ECX*8],EAX
|
||||
rol EAX,4
|
||||
loop .label
|
||||
ret
|
||||
|
||||
%endif
|
||||
Reference in New Issue
Block a user