Skip to content

Commit

Permalink
chap-05: Add io.mac dependency file for assembly source code
Browse files Browse the repository at this point in the history
Signed-off-by: Razvan Deaconescu <[email protected]>
  • Loading branch information
razvand committed Dec 24, 2021
1 parent 60788c2 commit e156d19
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions curs/chap-05-ihs/io.mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
;;; macro to use printf with 32bit parameters:
;;; - 1st parameter MUST be an immediate in backquotes `EAX=%d ECX=%x \n\x0`
;;; escape \n and \x0 only work with backquotes
;;; - rest of parameters MUST be 32bit
;;; - gen purpose and flags are preserved
;;; - stack is cleaned
%macro PRINTF32 1-*
pushf
pushad
jmp %%endstr
%%str: db %1
%%endstr:
%rep %0 - 1
%rotate -1
push dword %1
%endrep
push %%str
call printf
add esp, 4*%0
popad
popf
%endmacro

0 comments on commit e156d19

Please sign in to comment.