; ld a, (blk_op + BLKPARAM_SWAP_PAGE)
; call map_for_swap
atomlite_read:
- call atomlite_reader
+ call atomlite_reader_fast
jp map_kernel_low
atomlite_read_user:
+ push ix
; HL is the user buffer, BC length
+ ld ix,#U_DATA__U_PAGE
call user_mapping
jr z,ide_r2
call atomlite_reader
exx
call user_mapping
ide_r2:
- call atomlite_reader
+ call atomlite_reader
+ pop ix
jp map_kernel_low
_devide_write_data:
ld a, (_blk_op + BLKPARAM_IS_USER_OFFSET)
ld hl, (_blk_op + BLKPARAM_ADDR_OFFSET)
or a
- jr z, atomlite_read
+ jr z, atomlite_write
dec a
- jr z, atomlite_read_user
+ jr z, atomlite_write_user
; SWAP to enable yet
; ld a, (blk_op + BLKPARAM_SWAP_PAGE)
; call map_for_swap
atomlite_write:
- call atomlite_writer
+ call atomlite_writer_fast
jp map_kernel_low
atomlite_write_user:
+ push ix
; HL is the user buffer, BC length
+ ld ix,#U_DATA__U_PAGE
call user_mapping
jr z,ide_w2
call atomlite_writer
call user_mapping
ide_w2:
call atomlite_writer
+ pop ix
jp map_kernel_low
;
; This needs optimizing to use as we know C = 0 - but think about
#define PROGBASE 0x0000 /* Base of user */
#define PROGLOAD 0x0100 /* Load and run here */
#define PROGTOP 0xFD00 /* Top of program, base of U_DATA stash */
-#define PROC_SIZE 64 /* Memory needed per process */
+#define PROC_SIZE 32 /* Mimumum memory needed per process */
#define BOOT_TTY (512 + 1) /* Set this to default device for stdio, stderr */
/* In this case, the default is the first TTY device */
#include <kdata.h>
#include <printf.h>
#include <devtty.h>
+#include <devide.h>
void map_init(void)
{
-; UZI mnemonics for memory addresses etc
+; Fuzix mnemonics for memory addresses etc
-U_DATA .equ 0x010 ; (this is struct u_data from kernel.h)
+U_DATA .equ 0xF800 ; (this is struct u_data from kernel.h)
U_DATA__TOTALSIZE .equ 0x200 ; 512 bytes.
U_DATA_STASH .equ 0xFD00 ; FD00-FEFF
.include "kernel.def"
.include "../kernel.def"
-KERNEL_LOW .equ 0 ; 0/1 low 2/3 high
+KERNEL_LOW .equ 0x20 ; 0/1 low 2/3 high (ROM off)
KERNEL_HIGH .equ 2
VIDEO_LOW .equ 4 ; 4/5 video and font
; set system RAM size (FIXME - check for 512/1M)
ld hl, #256
ld (_ramsize), hl
- ld hl, #(256-64) ; 64K for kernel
+ ld hl, #(256-96) ; 64K for kernel, 32K for video/font/etc
ld (_procmem), hl
im 1 ; set CPU interrupt mode
; And then the high stubs from the kernel
inc hl
- inc hl
ld a,(hl)
call map_page_low
ld hl,#stubs_high
ei
jp (hl)
nop
-rst20: nop
nop
nop
nop
+rst20: ret
+ nop
nop
nop
nop
nop
-rst28: nop
nop
nop
+rst28: ret
nop
nop
nop
nop
nop
nop
- .ds 0x27
+ .ds 0x26
nmi_handler: ; Should be at 0x66
retn
push iy
ld (U_DATA__U_SP), sp
- ; Map the to
- ld a,(U_DATA__U_PAGE2)
+ ; The U_DATA stash lives in th top of the user process. Map that
+ ; low with interrupts off so we can ldir between the two
+ ld a,(U_DATA__U_PAGE + 1)
call map_page_low
ld hl,#U_DATA
ld de,#U_DATA_STASH-0x8000
pop bc ; return address (we never do)
pop de ; new process pointer
- ld hl,#P_TAB__P_PAGE2_OFFSET
+ ld hl,#P_TAB__P_PAGE_OFFSET + 1
add hl,de
ld a,(hl) ; our high page
ld P_TAB__P_STATUS_OFFSET(ix), #P_RUNNING
ld a, P_TAB__P_PAGE_OFFSET(ix)
ld (U_DATA__U_PAGE),a
- ld a, P_TAB__P_PAGE2_OFFSET(ix)
- ld (U_DATA__U_PAGE2),a
+ ld a, P_TAB__P_PAGE_OFFSET+1(ix)
+ ld (U_DATA__U_PAGE + 1),a
ld hl,#0
ld (_runticks), hl
; Recover IX and IY, return value
; We also have no sane stack for these so we use ix as the return.
;
copy_process:
- ld de,#P_TAB__P_PAGE2_OFFSET
+ ld de,#P_TAB__P_PAGE_OFFSET+1
add hl,de
ld a,(U_DATA__U_PAGE)
call map_page_low
jp _platform_copier_l
cp1ret:
inc hl
- inc hl
- ld a,(U_DATA__U_PAGE2)
+ ld a,(U_DATA__U_PAGE+1)
call map_page_low
call setup_platform_copier
ld ix,#cp2ret