Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undocumented Opcode Build Option #133

Open
wants to merge 10 commits into
base: v2.1
Choose a base branch
from
4 changes: 2 additions & 2 deletions source/Makefile
Expand Up @@ -4,9 +4,9 @@
# The makefiles on each directory can be used independently as well.

all:
$(MAKE) -C kernel
$(MAKE) -C kernel ASSEMBLE_SYMBOLS=$(ASSEMBLE_SYMBOLS)
$(MAKE) -C command/msxdos
$(MAKE) -C tools
$(MAKE) -C tools ASSEMBLE_SYMBOLS=$(ASSEMBLE_SYMBOLS)
$(MAKE) -C tools/C

.PHONY: clean
Expand Down
10 changes: 8 additions & 2 deletions source/kernel/Makefile
Expand Up @@ -45,14 +45,20 @@ define copy_to_bin
cp $(1) ../../bin/kernels/$(2)
endef

ifeq ($(strip $(ASSEMBLE_SYMBOLS)),)
EXTRA_SYMBOLS=
else
EXTRA_SYMBOLS=--define-symbols $(ASSEMBLE_SYMBOLS)
endif

define assemble
@printf "\n\033[0;36mAssembling %s\033[0m\n\n" $(1)
@$(N80) $(1) $$ $(2)
@$(N80) $(1) $$ $(2) $(EXTRA_SYMBOLS)
endef

define assemble_as
@printf "\n\033[0;36mAssembling %s as %s\033[0m\n\n" $(1) $(2)
@$(N80) $(1) $(2) $(3)
@$(N80) $(1) $(2) $(3) $(EXTRA_SYMBOLS)
endef

define print_linking
Expand Down
25 changes: 21 additions & 4 deletions source/kernel/bank0/init.mac
Expand Up @@ -2143,7 +2143,7 @@ scan_loop:
ld e,(hl)
inc hl
ld d,(hl)
db 0FDh,67h ;LD IYh,A
ld_iyh_a
push de
pop ix
call CALSLT
Expand Down Expand Up @@ -2173,10 +2173,27 @@ TNEX_LOOP:
push hl
push bc
and 10001111b
db 0FDh,67h ;LD IYh,A

ifdef DISABLE_UNDOCUMENTED_OPCODES

