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 > Non-x86 architectures > [ARMv7a] Windows Mobile Phone Example, Native FASM Mobile!

Author
Thread Post new topic Reply to topic
m3ntal



Joined: 08 Dec 2013
Posts: 296
[ARMv7a] Windows Mobile Phone Example, Native FASM Mobile!

Quote:
I recently got this LG Fathom for ARM programming, used for under $20. It's one of the last Windows Mobile (6.5) phones ever released. ARMv7a CPU with VFP/movw/t. High resolution: 800x480. Good physical keyboard. All standard symbols for pocket programming. Micro SD. Integrated stylus. Long battery life, 2-3 days of light/medium usage. CE/WM is very energy effecient compared to Android and I-Phone.

IMO, much better for ARM programming than Raspberry PI which has an old ARMv6, no VFP/movw/t and many other problems. Unlike ARM embedded systems, this is an all in one solution: PC, display, keyboard, battery, internal wifi and OS/API that predefines everything. Best $17 I've ever spent!



Image

EXAMPLE: FLAT ASSEMBLER MOBILE (WIP). ONLY 6K .EXE!

Download: FASM Mobile

Image
Image
Image

FASM Mobile design, minimal text editor. Written in FASMARM, mostly LL assembler with some pseudo instructions (ldi/m=immediate/memory) and function. Source preview:

Code:
;;;;;;;;;;;;;;;;;;;;; WINDOW ;;;;;;;;;;;;;;;;;;;;;

function initialize
  call GetModuleHandleW0
  stm a1hmodule
  call HeapCreate000
  stm a1heap
  call GetSystemMetrics0
  stm a1os.w
  stm a1screen.w
  stm a1window.w
  call GetSystemMetrics1
  stm a1os.h
  stm a1screen.h
  sub a122
  stm a1window.h
  mov a10
  stm a1window.x
  mov a122
  stm a1window.y
endf

function create.window
  ldm a1hmodule
  ldi v7wc
  str a1, [v7?wc.hInstance]
  mov a10
  str a1, [v7?wc.style]
  ldi a1!window.event
  str a1, [v7?wc.lpfnWndProc]
  set.window.color 0F7E1E7h
  ldm v5window.color
  call CreateSolidBrushv5
  str a1, [v7?wc.hbrBackground]
  ldi a1main.class.name
  str a1, [v7?wc.lpszClassName]
  call RegisterClassWv7
  tst a1a1
  beq .error
  ldi v1main.class.name
  ldi v2title
  ldi v3WS_DEFAULT
  ldm v4window.x
  ldm v5window.y
  ldm v6window.w
  ldm v7window.h
  ldm v8hmodule
  call CreateWindowExW0v1v2v3,\
   v4v5v6v700v80
  stm a1hwnd
  tst a1a1
  beq .error
  .success:
   return 1
  .error:
endf 0

function show.window
  ldm v7hwnd
  call ShowWindowv73
  call UpdateWindowv7
  call InvalidateRectv700
endf

;;;;;;;;;;;;;;;;;;;;; TOOLBAR ;;;;;;;;;;;;;;;;;;;;

align

IMAGE project.iopen.isave.iundo.i,\
 cut.icopy.ipaste.isearch.i,\
 compile.iexecute.ihelp.i

TOOL.BAR tool.bar,\
  project.iopen.isave.iundo.i,\
  search.icompile.iexecute.ihelp.i

TOOL.BAR tool.bar2,\
  project.iopen.isave.iundo.i,\
  cut.icopy.ipaste.isearch.i,\
  compile.iexecute.ihelp.i

filename \
 media.folder='MEDIA\',\
 project.i.file='MEDIA\CODE.BMP',\
 open.i.file='MEDIA\OPEN.BMP',\
 save.i.file='MEDIA\SAVE.BMP',\
 undo.i.file='MEDIA\UNDO.BMP',\
 cut.i.file='MEDIA\CUT.BMP',\
 copy.i.file='MEDIA\COPY.BMP',\
 paste.i.file='MEDIA\PASTE.BMP',\
 search.i.file='MEDIA\SEARCH.BMP',\
 compile.i.file='MEDIA\COMPILE.BMP',\
 execute.i.file='MEDIA\EXECUTE.BMP',\
 help.i.file='MEDIA\HELP.BMP'

function load.tool.bar
  load.images projectopensave,\
   undocutcopypastesearch,\
   compileexecutehelp
endf

function draw.tool.bartbn
  alias x=v1y=v2w=v3,\
   n=v4p=v5image=v7
  mov x0
  mov y4
  mov w30
  mov pa1
  mov na2
  @@:
    ldr image, [p]
    draw.image imagexy
    add xw
    add p4
    subs n1
  bne @b
