Skip to content

Commit

Permalink
rcbus-z8: more work
Browse files Browse the repository at this point in the history
  • Loading branch information
EtchedPixels committed Feb 15, 2024
1 parent 3d730bd commit de68da3
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Kernel/platform/platform-rcbus-z8/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ clean:
rm -f $(OBJS) $(JUNK) core *~ bootblock.bin bootblock fuzix.bin loader.tmp

image:
$(CROSS_LD) -t -b -C 0x0100 -S 0xF000 -f CLDBbXSs -o fuzix.bin crt0.o devices.o main.o \
$(CROSS_LD) -b -C 0x0100 -D 0x0100 -S 0xF000 -f CLDBbXSs -o fuzix.bin crt0.o devices.o main.o \
discard.o commonmem.o tricks.o rcbus-z8.o devtty.o \
../../start.o ../../version.o ../../cpu-z8/lowlevel-z8.o \
../../mm/bankfixed.o ../../timer.o ../../kdata.o ../../mm/memalloc_none.o \
Expand Down
1 change: 1 addition & 0 deletions Kernel/platform/platform-rcbus-z8/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define MAP_SIZE 0x8000U

#define CONFIG_TD_NUM 1
#define CONFIG_TD_SD
#define TD_SD_NUM 1

/* Read processes and big I/O direct into process space */
Expand Down
4 changes: 4 additions & 0 deletions Kernel/platform/platform-rcbus-z8/kernel.def
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ PROGBASE .equ 0x0000
PROGLOAD .equ 0x0100

CONFIG_SWAP .equ 1


MAINBANK .equ 0x10
INTBANK .equ 0x20
5 changes: 5 additions & 0 deletions Kernel/platform/platform-rcbus-z8/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ void plt_interrupt(void)
timer_interrupt();
}

void plt_reinterrupt(void)
{
tty_pollirq();
}

/* Nothing to do for the map of init */
31 changes: 23 additions & 8 deletions Kernel/platform/platform-rcbus-z8/rcbus-z8.S
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ plt_interrupt_all:

.export _int_disabled
.export _mem_bank
.export istack_switched_sp

.org 8
_int_disabled:
.byte 0
_mem_bank:
.byte 0
_saved_bank:
_mem_saved_bank:
.byte 0
istack_switched_sp:
.word 0

.code

Expand Down Expand Up @@ -115,6 +118,7 @@ map_proc_di:
jr nz, map_notk
or r15,r15
jr z, map_kernel
map_notk:
push r3
lde r3,@rr14
ld _mem_bank,r3
Expand Down Expand Up @@ -157,12 +161,23 @@ outchw:
;
; Bitbang SPI : TODO
;
.export _z8_spi_tx
_z8_spi_tx:
ret

.export _z8_spi_rx
_z8_spi_rx:
.export _sd_spi_tx_byte
.export _sd_spi_rx_byte
.export _sd_spi_tx_sector
.export _sd_spi_rx_sector
.export _sd_spi_lower_cs
.export _sd_spi_raise_cs
.export _sd_spi_fast
.export _sd_spi_slow

_sd_spi_tx_byte:
_sd_spi_rx_byte:
_sd_spi_tx_sector:
_sd_spi_rx_sector:
_sd_spi_lower_cs:
_sd_spi_raise_cs:
_sd_spi_fast:
_sd_spi_slow:
ret

;
Expand Down Expand Up @@ -204,7 +219,7 @@ has_ch:
.export _z8tty_put
_z8tty_put:
ld r3,#2
call __garg2
call __gargr2
ld 0xF0,r3
ret

Expand Down
24 changes: 14 additions & 10 deletions Kernel/platform/platform-rcbus-z8/tricks.S
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ _plt_switchout:
incw rr14
lde @rr14,r3
call map_proc_always
ld r14,#>__udata
ld r15,#<__udata
ld r14,#>_udata
ld r15,#<_udata
ld r12,#>U_DATA_STASH
ld r13,#<U_DATA_STASH
clr r0
Expand Down Expand Up @@ -77,14 +77,14 @@ _switchin:
jr nz, copyback
sub r1,r15
jr z, skip_copyback
copybank:
copyback:
; Map process r3
call map_proc_a

push r14
push r15
ld r14,#>__udata
ld r15,#<__udata
ld r14,#>_udata
ld r15,#<_udata
ld r12,#>U_DATA_STASH
ld r13,#<U_DATA_STASH
clr r0
Expand Down Expand Up @@ -165,7 +165,7 @@ skip_copyback:
in_isr:
ret

switchfal:
switchfail:
call outr14
ld r14,#>badswitchmsg
ld r15,#<badswitchmsg
Expand Down Expand Up @@ -223,7 +223,7 @@ copy48K:

_dofork:
ld r15,#2
call __garg2
call __gargr2

ld r14,r2
ld r15,r3
Expand Down Expand Up @@ -263,7 +263,7 @@ _dofork:
ld r13,#<U_DATA__U_PAGE
lde r1,@rr12 ; source

call copy48k
call copy48K

call map_proc_always

Expand All @@ -273,8 +273,8 @@ _dofork:
push r15

; udata to parent stash
ld r14,#>__udata
ld r15,#<__udata
ld r14,#>_udata
ld r15,#<_udata
ld r12,#>U_DATA_STASH
ld r13,#<U_DATA_STASH
clr r0
Expand Down Expand Up @@ -321,3 +321,7 @@ l2:

_need_resched:
.byte 0

badswitchmsg:
.ascii "badswitch"
.byte 0

0 comments on commit de68da3

Please sign in to comment.