Browse Source

roms/print80: add XDx: device entries

Secondary hard disk controller. The actual code is in UFD-DOS, but
there isn't enough space for the device list entries there, so
(optionally) put them here.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
H. Peter Anvin 1 year ago
parent
commit
cfb99b9bd3

+ 34 - 32
rv32/roms/asmsrc/abc80/print80.inc

@@ -27,9 +27,12 @@
 ;;; To auto-initialize this, we need a modified DOS that looks for
 ;;; additional ROM entry points (ABC800 has this, but not ABC80.)
 
+	.altmacro
+
 #include "z80.inc"
 #include "abc80.inc"
 #include "auxram.inc"
+#include "ufddos.inc"
 
 	defc selcode=60			; ABC-bus select code
 
@@ -56,6 +59,9 @@
 	;; PR: using raw protocol (not a chardev volume?)
 	defc raw_pr = 0
 
+	;; XDx: device entries (secondary hard disk, not enough space in DOS)
+	defc xd_dev = 1
+
 	;; CMD routine if in IEC area?
 	defc have_cmd = LARGE && (ROMSTART == 0x7000)
 	if !have_cmd
@@ -666,8 +672,8 @@ prb_setup_buf:
 	push af
 	push bc
 	push hl
-	call 65F4h		; Allocate buffer
-	call 662Bh		; Initialize buffer pointers
+	call DOSALLOCBUF	; Allocate buffer
+	call DOSBUFINIT		; Initialize buffer pointers
 	pop hl
 	pop bc
 	pop af
@@ -679,7 +685,7 @@ prb_empty_buf:			; Returns with A=0, HL->buf
 	push af
 	ex de,hl
 	ld a,(ix+12)
-	call 662Fh		; Returns with HL -> buffer
+	call DOSBUFREINIT	; Returns with HL -> buffer
 	ex de,hl
 	pop af
 	ret
@@ -1195,46 +1201,45 @@ e_cmd_space_overflow:
 
 	endif			; have_cmd
 
-
-	defc need_device_list = console_dev | connul | raw_pr
-
-	if need_device_list
-device_list:
+	_device_link = voldevs
+
+	.macro device name:req, jptbl:req
+	defw _device_link
+	_device_link = . - 2
+	defm \name
+	defw \jptbl
+	.endm
+
+	if xd_dev
+xd_device:
+	device "XD0", DOSJPTABLE
+	defb 0x14
+	device "XD1", DOSJPTABLE
+	defb 0x15
+	device "XD2", DOSJPTABLE
+	defb 0x16
+	device "XD3", DOSJPTABLE
+	endif
 
 	if console_dev
 prc_device:
-	if connul | raw_pr
-	defw . + 7		; Next entry follows
-	else
-	defw voldevs
-	endif
-	defm "PRC"
-	defw prc_jptable
+	device "PRC", prc_jptable
 	endif
 
 	if connul
 con_device:
-	defw . + 7		; Next entry follows
-	defm "CON"
-	defw con_jptable
+	device "CON", con_jptable
 nul_device:
-	if raw_pr
-	defw . + 7		; Next entry follows
-	else
-	defw voldevs
-	endif
-	defm "NUL"
-	defw nul_jptable
+	device "NUL", nul_jptable
 	endif
 
 	if raw_pr
 pr_device:
-	defw voldevs
-	defm "PR "
-	defw pr_jptable
+	device "PR ", pr_jptable
 	endif
 
-	endif
+	;; The value to put in the BASIC device link pointer
+device_list = _device_link
 
 	;; Jump table for BASIC functions that are inconsistent
 new_basic_jumps:		; Checksum 9913, 10042
@@ -1270,9 +1275,6 @@ __end:
 
 	section .bss
 __bss:
-	if !need_device_list
-device_list:
-	endif
 voldevs:
 	defs 7*MAX_VOLS		; Up to 32 volume device entries
 errsp:

+ 4 - 0
rv32/roms/asmsrc/abc80/ufddos.inc

@@ -15,3 +15,7 @@ defc DRDWRET		= 24689	    ;; Pointer to driver hook
 defc DRDWEND		= 25012	    ;; Driver hook exit (when claimed)
 defc DRDWERR		= 25011	    ;; Driver hook exit on error
 defc DGETBUF		= 25098	    ;; Get address of DOSBUF B[7:4]
+defc DOSJPTABLE		= 26195	    ;; Address for disk drive jump table
+defc DOSALLOCBUF	= 26100	    ;; Allocate a DOSBUF
+defc DOSBUFINIT		= 26155	    ;; Initialize an IX map+DOS file descriptor
+defc DOSBUFREINIT	= 26159	    ;; Requires A = (ix+12), preserves BC

+ 1 - 0
rv32/roms/asmsrc/abc80/ufddos80.asm

@@ -1388,6 +1388,7 @@ bufreset:       rrca                    ; 662f .    0f
 ;;;
 ;;; Jump table for BASIC device driver
 ;;;
+		.org 0x653, 0xff
 JP_OPEN:        ;; 6653 <- 66e9 66f1 66f9 6701 6709 6711 6719 6721 6729 6731
                 ;;         6739 6741 6749 6751 6759 6761 6769
                 jp do_open              ; 6653 ..f  c3 1a 66