flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Displaying decimal numbers during assembly time

Author
Thread Post new topic Reply to topic
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
Code:
format binary as 'txt'
times 30: db 'good luck - ',(%/10) mod 10 + '0',(%/1) mod 10 +'0',10
    
Post 28 Jun 2010, 09:42
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
edemko wrote:
(%/1)
Hehe. Wink
Post 28 Jun 2010, 09:46
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
%======>
hohe
Post 28 Jun 2010, 10:49
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
edemko wrote:
Code:
format binary as 'txt'
times 30: db 'good luck - ',(%/10) mod 10 + '0',(%/1) mod 10 +'0',10
    


Mmmhh, why fasm is not complaining about that colon?

[edit]edemko just reminded me how important is to read the manual some times Smile . A single colon is allowed (but not mandatory) to separate the number of repetitions from the instruction to execute.[/edit]


Last edited by LocoDelAssembly on 28 Jun 2010, 20:35; edited 1 time in total
Post 28 Jun 2010, 18:15
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
Thanks, everybody. Smile

LocoDelAssembly wrote:

Mmmhh, why fasm is not complaining about that colon?

RTM Wink
Post 28 Jun 2010, 20:34
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
Tomasz Grysztar wrote:
RTFM Wink
There, I fixed it for you. Razz
Post 28 Jun 2010, 20:53
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
revolution wrote:
There, I fixed it for you. Razz
Very Happy
Post 28 Jun 2010, 21:19
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
Code:
;display 13,10
;ShowDec %t
macro ShowDec value*{
  local .value
  .value = value
  if .value and $80000000'00000000 <> 0
    display '-'
    .value = not .value + 1
  end if
  display '0'+(.value/1000000000000000000)mod 10,\
          '0'+(.value/0100000000000000000)mod 10,\
          '0'+(.value/0010000000000000000)mod 10,\
          '0'+(.value/0001000000000000000)mod 10,\
          '0'+(.value/0000100000000000000)mod 10,\
          '0'+(.value/0000010000000000000)mod 10,\
          '0'+(.value/0000001000000000000)mod 10,\
          '0'+(.value/0000000100000000000)mod 10,\
          '0'+(.value/0000000010000000000)mod 10,\
          '0'+(.value/0000000001000000000)mod 10,\
          '0'+(.value/0000000000100000000)mod 10,\
          '0'+(.value/0000000000010000000)mod 10,\
          '0'+(.value/0000000000001000000)mod 10,\
          '0'+(.value/0000000000000100000)mod 10,\
          '0'+(.value/0000000000000010000)mod 10,\
          '0'+(.value/0000000000000001000)mod 10,\
          '0'+(.value/0000000000000000100)mod 10,\
          '0'+(.value/0000000000000000010)mod 10,\
          '0'+(.value/0000000000000000001)mod 10 ;for revolution purposes :b
}
    
Post 03 Jul 2010, 15:01
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
edemko wrote:
Code:
(.value/0000000000000000001)    
Hehe.
edemko wrote:
;for revolution purposes :b
Shocked
Post 03 Jul 2010, 16:30
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
edemko wrote:
Code:
;display 13,10
;ShowDec %t
macro ShowDec value*{
  local .value
  .value = value
  if .value and $80000000'00000000 <> 0
    display '-'
    .value = not .value + 1
  end if
  display '0'+(.value/1000000000000000000)mod 10,\
          '0'+(.value/0100000000000000000)mod 10,\
          '0'+(.value/0010000000000000000)mod 10,\
          '0'+(.value/0001000000000000000)mod 10,\
          '0'+(.value/0000100000000000000)mod 10,\
          '0'+(.value/0000010000000000000)mod 10,\
          '0'+(.value/0000001000000000000)mod 10,\
          '0'+(.value/0000000100000000000)mod 10,\
          '0'+(.value/0000000010000000000)mod 10,\
          '0'+(.value/0000000001000000000)mod 10,\
          '0'+(.value/0000000000100000000)mod 10,\
          '0'+(.value/0000000000010000000)mod 10,\
          '0'+(.value/0000000000001000000)mod 10,\
          '0'+(.value/0000000000000100000)mod 10,\
          '0'+(.value/0000000000000010000)mod 10,\
          '0'+(.value/0000000000000001000)mod 10,\
          '0'+(.value/0000000000000000100)mod 10,\
          '0'+(.value/0000000000000000010)mod 10,\
          '0'+(.value/0000000000000000001)mod 10 ;for revolution purposes :b
}
    
