flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > [ARM] OS/Graphics/UI. Magic-Compiler+Emulator. 8 Examples |
Author |
|
m3ntal 07 Mar 2014, 16:43
Magic-Compiler + 8 Examples for the PL110 ARM Primecell Color LCD Controller.
Visual UI/interfaces/controls. High resolution fonts and icons. Drawing works with any display that supports RGB 16 5.6.5 (example: Raspberry PI). Download: Magic-Compiler Package (8MB ZIP due to QEMU). Source code is compatible with FASMARM (included in \BINARY\). No setup. All \EXAMPLES\ and \PROJECTS\ compile+run where they are located and they all have shared access to \MEDIA\ files. To run an example, click NAME.BAT. QEMU works most of the time. If it fails (black screen, "Stopped"), just retry. LANGUAGE.INC is never finished, always under construction. No input. I couldn't find any information online for this device except for ARM's documents and QEMU's source code. Preview: Code: ; address &vga[(y*(screen.w*2))+(x*2)]... function vga.xy.16 . a3=SCREEN.PITCH, a4=a2*a3 . a4+(a1<<1), a2=VGA, a1=a2+a4 endf ; erase screen with color/a1... function clear.screen.16 alias vga=a3,\ w=a2, c=a1 . vga=VGA, w=SCREEN.N .repeat w . (u16) *vga++=c .endr endf ; create rgb16: a1/a2/a3 = 0-31/0-63/0-31 function rgb16 alias r=a1, g=a2, b=a3 . r&11111b, g&111111b, b&11111b . r<<11, r|(g<<5), r|b endf ; extract r/g/b 16 function get.rgb16 alias r=a1, g=a2, b=a3, c=a4 . c=r, r=c>>11, r&11111b, g=c>>5 . g&111111b, b=c&11111b endf ; draw pixel: a1-a3=x/y/c... function draw.pixel.16 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.16 alias vga=a1, c=v1, w=v2 . c=a4, w=a3 vga.xy .repeat w . (u16) *vga++=c .endr endf ; draw solid rectangle: a1-v1=x/y/w/h/c... function draw.box.16 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 rectangle outline... function draw.outline.16 alias c=v1,\ x=v2, y=v3, w=v4, h=v5 . x=a1, y=a2, w=a3, h=a4 vga.xy draw.line.h x, y, w, c ; top: x, y, w draw.line.v x, y, h, c ; left: x, y, h . a1=x+w, a1-- ; right: x+w-1 . a2=y+1, a3=h-1 ; y+1, h-1 draw.line.v a1, a2, a3, c . a1=x, a2=y+h, a2-- ; bottom: y+h-1 draw.line.h a1, a2, w, c endf ; draw rectangle with transparency... ; a1-a4=x/y/w/h. v5=color, v6=alpha function draw.box.t.16 alias vga=a1, c=v1,\ w=v3, h=v4, sw=v2,\ cl=v5, a=v6,\ pitch=a2,\ wb=a3, sc=v7 . 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) c=*vga ; screen color pusha mix c, cl, a ; combine . c=a1 popa . (u16) *vga++=c ; copy .endr . vga+pitch, vga-wb ; advance .endr endf ; draw 16BPP scanline. a1-a3/v1=x/y/w/pixels... function draw.scanline.16 alias vga=a1,\ ; aliases p=v1, w=v2 . w=a3 ; save w vga.xy ; &vga(x,y) .repeat w ; w # times . (u16) *vga++=*p++ ; copy pixel .endr endf ; draw with transparent color... function draw.scanline.t.16 alias vga=a1,\ ; aliases c=a2, key=v2,\ w=v3, p=v1 . w=a3, p=a4 ; save w/p vga.xy ; &vga(x,y) . (u16) key=*p ; color at 0x0 .repeat w ; w # times . (u16) c=*p++ ; get source pixel .if c<>key ; opaque? . (u16) *vga=c ; copy to screen .end . vga+2 ; next .endr endf ; draw 16BPP variant scanline. ; a1-v1=x/y/w/c/pixels... function draw.scanline.v.16 alias vga=a1,\ ; aliases p=v1, c=v2, s=v3,\ cl=v4, x=v5, w=v6,\ n=v7 . w=a3, cl=a4 ; save w, color vga.xy ; &vga(x,y) .repeat w ; w # times . (u16) c=*p++ ; get source pixel .if c=0 ; black, 100% invisible go .next .end . x=WHITE .if c=x ; white, 100% visible . c=cl go .draw .end . (u16) s=*vga ; else mixed . n=c&11111b, n<<3 ; alpha intensity .if n>=252 ; invisible go .next ; skip .end .if n<=4 ; pure . c=cl go .draw .end pusha mix s, cl, n ; combine . c=r0 ; screen+color popa .draw: . (u16) *vga=c .next: . vga+2 ; next .endr endf ; draw bitmap with transparency ; by upper left pixel color (0x0). ; a1-a4=x/y/w/h. v1=pixels... function draw.bitmap.t.16 alias \ ; aliases vga=a1, image=v1,\ w=v2, h=v3, sw=v4,\ ; sizes, saved w pitch=v5, iwb=v6,\ key=v7, c=a2 . w=a3, h=a4, sw=w ; save size . 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 endf ; draw bitmap with alpha in v8 function draw.bitmap.a.16 alias \ ; aliases vga=a1, image=v1,\ w=v2, h=v3, sw=v4,\ ; sizes, saved w pitch=v5, iwb=v6,\ key=v7, a=v8, c=r12 . w=a3, h=a4, sw=w ; save size . 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? pusha . (u16) a2=*vga . a1=c, a3=a mix . c=a1 popa . (u16) *vga++=c ; copy pixel .else . vga+2 ; next .end .endr . vga+pitch, vga-iwb ; advance .endr endf ; mix(a, b, n) - alpha combination. colors: ; a1/a2=a/b. intensity: a3/n=0-31 function mix.rgb16 alias \ a=a1, b=a2,\ n=a3, d=a4,\ x=v1, s=v2,\ sr=v3, sg=v4, sb=v5 . d=a>>>11, d&1Fh ; dr=(c1>>11)&11111b . s=b>>>11, s&1Fh ; sr=(c2>>11)&11111b . s-d, s*n, s>>>8 ; ((sr-dr)*n)>>8)+dr . sr=s+d . d=a>>>5, d&3Fh ; dg=(c1>>5)&111111b . s=b>>>5, s&3Fh ; sg=(c2>>5)&111111b . s-d, s*n, s>>>8 ; ((sg-dg)*n)>>8)+dg . sg=s+d . d=a&1Fh, s=b&1Fh ; db=c1&11111b . s-d, s*n, s>>>8 ; ((sb-db)*n)>>8)+db . sb=s+d . a=sr<<11 ; c=(r<<11)|(g<<5)|b . a|(sg<<5), a|sb endf ; memory.copy(destiny, source, count) function memory.copy, a, b, n cmp a3, 4 ; if n<4 blt .8 ; copy 8BIT mov v2, a3, lsr 2 ; v2=n/4 .32: ; copy 32BIT ldr v1, [a2], 4 ; v1=*a2++ str v1, [a1], 4 ; *a1++=v1 subs v2, 1 ; v2 # times bne .32 ands a3, 3 ; modulo 4 beq .! ; remainder? .8: ; copy 8BIT ldrb v1, [a2], 1 ; v1=*a2++ strb v1, [a1], 1 ; *a1++=v1 subs a3, 1 ; a3 # times bne .8 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.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.equal(a, b) - equal? return 1/0 function text.equal text.compare .if false return 1 .end endf 0 ; 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.find.last(t, c) - search for c reverse function text.find.last alias t=a1, c=a2,\ key=v1, p=v2 . key=c, p=t ; save begin . c=1 .while c ; advance to end-1, . (u8) c=*t++ ; last character .endw . t-2 .while t>p ; loop backwards . (u8) c=*t ; until beginning .if c=key ; found return t ; t=address .end . t-- ; previous .endw endf 0 ; not found
Last edited by m3ntal on 12 Mar 2014, 07:47; edited 3 times in total |
||||||||||
07 Mar 2014, 16:43 |
|
m3ntal 07 Mar 2014, 16:47
7 examples + 3 project templates:
|
||||||||||
07 Mar 2014, 16:47 |
|
m3ntal 07 Mar 2014, 16:48
Magic-Compiler with syntax highlighting:
|
||||||||||
07 Mar 2014, 16:48 |
|
m3ntal 08 Mar 2014, 20:06
|
|||
08 Mar 2014, 20:06 |
|
Gyver 09 Mar 2014, 10:40
Mouse doesn' t work on my system : Win 8.1 pro 64 bit
|
|||
09 Mar 2014, 10:40 |
|
m3ntal 10 Mar 2014, 03:24
Gyver: Sorry, no input.
QEMU supports serial+USB mouse+keyboard, but I can't find any information on how to initialize devices, setup interrupts and send/receive data. From ARM's documents, I managed to initialize the LCD and access a linear VGA. QEMU also supports Angel-ARM interrupts - see QEMU\TARGET-ARM\ARM-SEMI.C - so file I/O should be easy. Last edited by m3ntal on 12 Mar 2014, 07:30; edited 1 time in total |
|||
10 Mar 2014, 03:24 |
|
m3ntal 12 Mar 2014, 07:27
UPDATE (3/12/14)
* Download Magic-Compiler. New Angel-ARM, FILE.ASM example, FILE.INC, open/create/read/write/seek/etc, CONSOLE.INC, more testing, functions with fast-call parameters (TEXT+DRAW is reduced and clearer), removed DRAW.INC suffixes. Fix: text.find.last. \EXAMPLES\FILE\FILE.ASM: 100% portable. Code: text title.t='Angel-ARM',\ name='EXAMPLE.TXT',\ output='ABCDEFGHIJ',\ error.t='File I/O failed' size=output.$ main puts name putr get.filename name puts filename putr create filename .if false go .error .end text.copy buffer, output text.reverse buffer write buffer, size .if false go .error .end close open filename .if false go .error .end read buffer, size .if false go .error .end puts buffer text.reverse buffer puts buffer go .ok .error: puts error.t .ok: close draw.console endm |
|||
12 Mar 2014, 07:27 |
|
m3ntal 22 Mar 2014, 10:23
New: Convert text to number (i/u/h/b):
Code: ; convert text to unsigned 32BIT integer function t2u, t alias t=v1,\ c=v2, n=v3 . t=a1, (u8) c=*t .if c=30h ; skip preceding .while c=30h ; '0's... . (u8) c=*t++ .endw . t-- .end .if c=0 ; 0 value? return 0 .end . n=0 .forever . (u8) c=*t++ .if c=0 return n .end . n+(n<<2), n+n ; n=n*10+*t++-'0' . n-30h, n+c .endfv endf n ; convert text to signed 32BIT integer function t2i, t alias t=v1,\ c=v2, negate=v3 . t=a1, (u8) c=*t . negate=0 .if c='-' ; negative? . t++, negate=1 ; skip .end t2u t .if negate . -a1 .end endf ; convert hexadecimal text to number function t2h, t ; text to hexadecimal alias t=v1,\ c=v2, n=v3 . t=a1, (u8) c=*t .if c=30h ; skip preceding .while c=30h ; '0's... . (u8) c=*t++ .endw . t-- .end .if c=0 ; 0 value? return 0 .end . n=0 .forever . (u8) c=*t++ .if c=0 return n .end . n<<4 ; n=n*16+c2h(*t++) .if c<=39h ; 0-9 . c-30h .else.if c>=97 ; a-f . c-57h .else ; A-F . c-37h .end . n+c .endfv endf n ; convert binary text to number function t2b, t ; text to binary alias t=v1,\ c=v2, n=v3 . t=a1, (u8) c=*t .if c=30h ; skip preceding .while c=30h ; '0's... . (u8) c=*t++ .endw . t-- .end .if c=0 ; 0 value? return 0 .end . n=0 .forever . (u8) c=*t++ .if c=0 return n .end . n<<1, n+c ; n=n*2+*t++-'0' . n-30h .endfv endf n Code: ;;;;;;;;;;;;;;;;;;; PARSE TEXT ;;;;;;;;;;;;;;;;;;; ; skip while type and not 0 ; get p=text.skip.while p, C.WHITE function text.skip.while, t, type alias t=a1,\ type=a2, c=a3, p=a4 .forever . (u8) c=*t .if c=0 return 0 .end . p=TLT, p+c . (u8) c=*p, c&type .breakz . t++ .endfv . (u8) c=*t .if c=0 return 0 .end endf ; skip until type and while not 0 ; get p=text.skip.until p, C.RETURN function text.skip.until, t, type alias t=a1,\ type=a2, c=a3, p=a4 .forever . (u8) c=*t .if c=0 return 0 .end . p=TLT, p+c . (u8) c=*p, c&type .breakn . t++ .endfv . (u8) c=*t .if c=0 return 0 .end endf ; copy while type and not 0 ; get s=text.copy.while t, s, C.NAME function text.copy.while, a, b, type alias a=a1, b=a2,\ type=a3, c=a4, p=v1 .forever . (u8) c=*b .if c=0 go .e .end . p=TLT, p+c . (u8) c=*p, c&type .breakz . (u8) *a++=*b++ .endfv .e: . (u8) *a=0, (u8) c=*b .if c=0 return 0 .end endf b ; copy until type and while not 0 ; get s=text.copy.until t, s, C.END function text.copy.until, a, b, type alias a=a1, b=a2,\ type=a3, c=a4, p=v1 .forever . (u8) c=*b .if c=0 return 0 .end . p=TLT, p+c . (u8) c=*p, c&type .breakn . (u8) *a++=*b++ .endfv . (u8) *a=0, (u8) c=*b .if c=0 return 0 .end endf b ;;;;;;;;;;;;;;;;;; SOURCE, TOKEN ;;;;;;;;;;;;;;;;; ; safer, easier global skip/copy while/until align 4 void source.p, token.p integer token.type, token.value, token.size macro set.source r { . r12=source.p, r11=r, (u32) *r12=r11 } macro set.token r { . r12=token.p, r11=r, (u32) *r12=r11 } macro set.stream s, t { set.source s set.token t } macro get.source s, t { . s=source.p, (u32) s=*s if ~t eq . t=token.p, (u32) t=*t end if } macro get.token.p t { . t=token.p, (u32) t=*t } macro set.token.x x, v { . r12=token#x, r11=v, (u32) *r12=r11 } macro set.token.type v { set.token.x .type, v } macro set.token.class v { set.token.x .class, v } macro set.token.value v { set.token.x .value, v } macro get.token.value x { . x=token.value, (u32) x=*x } ; skip/copy while/until type... function skip.while, type alias p=v1, type=v2 . type=a1 get.source p try p=text.skip.while p, type set.source p endf p function skip.until, type alias p=v1, type=v2 . type=a1 get.source p try p=text.skip.until p, type set.source p endf p function copy.while, type alias p=v1, t=v2, type=v3 . type=a1 get.source p, t try p=text.copy.while t, p, type set.source p endf p function copy.until, type alias p=v1, t=v2, type=v3 . type=a1 get.source p, t try p=text.copy.until t, p, type set.source p endf p macro skip.space { skip.while C.SPACE } macro skip.white { skip.while C.WHITE } macro skip.comment { skip.until C.RETURN } function skip.all alias s=v1, c=v2 .white: try skip.white get.source s . (u8) c=*s .if c=0 return 0 .end .if c=SEMI.C try skip.comment go .white .end endf 1 ; skip spaces then character. return 0 ; if next c not key function skip.c, key alias p=v1,\ c=v2, key=v3 . key=a1 skip.space get.source p . (u8) c=*p .if c<>key return 0 .end . p++ set.source p endf p ;;;;;;;;;;;;;;;;;;; GET TOKEN ;;;;;;;;;;;;;;;;;;;; macro get.name { copy.while C.NAME } macro get.digits { copy.while C.DIGIT } function get.number alias t=v1, s=v2,\ n=v3, c=v4, p=v5 try skip.space get.source s . (u8) c=*s .if c<30h ; must begin go .error ; with 0-9 .end .if c>39h go .error .end get.digits ; A-F/a-f, h,b,k,m get.token.p t get p=text.end t ; get last . p--, (u8) c=*p ; c of token . (u8) *p=0, p++ .if c>30h ; ends with .if c<39h ; 0-9? get n=t2u t .end .end .if c=68h ; h/exadecimal get n=t2h t .else.if c=62h ; b/inary get n=t2b t .else.if c=6Bh ; k/ilobyte get n=t2u t . n<<10 .else.if c=6Dh ; m/egabyte get n=t2u t . n<<20 .else go .error .end set.token.type C.NUMBER set.token.value n return C.NUMBER .error: syntax.error E.NUMBER endf 0 function verify.n.x, n, a, b alias n=a1, a=a2, b=a3 .if n>=a .if n<=b return 1 .end .end syntax.error E.VALUE endf 0 macro verify.i8 { verify.n.x n, -128, 127 } macro verify.8 { verify.n.x -255, 255 } macro verify.12 { verify.n.x -4095, 4095 } macro verify.u16 { verify.n.x 0, 0FFFFh } macro verify.16 { verify.n.x -0FFFFh, 0FFFFh } macro verify.i24 { verify.n.x -7FFFFFh, 7FFFFFh } macro verify.u24 { verify.n.x 0, 0FFFFFFh } function get.n.x, a, b alias a=v1, b=v2, n=v3 . a=a1, b=a2 try get.number get.token.value n verify.n.x n, a, b endf 1 macro get.number.i8 { get.n.x -128, 127 } macro get.number.8 { get.n.x -255, 255 } macro get.number.12 { get.n.x -4095, 4095 } macro get.number.u16 { get.n.x 0, 0FFFFh } macro get.number.16 { get.n.x -0FFFFh, 0FFFFh } macro get.number.i24 { get.n.x -7FFFFFh, 7FFFFFh } macro get.number.u24 { get.n.x 0, 0FFFFFFh } macro get.number.24 { get.n.x -0FFFFFFh, 0FFFFFFh } Preview: Minimal Native ARM Assembler: Code: ;;;;;;;;;;;;;;;;;; ASSEMBLER.INC ;;;;;;;;;;;;;;;;; ; Native ARM Assembler align 4 uinteger @ip=10000h,\ data.offset, data.size,\ code.offset, code.size,\ in.section text opcode.name(16),\ operand.1(96), operand.2(96),\ operand.3(96), operand.4(96) integer name.index, opcode.c,\ opcode.s, opcode.key text label.prefix(32) texts registers.ta[]='r0', 'r1', 'r2', 'r3',\ 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10',\ 'r11', 'r12', 'r13', 'r14', 'r15' texts registers2.ta[]='a1', 'a2', 'a3', 'a4',\ 'v1', 'v2', 'v3', 'v4', 'v5', 'v6', 'v7',\ 'v8', 'ip', 'sp', 'lr', 'pc' numeric C.*,\ EQ, NE, HS, LO, MI, PL, VS, VC,\ HI, LS, GE, LT, GT, LE, AL, NV texts conditions.ta[]=\ 'eq', 'ne', 'hs', 'lo', 'mi', 'pl', 'vs', 'vc',\ 'hi', 'ls', 'ge', 'lt', 'gt', 'le', 'al', 'nv' numeric C.*,\ EQ, NE, HS, LO, MI, PL, VS, VC,\ HI, LS, GE, LT, GT, LE, AL, NV ; $ - s/tatus and/or condition ; example: add/adds/addgt/addsgt ; ? - condition ; @ - action: da, ia, db, ib textai opcodes.ta,\ I.ADC='adc$', I.ADD='add$', I.AND='and$',\ I.ASR='asr$', I.B='b?', I.BFC='bfc?',\ I.BFI='bfi?', I.BIC='bic$', I.BKPT='bkpt?',\ I.BL='bl?', I.BLX='blx?', I.BX='bx?',\ I.CLZ='clz?', I.CMN='cmn$', I.CMP='cmp$',\ I.CPS='cps', I.EOR='eor$', I.LDC='ldc?',\ I.LDM='ldm@', I.LDR='ldr?', I.LDRB='ldrb?',\ I.LDRD='ldrd?', I.LDRH='ldrh?',\ I.LDRSB='ldrsb?', I.LDRSH='ldrsh?',\ I.LSL='lsl$', I.LSR='lsr$', I.MCR='mcr?',\ I.MCRR='mcrr?', I.MLA='mla$', I.MLS='mls?',\ I.MOV='mov$', I.MOVT='movt?', I.MOVW='movw?',\ I.MRC='mrc?', I.MRRC='mrrc?', I.MRS='mrs?',\ I.MSR='msr?', I.MUL='mul$', I.MVN='mvn$',\ I.NOP='nop', I.ORR='orr$', I.POP='pop?',\ I.PUSH='push?', I.RBIT='rbit?', I.REV='rev?',\ I.REV16='rev16?', I.REVSH='revsh?',\ I.RFE='rfe', I.ROR='ror$', I.RRX='rrx?',\ I.RSB='rsb$', I.RSC='rsc$', I.SBC='sbc$',\ I.SBFX='sbfx?', I.SDIV='sdiv', I.SEL='sel?',\ I.SETEND='setend', I.SMLAL='smlal$',\ I.SMULL='smull$', I.SRS='srs', I.STC='stc?',\ I.STM='stm@', I.STR='str?', I.STRB='strb?',\ I.STRD='strd?', I.STRH='strh?', I.SUB='sub$',\ I.SWI='swi?', I.SWP='swp?', I.SWPB='swpb?',\ I.TEQ='teq$', I.TST='tst$', I.UBFX='ubfx?',\ I.UDIV='udiv', I.UMLAL='umlal$',\ I.UMULL='umull$', I.UXTB='uxtb?',\ I.UXTB16='uxtb16?', I.UXTH='uxth?',\ I.WFE='wfe?', I.WFI='wfi?', I.YIELD='yield?' ;;;;;;;;;;;;;;;;;;;;; ERRORS ;;;;;;;;;;;;;;;;;;;;; textai errors.ta,\ E.NONE ='None',\ E.SYNTAX ='Syntax',\ E.LOAD ='Load failed',\ E.UNEXPECT ='Unexpected',\ E.OPERANDS ='Invalid operand/s',\ E.AMODE ='Invalid addressing mode',\ E.CPU ='Unsupported by CPU',\ E.COMMA =', expected after',\ E.VALUE ='Value exceeds size',\ E.REGISTER ='Register expected',\ E.NUMBER ='Number expected',\ E.NAME ='Name expected',\ E.INAME ='Invalid name',\ E.RESERVE ='Reserved name',\ E.UNDEFINE ='Undefined',\ E.REDEFINE ='Redefinition',\ E.EXPECTT ='Text expected',\ E.ENDT ='Text has no end ''',\ E.MISMATCH ='Mismatched parenthesis' Code: .if name=I.NOP . i=0E1A00000h go .ok .end .if name=I.BKPT try get.number.u16 get.token.value n . i=0E1200000h . x=n>>4, c=0FFFh, x&c, x<<8 . i|x, x=n&0Fh, i|x, i|1110000b go .ok .end .if name=I.SWI try get.number.u24 get.token.value n . i=0EF000000h, i|n go .ok .end .if name=I.MOVW . i=0E3000000h go .movwt .end .if name=I.MOVT . i=0E3400000h .movwt: try verify.cpu ARM.v6T2 get r=get.register fail? r=-1 try skip.comma try get.number.16 get.token.value n . i|(r<<12), x=n&0F000h, x<<4 . i|x, c=0FFFh, x=n&c, i|x go .ok .end
|
||||||||||
22 Mar 2014, 10:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.