Updated documentation about 45gs02.
3 files changed, 113 insertions(+), 3 deletions(-)

M jasm/docs/jasm.md
M jasm/docs/syntax_highlight.py
M jasm/website/site/docs/index.html
M jasm/docs/jasm.md +53 -1
@@ 2,7 2,7 @@ 
 
 - - -
 
-This is the documentation for the 6502, 65C02, 65CE02 and Z80 assembler jAsm. It was written in 2015 by me, Jonas Hultén, because I used DAsm before and over the years it started to feel outdated. I missed namespaces and I was annoyed by some bugs, like its inability to use local variables as macro arguments. It felt a bit slow on my slow laptop computer as well, although that wasn't a strong argument. Also, I hadn't written a language before and it felt like an interesting challenge.
+This is the documentation for the 6502, 65C02, 65CE02, 45GS02 and Z80 assembler jAsm. It was written in 2015 by me, Jonas Hultén, because I used DAsm before and over the years it started to feel outdated. I missed namespaces and I was annoyed by some bugs, like its inability to use local variables as macro arguments. It felt a bit slow on my slow laptop computer as well, although that wasn't a strong argument. Also, I hadn't written a language before and it felt like an interesting challenge.
 
 jAsm was written with two main goals. It should be fast enough to assemble a large program in under a second and it should support everything DAsm can do and more. To reach the required speed it tries to use memory as linearly as possible and it proved to be faster than DAsm in the end.
 

          
