From 023a021515758cab64dab483faf4d5ae2b6abd5d Mon Sep 17 00:00:00 2001 From: Leo C Date: Wed, 29 Jun 2016 16:37:47 +0200 Subject: [PATCH] New stack(s) boot$stack: Used by boot and wboot (new) bs$stack: Used by (char) bios functions that switch to bank 0, and now also for seldsk/read/write. i$stack (formerly istack): Now global and used by *all* interrupt routines. --- cbios/Makefile | 6 +++--- cbios/bioskrnl.180 | 29 ++++++++++++++++++++------- cbios/mm.180 | 24 ++++++++++++++++------- cbios/time.180 | 49 +++++++++++++++++++++++++--------------------- 4 files changed, 69 insertions(+), 39 deletions(-) diff --git a/cbios/Makefile b/cbios/Makefile index 0b21a4a..76fc0ad 100644 --- a/cbios/Makefile +++ b/cbios/Makefile @@ -1,9 +1,9 @@ -SRC := bioskrnl.180 boot.180 stampf.180 chario.180 drvtbl.180 -SRC += move.180 time.180 mm.180 misc.180 utils.180 fifo.180 +SRC := bioskrnl.180 boot.180 chario.180 SRC += msgbuf.180 conbuf.180 ascii.180 -SRC += sdio.180 cfio.180 +SRC += drvtbl.180 sdio.180 cfio.180 stampf.180 +SRC += move.180 time.180 fifo.180 utils.180 misc.180 mm.180 SRC += scb.180 ALLSRC := $(SRC) ldrbios.180 diff --git a/cbios/bioskrnl.180 b/cbios/bioskrnl.180 index 339a759..794e0ff 100644 --- a/cbios/bioskrnl.180 +++ b/cbios/bioskrnl.180 @@ -78,7 +78,8 @@ ccp equ 0100h ; Console Command Processor gets loaded public ?conos,?auxis,?auxos,?dvtbl,?devin,?drtbl public ?mltio,?flush,?mov,?tim,?bnksl,?stbnk,?xmov - public bs$stack + extrn bs$stack + extrn _b0call ; BIOS Jump vector. @@ -130,6 +131,12 @@ ccp equ 0100h ; Console Command Processor gets loaded ?ioctl jp ioctl ; + rept 48 + db '|' + endm +boot$stack: + + ; BOOT ; Initial entry point for system startup. @@ -140,7 +147,7 @@ boot: out0 (cbr),a ld a,USR$CBAR out0 (cbar),a - ld sp,bs$stack + ld sp,boot$stack call hwinit ; first time hardware initialisation @@ -193,7 +200,7 @@ boot$1: ; Entry for system restarts. wboot: - ld sp,bs$stack + ld sp,boot$stack call set$jumps ; initialize page zero call ?rlccp ; reload CCP jp ccp ; then reset jmp vectors and exit to ccp @@ -216,9 +223,6 @@ set$jumps: ret - ds bs$stack$size -bs$stack equ $ - ; DEVTBL ; Return address of character device table @@ -450,6 +454,10 @@ bnksel: ; in seldsk: + b0call _seldsk + ret + +_seldsk: ld a,c ; save drive select code ld (@adrv),a xor a @@ -558,6 +566,10 @@ sectrn: ; extended disk parameter header (XDPH). read: + b0call _read + ret + +_read: ld a,1 ld (@op),a ld ix,(@xdph) ; get drive descriptor pointer @@ -572,6 +584,10 @@ read: ; extended disk parameter header (XDPH). write: + b0call _write + ret + +_write: ld a,2 ld (@op),a ld ix,(@xdph) ; get drive descriptor pointer @@ -616,5 +632,4 @@ flush: @cbnk: db 0 ; bank for processor operations - end diff --git a/cbios/mm.180 b/cbios/mm.180 index 4128fe9..d1f472c 100644 --- a/cbios/mm.180 +++ b/cbios/mm.180 @@ -221,8 +221,6 @@ phy2log: ; Switch stack pointer to "system" stack in top ram ; Save cbar ; - extrn bs$stack - cseg ; common! public _b0call @@ -446,8 +444,8 @@ isv_sw: ; isv_sw: ; ex (sp),hl ;save hl, 'return adr' in hl - ld (istack),sp ;save user stack pointer - ld sp,istack + ld (i$stack),sp ;save user stack pointer + ld sp,i$stack push de ; push bc ; push af ; @@ -466,14 +464,18 @@ isv_sw: ; pop af ; pop bc ; pop de ; - ld sp,(istack) ; + ld sp,(i$stack) ; pop hl ; ei ; ret ; endif - ds 24 -istack: + + public i$stack + rept 24 + db '|' + endm +i$stack: dw 0 dseg @@ -636,4 +638,12 @@ bnk2bbr: endif + cseg + public bs$stack + + rept bs$stack$size + db '|' + endm +bs$stack: + end diff --git a/cbios/time.180 b/cbios/time.180 index 24f92ef..36e5d6b 100644 --- a/cbios/time.180 +++ b/cbios/time.180 @@ -169,42 +169,47 @@ prt0ini: ; ; 1,25 ms clock tick + extrn i$stack cseg ;common! isvprt0: ; + ld (i$stack),sp ; + 19 + ld sp,i$stack ; + 9 + push af ; 11 in0 a,(tcr) ;reset TIF0 flag 12 in0 a,(tmdr0l) ; 12 in0 a,(tmdr0h) ; 12 ; - - push hl ;11 - ld hl,uptime ; 9 - inc (hl) ; 10 77 - jr nz,iprt_1 ; 6/8 -2 - inc hl ; 4 + push hl ; 11 + ld hl,time_to ; 9 + ld a,(hl) ; 6 + sub a,1 ; 6 79 + jr c,iprt_0 ; 6/8 + ld (hl),a ; 7 +iprt_0: ; 87 92 + inc hl ; 4 + inc (hl) ; 10 101 + jr nz,iprt_1 ; 6/8 109 -2 + inc hl ; 4 inc (hl) ; 10 14 jr nz,iprt_1 ; 6/8 - inc hl ; 4 - inc (hl) ;10 - jr nz,iprt_1 ;6/8 - inc hl ; 4 - inc (hl) ;10 -iprt_1: ; 85 138 - pop hl ; 9 - ld a,(time_to) ; 12 - sub a,1 ; 6 112 - jr c,iprt_0 ; 6/8 - ld (time_to),a ; 13 -iprt_0: ; 120 178 + inc hl ; 4 + inc (hl) ; 10 + jr nz,iprt_1 ; 6/8 + inc hl ; 4 + inc (hl) ; 10 +iprt_1: ; 109 138 + pop hl ; 9 pop af ; 9 + ld sp,(i$stack) ; + 18 ei ; 3 - ret ; 9 141 199 - ; +intack 18 159 217 + ret ; 9 139 199 + ; +intack 18 157 217 -uptime: - dw 0,0 time_to: db 0 +uptime: + dw 0,0 end -- 2.39.2