flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [FASMG] sprintf display/db formatted text

Author
Thread Post new topic Reply to topic
codestar



Joined: 25 Dec 2014
Posts: 254
codestar 07 May 2015, 16:17
sprintf-style display(...) (or db). See attachment.
Code:
include 'printf.txt'

; sprintf(console, "i=%d\nh=$%x\n\n",\
;   123, 0x12345678)

i=123
j=$12345678

displayf 'i=', i&d, &r, 'h=$', j&h, &r, &r

name equ 'Master'
age=37

displayf \
  'Hi, ', name, '. You are ', age&d, &r,\
  'years old which is ', &r, age&b, 'b',\
  &r, 'in binary and ', &r, age&h,\
  'h in hexadecimal.', &r, &r

define o1_name eax
define o2_name ecx
o1_type='r'
o2_type='i'
o1_value=0
o2_value=$CAFEBABE

if o1_type='r' & o2_type='i'
  displayf 'mov ', `o1_name,\
    ', $', o2_value&h, &r
end if    


Description:
Download
Filename: printf.zip
Filesize: 1.75 KB
Downloaded: 459 Time(s)

Post 07 May 2015, 16:17
View user's profile Send private message Reply with quote
uor99



Joined: 04 Dec 2014
Posts: 42
uor99 03 Oct 2016, 03:48
Great job ! Thanks.
Post 03 Oct 2016, 03:48
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.