endf

;;;;;;;;;;;;;;;;;;;;;; IMAGE ;;;;;;;;;;;;;;;;;;;;;

function load.imagenamefile
  alias x=v3bmp=v5hbmp=v6image=v7
  mov imagea1
  add bmpa1?image.bmp
  add hbmpa1?image.hbmp
  mov v1a2
  call SHLoadDIBitmapv1
  str a1, [image?image.hbmp]
  mov v1a1
  call GetObjectWv1BITMAP.$bmp
  ldr x, [bmp?bitmap.bmWidth]
  str x, [image?image.w]
  ldr x, [bmp?bitmap.bmHeight]
  str x, [image?image.h]
endf

macro load.image namefile {
  if file eq
    load.image namename#.file
  else
    load.image namefile
  end if
}

macro load.images [name]
 { forward load.image name#.i }

function move.imagenamexy
  str a2, [a1?image.x]
  str a3, [a1?image.y]
endf

function draw.imagename
  mov v7a1
  ldm v1hdc
  call CreateCompatibleDCv1
  stm a1mdc
  mov v1a1
  ldr v2, [v7?image.hbmp]
  call SelectObjectv1v2
  ldm v1hdc
  ldr v2, [v7?image.x]
  ldr v3, [v7?image.y]
  ldr v4, [v7?image.w]
  ldr v5, [v7?image.h]
  ldm v6mdc
  ldi v70CC0020h
  call StretchBltv1v2v3v4v5,\
   v600v4v5v7
  call DeleteDCv6
endf

macro draw.image namexy {
  if ~x eq
    move.image namexy
  end if
  draw.image name
}

FASM main/structure:

Code:
function compilename
  set.source.file name
  try preprocessor
  try parser
  try assembler
  try formatter
endf 1

function run
  try compile source.file
  execute destiny.file
endf 1

function preprocessor
  ; ...
endf 1

function parser
  ; ...
endf 1

function assembler
  ; ...
endf 1

function formatter
  ; ...
endf 1

HOW 2 SETUP & TEST ON PHONE

Quote:
* Settings > Advanced > Connections > Switch USB
* Select (*) USB Mass Storage, Save then OK
* Connect USB cable to PC. It should be recognized as a
drive. If it doesn't work, try to reconnect and press
power/reset or use the MicroSD
* Copy \FASMWM\ folder to phone main directory
* Disconnect USB cable. "Storage Card" will appear in
"File Explorer" on phone
* In "File Explorer", click/touch \FASMWM\*.EXE.
"Run from unknown sources?" Yes


MICROSOFT DEVICE EMULATOR

You can also use Microsoft Device Emulator and Mobile 6 SDK. Setup: File > Configure > General, set "Shared Folder" to \FASMWM\ and it will appear as "Storage Card" in "File Explorer". If there's an error, "(*) Disable error...". No VFP/movw/t, causes crash.

Image

"ANY GOOD ARM WINDOWS CE DEVICES?"

Search DealExtreme for: "GPS WINDOWS CE". The GPS devices have CE 5.0-6.0, 5"-7" screens, bluetooth for mouse/keyboard/remote. You can switch from the launcher to the old Windows CE for ARMv7+ programming in the classic Windows 95-style interface.

_________________
New FASM Site, Examples, Graphics, Updated Libraries
Post 01 Dec 2014, 14:29
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15096
Location: The Unicomplex
The device seems reasonable as a development system but the limited supply will be a problem for many.

Can the OS be rooted and/or replaced?


Last edited by revolution on 01 Dec 2014, 18:11; edited 1 time in total
Post 01 Dec 2014, 16:06
View user's profile Send private message Visit poster's website Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296


Last edited by m3ntal on 03 Dec 2014, 12:09; edited 1 time in total
Post 01 Dec 2014, 17:26
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
...


Last edited by m3ntal on 02 Dec 2014, 12:07; edited 1 time in total
Post 01 Dec 2014, 17:33
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
http://msdn.microsoft.com/en-us/library/bb158760.aspx. Windows Mobile GPS MSDN. Gpsapi.lib
Post 01 Dec 2014, 18:09
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
Update. Improved toolbars for portrait and landscape modes. New "Run/execute" red arrow. "Compile" uses official FASM hammer icon but smaller without microchip. Look at the time Cool

Image
Image

_________________
New FASM Site, Examples, Graphics, Updated Libraries
Post 02 Dec 2014, 12:06
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 48
You can also but UNIX os like linux with haret, from sd. Also WM devices have advanced debuging features, and you dont need root ,jailbreak or sth. its completly unprotected. Cool stuff fasm mobile thumbs up Wink
Post 24 Jul 2015, 17:45
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.