flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Main > unicode char

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 570
unicode char

Code:
include 'win32ax.inc' 
.code
  start:
        invoke  MessageBoxW,HWND_DESKTOP,"☆",invoke GetCommandLine,MB_OK
        invoke  ExitProcess,0
.end start 


To use Unicode, some converting macro exist, but only few. For some coding page there require more:

Code:
                           
       AD 9C AD 9D AD 9E AD 9F AD A0 AD A1 ; Page 936
(FF FE)EC 74 ED 74 F0 74 F1 74 F2 74 1A E1 ; Unicode

(One char per two bytes, but for letters one byte enough)
So is there tool to create a converting macro?
Post 07 Jan 2017, 02:44
View user's profile Send private message Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 570
Use this code in VB?

Code:
Dim v&()
Const LAST_CHAR& = &H80000000
Const NEED_GOON& = &H00000000
    Const ERROR& = &H7FFFFFFF

Sub main()
Dim i&, s() As Bytec$j&, p&, k&
'Init
ReDim v(255)
For i = 0 To 255
    v(i) = ERROR
Next
'Main
For i = 0 To 65535
    c = ChrB(i And 255) & ChrB(i \ 256)
    s = StrConv(cvbFromUnicode)
    If StrConv(svbUnicode) = c Then
        ' Create
        p = 0
        For j = 0 To UBound(s) - 1
            ' Page
            If v(p Or s(j)) = ERROR Then
                v(p Or s(j)) = NEED_GOON Or (UBound(v) + 1)
                ReDim Preserve v(UBound(v) + 256)
                For k = UBound(v) - 255 To UBound(v)
                    v(k) = ERROR
                Next
            End If
            p = v(p Or s(j)) Xor NEED_GOON
        Next
        v(p Or s(UBound(s))) = LAST_CHAR Or i
    End If
Next
Open App.Path & "\data.dat" For Binary As #1
Put #1, , v
Close #1
End Sub

Post 07 Jan 2017, 05:08
View user's profile Send private message Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 570

Code:
virtual at 0
  charcode::file 'data.dat'
end virtual
macro du [str] {
  local swnpa
  if str eqtype ''
    virtual at 1
   w::db str
      n = $
    end virtual
    p = 0
    repeat n-1
      load a byte from w:%
      displayint a
      load p dword from charcode:4*(p+a)
      displayint p
      if (p and $8000'0000)<>0
        dw p and $ffff
        p = 0
      end if
    end repeat
    if p <> 0
      'Error'
    end if
  else
    du str
  end if
}

Post 07 Jan 2017, 08:27
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.