diff --git a/src/asm/rgbasm.5 b/src/asm/rgbasm.5 index 5d192cd4..edc946cc 100644 --- a/src/asm/rgbasm.5 +++ b/src/asm/rgbasm.5 @@ -12,7 +12,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd April 12, 2017 +.Dd April 16, 2017 .Dt RGBASM 5 .Os RGBDS Manual .Sh NAME @@ -79,7 +79,7 @@ Valid banks range from 0 to 15. .It Sy WRAM0 A general-purpose RAM section. Mapped to memory at $C000–$CFFF, or $C000-$DFFF if DMG mode is enabled in -.Xr rgblink 1. +.Xr rgblink 1 . Can only allocate memory, not fill it. .It Sy WRAMX A banked general-purpose RAM section. @@ -87,7 +87,7 @@ Mapped to memory at $D000–$DFFF. Can only allocate memory, not fill it. Valid banks range from 1 to 7. Not available if DMG mode is enabled in -.Xr rgblink 1. +.Xr rgblink 1 . .It Sy OAM An object attributes RAM section. Mapped to memory at $FE00-$FE9F. @@ -444,7 +444,8 @@ to if you perform further calculations on them. For instance, if you pass 1 + 2 as the first argument and then do .Ic PRINTV -.Ic \[rs]1 Li * 2 +.Ic \[rs]1 +* 2 you will get the value 5 on screen and not 6 as you might have expected. .Pp In reality, up to 256 arguments can be passed to a macro, but you can only use @@ -550,7 +551,8 @@ Consequently, .Ic DB and .Ic DW -can be used in a Sy WRAM0/WRAMX/HRAM/VRAM/SRAM +can be used in a +.Sy WRAM0 No / Sy WRAMX No / Sy HRAM No / Sy VRAM No / Sy SRAM section. .Ss Declaring variables in a RAM section .Ic DS diff --git a/src/fix/rgbfix.1 b/src/fix/rgbfix.1 index 2681cf86..821ad05a 100644 --- a/src/fix/rgbfix.1 +++ b/src/fix/rgbfix.1 @@ -12,7 +12,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd April 8, 2017 +.Dd April 16, 2017 .Dt RGBFIX 1 .Os RGBDS Manual .Sh NAME @@ -102,7 +102,10 @@ Set the title string to a given string, truncated to at most 16 characters. It is recommended to use 15 characters instead, to avoid clashing with the CGB flag -.Pq Fl c No or Fl C . +.Po Fl c +or +.Fl C +.Pc . If both this and the game ID are set, the game ID will overwrite the overlapping portion of the title. .It Fl v diff --git a/src/gbz80.7 b/src/gbz80.7 index 961fd865..ec1e8afe 100644 --- a/src/gbz80.7 +++ b/src/gbz80.7 @@ -12,7 +12,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd April 12, 2017 +.Dd April 16, 2017 .Dt GBZ80 7 .Os RGBDS Manual .Sh NAME @@ -26,7 +26,8 @@ number of CPU cycles at 1MHz (or 2MHz in GBC dual speed mode) needed to complete them. .Pp Note: All arithmetic/logic operations that use register -.Sy A No as destination can omit the destination as it is assumed it's register +.Sy A +as destination can omit the destination as it is assumed it's register .Sy A . The following two lines have the same effect: .Pp @@ -48,23 +49,36 @@ Any of the general-purpose 16-bit registers 16-bit integer constant. .It Ar e8 8-bit offset -.Pq Fl Sy 128 No to Sy 127 . +.Po Fl Sy 128 +to +.Sy 127 +.Pc . .It Ar u3 3-bit unsigned integer constant -.Pq Sy 0 No to Sy 7 . +.Po Sy 0 +to +.Sy 7 +.Pc . .It Ar cc Condition codes: .Bl -tag -compact -.It Sy Z : No Execute if Z is set. -.It Sy NZ : No Execute if Z is not set. -.It Sy C : No Execute if C is set. -.It Sy NC : No Execute if C is not set. +.It Sy Z : +Execute if Z is set. +.It Sy NZ : +Execute if Z is not set. +.It Sy C : +Execute if C is set. +.It Sy NC : +Execute if C is not set. .El .It Ar vec One of the .Ar RST vectors -.Pq Sy 0x00 , 0x08 , 0x10 , 0x18 , 0x20 , 0x28 , 0x30 No and Sy 0x38 . +.Po Sy 0x00 , 0x08 , 0x10 , 0x18 , 0x20 , 0x28 , 0x30 +and +.Sy 0x38 +.Pc . .El .Pp .Sh INSTRUCTION OVERVIEW @@ -213,13 +227,17 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No Set if overflow from bit 3. +.Sy H : +Set if overflow from bit 3. .It -.Sy C : No Set if overflow from bit 7. +.Sy C : +Set if overflow from bit 7. .El .Ss ADC A,[HL] Add the value pointed by @@ -258,17 +276,23 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No Set if overflow from bit 3. +.Sy H : +Set if overflow from bit 3. .It -.Sy C : No Set if overflow from bit 7. +.Sy C : +Set if overflow from bit 7. .El .Ss ADD A,[HL] Add the value pointed by -.Sy HL No to Sy A . +.Sy HL +to +.Sy A . .Pp Cycles: 2 .Pp @@ -301,15 +325,20 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No Set if overflow from bit 11. +.Sy H : +Set if overflow from bit 11. .It -.Sy C : No Set if overflow from bit 15. +.Sy C : +Set if overflow from bit 15. .El .Ss ADD HL,SP Add the value in -.Sy SP No to Sy HL . +.Sy SP +to +.Sy HL . .Pp Cycles: 2 .Pp @@ -330,13 +359,17 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No 0 +.Sy Z : +0 .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No Set if overflow from bit 3. +.Sy H : +Set if overflow from bit 3. .It -.Sy C : No Set if overflow from bit 7. +.Sy C : +Set if overflow from bit 7. .El .Ss AND A,r8 Bitwise AND between the value in @@ -351,17 +384,23 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 1 +.Sy H : +1 .It -.Sy C : No 0 +.Sy C : +0 .El .Ss AND A,[HL] Bitwise AND between the value pointed by -.Sy HL No and Sy A . +.Sy HL +and +.Sy A . .Pp Cycles: 2 .Pp @@ -383,7 +422,10 @@ Flags: See .Sx AND A,r8 .Ss BIT u3,r8 Test bit -.Ar u3 No in register Ar r8 , No set the zero flag if bit not set. +.Ar u3 +in register +.Ar r8 , +set the zero flag if bit not set. .Pp Cycles: 2 .Pp @@ -392,15 +434,21 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if the selected bit is 0. +.Sy Z : +Set if the selected bit is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 1 +.Sy H : +1 .El .Ss BIT u3,[HL] Test bit -.Ar u3 No in the byte pointed by Sy HL , No set the zero flag if bit not set. +.Ar u3 +in the byte pointed by +.Sy HL , +set the zero flag if bit not set. .Pp Cycles: 3 .Pp @@ -419,7 +467,10 @@ Bytes: 3 Flags: None affected. .Ss CALL cc,n16 Call address -.Ar n16 No if condition Ar cc No is met. +.Ar n16 +if condition +.Ar cc +is met. .Pp Cycles: 6/3 .Pp @@ -436,17 +487,21 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Complemented. +.Sy C : +Complemented. .El .Ss CP A,r8 Subtract the value in .Ar r8 from -.Sy A No and set flags accordingly, but don't store the result. +.Sy A +and set flags accordingly, but don't store the result. .Pp Cycles: 1 .Pp @@ -455,14 +510,21 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 1 +.Sy N : +1 .It -.Sy H : No Set if no borrow from bit 4. +.Sy H : +Set if no borrow from bit 4. .It -.Sy C : No Set if no borrow -.Pq set if Ar r8 No > Sy A . +.Sy C : +Set if no borrow +.Po set if Ar r8 +> +.Sy A +.Pc . .El .Ss CP A,[HL] Subtract the value pointed by @@ -492,7 +554,10 @@ Flags: See .Sx CP A,r8 .Ss CPL Complement accumulator -.Pq Sy A No = Sy ~A . +.Po Sy A += +.Sy ~A +.Pc . .Pp Cycles: 1 .Pp @@ -501,9 +566,11 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy N : No 1 +.Sy N : +1 .It -.Sy H : No 1 +.Sy H : +1 .El .Ss DAA Decimal adjust register A to get a correct BCD representation after an @@ -516,15 +583,19 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set or reset depending on the operation. +.Sy C : +Set or reset depending on the operation. .El .Ss DEC r8 Decrement value in register -.Ar r8 No by 1. +.Ar r8 +by 1. .Pp Cycles: 1 .Pp @@ -533,15 +604,19 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 1 +.Sy N : +1 .It -.Sy H : No Set if no borrow from bit 4. +.Sy H : +Set if no borrow from bit 4. .El .Ss DEC [HL] Decrement the value pointed by -.Sy HL No by 1. +.Sy HL +by 1. .Pp Cycles: 3 .Pp @@ -551,7 +626,8 @@ Flags: See .Sx DEC r8 .Ss DEC r16 Decrement value in register -.Ar r16 No by 1. +.Ar r16 +by 1. .Pp Cycles: 2 .Pp @@ -560,7 +636,8 @@ Bytes: 1 Flags: None affected. .Ss DEC SP Decrement value in register -.Sy SP No by 1. +.Sy SP +by 1. .Pp Cycles: 2 .Pp @@ -593,7 +670,8 @@ Bytes: 1 Flags: None affected. .Ss INC r8 Increment value in register -.Ar r8 No by 1. +.Ar r8 +by 1. .Pp Cycles: 1 .Pp @@ -602,15 +680,19 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No Set if overflow from bit 3. +.Sy H : +Set if overflow from bit 3. .El .Ss INC [HL] Increment the value pointed by -.Sy HL No by 1. +.Sy HL +by 1. .Pp Cycles: 3 .Pp @@ -620,7 +702,8 @@ Flags: See .Sx INC r8 .Ss INC r16 Increment value in register -.Ar r16 No by 1. +.Ar r16 +by 1. .Pp Cycles: 2 .Pp @@ -629,7 +712,8 @@ Bytes: 1 Flags: None affected. .Ss INC SP Increment value in register -.Sy SP No by 1. +.Sy SP +by 1. .Pp Cycles: 2 .Pp @@ -647,7 +731,10 @@ Bytes: 3 Flags: None affected. .Ss JP cc,n16 Absolute jump to address -.Ar n16 No if condition Ar cc No is met. +.Ar n16 +if condition +.Ar cc +is met. .Pp Cycles: 4/3 .Pp @@ -656,7 +743,11 @@ Bytes: 3 Flags: None affected. .Ss JP HL Jump to address in -.Sy HL , No that is, load Sy PC No with value in register Sy HL . +.Sy HL , +that is, load +.Sy PC +with value in register +.Sy HL . .Pp Cycles: 1 .Pp @@ -665,7 +756,8 @@ Bytes: 1 Flags: None affected. .Ss JR e8 Relative jump by adding -.Ar e8 No to the current address. +.Ar e8 +to the current address. .Pp Cycles: 3 .Pp @@ -674,7 +766,10 @@ Bytes: 2 Flags: None affected. .Ss JR cc,e8 Relative jump by adding -.Ar e8 No to the current address if condition Ar cc No is met. +.Ar e8 +to the current address if condition +.Ar cc +is met. .Pp Cycles: 3/2 .Pp @@ -691,7 +786,9 @@ Bytes: 1 Flags: None affected. .Ss LD r8,n8 Load value -.Ar n8 No into register Ar r8 . +.Ar n8 +into register +.Ar r8 . .Pp Cycles: 2 .Pp @@ -700,7 +797,9 @@ Bytes: 2 Flags: None affected. .Ss LD r16,n16 Load value -.Ar n16 No into register Ar r16 . +.Ar n16 +into register +.Ar r16 . .Pp Cycles: 3 .Pp @@ -709,7 +808,9 @@ Bytes: 3 Flags: None affected. .Ss LD [HL],r8 Store value in register -.Ar r8 No into byte pointed by register Sy HL . +.Ar r8 +into byte pointed by register +.Sy HL . .Pp Cycles: 2 .Pp @@ -718,7 +819,9 @@ Bytes: 1 Flags: None affected. .Ss LD [HL],n8 Store value -.Ar n8 No into byte pointed by register Sy HL . +.Ar n8 +into byte pointed by register +.Sy HL . .Pp Cycles: 3 .Pp @@ -727,7 +830,9 @@ Bytes: 2 Flags: None affected. .Ss LD r8,[HL] Load value into register -.Ar r8 No from byte pointed by register Sy HL . +.Ar r8 +from byte pointed by register +.Sy HL . .Pp Cycles: 2 .Pp @@ -736,7 +841,9 @@ Bytes: 1 Flags: None affected. .Ss LD [r16],A Store value in register -.Sy A No into address pointed by register Ar r16 . +.Sy A +into address pointed by register +.Ar r16 . .Pp Cycles: 2 .Pp @@ -745,7 +852,9 @@ Bytes: 1 Flags: None affected. .Ss LD [n16],A Store value in register -.Sy A No into address Ar n16 . +.Sy A +into address +.Ar n16 . .Pp Cycles: 4 .Pp @@ -754,7 +863,8 @@ Bytes: 3 Flags: None affected. .Ss LD [$FF00+n8],A Store value in register -.Sy A No into high RAM or I/O registers. +.Sy A +into high RAM or I/O registers. .Pp The following synonym forces this encoding: .Sy LDH [$FF00+n8],A @@ -766,7 +876,8 @@ Bytes: 2 Flags: None affected. .Ss LD [$FF00+C],A Store value in register -.Sy A No into high RAM or I/O registers. +.Sy A +into high RAM or I/O registers. .Pp Cycles: 2 .Pp @@ -775,7 +886,9 @@ Bytes: 1 Flags: None affected. .Ss LD A,[r16] Load value in register -.Sy A No from address pointed by register Ar r16 . +.Sy A +from address pointed by register +.Ar r16 . .Pp Cycles: 2 .Pp @@ -784,7 +897,9 @@ Bytes: 1 Flags: None affected. .Ss LD A,[n16] Load value in register -.Sy A No from address Ar n16 . +.Sy A +from address +.Ar n16 . .Pp Cycles: 4 .Pp @@ -793,7 +908,8 @@ Bytes: 3 Flags: None affected. .Ss LD A,[$FF00+n8] Load value in register -.Sy A No from high RAM or I/O registers. +.Sy A +from high RAM or I/O registers. .Pp The following synonym forces this encoding: .Sy LDH A,[$FF00+n8] @@ -805,7 +921,8 @@ Bytes: 2 Flags: None affected. .Ss LD A,[$FF00+C] Load value in register -.Sy A No from high RAM or I/O registers. +.Sy A +from high RAM or I/O registers. .Pp Cycles: 2 .Pp @@ -814,7 +931,11 @@ Bytes: 1 Flags: None affected. .Ss LD [HL+],A Store value in register -.Sy A No into byte pointed by Sy HL No and post-increment Sy HL . +.Sy A +into byte pointed by +.Sy HL +and post-increment +.Sy HL . .Pp Cycles: 2 .Pp @@ -823,7 +944,11 @@ Bytes: 1 Flags: None affected. .Ss LD [HL-],A Store value in register -.Sy A No into byte pointed by Sy HL No and post-decrement Sy HL . +.Sy A +into byte pointed by +.Sy HL +and post-decrement +.Sy HL . .Pp Cycles: 2 .Pp @@ -832,7 +957,11 @@ Bytes: 1 Flags: None affected. .Ss LD A,[HL+] Load value into register -.Sy A No from byte pointed by Sy HL No and post-increment Sy HL . +.Sy A +from byte pointed by +.Sy HL +and post-increment +.Sy HL . .Pp Cycles: 2 .Pp @@ -841,7 +970,11 @@ Bytes: 1 Flags: None affected. .Ss LD A,[HL-] Load value into register -.Sy A No from byte pointed by Sy HL No and post-decrement Sy HL . +.Sy A +from byte pointed by +.Sy HL +and post-decrement +.Sy HL . .Pp Cycles: 2 .Pp @@ -850,7 +983,9 @@ Bytes: 1 Flags: None affected. .Ss LD SP,n16 Load value -.Ar n16 No into register Sy SP . +.Ar n16 +into register +.Sy SP . .Pp Cycles: 3 .Pp @@ -859,7 +994,12 @@ Bytes: 3 Flags: None affected. .Ss LD [n16],SP Store -.Sy SP No into addresses Ar n16 No (LSB) and Ar n16 No + 1 (MSB). +.Sy SP +into addresses +.Ar n16 +(LSB) and +.Ar n16 ++ 1 (MSB). .Pp Cycles: 5 .Pp @@ -870,7 +1010,9 @@ Flags: None affected. Add the signed value .Ar e8 to -.Sy SP No and store the result in Sy HL. +.Sy SP +and store the result in +.Sy HL. .Pp Cycles: 3 .Pp @@ -879,17 +1021,23 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No 0 +.Sy Z : +0 .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No Set if overflow from bit 3. +.Sy H : +Set if overflow from bit 3. .It -.Sy C : No Set if overflow from bit 7. +.Sy C : +Set if overflow from bit 7. .El .Ss LD SP,HL Load register -.Sy HL No into register Sy SP . +.Sy HL +into register +.Sy SP . .Pp Cycles: 2 .Pp @@ -917,17 +1065,23 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No 0 +.Sy C : +0 .El .Ss OR A,[HL] Bitwise OR between the value pointed by -.Sy HL No and Sy A . +.Sy HL +and +.Sy A . .Pp Cycles: 2 .Pp @@ -949,7 +1103,8 @@ Flags: See .Sx OR A,r8 .Ss POP AF Pop register -.Sy AF No from the stack. +.Sy AF +from the stack. .Pp Cycles: 3 .Pp @@ -958,7 +1113,8 @@ Bytes: 1 Flags: None affected. .Ss POP r16 Pop register -.Ar r16 No from the stack. +.Ar r16 +from the stack. .Pp Cycles: 3 .Pp @@ -967,7 +1123,8 @@ Bytes: 1 Flags: None affected. .Ss PUSH AF Push register -.Sy AF No into the stack. +.Sy AF +into the stack. .Pp Cycles: 4 .Pp @@ -976,7 +1133,8 @@ Bytes: 1 Flags: None affected. .Ss PUSH r16 Push register -.Ar r16 No into the stack. +.Ar r16 +into the stack. .Pp Cycles: 4 .Pp @@ -985,7 +1143,10 @@ Bytes: 1 Flags: None affected. .Ss RES u3,r8 Set bit -.Ar u3 No in register Ar r8 No to 0. +.Ar u3 +in register +.Ar r8 +to 0. .Pp Cycles: 2 .Pp @@ -994,7 +1155,10 @@ Bytes: 2 Flags: None affected. .Ss RES u3,[HL] Set bit -.Ar u3 No in the byte pointed by Sy HL No to 0. +.Ar u3 +in the byte pointed by +.Sy HL +to 0. .Pp Cycles: 4 .Pp @@ -1011,7 +1175,8 @@ Bytes: 1 Flags: None affected. .Ss RET cc Return from subroutine if condition -.Ar cc No is met. +.Ar cc +is met. .Pp Cycles: 5/2 .Pp @@ -1028,7 +1193,8 @@ Bytes: 1 Flags: None affected. .Ss RL r8 Rotate register -.Ar r8 No left through carry. +.Ar r8 +left through carry. .Pp .D1 C <- [7 <- 0] <- C .Pp @@ -1039,17 +1205,22 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RL [HL] Rotate value pointed by -.Sy HL No left through carry. +.Sy HL +left through carry. .Pp .D1 C <- [7 <- 0] <- C .Pp @@ -1061,7 +1232,8 @@ Flags: See .Sx RL r8 .Ss RLA Rotate register -.Sy A No left through carry. +.Sy A +left through carry. .Pp .D1 C <- [7 <- 0] <- C .Pp @@ -1072,17 +1244,22 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No 0 +.Sy Z : +0 .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RLC r8 Rotate register -.Ar r8 No left. +.Ar r8 +left. .Pp .D1 C <- [7 <- 0] <- [7] .Pp @@ -1093,17 +1270,22 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RLC [HL] Rotate value pointed by -.Sy HL No left. +.Sy HL +left. .Pp .D1 C <- [7 <- 0] <- [7] .Pp @@ -1115,7 +1297,8 @@ Flags: See .Sx RLC r8 .Ss RLCA Rotate register -.Sy A No left. +.Sy A +left. .Pp .D1 C <- [7 <- 0] <- [7] .Pp @@ -1126,17 +1309,22 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No 0 +.Sy Z : +0 .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RR r8 Rotate register -.Ar r8 No right through carry. +.Ar r8 +right through carry. .Pp .D1 C -> [7 -> 0] -> C .Pp @@ -1147,17 +1335,22 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RR [HL] Rotate value pointed by -.Sy HL No right through carry. +.Sy HL +right through carry. .Pp .D1 C -> [7 -> 0] -> C .Pp @@ -1169,7 +1362,8 @@ Flags: See .Sx RR r8 .Ss RRA Rotate register -.Sy A No right through carry. +.Sy A +right through carry. .Pp .D1 C -> [7 -> 0] -> C .Pp @@ -1180,17 +1374,22 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No 0 +.Sy Z : +0 .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RRC r8 Rotate register -.Ar r8 No right. +.Ar r8 +right. .Pp .D1 [0] -> [7 -> 0] -> C .Pp @@ -1201,17 +1400,22 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RRC [HL] Rotate value pointed by -.Sy HL No right. +.Sy HL +right. .Pp .D1 [0] -> [7 -> 0] -> C .Pp @@ -1223,7 +1427,8 @@ Flags: See .Sx RRC r8 .Ss RRCA Rotate register -.Sy A No right. +.Sy A +right. .Pp .D1 [0] -> [7 -> 0] -> C .Pp @@ -1234,13 +1439,17 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No 0 +.Sy Z : +0 .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss RST vec Call restart vector @@ -1264,14 +1473,21 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 1 +.Sy N : +1 .It -.Sy H : No Set if no borrow from bit 4. +.Sy H : +Set if no borrow from bit 4. .It -.Sy C : No Set if no borrow -.Pq set if Ar r8 No > Sy A . +.Sy C : +Set if no borrow +.Po set if Ar r8 +> +.Sy A +.Pc . .El .Ss SBC A,[HL] Subtract the value pointed by @@ -1307,15 +1523,21 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No 1 +.Sy C : +1 .El .Ss SET u3,r8 Set bit -.Ar u3 No in register Ar r8 No to 1. +.Ar u3 +in register +.Ar r8 +to 1. .Pp Cycles: 2 .Pp @@ -1324,7 +1546,10 @@ Bytes: 2 Flags: None affected. .Ss SET u3,[HL] Set bit -.Ar u3 No in the byte pointed by Sy HL No to 1. +.Ar u3 +in the byte pointed by +.Sy HL +to 1. .Pp Cycles: 4 .Pp @@ -1344,13 +1569,17 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss SLA [HL] Shift left arithmetic value pointed by @@ -1377,13 +1606,17 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss SRA [HL] Shift right arithmetic value pointed by @@ -1410,13 +1643,17 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No Set according to result. +.Sy C : +Set according to result. .El .Ss SRL [HL] Shift right logic value pointed by @@ -1452,18 +1689,27 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 1 +.Sy N : +1 .It -.Sy H : No Set if no borrow from bit 4. +.Sy H : +Set if no borrow from bit 4. .It -.Sy C : No Set if no borrow -.Pq set if Ar r8 No > Sy A . +.Sy C : +Set if no borrow +.Po set if Ar r8 +> +.Sy A +.Pc . .El .Ss SUB A,[HL] Subtract the value pointed by -.Sy HL No from Sy A . +.Sy HL +from +.Sy A . .Pp Cycles: 2 .Pp @@ -1485,7 +1731,8 @@ Flags: See .Sx SUB A,r8 .Ss SWAP r8 Swap upper 4 bits in register -.Ar r8 No and the lower ones. +.Ar r8 +and the lower ones. .Pp Cycles: 2 .Pp @@ -1494,17 +1741,22 @@ Bytes: 2 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No 0 +.Sy C : +0 .El .Ss SWAP [HL] Swap upper 4 bits in the byte pointed by -.Sy HL No and the lower ones. +.Sy HL +and the lower ones. .Pp Cycles: 4 .Pp @@ -1525,17 +1777,23 @@ Bytes: 1 Flags: .Bl -bullet -compact .It -.Sy Z : No Set if result is 0. +.Sy Z : +Set if result is 0. .It -.Sy N : No 0 +.Sy N : +0 .It -.Sy H : No 0 +.Sy H : +0 .It -.Sy C : No 0 +.Sy C : +0 .El .Ss XOR A,[HL] Bitwise XOR between the value pointed by -.Sy HL No and Sy A . +.Sy HL +and +.Sy A . .Pp Cycles: 2 .Pp diff --git a/src/link/rgblink.5 b/src/link/rgblink.5 index c8e54178..3954a58e 100644 --- a/src/link/rgblink.5 +++ b/src/link/rgblink.5 @@ -12,7 +12,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd April 12, 2017 +.Dd April 16, 2017 .Dt RGBLINK 5 .Os RGBDS Manual .Sh NAME @@ -33,27 +33,33 @@ Any line can contain a comment starting with .Ql \&; that ends at the end of the line: .Pp - ROMX $F ; This is a comment - "Functions to read array" - ALIGN 8 - "Array aligned to 256 bytes" +.Bd -literal -offset indent +ROMX $F ; This is a comment + "Functions to read array" + ALIGN 8 + "Array aligned to 256 bytes" - WRAMX 2 - "Some variables" +WRAMX 2 + "Some variables" +.Ed .Pp Numbers can be in decimal or hexadecimal format (the prefix is .Ql $ ) . It is an error if any bank or command is found before setting a bank. .Pp Files can be included by using the -.Ar INCLUDE No keyword followed by a string with the path of the file that has -to be included. +.Ar INCLUDE +keyword followed by a string with the path of the file that has to be included. .Pp The possible bank types are: -.Sy ROM0 , ROMX , VRAM , WRAM0 , WRAMX , OAM No and Sy HRAM . +.Sy ROM0 , ROMX , VRAM , WRAM0 , WRAMX , OAM +and +.Sy HRAM . Types -.Sy ROMX , VRAM , WRAMX No and Sy SRAM No are banked, which means that it is -needed to specify a bank after the type. +.Sy ROMX , VRAM , WRAMX +and +.Sy SRAM +are banked, which means that it is needed to specify a bank after the type. .Pp When a new bank statement is found, sections found after it will be placed right from the beginning of that bank. @@ -61,15 +67,20 @@ If the linkerscript switches to a different bank and then it comes back to the previous one it will continue from the last address that was used. .Pp The only two commands are -.Ar ORG No and Ar ALIGN : +.Ar ORG +and +.Ar ALIGN : .Bl -bullet .It -.Ar ORG No sets the address in which new sections will be placed. +.Ar ORG +sets the address in which new sections will be placed. It can not be lower than the current address. .It -.Ar ALIGN No will increase the address until it is aligned to the specified -boundary (it tries to set to 0 the number of bits specified after the command: -.Ar ALIGN No 8 No will align to No $100 ) . +.Ar ALIGN +will increase the address until it is aligned to the specified boundary (it +tries to set to 0 the number of bits specified after the command: +.Sy ALIGN 8 +will align to $100). .El .Pp Note: The bank, alignment, address and type of sections can be specified both