flat assembler
Message board for the users of flat assembler.

Index > 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
m3ntal 01 Dec 2014, 14:29
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 GetModuleHandleW, 0
  stm a1, hmodule
  call HeapCreate, 0, 0, 0
  stm a1, heap
  call GetSystemMetrics, 0
  stm a1, os.w
  stm a1, screen.w
  stm a1, window.w
  call GetSystemMetrics, 1
  stm a1, os.h
  stm a1, screen.h
  sub a1, 22
  stm a1, window.h
  mov a1, 0
  stm a1, window.x
  mov a1, 22
  stm a1, window.y
endf

function create.window
  ldm a1, hmodule
  ldi v7, wc
  str a1, [v7, ?wc.hInstance]
  mov a1, 0
  str a1, [v7, ?wc.style]
  ldi a1, !window.event
  str a1, [v7, ?wc.lpfnWndProc]
  set.window.color 0F7E1E7h
  ldm v5, window.color
  call CreateSolidBrush, v5
  str a1, [v7, ?wc.hbrBackground]
  ldi a1, main.class.name
  str a1, [v7, ?wc.lpszClassName]
  call RegisterClassW, v7
  tst a1, a1
  beq .error
  ldi v1, main.class.name
  ldi v2, title
  ldi v3, WS_DEFAULT
  ldm v4, window.x
  ldm v5, window.y
  ldm v6, window.w
  ldm v7, window.h
  ldm v8, hmodule
  call CreateWindowExW, 0, v1, v2, v3,\
   v4, v5, v6, v7, 0, 0, v8, 0
  stm a1, hwnd
  tst a1, a1
  beq .error
  .success:
   return 1
  .error:
endf 0

function show.window
  ldm v7, hwnd
  call ShowWindow, v7, 3
  call UpdateWindow, v7
  call InvalidateRect, v7, 0, 0
endf

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

align

IMAGE project.i, open.i, save.i, undo.i,\
 cut.i, copy.i, paste.i, search.i,\
 compile.i, execute.i, help.i

TOOL.BAR tool.bar,\
  project.i, open.i, save.i, undo.i,\
  search.i, compile.i, execute.i, help.i

TOOL.BAR tool.bar2,\
  project.i, open.i, save.i, undo.i,\
  cut.i, copy.i, paste.i, search.i,\
  compile.i, execute.i, help.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 project, open, save,\
   undo, cut, copy, paste, search,\
   compile, execute, help
endf

function draw.tool.bar, tb, n
  alias x=v1, y=v2, w=v3,\
   n=v4, p=v5, image=v7
  mov x, 0
  mov y, 4
  mov w, 30
  mov p, a1
  mov n, a2
  @@:
    ldr image, [p]
    draw.image image, x, y
    add x, w
    add p, 4
    subs n, 1
  bne @b
endf

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

function load.image, name, file
  alias x=v3, bmp=v5, hbmp=v6, image=v7
  mov image, a1
  add bmp, a1, ?image.bmp
  add hbmp, a1, ?image.hbmp
  mov v1, a2
  call SHLoadDIBitmap, v1
  str a1, [image, ?image.hbmp]
  mov v1, a1
  call GetObjectW, v1, BITMAP.$, 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 name, file {
  if file eq
    load.image name, name#.file
  else
    load.image name, file
  end if
}

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

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

function draw.image, name
  mov v7, a1
  ldm v1, hdc
  call CreateCompatibleDC, v1
  stm a1, mdc
  mov v1, a1
  ldr v2, [v7, ?image.hbmp]
  call SelectObject, v1, v2
  ldm v1, hdc
  ldr v2, [v7, ?image.x]
  ldr v3, [v7, ?image.y]
  ldr v4, [v7, ?image.w]
  ldr v5, [v7, ?image.h]
  ldm v6, mdc
  ldi v7, 0CC0020h
  call StretchBlt, v1, v2, v3, v4, v5,\
   v6, 0, 0, v4, v5, v7
  call DeleteDC, v6
endf

macro draw.image name, x, y {
  if ~x eq
    move.image name, x, y
  end if
  draw.image name
}    
FASM main/structure:
Code:
function compile, name
  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.
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: 19869
Location: In your JS exploiting you and your system
revolution 01 Dec 2014, 16:06
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
m3ntal 01 Dec 2014, 17:26


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
m3ntal 01 Dec 2014, 17:33
[ Post removed by author. ]


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
m3ntal 01 Dec 2014, 18:09
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
m3ntal 02 Dec 2014, 12:06
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
Post 02 Dec 2014, 12:06
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 24 Jul 2015, 17:45
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
NEASM



Joined: 13 Apr 2018
Posts: 13
NEASM 14 Sep 2018, 23:59
Download link doesn't works. Please, fix it.
Post 14 Sep 2018, 23:59
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.