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 authored and gabrielmocanu committed Mar 30, 2024
1 parent 537ff1b commit 9e1e777
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 9e1e777

Please sign in to comment.