flat assembler
Message board for the users of flat assembler.

flat assembler > Non-x86 architectures > gba gfxlib, port to fasmarm

Author
Thread Post new topic Reply to topic
ghoshi



Joined: 18 Feb 2010
Posts: 7
hi, I've been modified the gba gfxlib (http://www.devrs.com/gba/asmcode.php) and port part of it to fasmarm, can draw pixel, line, ellipse on the gba screen now.

Compile: fasmarm fasmarm glib.asm
Run: VisualBoyAdvance glib.bin

Install VisualBoyAdvance in ubuntu: sudo apt-get install VisualBoyAdvance


Description: Screenshot
Filesize: 13.11 KB
Viewed: 11434 Time(s)

gfxlib.png


Description: fasmarm_gba_gfxlib
Download
Filename: fasmarm_gba_gfxlib.tar.gz
Filesize: 23.98 KB
Downloaded: 580 Time(s)

Post 16 Jul 2010, 09:18
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Wow, that's pretty cool.
Post 16 Jul 2010, 10:21
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
The GBA use ARM7TDMI, that is version 4 of the instruction set. You might want to consider use the processor and coprocessor directives to set the instructions supported. Otherwise you have to manually make sure that you don't try to use something from a later generation.
Post 16 Jul 2010, 10:45
View user's profile Send private message Visit poster's website Reply with quote
ghoshi



Joined: 18 Feb 2010
Posts: 7
Thank you, revolution, I'll pay attention to this. And I want to port like MenuetOS to fasmarm too, but need some more tutorial, or can some one give me some example of os writed with fasmarm please?
Post 16 Jul 2010, 11:36
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
ghoshi wrote:
... can some one give me some example of os writed with fasmarm please?
fasmarm has a very small user base. It will take time before things like open source OSes start to appear, if at all.

ARM is not really targeted towards general purpose systems, so any assembly code tends to be single purpose and not very transferable to elsewhere.

But Linux has been ported to many boards. However it tends to be a huge install and a huge overhead in the small ARM boards. I would only recommend it for quick and dirty setups where performance and power usage optimisation are not important.
Post 16 Jul 2010, 11:54
View user's profile Send private message Visit poster's website Reply with quote
ghoshi



Joined: 18 Feb 2010
Posts: 7
I just try to write a small os with height performance and low power with fasmarm, so I' try it, thank you.
Post 16 Jul 2010, 13:09
View user's profile Send private message Reply with quote
ghoshi



Joined: 18 Feb 2010
Posts: 7
@revolution, when I write this: LDR r2,0x0FF00FF0, the compiler complain that the second parameter is invalid, can you tell me why, and how to solve this?
Post 16 Jul 2010, 13:53
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
What are you trying to do?

Load a value from memory or load a constant?

ldr r1,[r1,offset]

or,

mov r2,0x0ff00000
orr r2,r2,0x00000ff0
Post 16 Jul 2010, 13:59
View user's profile Send private message Visit poster's website Reply with quote
ghoshi



Joined: 18 Feb 2010
Posts: 7
revolution wrote:
What are you trying to do?

Load a value from memory or load a constant?

ldr r1,[r1,offset]

or,

mov r2,0x0ff00000
orr r2,r2,0x00000ff0

I try to load a 32bit constant to regtister, use ldr, but can't compile correct.
Post 16 Jul 2010, 15:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
ldr r2,[MyConstant]
;...
MyConstant dw 0x0FF00FF0
Post 16 Jul 2010, 16:13
View user's profile Send private message Visit poster's website Reply with quote
ghoshi



Joined: 18 Feb 2010
Posts: 7
If I want to use the immediately value in the ldr instructions?
Post 17 Jul 2010, 01:43
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
ghoshi wrote:
If I want to use the immediately value in the ldr instructions?
ARM CPU does not support such instructions. Use MOV+ORR or a variable defined somewhere in memory.
Post 17 Jul 2010, 02:00
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: 16128
Location: Hyperborea
revolution wrote:
The GBA use ARM7TDMI, that is version 4 of the instruction set. You might want to consider use the processor and coprocessor directives to set the instructions supported. Otherwise you have to manually make sure that you don't try to use something from a later generation.
This is especially important when you use nop. If fasmarm thinks you have a v6K or higher CPU (the default is to enable all CPU instruction sets) then it will generate the 0xE320F000 nop hint instruction. On a v4 CPU this will fault as the instruction is not available. The v4 instruction set does not have any real nop instructions, fasmarm will synthesise it by using 0xE1A00000 mov r0,r0.
Post 17 Jul 2010, 04:54
View user's profile Send private message Visit poster's website Reply with quote
ghoshi



Joined: 18 Feb 2010
Posts: 7
OK, thank you, revolution, I'll notice this Smile
Post 17 Jul 2010, 05:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
Oh yeah, and one other reason to restrict the CPU instruction range is mov
Code:
;v7 (default)
mov r0,0x123 ;0xE3000123  - movw r0,0x123
;v4
processor 0xfe
mov r0,0x123 ;error: Requires CPU capability T2, use directive "processor" to select.    
Post 17 Jul 2010, 05:33
View user's profile Send private message Visit poster's website 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-2018, Tomasz Grysztar.

Powered by rwasa.