Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions source/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ B0RELS = $(addprefix bank0/,doshead.rel 40ff.rel b0.rel init.rel alloc.rel dskba
B1RELS = $(addprefix bank1/,dosinit.rel mapinit.rel msg.rel)
B2RELS = $(addprefix bank2/,kinit.rel char.rel dev.rel kbios.rel misc.rel seg.rel path.rel find.rel dir.rel handles.rel del.rel rw.rel files.rel buf.rel fat.rel val.rel err.rel)
B3RELS = $(addprefix bank3/,dos1ker.rel)
B4RELS = $(addprefix bank4/,jump.rel env.rel cpm.rel partit.rel ramdrv.rel time.rel seg.rel misc.rel dskab.rel)
B4RELS = $(addprefix bank4/,jump.rel env.rel cpm.rel ramdrv.rel time.rel seg.rel misc.rel dskab.rel)
B5RELS = $(addprefix bank5/,b5.rel)
B6RELS = $(addprefix bank6/,b6.rel)

Expand All @@ -362,7 +362,7 @@ lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(s
$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))

.SECONDEXPANSION:
$(COMRELS) $(B0RELS) $(B1RELS) $(B2RELS) $(B3RELS) $(B4RELS) $(B5RELS) $(B6RELS) drv.rel rel.rel: \
$(COMRELS) $(B0RELS) $(B1RELS) $(B2RELS) $(B3RELS) $(B4RELS) partit.rel $(B5RELS) $(B6RELS) drv.rel rel.rel: \
macros.inc \
const.inc \
condasm.inc \
Expand Down Expand Up @@ -484,6 +484,12 @@ bank4/b4.rel: \

$(call assemble,bank4/b4.mac)

bank4/partit.rel: \
bank4/partit.mac \
bank0/b0labels.inc

$(call assemble,bank4/partit.mac)

bank4/ramdrvh.rel: \
macros.inc \
const.inc \
Expand All @@ -503,6 +509,7 @@ bank4/B4RD.BIN: \
bank4/B4.BIN bank4/B4.SYM: \
$(COMRELS) \
$(B4RELS) \
bank4/partit.rel \
bank4/b4.rel \
bank4/ramdrv.rel \
bank0/b0labels.inc \
Expand Down
8 changes: 8 additions & 0 deletions source/kernel/bank0/dskbasic.mac
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,14 @@ DO_FDISK_OK:
call CALBNK##
pop hl

;In DOS 1 mode FDISK is called via CALBNK from bank 3's DO_FDISK.
;So here we just return and the calling code will take care of
;executing the NEW statement. This way bank 3 will remain active.

