diff --git a/docs/spec/README.md b/docs/spec/README.md index 7f1d831..2922b9b 100644 --- a/docs/spec/README.md +++ b/docs/spec/README.md @@ -15,6 +15,7 @@ To read the full specification as a list read the [`specs` document](spec.md) - [Instruction set](#instruction-set) - [Assembly](#assembly) - [Memory](#memory) + - [Character display memory](#character-display-memory) - [Audio](#audio) - [Input](#input) @@ -84,10 +85,10 @@ Lychee Assembly, the custom assembly dialect. This version include some syntax s Lychee uses memory-mapped memory and I/O. This means all that the ROM, Work RAM, Character display memory and I/O all live under the same memory address range. Lychee uses a 16 bit address bus, thus 65536 possible address locations. This is then split between the different parts of the machine. -1. ($0000-$8000) 32 kb: ROM -2. ($8001-$9680) 5760 bytes: Character display memory -3. ($9681-$9780) 255 bytes: Flags & I/O -4. ($9781-$9999) 536 bytes: Reserved stack ram +1. ($0000-$7FFF) 32 kb: ROM +2. ($8000-$967F) 5760 bytes: Character display memory +3. ($9680-$977F) 255 bytes: Flags & I/O +4. ($9780-$9999) 538 bytes: Reserved stack ram 5. ($A000 - $FFFF) 24 kb: Work RAM ### Character display memory diff --git a/examples/asm/loopchars.asm b/examples/asm/loopchars.asm index 9136c49..78cc224 100644 --- a/examples/asm/loopchars.asm +++ b/examples/asm/loopchars.asm @@ -10,14 +10,14 @@ jp Z &color # if all chars done then jump to color jp &increment # else loop color: # load color into vram -ld a $02 +ld a $01 ld l a ld a b inc a # increment color ld b a ld (hl) a # load initial char -ld a $01 +ld a $00 ld l a ld a $32 ld (hl) a diff --git a/examples/asm/loopcharsbasic.asm b/examples/asm/loopcharsbasic.asm index 5df5ef3..6c1c69e 100644 --- a/examples/asm/loopcharsbasic.asm +++ b/examples/asm/loopcharsbasic.asm @@ -1,10 +1,10 @@ ld a $80 ld h a -ld a $02 +ld a $01 ld l a ld a $07 ld (hl) a -ld a $01 +ld a $00 ld l a ld a $19 ld (hl) a diff --git a/examples/asm/loopcharsscreen.asm b/examples/asm/loopcharsscreen.asm index c108845..d550154 100644 --- a/examples/asm/loopcharsscreen.asm +++ b/examples/asm/loopcharsscreen.asm @@ -4,7 +4,7 @@ ld a $07 ld e a ld a $80 ld h a -ld a $01 +ld a $00 ld l a increment: ld a $32 diff --git a/examples/asm/timertest.asm b/examples/asm/timertest.asm index 992692b..7ff7168 100644 --- a/examples/asm/timertest.asm +++ b/examples/asm/timertest.asm @@ -2,12 +2,12 @@ setup: # Load color ld a $80 ld h a -ld a $02 +ld a $01 ld l a ld a $08 ld (hl) a # Load initial char -ld a $01 +ld a $00 ld l a ld a $30 ld (hl) a diff --git a/rom-dump.bin b/rom-dump.bin new file mode 100644 index 0000000..34599b6 Binary files /dev/null and b/rom-dump.bin differ diff --git a/src/lycheepkg/emulator.nim b/src/lycheepkg/emulator.nim index 1bd9b83..206299a 100644 --- a/src/lycheepkg/emulator.nim +++ b/src/lycheepkg/emulator.nim @@ -2,7 +2,7 @@ import strutils, system, std/[bitops] const mem_size: int = 24576 # 24kb const vmem_size: int = 5760 # 5.6kb -const mem_offset*: int = 0x8001 +const mem_offset*: int = 0x8000 const ram_size*: int = 64 * 1024 const workmem_start: int = 0xA000