@@ 22,6 22,7 @@ This documentation covers the language a
    * [6502](#m6502)
    * [65c02](#wdc65c02)
    * [65ce02](#csg65ce02)
+   * [45gs02](#mega45gs02)
    * [Z80](#z80)
 * [Starter Guide](#starter-guide)
    * [Basic Start](#starter-guide-basic-start)

          
@@ 58,6 59,7 @@ This documentation covers the language a
       * [6502 Pseudo Instructions](#6502-pseudo-instructions)
       * [65c02 Pseudo Instructions](#65c02-pseudo-instructions)
       * [65ce02 Pseudo Instructions](#65ce02-pseudo-instructions)
+      * [45gs02 Pseudo Instructions](#45gs02-pseudo-instructions)
       * [Z80 Pseudo Instructions](#z80-pseudo-instructions)
    * [Verboseness](#verboseness)
    * [Return Codes](#return-codes)

          
@@ 174,6 176,35 @@ The stack pointer relative access addres
 	[65ce02]
 	lda ($55,sp),y
 
+<div id="mega45gs02"></div>
+## 45GS02
+
+jAsm has experimental support for the new Mega65 instructions of the 45GS02, along with the instructions of CSG4510.
+
+Instructions are written in lower case.
+
+	[45gs02]
+	ldz $d020
+	bru loop
+
+Just like 65CE02, the bit operation instructions don't have the bit in the instruction name as some assemblers do. Instead it is a separate argument. To follow convention, there is no '#' before the bit number to indicate immediate mode, even if that would be more consistent.
+
+	[45gs02]
+	bbr 0, zp, label
+	bbs 1, zp, label
+	rmb 2, zp
+	smb 3, zp
+
+The stack pointer relative access addressing mode is written like this.
+
+	[45gs02]
+	lda ($55,sp),y
+
+The indirect quad addressing mode is written using brackets.
+
+	[45gs02]
+	lda [$55],z
+
 <div id="z80"></div>
 ## Z80
 

          
@@ 1300,6 1331,27 @@ These are equivalent to the implied mode
 
 This is equivalent to the `[65ce02]|bru` instruction.
 
+<div id="45gs02-pseudo-instructions"></div>
+### 45GS02 pseudo instructions
+
+These are the pseudo instructions for 45GS02.
+
+	[45gs02]
+	bhs addr // branch if higher or same
+	blt addr // branch if lower
+
+These are equivalent to `[45gs02]|bcs` and `[45gs02]|bcc`, respectively.
+
+	[45gs02]
+	dea // decrement A register
+	ina // increment A register
+
+These are equivalent to the implied mode `[45gs02]|dec` and `[45gs02]|inc`, respectively.
+
+	[45gs02]
+	bra label // branch unconditionally
+
+This is equivalent to the `[45gs02]|bru` instruction.
 
 <div id="z80-pseudo-instructions"></div>
 ### Z80 pseudo instructions

          
M jasm/docs/syntax_highlight.py +4 -1
@@ 48,6 48,7 @@ def syntax_highlight_code(code_class, te
 	instructions_6502 = re.compile(r'\b(adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|bhs|blt)\b')
 	instructions_65c02 = re.compile(r'\b(adc|and|asl|bbr|bbs|bcc|bcs|beq|bit|bmi|bne|bpl|bra|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|phx|phy|pla|plp|plx|ply|rmb|rol|ror|rti|rts|sbc|sec|sed|sei|smb|sta|stp|stx|sty|stz|tax|tay|trb|tsb|tsx|txa|txs|tya|wai|bhs|blt|dea|ina)\b')
 	instructions_65ce02 = re.compile(r'\b(adc|and|asl|asr|asw|bbr|bbs|bcc|bcs|beq|bit|bmi|bne|bpl|bru|brk|bsr|bvc|bvs|clc|cld|cle|cli|clv|cmp|cpx|cpy|cpz|dec|dew|dex|dey|dez|eor|inc|inw|inx|iny|inz|jmp|jsr|lda|ldx|ldy|ldz|lsr|neg|nop|ora|pha|php|phw|phx|phy|phz|pla|plp|plx|ply|plz|rmb|rol|ror|row|rti|rtn|rts|sbc|sec|sed|see|sei|smb|sta|stx|sty|stz|tab|tax|tay|taz|tba|trb|tsb|tsx|tsy|txa|txs|tya|tys|tza|bhs|blt|bra|dea|ina)\b')
+	instructions_45gs02 = re.compile(r'\b(adc|adcq|and|andq|asl|aslq|asr|asrq|asw|bbr|bbs|bcc|bcs|beq|bit|bitq|bmi|bne|bpl|brk|bru|bsr|bvc|bvs|clc|cld|cle|cli|clv|cmp|cmpq|cpx|cpy|cpz|dec|deq|dew|dex|dey|dez|eom|eor|eorq|inc|inq|inw|inx|iny|inz|jmp|jsr|lda|ldq|ldx|ldy|ldz|lsr|lsrq|map|neg|ora|orq|pha|php|phw|phx|phy|phz|pla|plp|plx|ply|plz|rmb|rol|rolq|ror|rorq|row|rti|rtn|rts|sbc|sbcq|sec|sed|see|sei|smb|sta|stq|stx|sty|stz|tab|tax|tay|taz|tba|trb|tsb|tsx|tsy|txa|txs|tya|tys|tza|bhs|blt|bra|dea|ina)\b')
 	instructions_z80 = re.compile(r'\b(adc|add|and|bit|call|ccf|cp|cpd|cpdr|cpi|cpir|cpl|daa|dec|di|djnz|ei|ex|exx|halt|im|in|inc|ind|indr|ini|inir|jp|jr|ld|ldd|lddr|ldi|ldir|neg|nop|or|otdr|otir|out|outd|outi|pop|push|res|ret|reti|retn|rl|rla|rlc|rlca|rld|rr|rra|rrc|rrca|rrd|rst|sbc|scf|set|sla|sra|srl|sub|xor)\b')
 	operators = re.compile(r'(<<=|>>=|&amp;&amp;=|[|][|]=|!=|[+][+]|--|<<|>>|<=|>=|==|&amp;&amp;|[|][|]|[+]=|-=|[*]=|[/]=|&amp;=|[|]=|\^=|::|!|~|[*]|[/]|[+]|-|&lt;|&gt;|&amp;|\^|[|]|=|#|%)')
 	special = re.compile(r'({|}|\(|\)|;|\[|\])')

          
@@ 84,6 85,8 @@ def syntax_highlight_code(code_class, te
 		text = colorize(text, instructions_65c02, "instruction")
 	elif code_class == "[65ce02]":
 		text = colorize(text, instructions_65ce02, "instruction")
+	elif code_class == "[45gs02]":
+		text = colorize(text, instructions_45gs02, "instruction")
 	else:
 		text = colorize(text, instructions_z80, "instruction")
 

          
@@ 117,7 120,7 @@ def syntax_highlight_code(code_class, te
 
 
 def syntax_highlight_text(code_class, code):
-	if code_class == "[6502]" or code_class == "[65c02]" or code_class == "[65ce02]" or code_class == "[z80]":
+	if code_class == "[6502]" or code_class == "[65c02]" or code_class == "[65ce02]" or code_class == "[45gs02]" or code_class == "[z80]":
 		return syntax_highlight_code(code_class, code)
 	elif code_class == "[text]":
 		return code

          
M jasm/website/site/docs/index.html +56 -1
@@ 14,7 14,7 @@ 
 
 <hr />
 
-<p>This is the documentation for the 6502, 65C02, 65CE02 and Z80 assembler jAsm. It was written in 2015 by me, Jonas Hult&eacute;n, because I used DAsm before and over the years it started to feel outdated. I missed namespaces and I was annoyed by some bugs, like its inability to use local variables as macro arguments. It felt a bit slow on my slow laptop computer as well, although that wasn't a strong argument. Also, I hadn't written a language before and it felt like an interesting challenge.</p>
+<p>This is the documentation for the 6502, 65C02, 65CE02, 45GS02 and Z80 assembler jAsm. It was written in 2015 by me, Jonas Hult&eacute;n, because I used DAsm before and over the years it started to feel outdated. I missed namespaces and I was annoyed by some bugs, like its inability to use local variables as macro arguments. It felt a bit slow on my slow laptop computer as well, although that wasn't a strong argument. Also, I hadn't written a language before and it felt like an interesting challenge.</p>
 
 <p>jAsm was written with two main goals. It should be fast enough to assemble a large program in under a second and it should support everything DAsm can do and more. To reach the required speed it tries to use memory as linearly as possible and it proved to be faster than DAsm in the end.</p>
 

          
@@ 36,6 36,7 @@ 
 <li><a href="#m6502">6502</a></li>
 <li><a href="#wdc65c02">65c02</a></li>
 <li><a href="#csg65ce02">65ce02</a></li>
+<li><a href="#mega45gs02">45gs02</a></li>
 <li><a href="#z80">Z80</a></li>
 </ul></li>
 <li><a href="#starter-guide">Starter Guide</a>

          
@@ 79,6 80,7 @@ 
 <li><a href="#6502-pseudo-instructions">6502 Pseudo Instructions</a></li>
 <li><a href="#65c02-pseudo-instructions">65c02 Pseudo Instructions</a></li>
 <li><a href="#65ce02-pseudo-instructions">65ce02 Pseudo Instructions</a></li>
+<li><a href="#45gs02-pseudo-instructions">45gs02 Pseudo Instructions</a></li>
 <li><a href="#z80-pseudo-instructions">Z80 Pseudo Instructions</a></li>
 </ul></li>
 <li><a href="#verboseness">Verboseness</a></li>

          
@@ 210,6 212,36 @@ 
 <pre><code><span class="instruction">lda</span> <span class="special">(</span><span class="literal">$55</span>,sp<span class="special">)</span>,y
 </code></pre>
 
+<div id="mega45gs02"></div>
+
+<h2>45GS02</h2>
+
+<p>jAsm has experimental support for the new Mega65 instructions of the 45GS02, along with the instructions of CSG4510.</p>
+
+<p>Instructions are written in lower case.</p>
+
+<pre><code><span class="instruction">ldz</span> <span class="literal">$d020</span>
+<span class="instruction">bru</span> loop
+</code></pre>
+
+<p>Just like 65C02, the bit operation instructions don't have the bit in the instruction name as some assemblers do. Instead it is a separate argument. To follow convention, there is no '#' before the bit number to indicate immediate mode, even if that would be more consistent.</p>
+
+<pre><code><span class="instruction">bbr</span> <span class="literal">0</span>, zp, label
+<span class="instruction">bbs</span> <span class="literal">1</span>, zp, label
+<span class="instruction">rmb</span> <span class="literal">2</span>, zp
+<span class="instruction">smb</span> <span class="literal">3</span>, zp
+</code></pre>
+
+<p>The stack pointer relative access addressing mode is written like this.</p>
+
+<pre><code><span class="instruction">lda</span> <span class="special">(</span><span class="literal">$55</span>,sp<span class="special">)</span>,y
+</code></pre>
+
+<p>The new indirect quad addressing mode is written using brackets.</p>
+
+<pre><code><span class="instruction">lda</span> <span class="special">[</span><span class="literal">$55</span><span class="special">]</span>,z
+</code></pre>
+
 <div id="z80"></div>
 
 <h2>Z80</h2>

          
@@ 1372,6 1404,29 @@ jasm --define DEFAULT_NAME=bobo input.ja
 
 <p>This is equivalent to the <code><span class="instruction">bru</span></code> instruction.</p>
 
+<div id="45gs02-pseudo-instructions"></div>
+
+<h3>45GS02 pseudo instructions</h3>
+
+<p>These are the pseudo instructions for 45GS02.</p>
+
+<pre><code><span class="instruction">bhs</span> addr <span class="comment">// branch if higher or same</span>
+<span class="instruction">blt</span> addr <span class="comment">// branch if lower</span>
+</code></pre>
+
+<p>These are equivalent to <code><span class="instruction">bcs</span></code> and <code><span class="instruction">bcc</span></code>, respectively.</p>
+
+<pre><code><span class="instruction">dea</span> <span class="comment">// decrement A register</span>
+<span class="instruction">ina</span> <span class="comment">// increment A register</span>
+</code></pre>
+
+<p>These are equivalent to the implied mode <code><span class="instruction">dec</span></code> and <code><span class="instruction">inc</span></code>, respectively.</p>
+
+<pre><code><span class="instruction">bra</span> label <span class="comment">// branch unconditionally</span>
+</code></pre>
+
+<p>This is equivalent to the <code><span class="instruction">bru</span></code> instruction.</p>
+
 <div id="z80-pseudo-instructions"></div>
 
 <h3>Z80 pseudo instructions</h3>