Skip to content

Commit

Permalink
fixed incorrect vram address
Browse files Browse the repository at this point in the history
  • Loading branch information
imagineeeinc committed Aug 23, 2024
1 parent af0afb9 commit 4679b69
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions docs/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/asm/loopchars.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/asm/loopcharsbasic.asm
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/asm/loopcharsscreen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/asm/timertest.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added rom-dump.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion src/lycheepkg/emulator.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4679b69

Please sign in to comment.