flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > ARM Development Studio (GBA) + 7 Examples |
Author |
|
m3ntal 08 Dec 2013, 14:50
Unofficial ARM GBA Studio.
Includes FASMARM Assembler, Magic-ARM Compiler (Beta), D-ARM7 Disassembler, examples, media/graphics (icons, cursors, images). All \EXAMPLES\ and \PROJECTS\ will assemble + execute where they are with no setup and they all have access to the same files in \INCLUDE\ and \MEDIA\. * \BINARY\ - Development programs * \UTILITY\ - Small utilities, file conversions * \EXAMPLES\ - 7 examples. Source+.GBA * \PROJECTS\ - User created projects. 3 templates * \INCLUDE\ - Magic-Compiler (LANGUAGE.INC) + library files: TEXT.INC, DRAW.INC, FONT.INC, etc * \MEDIA\ - Multi-media files, graphics+sounds, controls: FONT, ICON, CURSOR, SPRITE, STAGE, etc * \EMULATOR\ - ARM emulators. To setup, download VBA then copy VISUALBOYADVANCE.EXE (1.88MB) to \EMULATOR\VBA\ Preview: Code: ; _ ; ?__. .__ __ ____ _(_) __? ; / |/ / @ `/ $ `/ / __/ ; /_/|_/_/\_,_/\_, /_/\__/ ; /___/ ; Magic-ARM Compiler ; erase screen with color/a1... function clear.screen alias vga=a3, w=a2, c=a1 . vga=VRAM, w=SCREEN.N .repeat w . (u16) *vga++=c .endr endf ; address &vga[(y*(screen.w*2))+(x*2)]... function vga.xy . a3=SCREEN.PITCH, a4=a2*a3 . a4=a4+(a1<<1), a2=VRAM, a1=a2+a4 endf ; draw pixel: a1-a3=x/y/c... function draw.pixel alias vga=a1, c=v1 . c=a3 vga.xy . (u16) *vga=c endf ; draw horizontal line: a1-a4=x/y/w/c... function draw.line.h alias vga=a1, c=v1, w=v2 . c=a4, w=a3 vga.xy .repeat w . (u16) *vga++=c .endr endf ; text.n(t) - get text length, # characters function text.n alias t=a1, b=a2, c=v1 . c=1, b=t .while c ; until 0 . (u8) c=*t++ ; read c .endw . t--, t-b ; return current-start endf ; text.copy(a, b) - standard copy with 0 after function text.copy alias a=a1, b=a2, c=v1 . c=1 .while c . (u8) c=*b++ ; read . (u8) *a++=c ; copy .endw . a-- ; return end endf ; text.attach(a, b) - attach b to a function text.attach alias a=a1,\ b=a2, p=v1 . p=b text.end . b=p text.copy endf ; text.attach.c(t, c) - attach c to t function text.attach.c alias t=a1, c=v2 . c=a2 text.end . (u8) *t++=c, (u8) *t=0 endf ; text.find(t, c) - search for character. ; return address or 0 function text.find alias t=a1,\ c=v1, key=a2 .forever ; loop . (u8) c=*t ; read c .if c=0 ; end? return 0 ; not found .end .if c=key ; found? return t ; t=address .end . t++ ; next .endfv endf ; text.compare(a, b) - lexical comparison. ; return <0> function text.compare alias a=a1, b=a2,\ c=v1, d=v2 . c=1, d=c .while c=d ; while equal . (u8) c=*a++ . (u8) d=*b++ . c|d ; and both nonzero .breakz ; break if either=0 .endw . a=c-d ; return *a-*b endf ; text.upper(t) - convert to uppercase function text.upper alias t=a1, c=v1 .forever . (u8) c=*t ; get c .if c=0 ; end? return t .end .if c>=97 ; lowercase? .if c<=122 . c-32 . (u8) *t=c ; copy c .end .end . t++ ; next c .endfv endf ; convert unsigned 32BIT integer to text .while n ; until 0 . y=n ; dividend . x=1999999Ah ; ((2^32)/10)+1 . n=n-(n>>>30) ; n=n-(n>>>30) umull c, n, n, x ; divide: n*reciprocal . x=n<<1 ; multiply by 10 . x=x+(x<<2) . x=y-x ; remainder . c=x+30h ; c=(n%10)+'0' . (u8) *t++=c ; *t++=c .endw ; convert 32BIT binary number to text .while n ; *t++=(n&1)+'0' . x=n&1, x+30h . (u8) *t++=x . n>>>1 ; n/2 .endw . (u8) *t=0, a1=s ; convert bgr15 to rgb15 function convert.bgr15.rgb24 alias r=a1, g=a2, b=a3, c=a4 . c=a1, r=c&11111b, r<<3 . g=c>>5, g&11111b, g<<3 . b=c>>10, b&11111b, b<<3 . c=r<<16, r=c|(g<<8), r|b endf ; return r/g/b in a1-a3 from bgr15 function get.rgb15 alias r=a1, g=a2, b=a3, c=a4 . c=a1, r=c&11111b, g=c>>5, g&11111b . b=c>>10, b&11111b endf ; draw solid rectangle: a1-v1=x/y/w/h/c... function draw.box alias vga=a1, c=v1,\ sw=v2, w=v3, h=v4,\ pitch=a2, wb=a3 . w=a3, sw=w, h=a4 ; save w/h vga.xy . pitch=SCREEN.PITCH ; screen+row . wb=w<<1 ; w in bytes .repeat h ; h # times . w=sw ; reset saved .repeat w ; w # times . (u16) *vga++=c ; copy color .endr . vga+pitch, vga-wb ; advance .endr endf ; draw 15/16BPP bitmap. a1-a4=x/y/w/h. ; v1=pixels... . pitch=SCREEN.PITCH ; screen+image . iwb=w<<1 ; w in bytes vga.xy ; &vga(x,y) .repeat h ; h # times . w=sw ; get saved w .repeat w ; w # times . (u16) \ *vga++=*image++ ; copy pixel .endr . vga+pitch, vga-iwb ; advance .endr ; draw 15/16BPP bitmap with transparency ; by upper left pixel color (0x0). ; a1-a4=x/y/w/h. v1=pixels... . pitch=SCREEN.PITCH ; screen+image . iwb=w<<1 ; w in bytes . (u16) key=*image ; transparent color vga.xy ; &vga(x,y) .repeat h ; h # times . w=sw .repeat w ; w # times . (u16) c=*image++ .if c<>key ; opaque? . (u16) *vga++=c ; copy pixel .else . vga+2 ; next .end .endr . vga+pitch, vga-iwb ; advance .endr ; draw 15/16BPP scanline. a1-a3/v1=x/y/w/pixels... function draw.scanline alias vga=a1,\ ; aliases p=v1, w=v2 . w=a3, p=v1 ; save w/p vga.xy ; &vga(x,y) .repeat w ; w # times . (u16) *vga++=*p++ ; copy pixel .endr endf ; draw bitmap text (FONT.INC)... function draw.text alias t=v1,\ ; aliases x=v2, y=v3,\ c=v5, fw=v6, ix=v7 . t=a1, x=a2, y=a3 ; save these . ix=x . fw=FW ; font w . (u8) c=*t .while c ; while nonzero . (u8) c=*t++ ; get next c .if c=0Dh ; return? . t++ ; skip 0Ah after . x=ix, x-fw, y+FH ; reset x/y .end draw.c c, x, y ; draw character . x+fw ; x+font.w .endw endf (Keywords for search engines: programming ARM ASM assembler assembly tutorials how to learn introduction beginner manual bare metal GBA gameboy advance SP raspberry pi instruction reference encodings list decode register memory ip sp lr pc load relative mov ldr adr immediate constant address branch pipeline THUMB 1 2 FPA VFP SIMD NEON bios interrupt coprocessor emulator disassembler simulator)
|
||||||||||||||||||||
08 Dec 2013, 14:50 |
|
nop 09 Dec 2013, 08:22
welcome back uart777 great work
|
|||
09 Dec 2013, 08:22 |
|
ctl3d32 09 Dec 2013, 11:16
hauahuhuha
|
|||
09 Dec 2013, 11:16 |
|
HaHaAnonymous 09 Dec 2013, 11:34
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:08; edited 1 time in total |
|||
09 Dec 2013, 11:34 |
|
revolution 09 Dec 2013, 13:02
HaHaAnonymous wrote: How do you know it is uart777? |
|||
09 Dec 2013, 13:02 |
|
Dex4u 09 Dec 2013, 17:58
Its got to be him, there can not be two people putting out s**t like that.
Anyway i thought you was working on a usb stack for the RPI, was it too hard for you ?, i thought so. Mines almost finished. |
|||
09 Dec 2013, 17:58 |
|
HaHaAnonymous 09 Dec 2013, 20:02
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:06; edited 1 time in total |
|||
09 Dec 2013, 20:02 |
|
typedef 13 Dec 2013, 07:51
HaHaAnonymous wrote:
Hahahahahaha. I thought we solved this mystery already. We came to a conclusion that revolution is woman...or not. |
|||
13 Dec 2013, 07:51 |
|
m3ntal 13 Dec 2013, 16:59
What are you guys talking about? This post is supposed to be about ARM programming. Why do you get personal and change the subject?
I'm requesting that all replies to this be deleted or moved. |
|||
13 Dec 2013, 16:59 |
|
sid123 23 Dec 2013, 06:33
Nice examples, would consider it when I am over with x86 assembly,
(can't concentrate on two things, ARM and x86 ) So it's something like Visual Studio? Like some sort of IDE, Also, where did you get those cool windows, Z-Console? Is that your OS? All those nice graphics look cool. Any website or something? |
|||
23 Dec 2013, 06:33 |
|
m3ntal 25 Dec 2013, 19:37
Quote: So it's something like Visual Studio? Quote: Also, where did you get those cool windows, Z-Console? MAGIC-ARM FUNCTIONS First Real ARM Macro Language + Library. Pure LL register usage. Highly Portable Text + Graphics. Preview: Code: ; memory.set p, v, n ; memory.copy a, b, n ; memory.zero p, n ; text.n t ; get # characters (size-1) ; text.copy a, b ; standard copy with 0 after ; text.copy.n ... ; copy with maximum size ; text.attach a, b ; attach b to a; "concencate" ; text.attach.c... ; attach character ; text.compare a, b ; compare. return <0> ; text.find t, c ; search for c. return &/0 ; text.find.last... ; search for c reverse ; text.begins a, b ; begins with b? ; text.ends a, b ; ends with b? ; text.upper t ; convert to uppercase ; text.lower t ; convert to lowercase ; text.reverse t ; reverse ; i2t n, t ; number/text conversions ; u2t n, t ; h2t n, t ; b2t n, t ; vga.xy x, y ; &vga[xy(x,y)] ; color.at ; vga[xy(x,y)] ; clear.screen ; locate x, y, w, h ; draw.pixel x, y, c ; draw.line.h x, y, w, c ; draw.line.v x, y, h, c ; draw.scanline x, y, w, p ; draw.scanline.t x, y, w, p ; draw.scanline.v x, y, w, p, c ; draw.box x, y, w, h, c ; draw.box.a x, y, w, h, c, a ; draw.outline x, y, w, h, c ; draw.box.o x, y, w, h, c, c2 ; draw.bitmap x, y, w, h, p ; draw.bitmap.t x, y, w, h, p ; draw.bitmap.a x, y, w, h, p, a ; draw.fade x, y, w, h, c, c2 ; draw.shade x, y, w, h, c, c2 ; create.console ; draw.console ; putx x, s ; putc x ; putt x ; puts x ; putn n, name ; puti n ; putu n ; puth n ; putb n |
|||
25 Dec 2013, 19:37 |
|
dstyl 08 Aug 2015, 02:50
Serious hot stuff, already took out my flash card thumbs up man !
|
|||
08 Aug 2015, 02:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.