Skip to content

Commit

Permalink
msx2: various platform side and vdp fixes
Browse files Browse the repository at this point in the history
With these and the small core fixes to follow we blow up for reasons I don't
yet understand in the uput() call in create_init. Presumably some kind of
mapping setup bug. With that commented we hit the boot device request, at
which point we have no keyboard.

Display is still wonky. Guess it wants an MSXpert to figure out whats wrong
with the 80x25 setup
  • Loading branch information
EtchedPixels committed Nov 6, 2014
1 parent 862578f commit f42e996
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 22 deletions.
7 changes: 7 additions & 0 deletions Kernel/platform-msx2/crt0.s
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
;
; Execution begins with us correctly mapped and at 0x0x100
;
; We assume here that the kernel packs below 48K for now we've got a few
; KBytes free but revisit as needed
;
start: di
ld a, #4 ; 0 holds 8K of stuff we might want
out (0xff), a ; if we go the OS route, so use 4
; plus "0" is magic so this saves
; shifting them all by one.
; Debug port
ld a, #0x23
out (0x2e), a
Expand Down
2 changes: 1 addition & 1 deletion Kernel/platform-msx2/devtty.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void keydecode(void)

#endif

void platform_interrupt(void)
void tty_interrupt(void)
{
#if 0
uint8_t a = irqmap;
Expand Down
10 changes: 8 additions & 2 deletions Kernel/platform-msx2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ void pagemap_init(void)
int i = msxmaps - 1;
/* Add all the RAM, except 0,1,2,3 which is the kernel data/bss, add 0
last to become the common for init */
while (i > 3)
while (i > 4)
pagemap_add(i--);
/* Init will pick this up correctly as its common */
pagemap_add(0);
pagemap_add(4);
}

void map_init(void)
{
}


void platform_interrupt(void)
{
timer_interrupt();
}
30 changes: 11 additions & 19 deletions Kernel/platform-msx2/msx2.s
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,8 @@ _program_vectors:
;
map_process_always:
push hl
push af
ld hl, #U_DATA__U_PAGE
call map_process_2
pop af
pop hl
ret
;
Expand All @@ -251,23 +249,18 @@ map_process:
or l
jr nz, map_process_2
;
; Map in the kernel below the current common, all registers preserved
; This maps 0-3 but I guess we should save the map from the boot
; somehow and use that?
; Map in the kernel below the current common, go via the helper
; so our cached copy is correct.
;
map_kernel:
push af
ld a, #3
out (0xFC), a
dec a
out (0xFD), a
dec a
out (0xFE), a
; and 0xFF is managed by task switches
pop af
ret
push hl
ld hl, #map_kernel_data
call map_process_2
pop hl
ret
map_process_2:
push de
push af
ld de, #map_table ; Write only so cache in RAM
ld a, (hl)
ld (de), a
Expand All @@ -282,20 +275,17 @@ map_process_2:
ld a, (hl) ; Next 16K. Leave the common for the task
out (0xFE), a ; switcher
ld (de), a
pop af
pop de
; NOTE: map_restore relies on the HL for
; exit of this
ret
;
; Restore a saved mapping. We are guaranteed that we won't switch
; common copy between save and restore. Preserve all registers
;
map_restore:
push hl
push af
ld hl,#map_savearea
call map_process_2 ; Put the mapper back right
pop af
pop hl
ret
;
Expand All @@ -313,6 +303,8 @@ map_table:
.db 0,0,0,0
map_savearea:
.db 0,0,0,0
map_kernel_data:
.db 3,2,1,4

; emulator debug port for now
outchar:
Expand Down
12 changes: 12 additions & 0 deletions Kernel/platform-msx2/vdp.s
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
.globl _vdpport

.globl vdpinit
.globl platform_interrupt_all

.area _CODE
;
Expand Down Expand Up @@ -282,3 +283,14 @@ _cursor_off:
.area _DATA
cursorpos: .dw 0
cursorpeek: .db 0

.area _COMMONMEM

;
; FIXME: should use vdpport, but right now vdpport is in data not
; common space.
;
platform_interrupt_all:
ld c, #0x99
in a, (c)
ret

0 comments on commit f42e996

Please sign in to comment.