ex (sp),iy
ex (sp),hl
ld h,a
ld a,(MASTER_SLOT##)
cp h
ld a,h
ex (sp),hl
ex (sp),iy

else

ld iyh,a
ld a,(MASTER_SLOT##)
db 0FDh,0BCh ;CP IYh
db 0FDh,7Ch ;LD A,IYh
cp iyh
ld a,iyh

endif

ld h,40h
ld ix,DV_TIRQ##
call call_drv
Expand Down
8 changes: 4 additions & 4 deletions source/kernel/bank1/dosinit.mac
Expand Up @@ -1564,7 +1564,7 @@ _U_CALLRAM:
ex af,af
... < call _GET_P1 >
push af
ld a,iyl
ld_a_iyl
... < call _PUT_P1 >
ex af,af
call CALSLT##
Expand Down Expand Up @@ -1651,7 +1651,7 @@ _U_CALLRAM2:
dec ix
dec ix
push ix
ld iyl,e
ld_iyl_e

ld a,d
and 00111111b
Expand All @@ -1675,13 +1675,13 @@ _U_CALLRAM2:
ld bc,(MAP_TAB##)
add hl,bc
ld a,(hl) ;A = Slot to call
ld iyh,a
ld_iyh_a

ex af,af'
exx
inc sp
inc sp
jr _U_CALLRAM
jp _U_CALLRAM
;
;-----------------------------------------------------------------------------
;
Expand Down
38 changes: 19 additions & 19 deletions source/kernel/bank4/partit.mac
Expand Up @@ -209,14 +209,14 @@ DO_EXTPAR:
jp nz,UNEX_PART

ld a,(ix+POFF_PSTART) ;Save the start sector number of the outer extended partition
ld iyl,a ;(the one that includes all other extended partitions).
ld_iyl_a ;(the one that includes all other extended partitions).
ld a,(ix+POFF_PSTART+1) ;We need it to calculate the offsets of the inner
ld iyh,a ;extended partitions.
ld_iyh_a ;extended partitions.
push iy
ld a,(ix+POFF_PSTART+2)
ld iyl,a
ld_iyl_a
ld a,(ix+POFF_PSTART+3)
ld iyh,a
ld_iyh_a
push iy

;=== Loop for extended partition search ===
Expand Down Expand Up @@ -355,7 +355,7 @@ DEV_READ:
push de
push hl

ld iyh,c
ld_iyh_c
ld ix,DEV_RW##
ld (BK4_ADD##),ix
ld ix,CALDRV##
Expand Down Expand Up @@ -597,7 +597,7 @@ AUTODRV_DRVLOOP:
; A = Relative drive for the driver

ld c,a
ld a,iyl
ld_a_iyl
ld (ix+UD1_SLOT##),a ;Set slot number in table entry
ld a,c
ld (ix+UD1_RELATIVE_DRIVE##),a
Expand All @@ -607,7 +607,7 @@ AUTODRV_DRVLOOP:
push iy
push ix

ld a,iyh ;ld a,(iy+4)
ld_a_iyh ;ld a,(iy+4)
and 00000100b ;Driver provides config?
jr z,AUTODRV_DRVL2
push ix
Expand Down Expand Up @@ -708,7 +708,7 @@ AUTOD_UDFND:
;--- Check if it is assigned to a device based driver

ld a,(ix+UD_SLOT##)
ld iyh,a
ld_iyh_a

ld c,a
ld a,(KER250##)
Expand Down Expand Up @@ -1067,7 +1067,7 @@ AA_CHKDUP_OK:
;--- Obtain device information

ld a,(ix+AAD_DRIVER_SLOT)
ld iyh,a
ld_iyh_a
ld hl,LUN_INFO##
ld (BK4_ADD##),hl
ld hl,($SECBUF##)
Expand Down Expand Up @@ -1566,7 +1566,7 @@ AA_WSEC:
AA_RSEC:
or a
AA_DOSEC:
ld iyh,c
ld_iyh_c
ld hl,DEV_RW##
ld (BK4_ADD##),hl
ld c,b
Expand Down Expand Up @@ -2482,7 +2482,7 @@ F_CDRVR_GO:
ret nz

ld (BK4_ADD##),de
ld iyh,c
ld_iyh_c
ld l,(ix)
ld h,(ix+1)
push hl
Expand Down Expand Up @@ -2630,10 +2630,10 @@ UNMAP_LOOP:
inc hl
ld h,(hl)
ld l,a
cp iyl
cp_iyl
jr nz,UNMAP_OK1
ld a,h
cp iyh
cp_iyh
jr z,UNMAP_NEXT2 ;It is the unit not to be unassigned
UNMAP_OK1:

Expand Down Expand Up @@ -3084,7 +3084,7 @@ MAP_SPECIFIC:
ld c,(iy)
ld a,(iy+2)
ld b,(iy+3)
ld iyh,c
ld_iyh_c
ld hl,($SECBUF##)
ld ix,CALDRV##
call CALSLT
Expand Down Expand Up @@ -3121,7 +3121,7 @@ MAP_SPECIFIC:
ld c,(iy)
ld a,(iy+2)
ld b,(iy+3)
ld iyh,c
ld_iyh_c
ld ix,CALDRV##
call CALSLT
pop iy
Expand Down Expand Up @@ -3650,7 +3650,7 @@ MAPDOS1_DEF:
push hl
push ix
ld a,(ix+UD1_SLOT##)
ld iyh,a
ld_iyh_a
call GET_DV_TYPE
pop ix
pop hl
Expand Down Expand Up @@ -3815,7 +3815,7 @@ MAPDOS1_CHK_NEXT:
ld c,(iy)
ld a,(iy+2)
ld b,(iy+3)
ld iyh,c
ld_iyh_c
ld hl,($SECBUF##)
ld ix,CALDRV##
call CALSLT
Expand Down Expand Up @@ -5954,7 +5954,7 @@ DRVS1LOOP:
pop de
jr c,DRVS1NEXT ;Skip if not a Nextor kernel

ld iyh,e
ld_iyh_e
call GET_DV_TYPE
bit 0,a ;Device-based?
jr z,DRVS1NEXT ;No: skip
Expand Down Expand Up @@ -6192,7 +6192,7 @@ ASK_DRIVE_CONFIG:
push de
push bc ;BC=DOS mode and relative unit
ld a,(ix+UD_SLOT##)
ld iyh,a
ld_iyh_a
ld hl,DV_CONFIG##
ld (BK4_ADD##),hl
ld a,CFG_DEVLUN
Expand Down
33 changes: 16 additions & 17 deletions source/kernel/drivers/SunriseIDE/sunride.asm
Expand Up @@ -6,6 +6,7 @@
; By FRS

;MASTER_ONLY constant must be defined externally to generate the master-only variant.
INCLUDE ../../macros.inc

org 4000h
ds 4100h-$,0 ; DRV_START must be at 4100h
Expand Down Expand Up @@ -1052,8 +1053,7 @@ DEV_RW2:
ld b,0
ret
DEV_RW_NO0SEC:
ld iyl,e
ld iyh,d
ld_iy_de
ld a,(iy+3)
and 11110000b
jp nz,DEV_RW_NOSEC ;Only 28 bit sector numbers supported
Expand Down Expand Up @@ -1091,7 +1091,7 @@ DEV_ATA_RD:

call CHK_RW_FAULT
ret c
ld iyl,b ; iyl=number of blocks
ld_iyl_b ; iyl=number of blocks
ex de,hl ; de=destination address

ld bc,512 ; block size ***Hardcoded. Ignores (BLKLEN)
Expand All @@ -1108,7 +1108,7 @@ DEV_ATA_WR:
ld a,ATACMD.PWRSECTRT ; PIO write sector with retry
call PIO_CMD
jp c,DEV_RW_ERR
ld iyl,b ; iyl=number of blocks
ld_iyl_b ; iyl=number of blocks

ld bc,512 ; block size ***Hardcoded. Ignores (BLKLEN)
call WRITE_DATA
Expand All @@ -1126,8 +1126,7 @@ DEV_ATAPI_RW:
push de
ld e,(ix+DEVINFO.pBASEWRK) ; hl=pointer to WorkArea
ld d,(ix+DEVINFO.pBASEWRK+1)
ld iyl,e
ld iyh,d ; iy=WRKAREA pointer
ld_iy_de ; iy=WRKAREA pointer
pop de

; Set the block size
Expand Down Expand Up @@ -1174,7 +1173,7 @@ DEV_ATAPI_RD:
push bc
push hl
push iy
ld iyl,1 ; 1 block
ld_iyl_1 ; 1 block
ld hl,WRKAREA.PCTBUFF
ld bc,PCTRW10._SIZE ; block size=10 bytes
call WRITE_DATA ; Send the packet to the device
Expand Down Expand Up @@ -1217,13 +1216,13 @@ DEV_ATAPI_RD:
ex de,hl ; de=destination address
.loopsector:
push bc
ld iyl,c ; get the number of blocks per sector
ld_iyl_c ; get the number of blocks per sector
.loopblock:
call WAIT_DRQ
jr c,.rderr
ld hl,IDE_DATA
call RUN_HLPR
dec iyl
dec_iyl
jr nz,.loopblock
pop bc
djnz .loopsector
Expand All @@ -1245,7 +1244,7 @@ DEV_ATAPI_WR:
push bc
push hl
push iy
ld iyl,1 ; 1 block
ld_iyl_1 ; 1 block
ld hl,WRKAREA.PCTBUFF
ld bc,PCTRW10._SIZE ; block size=10 bytes
call WRITE_DATA ; Send the packet to the device
Expand Down Expand Up @@ -1287,15 +1286,15 @@ DEV_ATAPI_WR:
pop bc
.loopsector:
push bc
ld iyl,c ; get the number of blocks per sector
ld_iyl_c ; get the number of blocks per sector
.loopblock:
call WAIT_DRQ
jr c,.rderr
ld de,IDE_DATA
call RUN_HLPR
call CHK_RW_FAULT
jr c,.rderr
dec iyl
dec_iyl
jp nz,.loopblock
pop bc
djnz .loopsector
Expand Down Expand Up @@ -1841,13 +1840,13 @@ LUN_NFO_ATAPI:

ld a,ATAPICMD.PACKET ; PIO send PACKET command
call PIO_CMD
jr c,.errorpop
jp c,.errorpop

pop hl
push hl ; Source=PCTBUF
ld bc,12 ; 12 byte packet
push iy
ld iyl,1
ld_iyl_1
call WRITE_DATA ; Send the packet to the device
pop iy
jr nc,.rdmediapropr ; No error? Then read media proprieties
Expand All @@ -1865,7 +1864,7 @@ LUN_NFO_ATAPI:
pop de ; Destination=PCTBUFF
ld bc,8 ; 8 byte response
push iy
ld iyl,1
ld_iyl_1
call READ_DATA
pop iy
jr c,LUN_INFO_ERROR
Expand Down Expand Up @@ -2462,7 +2461,7 @@ READ_DATA:
ret c
ld hl,IDE_DATA
call RUN_HLPR
dec iyl
dec_iyl
jp nz,.loop
ret

Expand All @@ -2481,7 +2480,7 @@ WRITE_DATA:
call RUN_HLPR
call CHK_RW_FAULT
ret c
dec iyl
dec_iyl
jp nz,.loop
ret

Expand Down