flat assembler
Message board for the users of flat assembler.

Index > Programming Language Design > I realy dont know that fasm1 & fasmg can so

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 28 Jul 2017, 10:19
Code:
format binary as 'txt'

macro db866 [arg] ; macro that allows in windows environment to make dos 866-RUS strings without pseudographic, for your language macro may be different.
 { local offset,char
   offset = $-$$
   db arg
   ;if arg eqtype ''
     repeat $-offset-$$
       load char byte from $$+offset+%-1
       if char > 7Fh
         if char >= 0F0h
           char = char - 10h
         else if char >= 0C0h
           char = char - 40h
         else
           if char = 0A0h ; NBSP
             char = 0FFh
           else if char = 0A4h ; Currency sign
             char = 0FDh
           else if char = 0A8h ; CYRILLIC CAPITAL LETTER IO
             char = 0F0h
           else if char = 0B0h ; degree sign
             char = 0F8h
           else if char = 0B7h ; middle dot
             char = 0FAh
           else if char = 0B8h ; CYRILLIC SMALL LETTER IO
             char = 0F1h
           else if char = 0B9h ; numero sign
             char = 0FCh
           else
             char = 0
           end if
         end if
         store byte char at $$+offset+%-1
       end if
     end repeat }
   ;end if }

struc db866 [args]
 { common label . word
   db866 args }

db866 'Ïðèâåò ìèð',"¤",'¨¸',"°","·","¹","english text" ; in Win1251 RUSTEXT: "Hello World",currency sign in quotes,"YOyo",degree sign in quotes, middle dot in quotes, numero sign in quotes,"english text"= 'a' ; declare symbol with cirilic at name, 1st char is english letter - so it is valid symbol
db a¨

d¤ = 7 ; declare realy-realy uniqe symbol -it isn`t useful for end programmer, but... ...for making something that can be name clashed frequency.

db a¨ +; using of our unusual symbols    


result text in dos cp 866 same as in win1251 entered with letters "a","g" at end.

Maybe someone describe this previously? It there `re more such features hidden in fasm?

Code:
= 'a'
db a¨

d¤ = 7

db a¨ +

Yea in fasmg it supported too: result 2 bytes, no error.

Tomasz, please!!!!: don`t fix it. It is a cool feature. it is not a bug.
No more needed for uniques to make long sequences of random chars so that no one use it in its own code, now it is possible to save in name meaning and make it unique by adding just 1 symbol.

I explore this feature when I tryed to add kolibriOS fasm sources to my colaborate fasm1-fasmg package - in future i add them.


Description:
Download
Filename: TESTWIN2DOS.ASM
Filesize: 1.1 KB
Downloaded: 858 Time(s)


_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 28 Jul 2017, 10:19
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 28 Jul 2017, 11:25
All fasm versions treat the bytes 128-255 as a regular characters, and any character that is not one of the syntactically special ones can be used to form names of symbols. You can even begin a name with such character, because the only restriction on the first character of a name is that it cannot be a digit.
This also means that fasm is mostly encoding-neutral, because it does not matter what encoding you use, byte values 128-255 are always treated as parts of symbol names and they just need to be matched exactly every time you use such name. But, because of that, case-insensitivity option that fasmg provides does not work with any characters other than the basic English A-Z set.
Post 28 Jul 2017, 11:25
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 28 Jul 2017, 11:59
So, Tomasz. Why you not used it?
For example (0A4h) ¤ looks language independent, in win... codepages it is on the same place in all of them, so it can be freely used as unique mark of some global vars in code related to windows programming. Fact that this symbol can`t be entered from keyboard (even with use of alt key) it can be only copypasted from clipboard. So pure end programmers wouldn`t use it.
Post 28 Jul 2017, 11:59
View user's profile Send private message Send e-mail Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 28 Jul 2017, 12:27
(0A0h)   looks interest too:it looks like whitespace, but it not break the sequence for token (Maybe symbol called "no-break space" exacly for such purposes). It is more interest to end programmers, that likes all bad in programming (I think whitespace in token it is evil, even such clever whitespace as 0A0h).
Post 28 Jul 2017, 12:27
View user's profile Send private message Send e-mail 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.