Skip to content

Commit

Permalink
Add common extensions to Motorola 68k Assembly (#4637)
Browse files Browse the repository at this point in the history
* Add common extensions to Motorola 68k

* Revert ACE mode for m68k assembly

* Add heuristics for Motorola 68K Assembly

* Add SWIG language and `.i` Assembly extension

Co-authored-by: John Gardner <[email protected]>
  • Loading branch information
2 people authored and lildude committed Jan 14, 2020
1 parent 1ab7667 commit 9cc1b39
Show file tree
Hide file tree
Showing 15 changed files with 5,274 additions and 4 deletions.
24 changes: 24 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ disambiguations:
pattern: '^[=-]+(\s|\n)|{{[A-Za-z]'
- language: AGS Script
pattern: '^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])'
- extensions: ['.asm']
rules:
- language: Motorola 68K Assembly
named_pattern: m68k
- extensions: ['.asy']
rules:
- language: LTspice Symbol
Expand Down Expand Up @@ -191,13 +195,21 @@ disambiguations:
rules:
- language: Hack
pattern: '<\?hh'
- extensions: ['.i']
rules:
- language: Motorola 68K Assembly
named_pattern: m68k
- language: SWIG
pattern: '^[ \t]*%[a-z_]+\b|^%[{}]$'
- extensions: ['.ice']
rules:
- language: JSON
pattern: '\A\s*[{\[]'
- language: Slice
- extensions: ['.inc']
rules:
- language: Motorola 68K Assembly
named_pattern: m68k
- language: PHP
pattern: '^<\?(?:php)?'
- language: SourcePawn
Expand Down Expand Up @@ -403,6 +415,10 @@ disambiguations:
pattern: '^(use |fn |mod |pub |macro_rules|impl|#!?\[)'
- language: RenderScript
pattern: '#include|#pragma\s+(rs|version)|__attribute__'
- extensions: ['.s']
rules:
- language: Motorola 68K Assembly
named_pattern: m68k
- extensions: ['.sc']
rules:
- language: SuperCollider
Expand Down Expand Up @@ -508,6 +524,14 @@ named_patterns:
- 'std::\w+'
fortran: '^(?i:[c*][^abd-z]| (subroutine|program|end|data)\s|\s*!)'
key_equals_value: '^[^#!;][^=]*='
m68k:
- '(?im)\bmoveq(?:\.l)?\s+#(?:\$-?[0-9a-f]{1,3}|%[0-1]{1,8}|-?[0-9]{1,3}),\s*d[0-7]\b'
- '(?im)^\s*move(?:\.[bwl])?\s+(?:sr|usp),\s*[^\s]+'
- '(?im)^\s*move\.[bwl]\s+.*\b[ad]\d'
- '(?im)^\s*movem\.[bwl]\b'
- '(?im)^\s*move[mp](?:\.[wl])?\b'
- '(?im)^\s*btst\b'
- '(?im)^\s*dbra\b'
objectivec: '^\s*(@(interface|class|protocol|property|end|synchronised|selector|implementation)\b|#import\s+.+\.h[">])'
perl5: '\buse\s+(?:strict\b|v?5\.)'
perl6: '^\s*(?:use\s+v6\b|\bmodule\b|\b(?:my\s+)?class\b)'
16 changes: 15 additions & 1 deletion lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ Assembly:
extensions:
- ".asm"
- ".a51"
- ".i"
- ".inc"
- ".nasm"
tm_scope: source.assembly
Expand Down Expand Up @@ -3258,7 +3259,11 @@ Motorola 68K Assembly:
aliases:
- m68k
extensions:
- ".X68"
- ".asm"
- ".i"
- ".inc"
- ".s"
- ".x68"
tm_scope: source.m68k
ace_mode: assembly_x86
language_id: 477582706
Expand Down Expand Up @@ -4799,6 +4804,15 @@ SVG:
codemirror_mode: xml
codemirror_mime_type: text/xml
language_id: 337
SWIG:
type: programming
extensions:
- ".i"
tm_scope: source.c++
ace_mode: c_cpp
codemirror_mode: clike
codemirror_mime_type: text/x-c++src
language_id: 1066250075
Sage:
type: programming
group: Python
Expand Down
82 changes: 82 additions & 0 deletions samples/Assembly/3D_PRG.I
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
; this file is part of Release, written by Malban in 2017
;
***********************************************************
; input list in X
; destroys u
; 0 move
; negative use as shift
; positive end
asm_draw_3ds:
ldu 2,x
lda 1,x;
starts:
sta $d004;
ldd ,u;
sta $d001;
clr $d000;
lda ,x;
inc $d000;
stb $d001;
sta $d00A;
clr $d005;
leax 4,x;
ldu 2,x;
lda ,x;
bgt end1s;
lda 1,x;
ldb #$40;
waits: bitb $d00D;
beq waits;
ldb #0
stb $d00A;
bra starts;
end1s: ldd #$0040;
ends: bitb $d00D;
beq ends;
sta $d00A
rts

asm_draw_3d:
ldu 1,x
start: ldd ,u;
sta $d001;
clr $d000;
lda ,x;
inc $d000;
stb $d001;
sta $d00A;
clr $d005;
leax 3,x;
ldu 1,x;
lda ,x;
bgt end1;
ldd #$0040;
wait: bitb $d00D;
beq wait;
sta $d00A;
bra start;
end1: ldd #$0040;
end: bitb $d00D;
beq end;
sta $d00A
rts



; Cosinus data
cosinus3d:
DB 63, 62, 61, 60, 58, 55, 52, 48, 43, 39, 34 ; 11
DB 28, 23, 17, 10, 4, -1, -7, -14, -20, -25, -31 ; 22
DB -36, -41, -46, -50, -53, -56, -59, -61, -62, -62, -62 ; 33
DB -62, -61, -59, -56, -53, -50, -46, -41, -36, -31, -25 ; 44
DB -20, -14, -7, -1, 4, 10, 17, 23, 28, 34, 39 ; 55
DB 43, 48, 52, 55, 58, 60, 61, 62, 63
; Sinus data
sinus3d:
DB 0, 6, 12, 18, 24, 30, 35, 40, 45, 49, 52 ; 11
DB 56, 58, 60, 62, 62, 62, 62, 61, 59, 57, 54 ; 22
DB 51, 47, 42, 38, 32, 27, 21, 15, 9, 3, -3 ; 33
DB -9, -15, -21, -27, -32, -38, -42, -47, -51, -54, -57 ; 44
DB -59, -61, -62, -62, -62, -62, -60, -58, -56, -52, -49 ; 55
DB -45, -40, -35, -30, -24, -18, -12, -6, -3
Loading

0 comments on commit 9cc1b39

Please sign in to comment.