Code:
macro ShowDec value*{
  local .value
  .value = value
  if .value and $80000000'00000000 <> 0
    display '-'
    .value = not .value + 1
  end if
  display '0'+(.value/1000000000000000000)mod 10,\
          '0'+(.value/0100000000000000000)mod 10,\
          '0'+(.value/0010000000000000000)mod 10,\
          '0'+(.value/0001000000000000000)mod 10,\
          '0'+(.value/0000100000000000000)mod 10,\
          '0'+(.value/0000010000000000000)mod 10,\
          '0'+(.value/0000001000000000000)mod 10,\
          '0'+(.value/0000000100000000000)mod 10,\
          '0'+(.value/0000000010000000000)mod 10,\
          '0'+(.value/0000000001000000000)mod 10,\
          '0'+(.value/0000000000100000000)mod 10,\
          '0'+(.value/0000000000010000000)mod 10,\
          '0'+(.value/0000000000001000000)mod 10,\
          '0'+(.value/0000000000000100000)mod 10,\
          '0'+(.value/0000000000000010000)mod 10,\
          '0'+(.value/0000000000000001000)mod 10,\
          '0'+(.value/0000000000000000100)mod 10,\
          '0'+(.value/0000000000000000010)mod 10,\
          '0'+(.value/0000000000000000001)mod 10 ;for revolution purposes :b
}
ShowDec 1 shl 63    
Code:
C:\Documents and Settings\We Are The Borg\Our Documents>fasm ShowDec.asm
flat assembler  version 1.69.14  (165436 kilobytes memory)
-922337203*(+,))+(0(
1 passes, 0 bytes.    
Exclamation

See here for a version that works.
Post 04 Jul 2010, 02:19
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
Code:
;cool:
if number<0 ;that is (if number and $80000000'00000000), that is (if BT number,63)

;cool:
number=number-10000000000000000000 
;  18 446 744 073 709 551 615
;- 10 000 000 000 000 000 000
;= 08 446 744 073 709 551 615

;cool:
number=-number ;better then my (number = not number +1) :^
    

ShowDec: Shocked
Code:
_  fix (9'223'372'036'854'775'808/
__ fix )mod 10+'0'

/*
display _ 1'000'000'000'000'000'000 __
display _ 1'000'000'000'000'000'00 __
display _ 1'000'000'000'000'000'0 __
display _ 1'000'000'000'000'000 __
display _ 1'000'000'000'000'00 __
display _ 1'000'000'000'000'0 __
display _ 1'000'000'000'000 __
display _ 1'000'000'000'00 __
display _ 1'000'000'000'0 __
next errors come, how does fasm divide?
*/
display _ 1'000'000'000 __
display _ 1'000'000'00 __
display _ 1'000'000'0 __
display _ 1'000'000 __
display _ 1'000'00 __
display _ 1'000'0 __
display _ 1'000 __
display _ 1'00 __
display _ 1'0 __
display _ 1 __
    
Post 04 Jul 2010, 06:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
edemko wrote:
number=-number ;better then my (number = not number +1)
It is the same and makes no difference. Both will always result in 0x8000'0000'0000'0000, i.e. you can't make that number positive by trying to negate it. So your division gives a negative result. That is why the display is all messed up.

negative / positive = negative

This has been split into a separate topic. Originally from here.
Post 04 Jul 2010, 06:22
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
I wish fasm getting next operators before next release: shl/shr performing unsigned, sal/sar - signed, idiv/div - respectively as the CPU does. There will be no arguments of principles. Tomasz take me serious this time as mostly i'm not. Tomasz i hope. I hope. It's cool you are not a MS or any other company - easy to ask. Life.
Post 04 Jul 2010, 10:53
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.