ld a,(MAIN_BANK##)
or a
ret nz

ld hl,NEWTXT
ld de,09000h
ld bc,3
Expand Down
5 changes: 3 additions & 2 deletions source/kernel/bank0/init.mac
Original file line number Diff line number Diff line change
Expand Up @@ -2698,10 +2698,11 @@ MK_DVB_TBL:
ld b,a ;B = Number of entries in the table
add a,a
add a,a
add a,a
add a,a ;A = B*8
sub b ;Now A = B*7
ld l,a
ld h,0
inc hl ;HL = Size of table = (entries * 8) + 1
inc hl ;HL = Size of table = (entries * UD1_SIZE) + 1
push hl
call ALLOC##
pop bc
Expand Down
19 changes: 17 additions & 2 deletions source/kernel/bank3/dos1ker.mac
Original file line number Diff line number Diff line change
Expand Up @@ -8741,7 +8741,7 @@ A7397:

defb 31,28,31,30,31,30,31,31,30,31,30,31

BOOTKEYS equ 0F992h ;Defined in kvar.mac
BOOTKEYS equ 0F9B9h ;Defined in kvar.mac

TO_BASIC_REQUIRED:
LD A,0FFH
Expand Down Expand Up @@ -8847,7 +8847,22 @@ DO_FDISK:
call CALBNK##

pop hl
ret

;Execute NEW and return to BASIC.
;FDISK:: in bank 0 returns normally in DOS 1 mode
;(instead of doing jp CALBAS) so that CALBNK properly
;restores bank 3 first.

ld hl,NEWTXT_DOS1
ld de,09000h
ld bc,3
ldir
ld hl,09000h
ld ix,NEWSTT
jp CALBAS

NEWTXT_DOS1:
db 3ah, 94h, 0 ; ":NEW"


; Extra CALL handlers.
Expand Down
82 changes: 36 additions & 46 deletions source/kernel/bank4/partit.mac
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ AUTODRV_DRVLOOP:
ld hl,(KERNEX_DOS1##)
inc (hl) ;Increment size of table
pop ix
ld de,8
ld de,UD1_SIZE##
add ix,de ;Point to next entry in table
pop iy
pop bc
Expand Down Expand Up @@ -949,7 +949,7 @@ AA_CHKDUP_DOS1:
inc iy

AA_CHKDUP_LOOP1:
ld a,(iy+UD_SLOT##)
ld a,(iy+UD1_SLOT##)
cp (ix+AAD_DRIVER_SLOT)
jr nz,AA_CHKDUP_NEXT1

Expand All @@ -963,7 +963,7 @@ AA_CHKDUP_LOOP1:

AA_CHKDUP_NEXT1:
ld a,b
ld bc,8
ld bc,UD1_SIZE##
add iy,bc
ld b,a
djnz AA_CHKDUP_LOOP1
Expand Down Expand Up @@ -3634,62 +3634,55 @@ MAPDOS1_NODEF:

;* First check that the same drive and partition is not mapped to another drive

ld a,(ix+2)
ld a,(ix+UD1_DEVICE_NUMBER##)
push af
ld (ix+2),0 ;At the moment leave the drive unmapped
ld (ix+UD1_DEVICE_NUMBER##),0 ;At the moment leave the drive unmapped
push ix

ld ix,(KERNEX_DOS1)
inc ix
ld b,(ix-1)
MAPDOS1_CHECK_LOOP:
ld a,(ix) ;Check slot number
ld a,(ix+UD1_SLOT##) ;Check slot number
cp (iy)
jr nz,MAPDOS1_CHK_NEXT
ld a,(ix+2) ;Check device number
ld a,(ix+UD1_DEVICE_NUMBER##) ;Check device number
cp (iy+2)
jr nz,MAPDOS1_CHK_NEXT

ld a,(ix+3) ;Check starting sector
ld a,(ix+UD1_FIRST_ABSOLUTE_SECTOR##) ;Check starting sector
cp (iy+3)
jr nz,MAPDOS1_CHK_NEXT
ld a,(ix+4)
ld a,(ix+UD1_FIRST_ABSOLUTE_SECTOR##+1)
cp (iy+4)
jr nz,MAPDOS1_CHK_NEXT
ld a,(ix+5)
ld a,(ix+UD1_FIRST_ABSOLUTE_SECTOR##+2)
cp (iy+5)
jr nz,MAPDOS1_CHK_NEXT
ld a,(ix+6)
ld a,(ix+UD1_FIRST_ABSOLUTE_SECTOR##+3)
cp (iy+6)
jr nz,MAPDOS1_CHK_NEXT
ld a,(ix+7)
cp (iy+7)
jr nz,MAPDOS1_CHK_NEXT

pop ix
pop af
ld (ix+2),a ;Leave old partition mapped
ld (ix+UD1_DEVICE_NUMBER##),a ;Leave old partition mapped
ld a,.PUSED##
ret

MAPDOS1_CHK_NEXT:
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
push bc
ld bc,UD1_SIZE##
add ix,bc
pop bc
djnz MAPDOS1_CHECK_LOOP

pop ix
pop af
ld (ix+2),a ;Leave old partition mapped
ld (ix+UD1_DEVICE_NUMBER##),a ;Leave old partition mapped

;* Now check that the specified driver and device are valid

ld a,(ix) ;Error if slot in parameters block is not the same already assigned
ld a,(ix+UD1_SLOT##) ;Error if slot in parameters block is not the same already assigned
cp (iy)
ld a,.IDRVR##
ret nz
Expand Down Expand Up @@ -3726,15 +3719,15 @@ MAPDOS1_CHK_NEXT:

pop ix
ld a,(iy+2)
ld (ix+2),a ;Device number
ld (ix+UD1_DEVICE_NUMBER##),a ;Device number
ld a,(iy+4)
ld (ix+3),a ;First sector
ld (ix+UD1_FIRST_ABSOLUTE_SECTOR##),a ;First sector
ld a,(iy+5)
ld (ix+4),a
ld (ix+UD1_FIRST_ABSOLUTE_SECTOR##+1),a
ld a,(iy+6)
ld (ix+5),a
ld (ix+UD1_FIRST_ABSOLUTE_SECTOR##+2),a
ld a,(iy+7)
ld (ix+6),a
ld (ix+UD1_FIRST_ABSOLUTE_SECTOR##+3),a

MAPDOS1_END_OK:
set 7,(ix+UD1_RELATIVE_DRIVE##) ;Set partition changed flag
Expand Down Expand Up @@ -5666,12 +5659,12 @@ GET_DVB_POINTER:
inc ix
ld b,(ix-1)
GET_DVB_LOOP:
ld a,(ix) ;Driver slot
ld a,(ix+UD1_SLOT##) ;Driver slot
and 10001111b
cp e
jr nz,GET_DVB_NEXT

ld a,(ix+1) ;Relative unit for driver
ld a,(ix+UD1_RELATIVE_DRIVE##) ;Relative unit for driver
and 01111111b ;Clear "partition changed" flag
cp c
jr nz,GET_DVB_NEXT
Expand All @@ -5680,13 +5673,10 @@ GET_DVB_LOOP:
ret

GET_DVB_NEXT:
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
push bc
ld bc,UD1_SIZE##
add ix,bc
pop bc
djnz GET_DVB_LOOP

scf
Expand Down Expand Up @@ -5992,28 +5982,28 @@ CMIU_DOS1:
inc iy

CMIU1_LOOP:
ld a,(iy)
ld a,(iy+UD1_SLOT##)
cp h
jr nz,CMIU1_NEXT

ld a,(iy+2)
ld a,(iy+UD1_DEVICE_NUMBER##)
or a ;If device number is 0, it is an unused table entry
jr z,CMIU1_NEXT
cp d
jr nz,CMIU1_NEXT

exx

ld a,(iy+4)
ld a,(iy+UD1_FIRST_ABSOLUTE_SECTOR##)
cp e
jr nz,CMIU1_NEXXT
ld a,(iy+5)
ld a,(iy+UD1_FIRST_ABSOLUTE_SECTOR##+1)
cp d
jr nz,CMIU1_NEXXT
ld a,(iy+6)
ld a,(iy+UD1_FIRST_ABSOLUTE_SECTOR##+2)
cp l
jr nz,CMIU1_NEXXT
ld a,(iy+7)
ld a,(iy+UD1_FIRST_ABSOLUTE_SECTOR##+3)
cp h
jr nz,CMIU1_NEXXT

Expand All @@ -6026,7 +6016,7 @@ CMIU1_NEXXT:
exx
CMIU1_NEXT:
ld a,b
ld bc,8
ld bc,UD1_SIZE##
add iy,bc
ld b,a
djnz CMIU1_LOOP
Expand Down
2 changes: 1 addition & 1 deletion source/kernel/drv.mac
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ DIO_OK:

DIO_NEXT:
push bc
ld bc,8
ld bc,UD1_SIZE##
add iy,bc
pop bc
djnz IS_DVB_LOOP
Expand Down
9 changes: 8 additions & 1 deletion source/kernel/kvar.mac
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,14 @@ size macro name
field EMU_DESC_SIZE,EMU_TMP ;Temporary location of work area used when setting up disk emulation mode
field 1,IN_EMU_MODE ;Set to 1 when disk emulation mode has been entered
field 2,EMU_WORK_AREA_ADDRESS ;Address of work area as read from the emulation data file
;NOTE! BOOTKEYS is used in dos1ker.mac, it must be manually updated if it changes

;The KERNEX_DOS1 table (1 + max 8 entries of UD1_SIZE bytes each = up to 57 bytes)
;is also written at BOOT_TMP, overlapping with the fields above plus 40 more bytes.
;BOOTKEYS and I_AM_RUSSIAN must be placed past the maximum table extent.
field 40 ;Padding to avoid KERNEX_DOS1 table overlap

;NOTE! BOOTKEYS is used in dos1ker.mac with a hardcoded address,
;it must be manually updated there if it changes.
field 5,BOOTKEYS ;To store the state of boot keys
field 1,I_AM_RUSSIAN
;
Expand Down
Loading