diff --git a/Binary/Apps/Makefile b/Binary/Apps/Makefile new file mode 100644 index 00000000..a979319b --- /dev/null +++ b/Binary/Apps/Makefile @@ -0,0 +1,7 @@ +TOOLS = ../../Tools +SUBDIRS = Tunes + +include $(TOOLS)/Makefile.inc + +clean:: + rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom *.COM *.BIN diff --git a/Binary/Apps/Tunes/Makefile b/Binary/Apps/Tunes/Makefile new file mode 100644 index 00000000..b643ef0f --- /dev/null +++ b/Binary/Apps/Tunes/Makefile @@ -0,0 +1,6 @@ +TOOLS = ../../../Tools + +include $(TOOLS)/Makefile.inc + +clean:: + rm -f *.pt? *.mym diff --git a/Binary/Makefile b/Binary/Makefile index 8602cf74..7175f9f2 100644 --- a/Binary/Makefile +++ b/Binary/Makefile @@ -1,6 +1,7 @@ -clean: +TOOLS = ../Tools +SUBDIRS = Apps -clobber: - rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom +include $(TOOLS)/Makefile.inc -all: +clobber:: + rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom diff --git a/Doc/ChangeLog.txt b/Doc/ChangeLog.txt index 873e0e36..2dbd6d4e 100644 --- a/Doc/ChangeLog.txt +++ b/Doc/ChangeLog.txt @@ -40,6 +40,13 @@ Version 2.9.2 - PMS: Added font compression option - PMS: Added a "safe mode" startup w/ minimal device support - WBW: Switch RC/SC Z180 platforms to 115,200 default baud rate +- PMS: Enhanced PPIDE driver to handle multiple PPI interfaces +- PMS: Added a ROM based game +- WBW: Only assign drive letters to hard disk devices with media +- WBW: Enhanced IDE driver to handle multiple IDE interfaces +- D?R: Contributed SC126 How-To: Preparing a MicroSD Card to Transfer Files to/from a Linux System +- PMS: Updated romldr to handle more than 9 drives +- PMS: Added "user" rom module template Version 2.9.1 ------------- diff --git a/Doc/Contrib/SC126_How-To_No_1_Serial_Comms_Using_Minicom.pdf b/Doc/Contrib/SC126_How-To_No_1_Serial_Comms_Using_Minicom.pdf new file mode 100644 index 00000000..eb4d5b48 Binary files /dev/null and b/Doc/Contrib/SC126_How-To_No_1_Serial_Comms_Using_Minicom.pdf differ diff --git a/Doc/Contrib/SC126_How-To_No_2_Preparing_an_SD_Card_for_Use_with_SC126_Rev_1-5.pdf b/Doc/Contrib/SC126_How-To_No_2_Preparing_an_SD_Card_for_Use_with_SC126_Rev_1-5.pdf new file mode 100644 index 00000000..9dd3fe3b Binary files /dev/null and b/Doc/Contrib/SC126_How-To_No_2_Preparing_an_SD_Card_for_Use_with_SC126_Rev_1-5.pdf differ diff --git a/Doc/NZCOM Manual.pdf b/Doc/NZCOM Manual.pdf new file mode 100644 index 00000000..59a62a08 Binary files /dev/null and b/Doc/NZCOM Manual.pdf differ diff --git a/Makefile b/Makefile index ba64fcc0..095c356e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: cd Tools/unix ; make install - cd Source ; make all - cd Source/Images ; make al + cd Source ; make install + cd Source/Images ; make all clean: cd Tools/unix ; make clean diff --git a/ReadMe.txt b/ReadMe.txt index 49a04500..ecfc0831 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -7,7 +7,7 @@ *********************************************************************** Wayne Warthen (wwarthen@gmail.com) -Version 2.9.2-pre.27, 2020-01-26 +Version 2.9.2-pre.29, 2020-02-08 https://www.retrobrewcomputers.org/ RomWBW is a ROM-based implementation of CP/M-80 2.2 and Z-System for diff --git a/Source/Apps/Makefile b/Source/Apps/Makefile index 15f43c62..99803081 100644 --- a/Source/Apps/Makefile +++ b/Source/Apps/Makefile @@ -6,7 +6,6 @@ SUBDIRS = XM FDU FAT # Tune - left out for now DEST = ../../Binary/Apps TOOLS =../../Tools -RELPATH = Source/Apps include $(TOOLS)/Makefile.inc diff --git a/Source/Apps/RTC.asm b/Source/Apps/RTC.asm index 8d3e3750..c6f7b645 100644 --- a/Source/Apps/RTC.asm +++ b/Source/Apps/RTC.asm @@ -23,6 +23,7 @@ ; ;[2019/08/11] v1.4 Support SCZ180 platform. ; +;[2020/02/02] v1.5 PMS Basic command line support ; ; Constants ; @@ -40,6 +41,7 @@ PORT_SCZ180 .EQU $0C ; RTC port for SBCZ180 PORT_EZZ80 .EQU $C0 ; RTC port for EZZ80 (actually does not have one!!!) BDOS .EQU 5 ; BDOS invocation vector +FCB .EQU 05CH ; Start of command line BID_BOOT .EQU $00 HB_BNKCALL .EQU $FFF9 @@ -1220,18 +1222,22 @@ IDBIO2: ; Note:above code is not fully in sync with current menu code RTC_TOP_LOOP: + CALL RTC_RESET_ON + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + + LD A,(FCB+1) ; If there a command line tail + CP '/' ; get the command and feed it + LD A,(FCB+2) ; into the input stream + JR Z,RTC_UCL + LD DE,CRLF_MSG LD C,09H ; CP/M write string to console call CALL 0005H CALL RTC_HELP - CALL RTC_RESET_ON - - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - RTC_TOP_LOOP_1: LD DE,RTC_TOP_LOOP1_PROMPT LD C,09H ; CP/M write string to console call @@ -1239,7 +1245,7 @@ RTC_TOP_LOOP_1: LD C,01H ; CP/M console input call CALL 0005H - +RTC_UCL: AND %01011111 ; handle lower case responses to menu CP 'L' @@ -1312,6 +1318,9 @@ RTC_TOP_LOOP_CHARGE: LD C,09H ; CP/M write string to console call CALL 0005H CALL RTC_CHARGE_ENABLE + LD A,(FCB+1) ; If we came from the + CP '/' ; command line + RET Z ; exit back to CP/M JP RTC_TOP_LOOP_1 RTC_TOP_LOOP_NOCHARGE: @@ -1319,6 +1328,9 @@ RTC_TOP_LOOP_NOCHARGE: LD C,09H ; CP/M write string to console call CALL 0005H CALL RTC_CHARGE_DISABLE + LD A,(FCB+1) ; If we came from the + CP '/' ; command line + RET Z ; exit back to CP/M JP RTC_TOP_LOOP_1 RTC_TOP_LOOP_START: @@ -1350,6 +1362,9 @@ RTC_TOP_LOOP_TIME: LD DE,RTC_PRINT_BUFFER LD C,09H ; CP/M write string to console call CALL 0005H + LD A,(FCB+1) ; If we came from the + CP '/' ; command line + RET Z ; exit back to CP/M JP RTC_TOP_LOOP_1 RTC_TOP_LOOP_RAW: @@ -1552,7 +1567,7 @@ TESTING_BIT_DELAY_OVER: RTC_HELP_MSG: .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "RTC: Version 1.4" + .TEXT "RTC: Version 1.5" .DB 0Ah, 0Dh ; line feed and carriage return .TEXT "Commands: E)xit T)ime st(A)rt S)et R)aw L)oop C)harge N)ocharge D)elay I)nit G)et P)ut B)oot H)elp" .DB 0Ah, 0Dh ; line feed and carriage return diff --git a/Source/Apps/Tune/Tune.asm b/Source/Apps/Tune/Tune.asm index 54911263..2526fccf 100644 --- a/Source/Apps/Tune/Tune.asm +++ b/Source/Apps/Tune/Tune.asm @@ -37,6 +37,7 @@ ; 2018-01-26 [WBW] Initial release ; 2018-01-28 [WBW] Added support for MYM sound files ; 2019-11-21 [WBW] Added table-driven configuration +; 2020-02-11 [WBW] Made hardware config & detection more flexible ;_______________________________________________________________________________ ; ; ToDo: @@ -81,30 +82,48 @@ TYPMYM .EQU 3 ; FILTYP value for MYM sound file LD A,RMJ << 4 | RMN ; Expected HBIOS ver CP D ; Compare with result above JP NZ,ERRBIO ; Handle BIOS error + LD A,L ; Platform id to A + LD (CURPLT),A ; Save as current platform id ; - ; Use platform id to setup active configuration - LD A,L ; Platform ID is still in L from above - RLCA ; Adjust for table entry size (4 bytes) - PUSH AF ; Save ID * 2 for later - RLCA LD HL,CFGTBL ; Point to start of config table - CALL ADDHLA ; HL := desired config table entry - LD DE,CFG ; Dest is active config - LD BC,4 ; Copy 4 bytes - LDIR ; Copy to active config -; - LD HL,PLTSTR ; Point to platform string table - POP AF ; Recover platform id * 2 for table offset - CALL ADDHLA ; HL := Platform string index adr - LD E,(HL) ; DE := Platform string adr - INC HL - LD D,(HL) - CALL CRLF ; Formatting - CALL PRTSTR ; Display platform string +CFGSEL: + LD A,$FF ; End of table marker + CP (HL) ; Compare + JP Z,ERRHW ; Bail out if no more configs to try +; + LD BC,CFGSIZ ; Size of one entry + LD DE,CFG ; Active config structure + LDIR ; Update active config structure +; + LD A,(CURPLT) ; Get current running platform id + LD E,A ; Put in E + LD A,(PLT) ; Get platform id of loaded config + CP E ; Equal? + JR NZ,CFGSEL ; If no match keep trying +; + ; Test for hardware (sound chip detection) + CALL SLOWIO + LD DE,(PORTS) ; D := RDAT, E := RSEL + LD C,E ; Port = RSEL + LD A,2 ; Register 2 + OUT (C),A ; Select register 2 + LD C,D ; Port = RDAT + LD A,$AA ; Value = $AA + OUT (C),A ; Write $AA to register 2 + ;LD C,E ; Port = RSEL + LD A,(RIN) ; Port = RIN + LD C,A ; ... to C + IN A,(C) ; Read back value in register 2 + PUSH AF + CALL NORMIO + POP AF + ;CALL PRTHEX ; *debug* + CP $AA ; Value as written? + JR NZ,CFGSEL ; If not, keep trying configs ; - LD A,(CFG) ; RSEL port address to A - INC A ; Test for $FF - JP Z,ERRPLT ; Bail out if unsupported platform + CALL CRLF ; Formatting + LD DE,(DESC) ; Load hardware description pointer + CALL PRTSTR ; Print description ; ; Test for timer running to determine if it can be used for delay LD B,BF_SYSGET ; HBIOS: GET function @@ -123,19 +142,6 @@ SETDLY: LD (WMOD),A ; Save wait mode CALL PRTSTR ; Print it ; -; ; *DEBUG* -; LD A,',' -; CALL PRTCHR -; LD HL,CFG -; LD B,4 -;DBGLP: -; LD A,' ' -; CALL PRTCHR -; LD A,(HL) -; INC HL -; CALL PRTHEX -; DJNZ DBGLP -; ; Get CPU speed & type from RomWBW HBIOS and compute quark delay factor LD B,$F8 ; HBIOS SYSGET function 0xF8 LD C,$F0 ; CPUINFO subfunction 0xF0 @@ -146,31 +152,13 @@ SETDLY: LD (QDLY),HL ; Save result as quark delay factor ; ; Activate SCG card if applicable - LD A,(CFG+3) + LD A,(ACR) CP $FF JR Z,NOSCG LD C,A LD A,$FF OUT (C),A NOSCG: -; - ; Test for hardware (sound chip detection) - CALL SLOWIO - LD DE,(CFG) ; D := RDAT, E := RSEL - LD C,E ; Port = RSEL - LD A,2 ; Register 2 - OUT (C),A ; Select register 2 - LD C,D ; Port = RDAT - LD A,$AA ; Value = $AA - OUT (C),A ; Write $AA to register 2 - LD C,E ; Port = RSEL - IN A,(C) ; Read back value in register 2 - PUSH AF - CALL NORMIO - POP AF - ;CALL PRTHEX ; *debug* - CP $AA ; Value as written? - JP NZ,ERRHW ; If not, handle hardware error ; ; Clear heap storage LD HL,HEAP ; Point to heap start @@ -431,7 +419,7 @@ IDBIO2: ; ; SLOWCPU: - LD A,(CFG+2) ; Z180 base I/O port + LD A,(Z180) ; Z180 base I/O port CP $FF ; Check for no value RET Z ; Bail out if no value ADD A,$1E ; Apply offset of CMR register @@ -451,7 +439,7 @@ SLOWCPU: ; ; NORMCPU: - LD A,(CFG+2) ; Z180 base I/O port + LD A,(Z180) ; Z180 base I/O port CP $FF ; Check for no value RET Z ; Bail out if no value ADD A,$1E ; Apply offset of CMR register @@ -467,7 +455,7 @@ NORMCPU: ; ; SLOWIO: - LD A,(CFG+2) ; Z180 base I/O port + LD A,(Z180) ; Z180 base I/O port CP $FF ; Check for no value RET Z ; Bail out if no value ADD A,$32 ; Apply offset of DCNTL register @@ -482,7 +470,7 @@ SLOWIO: ; ; NORMIO: - LD A,(CFG+2) ; Z180 base I/O port + LD A,(Z180) ; Z180 base I/O port CP $FF ; Check for no value RET Z ; Bail out if no value ADD A,$32 ; Apply offset of DCNTL register @@ -716,25 +704,56 @@ ERR2: ; without the string ; ; CONFIG TABLE, ENTRY ORDER MATCHES HBIOS PLATFORM ID ; -CFGTBL: ; RSEL RDAT Z180 ACR - .DB $FF, $FF, $FF, $FF ; PLATFORM ID 0 IS INVALID - .DB $9A, $9B, $FF, $9C ; SBC W/ SCG - .DB $FF, $FF, $FF, $FF ; ZETA (NOT POSSIBLE) - .DB $FF, $FF, $FF, $FF ; ZETA 2 (NOT POSSIBLE) - .DB $9C, $9D, $40, $FF ; N8 W/ ONBOARD PSG - .DB $9A, $9B, $40, $9C ; MK4 W/ SCG - .DB $9A, $9B, $FF, $FF ; UNA (NOT SUPPORTED) - .DB $D8, $D0, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (EB) - .DB $68, $60, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (EB) - .DB $D8, $D0, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (EB) - .DB $68, $60, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (EB) -; -CFG: ; ACTIVE CONFIG VALUES (FROM SELECTED CFGTBL) +CFGSIZ .EQU 8 +; +CFGTBL: ; PLT RSEL RDAT RIN Z180 ACR + ; DESC + .DB $01, $9A, $9B, $9A, $FF, $9C ; SBC W/ SCG + .DW HWSTR_SCG +; + .DB $04, $9C, $9D, $9C, $40, $FF ; N8 W/ ONBOARD PSG + .DW HWSTR_N8 +; + .DB $05, $9A, $9B, $9A, $40, $9C ; MK4 W/ SCG + .DW HWSTR_SCG +; + .DB $07, $D8, $D0, $D8, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $07, $D1, $D0, $D0, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $08, $68, $60, $68, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $08, $61, $60, $60, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $09, $D8, $D0, $D8, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $09, $D1, $D0, $D0, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCMF +; + .DB $0A, $68, $60, $68, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $0A, $61, $60, $60, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $FF ; END OF TABLE MARKER +; +CFG: ; ACTIVE CONFIG VALUES (FROM SELECTED CFGTBL ENTRY) +PLT .DB 0 ; RomWBW HBIOS platform id +PORTS: RSEL .DB 0 ; Register selection port RDAT .DB 0 ; Register data port +RIN .DB 0 ; Register input port Z180 .DB 0 ; Z180 base I/O port ACR .DB 0 ; Aux Ctrl Reg I/O port on SCG +DESC .DW 0 ; Hardware description string adr ; +CURPLT .DB 0 ; Current platform id reported by HBIOS QDLY .DW 0 ; quark delay factor WMOD .DB 0 ; delay mode, non-zero to use timer DCSAV .DB 0 ; for saving original Z180 DCNTL value @@ -747,8 +766,8 @@ FILTYP .DB 0 ; Sound file type (TYPPT2, TYPPT3, TYPMYM) TMP .DB 0 ; work around use of undocumented Z80 ; -MSGBAN .DB "Tune Player for RomWBW v2.2, 21-Nov-2019",0 -MSGUSE .DB "Copyright (C) 2019, Wayne Warthen, GNU GPL v3",13,10 +MSGBAN .DB "Tune Player for RomWBW v2.3, 11-Feb-2020",0 +MSGUSE .DB "Copyright (C) 2020, Wayne Warthen, GNU GPL v3",13,10 .DB "PTxPlayer Copyright (C) 2004-2007 S.V.Bulba",13,10 .DB "MYMPlay by Marq/Lieves!Tuore",13,10,13,10 .DB "Usage: TUNE .[PT2|PT3|MYM]",0 @@ -764,29 +783,10 @@ MSGDLY .DB ", delay mode",0 MSGPLY .DB "Playing...",0 MSGEND .DB " Done",0 ; -PLTSTR: - .DW 0 - .DW PLTSTR_SBC - .DW PLTSTR_ZETA - .DW PLTSTR_ZETA2 - .DW PLTSTR_N8 - .DW PLTSTR_MK4 - .DW PLTSTR_UNA - .DW PLTSTR_RCZ80 - .DW PLTSTR_RCZ180 - .DW PLTSTR_EZZ80 - .DW PLTSTR_SCZ180 -; -PLTSTR_SBC .DB "SBC w/ SCG ECB Sound Card",0 -PLTSTR_ZETA .DB "Zeta -- Not Supported!!!",0 -PLTSTR_ZETA2 .DB "Zeta 2 -- Not Supported!!!",0 -PLTSTR_N8 .DB "N8 Onboard Sound System",0 -PLTSTR_MK4 .DB "Mark IV w/ SCG ECB Sound Card",0 -PLTSTR_UNA .DB "UNA -- Not Supported!!!",0 -PLTSTR_RCZ80 .DB "RC2014 Z80 w/ Sound Module (EB)",0 -PLTSTR_RCZ180 .DB "RC2014 Z180 w/ Sound Module (EB)",0 -PLTSTR_EZZ80 .DB "Easy Z80 w/ Sound Module (EB)",0 -PLTSTR_SCZ180 .DB "SC Z180 w/ Sound Module (EB)",0 +HWSTR_SCG .DB "SCG ECB Board",0 +HWSTR_N8 .DB "N8 Onboard Sound",0 +HWSTR_RCEB .DB "RC2014 Sound Module (EB)",0 +HWSTR_RCMF .DB "RC2014 Sound Module (MF)",0 ; ;=============================================================================== ; PTx Player Routines @@ -2172,7 +2172,7 @@ LOUT OUT (C),A #IF WBW DI CALL SLOWIO - LD DE,(CFG) ; D := RDAT, E := RSEL + LD DE,(PORTS) ; D := RDAT, E := RSEL XOR A ; start with reg 0 LD C,E ; point to address port LD HL,AYREGS ; start of value list @@ -2557,7 +2557,7 @@ upsg: ld a,(WMOD) ; if WMOD = 1, CPU is z180 call SLOWIO upsg1: ld hl,(psource) - ld de,(CFG) ; E := RSEL, D := RDAT + ld de,(PORTS) ; E := RSEL, D := RDAT xor a psglp: ld c,e ; C := RSEL @@ -2629,47 +2629,47 @@ HEAP .EQU $ VARS -ChanA .DS CHP -ChanB .DS CHP -ChanC .DS CHP +ChanA .DS CHP +ChanB .DS CHP +ChanC .DS CHP ;GlobalVars -DelyCnt .DS 1 -CurESld .DS 2 -CurEDel .DS 1 +DelyCnt .DS 1 +CurESld .DS 2 +CurEDel .DS 1 Ns_Base_AddToNs -Ns_Base .DS 1 -AddToNs .DS 1 +Ns_Base .DS 1 +AddToNs .DS 1 AYREGS -VT_ .DS 256 ;CreatedVolumeTableAddress +VT_ .DS 256 ;CreatedVolumeTableAddress -EnvBase .EQU VT_+14 +EnvBase .EQU VT_+14 -T1_ .EQU VT_+16 ;Tone tables data depacked here +T1_ .EQU VT_+16 ;Tone tables data depacked here -T_OLD_1 .EQU T1_ -T_OLD_2 .EQU T_OLD_1+24 -T_OLD_3 .EQU T_OLD_2+24 -T_OLD_0 .EQU T_OLD_3+2 -T_NEW_0 .EQU T_OLD_0 -T_NEW_1 .EQU T_OLD_1 -T_NEW_2 .EQU T_NEW_0+24 -T_NEW_3 .EQU T_OLD_3 +T_OLD_1 .EQU T1_ +T_OLD_2 .EQU T_OLD_1+24 +T_OLD_3 .EQU T_OLD_2+24 +T_OLD_0 .EQU T_OLD_3+2 +T_NEW_0 .EQU T_OLD_0 +T_NEW_1 .EQU T_OLD_1 +T_NEW_2 .EQU T_NEW_0+24 +T_NEW_3 .EQU T_OLD_3 -PT2EMPTYORN .EQU VT_+31 ;1,0,0 sequence +PT2EMPTYORN .EQU VT_+31 ;1,0,0 sequence -NT_ .FILL 192 ;CreatedNoteTableAddress +NT_ .DS 192 ;CreatedNoteTableAddress ;local var -Ampl .EQU AYREGS+AmplC +Ampl .EQU AYREGS+AmplC -VAR0END .EQU VT_+16 ;INIT zeroes from VARS to VAR0END-1 +VAR0END .EQU VT_+16 ;INIT zeroes from VARS to VAR0END-1 -VARSEND .EQU $ +VARSEND .EQU $ -MDLADDR .EQU $ +MDLADDR .EQU $ ; ;=============================================================================== ; MYM Player Storage @@ -2678,10 +2678,11 @@ MDLADDR .EQU $ .ORG HEAP ; Reserve room for uncompressed data uncomp: -.org $+(3*FRAG*REGS) + .DS (3*FRAG*REGS) ; The tune is stored here -rows: .dw 0 +rows: + .DS 2 ; WORD value data: ; ;=============================================================================== diff --git a/Source/BL/Build.cmd b/Source/BL/Build.cmd deleted file mode 100644 index 7b8c5353..00000000 --- a/Source/BL/Build.cmd +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -setlocal - -set TOOLS=../../Tools - -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% - -set TASMTABS=%TOOLS%\tasm32 - -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ - -tasm -t80 -g3 -fFF bl.asm bl.bin bl.lst diff --git a/Source/BL/Clean.cmd b/Source/BL/Clean.cmd deleted file mode 100644 index 23ffc7b3..00000000 --- a/Source/BL/Clean.cmd +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -setlocal - -if exist *.bin del *.bin -if exist *.lst del *.lst -if exist *.sys del *.sys diff --git a/Source/BPBIOS/@WBW Z3ENV.txt b/Source/BPBIOS/@WBW Z3ENV.txt index 0b8bb617..8c17e2ca 100644 --- a/Source/BPBIOS/@WBW Z3ENV.txt +++ b/Source/BPBIOS/@WBW Z3ENV.txt @@ -75,7 +75,7 @@ should be consulted to understand these. The build process used here produces several different configurations which can be loaded at runtime. The original distributed memory segment configuration occupies the top of memory which, unfortunately, conflicts with the RomWBW HBIOS need to -occupt this space. +occupy this space. Although RomWBW HBIOS is implemented in it's own dedicated memory bank, it requires a small proxy at the top of memory which acts as a mechansim to diff --git a/Source/BPBIOS/Build.cmd b/Source/BPBIOS/Build.cmd index db50c0d7..76a44e01 100644 --- a/Source/BPBIOS/Build.cmd +++ b/Source/BPBIOS/Build.cmd @@ -3,6 +3,8 @@ setlocal setlocal & cd ZCPR33 && call Build || exit /b 1 & endlocal +setlocal & cd Z34RCP11 && call Build || exit /b 1 & endlocal +setlocal & cd NZFCP13 && call Build || exit /b 1 & endlocal set PATH=%PATH%;..\..\Tools\zx;..\..\Tools\cpmtools; @@ -26,22 +28,22 @@ call :makebp 41nbnk rem pause -cpmrm.exe -f wbw_hd0 ../../Binary/hd0.img 0:ws*.* - -cpmrm.exe -f wbw_hd0 ../../Binary/hd0.img 0:*.img -cpmcp.exe -f wbw_hd0 ../../Binary/hd0.img *.img 0: - -cpmrm.exe -f wbw_hd0 ../../Binary/hd0.img 0:*.rel -cpmcp.exe -f wbw_hd0 ../../Binary/hd0.img *.rel 0: - -rem cpmrm.exe -f wbw_hd0 ../../Binary/hd0.img 0:*.dat -rem cpmcp.exe -f wbw_hd0 ../../Binary/hd0.img *.dat 0: - -cpmrm.exe -f wbw_hd0 ../../Binary/hd0.img 0:*.zex -cpmcp.exe -f wbw_hd0 ../../Binary/hd0.img *.zex 0: - -cpmrm.exe -f wbw_hd0 ../../Binary/hd0.img 0:myterm.z3t -cpmcp.exe -f wbw_hd0 ../../Binary/hd0.img myterm.z3t 0:myterm.z3t +rem cpmrm.exe -f wbw_hd0 ../../Binary/hd_bp.img 0:ws*.* +rem +rem cpmrm.exe -f wbw_hd0 ../../Binary/hd_bp.img 0:*.img +rem cpmcp.exe -f wbw_hd0 ../../Binary/hd_bp.img *.img 0: +rem +rem cpmrm.exe -f wbw_hd0 ../../Binary/hd_bp.img 0:*.rel +rem cpmcp.exe -f wbw_hd0 ../../Binary/hd_bp.img *.rel 0: +rem +rem rem cpmrm.exe -f wbw_hd0 ../../Binary/hd_bp.img 0:*.dat +rem rem cpmcp.exe -f wbw_hd0 ../../Binary/hd_bp.img *.dat 0: +rem +rem cpmrm.exe -f wbw_hd0 ../../Binary/hd_bp.img 0:*.zex +rem cpmcp.exe -f wbw_hd0 ../../Binary/hd_bp.img *.zex 0: +rem +rem cpmrm.exe -f wbw_hd0 ../../Binary/hd_bp.img 0:myterm.z3t +rem cpmcp.exe -f wbw_hd0 ../../Binary/hd_bp.img myterm.z3t 0:myterm.z3t goto :eof diff --git a/Source/BPBIOS/Clean.cmd b/Source/BPBIOS/Clean.cmd index 62c3210f..5bcf9d9e 100644 --- a/Source/BPBIOS/Clean.cmd +++ b/Source/BPBIOS/Clean.cmd @@ -10,3 +10,5 @@ if exist zcpr33*.rel del zcpr33*.rel if exist *.bak del *.bak setlocal & cd ZCPR33 && call Clean.cmd & endlocal +setlocal & cd Z34RCP11 && call Clean.cmd & endlocal +setlocal & cd NZFCP13 && call Clean.cmd & endlocal diff --git a/Source/BPBIOS/Makefile b/Source/BPBIOS/Makefile index cad76b25..a5e31b8a 100644 --- a/Source/BPBIOS/Makefile +++ b/Source/BPBIOS/Makefile @@ -6,24 +6,24 @@ VERSIONS = \ 41tbnk 41nbnk HD0IMG = ../../Binary/hd0.img -OBJECTS = $(foreach ver,$(VERSIONS),bp$(ver).img) +IMGFILES = $(foreach ver,$(VERSIONS),bp$(ver).img) +DISTFILES = *.zex *.rel myterm.z3t + OTHERS = zcpr33n.rel zcpr33t.rel \ bpbio-ww.rel bpsys.dat bpsys.bak bpbio-ww.err def-ww.lib TOOLS = ../../Tools -CPMCP = $(TOOLS)/`uname`/cpmcp -IMGFILES = *.img *.rel *.zex myterm.z3t SUBDIRS = ZCPR33 include $(TOOLS)/Makefile.inc $(HD0IMG): $(IMGFILES) - $(CPMCP) -f wbw_hd0 $(HD0IMG) $(IMGFILES) 0: + $(CPMCP) -f wbw_hd0 $(HD0IMG) $(IMGFILES) $(DISTFILES) 0: zcpr33n.rel zcpr33t.rel: (cd ZCPR33 ; make install) -all:: $(OBJECTS) $(HD0IMG) +all:: $(HD0IMG) clobber:: rm -f $(HD0IMG) diff --git a/Source/BPBIOS/NZFCP13/Build.cmd b/Source/BPBIOS/NZFCP13/Build.cmd new file mode 100644 index 00000000..2c53cfd9 --- /dev/null +++ b/Source/BPBIOS/NZFCP13/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set PATH=%PATH%;..\..\..\Tools\zx;..\..\..\Tools\cpmtools; + +set ZXBINDIR=../../../tools/cpm/bin/ +set ZXLIBDIR=../../../tools/cpm/lib/ +set ZXINCDIR=../../../tools/cpm/include/ + +zx Z80ASM -nzfcp13/MF +rem zx ZMAC -nzfcp13.z80 -/P diff --git a/Source/BPBIOS/NZFCP13/Clean.cmd b/Source/BPBIOS/NZFCP13/Clean.cmd new file mode 100644 index 00000000..a088f4e8 --- /dev/null +++ b/Source/BPBIOS/NZFCP13/Clean.cmd @@ -0,0 +1,7 @@ +@echo off +setlocal + +if exist *.prn del *.prn +if exist *.lst del *.lst +if exist *.err del *.err +if exist *.rel del *.rel diff --git a/Source/BPBIOS/NZFCP13/fcp-4.zrl b/Source/BPBIOS/NZFCP13/fcp-4.zrl new file mode 100644 index 00000000..a6f2c9a2 Binary files /dev/null and b/Source/BPBIOS/NZFCP13/fcp-4.zrl differ diff --git a/Source/BPBIOS/NZFCP13/fcp-4t.zrl b/Source/BPBIOS/NZFCP13/fcp-4t.zrl new file mode 100644 index 00000000..8d3cb48c Binary files /dev/null and b/Source/BPBIOS/NZFCP13/fcp-4t.zrl differ diff --git a/Source/BPBIOS/NZFCP13/fcp-5.zrl b/Source/BPBIOS/NZFCP13/fcp-5.zrl new file mode 100644 index 00000000..a2456212 Binary files /dev/null and b/Source/BPBIOS/NZFCP13/fcp-5.zrl differ diff --git a/Source/BPBIOS/NZFCP13/fcp-5t.zrl b/Source/BPBIOS/NZFCP13/fcp-5t.zrl new file mode 100644 index 00000000..eb94964c Binary files /dev/null and b/Source/BPBIOS/NZFCP13/fcp-5t.zrl differ diff --git a/Source/BPBIOS/NZFCP13/fcp-6.zrl b/Source/BPBIOS/NZFCP13/fcp-6.zrl new file mode 100644 index 00000000..6aa1aea9 Binary files /dev/null and b/Source/BPBIOS/NZFCP13/fcp-6.zrl differ diff --git a/Source/BPBIOS/NZFCP13/fcp-6t.zrl b/Source/BPBIOS/NZFCP13/fcp-6t.zrl new file mode 100644 index 00000000..b75fbfb7 Binary files /dev/null and b/Source/BPBIOS/NZFCP13/fcp-6t.zrl differ diff --git a/Source/BPBIOS/NZFCP13/fcp-7t.zrl b/Source/BPBIOS/NZFCP13/fcp-7t.zrl new file mode 100644 index 00000000..8a12be09 Binary files /dev/null and b/Source/BPBIOS/NZFCP13/fcp-7t.zrl differ diff --git a/Source/BPBIOS/NZFCP13/nzfcp.doc b/Source/BPBIOS/NZFCP13/nzfcp.doc new file mode 100644 index 00000000..1eb1b0ab --- /dev/null +++ b/Source/BPBIOS/NZFCP13/nzfcp.doc @@ -0,0 +1,89 @@ + Z-Relocatable Flow Control Packages + 11 October 89 by Carson Wilson + +The seven pre-compiled Flow Control Packages (FCP's) in this library may be +loaded directly to Z System with NZ-COM, Z3PLUS, or JetLDR, provided +sufficient space has been allocated to the FCP segment. The FCP's come in two +flavors. Files named FCP-nT.ZRL implement extended flow control processing +when needed using a program named IF.COM at the root of your path, or at +directory A0 if there is no path. Files named simply FCP-n.ZRL rely +exclusively on memory-based processing. The "n" in the filename indicates the +total number of records required by each package. The standard number of +records for both NZ-COM and Z3PLUS is currently 5, so if you wish to load a +larger FCP you must reconfigure your system with MKZCM or by editing your .Z3P +file. For general help with flow control commands, see the file IF.HLP, or +section 3.2.2 of your NZ-COM or Z3PLUS manual. + +While IF.COM allows options not available in memory-resident flow-control +processing, fully resident versions free the user from the requirement that +IF.COM be present during flow control processing. Resident processing is also +somewhat faster due to the need to load IF.COM from disk for each flow control +command. Finally, the ability to locate and load the transient IF.COM +requires considerable code space in the resident code itself. Generally, +IF.COM is best used on fixed-disk systems, while resident processing is more +suited to floppy-based systems. + +The options included in fully resident versions were selected somewhat +differently than those of those using IF.COM. Criteria, in order of +precedence, were as follows: + +Transient Versions Resident Versions +------------------ ----------------- +1. Is the feature available in 1. How useful is the feature? + IF.COM? 2. How much memory does the feature +2. Does the feature require disk require? + access? +3. How useful is the feature? +4. How much memory does the feature + require? + +The tables below summarize the size and features of each flavor of FCP. Each +package includes only the features appearing above it. For example, +FCP-5T.ZRL (the default FCP for both NZ-COM and Z3PLUS) contains only ZIF, +IFQ, OR, AND, negation, ERROR, and NULL. Size is expressed as records plus +remaining bytes required by the FCP. As FCP space is allocated in record +units only, I have attempted to include only combinations which leave as +little remaining space possible. Sizes without corresponding filenames are +included for reference purposes only. + +FEATURES OF TRANSIENT (IF.COM) FCPS SIZE(RECS+BYTES) FILE NAME +----------------------------------------------------------------------------- +ZIF - unconditionally clear IF states? +IFQ - show current if status? 3+124 FCP-4T.ZRL +OR - set state at current level? 4+25 +AND - reset state at current level? +Allow negation of conditions? +ERROR - test program error flag? +NULL - test for no file name? 4+84 FCP-5T.ZRL +REG - test register values? 5+16 +AMBIG - test for "?" in file spec? +COMPR - test for compressed filespec? += - test tokens for equality? 5+92 FCP-6T.ZRL +INPUT - test user input? 6+25 +Allow "IF T" and "IF F" forms? +WHEEL - test wheel byte? +TCAP - test whether TCAP loaded? +EXIST - test for file existence? 6+106 FCP-7T.ZRL +EMPTY - test files for contents? 7+10 + + +FEATURES OF RESIDENT FCPS SIZE(RECS+BYTES) FILE NAME +----------------------------------------------------------------------------- +ZIF - unconditionally clear IF states? +IFQ - show current if status? +OR - set state at current level? +AND - reset state at current level? +Allow negation of conditions? +NULL - test for no file name? +INPUT - test user input? += - test tokens for equality? +ERROR - test program error flag? +Allow "IF T" and "IF F" forms? +EXIST - test for file existence? 3+123 FCP-4.ZRL +AMBIG - test for "?" in file spec? +COMPR - test for compressed filespec? +REG - test register values? +WHEEL - test wheel byte? +TCAP - test whether TCAP loaded? 4+113 FCP-5.ZRL +EMPTY - test files for contents? 5+17 FCP-6.ZRL + \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/nzfcp.lib b/Source/BPBIOS/NZFCP13/nzfcp.lib new file mode 100644 index 00000000..db55f33f --- /dev/null +++ b/Source/BPBIOS/NZFCP13/nzfcp.lib @@ -0,0 +1,161 @@ +; Module: NZFCP.LIB +; Author: Carson Wilson +; Version: 1.3 +; Date: 9 Oct 89 +; Changes: Prompts for options if SLR true. + +; This module is a set of configuration options for the flow control package +; code in NZFCP.Z80. The options are not fully commented here; see +; "ZCPR3, The Manual" for a detailed discussion of most of them. + + +; * * * * * * N O T I C E * * * * * * +; +; The main code in Z33FCP.Z80 has been written with relative jump instructions +; for minimum code size. If the options below are changed, then some of the +; jumps may become out-of-range. You will then have to change the code based +; on the error messages you get from your assembler. I cannot think of any +; way to handle the jumps automatically (macros fail because the jump distances +; cannot be resolved fully even in two passes of the assembler). If you want +; to play things really safe, you can do a global search and replace to change +; all occurrences of the JR instruction to JP (but note that this change is +; irreversible). I prefer to live with this nuisance so that I can get the +; most out of the code. +; +; Another possible way to clear up a problem with a relative jump that is out +; of range is to take the block of code with the labels IFCTRUE and IFCFALSE +; and move it up or down in the code. It is placed somewhere in the middle of +; the resident options, so that the options can reach those entry points with +; a relative jump. You should try to place that code near the middle of the +; options which you have enabled. +; +; Jay Sage (May 17, 1987) + +;============================================================================= +; +; M A C R O S +; +;============================================================================= + +; SLR assemblers allow selection of options during assembly. + +SLR equ no + + if SLR + +y equ yes +n equ no + +select macro option default comment + .accept comment,option ; Prompt user for selection + endm + + .printx + .printx Answer "Y" to include, "N" to exclude commands: + .printx + + else + +select macro option default comment +option equ default ; Use selections from file + endm + endif ; SLR + +; ------------------------------------------------------------------------- + +; Command names + +; The CTABLE macro, which constructs the command dispatch table, includes a +; line for each command, the first parameter of which is the name of the +; command. These names may be changed if you wish. But make sure that you +; do not use a name that is longer than the maximum allowed length. If you +; do, the name will be truncated and a nonfatal error will occur during +; assembly. DO NOT CHANGE ANY PARAMETER OTHER THAN THE COMMAND NAME. Lower +; case letters will be converted to upper case. The macro COMMAND is defined +; in Z34MAC.LIB. + +cmdsize equ 4 ; Maximum length of command names + +; Command table name, enable, wheel, jump_addr + ; [ DO NOT CHANGE THESE PARAMETERS ] +ctable macro +ifcmd: command if, yes, no, ifstart + command and, andopt, no, andstart + command or, oropt, no, orstart + command else, yes, no, ifelse + command fi, yes, no, ifend + command ifq, ifqopt, no, ifstat0 + command xif, yes, no, ifexit + command zif, zifopt, no, ifzero + endm + +;----------------------------------------------------------------------------- + +; General configuration options + +NOISE equ no ; Don't display if-state messages + +select COMIF no 'Enable transient IF processing? ' + +PATHROOT equ yes ; Find transient IF in root of path + +ifdrv equ 'A' ; Drive to use if PATHROOT is off or + ; ..if the path is empty +ifusr equ 0 ; User to use if PATHROOT is off or + ; ..if the path is empty + +; --------------------------------------------------------------------- + +; Command inclusion options + +select ZIFOPT yes 'ZIF - unconditionally clear IF states? ' +select IFQOPT yes 'IFQ - show current if status? ' +select OROPT yes 'OR - set state at current level? ' +select ANDOPT yes 'AND - reset state at current level? ' + +;----------------------------------------------------------------------------- + +; If Condition Options + + if COMIF ; Different precedence if transient IF available. +select IFONEG yes 'Allow negation of conditions? ' +negchar equ '~' ; Character to use if negation allowed +select IFOERROR yes 'ERROR - test program error flag? ' +select IFONULL yes 'NULL - test for no file name? ' +select IFOREG yes 'REG - test register values? ' +select IFAMBIG yes 'AMBIG - test for "?" in file spec? ' +select IFCOMPR yes 'COMPR - test for compressed filespec? ' +select IFOEQ yes '= - test tokens for equality? ' +select IFOINPUT yes 'INPUT - test user input? ' +XEQOPT equ yes ; Test only first token for equal sign +select IFOTRUE yes 'Allow "IF T" and "IF F" forms? ' +select IFOWHEEL no 'WHEEL - test wheel byte? ' +select IFOTCAP no 'TCAP - test whether TCAP loaded? ' +select IFOEXIST yes 'EXIST - test for file existence? ' +select IFOEMPTY yes 'EMPTY - test files for contents? ' + else +select IFONEG yes 'Allow negation of conditions? ' +negchar equ '~' ; Character to use if negation allowed +select IFONULL yes 'NULL - test for no file name? ' +select IFOINPUT yes 'INPUT - test user input? ' +select IFOEQ yes '= - test tokens for equality? ' +XEQOPT equ yes ; Test only first token for equal sign +select IFOERROR yes 'ERROR - test program error flag? ' +select IFOTRUE yes 'Allow "IF T" and "IF F" forms? ' +select IFOEXIST yes 'EXIST - test for file existence? ' +select IFAMBIG no 'AMBIG - test for "?" in file spec? ' +select IFCOMPR no 'COMPR - test for compressed filespec? ' +select IFOREG no 'REG - test register values? ' +select IFOWHEEL no 'WHEEL - test wheel byte? ' +select IFOTCAP no 'TCAP - test whether TCAP loaded? ' +select IFOEMPTY no 'EMPTY - test files for contents? ' + endif ; COMIF + +; Miscellaneous configuration information + +curusr equ z3msg+2eh ; Current logged user address +curdr equ z3msg+2fh ; Current logged drive address +curint equ '$' ; Path symbol for current drive/user + +; END of NZFCP.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/nzfcp.lib.sav b/Source/BPBIOS/NZFCP13/nzfcp.lib.sav new file mode 100644 index 00000000..18f557f8 --- /dev/null +++ b/Source/BPBIOS/NZFCP13/nzfcp.lib.sav @@ -0,0 +1,161 @@ +; Module: NZFCP.LIB +; Author: Carson Wilson +; Version: 1.3 +; Date: 9 Oct 89 +; Changes: Prompts for options if SLR true. + +; This module is a set of configuration options for the flow control package +; code in NZFCP.Z80. The options are not fully commented here; see +; "ZCPR3, The Manual" for a detailed discussion of most of them. + + +; * * * * * * N O T I C E * * * * * * +; +; The main code in Z33FCP.Z80 has been written with relative jump instructions +; for minimum code size. If the options below are changed, then some of the +; jumps may become out-of-range. You will then have to change the code based +; on the error messages you get from your assembler. I cannot think of any +; way to handle the jumps automatically (macros fail because the jump distances +; cannot be resolved fully even in two passes of the assembler). If you want +; to play things really safe, you can do a global search and replace to change +; all occurrences of the JR instruction to JP (but note that this change is +; irreversible). I prefer to live with this nuisance so that I can get the +; most out of the code. +; +; Another possible way to clear up a problem with a relative jump that is out +; of range is to take the block of code with the labels IFCTRUE and IFCFALSE +; and move it up or down in the code. It is placed somewhere in the middle of +; the resident options, so that the options can reach those entry points with +; a relative jump. You should try to place that code near the middle of the +; options which you have enabled. +; +; Jay Sage (May 17, 1987) + +;============================================================================= +; +; M A C R O S +; +;============================================================================= + +; SLR assemblers allow selection of options during assembly. + +SLR equ yes + + if SLR + +y equ yes +n equ no + +select macro option default comment + .accept comment,option ; Prompt user for selection + endm + + .printx + .printx Answer "Y" to include, "N" to exclude commands: + .printx + + else + +select macro option default comment +option equ default ; Use selections from file + endm + endif ; SLR + +; ------------------------------------------------------------------------- + +; Command names + +; The CTABLE macro, which constructs the command dispatch table, includes a +; line for each command, the first parameter of which is the name of the +; command. These names may be changed if you wish. But make sure that you +; do not use a name that is longer than the maximum allowed length. If you +; do, the name will be truncated and a nonfatal error will occur during +; assembly. DO NOT CHANGE ANY PARAMETER OTHER THAN THE COMMAND NAME. Lower +; case letters will be converted to upper case. The macro COMMAND is defined +; in Z34MAC.LIB. + +cmdsize equ 4 ; Maximum length of command names + +; Command table name, enable, wheel, jump_addr + ; [ DO NOT CHANGE THESE PARAMETERS ] +ctable macro +ifcmd: command if, yes, no, ifstart + command and, andopt, no, andstart + command or, oropt, no, orstart + command else, yes, no, ifelse + command fi, yes, no, ifend + command ifq, ifqopt, no, ifstat0 + command xif, yes, no, ifexit + command zif, zifopt, no, ifzero + endm + +;----------------------------------------------------------------------------- + +; General configuration options + +NOISE equ no ; Don't display if-state messages + +select COMIF no 'Enable transient IF processing? ' + +PATHROOT equ yes ; Find transient IF in root of path + +ifdrv equ 'A' ; Drive to use if PATHROOT is off or + ; ..if the path is empty +ifusr equ 0 ; User to use if PATHROOT is off or + ; ..if the path is empty + +; --------------------------------------------------------------------- + +; Command inclusion options + +select ZIFOPT yes 'ZIF - unconditionally clear IF states? ' +select IFQOPT yes 'IFQ - show current if status? ' +select OROPT yes 'OR - set state at current level? ' +select ANDOPT yes 'AND - reset state at current level? ' + +;----------------------------------------------------------------------------- + +; If Condition Options + + if COMIF ; Different precedence if transient IF available. +select IFONEG yes 'Allow negation of conditions? ' +negchar equ '~' ; Character to use if negation allowed +select IFOERROR yes 'ERROR - test program error flag? ' +select IFONULL yes 'NULL - test for no file name? ' +select IFOREG yes 'REG - test register values? ' +select IFAMBIG yes 'AMBIG - test for "?" in file spec? ' +select IFCOMPR yes 'COMPR - test for compressed filespec? ' +select IFOEQ yes '= - test tokens for equality? ' +select IFOINPUT yes 'INPUT - test user input? ' +XEQOPT equ yes ; Test only first token for equal sign +select IFOTRUE yes 'Allow "IF T" and "IF F" forms? ' +select IFOWHEEL no 'WHEEL - test wheel byte? ' +select IFOTCAP no 'TCAP - test whether TCAP loaded? ' +select IFOEXIST yes 'EXIST - test for file existence? ' +select IFOEMPTY yes 'EMPTY - test files for contents? ' + else +select IFONEG yes 'Allow negation of conditions? ' +negchar equ '~' ; Character to use if negation allowed +select IFONULL yes 'NULL - test for no file name? ' +select IFOINPUT yes 'INPUT - test user input? ' +select IFOEQ yes '= - test tokens for equality? ' +XEQOPT equ yes ; Test only first token for equal sign +select IFOERROR yes 'ERROR - test program error flag? ' +select IFOTRUE yes 'Allow "IF T" and "IF F" forms? ' +select IFOEXIST yes 'EXIST - test for file existence? ' +select IFAMBIG yes 'AMBIG - test for "?" in file spec? ' +select IFCOMPR yes 'COMPR - test for compressed filespec? ' +select IFOREG yes 'REG - test register values? ' +select IFOWHEEL no 'WHEEL - test wheel byte? ' +select IFOTCAP no 'TCAP - test whether TCAP loaded? ' +select IFOEMPTY yes 'EMPTY - test files for contents? ' + endif ; COMIF + +; Miscellaneous configuration information + +curusr equ z3msg+2eh ; Current logged user address +curdr equ z3msg+2fh ; Current logged drive address +curint equ '$' ; Path symbol for current drive/user + +; END of NZFCP.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/nzfcp13.for b/Source/BPBIOS/NZFCP13/nzfcp13.for new file mode 100644 index 00000000..40fb0c2c --- /dev/null +++ b/Source/BPBIOS/NZFCP13/nzfcp13.for @@ -0,0 +1,9 @@ +Source code plus the compiled Flow Control Packages (FCP's) +distributed in FCP.LBR as part of the Z System. The precompiled +modules are in Z-Relocatable form, and must be loaded with JetLDR, +NZCOM, or Z3PLUS. Now features interactive assembly of code +a-la-Z34RCP11 under the SLR or ZMAC assemblers. Macro now reports +length of resulting FCP in records and bytes following assembly. +JetLDR signons also automatically generated. 9/15/90 Carson Wilson + + \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/nzfcp13.z80 b/Source/BPBIOS/NZFCP13/nzfcp13.z80 new file mode 100644 index 00000000..fe700554 --- /dev/null +++ b/Source/BPBIOS/NZFCP13/nzfcp13.z80 @@ -0,0 +1,1424 @@ + +; Program: NZFCP +; Date: October 9, 1989 +; Author: Carson Wilson +; Version: 1.3 +; Changes: Updated & improved JetLDR signon. +; Changed four JR's to JP's. + +; Date: August 21, 1988 +; Author: Carson Wilson +; Version: 1.2 + +; Derived from: + +; Date: April 1988 +; Name changed and code modified for NZ-COM. + +; Derived from: + +; PROGRAM: Z34FCP +; AUTHOR: Jay Sage +; VERSION: 1.0 +; DATE: May 25, 1987 +; DERIVATION: FCP10 by Jay Sage (ZSIG) + +; ZCPR34 is copyright 1987 by Jay P. Sage. All rights reserved. End-user +; distribution and duplication permitted for non-commercial purposes only. +; Any commercial use of ZCPR34, defined as any situation where the duplicator +; recieves revenue by duplicating or distributing ZCPR34 by itself or in +; conjunction with any hardware or software product, is expressly prohibited +; unless authorized in writing by Jay P. Sage. + +;============================================================================= +; +; R E V I S I O N H I S T O R Y +; +;============================================================================= +; +; 21 Aug 88 Added JetLDR signon description. +; IF IN now prints ' (Y/N)? ', and accepts only Y or y or +; N or n. +; Added macro code to show FCP length following assembly. +; +; Carson Wilson. +; +; 6 April 88 Handles latest Type 4 IF.COM +; 1.2 Changed command tail loader to accept :IF. Joe Wright +; +; 12/31/87 Modified for use with Z34CMN.LIB for NZ-COM. Joe Wright. +; 1.1 +; +; 05/25/87 Created ZCPR33 version from the code I released through ZSIG. +; 1.0 This code differs only in the more efficient way in which it +; determines if it was invoked with a directory prefix that +; signals that the transient IF.COM should be used to process +; the IF command. This permits the user to force the use of a +; more powerful option processor in the transient IF.COM than in +; the resident code. Option bytes were added after the end of +; the resident option dispatch table so that SHOW can report +; configuration options to the user. +; +; FCP10 notes +; +; The transient processor can now be loaded at an address other +; than 100h so as not to interfere with code loaded in the TPA. +; Then the GO command can normally be used even after IF.COM is +; used to process the flow test. If the LOADCHK equate +; is true then the FCP will verify that the transient +; processor has been loaded to the page in memory for which +; it was assembled. If loaded to the wrong page, it will +; be reloaded to the correct one. +; +; The test for the form ARG1=ARG2 was tightened up so as not to +; be confused by an equal sign in some later part of the command +; tail (e.g., "IF REG 1 = 2"). Now only the first token +; (contiguous string of characters) is checked. This extra code +; is under the control of the XEQOPT equate. The only option +; that is still a problem is the COMIF form '~='. Since the '=' +; is in the first token, this 'not equal' condition cannot be +; distinguished from an equality test against the character '~'. +; The solution is to turn off equality testing in the resident FCP +; or to use the alternative COMIF options 'NE' or '~EQ' for this +; test. +; +; Added optional commands AND and OR. These work like IF except +; that they affect the current IF level rather than going one +; level deeper. +; +; Added optional command ZIF to zero out all IF states no matter +; whether current state is true or false (XIF only works if state +; is true. +; +; Added new optional command IFQ (if-query) and enhanced the +; IFSTAT code that is invoked when the NOISE equate is true. +; In both cases, the entire tree of IF states is now shown, +; starting with the current level. For example, IFQ might result +; in the display "IF FTT" (we are at third IF level and it is +; false; the second and first IF levels are true). If the +; current IF level is 0, then the display is "IF None". +; +; Added two new resident options: AMBIGUOUS (AM) returns true if +; the file specification in the second token has a '?' (or '*') +; in it; COMPRESSED (CO) returns true if the file specificaton in +; the second token has a 'Z' or a 'Q' in the second character of +; the file type. +; +; Howard Goldstein contributed significantly to the development +; of this code. Bridger Mitchell also offered helpful +; suggestions. +; +; Jay Sage +; +; Notes from earlier SYSFCP revisions +; +; 09/12/85 Fixed bug in my code used when IF.COM is found in a specified +; drive/user area. The values of CDISK and CUSER were not being +; set, and as a result the user was not returned to the correct +; directory. The EXIST and EMPTY tests did not work correctly +; unless a DIR: or DU: was given explicitly with each file name. +; Jay Sage + +; 08/29/85 Reorganized code so that COMIF code handles only those +; options not in the table of local IF functions. Also changed +; code to allow searching for IF.COM in a specified directory +; instead of using the ROOT of the path. Also renamed macros +; to make code ZAS compatible. +; Jay Sage + +; 07/21/85 Corrected reversed sensing of program error flag in the +; IF ERROR test. +; Jay Sage + +; 01/02/85 Revised to correct a bug in the IF EMPTY test. First, the +; current record byte was not being set to zero before trying +; to read from the file. Secondly, the test for error was not +; testing for FF but for 00. My BDOS does not return 0 for +; success. It seems to return 00, 01, 02, or 03. This made the +; file appear to be empty. +; Jay Sage + + +;============================================================================= +; +; M A C R O S A N D E Q U A T E S +; +;============================================================================= + + name ('FCP') + +; External macro references + + maclib Z34CMN.LIB ; Source of system addresses + maclib NZFCP.LIB ; Source of configuration options + maclib Z34MAC.LIB ; Z34 macros + +; Equates section + +version equ 13 + +lf equ 0ah +cr equ 0dh +bell equ 07h + +base equ 0 +wboot equ base+0000h ; CP/M warm boot address +udflag equ base+0004h ; User num in high nybble, disk in low +bdos equ base+0005h ; BDOS function call entry point +tfcb equ base+005ch ; Default FCB buffer +fcb1 equ tfcb ; 1st and 2nd FCBs +fcb2 equ tfcb+16 +tbuff equ base+0080h ; Default disk I/O buffer +tpa equ base+0100h ; Base of TPA + + +;============================================================================= +; +; J e t L D R S I G N - O N +; +;============================================================================= + +; This prints an extended ID message upon loading with JetLDR. +; These are NOT the command names. + + COM /_ID_/ + + db 'Copyright 1989 ZSA',cr,lf + db 'Commands:',cr,lf + db ' IF ELSE FI XIF ' + + if andopt + db 'AND ' + endif + if oropt + db 'OR ' + endif + if ifqopt + db 'IFQ ' + endif + if zifopt + db 'ZIF ' + endif + + db cr,lf,'Options' + if ifoneg + db ' (use "',negchar,'" to negate)' + endif + if noise + db '; (noise)' + endif + db ':',cr,lf + + if ifotrue + db ' T F ' + endif + if ifambig + db 'AMbig ' + endif + if ifcompr + db 'COmpr ' + endif + if ifoempty + db 'EMpty ' + endif + if ifoeq + db 'x=y ' + endif + if ifoerror + db 'ERror ' + endif + if ifoexist + db 'EXist ' + endif + if ifoinput + db 'INput ' + endif + if ifonull + db 'NUll ' + endif + if iforeg + db 'REgs ' + endif + if ifotcap + db 'TCap ' + endif + if ifowheel + db 'WHeel ' + endif + + if comif + db cr,lf,' Use ' + if pathroot + db 'root:' + endif + db 'IF.COM' + endif + + db 0 ; End of JetLDR sign-on message + + CSEG + +;============================================================================= + +; Start of code + +start: + db 'Z3FCP' ; Flag for Package Loader + +;============================================================================= +; +; C O M M A N D T A B L E +; +;============================================================================= + +; The command name table is structured as follows: +; +; The first byte is the number of characters in each command name. +; Next come records consisting of command names followed by entry +; point addresses for the code to process the command. Finally, +; there is a null to indicate the end of the dispatch table. + + db cmdsize ; Size of text entries +ctab: ctable ; Macro defined in NZFCP.LIB + db 0 + +;============================================================================= +; +; I F C O N D I T I O N O P T I O N S +; +;============================================================================= + +condtab: + + if ifotrue + db 'T ' ; TRUE + dw ifctrue + db 'F ' ; FALSE + dw ifcfalse + endif ; ifotrue + + if ifambig ; Ambiguous file spec + db 'AM' + dw ifcambig + endif ; ifambig + + if ifcompr ; Squeezed or crunched + db 'CO' + dw ifccompr + endif ; ifcompr + + if ifoempty + db 'EM' ; File empty + dw ifcempty + endif ; ifoempty + + if ifoerror + db 'ER' ; Error message + dw ifcerror + endif ; ifoerror + + if ifoexist + db 'EX' ; File exists + dw ifcex + endif ; ifoexist + + if ifoinput + db 'IN' ; User input + dw ifcinput + endif ; ifoinput + + if ifonull + db 'NU' + dw ifcnull + endif ; ifonull + + if ifotcap ; Z3 TCAP available + db 'TC' + dw ifctcap + endif ; ifotcap + + if ifowheel ; Wheel Byte + db 'WH' + dw ifcwheel + endif ; ifowheel + + db 0 + +; Option bytes: these option bytes can be used to convey information to +; programs such as SHOW. The first one is used to reduce the chance of +; misinterpreting data from an earlier version of the FCP that does not +; have the option bytes. The next byte tells if COMIF has been activated +; and if the root of the path will be used as the directory in which to look +; for IF.COM. If PATHROOT is not selected (or if the path is empty), then +; the specified drive/user will be used. The overflow bit in case the user +; number is greater than 15 is kept in bit 2 of the second option byte. The +; combined user/drive value is kept in the third option byte. + +highuser defl ifusr gt 15 + +opt0: db 34h ; ZCPR34 version ID +opt1: optflag highuser,pathroot,comif +opt2: db ( ifusr and 0fh ) shl 4 + ( ifdrv - 'A' ) ; user/drive flag + +;============================================================================= +; +; C O M M A N D P R O C E S S I N G C O D E +; +;============================================================================= + +; Command: ZIF +; +; This command zeros out the IF system no matter what the current +; level IF state is. + + if zifopt + +ifzero: + if noise + call nl ; Print new line + endif ; noise + + jr ifexit1 + + endif ; zifopt + +;----------------------------------------------------------------------------- + +; Command: XIF +; +; If current IF state is true, XIF terminates all IFs, restoring a basic +; TRUE state. + +ifexit: + if noise + call nl ; Print new line + endif ; noise + + call iftest ; See if current IF is running and FALSE + + if noise + jr z,ifstat ; Abort with status message if so + else ; not noise + ret z ; Or just return if false + endif ; noise + +ifexit1: + ld hl,z3msg+1 ; Pt to IF flag + ld (hl),0 ; Zero IF flag + jr ifendmsg ; Print message + +;----------------------------------------------------------------------------- + +; Command: FI +; +; FI decrements to the previous IF level. It does this by shifting the +; current-if-bit in the first 'if' message in the Z3MSG buffer right one +; position. + +ifend: + if noise + call nl ; Print new line + endif ; noise + +; ld hl,z3msg+1 ; Point to IF flag +; ld a,(hl) ; Get it +; or a ; No IF active? + + call msgbf1 + dec hl ; Save a byte over the three lines above + + jr z,ifnderr + +ifendmsg: + if noise + call print + dc 'To ' ; Prefix to status display + endif ; noise + + srl (hl) ; Adjust active bit + + if noise + jr nz,ifstat ; Print status if IF still active + endif ; noise + +ifnderr: + if noise + + call print ; Print message + dc 'No ' + jp prif + + else ; not noise + + ret + + endif ; noise + +;----------------------------------------------------------------------------- + +; Command: ELSE +; +; ELSE complements the Active Bit for the Current IF provided the +; previous IF state was true. If the previous state was false, the +; command is flushed. +; +; This is accomplished according to the following algorithm. If the +; current IF is 0 (no IF) or 1 (one IF), then take the previous state +; to be true and perform the toggle. Otherwise, test the previous +; IF level condition and toggle only if it is true. + +ifelse: + if noise and (not ifqopt) + call nl ; Print new line + endif ; noise and (not ifqopt) + + call msgbf1 ; Get current if + ld b,a ; Save in B + srl a ; Back up if pointer bit to previous IF level + jr z,iftog ; If no previous IF level, go to toggle code + and (hl) ; Determine state of previous IF level + + if noise + if ifqopt + jr z,ifstat0 ; Print status on new line + else + jr z,ifstat ; If false, just print status + endif ; Ifqopt + else ; not noise + ret z ; Or simply return + endif ; noise + +iftog: + ld a,(hl) ; Get if-status message byte + xor b ; Flip current state + ld (hl),a ; Put result back in message byte + ; ..and fall thru to print status + + if not noise + ret + endif + +;----------------------------------------------------------------------------- + +; Indicate if current IF is True or False + +ifstat0: + call nl +ifstat: + call prif ; Print 'IF ' + call msgbf1 ; Get current if byte and set flags + ld b,a ; Get it into B + jr nz,ifstat1 ; Nz means if active + + call print + dc 'None' + ret + +ifstat1: + ld a,(hl) ; Get if-status message byte + and b ; Mask in currently active IF level status + ld c,'F' ; Load with false indicator + jr z,ifstat2 ; If current IF is false, jump + ld c,'T' ; Else, load with true indicator +ifstat2: + ld a,c + call conout + + srl b ; Drop one IF level + jr nz,ifstat1 ; Loop through all IF states + ret + +;------------------------- + +; Output CRLF + +nl: call print + dc cr,lf + ret + +;----------------------------------------------------------------------------- + +; Command: OR + +; This command performs a logical or operation by updating the +; if state without going to a new level. If there are active +; IFs and the current state is true, we do nothing. Else we back +; up one level and fall through to normal IF processing. + + if oropt + +orstart: + call msgbf1 ; Get if active byte + jr z,backup ; Treat like if if no IFs active + and (hl) ; Check current state + jr z,backup ; Current STATE false so go proecess + + if noise + jr ifstat0 ; Else return and show status + else + ret ; Or just return + + endif ; Noise + endif ; Oropt + +;----------------------------------------------------------------------------- + +; Command: AND + +; This command performs a logical and operation by updating the +; if state without going to a new level. If there are active +; IFs and the current state is false, we do nothing. Else we back +; up one level and fall through to normal IF processing. + + if andopt + +andstart: + call iftest ; Test for IF running and false + if noise + jr z,ifstat0 ; Condition met, show status & return + else + ret z ; Condition met, return + endif ; Noise + endif ; Andopt + +; Common stuff for and and or + + if andopt or oropt + +backup: + dec hl ; Pt to flag byte + srl (hl) ; Drop back one level +; +; Poke "IF" into external fcb for transient +; + if comif +pokefcb: + ld de,extfcb+1 ; Pt to external fcb + ld hl,ifcmd ; Pointer to IF command in table + ld bc,cmdsize ; Length + ldir ; Move it in + + endif ; comif + +; Fall through to IF PROCESSING + endif ;Andopt or oropt + +;----------------------------------------------------------------------------- + +; FCP Command: IF +; +; If current IF state is false, then advance to next level and set it +; to false also. If current IF state is true, then test condition and +; set the next level accordingly. + +ifstart: + if not ifqopt + + ld a,(extfcb) ; NZ if explicit + ld hl,tbuff + or (hl) + jp z,ifstat0 ; Report IF status + + endif ; not ifqopt + +ifstrt: + if noise + call nl ; Print new line + endif ; noise + + call iftest ; See if current IF is running and FALSE + jP z,ifcf ; Yes, do the right thing + +; Test for presence of colon in command. If colon present, then go directly +; to COMIF processing. + + if comif + ld a,(extfcb) ; Check drive byte of external FCB + or a ; If it is zero, no colon was present + jp nz,runcomif ; If colon, go to comif processing + ; Else fall through to resident processing + endif ; comif + +;----------------------------------------------------------------------------- +; +; R E S I D E N T C O M M A N D P R O C E S S I N G +; +;----------------------------------------------------------------------------- + +resident: + +; Test for Equality if Equal Sign in Token + + if ifoeq + + ld hl,tbuff+1 + + if xeqopt ; Extended equal testing + +skipsp: ; Skip over any space to first token + ld a,(hl) + or a ; Check for end of tail + jr z,ifck0 ; If so , go on + cp ' '+1 ; Test for space or control character + jr nc,tsteq ; If not, we are at first token + inc hl ; Otherwise advance to next character + jr skipsp ; ..and continue testing + + endif ; xeqopt + +tsteq: + ld a,(hl) ; Get character from command tail + inc hl ; Point to next one + or a ; EOL? + jr z,ifck0 ; Continue if so + + if xeqopt + cp ' '+1 ; End of token? + jr c,ifck0 ; If so, go on + endif ; xeqopt + + cp '=' ; Found '=' ? + jr nz,tsteq ; If not, continue scan + + ld hl,fcb1+1 ; Else, get ready to compare FCBs + ld de,fcb2+1 + ld b,11 ; 11 bytes +eqtest: + ld a,(de) ; Compare + cp (hl) + jr nz,ifcf + inc hl ; Pt to next + inc de + djnz eqtest + jr ifct + + endif ; ifoeq + + +ifck0: + ld de,fcb1+1 ; Point to first character in FCB1 + + if ifoneg + ld a,(de) ; Get it + ld (negflag),a ; Set negate flag + cp negchar ; Is it a negate? + jr nz,ifck1 ; If not, go on + inc de ; Else point to character after negchar +ifck1: + endif ; ifoneg + + if iforeg ; REGISTERS + call regtest ; Test for register value + jr nz,runreg + endif ; iforeg + + call condtest ; Test of condition match + jr nz,runcond ; If found, process condition + + if comif + jp runcomif ; If function not found in table, use transient + else + + call print ; Beep to indicate error + dc bell + + if noise + jp ifstat ; No condition, display current condition + else ; no noise + ret + endif ; noise + endif ; comif + +;----------------------------------------------------------------------------- +; +; Process register - register value is in A +; +;----------------------------------------------------------------------------- + + if iforeg +runreg: + push af ; Save value + call getnum ; Extract value in FCB2 as a number + pop af ; Get value + cp b ; Compare against extracted value + jr jrtrue ; True if match; false if not + endif ; iforeg + +;----------------------------------------------------------------------------- +; +; Process conditional test - address of conditional routine is in HL +; +;----------------------------------------------------------------------------- + +runcond: + jp (hl) ; "call" routine pted to by HL + +;============================================================================= +; +; R E S I D E N T C O N D I T I O N O P T I O N S +; +;============================================================================= + +; Condition: AMBIGUOUS + + if ifambig + +ifcambig: + ld hl,fcb2+1 ; Scan FCB2 for a '?' character + ld bc,11 ; Characters to scan + ld a,'?' ; Reference character + cpir + jr jrtrue ; True if '?' found; false if not + + endif ; ifambig + +;----------------------------------------------------------------------------- + +; Condition: COMPRESSED + + if ifcompr + +ifccompr: + ld a,(fcb2+10) ; Get middle character of file type + cp 'Z' ; Crunched + jr z,ifctrue + cp 'Q' ; Squeezed + jr jrtrue + + endif ; ifcompr + +;----------------------------------------------------------------------------- + +; Condition: TRUE +; IFCTRUE enables an active IF +; Condition: FALSE +; IFCFALSE enables an inactive IF + + if ifoempty or ifoerror or ifoexist or ifowheel +jrfalse: + jr z,ifcfalse + endif ; Ifoempty or ifoerror or ifoexist or ifowheel + +ifctrue: + + if ifoneg + call negtest ; Test for negate + jr z,ifcf + endif ; ifoneg + +ifct: + ld b,0ffh ; Active + jp ifset + + if iforeg or ifambig or ifcompr or ifoinput or ifonull +jrtrue: + jr z,ifctrue + endif ; Iforeg or ifambig or ifcompr or ifoinput or ifonull + +ifcfalse: + + if ifoneg + call negtest ; Test for negate + jr z,ifct + endif ; ifoneg + +ifcf: + ld b,0 ; Inactive + jp ifset + +;----------------------------------------------------------------------------- + +; Condition: EMPTY filename.typ + + if ifoempty +ifcempty: + call tlog ; Log into FCB2's DU + ld de,fcb2 ; Pt to fcb2 + ld c,15 ; Open file + push de ; Save fcb ptr + call bdos + pop de + inc a ; Not found? + jr z,ifctrue + ld c,20 ; Try to read a record + xor a ; set cr value to zero + ld (fcb2+32),a ; to attempt to read first record + call bdos + or a ; 0=OK + jr jrfalse ; true if no read + endif ; ifoempty + +;----------------------------------------------------------------------------- + +; Condition: ERROR + + if ifoerror +ifcerror: + ld a,(z3msg+6) ; Get error byte + or a ; 0=FALSE (no error registered) + jr jrfalse + endif ; ifoerror + +;----------------------------------------------------------------------------- + +; Condition: EXIST filename.typ + + if ifoexist +ifcex: + call tlog ; Log into DU + ld de,fcb2 ; Pt to fcb + ld c,17 ; Search for first + call bdos + inc a ; Set zero if error + jr jrfalse + endif ; Ifoexist + +;----------------------------------------------------------------------------- + +; Condition: INPUT (from user) + +; Modified to say " (Y/N)? ", and accept ONLY Y or y or N or n +; Carson Wilson 3/1/88 + + if ifoinput +ifcinput: + call print + dc ' (Y/N)? ' +ifcinp1: + ld hl,z3msg+7 ; Pt to ZEX message byte + ld (hl),10b ; Suspend ZEX input + push hl ; Save ptr to ZEX message byte +ifcinp2: + ld e,0ffh + ld c,6 ; Direct input from console + call bdos + or a ; Any input yet? + jr z,ifcinp2 ; Nope, try again + + pop hl ; Get ptr to ZEX message byte + ld (hl),0 ; Return ZEX to normal processing + and 5fh ; Mask and capitalize user input + cp 'Y' + jr nz,testN ; No, check if 'N' + call conout ; Display 'Y' + jr ifctrue ; Process as true +testN: + cp 'N' + jr nz,notN ; Not 'N' or 'n' + call conout ; Display 'N' + jr ifcfalse ; Process as false +notN: + ld a,bell ; Protest! + call conout + jr ifcinp1 ; Force either Y or y or N or n + + endif ; ifoinput + +;----------------------------------------------------------------------------- + +; Condition: NULL (2nd file name) + + if ifonull +ifcnull: + ld a,(fcb2+1) ; Get first char of 2nd file name + cp ' ' ; Space = null + jr jrtrue + endif ; ifonull + +;----------------------------------------------------------------------------- + +; Condition: TCAP + + if ifotcap +ifctcap: + ld a,(z3env+80h) ; Get first char of Z3 TCAP Entry + cp ' '+1 ; Space or less = none + jP c,ifcfalse + jP ifctrue + endif ; ifotcap + +;----------------------------------------------------------------------------- + +; Condition: WHEEL + + if ifowheel +ifcwheel: + ld hl,(z3env+29h) ; Get address of wheel byte + ld a,(hl) ; Get byte + or a ; Test for true + jP jrfalse ; False if 0 + endif ; ifowheel + +;============================================================================= +; +; S U P P O R T R O U T I N E S +; +;============================================================================= + +; Convert chars in FCB2 into a number in B + + if iforeg +getnum: + ld b,0 ; Set number + ld hl,fcb2+1 ; Pt to first char +getn1: + ld a,(hl) ; Get char + inc hl ; Pt to next + sub '0' ; Convert to binary + ret c ; Done if error + cp 10 ; Range? + ret nc ; Done if out of range + ld c,a ; Value in C + ld a,b ; A=old value + add a,a ; *2 + add a,a ; *4 + add a,b ; *5 + add a,a ; *10 + add a,c ; Add in new digit value + ld b,a ; Result in B + jr getn1 ; Continue processing + endif ; iforeg + +;----------------------------------------------------------------------------- + +; Log into DU in FCB2 + + if ifoexist or ifoempty + +tlog: + ld a,(fcb2) ; Get disk + or a ; Current? + jr nz,tlog1 + ld c,25 ; Get disk + call bdos + inc a ; Increment for following decrement +tlog1: + dec a ; A=0 + ld e,a ; Disk in E + ld c,14 + call bdos + ld a,(fcb2+13) ; Pt to user + ld e,a + ld c,32 ; Set user + jp bdos + + endif ; ifoexist or ifoempty + +;----------------------------------------------------------------------------- + +; Test of Negate Flag = negchar + + if ifoneg +negtest: +negflag equ $+1 ; Pointer for in-the-code modification + ld a,0 ; 2nd byte is filled in + cp negchar ; Test for No + ret + endif ; ifoneg + +;----------------------------------------------------------------------------- + +; Test FCB1 against a single digit (0-9) +; Return with register value in A and NZ if so + + if iforeg +regtest: + ld a,(de) ; Get digit + sub '0' + jr c,zret ; Z flag for no digit + cp 10 ; Range? + jr nc,zret ; Z flag for no digit + ld hl,z3msg+30h ; Pt to registers + add a,l ; Pt to register + ld l,a + ld a,h ; Add in H + adc 0 + ld h,a + xor a ; Set NZ + dec a + ld a,(hl) ; Get register value + ret +zret: + xor a ; Set Z + ret + endif ; iforeg + +;----------------------------------------------------------------------------- + +; Test to see if a current IF is running and if it is FALSE +; If so, return with Zero Flag Set (Z) +; If not, return with Zero Flag Clear (NZ) +; Affect only HL and PSW + +iftest: + call msgbf1 ; Test for active IF + jr z,ifok ; No active IF + and (hl) ; Check active flag + ret z ; Return Z since IF running and FALSE +ifok: + or 255 ; Return NZ for OK + ret + +msgbf1: + ld hl,z3msg+1 ; Get IF active flag + ld a,(hl) + inc hl ; Pt to If status byte + or a ; Set z if no IF active + ret + +;----------------------------------------------------------------------------- + +; Test FCB1 against condition table (must have 2-char entries) +; Return with routine address in HL if match and NZ flag + +condtest: + ld hl,condtab ; Pt to table +condt1: + ld a,(hl) ; End of table? + or a + ret z + ld a,(de) ; Get char + cp (hl) ; Comppare entries + inc hl ; Pt to next + inc de + jr nz,condt2 + ld a,(de) ; Get 2nd char + cp (hl) ; Compare + jr nz,condt2 + inc hl ; Pt to address + ld a,(hl) ; Get address in HL + inc hl + ld h,(hl) + ld l,a ; HL = address + jr ifok ; Set NZ for OK +condt2: + inc hl ; Pt to next entry + inc hl ; Skip over addr + inc hl + dec de ; Pt to 1st char of condition + jr condt1 + +;----------------------------------------------------------------------------- + +; Turn on next IF level +; B register is 0 if level is inactive, 0FFH if level is active + +ifset: +; ld hl,z3msg+1 ; Get IF flag +; ld a,(hl) +; or a ; If no if at all, start 1st one + + call msgbf1 + dec hl + + jr z,ifset1 +ifset0: + add a,a ; Advance to next level + jr c,iferr ; Check for overflow (8 IFs max) + ld (hl),a ; Set IF byte + jr ifset2 +ifset1: + inc a ; A=1 + ld (hl),a ; Set 1st IF +ifset2: + ld d,a ; Get IF byte + and b ; Set interested bit + ld b,a + inc hl ; Pt to active flag + ld a,d ; Complement IF byte + cpl + and (hl) ; Mask in only uninterested bits + or b ; Mask in interested bit + ld (hl),a ; Save result + + if noise + jp ifstat ; Print status and exit + else + ret ; Or just exit + endif ; noise + +iferr: + call print ; Beep to indicate overflow + dc bell + ret + +;============================================================================= +; +; T R A N S I E N T I F P R O C E S S I N G +; +;============================================================================= + + + if comif + +runcomif: + +; First we have to find IF.COM + + ld bc,100h*(ifdrv-'A')+ifusr ; Values to use if null path + + if pathroot + + ld hl,(expath) ; Point to symbolic path (indirect) +fndroot: + ld a,(hl) ; Check for end of path + or a + jr z,froot2 ; If end, branch + +; Process Next Path Element + + cp curint ; Current disk/user symbol? + jr nz,froot0 ; If not, branch + ld a,(curdr) ; Get current disk + inc a ; Compensate for following decrement +froot0: + dec a ; Shift to range 0..15 + ld b,a ; Set disk + inc hl ; Point to user in path + ld a,(hl) ; Get user + cp curint ; Current drive/user symbol? + jr nz,froot1 ; If not, branch + ld a,(curusr) ; Get current user +froot1: + ld c,a ; Set user + inc hl ; Point to next element in symbolic path + jr fndroot + +; Done with Search - BC Contains ROOT DU (or specified DU if path is empty) + + endif ; pathroot + +froot2: + call logbc ; Log into IF.COM's directory + +; Try to Open File IF.COM + + ld de,extfcb ; Point to command FCB + xor a + ld (de),a ; Force current drive + ld c,15 ; Open file + call bdos + inc a + jr nz,ifload ; Branch if file found + +; IF.COM not found - process as IF F + +ifnotfnd: + call iferr ; Ring bell + call reset ; Return home + jp ifcf + +; Load File IF.COM + +ifload: + call defdma ; First record to tbuff + call readcmd ; Read 1st record from IF.COM + jr nz,ifnotfnd ; If eof, treat as if file not found + + ld (extfcb+32),a ; Start from scratch (record 0) + ld a,(tbuff+8) + cp 3 + jr c,ifnotfnd ; Only Types 3 and 4 are acceptable + + call loadif ; Load IF.COM and set IFADR appropriately +; +; Build the command tail at tbuff +; + ld de,tbuff ; Point DE to tbuff + push de ; Save it for later + ld hl,(z3msg+4) ; Points into MCL buffer +; +; Advance HL to first 'space' after IF or .IF or :IF +; +advsp: inc hl + ld a,(hl) + cp ' '+1 ; Carry if space or null + jr nc,advsp + + ld c,0 ; Clear a counter + +putt: inc de ; Advance tbuff pointer + ld a,(hl) ; From MCL + ld (de),a ; To tbuff + inc hl ; Advance MCL pointer + or a ; Check for null + jr z,putx ; End of command line + cp ';' ; Command separator + jr z,putx ; End of command + inc c ; Count it up + jr putt ; Next.. + +putx: xor a ; Get a null + ld (de),a ; Terminate the line in tbuff + pop hl ; Beginning of tbuff + ld (hl),c ; Character count +; +; Pick up the execution address for Type 3 or 4 +; + ld hl,(ifadr) ; Load address + ld a,(hl) ; First byte at load address + cp 0c7h ; Test for RST 0 + jr nz,runif ; Nope, execute it + ld (hl),0c3h ; Plug in a JP +; +; Arrive here to execute IF.COM +; +runif: ld hl,z3env ; Pass environment in HL + db 0c3h ; JP instruction +ifadr: dw 0 ; Load/Execution address of IF.COM + +; +; Load IF.COM +; +loadif: + ld hl,(tbuff+11) ; Type 3 load address + jr z,loada ; Load as Type 3 +; +; Assume Type 4 (or higher) +; + ld hl,extfcb+32 ; Point to CR of extfcb + ld (hl),2 ; Set up for record 2 + push hl ; Save the pointer + call readcmd ; Get it into tbuff + pop hl + jp nz,ifnotfnd ; Too short + ld (hl),a ; Record 0 again + ld hl,(tbuff+11) ; Size word + push hl ; Save it + call readcmd ; Read record 0 again + pop bc ; Size + ld de,(ccp) ; CCP start + ld hl,z3env + dec a ; Phony fullget flag + call tbuff+9 ; Call Type 4 loader + push hl ; Save load address + call readcmd ; Read record 1 to tbuff (point to record 2) + pop hl ; Load address +; +loada: ld (ifadr),hl ; Save it +; +; Load IF.COM to (HL) until end of file, reset DMA and DU and return +; +load: push hl ; Save loading address + call setdma ; According to HL + call readcmd ; Read a record from file + pop hl ; Get current loading address back + jr nz,reset ; End of file + ld de,128 ; Advance it by one record + add hl,de + jr load ; Back to read some more + +; Reset DMA and Current DU + +reset: call defdma + ld bc,(curusr) ; Return home + +; Log Into DU in BC + +logbc: ld e,b ; Set disk + push bc + ld c,14 ; Select disk + call bdos + pop bc + ld e,c ; Set user + ld c,32 ; Select user + jp bdos + + +; Set default DMA address + +defdma: ld hl,tbuff + +; Set DMA to address according to HL + +setdma: push hl ; Save it + ex de,hl ; To DE + ld c,26 ; Set DMA command + call bdos ; Do it + pop hl ; DMA address + ret + +; Read a record from file in EXTFCB + +readcmd: + ld de,extfcb + ld c,20 + call bdos + or a ; Set NZ if error (end of file) + ret + + endif ; comif + +;============================================================================= +; +; U T I L I T Y S U B R O U T I N E S +; +;============================================================================= + +; Print "IF " + +prif: + call print + dc 'IF ' + ret + +;----------------------------------------------------------------------------- + +; Print String (terminated in 0 or MSB Set) at Return Address + +print: + ex (sp),hl ; Get address + call print1 + ex (sp),hl ; Put address + ret + +; Print String (terminated by MSB Set) pted to by HL + +print1: + ld a,(hl) ; Done? + inc hl ; Pt to next + call conout ; Print char + or a ; Set msb flag (m) + ret m ; Msb terminator + jr print1 + +;----------------------------------------------------------------------------- + +; Console Output Routine + +conout: + push hl ; Save regs + push de + push bc + push af + and 7fh ; Clear msb + ld e,a ; Char in E + ld c,2 ; Output + call bdos + pop af ; Get regs + pop bc + pop de + pop hl + ret + +;============================================================================= +; +; Display current length in records +; +prtval macro m1,v1,m2,v2,m3 + .radix 10 + .printx m1 v1 m2 v2 m3 + endm + +length equ $ - start +recs equ length / 128 +bytes equ length mod 128 + + .printx + prtval ,%recs,,%bytes, + .printx + + end + +; End of NZFCP.Z80 + \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/z34cmn.lib b/Source/BPBIOS/NZFCP13/z34cmn.lib new file mode 100644 index 00000000..ad8c8cec --- /dev/null +++ b/Source/BPBIOS/NZFCP13/z34cmn.lib @@ -0,0 +1,105 @@ +; +; Library: Z34CMN.LIB +; Author: Carson Wilson +; Version: 1.2 +; Date: 16 June 1988 +; Changes: Renamed CRT0 to LINS for NZCOM compatibility. +; Added CUSR " " " + +; Author: Carson Wilson +; Version: 1.1 +; Date: 12 June 1988 +; Changes: Added CDRV for various Z34RCP commands. +; Added CRT0 for Z34RCP TYPE command. +; Added Z3TCAP and CLRSCR for Z34RCP CLS command. +; Added QUIET for ZCPR34 time in prompt. +; Added RSDMSG for ZCPR34 time in prompt. + +; Library: Z34CMN.LIB +; Author: Joe Wright +; Date: 23 March 1988 + +; As a replacement for Z3BASE.LIB, some usual equates. + +base equ 0 ; Base Page + +false equ 0 +true equ not false + +no equ false +yes equ true + +off equ false +on equ true + +; Named COMMON declarations start here. For compatibility, these +; are the same names used by Bridger Mitchell's JetLDR. + + common /_ENV_/ +z3env: ; Z3 Environment descriptor +z3envs equ yes ; There is one + +expath equ z3env+9 ; Address of External Path +expaths equ 10 ; Maximum 10 elements for MPATH + +rcp equ z3env+0ch ; Address of RCP +rcps equ yes ; Used as existence test, not size + +fcp equ z3env+12h ; Address of FCB +fcps equ yes ; Used as existence test, not size + +z3ndir equ z3env+15h ; Address of NDR +z3ndirs equ yes ; Used as existence test, not size + +quiet equ z3env+28h ; Quiet flag address + +z3whl equ z3env+29h ; Wheel byte address +z3whls equ yes ; There is a wheel + +lins equ z3env+33h ; CRT text lines address + +ccp equ z3env+3fh ; CCP entry +ccps equ z3env+41h ; Size + +dos equ z3env+42h ; DOS entry (+6) +doss equ z3env+44h ; Size + +bio equ z3env+45h ; BIO entry + +z3tcap equ z3env+80h ; TCAP address + +clrscr equ z3env+97h ; Clear screen string address + + common /_SSTK_/ +shstk: ; Top of Shell stack +shstks equ yes ; There is a shell stack + + common /_MSG_/ +z3msg: ; Message buffer +z3msgs equ yes ; There is one + +cusr equ z3msg+2eh ; Current user +cdrv equ z3msg+2fh ; Current drive + +rsdmsg equ z3msg+3ah ; Reserved bytes + + common /_FCB_/ +extfcb: ; External file control block +extfcbs equ yes ; There is one + + common /_MCL_/ +z3cl: ; Multiple command line +z3cls equ yes ; There is one + + common /_XSTK_/ +extstk: ; External stack +extstks equ yes ; There is one + + common /_BIOS_/ +bios: + + cseg ; Select Code Segment + +; End of Z34CMN.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/z34mac.lib b/Source/BPBIOS/NZFCP13/z34mac.lib new file mode 100644 index 00000000..8ab3ffbe --- /dev/null +++ b/Source/BPBIOS/NZFCP13/z34mac.lib @@ -0,0 +1,122 @@ + +; Z33MAC.LIB : Macros for use with ZCPR33 + +; General purpose macros + +putreg macro + push hl ; Save registers in order + push de + push bc + endm + +getreg macro + pop bc ; Restore registers in order + pop de + pop hl + endm + +swap macro + rrca ; Exchange nibbles + rrca + rrca + rrca + endm + +;---------------------------------------- + +; Macro for forming option bytes + +; This macro generates a byte with bits corresponding to up to 8 option +; flags. The bits are filled in the order of the parameters and are right +; justified in the byte. + +optflag macro f1,f2,f3,f4,f5,f6,f7,f8 + +flag defl 0 ;; initial value + + irp temp, + + if not nul temp +flag defl flag shl 1 + if temp +flag defl flag or 1 + endif ;;temp + endif ;;not nul temp + + endm ;; irp + + defb low flag + + endm ;; optflag + +;----------------------------------------------------------------------------- + +; Command table entry definition macro + +; Macro to form an entry for one command in the table. The first parameter is +; the name to be used for the command (no quotes); the second parameter is the +; flag that indicates whether or not the command is to be enabled; the third +; parameter is the wheel control flag; and the last parameter is the jump +; address to the code that carries out the command. The command names are +; automatically padded out to the correct length (they will be truncated and +; an error message will result if a command name is too long). The characters +; in the command name are automatically converted to upper case. + +command macro cmdname,enableflag,wheelflag,address + + if enableflag ;; Generate command only if enabled + +whlmask defl wheelflag ;; Initialize variables +count defl cmdsize ;; Initialize to size of each command name + + irpc char,cmdname ;; Repeat over letters in command name + +count defl count - 1 ;; Count down characters in name + + if [ count lt cmdsize ] + + ;; If character is lower case, convert to upper case + + if [ '&char' ge 'a' ] and [ '&char' le 'z' ] + + if whlmask + defb [ '&char' and 5fh ] + 80h + else ;;not whlmask + defb [ '&char' and 5fh ] + endif ;;whlmask + + else ;;not lower case + + if whlmask + defb '&char' + 80h ;; If controlled by wheel, set high bit + else ;;not whlmask + defb '&char' ;; If not restricted, leave high bit clear + endif ;;whlmask + + endif ;;lower case + + endif ;;[ count lt cmdsize ] + +whlmask defl false ;; Turn off high-bit setting after first char + + endm ;irpc + + ;; Pad command name with blanks + + if [ count gt cmdsize ] ;; If we underflowed + *** Command name "&cmdname" is too long / truncated *** + else + rept count + defb ' ' + endm + endif ;[ count gt cmdsize ] + + dw address ;; Dispatch address for command + + endif ;enable + + endm ;command + +; End Z33MAC.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/WW.Z3T b/Source/BPBIOS/WW.Z3T new file mode 100644 index 00000000..004cc957 Binary files /dev/null and b/Source/BPBIOS/WW.Z3T differ diff --git a/Source/BPBIOS/Z34RCP11/Build.cmd b/Source/BPBIOS/Z34RCP11/Build.cmd new file mode 100644 index 00000000..1323b95f --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set PATH=%PATH%;..\..\..\Tools\zx;..\..\..\Tools\cpmtools; + +set ZXBINDIR=../../../tools/cpm/bin/ +set ZXLIBDIR=../../../tools/cpm/lib/ +set ZXINCDIR=../../../tools/cpm/include/ + +rem zx Z80ASM -z34rcp11/MF +zx ZMAC -z34rcp11.z80 -/P diff --git a/Source/BPBIOS/Z34RCP11/Clean.cmd b/Source/BPBIOS/Z34RCP11/Clean.cmd new file mode 100644 index 00000000..a088f4e8 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/Clean.cmd @@ -0,0 +1,7 @@ +@echo off +setlocal + +if exist *.prn del *.prn +if exist *.lst del *.lst +if exist *.err del *.err +if exist *.rel del *.rel diff --git a/Source/BPBIOS/Z34RCP11/cledinst.com b/Source/BPBIOS/Z34RCP11/cledinst.com new file mode 100644 index 00000000..c26a3cf0 Binary files /dev/null and b/Source/BPBIOS/Z34RCP11/cledinst.com differ diff --git a/Source/BPBIOS/Z34RCP11/cledsave.com b/Source/BPBIOS/Z34RCP11/cledsave.com new file mode 100644 index 00000000..dde04bc1 Binary files /dev/null and b/Source/BPBIOS/Z34RCP11/cledsave.com differ diff --git a/Source/BPBIOS/Z34RCP11/nzrcp.z80 b/Source/BPBIOS/Z34RCP11/nzrcp.z80 new file mode 100644 index 00000000..52b844e3 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/nzrcp.z80 @@ -0,0 +1,3010 @@ + +; New Name: NZRCP.Z80 Joe Wright July 1987 + +; Program: Z34RCP +; Version: 1.0 +; Description: Resident Command Package (RCP) for ZCPR34 +; Author: Jay Sage +; Date: March 1, 1987 +; Derivation: SYSRCP (Richard Conn) and many other contributions + +; ZCPR34 is copyright 1987 by Jay P. Sage. All rights reserved. End-user +; distribution and duplication permitted for non-commercial purposes only. +; Any commercial use of ZCPR34, defined as any situation where the duplicator +; recieves revenue by duplicating or distributing ZCPR34 by itself or in +; conjunction with any hardware or software product, is expressly prohibited +; unless authorized in writing by Jay P. Sage. + +version equ 2 +subver equ 4 + +; Vers 2.4 - Add whlchk subroutine for indirect addressing of wheel byte. +; 4 Apr 88 - Fixed command list routines. +; Joe Wright - Inhibit SPOP if there is no shell. Allow shstks = 1. + +; Vers 2.3 - Reset command, after calling F37, jumps to 0. +; 22 Feb 88 + +; Vers 2.2 - Modified for use of Z34CMN.LIB and NZ-COM. +; 31 Dec 87 +; Joe Wright + + +; Vers 2.1 - R command uses ZRDOS function 37 to reset drives. +; 6 Sep 87 - WHL command changed, WHLQ disappears. +; Joe Wright - REG command expanded. Add REG E (program error byte) +; - SPOP command added. Pops the shell stack + +;============================================================================= +; +; D E F I N I T I O N S S E C T I O N +; +;============================================================================= + + name ('RCP') + + maclib z34cmn.lib ; Defines ZCPR system addresses + maclib z34defn.lib ; Defines offsets in Z34 command processor + maclib z34mac.lib ; Macros + maclib sysdef.lib ; Common logic, sys, ascii defines + maclib nzrcp.lib ; Defines command options + +;============================================================================= +; +; E N T R Y C O D E S E C T I O N +; +;============================================================================= + +start: + db 'Z3RCP' ; Package ID + + +;---------------------------------------- + +; Command table + + db cmdsize ; Length of each command name + cmdtbl ; Dispatch table from Z33RCP.LIB + db 0 ; Marks end of command jump table + + +;---------------------------------------- + +; Name of RCP + +; This block allows the 'H' command and/or the SHOW utility to display a name +; and version number for this RCP as well as the commands that are supported. + +rcpname: + idstring ; From macro in Z33RCP.LIB + +; Include only those code sections that are required. + +; include rcph ; 'H' help (command list) command + page + +; RCP-H.Z80 'H' Command + +;============================================================================= +; +; H E L P C O M M A N D +; +;============================================================================= + +; This command displays a list of all resident commands that are supported, +; including those in the CPR (command processor), RCP, and FCP. + +clist: + +; Print the CPR-resident command names + + if listcpr + + call print ; Print "CPR" + db lf + db 'CP','R'+80h +; + ld hl,(ccp) ; CCP location from Z3ENV + ld de,offcmd ; Offset to CPR command table + add hl,de + call cmdlist ; Display the list of commands + + endif ;listcpr + +; Print the FCP-resident command names + + if listfcp + + ld hl,(fcp) + ld a,h + or l + jr z,rcplist ; No FCP + + ld a,(hl) + or a + jr z,rcplist ; FCP removed + + call print ; Print header for FCP + db lf + db 'FC','P'+80h + ld de,5 + add hl,de ; Point to FCP command table + call cmdlist + + endif ;listfcp + +; Print the RCP-resident command names + +rcplist: + if listrcp + + call crlf ; Skip a line + ld hl,rcpname ; Print RCP name + call printhl + ld hl,start+5 ; Point to RCP command table + + else + + ret + + endif ;listrcp + + ; Fall through to CMDLIST + +;---------------------------------------- + +; Subroutine to display list of commands in a command table (code above +; falls through to this routine -- do not move it). The commands are +; displayed 5 per line with 8 character spaces allowed for each command +; (subject to equates below). + +cmdlist: + call crlf ; Start with new line + ld e,(hl) ; Get size of each command name into DE + ld d,0 + inc hl ; Point to name of first command + ld c,cmdsline ; Set names-per-line value + +cmdlist1: + ld a,(hl) ; Get first character of the command name + or a ; See if it is null + jr nz,cmdlist1a ; If not, continue + ld a,cmdsline ; See if we are already on a new line + cp c + call nz,crlf ; If not, skip a line + ret + +cmdlist1a: + if noshow ; Option to suppress wheel-limited cmds + rla ; Shift high bit of name into carry bit + jr nc,cmdlist2 ; If not restricted, go on + call whlchk ; Check wheel byte + jr nz,cmdlist2 ; If wheel set, continue as usual + add hl,de ; Otherwise skip this command + jr cmdlist5 + endif + +; Print leading spaces between names + +cmdlist2: + ld a,cmdspace ; Spacing between command names + sub e ; Less length of each command name + ld b,a + ld a,' ' +cmdlist3: + call conout + djnz cmdlist3 + +; Print name of command + + ld b,e ; Length of each name into B +cmdlist4: + ld a,(hl) ; Get command name character + call conout + inc hl ; Point to next + djnz cmdlist4 + + dec c ; Decrement count of names on this line + jr nz,cmdlist5 ; Branch if room for more names + call crlf ; Otherwise, end this line and + ld c,cmdsline ; ..reset count for another line of commands + +; Skip to next command name + +cmdlist5: + inc hl ; Skip jump vector + inc hl + jr cmdlist1 ; Back to process next name + +; End RCP-H.Z80 + +;============================================================================= +; +; P O P S H E L L S T A C K C O M M A N D +; +;============================================================================= + +; +; POP the Shell Stack +; + if spopon + +; Pop the shell stack + +spop: ld hl,(z3env+1eh) ; SHSTK (indirect) + ld a,h + or l + ret z ; No shell stack + + ex de,hl ; SHSTK to DE + ld hl,(z3env+20h) ; SHSTKS to L, SHSIZE to H + push hl ; Save SHSIZE + xor a ; Your basic null in A + ld b,l + dec b ; SHSTKS-1 in B + jr z,sp0a ; Clear one entry + + push de ; Save SHSTK + ld e,h ; SHSIZE to E + ld d,a ; Clear D + ld h,a ; Clear H.. + ld l,a ; ..and L +sp0: add hl,de ; Multiply SHSIZE*(SHSTKS-1) + djnz sp0 + ld b,h + ld c,l ; Length to BC + ex de,hl ; SHSIZE to HL + pop de ; Get SHSTK (destination) + add hl,de ; SHSTK+SHSIZE to HL (Source) + ldir + +sp0a: pop bc ; Get SHSIZE in B +sp1: ld (de),a ; Clear last entry + inc de + djnz sp1 + ret + endif ; SPOPON + + + if clson +; include rcpcls ; 'CLS' clear screen command + page + +; RCP-CLS.Z80 'CLS' Command + +;============================================================================= +; +; C L E A R S C R E E N C O M M A N D +; +;============================================================================= + +; Command: CLS +; Function: To clear the CRT screen +; Comments: The setting of the CLSTCAP equate determines whether this +; command uses the TCAP information or not. If not, it uses the +; clear-screen string passed in macro CLSSTR. That string should +; end with the high bit set. + +cls: + if clstcap ; If using TCAP for clear screen string + + ld a,(z3env+80h) ; Get beginning of tcap + cp ' '+1 ; See if blank or perhaps null + jr nc,cls1 ; If not, go to clear screen code + call print ; If blank, then give error message + db ' No TCA','P'+80h + ret + +cls1: ld hl,z3env+97h ; Point to beginning of clear screen string + jp printhl ; Display it + + else ; Not using tcap + + call print + clsstr ; String from Z33RCP.LIB + ret + + endif ;clstcap + +; End RCP-CLS.Z80 + + endif ;clson + + if reson +; include rcpr ; 'R' disk reset command + page + +; RCP-R.Z80 'R' command + +;============================================================================= +; +; D I S K R E S E T C O M M A N D +; +;============================================================================= + +; Command: RESET +; Function: Reset the disk system +; Comments: ZRDOS does not require a disk system reset when disks are +; changed, but directory programs will not show the correct +; size if this is not done. It is also good practice. Since +; no warm boot performed, the disk in drive A need not have the +; operating system on it. +; Ver 2.1 Now logs all drives off and forces fixed and ram disks to +; re-log. +reset: + if resmsg ; If displaying a reset message + call print ; Report action + dc ' Reset' + endif ;resmsg + + ld de,-1 ; All 16 drives + ld c,37 ; Disks reset ZRDOS function + call bdos + ld c,13 ; Reset disk system + jp bdos + +; End RCP-R.Z80 + + endif ;reson + + if tston +; include rcptst ; 'TST' error test command + page + +; RCP-TST.Z80 'TST' Command + +;============================================================================= +; +; E R R O R T E S T C O M M A N D +; +;============================================================================= + +; Command: TST +; Function: To set the message buffer program error flag based on +; error count reported by M80 or L80 +; Syntax: TST PN where PN is (at least) the first letter of M80 or L80 + +testerr: + +; Check for name of program to test + + ld a,(fcb1+1) ; Get first character in program name + + if testm80 + ld hl,m80f ; Preset for m80 test counts + ld de,m80w + cp 'M' + jr z,testcount + endif ; Testm80 + + if testf80 + ld hl,f80f + ld de,f80w + cp 'F' + jr z,testcount + endif ; Testf80 + +; If no match, give error message + + call print + db 'bad nam','e'+80h + +testcount: + ld a,(hl) ; Test first error count word + inc hl + or (hl) + ex de,hl ; Test second word + or (hl) + inc hl + or (hl) + ld hl,z3msg+6 ; Point to program error flag + ld (hl),0 ; Clear it + ret z ; If counts were zero, we are done + ld (hl),0ffh ; Else set the error flag + ret + +; End RCP-TST.Z80 + + endif ;tston + + if spaceon +; include rcpsp ; 'SP' space on disk command + page + +; RCP-SP.Z80 'SP' Command + +;============================================================================= +; +; D I S K S P A C E C O M M A N D +; +;============================================================================= + +; Command: SP +; Function: Shows space remaining on designated drive +; Syntax: SP [DIR:|DU:] +; Comments: This code can be called by several other RCP commands so that +; they can show the space remaining on the disk after their +; operation. + + if [erasp or cpsp or dirsp] +crspace: ; Used to call space after other subroutines + call crlf ; Start new line + endif ;[erasp or cpsp or dirsp] + +space: + ld a,(fcb1) ; Determine requested drive + or a ; If drive explicitly selected + jr nz,space1 ; ..then skip + + ld c,25 ; BDOS get current drive function + call bdos + inc a ; Shift to range 1..16 + +space1: + dec a ; Shift to range 0..15 + ld e,a ; Save in E for selecting disk below + add 'A' ; Convert to letter and + ld (seldrv),a ; save in message string below + ld c,14 ; BDOS select disk function + call bdos ; Not needed if no drive selected, but smallest + ; ..possible code size this way. + +; Here we extract the following disk parameter information from the disk +; parameter block (DPB): +; BLKSHF: block shift factor (1 byte) +; BLKMAX: max number of blocks on disk (2 bytes) + +dparams: + ld c,31 ; BDOS get disk parameters function + call bdos + inc hl ; Advance to block shift factor byte + inc hl + ld a,(hl) ; Get value and + ld (blkshf),a ; ..save it in code below + inc hl ; Advance to max block number word + inc hl + inc hl + ld e,(hl) ; Get value into HL + inc hl + ld d,(hl) + inc de ; Add 1 for max number of blocks + +; Compute amount of free space left on disk + +dfree: + ld c,27 ; BDOS get allocation vector function + push de ; Save BLKMAX value + call bdos ; Get allocation vector into HL + ld b,h ; Copy allocation vector to BC + ld c,l + pop hl ; Restore MAXBLK value to HL + ld de,0 ; Inititialize count of free blocks + +; At this point we have +; BC = allocation vector address +; DE = free block count +; HL = number of blocks on disk + +free1: + push bc ; Save allocation address + ld a,(bc) ; Get bit pattern of allocation byte + ld b,8 ; Set to process 8 blocks +free2: + rla ; Rotate allocated block bit into carry flag + jr c,free3 ; If set (bit=1), block is allocated + inc de ; If not set, block is not allocated, so + ; ..increment free block count +free3: + ld c,a ; Save remaining allocation bits in C + dec hl ; Count down number of blocks on disk + ld a,l ; See if we are down to zero + or h + jr z,free4 ; Branch if no more blocks to check + ld a,c ; Get back current allocation bit pattern + djnz free2 ; Loop through 8 bits + pop bc ; Get pointer to allocation vector + inc bc ; Point to next allocation byte + jr free1 ; Continue by processing next allocation byte + +free4: + pop bc ; Clean up stack + ex de,hl ; Free block count to HL +blkshf equ $+1 ; Pointer for in-the-code modification + ld a,0 ; Get block shift factor + sub 3 ; Convert to log base 2 of K per block + jr z,free6 ; Done if single density (1k per block) + +; Convert for blocks of more than 1K each + +free5: + add hl,hl + dec a + jr nz,free5 + +; At this point HL = amount of free space on disk in K + +free6: + call print + db ' Space on ' +seldrv: db 0 ; Modified above to contain drive letter + db ':',[' '+80h] + +; Display decimal value of HL + + ld b,0 ; Initialize count of digits already printed + ld de,10000 ; Divisor in DE + call decdsp ; Print digit (or space if leading '0') + ld de,1000 + call decdsp + call decdsp3 ; Display hundreds, tens, and units + ld a,'K' + jp conout ; Final return from space routine + +; End RCP-SP.Z80 + + endif ;spaceon + + if diron +; include rcpdir ; 'DIR' directory command + page + +; RCP-DIR.Z80 'DIR' Command + +;============================================================================= +; +; D I R E C T O R Y D I S P L A Y C O M M A N D +; +;============================================================================= + +; Command: DIR +; Function: Display a directory of the files on disk +; Syntax: DIR Displays the DIR files +; DIR S Displays the SYS files +; DIR A Display both DIR and SYS files +; DIR /S Equivalent to DIR *.* S +; DIR /A Equivalent to DIR *.* A + +dir: + call retsave ; Save return address and set stack + +; See if FCB should be made wild (all '?') + + ld hl,fcb1+1 ; Point to file name in FCP + ld a,(hl) ; Get first character of filename + + if slashchk ; Allow "DIR /S" and "DIR /A" formats + cp '/' ; If name does not start with '/' + jr nz,dir01 ; ..branch and process normally + inc hl ; Point to second character + ld a,(hl) ; Get option character after slash + ld (fcb2+1),a ; ..and put it into second FCB + dec hl ; Back to first character + ld a,' ' ; Simulate empty FCB + endif ;slashchk + +dir01: + ld b,11 ; Prepare to fill FCB name and type with '?' + cp ' ' ; See if no file spec given + ld a,'?' ; Get ready to fill with '?' + call z,fillp ; ..carry out fill + + if nosys ; Suppress-SYS-file-if-no-wheel option + call whlchk ; Check wheel byte + jr z,dirnly ; If wheel off, ignore options + endif + + ld a,(fcb2+1) ; Get first char of 2nd file name + ld b,1 ; Set for both dir and sys files + cp allflag ; SYS and DIR flag specifier? + jr z,dirpr ; Got system specifier + dec b ; B=0 for sys files only + cp sysflag ; SYS only? + jr z,dirpr + +dirnly: ld b,80h ; Must be dir-only selection + +; DIRECTORY PRINT ROUTINE; ON ENTRY, B REG IS SET AS FOLLOWS: +; 0 FOR ONLY SYSTEM FILES, 80H FOR ONLY DIR FILES, 1 FOR BOTH +; +dirpr: + ld a,b ; Get systst flag + call getdir ; Load and sort directory + jp z,prfnf ; Print no file message + ld e,width ; Count down to 0 +; +; ENTRY PRINT LOOP; ON ENTRY, HL PTS TO FILES SELECTED (TERMINATED BY 0) +; AND E IS ENTRY COUNTER +; +dir3: + ld a,(hl) ; Check for done + or a + if dirsp and spaceon + jp z,spaexit ; Show space when done + else + jp z,exit ; Exit if done + endif ; Dirsp and spaceon + ld a,e ; Get entry counter + or a ; Output if 4 entries printed in line + jr nz,dir3a ; Continue + call crlf ; New line + ld e,width ; Reset entry count + ld a,e ; Get entry count +dir3a cp width ; First entry? + jr z,dir4 + call print +; + if wide +; + db ' ' ; 2 spaces + db fence ; Then fence char + db ' '+80h ; Then 1 more space +; + else +; + db ' ' ; Space + db fence+80h ; Then fence char +; + endif ; Wide +; +dir4: + call prfn ; Print file name + call break ; Check for abort + dec e ; Decrement entry counter + jr dir3 + +; End RCP-DIR.Z80 + + endif ;diron + + if eraon +; include rcpera ; 'ERA' erase command + page + +; RCP-ERA.Z80 'ERA' Command + +;============================================================================= +; +; E R A S E C O M M A N D +; +;============================================================================= + +;Command: ERA +;Function: Erase files +;Forms: +; ERA Erase Specified files and print their names +; ERA I Erase Specified files and print their names, but ask +; for verification before Erase is done + +era: + call retsave + ld a,(fcb2+1) ; Get eraflg if it's there + ld (eraflg),a ; Save it as a flag + ld a,1 ; Dir files only + call getdir ; Load directory of files + jp z,prfnf ; Abort if no files +; +; MAIN ERASE LOOP +; +era1: + call break ; See if user wants to stop + push hl ; Save ptr to file + call prfn ; Print its name + ld (nxtfile),hl ; Save ptr to next file + pop hl ; Get ptr to this file + call rotest ; Test file pted to by hl for r/o + jr nz,era3 +eraflg equ $+1 ; Address of flag + ld a,0 ; 2nd byte is flag + cp 'I' ; Is it an inspect option? + jr nz,era2 ; Skip prompt if it is not + call eraq ; Erase? + jr nz,era3 ; Skip if not +era2: + ld de,fcb1+1 ; Copy into fcb1 + ld b,11 ; 11 bytes + call blkmov + call initfcb1 ; Init fcb + ld c,19 ; Delete file + call bdos +era3: + ld hl,(nxtfile) ; Hl pts to next file + ld a,(hl) ; Get char + or a ; Done? + if erasp and spaceon + jp z,spaexit + else + jp z,exit + endif ; Erasp and spaceon + call crlf ; New line + jr era1 + +; End RCP-ERA.Z80 + + endif ;eraon + + if lton +; include rcplt ; 'LIST' and 'TYPE' commands + page + +; RCP-LT.Z80 + +;============================================================================= +; +; L I S T A N D T Y P E C O M M A N D S +; +;============================================================================= + +;Command: LIST +;Function: Print out specified file on the LST: Device +;Forms: +; LIST Print file (NO Paging) +;Notes: +; The flags which apply to TYPE do not take effect with LIST + + if liston +list: +; +; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED + + + call retsave + ld a,0ffh ; Turn on printer flag + jr type0 + endif ;liston + +;Command: TYPE +;Function: Print out specified file on the CON: Device +;Forms: +; TYPE Print file +; TYPE P Print file with paging flag +;Notes: +; The flag PGDFLG defines the letter which toggles the paging +; facility (P in the forms section above) +; The flag PGDFLT determines if TYPE is to page by default +; (PGDFLT=TRUE if TYPE pages by default); combined with +; PGDFLG, the following events occur -- +; If PGDFLT = TRUE, PGDFLG turns OFF paging +; If PGDFLT = FALSE, PGDFLG turns ON paging +; +type: +; +; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED +; +; + call retsave + xor a ; Turn off printer flag +; +; ENTRY POINT FOR CPR LIST FUNCTION (LIST) +; +type0: + if liston + ld (prflg),a ; Set flag + endif ; Liston + + ld a,(fcb2+1) ; Get page flag + ld (pgflg),a ; Save it as a flag + ld a,1 ; Select dir files + call getdir ; Allow ambiguous files (HL points to buffer) + jp z,prfnf ; No files + jr typex2 + + ; Entry point for successive files +typex: + ld hl,(nxtfile) ; Get ptr to next file + ld a,(hl) ; Any files? + or a + jp z,exit + + if liston + ld a,(prflg) ; Check for list output + or a ; 0=type + jr z,typex1 + ld a,cr ; Bol on printer + call lcout + ld a,ff ; Form feed the printer + call lcout + jr typex2 + endif ; Liston + +typex1: +; LDA PAGCNT ; If we've just done so, + push hl + ld hl,(pagcnt) + ld a,(hl) + pop hl + cp nlines-2 ; Don't type another + call nz,pagebreak ; Page break message +typex2: + ld de,fcb1+1 ; Copy into fcb1 + ld b,11 ; 11 bytes + call blkmov + ld (nxtfile),hl ; Set ptr to next file + call initfcb1 ; Init fcb1 + ld c,15 ; Open file + call bdos + inc a ; Set error flag + jp z,prfnf ; Abort if error +; MVI A,NLINES-2 ; Set line count +; STA PAGCNT + ld hl,(pagcnt) + ld (hl),nlines-2 + ld a,cr ; New line + call lcout + ld a,lf + call lcout + ld bc,080h ; Set char position and tab count + ; (b=0=tab, c=080h=char position) +; +; MAIN LOOP FOR LOADING NEXT BLOCK +; +type2: + ld a,c ; Get char count + cp 80h + jr c,type3 +; PUSH H ; Read next block + push bc + ld de,fcb1 ; Pt to fcb + ld c,20 ; Read record + call bdos + or a ; Set flags + pop bc +; POP H + jr nz,typex ; End of file? + ld c,0 ; Set char count + ld hl,tbuff ; Pt to first char +; +; MAIN LOOP FOR PRINTING CHARS IN TBUFF +; +type3: + ld a,(hl) ; Get next char + and 7fh ; Mask out msb + cp 1ah ; End of file (^z)? + jr z,typex ; Next file if so +; +; OUTPUT CHAR TO CON: OR LST: DEVICE WITH TABULATION +; + cp cr ; Reset tab count? + jr z,type4 + cp lf ; Reset tab count? + jr z,type4 + cp tab ; Tab? + jr z,type5 +; +; OUTPUT CHAR AND INCREMENT CHAR COUNT +; + call lcout ; Output char + inc b ; Increment tab count + jr type6 +; +; OUTPUT OR AND RESET TAB COUNT +; +type4: + call lcout ; Output or + ld b,0 ; Reset tab counter + jr type6 +; +; TABULATE +; +type5: + ld a,' ' ; + call lcout + inc b ; Incr pos count + ld a,b + and 7 + jr nz,type5 +; +; CONTINUE PROCESSING +; +type6: + inc c ; Increment char count + inc hl ; Pt to next char + call break ; Check for abort + jp z,typex ; Skip + jr type2 +; +; SEND OUTPUT TO LST: OR CON:, AS PER THE FLAG +; RETURN WITH Z IF ABORT +; +lcout: + push hl ; Save regs + push bc + ld e,a ; Char in e + ld c,2 ; Output to con: + if liston +prflg equ $+1 ; Pointer for in-the-code modification + ld a,0 ; 2nd byte is the print flag + or a ; 0=type + jr z,lc1 + ld c,5 ; Output to lst: + endif ; Liston + +lc1: + push de ; Save char + call bdos ; Output char in e + pop de ; Get char + ld a,e + cp lf + jr nz,lc2 + if liston + ld a,(prflg) ; Output to lst:? + or a ; Nz = yes + jr nz,lc2 + endif ; Liston +; +; CHECK FOR PAGING +; +; LXI H,PAGCNT ; Count down + ld hl,(pagcnt) + dec (hl) + jr nz,lc2 ; Jump if not end of page + ld (hl),nlines-2 ; Refill counter +pgflg equ $+1 ; Pointer to in-the-code buffer + ld a,0 ; 2nd byte is the paging flag + cp pgdflg ; Page default override option wanted? +; + if pgdflt ; If paging is default +; + jr z,lc2 ; Pgdflg means no paging +; + else +; + jr nz,lc2 ; Pgdflg means page +; + endif ; Pgdflt +; + call pagebreak ; Print page break message + jp z,typex ; Z to skip +lc2: + pop bc ; Restore regs + pop hl + ret +; +; PRINT PAGE BREAK MESSAGE AND GET USER INPUT +; ABORT IF ^C, RZ IF ^X +; +pagebreak: + push hl ; Save hl + call print + db cr,lf,' Typing',' '+80h + ld hl,fcb1+1 ; Print file name + call prfn + call dash ; Print dash + call conin ; Get input + pop hl ; Restore hl + push af + call crlf ; New line + pop af + jp break1 +; +; End RCP-LT.Z80 + + endif ;lton + + if renon +; include rcpren ; 'REN' rename command + page + +; RCP-REN.Z80 + +;Section 5E +;Command: REN +;Function: To change the name of an existing file +;Forms: +; REN = Perform function +; +ren: +; +; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED +; + + call retsave +; +; +; STEP 1: CHECK FOR FILE 2 BEING AMBIGUOUS +; + ld hl,fcb2+1 ; Can't be ambiguous + call ambchk1 +; +; STEP 2: LOG INTO USER AREA +; + call logusr ; Log into user area of fcb1 +; +; STEP 3: SEE IF OLD FILE IS R/O +; + ld hl,fcb1 ; Pt to 1st fcb + push hl + ld de,fcb2 ; Pt to 2nd file + push de ; Save ptr + ld a,(hl) ; Get 1st's drive + ld (de),a ; Stuff into second fcb + ld c,17 ; Look for file + call bdos + inc a + jp z,prfnf + call getsbit ; Get ptr to entry in tbuff + ex de,hl ; Hl pts to entry + inc hl ; Pt to fn + call rotest ; See if file is r/o + jp nz,exit +; +; STEP 4: SEE IF NEW FILE ALREADY EXISTS +; EXTEST PERFORMS A NUMBER OF CHECKS: +; 1) AMBIGUITY +; 2) R/O +; 3) IF FILE EXISTS AND NOT R/O, PERMISSION TO DELETE +; + call extest + jp z,exit ; R/o or no permission +; +; STEP 5: EXCHANGE FILE NAME FIELDS FOR RENAME +; + pop de ; Pt to old + pop hl ; Pt to new + push hl ; Save ptr + ld b,12 ; 12 bytes + call iswap1 +; +; STEP 6: RENAME THE FILE +; + pop de ; Get ptr to fcb + ld c,23 ; Rename + call bdos + inc a ; Set zero flag if error + jp z,prfnf ; Print no source file message + jp exit +; +; +; End RCP-REN.Z80 + + endif ;renon + + if proton +; include rcpprot ; 'PROT' file attribute setting command + page + +; RCP-PROT.Z80 + +;Section 5F +;Command: PROT +;Function: To set the attributes of a file (R/O and SYS) +; +;Form: +; PROT afn RSI +;If either R or S are omitted, the file is made R/W or DIR, resp; +;R and S may be in any order. If I is present, Inspection is enabled. + +att: + call retsave + xor a ; Set no inspect + ld (inspect),a + ld hl,0 ; Set r/o and sys attributes off + ld de,fcb2+1 ; Pt to attributes + ld b,3 ; 3 chars max +att1: + ld a,(de) ; Get char + inc de ; Pt to next + cp 'I' ; Inspect? + jr z,atti + cp 'R' ; Set r/o? + jr z,attr + cp 'S' ; Set sys? + jr z,atts +att2: + djnz att1 + jr att3 +atti: + ld (inspect),a ; Set flag + jr att2 +attr: + ld h,80h ; Set r/o bit + jr att2 +atts: + ld l,80h ; Set sys bit + jr att2 +att3: + ld (fatt),hl ; Save file attributes + ld a,1 ; Select dir and sys files + call getdir ; Load directory + jp z,prfnf ; No file error + jr att5 +att4: + ld hl,(nxtfile) ; Pt to next file + ld a,(hl) ; End of list? + or a + jp z,exit + call crlf ; New line +att5: + call break ; Check for possible abort + push hl ; Save ptr to current file + call prfn ; Print its name + ld (nxtfile),hl ; Save ptr to next file + call print + db ' Set to R','/'+80h + ld hl,(fatt) ; Get attributes + ld c,'W' ; Assume r/w + ld a,h ; Get r/o bit + or a + jr z,att6 + ld c,'O' ; Set r/o +att6: + ld a,c ; Get char + call conout + ld a,l ; Get sys flag + or a ; Set flag + jr z,att7 + call print + db ' and SY','S'+80h +att7: +inspect equ $+1 ; Ptr for in-the-code modification + ld a,0 ; Get inspect flag + or a ; Z=no + pop hl ; Get ptr to current file + jr z,att8 + call eraq1 ; Ask for y/n + jr nz,att4 ; Advance to next file if not y +att8: + ld de,fcb1+1 ; Copy into fcb1 + ld b,11 ; 11 bytes + call blkmov +fatt equ $+1 ; Ptr for in-the-code modification + ld hl,0 ; Get attributes + dec de ; Pt to sys byte + dec de + ld a,l ; Get sys flag + call attset ; Set attribute correctly + dec de ; Pt to r/o byte + ld a,h ; Get r/o flag + call attset + ld de,fcb1 ; Pt to fcb + ld c,30 ; Set attributes + call bdos + jr att4 +attset: + or a ; 0=clear attribute + jr z,attst1 + ld a,(de) ; Get byte + or 80h ; Set attribute + ld (de),a + ret +attst1: + ld a,(de) ; Get byte + and 7fh ; Clear attribute + ld (de),a + ret +; +; End RCP-PROT.Z80 + + endif ;proton + + if cpon +; include rcpcp ; 'CP' file copying command + +; RCP-CP.Z80 + +;============================================================================= +; +; F I L E C O P Y C O M M A N D +; +;============================================================================= + +; Command: CP +; Function: Copy a file from one place to another +; Syntax: CP destfile=srcfile +; CP srcfile +; Comments: Both file specifications can include a directory specification. +; If only one file name is given, then the current directory and +; the source file name are assumed for the destination. + +copy: + call retsave + +; If new is blank, make it the same name and type as old + + ld de,fcb1+1 ; Point to destination file name + ld a,(de) ; Get first character + cp ' ' ; If not blank (no name) + jr nz,copy0 ; ..then branch to copy + + ld hl,fcb2+1 ; Copy source name into destination FCB + ld b,11 ; Name and type are 11 bytes + call blkmov + +; See if destination is same as source, and abort if so + +copy0: + ld hl,fcb1 ; Set up pointers to two files + ld de,fcb2 + push hl + push de + inc hl ; Point to names of files + inc de + ld b,13 ; Compare 13 bytes (name, type, and user #) +copy1: + call comp + jr nz,copy2 ; If they differ, go on with copy + + ld c,25 ; Get-current-disk BDOS function + call bdos ; Get it in case no drive given explicitly + inc a ; Shift to range 1..16 + ld b,a ; ..and keep value in B + pop de ; Restore pointers to FCBs + pop hl + ld a,(de) ; Get drive of source file + ld c,a ; ..and save it in C + or a ; Is it default drive? + jr nz,copy1a ; Branch if drive made explicit + ld c,b ; Otherwise, copy default drive into C +copy1a: + ld a,(hl) ; Get drive of destination file + or a ; Is it default drive? + jr nz,copy1b ; Branch if drive made explicit + ld a,b ; Otherwise, get current drive +copy1b: + cp c ; Compare the two drives specified + jr nz,copy3 ; Branch if they are different + jr cperr ; Branch to error code if they are the same + +copy2: + pop de ; Clean up the stack + pop hl + +; Make note of the user numbers of the two files + +copy3: + ld a,(fcb1+13) ; Get destination user number + ld (usrdest),a + ld a,(fcb2+13) ; Get source user number + ld (usrsrc),a + +; Set up new FCB for source file and open the source + + call define ; Define buffer addresses dynamically + ld hl,(srcfcb) ; Get address to use for new source FCB + push hl + ex de,hl ; Copy file data to new FCB + ld b,12 + call blkmov + call logsrc ; Log in user number of source file + pop hl ; Initialize the source file FCB + call initfcb2 + ld c,15 ; Open file + call bdos + inc a ; Check for error + jp z,prfnf ; Branch if file not found + +; Make sure destination file does not already exist + + call logdest ; Log into destination s user area + call extest ; Test for existence of file + jp z,exit ; Branch if it exists + +; Create destination file + + ld de,fcb1 ; Point to destination FCB + ld c,22 ; BDOS make-file function + call bdos + inc a ; Test for error (no directory space) + jr nz,copy5 ; Branch if OK + +; Report file error + +cperr: + call print + db ' Copy','?'+80h + jp exit + +; Copy source to destination with buffering + +;++++++++++ this should be done by changing DMA address to save all the +; buffer swapping + +copy5: + call logsrc ; Log in source user area + ld b,0 ; Initialize counter + ld hl,(cbuff) ; Initialize buffer pointer + +copy5a: + push hl ; Save address and counter + push bc + ld hl,(srcfcb) ; Point to source file FCB + ex de,hl ; Put it in DE for BDOS call + ld c,20 ; BDOS read-sequential function + call bdos + pop bc ; Get counter and address + pop de + or a ; Read Ok? + jr nz,copy5b ; Branch if end of file + + push bc ; Save counter + ld hl,tbuff ; Copy from 80h to buffer + ld b,128 ; 128 bytes + call blkmov + ex de,hl ; HL points to next buffer address + pop bc ; Get counter back + inc b ; Increment it + ld a,b ; See if buffer full + cp cpblocks + jr nz,copy5a ; If not, go back for more + +copy5b: + ld a,b ; Get count of blocks loaded into buffer + or a ; Are there any? + jr z,copy6 ; Branch if not (we are done) + + push bc ; Save count + call logdest ; Log into destination user number +cbuff equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Point to beginning of copy buffer +copy5c: + ld de,tbuff ; Copy into tbuff + ld b,128 ; 128 bytes + call blkmov + push hl ; Save pointer to next block + ld de,fcb1 ; Point to destination file FCB + ld c,21 ; Write the block + call bdos + or a + jr nz,cperr ; Branch on error (disk full of write error) + pop hl ; Get back pointer to next block + pop bc ; Get count +; djnz copy5 ; Work through the blocks + dec b ; + jr z,copy5 ; + push bc ; Save count + jr copy5c ; Back for another bufferful + +; Close the destination file + +copy6: + call logdest ; Log into destination user number + ld de,fcb1 ; Point to destination FCB + ld c,16 ; Close file + call bdos + call print + db ' Don','e'+80h + + if cpsp and spaceon + jp spaexit ; Report space remaining on destination drive + else + jp exit + endif ;cpsp and spaceon + +; Log into user number of source file + +logsrc: +usrsrc equ $+1 ; Pointer for in-the-code modification + ld a,0 ; Get user number + jr setusrrel ; Local jump to save code + +; Log into user number of destination file + +logdest: +usrdest equ $+1 ; Pointer for in-the-code modification + ld a,0 ; Get user number +setusrrel: + jp setusr + +; End RCP-CP.Z80 + + endif ;cpon + + if peekon or pokeon or porton +; include rcpiom ; 'PEEK', 'POKE', 'PORT' commands + page + +; RCP-IOM.Z80 + +; Command: PEEK +; Function: Display memory contents +; +; Form: +; PEEK startadr 256 bytes displayed +; PEEK startadr endadr range of bytes displayed + + if peekon + +peek: + call retsave + + ld hl,tbuff+1 ; Find first number +nxtpeek equ $+1 ; Pointer for in-the-code modification + ld de,100h ; Default peek address if none + call sksp ; Skip to first token (if any) + call nz,hexnum ; Get start address if any + + push de ; Save starting address + ld bc,255 ; Compute default ending address + ex de,hl + add hl,bc + + if peekchk ; Check for overflow + jr nc,peek0 ; If no overflow past FFFF, go on + ld hl,0ffffh ; Else use FFFF as ending address +peek0: + endif ;peekchk + + ex de,hl ; End address in DE + call sksp ; Skip to next token (if any) + call nz,hexnum ; Get 2nd number in DE (else default) + +peek1: + pop hl ; HL is start address, DE is end address + + if peekhdr + + push hl ; Save starting address again + ld b,8 ; Output leading spaces +peek0a: + call print + db ' '+80h + djnz peek0a + + ld b,16 ; Display 16 column headers +peek0b: + ld a,l + and 03h + call z,spac + + call spac + call spac + ld a,l ; Get low byte of address + and 0fh ; Display low hex digit + call pah + inc hl + djnz peek0b + + if peekbdr + call crlf + ld b,8 +peek0c: + call print + db ' '+80h + djnz peek0c + ld b,16 +peek0d: + ld a,l + and 3 + call z,spac + inc l + call print + db ' -', '-'+80h + djnz peek0d + endif ;peekbdr + + pop hl ; Restore starting address + + endif ;peekhdr + + ld c,0ffh ; Use C as continue flag + call peek2 ; Do peek + ld (nxtpeek),hl ; Set continued peek address + jp exit + +peek2: + ld a,c ; Check continuation flag + or a ; + ret z ; + +; Print line header + +peek2a: + call crlf ; New line + ld a,h ; Print address + call pashc + ld a,l + call pahc + call dash ; Print leader + ld b,16 ; 16 bytes to display + push hl ; Save start address + + ; Print hex values for 16 bytes + +peek3: + ld a,l + and 03h + call z,spac + + ld a,(hl) ; Get next byte + call pashc ; Print with leading space + + ; Check for last address + ; If c is already 0, leave it that way. + ; Otherwise check for end address and if so + ; Set c to zero. + + ld a,c ; See if continue flag already cleared + or a + jr z,peek3a ; If so, skip test + ld a,h + sub a,d ; See if h = d + ld c,a + ld a,l + sub a,e ; See if l = e + or c ; Combine two tests + ld c,a + +peek3a: inc hl ; Pt to next + djnz peek3 + + ; Print ascii equivalents for 16 bytes + + pop hl ; Pt to first address again + ld b,16 ; 16 bytes + call print ; Space and fence + db ' ' + db fence+80h + push bc ; Save flag in c +peek4: + ld a,(hl) ; Get next byte + ld c,'.' ; Assume dot + and 7fh ; Mask it + cp ' ' ; Dot if less than space + jr c,peek5 + cp 7fh ; Don't print del + jr z,peek5 + ld c,a ; Char in c +peek5: + ld a,c ; Get char + call conout ; Send it + inc hl ; Pt to next + djnz peek4 + + call print ; Closing fence + db fence+80h + pop bc ; Get flag in c back + call break ; Allow abort + jr peek2 + + endif ; Peekon +; +; PRINT A AS 2 HEX CHARS +; PASHC - LEADING SPACE +; + if peekon or [pokeon and not pokeq] or porton +pashc: + push af ; Save a + call spac + pop af +pahc: + push af + rrca ; Exchange nybbles + rrca + rrca + rrca + call pah ; Print hex char + pop af +pah: + and 0fh ; Mask + add a,'0' ; Convert to ascii + cp '9'+1 ; Letter? + jr c,pah1 + add a,7 ; Adjust to letter +pah1: + jp conout +; + endif ; Peekon or [pokeon and not pokeq] or porton +; +;Section 5I +;Command: POKE +;Function: Place Values into Memory +; +;Form: +; POKE startadr val1 val2 ... +; + if pokeon +poke: + call retsave + ld hl,tbuff+1 ; Pt to first char + call sksp ; Skip to non-blank + jr z,noargs ; Arg error + call hexnum ; Convert to number + + if not pokeq + call print + db ' Pok','e'+80h + call adrat ; Print at message + endif + +; LOOP FOR STORING HEX VALUES SEQUENTIALLY VIA POKE + +poke1: + push de ; Save address + call sksp ; Skip to non-blank + jp z,exit ; Done + cp '"' ; Quoted text? + jr z,poke2 + call hexnum ; Get number + ld a,e ; Get low + pop de ; Get address + ld (de),a ; Store number + inc de ; Pt to next + jr poke1 +; +; STORE ASCII CHARS +; +poke2: + pop de ; Get next address + inc hl ; Pt to next char +poke3: + ld a,(hl) ; Get next char + or a ; Done? + jp z,exit + ld (de),a ; Put char + inc hl ; Pt to next + inc de + jr poke3 + + endif ; Pokeon +; +; No Argument Error +; + + if pokeon or porton + +noargs: + call print + db ' Arg','?'+80h + jp exit +; + endif ; Pokeon or porton + +; +;Section 5I+ +;Command: PORT +;Function: Display or Set I/O Port Data +; +;Form: +; PORT addr - read port and display value +; PORT addr value - output value to port +; + if porton +port: + call retsave + ld hl,tbuff+1 ; Find first number + call sksp ; Skip to first command-line token + jr z,noargs ; Abort if no port address given + call hexnum ; Get start address into de + push hl ; Save pointer to command tail + ld hl,portaddr ; Modify code + ld (hl),e ; Move specified port addr into place + dec hl ; Point to opcode position + ld (hl),0dbh ; Poke 'in' opcode + ex (sp),hl ; Get tail pointer back while saving this one + call print ; Print header + db ' Por','t'+80h + ld a,e + call pashc ; Print port address + call sksp ; Skip to possible second value + jr z,portin ; Proceed with port input + + call hexnum ; Get 2nd number in de + ex (sp),hl ; Get pointer to opcode back + ld (hl),0d3h ; Poke 'out' opcode + call print + db ': OU','T'+80h + ld a,e ; Get value to output + jr paddr + +portin: call print + db ': I','N'+80h + xor a ; Make sure high port address = 0 (for HD64180) +paddr: ld b,0 ; ..for both IN and OUT instructions +opcode: + db 0 ; Opcode for IN or OUT inserted by code above +portaddr: + db 0 ; Port address inserted by code above + call pashc + pop hl ; Clean up stack + jp exit + + endif ; Porton + +; End RCP-IOM.Z80 + + endif ;peekon or pokeon or porton + + if regon +; include rcpreg ; 'REG' register operation commands + page + +; RCP-REG.Z80 + +; +;Section 5J +;Command: REG +;Function: Manipulate Memory Registers +; +;Forms: +; REG D or REG <-- Display 10 Register Values +; REG Mreg <-- Decrement Register Value +; REG Preg <-- Increment Register Value +; REG Sreg value <-- Set Register Value +; +; Vers 2.1 Joe Wright +; +; REG reg <-- Display a single register value +; +; REG numbers now range from 0 to 31, although only the first ten are +; displayed with REG D. +; +; REG now treats the program error byte as register E. +; +register: + ld de,fcb1+2 ; Pt to first arg + ld a,(de) ; Get possible digit + call regptr ; Pt HL to potential register + dec de ; Point to command + ld a,(de) + cp 'S' ; Set? + jr z,rset + cp 'P' ; Plus? + jr z,rinc + cp 'M' ; Minus? + jr z,rdec + cp ' ' + jr z,rshow + cp 'D' + jr z,rshow + call regptr + jp regout + +; INCREMENT REGISTER VALUE +; HL PTS TO MEMORY REGISTER ON INPUT + +rinc: + inc (hl) ; Increment it + jr regout ; Print result + +; DECREMENT REGISTER VALUE +; HL PTS TO MEMORY REGISTER ON INPUT + +rdec: + dec (hl) ; Decrement value + jr regout ; Print result + +; Show first ten registers and Program Error byte +; +rshow: + call rshow10 + ld hl,z3msg+6 + jp regout + +rshow10: + xor a ; Select register 0 + ld b,a ; Counter set to 0 in B + call regp1 ; HL pts to register 0 +rshow1: + ld a,b ; Get counter value + cp 10 ; First ten registers + ret z ; Exit if done + push bc ; Save counter + push hl ; Save pointer + call regout ; Print register value + pop hl ; Get pointer + pop bc ; Get counter + inc b ; Increment counter + ld a,b ; Check for new line + and 3 + call z,crlf ; Newline after fourth display + inc hl ; Pt to next register + jr rshow1 + +; SET REGISTER VALUE +; HL PTS TO REGISTER ON INPUT + +rset: + ld de,fcb2+1 ; Pt to value + call de2bin ; Eval string at DE to binary in B + ld (hl),b ; Set value + +; Enter with HL pointing to the register. HL is maintained. +; +regout: + call print + db ' Reg',' '+80h + ld de,z3msg+30h ; Register 0 + sbc hl,de ; Register number in HL + ld a,l + cp 32 ; A numbered Register? + jr c,rego0 ; Yep + call print + db ' ','E'+80h + jr rego1 ; Report + +rego0: push hl + push de + ld b,0 ; Suppress zeros + call decdsp2 ; Report register number + pop de + pop hl + +rego1: add hl,de ; HL points to register again + call print + db ' =',' '+80h + ld l,(hl) + xor a + ld h,a + ld b,a ; Suppress leading zeros + jp decdsp3 ; Display value + +; Evaluate decimal string at DE to binary in B +; +de2bin: + ld b,0 ; Init value to zero +de2b: + ld a,(de) ; Get this digit + inc de ; Pt to next + sub '0' ; Convert to binary + ret c ; A space, finished + cp 10 ; Range? + ret nc ; Not decimal, finished + ld c,a ; Digit in c + ld a,b ; Multiply old by 10 + add a,a ; *2 + add a,a ; *4 + add a,b ; *5 + add a,a ; *10 + add a,c ; Add in new digit + ld b,a ; Result in b + jr de2b ; Again + +; SET HL TO POINT TO MEMORY REGISTER WHOSE INDEX IS PTED TO BY HL +; ON INPUT, A CONTAINS REGISTER CHAR +; ON OUTPUT, HL = ADDRESS OF MEMORY REGISTER (REG 0 ASSUMED IF ERROR) + +regptr: + ld hl,z3msg+6 ; The E register + cp 'E' + ret z + push de + call de2bin ; Get register number in B + pop de + ld a,b + cp 32 ; Range 0-31 + ld a,0 + jr nc,regp1 ; Out of range, use 0 + ld a,b ; Value in A +regp1: + ld hl,z3msg+30h ; Pt to memory registers + add a,l ; Pt to proper register + ld l,a + ret ; No chance of crossing page boundary +; +; End RCP-REG.Z80 + + endif ;regon + + if whlon or whlqon +; include rcpwhl ; 'WHL' and 'WHLQ' commands + page +; +;Section 5K +;Command: WHL/WHLQ +;Function: Set the Wheel Byte on or off +; +;If WHLQUIET equate is true, then RCP does not report wheel status with WHL +;command. +; +;Form: +; WHL -- turn Wheel Byte OFF +; WHL password -- turn Wheel Byte ON if password is correct +; WHLQ -- find out status of Wheel Byte +; +; Vers 2.1 Changes the function a little as follows: +; +; WHL -- Report Wheel Status (no WHLQ) +; WHL password -- Set Wheel ON if password is correct +; -- Set Wheel OFF if password incorrect +whl: + ld hl,fcb1+1 ; Pt to first char + ld a,(hl) ; Get it + + if not whlqon + cp ' ' + jr z,whlmsg ; Report wheel status if no password + endif + + ld de,whlpass + ld b,8 ; Check 8 chars + call comp ; Compare + jr nz,whloff ; Set wheel OFF if incorrect password + +; TURN ON WHEEL BYTE + + ld a,0ffh ; Turn on wheel byte + jr whlset + +; TURN OFF WHEEL BYTE + +whloff: + xor a ; Turn off wheel byte +whlset: + ld hl,(z3whl) ; Indirect from z3env + ld (hl),a +whlq: + if whlquiet + ret + endif + +; PRINT WHEEL BYTE MESSAGE + + if not whlquiet + +whlmsg: + call print + dc ' Wheel ' + call whlchk ; Check wheel byte + jr z,offm + call print + dc 'On' + ret +offm: + call print + dc 'Off' + ret + + endif ;[not whlquiet] or whlqon + + +; WHEEL PASSWORD DEFINED FROM SYSRCP.LIB FILE + + db 'Z'-'@' ; Leading ^z to block attempt to type rcp file +whlpass: + wpass ; Use macro +; +; End RCP-WHL.Z80 + + endif ;whlon + + if echoon +; include rcpecho ; 'ECHO' command + page + +; RCP-ECHO.Z80 + +;============================================================================= +; +; E C H O T E X T T O S C R E E N A N D P R I N T E R +; +;============================================================================= + +; Command: ECHO +; Function: Echo text to console or printer + +echo: + xor a ; Lower case flag setting + + if upcase ; If upper case default + dec a + endif ;upcase + + ld (casefl),a ; Store flag in code below + + ld hl,tbuff+1 ; Point to first character + call getchar ; Get first character (should be blank) + ; If none, exit from routine + + if echolst + call getchar ; Get first char after leading blank + ld b,a ; Save first char as list output flag + cp '$' ; Print flag? + jr z,echo2 ; If so, go on + dec hl ; Else backup one character + endif ; Echolst + +; LOOP TO ECHO CHARS + +echo2: call getchar + + if echolst + cp ff ; Form feed? + jr z,echo3 + endif ;echolst + + cp '^' + jr nz,echo2a ; Not control character prefix + call getchar ; Get next character + and 1fh ; Convert to control character + jr echo2d ; Echo it + +echo2a: cp cmdchar ; Case shift prefix? + jr nz,echo2d ; No, normal echo + call getchar ; Get next character + cp ucasechar ; Up-shift character? + jr z,echo2c ; Store non-zero value in case flag + +echo2b: cp lcasechar ; Lower-case character? + jr nz,echo2d ; No, echo the character as is + xor a ; Else, clear case flag +echo2c: ld (casefl),a + jr echo2 ; On to next character + +echo2d: + call echout ; Send char + jr echo2 + +; FORM FEED - SEND NEW LINE FOLLOWED BY FORM FEED IF PRINTER OUTPUT + + if echolst +echo3: + ld a,b ; Check for printer output + cp '$' + jr nz,echoff ; Send form feed normally if not printer + call echonl ; Send new line + ld a,ff ; Send form feed + jr echout + +; SEND FORM FEED CHAR TO CONSOLE + +echoff: + ld a,ff ; Get char + jr echo2d + endif ;echolst + +; END OF PRINT LOOP - CHECK FOR PRINTER TERMINATION + +echo4: + if not echolst + + ret + + else + + ld a,b ; Get list mode flag + cp '$' + ret nz ; Done if no printer output + +; OUTPUT A NEW LINE + +echonl: + ld a,cr ; Output new line on printer + call echout + ld a,lf ; Fall thru to echout + + endif ;not echolst + +; OUTPUT CHAR TO PRINTER OR CONSOLE + +echout: + ld c,a ; Char in c + + cp 'A' ; If less than 'a' + jr c,echouta ; Leave as is + cp 'Z'+1 ; If greater than 'z' + jr nc,echouta ; Leave as is + add 20h ; Else convert to lower case +echouta: + ld d,a ; Save lower case version in d +casefl equ $+1 ; Pointer for in-the-code modification + ld a,0 + or a + jr nz,echoutb ; If upper case selected, go on as is + ld c,d ; Else substitute lower case version +echoutb: + + push hl ; Save hl + push bc ; Save bc + ld de,0ch-3 ; Offset for console output + + if echolst + ld a,b ; Check for printer output + cp '$' + jr nz,echout1 + inc de ; Add 3 for printer offset + inc de + inc de + endif ;echolst + +; OUTPUT CHAR IN C WITH BIOS OFFSET IN DE + +echout1: + call biout ; Bios output + pop bc ; Restore bc,hl + pop hl + ret + +; Get a character from the command tail buffer + +getchar: + ld a,(hl) ; Get character + inc hl ; Point to next one + or a ; Check for end of string + ret nz ; If not end, return + pop hl ; Else, clean up stack + jr echo4 ; And exit from routine + +; OUTPUT CHAR IN C TO BIOS WITH OFFSET IN DE + +biout: + ld hl,(wboot+1) ; Get address of warm boot + add hl,de ; Pt to routine + jp (hl) ; Jump to it + +; End RCP-ECHO.Z80 + + endif ;echoon + +; include rcpsubs ; File of subroutines + page + +; RCPSUBS.Z80 Subroutines for Z33RCP.Z80 + + +;----------------------------------------------------------------------------- + +; Display decimal digit routines + +;-------------------- + +; Display hundreds, tens, and units digits (assumes flag in B has been set) + + if regon or spaceon + +decdsp3: + ld de,100 ; Display hundreds + call decdsp +decdsp2: + ld de,10 ; Display tens + call decdsp + ld a,l ; Get remaining units value + add '0' ; Convert to character + jr conout ; Print it and return + +;-------------------- + +; Routine to print any single digit + +; Actually, this routine displays the value of HL divided by DE and leaves the +; remainder in HL. In computing the character to display, it assumes that the +; result of the division will be a decimal digit. If the result is zero, the +; value in the B register, which is the number of digits already printed, is +; checked. If it is zero, a space is printed instead of a leading '0'. If it +; is not zero, the '0' is printed. Whenever any digit (not a space) is +; printed, the value in B is incremented. + +decdsp: + ld c,'0'-1 ; Initialize digit count + xor a ; Clear carry flag + +decdsp1: + inc c ; Pre-increment the digit + sbc hl,de ; Subtract DE from HL + jr nc,decdsp1 + + add hl,de ; Add back in to produce remainder + ld a,c ; Get decimal digit + cp '0' ; Check for leading 0 + jr nz,decdout ; If not 0, proceed to display it + ld a,b ; Digit printed already? + or a + ld a,' ' ; Possible space for calling routine to print +; ret z ; If no digit printed, return zero flag set + jr z,conout ; Print leading space +decdout: + inc b ; Indicate digit printed + ld a,c ; Else print real digit + ; Fall through to CONOUT + + endif ;regon or spaceon + +;----------------------------------------------------------------------------- + +; Console Output Routine + +conout: + putreg ; Save all register except AF + push af ; Save AF, too + and 7fh ; Mask out MSB + ld e,a ; Transfer character to E + ld c,2 ; BDOS conout function number + call bdos + pop af + getreg ; Restore registers +note: ; Use this RET for NOTE command + ret + + if peekon or [pokeon and not pokeq] or porton +spac: ld a,' ' + jr conout + endif ; peekon or [pokeon and not pokeq] or porton + + +;----------------------------------------------------------------------------- + +; String printing routines + +;-------------------- + +; Print string following call (terminated with null or character with the +; high bit set) + +print: + ex (sp),hl ; Get address + call printhl + ex (sp),hl ; Put address + ret + +;-------------------- + +; Print string pointed to by HL (terminated with null or character with the +; high bit set) + +printhl: + ld a,(hl) ; Get next character + inc hl ; Point to following one + or a ; See if null terminator + ret z ; If so, we are done + call conout ; Display the character + ret m ; We are done if MSB is set (negative number) + jr printhl ; Back for more + +;----------------------------------------------------------------------------- + +; OUTPUT NEW LINE TO CON: + +crlf: + call print + db cr,lf+80h + ret + +; CONSOLE INPUT + + if eraon or lton or proton or renon or cpon + +conin: + push hl ; Save regs + push de + push bc + ld c,1 ; Input + call bdos + pop bc ; Get regs + pop de + pop hl + and 7fh ; Mask msb + cp 61h + ret c + and 5fh ; To upper case + ret + + endif ; Eraon or lton or proton or renon or cpon +; +; SAVE RETURN ADDRESS +; +retsave: + pop de ; Get return address + pop hl ; Get return address to zcpr3 + ld (z3ret),hl ; Save it + push hl ; Put return address to zcpr3 back + push de ; Put return address back + ret + +; + if spaceon and [dirsp or cpsp or erasp] +spaexit: + call crspace ; Show space remaining + endif ; Spaceon and [dirsp or cpsp or erasp] +; +; EXIT TO ZCPR3 +; +exit: +z3ret equ $+1 ; Pointer to in-the-code modification + jp 0 ; Return address + +; +; PRINT A DASH +; + if lton or peekon +dash: + call print + db ' -',' '+80h + ret +; + endif ; Lton or peekon +; +; PRINT ADDRESS MESSAGE +; PRINT ADDRESS IN DE +; + if peekon or pokeon + if not pokeq +adrat: + call print + db ' at',' '+80h + ld a,d ; Print high + call pahc + ld a,e ; Print low + jp pahc + + endif ; Not pokeq + endif ; Peekon or pokeon + + if peekon or pokeon or porton +; +; EXTRACT HEXADECIMAL NUMBER FROM LINE PTED TO BY HL +; RETURN WITH VALUE IN DE AND HL PTING TO OFFENDING CHAR +; +hexnum: + ld de,0 ; De=accumulated value +hnum1: + ld a,(hl) ; Get char + cp ' '+1 ; Done? + ret c ; Return if space or less + inc hl ; Pt to next + sub '0' ; Convert to binary + jr c,numerr ; Return and done if error + cp 10 ; 0-9? + jr c,hnum2 + sub 7 ; A-f? + cp 10h ; Error? + jr nc,numerr +hnum2: + push hl ; Save pointer + ex de,hl + add hl,hl + add hl,hl + add hl,hl + add hl,hl ; DE x16 to HL + ld e,a + ld d,0 + add hl,de + ex de,hl ; DE = DE * 16 + A + pop hl ; Get the pointer + jr hnum1 ; Try again +; +; NUMBER ERROR +; +numerr: + call print + db ' Num','?'+80h + jp exit +; +; SKIP TO NEXT NON-BLANK +; +sksp: + ld a,(hl) ; Get char + inc hl ; Pt to next + cp ' ' ; Skip spaces + jr z,sksp + dec hl ; Pt to good char + or a ; Set eol flag + ret +; + endif ; Peekon or pokeon or porton + +;----------------------------------------------------------------------------- + +; Test File in FCB for unambiguity and existence, ask user to delete if so +; Return with Z flag set if R/O or no permission to delete +; + if renon or cpon +extest: + call ambchk ; Ambiguous file names not allowed + call searf ; Look for specified file + jr z,exok ; Ok if not found + call getsbit ; Position into dir + inc de ; Pt to file name + ex de,hl ; Hl pts to file name + push hl ; Save ptr to file name + call prfn ; Print file name + pop hl + call rotest ; Check for r/o + jr nz,exer + call eraq ; Erase? + jr nz,exer ; Restart as error if no + ld de,fcb1 ; Pt to fcb1 + ld c,19 ; Delete file + call bdos +exok: + xor a + dec a ; Nz = ok + ret +exer: + xor a ; Error flag - file is r/o or no permission + ret + +; +; CHECK FOR AMBIGUOUS FILE NAME IN FCB1 +; RETURN Z IF SO +; +ambchk: + ld hl,fcb1+1 ; Pt to fcb +; +; CHECK FOR AMBIGUOUS FILE NAME PTED TO BY HL +; +ambchk1: + push hl + ld b,11 ; 11 bytes +amb1: + ld a,(hl) ; Get char + and 7fh ; Mask + cp '?' + jr z,amb2 + inc hl ; Pt to next + djnz amb1 + dec b ; Set nz flag + pop de + ret +amb2: + pop hl ; Pt to file name + call prfn + call print + db ' is AF','N'+80h + jp exit +; + endif ; Renon or cpon +; +; TEST FILE PTED TO BY HL FOR R/O +; NZ IF R/O +; + if renon or cpon or eraon +; +rotest: + push hl ; Advance to r/o byte + ld bc,8 ; Pt to 9th byte + add hl,bc + ld a,(hl) ; Get it + and 80h ; Mask bit + push af + ld hl,romsg + call nz,printhl ; Print if nz + pop af ; Get flag + pop hl ; Get ptr + ret +romsg: + db ' is R/','O'+80h +; +; CHECK USER TO SEE IF HE APPROVES ERASE OF FILE +; RETURN WITH Z IF YES +; +eraq: + call print + db ' - Eras','e'+80h + endif ; Renon or cpon or eraon + + if renon or cpon or eraon or proton +eraq1: + call print + db ' (Y/N/Q)?',' '+80h + call conin ; Get response + cp 'Q' ; Quit command? + jp z,exit + cp 'Y' ; Key on yes + ret +; + endif ; Renon or cpon or eraon or proton +; +; INIT FCB1, RETURN WITH DE PTING TO FCB1 +; + if eraon or lton or cpon +initfcb1: + ld hl,fcb1 ; Pt to fcb +initfcb2: + push hl ; Save ptr + ld bc,12 ; Pt to first byte + add hl,bc + ld b,24 ; Zero 24 bytes + xor a ; Zero fill + call fillp ; Fill memory + pop de ; Pt to fcb + ret +; + endif ; Eraon or lton or cpon +; + if eraon or lton or cpon or diron + +fillp: + ld (hl),a ; Store byte + inc hl ; Pt to next + djnz fillp ; Count down + ret +; + endif ; Eraon or lton or cpon or diron + +; +; CHECK FOR USER INPUT; IF ^C, RETURN WITH Z +; + if diron or lton or eraon or proton or peekon + +break: + push hl ; Save regs + push de + push bc + ld c,11 ; Console status check + call bdos + or a + ld c,1 ; Get char if any + call nz,bdos + pop bc ; Restore regs + pop de + pop hl +break1: cp ctrlc ; Check for abort + jp z,exit ; Exit + cp ctrlx ; Skip? + ret + endif ; Diron or lton or eraon or proton or peekon + +; AFTER A SEARCH, RETURN NZ SET IF DESIRED TYPE OF FILE FOUND, Z IF NOT +; THIS ALGORITHM LOOKS AT THE SYSTEM BIT OF THE LOCATED FILE; THIS +; BIT IS SET TO 1 IF THE FILE IS A SYSTEM FILE AND 0 IF NOT A SYSTEM +; FILE. THE FOLLOWING EXCLUSIVE OR MASKS ARE APPLIED TO RETURN Z OR NZ +; AS REQUIRED BY THE CALLING PROGRAM: +; +; SYSTEM BYTE: X 0 0 0 0 0 0 0 (AFTER 80H MASK, X=1 IF SYS, 0 IF DIR) +; +; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR 0 = 0 if X=0, = 80H if X=1) +; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR 80H = 80h if X=0, = 0 if X=1) +; BOTH : 0 0 0 0 0 0 0 1 (XOR 1 = 81H or 1H, NZ in both cases) + + if diron or eraon or lton or proton or cpon or renon + +getsbit: + dec a ; Adjust to returned value + rrca ; Convert number to offset into tbuff + rrca + rrca + and 60h + ld de,tbuff ; Pt to buffer + add a,e ; Add entry offset to base addr + ld e,a ; Result in e + push de ; Save ptr in de + add 10 ; Add offset of 10 to pt to system byte + ld e,a ; Set address + ld a,(de) ; Get byte + pop de ; Get ptr in de + and 80h ; Look at only system bit +systst equ $+1 ; In-the-code variable + xor 0 ; If systst=0, sys only; if systst=80h, dir + ; Only; if systst=1, both sys and dir + ret ; Nz if ok, z if not ok +; +; +; COPY HL TO DE FOR B BYTES +; +blkmov: + ld a,(hl) ; Get + ld (de),a ; Put + inc hl ; Pt to next + inc de + djnz blkmov ; Loop + ret + +; +; PRINT FILE NOT FOUND MESSAGE +; +prfnf: + call print + db ' No File','s'+80h + jp exit + +; LOG INTO USER AREA CONTAINED IN FCB1 +; +logusr: + ld a,(fcb1+13) ; Get user number +setusr: + ld e,a + ld c,32 ; Use bdos fct + jp bdos + +; +; PRINT FILE NAME PTED TO BY HL +; +prfn: + call print ; Leading space + db ' '+80h + ld b,8 ; 8 chars + call prfn1 + call print + db '.'+80h ; Dot + ld b,3 ; 3 chars +prfn1: + ld a,(hl) ; Get char + inc hl ; Pt to next + call conout ; Print char + djnz prfn1 ; Count down + ret + +; +; SEARCH FOR FIRST +; +searf: + push bc ; Save counter + push hl ; Save hl + ld c,17 ; Search for first function +searf1: + ld de,fcb1 ; Pt to fcb + call bdos + inc a ; Set zero flag for error return + pop hl ; Get hl + pop bc ; Get counter + ret + + endif ; Diron or eraon or lton or proton or cpon or renon + +;----------------------------------------------------------------------------- + +; Define buffers as high as possible in TPA for the following groups +; of commands: +; COPY needs SRCFCB and CBUFF +; LIST/TYPE needs PAGCNT and DIRBUF +; ERA, PROT, and DIR commands. needs DIRBUF +; If DIRBUF is defined, its value is in HL on return from this code. The DE +; register pair is not changed by the code, but the BC pair is affected. + +dirbufon equ lton or diron or eraon or proton + + if dirbufon +dirbuf: ds 2 ; Address for directory buffer + endif ;dirbufon + + if cpon +srcfcb: ds 2 ; Address of source file FCB (CBUFF address + ; ..is in the code) + endif ;cpon + + if lton +pagcnt: ds 2 ; Address for page counter + endif ;lton + + + if cpon or lton or eraon or proton or diron + +define: + push de + ld hl,(bdos+1) ; Get bottom of BDOS + ex de,hl ; ..into DE + ld hl,(1) ; Get BIOS warmboot address into HL + ld bc,-[0e00h+800h+3] ; Offset to command processor address + add hl,bc + +; Now we have to compare and pick the lower address as the top of TPA + + push hl ; Save CPR address while comparing + xor a ; Clear the carry flag + sbc hl,de ; Compute (CPR-BDOS) + pop hl ; Restore CPR address + jr c,define1 ; Branch if BDOS address is higher (use CPR) + ex de,hl ; Otherwise use BDOS address +define1: + + if lton + dec hl ; Put PAGCNT in first free byte at top of TPA + ld (pagcnt),hl + endif ;lton + + if cpon + ld de,-36 ; Calculate place for SRCFCB for copy command + add hl,de + ld (srcfcb),hl + if dirbufon + push hl ; Save if needed below + endif ;dirbufon + ld de,-[cpblocks*128] ; CBUFF can use same space as DIRBUF + add hl,de + ld (cbuff),hl + if dirbufon + pop hl + endif ;dirbufon + endif ;cpon + + if dirbufon + ld de,-[maxdirs*11] ; Space for directory buffer + add hl,de + ld (dirbuf),hl + endif + + pop de + ret + + endif ;cpon or dirbufon + +;----------------------------------------------------------------------------- + +; +; SEARCH FOR NEXT +; + if diron or eraon or lton or proton + +searn: + push bc ; Save counter + push hl ; Save hl + ld c,18 ; Search for next function + jr searf1 + +; LOAD DIRECTORY AND SORT IT +; ON INPUT, A=SYSTST FLAG (0=SYS, 1=DIR, 80H=BOTH) +; DIRECTORY IS LOADED INTO BUFFER AT TOP OF TPA +; RETURN WITH ZERO SET IF NO MATCH AND HL PTS TO 1ST ENTRY IF MATCH + +direrr: + call print + db 'DIR Ovf','l'+80h + jp exit + +getdir: + ld (systst),a ; Set system test flag + call logusr ; Log into user area of fcb1 + +; LXI H,DIRBUF ; Pt to dir buffer + call define ; Define buffer addresses + ld (hl),0 ; Set empty + ld bc,0 ; Set counter + call searf ; Look for match + ret z ; Return if not found +; +; STEP 1: LOAD DIRECTORY +; +gd1: + push bc ; Save counter + call getsbit ; Check for system ok + pop bc + jr z,gd2 ; Not ok, so skip + push bc ; Save counter + inc de ; Pt to file name + ex de,hl ; Hl pts to file name, de pts to buffer + ld b,11 ; Copy 11 bytes + call blkmov ; Do copy + pop bc ; Get counter + inc bc ; Increment counter + ld hl,maxdirs-1 ; See if count equals or exceeds MAXDIRS + ld a,b ; Check high bytes + sub a,h + jr c,gd1a ; If carry set, we are OK + ld a,c ; Check low bytes + sub a,l + jr nc,direrr ; If no carry, jump to error message +gd1a: + ex de,hl ; Hl pts to next buffer location +gd2: + call searn ; Look for next + jr nz,gd1 + ld (hl),0 ; Store ending 0 +; LXI H,DIRBUF ; Pt to dir buffer + ld hl,(dirbuf) ; Pt to dir buffer + ld a,(hl) ; Check for empty + or a + ret z +; +; STEP 2: SORT DIRECTORY +; + if sorton + push hl ; Save ptr to dirbuf for return + call diralpha ; Sort + pop hl + endif + xor a ; Set nz flag for ok + dec a + ret + +; +; DIRALPHA -- ALPHABETIZES DIRECTORY IN DIRBUF; BC CONTAINS +; THE NUMBER OF FILES IN THE DIRECTORY +; +diralpha: +; +; SHELL SORT -- +; THIS SORT ROUTINE IS ADAPTED FROM "SOFTWARE TOOLS" +; BY KERNIGAN AND PLAUGHER, PAGE 106. COPYRIGHT, 1976, ADDISON-WESLEY. +; + ld h,b ; Hl=bc=file count + ld l,c + ld (n),hl ; Set "N" + ld (gap),hl ; Set initial gap to n for first division by 2 + +; FOR (GAP = N/2; GAP > 0; GAP = GAP/2) +srtl0: + or a ; Clear carry +gap equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Get previous gap + ld a,h ; Rotate right to divide by 2 + rra + ld h,a + ld a,l + rra + ld l,a + +; TEST FOR ZERO + or h + ret z ; Done with sort if gap = 0 + + ld (gap),hl ; Set value of gap + ld (ii),hl ; Set ii=gap for following loop + +; FOR (II = GAP + 1; II <= N; II = II + 1) +srtl1: +ii equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Add 1 to ii + inc hl + ld (ii),hl + +; TEST FOR II <= N + ex de,hl ; Ii is in de +n equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Number of items to sort + ld a,l ; Compare by subtraction + sub a,e + ld a,h + sbc a,d ; Carry set means ii > n + jr c,srtl0 ; Don't do for loop if ii > n + + ex de,hl ; Set jj = ii initially for first subtraction of gap + ld (jj),hl + +; FOR (JJ = II - GAP; JJ > 0; JJ = JJ - GAP) +srtl2: + ld hl,(gap) ; Get gap + ex de,hl ; In de +jj equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Get jj + ld a,l ; Compute jj - gap + sub a,e + ld l,a + ld a,h + sbc a,d + ld h,a + ld (jj),hl ; Jj = jj - gap + jr c,srtl1 ; If carry from subtractions, jj < 0 and abort + or l ; Jj=0? + + jr z,srtl1 ; If zero, jj=0 and abort + +; SET JG = JJ + GAP + ex de,hl ; Jj in de + ld hl,(gap) ; Get gap + add hl,de ; Jj + gap + ld (jg),hl ; Jg = jj + gap + +; IF (V(JJ) <= V(JG)) + call icompare ; J in de, jg in hl + +; ... THEN BREAK + jr c,srtl1 + +; ... ELSE EXCHANGE + ld hl,(jj) ; Swap jj, jg + ex de,hl +jg equ $+1 ; Pointer for in-the-code modification + ld hl,0 + call iswap ; Jj in de, jg in hl + +; END OF INNER-MOST FOR LOOP + jr srtl2 + +; +; SWAP (Exchange) the elements whose indexes are in HL and DE +; +iswap: + call ipos ; Compute position from index + ex de,hl + call ipos ; Compute 2nd element position from index + ld b,11 ; 11 bytes to flip + endif ; Diron or eraon or lton or proton + + if diron or eraon or lton or proton or renon +iswap1: + ld a,(de) ; Get bytes + ld c,(hl) + ld (hl),a ; Put bytes + ld a,c + ld (de),a + inc hl ; Pt to next + inc de + djnz iswap1 + ret + endif ; Diron or eraon or lton or proton or renon + + if diron or eraon or lton or proton +; +; ICOMPARE compares the entry pointed to by the pointer pointed to by HL +; with that pointed to by DE (1st level indirect addressing); on entry, +; HL and DE contain the numbers of the elements to compare (1, 2, ...); +; on exit, Carry Set means ((DE)) < ((HL)), Zero Set means ((HL)) = ((DE)), +; and Non-Zero and No-Carry means ((DE)) > ((HL)) +; +icompare: + call ipos ; Get position of first element + ex de,hl + call ipos ; Get position of 2nd element + ex de,hl +; +; COMPARE DIR ENTRY PTED TO BY HL WITH THAT PTED TO BY DE; +; NO NET EFFECT ON HL, DE; RET W/CARRY SET MEANS DE/>> to indicate state) + ^W - recall command lines from history stack + ^E - recall history in reverse direction + + +Installation: + + The installation program, CLEDINST, allows you to set up the editor +to your preference. The RCP can be installed directly in memory or in a disk +file -- RCPxxx.ZRL or a system configuration saved with SNAP or NZBLITZ. +CLEDINST also serves as a "help" utility by displaying the current command +bindings. Type "CLEDINST //" for help with CLEDINST.COM. + + +History Tool: + + CLEDSAVE writes the contents of the history stack to a text file on disk. +The file can be reloaded later (CLEDSAVE L), or composed in advance +with a text editor, then loaded. If the file is too large for the history +stack, as many commmand lines as fit are loaded. + + CLEDSAVE is useful as in a startup alias to load frequently used command +lines from an easily altered file. For example: + +Alias: START + +A15: +CLEDSYS <- load SNAP image of ENV,TCAP,RCP,FCP,NDR,QUIET,&PATH +CLEDSAVE CLED.VAR L <- load precomposed command lines into CLED +CLED <- turn the shell on +... <- rest of startup line runs before CLED gets control + +For help with CLEDSAVE.COM, type "CLEDSAVE //". + + You may also use SNAP or NZBLITZ to save the system segment image with +command lines already loaded (turn SAVE OFF first.) + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcled.lib b/Source/BPBIOS/Z34RCP11/rcpcled.lib new file mode 100644 index 00000000..6c2879a7 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpcled.lib @@ -0,0 +1,1327 @@ + page + +; Library: RCPCLED for Z34RCP +; Author: Carson Wilson (modifications only) +; Version: 1.3b +; Date: October 8, 1989 +; Changes: Civilian time now prints "12" instead of "0" for midnight hour. +; Put Z3PLUS time display capability back in. +; Z3PLUS time display disabled if date = 01/01/78 (no clock). +; Added Rob Friefeld's fix to SAVE_LINE. +; +; Author: rdf +; Version: 1.3a +; Date: October 2, 1989 +; Changes: Changed order of installable highlight codes and history buffer +; addresses to simplify installing a ZRL file. Changed version +; number to guarantee compatibility with accessory programs. +; Option to print user number zero at prompt. +; Time string separator installable. + +; Author: Carson Wilson (modifications only) +; Version: 1.2 B +; Date: September 29, 1989 +; Changes: Made ">>" the prompt when previous commands are NOT being +; overwritten. +; Changed line edit commands to be closer to CP/M Plus. +; Shortened the clock read code (ZSDOS allows straight +; DateStamper calls). +; Uses DEFINE from RCPSUBS.LIB to save space. +; Does not print prompt user number if at user zero. +; Optional installable highlight codes for time in prompt. +; Time prompt shortened to "hh.mm" for easier reading. + +; Author: Rob Friefeld +; Version: 1.2 a +; Date: September 20, 1989 + +; Syntax: CLED [/] if "/", then run for one command line only +; e.g. from a shell like ZFILER + +; +; ===== D E F I N I T I O N S S E C T I O N ===================== +; + +clver equ 13 ; Version number (Install program compat.) +clrev equ 'b' ; Revision (Does not affect config.) + +del equ 7fh ; not in sysdef.lib + +; +;===== C O N F I G U R A T I O N A R E A ======================== +; + +; The installation program and buffer loader depend on the configuration +; of this data structure. It should not be changed. + +shname: db 'CLED',0 ; Name put on shell stack +versid: db clver ; CLED version +ddsep: db dudir_sep ; DU:DIR separator char +ins_flag: db clins ; Yes = insert mode +minsave: db clmin ; Discard line =< this +era_flag: db clera ; Erase stored line on exit +save_flag: db clsav ; Save command lines +tim_sep: db timesep ; Time string separator + +; --------------------------- + +; Command list for RCPCLED, Version 1.3 +; Set bit 7 to use a command with meta key + +cmd_list: + db 'Q' ; Meta key 1 + db 'H' ; Backspace + db 'S' ; Cursor left + db 'D' ; Cursor right + db 'A' ; Word left + db 'F' ; Word right + db 'B' ; Line end/ start + dc 'S' ; Line start + dc 'D' ; Line end + db 'G' ; Delete char + db DEL ; Delete left + db 'T' ; Delete word + db 'L' ; Delete word left + db 'X' ; Delete to SOL + db 'Y' ; Delete line + db 'K' ; Delete to EOL + db 'V' ; Toggle insert + db 'P' ; Enter control + db 'W' ; Recall line + db 'E' ; Recall reverse + db 'M' ; Execute line + db '[' ; ESC menu + +cmdlen equ $ - cmd_list + +; --------------------------- +; Highlight on/off codes for time display (installable) +; +stndout: db 0,0,0,0 ; Must terminate with hibit or binary 0 +stndend: db 0,0,0,0 ; Ditto + +; --------------------------- +; 4 bytes are used here for the information of the history save/load tool, +; CLEDSAVE + +histaddr: dw history ; Pointer to history buffer +histsz: dw histsize ; Buffer size + +; +;===== M A I N C O D E S E C T I O N ======================== +; +cled: + call define ; Set pointer to free mem + ld de,-lbufwid-1 + add hl,de + ld (line),hl ; Set line buffer location + xor a + ld (hl),a ; Zero line + ld hl,history ; History stack + ld (recall_ptr),hl ; Init position pointer to start + + ld a,(fcb+1) ; Check command line option + cp '/' + jr z,cledit ; Go right to editing + + ld a,(z3msg+3) ; QSHELL + dec a ; <> 1 on manual invocation + jr z,cledit ; Skip installation + +; +;===== S H E L L I N S T A L L A T I O N ========================= +; +sh_inst: + ld hl,shname + call shpush ; Z = OK + ret z + call print ; Complain about stack and cancel + dc cr,lf,'SH STK' ; Full or non-existent + ret + +; +;===== L I N E E D I T =========================================== +; + +; This is the main entry point for the shell +; 1 - Display prompt +; 2 - Get user input +; 3 - Reset shell bit +; 4 - Run command line + + +; Subtask 1 -- +cledit: + call prompt ; Display system prompt + +;---------------------------------------- +; Subtask 2 -- + +; The editor returns NZ if the shell pop command has been given. If not, it +; returns the character count of the command line in B. + + call EDIT + +;---------------------------------------- +; Subtask 3 -- + push af ; Save return code + xor a + ld (z3msg+3),a ; PUTCST + pop af + +;---------------------------------------- +; Subtask 4 -- + jp nz,shpop ; Quit shell + +; Here we load the MCL directly from the line buffer. On OVFL, loop to edit. + +loadcl: + ld a,(z3cl+2) ; MCL size + inc b ; B contains line count, include terminating 0 + cp b ; Compare to line size + jr nc,loadcl1 ; OK + +mclerr: + call print + dc cr,lf,'OVFL',cr,lf + jp cledit + +loadcl1: + ld de,z3cl+4 ; Set MCL pointer to start + ld (z3cl),de + + ld hl,(line) + ld c,b + ld b,0 + ldir ; Move line buff to MCL + ret ; Run it + + +; +;===== S U B R O U T I N E S ======================================= +; + +; Prompt -- PRINT a DU:DIR prompt. +; +prompt: + if systime + call print_time + endif + + ld bc,(cusr) ; GDEFDU + ld a,b ; Drive + add a,'A' ; Make it a letter + call conout ; Write it + ld a,c ; Get user + + if puser0 + call pusr ; Write it + else + or a + call nz,pusr ; Write it IF NONZERO + endif ;puser0 + + call dutdir ; Get the ndr + jr z,prompt1 + ld a,(ddsep) ; DU:DIR separator + call conout + ld b,8 ; Eight chars max +nameloop: + ld a,(hl) ; Get the first char + cp ' ' + call nz,conout ; Write it if not blank + inc hl + djnz nameloop + +prompt1: + call prompt2 + ld a,(save_flag) ; If save is OFF, prompt is >> + or a + ret nz +prompt2: + call print + dc '>' + ret + +; PUSR -- Convert user # in A to decimal and print +; +pusr: + ld hl,10 shl 8 + '0'-1 ; H=10, L='0'-1 + cp h ; User < 10 ? + jr c,pusr1 +pusr0: + inc l ; Advance character for user number tens digit + sub h + jr nc,pusr0 + add a,h + ld h,a ; Keep low digit of user number in H + ld a,l ; Display tens digit + call conout + ld a,h ; Ready to process units digit +pusr1: + jp decout ; Routine in RCPSUBS.LIB +; add '0' +;pusr2: +; jp conout + +; Console input without echo + +cin: + push hl + push de + push bc +cin1: ld c,dirconf ; DCIO + ld e,-1 + call bdos + or a + jr z,cin1 + pop bc + pop de + pop hl + ret + +; +;===== E D I T O R S E C T I O N ================================ +; + +; Date: October 2, 1989 + +; Entry is EDIT +; Return Z = Execute command line, NZ = Quit shell, B = char count of line + +; Initialize to on-line environment. +; While editing, HL -> current position in LINE, B = char count, +; C = cursor position (0 .. count), DE = scratch + +edit: + ld hl,(line) ; Init to start of line + xor a + ld b,a ; Line count = 0 + ld c,a ; Cursor pos = 0 + + push hl ; There may already be a line here + dec b ; Accumulate possible char count in B +edit1: + inc b + cp (hl) ; A = 0 + inc hl + jr nz,edit1 ; Loop until 0 terminator +edit2: + pop hl ; Point to line again + call zline ; Zero the remainder of LINE buffer + call ptail ; Print the line from cursor position + +;-------------------------------------------------------------------- + +; EDIT COMMAND LOOP + +; Get a char. If it is text, enter it. If it is a control, scan the +; CMD_LIST for a match. If found, compute offset into jump table and go. +; A "shifted" key (high bit set in table) is matched after the "meta-key" +; has been entered. + +ecmd: + exx ; Main regs must be preserved + ld hl,ecmd ; Save address so a return comes back here + push hl + +no_match: + call cin ; Next key... + cp 'C'-'@' ; Warm boot? + jp z,0000h + + ld hl,meta_flag ; Shift flag + or (hl) ; Mask in possible high bit + ld (hl),0 ; Reset flag + exx ; Recover main regs + + cp 20h ; Test key + jr c,control_key ; Not text + cp del ; This control char > text chars + jp c,enter ; Input text + +control_key: + call menuinp ; Convert control char to cap + + exx ; Must preserve main regs + ld hl,cmd_list ; Scan command list + ld bc,cmdlen + cpir + jr nz,no_match + ld hl,cmd_vector + ld a,cmdlen-1 ; Point to address in vector table + sub c + add a,a + ld c,a + add hl,bc + ld c,(hl) + inc hl + ld b,(hl) + ld (cjump),bc ; Address to jump to + exx ; Restore regs! + +cjump equ $+1 + jp 0 + + +; Convert a control key entry to cap char + +menuinp: + push af + and 80h ; Keep high bit + ld e,a + pop af + and 7fh + call ucase + or e ; Restore high bit + ret + +; Mark meta-key flag + +meta_key1: + ld a,10000000b + ld (meta_flag),a + ret + +meta_flag: db 0 ; Initial value 0 = no shift + + +; Jump table for commands + +cmd_vector: + dw meta_key1 ; Shift key + dw bsp ; Backspace + dw bsp ; Cursor left + dw fsp ; Cursor right + dw bwrd ; Left word + dw fwrd ; Right word + dw linend ; To EOL + dw linbeg ; To SOL + dw linend1 ; To EOL/SOL + dw delete ; Delete char + dw delft ; Delete char left + dw delwrd ; Delete word right + dw delwlft ; Delete word left + dw delsol ; Delete to start of line + dw dline ; Delete line + dw deleol ; Delete to end of line + dw instog ; Toggle insert + dw ctl_entry ; Enter control char + dw recall_back ; Scroll back in history + dw recall_fwrd ; Scroll ahead in history + dw eds$ex ; Execute line + dw esc_menu ; Submenu + +;-------------------------------------------------------------------- + +; ON-LINE ROUTINES, EDITING CURRENT LINE IN LINE BUFFER + +; WHILE ON LINE: +; B = CHAR COUNT (0..lbufwid) C = CURSOR POSITION (0..lbufwid) +; HL = MEM POSITION + + +; Backspace +; Return Z = backspace not done, NZ = all OK + +bsp: + xor a + cp c ; Cursor pos + ret z ; At start + dec hl ; Back up in mem + dec c ; Cursor pos back +bspace: + ld a,bs ; Back up on screen + or a ; Must ret nz + jp conout + + +; Forward space +; Return Z = not done + +fsp: + ld a,(hl) + or a + ret z ; At EOL + inc hl + inc c + jp pctl ; Screen advance by reprinting char + + +; Back word + +bwrd: + call bsp ; Backspace + ret z ; Nowhere to go + ld a,(hl) + cp ' ' + jr z,bwrd ; Backspace over blanks + dec hl ; Now backspace until next wordsep + call wrdsep ; Look at char before this position + inc hl + jr nz,bwrd + ret + +; Forward word + +fwrd: + call wrdsep ; Are we on a word separator? + jr z,fwrd1 ; Yes + call fsp ; No, advance until we find one + jr fwrd + +fwrd1: call fsp ; Word sep found, advance 1 more space + ld a,(hl) ; Are we on a blank? + cp ' ' + jr z,fwrd1 ; Don't quit on a blank + ret + + +; Delete char left + +delft: + call bsp ; Backspace and fall through to delete + + +; Delete char + +delete: + call delmem ; In memory + jp ptail ; Refresh screen from cursor position + +; Delete to start of line + +delsol: + ld a,c ; Get cursor pos + or a + ret z ; Already at start + cp b + jr z,dline ; At end, so delete entire line (quicker) + ld e,a ; Cursor pos = # chars to delete + call linbeg ; Go to start +delcmd1: + call delmem ; Delete first char in memory + dec e ; Loop counter + jr nz,delcmd1 + jp ptail ; Now update screen + + +; Delete word left + +delwlft: + call bwrd ; Back a word and fall thru ... + + +; Delete word right + +delwrd: + call wrdsep ; On a word sep? + jr z,delete ; Yes, kill it + ld a,b ; Compare line count to cursor pos + cp c + jr z,delete ; On last char of line +delwrd1: + call delmem ; Delete in mem, let screen catch up later + jr delwrd ; Go until word sep found + + +; Delete line + +dline: + call linbeg ; Position at line start and fall thru ... + +; Delete to eoln + +deleol: + call ereol ; Clear on screen + ld b,c ; Char count = current position + jp zline ; Zero line tail in mem + +; Insert/overwrite toggle + +instog: + ld a,(ins_flag) ; Flag 0 -> owrt + cpl + ld (ins_flag),a + ret + +; Enter a control + +ctl_entry: + call cin + and 1fh ; Fall thru to normal char entry + +; Enter a char + +enter: + ex af,af' ; Save char + ld a,b ; At eoln? + cp c + jr z,ovrwrt ; Yes, no need for insert mode + ld a,(ins_flag) ; Which mode are we in? + or a ; 0 = overwrite, nz = insert + jr nz,insert + + +; Enter char in overwrite mode + +ovrwrt: + ld a,b ; Char count + cp lbufwid-2 ; Line full? + jr c,ovr1 ; No + cp c ; At EOLN? + ret z ; Accept no more chars + +ovr1: ex af,af' ; Recover char + ld (hl),a ; Put char in place + call fsp ; Advance by printing it + ld a,b ; Char count -> a + cp c + ret nc ; No need to incr char count inside line + inc b ; Else add to count + ret + +; Enter char in insert mode + +insert: + ld a,b ; Line full? + cp lbufwid-2 + ret nc + +insrt: + ld a,b ; At eoln? + sub c ; A = # chars to eoln + jr z,ovr1 ; Yes, really want overwrite + call insmem ; Push chars down to make room + ex af,af' ; Recover new char + ld (hl),a ; Place char in line + call ptail ; Reprint entire line from here + inc b ; Inc char count + jp fsp ; Advance cursor + + +; Line end/start toggle + +linend: ; Go to eoln or, if there, to start of line + ld a,b + cp c + jr z,linbeg + +linend1: + call fsp ; Print ahead until EOL + jr nz,linend1 + ret + +linbeg: + call bsp ; Backspace until start + jr nz,linbeg + ret + + +; Compare current char to list of word separators + +wrdsep: + push hl + push bc + ld bc,wrdseplen + ld a,(hl) + ld hl,wrdseps + cpir + pop bc + pop hl + ret + +wrdseps: + db 0,' ,;:.' ; Punctuation word separators +wrdseplen equ $ - wrdseps + + +; Delete current char from line + +delmem: + ld (hl),0 ; Terminal 0 or char to be deleted + ld a,b + sub c ; A = (count-position) = chars from end + ret z ; At eoln, no char + dec b + ret z ; Single char line + dec a + ret z ; On last char, just deleted it +delmem1: + inc a ; To move terminal 0 in + push hl + push de + push bc + ld d,h ; Dest is current pos + ld e,l + inc hl ; Source, terminal 0 + ld c,a ; Count, line tail + ld b,0 + ldir ; Block move + pop bc + pop de + pop hl + ret + +; Insert a char in line + +insmem: + push bc ; Make room for char in line + push de + ld c,a ; Bc = # chars to move + ld b,0 + add hl,bc ; Dest is new eoln + ld d,h ; Now in DE + ld e,l + dec hl ; Source is current eoln + lddr ; Tail move + pop de + pop bc ; Recover char count, crs pos info + inc hl ; Hl to next char + ret + + +; Print line tail from cursor position, return to position + +ptail: + push hl ; Save mem pos + push bc ; Save screen pos + call linend1 ; Print ahead to end of line + call ereol ; Clean off danglers +ptail1: + ld a,c ; End of line cursor pos + pop bc + pop hl + sub c ; Current cursor pos + ret z ; At end of line already + ld e,a ; Loop counter +ptail2: + call bspace ; Else back up to where we were + dec e + jr nz,ptail2 + ret + + +; Print a char, turn a control char into a cap char + +pctl: + push af + cp 20h + jr nc,pctl1 + add '@' +pctl1: call conout + pop af + ret + + +; Convert char or control key to upper case + +ucase: + cp ' ' + jr nc,notctl + add '@' +notctl: cp 'a' + ret c ; Not a lowercase + cp 'z'+1 + ret nc ; Not a lowercase + sub ' ' ; Yes, a lowercase + ret + + +; Zero line tail + +zline: + push hl + push bc + ld hl,(line) ; HL -> start of line + ld c,b ; BC = char count + ld b,0 + add hl,bc ; HL -> EOLN + ld a,lbufwid + sub c + dec a + jr z,zline0 + ld b,a ; # of 0's + xor a +zline1: + ld (hl),a + inc hl + djnz zline1 +zline0: + pop bc + pop hl + ret + + +; ESC key pressed - get submenu command + +esc_menu: + call cin + call ucase + cp 'Q' ; Quit + jr z,edquit + cp 'S' ; Toggle Save + ret nz ; Loop if none of these + +; Toggle recording state +; - Alter line prompt to > if save ON, >> if save OFF + +save_tog: + ld a,(save_flag) ; Flip flag byte + cpl + ld (save_flag),a + call crlf + call prompt ; Print new prompt string + pop af ; Lift ecmd from stack + jp edit ; Restart + + +; Exit editor + +eds$ex: + pop af ; Lift ECMD from stack + ld a,(save_flag) ; Are we recording? + or a + ret z ; Nope + + ld a,(minsave) ; Is line worth keeping? + cp b + push bc + call c,save_line + pop bc + +edn$ex: + xor a ; Return Z + ret + + +; Exit and pop shell + +edquit: + pop af ; Lift ECMD from stack + xor a ; Return NZ + dec a + ret + + +; --------------------------- + +; HISTORY STACK ROUTINES for RCPCLED, Version 1.2 + +;Each command line is pushed onto the history stack before execution. As the +;older ones overflow, they are eliminated. The last character of each line +;has the high bit set. The buffer terminates with a 0. +;The history stack is internal to the RCP, but could be implemented in an RSX + +; Save new line to stack +; - This routine called only on exit, so on-line regs not preserved. +; - Push contents down by size of current line +; - Move line buffer to start of stack +; - Terminate line with high bit set +; - Terminate history with 0 after last complete line +; - If current line is too big for buffer size chosen, do nothing + +save_line: + ld c,b ; Line size from b to bc + xor a + ld b,a + push bc + ld hl,HISTSIZE + sbc hl,bc ; Buffer size - line length + jr z,savel_err ; Not enough room + jr c,savel_err ; Definitely not enough room! + push hl + ld hl,hbuf_top + push hl + sbc hl,bc ; hl -> bufftop - line size + pop de ; de -> bufftop + pop bc ; bc = buffsize - line size + lddr ; tail move + + pop bc ; Recover line size in bc + ex de,hl + inc de ; de -> buffstart + ld hl,(line) ; Move in line + ldir + dec de + ex de,hl + set 7,(hl) ; Tag line terminus + + ld hl,hbuf_top ; Terminate history after last complete line +savel1: + dec hl ; Back up to EOLN + bit 7,(hl) + jr z,savel1 ; Loop until hi-bit encountered + inc hl + ld (hl),0 + ret + +savel_err: + pop af ; Lift BC push + ret + +; Recall command history, newest -> oldest +; - recall_ptr is init to start of buffer on each CLED invocation +; - return with pointer updated to next line + +recall_back: + call check_recall ; Is there anything in buffer? + ret nc ; No + +; Transfer from recall pointer to line buffer +; - enter hl @ recall_ptr +; - return ptr -> start of next command if no OVFL + +rc_back1: + ld de,(line) ; Destination for move +rc_back1a: + ld a,(hl) + or a + jr z,recall_quit ; Buff end + ldi + bit 7,a + jr z,rc_back1a + + ld (recall_ptr),hl ; Update ptr now + ex de,hl ; Point to end of line in line buffer + ld (hl),0 ; Terminate it + dec hl + res 7,(hl) ; Fix high bit from storage + + pop af ; Lift ecmd from stack + jp edit ; Restart on this line + +recall_quit0: + pop af ; Lift subroutine call from stack +recall_quit: + exx ; Recover main regs + ret ; Back to editing + + +; Recall command history, oldest -> newest + +recall_fwrd: + call check_recall ; Anything in buffer? + ret nc ; No + call rc_fwrd1 ; Move to previous line + call rc_fwrd1 ; Don't repeat line on direction rev + jr rc_back1 ; Now same code as recall_back + +rc_fwrd1: + dec hl ; Initially, HL -> next line to recall + ld de,history ; Underflow address +rc_fwrd1a: + push hl ; Compute position relative to top + xor a + sbc hl,de + pop hl + ret z ; Quit when start of buff reached + jr c,recall_quit0 ; Underflow + dec hl ; Going backwards in buffer + bit 7,(hl) + jr z,rc_fwrd1a + inc hl ; Point to char past command terminator + ret + + +; Check to see if anything in recall buffer yet +; - Ret NC = no, main regs preserved +; - Else switch main regs to alt, ret HL @ recall buffer line + +check_recall: + ld a,(history) ; Is anything in buffer yet? + or a + ret z ; Nope + call linbeg + exx + ld hl,(recall_ptr) + scf + ret + +; --------------------------- + +; Routine: EREOL function for Z34RCP +; Author: Rob Friefeld +; Version: 1.0 +; Date: September 19, 1989 +; +; Entry: EREOL +; Function: To clear to end of line +; Comments: The setting of the ERLTCAP equate determines whether this +; command uses the TCAP information or not. If not, it uses the +; ereol string passed in macro CLR_EOL. That string should +; end with the high bit set. The setting of the ERLQUICK equate +; determines whether to simply output the TCAP string for this +; function or to interpret it as does Rick Conn's VLIB version. +; Uses RCPSUBS.LIB routines CONOUT and PRINTHL. + + +; ------------------------------------------------------------------- + + if [not erltcap] +; Erase to end of line. Return NZ. + +ereol: call print + clr_eol +; or -1 ; For VLIB compatibility + ret + + + else + if erlquick + +; --------------------------- + +; This version just prints the EREOL string: no delay, no interpretation. + +ereol: + push hl + ld hl,z3tcap+17h ; CLS string + xor a ; Skip to EREOL string +ereol1: cp (hl) ; Skip once + inc hl + jr nz,ereol1 +ereol2: cp (hl) ; Skip twice + inc hl + jr nz,ereol2 + call printhl ; Print it + pop hl + ret + +; --------------------------- + +; This is a disassembly of EREOL from VLIB + else + +ereol: + push bc + push de + push hl + ld hl,z3tcap+16h ; Point to ereol delay + ld d,(hl) + inc hl + call vidskp + call vidskp + call vidout + pop hl + pop de + pop bc + xor a + dec a + ret + +vidskp: + ld a,(hl) + inc hl + or a + ret z + cp '\' + jr nz,vidskp + inc hl + jr vidskp + +vidout: + ld a,(hl) + or a + jr z,vid2 + inc hl + cp '\' + jr nz,vid1 + ld a,(hl) +vid1: + call conout + jr vidout + +vid2: + ld a,d + or a + ret z + ld c,a + ld hl,z3env+2bh ; Processor speed + ld a,(hl) + or a + jr nz,vidl1 + ld a,4 +vidl1: + ld b,a + push bc + call vdelay + pop bc + dec c + jr nz,vidl2 + ret +vdelay: + call vdel1 + djnz vdelay + ret +vdel1: + ld c,20 +vdel1a: + ex (sp),hl + ex (sp),hl + dec c + jr nz,vdel1a + ret + + endif ;erlquick + endif ;not erltcap + +; +;===== Z 3 L I B R O U T I N E S ================================ +; + +; Disassembly of Z3LIB routines DUTDIR, SHPUSH, SHPOP +; For use with CLED RCP segment ONLY +; Does not save regs as does Z3LIB, and has less env error checking +; rdf 10/2/89 + +DUTDIR: + ld a,z3ndirs ; No NDR + or a + ret z + + ld hl,(z3ndir) + inc b +dutdir1: + ld a,(hl) + or a + jr nz,dutdir2 + dec b + xor a + ret +dutdir2: + cp b + inc hl + jr nz,dutdir3 + ld a,(hl) + cp c + jr nz,dutdir3 + inc hl + dec b + xor a + dec a + ret +dutdir3: + push bc + ld bc,11h + add hl,bc + pop bc + jr dutdir1 + + +shpop: + +; *** +;Special function for RCPCLED -- null saved command line + ld a,(era_flag) ; Erase? + or a + jr z,eflag1 ; Z = NO + xor a + ld (history),a +eflag1: +; *** + +;shpop: + call getsh ; HL -> stack, DE = size, B = entries + ret z ; No stack + ld c,e ; Entry size + ld a,(hl) + or a + ret z ; Empty + ex de,hl + add hl,de ; HL -> next entry, DE -> first entry + xor a +shpop1: + ld (de),a ; Zero entry + dec b + ret z ; Successful exit, no more entries + push bc ; Pop next entry + ld b,0 + ldir + pop bc + jr shpop1 + + +shpush: + push hl ; Save string pointer + call getsh + jr z,shpush_err1 ; No stack + +shpush3: + ld a,(hl) ; Look for free entry + or a + jr z,shpush4 + add hl,de + djnz shpush3 + jr shpush_err2 ; Stack full +shpush4: + call getsh ; Point to top of stack + push bc +shpush5: + dec b + jr z,shpush6 + add hl,de + jr shpush5 +shpush6: + pop bc + ld c,e + dec hl + ex de,hl + add hl,de ; HL -> (entry-1) + size, DE -> (entry-1) + ex de,hl +shpush7: + ld a,b + cp 1 + jr z,shpush8 + dec b + push bc + ld b,0 + lddr + pop bc + jr shpush7 +shpush8: + call getsh + pop de + ex de,hl +shpush9: + ld a,(hl) + ldi + or a + jr nz,shpush9 + +shpushx: + ret + +shpush_err1: +; ld a,1 ; No stack +; jr shpush_err + +shpush_err2: + ld a,2 ; Stack full +shpush_err: + pop hl + or a + ret + + +; Get shell stack entry +; Return HL -> top of stack +; DE = entry size +; C = unchanged +; B = # entries +; A = # entries +; Z = no entries +getsh: +getsh2: + ld hl,(z3env+1eh) ; Stack + ld a,(z3env+20h) ; # entries + ld b,a + ld de,(z3env+21h) ; Entry size in E + ld d,0 + or a + ret + +; +;===== C L O C K R E A D I N G ================================== +; + + if systime + +; Print system time from DateStamper, ZS/ZDDOS/Z3PLUS clock + +; Entry point +; Print the string with leading '0' suppression +; Format: "h.mm " or "hh.mm " + +print_time: + +; 1. Test for DateStamper/ZSDOS/Z3PLUS and read clock if present + + ld c,12 ; Return version + ld e,'D' ; DateStamper test + call bdos + ld a,l ; Version # + cp 30h ; Z3PLUS? + jr nc,time1 ; Yes + ld a,h + cp 'D' + ret nz ; No clock + +; 2. Get time + + ld hl,time2 + push hl ; Return address on stack + push de ; Clock address on stack + ld hl,dtbuf ; Point to buffer + ret ; Call clock, return to time2 +time1: ; Z3PLUS entry point + ld c,105 ; CP/M Plus get time + ld de,dtbuf+1 + push de + call bdos + pop hl + ld a,(hl) + inc hl + ld b,(hl) + dec a + or b + ret z ; No clock if date = 0001 +time2: + +; 3. Turn highlight on, if present + + ld hl,stndout + call printhl + + ld hl,dtbuf+3 ; Point to hours + +; 4. Convert military time to civilian, if selected + + if civtim + ld a,(hl) ; Hours + or a ; Midnight? + jr nz,time3 ; No + ld a,24h ; Yes, say "12" +time3: sub 13h ; Time past 12:59 pm? + jr c,time4 ; No, don't change + daa ; Decimal adjust + inc a ; Yes, xlate to 12-hour + daa + ld (hl),a ; ..and patch in. + endif ; civtim + +; 5. Display time + +time4: + xor a + call pmbcd ; Print hours as 1 or 2 digits + ld a,(tim_sep) ; Print separator between hours, minutes + call conout + inc hl ; Point to minutes + ld a,80h ; Say print leading 0 + call pmbcd ; Print minutes as 2 digits + +; 2. Turn highlight off, if present + + ld hl,stndend + call printhl + jp spac ; Space before rest of prompt + +; +;===== D A T A ==================================================== +; + +; Buffer for date/time for read/write system clock + +dtbuf: ds 6 + + endif ;systime + + +line ds 2 ; Pointer to line buffer +recall_ptr ds 2 ; History position pointer +history ds HISTSIZE,0 ; History buffer +hbuf_top: equ $-1 + +; End RCPCLED.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcls.lib b/Source/BPBIOS/Z34RCP11/rcpcls.lib new file mode 100644 index 00000000..e6264137 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpcls.lib @@ -0,0 +1,35 @@ + page + +; Library: RCPCLS for Z34RCP +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: CLS +; Function: To clear the CRT screen +; Comments: The setting of the CLSTCAP equate determines whether this +; command uses the TCAP information or not. If not, it uses the +; clear-screen string passed in macro CLSSTR. That string should +; end with the high bit set. + +cls: + if clstcap ; If using TCAP for clear screen string + ld a,(z3tcap) ; TCAP address from Z34CMN.LIB + cp ' '+1 ; See if blank + jr nc,cls1 ; If not, go to clear screen code + jp crlf ; If blank, just do CRLF +cls1: + ld hl,clrscr ; Address from Z34CMN.LIB + jp printhl ; Display it + + else ; Not using tcap + + call print + clsstr ; String from Z34RCP.LIB + ret + + endif ;clstcap + +; End RCPCLS.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcmd.lib b/Source/BPBIOS/Z34RCP11/rcpcmd.lib new file mode 100644 index 00000000..58a54e78 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpcmd.lib @@ -0,0 +1,56 @@ + page + +; Library: RCPCMD for Z34RCP +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; Description: Command Table and Custom Commands for Z34-RCP + +; This is the customization file for the ZCPR Version 3.4 resident command +; package. Use it to add your own custom commands to the RCP. + +; Give each of your custom commands a unique label and command name. Then +; add the command name(s) to the macro CUSTTBL, below, and append the code +; for the commands to the end of this file. + +; CUSTTBL - Custom commands table. +; +; Add one line to CUSTTBL for each of your custom commands. Each line +; must be of the form: +; +; COMMAND name, TRUE, wheel, label +; +; Where COMMAND and TRUE appear as-is, and "name", "wheel", and "label" +; are created by the user. "Name" is a name of four characters or less used +; to invoke the command, in upper case. "Wheel" is "true" to protect the +; command from non-wheel users, "false" otherwise. "Label" marks the +; beginning of the custom code. For example, to create a wheel- +; protected command named "DIR" which calls the code at label "directory", +; CUSTTBL appears as follows: +; +;custtbl macro +; command DIR, true, true, directory +; endm + +custtbl macro +;; command ____, true, ____, _______ ; Template for custom commands + endm + +; ------------------------------ + +; RCP command dispatch table + + db cmdsize ; Length of each command name + cmdtbl ; Dispatch table from Z34RCP.LIB + custtbl ; Optional custom commands + db 0 ; Marks end of command jump table + +; -------------------------------------------------- + +; Insert label(s) and code for custom RCP commands here: + +; + +; END RCPCMD.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcp.lib b/Source/BPBIOS/Z34RCP11/rcpcp.lib new file mode 100644 index 00000000..6ec69f48 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpcp.lib @@ -0,0 +1,245 @@ + page + +; Library: RCPCP for Z34RCP +; Author: Carson Wilson +; Version: 1.3 +; Date: August 11, 1989 +; Changes: Responds dynamically to QUIET flag, eliminating "noise." + +; Version: 1.2 +; Date: December 30, 1988 +; Changes: Now works properly with CP/M Plus. +; Moved SETDMA to common routines. + +; Author: Carson Wilson +; Version: 1.1 +; Date: August 4, 1988 +; Changes: Now initializes FCB1 before calling SetFStp, allowing +; stamp setting of multiple-extent files. +; +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: CP +; Function: Copy a file from one place to another +; Syntax: If FCBSWAP false: +; CP destfile=srcfile, CP =srcfile +; If FCBSWAP true: +; CP srcfile destfile, CP srcfile +; If TESTEQ and FCBSWAP true: +; Both of the above forms work +; +; Comments: Both file specifications can include a directory specification. +; If only one file name is given, then the current directory and +; the source file name are assumed for the destination. + +; +; New ZSDOS/DosDisk BDOS standard functions: +; +GetFStp equ 102 ; Get file stamp function +SetFStp equ 103 ; Set file stamp function + +copy: + call retsave + call dirchek ; Test bad directory + + if leftright + call fcbswap ; Exchange fcb1 with fcb2 + endif + +; If new is blank, make it the same name and type as old + + ld de,fcb1+1 ; Point to destination file name + ld a,(de) ; Get first character + cp ' ' ; If not blank (no name) + jr nz,copy0 ; ..then branch to copy + ld hl,fcb2+1 ; Copy source name into destination FCB + ld b,11 ; Name and type are 11 bytes + call blkmov + +; See if destination is same as source, and abort if so + +copy0: + ld hl,fcb1 ; Set up pointers to two files + ld de,fcb2 + push hl + push de + inc hl ; Point to names of files + inc de + ld b,13 ; Compare 13 bytes (name, type, and user #) +copy1: call comp + jr nz,copy2 ; If they differ, go on with copy + ld a,(cdrv) ; ZCPR current drive + inc a ; Shift to range 1..16 + ld b,a ; ..and keep value in B + pop de ; Restore pointers to FCBs + pop hl + ld a,(de) ; Get drive of source file + ld c,a ; ..and save it in C + or a ; Is it default drive? + jr nz,copy1a ; Branch if drive made explicit + ld c,b ; Otherwise, copy default drive into C +copy1a: ld a,(hl) ; Get drive of destination file + or a ; Is it default drive? + jr nz,copy1b ; Branch if drive made explicit + ld a,b ; Otherwise, get current drive +copy1b: cp c ; Compare the two drives specified + jr nz,copy3 ; Branch if they are different + jp duperr ; Tell EH duplicate filespecs +copy2: + pop de ; Clean up the stack + pop hl + +; Make note of the user numbers of the two files + +copy3: + ld a,(fcb1+13) ; Get destination user number + ld (usrdest),a + ld a,(fcb2+13) ; Get source user number + ld (usrsrc),a + +; Set up new FCB for source file and open the source + + call define ; Define buffer addresses dynamically +srcfcb equ $+1 + ld hl,0 ; Get address to use for new source FCB + push hl + ex de,hl ; Copy file data to new FCB + ld b,12 + call blkmov + call logsrc ; Log in user number of source file + pop hl ; Initialize the source file FCB + call initfcb2 + ld c,15 ; Open source file + call bdos + inc a ; Check for error + jp z,noflerr ; File not found error handler + + if StpCall + call cpmver + jr nc,copy4 ; Don't do this if CP/M Plus +stpbuf equ $+1 + ld de,0 + call setdma ; Set DMA to date buffer + ld de,(srcfcb) + ld c,GetFStp ; Get stamp (if any) to DMA + call bdos + ld (gotstp),a ; Store result + ld de,tbuff ; Restore DMA + call setdma ; ..for search +copy4: + endif ; StpCall + +; Make sure destination file does not already exist + + call logdest ; Log into destination user area + call extest ; Test for existence of file in fcb1 + jp z,exit ; Branch if it exists and user says no + +; Create destination file + + ld de,fcb1 ; Point to destination FCB + ld c,22 ; BDOS make-file function + call bdos + inc a ; Test for error (no directory space) + jp z,fulerr ; Invoke EH if not OK + +; Copy source to destination + +copy5: call logsrc ; Log in source user area + ld b,0 ; Initialize counter + ld de,(cbuff) ; Initialize buffer pointer +copy5a: push de ; Save address and counter + push bc + call setdma ; Set DMA to cbuff+(b*128) + ld de,(srcfcb) ; Point to source file FCB + ld c,20 ; BDOS read-sequential function + call bdos + pop bc ; Get counter and address + pop de + or a ; Read Ok? + jr nz,copy5b ; Branch if end of file + ld hl,128 ; Point DE to next buffer address + add hl,de + ex de,hl + inc b ; Increment counter + ld a,b ; See if buffer full + cp cpblocks + jr nz,copy5a ; If not, go back for more +copy5b: ld a,b ; Get count of blocks loaded into buffer + or a ; Are there any? + jr z,copy6 ; Branch if not (we are done) + push bc ; Save count + call logdest ; Log into destination user number +cbuff equ $+1 ; Pointer for in-the-code modification + ld de,0 ; Point to beginning of copy buffer +copy5c: push de ; Save buffer address + call setdma ; Set dma to buffer + ld de,fcb1 ; Point to destination file FCB + ld c,21 ; Sequential write the block + call bdos + or a ; Get result + jp nz,fulerr ; Invoke EH (disk full or write error) + pop de ; Get buffer address & balance stack + pop bc ; Get count + dec b ; Buffer empty? + jr z,copy5 ; Yes. Back for refill + push bc ; No. Save count + ld hl,128 + add hl,de + ex de,hl ; DE points to next buffer address + jr copy5c ; Back for another sector to write + +; Close the destination file + +copy6: call logdest ; Log into destination user number + ld de,fcb1 ; Point to destination FCB + ld c,16 ; Close file + call bdos + inc a ; 0ffh --> 0 if error + jp z,fulerr ; Invoke EH + + if StpCall +gotstp equ $+1 + ld a,0 ; File had stamp? + dec a ; 1 --> 0 = yes + jr nz,noset ; No + ld de,(stpbuf) ; Point to buffer + call setdma ; Set DMA + call initfcb1 ; Init. for SetFStp, point to dest. + ld c,SetFStp ; Set file's stamp + call bdos ; CCP restores DMA +noset: + endif ; StpCall + + ld a,(quiet) + or a + jr nz,qcpdone + call print + db ' Don','e'+80h +qcpdone: + if cpsp and spaceon + jp spaexit ; Report space remaining on destination drive + else + jp exit + endif ;cpsp and spaceon + +; Log into user number of source file + +logsrc: +usrsrc equ $+1 ; Pointer for in-the-code modification + ld a,0 ; Get user number + jr setusrrel ; Local jump to save code + +; Log into user number of destination file + +logdest: +usrdest equ $+1 ; Pointer for in-the-code modification + ld a,0 ; Get user number +setusrrel: + jp setusr + +; End RCPCP.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpdir.lib b/Source/BPBIOS/Z34RCP11/rcpdir.lib new file mode 100644 index 00000000..76c08bc3 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpdir.lib @@ -0,0 +1,137 @@ + page + +; Library: RCPDIR for Z34RCP +; Author: Carson Wilson +; Version: 1.0 +; Date: August 6, 1989 +; Changes: Now allows "DIR [dir:].aft" as well as "DIR [dir:]*.aft" +; to show all files of a given file extentsion, +; e.g., "d .?80" gives all .Z80 and .180 files. +; +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: DIR +; Function: Display a directory of the files on disk +; Syntax: DIR [dir:afn] Displays the DIR files +; DIR [dir:afn] S Displays the SYS files +; DIR [dir:afn] A Display both DIR and SYS files +; +; If slashchk is true: +; +; DIR [dir:]/S Equivalent to DIR [dir:]*.* S +; DIR [dir:]/A Equivalent to DIR [dir:]*.* A + +dir: + call retsave ; Save return address and set stack + +; See if FCB should be made wild (all '?') + + ld hl,fcb1+1 ; Point to file name in FCP + ld a,(hl) ; Get first character of filename + + if slashchk ; Allow "DIR /S" and "DIR /A" formats + cp '/' ; If name does not start with '/' + jr nz,dir01 ; ..branch and process normally + inc hl ; Point to second character + ld a,(hl) ; Get option character after slash + ld (fcb2+1),a ; ..and put it into second FCB + dec hl ; Back to first character + ld a,' ' ; Simulate empty FCB + endif ;slashchk + +dir01: + cp ' ' ; See if no file spec given + jr nz,dir02 ; Spec given + + ld b,8 ; Wildcard name + ld a,(fcb1+9) + cp ' ' ; Wildcard type? + jr nz,dir01a ; No + ld b,11 ; Yes. Fill name and type. +dir01a: ld a,'?' ; Get ready to fill with '?' + call fillp ; ..carry out fill +dir02: + if nosys ; Suppress-SYS-file-if-no-wheel option + call getwhl ; Get wheel status + jr z,dirnly ; If wheel off, ignore options + endif + + ld a,(fcb2+1) ; Get first char of 2nd file name + ld b,1 ; Set for both dir and sys files + cp allflag ; SYS and DIR flag specifier? + jr z,dirpr ; Got system specifier + dec b ; B=0 for sys files only + cp sysflag ; SYS only? + jr z,dirpr + +dirnly: ld b,80h ; Must be dir-only selection + +; DIRECTORY PRINT ROUTINE +; On entry, B reg is set as follows: +; 0 for only system files, 80h for only dir files, 1 for both +; +dirpr: + ld a,b ; Get systst flag + call getdir ; Load and sort directory + jp z,prfnf ; Print no file message + if wide + ld e,5 + else + ld e,4 ; Count down to 0 + endif ; wide +; +; ENTRY PRINT LOOP +; On entry, HL pts to files selected (terminated by 0) +; and E is entry counter +; +dir3: + ld a,(hl) ; Check for done + or a + if dirsp and spaceon + jp z,spaexit ; Show space when done + else + jp z,exit ; Exit if done + endif ; Dirsp and spaceon + ld a,e ; Get entry counter + or a ; Output CRLF if 4 or 5 entries printed in line + jr nz,dir3a ; Continue + call crlf ; New line + if wide + ld e,5 + else + ld e,4 ; Reset entry count + endif ; wide + + ld a,e ; Get entry count +dir3a: + if wide + cp 5 + else + cp 4 ; First entry? + endif ; wide + + jr z,dir4 + call print +; + if wide +; + db ' ' ; 2 spaces + db ' '+80h ; Then 1 more space +; + else +; + db ' ' ; Space + db fence+80h ; Then fence char +; + endif ; Wide +; +dir4: + call prfn ; Print file name + call break ; Check for abort + dec e ; Decrement entry counter + jr dir3 + +; End RCPDIR.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpecho.lib b/Source/BPBIOS/Z34RCP11/rcpecho.lib new file mode 100644 index 00000000..ffe56183 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpecho.lib @@ -0,0 +1,162 @@ + page + +; Library: RCPECHO for Z34RCP +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: ECHO +; Function: Echo text to console or printer + +echo: + xor a ; Lower case/printer off flag setting + ld (crtfl),a ; Printer off by default + + if upcase ; If upper case default + dec a + endif ;upcase + + ld (casefl),a ; Store flag in code below + ld hl,tbuff+1 ; Point to first character + call getchar ; Get first character (should be blank) + ; If none, exit from routine + +; Loop to echo chars + +echo2: call getchar + + if echolst + cp ff ; Form feed? + jr z,echo3 + endif ;echolst + + cp '^' + jr nz,echo2a ; Not control character prefix + call getchar ; Get next character + and 1fh ; Convert to control character + jr echo2e ; Echo it +echo2a: + cp cmdchar ; Case shift prefix? + jr nz,echo2e ; No, normal echo + call getchar ; Get next character + + if echolst + cp prtchar ; Turn printer on? + jr z,echo2b ; Store non-zero in crt flag + cp crtchar ; Turn printer off? + jr nz,echo2c ; No, test for shift characters + xor a ; Yes, clear crt flag +echo2b: ld (crtfl),a + jr echo2 ; On to next character +echo2c: + endif ; echolst + + cp ucasechar ; Up-shift character? + jr z,echo2d ; Store non-zero value in case flag + cp lcasechar ; Lower-case character? + jr nz,echo2e ; No, echo the character as is + xor a ; Else, clear case flag +echo2d: ld (casefl),a + jr echo2 ; On to next character +echo2e: + call echout ; Send char + jr echo2 + +; Form feed - send new line followed by form feed if printer output + + if echolst +echo3: + ld a,(crtfl) ; Check for printer output + or a ; Non-zero? + jr z,echoff ; No, send form feed normally + call echonl ; Send new line + ld a,ff ; Send form feed + jr echout + +; Send form feed char to console + +echoff: + ld a,ff ; Get char + jr echo2e + endif ;echolst + +; End of print loop - check for printer termination + +echo4: + if not echolst + ret + + else + ld a,(crtfl) ; Get list mode flag + or a + ret z ; Done if no printer output + +; Output a new line + +echonl: + ld a,cr ; Output new line on printer + call echout + ld a,lf ; Fall thru to echout + endif ; not echolst + +; Output char to printer or console + +echout: + ld c,a ; Char in c + cp 'A' ; If less than 'A' + jr c,echouta ; Leave as is + cp 'Z'+1 ; If greater than 'Z' + jr nc,echouta ; Leave as is + add 20h ; Else convert to lower case +echouta: + ld d,a ; Save lower case version in d +casefl equ $+1 ; Pointer for in-the-code modification + ld a,0 + or a ; Upper case? + jr nz,echoutb ; If upper case selected, go on as is + ld c,d ; Else substitute lower case version +echoutb: + + push hl ; Save hl + push bc ; Save bc + ld de,0ch-3 ; Offset for BIOS console output + + if echolst + +crtfl equ $+1 + ld a,0 + or a ; Printer? + jr z,echout1 ; No + inc de ; Offset for BIOS printer output + inc de + inc de + endif ;echolst + +; Output char in C with BIOS offset in DE + +echout1: + call biout ; Bios output + pop bc ; Restore bc,hl + pop hl + ret + +; Get a character from the command tail buffer + +getchar: + ld a,(hl) ; Get character + inc hl ; Point to next one + or a ; Check for end of string + ret nz ; If not end, return + pop hl ; Else, clean up stack + jr echo4 ; And exit from routine + +; Output char in C to BIOS with offset in DE + +biout: + ld hl,(wboot+1) ; Get address of warm boot + add hl,de ; Pt to routine + jp (hl) ; Jump to it + +; End RCPECHO.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpera.lib b/Source/BPBIOS/Z34RCP11/rcpera.lib new file mode 100644 index 00000000..776becb8 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpera.lib @@ -0,0 +1,76 @@ + page + +; Library: RCPERA for Z34RCP +; Author: Carson Wilson +; Version: 1.2 +; Date: Sept. 15, 1989 +; Changes: Chains to error handler with flag set to invoke transient ERA +; if a read only file is encountered. Propose error code +; 17 decimal for "file read only" error. +; +; Version: 1.1 +; Date: August 12, 1989 +; Changes: Now responds dynamically to QUIET flag, eliminating "noise". +; NOTE: if QUIET is active, using the inspect option or trying +; to erase R/O files will give meaningless messages. Use +; the PROT command to set R/O files to R/W first in order to +; erase them quietly. +; +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: ERA +; Function: Erase files +; Forms: +; ERA Erase Specified files and print their names +; ERA o Erase Specified files and print their names, but ask +; for verification before Erase is done + +era: + call retsave + ld a,(fcb2+1) ; Get eraflg if it's there + ld (eraflg),a ; Save it as a flag + ld a,1 ; Dir files only + call getdir ; Load directory of files + jp z,prfnf ; Abort if no files +; +; Main erase loop +; +era1: call break ; See if user wants to stop + call qplug ; Turn of output if quiet + push hl ; Save ptr to file + call prfn ; Print its name + ld (nxtfile),hl ; Save ptr to next file + pop hl ; Get ptr to this file + call unplug ; Turn output on + call rotest ; Test file pted to by hl for r/o + ld a,17 ; Proposed file R/O error code + ld b,00010000b ; EH flag to invoke transient + jp nz,errex1 ; Chain to transient if R/O +eraflg equ $+1 ; Address of flag + ld a,0 ; 2nd byte is flag + cp ' ' ; Is it an inspect option? + jr z,era2 ; Skip prompt if it is not + call eraq ; Erase? + jr nz,era3 ; Skip if not +era2: ld de,fcb1+1 ; Copy into fcb1 + ld b,11 ; 11 bytes + call blkmov + call initfcb1 ; Init fcb + ld c,19 ; Delete file + call bdos +era3: ld hl,(nxtfile) ; Hl pts to next file + ld a,(hl) ; Get char + or a ; Done? + if erasp and spaceon + jp z,spaexit + else + jp z,exit + endif ; Erasp and spaceon + call crlf ; New line + jr era1 + +; End RCPERA.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcph.lib b/Source/BPBIOS/Z34RCP11/rcph.lib new file mode 100644 index 00000000..34cae928 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcph.lib @@ -0,0 +1,119 @@ + page + +; Library: RCPH for Z34RCP +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: HELP +; Function: This command displays a list of all resident commands that +; are supported, including those in the CPR (command processor), +; RCP, and FCP. +; +; Syntax: H + +clist: + +; Print the FCP-resident command names + + if listfcp + call print ; Print header for FCP + db lf + db 'FC','P'+80h + ld hl,(fcp) ; Get FCP address dynamically from ENV + ld a,h ; See if still there + or l + jr z,nofcp ; FCP has been removed + ld bc,5 ; Calculate address of FCP command table + add hl,bc + call cmdlist ; Display list of commands +nofcp: + endif ;listfcp + +; Print the CPR-resident command names + + if listcpr + call print ; Print "CPR" + db cr,lf ; Need CR if no FCP + db 'CP','R'+80h + ld hl,(ccp) ; Get CCP address from ENV + ld bc,offcmd ; Point to command table in CPR + add hl,bc + call cmdlist ; Display the list of commands + endif ;listcpr + +; Print the RCP-resident command names + + call crlf ; Skip a line + ld hl,rcpname ; Print RCP name + call printhl + ld hl,RCPbegin+5 ; Point to RCP command table + ; Fall through to CMDLIST + +;---------------------------------------- + +; Subroutine to display list of commands in a command table (code above +; falls through to this routine -- do not move it). The commands are +; displayed 5 per line with 8 character spaces allowed for each command +; (subject to equates below). + +cmdlist: + call crlf ; Start with new line + ld e,(hl) ; Get size of each command name into DE + ld d,0 + inc hl ; Point to name of first command + ld c,cmdsline ; Set names-per-line value +cmdlist1: + ld a,(hl) ; Get first character of the command name + or a ; See if it is null + jr nz,cmdlist1a ; If not, continue + ld a,cmdsline ; See if we are already on a new line + cp c + call nz,crlf ; If not, skip a line + ret + +cmdlist1a: + if noshow ; Option to suppress wheel-limited cmds + rla ; Shift high bit of name into carry bit + jr nc,cmdlist2 ; If not restricted, go on + call getwhl ; Otherwise, check wheel byte + or a + jr nz,cmdlist2 ; If wheel set, continue as usual + add hl,de ; Otherwise skip this command + jr cmdlist5 + endif + +; Print leading spaces between names + +cmdlist2: + ld a,cmdspace ; Spacing between command names + sub e ; Less length of each command name + ld b,a +cmdlist3: + call spac + djnz cmdlist3 + +; Print name of command + + ld b,e ; Length of each name into B +cmdlist4: + ld a,(hl) ; Get command name character + call conout + inc hl ; Point to next + djnz cmdlist4 + + dec c ; Decrement count of names on this line + jr nz,cmdlist5 ; Branch if room for more names + call crlf ; Otherwise, end this line and + ld c,cmdsline ; ..reset count for another line of commands + +; Skip to next command name + +cmdlist5: + inc hl ; Skip jump vector + inc hl + jr cmdlist1 ; Back to process next name + +; End RCPH.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpid.lib b/Source/BPBIOS/Z34RCP11/rcpid.lib new file mode 100644 index 00000000..dfbacaf2 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpid.lib @@ -0,0 +1,64 @@ + page + +; Library: RCPID for Z34RCP +; Author: Carson Wilson +; Version: 1.0 +; Date: September 29, 1989 +; Changes: ID appended with 'C' if CLED is present +; +; Author: Carson Wilson +; Version: 1.0 +; Date: September 14, 1988 +; +; Function: Build the name of the RCP and append it at the end of the +; file at label RCPID. This serves two purposes: first it +; allows the 'H' command to describe which RCP is active, +; second, the string identifies the actual end of the RCP +; in memory. +; +; ------------------------------------------------------------------------ + +; Macros to build RCP ID for Help command + +; Under SLR and compatible assemblers, the RCP name reflects the +; RCP size, e.g., "RCP-21F" means the RCP occupies 21 records. + + if SLR +rcpid macro +rcplen defl RCPend - RCPbegin +fulrecs equ rcplen / 128 ; Full records +lastr equ [rcplen mod 128 + 127]/128 ; Last record, if any +ttlrecs equ fulrecs + lastr + + db 'RCP-' + db ttlrecs / 10 + '0' ; Tens of records + db ttlrecs mod 10 + '0' ; Ones + db rcptype ; 'F', 'H', etc. from RCP.LIB + if cledon + db 'C' ; Distinguish CLED versions + endif + db 0 ; ID string terminator + endm + + else ; Non-SLR +rcpid macro + db 'RCP-' + db rcptype + db 0 + endm + endif ; SLR + +; ----------------------------------------------------------------------- + +; Name of RCP + +; This block allows the 'H' command and/or the SHOW utility to display a name +; and version number for this RCP as well as the commands that are supported. +; It also generates a unique string marking the end of the RCP module. + +rcpname: + rcpid + +; End of RCPID.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpiom.lib b/Source/BPBIOS/Z34RCP11/rcpiom.lib new file mode 100644 index 00000000..d85e553d --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpiom.lib @@ -0,0 +1,296 @@ + page + +; Library: RCPIOM for Z34RCP +; Author: Carson Wilson +; Version: 1.1 +; Date: August 12, 1989 +; Changes: POKE and PORT now respond dynamically to QUIET flag, +; eliminating "noise." + +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Commands: PEEK, POKE, and PORT + +; ------------------------------------------------------------------ +; +; Command: PEEK +; Function: Display memory contents +; +; Form: +; PEEK startadr 128 bytes displayed +; PEEK startadr endadr Range of bytes displayed + + if peekon +peek: + call retsave + ld hl,tbuff+1 ; Find first number +nxtpeek equ $+1 ; Pointer for in-the-code modification + ld de,100h ; Default peek address if none + call sksp ; Skip to first token (if any) + call nz,hexnum ; Get start address if any + push de ; Save starting address + ld bc,peeklen ; Compute default ending address + ex de,hl + add hl,bc + + if peekchk ; Check for overflow + jr nc,peek0 ; If no overflow past FFFF, go on + ld hl,0ffffh ; Else use FFFF as ending address +peek0: + endif ;peekchk + + ex de,hl ; End address in DE + call sksp ; Skip to next token (if any) + call nz,hexnum ; Get 2nd number in DE (else default) +peek1: pop hl ; HL is start address, DE is end address + + if peekhdr + push hl ; Save starting address again + ld b,8 ; Output leading spaces +peek0a: call spac + djnz peek0a + ld b,16 ; Display 16 column headers +peek0b: ld a,l ; Get low byte of address + and 0fh ; Display low hex digit + call pashc + inc hl + djnz peek0b +; +; Display header for ASCII area +; + call print + db ' ',' '+80H ; Space over to ASCII area + pop hl ; Get address + push hl + ld b,16 ; Display 16 chars. ASCII header +peek0b1:ld a,l ; Get byte + and 0fh ; Mask + call pah ; Print ASCII char. + inc hl ; Next byte + djnz peek0b1 + + if peekbdr + call crlf + ld b,8 +peek0c: call spac ; Print leading spaces + djnz peek0c + ld b,16 +peek0d: call print + db ' -','-'+80h + djnz peek0d + +; Print border at ASCII area + + call print + db ' ',' '+80h ; Space to ASCII border + ld b,16 ; 16 dashes +peek0e: call print + db '-'+80h + djnz peek0e + endif ;peekbdr + + pop hl ; Restore starting address + endif ;peekhdr + + ld c,0ffh ; Use C as continue flag + call peek2 ; Do peek + ld (nxtpeek),hl ; Set continued peek address + jp exit +peek2: + ld a,c ; Check continuation flag + or a + ret z + +; Print line header + +peek2a: call crlf ; New line + ld a,h ; Print address + call pashc + ld a,l + call pahc + call dash ; Print leader + ld b,16 ; 16 bytes to display + push hl ; Save start address + +; Print hex values for 16 bytes + +peek3: ld a,(hl) ; Get next byte + call pashc ; Print with leading space + +; Check for last address. If C is already 0, leave it that way. +; Otherwise check for end address and if so set C to zero. + + ld a,c ; See if continue flag already cleared + or a + jr z,peek3a ; If so, skip test + ld a,h + sub a,d ; See if h = d + ld c,a + ld a,l + sub a,e ; See if l = e + or c ; Combine two tests + ld c,a +peek3a: inc hl ; Pt to next + djnz peek3 + +; Print ASCII equivalents for 16 bytes + + pop hl ; Pt to first address again + ld b,16 ; 16 bytes + call print ; Space and fence + db ' ' + db fence+80h + push bc ; Save flag in c +peek4: ld a,(hl) ; Get next byte + ld c,'.' ; Assume dot + and 7fh ; Mask it + cp ' ' ; Dot if less than space + jr c,peek5 + cp 7fh ; Don't print del + jr z,peek5 + ld c,a ; Char in c +peek5: ld a,c ; Get char + call conout ; Send it + inc hl ; Pt to next + djnz peek4 + call print ; Closing fence + db fence+80h + pop bc ; Get flag in c back + call break ; Allow abort + jr peek2 + endif ; Peekon + +; PAHC - Print A as 2 hex chars +; PASHC - With leading space + + if peekon or pokeon or porton +pashc: + push af ; Save A + call spac + pop af +pahc: push bc ; Save bc + ld c,a ; Byte in c + rrca ; Exchange nybbles + rrca + rrca + rrca + call pah ; Print hex char + ld a,c ; Get low + pop bc ; Restore bc and fall thru to pah +pah: and 0fh ; Mask + add '0' ; Convert to ascii + cp '9'+1 ; Letter? + jr c,pah1 + add 7 ; Adjust to letter +pah1: jp conout + endif ; Peekon or pokeon or porton + +; -------------------------------------------------------------------- +; +; Command: POKE +; Function: Place Values into Memory +; +; Form: +; POKE startadr val1 val2 ... +; + if pokeon +poke: + call retsave + ld hl,tbuff+1 ; Pt to first char + call sksp ; Skip to non-blank + jp z,numerr ; Numerical error + call hexnum ; Convert to number + call qplug ; Shut off output if quiet + call print + db ' Pok','e'+80h + call adrat ; Print at message (quiet sensitive) + call unplug ; Turn on output + +; Loop for storing hex values sequentially via POKE + +poke1: push de ; Save address + call sksp ; Skip to non-blank + jp z,exit ; Done + cp '"' ; Quoted text? + jr z,poke2 + call hexnum ; Get number + ld a,e ; Get low + pop de ; Get address + ld (de),a ; Store number + inc de ; Pt to next + jr poke1 + +; Store ASCII chars. + +poke2: pop de ; Get next address + inc hl ; Pt to next char +poke3: ld a,(hl) ; Get next char + or a ; Done? + jp z,exit + ld (de),a ; Put char + inc hl ; Pt to next + inc de + jr poke3 + + endif ; Pokeon + +; ------------------------------------------------------------------- +; +; Command: PORT +; Function: Display or Set I/O Port Data +; +; Forms: +; PORT addr - Read port and display value +; PORT addr value - Output value to port +; + if porton +port: + call retsave + ld hl,tbuff+1 ; Find first number + call sksp ; Skip to first command-line token + jp z,numerr ; Numerical error + call hexnum ; Get start address into de + push hl ; Save pointer to command tail + ld hl,portadl ; Modify code + ld (hl),e ; Move specified port addr into place + dec hl ; Point to opcode position + ld (hl),0dbh ; Poke 'in' opcode + dec hl + ld (hl),d ; Save MSB for port address + inc hl + ex (sp),hl ; Get tail pointer back while saving this one + call qplug ; Shut off output if quiet + call print ; Print header + db ' Por','t'+80h + ld a,e + call pashc ; Print port address + call sksp ; Skip to possible second value + jr z,portin ; Proceed with port input + call hexnum ; Get 2nd number in de + ex (sp),hl ; Get pointer to opcode back + ld (hl),0d3h ; Poke 'out' opcode + call print + db ': OU','T'+80h + ld a,e ; Get value to output + jr paddr +portin: + call print + db ': I','N'+80h + xor a ; Make sure high port address = 0 (for hd64180) +portadh equ $+1 +paddr: ld b,0 ; ..for both in and out instructions +opcode: + db 0 ; Opcode for in or out inserted by code above +portadl: + db 0 ; Port address inserted by code above + call pashc + call unplug ; Turn on output + pop hl ; Clean up stack + jp exit + + endif ; Porton + +; End RCPIOM.Z80 + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcplt.lib b/Source/BPBIOS/Z34RCP11/rcplt.lib new file mode 100644 index 00000000..98d6b0ba --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcplt.lib @@ -0,0 +1,256 @@ + page + +; Library: RCPLT for Z34RCP +; Author: Carson Wilson +; Version: 1.1 +; Date: August 26, 1989 +; Changes: Some WordStar characters caused garbage to appear on the +; screen. Now filters control characters other than CR, +; TAB, and LF. Thanks to Gene Pizzetta for this suggestion. +; +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Commands: LIST and TYPE + +; ---------------------------------------------------------------- +; +; Command: LIST +; Function: Print out specified file on the LST: Device +; Forms: +; LIST Do form feed +; LIST Print file(s) (NO Paging) +; Notes: +; The flags which apply to TYPE do not take effect with LIST +; The tab expansion code is required for LST: output. + + if liston +list: + ld a,(fcb1+1) ; Get filename or ' ' from command + ld (prflg),a ; List flag (A can't be 0) + cp ' ' ; Null command? + jp z,lstff ; Yes, do form feed and return + jr type0 ; No, send file to LST: + endif ;liston + +; -------------------------------------------------------------------- +; +; Command: TYPE +; Function: Print out specified file on the CON: Device +; Forms: +; TYPE Print file +; TYPE P Print file with paging flag +; Notes: +; The flag PGDFLG defines the letter which toggles the paging +; facility (P in the forms section above) +; The flag PGDFLT determines if TYPE is to page by default +; (PGDFLT=TRUE if TYPE pages by default); combined with +; PGDFLG, the following events occur -- +; If PGDFLT = TRUE, PGDFLG turns OFF paging +; If PGDFLT = FALSE, PGDFLG turns ON paging + +type: + if liston + xor a ; Turn off printer flag + ld (prflg),a ; Set flag + endif ; Liston + +; Entry point for list function (LIST) + +type0: call retsave ; Save return address + ld a,(fcb2+1) ; Get page flag from command + ld (pgflg),a ; Store it + ld a,1 ; Select dir files + call getdir ; Allow ambiguous files (HL points to buffer) + jp z,noflerr ; EH no files error + ld a,(lins) ; Set line count + ld (pagcnt),a + jr typex1 + +; Entry point for successive files + +typex0: pop hl ; Balance stack for skip + pop hl ; ..to next file command (^X) +typex: ld hl,(nxtfile) ; Get ptr to next file + ld a,(hl) ; Any files? + or a + jp z,exit + + if liston + ld a,(prflg) ; Check for lst: output + or a ; 0=type + jr z,typex1 + ld a,cr ; Bol on printer + call lcout + call lstff ; Form feed the printer +; fall thru + endif ; Liston + + ; Entry point for 1st file +typex1: ld de,fcb1+1 ; Copy into fcb1 + ld b,11 ; 11 bytes + call blkmov + ld (nxtfile),hl ; Set ptr to next file + call initfcb1 ; Init fcb1 + ld c,15 ; Open file + call bdos + inc a ; Set error flag + jp z,noflerr ; EH no files error + ld a,cr ; New line + call lcout + ld a,lf + call lcout + ld bc,080h ; Set char position and tab count + ; (b=0=tab, c=080h=char position) + +; Main loop for loading next block + +type2: ld a,c ; Get char count + cp 80h + jr c,type3 + call break + push bc ; Read next block + ld de,fcb1 ; Pt to fcb + ld c,20 ; Read record + call bdos + or a ; Set flags + pop bc + jr nz,typex ; End of file? + ld c,0 ; Set char count + ld hl,tbuff ; Pt to first char + +; Main loop for printing chars in tbuff + +type3: ld a,(hl) ; Get next char + and 7fh ; Mask out msb + cp 1ah ; End of file (^z)? + jr z,typex ; Next file if so + +; Output char to CON: or LST: device with tabulation + + cp cr ; Reset tab count? + jr z,type4 + cp lf ; Reset tab count? + jr z,type4 + cp tab ; Tab? + jr z,type5 + cp ' ' ; Skip other ctls. + jr c,type6 + +; Output char and increment char count + + call lcout ; Output char + inc b ; Increment tab count + jr type6 + +; Output or and reset tab count + +type4: call lcout ; Output or + ld b,0 ; Reset tab counter + jr type6 + +; Tabulate + +type5: ld a,' ' ; + call lcout + inc b ; Incr pos count + ld a,b + and 7 + jr nz,type5 + +; Continue processing + +type6: + inc c ; Increment char count + inc hl ; Pt to next char + jr type2 + +; Send a formfeed to LST:. Assumes PRFLG <> 0. + +lstff: + ld a,ff ; formfeed +; fall thru + +; Send output to LST: or CON:, as per the flag +; Return with Z if abort + +lcout: push hl ; Save regs + push bc + ld e,a ; Char in e + ld c,2 ; Output to con: + + if liston +prflg equ $+1 ; Pointer for in-the-code modification + ld a,0 ; 2nd byte is the print flag + or a ; 0=type + jr z,lc1 + ld c,5 ; Output to lst: + endif ; Liston + +lc1: push de ; Save char + call bdos ; Output char in e + pop de ; Get char + ld a,e + cp lf ; New line? + jr nz,lc2 ; No, return + call break ; Check for abort + jp z,typex0 ; Skip if ^X + + if liston + ld a,(prflg) ; Output to lst:? + or a ; Nz = yes + jr nz,lc2 + endif ; Liston + +; New line, so check for paging + + ld hl,pagcnt + dec (hl) + jr nz,lc2 ; Jump if not end of page + ld a,(lins) + ld (hl),a ; Reset counter +pgflg equ $+1 ; Pointer to in-the-code buffer + ld a,0 ; 2nd byte is the paging flag + cp pgdflg ; Page default override option wanted? + + if pgdflt ; If paging is default + jr z,lc2 ; Pgdflg means no paging + else + jr nz,lc2 ; Pgdflg means page + endif ; Pgdflt + + push hl ; Save hl + call print + db cr,lf,' Typing',' '+80h + ld hl,fcb1+1 ; Print file name + call prfn + call dash ; Print dash + call conin ; Get input + pop hl ; Restore hl + call break1 ; Set Z flag or abort + push af ; Save results + + if typecls and clson + call cls ; Clear between screens + else + call crlf + endif + + pop af ; Get results + jp z,typex0 ; Control-X, so skip to next file + cp ctrlz ; If Control-Z, + jr nz,lc2 + ld a,pgdflg ; Switch to non-default + ld (pgflg),a ; ..paging mode +lc2: pop bc ; Restore regs + pop hl + ret + +; Storage for line counter + +pagcnt: + ds 1 + +; End RCPLT.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpprot.lib b/Source/BPBIOS/Z34RCP11/rcpprot.lib new file mode 100644 index 00000000..4e8a5479 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpprot.lib @@ -0,0 +1,130 @@ + page + +; Library: RCPPROT for Z34RCP +; Author: Carson Wilson +; Version: 1.1 +; Date: August 12, 1989 +; Changes: Now responds dynamically to QUIET flag, eliminating "noise." + +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: PROT +; Function: To set the attributes of a file (R/O, SYS, and ARC) +; Form: PROT afn RSAI +; Comments: If R, S, or A are omitted, the file is made R/W, DIR, or +; modified, respectively. R, S, A, and I may be in any order. +; If I is present, Inspection is enabled. + +att: + call retsave + call dirchek ; Test bad directory + xor a ; Set no inspect + ld (inspect),a + ld hl,0 ; Set r/o and sys attributes off + ld c,0 ; Set Arc attribute off + ld de,fcb2+1 ; Pt to attributes + ld b,4 ; 4 chars max +att1: + ld a,(de) ; Get char + inc de ; Pt to next + cp 'I' ; Inspect? + jr z,atti + cp 'R' ; Set r/o? + jr z,attr + cp 'S' ; Set sys? + jr z,atts + cp 'A' + jr z,atta +att2: + djnz att1 + jr att3 +atti: + ld (inspect),a ; Set flag + jr att2 +attr: + ld h,a ; Save R/O flag + jr att2 +atts: + ld l,a ; Save SYS flag + jr att2 +atta: + ld c,a ; Save ARC + jr att2 +att3: + ld (fatt2),hl ; Save file attributes + ld a,c + ld (fatt1),a ; Save Arc attribute + ld a,1 ; Select dir and sys files + call getdir ; Load directory + jp z,noflerr ; Tell error handler no file + jr att5 +att4: + ld hl,(nxtfile) ; Pt to next file + ld a,(hl) ; End of list? + or a + jp z,exit + call crlf ; New line +att5: call break ; Check for possible abort + call qplug ; Turn off output if quiet + push hl ; Save ptr to current file + call prfn ; Print its name + ld (nxtfile),hl ; Save ptr to next file + call print + db ' Set to R','/'+80h + ld hl,(fatt2) ; Get attributes + ld c,'W' ; Assume r/w + ld a,h ; Get r/o bit + or a + jr z,att6 + ld c,'O' ; Set r/o +att6: ld a,c ; Get char + call conout + ld a,l ; Get sys flag + or a ; Set flag + jr z,att7 + call print + db ', SY','S'+80h +att7: ld a,(fatt1) + or a + jr z,att7a + call print + db ', AR','C'+80h +att7a: call unplug ; Turn output on +inspect equ $+1 ; Ptr for in-the-code modification + ld a,0 ; Get inspect flag + or a ; Z=no + pop hl ; Get ptr to current file + jr z,att8 + call eraq1 ; Ask for y/n + jr nz,att4 ; Advance to next file if not y +att8: ld de,fcb1+1 ; Copy into fcb1 + ld b,11 ; 11 bytes + call blkmov + ex de,hl + dec hl ; Pt to archive byte +fatt1 equ $+1 + ld a,0 + call attset + dec hl ; Pt to sys byte +fatt2 equ $+1 ; Ptr for in-the-code modification + ld de,0 ; Get attributes + ld a,e ; Get sys flag + call attset ; Set attribute correctly + dec hl ; Pt to r/o byte + ld a,d ; Get r/o flag + call attset + ld de,fcb1 ; Pt to fcb + ld c,30 ; Set attributes + call bdos + jp att4 +attset: + res 7,(hl) ; Clear attribute + or a + ret z ; 0=clear attribute + set 7,(hl) ; Set attribute + ret + +; End RCPPROT.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpquiet.lib b/Source/BPBIOS/Z34RCP11/rcpquiet.lib new file mode 100644 index 00000000..9269d241 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpquiet.lib @@ -0,0 +1,49 @@ + page + +; Library: RCPQUIET for Z34RCP +; Author: Carson Wilson +; Version: 1.1 +; Date: August 6, 1989 +; Changes: Now "Q R[eset]" and "Q S[et]" just reset and set quiet status +; without showing it, and Q alone (or with any other character, +; e.g., "Q ?") always just shows status. +; Forms: +; Q - Display quiet flag (always) +; Q s - Set quiet flag ON +; Q r - Set quiet flag OFF +; +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: Q +; Function: Set the Quiet flag on or off +; Comments: If QQUIET equate is true, then RCP does not report +; quiet status with the Q command. +; Forms: +; Q - Display quiet flag (if QQUIET false) +; Q s - Set quiet flag ON +; Q r - Set quiet flag OFF + +quset: + ld a,(fcb1+1) ; Get first char + ld b,1 ; Prepare to turn on + cp 'S' ; S-et quiet (ON) + jr z,quset1 + ld b,0 ; Prepare to turn off + cp 'R' ; R-eset quiet (OFF) + jr nz,qmsg ; Neither S nor R, so display +quset1: + ld a,b + ld (quiet),a + ret + +qmsg: +; Print Quiet Flag Message + + ld a,(quiet) + jp tella ; Say " On" or " Off" and return + +; End RCPQUIET.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpr.lib b/Source/BPBIOS/Z34RCP11/rcpr.lib new file mode 100644 index 00000000..e29a4f37 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpr.lib @@ -0,0 +1,108 @@ + page + +; Library: RCPR for Z34RCP +; Author: Carson Wilson +; Version: 1.5 +; Date: August 30, 1989 +; Changes: Minor bug fix as suggested by Howard Goldstein. +; +; Version: 1.4 +; Date: August 26, 1989 +; Changes: Now performs reset 37 for ALL drives under CP/M 2.2 or ZRDOS +; to ensure that fast fixed disks are reset under ZRDOS, then +; exits with reset 13 to compensate for bugs in ZRDOS/CP/M 2.2 +; reset 37. Still resets individual drives selectively under +; CP/M Plus and ZS/ZDDOS. + +; Version: 1.3 +; Date: August 11, 1989 +; Changes: Now responds dynamically to QUIET flag, eliminating "noise." +; Now performs reset 37 in ALL cases, reset 13 as well if not +; CP/M Plus or ZSDOS (per suggestion by Howard Goldstein). + +; Version: 1.2 +; Date: December 30, 1988 +; Changes: Now resets single drives under Z3PLUS. + +; Version: 1.1 +; Date: September 11, 1988 +; Changes: Fixed bug which failed to detect ZRDOS. ZRDOS' function +; 37, like CP/M's, is not reliable. + +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: RESET +; Function: Reset the disk system +; Forms: R [d: or dir:] - ZSDOS or CP/M Plus +; R - CP/M 2.2 or ZRDOS +; Comments: ZRDOS does not require a disk system reset when disks are +; changed, but directory programs will not show the correct +; size if this is not done. It is also good practice. Since +; no warm boot is performed, the disk in drive A need not have +; the operating system on it. +; +; Under ZSDOS or CP/M Plus, individual drives may be reset, and +; if RESETSP is true, space remaining is also given. If +; the fast hard disk reset capability is enabled under ZSDOS, +; any "fast" fixed disks are also reset at this time. +; +; NOTE: It is necessary to reset a legal directory or DU when there are +; protected directories. + +reset: ld a,(quiet) + or a ; Skip message if quiet + jr nz,QReset + call print ; Report action + db ' Rese','t'+80h +QReset: call cpmver ; CP/M Plus? + jr nc,reset0 ; Yes + ld c,48 + call bdos ; ZRDOS or CP/M? + ld a,h + or a + jr nz,reset0 ; No, assume bug-free F37 + ld de,0ffffh ; Yes, reset ALL drives, both ways + ld c,37 + call bdos + ld c,13 + jp bdos ; Yes, do regular reset + +; Reset individual drive(s) + +reset0: call dirchek ; Abort with error if illegal drivespec + ld a,(fcb1) ; Use default drive? + or a + jr nz,reset1 ; No, use drive from FCB1 + ld a,(cdrv) ; Yes, get ZCPR 3.3 current drive byte + inc a ; Shift range to 1..16 +reset1: ld hl,1 ; Map drive "A:" +reset2: dec a ; Done yet? + jr z,reset3 ; Yes + add hl,hl ; No, shift vector to next drive + jr reset2 + +; Check for fixed disks + +reset3: push hl ; Save current or specified vector + ld c,39 + call bdos ; ZSDOS return fixed disks in HL + pop de ; Restore vector + ld a,d + or h ; Add any fixed disks + ld d,a + ld a,e + or l + ld e,a + ld c,37 ; Reset individual drive(s) + + if spaceon and resetsp + call bdos + jp crspace ; Show space remaining (QUIET sensitive) + else + jp bdos ; Do reset and return + endif + +; End RCPR.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpreg.lib b/Source/BPBIOS/Z34RCP11/rcpreg.lib new file mode 100644 index 00000000..d73eee05 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpreg.lib @@ -0,0 +1,165 @@ + page + +; Library: RCPREG for Z34RCP +; Version: 1.1 +; Date: August 11, 1989 +; Changes: Register Set, Decrement, and Increment commands now respond +; dynamically to QUIET flag, eliminating "noise." + +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: REG +; Function: Manipulate Memory Registers +; +; Forms: +; REG D or REG <-- Display 10 Register Values +; REG Mreg <-- Decrement Register Value +; REG Preg <-- Increment Register Value +; REG Sreg value <-- Set Register Value +; +; Vers 2.1 Joe Wright +; +; REG reg <-- Display a single register value +; +; REG numbers now range from 0 to 31, although only the first ten are +; displayed with REG D. +; +; REG now treats the program error byte as register E. +; +register: + ld de,fcb1+2 ; Pt to first arg + ld a,(de) ; Get possible digit + call regptr ; Pt hl to potential register + dec de ; Point to command + ld a,(de) + cp 'S' ; Set? + jr z,rset + cp 'P' ; Plus? + jr z,rinc + cp 'M' ; Minus? + jr z,rdec + cp ' ' + jr z,rshow + cp 'D' + jr z,rshow + call regptr + jp regout + +; Increment register value +; HL pts to memory register on input + +rinc: inc (hl) ; Increment it + jr Qregout ; Print result + +; Decrement register value +; HL pts to memory register on input + +rdec: dec (hl) ; Decrement value + jr Qregout ; Print result + +; Show first ten registers and Program Error byte + +rshow: call rshow10 + ld hl,z3msg+6 + jp regout + +rshow10:xor a ; Select register 0 + ld b,a ; Counter set to 0 in b + call regp1 ; Hl pts to register 0 +rshow1: ld a,b ; Get counter value + cp 10 ; First ten registers + ret z ; Exit if done + push bc ; Save counter + push hl ; Save pointer + call regout ; Print register value + pop hl ; Get pointer + pop bc ; Get counter + inc b ; Increment counter + ld a,b ; Check for new line + and 3 + call z,crlf ; Newline after fourth display + inc hl ; Pt to next register + jr rshow1 + +; Set register value +; HL pts to register on input + +rset: + ld de,fcb2+1 ; Pt to value + call de2bin ; Eval string at de to binary in b + ld (hl),b ; Set value + +; Enter with HL pointing to the register. HL is maintained. +; +qregout:ld a,(quiet) + or a + ret nz +regout: call print + db ' Reg',' '+80h + ld de,z3msg+30h ; Register 0 + sbc hl,de ; Register number in hl + ld a,l + cp 32 ; A numbered register? + jr c,rego0 ; Yep + call print + db ' ','E'+80h + jr rego1 ; Report + +rego0: push hl + push de + ld b,0 ; Suppress zeros + call decdsp2 ; Report register number + pop de + pop hl +rego1: add hl,de ; Hl points to register again + call print + db ' =',' '+80h + ld l,(hl) + xor a + ld h,a + ld b,a ; Suppress leading zeros + jp decdsp3 ; Display value + +; Evaluate decimal string at DE to binary in B + +de2bin: ld b,0 ; Init value to zero +de2b: ld a,(de) ; Get this digit + inc de ; Pt to next + sub '0' ; Convert to binary + ret c ; A space, finished + cp 10 ; Range? + ret nc ; Not decimal, finished + ld c,a ; Digit in c + ld a,b ; Multiply old by 10 + add a,a ; *2 + add a,a ; *4 + add a,b ; *5 + add a,a ; *10 + add a,c ; Add in new digit + ld b,a ; Result in b + jr de2b ; Again + +; Set HL to point to memory register whose index is pted to by HL +; On input, A contains register char +; On output, HL = address of memory register (reg 0 assumed if error) + +regptr: ld hl,z3msg+6 ; The e register + cp 'E' + ret z + push de + call de2bin ; Get register number in b + pop de + ld a,b + cp 32 ; Range 0-31 + ld a,0 + jr nc,regp1 ; Out of range, use 0 + ld a,b ; Value in a +regp1: ld hl,z3msg+30h ; Pt to memory registers + add a,l ; Pt to proper register + ld l,a + ret ; No chance of crossing page boundary + +; End RCPREG.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpren.lib b/Source/BPBIOS/Z34RCP11/rcpren.lib new file mode 100644 index 00000000..6947bad2 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpren.lib @@ -0,0 +1,100 @@ + page + +; Library: RCPREN for Z34RCP +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: REN +; Function: To change the name of an existing file +; Forms: +; LEFTRIGHT false: +; REN = +; LEFTRIGHT true: +; REN +; LEFTRIGHT and TESTEQ both true: +; Either of the above forms may be used. + +ren: + call retsave + call dirchek ; Test bad dirspec + + if leftright + call fcbswap ; Exchange command line fcb's + endif +; +; STEP 1: See if old name is ambiguous +; + ld hl,fcb2+1 ; Can't be ambiguous + call ambchk1 +; +; STEP 2: Log into user area +; +; If dirspec given at old name, use it +; else use dirspec (or default) given at new name. + + ld hl,fcb1 ; Pt to new name + push hl + ld de,fcb2 ; Pt to old name + push de ; Save ptr + ld a,(de) ; Test if dirspec issued + or a ; ..at old name + jr z,ren1 ; No, use user at new name + ld (hl),a ; Stuff drive into new file + ld a,(fcb2+13) ; Yes, log to user area + call setusr ; ..of old name + jr ren2 +; +; Use dirspec at new name (none given at old name) +; +ren1: + ld a,(hl) ; Stuff drive of new name + ld (de),a ; ..into old name + call logusr ; Log to user at new name +ren2: +; +; STEP 3: See if old file is R/O +; + pop de ; Restore ptr to old FCB + push de ; Save it again + ld c,17 ; Look for old file + call bdos + inc a + jr z,rnxit + call getsbit ; Match found, get ptr to entry in tbuff + ex de,hl ; Hl pts to entry + inc hl ; Pt to fn + call rotest ; See if file is r/o + jr nz,rnxit1 ; Abort if so +; +; STEP 4: See if new file already exists +; EXTEST performs a number of checks: +; 1) Ambiguity +; 2) R/O +; 3) If file exists and not R/O, permission to delete +; + call extest + jr z,rnxit1 ; R/o or no permission +; +; STEP 5: Exchange file name fields for rename +; + pop de ; Pt to old + pop hl ; Pt to new + push hl ; Save ptr + ld b,12 ; 12 bytes + call iswap1 +; +; STEP 6: Rename the file +; + pop de ; Get ptr to FCB + ld c,23 ; Rename + call bdos + inc a ; Set zero flag if error +rnxit: + jp z,noflerr ; EH print no source file message +rnxit1: + jp exit + +; End RCPREN.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpsp.lib b/Source/BPBIOS/Z34RCP11/rcpsp.lib new file mode 100644 index 00000000..0fc5ecf6 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpsp.lib @@ -0,0 +1,163 @@ + page + +; Library: RCPSP for Z34RCP +; Author: Carson Wilson +; Version: 1.2 +; Date: August 11, 1989 +; Changes: CRSPACE does nothing if QUIET is true. +; +; Author: Carson Wilson +; Version: 1.1 +; Date: December 30, 1988 +; Changes: Calls CPMVER common routine. +; Sets DMA to TBUFF for CP/M Plus in case we chained to SP. + +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Command: SP +; Function: Shows space remaining on designated drive +; Syntax: SP [DIR:|DU:] +; Comments: This code can be called by several other RCP commands so that +; they can show the space remaining on the disk after their +; operation. + +; Now works with CP/M Plus. + + if [erasp or cpsp or dirsp] +crspace: ; Used to call space after other subroutines + ld a,(quiet) + or a ; Skip if we're being quiet + ret nz + call crlf ; Start new line + jr space0 ; Skip directory check + endif ;[erasp or cpsp or dirsp] +space: + call dirchek ; Abort to EH on bad dirspec +space0: ld a,(fcb1) ; Determine requested drive + or a ; If drive explicitly selected + jr nz,space1 ; ..then skip + ld a,(cdrv) ; Get current drive from ZCPR 3.4 + inc a ; Shift to range 1..16 + +space1: + dec a ; Shift to range 0..15 + ld e,a ; Save in E for selecting disk below + add a,'A' ; Convert to letter and + ld (seldrv),a ; save in message string below + ld c,14 ; BDOS select disk function + call bdos ; Not needed if no drive selected, but smallest + ; ..possible code size this way. + +; Here we extract the following disk parameter information from the disk +; parameter block (DPB): +; BLKSHF: block shift factor (1 byte) +; BLKMAX: max number of blocks on disk (2 bytes) + + call cpmver ; What BDOS is running? + jr nc,isplus + ld c,31 ; BDOS get disk parameters function + call bdos + inc hl ; Advance to block shift factor byte + inc hl + ld a,(hl) ; Get value and + ld (blkshf),a ; ..save it in code below + inc hl ; Advance to max block number word + inc hl + inc hl + ld e,(hl) ; Get value into HL + inc hl + ld d,(hl) + inc de ; Add 1 for max number of blocks + +; Compute amount of free space left on disk + +dfree: + ld c,27 ; BDOS get allocation vector function + push de ; Save BLKMAX value + call bdos ; Get allocation vector into HL + ld b,h ; Copy allocation vector to BC + ld c,l + pop hl ; Restore BLKMAX value to HL + ld de,0 ; Inititialize count of free blocks + +; At this point we have +; BC = allocation vector address +; DE = free block count +; HL = number of blocks on disk + +free1: push bc ; Save allocation address + ld a,(bc) ; Get bit pattern of allocation byte + ld b,8 ; Set to process 8 blocks +free2: rla ; Rotate allocated block bit into carry flag + jr c,free3 ; If set (bit=1), block is allocated + inc de ; If not set, block is not allocated, so + ; ..increment free block count +free3: ld c,a ; Save remaining allocation bits in C + dec hl ; Count down number of blocks on disk + ld a,l ; See if we are down to zero + or h + jr z,free4 ; Branch if no more blocks to check + ld a,c ; Get back current allocation bit pattern + djnz free2 ; Loop through 8 bits + pop bc ; Get pointer to allocation vector + inc bc ; Point to next allocation byte + jr free1 ; Continue by processing next allocation byte + +free4: pop bc ; Clean up stack + ex de,hl ; Free block count to HL +blkshf equ $+1 ; Pointer for in-the-code modification + ld a,0 ; Get block shift factor + sub 3 ; Convert to log base 2 of K per block + jr z,free6 ; Done if single density (1k per block) + +; Convert for blocks of more than 1K each + +free5: add hl,hl + dec a + jr nz,free5 + +; At this point HL = amount of free space on disk in K + +; Display decimal value of HL + +free6: ld b,0 ; Initialize count of digits already printed + ld de,10000 ; Divisor in DE + call decdsp ; Print digit (or space if leading '0') + ld de,1000 + call decdsp + call decdsp3 ; Display hundreds, tens, and units + + call print + db 'k free on ' +seldrv: db 0 ; Modified above to contain drive letter + db ':'+80h + ret + +; CP/M Plus free space calculation + +isplus: ld de,tbuff ; We may have chained to SP + call setdma + ld a,(seldrv) ; Get drive letter + sub 'A' ; Convert to BDOS call value + ld e,a + ld c,2eh ; Get free space call + call bdos + +; Convert 3 byte count of records to K + + ld b,3 ; Total amount to shift +c3fre1: ld hl,tbuff+2 ; Point to buffer start + rr (hl) + dec hl + rr (hl) + dec hl + rr (hl) + djnz c3fre1 + ld hl,(tbuff) ; Get free mod 65536k + jr free6 + +; End RCPSP.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpsubs.lib b/Source/BPBIOS/Z34RCP11/rcpsubs.lib new file mode 100644 index 00000000..3879e9a2 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/rcpsubs.lib @@ -0,0 +1,1057 @@ + page + +; Library: RCPSUBS for Z34RCP +; Author: Carson Wilson +; Version: 1.4 +; Date: October 4, 1989 +; Changes: Added modifications by Rob Friefeld for CLED. +; +; Version: 1.3 +; Date: Sept. 8, 1989 +; Changes: Added ERREX1 routine. RCP now sets bit 4 of the command +; status flag on ambiguous file name errors. Intelligent +; error handlers can interpret this bit and chain to +; more sophisticated transient programs of the same name, +; much the same as CP/M Plus. +; +; Version: 1.2 +; Date: August 12, 1989 +; Changes: Added QPLUG and UNPLUG routines for QUIET operation. + +; Author: Carson Wilson +; Version: 1.1 +; Date: December 30, 1988 +; Changes: Added CPMVER routine to detect CP/M Plus. +; Expanded ZSDOS datestamp buffer to full 128 bytes. +; Now gets CCP address from Z34CMN.LIB instead of calculating +; it from BIOS address, since NZCOM allows nonstandard length +; CCP segments (suggested by Howard Goldstein). + +; Author: Carson Wilson +; Version: 1.0 +; Date: June 15, 1988 +; +; Subroutines for Z34RCP.Z80 + +; ---------------------------------------- + +; Routines to chain to Error Handler (EH) + +; 1. Error codes (from ZCPR34.LBR) + +; ZCPR34 uses the error byte at the beginning of the message buffer as a flag +; to show what kind of error occurred. Advanced error handlers will be able +; to help the user further by suggesting the possible cause of the error. + +ecbaddir equ 2 ; Bad directory specification -- logging of + ; ..user number beyond legal range, + ; ..nonexistent named directory +ecambig equ 8 ; Ambiguous file specification where not + ; ..allowed (SAVE, GET, REN) +ecbadnum equ 9 ; Bad numerical value -- not a number where + ; ..number expected, number out of range +ecnofile equ 10 ; File not found -- REN, TYPE, LIST could not + ; ..find a specified file +ecdiskfull equ 11 ; Disk directory or data area full + ; ..(DOS write error) +ectpafull equ 12 ; TPA overflow error +ecdupspec equ 16 ; Duplicate filespecs (COPY, RENAME) + +; 2. Error Routines + + if cpon or renon or lton or proton +NoFlErr: ; File missing + ld a,ecnofile ; File not found error + jr errexit ; Chain to error handler + endif ; cpon or renon or lton or proton + + if cpon +FulErr: ; Disk or directory full (BDOS write error) + ld a,ecdiskfull ; Disk or data area full + jr errexit ; Chain to error handler +DupErr: ; Duplicate file specs + ld a,ecdupspec ; Duplicate filespec error + jr errexit ; Chain to error handler + endif ; cpon +; +; Check for illegal directory specification under ZCPR 3.4. +; DirChek assumes that FCB's have not been altered since they were +; set by the CCP. Therefore DirChek is called before other BDOS calls. + + if cpon or lton or renon or diron or eraon or proton or reson or spaceon +DirChek: + ld a,(fcb1+15) ; Z34 sets these to non zero + ld hl,fcb2+15 ; ..if illegal dirspecs. found + or (hl) + ret z ; Return if OK + ld a,ecbaddir ; Bad dir. error code +; fall thru + endif +; +; Set error type, then set error, ECP, and external program bits of command +; status flag to tell CCP to go straight to EH. + +ErrExit: + ld b,0 +ErrEx1: ld ix,z3msg ; Point to message buffer + ld (ix+0),a ; First set error type in error byte + ld a,00001110b ; Tell CCP External, No ECP, Error, No shell + or b ; Add any specified bits + ld (ix+3),A ; Set bits in command status flag + jp exit ; Return to CCP + +; ------------------------------------------------------------- + +; Routine to get wheel byte - Returns wheel in A with flags set + +getwhl: + push hl + ld hl,(z3whl) ; Get wheel address from ENV + ld a,(hl) ; Read wheel byte + and a ; Set flags + pop hl + ret + +; ------------------------------ + + if systime ; Time in CLED prompt +; +; PMBCD - Print byte at (HL) to console as 1 or 2 BCD digits. +; +; Entry: A = 80h for leading zero's +; A = 0h for no leading zero's +; +pmbcd: + rld ; Get hi nibble (HL) to low nibble A + or a ; For HD64180 + call nz,decout ; Display if low or high of A not zero + rld ; Get low nibble (HL), from above +decout: + and 00001111b ; Mask high nibble + add a,'0' ; Convert to character + jr conout + endif ; systime + +; Display decimal digit routines + +; Display hundreds, tens, and units digits (assumes flag in B has been set) + + if regon or spaceon +decdsp3: + ld de,100 ; Display hundreds + call decdsp +decdsp2: + ld de,10 ; Display tens + call decdsp + ld a,l ; Get remaining units value +decdsp4: + add a,'0' ; Convert to character + jr conout ; Print it and return + +; --------------------------------- + +; Routine to print any single digit + +; Actually, this routine displays the value of HL divided by DE and leaves the +; remainder in HL. In computing the character to display, it assumes that the +; result of the division will be a decimal digit. If the result is zero, the +; value in the B register, which is the number of digits already printed, is +; checked. If it is zero, a space is printed instead of a leading '0'. If it +; is not zero, the '0' is printed. Whenever any digit (not a space) is +; printed, the value in B is incremented. + + +decdsp: + ld c,'0'-1 ; Initialize digit count + xor a ; Clear carry flag + +decdsp1: + inc c ; Pre-increment the digit + sbc hl,de ; Subtract DE from HL + jr nc,decdsp1 + + add hl,de ; Add back in to produce remainder + ld a,c ; Get decimal digit + cp '0' ; Check for leading 0 + jr nz,decdout ; If not 0, proceed to display it + ld a,b ; Digit printed already? + or a + jr z,spac ; Print leading space if not +decdout: + ld a,c ; Else print real digit + inc b ; Indicate digit printed + jr conout + endif ; regon or spaceon + +; ------------ + +; Print a dash + + if lton or peekon +dash: call print + db ' -',' '+80h + ret + endif ; Lton or peekon + +; ------------------------- + +; Shut off output in QUIET is set. Return Z if QUIET, NZ otherwise. +; Uses: AF + +qplug: + ld a,(quiet) + or a + ret z + ld a,0C9h ; "RET" +qplug1: ld (plug),a + ret + +; -------------------------- + +; Turn on output + +unplug: xor a + jr qplug1 + + +; ------------- + +; Print a space + +spac: ld a,' ' + +; fall thru + +; Console Output Routine + +conout: +plug: db 00h ; Goes to 0C9h to turn off output + putreg ; Save all registers except AF + push af ; Save AF, too + and 7fh ; Mask out MSB + ld e,a ; Transfer character to E + ld c,2 ; BDOS conout function number + call bdos + pop af + getreg ; Restore registers +note: ; Use this RET for NOTE command + ret + +; ------------------------ + +; String printing routines + +; Print string following call (terminated with null or character with the +; high bit set) + +print: + ex (sp),hl ; Get address + call printhl + ex (sp),hl ; Put address + ret + + if whlon or quieton +; +; Routine to say "On" if A is non-zero or "Off" if A is zero. +; Called by WHL and Q commands. + +onmsg: + dc ' On' +offmsg: + dc ' Off' +tella: + ld hl,offmsg ; Prepare to say Off + or a + jr z,printhl ; Say it if A=0 + ld hl,onmsg ; Say On + +; fall thru ; Display message and return + + endif ; whlon or quieton + +; Print string pointed to by HL (terminated with null or character with the +; high bit set) + +printhl: + ld a,(hl) ; Get next character + inc hl ; Point to following one + or a ; See if null terminator + ret z ; If so, we are done + call conout ; Display the character + ret m ; We are done if MSB is set (negative number) + jr printhl ; Back for more + +; ------------------------ + +; Output new line to CON: + +crlf: + call print + db cr,lf+80h + ret + +; Console input + + if eraon or lton or proton or renon or cpon +conin: + push hl ; Save regs + push de + push bc + ld c,1 ; Input + call bdos + pop bc ; Get regs + pop de + pop hl + and 7fh ; Mask msb + cp 61h + ret c + and 5fh ; To upper case + ret + endif ; Eraon or lton or proton or renon or cpon + +; ------------------- + +; Save return address + +retsave: + pop de ; Get return address + pop hl ; Get return address to zcpr3 + ld (z3ret),hl ; Save it + push hl ; Put return address to zcpr3 back + push de ; Put return address back + ret + +; ------------------------------- + +; Test file pted to by HL for R/O +; NZ if R/O + + if renon or cpon or eraon +rotest: + push hl ; Advance to r/o byte + ld bc,8 ; Pt to 9th byte + add hl,bc + ld a,(hl) ; Get it + and 80h ; Mask bit + push af + ld hl,romsg + call nz,printhl ; Print if nz + pop af ; Get flag + pop hl ; Get ptr + ret +romsg: + db ' is R/','O'+80h + +; ----------------------------------------------- + +; Check user to see if he approves erase of file +; Return with Z if yes + +eraq: + call print + db ' - Eras','e'+80h + endif ; Renon or cpon or eraon + + if renon or cpon or eraon or proton +eraq1: + call print + db ' (Y/N/Q)? N',88h ; 88h = backspace + call conin ; Get response + cp 'Q' ; Quit command? + jr z,exit + cp 'Y' ; Key on yes + ret + endif ; Renon or cpon or eraon or proton + +; ------------------------------------- + +; Give space on current disk and return + + if spaceon and [dirsp or cpsp or erasp or resetsp] +spaexit: + call crspace ; Show space remaining +; fall thru + endif ; spaceon and [dirsp or cpsp or erasp or resetsp] + +; +; Exit to ZCPR3 +; +exit: +z3ret equ $+1 ; Pointer to in-the-code modification + ld hl,0 ; Return address + jp (hl) ; Goto ZCPR3 + +; -------------------------------------------------------- + +; Check for user input; if ^X, return with Z, abort if ^C + + if diron or lton or eraon or proton or peekon +break: + push hl ; Save regs + push de + push bc + ld c,11 ; Console status check + call bdos + or a + ld c,1 ; Get char if any + call nz,bdos + pop bc ; Restore regs + pop de + pop hl +break1: cp ctrlc ; Check for abort + jr z,exit ; Exit + cp ctrlx ; Skip? + ret + endif ; Diron or lton or eraon or proton or peekon + +; --------------------- + +; Print address in DE + + if peekon or pokeon +adrat: + call print + db ' at',' '+80h + ld a,d ; Print high + call pahc + ld a,e ; Print low + jp pahc + endif ; Peekon or pokeon + +; -------------------------------------------------- + +; Extract hexadecimal number from line pted to by HL +; Return with value in DE and HL pting to offending char + + if peekon or pokeon or porton +hexnum: + ld de,0 ; De=accumulated value +hnum1: + ld a,(hl) ; Get char + cp ' '+1 ; Done? + ret c ; Return if space or less + inc hl ; Pt to next + sub '0' ; Convert to binary + jr c,numerr ; Return and done if error + cp 10 ; 0-9? + jr c,hnum2 + sub 7 ; A-f? + cp 10h ; Error? + jr nc,numerr +hnum2: + push hl ; Save pointer + ex de,hl + add hl,hl + add hl,hl + add hl,hl + add hl,hl ; De x16 to hl + ld e,a + ld d,0 + add hl,de + ex de,hl ; De = de * 16 + a + pop hl ; Get the pointer + jr hnum1 ; Try again +; +; Number error +; +numerr: + ld a,ecbadnum ; Numeric error + jp errexit ; Chain to error handler + +; Skip to next non-blank + +sksp: + ld a,(hl) ; Get char + inc hl ; Pt to next + cp ' ' ; Skip spaces + jr z,sksp + dec hl ; Pt to good char + or a ; Set eol flag + ret + endif ; Peekon or pokeon or porton + +; ------------------------------------------------------------------------ + +; Test File in FCB for unambiguity and existence, ask user to delete if so +; Return with Z flag set if R/O or no permission to delete + + if renon or cpon +extest: + call ambchk ; Ambiguous file names not allowed + call searf ; Look for specified file + jr z,exok ; Ok if not found + call getsbit ; Position into dir + inc de ; Pt to file name + ex de,hl ; Hl pts to file name + push hl ; Save ptr to file name + call prfn ; Print file name + pop hl + call rotest ; Check for r/o + jr nz,exer + call eraq ; Erase? + jr nz,exer ; Restart as error if no + ld de,fcb1 ; Pt to fcb1 + ld c,19 ; Delete file + call bdos +exok: xor a + dec a ; Nz = ok + ret +exer: + xor a ; Error flag - file is r/o or no permission + ret + +; Check for ambiguous file name in FCB1 +; Return z if so + +ambchk: + ld hl,fcb1+1 ; Pt to fcb + +; Check for ambiguous file name pted to by HL + +ambchk1: + push hl + ld b,11 ; 11 bytes +amb1: ld a,(hl) ; Get char + and 7fh ; Mask + cp '?' + jr z,amb2 + inc hl ; Pt to next + djnz amb1 + dec b ; Set nz flag + pop de + ret +amb2: + pop hl ; Pt to file name + ld a,ecambig ; Ambiguous name error + ld b,00010000b ; Bit 4 tells EH to load transient + jp ErrEx1 ; Chain to error handler + endif ; Renon or cpon + +; --------------------------------------- + +; Init FCB1, return with DE pting to FCB1 + + if eraon or lton or cpon +initfcb1: + ld hl,fcb1 ; Pt to fcb +initfcb2: + push hl ; Save ptr + ld bc,12 ; Pt to first byte + add hl,bc + ld b,24 ; Zero 24 bytes + xor a ; Zero fill + call fillp ; Fill memory + pop de ; Pt to fcb + ret + endif ; Eraon or lton or cpon + +; Fill a region with byte in A + + if eraon or lton or cpon or diron +fillp: + ld (hl),a ; Store byte + inc hl ; Pt to next + djnz fillp ; Count down + ret + endif ; Eraon or lton or cpon or diron + +; --------------------------------------------------------------------- + +; After a search, return NZ set if desired type of file found, Z if not. +; This algorithm looks at the system bit of the located file; this +; bit is set to 1 if the file is a system file and 0 if not a system +; file. The following exclusive or masks are applied to return Z or NZ +; as required by the calling routine: +; +; SYSTEM BYTE: X 0 0 0 0 0 0 0 (AFTER 80H MASK, X=1 IF SYS, 0 IF DIR) +; +; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR 0 = 0 if X=0, = 80H if X=1) +; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR 80H = 80h if X=0, = 0 if X=1) +; BOTH : 0 0 0 0 0 0 0 1 (XOR 1 = 81H or 1H, NZ in both cases) + + if diron or eraon or lton or proton or cpon or renon +getsbit: + dec a ; Adjust to returned value + rrca ; Convert number to offset into tbuff + rrca + rrca + and 60h + ld de,tbuff ; Pt to buffer + add a,e ; Add entry offset to base addr + ld e,a ; Result in e + push de ; Save ptr in de + add a,10 ; Add offset of 10 to pt to system byte + ld e,a ; Set address + ld a,(de) ; Get byte + pop de ; Get ptr in de + and 80h ; Look at only system bit +systst equ $+1 ; In-the-code variable + xor 0 ; If systst=0, sys only; if systst=80h, dir + ; Only; if systst=1, both sys and dir + ret ; Nz if ok, z if not ok + +; Log into user area contained in FCB1 + +logusr: + ld a,(fcb1+13) ; Get user number +setusr: + ld e,a + ld c,32 ; Use bdos fct + jp bdos + +; Print file name pted to by HL + +prfn: + call spac ; Leading space + ld b,8 ; 8 chars + call prfn1 + call print + db '.'+80h ; Dot + ld b,3 ; 3 chars +prfn1: ld a,(hl) ; Get char + inc hl ; Pt to next + call conout ; Print char + djnz prfn1 ; Count down + ret + +; Search for first + +searf: + push bc ; Save counter + push hl ; Save hl + call dirchek ; Check bad dirspec + ld c,17 ; Search for first function +searf1: ld de,fcb1 ; Pt to fcb + call bdos + inc a ; Set zero flag for error return + pop hl ; Get hl + pop bc ; Get counter + ret + endif ; Diron or eraon or lton or proton or cpon or renon + +; ------------------------- + +; Copy HL to DE for B bytes + + if diron or eraon or lton or proton or cpon +blkmov: + ld a,(hl) ; Get + ld (de),a ; Put + inc hl ; Pt to next + inc de + djnz blkmov ; Loop + ret + endif ; Diron or eraon or lton or proton or cpon + +; ----------------------------- + +; Print file not found message + + if diron or eraon +prfnf: + call print + db ' No File','s'+80h + jp exit + endif ; Diron or eraon + +; ------------------------------------------------------------------ + +; Define buffers as high as possible in TPA for the following groups +; of commands: +; +; COPY needs SRCFCB, CBUFF, STPBUF (if STPCALL) +; ERA, PROT, LIST/TYPE need DIRBUF and NXTFILE +; DIR needs DIRBUF +; +; If DIRBUF is defined, its value is in HL on return from this code. The DE +; register pair is not changed by the code, but the BC pair is affected. + +dirbufon equ lton or eraon or proton or diron + + if dirbufon +dirbuf: ds 2 ; Address for directory buffer + endif ; dirbufon + + if lton or eraon or proton +nxtfile: ds 2 ; Ptr to next file in list + endif ; eraon or lton or proton + + if cpon or dirbufon or cledon +define: + push de + ld hl,(bdos+1) ; Get bottom of BDOS + ex de,hl ; ..into DE + ld hl,(ccp) ; From Z34CMN.LIB + +; Now we have to compare and pick the lower address as the top of TPA + + push hl ; Save CPR address while comparing + xor a ; Clear the carry flag + sbc hl,de ; Compute (CPR-BDOS) + pop hl ; Restore CPR address + jr c,define1 ; Branch if BDOS address is higher (use CPR) + ex de,hl ; Otherwise use BDOS address +define1: + if cpon + ld de,-36 ; Calculate place for SRCFCB for copy command + add hl,de + ld (srcfcb),hl + + if stpcall + ld de,-128 + add hl,de ; Buffer for datestamps + ld (stpbuf),hl + endif ; stpcall + + if dirbufon + push hl ; Save if needed below + endif ; dirbufon + + ld de,-[cpblocks*128] ; CBUFF can use same space as DIRBUF + add hl,de + ld (cbuff),hl + + if dirbufon + pop hl + endif ; dirbufon + + endif ; cpon + + if dirbufon + ld de,-[maxdirs*11] ; Space for directory buffer + add hl,de + ld (dirbuf),hl + endif ; dirbufon + + pop de + ret + + endif ; cpon or dirbufon or cledon + +; --------------- + +; Search for next + + if diron or eraon or lton or proton +searn: + push bc ; Save counter + push hl ; Save hl + ld c,18 ; Search for next function + jr searf1 + +; Load directory and sort it +; On input, A=SYSTST flag (0=SYS, 1=DIR, 80H=BOTH) +; Directory is loaded into buffer at top of TPA +; Return with ZERO set if no match and HL pts to 1st entry if match + +direrr: + ld a,ectpafull ; Chain to error handler + jp errexit + +getdir: + ld (systst),a ; Set system test flag + call logusr ; Log into user area of fcb1 + call define ; Define buffer addresses + ld (hl),0 ; Set empty + ld bc,0 ; Set counter + call searf ; Look for match + ret z ; Return if not found + +; Step 1: Load directory + +gd1: + push bc ; Save counter + call getsbit ; Check for system ok + pop bc + jr z,gd2 ; Not ok, so skip + push bc ; Save counter + inc de ; Pt to file name + ex de,hl ; Hl pts to file name, de pts to buffer + ld b,11 ; Copy 11 bytes + call blkmov ; Do copy + pop bc ; Get counter + inc bc ; Increment counter + ld hl,maxdirs-1 ; See if count equals or exceeds MAXDIRS + ld a,b ; Check high bytes + sub h + jr c,gd1a ; If carry set, we are OK + ld a,c ; Check low bytes + sub l + jr nc,direrr ; If no carry, jump to error message +gd1a: ex de,hl ; Hl pts to next buffer location +gd2: call searn ; Look for next + jr nz,gd1 + ld (hl),0 ; Store ending 0 + ld hl,(dirbuf) ; Pt to dir buffer + ld a,(hl) ; Check for empty + or a + ret z + +; Step 2: Sort directory + + if dsort + push hl ; Save ptr to dirbuf for return + call diralpha ; Sort + pop hl + endif + + xor a ; Set nz flag for ok + dec a + ret + + +; DIRALPHA -- Alphabetizes directory in DIRBUF; BC contains +; the number of files in the directory +; + if dsort +diralpha: +; +; SHELL SORT -- +; This sort routine is adapted from "Software Tools" +; by Kernigan and Plaugher, page 106. Copyright, 1976, Addison-Wesley. +; + ld h,b ; Hl=bc=file count + ld l,c + ld (num),hl ; Set "NUM" + ld (gap),hl ; Set initial gap to n for first division by 2 + +; For (gap = num/2; gap > 0; gap = gap/2) + +srtl0: +gap equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Get previous gap + or a ; Clear carry + rr h ; Rotate right to divide by 2 + rr l + + ld a,l ; Test for zero + or h + ret z ; Done with sort if gap = 0 + + ld (gap),hl ; Set value of gap + push hl + pop ix ; Set ix=gap for following loop + +; For (ix = gap + 1; ix <= num; ix = ix + 1) + +srtl1: + inc ix ; Add 1 to ix + push ix + pop de ; IX is in DE + +; Test for ix <= num + +num equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Number of items to sort + ld a,l ; Compare by subtraction + sub e + ld a,h + sbc a,d ; Carry set means ix > n + jr c,srtl0 ; Don't do for loop if ix > n + ex de,hl ; Set jj = ix initially for first + ; ..subtraction of gap + ld (jj),hl + +; For (jj = ix - gap; jj > 0; jj = jj - gap) + +srtl2: + ld de,(gap) +jj equ $+1 ; Pointer for in-the-code modification + ld hl,0 ; Get jj + + sbc hl,de ; Compute JJ - GAP + ld a,h + ld (jj),hl ; Jj = jj - gap + jr c,srtl1 ; If carry from subtractions, jj < 0 and abort + or l ; Jj=0? + jr z,srtl1 ; If zero, jj=0 and abort + +; Set iy = jj + gap + + ex de,hl ; Jj in de + ld hl,(gap) ; Get gap + add hl,de ; Jj + gap + push hl + pop iy ; IY = iy + gap + +; If (v(jj) <= v(iy)) + + call icompare ; JJ in de, iy in hl + +; ...then break + + jr c,srtl1 + +; ...else exchange + + ld de,(jj) ; Swap jj, iy + push iy + pop hl + call iswap ; Jj in de, iy in hl + +; End of inner-most for loop + + jr srtl2 + +; +; SWAP (Exchange) the elements whose indexes are in HL and DE +; +iswap: + call ipos ; Compute position from index + ex de,hl + call ipos ; Compute 2nd element position from index + ld b,11 ; 11 bytes to flip + endif ; Dsort + endif ; Diron or eraon or lton or proton + + if diron or eraon or lton or proton or renon or (cpon and leftright) +iswap1: + ld a,(de) ; Get bytes + ld c,(hl) + ex de,hl + ld (de),a ; Put bytes + ld (hl),c + inc hl ; Pt to next + inc de + djnz iswap1 + ret + endif ; Diron or eraon or lton or proton or renon + ; ..or (cpon and leftright) + + if leftright and (cpon or renon) +; +; FCBSWAP exchanges 16 byte FCB1 with FCB2 from the command line. +; This allows COPY and REN commands to execute left to right, +; e.g., "cp source dest". Costs 10 bytes. +; +; If TESTEQ is true, then commands containing '=' still execute right +; to left, e.g., "cp dest=source". Costs 11 bytes additional. +; +fcbswap: + if testeq + xor a ; Zero B + ld b,a + ld hl,80h ; Point to command line, length + ld c,(hl) ; Set up for CPIR + ld a,'=' ; Search for '=' + cpir ; '=' found in command? + ret z ; Yes, don't swap + endif ; Testeq + + ld de,fcb1 ; Point to command fcb's + ld hl,fcb2 + ld b,16 ; Exchange them + jr iswap1 + endif ; leftright and (cpon or renon) + + if diron or eraon or lton or proton + if dsort +; +; ICOMPARE compares the entry pointed to by the pointer pointed to by HL +; with that pointed to by DE (1st level indirect addressing); on entry, +; HL and DE contain the numbers of the elements to compare (1, 2, ...); +; on exit, Carry Set means ((DE)) < ((HL)), Zero Set means ((HL)) = ((DE)), +; and Non-Zero and No-Carry means ((DE)) > ((HL)) +; +icompare: + call ipos ; Get position of first element + ex de,hl + call ipos ; Get position of 2nd element + ex de,hl +; +; Compare dir entry pted to by HL with that pted to by DE; +; No net effect on HL, DE; ret w/CARRY set means DE +; Version: 1.2 +; Date: 16 June 1988 +; Changes: Renamed CRT0 to LINS for NZCOM compatibility. +; Added CUSR " " " + +; Author: Carson Wilson +; Version: 1.1 +; Date: 12 June 1988 +; Changes: Added CDRV for various Z34RCP commands. +; Added CRT0 for Z34RCP TYPE command. +; Added Z3TCAP and CLRSCR for Z34RCP CLS command. +; Added QUIET for ZCPR34 time in prompt. +; Added RSDMSG for ZCPR34 time in prompt. + +; Library: Z34CMN.LIB +; Author: Joe Wright +; Date: 23 March 1988 + +; As a replacement for Z3BASE.LIB, some usual equates. + +base equ 0 ; Base Page + +false equ 0 +true equ not false + +no equ false +yes equ true + +off equ false +on equ true + +; Named COMMON declarations start here. For compatibility, these +; are the same names used by Bridger Mitchell's JetLDR. + + common /_ENV_/ +z3env: ; Z3 Environment descriptor +z3envs equ yes ; There is one + +expath equ z3env+9 ; Address of External Path +expaths equ 10 ; Maximum 10 elements for MPATH + +rcp equ z3env+0ch ; Address of RCP +rcps equ yes ; Used as existence test, not size + +fcp equ z3env+12h ; Address of FCB +fcps equ yes ; Used as existence test, not size + +z3ndir equ z3env+15h ; Address of NDR +z3ndirs equ yes ; Used as existence test, not size + +quiet equ z3env+28h ; Quiet flag address + +z3whl equ z3env+29h ; Wheel byte address +z3whls equ yes ; There is a wheel + +lins equ z3env+33h ; CRT text lines address + +ccp equ z3env+3fh ; CCP entry +ccps equ z3env+41h ; Size + +dos equ z3env+42h ; DOS entry (+6) +doss equ z3env+44h ; Size + +bio equ z3env+45h ; BIO entry + +z3tcap equ z3env+80h ; TCAP address + +clrscr equ z3env+97h ; Clear screen string address + + common /_SSTK_/ +shstk: ; Top of Shell stack +shstks equ yes ; There is a shell stack + + common /_MSG_/ +z3msg: ; Message buffer +z3msgs equ yes ; There is one + +cusr equ z3msg+2eh ; Current user +cdrv equ z3msg+2fh ; Current drive + +rsdmsg equ z3msg+3ah ; Reserved bytes + + common /_FCB_/ +extfcb: ; External file control block +extfcbs equ yes ; There is one + + common /_MCL_/ +z3cl: ; Multiple command line +z3cls equ yes ; There is one + + common /_XSTK_/ +extstk: ; External stack +extstks equ yes ; There is one + + common /_BIOS_/ +bios: + + cseg ; Select Code Segment + +; End of Z34CMN.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34defn.lib b/Source/BPBIOS/Z34RCP11/z34defn.lib new file mode 100644 index 00000000..683fc322 Binary files /dev/null and b/Source/BPBIOS/Z34RCP11/z34defn.lib differ diff --git a/Source/BPBIOS/Z34RCP11/z34mac.lib b/Source/BPBIOS/Z34RCP11/z34mac.lib new file mode 100644 index 00000000..8ab3ffbe --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/z34mac.lib @@ -0,0 +1,122 @@ + +; Z33MAC.LIB : Macros for use with ZCPR33 + +; General purpose macros + +putreg macro + push hl ; Save registers in order + push de + push bc + endm + +getreg macro + pop bc ; Restore registers in order + pop de + pop hl + endm + +swap macro + rrca ; Exchange nibbles + rrca + rrca + rrca + endm + +;---------------------------------------- + +; Macro for forming option bytes + +; This macro generates a byte with bits corresponding to up to 8 option +; flags. The bits are filled in the order of the parameters and are right +; justified in the byte. + +optflag macro f1,f2,f3,f4,f5,f6,f7,f8 + +flag defl 0 ;; initial value + + irp temp, + + if not nul temp +flag defl flag shl 1 + if temp +flag defl flag or 1 + endif ;;temp + endif ;;not nul temp + + endm ;; irp + + defb low flag + + endm ;; optflag + +;----------------------------------------------------------------------------- + +; Command table entry definition macro + +; Macro to form an entry for one command in the table. The first parameter is +; the name to be used for the command (no quotes); the second parameter is the +; flag that indicates whether or not the command is to be enabled; the third +; parameter is the wheel control flag; and the last parameter is the jump +; address to the code that carries out the command. The command names are +; automatically padded out to the correct length (they will be truncated and +; an error message will result if a command name is too long). The characters +; in the command name are automatically converted to upper case. + +command macro cmdname,enableflag,wheelflag,address + + if enableflag ;; Generate command only if enabled + +whlmask defl wheelflag ;; Initialize variables +count defl cmdsize ;; Initialize to size of each command name + + irpc char,cmdname ;; Repeat over letters in command name + +count defl count - 1 ;; Count down characters in name + + if [ count lt cmdsize ] + + ;; If character is lower case, convert to upper case + + if [ '&char' ge 'a' ] and [ '&char' le 'z' ] + + if whlmask + defb [ '&char' and 5fh ] + 80h + else ;;not whlmask + defb [ '&char' and 5fh ] + endif ;;whlmask + + else ;;not lower case + + if whlmask + defb '&char' + 80h ;; If controlled by wheel, set high bit + else ;;not whlmask + defb '&char' ;; If not restricted, leave high bit clear + endif ;;whlmask + + endif ;;lower case + + endif ;;[ count lt cmdsize ] + +whlmask defl false ;; Turn off high-bit setting after first char + + endm ;irpc + + ;; Pad command name with blanks + + if [ count gt cmdsize ] ;; If we underflowed + *** Command name "&cmdname" is too long / truncated *** + else + rept count + defb ' ' + endm + endif ;[ count gt cmdsize ] + + dw address ;; Dispatch address for command + + endif ;enable + + endm ;command + +; End Z33MAC.LIB + + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp.lib b/Source/BPBIOS/Z34RCP11/z34rcp.lib new file mode 100644 index 00000000..74908d54 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/z34rcp.lib @@ -0,0 +1,515 @@ + +; File: Z34RCP.LIB +; Description: Resident Command Package (RCP) for ZCPR34 +; Version: 1.4 +; Author: Carson Wilson +; Date: October 4, 1989 +; Changes: Added PUSER0 equate suggested by Rob Friefeld. +; +; Version: 1.3 +; Author: Carson Wilson +; Date: September 29, 1989 +; Changes: Added CLED (Command Line Editor Shell) command options +; and equates. +; +; Version: 1.2 +; Author: Carson Wilson +; Date: August 11, 1989 +; Changes: Removed several "quiet" conditional assembly equates as +; we are now sensing the QUIET flag instead. +; Changed default of WHLQUIET to false. +; +; Version: 1.1 +; Author: Carson Wilson +; Date: July 10, 1989 +; Changes: Changed 'S' command name to 'SP'. +; Removed wheel protection from 'Q' command and set QQUIET +; on by default. +; Changed command order. + +; Version: 1.0 +; Author: Carson Wilson +; Date: June 15, 1988 + +; This is the configuration file for the ZCPR Version 3.4 resident command +; package. You should read through this file and set the equates according +; to the features you want to implement. Since most systems have a limited +; amount of space for the resident command package, it will probably be +; impossible to include all features. + +; If you are using an SLR or equivalent assembler, you will be prompted +; at assembly time for which commands to include in the RCP. + +;============================================================================= +; +; A S S E M B L Y O P T I O N S +; +;============================================================================= + +; SLR controls whether special pseudo-ops such as ".printx" and ".accept", +; and complex macros are used at assembly time. For SLR Systems or compatible +; macro assemblers, set this equate to true. + +SLR equ false + +; RCPTYPE is the final character of the RCP name in the H(elp) command, +; and determines the order in which commands are added. + + if SLR +Y equ true +N equ false +H equ 'H' +F equ 'F' + +.accept 'Enter "F" for floppy, "H" for fixed disk version: ',rcptype + else +rcptype equ 'H' ; Floppy disk version + endif ; SLR + +; ZRL controls whether named common labels are used in the code. To create +; absolute code, modify RCPBASE.LIB to reflect your system's addresses, set +; ZRL to false and instruct your assembler to generate absolute code (either +; a .COM or .HEX file). +; +; To create a relocatable file for use with Bridger Mitchell's JetLDR or +; Joe Wright's NZCOM, you must use an assembler which recognizes named +; common blocks. If your assembler has this capability, set ZRL to true +; and instruct the assembler to generate relocatable (.REL) code. + +ZRL equ true + +;============================================================================= +; +; M A C R O S +; +;============================================================================= + +; SLR assemblers allow selection of options during assembly. + + if SLR + +select macro option default comment + .accept comment,option ; Prompt user for selection + endm + + .printx + .printx Answer "Y" to include, "N" to exclude commands: + .printx + + else + +select macro option default comment +option equ default ; Use selections from file + endm + endif ; SLR + +;============================================================================= +; +; R E S I D E N T C O M M A N D S S E L E C T I O N +; +;============================================================================= + +; Commands to include in the resident command package + +; There are some interrelations between a number of the possible resident +; commands. Some are so close (LIST and TYPE) that a single equate controls +; both functions. Others like DIR and ERA share code (both display file +; listings). It is efficient to select or deselect them together. + +; If you are using an SLR or compatible assembler, you will be prompted +; at assembly time for command selections. Otherwise, select commands to +; be included by setting each SELECT macro below to yes or no. + +select CLEDON no 'CLED - command line editor shell? ' +select CLSON yes 'CLS - clear screen? ' +select RESON yes 'R - reset disk system? ' +select SPACEON yes 'SP - show space remaining on disk? ' + + if RCPTYPE='F' ; Assemble in floppy order +select DIRON yes 'D - disk directory? ' +select ERAON yes 'ERA - erase files? ' +select ECHOON yes 'ECHO - send text to screen or printer? ' +select RENON yes 'REN - rename files? ' +select CPON yes 'CP - copy file? ' +select LTON yes 'TYPE - display file on console? ' +select POKEON yes 'POKE - set memory? ' +select PEEKON yes 'PEEK - view memory? ' + else ; Assemble in fixed-disk order +select ECHOON yes 'ECHO - send text to screen or printer? ' +select POKEON yes 'POKE - set memory? ' +select PEEKON yes 'PEEK - view memory? ' +select QUIETON yes 'Q - set or clear quiet status? ' +select DIRON yes 'D - disk directory? ' +select ERAON no 'ERA - erase files? ' +select RENON no 'REN - rename files? ' +select CPON no 'CP - copy file? ' +select LTON yes 'TYPE - display file on console? ' + endif ; RCPTYPE='F' + + if LTON +select LISTON no 'LIST - list to printer? ' + else ; allowed only if TYPE is enabled +LISTON equ no + endif + + if RCPTYPE='F' ; Assemble in floppy order +select QUIETON yes 'Q - set or clear quiet status? ' + endif + +select PROTON no 'PROT - set file attributes? ' +select NOTEON no 'NOTE - command-line comment? ' +select REGON no 'REG - set and display user registers? ' +select WHLON no 'WHL - set or clear wheel status? ' +select PORTON no 'PORT - view and set I/O ports? ' + +;============================================================================= +; +; W H E E L P R O T E C T I O N +; +;============================================================================= + +; To prevent unauthorized users from performing certain dangerous or sensitive +; operations on the computer, ZCPR34 provides the capability of disabling the +; operation of certain commands when the wheel byte is off. In ZCPR30, an +; attempt to use one of these wheel-protected commands when the wheel byte was +; off resulted in an error message. In ZCPR34 things work differently. In the +; same situation, the command simply disappears. In this way a transient +; program or extended command processor function can take over and deal with +; the attempt to use the command in a much more flexible way. +; +; Wheel-protected commands in ZCPR30 had extra code to intercept the function +; and disable it. In ZCPR34, wheel protection is enabled and disabled in a +; different way. To wheel-protect a command the high bit of the first +; character in the command name is set. The command table scanner in ZCPR34 +; will not recognize these commands when the wheel byte is off. Since the same +; command scanner is used to scan the commands in the RCP and FCP (flow control +; package), commands there can be wheel protected in the same way. For skilled +; computer operators it is very easy to use a debugger, file patcher, or disk +; utility to enable and disable wheel protection without having to reassemble +; the CPR, RCP, or FCP. +; +; Because of the way the command scanner works, once wheel protection is +; implemented in the CCP, there is no further code penalty in protecting RCP +; commands. Therefore, we recommend protecting all possibly sensitive +; commands or none. + +wcled equ no ; CLED +wcp equ yes ; CP +wdir equ no ; DIR +wera equ yes ; ERA +wlist equ yes ; LIST +wpeek equ yes ; PEEK +wpoke equ yes ; POKE +wport equ yes ; PORT +wprot equ yes ; PROT +wquiet equ no ; QUIET +wreg equ yes ; REG +wren equ yes ; REN +wspop equ yes ; SPOP +wtype equ yes ; TYPE +whrc equ no ; H + +wheel defl wcp or wdir or wera or wlist or wpeek or wpoke or wport +wheel defl wheel or wprot or wreg or wren or wtype or whrc + +;============================================================================= +; +; C O M M A N D O P T I O N S +; +;============================================================================= + +; Options affecting several commands + +; DSORT includes code to sort file entries for the D, TYPE, LIST, ERA, +; and PROT commands. + +dsort equ yes + +; LEFTRIGHT affects the COPY and RENAME commands. If yes, add code to allow +; CP and REN operations work from left to right, and CP to accept a +; single filespec as its source. +; Examples: +; B0>ren b1:old.nam new.nam Renames B1:old.nam to B1:new.nam +; B0>cp a15:that.fil Copies A15:that.fil to B0: +; B0>cp source.fil dest.fil Copies source.fil to dest.fil + +leftright equ yes + +; If LEFTRIGHT is yes, setting TESTEQ to yes also allows CP and REN commands +; to be processed from right to left if they contain an equal sign ("="). +; Costs 11 bytes. +; Example: +; B0>cp dest.fil=source.fil Copies source.fil to dest.fil + +testeq equ yes + +;----------------------------------------------------------------------------- + +; 'CLS' command + +; This command clears the console screen. It can either use a fixed string +; (for shorter code if the same terminal is always used) or use the TCAP +; entry for automatic adaptation to any terminal. + +clstcap equ true ; Use TCAP for clear-screen string + +; If CLSTCAP is not enabled, then the string below must be provided and +; it must end with a character with the high bit set + + if not clstcap +clsstr macro + db 'Z'-'@'+80h ; Control-Z to clear screen + endm + endif ;not clstcap + +typecls equ true ; Clear between screens when typing files + +;----------------------------------------------------------------------------- + +; 'CP' command + +; This command copies a single file. The destination file can have a different +; name from the source file. Set the size of the memory buffer in K below (do +; not change the second definition). The copy buffer is placed at the top of +; the TPA, where it will generally not interfere with subsequent use of the GO +; command to rerun a program loaded in the TPA. + +cpblocks defl 16 ; Size of copy buffer in K + +cpblocks defl cpblocks * 8 ; Convert to number of records + +; If you will be using a BDOS or RSX which supports new functions 102 (Get +; Stamp) and 103 (Set Stamp), set STPCALL to true, and datestamps of files +; will be preserved across copies. The "last access" stamps of both copies +; are set to the time the copy took place if access stamping is enabled. + +stpcall equ true ; Copy file stamps with functions 102/3 + +;----------------------------------------------------------------------------- + +; 'DIR' command + +; This command displays a sorted listing of the files in a directory. The +; file name buffer is allocated at the top of the TPA so as not to modify +; any program loaded in low memory. Consequently, the size of the buffer +; must be set in advance. + + +maxdirs equ 256 ; Maximum number of names in directory buffer + +nosys equ yes ; suppress 'A' and 'S' options if wheel off + +slashchk equ yes ; allow "DIR /S" or "DIR /A" formats (costs + ; about 12 bytes) + +allflag equ 'A' ; Option character for showing + ; all file (both SYS and DIR) +sysflag equ 'S' ; Option character for showing + ; SYS files only +sortnt equ yes ; Sort file by name then type +wide equ yes ; Make display for 80-column screen +fence equ '|' ; Character to use as fence between columns + ; ..if WIDE is false. + +;----------------------------------------------------------------------------- + +; 'ECHO' command + +; This command sends characters to the console or list device. If ECHOLST is +; enabled, then code is included for sending characters to the LST device. +; Characters normally go the the console device and are normally upper or lower +; case depending on the setting of UPCASE. The command line can have special +; command sequences to toggle the case of the output and to change the +; destination between the console and printer. Any other character following +; the command character will be sent as is. For the normal setting of the +; equates below (upcase/yes, cmdchar/%, prtchar/P, crtchar/C, lcasech/>, +; and ucasech/<) an example command line would be: +; A0:ROOT>ECHO T%>HIS IS A TEST^M^J^IDONE%PONE, TWO, %' ; Character after CASECHAR that toggles + ; subsequent output to lower case + +; ---------------------------------------------------------------------------- + +; 'H' command + +; This command displays a list of the resident commands implemented in the +; system. FCP, CPR, and RCP commands can be displayed. The basic command is +; not optional; it is always included. + +listcpr equ yes ; Include list of CPR-resident commands in + ; display (highly recommended) + +listfcp equ yes ; Include list of FCP-resident commands in + ; display (recommended if there is room) + +noshow equ yes ; Suppress listing commands that are wheel- + ; restricted unless wheel byte is set (i.e., + ; don't show commands that won't run) + +cmdsline equ 5 ; Number of commands on each line of display + +cmdspace equ 8 ; Space in display for each command name + +;----------------------------------------------------------------------------- + +; 'LIST' and 'TYPE' commands + +pgdflt equ yes ; Default to paging of console output + +pgdflg equ 'P' ; Character to toggle paging status + +;---------------------------------------- + +; 'PEEK' command + +peekhdr equ yes ; Label columns in PEEK display + +peekbdr equ yes ; Include line of hyphens under labels + +peekchk equ yes ; If yes, the ending address will be tested to + ; prevent overflow past FFFF (costs 5 bytes) + +peeklen equ 127 ; Display 1 record (128 bytes) as default. + ; PEEK displays in increments of 16 bytes. + ; You may set PEEKLEN for 0 to 65525. + +;---------------------------------------- + +; 'S' command + +; Print disk space with other commands (recommended) + +dirsp equ true ; Show space after DIR +erasp equ true ; Show space after ERA +cpsp equ true ; Show space after CP +resetsp equ true ; Show space after R + +;---------------------------------------- + +; 'WHL' command + +whlquiet equ false ; If true, don't report wheel state with + ; .."WHL password" command (costs 1 byte) + +wpass macro + db 'SYSTEM ' + endm + +;---------------------------------------- + +; 'CLED' command +; +; Command line editing takes place in the line buffer. It does not take up +; room in the RCP. The editor will handle a 255 byte line. Although that +; is larger than the maximum command line size, it allows you to edit a long +; line without deleting something first. The history is kept inside the RCP, +; so its size will depend upon how many other RCP commands are enabled. +; HISTSIZE should be at least as large as the multiple command line buffer +; (204 bytes). + +lbufwid equ 255 ; Line buffer size, byte +histsize equ 204 ; History buffer size, word + +; CLERA controls whether to null the internal history when CLED is exited, or +; to leave it for the next run. Secure systems will want to set it to YES. + +clera equ no ; Erase history on terminating shell + +; CLMIN sets the cutoff for discarding short lines from history recording. +; A setting of 3 would discard a command such as DIR. + +clmin equ 5 ; Discard lines which do not exceed this + +clins equ yes ; Initial insert state ON +clsav equ yes ; Initial history recording ON + +; The appearance of the command line prompt may include the system time if a +; DateStamper or ZS/ZDDOS clock is implemented. The DU:DIR separator character +; can be changed to indicate that CLED is running. + +dudir_sep equ '/' ; DU:DIR separator char +puser0 equ no ; Print user #0 in prompt +systime equ yes ; Include system time in prompt + + if systime +civtim equ yes ; Yes for 12-hr civil time vs. 24-hr military +timesep equ '.' ; Separator between hours and minutes + endif + +; The editor must use EREOL. The VLIB routine to send the EREOL sequence +; to the terminal needs to test for a video delay and the presence of the "/" +; quote character. Most terminals can just print the TCAP sequence as is. If +; that doesn't work, set ERLQUICK to NO. If you are using only one terminal, +; it will be most efficient to set ERLTCAP to NO and use the CLR_EOL macro. + +erltcap equ yes ; Use TCAP routine vs macro + + if erltcap +erlquick equ yes ; Use simplified TCAP routine + else + +clr_eol macro ; Define terminal specific string + dc 1bh,'T' ; ...set high bit on last character + endm + + endif ;erltcap + +;----------------------------------------------------------------------------- + +; Command names + +; The CTABLE macro, which constructs the command dispatch table, includes a +; line for each command, the first parameter of which is the name of the +; command. These names may be changed if you wish. But make sure that you +; do not use a name that is longer than the maximum allowed length. If you +; do, the name will be truncated and a nonfatal error will occur during +; assembly. DO NOT CHANGE ANY PARAMETER OTHER THAN THE COMMAND NAME. Lower +; case letters will be converted to upper case. The macro COMMAND is defined +; in Z34MAC.LIB. + +cmdsize equ 4 ; Length of each command name + +cmdtbl macro + command CLED, cledon, wcled, cled + command CLS, clson, false, cls + command CP, cpon, wcp, copy + command D, diron, wdir, dir + command ECHO, echoon, false, echo + command ERA, eraon, wera, era + command H, true, whrc, clist + command LIST, liston, wlist, list + command NOTE, noteon, false, note + command P, peekon, wpeek, peek + command POKE, pokeon, wpoke, poke + command PORT, porton, wport, port + command PROT, proton, wprot, att + command Q, quieton,wquiet, quset + command R, reson, false, reset + command REG, regon, wreg, register + command REN, renon, wren, ren + command SP, spaceon,false, space + command SPOP, cledon, wspop, shpop + command TYPE, lton, wtype, type + command WHL, whlon, false, whl + endm + +; END Z34RCP.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp.lib.sav b/Source/BPBIOS/Z34RCP11/z34rcp.lib.sav new file mode 100644 index 00000000..a0272445 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/z34rcp.lib.sav @@ -0,0 +1,515 @@ + +; File: Z34RCP.LIB +; Description: Resident Command Package (RCP) for ZCPR34 +; Version: 1.4 +; Author: Carson Wilson +; Date: October 4, 1989 +; Changes: Added PUSER0 equate suggested by Rob Friefeld. +; +; Version: 1.3 +; Author: Carson Wilson +; Date: September 29, 1989 +; Changes: Added CLED (Command Line Editor Shell) command options +; and equates. +; +; Version: 1.2 +; Author: Carson Wilson +; Date: August 11, 1989 +; Changes: Removed several "quiet" conditional assembly equates as +; we are now sensing the QUIET flag instead. +; Changed default of WHLQUIET to false. +; +; Version: 1.1 +; Author: Carson Wilson +; Date: July 10, 1989 +; Changes: Changed 'S' command name to 'SP'. +; Removed wheel protection from 'Q' command and set QQUIET +; on by default. +; Changed command order. + +; Version: 1.0 +; Author: Carson Wilson +; Date: June 15, 1988 + +; This is the configuration file for the ZCPR Version 3.4 resident command +; package. You should read through this file and set the equates according +; to the features you want to implement. Since most systems have a limited +; amount of space for the resident command package, it will probably be +; impossible to include all features. + +; If you are using an SLR or equivalent assembler, you will be prompted +; at assembly time for which commands to include in the RCP. + +;============================================================================= +; +; A S S E M B L Y O P T I O N S +; +;============================================================================= + +; SLR controls whether special pseudo-ops such as ".printx" and ".accept", +; and complex macros are used at assembly time. For SLR Systems or compatible +; macro assemblers, set this equate to true. + +SLR equ true + +; RCPTYPE is the final character of the RCP name in the H(elp) command, +; and determines the order in which commands are added. + + if SLR +Y equ true +N equ false +H equ 'H' +F equ 'F' + +.accept 'Enter "F" for floppy, "H" for fixed disk version: ',rcptype + else +rcptype equ 'F' ; Floppy disk version + endif ; SLR + +; ZRL controls whether named common labels are used in the code. To create +; absolute code, modify RCPBASE.LIB to reflect your system's addresses, set +; ZRL to false and instruct your assembler to generate absolute code (either +; a .COM or .HEX file). +; +; To create a relocatable file for use with Bridger Mitchell's JetLDR or +; Joe Wright's NZCOM, you must use an assembler which recognizes named +; common blocks. If your assembler has this capability, set ZRL to true +; and instruct the assembler to generate relocatable (.REL) code. + +ZRL equ true + +;============================================================================= +; +; M A C R O S +; +;============================================================================= + +; SLR assemblers allow selection of options during assembly. + + if SLR + +select macro option default comment + .accept comment,option ; Prompt user for selection + endm + + .printx + .printx Answer "Y" to include, "N" to exclude commands: + .printx + + else + +select macro option default comment +option equ default ; Use selections from file + endm + endif ; SLR + +;============================================================================= +; +; R E S I D E N T C O M M A N D S S E L E C T I O N +; +;============================================================================= + +; Commands to include in the resident command package + +; There are some interrelations between a number of the possible resident +; commands. Some are so close (LIST and TYPE) that a single equate controls +; both functions. Others like DIR and ERA share code (both display file +; listings). It is efficient to select or deselect them together. + +; If you are using an SLR or compatible assembler, you will be prompted +; at assembly time for command selections. Otherwise, select commands to +; be included by setting each SELECT macro below to yes or no. + +select CLEDON no 'CLED - command line editor shell? ' +select CLSON yes 'CLS - clear screen? ' +select RESON yes 'R - reset disk system? ' +select SPACEON yes 'SP - show space remaining on disk? ' + + if RCPTYPE='F' ; Assemble in floppy order +select DIRON yes 'D - disk directory? ' +select ERAON yes 'ERA - erase files? ' +select ECHOON yes 'ECHO - send text to screen or printer? ' +select RENON yes 'REN - rename files? ' +select CPON yes 'CP - copy file? ' +select LTON yes 'TYPE - display file on console? ' +select POKEON yes 'POKE - set memory? ' +select PEEKON yes 'PEEK - view memory? ' + else ; Assemble in fixed-disk order +select ECHOON yes 'ECHO - send text to screen or printer? ' +select POKEON yes 'POKE - set memory? ' +select PEEKON yes 'PEEK - view memory? ' +select QUIETON yes 'Q - set or clear quiet status? ' +select DIRON yes 'D - disk directory? ' +select ERAON yes 'ERA - erase files? ' +select RENON yes 'REN - rename files? ' +select CPON yes 'CP - copy file? ' +select LTON yes 'TYPE - display file on console? ' + endif ; RCPTYPE='F' + + if LTON +select LISTON no 'LIST - list to printer? ' + else ; allowed only if TYPE is enabled +LISTON equ no + endif + + if RCPTYPE='F' ; Assemble in floppy order +select QUIETON yes 'Q - set or clear quiet status? ' + endif + +select PROTON no 'PROT - set file attributes? ' +select NOTEON no 'NOTE - command-line comment? ' +select REGON no 'REG - set and display user registers? ' +select WHLON no 'WHL - set or clear wheel status? ' +select PORTON no 'PORT - view and set I/O ports? ' + +;============================================================================= +; +; W H E E L P R O T E C T I O N +; +;============================================================================= + +; To prevent unauthorized users from performing certain dangerous or sensitive +; operations on the computer, ZCPR34 provides the capability of disabling the +; operation of certain commands when the wheel byte is off. In ZCPR30, an +; attempt to use one of these wheel-protected commands when the wheel byte was +; off resulted in an error message. In ZCPR34 things work differently. In the +; same situation, the command simply disappears. In this way a transient +; program or extended command processor function can take over and deal with +; the attempt to use the command in a much more flexible way. +; +; Wheel-protected commands in ZCPR30 had extra code to intercept the function +; and disable it. In ZCPR34, wheel protection is enabled and disabled in a +; different way. To wheel-protect a command the high bit of the first +; character in the command name is set. The command table scanner in ZCPR34 +; will not recognize these commands when the wheel byte is off. Since the same +; command scanner is used to scan the commands in the RCP and FCP (flow control +; package), commands there can be wheel protected in the same way. For skilled +; computer operators it is very easy to use a debugger, file patcher, or disk +; utility to enable and disable wheel protection without having to reassemble +; the CPR, RCP, or FCP. +; +; Because of the way the command scanner works, once wheel protection is +; implemented in the CCP, there is no further code penalty in protecting RCP +; commands. Therefore, we recommend protecting all possibly sensitive +; commands or none. + +wcled equ no ; CLED +wcp equ yes ; CP +wdir equ no ; DIR +wera equ yes ; ERA +wlist equ yes ; LIST +wpeek equ yes ; PEEK +wpoke equ yes ; POKE +wport equ yes ; PORT +wprot equ yes ; PROT +wquiet equ no ; QUIET +wreg equ yes ; REG +wren equ yes ; REN +wspop equ yes ; SPOP +wtype equ yes ; TYPE +whrc equ no ; H + +wheel defl wcp or wdir or wera or wlist or wpeek or wpoke or wport +wheel defl wheel or wprot or wreg or wren or wtype or whrc + +;============================================================================= +; +; C O M M A N D O P T I O N S +; +;============================================================================= + +; Options affecting several commands + +; DSORT includes code to sort file entries for the D, TYPE, LIST, ERA, +; and PROT commands. + +dsort equ yes + +; LEFTRIGHT affects the COPY and RENAME commands. If yes, add code to allow +; CP and REN operations work from left to right, and CP to accept a +; single filespec as its source. +; Examples: +; B0>ren b1:old.nam new.nam Renames B1:old.nam to B1:new.nam +; B0>cp a15:that.fil Copies A15:that.fil to B0: +; B0>cp source.fil dest.fil Copies source.fil to dest.fil + +leftright equ yes + +; If LEFTRIGHT is yes, setting TESTEQ to yes also allows CP and REN commands +; to be processed from right to left if they contain an equal sign ("="). +; Costs 11 bytes. +; Example: +; B0>cp dest.fil=source.fil Copies source.fil to dest.fil + +testeq equ yes + +;----------------------------------------------------------------------------- + +; 'CLS' command + +; This command clears the console screen. It can either use a fixed string +; (for shorter code if the same terminal is always used) or use the TCAP +; entry for automatic adaptation to any terminal. + +clstcap equ true ; Use TCAP for clear-screen string + +; If CLSTCAP is not enabled, then the string below must be provided and +; it must end with a character with the high bit set + + if not clstcap +clsstr macro + db 'Z'-'@'+80h ; Control-Z to clear screen + endm + endif ;not clstcap + +typecls equ true ; Clear between screens when typing files + +;----------------------------------------------------------------------------- + +; 'CP' command + +; This command copies a single file. The destination file can have a different +; name from the source file. Set the size of the memory buffer in K below (do +; not change the second definition). The copy buffer is placed at the top of +; the TPA, where it will generally not interfere with subsequent use of the GO +; command to rerun a program loaded in the TPA. + +cpblocks defl 16 ; Size of copy buffer in K + +cpblocks defl cpblocks * 8 ; Convert to number of records + +; If you will be using a BDOS or RSX which supports new functions 102 (Get +; Stamp) and 103 (Set Stamp), set STPCALL to true, and datestamps of files +; will be preserved across copies. The "last access" stamps of both copies +; are set to the time the copy took place if access stamping is enabled. + +stpcall equ true ; Copy file stamps with functions 102/3 + +;----------------------------------------------------------------------------- + +; 'DIR' command + +; This command displays a sorted listing of the files in a directory. The +; file name buffer is allocated at the top of the TPA so as not to modify +; any program loaded in low memory. Consequently, the size of the buffer +; must be set in advance. + + +maxdirs equ 256 ; Maximum number of names in directory buffer + +nosys equ yes ; suppress 'A' and 'S' options if wheel off + +slashchk equ yes ; allow "DIR /S" or "DIR /A" formats (costs + ; about 12 bytes) + +allflag equ 'A' ; Option character for showing + ; all file (both SYS and DIR) +sysflag equ 'S' ; Option character for showing + ; SYS files only +sortnt equ yes ; Sort file by name then type +wide equ yes ; Make display for 80-column screen +fence equ '|' ; Character to use as fence between columns + ; ..if WIDE is false. + +;----------------------------------------------------------------------------- + +; 'ECHO' command + +; This command sends characters to the console or list device. If ECHOLST is +; enabled, then code is included for sending characters to the LST device. +; Characters normally go the the console device and are normally upper or lower +; case depending on the setting of UPCASE. The command line can have special +; command sequences to toggle the case of the output and to change the +; destination between the console and printer. Any other character following +; the command character will be sent as is. For the normal setting of the +; equates below (upcase/yes, cmdchar/%, prtchar/P, crtchar/C, lcasech/>, +; and ucasech/<) an example command line would be: +; A0:ROOT>ECHO T%>HIS IS A TEST^M^J^IDONE%PONE, TWO, %' ; Character after CASECHAR that toggles + ; subsequent output to lower case + +; ---------------------------------------------------------------------------- + +; 'H' command + +; This command displays a list of the resident commands implemented in the +; system. FCP, CPR, and RCP commands can be displayed. The basic command is +; not optional; it is always included. + +listcpr equ yes ; Include list of CPR-resident commands in + ; display (highly recommended) + +listfcp equ yes ; Include list of FCP-resident commands in + ; display (recommended if there is room) + +noshow equ yes ; Suppress listing commands that are wheel- + ; restricted unless wheel byte is set (i.e., + ; don't show commands that won't run) + +cmdsline equ 5 ; Number of commands on each line of display + +cmdspace equ 8 ; Space in display for each command name + +;----------------------------------------------------------------------------- + +; 'LIST' and 'TYPE' commands + +pgdflt equ yes ; Default to paging of console output + +pgdflg equ 'P' ; Character to toggle paging status + +;---------------------------------------- + +; 'PEEK' command + +peekhdr equ yes ; Label columns in PEEK display + +peekbdr equ yes ; Include line of hyphens under labels + +peekchk equ yes ; If yes, the ending address will be tested to + ; prevent overflow past FFFF (costs 5 bytes) + +peeklen equ 127 ; Display 1 record (128 bytes) as default. + ; PEEK displays in increments of 16 bytes. + ; You may set PEEKLEN for 0 to 65525. + +;---------------------------------------- + +; 'S' command + +; Print disk space with other commands (recommended) + +dirsp equ true ; Show space after DIR +erasp equ true ; Show space after ERA +cpsp equ true ; Show space after CP +resetsp equ true ; Show space after R + +;---------------------------------------- + +; 'WHL' command + +whlquiet equ false ; If true, don't report wheel state with + ; .."WHL password" command (costs 1 byte) + +wpass macro + db 'SYSTEM ' + endm + +;---------------------------------------- + +; 'CLED' command +; +; Command line editing takes place in the line buffer. It does not take up +; room in the RCP. The editor will handle a 255 byte line. Although that +; is larger than the maximum command line size, it allows you to edit a long +; line without deleting something first. The history is kept inside the RCP, +; so its size will depend upon how many other RCP commands are enabled. +; HISTSIZE should be at least as large as the multiple command line buffer +; (204 bytes). + +lbufwid equ 255 ; Line buffer size, byte +histsize equ 204 ; History buffer size, word + +; CLERA controls whether to null the internal history when CLED is exited, or +; to leave it for the next run. Secure systems will want to set it to YES. + +clera equ no ; Erase history on terminating shell + +; CLMIN sets the cutoff for discarding short lines from history recording. +; A setting of 3 would discard a command such as DIR. + +clmin equ 5 ; Discard lines which do not exceed this + +clins equ yes ; Initial insert state ON +clsav equ yes ; Initial history recording ON + +; The appearance of the command line prompt may include the system time if a +; DateStamper or ZS/ZDDOS clock is implemented. The DU:DIR separator character +; can be changed to indicate that CLED is running. + +dudir_sep equ '/' ; DU:DIR separator char +puser0 equ no ; Print user #0 in prompt +systime equ yes ; Include system time in prompt + + if systime +civtim equ yes ; Yes for 12-hr civil time vs. 24-hr military +timesep equ '.' ; Separator between hours and minutes + endif + +; The editor must use EREOL. The VLIB routine to send the EREOL sequence +; to the terminal needs to test for a video delay and the presence of the "/" +; quote character. Most terminals can just print the TCAP sequence as is. If +; that doesn't work, set ERLQUICK to NO. If you are using only one terminal, +; it will be most efficient to set ERLTCAP to NO and use the CLR_EOL macro. + +erltcap equ yes ; Use TCAP routine vs macro + + if erltcap +erlquick equ yes ; Use simplified TCAP routine + else + +clr_eol macro ; Define terminal specific string + dc 1bh,'T' ; ...set high bit on last character + endm + + endif ;erltcap + +;----------------------------------------------------------------------------- + +; Command names + +; The CTABLE macro, which constructs the command dispatch table, includes a +; line for each command, the first parameter of which is the name of the +; command. These names may be changed if you wish. But make sure that you +; do not use a name that is longer than the maximum allowed length. If you +; do, the name will be truncated and a nonfatal error will occur during +; assembly. DO NOT CHANGE ANY PARAMETER OTHER THAN THE COMMAND NAME. Lower +; case letters will be converted to upper case. The macro COMMAND is defined +; in Z34MAC.LIB. + +cmdsize equ 4 ; Length of each command name + +cmdtbl macro + command CLED, cledon, wcled, cled + command CLS, clson, false, cls + command CP, cpon, wcp, copy + command D, diron, wdir, dir + command ECHO, echoon, false, echo + command ERA, eraon, wera, era + command H, true, whrc, clist + command LIST, liston, wlist, list + command NOTE, noteon, false, note + command P, peekon, wpeek, peek + command POKE, pokeon, wpoke, poke + command PORT, porton, wport, port + command PROT, proton, wprot, att + command Q, quieton,wquiet, quset + command R, reson, false, reset + command REG, regon, wreg, register + command REN, renon, wren, ren + command SP, spaceon,false, space + command SPOP, cledon, wspop, shpop + command TYPE, lton, wtype, type + command WHL, whlon, false, whl + endm + +; END Z34RCP.LIB + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.doc b/Source/BPBIOS/Z34RCP11/z34rcp11.doc new file mode 100644 index 00000000..92195c5d --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/z34rcp11.doc @@ -0,0 +1,429 @@ + + ZCPR Version 3.4 Resident Command Package + Source Code + + Revised Documentation for Version 1.1 + October 7, 1989 by Carson Wilson + + Version 1.0 Documentation + June 17, 1988 by Carson Wilson + + + Contents + -------- + + 1. Files in this Library. + + 2. Purpose of the Resident Command Package. + + 2.1. "Resident" vs. "Transient" Commands. + + 2.2. The Z-System Resident Command Package. + + 2.2.1. Design Philosophy of the Z34 RCP. + + 3. Structure and Operation of the RCP Segment. + + 4. Generating an RCP for your System. + + 4.1. The Z-Relocatable Approach. + + 4.1.1. NZCOM and JetLDR. + 4.1.2. Z-Relocatable (ZRL) Code + + 4.2. The Assembly Approach. + + 4.2.1. Note on Assemblers. + 4.2.2. Assembly to Absolute Code. + 4.2.3. Assembly to Z-Relocatable Code. + 4.2.4. Adding Custom Commands to Z34RCP. + + 5. Legal Use of These Files. + + + +1. Files in this Library. + +This library of files contains the assembler source code and +accompanying documentation for the Z-System Resident Command +Package (RCP). To use Z34RCP you must be running ZCPR versions +3.3 or above. For pre-assembled Z-Relocatable (ZRL) RCPs, see +RCPZRL11.LBR. Z34RCP11.LBR consists of the following files +(uncompress with UNCR.COM, QL.COM or LBRE.COM): + +CLEDINST.CZM - Installer for CLED command. +CLEDSAVE.CZM - Command file utility for CLED. +RCPCLED .DZC - Documentation on CLED. +RCPBASE .LZB - Used to assemble an absolute address RCP. +RCPCMD .LZB - Used to include custom commands in the RCP. +RCP?????.LZB - Code modules for the standard RCP commands. +SYSDEF .LZB - Commonly used equates. +Z34CMN .LZB - Used to assemble Z-Relocatable RCP's. +Z34DEFN .LZB - Offsets in the ZCPR 3.4 code. +Z34MAC .LZB - Assembler macros. +Z34RCP11.DZC - This file. +Z34RCP11.FOR - Short description of the library. +Z34RCP11.HZP - Help file for the RCP, gives command syntax and + examples. +Z34RCP .LZB - Used to select features when assembling the RCP. +Z34RCP11.NZW - Changes since Z34RCP10.LBR. Intended for former + RCP users, this will be only of passing interest + to new users. +Z34RCP11.ZZ0 - Main file for assembling the RCP. +ZSYSTEM .AZ - General information about Z System. + + +2. Purpose of the Resident Command Package. + + 2.1. "Resident" vs. "Transient" Commands. + +Most of the commands used under CP/M and Z-System are "transient" +commands. The machine code for these commands (or "programs") is +stored in "command files," whose file type is normally .COM. +Thus, the machine code for WordStar is stored in a file called +"WS.COM". + +To run WordStar, the user issues the command "WS" at the command +line, the operating system loads WS.COM from the disk drive to +memory, and WS.COM takes over control of the computer. If the +user then exits WordStar and issues another command, the +operating system can load another command file from the disk, +reusing the area of memory previously occupied by WordStar. + +Recycling memory in this way makes personal computers quite +versatile, as the number of commands available to the user is +only limited to the number of command files stored on disk. +There are some drawbacks to this approach, however. Although +disk-based commands conserve memory by recycling it, they must be +loaded from disk each time they operate. This creates its own +costs in terms of speed of execution, disk storage space, and +memory reallocation. + +The most obvious disadvantage of loading a file from disk each +time a command is issued is that it takes time to find and load +disk files. Especially with floppy diskettes, the amount of time +which elapses after the command is issued and before the command +executes is significant. A second drawback to disk-based +commands is that commands will not execute unless their machine +code is available on the disk system. This means that the user +must know what command files are available on disk before issuing +commands. The final disadvantage of disk file based commands is +that some commands (e.g., SAVE) require that the area of memory +normally overwritten by command files (known as the "Transient +Program Area" or TPA) be preserved. + +In answer to these difficulties, the creators of CP/M designed +some of its commands as "built-in" commands. The DIR, REN, SAVE, +ERA, USER, and TYPE commands of CP/M 2.2 remain in memory and can +be issued without loading machine code files from disk. Thus, +the DIR command provides a disk directory regardless of whether +the command file "DIR.COM" is present on disk, and the SAVE +command saves the contents of memory at 100 hex to a disk file. +Residing permanently in memory, these commands are simple in +order to leave memory for disk-based commands to load in. + + 2.2. The Z-System Resident Command Package. + +The creators of Z-System have followed the resident command +philosophy of CP/M, extending and enhancing the capabilities of +resident commands with the Z-System Resident Command Package. +Under CP/M 2.2, resident commands are tightly integrated with the +operating system. The user is therefore limited to a fixed set +of resident commands. The code in the Z-System Resident Command +Package is much more loosely linked with the operating system. + +The RCP occupies a section of protected memory, but how that +memory is used is only very loosely constrained. The Z-System +resident command package may be tailored for a wide variety of +installations, and easily altered within a single installation. + + 2.2.1. Design Philosophy of the Z34 RCP. + +Though any set of commands which will fit in the RCP memory area +can be loaded as an RCP, a standard set of Z-System RCP commands +have evolved over the years. Distributed as the standard +Z-System RCP, this set of commands consists of universal, +single-purpose commands modeled after the resident command set of +CP/M 2.2, such as DIR, REN, and ERA. + +Keeping these commands simple both conserves memory and allows +their use in custom command scripts. None of the standard RCP +commands require interaction on the part of the user--they +perform a single function and quit. Aliases or other command +scripts which build complex commands from simple RCP commands +therefore retain complete control over the user interface. + +However, the standard RCP forms only one of many alternative uses +to which the Z-System RCP memory segment may be put. Since the +RCP memory is protected, it can be used by background programs +which continue to function even while other applications have +been loaded into the transient program area. Several such +programs, including key-redefiners, screen-trapping programs, +background numeric calculators, program assembly environments, +and memory utilities have been developed. + +Until Z34RCP, all but the most advanced users had to surrender +their entire RCP to use the custom commands, even if the commands +needed far less than the available RCP space. Thus, to use a +key-redefinition RCP, one was forced to give up all of his other +RCP commands. Z34RCP solves this problem by acting as a base to +which programmers may easily add code. By modifying the standard +file RCPCMD.LIB, programmers can implement and distribute custom +RCP commands which may be installed by those with only basic +knowledge of assembly language. See "Adding Custom Commands," +below, for details. + + +3. Structure and Operation of the RCP Segment. + +Typically, the Resident Command Package occupies 2 kilobytes of +memory, protected above the system's Basic Input Output System +(BIOS). Its internal structure is very simple, consisting of the +five byte string "Z3RCP", a table of command names and their +addresses within the RCP, and the machine code of the commands +themselves. This means that an RCP of a given length can contain +any number of resident commands which will fit in 2k, from one +large program to many shorter programs. + +Further, since the RCP is independent of the rest of the +operating system, the resident commands may be changed at will. +On system startup, a default RCP is loaded into memory. +Thereafter the RCP's commands remain active until the system is +turned off or another RCP is loaded. + +Using loader programs to load the RCP to memory allows another +important ability--it can exchange RCPs during a single session. +By allowing users to change their RCPs "on-the-fly," loader +programs provide some of the benefits of transient commands even +while preserving the benefits of resident commands. In fact, +even what portion of memory is allocated to the RCP can be +altered in this way by advanced users! (see the Z-System User's +Manual for more on this). + + +4. Generating an RCP for your System. + +Since Z80 computers come with a wide variety of operating system +environments, it is impossible for a single segment of machine +code function as a universal RCP. Due to differences in +operating system and hardware design, the size and location of +memory available to the Z-System RCP vary widely. Until +Z34RCP, this meant that each type of Z80 computer required an RCP +segment assembled specifically for that computer. + +Now, however, there are two basic means by which you may generate +an RCP for your system. The simplest route is to load already- +assembled Z-Relocatable code modules. This technique is +recommended for beginners and those with little experience in +assembly language. See RCPZRL11.LBR for pre-assembled RCP +modules. For more experienced users with an interest in +customizing or their RCPs or adding their own commands, custom +assembly of the files in this library is also an option. + + 4.1. The Z-Relocatable Approach. + + 4.1.1. NZCOM and JetLDR. + +LDR.COM, the familiar Z-System segment loader first introduced by +Rick Conn as a means of loading the various segments of the ZCPR +environment from disk to memory, required that system segments be +assembled to run only at system-specific addresses. For example, +if the system's RCP started at FA00 hex, only an RCP assembled to +run at that starting address would function on the system. +Therefore, separate SYS.RCP files were needed for each computer +installation. + +Thanks to several advanced loader utilities, namely NZCOM by Joe +Wright and JetLDR and Z3PLUS by Bridger Mitchell, custom- +assembling an RCP for a given target machine is no longer +necessary. These three programs can load specially assembled RCP +segments (known as Z-ReLocatable or "ZRL" segments) to any area +of memory. Z-System users now need only obtain previously +assembled RCP segments, much as they need only obtain assembled +.COM or .OBJ files to run transient programs. + +Using information in the system's environmental descriptor, +advanced loaders load pre-assembled segments to the proper +addresses in any system. The only remaining constraint is the +amount of memory allocated to the RCP. While the standard RCP +size is 2 kilobytes, many Z-System installations vary +considerably from this standard, so it is still necessary to +ensure that a ZRL segment does not exceed available RCP memory. +Fortunately, this is taken care of automatically by the advanced +loader programs. + +Using NZCOM or JetLDR, it is possible to load an RCP directly +from RCPZRL11.LBR. See NZCOM or JetLDR documentation for full +instructions on how to load Z-Relocatable RCPs with these +programs. + + 4.1.2. Z-Relocatable (ZRL) Code + +The technique used by NZCOM and JetLDR to load a single RCP to +any address in memory involves relocatable code. Relocatable +code has been used for years by the "linker" programs available +to assembly language programmers. Since only portions of a given +Z80 machine code routine are specific to one memory address, it +is possible to create "relocatable" files of Z80 routines (known +by their file type .REL) containing all but the address-specific +codes. These files can then be very quickly relocated (or +"linked") by a linker program to operate at any memory address. + +Z-Relocatable code is simply a more sophisticated form of +relocatable code. ZRL files contain separately labeled segments, +known as "named common blocks." Where normal relocatable code is +all linked to operate at one address at a time by the linker +program, named common blocks allow the linker to distinguish +between different sections of the file and to link each "block" +to operate at a different address. + +This represents a major step forwards in user convenience, and +will certainly lead to more innovative work using the ZCPR system +segments. There is a minor drawback, however, inherent in the +form of assembly required by NZCOM and JetLDR. Before the advent +of these two programs, system segments were equivalent to .COM +files which were assembled to operate at addresses other than the +standard 100 hex. The ability to load a single system segment to +any address depends partially on the form of the assembled system +segment itself. + +While public domain assemblers will produce absolute object +files, more sophisticated assemblers, such as SLR's Z80ASM (a +bargain at $50) are required to assemble code with named common +addresses. NZCOM and JetLDR thus greatly reduce the time needed +by most users to install Z-System segments, but those wishing to +assemble Z-Relocatable segments will probably need a commercial +assembler. + + 4.2. The Assembly Approach. + +Those with knowledge of assembly language may opt to assemble +their own custom RCPs, including only the commands and options +which match their exact requirements. Z34RCP.LBR contains the +complete source to the ZCPR 3.4 RCP. The file Z34RCP.Z80 +contains include statements to combine the various library files +during assembly. The file Z34RCP.LIB contains all of the equates +controlling assembly time options, and should be edited before +assembling Z34RCP.Z80. + + 4.2.1. Note on Assemblers. + +The development work on Z34RCP was done exclusively with the SLR +Systems line of Z80 assemblers. Hence, some of the source code +is unavoidably specific to SLR and compatible assemblers. Those +using incompatible assemblers such as public-domain Z80 +assemblers should set the SLR equate in Z34RCP.LIB to FALSE. +This removes most SLR-specific pseudo-ops, but some additional +editing of the source files may be required for error-free +assembly. Unless your assembler can handle named common blocks, +you will also want to set the ZRL equate in Z34RCP.LIB to FALSE. + + 4.2.2. Assembly to Absolute Code. + +If you are assembling a custom RCP for use at one memory address +only, or if your assembler can't handle named common blocks, you +can set the ZRL equate in Z34RCP.LIB to FALSE, and instruct your +assembler to produce absolute code (either a .HEX or a .COM file). + +Before generating absolute code you must set addresses in the +file RCPBASE.LIB for the particular installation. Once you have +set these addresses, you may proceed to assemble Z34RCP.Z80 to +either Z34RCP.COM or Z34RCP.HEX. If your assembler generated a +.HEX file, use LOAD.COM to convert Z34RCP.HEX to Z34RCP.COM. + +If you are running a version of ZCPR prior to 3.4, you must now +alter two bytes in your Z-System environment segment to point to +your system's CCP address. The bytes at offset 39 and 40 hex +(formerly containing "width of printer 2" and "lines on printer +2") should contain a 2-byte address of your system's CCP, most +significant byte last. + +Z34RCP.COM may now be renamed to SYS.RCP and loaded with the Z- +System loader program LDR.COM or Bridger Mitchell's JetLDR. + + 4.2.3. Assembly to Z-Relocatable Code. + +Unlike absolute RCP segments, Z-Relocatable segments may be +loaded to ANY address, provided enough RCP space to contain them +is available. To assemble a Z-Relocatable RCP, you will need an +assembler which can handle named common blocks (see 4.2.1 above). +Set the ZRL equate in Z34RCP.LIB to TRUE, and instruct your +assembler to produce a relocatable (.REL) file. The resulting +Z34RCP.REL may then be renamed to Z34RCP.ZRL and loaded with +NZCOM, Z3PLUS, JetLDR. + + 4.2.4. Adding Custom Commands to Z34RCP. + +As mentioned above, I have designed Z34RCP as a base to which +custom RCP commands may readily be added. All code and command +names for custom commands may be included in RCPCMD.LIB. +Thereafter, whenever the RCP is assembled the commands added to +RCPCMD.LIB will be included automatically. To remove the custom +commands, just replace the modified RCPCMD.LIB with an unmodified +copy. See RCPCMD.LIB for detailed instructions on how to add +code and command names. + +RCPCMD.LIB also facilitates distribution of custom commands to be +included by others in their RCPs. Simply distribute a copy of +your modified RCPCMD.LIB along with instructions on how to use +your custom commands. Users may then easily include the new +commands by substituting your modified RCPCMD.LIB for their +original copy and reassembling their RCPs. + +Of course, users of NZCOM, Z3PLUS, or JetLDR may simply trade +custom RCPs in Z-Relocatable form and dispense with the need for +any assembly work on the part of the user. All three of these +advanced loaders are available from Z Systems Associates (see +below). + + +5. Legal Use of These Files. + +Z34RCP is copyright 1989 by Z Systems Associates (ZSA), all +rights reserved. Any commercial use of Z34RCP, defined as any +situation where the duplicator recieves revenue by duplicating or +distributing Z34RCP by itself or in conjunction with any hardware +or software product, is expressly prohibited unless authorized in +writing by ZSA. + +Except for the file RCPCMD.LIB (see 4.2.4 above), you may +redistribute Z34RCP.LBR in its present form only. I encourage +you to explore the source code, suggest improvements, and +document errors. However, please obtain permission from Z +Systems Associates before redistributing any of these files in +altered form. This will prevent confusion by allowing your work +to be coordinated with the efforts of others. + +The Z Systems Associates are: + + Sage Microsystems East + Selling & Supporting the Best in 8-Bit Software + 1435 Centre St., Newton Centre, MA 02159-2469 + Voice: 617/965-3552 (9:00am - 11:30pm) + Modem: 617/965-7259 (password = DDT)(MABOS on PC-Pursuit) + +and: + + Plu*Perfect Systems + "==World-Class Software" + 410 23rd Street, Santa Monica, CA 90402 + Voice: 213/393-6105 (evenings) + Modem: 213/670-9465 (leave message for "Bridger Mitchell") + +For more information on Z System, check at the above bulletin +board systems, or consult The Computer Journal for excellent +articles on ZCPR and CP/M. The Computer Journal is published six +times a year by Publishing Consultants, 190 Sullivan Crossroad, +Columbia Falls, MT 59912, phone 406/257-9119. An issue averages +forty pages with few ads. Subscription rates are $16 for one +year (6 issues), or $28 for two years (12 issues) in the U.S., +$22 for one year Canada and Mexico, and $24 (surface) for one +year in other countries. + + +Carson Wilson is the operator of: + + Antelope Freeway Remote Access System + Chicago, 312-764-5162 + 300-1200-2400 Baud, 24 Hours + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.for b/Source/BPBIOS/Z34RCP11/z34rcp11.for new file mode 100644 index 00000000..c60e1910 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/z34rcp11.for @@ -0,0 +1,7 @@ +Z-System Resident Command Package (RCP) in source code form, version +1.1. Complete Z80 source code to the RCP plus documentation, for +ZCPR versions 3.3 and above. Adds several exciting new commands and +features and fixes various bugs in the previous release. See +companion file RCPZRL11.LBR for pre-compiled RCP modules which may +be loaded with NZ-COM, Z3PLUS, or JetLDR. + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.hlp b/Source/BPBIOS/Z34RCP11/z34rcp11.hlp new file mode 100644 index 00000000..991d5d71 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/z34rcp11.hlp @@ -0,0 +1,390 @@ + The RCP Commands + CLED/SPOP Command Line Editor  + CLS Clear the CRT screen  + CP Copy a File  + D Display Directory  + ECHO Echo Command Tail  + ERA Erase Files  + H Display Available Commands  + LIST/TYPE Display a File on Printer/CRT + NOTE Comment  + P/POKE Display/Alter Memory  + PORT Input/Output to system ports  + PROT Protect Files  + Q Alter or Query the Quiet Flag + R Reset Disk  + REG ZCPR3 Register Display/Alter  + REN Rename a File  + SP Display Disk Space Remaining  + WHL Alter or Query Wheel Byte  +:Thå RCÐ Commands + + + Thå   standarä ZCPR³ Systeí Residenô Commanä  Packagå  (RCP© +distributeä  witè thå ZCPR³ systeí containó á numbeò oæ  residenô +commandó  whicè  maù bå enableä (dependinç oî systeí  memorù  anä +securitù  characteristics©  aô thå discretioî oæ  thå  installer® +Usagå oæ thå RCÐ commandó ió describeä iî thió HELÐ file. + + Thå  RCÐ commandó residå iî memorù ratheò thaî beinç  loadeä +froí  disk¬ anä thereforå operatå verù efficientlù anä arå  disë­ +independent®   Oî thå otheò hand¬ duå tï memorù constraints¬  thå +RCÐ commandó arå ofteî lesó powerfuì thaî theiò transienô prograí +counterparts® + + + + Iæ aî erroò occurs¬ thå RCÐ commandó generallù chaiî tï  thå +installeä erroò handler¬ providinç á detaileä reporô oæ thå erroò +anä  allowinç thå commanä tï bå editeä oò aborted® Iæ  nï  erroò +handleò  ió  installed¬  thå commanä whicè causeä  thå  erroò  ió +echoeä tï thå screen¬ followeä bù á questioî mark. + + Alì RCÐ commandó arå installatioî-dependent¬ anä manù maù bå +configureä  aô  assemblù timå tï perforí  iî  slightlù  differenô +ways®   Thå  exampleó giveî iî thió HELÐ filå arå  baseä  oî  thå +distributeä seô oæ options® Seå sourcå codå filå Z34RCP.LIÂ  foò +morå detailó oî commanä anä optioî selection. + +:CLED anä SPOÐ Commands + Transient Counterparts: LSÈ anä SPOP + + Thå  CLEÄ commanä invokeó á speciaì prograí  whicè  provideó +WordStaò-likå editinç oæ commandó aô thå systeí prompt® Iô  alsï +allowó yoõ tï recalì thå lasô severaì commandó invokeä witè  onlù +onå keystroke® Finally¬ iæ available¬ CLEÄ displayó thå  currenô +systeí timå tï thå lefô oæ youò prompt® Thå syntaø is: + + CLED - invoke as shell + CLED / - invoke for next command only + + + + Thå SPOÐ commanä "pops¢ thå toð shelì froí thå shelì  stack¬ +sï thaô iô nï longeò loadó afteò everù command® Thió commanä  ió +rarelù  needed¬  anä ió includeä onlù witè versionó  oæ  thå  RCÐ +includinç CLEÄ (seå above)® Thå syntaø ió simply: + + SPOP +:CLS Command + Transient Counterpart: None + + Thå  CLÓ  commanä  clearó  thå  terminaì  screen¬   removinç +displayó  whicè  mighô  havå beeî lefô bù  previouó  commandó  oò +programs® Thå syntaø is: + + CLS + +:CP Command + Transient Counterpart: MCOPY + + Thå  CÐ  commanä copieó onå filå froí onå DÕ tï  anotheò  oò +intï  thå samå DÕ undeò á differenô name® Iæ functionó 10²  (geô +stamp©  anä 10³ (seô stamp© arå supporteä bù aî RSØ oò DOS¬  filå +datestampó arå preserveä acrosó copies® Thå syntaø is: + + CP dir:ufn1 dir:ufn2 -- ufn1 to ufn2 + CP dir:ufn1 -- ufn1 to current dir: + CP dir:ufn2=dir:ufn1 -- ufn1 to ufn2 + + Examples: + + CP f1.txt f2.txt + CP b0:f1.txt a15: + CP root:f1.txt + +:D Command + Transient Counterpart: DIR, XD, XDIR + + Thå   Ä   commanä  displayó  thå  directorù  oæ   fileó   iî +alphabeticaì ordeò acrosó thå lineó tï thå user® Thå syntaø is: + + D dir:afn.aft o + D .aft o + D /o + + Options (wheel only) are: + + S - Display System Files Only + A - Display Both Non-System and System Files + + Examples: + + D /a + D root:myfile.txt Š D .com + +:ECHO Command + Transient Counterpart: ECHO + + ECHÏ   ió usefuì iî issuinç botè messageó (tï thå  user¬ +saù withiî á commanä filå durinç execution© anä escapå sequences® +Bù  uså oæ thå %¾ anä %¼ parameters¬ ECHÏ caî senä itó outpuô  iî +combinationó  oæ uppeò anä loweò case® Bù uså oæ thå %Ð  anä  %Ã +parameters¬  ECHÏ  outpuô  caî  bå  toggleä  betweeî  screeî  anä +printer®   ECHÏ  useó  BIOÓ  calls¬  sï  alì  controì  characteró +(entereä aó ^character© arå passeä exactly® Hence¬ consolå-leveì +programminç oæ sucè deviceó (CRTó anä printers© ió possible. + + Examples: + ECHO %Pthis is a test%Cof echo%P + -- "THIS IS A TEST" goes to the printer + "OF ECHO" goes to the console + (trailing %P flushes printer buffer) + + ECHO t%>his is a % + prtdec ,%recs,,%bytes, + prtdec ; Trailing CRLF + endm + + else ; Non-SLR assemblers +include macro filename + $include filename&.lib + endm + endif ; SLR + + + if ZRL + +; ============================================================================= + +; J e t L D R I D S E C T I O N + +; ============================================================================= + +; Macro to build ID block message for JetLDR. Max. length is ~256 chars. + +optcnt defl 0 ; Options counter + +option macro string1,enable1,string2,enable2 + + if enable1 ;; Skip if command not present + if [optcnt mod 4] eq 0 + db cr,lf ;; New line every four options + endif + optcnt defl optcnt + 1 ;; Increment options counter + count defl 0 ;; Initialize character count + + irpc char,string1 ;; Count and define characters + count defl count + 1 + db '&char' + endm ; irpc + + if not nul enable2 ;; Sub-option label present + if enable2 ;; Sub-option enabled + db ' (' ;; Begin sub-opt description + irpc char,string2 ;; Count and define characters + count defl count + 1 + db '&char' + endm ; irpc + db ')' ;; End sub-opt description + count defl count + 3 ;; For ' ()' + endif ; enable2 + endif ; not nul enable2 + + if [optcnt mod 4] ne 0 + count defl 11 - count + rept count + db ' ' ;; Pad to 11 spaces + endm ; rept + endif ; [optcnt mod 4] ne 0 + + endif ; enable1 + endm ; option macro + +; --------------------------------------------------------- + + COM /_ID_/ ; JetLDR ID block + db 'Copr. 1989 ZSA. Enabled Commands:' + option Cled,cledon + option Cls,clson,TC,clstcap + option Cp,cpon,stp,stpcall + option Dir,diron,sp, + option Echo,echoon,lst,echolst + option Era,eraon,sp, + option Help,true + option List,liston + option Note,noteon + option Peek,peekon,hdr,peekhdr + ; option Poke,pokeon,q,pokeq + option Poke,pokeon + option Port,porton + option Protect,proton + option Quiet,quieton + option Register,regon + option Rename,renon + option Reset,reson,sp, + option Space,spaceon + option Spop,cledon + option Type,lton,cls, + option Wheel,whlon,q,whlquiet + db 0 ; ID string terminator + +;============================================================================= +; +; E N T R Y C O D E S E C T I O N +; +;============================================================================= + + cseg + else + org z3rcp + endif ; ZRL + +RCPbegin: + db 'Z3RCP' ; Package ID + + include RCPcmd ; Command table and custom commands + + include RCPsubs ; File of subroutines + + include RCPh ; 'H' help (command list) command + +; Include only selected code sections. + + if cledon ; 'CLED' and 'SPOP' commands + include RCPcled + endif ;cledon + + if clson + include RCPcls ; 'CLS' clear screen command + endif ;clson + + if reson + include RCPr ; 'R' disk reset command + endif ;reson + + if spaceon + include RCPsp ; 'SP' space on disk command + endif ;spaceon + + if diron + include RCPdir ; 'DIR' directory command + endif ;diron + + if eraon + include RCPera ; 'ERA' erase command + endif ;eraon + + if renon + include RCPren ; 'REN' rename command + endif ;renon + + if cpon + include RCPcp ; 'CP' file copying command + endif ;cpon + + if echoon + include RCPecho ; 'ECHO' command + endif ;echoon + + if quieton + include RCPquiet ; 'Q' quiet flag + endif ;quieton + + if lton + include RCPlt ; 'LIST' and 'TYPE' commands + endif ;lton + + if proton + include RCPprot ; 'PROT' file attribute setting command + endif ;proton + + if peekon or pokeon or porton + include RCPiom ; 'PEEK', 'POKE', 'PORT' commands + endif ;peekon or pokeon or porton + + if regon + include RCPreg ; 'REG' register operation commands + endif ;regon + + if whlon + include RCPwhl ; 'WHL' command + endif ;whlon + + include RCPid ; Add ID string (must come last) + +RCPend: ; Used to calculate length + end + +; End of Z34RCP.Z80 + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.z80.sav b/Source/BPBIOS/Z34RCP11/z34rcp11.z80.sav new file mode 100644 index 00000000..7af6b875 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/z34rcp11.z80.sav @@ -0,0 +1,267 @@ + +; Program: Z34RCP +; Description: Resident Command Package (RCP) for ZCPR34 +; Version: 1.3 +; Author: Carson Wilson +; Date: September 13, 1989 +; Changes: Added CLED (command line editor shell) command. +; To save space, JetLDR ID section no longer pads end of each +; line. (JetLDR allows only 256 bytes maximum in its +; description field). + +; Version: 1.2 +; Author: Carson Wilson +; Date: July 9, 1989 +; Changes: Uses spaces instead of tabs in JetLDR displays. +; Copyright now ZSA. + +; Version: 1.1 +; Author: Carson Wilson +; Date: September 14, 1988 +; Changes: RCPID macro called from RCPID.LIB so that the final INCLUDE +; macro call gives total size of the RCP, including the ID +; string, with SLR assemblers. +; Label WHLQ changed to WHLQUIET in Option macro to match +; Z34HDR.LIB equate. + +; Version: 1.0 +; Author: Carson Wilson +; Date: June 15, 1988 + +; Derivation: SYSRCP (Richard Conn) + +; Z34RCP is copyright 1989 by Z Systems Associates. All rights reserved. +; End-user distribution and duplication permitted for non-commercial purposes +; only. Any commercial use of Z34RCP, defined as any situation where the +; duplicator recieves revenue by duplicating or distributing Z34RCP by itself +; or in conjunction with any hardware or software product, is expressly +; prohibited unless authorized in writing by Z Systems Associates. + +;============================================================================= +; +; D E F I N I T I O N S S E C T I O N +; +;============================================================================= + + maclib sysdef.lib ; Common logic, sys, ascii defines + maclib z34defn.lib ; Defines offsets in Z34 command processor + maclib z34mac.lib ; Macros + maclib z34rcp.lib ; Defines command options + + if ZRL + maclib z34cmn.lib ; Defines universal ZCPR named common blocks + else + maclib rcpbase.lib ; Defines addresses for one system + endif + + name RCP11 ; Declare module name + +; ============================================================================ + +; M A C R O S S E C T I O N + +; ============================================================================ + +; Macros to include module file and print module length. +; Under SLR and compatible assemblers, a running account of current RCP +; size and bytes added will be given for each module. +; +; For other assemblers you may have to either modify the non-SLR include +; macro or use a text editor to read in the actual contents of each file +; in place of the include statement. + + if SLR +; +; General purpose macro to display decimal values and messages +; +prtdec macro m1,m2,m3,m4,m5 + .radix 10 ; Decimal output + .printx m1 m2 m3 m4 m5 ; Print to screen + endm +; +; Macro to include modules and display lengths. +; +include macro filename +before defl $ + $include filename&.lib +after defl $ +modlen defl after - before ; Module length +rcplen defl after - RCPbegin ; RCP length +recs defl rcplen / 128 ; ..in records +bytes defl rcplen mod 128 ; ..and additional bytes + prtdec %modlen, + prtdec ,%recs,,%bytes, + prtdec ; Trailing CRLF + endm + + else ; Non-SLR assemblers +include macro filename + $include filename&.lib + endm + endif ; SLR + + + if ZRL + +; ============================================================================= + +; J e t L D R I D S E C T I O N + +; ============================================================================= + +; Macro to build ID block message for JetLDR. Max. length is ~256 chars. + +optcnt defl 0 ; Options counter + +option macro string1,enable1,string2,enable2 + + if enable1 ;; Skip if command not present + if [optcnt mod 4] eq 0 + db cr,lf ;; New line every four options + endif + optcnt defl optcnt + 1 ;; Increment options counter + count defl 0 ;; Initialize character count + + irpc char,string1 ;; Count and define characters + count defl count + 1 + db '&char' + endm ; irpc + + if not nul enable2 ;; Sub-option label present + if enable2 ;; Sub-option enabled + db ' (' ;; Begin sub-opt description + irpc char,string2 ;; Count and define characters + count defl count + 1 + db '&char' + endm ; irpc + db ')' ;; End sub-opt description + count defl count + 3 ;; For ' ()' + endif ; enable2 + endif ; not nul enable2 + + if [optcnt mod 4] ne 0 + count defl 11 - count + rept count + db ' ' ;; Pad to 11 spaces + endm ; rept + endif ; [optcnt mod 4] ne 0 + + endif ; enable1 + endm ; option macro + +; --------------------------------------------------------- + + COM /_ID_/ ; JetLDR ID block + db 'Copr. 1989 ZSA. Enabled Commands:' + option Cled,cledon + option Cls,clson,TC,clstcap + option Cp,cpon,stp,stpcall + option Dir,diron,sp, + option Echo,echoon,lst,echolst + option Era,eraon,sp, + option Help,true + option List,liston + option Note,noteon + option Peek,peekon,hdr,peekhdr + option Poke,pokeon,q,pokeq + option Port,porton + option Protect,proton + option Quiet,quieton + option Register,regon + option Rename,renon + option Reset,reson,sp, + option Space,spaceon + option Spop,cledon + option Type,lton,cls, + option Wheel,whlon,q,whlquiet + db 0 ; ID string terminator + +;============================================================================= +; +; E N T R Y C O D E S E C T I O N +; +;============================================================================= + + cseg + else + org z3rcp + endif ; ZRL + +RCPbegin: + db 'Z3RCP' ; Package ID + + include RCPcmd ; Command table and custom commands + + include RCPsubs ; File of subroutines + + include RCPh ; 'H' help (command list) command + +; Include only selected code sections. + + if cledon ; 'CLED' and 'SPOP' commands + include RCPcled + endif ;cledon + + if clson + include RCPcls ; 'CLS' clear screen command + endif ;clson + + if reson + include RCPr ; 'R' disk reset command + endif ;reson + + if spaceon + include RCPsp ; 'SP' space on disk command + endif ;spaceon + + if diron + include RCPdir ; 'DIR' directory command + endif ;diron + + if eraon + include RCPera ; 'ERA' erase command + endif ;eraon + + if renon + include RCPren ; 'REN' rename command + endif ;renon + + if cpon + include RCPcp ; 'CP' file copying command + endif ;cpon + + if echoon + include RCPecho ; 'ECHO' command + endif ;echoon + + if quieton + include RCPquiet ; 'Q' quiet flag + endif ;quieton + + if lton + include RCPlt ; 'LIST' and 'TYPE' commands + endif ;lton + + if proton + include RCPprot ; 'PROT' file attribute setting command + endif ;proton + + if peekon or pokeon or porton + include RCPiom ; 'PEEK', 'POKE', 'PORT' commands + endif ;peekon or pokeon or porton + + if regon + include RCPreg ; 'REG' register operation commands + endif ;regon + + if whlon + include RCPwhl ; 'WHL' command + endif ;whlon + + include RCPid ; Add ID string (must come last) + +RCPend: ; Used to calculate length + end + +; End of Z34RCP.Z80 + \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/zsystem.ad b/Source/BPBIOS/Z34RCP11/zsystem.ad new file mode 100644 index 00000000..5231a575 --- /dev/null +++ b/Source/BPBIOS/Z34RCP11/zsystem.ad @@ -0,0 +1,97 @@ + + Z System Upgrades CP/M + +Z System is first-rate, state-of-the-art software for your CP/M machine. +ZCPR has been with us for over five years now, and has enhanced computer +productivity for thousands of CP/M users. Z System is now a mature +replacement for CP/M 2.2 or CP/M Plus, yet is "backward compatible" with +almost all programs written for CP/M. This means that you can still run +the CP/M programs you now use, yet take advantage of greatly increased +power and performance at the same time. + +NZ-COM and Z3PLUS form the heart of Z System. They replace the most +visible parts of CP/M 2.2 and CP/M Plus respectively, adding enhanced +command processing, named directories, vastly improved resident +commands, flow control processing, error handling, and much more. But +it isn't necessary to master all of these (at least at first!) to take +advantage of NZ-COM and Z3PLUS. In fact, though both packages come with +several disks of software and excellent manuals, almost anyone can +install either of these packages on their CP/M computer in just a few +minutes' time. The price for either NZ-COM or Z3PLUS is $69.95 plus $3 +shipping. + +The next step up in sophistication for CP/M 2.2 users is ZSDOS. ZSDOS +replaces the less visible portion of CP/M 2.2 which controls program +input and output. Through clever coding and exhaustive testing, the +authors of ZSDOS offer significant improvements in performance, safety, +and versatility for CP/M 2.2, including file time and date stamping, +file archiving for faster backups, public files (accessable from all +user areas), path access to files, and improved error messages and +handling. As with NZ-COM and Z3PLUS, ZSDOS installation is completely +menu-driven. ZSDOS comes with a collection of state-of-the-art utility +programs and a 140 page manual to help you make the most of the extended +features. ZSDOS costs $75 ($60 when purchased with NZ-COM) plus $3 +shipping. + +Another path to system enhancement for CP/M 2.2 users with hard or RAM +disks is available in the form of BackGrounder ii (BGii). BGii allows +you to "suspend" any program at the touch of a button and use a wide +range of resident commands such as DIR, REN, ERA, CALC, or TYPE. Then +hit the button again and BGii quickly returns you to the program you +suspended, right where you left off. Or use BGii's SWAP command and +you're back at the CP/M prompt, ready to run any other CP/M program. +When you're through, SWAP again and BGii returns you to your original +program, exactly as you left it! Advanced "Cut" and "Paste" commands +are also available for many terminals, allowing you to transfer sections +of screen directly from one program to another. Print spooling, +advanced key redefinition and recording capabilities, and a beautifully +designed 140-page user's manual are included. Installation is +menu-driven and easy. BGii is compatible with either ZCPR or CP/M 2.2, +and costs $75.00 plus $3 shipping. + +Last but not least is DosDisk, a small but powerful program which allows +you to read or write DIRECTLY to MS-DOS disks with your CP/M computer. +No more file transfers--simply insert a standard MS-DOS DSDD diskette in +your CP/M machine, type "DosDisk :", and away you go--all files +on the diskette are now accessable by all of your CP/M programs--even +files in MS-DOS subdirectories! DosDisk comes with a handsome 38-page +user's manual, and is available preconfigured for most machines at just +$30.00 plus $3 shipping. DosDisk is compatible with either ZCPR or +CP/M 2.2. + +These and other fine products for CP/M and CP/M Plus are available from +users groups around the country, or directly from Z Systems Associates. +Sizeable discounts for users' groups are also available from Z Systems +Associates through the Z Plan. The Z Systems Associates are: + + Sage Microsystems East + Selling & Supporting the Best in 8-Bit Software + 1435 Centre St., Newton Centre, MA 02159-2469 + Voice: 617/965-3552 (9:00am - 11:30pm) + Modem: 617/965-7259 (password = DDT)(MABOS on PC-Pursuit) + + Same-day shipping of most products with modem download and support + available. Order by phone, mail, or modem. Shipping and handling $4 + per order (USA). Check, VISA, or MasterCard. Specify exact disk format. + +and: + + Plu*Perfect Systems + "==World-Class Software" + 410 23rd Street, Santa Monica, CA 90402 + Voice: 213/393-6105 (evenings) + Modem: 213/670-9465 (leave message for "Bridger Mitchell") + + To order: Specify product, operating system, computer, 5 1/4" disk + format. Enclose check, adding $3 shipping ($5 foreign) + 6.5% tax in + California. Enclose invoice if upgrading BGii or ZRDOS. + +For more information on Z System, check at the above bulletin board +systems, or consult The Computer Journal for excellent articles on ZCPR +and CP/M. The Computer Journal is published six times a year by +Publishing Consultants, 190 Sullivan Crossroad, Columbia Falls, MT +59912, phone 406/257-9119. An issue averages forty pages with few ads. +Subscription rates are $16 for one year (6 issues), or $28 for two years +(12 issues) in the U.S., $22 for one year Canada and Mexico, and $24 +(surface) for one year in other countries. + \ No newline at end of file diff --git a/Source/BPBIOS/dph.lib b/Source/BPBIOS/dph.lib index 72f39fef..1f6021e6 100644 --- a/Source/BPBIOS/dph.lib +++ b/Source/BPBIOS/dph.lib @@ -11,6 +11,11 @@ ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CSEG + +; Table has been reordered so that hard disk entries come before +; floppy entries. This means that "DRV_A" appears as I: and "DRV_E" +; appears as A:. The point is to allow booting from the first +; hard drive which pretty much needs to be A: DPHTBL: IF DRV_E AND HARDDSK @@ -34,46 +39,46 @@ DPHTBL: DEFW 00 ENDIF - IF DRV_A - DEFW DPH$00 ; Dph for drive A (Floppy) + IF DRV_I AND HARDDSK + DEFW DPH$54 ; Dph for Hard drive Partition I ELSE DEFW 00 ENDIF - IF DRV_B - DEFW DPH$01 ; Dph for drive B (Floppy) + IF DRV_J AND HARDDSK + DEFW DPH$55 ; Dph for Hard drive Partition J ELSE DEFW 00 ENDIF - IF DRV_C - DEFW DPH$02 ; Dph for drive C (Floppy) + IF DRV_K AND HARDDSK + DEFW DPH$56 ; Dph for Hard drive Partition K ELSE DEFW 00 ENDIF - IF DRV_D - DEFW DPH$03 ; Dph for drive D (Floppy) + IF DRV_L AND HARDDSK + DEFW DPH$57 ; Dph for Hard drive Partition L ELSE - DEFW 0 ; Dph for drive D + DEFW 00 ENDIF - IF DRV_I AND HARDDSK - DEFW DPH$54 ; Dph for Hard drive Partition I + IF DRV_A + DEFW DPH$00 ; Dph for drive A (Floppy) ELSE DEFW 00 ENDIF - IF DRV_J AND HARDDSK - DEFW DPH$55 ; Dph for Hard drive Partition J + IF DRV_B + DEFW DPH$01 ; Dph for drive B (Floppy) ELSE DEFW 00 ENDIF - IF DRV_K AND HARDDSK - DEFW DPH$56 ; Dph for Hard drive Partition K + IF DRV_C + DEFW DPH$02 ; Dph for drive C (Floppy) ELSE DEFW 00 ENDIF - IF DRV_L AND HARDDSK - DEFW DPH$57 ; Dph for Hard drive Partition L + IF DRV_D + DEFW DPH$03 ; Dph for drive D (Floppy) ELSE - DEFW 00 + DEFW 0 ; Dph for drive D ENDIF IF DRV_M AND RAMDSK diff --git a/Source/BPBIOS/hardhb.z80 b/Source/BPBIOS/hardhb.z80 index 39d2afab..d19ccb40 100644 --- a/Source/BPBIOS/hardhb.z80 +++ b/Source/BPBIOS/hardhb.z80 @@ -189,7 +189,8 @@ HDSK_RW1: POP BC ; RESTORE INCOMING FUNCTION, DEVICE/UNIT RET NZ ; ABORT IF SEEK RETURNED AN ERROR W/ ERROR IN A LD HL,(HB_DSKBUF) ; GET BUFFER ADDRESS - LD DE,1 ; TRANSFER ONE SECTOR + LD D,BID_HB ; BUFFER IN HBIOS BANK + LD E,1 ; ONE SECTOR CALL HBX_INVOKE ; DO IT OR A ; SET FLAGS RET Z ; DONE IF NO ERROR diff --git a/Source/BPBIOS/hbios.z80 b/Source/BPBIOS/hbios.z80 index be63e92d..7899f6aa 100644 --- a/Source/BPBIOS/hbios.z80 +++ b/Source/BPBIOS/hbios.z80 @@ -194,6 +194,9 @@ HBX_ROM: IF MK4 RLCA + JR NC,HBX_BNKSEL1 + XOR 00100001B +HBX_BNKSEL1: RLCA RLCA OUT0 (CPU_BBR),A diff --git a/Source/BPBIOS/romwbw-mk4.lib b/Source/BPBIOS/romwbw-mk4.lib index 09968231..e4dcf70f 100644 --- a/Source/BPBIOS/romwbw-mk4.lib +++ b/Source/BPBIOS/romwbw-mk4.lib @@ -26,15 +26,15 @@ HBCLK EQU YES ; HBIOS clock driver ; ; Set HB_IODEV to appropriate console device ; -HB_IODEV EQU 0 +HB_IODEV EQU 0 ; Assume we want to use first HBIOS serial device ; ; Set HB_HDDEV to appropriate hard disk driver ; -HB_HDDEV EQU 2 +HB_HDDEV EQU 2 ; Assumes disk device #2 is first hard disk device ; ; Set HB_MDDEV to appropriate memory disk driver ; -HB_MDDEV EQU 0 +HB_MDDEV EQU 0 ; Assumes disk device #0 is ROM disk device ; ; RAM/ROM disk sizes expressed as count of 2K blocks ; @@ -66,3 +66,17 @@ MEMTOP EQU 0FFE0H - 1 ; Start of HBIOS 32 byte control block ELSE MEMTOP EQU HBLOC - 1 ; Start of HBIOS 512 byte proxy ENDIF + + IF INTPXY +HB_EI MACRO + ENDM +HB_DI MACRO + ENDM + ELSE +HB_EI MACRO + EI + ENDM +HB_DI MACRO + DI + ENDM + ENDIF diff --git a/Source/BPBIOS/romwbw-sim.lib b/Source/BPBIOS/romwbw-sim.lib index 61087ae5..d666295f 100644 --- a/Source/BPBIOS/romwbw-sim.lib +++ b/Source/BPBIOS/romwbw-sim.lib @@ -26,15 +26,15 @@ HBCLK EQU YES ; HBIOS clock driver ; ; Set HB_IODEV to appropriate console device ; -HB_IODEV EQU 0 +HB_IODEV EQU 0 ; Assume we want to use first HBIOS serial device ; ; Set HB_HDDEV to appropriate hard disk driver ; -HB_HDDEV EQU 2 +HB_HDDEV EQU 2 ; Assumes disk device #2 is first hard disk device ; ; Set HB_MDDEV to appropriate memory disk driver ; -HB_MDDEV EQU 0 +HB_MDDEV EQU 0 ; Assumes disk device #0 is ROM disk device ; ; RAM/ROM disk sizes expressed as count of 2K blocks ; @@ -66,3 +66,17 @@ MEMTOP EQU 0FFE0H - 1 ; Start of HBIOS 32 byte control block ELSE MEMTOP EQU HBLOC - 1 ; Start of HBIOS 512 byte proxy ENDIF + + IF INTPXY +HB_EI MACRO + ENDM +HB_DI MACRO + ENDM + ELSE +HB_EI MACRO + EI + ENDM +HB_DI MACRO + DI + ENDM + ENDIF diff --git a/Source/BPBIOS/z33.zex b/Source/BPBIOS/z33.zex index bd8b92d3..ea1e714e 100644 --- a/Source/BPBIOS/z33.zex +++ b/Source/BPBIOS/z33.zex @@ -1,3 +1,3 @@ IOPINIT -LDR SYS.RCP,SYS.NDR,SYS.FCP,WW.Z3T +JETLDR RCP.ZRL,SYS.NDR,FCP.ZRL,MYTERM.Z3T  \ No newline at end of file diff --git a/Source/BPBIOS/z34.zex b/Source/BPBIOS/z34.zex index bd8b92d3..ea1e714e 100644 --- a/Source/BPBIOS/z34.zex +++ b/Source/BPBIOS/z34.zex @@ -1,3 +1,3 @@ IOPINIT -LDR SYS.RCP,SYS.NDR,SYS.FCP,WW.Z3T +JETLDR RCP.ZRL,SYS.NDR,FCP.ZRL,MYTERM.Z3T  \ No newline at end of file diff --git a/Source/BPBIOS/z41.zex b/Source/BPBIOS/z41.zex index 010e3334..aa944b80 100644 --- a/Source/BPBIOS/z41.zex +++ b/Source/BPBIOS/z41.zex @@ -1,4 +1,4 @@ IOPINIT -LDR SYS.NDR,SYS.FCP,WW.Z3T +JETLDR SYS.NDR,FCP.ZRL,MYTERM.Z3T ZSCFG2 CB  \ No newline at end of file diff --git a/Source/Build.cmd b/Source/Build.cmd index ef139f9d..9419b3ce 100644 --- a/Source/Build.cmd +++ b/Source/Build.cmd @@ -4,6 +4,6 @@ setlocal REM setlocal & call BuildDoc || exit /b 1 & endlocal setlocal & call BuildProp || exit /b 1 & endlocal setlocal & call BuildShared || exit /b 1 & endlocal -setlocal & call BuildImages || exit /b 1 & endlocal REM setlocal & call BuildBP || exit /b 1 & endlocal +setlocal & call BuildImages || exit /b 1 & endlocal setlocal & call BuildROM %* || exit /b 1 & endlocal \ No newline at end of file diff --git a/Source/BuildShared.cmd b/Source/BuildShared.cmd index bb8076d6..578af84e 100644 --- a/Source/BuildShared.cmd +++ b/Source/BuildShared.cmd @@ -1,14 +1,13 @@ @echo off setlocal -setlocal & cd Apps && call Build || exit /b 1 & endlocal +setlocal & cd CBIOS && call Build || exit /b 1 & endlocal setlocal & cd CPM22 && call Build || exit /b 1 & endlocal setlocal & cd ZCPR && call Build || exit /b 1 & endlocal setlocal & cd ZCPR-DJ && call Build || exit /b 1 & endlocal setlocal & cd ZSDOS && call Build || exit /b 1 & endlocal -setlocal & cd CBIOS && call Build || exit /b 1 & endlocal setlocal & cd CPM3 && call Build || exit /b 1 & endlocal setlocal & cd ZPM3 && call Build || exit /b 1 & endlocal +setlocal & cd Apps && call Build || exit /b 1 & endlocal setlocal & cd Forth && call Build || exit /b 1 & endlocal setlocal & cd Fonts && call Build || exit /b 1 & endlocal -setlocal & cd BL && call Build || exit /b 1 & endlocal diff --git a/Source/CBIOS/cbios.asm b/Source/CBIOS/cbios.asm index 971d3690..737280ce 100644 --- a/Source/CBIOS/cbios.asm +++ b/Source/CBIOS/cbios.asm @@ -302,7 +302,7 @@ BOOT: LD SP,STACK ; STACK FOR INITIALIZATION ; - ; COPY INITIALIZATION CODE TO RUNNINT LOCATION $8000 + ; COPY INITIALIZATION CODE TO RUNNING LOCATION $8000 LD HL,BUFPOOL LD DE,$8000 LD BC,CBIOS_END - BUFPOOL @@ -1670,8 +1670,8 @@ DPB_RF: .DB 15 ; BLM: BLOCK MASK .DB 0 ; EXM: EXTENT MASK .DW 2047 ; DSM: TOTAL STORAGE IN BLOCKS - 1 BLK = (4MB / 2K BLS) - 1 = 2047 - .DW 255 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE + .DW 511 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 + .DB 11111111B ; AL0: DIR BLK BIT MAP, FIRST BYTE .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE .DW 0 ; CKS: ZERO FOR NON-REMOVABLE MEDIA .DW 0 ; OFF: RESERVED TRACKS = 0 TRK @@ -2014,7 +2014,7 @@ AUTOSUB: INC A ; CHECK FOR ERR, $FF --> $00 RET Z ; ERR, DO NOT ATTEMPT AUTO SUBMIT ; - LD HL,CMD ; ADDRESS OF STARTUP COMMAND + LD HL,CMD ; ADDRESS OF STARTUP COMMANDs LD DE,CCP_LOC + 7 ; START OF COMMAND BUFFER IN CCP LD BC,CMDLEN ; LENGTH OF AUTOSTART COMMAND LDIR ; PATCH COMMAND LINE INTO CCP @@ -2398,7 +2398,11 @@ DRV_INIT: LD (DRVMAPADR),HL ; SAVE AS DRVMAP ADDRESS LD (HEAPTOP),HL ; AND AS NEW HEAP TOP ; - ; SETUP TO LOOP THROUGH AVAILABLE DEVICES + ; SETUP TO LOOP THROUGH AVAILABLE DEVICES BUILDING LIST OF + ; ACTIVE UNITS AND COUNTING NUMBER OF ACTIVE HARD DISK + ; DEVICES. NON-HARD DISK UNITS ARE ALWAYS CONSIDERED + ; ACTIVE, BUT HARD DISK UNITS ARE ONLY CONSIDERED ACTIVE + ; IF THERE IS MEDIA IN THE DRIVE. LD B,BF_SYSGET LD C,BF_SYSGET_DIOCNT RST 08 ; E := DISK UNIT COUNT @@ -2408,31 +2412,76 @@ DRV_INIT: RET Z ; HANDLE ZERO DEVICES (ALBEIT POORLY) ; ; LOOP THRU DEVICES TO COUNT TOTAL HARD DISK VOLUMES - PUSH BC ; SAVE THE DEVICE COUNT - LD C,0 ; USE C AS DEVICE LIST INDEX - LD E,0 ; INIT E FOR HARD DISK VOLUME COUNT + LD C,0 ; INIT C AS DEVICE LIST INDEX + LD D,0 ; INIT D AS TOTAL DEVICE COUNT + LD E,0 ; INIT E FOR HARD DISK DEVICE COUNT + LD HL,DRVLST ; INIT HL PTR TO DRIVE LIST ; DRV_INIT2: - PUSH BC ; SAVE LOOP CONTROL CALL DRV_INIT3 ; CHECK DRIVE - POP BC ; RESTORE LOOP CONTROL INC C ; NEXT UNIT DJNZ DRV_INIT2 ; LOOP - POP BC ; RESTORE UNIT COUNT IN B + LD A,D ; TOTAL DEVICE COUNT TO D + LD (DRVLSTC),A ; SAVE THE COUNT JR DRV_INIT4 ; CONTINUE ; DRV_INIT3: PUSH DE ; SAVE DE (HARD DISK VOLUME COUNTER) + PUSH HL ; SAVE DRIVE LIST PTR + PUSH BC ; SAVE LOOP CONTROL LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO RST 08 ; CALL HBIOS, UNIT TO C LD A,D ; DEVICE TYPE TO A + POP BC ; RESTORE LOOP CONTROL + POP HL ; RESTORE DRIVE LIST PTR POP DE ; RESTORE DE CP DIODEV_IDE ; HARD DISK DEVICE? - RET C ; NOPE, RETURN + JR NC,DRV_INIT3A ; IF SO, HANDLE SPECIAL + LD (HL),C ; SAVE UNIT NUM IN LIST + INC HL ; BUMP PTR + INC D ; INC TOTAL DEVICE COUNT + RET +; +DRV_INIT3A: + ; CHECK FOR ACTIVE AND RETURN IF NOT + PUSH DE ; SAVE DE (HARD DISK VOLUME COUNTER) + PUSH HL ; SAVE DRIVE LIST PTR + PUSH BC ; SAVE LOOP CONTROL + + LD B,BF_DIOMEDIA ; HBIOS FUNC: SENSE MEDIA + LD E,1 ; PERFORM MEDIA DISCOVERY + RST 08 + + POP BC ; RESTORE LOOP CONTROL + POP HL ; RESTORE DRIVE LIST PTR + POP DE ; RESTORE DE + + RET NZ ; IF NO MEDIA, JUST RETURN + + ; IF ACTIVE... + LD (HL),C ; SAVE UNIT NUM IN LIST + INC HL ; BUMP PTR + INC D ; INC TOTAL DEVICE COUNT INC E ; INCREMENT HARD DISK COUNT RET ; AND RETURN ; DRV_INIT4: ; SET SLICES PER VOLUME (HDSPV) BASED ON HARD DISK VOLUME COUNT + +; ; *** DEBUG *** +; CALL NEWLINE2 +; LD A,(DRVLSTC) +; LD B,A +; CALL PRTHEXBYTE +; LD A,' ' +; CALL COUT +; LD HL,DRVLST +;TEMP1: +; LD A,(HL) +; INC HL +; CALL PRTHEXBYTE +; DJNZ TEMP1 +; ; *** DEBUG *** + LD A,E ; HARD DISK VOLUME COUNT TO A LD E,8 ; ASSUME 8 SLICES PER VOLUME DEC A ; DEC ACCUM TO CHECK FOR COUNT = 1 @@ -2446,14 +2495,20 @@ DRV_INIT5: LD A,E ; SLICES PER VOLUME VALUE TO ACCUM LD (HDSPV),A ; SAVE IT ; - ; SETUP TO ENUMERATE DEVICES TO BUILD DRVMAP - LD B,BF_SYSGET - LD C,BF_SYSGET_DIOCNT - RST 08 ; E := DISK UNIT COUNT - LD B,E ; COUNT TO B - LD C,0 ; USE C AS DEVICE LIST INDEX +; ; SETUP TO ENUMERATE DEVICES TO BUILD DRVMAP +; LD B,BF_SYSGET +; LD C,BF_SYSGET_DIOCNT +; RST 08 ; E := DISK UNIT COUNT +; LD B,E ; COUNT TO B +; LD C,0 ; USE C AS DEVICE LIST INDEX +; + LD A,(DRVLSTC) ; ACTIVE DRIVE LIST COUNT TO ACCUM + LD B,A ; ... AND MOVE TO B FOR LOOP COUNTER + LD HL,DRVLST ; HL IS PTR TO ACTIVE DRIVE LIST ; DRV_INIT6: ; LOOP THRU ALL UNITS AVAILABLE + PUSH HL ; PRESERVE DRIVE LIST PTR + LD C,(HL) ; GET UNIT NUM FROM LIST PUSH BC ; PRESERVE LOOP CONTROL LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO RST 08 ; CALL HBIOS, D := DEVICE TYPE @@ -2462,6 +2517,8 @@ DRV_INIT6: ; LOOP THRU ALL UNITS AVAILABLE CALL DRV_INIT7 ; MAKE DRIVE MAP ENTRY(S) POP BC ; RESTORE LOOP CONTROL INC C ; INCREMENT LIST INDEX + POP HL ; RESTORE DRIVE LIST PTR + INC HL ; INCREMENT ACTIVE DRIVE LIST PTR DJNZ DRV_INIT6 ; LOOP AS NEEDED RET ; FINISHED ; @@ -2880,6 +2937,8 @@ HEAPTOP .DW BUFPOOL ; CURRENT TOP OF HEAP BOOTVOL .DW 0 ; BOOT VOLUME, MSB=BOOT UNIT, LSB=BOOT SLICE BNKRAMD .DB 0 ; STARTING BANK ID FOR RAM DRIVE HDSPV .DB 2 ; SLICES PER VOLUME FOR HARD DISKS (MUST BE >= 1) +DRVLST .FILL 32 ; ACTIVE DRIVE LIST USED DURINT DRV_INIT +DRVLSTC .DB 0 ; ENTRY COUNT FOR ACTIVE DRIVE LIST ; CMD .DB CMDLEN - 2 .TEXT "SUBMIT PROFILE" diff --git a/Source/CBIOS/ver.inc b/Source/CBIOS/ver.inc index 530202ad..b65ec245 100644 --- a/Source/CBIOS/ver.inc +++ b/Source/CBIOS/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 9 #DEFINE RUP 2 #DEFINE RTP 0 -#DEFINE BIOSVER "2.9.2-pre.27" +#DEFINE BIOSVER "2.9.2-pre.29" diff --git a/Source/CPM22/Build.cmd b/Source/CPM22/Build.cmd index 93a836cb..5c1effaa 100644 --- a/Source/CPM22/Build.cmd +++ b/Source/CPM22/Build.cmd @@ -32,6 +32,14 @@ zx MLOAD25 -OS2CCP.BIN=OS2CCP.HEX zx MAC -OS3BDOS.ASM -$PO zx MLOAD25 -OS3BDOS.BIN=OS3BDOS.HEX +tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst + +copy /b os2ccp.bin + os3bdos.bin + ..\cbios\cbios_wbw.bin cpm_wbw.bin +copy /b os2ccp.bin + os3bdos.bin + ..\cbios\cbios_una.bin cpm_una.bin + +copy /b loader.bin + cpm_wbw.bin cpm_wbw.sys +copy /b loader.bin + cpm_una.bin cpm_una.sys + goto :eof :asm diff --git a/Source/CPM22/Clean.cmd b/Source/CPM22/Clean.cmd index e2e6145a..243e3c08 100644 --- a/Source/CPM22/Clean.cmd +++ b/Source/CPM22/Clean.cmd @@ -5,3 +5,4 @@ if exist *.bin del *.bin if exist *.lst del *.lst if exist *.prn del *.prn if exist *.hex del *.hex +if exist *.sys del *.sys diff --git a/Source/BL/bl.asm b/Source/CPM22/loader.asm similarity index 100% rename from Source/BL/bl.asm rename to Source/CPM22/loader.asm diff --git a/Source/BL/ver.inc b/Source/CPM22/ver.inc similarity index 60% rename from Source/BL/ver.inc rename to Source/CPM22/ver.inc index 530202ad..b65ec245 100644 --- a/Source/BL/ver.inc +++ b/Source/CPM22/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 9 #DEFINE RUP 2 #DEFINE RTP 0 -#DEFINE BIOSVER "2.9.2-pre.27" +#DEFINE BIOSVER "2.9.2-pre.29" diff --git a/Source/CPM3/Build.cmd b/Source/CPM3/Build.cmd index 966837ea..f70ec6d2 100644 --- a/Source/CPM3/Build.cmd +++ b/Source/CPM3/Build.cmd @@ -35,7 +35,8 @@ zx Z80ASM -CHARIO/MF zx Z80ASM -MOVE/MF zx Z80ASM -DRVTBL/MF zx Z80ASM -DISKIO/MF -zx LINK -BIOS3[OS]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO +zx Z80ASM -UTIL/MF +zx LINK -BIOS3[OS]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL zx GENCPM -AUTO -DISPLAY copy cpm3.sys cpm3res.sys rem pause @@ -54,7 +55,8 @@ zx Z80ASM -CHARIO/MF zx Z80ASM -MOVE/MF zx Z80ASM -DRVTBL/MF zx Z80ASM -DISKIO/MF -zx LINK -BNKBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO +zx Z80ASM -UTIL/MF +zx LINK -BNKBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL zx GENCPM -AUTO -DISPLAY copy cpm3.sys cpm3bnk.sys rem pause @@ -73,7 +75,8 @@ zx Z80ASM -CHARIO/MF zx Z80ASM -MOVE/MF zx Z80ASM -DRVTBL/MF zx Z80ASM -DISKIO/MF -zx LINK -ZPMBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO +zx Z80ASM -UTIL/MF +zx LINK -ZPMBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL rem zx GENCPM -AUTO -DISPLAY rem copy cpm3.sys zpm3.sys rem pause diff --git a/Source/CPM3/bioskrnl.asm b/Source/CPM3/bioskrnl.asm index 32e918b9..ab3a9ccd 100644 --- a/Source/CPM3/bioskrnl.asm +++ b/Source/CPM3/bioskrnl.asm @@ -244,7 +244,7 @@ co$next: push h ; save the vector push b ; save the count and character not$out$ready: - call coster ! ora a ! jz not$out$ready + push b ! call coster ! pop b ! ora a ! jz not$out$ready pop b ! push b ; restore and resave the character and device call ?co ; if device selected, print it pop b ; recover count and character diff --git a/Source/CPM3/boot.z80 b/Source/CPM3/boot.z80 index d0b5cb0f..3e1cf55b 100644 --- a/Source/CPM3/boot.z80 +++ b/Source/CPM3/boot.z80 @@ -13,6 +13,8 @@ extrn @dtbl,@ctbl extrn @date,@hour,@min,@sec extrn @srch1 + extrn addhla, bcd2bin, bin2bcd + ;extrn cout, phex8 include ver.inc @@ -120,32 +122,113 @@ dinit: or a ; set flags ret z ; !!! handle zero devices (albeit poorly) !!! - ; loop thru devices to count total hard disk volumes - push bc ; save the device count - ld c,0 ; use c as device list index - ld e,0 ; init e for hard disk volume count +; ; loop thru devices to count total hard disk volumes +; push bc ; save the device count +; ld c,0 ; use c as device list index +; ld e,0 ; init e for hard disk volume count +; +;dinit2: +; push bc ; save loop control +; call dinit3 ; check drive +; pop bc ; restore loop control +; inc c ; next unit +; djnz dinit2 ; loop +; pop bc ; restore unit count in b +; jr dinit4 ; continue + ; loop thru devices to count total hard disk volumes + ld c,0 ; init c as device list index + ld d,0 ; init d as total device count + ld e,0 ; init e for hard disk device count + ld hl,drvlst ; init hl ptr to drive list +; dinit2: - push bc ; save loop control call dinit3 ; check drive - pop bc ; restore loop control inc c ; next unit djnz dinit2 ; loop - pop bc ; restore unit count in b + ld a,d ; total device count to d + ld (drvlstc),a ; save the count jr dinit4 ; continue +;dinit3: +; push de ; save de (hard disk volume counter) +; ld b,017h ; hbios func: report device info +; rst 08 ; call hbios, unit to c +; ld a,d ; device type to a +; pop de ; restore de +; cp 050h ; hard disk device? +; ret c ; nope, return +; inc e ; increment hard disk count +; ret ; and return + dinit3: push de ; save de (hard disk volume counter) - ld b,017h ; hbios func: report device info + push hl ; save drive list ptr + push bc ; save loop control + ld b,17h ; hbios func: report device info rst 08 ; call hbios, unit to c ld a,d ; device type to a + pop bc ; restore loop control + pop hl ; restore drive list ptr pop de ; restore de - cp 050h ; hard disk device? - ret c ; nope, return + cp 30h ; hard disk device? + jr nc,dinit3a ; if so, handle special + ld (hl),c ; save unit num in list + inc hl ; bump ptr + inc d ; inc total device count + ret +; +dinit3a: + ; check for active and return if not + push de ; save de (hard disk volume counter) + push hl ; save drive list ptr + push bc ; save loop control + + ld b,18h ; hbios func: sense media + ld e,1 ; perform media discovery + rst 08 + + pop bc ; restore loop control + pop hl ; restore drive list ptr + pop de ; restore de + + ret nz ; if no media, just return + + ; if active... + ld (hl),c ; save unit num in list + inc hl ; bump ptr + inc d ; inc total device count inc e ; increment hard disk count ret ; and return + +;dinit4: ; set slices per volume (hdspv) based on hard disk volume count +; ld a,e ; hard disk volume count to a +; ld e,8 ; assume 8 slices per volume +; dec a ; dec accum to check for count = 1 +; jr z,dinit5 ; yes, skip ahead to implement 8 hdspv +; ld e,4 ; now assume 4 slices per volume +; dec a ; dec accum to check for count = 2 +; jr z,dinit5 ; yes, skip ahead to implement 4 hdspv +; ld e,2 ; in all other cases, we use 2 hdspv + dinit4: ; set slices per volume (hdspv) based on hard disk volume count + +; ; *** debug *** +; ;call newline2 +; ld a,(drvlstc) +; ld b,a +; call phex8 +; ld a,' ' +; call cout +; ld hl,drvlst +;temp1: +; ld a,(hl) +; inc hl +; call phex8 +; djnz temp1 +; ; *** debug *** + ld a,e ; hard disk volume count to a ld e,8 ; assume 8 slices per volume dec a ; dec accum to check for count = 1 @@ -155,29 +238,56 @@ dinit4: ; set slices per volume (hdspv) based on hard disk volume count jr z,dinit5 ; yes, skip ahead to implement 4 hdspv ld e,2 ; in all other cases, we use 2 hdspv +;dinit5: +; ld a,e ; slices per volume value to accum +; ld (hdspv),a ; save it +; +; ; setup to enumerate devices to build drvmap +; ld b,0F8h ; SYS GET +; ld c,010h ; Disk Drive Unit Count +; rst 08 ; e := disk unit count +; ld b,e ; count to b +; ld c,0 ; use c as device list index +; ld hl,0 ; dph index + dinit5: ld a,e ; slices per volume value to accum ld (hdspv),a ; save it - - ; setup to enumerate devices to build drvmap - ld b,0F8h ; SYS GET - ld c,010h ; Disk Drive Unit Count - rst 08 ; e := disk unit count - ld b,e ; count to b - ld c,0 ; use c as device list index + ld a,(drvlstc) ; active drive list count to accum + ld b,a ; ... and move to b for loop counter + ld de,drvlst ; de is ptr to active drive list ld hl,0 ; dph index +;dinit6: ; loop thru all units available +; push bc ; preserve loop control +; push hl ; preserve dph pointer +; ld b,017h ; hbios func: report device info +; rst 08 ; call hbios, d := device type +; pop hl ; restore dph pointer +; pop bc ; get unit index back in c +; push bc ; resave loop control +; call dinit7 ; update dph entries +; pop bc ; restore loop control +; inc c ; increment list index +; djnz dinit6 ; loop as needed + dinit6: ; loop thru all units available + push de ; preserve drive list ptr + ex de,hl ; list ptr to hl + ld c,(hl) ; get unit num from list + ex de,hl ; list ptr back to de push bc ; preserve loop control push hl ; preserve dph pointer - ld b,017h ; hbios func: report device info + ld b,17h ; hbios func: report device info rst 08 ; call hbios, d := device type pop hl ; restore dph pointer pop bc ; get unit index back in c push bc ; resave loop control - call dinit7 ; update dph entries + call dinit7 ; make drive map entry(s) pop bc ; restore loop control inc c ; increment list index + pop de ; restore drive list ptr + inc de ; increment active drive list ptr djnz dinit6 ; loop as needed ; zero out remaining dph table entries @@ -570,50 +680,6 @@ read: ld c,20 jp bdos -addhla: - add a,l - ld l,a - ret nc - inc h - ret - -bcd2bin: - ; convert A from packed bcd to binary - push bc - ld c,a - and 0F0h - srl a - ld b,a - srl a - srl a - add a,b - ld b,a - ld a,c - and 0Fh - add a,b - pop bc - ret - -bin2bcd: - ; convert A from binary to packed bcd - push bc - ld b,10 - ld c,-1 -bin2bcd1: - inc c - sub b - jr nc,bin2bcd1 - add a,b - ld b,a - ld a,c - add a,a - add a,a - add a,a - add a,a - or b - pop bc - ret - if zpm signon$msg db 13,10,'ZPM3' @@ -656,6 +722,8 @@ fcb$nr db 0,0,0 @bootdu db 0 hdspv db 2 ; slices per volume for hard disks (must be >= 1) +drvlst ds 32 ; active drive list used durint drv_init +drvlstc db 0 ; entry count for active drive list ; The following section contains key information and addresses for the ; RomWBW CBIOS. A pointer to the start of this section is stored with diff --git a/Source/CPM3/diskio.z80 b/Source/CPM3/diskio.z80 index 91613e73..b951bfab 100644 --- a/Source/CPM3/diskio.z80 +++ b/Source/CPM3/diskio.z80 @@ -36,6 +36,8 @@ extrn ?const ; get console status extrn ?bnkxlt + + ;extrn phex8, cout ; CP/M 3 Disk definition macros @@ -365,6 +367,9 @@ dsk$login: ; simple single density only environment. + ;ld a,'L' + ;call cout + push de ; save DPH ptr ; check media @@ -372,7 +377,8 @@ dsk$login: ;halt ld c,a ; put in C ld b,18h ; HBIOS Media function - ld e,1 ; Enabled media check/discovery + ld e,1 ; Enable media check/discovery + ;rst 08 call 0FFF0H ; HBIOS call ld a,e ; Resultant media id to accum or a ; Set flags @@ -380,8 +386,11 @@ dsk$login: ; ; !!! Need to do something on error !!! ; - ret z ; Bail out on error + jr nz,dsk$login0 ; continue if OK + pop de ; else error + ret ; return +dsk$login0: ld hl,dpb$start - dpb$sz ld de,dpb$sz ld b,a ; loop count @@ -422,6 +431,9 @@ dsk$read: ; ld ix,30H ; halt + ;ld a,'R' + ;call cout + push de ; save XDPH pointer call dsk$seek ; disk seek pop hl ; restore pointer to HL @@ -440,8 +452,10 @@ dsk$read: endif ld d,a ; set desk bank ld e,1 ; 1 sector - ;rst 08 ; do it - call 0FFF0H + rst 08 ; do it + ;call 0FFF0H + + ;call phex8 ret ; return ; lxi h,read$msg ; point at " Read " @@ -470,8 +484,8 @@ dsk$write: endif ld d,a ; set desk bank ld e,1 ; 1 sector - ;rst 08 ; do it - call 0FFF0H + rst 08 ; do it + ;call 0FFF0H ret ; return ; lxi h,write$msg ; point at " Write " @@ -485,34 +499,44 @@ dsk$seek: ld c,a ; BIOS Disk Unit in C ld b,12H ; HBIOS SEEK function push bc ; save it - + push de ; save XDPH pointer + ld b,17h ; HBIOS DEVICE function + rst 08 ; Do it, D=device type + ld a,d ; put in accum + and 0F0h ; isolate high bits + ld b,1 ; assume it is floppy, 1 head bit + ld c,01h ; 1 bit head mask + cp 10h ; floppy? + jr z,seek0 ; yup, skip ahead + ld b,4 ; must be hard disk, 4 head bits + ld c,0Fh ; 4 bit head mask +seek0: + pop de ; recover XDPH pointer + push bc ; save bc inc de ; point to slice field of XDPH ld a,(de) ; get it ld e,a ; slice to E ld h,65 ; number of tracks per slice call mult8 ; HL now has track offset for slice - push hl ; save it for now - + pop bc ; recover bc + push hl ; save track offset for now ld hl,(@trk) ; get track value ld a,l ; lsb of track to a - and 0FH ; isolate head in low 4 bits - ld d,a ; stuff it in d - ld a,(@sect) ; get sector - ld e,a ; stuff it in e - ld b,4 ; prepare to shift out 4 bit head value + and c ; apply mask + ld d,a ; save in d seek1: srl h ; shift one bit out rr l ; ... of hl - djnz seek1 ; do all 4 bits - + djnz seek1 ; do all bits + ld a,(@sect) ; get sector + ld e,a ; stuff it in e ex de,hl ; de=track, hl=head/sect - ex (sp),hl ; save head/sect, hl = offset + ex (sp),hl ; save head/sect, hl = offset add hl,de ; hl has final track value pop de ; recover head/sect to de - pop bc ; recover function & unit - ;rst 08 ; perform seek - call 0FFF0H + rst 08 ; perform seek + ;call 0FFF0H ret ; diff --git a/Source/CPM3/util.z80 b/Source/CPM3/util.z80 new file mode 100644 index 00000000..affa7ade --- /dev/null +++ b/Source/CPM3/util.z80 @@ -0,0 +1,133 @@ + title 'Utility module for RomWBW' + + maclib options.lib + + public addhla, bcd2bin, bin2bcd + public phex16, phex8, cout + + cseg + +addhla: + add a,l + ld l,a + ret nc + inc h + ret + +bcd2bin: + ; convert A from packed bcd to binary + push bc + ld c,a + and 0F0h + srl a + ld b,a + srl a + srl a + add a,b + ld b,a + ld a,c + and 0Fh + add a,b + pop bc + ret + +bin2bcd: + ; convert A from binary to packed bcd + push bc + ld b,10 + ld c,-1 +bin2bcd1: + inc c + sub b + jr nc,bin2bcd1 + add a,b + ld b,a + ld a,c + add a,a + add a,a + add a,a + add a,a + or b + pop bc + ret + + if 0 +; +; Print the hex word value in HL +; +phex16: + push af + ld a,h + call phex8 + ld a,l + call phex8 + pop af + ret +; +; Print the hex byte value in A +; +phex8: + push af + push de + call hexascii + ld a,d + call cout + ld a,e + call cout + pop de + pop af + ret + +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a + call hexconv + ld e,a + ld a,d + rlca + rlca + rlca + rlca + call hexconv + ld d,a + ret +; +; convert low nibble of A to ascii hex +; +hexconv: + and 0Fh ;low nibble only + add a,90h + daa + adc a,40h + daa + ret +; +; output character from A +; +cout: + ; save all incoming registers + push af + push bc + push de + push hl + ld e,a + ld bc,0100h + rst 08 + pop hl + pop de + pop bc + pop af + ret + + else + +phex16: +phex8: +cout: + halt + + endif + + end diff --git a/Source/CPM3/ver.inc b/Source/CPM3/ver.inc index 868c7005..2fc0ccc8 100644 --- a/Source/CPM3/ver.inc +++ b/Source/CPM3/ver.inc @@ -3,5 +3,5 @@ rmn equ 9 rup equ 2 rtp equ 0 biosver macro - db "2.9.2-pre.27" + db "2.9.2-pre.29" endm diff --git a/Source/Clean.cmd b/Source/Clean.cmd index 3c374280..a4420787 100644 --- a/Source/Clean.cmd +++ b/Source/Clean.cmd @@ -11,7 +11,6 @@ setlocal & cd CPM3 && call Clean.cmd & endlocal setlocal & cd ZPM3 && call Clean.cmd & endlocal setlocal & cd Forth && call Clean.cmd & endlocal setlocal & cd Fonts && call Clean.cmd & endlocal -setlocal & cd BL && call Clean.cmd & endlocal setlocal & cd BPBIOS && call Clean.cmd & endlocal setlocal & cd HBIOS && call Clean.cmd & endlocal setlocal & cd Doc && call Clean.cmd & endlocal diff --git a/Source/HBIOS/Build.ps1 b/Source/HBIOS/Build.ps1 index a94fe7d7..cb898af7 100644 --- a/Source/HBIOS/Build.ps1 +++ b/Source/HBIOS/Build.ps1 @@ -107,7 +107,7 @@ $ComFile = "${OutDir}/${RomName}.com" # Final name of COM image (command line lo $ImgFile = "${OutDir}/${RomName}.img" # Final name of IMG image (memory loadable HBIOS/CBIOS image) # Select the proper CBIOS to include in the ROM. UNA is special. -if ($Platform -eq "UNA") {$CBiosFile = '../CBIOS/cbios_una.bin'} else {$CBiosFile = '../CBIOS/cbios_wbw.bin'} +if ($Platform -eq "UNA") {$Bios = 'una'} else {$Bios = 'wbw'} # List of RomWBW proprietary apps to imbed in ROM disk. $RomApps = "assign","fdu","format","mode","osldr","rtc","survey","syscopy","sysgen","talk","timer","xm","inttest" @@ -140,7 +140,7 @@ Function Concat($InputFileList, $OutputFile) # # Since TASM has no mechanism to include files dynamically based on variables, a file -# if built on-the-fly here for imbedding in the build process. This file is basically +# is built on-the-fly here for imbedding in the build process. This file is basically # just used to include the platform and config files. It also passes in some values # from the build to include in the build. @@ -155,14 +155,6 @@ ROMSIZE .EQU ${ROMSize} ; "@ | Out-File "build.inc" -Encoding ASCII -# Bring over previously assembled binary copy of the CP/M CCP and BDOS images for later use. -Copy-Item '..\cpm22\os2ccp.bin' 'ccp.bin' -Copy-Item '..\cpm22\os3bdos.bin' 'bdos.bin' - -# Bring over previously assembled binary copy of the ZSystem CCP and BDOS images for later use. -Copy-Item '..\zcpr-dj\zcpr.bin' 'zcpr.bin' -Copy-Item '..\zsdos\zsdos.bin' 'zsdos.bin' - # Bring over previously assembled binary copy of Forth for later use. Copy-Item '..\Forth\camel80.bin' 'camel80.bin' @@ -170,14 +162,10 @@ Copy-Item '..\Forth\camel80.bin' 'camel80.bin' Copy-Item '..\Fonts\font*.asm' '.' # Assemble individual components. Note in the case of UNA, there is less to build. -Asm 'dbgmon' -Asm 'prefix' -Asm 'romldr' -Asm 'eastaegg' -Asm 'nascom' -Asm 'tastybasic' -Asm 'imgpad' -Asm 'imgpad0' +# +$RomComponentList = "dbgmon", "prefix", "romldr", "eastaegg", "nascom", "tastybasic", "game", "usrrom", "imgpad", "imgpad0" +ForEach ($RomComponentName in $RomComponentList) {Asm $RomComponentName} + if ($Platform -ne "UNA") { Asm 'hbios' '-dROMBOOT' -Output 'hbios_rom.bin' -List 'hbios_rom.lst' @@ -191,17 +179,10 @@ if ($Platform -ne "UNA") # "Building ${RomName} output files..." -# Combine the CCP and BDOS portions of CP/M and ZSystem to create OS images -Concat 'ccp.bin','bdos.bin',$CBiosFile 'cpm.bin' -Concat 'zcpr.bin','zsdos.bin',$CBiosFile 'zsys.bin' - -# Prepend a bit of boot code required to bootstrap the OS images -Concat 'prefix.bin','cpm.bin' 'cpm.sys' -Concat 'prefix.bin','zsys.bin' 'zsys.sys' - # Build 32K OS chunk containing the loader, debug monitor, and OS images -Concat 'romldr.bin', 'eastaegg.bin','dbgmon.bin', 'cpm.bin', 'zsys.bin' osimg.bin -Concat 'camel80.bin', 'nascom.bin', 'tastybasic.bin', 'imgpad0.bin' osimg1.bin +Concat 'romldr.bin', 'eastaegg.bin','dbgmon.bin', "..\cpm22\cpm_${Bios}.bin", "..\zsdos\zsys_${Bios}.bin" osimg.bin +Concat 'camel80.bin', 'nascom.bin', 'tastybasic.bin', 'game.bin', 'imgpad0.bin', 'usrrom.bin' osimg1.bin + # # Now the ROM disk image is created. This is done by starting with a # blank ROM disk image of the correct size, then cpmtools is used to @@ -229,7 +210,8 @@ foreach ($App in $RomApps) } # Add the CP/M and ZSystem system images to the ROM disk (used by SYSCOPY) -cpmcp -f $RomFmt $RomDiskFile *.sys 0: +cpmcp -f $RomFmt $RomDiskFile ..\cpm22\cpm_${Bios}.sys 0:cpm.sys +cpmcp -f $RomFmt $RomDiskFile ..\zsdos\zsys_${Bios}.sys 0:zsys.sys # # Finally, the individual binary components are concatenated together to produce @@ -249,5 +231,5 @@ else Concat 'hbios_img.bin','osimg.bin' $ImgFile } -# Remove the temprary working ROM disk file +# Remove the temporary working ROM disk file Remove-Item $RomDiskFile diff --git a/Source/HBIOS/Config/MK4_std.asm b/Source/HBIOS/Config/MK4_std.asm index f0e45a2d..4909dc00 100644 --- a/Source/HBIOS/Config/MK4_std.asm +++ b/Source/HBIOS/Config/MK4_std.asm @@ -38,10 +38,8 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_DIDE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_MK4 ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .SET PPIDEMODE_MFP ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC] ; SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .SET SDMODE_MK4 ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC] diff --git a/Source/HBIOS/Config/RCZ180_ext.asm b/Source/HBIOS/Config/RCZ180_ext.asm index 29837d4a..7c9cca5b 100644 --- a/Source/HBIOS/Config/RCZ180_ext.asm +++ b/Source/HBIOS/Config/RCZ180_ext.asm @@ -41,6 +41,5 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/RCZ180_nat.asm b/Source/HBIOS/Config/RCZ180_nat.asm index 2ebeebf9..5c83fe9a 100644 --- a/Source/HBIOS/Config/RCZ180_nat.asm +++ b/Source/HBIOS/Config/RCZ180_nat.asm @@ -41,6 +41,5 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/RCZ80_kio.asm b/Source/HBIOS/Config/RCZ80_kio.asm index d30c7ff0..eeede184 100644 --- a/Source/HBIOS/Config/RCZ80_kio.asm +++ b/Source/HBIOS/Config/RCZ80_kio.asm @@ -47,6 +47,5 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/RCZ80_std.asm b/Source/HBIOS/Config/RCZ80_std.asm index 61ef8517..d266d9f2 100644 --- a/Source/HBIOS/Config/RCZ80_std.asm +++ b/Source/HBIOS/Config/RCZ80_std.asm @@ -34,6 +34,5 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/SBC_std.asm b/Source/HBIOS/Config/SBC_std.asm index 8097a3d6..d5cb313a 100644 --- a/Source/HBIOS/Config/SBC_std.asm +++ b/Source/HBIOS/Config/SBC_std.asm @@ -34,10 +34,8 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_DIO3 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_DIO ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .SET PPIDEMODE_SBC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC] ; SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .SET SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC] diff --git a/Source/HBIOS/Config/SCZ180_126.asm b/Source/HBIOS/Config/SCZ180_126.asm index 01f051ca..09d2100a 100644 --- a/Source/HBIOS/Config/SCZ180_126.asm +++ b/Source/HBIOS/Config/SCZ180_126.asm @@ -41,7 +41,6 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) ; diff --git a/Source/HBIOS/Config/SCZ180_130.asm b/Source/HBIOS/Config/SCZ180_130.asm index 60de55b9..ae332544 100644 --- a/Source/HBIOS/Config/SCZ180_130.asm +++ b/Source/HBIOS/Config/SCZ180_130.asm @@ -43,7 +43,6 @@ FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .SET IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] ; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) ; diff --git a/Source/HBIOS/asci.asm b/Source/HBIOS/asci.asm index 788a705a..26a71d87 100644 --- a/Source/HBIOS/asci.asm +++ b/Source/HBIOS/asci.asm @@ -520,8 +520,10 @@ ASCI_INITGO: INC C ; ... STAT REG, B IS STILL 0 #IF (INTMODE > 0) LD A,$08 ; SET RIE BIT ON - OUT (C),A ; WRITE STAT REG +#ELSE + XOR A ; CLEAR RIE/TIE #ENDIF + OUT (C),A ; WRITE STAT REG LD A,$0E ; BUMP TO ADD A,C ; ... ASEXT REG LD C,A ; PUT IN C FOR I/O, B IS STILL 0 diff --git a/Source/HBIOS/cfg_dyno.asm b/Source/HBIOS/cfg_dyno.asm index 6e034243..0babcf5d 100644 --- a/Source/HBIOS/cfg_dyno.asm +++ b/Source/HBIOS/cfg_dyno.asm @@ -105,14 +105,33 @@ FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER ; IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU TRUE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) -; -PPIDEENABLE .EQU TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_DYNO ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_RC ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $10 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER +; +PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $4C ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_ezz80.asm b/Source/HBIOS/cfg_ezz80.asm index 35fedb50..d691eb2d 100644 --- a/Source/HBIOS/cfg_ezz80.asm +++ b/Source/HBIOS/cfg_ezz80.asm @@ -120,14 +120,33 @@ FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER ; IDEENABLE .EQU TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU TRUE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_RC ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $10 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_RC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $20 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_master.asm b/Source/HBIOS/cfg_master.asm index 9bc94944..f02968d7 100644 --- a/Source/HBIOS/cfg_master.asm +++ b/Source/HBIOS/cfg_master.asm @@ -161,17 +161,42 @@ FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS ; RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER -RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-2) +RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-4) ; IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_NONE ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU FALSE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_NONE ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $20 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_NONE ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $60 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $20 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $44 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_NONE ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_mk4.asm b/Source/HBIOS/cfg_mk4.asm index 7291659f..37025c1a 100644 --- a/Source/HBIOS/cfg_mk4.asm +++ b/Source/HBIOS/cfg_mk4.asm @@ -116,17 +116,42 @@ FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS ; RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER -RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-2) +RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-4) ; IDEENABLE .EQU TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_MK4 ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU TRUE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_MK4 ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $80 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_DIDE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $20 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $28 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $28 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU FALSE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU FALSE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_DIDE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $30 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $38 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $38 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU FALSE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU FALSE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_DIO3 ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 2 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $44 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $20 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_MK4 ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_n8.asm b/Source/HBIOS/cfg_n8.asm index f63be838..3592584b 100644 --- a/Source/HBIOS/cfg_n8.asm +++ b/Source/HBIOS/cfg_n8.asm @@ -119,17 +119,42 @@ FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS ; RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER -RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-2) +RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-4) ; IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_DIO ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU FALSE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_DIO ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $20 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $20 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $28 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU FALSE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU FALSE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_N8 ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $80 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_CSIO ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_rcz180.asm b/Source/HBIOS/cfg_rcz180.asm index 41bfc5e0..aeb1f0c4 100644 --- a/Source/HBIOS/cfg_rcz180.asm +++ b/Source/HBIOS/cfg_rcz180.asm @@ -125,15 +125,39 @@ FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER ; IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU TRUE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_RC ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $10 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_RC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) -; +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $20 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY diff --git a/Source/HBIOS/cfg_rcz80.asm b/Source/HBIOS/cfg_rcz80.asm index 89b70b4f..3a49b4d3 100644 --- a/Source/HBIOS/cfg_rcz80.asm +++ b/Source/HBIOS/cfg_rcz80.asm @@ -129,14 +129,39 @@ FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER ; IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU TRUE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_RC ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $10 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_RC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $20 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_sbc.asm b/Source/HBIOS/cfg_sbc.asm index 3622da7b..78193630 100644 --- a/Source/HBIOS/cfg_sbc.asm +++ b/Source/HBIOS/cfg_sbc.asm @@ -119,17 +119,42 @@ FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS ; RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER -RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-2) +RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-4) ; IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_DIO ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU FALSE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_DIO ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $20 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $20 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $28 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU FALSE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU FALSE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_SBC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $60 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $20 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $44 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_JUHA ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_scz180.asm b/Source/HBIOS/cfg_scz180.asm index 39677f51..532544d7 100644 --- a/Source/HBIOS/cfg_scz180.asm +++ b/Source/HBIOS/cfg_scz180.asm @@ -120,14 +120,39 @@ FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER ; IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDEMODE .EQU IDEMODE_RC ; IDE: DRIVER MODE: IDEMODE_[DIO|DIDE] IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDE8BIT .EQU TRUE ; IDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_RC ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $10 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_RC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $20 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_SC ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_zeta.asm b/Source/HBIOS/cfg_zeta.asm index 4997be12..d34cfdbb 100644 --- a/Source/HBIOS/cfg_zeta.asm +++ b/Source/HBIOS/cfg_zeta.asm @@ -101,9 +101,11 @@ RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_SBC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $60 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/cfg_zeta2.asm b/Source/HBIOS/cfg_zeta2.asm index 65c3e8d5..44c6bdcd 100644 --- a/Source/HBIOS/cfg_zeta2.asm +++ b/Source/HBIOS/cfg_zeta2.asm @@ -106,9 +106,11 @@ RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) ; PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDEMODE .EQU PPIDEMODE_SBC ; PPIDE: DRIVER MODE: PPIDEMODE_[SBC|DIO3|MFP|N8|RC|DYNO] PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDE8BIT .EQU FALSE ; PPIDE: USE 8-BIT TRANSFERS (CF CARDS MOSTLY) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $60 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/game.asm b/Source/HBIOS/game.asm new file mode 100644 index 00000000..8bbce38b --- /dev/null +++ b/Source/HBIOS/game.asm @@ -0,0 +1,1234 @@ +; 2048 +; +; Join the numbers and get to the 2048 tile. +; +; Commands: +; +; Use the arrow keys to move the tiles. +; When two tiles with the same number touch, they merge into one. +; +; w, s, a, d - Alternate keys (up, down, left, right) +; CTRL-E, CTRL-X, CTRL-S, CTRL-D - Wordstar-compatible control keys +; +; Compile: +; +; TASM -80 -b 2048.ASM 2048.COM +; +; Credits: +; +; Based on 2048 created by Gabriele Cirulli. +; Based on the console version for GNU/Linux by Maurits van der Schee +; Ported to Z80 and CP/M by Marco Maccaferri +; Ported to ROMWBW ROM by Phil Summers difficultylevelhigh@gmail from https://github.com/maccasoft/z80-apps/2048.asm + +CTRL_A .EQU 1 +CTRL_B .EQU 2 +CTRL_C .EQU 3 +CTRL_D .EQU 4 +CTRL_E .EQU 5 +CTRL_F .EQU 6 +CTRL_G .EQU 7 +CTRL_H .EQU 8 +CTRL_I .EQU 9 +CTRL_J .EQU 10 +CTRL_K .EQU 11 +CTRL_L .EQU 12 +CTRL_M .EQU 13 +CTRL_N .EQU 14 +CTRL_O .EQU 15 +CTRL_P .EQU 16 +CTRL_Q .EQU 17 +CTRL_R .EQU 18 +CTRL_S .EQU 19 +CTRL_T .EQU 20 +CTRL_U .EQU 21 +CTRL_V .EQU 22 +CTRL_W .EQU 23 +CTRL_X .EQU 24 +CTRL_Y .EQU 25 +CTRL_Z .EQU 26 + +BEL .EQU 07H +FF .EQU 0CH +CR .EQU 0DH +LF .EQU 0AH +EOS .EQU 24H + +;BDOS .EQU 0005H + +BOARD_X .EQU 25H +BOARD_Y .EQU 06H + +#include "std.asm" + + .ORG GAM_LOC + +S2048: LD A,R + LD (RAND16+1),A + LD A,R + LD (RAND16+2),A + + LD B,VAREND-BOARD + LD HL,BOARD + XOR A +CLRBOARD: LD (HL),A + INC HL + DJNZ CLRBOARD + + LD DE,INIT +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + + CALL ADDRANDOM + CALL ADDRANDOM + + CALL DRAWBORDER + CALL DRAWBOARD + +LOOP2 LD A,BOARD_X-3 + LD (XPOS),A + LD A,BOARD_Y + ADD A,13H + DAA + LD (YPOS),A + CALL GOTOXY + LD DE,MSG1 +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + +LOOP: +; LD C,06H +; LD E,0FFH +; CALL BDOS +; CP 0 +; JP Z,LOOP + CALL CIN + + CP 'a' + JP C,K3 + CP '{' + JP NC,K3 + AND 5FH + +K3 CP CTRL_C + JP Z,EXIT + + CP 1BH + JP Z,K1 + + CP CTRL_E + JP Z,TOP + CP CTRL_X + JP Z,BOTTOM + CP CTRL_D + JP Z,RIGHT + CP CTRL_S + JP Z,LEFT + + CP 'W' + JP Z,TOP + CP 'S' + JP Z,BOTTOM + CP 'D' + JP Z,RIGHT + CP 'A' + JP Z,LEFT + + CP '8' + JP Z,TOP + CP '2' + JP Z,BOTTOM + CP '6' + JP Z,RIGHT + CP '4' + JP Z,LEFT + + CP 'Q' + JP Z,QUIT + +; LD C,02H +; LD E,BEL +; CALL BDOS +; CALL COUTE + + JP LOOP + +K1: +; LD C,06H +; LD E,0FFH +; CALL BDOS +; CP 0 +; JP Z,K1 + CALL CIN + + CP '[' + JP NZ,LOOP + +K4: +; LD C,06H +; LD E,0FFH +; CALL BDOS +; CP 0 +; JP Z,K4 + CALL CIN + +K2 CP 'A' + JP Z,TOP + CP 'B' + JP Z,BOTTOM + CP 'C' + JP Z,RIGHT + CP 'D' + JP Z,LEFT + +; LD C,02H +; LD E,BEL +; CALL BDOS +; CALL COUTE + + JP LOOP + +LOOP1 LD A,(MOVED) + CP 0 + JP Z,LOOP + + CALL DRAWBOARD + + CALL ADDRANDOM + CALL DRAWBOARD + + CALL ISOVER + CP 1 + JP Z,GAMEOVER + + JP LOOP + +TOP: + CALL ROTATE + CALL ROTATE + CALL ROTATE + CALL MOVEMERGE + CALL ROTATE + JP LOOP1 + +BOTTOM: + CALL ROTATE + CALL MOVEMERGE + CALL ROTATE + CALL ROTATE + CALL ROTATE + JP LOOP1 + +RIGHT: + CALL ROTATE + CALL ROTATE + CALL MOVEMERGE + CALL ROTATE + CALL ROTATE + JP LOOP1 + +LEFT: + CALL MOVEMERGE + JP LOOP1 + +QUIT: + LD A,BOARD_X-3 + LD (XPOS),A + LD A,BOARD_Y + ADD A,13H + DAA + LD (YPOS),A + CALL GOTOXY + LD DE,MSG2 +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + +Q1: +; LD C,06H +; LD E,0FFH +; CALL BDOS +; CP 0 +; JP Z,Q1 + CALL CIN + + CP 'y' + JP Z,EXIT + CP 'Y' + JP Z,EXIT + CP 'n' + JP Z,LOOP2 + CP 'N' + JP Z,LOOP2 + CP 'R' + JP S2048 + CP 'r' + JP S2048 + +; LD C,02H +; LD E,BEL +; CALL BDOS +; CALL COUTE + JP Q1 + +GAMEOVER: + LD A,BOARD_X-3 + LD (XPOS),A + LD A,BOARD_Y+13H + DAA + LD (YPOS),A + CALL GOTOXY + LD DE,MSG3 +; LD C,09H +; CALL BDOS + CALL PRTSTRDE +GAMEMORE: CALL CIN + CP 'y' + JP Z,S2048 + CP 'Y' + JP Z,S2048 + CP 'n' + JP Z,EXIT + CP 'N' + JP Z,EXIT + JR GAMEMORE +EXIT: + LD DE,TERM +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + + LD A,00H + LD HL,0000H + JP 0FFF9H +; RET + +ISOVER: + LD A,1 + LD (RESULT),A + + LD B,16 + LD HL,BOARD +G1: LD A,(HL) + CP 13 + JP Z,GR + INC HL + DJNZ G1 + + CALL CANMERGE + CP 0 + JP Z,G2 + XOR A + LD (RESULT),A + +G2: CALL ROTATE + CALL CANMERGE + CP 0 + JP Z,G3 + XOR A + LD (RESULT),A + +G3: CALL ROTATE + CALL CANMERGE + CP 0 + JP Z,G4 + XOR A + LD (RESULT),A + +G4: CALL ROTATE + CALL CANMERGE + CP 0 + JP Z,G5 + XOR A + LD (RESULT),A + +G5: CALL ROTATE + +GR: LD A,(RESULT) + RET + +CANMERGE: + LD HL,BOARD + LD (BOARDPTR),HL + CALL TESTMERGE + CP 1 + RET Z + LD HL,BOARD+4 + LD (BOARDPTR),HL + CALL TESTMERGE + CP 1 + RET Z + LD HL,BOARD+8 + LD (BOARDPTR),HL + CALL TESTMERGE + CP 1 + RET Z + LD HL,BOARD+12 + LD (BOARDPTR),HL + CALL TESTMERGE + RET + +TESTMERGE: + LD DE,(BOARDPTR) + LD HL,(BOARDPTR) + INC HL + + LD B,3 +M8 LD A,(DE) + CP 0 + JP Z,M7 + LD C,(HL) + CP C + JP Z,M7 + INC HL + INC DE + DJNZ M8 + XOR A + RET +M7 LD A,1 + RET + +MOVEMERGE: + XOR A + LD (MOVED),A + + LD HL,BOARD + LD (BOARDPTR),HL + CALL MERGE + LD HL,BOARD+4 + LD (BOARDPTR),HL + CALL MERGE + LD HL,BOARD+8 + LD (BOARDPTR),HL + CALL MERGE + LD HL,BOARD+12 + LD (BOARDPTR),HL + CALL MERGE + + RET + +ADDRANDOM: + LD DE,0 + LD B,16 + LD HL,BOARD +N2 LD A,(HL) + CP 0 + JP NZ,N1 + INC E +N1 INC HL + DJNZ N2 + + LD A,E + CP 0 + RET Z + + PUSH DE + CALL RAND16 + POP DE + CALL DIV16 + + LD B,L +N4: LD C,16 + LD HL,BOARD +N5: LD A,(HL) + CP 0 + JP NZ,N3 + DEC B + JP Z,N6 +N3: INC HL + DEC C + JP NZ,N5 + JP N4 + +N6 PUSH HL + + CALL RAND16 + LD DE,10 + CALL DIV16 + LD DE,9 + CALL DIV16 + LD A,E + INC A + + POP HL + LD (HL),A + + RET + +MERGE: + CALL COLLAPSE + + ; merge tiles with same value + + LD DE,(BOARDPTR) + LD HL,(BOARDPTR) + INC HL + + LD B,3 +M6: LD A,(DE) + CP 0 + RET Z + LD C,(HL) + CP C + JP NZ,M5 + + INC A + LD (DE),A + CALL ADDPOINTS + XOR A + LD (HL),A + + LD A,(MOVED) + INC A + LD (MOVED),A + + PUSH DE + PUSH HL + CALL COLLAPSE + POP HL + POP DE + +M5: INC HL + INC DE + DJNZ M6 + + RET + +COLLAPSE: + ; collapse all tiles + + LD HL,(BOARDPTR) + + LD B,4 ; find first zero +M1: LD A,(HL) + CP 0 + JP Z,M2 + INC HL + DJNZ M1 + RET + +M2: LD E,L ; DE=fist zero position + LD D,H + +M4: LD A,(HL) ; move all non-zero tiles + CP 0 + JP Z,M3 + + LD (DE),A + INC DE + XOR A + LD (HL),A + + LD A,(MOVED) + INC A + LD (MOVED),A + +M3: INC HL + DJNZ M4 + + RET + +ROTATE: + ; outer ring + + LD B,3 + +R1: LD A,(BOARD+3) + LD C,A + + LD A,(BOARD+2) + LD (BOARD+3),A + LD A,(BOARD+1) + LD (BOARD+2),A + LD A,(BOARD+0) + LD (BOARD+1),A + + LD A,(BOARD+4) + LD (BOARD+0),A + LD A,(BOARD+8) + LD (BOARD+4),A + LD A,(BOARD+12) + LD (BOARD+8),A + + LD A,(BOARD+13) + LD (BOARD+12),A + LD A,(BOARD+14) + LD (BOARD+13),A + LD A,(BOARD+15) + LD (BOARD+14),A + + LD A,(BOARD+11) + LD (BOARD+15),A + LD A,(BOARD+7) + LD (BOARD+11),A + LD A,C + LD (BOARD+7),A + + DJNZ R1 + + ; inner ring + + LD A,(BOARD+6) + LD C,A + + LD A,(BOARD+5) + LD (BOARD+6),A + LD A,(BOARD+9) + LD (BOARD+5),A + LD A,(BOARD+10) + LD (BOARD+9),A + + LD A,C + LD (BOARD+10),A + + RET + +ADDPOINTS: + PUSH DE + PUSH HL + + LD E,A + LD D,0 + LD HL,POINTS + ADD HL,DE + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + + LD A,(SCORE+3) + ADD A,E + DAA + LD (SCORE+3),A + + LD A,(SCORE+2) + ADC A,D + DAA + LD (SCORE+2),A + + LD A,(SCORE+1) + ADC A,00H + DAA + LD (SCORE+1),A + + LD A,(SCORE) + ADC A,00H + DAA + LD (SCORE),A + + POP HL + POP DE + RET + +PRINTSCORE: + LD HL,SCORE + LD DE,SCORESTR+4 + LD B,4 + +P1 LD A,(HL) + RRA + RRA + RRA + RRA + AND 0FH + ADD A,30H + LD (DE),A + INC DE + + LD A,(HL) + AND 0FH + ADD A,30H + LD (DE),A + INC DE + + INC HL + DJNZ P1 + + LD HL,SCORESTR+4 + LD B,7 +P3 LD A,(HL) + CP 30H + JP NZ,P2 + LD A,20H + LD (HL),A + INC HL + DJNZ P3 + +P2 LD A,BOARD_X + ADD A,16H + DAA + LD (XPOS),A + LD A,BOARD_Y + SUB 02H + DAA + LD (YPOS),A + CALL GOTOXY + + LD DE,SCORESTR +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + RET + +DRAWBORDER: + LD A,BOARD_X + LD (XPOS),A + LD A,BOARD_Y + SUB 02H + DAA + LD (YPOS),A + CALL GOTOXY + + LD DE,MSG4 +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + + LD A,BOARD_X + SUB 01H + DAA + LD (XPOS),A + LD A,BOARD_Y + SUB 01H + DAA + LD (YPOS),A + CALL GOTOXY + + LD DE,TOPBORDER +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + + LD B,12 +L4 PUSH BC + LD A,(YPOS) + ADD A,1 + DAA + LD (YPOS),A + CALL GOTOXY +; LD C,02H + LD E,0DBH +; CALL BDOS + CALL COUTE + LD DE,ADVANCE +; LD C,09H +; CALL BDOS + CALL PRTSTRDE +; LD C,02H + LD E,0DBH +; CALL BDOS + CALL COUTE + POP BC + DEC B + JP NZ,L4 + + LD A,(YPOS) + ADD A,1 + DAA + LD (YPOS),A + CALL GOTOXY + LD DE,BTMBORDER +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + + RET + +DRAWBOARD: + CALL PRINTSCORE + + LD A,BOARD_X + LD (XPOS),A + LD A,BOARD_Y + SUB 01H + DAA + LD (YPOS),A + + LD HL,BOARD + LD B,4 +L1 PUSH BC + + PUSH HL + LD A,(YPOS) + ADD A,1 + DAA + LD (YPOS),A + CALL GOTOXY + POP HL + + PUSH HL + LD E,(HL) + CALL PRINTSPACE + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTSPACE + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTSPACE + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTSPACE + CALL NEWLINE + POP HL + + DEC HL + DEC HL + DEC HL + + PUSH HL + LD A,(YPOS) + ADD A,1 + DAA + LD (YPOS),A + CALL GOTOXY + POP HL + + PUSH HL + LD E,(HL) + CALL PRINTLABEL + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTLABEL + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTLABEL + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTLABEL + CALL NEWLINE + POP HL + + DEC HL + DEC HL + DEC HL + + PUSH HL + LD A,(YPOS) + ADD A,1 + DAA + LD (YPOS),A + CALL GOTOXY + POP HL + + PUSH HL + LD E,(HL) + CALL PRINTSPACE + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTSPACE + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTSPACE + POP HL + INC HL + PUSH HL + LD E,(HL) + CALL PRINTSPACE + CALL NEWLINE + POP HL + + INC HL + + POP BC + DEC B + JP NZ,L1 + + RET + +PRINTSPACE: + LD D,0 + + PUSH DE + LD HL,COLORPTR + ADD HL,DE + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + POP DE + + LD DE,SPACER +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + + RET + +PRINTLABEL: + LD D,0 + + PUSH DE + LD HL,COLORPTR + ADD HL,DE + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + POP DE + + PUSH DE + LD HL,LABELPTR + ADD HL,DE + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) +; LD C,09H +; CALL BDOS + CALL PRTSTRDE + POP DE + + RET + +GOTOXY: +; LD C,02H + LD E,1BH +; CALL BDOS + CALL COUTE +; LD C,02H + LD E,'[' +; CALL BDOS + CALL COUTE + + LD A,(YPOS) + CP 10H + JP C,L2 + + RRA + RRA + RRA + RRA + AND 0FH + ADD A,'0' + +; LD C,02H + LD E,A +; CALL BDOS + CALL COUTE + + LD A,(YPOS) + +L2 AND 0FH + ADD A,'0' + +; LD C,02H + LD E,A +; CALL BDOS + CALL COUTE + +; LD C,02H + LD E,3BH +; CALL BDOS + CALL COUTE + + LD A,(XPOS) + CP 10H + JP C,L3 + + RRA + RRA + RRA + RRA + AND 0FH + ADD A,'0' + +; LD C,02H + LD E,A +; CALL BDOS + CALL COUTE + + LD A,(XPOS) + +L3 AND 0FH + ADD A,'0' + +; LD C,02H + LD E,A +; CALL BDOS + CALL COUTE + +; LD C,02H + LD E,'H' +; CALL BDOS + CALL COUTE + + RET + +NEWLINE: + +; LD C,02H + LD E,CR +; CALL BDOS + CALL COUTE + +; LD C,02H + LD E,LF +; CALL BDOS + CALL COUTE + + RET + +RAND16 LD DE,0 + LD A,D + LD H,E + LD L,253 + OR A + SBC HL,DE + SBC A,0 + SBC HL,DE + LD D,0 + SBC A,D + LD E,A + SBC HL,DE + JR NC,RAND + INC HL +RAND LD (RAND16+1),HL + RET + +DIV16: + LD A,H ; HL = HL % DE + LD C,L + LD HL,0 + LD B,16 + +DL1 SCF + RL C + RLA + ADC HL,HL + SBC HL,DE + JR NC,$+4 + ADD HL,DE + DEC C + DJNZ DL1 + + LD D,A ; DE = HL / DE + LD E,C + RET + +SPACER .DB " ", '$' + +LABELPTR: .DW LABELS + .DW LABELS + 8 + .DW LABELS + 16 + .DW LABELS + 24 + .DW LABELS + 32 + .DW LABELS + 40 + .DW LABELS + 48 + .DW LABELS + 56 + .DW LABELS + 64 + .DW LABELS + 72 + .DW LABELS + 80 + .DW LABELS + 88 + .DW LABELS + 96 + .DW LABELS + 104 + +LABELS .DB " ", EOS + .DB " 2 ", EOS + .DB " 4 ", EOS + .DB " 8 ", EOS + .DB " 16 ", EOS + .DB " 32 ", EOS + .DB " 64 ", EOS + .DB " 128 ", EOS + .DB " 256 ", EOS + .DB " 512 ", EOS + .DB " 1024 ", EOS + .DB " 2048 ", EOS + .DB " 4096 ", EOS + .DB " 8192 ", EOS + +COLORPTR: .DW COLORS + .DW COLORS + 9 + .DW COLORS + 18 + .DW COLORS + 27 + .DW COLORS + 36 + .DW COLORS + 45 + .DW COLORS + 54 + .DW COLORS + 63 + .DW COLORS + 72 + .DW COLORS + 81 + .DW COLORS + 90 + .DW COLORS + 99 + .DW COLORS + 108 + .DW COLORS + 117 + +COLORS .DB 1BH, "[40;37m", EOS ; 0 + .DB 1BH, "[44;37m", EOS ; 2 + .DB 1BH, "[46;37m", EOS ; 4 + .DB 1BH, "[42;37m", EOS ; 8 + .DB 1BH, "[43;30m", EOS ; 16 + .DB 1BH, "[45;37m", EOS ; 32 + .DB 1BH, "[41;37m", EOS ; 64 + .DB 1BH, "[47;30m", EOS ; 128 + .DB 1BH, "[44;37m", EOS ; 256 + .DB 1BH, "[46;37m", EOS ; 512 + .DB 1BH, "[42;37m", EOS ; 1024 + .DB 1BH, "[43;30m", EOS ; 2048 + .DB 1BH, "[45;37m", EOS ; 4096 + .DB 1BH, "[41;37m", EOS ; 8192 + +POINTS .DW 0000H + .DW 0000H + .DW 0004H + .DW 0008H + .DW 0016H + .DW 0032H + .DW 0064H + .DW 0128H + .DW 0256H + .DW 0512H + .DW 1024H + .DW 2048H + .DW 4096H + .DW 8192H + +INIT: .DB 1BH, "[2J", EOS +TERM: .DB 1BH, "[?25h" +RESET: .DB 1BH, "[0m", EOS + +ADVANCE: .DB 1BH, "[28C", EOS + +TOPBORDER: + .DB 1BH, "[47;37m" + .DB 0DCH + .DB 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH + .DB 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH + .DB 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH + .DB 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH, 0DCH + .DB 0DCH, EOS + +BTMBORDER .DB 0DFH + .DB 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH + .DB 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH + .DB 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH + .DB 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH, 0DFH + .DB 0DFH, 1BH, "[0m", EOS + +MSG1: .DB 1BH, "[0m" + .DB "UDLR = wsad ^E^X^S^D 8246 : Q=QUIT" + + .DB EOS +MSG2: .DB 1BH, "[0m" + .DB " QUIT or RESTART (y/n/r) " + .DB EOS +MSG3: .DB 1BH, "[0m" + .DB " GAME OVER! PLAY AGAIN (y/n) " + .DB BEL, CR, LF, EOS +MSG4: .DB 1BH, "[0m" + .DB "2048 pts" + .DB EOS + +; HBIOS functions replacing BDOS functions +; +; +; PRINT A STRING AT ADDRESS SPECIFIED IN DE +; STRING MUST BE TERMINATED BY '$' +; +PRTSTRDE: + PUSH HL + LD H,D + LD L,E + CALL PRTSTR + POP HL + RET +; +; PRINT A STRING AT ADDRESS SPECIFIED IN HL +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; LD HL,MYSTR +; CALL PRTSTR +; ... +; MYSTR: .DB "HELLO$" +; +PRTSTR: + LD A,(HL) + INC HL + CP '$' + RET Z + CALL COUT + JR PRTSTR +; +; OUTPUT CHARACTER IN A TO CONSOLE DEVICE +; +COUT: PUSH AF + PUSH BC + PUSH DE + LD B,01H + LD C,0 + LD E,A + RST 08 + POP DE + POP BC + POP AF + RET +; +; OUTPUT CHARACTER IN A TO CONSOLE DEVICE +; +COUTE: PUSH AF + LD A,E + CALL COUT + POP AF + RET +; +; WAIT FOR A CHARACTER FROM THE CONSOLE DEVICE AND RETURN IT IN A +; +CIN: PUSH BC + LD B,00H + LD C,00H + RST 08 + LD A,E + POP BC + RET + +; variables + +BOARD: + .DB 00, 00, 00, 00 + .DB 00, 00, 00, 00 + .DB 00, 00, 00, 00 + .DB 00, 00, 00, 00 + +XPOS: .DB 0 +YPOS: .DB 0 +BOARDPTR: .DW 0 +MOVED: .DB 0 +RESULT: .DB 0 +SCORE .DB 00H, 00H, 00H, 00H +VAREND .EQU $ +SCORESTR .DB 1BH, "[0m $" + +LASTBYTE .EQU $ + +SLACK .EQU (GAM_END - LASTBYTE) + .FILL SLACK,'e' +; + .ECHO "GAME space remaining: " + .ECHO SLACK + .ECHO " bytes.\n" + + .END + diff --git a/Source/HBIOS/hbios.asm b/Source/HBIOS/hbios.asm index 7e879f51..fa3d5471 100644 --- a/Source/HBIOS/hbios.asm +++ b/Source/HBIOS/hbios.asm @@ -775,6 +775,7 @@ HB_START: ; MASK OFF TIMER INTERRUPTS XOR A OUT0 (Z180_TCR),A + OUT0 (Z180_ITC),A ; SET DEFAULT CPU CLOCK MULTIPLIERS (XTAL / 2) ; @@ -905,7 +906,7 @@ HB_START1: ; BNKCALL ARRIVES HERE, BUT NOW RUNNING IN RAM BANK LD ($0039),HL #ELSE ; RETI ($ED, $4D) IF NON-INTERRUPT MODE - LD HL,($0038) + LD HL,$0038 LD (HL),$ED INC HL LD (HL),$4D diff --git a/Source/HBIOS/ide.asm b/Source/HBIOS/ide.asm index c9149ca7..b2f771f3 100644 --- a/Source/HBIOS/ide.asm +++ b/Source/HBIOS/ide.asm @@ -4,9 +4,20 @@ ;============================================================================= ; ; TODO: -; - IMPLEMENT IDE_INITDEVICE -; - HANDLE SECONDARY INTERFACE ON DIDE -; - IMPLEMENT INTELLIGENT RESET, CHECK IF DEVICE IS ACTUALLY BROKEN BEFORE RESET +; - FIX SCALER CONSTANT +; - GOPARTNER NEEDS TO HANDLE "NO PARTNER" CONDITION +; - IMPLEMENT H/W PROBES FOR DIO AND DIDE +; +; NOTES: +; - WELL KNOWN IDE PORT ADDRESSES: +; BOARD BASE DATLO DATHI +; ------ ------ ------ ------ +; DIO $20 $20 $28 +; DIDE-A $20 $28 $28 +; DIDE-B $30 $38 $38 +; MK4 $80 N/A N/A +; RC $10 N/A N/A +; SMB $E0 N/A N/A ; ; +-----------------------------------------------------------------------+ ; | CONTROL BLOCK REGISTERS | @@ -100,77 +111,31 @@ #DEFINE DCALL \; #ENDIF ; -; UNIT MAPPING IS AS FOLLOWS: -; IDE0: PRIMARY MASTER -; IDE1: PRIMARY SLAVE -; IDE2: SECONDARY MASTER -; IDE3: SECONDARY SLAVE -; -IDE_DEVCNT .EQU 2 ; ASSUME ONLY PRIMARY INTERFACE -IDE_IO_BASE .EQU $20 ; DEFAULT IO BASE (NOTE OVERRIDES BELOW) -; -#IF (IDEMODE == IDEMODE_MK4) -IDE_IO_BASE .SET $80 -IDE_XAR .EQU $88 ; EXTERNAL ADDRESS REGISTER (XAR)#ENDIF -#ENDIF - -#IF (IDEMODE == IDEMODE_RC) -IDE_IO_BASE .SET $10 -#ENDIF - -#IF (IDEMODE == IDEMODE_SMB) -IDE_IO_BASE .SET $E0 -#ENDIF - -#IF ((IDEMODE == IDEMODE_DIO) | (IDEMODE == IDEMODE_MK4)) -#IF (IDE8BIT) -IDE_IO_DATA .EQU $IDE_IO_BASE + $00 ; DATA PORT (8 BIT PIO) (R/W) -#ELSE -IDE_IO_DATALO .EQU $IDE_IO_BASE + $00 ; DATA PORT (16 BIT PIO LO BYTE) (R/W) -IDE_IO_DATAHI .EQU $IDE_IO_BASE + $08 ; DATA PORT (16 BIT PIO HI BYTE) (R/W) -IDE_IO_DATA .EQU IDE_IO_DATALO -#ENDIF -#ENDIF -; -#IF (IDEMODE == IDEMODE_DIDE) -IDE_DEVCNT .SET 4 ; DIDE HAS PRIMARY AND SECONDARY INTERACES -#IF (IDE8BIT) -IDE_IO_DATA .EQU $IDE_IO_BASE + $00 ; DATA PORT (8 BIT PIO) (R/W) -#ELSE -IDE_IO_DATA .EQU $IDE_IO_BASE + $08 ; DATA PORT (16 BIT PIO LO/HI BYTES) (R/W) -IDE_IO_DMA .EQU $IDE_IO_BASE + $09 ; DATA PORT (16 BIT DMA LO/HI BYTES) (R/W) -#ENDIF -#ENDIF -; -#IF ((IDEMODE == IDEMODE_RC) | (IDEMODE == IDEMODE_SMB)) -IDE_DEVCNT .SET 1 ; RC2014 COMPACT FLASH SUPPORTS ONLY 1 DEVICE -IDE_IO_DATA .EQU $IDE_IO_BASE + $00 ; DATA PORT (8 BIT) (R/W) -#ENDIF -; -;IDE_IO_DATA .EQU $IDE_IO_BASE + $00 ; DATA INPUT/OUTPUT (R/W) -IDE_IO_ERR .EQU $IDE_IO_BASE + $01 ; ERROR REGISTER (R) -IDE_IO_FEAT .EQU $IDE_IO_BASE + $01 ; FEATURES REGISTER (W) -IDE_IO_COUNT .EQU $IDE_IO_BASE + $02 ; SECTOR COUNT REGISTER (R/W) -IDE_IO_SECT .EQU $IDE_IO_BASE + $03 ; SECTOR NUMBER REGISTER (R/W) -IDE_IO_CYLLO .EQU $IDE_IO_BASE + $04 ; CYLINDER NUM REGISTER (LSB) (R/W) -IDE_IO_CYLHI .EQU $IDE_IO_BASE + $05 ; CYLINDER NUM REGISTER (MSB) (R/W) -IDE_IO_DRVHD .EQU $IDE_IO_BASE + $06 ; DRIVE/HEAD REGISTER (R/W) -IDE_IO_LBA0 .EQU $IDE_IO_BASE + $03 ; LBA BYTE 0 (BITS 0-7) (R/W) -IDE_IO_LBA1 .EQU $IDE_IO_BASE + $03 ; LBA BYTE 1 (BITS 8-15) (R/W) -IDE_IO_LBA2 .EQU $IDE_IO_BASE + $03 ; LBA BYTE 2 (BITS 16-23) (R/W) -IDE_IO_LBA3 .EQU $IDE_IO_BASE + $03 ; LBA BYTE 3 (BITS 24-27) (R/W) -IDE_IO_STAT .EQU $IDE_IO_BASE + $07 ; STATUS REGISTER (R) -IDE_IO_CMD .EQU $IDE_IO_BASE + $07 ; COMMAND REGISTER (EXECUTE) (W) -IDE_IO_ALTSTAT .EQU $IDE_IO_BASE + $0E ; ALTERNATE STATUS REGISTER (R) -IDE_IO_CTRL .EQU $IDE_IO_BASE + $0E ; DEVICE CONTROL REGISTER (W) -IDE_IO_DRVADR .EQU $IDE_IO_BASE + $0F ; DRIVE ADDRESS REGISTER (R) +IDE_REG_DATA .EQU $00 ; DATA /OUTPUT (R/W) +IDE_REG_ERR .EQU $01 ; ERROR REGISTER (R) +IDE_REG_FEAT .EQU $01 ; FEATURES REGISTER (W) +IDE_REG_COUNT .EQU $02 ; SECTOR COUNT REGISTER (R/W) +IDE_REG_SECT .EQU $03 ; SECTOR NUMBER REGISTER (R/W) +IDE_REG_CYLLO .EQU $04 ; CYLINDER NUM REGISTER (LSB) (R/W) +IDE_REG_CYLHI .EQU $05 ; CYLINDER NUM REGISTER (MSB) (R/W) +IDE_REG_DRVHD .EQU $06 ; DRIVE/HEAD REGISTER (R/W) +IDE_REG_LBA0 .EQU $03 ; LBA BYTE 0 (BITS 0-7) (R/W) +IDE_REG_LBA1 .EQU $04 ; LBA BYTE 1 (BITS 8-15) (R/W) +IDE_REG_LBA2 .EQU $05 ; LBA BYTE 2 (BITS 16-23) (R/W) +IDE_REG_LBA3 .EQU $06 ; LBA BYTE 3 (BITS 24-27) (R/W) +IDE_REG_STAT .EQU $07 ; STATUS REGISTER (R) +IDE_REG_CMD .EQU $07 ; COMMAND REGISTER (EXECUTE) (W) +IDE_REG_XAR .EQU $08 ; ECB DIDE EXTERNAL ADDRESS REGISTER (W) +IDE_REG_ALTSTAT .EQU $0E ; ALTERNATE STATUS REGISTER (R) +IDE_REG_CTRL .EQU $0E ; DEVICE CONTROL REGISTER (W) +IDE_REG_DRVADR .EQU $0F ; DRIVE ADDRESS REGISTER (R) ; ; COMMAND BYTES ; -IDE_CIDE_RECAL .EQU $10 -IDE_CIDE_READ .EQU $20 -IDE_CIDE_WRITE .EQU $30 -IDE_CIDE_IDDEV .EQU $EC +IDE_CIDE_RECAL .EQU $10 +IDE_CIDE_READ .EQU $20 +IDE_CIDE_WRITE .EQU $30 +IDE_CIDE_IDDEV .EQU $EC IDE_CIDE_SETFEAT .EQU $EF ; ; FEATURE BYTES @@ -197,57 +162,130 @@ IDE_STBSYTO .EQU -7 ; ; DRIVE SELECTION BYTES (FOR USE IN DRIVE/HEAD REGISTER) ; -IDE_DRVSEL: -IDE_DRVMASTER .DB %11100000 ; LBA, MASTER DEVICE -IDE_DRVSLAVE .DB %11110000 ; LBA, SLAVE DEVICE +;IDE_DRVSEL: +IDE_DRVMASTER .EQU %11100000 ; LBA, MASTER DEVICE +IDE_DRVSLAVE .EQU %11110000 ; LBA, SLAVE DEVICE ; ; IDE DEVICE CONFIGURATION ; -IDE_CFGSIZ .EQU 12 ; SIZE OF CFG TBL ENTRIES +IDE_CFGSIZ .EQU 19 ; SIZE OF CFG TBL ENTRIES ; ; PER DEVICE DATA OFFSETS ; IDE_DEV .EQU 0 ; OFFSET OF DEVICE NUMBER (BYTE) -IDE_STAT .EQU 1 ; LAST STATUS (BYTE) -IDE_TYPE .EQU 2 ; DEVICE TYPE (BYTE) -IDE_FLAGS .EQU 3 ; FLAG BITS BIT 0=CF, 1=LBA (BYTE) -IDE_MEDCAP .EQU 4 ; MEDIA CAPACITY (DWORD) -IDE_LBA .EQU 8 ; OFFSET OF LBA (DWORD) +IDE_MODE .EQU 1 ; OPERATION MODE: IDE MODE (BYTE) +IDE_STAT .EQU 2 ; LAST STATUS (BYTE) +IDE_TYPE .EQU 3 ; DEVICE TYPE (BYTE) +IDE_ACC .EQU 4 ; ACCESS FLAG BITS BIT 0=MASTER, 1=8BIT (BYTE) +IDE_MED .EQU 5 ; MEDIA FLAG BITS BIT 0=CF, 1=LBA (BYTE) +IDE_MEDCAP .EQU 6 ; MEDIA CAPACITY (DWORD) +IDE_LBA .EQU 10 ; OFFSET OF LBA (DWORD) +IDE_IOBASE .EQU 14 ; IO BASE ADDRESS (BYTE) +IDE_DATALO .EQU 15 ; 16 BIT DATA LO BYTE +IDE_DATAHI .EQU 16 ; 16 BIT DATA HI BYTE +IDE_PARTNER .EQU 17 ; PARTNER DEVICE (MASTER <-> SLAVE) (WORD) +; +IDE_ACC_MAS .EQU %00000001 ; UNIT IS MASTER (ELSE SLAVE) +IDE_ACC_8BIT .EQU %00000010 ; UNIT WANTS 8 BIT I/O (ELSE 16 BIT) +; +IDE_MED_CF .EQU %00000001 ; MEDIA IS CF CARD +IDE_MED_LBA .EQU %00000010 ; MEDIA HAS LBA CAPABILITY +; +IDE_DEVCNT .EQU IDECNT * 2 ; IDE_CFGTBL: - ; DEVICE 0, PRIMARY MASTER +; +#IF (IDECNT >= 1) +; +IDE_DEV0M: ; DEVICE 0, MASTER .DB 0 ; DRIVER DEVICE NUMBER + .DB IDE0MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE - .DB 0 ; FLAGS BYTE + .DB IDE_ACC_MAS | (IDE0A8BIT & IDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS .DW 0,0 ; DEVICE CAPACITY .DW 0,0 ; CURRENT LBA -#IF (IDE_DEVCNT >= 2) - ; DEVICE 1, PRIMARY SLAVE - .DB 1 ; DRIVER DEVICE NUMBER + .DB IDE0BASE ; IO BASE ADDRESS + .DB IDE0DATLO ; IO BASE ADDRESS + .DB IDE0DATHI ; IO BASE ADDRESS + .DW IDE_DEV0S ; PARTNER +; +IDE_DEV0S: ; DEVICE 0, SLAVE + .DB 0 ; DRIVER DEVICE NUMBER + .DB IDE0MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE - .DB 0 ; FLAGS BYTE + .DB (IDE0B8BIT & IDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS .DW 0,0 ; DEVICE CAPACITY .DW 0,0 ; CURRENT LBA + .DB IDE0BASE ; IO BASE ADDRESS + .DB IDE0DATLO ; IO BASE ADDRESS + .DB IDE0DATHI ; IO BASE ADDRESS + .DW IDE_DEV0M ; PARTNER #ENDIF -#IF (IDE_DEVCNT >= 3) - ; DEVICE 2, SECONDARY MASTER - .DB 2 ; DRIVER DEVICE NUMBER +; +#IF (IDECNT >= 2) +; +IDE_DEV1M: ; DEVICE 1, MASTER + .DB 0 ; DRIVER DEVICE NUMBER + .DB IDE1MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE - .DB 0 ; FLAGS BYTE + .DB IDE_ACC_MAS | (IDE1A8BIT & IDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS .DW 0,0 ; DEVICE CAPACITY .DW 0,0 ; CURRENT LBA + .DB IDE1BASE ; IO BASE ADDRESS + .DB IDE1DATLO ; IO BASE ADDRESS + .DB IDE1DATHI ; IO BASE ADDRESS + .DW IDE_DEV1S ; PARTNER +; +IDE_DEV1S: ; DEVICE 1, SLAVE + .DB 0 ; DRIVER DEVICE NUMBER + .DB IDE1MODE ; DRIVER DEVICE MODE + .DB 0 ; DEVICE STATUS + .DB 0 ; DEVICE TYPE + .DB (IDE1B8BIT & IDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS + .DW 0,0 ; DEVICE CAPACITY + .DW 0,0 ; CURRENT LBA + .DB IDE1BASE ; IO BASE ADDRESS + .DB IDE1DATLO ; IO BASE ADDRESS + .DB IDE1DATHI ; IO BASE ADDRESS + .DW IDE_DEV1M ; PARTNER #ENDIF -#IF (IDE_DEVCNT >= 4) - ; DEVICE 2, SECONDARY SLAVE - .DB 3 ; DRIVER DEVICE NUMBER +; +#IF (IDECNT >= 3) +; +IDE_DEV2M: ; DEVICE 2, MASTER + .DB 0 ; DRIVER DEVICE NUMBER + .DB IDE2MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE - .DB 0 ; FLAGS BYTE + .DB IDE_ACC_MAS | (IDE2A8BIT & IDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS .DW 0,0 ; DEVICE CAPACITY .DW 0,0 ; CURRENT LBA + .DB IDE2BASE ; IO BASE ADDRESS + .DB IDE2DATLO ; IO BASE ADDRESS + .DB IDE2DATHI ; IO BASE ADDRESS + .DW IDE_DEV2S ; PARTNER +; +IDE_DEV2S: ; DEVICE 2, SLAVE + .DB 0 ; DRIVER DEVICE NUMBER + .DB IDE2MODE ; DRIVER DEVICE MODE + .DB 0 ; DEVICE STATUS + .DB 0 ; DEVICE TYPE + .DB (IDE2B8BIT & IDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS + .DW 0,0 ; DEVICE CAPACITY + .DW 0,0 ; CURRENT LBA + .DB IDE2BASE ; IO BASE ADDRESS + .DB IDE2DATLO ; IO BASE ADDRESS + .DB IDE2DATHI ; IO BASE ADDRESS + .DW IDE_DEV1M ; PARTNER #ENDIF ; #IF ($ - IDE_CFGTBL) != (IDE_DEVCNT * IDE_CFGSIZ) @@ -273,78 +311,87 @@ IDE_TOFAST .EQU 10 ; FAST TIMEOUT IS 0.5 SECS ;============================================================================= ; IDE_INIT: - CALL NEWLINE ; FORMATTING - PRTS("IDE:$") -; ; COMPUTE CPU SPEED COMPENSATED TIMEOUT SCALER - ; AT 1MHZ, THE SCALER IS 961 (50000US / 52TS = 961) - ; SCALER IS THEREFORE 961 * CPU SPEED IN MHZ + ; AT 1MHZ, THE SCALER IS 218 (50000US / 229TS = 218) + ; SCALER IS THEREFORE 218 * CPU SPEED IN MHZ LD DE,961 ; LOAD SCALER FOR 1MHZ LD A,(CB_CPUMHZ) ; LOAD CPU SPEED IN MHZ CALL MULT8X16 ; HL := DE * A LD (IDE_TOSCALER),HL ; SAVE IT ; -#IF (IDEMODE == IDEMODE_DIO) - PRTS(" MODE=DIO$") -#ENDIF -#IF (IDEMODE == IDEMODE_DIDE) - PRTS(" MODE=DIDE$") -#ENDIF -#IF (IDEMODE == IDEMODE_MK4) - PRTS(" MODE=MK4$") -#ENDIF - ; PRINT IDE INTERFACE PORT ADDRESS - PRTS(" IO=0x$") ; LABEL FOR IO ADDRESS - LD A,IDE_IO_DATA ; GET IO ADDRESS - CALL PRTHEXBYTE ; PRINT IT -; + XOR A ; ZERO ACCUM + LD (IDE_DEVNUM),A ; INIT DEV UNIT NUM FOR DYNAMIC ASSIGNMENT + LD IY,IDE_CFGTBL ; POINT TO START OF CONFIG TABLE ; - CALL IDE_DETECT ; CHECK FOR HARDWARE - JR Z,IDE_INIT00 ; CONTINUE IF PRESENT -; - ; HARDWARE NOT PRESENT - PRTS(" NOT PRESENT$") - OR $FF ; SIGNAL FAILURE - RET +IDE_INIT1: + LD A,(IY) ; LOAD FIRST BYTE TO CHECK FOR END + CP $FF ; CHECK FOR END OF TABLE VALUE + JR NZ,IDE_INIT2 ; IF NOT END OF TABLE, CONTINUE + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN ; -IDE_INIT00: - ; PRINT UNIT COUNT - PRTS(" DEVICES=$") ; PRINT LABEL FOR DEVICE COUNT - LD A,IDE_DEVCNT ; GET UNIT COUNT - CALL PRTDECB ; PRINT IT IN DECIMAL +IDE_INIT2: + BIT 0,(IY+IDE_ACC) ; MASTER? + JR Z,IDE_INIT4 ; IF NOT MASTER, SKIP AHEAD ; -; SETUP THE DISPATCH TABLE ENTRIES + CALL NEWLINE ; FORMATTING + PRTS("IDE:$") ; LABEL FOR IO ADDRESS ; - LD B,IDE_DEVCNT ; LOOP CONTROL - LD IY,IDE_CFGTBL ; START OF CFG TABLE -IDE_INIT0: - PUSH BC ; SAVE LOOP CONTROL + PRTS(" IO=0x$") ; LABEL FOR IO ADDRESS + LD A,(IY+IDE_IOBASE) ; GET IO BASE ADDRES + CALL PRTHEXBYTE ; DISPLAY IT +; + PRTS(" MODE=$") ; LABEL FOR MODE + LD A,(IY+IDE_MODE) ; GET MODE BITS + LD DE,IDE_STR_MODE_DIO ; MODE LABEL + CP IDEMODE_DIO ; TEST FOR MODE + JR Z,IDE_INIT2A ; IF SO, DISPLAY IT + LD DE,IDE_STR_MODE_DIDE ; MODE LABEL + CP IDEMODE_DIDE ; TEST FOR MODE + JR Z,IDE_INIT2A ; IF SO, DISPLAY IT + LD DE,IDE_STR_MODE_MK4 ; MODE LABEL + CP IDEMODE_MK4 ; TEST FOR MODE + JR Z,IDE_INIT2A ; IF SO, DISPLAY IT + LD DE,IDE_STR_MODE_RC ; MODE LABEL + CP IDEMODE_RC ; TEST FOR MODE + JR Z,IDE_INIT2A ; IF SO, DISPLAY IT + JR IDE_INIT4 ; NO MODE? BYPASS ENTRY +IDE_INIT2A: + CALL WRITESTR ; DISPLAY MODE +; + CALL IDE_DETECT ; PROBE FOR INTERFACE + JR Z,IDE_INIT3 ; GOT IT, MOVE ON TO INIT UNITS + CALL PC_SPACE ; FORMATTING + LD DE,IDE_STR_NOHW ; NOT PRESENT MESSAGE + CALL WRITESTR ; DISPLAY IT + JR IDE_INIT4 ; SKIP CFG ENTRY +; +IDE_INIT3: + CALL IDE_RESET ; RESET THE BUS + CALL IDE_INIT5 ; DETECT/INIT MASTER + PUSH IY ; SAVE CFG PTR + CALL IDE_GOPARTNER ; SWITCH IY TO PARTNER CFG + CALL IDE_INIT5 ; DETECT/INIT SLAVE + POP IY ; RESTORE CFG PTR +; +IDE_INIT4: + LD DE,IDE_CFGSIZ ; SIZE OF CFG TABLE ENTRY + ADD IY,DE ; BUMP POINTER + JP IDE_INIT1 ; AND LOOP +; +IDE_INIT5: + ; UPDATE DRIVER RELATIVE UNIT NUMBER IN CONFIG TABLE + LD A,(IDE_DEVNUM) ; GET NEXT UNIT NUM TO ASSIGN + LD (IY+IDE_DEV),A ; UPDATE IT + INC A ; BUMP TO NEXT UNIT NUM TO ASSIGN + LD (IDE_DEVNUM),A ; SAVE IT +; + ; ADD UNIT TO GLOBAL DISK UNIT TABLE LD BC,IDE_FNTBL ; BC := FUNC TABLE ADR PUSH IY ; CFG ENTRY POINTER POP DE ; COPY TO DE - CALL DIO_ADDENT ; ADD ENTRY, BC IS NOT DESTROYED - LD BC,IDE_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,BC ; BUMP IY TO NEXT ENTRY - POP BC ; RESTORE BC - DJNZ IDE_INIT0 ; LOOP AS NEEDED -; - ; INITIALIZE THE IDE INTERFACE NOW - CALL IDE_RESET ; DO HARDWARE SETUP/INIT - RET NZ ; ABORT IF RESET FAILS -; - ; DEVICE DISPLAY LOOP - LD B,IDE_DEVCNT ; LOOP ONCE PER DEVICE - LD IY,IDE_CFGTBL ; START OF CFG TABLE -IDE_INIT1: - PUSH BC ; SAVE LOOP CONTROL - CALL IDE_INIT2 ; DISPLAY UNIT INFO - LD BC,IDE_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,BC ; BUMP IY TO NEXT ENTRY - POP BC ; RESTORE LOOP CONTROL - DJNZ IDE_INIT1 ; LOOP UNTIL DONE - RET ; DONE + CALL DIO_ADDENT ; ADD ENTRY TO GLOBAL DISK DEV TABLE ; -IDE_INIT2: ; CHECK FOR BAD STATUS LD A,(IY+IDE_STAT) ; GET STATUS OR A ; SET FLAGS @@ -352,13 +399,13 @@ IDE_INIT2: ; CALL IDE_PRTPREFIX ; PRINT DEVICE PREFIX ; -#IF (IDE8BIT) - PRTS(" 8BIT$") -#ENDIF + LD DE,IDE_STR_8BIT + BIT 1,(IY+IDE_ACC) ; 8 BIT ACCESS? + CALL NZ,WRITESTR ; ; PRINT LBA/NOLBA CALL PC_SPACE ; FORMATTING - BIT 1,(IY+IDE_FLAGS) ; TEST LBA FLAG + BIT 1,(IY+IDE_MED) ; TEST LBA FLAG LD DE,IDE_STR_NO ; POINT TO "NO" STRING CALL Z,WRITESTR ; PRINT "NO" BEFORE "LBA" IF LBA NOT SUPPORTED PRTS("LBA$") ; PRINT "LBA" REGARDLESS @@ -377,8 +424,7 @@ IDE_INIT2: CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) PRTS("MB$") ; PRINT SUFFIX ; - XOR A ; SIGNAL SUCCESS - RET ; RETURN WITH A=0, AND Z SET + RET ; ;---------------------------------------------------------------------- ; PROBE FOR IDE HARDWARE @@ -388,8 +434,11 @@ IDE_INIT2: ; IDE_DETECT: ; -#IF (IDEMODE == IDEMODE_DIDE) -#ENDIF +;#IF (IDEMODE == IDEMODE_DIDE) +;#ENDIF +;; +;#IF (IDEMODE == IDEMODE_DIO) +;#ENDIF ; XOR A ; SIGNAL SUCCESS RET ; AND RETURN @@ -451,7 +500,7 @@ IDE_IO: #ENDIF PUSH BC ; SAVE COUNTERS CALL IDE_SELUNIT ; HARDWARE SELECTION OF TARGET UNIT - CALL IDE_CHKDEVICE ; CHECK DEVICE AND CLEAR STATUS + CALL IDE_CHKERR ; CHECK FOR ERR STATUS AND RESET IF SO POP BC ; RESTORE COUNTERS JR NZ,IDE_IO3 ; BAIL OUT ON ERROR IDE_IO1: @@ -492,7 +541,7 @@ IDE_STATUS: IDE_DEVICE: LD D,DIODEV_IDE ; D := DEVICE TYPE LD E,(IY+IDE_DEV) ; E := PHYSICAL DEVICE NUMBER - BIT 0,(IY+IDE_FLAGS) ; TEST CF BIT IN FLAGS + BIT 0,(IY+IDE_MED) ; TEST CF BIT IN FLAGS LD C,%00000000 ; ASSUME NON-REMOVABLE HARD DISK JR Z,IDE_DEVICE1 ; IF Z, WE ARE DONE LD C,%01001000 ; OTHERWISE REMOVABLE COMPACT FLASH @@ -582,11 +631,15 @@ IDE_SETFEAT: PRTS(" SETFEAT$") #ENDIF LD A,(IDE_DRVHD) - OUT (IDE_IO_DRVHD),A + ;OUT (IDE_IO_DRVHD),A + CALL IDE_OUT + .DB IDE_REG_DRVHD DCALL PC_SPACE DCALL PRTHEXBYTE POP AF - OUT (IDE_IO_FEAT),A ; SET THE FEATURE VALUE + ;OUT (IDE_IO_FEAT),A ; SET THE FEATURE VALUE + CALL IDE_OUT + .DB IDE_REG_FEAT DCALL PC_SPACE DCALL PRTHEXBYTE LD A,IDE_CIDE_SETFEAT ; CMD = SETFEAT @@ -601,7 +654,9 @@ IDE_IDENTIFY: PRTS(" IDDEV$") #ENDIF LD A,(IDE_DRVHD) - OUT (IDE_IO_DRVHD),A + ;OUT (IDE_IO_DRVHD),A + CALL IDE_OUT + .DB IDE_REG_DRVHD DCALL PC_SPACE DCALL PRTHEXBYTE LD A,IDE_CIDE_IDDEV @@ -620,7 +675,9 @@ IDE_RDSEC: PRTS(" READ$") #ENDIF LD A,(IDE_DRVHD) - OUT (IDE_IO_DRVHD),A + ;OUT (IDE_IO_DRVHD),A + CALL IDE_OUT + .DB IDE_REG_DRVHD DCALL PC_SPACE DCALL PRTHEXBYTE CALL IDE_SETADDR ; SETUP CYL, TRK, HEAD @@ -640,7 +697,9 @@ IDE_WRSEC: PRTS(" WRITE$") #ENDIF LD A,(IDE_DRVHD) - OUT (IDE_IO_DRVHD),A + ;OUT (IDE_IO_DRVHD),A + CALL IDE_OUT + .DB IDE_REG_DRVHD DCALL PC_SPACE DCALL PRTHEXBYTE CALL IDE_SETADDR ; SETUP CYL, TRK, HEAD @@ -657,33 +716,29 @@ IDE_SETADDR: ; SEND 3 LOWEST BYTES OF LBA IN REVERSE ORDER ; IDE_IO_LBA3 HAS ALREADY BEEN SET ; HSTLBA2-0 --> IDE_IO_LBA2-0 - LD C,IDE_IO_LBA0 + 3 ; STARTING IO PORT (NOT PRE-DEC BELOW) - LD A,IDE_LBA + 2 ; OFFSET OF 3RD BYTE OF LBA IN CFG - CALL LDHLIYA ; HL := IY + A, REG A TRASHED - LD B,3 ; SEND 3 BYTES -IDE_SETADDR1: -; -#IF (IDETRACE >= 3) - LD A,(HL) - CALL PC_SPACE - CALL PRTHEXBYTE -#ENDIF -; - DEC C ; NEXT PORT - OUTD ; SEND NEXT BYTE - JR NZ,IDE_SETADDR1 ; LOOP TILL DONE + LD A,(IY+IDE_LBA+2) + DCALL PC_SPACE + DCALL PRTHEXBYTE + CALL IDE_OUT + .DB IDE_REG_LBA2 ; - ; SEND COUNT OF BLOCKS TO TRANSFER - ; 1 --> IDE_IO_COUNT - LD A,1 ; COUNT VALUE IS 1 BLOCK + LD A,(IY+IDE_LBA+1) + DCALL PC_SPACE + DCALL PRTHEXBYTE + CALL IDE_OUT + .DB IDE_REG_LBA1 ; -#IF (IDETRACE >= 3) + LD A,(IY+IDE_LBA+0) DCALL PC_SPACE DCALL PRTHEXBYTE -#ENDIF + CALL IDE_OUT + .DB IDE_REG_LBA0 ; - DEC C ; PORT := IDE_IO_COUNT - OUT (C),A ; SEND IT + LD A,1 + DCALL PC_SPACE + DCALL PRTHEXBYTE + CALL IDE_OUT + .DB IDE_REG_COUNT ; #IF (DSKYENABLE) CALL IDE_DSKY @@ -702,7 +757,9 @@ IDE_RUNCMD: LD A,(IDE_CMD) ; GET THE COMMAND DCALL PC_SPACE DCALL PRTHEXBYTE - OUT (IDE_IO_CMD),A ; SEND IT (STARTS EXECUTION) + ;OUT (IDE_IO_CMD),A ; SEND IT (STARTS EXECUTION) + CALL IDE_OUT + .DB IDE_REG_CMD #IF (IDETRACE >= 3) PRTS(" -->$") #ENDIF @@ -720,79 +777,116 @@ IDE_GETBUF: #IF (IDETRACE >= 3) PRTS(" GETBUF$") #ENDIF - +; CALL IDE_WAITDRQ ; WAIT FOR BUFFER READY RET NZ ; BAIL OUT IF TIMEOUT - +; LD B,0 - -#IF (IDE8BIT | (IDEMODE == IDEMODE_DIDE)) - LD C,IDE_IO_DATA - INIR - INIR -;X1: -; NOP -; INI -; JR NZ,X1 -;X2: -; NOP -; INI -; JR NZ,X2 -#ELSE - LD C,IDE_IO_DATAHI +; + BIT 1,(IY+IDE_ACC) ; 8 BIT? + JR Z,IDE_GETBUF1 ; IF NOT, DO 16 BIT + CALL IDE_GETBUF8 ; DO 8 BIT + JR IDE_GETBUF2 +; IDE_GETBUF1: - IN A,(IDE_IO_DATALO) ; READ THE LO BYTE - LD (HL),A ; SAVE IN BUFFER - INC HL ; INC BUFFER POINTER - INI ; READ AND SAVE HI BYTE, INC HL, DEC B - JP NZ,IDE_GETBUF1 ; LOOP AS NEEDED -#ENDIF + CALL IDE_GETBUF16 +; +IDE_GETBUF2: CALL IDE_WAITRDY ; PROBLEMS IF THIS IS REMOVED! CALL IDE_GETRES JP NZ,IDE_IOERR RET ; +IDE_GETBUF8: + ; 8 BIT I/O + ;LD C,IDE_IO_DATA + LD C,(IY+IDE_IOBASE) + INIR + INIR + RET +; +IDE_GETBUF16: + ; 16 BIT I/O + ;LD C,IDE_IO_DATAHI + LD D,(IY+IDE_DATALO) + LD E,(IY+IDE_DATAHI) + CALL IDE_GETBUF16A ; GET FIRST 256 BYTES + CALL IDE_GETBUF16A ; GET SECOND 256 BYTES + RET +; +IDE_GETBUF16A: + LD C,D ; PORT FOR LSB + INI ; GET IT, SAVE IT, AND DEC B + LD C,E ; PORT FOR MSB + INI ; GET IT, SAVE IT, AND DEC B + JR NZ,IDE_GETBUF16A ; LOOP TILL COUNTER EXHAUSTED + RET +; ; ; IDE_PUTBUF: #IF (IDETRACE >= 3) - PRTS(" GETBUF$") + PRTS(" PUTBUF$") #ENDIF - +; CALL IDE_WAITDRQ ; WAIT FOR BUFFER READY RET NZ ; BAIL OUT IF TIMEOUT ; - ;LD HL,(IDE_DSKBUF) LD B,0 - -#IF (IDE8BIT | (IDEMODE == IDEMODE_DIDE)) - LD C,IDE_IO_DATA - OTIR - OTIR -#ELSE - LD C,IDE_IO_DATAHI +; + BIT 1,(IY+IDE_ACC) ; 8 BIT? + JR Z,IDE_PUTBUF1 ; IF NOT, DO 16 BIT + CALL IDE_PUTBUF8 ; DO 8 BIT + JR IDE_PUTBUF2 +; IDE_PUTBUF1: - LD A,(HL) ; GET THE LO BYTE AND KEEP IT IN A FOR LATER - INC HL ; BUMP TO NEXT BYTE IN BUFFER - OUTI ; WRITE HI BYTE, INC HL, DEC B - OUT (IDE_IO_DATALO),A ; NOW WRITE THE SAVED LO BYTE TO LO BYTE - JP NZ,IDE_PUTBUF1 ; LOOP AS NEEDED -#ENDIF + CALL IDE_PUTBUF16 +; +IDE_PUTBUF2: CALL IDE_WAITRDY ; PROBLEMS IF THIS IS REMOVED! CALL IDE_GETRES JP NZ,IDE_IOERR RET ; +IDE_PUTBUF8: + ; 8 BIT I/O + ;LD C,IDE_IO_DATA + LD C,(IY+IDE_IOBASE) + OTIR + OTIR + RET +; +IDE_PUTBUF16: + ; 16 BIT I/O + ;LD C,IDE_IO_DATAHI + LD D,(IY+IDE_DATALO) + LD E,(IY+IDE_DATAHI) + CALL IDE_PUTBUF16A ; PUT FIRST 256 BYTES + CALL IDE_PUTBUF16A ; PUT SECOND 256 BYTES + RET +; +IDE_PUTBUF16A: + LD C,D ; PORT FOR LSB + OUTI ; PUT IT AND DEC B + LD C,E ; PORT FOR MSB + OUTI ; PUT IT AND DEC B + JR NZ,IDE_PUTBUF16A ; LOOP TILL COUNTER EXHAUSTED + RET +; ; ; IDE_GETRES: - IN A,(IDE_IO_STAT) ; GET STATUS + ;IN A,(IDE_IO_STAT) ; GET STATUS + CALL IDE_IN + .DB IDE_REG_STAT DCALL PC_SPACE DCALL PRTHEXBYTE AND %00000001 ; ERROR BIT SET? RET Z ; NOPE, RETURN WITH ZF ; - IN A,(IDE_IO_ERR) ; READ ERROR REGISTER + ;IN A,(IDE_IO_ERR) ; READ ERROR REGISTER + CALL IDE_IN + .DB IDE_REG_ERR DCALL PC_SPACE DCALL PRTHEXBYTE OR $FF ; FORCE NZ TO SIGNAL ERROR @@ -805,44 +899,110 @@ IDE_GETRES: ; RESET ALL DEVICES ON BUS ; IDE_RESET: +#IF (IDETRACE >= 3) + CALL IDE_PRTPREFIX + PRTS(" RESET$") +#ENDIF +; +;#IF (IDEMODE == IDEMODE_MK4) +; + LD A,(IY+IDE_MODE) ; GET MODE + CP IDEMODE_MK4 ; MK4? + JR NZ,IDE_RESET1 ; IF NOT, BYPASS ; -#IF (IDEMODE == IDEMODE_MK4) ; USE HARDWARE RESET LINE +#IF (IDETRACE >= 3) + PRTS(" HARD$") +#ENDIF LD A,$80 ; HIGH BIT OF XAR IS IDE RESET - OUT (IDE_XAR),A + ;OUT (IDE_IO_XAR),A + CALL IDE_OUT + .DB IDE_REG_XAR LD DE,2 ; DELAY 32US (SPEC IS >= 25US) CALL VDELAY XOR A ; CLEAR RESET BIT - OUT (IDE_XAR),A -#ENDIF - -#IF ((IDEMODE == IDEMODE_RC) | (IDEMODE == IDEMODE_SMB)) + ;OUT (IDE_IO_XAR),A + CALL IDE_OUT + .DB IDE_REG_XAR +; +IDE_RESET1: +; +;#ENDIF +; +;#IF (IDEMODE == IDEMODE_RC) +; + LD A,(IY+IDE_MODE) ; GET MODE + CP IDEMODE_RC ; RC2014? + JR NZ,IDE_RESET2 ; IF NOT, BYPASS +; ; RC2014 CANNOT ADDRESS THE DEVICE CONTROL PORT AND ; HAS NO WAY TO PERFORM A HARD RESET FROM SOFTWARE, ; SO FAKE IT BY SETTING THE REGISTERS TO THE SAME ; VALUES THAT A RESET WOULD CAUSE. +#IF (IDETRACE >= 3) + PRTS(" FAKE$") +#ENDIF XOR A - OUT (IDE_IO_CYLLO),A - OUT (IDE_IO_CYLHI),A + ;OUT (IDE_IO_CYLLO),A + CALL IDE_OUT + .DB IDE_REG_CYLLO + ;OUT (IDE_IO_CYLHI),A + CALL IDE_OUT + .DB IDE_REG_CYLHI INC A - OUT (IDE_IO_COUNT),A - OUT (IDE_IO_SECT),A -#ENDIF - -#IF ((IDEMODE != IDEMODE_MK4) & (IDEMODE != IDEMODE_RC) & (IDEMODE != IDEMODE_SMB)) + ;OUT (IDE_IO_COUNT),A + CALL IDE_OUT + .DB IDE_REG_COUNT + ;OUT (IDE_IO_SECT),A + CALL IDE_OUT + .DB IDE_REG_SECT +; +IDE_RESET2: +; +;#ENDIF +; +;#IF ((IDEMODE != IDEMODE_MK4) & (IDEMODE != IDEMODE_RC)) +; + LD A,(IY+IDE_MODE) ; GET MODE + CP IDEMODE_MK4 ; MK4? + JR Z,IDE_RESET3 ; IF SO, BYPASS + CP IDEMODE_RC ; RC2014? + JR Z,IDE_RESET3 ; IF SO, BYPASS +; ; INITIATE SOFT RESET - LD A,%00001110 ; NO INTERRUPTS, ASSERT RESET BOTH DRIVES - OUT (IDE_IO_CTRL),A +#IF (IDETRACE >= 3) + PRTS(" SOFT$") #ENDIF + LD A,%00001110 ; NO INTERRUPTS, ASSERT RESET BOTH DRIVES + ;OUT (IDE_IO_CTRL),A + CALL IDE_OUT + .DB IDE_REG_CTRL +; +IDE_RESET3: +; +;#ENDIF ; LD DE,2 ; DELAY 32US (SPEC IS >= 25US) CALL VDELAY ; -#IF ((IDEMODE != IDEMODE_RC) & (IDEMODE != IDEMODE_SMB)) +;#IF (IDEMODE != IDEMODE_RC) +; + LD A,(IY+IDE_MODE) ; GET MODE + CP IDEMODE_RC ; RC2014? + JR Z,IDE_RESET4 ; IF SO, BYPASS +; ; CONFIGURE OPERATION AND END SOFT RESET - LD A,%00001010 ; NO INTERRUPTS, DEASSERT RESET - OUT (IDE_IO_CTRL),A ; PUSH TO REGISTER +#IF (IDETRACE >= 3) + PRTS(" CONFIG$") #ENDIF + LD A,%00001010 ; NO INTERRUPTS, DEASSERT RESET + ;OUT (IDE_IO_CTRL),A ; PUSH TO REGISTER + CALL IDE_OUT + .DB IDE_REG_CTRL +; +IDE_RESET4: +; +;#ENDIF ; ; SPEC ALLOWS UP TO 450MS FOR DEVICES TO ASSERT THEIR PRESENCE ; VIA -DASP. I ENCOUNTER PROBLEMS LATER ON IF I DON'T WAIT HERE @@ -854,28 +1014,16 @@ IDE_RESET: LD DE,150000/16 ; ~???MS CALL VDELAY ; - ;; CLEAR OUT ALL DATA (FOR ALL UNITS) - ;LD HL,IDE_UDATA - ;LD BC,IDE_UDLEN - ;XOR A - ;CALL FILL -; - ;LD A,(IDE_UNIT) ; GET THE CURRENT UNIT SELECTION - ;PUSH AF ; AND SAVE IT - PUSH IY ; SAVE CURRENT DEVICE CFG PTR - - ; PROBE / INITIALIZE ALL UNITS - LD B,IDE_DEVCNT ; NUMBER OF UNITS TO TRY - LD IY,IDE_CFGTBL ; START OF CFG TABLE -IDE_RESET1: - PUSH BC ; SAVE LOOP CONTROL - CALL IDE_INITUNIT ; PROBE/INIT UNIT - LD BC,IDE_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,BC ; BUMP IY TO NEXT ENTRY - POP BC ; RESTORE BC - DJNZ IDE_RESET1 ; LOOP AS NEEDED -; - POP IY ; RECOVER DEVICE CFG PTR + ; INITIALIZE THE INDIVIDUAL UNITS (MASTER AND SLAVE). + ; BASED ON TESTING, IT APPEARS THAT THE MASTER UNIT MUST + ; BE DONE FIRST OR THIS BEHAVES BADLY. + PUSH IY ; SAVE CFG PTR + BIT 0,(IY+IDE_ACC) ; MASTER? + CALL Z,IDE_GOPARTNER ; IF NOT, SWITCH TO MASTER + CALL IDE_INITUNIT ; INIT CURRENT UNIT + CALL IDE_GOPARTNER ; POINT TO SLAVE + CALL IDE_INITUNIT ; INIT PARTNER UNIT + POP IY ; RECOVER ORIG CFG PTR ; XOR A ; SIGNAL SUCCESS RET ; AND DONE @@ -886,19 +1034,14 @@ IDE_INITUNIT: CALL IDE_SELUNIT ; SELECT UNIT RET NZ ; ABORT IF ERROR - ;LD HL,IDE_TIMEOUT ; POINT TO TIMEOUT - ;LD (HL),IDE_TOFAST ; USE FAST TIMEOUT DURING INIT - LD HL,IDE_TIMEOUT ; POINT TO TIMEOUT LD (HL),IDE_TONORM ; SET NORMAL TIMEOUT CALL IDE_PROBE ; DO PROBE - CALL Z,IDE_INITDEV ; IF FOUND, ATTEMPT TO INIT DEVICE + RET NZ ; JUST RETURN IF NOTHING THERE - ;LD HL,IDE_TIMEOUT ; POINT TO TIMEOUT - ;LD (HL),IDE_TONORM ; BACK TO NORMAL TIMEOUT - - RET + CALL IDE_INITDEV ; IF FOUND, ATTEMPT TO INIT DEVICE + RET ; DONE ; ; TAKE ANY ACTIONS REQUIRED TO SELECT DESIRED PHYSICAL UNIT ; UNIT IS SPECIFIED IN IDE_UNIT @@ -910,22 +1053,16 @@ IDE_SELUNIT: PRTS(" SELUNIT$") #ENDIF ; -#IF (IDEMODE == IDEMODE_DIDE) - ; SELECT PRIMARY/SECONDARY INTERFACE FOR DIDE HARDWARE -#ENDIF - PUSH HL ; SAVE HL, IT IS DESTROYED BELOW - PUSH IY - POP BC - LD A,(IY+IDE_DEV) ; GET DEVICE - AND $01 ; LS BIT DETERMINES MASTER/SLAVE - LD HL,IDE_DRVSEL - CALL ADDHLA - LD A,(HL) ; LOAD DRIVE/HEAD VALUE - POP HL ; RECOVER HL + BIT 0,(IY+IDE_ACC) ; MASTER? + JR Z,IDE_SELUNIT1 ; HANDLE SLAVE + LD A,IDE_DRVMASTER ; MASTER + JR IDE_SELUNIT2 +IDE_SELUNIT1: + LD A,IDE_DRVSLAVE ; SLAVE +IDE_SELUNIT2: LD (IDE_DRVHD),A ; SAVE IT -; - XOR A ; SIGNAL SUCCESS - RET ; AND DONE + XOR A ; SUCCESS + RET ; ; ; @@ -936,14 +1073,18 @@ IDE_PROBE: #ENDIF ; LD A,(IDE_DRVHD) - OUT (IDE_IO_DRVHD),A + ;OUT (IDE_IO_DRVHD),A + CALL IDE_OUT + .DB IDE_REG_DRVHD DCALL PC_SPACE DCALL PRTHEXBYTE CALL DELAY ; DELAY ~16US ; - LD C,IDE_IO_STAT - IN A,(C) + ;LD C,IDE_IO_STAT + ;IN A,(C) + CALL IDE_IN + .DB IDE_REG_STAT DCALL PC_SPACE DCALL PRTHEXBYTE CP $FF @@ -962,7 +1103,9 @@ IDE_PROBE0: DCALL IDE_REGDUMP ; ; CHECK STATUS - IN A,(IDE_IO_STAT) ; GET STATUS + ;IN A,(IDE_IO_STAT) ; GET STATUS + CALL IDE_IN + .DB IDE_REG_STAT DCALL PC_SPACE DCALL PRTHEXBYTE ; IF DEBUG, PRINT STATUS OR A ; SET FLAGS TO TEST FOR ZERO @@ -970,22 +1113,30 @@ IDE_PROBE0: ; ; CHECK SIGNATURE DCALL PC_SPACE - IN A,(IDE_IO_COUNT) + ;IN A,(IDE_IO_COUNT) + CALL IDE_IN + .DB IDE_REG_COUNT DCALL PRTHEXBYTE CP $01 JP NZ,IDE_NOMEDIA DCALL PC_SPACE - IN A,(IDE_IO_SECT) + ;IN A,(IDE_IO_SECT) + CALL IDE_IN + .DB IDE_REG_SECT DCALL PRTHEXBYTE CP $01 JP NZ,IDE_NOMEDIA DCALL PC_SPACE - IN A,(IDE_IO_CYLLO) + ;IN A,(IDE_IO_CYLLO) + CALL IDE_IN + .DB IDE_REG_CYLLO DCALL PRTHEXBYTE CP $00 JP NZ,IDE_NOMEDIA DCALL PC_SPACE - IN A,(IDE_IO_CYLHI) + ;IN A,(IDE_IO_CYLHI) + CALL IDE_IN + .DB IDE_REG_CYLHI DCALL PRTHEXBYTE CP $00 JP NZ,IDE_NOMEDIA @@ -1005,33 +1156,21 @@ IDE_INITDEV: OR A ; SET FLAGS JP Z,IDE_NOMEDIA ; EXIT SETTING NO MEDIA STATUS ; - ; CLEAR OUT UNIT SPECIFIC DATA, BUT PRESERVE THE EXISTING - ; VALUE OF THE UNIT TYPE WHICH WAS ESTABLISHED BY THE DEVICE - ; PROBES WHEN THE IDE BUS WAS RESET - ;PUSH AF ; SAVE UNIT TYPE VALUE FROM ABOVE - ;PUSH HL ; SAVE UNIT TYPE FIELD POINTER - ;IDE_DPTR(0) ; SET HL TO START OF UNIT DATA - ;LD BC,IDE_UDLEN - ;XOR A - ;CALL FILL - ;POP HL ; RECOVER UNIT TYPE FIELD POINTER - ;POP AF ; RECOVER UNIT TYPE VALUE - ;LD (HL),A ; AND PUT IT BACK -; -#IF (IDE8BIT) + BIT 1,(IY+IDE_ACC) ; 8 BIT ACCESS? + JR Z,IDE_INITDEV0 ; NO, DO 16 BIT INIT LD A,IDE_FEAT_ENABLE8BIT ; FEATURE VALUE = ENABLE 8-BIT PIO -#ELSE - LD A,IDE_FEAT_DISABLE8BIT ; FEATURE VALUE = DISABLE 8-BIT PIO -#ENDIF - CALL IDE_SETFEAT ; SET FEATURE - -#IF (IDE8BIT) + RET NZ ; BAIL OUT ON ERROR + JR IDE_INITDEV00 ; CONTINUE +; +IDE_INITDEV0: ; "REAL" IDE DRIVES MAY NOT ACCEPT THE DISABLE8BIT FEATURE COMMAND, ; SO IT IS ONLY AN ERROR IF WE ARE ATTEMPTING TO ENABLE8BIT. - ; CREDIT TO ED BRINDLEY FOR THIS CORRECTION. - RET NZ ; BAIL OUT ON ERROR -#ENDIF + ; CREDIT TO ED BRINDLEY FOR THIS CORRECTION. SO ERROR RETURN IGNORED HERE. + LD A,IDE_FEAT_DISABLE8BIT ; FEATURE VALUE = ENABLE 8-BIT PIO + CALL IDE_SETFEAT ; SET FEATURE, IGNORE ERRORS +; +IDE_INITDEV00: ; CALL IDE_IDENTIFY ; EXECUTE IDENTIFY COMMAND RET NZ ; BAIL OUT ON ERROR @@ -1040,7 +1179,7 @@ IDE_INITDEV: DCALL DUMP_BUFFER ; DUMP IT IF DEBUGGING ; XOR A - LD (IY+IDE_FLAGS),0 ; CLEAR FLAGS + LD (IY+IDE_MED),0 ; CLEAR FLAGS ; DETERMINE IF CF DEVICE LD HL,HB_WRKBUF ; FIRST WORD OF IDENTIFY DATA HAS CF FLAG @@ -1051,14 +1190,14 @@ IDE_INITDEV: LD A,$84 ; SECOND BYTE OF MARKER IS $84 CP (HL) ; COMPARE JR NZ,IDE_INITDEV1 ; IF NOT MATCH, NOT CF - SET 0,(IY+IDE_FLAGS) ; SET FLAGS BIT FOR CF MEDIA + SET 0,(IY+IDE_MED) ; SET FLAGS BIT FOR CF MEDIA ; IDE_INITDEV1: ; DETERMINE IF LBA CAPABLE LD A,(HB_WRKBUF+98+1) ; GET BYTE WITH LBA BIT FROM BUFFER BIT 1,A ; CHECK THE LBA BIT JR Z,IDE_INITDEV2 ; NOT SET, BYPASS - SET 1,(IY+IDE_FLAGS) ; SET FLAGS BIT FOR LBA + SET 1,(IY+IDE_MED) ; SET FLAGS BIT FOR LBA ; IDE_INITDEV2: ; GET DEVICE CAPACITY AND SAVE IT @@ -1078,15 +1217,24 @@ IDE_INITDEV2: ; RET ; RETURN, A=0, Z SET ; +; SWITCH IY POINTER FROM CURRENT UNIT CFG TO PARTNER UNIT CFG +; +IDE_GOPARTNER: + PUSH HL ; SAVE HL + LD L,(IY+IDE_PARTNER) ; GET PARTNER ENTRY + LD H,(IY+IDE_PARTNER+1) ; ... + PUSH HL ; MOVE HL + POP IY ; ... TO IY + POP HL ; RESTORE INCOMING HL + RET ; AND DONE ; +; CHECK CURRENT DEVICE FOR ERROR STATUS AND ATTEMPT TO RECOVER +; VIA RESET IF DEVICE IS IN ERROR. ; -IDE_CHKDEVICE: +IDE_CHKERR: LD A,(IY+IDE_STAT) ; GET STATUS OR A ; SET FLAGS - RET Z ; RETURN IF ALL IS WELL -; - ; ATTEMPT TO REINITIALIZE HERE??? - JP IDE_ERR + CALL NZ,IDE_RESET ; IF ERROR STATUS, RESET BUS RET ; ; @@ -1097,7 +1245,9 @@ IDE_WAITRDY: IDE_WAITRDY1: LD DE,(IDE_TOSCALER) ; CPU SPPED SCALER TO INNER LOOP VAR IDE_WAITRDY2: - IN A,(IDE_IO_STAT) ; READ STATUS + ;IN A,(IDE_IO_STAT) ; READ STATUS + CALL IDE_IN + .DB IDE_REG_STAT LD C,A ; SAVE IT AND %11000000 ; ISOLATE BUSY AND RDY BITS XOR %01000000 ; WE WANT BUSY(7) TO BE 0 AND RDY(6) TO BE 1 @@ -1117,7 +1267,9 @@ IDE_WAITDRQ: IDE_WAITDRQ1: LD DE,(IDE_TOSCALER) ; CPU SPPED SCALER TO INNER LOOP VAR IDE_WAITDRQ2: - IN A,(IDE_IO_STAT) ; WAIT FOR DRIVE'S 512 BYTE READ BUFFER + ;IN A,(IDE_IO_STAT) ; WAIT FOR DRIVE'S 512 BYTE READ BUFFER + CALL IDE_IN + .DB IDE_REG_STAT LD C,A ; SAVE IT AND %10001000 ; TO FILL (OR READY TO FILL) XOR %00001000 @@ -1137,7 +1289,9 @@ IDE_WAITBSY: IDE_WAITBSY1: LD DE,(IDE_TOSCALER) ; CPU SPPED SCALER TO INNER LOOP VAR IDE_WAITBSY2: - IN A,(IDE_IO_STAT) ; WAIT FOR DRIVE'S 512 BYTE READ BUFFER ; 11TS + ;IN A,(IDE_IO_STAT) ; WAIT FOR DRIVE'S 512 BYTE READ BUFFER ; 11TS + CALL IDE_IN ; 17TS + ???TS + .DB IDE_REG_STAT ; 0TS LD C,A ; SAVE IT ; 4TS AND %10000000 ; TO FILL (OR READY TO FILL) ; 7TS RET Z ; 5TS @@ -1146,7 +1300,39 @@ IDE_WAITBSY2: OR E ; 4TS JR NZ,IDE_WAITBSY2 ; 12TS DJNZ IDE_WAITBSY1 ; ----- - JP IDE_BSYTO ; EXIT WITH BSYTO ERR ; 52TS + JP IDE_BSYTO ; EXIT WITH BSYTO ERR ; ??TS +; +; READ A VALUE FROM THE DEVICE POINTED TO BY IY AND RETURN IT IN A +; +IDE_IN: + EX (SP),HL ; GET PARM POINTER + PUSH BC + LD A,(HL) + INC HL + LD C,(IY+IDE_IOBASE) + ADD A,C + LD C,A + IN A,(C) + POP BC + EX (SP),HL ; RESTORE STACK + RET +; +; OUTPUT VALUE IN A TO THE DEVICE POINTED TO BY IY +; +IDE_OUT: + EX (SP),HL ; GET PARM POINTER + PUSH BC + PUSH AF + LD A,(HL) + INC HL + LD C,(IY+IDE_IOBASE) + ADD A,C + LD C,A + POP AF + OUT (C),A + POP BC + EX (SP),HL ; RESTORE STACK + RET ; ;============================================================================= ; ERROR HANDLING AND DIAGNOSTICS @@ -1252,7 +1438,10 @@ IDE_REGDUMP: PUSH BC CALL PC_SPACE CALL PC_LBKT - LD C,IDE_IO_CMD + ;LD C,IDE_IO_CMD + LD A,(IY+IDE_IOBASE) + ADD A,IDE_REG_CMD + LD C,A LD B,7 IDE_REGDUMP1: IN A,(C) @@ -1284,16 +1473,20 @@ IDE_PRTPREFIX: #IF (DSKYENABLE) IDE_DSKY: LD HL,DSKY_HEXBUF ; POINT TO DSKY BUFFER - IN A,(IDE_IO_DRVHD) ; GET DRIVE/HEAD + CALL IDE_IN + .DB IDE_REG_DRVHD LD (HL),A ; SAVE IN BUFFER INC HL ; INCREMENT BUFFER POINTER - IN A,(IDE_IO_CYLHI) ; GET DRIVE/HEAD + CALL IDE_IN + .DB IDE_REG_CYLHI LD (HL),A ; SAVE IN BUFFER INC HL ; INCREMENT BUFFER POINTER - IN A,(IDE_IO_CYLLO) ; GET DRIVE/HEAD + CALL IDE_IN + .DB IDE_REG_CYLLO LD (HL),A ; SAVE IN BUFFER INC HL ; INCREMENT BUFFER POINTER - IN A,(IDE_IO_SECT) ; GET DRIVE/HEAD + CALL IDE_IN + .DB IDE_REG_SECT LD (HL),A ; SAVE IN BUFFER CALL DSKY_HEXOUT ; SEND IT TO DSKY RET @@ -1314,6 +1507,13 @@ IDE_STR_STBSYTO .TEXT "BUSY TIMEOUT$" IDE_STR_STUNK .TEXT "UNKNOWN ERROR$" ; IDE_STR_NO .TEXT "NO$" +IDE_STR_NOHW .TEXT "NOT PRESENT$" +IDE_STR_8BIT .TEXT " 8-BIT$" +; +IDE_STR_MODE_DIO .TEXT "DIO$" +IDE_STR_MODE_DIDE .TEXT "DIDE$" +IDE_STR_MODE_MK4 .TEXT "MK4$" +IDE_STR_MODE_RC .TEXT "RC$" ; ;============================================================================= ; DATA STORAGE @@ -1327,3 +1527,5 @@ IDE_IOFNADR .DW 0 ; PENDING IO FUNCTION ADDRESS IDE_DRVHD .DB 0 ; CURRENT DRIVE/HEAD MASK ; IDE_DSKBUF .DW 0 ; ACTIVE DISK BUFFER +; +IDE_DEVNUM .DB 0 ; TEMP DEVICE NUM USED DURING INIT diff --git a/Source/HBIOS/imgpad0.asm b/Source/HBIOS/imgpad0.asm index e2822918..2aa54841 100644 --- a/Source/HBIOS/imgpad0.asm +++ b/Source/HBIOS/imgpad0.asm @@ -1,6 +1,6 @@ #INCLUDE "std.asm" ; -SLACK .EQU ($8000-BAS_SIZ-TBC_SIZ-FTH_SIZ) +SLACK .EQU ($8000-BAS_SIZ-TBC_SIZ-FTH_SIZ-GAM_SIZ-USR_SIZ) .FILL SLACK,00H ; MON_STACK .EQU $ diff --git a/Source/HBIOS/ppide.asm b/Source/HBIOS/ppide.asm index 1cf840e3..3cb48b86 100644 --- a/Source/HBIOS/ppide.asm +++ b/Source/HBIOS/ppide.asm @@ -4,35 +4,16 @@ ;============================================================================= ; ; TODO: -; - IMPLEMENT PPIDE_INITDEVICE -; - IMPLEMENT INTELLIGENT RESET, CHECK IF DEVICE IS ACTUALLY BROKEN BEFORE RESET ; - FIX SCALER CONSTANT +; - GOPARTNER NEEDS TO HANDLE "NO PARTNER" CONDITION ; -; -#IF (PPIDEMODE == PPIDEMODE_SBC) -PPIDE_IO_BASE .EQU $60 -#ENDIF -; -#IF ((PPIDEMODE == PPIDEMODE_DIO3) | (PPIDEMODE == PPIDEMODE_RC)) -PPIDE_IO_BASE .EQU $20 -#ENDIF -; -#IF (PPIDEMODE == PPIDEMODE_MFP) -PPIDE_IO_BASE .EQU $44 -#ENDIF -; -#IF (PPIDEMODE == PPIDEMODE_N8) -PPIDE_IO_BASE .EQU $80 -#ENDIF -; -#IF (PPIDEMODE == PPIDEMODE_DYNO) -PPIDE_IO_BASE .EQU $4C -#ENDIF -; -PPIDE_IO_DATALO .EQU PPIDE_IO_BASE + 0 ; IDE DATA BUS LSB (8255 PORT A) -PPIDE_IO_DATAHI .EQU PPIDE_IO_BASE + 1 ; IDE DATA BUS MSB (8255 PORT B) -PPIDE_IO_CTL .EQU PPIDE_IO_BASE + 2 ; IDE ADDRESS BUS AND CONTROL SIGNALS (8255 PORT C) -PPIDE_IO_PPI .EQU PPIDE_IO_BASE + 3 ; 8255 CONTROL PORT +; NOTES: +; - WELL KNOWN PPIDE PORT ADDRESSES: +; $60 - SBC/ZETA ONBOARD PPI +; $20 - ECB DISKIO3, RC FAMILY +; $44 - ECB MULTI-FUNCTION PIC +; $80 - N8 ONBOARD PPI +; $4C - DYNO ONBOARD PPI ; ; THE CONTROL PORT OF THE 8255 IS PROGRAMMED AS NEEDED TO READ OR WRITE ; DATA ON THE IDE BUS. PORT C OF THE 8255 IS ALWAYS IN OUTPUT MODE BECAUSE @@ -49,8 +30,8 @@ PPIDE_DIR_WRITE .EQU %10000000 ; IDE BUS DATA OUTPUT MODE PPIDE_CTL_DA0 .EQU %00000001 ; DRIVE ADDRESS BUS - BIT 0 (DA0) PPIDE_CTL_DA1 .EQU %00000010 ; DRIVE ADDRESS BUS - BIT 1 (DA1) PPIDE_CTL_DA2 .EQU %00000100 ; DRIVE ADDRESS BUS - BIT 2 (DA2) -PPIDE_CTL_CS1FX .EQU %00001000 ; DRIVE CHIP SELECT 0 (ACTIVE LOW, INVERTED) -PPIDE_CTL_CS3FX .EQU %00010000 ; DRIVE CHIP SELECT 1 (ACTIVE LOW, INVERTED) +PPIDE_CTL_CS1 .EQU %00001000 ; DRIVE CHIP SELECT 0 (ACTIVE LOW, INVERTED) +PPIDE_CTL_CS3 .EQU %00010000 ; DRIVE CHIP SELECT 1 (ACTIVE LOW, INVERTED) PPIDE_CTL_DIOW .EQU %00100000 ; DRIVE I/O WRITE (ACTIVE LOW, INVERTED) PPIDE_CTL_DIOR .EQU %01000000 ; DRIVE I/O READ (ACTIVE LOW, INVERTED) PPIDE_CTL_RESET .EQU %10000000 ; DRIVE RESET (ACTIVE LOW, INVERTED) @@ -85,7 +66,7 @@ PPIDE_CTL_RESET .EQU %10000000 ; DRIVE RESET (ACTIVE LOW, INVERTED) ; | PPIDE_REG_STAT | 0x07 | R | STATUS REGISTER | ; | PPIDE_REG_CMD | 0x07 | W | COMMAND REGISTER (EXECUTE) | ; +-----------------------+-------+-------+-------------------------------+ -; * LBA0-4 ARE ALTERNATE DEFINITIONS OF SECT, CYL, AND DRVHD PORTS +; * LBA0-3 ARE ALTERNATE DEFINITIONS OF SECT, CYL, AND DRVHD PORTS ; ; === STATUS REGISTER === ; @@ -141,39 +122,31 @@ PPIDE_CTL_RESET .EQU %10000000 ; DRIVE RESET (ACTIVE LOW, INVERTED) ; SRST: SOFTWARE RESET ; ~IEN: INTERRUPT ENABLE ; -; CONTROL VALUES TO USE WHEN ACCESSING THE VARIOUS IDE DEVICE REGISTERS -; -PPIDE_REG_DATA .EQU PPIDE_CTL_CS1FX | $00 ; DATA INPUT/OUTPUT (R/W) -PPIDE_REG_ERR .EQU PPIDE_CTL_CS1FX | $01 ; ERROR REGISTER (R) -PPIDE_REG_FEAT .EQU PPIDE_CTL_CS1FX | $01 ; FEATURES REGISTER (W) -PPIDE_REG_COUNT .EQU PPIDE_CTL_CS1FX | $02 ; SECTOR COUNT REGISTER (R/W) -PPIDE_REG_SECT .EQU PPIDE_CTL_CS1FX | $03 ; SECTOR NUMBER REGISTER (R/W) -PPIDE_REG_CYLLO .EQU PPIDE_CTL_CS1FX | $04 ; CYLINDER NUM REGISTER (LSB) (R/W) -PPIDE_REG_CYLHI .EQU PPIDE_CTL_CS1FX | $05 ; CYLINDER NUM REGISTER (MSB) (R/W) -PPIDE_REG_DRVHD .EQU PPIDE_CTL_CS1FX | $06 ; DRIVE/HEAD REGISTER (R/W) -PPIDE_REG_LBA0 .EQU PPIDE_CTL_CS1FX | $03 ; LBA BYTE 0 (BITS 0-7) (R/W) -PPIDE_REG_LBA1 .EQU PPIDE_CTL_CS1FX | $04 ; LBA BYTE 1 (BITS 8-15) (R/W) -PPIDE_REG_LBA2 .EQU PPIDE_CTL_CS1FX | $05 ; LBA BYTE 2 (BITS 16-23) (R/W) -PPIDE_REG_LBA3 .EQU PPIDE_CTL_CS1FX | $06 ; LBA BYTE 3 (BITS 24-27) (R/W) -PPIDE_REG_STAT .EQU PPIDE_CTL_CS1FX | $07 ; STATUS REGISTER (R) -PPIDE_REG_CMD .EQU PPIDE_CTL_CS1FX | $07 ; COMMAND REGISTER (EXECUTE) (W) -PPIDE_REG_ALTSTAT .EQU PPIDE_CTL_CS3FX | $06 ; ALTERNATE STATUS REGISTER (R) -PPIDE_REG_CTRL .EQU PPIDE_CTL_CS3FX | $06 ; DEVICE CONTROL REGISTER (W) -PPIDE_REG_DRVADR .EQU PPIDE_CTL_CS3FX | $07 ; DRIVE ADDRESS REGISTER (R) -; #IF (PPIDETRACE >= 3) #DEFINE DCALL CALL #ELSE #DEFINE DCALL \; #ENDIF ; -; UNIT MAPPING IS AS FOLLOWS: -; PPIDE0: PRIMARY MASTER -; PPIDE1: PRIMARY SLAVE -; PPIDE2: SECONDARY MASTER -; PPIDE3: SECONDARY SLAVE +; CONTROL VALUES TO USE WHEN ACCESSING THE VARIOUS IDE DEVICE REGISTERS ; -PPIDE_DEVCNT .EQU 2 ; ASSUME ONLY PRIMARY INTERFACE +PPIDE_REG_DATA .EQU PPIDE_CTL_CS1 | $00 ; DATA INPUT/OUTPUT (R/W) +PPIDE_REG_ERR .EQU PPIDE_CTL_CS1 | $01 ; ERROR REGISTER (R) +PPIDE_REG_FEAT .EQU PPIDE_CTL_CS1 | $01 ; FEATURES REGISTER (W) +PPIDE_REG_COUNT .EQU PPIDE_CTL_CS1 | $02 ; SECTOR COUNT REGISTER (R/W) +PPIDE_REG_SECT .EQU PPIDE_CTL_CS1 | $03 ; SECTOR NUMBER REGISTER (R/W) +PPIDE_REG_CYLLO .EQU PPIDE_CTL_CS1 | $04 ; CYLINDER NUM REGISTER (LSB) (R/W) +PPIDE_REG_CYLHI .EQU PPIDE_CTL_CS1 | $05 ; CYLINDER NUM REGISTER (MSB) (R/W) +PPIDE_REG_DRVHD .EQU PPIDE_CTL_CS1 | $06 ; DRIVE/HEAD REGISTER (R/W) +PPIDE_REG_LBA0 .EQU PPIDE_CTL_CS1 | $03 ; LBA BYTE 0 (BITS 0-7) (R/W) +PPIDE_REG_LBA1 .EQU PPIDE_CTL_CS1 | $04 ; LBA BYTE 1 (BITS 8-15) (R/W) +PPIDE_REG_LBA2 .EQU PPIDE_CTL_CS1 | $05 ; LBA BYTE 2 (BITS 16-23) (R/W) +PPIDE_REG_LBA3 .EQU PPIDE_CTL_CS1 | $06 ; LBA BYTE 3 (BITS 24-27) (R/W) +PPIDE_REG_STAT .EQU PPIDE_CTL_CS1 | $07 ; STATUS REGISTER (R) +PPIDE_REG_CMD .EQU PPIDE_CTL_CS1 | $07 ; COMMAND REGISTER (EXECUTE) (W) +PPIDE_REG_ALTSTAT .EQU PPIDE_CTL_CS3 | $06 ; ALTERNATE STATUS REGISTER (R) +PPIDE_REG_CTRL .EQU PPIDE_CTL_CS3 | $06 ; DEVICE CONTROL REGISTER (W) +PPIDE_REG_DRVADR .EQU PPIDE_CTL_CS3 | $07 ; DRIVE ADDRESS REGISTER (R) ; ; COMMAND BYTES ; @@ -194,7 +167,7 @@ PPIDE_TYPEUNK .EQU 0 PPIDE_TYPEATA .EQU 1 PPIDE_TYPEATAPI .EQU 2 ; -; PPIDE DEVICE STATUS +; PPIDE DEVICE STATUS CODES ; PPIDE_STOK .EQU 0 PPIDE_STINVUNIT .EQU -1 @@ -207,44 +180,133 @@ PPIDE_STBSYTO .EQU -7 ; ; DRIVE SELECTION BYTES (FOR USE IN DRIVE/HEAD REGISTER) ; -PPIDE_DRVSEL: -PPIDE_DRVMASTER .DB %11100000 ; LBA, MASTER DEVICE -PPIDE_DRVSLAVE .DB %11110000 ; LBA, SLAVE DEVICE +;PPIDE_DRVSEL: +PPIDE_DRVMASTER .EQU %11100000 ; LBA, MASTER DEVICE +PPIDE_DRVSLAVE .EQU %11110000 ; LBA, SLAVE DEVICE ; ; PPIDE DEVICE CONFIGURATION ; -PPIDE_CFGSIZ .EQU 12 ; SIZE OF CFG TBL ENTRIES +PPIDE_CFGSIZ .EQU 18 ; SIZE OF CFG TBL ENTRIES ; ; PER DEVICE DATA OFFSETS ; PPIDE_DEV .EQU 0 ; OFFSET OF DEVICE NUMBER (BYTE) PPIDE_STAT .EQU 1 ; LAST STATUS (BYTE) PPIDE_TYPE .EQU 2 ; DEVICE TYPE (BYTE) -PPIDE_FLAGS .EQU 3 ; FLAG BITS BIT 0=CF, 1=LBA (BYTE) -PPIDE_MEDCAP .EQU 4 ; MEDIA CAPACITY (DWORD) -PPIDE_LBA .EQU 8 ; OFFSET OF LBA (DWORD) +PPIDE_ACC .EQU 3 ; ACCESS FLAG BITS BIT 0=MASTER, 1=8BIT (BYTE) +PPIDE_MED .EQU 4 ; MEDIA FLAG BITS BIT 0=CF, 1=LBA (BYTE) +PPIDE_MEDCAP .EQU 5 ; MEDIA CAPACITY (DWORD) +PPIDE_LBA .EQU 9 ; OFFSET OF LBA (DWORD) +PPIDE_DATALO .EQU 13 ; BASE PORT AND IDE DATA BUS LSB (8255 PORT A) (BYTE) +PPIDE_CTL .EQU 14 ; IDE ADDRESS BUS AND CONTROL SIGNALS (8255 PORT C)(BYTE) +PPIDE_PPI .EQU 15 ; 8255 CONTROL PORT(BYTE) +PPIDE_PARTNER .EQU 16 ; PARTNER DEVICE (MASTER <-> SLAVE) (WORD) +; +PPIDE_ACC_MAS .EQU %00000001 ; UNIT IS MASTER (ELSE SLAVE) +PPIDE_ACC_8BIT .EQU %00000010 ; UNIT WANTS 8 BIT I/O (ELSE 16 BIT) +; +PPIDE_MED_CF .EQU %00000001 ; MEDIA IS CF CARD +PPIDE_MED_LBA .EQU %00000010 ; MEDIA HAS LBA CAPABILITY +; +PPIDE_DEVCNT .EQU PPIDECNT * 2 ; PPIDE_CFGTBL: - ; DEVICE 0, PRIMARY MASTER - .DB 0 ; DRIVER DEVICE NUMBER +; +#IF (PPIDECNT >= 1) +; +PPIDE_DEV0M: ; DEVICE 0, MASTER + .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB 0 ; DEVICE STATUS + .DB 0 ; DEVICE TYPE + .DB PPIDE_ACC_MAS | (PPIDE0A8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS + .DW 0,0 ; DEVICE CAPACITY + .DW 0,0 ; CURRENT LBA + .DB PPIDE0BASE ; DATALO + .DB PPIDE0BASE+2 ; CTL + .DB PPIDE0BASE+3 ; PPI + .DW PPIDE_DEV0S ; PARTNER +; +PPIDE_DEV0S: ; DEVICE 0, SLAVE + .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE - .DB 0 ; FLAGS BYTE + .DB (PPIDE0B8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS .DW 0,0 ; DEVICE CAPACITY .DW 0,0 ; CURRENT LBA - ; DEVICE 1, PRIMARY SLAVE - .DB 1 ; DRIVER DEVICE NUMBER + .DB PPIDE0BASE ; DATALO + .DB PPIDE0BASE+2 ; CTL + .DB PPIDE0BASE+3 ; PPI + .DW PPIDE_DEV0M ; PARTNER +; +#ENDIF +; +#IF (PPIDECNT >= 2) +; +PPIDE_DEV1M: ; DEVICE 1, MASTER + .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE - .DB 0 ; FLAGS BYTE + .DB PPIDE_ACC_MAS | (PPIDE1A8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS .DW 0,0 ; DEVICE CAPACITY .DW 0,0 ; CURRENT LBA + .DB PPIDE1BASE ; DATALO + .DB PPIDE1BASE+2 ; CTL + .DB PPIDE1BASE+3 ; PPI + .DW PPIDE_DEV1S ; PARTNER +; +PPIDE_DEV1S: ; DEVICE 1, SLAVE + .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB 0 ; DEVICE STATUS + .DB 0 ; DEVICE TYPE + .DB (PPIDE1B8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS + .DW 0,0 ; DEVICE CAPACITY + .DW 0,0 ; CURRENT LBA + .DB PPIDE1BASE ; DATALO + .DB PPIDE1BASE+2 ; CTL + .DB PPIDE1BASE+3 ; PPI + .DW PPIDE_DEV1M ; PARTNER +; +#ENDIF +; +#IF (PPIDECNT >= 3) +; +PPIDE_DEV2M: ; DEVICE 2, MASTER + .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB 0 ; DEVICE STATUS + .DB 0 ; DEVICE TYPE + .DB PPIDE_ACC_MAS | (PPIDE2A8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS + .DW 0,0 ; DEVICE CAPACITY + .DW 0,0 ; CURRENT LBA + .DB PPIDE2BASE ; DATALO + .DB PPIDE2BASE+2 ; CTL + .DB PPIDE2BASE+3 ; PPI + .DW PPIDE_DEV2S ; PARTNER +; +PPIDE_DEV2S: ; DEVICE 2, SLAVE + .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB 0 ; DEVICE STATUS + .DB 0 ; DEVICE TYPE + .DB (PPIDE2B8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS + .DB 0 ; MEDIA FLAGS + .DW 0,0 ; DEVICE CAPACITY + .DW 0,0 ; CURRENT LBA + .DB PPIDE2BASE ; DATALO + .DB PPIDE2BASE+2 ; CTL + .DB PPIDE2BASE+3 ; PPI + .DW PPIDE_DEV2M ; PARTNER +; +#ENDIF ; #IF ($ - PPIDE_CFGTBL) != (PPIDE_DEVCNT * PPIDE_CFGSIZ) .ECHO "*** INVALID PPIDE CONFIG TABLE ***\n" #ENDIF ; - .DB $FF ; END MARKER + .DB $FF ; END OF TABLE MARKER ; ; THE IDE_WAITXXX FUNCTIONS ARE BUILT TO TIMEOUT AS NEEDED SO DRIVER WILL ; NOT HANG IF DEVICE IS UNRESPONSIVE. DIFFERENT TIMEOUTS ARE USED DEPENDING @@ -263,9 +325,6 @@ PPIDE_TOFAST .EQU 10 ; FAST TIMEOUT IS 0.5 SECS ;============================================================================= ; PPIDE_INIT: - CALL NEWLINE ; FORMATTING - PRTS("PPIDE:$") ; LABEL FOR IO ADDRESS -; ; COMPUTE CPU SPEED COMPENSATED TIMEOUT SCALER ; AT 1MHZ, THE SCALER IS 218 (50000US / 229TS = 218) ; SCALER IS THEREFORE 218 * CPU SPEED IN MHZ @@ -274,58 +333,61 @@ PPIDE_INIT: CALL MULT8X16 ; HL := DE * A LD (PPIDE_TOSCALER),HL ; SAVE IT ; - PRTS(" IO=0x$") ; LABEL FOR IO ADDRESS - LD A,PPIDE_IO_BASE - CALL PRTHEXBYTE + XOR A ; ZERO ACCUM + LD (PPIDE_DEVNUM),A ; INIT DEV UNIT NUM FOR DYNAMIC ASSIGNMENT + LD IY,PPIDE_CFGTBL ; POINT TO START OF CONFIG TABLE ; -#IF (PPIDE8BIT) - PRTS(" 8BIT$") -#ENDIF - CALL PPIDE_DETECT ; CHECK FOR HARDWARE - JR Z,PPIDE_INIT00 ; CONTINUE IF PRESENT +PPIDE_INIT1: + LD A,(IY) ; LOAD FIRST BYTE TO CHECK FOR END + CP $FF ; CHECK FOR END OF TABLE VALUE + JR NZ,PPIDE_INIT2 ; IF NOT END OF TABLE, CONTINUE + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN ; - ; HARDWARE NOT PRESENT - PRTS(" NOT PRESENT$") - OR $FF ; SIGNAL FAILURE - RET +PPIDE_INIT2: + BIT 0,(IY+PPIDE_ACC) ; MASTER? + JR Z,PPIDE_INIT4 ; IF NOT MASTER, SKIP AHEAD ; -PPIDE_INIT00: - PRTS(" DEVICES=$") - LD A,PPIDE_DEVCNT - CALL PRTDECB + CALL NEWLINE ; FORMATTING + PRTS("PPIDE:$") ; LABEL FOR IO ADDRESS ; -; SETUP THE DISPATCH TABLE ENTRIES + PRTS(" IO=0x$") ; LABEL FOR IO ADDRESS + LD A,(IY+PPIDE_DATALO) ; GET IO BASE ADDRES + CALL PRTHEXBYTE ; DISPLAY IT ; - LD B,PPIDE_DEVCNT ; LOOP CONTROL - LD IY,PPIDE_CFGTBL ; START OF CFG TABLE -PPIDE_INIT0: - PUSH BC ; SAVE LOOP CONTROL + CALL PPIDE_DETECT ; PROBE FOR INTERFACE + JR Z,PPIDE_INIT3 ; GOT IT, MOVE ON TO INIT UNITS + CALL PC_SPACE ; FORMATTING + LD DE,PPIDE_STR_NOPPI ; NO PPI MESSAGE + CALL WRITESTR ; DISPLAY IT + JR PPIDE_INIT4 ; SKIP CFG ENTRY +; +PPIDE_INIT3: + CALL PPIDE_RESET ; RESET THE BUS + CALL PPIDE_INIT5 ; DETECT/INIT MASTER + PUSH IY ; SAVE CFG PTR + CALL PPIDE_GOPARTNER ; SWITCH IY TO PARTNER CFG + CALL PPIDE_INIT5 ; DETECT/INIT SLAVE + POP IY ; RESTORE CFG PTR +; +PPIDE_INIT4: + LD DE,PPIDE_CFGSIZ ; SIZE OF CFG TABLE ENTRY + ADD IY,DE ; BUMP POINTER + JR PPIDE_INIT1 ; AND LOOP +; +PPIDE_INIT5: + ; UPDATE DRIVER RELATIVE UNIT NUMBER IN CONFIG TABLE + LD A,(PPIDE_DEVNUM) ; GET NEXT UNIT NUM TO ASSIGN + LD (IY+PPIDE_DEV),A ; UPDATE IT + INC A ; BUMP TO NEXT UNIT NUM TO ASSIGN + LD (PPIDE_DEVNUM),A ; SAVE IT +; + ; ADD UNIT TO GLOBAL DISK UNIT TABLE LD BC,PPIDE_FNTBL ; BC := FUNC TABLE ADR PUSH IY ; CFG ENTRY POINTER POP DE ; COPY TO DE CALL DIO_ADDENT ; ADD ENTRY TO GLOBAL DISK DEV TABLE - LD BC,PPIDE_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,BC ; BUMP IY TO NEXT ENTRY - POP BC ; RESTORE BC - DJNZ PPIDE_INIT0 ; LOOP AS NEEDED -; - ; INITIALIZE THE PPIDE INTERFACE NOW - CALL PPIDE_RESET ; DO HARDWARE SETUP/INIT - RET NZ ; ABORT IF RESET FAILS -; - ; DEVICE DISPLAY LOOP - LD B,PPIDE_DEVCNT ; LOOP ONCE PER DEVICE - LD IY,PPIDE_CFGTBL ; START OF CFG TABLE -PPIDE_INIT1: - PUSH BC ; SAVE LOOP CONTROL - CALL PPIDE_INIT2 ; DISPLAY UNIT INFO - LD BC,PPIDE_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,BC ; BUMP IY TO NEXT ENTRY - POP BC ; RESTORE LOOP CONTROL - DJNZ PPIDE_INIT1 ; LOOP UNTIL DONE - RET ; DONE ; -PPIDE_INIT2: ; CHECK FOR BAD STATUS LD A,(IY+PPIDE_STAT) ; GET STATUS OR A ; SET FLAGS @@ -333,13 +395,13 @@ PPIDE_INIT2: ; CALL PPIDE_PRTPREFIX ; PRINT DEVICE PREFIX ; -#IF (PPIDE8BIT) - PRTS(" 8BIT$") -#ENDIF + LD DE,PPIDE_STR_8BIT + BIT 1,(IY+PPIDE_ACC) ; 8 BIT ACCESS? + CALL NZ,WRITESTR ; ; PRINT LBA/NOLBA CALL PC_SPACE ; FORMATTING - BIT 1,(IY+PPIDE_FLAGS) ; TEST LBA FLAG + BIT 1,(IY+PPIDE_MED) ; TEST LBA FLAG LD DE,PPIDE_STR_NO ; POINT TO "NO" STRING CALL Z,WRITESTR ; PRINT "NO" BEFORE "LBA" IF LBA NOT SUPPORTED PRTS("LBA$") ; PRINT "LBA" REGARDLESS @@ -358,11 +420,10 @@ PPIDE_INIT2: CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) PRTS("MB$") ; PRINT SUFFIX ; - XOR A ; SIGNAL SUCCESS - RET ; RETURN WITH A=0, AND Z SET + RET ; ;---------------------------------------------------------------------- -; PROBE FOR PPIDE HARDWARE +; PROBE FOR PPI HARDWARE ;---------------------------------------------------------------------- ; ; ON RETURN, ZF SET INDICATES HARDWARE FOUND @@ -375,9 +436,12 @@ PPIDE_DETECT: ; THEN THE BUS HOLD CIRCUITRY WILL READ BACK THE ZERO. SINCE ; WE ARE IN WRITE MODE, AN IDE CONTROLLER WILL NOT BE ABLE TO ; INTERFERE WITH THE VALUE BEING READ. +; LD A,PPIDE_DIR_WRITE ; SET DATA BUS DIRECTION TO WRITE - OUT (PPIDE_IO_PPI),A ; OUTPUT TO CONTROL WORD - LD C,PPIDE_IO_DATALO ; PPI PORT A + LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD + OUT (C),A ; WRITE IT +; + LD C,(IY+PPIDE_DATALO) ; PPI PORT A, DATALO XOR A ; VALUE ZERO OUT (C),A ; PUSH VALUE TO PORT IN A,(C) ; GET PORT VALUE @@ -443,7 +507,7 @@ PPIDE_IO: #ENDIF PUSH BC ; SAVE COUNTERS CALL PPIDE_SELUNIT ; HARDWARE SELECTION OF TARGET UNIT - CALL PPIDE_CHKDEVICE ; CHECK DEVICE AND CLEAR STATUS + CALL PPIDE_CHKERR ; CHECK FOR ERR STATUS AND RESET IF SO POP BC ; RESTORE COUNTERS JR NZ,PPIDE_IO3 ; BAIL OUT ON ERROR PPIDE_IO1: @@ -484,7 +548,7 @@ PPIDE_STATUS: PPIDE_DEVICE: LD D,DIODEV_PPIDE ; D := DEVICE TYPE LD E,(IY+PPIDE_DEV) ; E := PHYSICAL DEVICE NUMBER - BIT 0,(IY+PPIDE_FLAGS) ; TEST CF BIT IN FLAGS + BIT 0,(IY+PPIDE_MED) ; TEST CF BIT IN FLAGS LD C,%00000000 ; ASSUME NON-REMOVABLE HARD DISK JR Z,PPIDE_DEVICE1 ; IF Z, WE ARE DONE LD C,%01001000 ; OTHERWISE REMOVABLE COMPACT FLASH @@ -658,7 +722,6 @@ PPIDE_WRSEC: ; ; PPIDE_SETADDR: - ; XXX ; SEND 3 LOWEST BYTES OF LBA IN REVERSE ORDER ; IDE_IO_LBA3 HAS ALREADY BEEN SET ; HSTLBA2-0 --> IDE_IO_LBA2-0 @@ -667,19 +730,19 @@ PPIDE_SETADDR: DCALL PRTHEXBYTE CALL PPIDE_OUT .DB PPIDE_REG_LBA2 - +; LD A,(IY+PPIDE_LBA+1) DCALL PC_SPACE DCALL PRTHEXBYTE CALL PPIDE_OUT .DB PPIDE_REG_LBA1 - +; LD A,(IY+PPIDE_LBA+0) DCALL PC_SPACE DCALL PRTHEXBYTE CALL PPIDE_OUT .DB PPIDE_REG_LBA0 - +; LD A,1 DCALL PC_SPACE DCALL PRTHEXBYTE @@ -730,49 +793,64 @@ PPIDE_GETBUF: ; ; SETUP PPI TO READ LD A,PPIDE_DIR_READ ; SET DATA BUS DIRECTION TO READ - OUT (PPIDE_IO_PPI),A ; DO IT + ;OUT (PPIDE_IO_PPI),A ; DO IT + LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD + OUT (C),A ; WRITE IT ; ; SELECT READ/WRITE IDE REGISTER LD A,PPIDE_REG_DATA ; DATA REGISTER - OUT (PPIDE_IO_CTL),A ; DO IT + ;OUT (PPIDE_IO_CTL),A ; DO IT + LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS + OUT (C),A ; DO IT LD E,A ; E := READ UNASSERTED XOR PPIDE_CTL_DIOR ; SWAP THE READ LINE BIT LD D,A ; D := READ ASSERTED ; ; LOOP SETUP + XOR A ; IMPORTANT, NEEDED FOR LOOP END COMPARISON LD B,0 ; 256 ITERATIONS - LD C,PPIDE_IO_DATALO ; SETUP C WITH IO PORT (LSB) -; -#IF (!PPIDE8BIT) - INC C ; PRE-INCREMENT C -#ENDIF -; - CALL PPIDE_GETBUF1 ; FIRST PASS (FIRST 256 BYTES) - CALL PPIDE_GETBUF1 ; SECOND PASS (LAST 256 BYTES) -; - ;; CLEAN UP - ;XOR A ; ZERO A - ;OUT (PPIDE_IO_CTL),A ; RELEASE ALL BUS SIGNALS -; + LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS +; + BIT 1,(IY+PPIDE_ACC) ; 8 BIT? + JR Z,PPIDE_GETBUF1 ; IF NOT, DO 16 BIT + CALL PPIDE_GETBUF8 ; FIRST PASS (FIRST 256 BYTES) + CALL PPIDE_GETBUF8 ; SECOND PASS (LAST 256 BYTES) + JR PPIDE_GETBUF2 ; CONTINUE +PPIDE_GETBUF1: + CALL PPIDE_GETBUF16 ; FIRST PASS (FIRST 256 BYTES) + CALL PPIDE_GETBUF16 ; SECOND PASS (LAST 256 BYTES) +PPIDE_GETBUF2: CALL PPIDE_WAITRDY ; PROBLEMS IF THIS IS REMOVED! RET NZ CALL PPIDE_GETRES JP NZ,PPIDE_IOERR RET ; -PPIDE_GETBUF1: ; START OF READ LOOP - LD A,D ; ASSERT READ - OUT (PPIDE_IO_CTL),A ; DO IT -#IF (!PPIDE8BIT) - DEC C - INI ; GET AND SAVE NEXT BYTE +PPIDE_GETBUF8: ; 8 BIT WIDE READ LOOP + ; ENTER W/ C = PPIDE_IO_CTL + OUT (C),D ; ASSERT READ + DEC C ; CTL -> MSB + DEC C ; MSB -> LSB + INI ; READ FROM LSB INC C ; LSB -> MSB -#ENDIF - INI ; GET AND SAVE NEXT BYTE - LD A,E ; DEASSERT READ - OUT (PPIDE_IO_CTL),A ; DO IT + INC C ; MSB -> CTL + OUT (C),E ; DEASSERT READ + CP B ; B == A == 0? + JR NZ,PPIDE_GETBUF8 ; LOOP UNTIL DONE + RET ; - JR NZ,PPIDE_GETBUF1 ; LOOP UNTIL DONE +PPIDE_GETBUF16: ; 16 BIT WIDE READ LOOP + ; ENTER W/ C = PPIDE_IO_CTL + OUT (C),D ; ASSERT READ + DEC C ; CTL -> MSB + DEC C ; MSB -> LSB + INI ; READ FROM LSB + INC C ; LSB -> MSB + INI ; READ MSB FOR 16 BIT + INC C ; MSB -> CTL + OUT (C),E ; DEASSERT READ + CP B ; B == A == 0? + JR NZ,PPIDE_GETBUF16 ; LOOP UNTIL DONE RET ; ; @@ -781,56 +859,69 @@ PPIDE_PUTBUF: #IF (PPIDETRACE >= 3) PRTS(" PUTBUF$") #ENDIF - +; ; WAIT FOR BUFFER CALL PPIDE_WAITDRQ ; WAIT FOR BUFFER READY RET NZ ; BAIL OUT IF TIMEOUT ; ; SETUP PPI TO WRITE LD A,PPIDE_DIR_WRITE ; SET DATA BUS DIRECTION TO WRITE - OUT (PPIDE_IO_PPI),A ; DO IT + ;OUT (PPIDE_IO_PPI),A ; DO IT + LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD + OUT (C),A ; WRITE IT ; ; SELECT READ/WRITE IDE REGISTER LD A,PPIDE_REG_DATA ; DATA REGISTER - OUT (PPIDE_IO_CTL),A ; DO IT + ;OUT (PPIDE_IO_CTL),A ; DO IT + LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS + OUT (C),A ; DO IT LD E,A ; E := WRITE UNASSERTED XOR PPIDE_CTL_DIOW ; SWAP THE READ LINE BIT LD D,A ; D := WRITE ASSERTED ; ; LOOP SETUP + XOR A ; IMPORTANT, NEEDED FOR LOOP END COMPARISON LD B,0 ; 256 ITERATIONS - LD C,PPIDE_IO_DATALO ; SETUP C WITH IO PORT (LSB) -; -#IF (!PPIDE8BIT) - INC C ; PRE-INCREMENT C -#ENDIF -; - CALL PPIDE_PUTBUF1 ; FIRST PASS (FIRST 256 BYTES) - CALL PPIDE_PUTBUF1 ; SECOND PASS (LAST 256 BYTES) -; - ;; CLEAN UP - ;XOR A ; ZERO A - ;OUT (PPIDE_IO_CTL),A ; RELEASE ALL BUS SIGNALS -; + LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS +; + BIT 1,(IY+PPIDE_ACC) ; 8 BIT? + JR Z,PPIDE_PUTBUF1 ; IF NOT, DO 16 BIT + CALL PPIDE_PUTBUF8 ; FIRST PASS (FIRST 256 BYTES) + CALL PPIDE_PUTBUF8 ; SECOND PASS (LAST 256 BYTES) + JR PPIDE_PUTBUF2 ; CONTINUE +PPIDE_PUTBUF1: + CALL PPIDE_PUTBUF16 ; FIRST PASS (FIRST 256 BYTES) + CALL PPIDE_PUTBUF16 ; SECOND PASS (LAST 256 BYTES) +PPIDE_PUTBUF2: CALL PPIDE_WAITRDY ; PROBLEMS IF THIS IS REMOVED! RET NZ CALL PPIDE_GETRES JP NZ,PPIDE_IOERR RET ; -PPIDE_PUTBUF1: ; START OF READ LOOP -#IF (!PPIDE8BIT) - DEC C - OUTI ; PUT NEXT BYTE ON THE BUS (LSB) - INC C -#ENDIF - OUTI - LD A,D ; ASSERT WRITE - OUT (PPIDE_IO_CTL),A ; DO IT - LD A,E ; DEASSERT WRITE - OUT (PPIDE_IO_CTL),A ; DO IT +PPIDE_PUTBUF8: ; 8 BIT WIDE WRITE LOOP + DEC C ; CTL -> MSB + DEC C ; MSB -> LSB + OUTI ; WRITE NEXT BYTE (LSB) + INC C ; LSB -> MSB + INC C ; MSB -> CTL + OUT (C),D ; ASSERT WRITE + OUT (C),E ; DEASSERT WRITE + CP B ; B == A == 0? + JR NZ,PPIDE_PUTBUF8 ; LOOP UNTIL DONE + RET ; - JR NZ,PPIDE_PUTBUF1 ; LOOP UNTIL DONE +PPIDE_PUTBUF16: ; 16 BIT WIDE WRITE LOOP + DEC C ; CTL -> MSB + DEC C ; MSB -> LSB + OUTI ; WRITE NEXT BYTE (LSB) + INC C ; LSB -> MSB + OUTI ; WRITE NEXT BYTE (MSB) + INC C ; MSB -> CTL + OUT (C),D ; ASSERT WRITE + OUT (C),E ; DEASSERT WRITE + CP B ; B == A == 0? + JR NZ,PPIDE_PUTBUF16 ; LOOP UNTIL DONE RET ; ; @@ -859,18 +950,27 @@ PPIDE_GETRES: ; SOFT RESET OF ALL DEVICES ON BUS ; PPIDE_RESET: +#IF (PPIDETRACE >= 3) + CALL PPIDE_PRTPREFIX + PRTS(" RESET$") +#ENDIF ; ; SETUP PPI TO READ LD A,PPIDE_DIR_READ ; SET DATA BUS DIRECTION TO READ - OUT (PPIDE_IO_PPI),A ; DO IT + ;OUT (PPIDE_IO_PPI),A ; DO IT + LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD + OUT (C),A ; WRITE IT ; ; PULSE IDE RESET LINE LD A,PPIDE_CTL_RESET - OUT (PPIDE_IO_CTL),A + ;OUT (PPIDE_IO_CTL),A + LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS + OUT (C),A LD DE,20 CALL VDELAY XOR A - OUT (PPIDE_IO_CTL),A + ;OUT (PPIDE_IO_CTL),A + OUT (C),A LD DE,20 CALL VDELAY ; @@ -889,27 +989,17 @@ PPIDE_RESET: LD DE,150000/16 ; ~???MS CALL VDELAY ; - ;; CLEAR OUT ALL DATA (FOR ALL UNITS) - ;LD HL,PPIDE_UDATA - ;LD BC,PPIDE_UDLEN - ;XOR A - ;CALL FILL -; - PUSH IY ; SAVE CURRENT DEVICE CFG PTR -; - ; PROBE / INITIALIZE ALL UNITS - LD B,PPIDE_DEVCNT ; NUMBER OF UNITS TO TRY - LD IY,PPIDE_CFGTBL ; START OF CFG TABLE -PPIDE_RESET1: - PUSH BC ; SAVE LOOP CONTROL - CALL PPIDE_INITUNIT ; PROBE/INIT UNIT - LD BC,PPIDE_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,BC ; BUMP IY TO NEXT ENTRY - POP BC ; RESTORE BC - DJNZ PPIDE_RESET1 ; LOOP AS NEEDED -; - POP IY ; RECOVER DEVICE CFG PTR -; + ; INITIALIZE THE INDIVIDUAL UNITS (MASTER AND SLAVE). + ; BASED ON TESTING, IT APPEARS THAT THE MASTER UNIT MUST + ; BE DONE FIRST OR THIS BEHAVES BADLY. + PUSH IY ; SAVE CFG PTR + BIT 0,(IY+PPIDE_ACC) ; MASTER? + CALL Z,PPIDE_GOPARTNER ; IF NOT, SWITCH TO MASTER + CALL PPIDE_INITUNIT ; INIT CURRENT UNIT + CALL PPIDE_GOPARTNER ; POINT TO SLAVE + CALL PPIDE_INITUNIT ; INIT PARTNER UNIT + POP IY ; RECOVER ORIG CFG PTR +; XOR A ; SIGNAL SUCCESS RET ; AND DONE ; @@ -923,9 +1013,10 @@ PPIDE_INITUNIT: LD (HL),PPIDE_TONORM ; SET NORMAL TIMEOUT CALL PPIDE_PROBE ; DO PROBE - CALL Z,PPIDE_INITDEV ; IF FOUND, ATTEMPT TO INIT DEVICE + RET NZ ; JUST RETURN IF NOTHING THERE - RET + CALL PPIDE_INITDEV ; IF FOUND, ATTEMPT TO INIT DEVICE + RET ; DONE ; ; TAKE ANY ACTIONS REQUIRED TO SELECT DESIRED PHYSICAL UNIT ; @@ -934,18 +1025,15 @@ PPIDE_SELUNIT: CALL PPIDE_PRTPREFIX PRTS(" SELUNIT$") #ENDIF - PUSH HL ; SAVE HL, IT IS DESTROYED BELOW - PUSH IY - POP BC - LD A,(IY+PPIDE_DEV) ; GET DEVICE - AND $01 ; LS BIT DETERMINES MASTER/SLAVE - LD HL,PPIDE_DRVSEL - CALL ADDHLA - LD A,(HL) ; LOAD DRIVE/HEAD VALUE - POP HL ; RECOVER HL + BIT 0,(IY+PPIDE_ACC) ; MASTER? + JR Z,PPIDE_SELUNIT1 ; HANDLE SLAVE + LD A,PPIDE_DRVMASTER ; MASTER + JR PPIDE_SELUNIT2 +PPIDE_SELUNIT1: + LD A,PPIDE_DRVSLAVE ; SLAVE +PPIDE_SELUNIT2: LD (PPIDE_DRVHD),A ; SAVE IT -; - XOR A + XOR A ; SUCCESS RET ; ; @@ -974,7 +1062,9 @@ PPIDE_PROBE: ; THERE, THEN THE VALUE WRITTEN TO PPI PORT A IS IGNORED ; BECAUSE THE WRITE SIGNAL IS NEVER PULSED. XOR A - OUT (PPIDE_IO_DATALO),A + ;OUT (PPIDE_IO_DATALO),A + LD C,(IY+PPIDE_DATALO) ; PPI PORT A, DATALO + OUT (C),A ; IN A,(PPIDE_REG_STAT) ; GET STATUS CALL PPIDE_IN .DB PPIDE_REG_STAT @@ -1047,42 +1137,21 @@ PPIDE_INITDEV: OR A ; SET FLAGS JP Z,PPIDE_NOMEDIA ; EXIT SETTING NO MEDIA STATUS ; - ; CLEAR OUT UNIT SPECIFIC DATA, BUT PRESERVE THE EXISTING - ; VALUE OF THE UNIT TYPE WHICH WAS ESTABLISHED BY THE DEVICE - ; PROBES WHEN THE PPIDE BUS WAS RESET - ;PUSH AF ; SAVE UNIT TYPE VALUE FROM ABOVE - ;LD A,(IY+PPIDE_DEV) ; GET CURRENT DEVICE NUMBER - ;PUSH AF ; ... AND SAVE IT - ;;PUSH HL ; SAVE UNIT TYPE FIELD POINTER - ;;PPIDE_DPTR(0) ; SET HL TO START OF UNIT DATA - ;;LD BC,PPIDE_UDLEN - ;;XOR A - ;;CALL FILL - ;;POP HL ; RECOVER UNIT TYPE FIELD POINTER - ;;POP AF ; RECOVER UNIT TYPE VALUE - ;PUSH IY ; SET HL TO - ;POP HL ; ... START OF DEVICE INSTANCE DATA - ;LD BC,PPIDE_CFGSIZ ; SIZE OF CONFGI DATA TO CLEAR - ;XOR A ; FILL WITH ZERO - ;CALL FILL ; DO IT - ;POP AF ; RECOVER DEVICE NUMBER VALUE - ;LD (IY+PPIDE_DEV),A ; ... AND PUT IT BACK - ;POP AF ; RECOVER DEVICE TYPE VALUE - ;LD (IY+PPIDE_TYPE),A ; ... AND PUT IT BACK -; -#IF (PPIDE8BIT) + BIT 1,(IY+PPIDE_ACC) ; 8 BIT ACCESS? + JR Z,PPIDE_INITDEV0 ; NO, DO 16 BIT INIT LD A,PPIDE_FEAT_ENABLE8BIT ; FEATURE VALUE = ENABLE 8-BIT PIO -#ELSE - LD A,PPIDE_FEAT_DISABLE8BIT ; FEATURE VALUE = DISABLE 8-BIT PIO -#ENDIF CALL PPIDE_SETFEAT ; SET FEATURE - -#IF (PPIDE8BIT) + RET NZ ; BAIL OUT ON ERROR + JR PPIDE_INITDEV00 ; CONTINUE +; +PPIDE_INITDEV0: ; "REAL" IDE DRIVES MAY NOT ACCEPT THE DISABLE8BIT FEATURE COMMAND, ; SO IT IS ONLY AN ERROR IF WE ARE ATTEMPTING TO ENABLE8BIT. - ; CREDIT TO ED BRINDLEY FOR THIS CORRECTION. - RET NZ ; BAIL OUT ON ERROR -#ENDIF + ; CREDIT TO ED BRINDLEY FOR THIS CORRECTION. SO ERROR RETURN IGNORED HERE. + LD A,PPIDE_FEAT_DISABLE8BIT ; FEATURE VALUE = ENABLE 8-BIT PIO + CALL PPIDE_SETFEAT ; SET FEATURE, IGNORE ERRORS +; +PPIDE_INITDEV00: ; CALL PPIDE_IDENTIFY ; EXECUTE PPIDENTIFY COMMAND RET NZ ; BAIL OUT ON ERROR @@ -1090,9 +1159,8 @@ PPIDE_INITDEV: LD DE,HB_WRKBUF ; POINT TO BUFFER DCALL DUMP_BUFFER ; DUMP IT IF DEBUGGING ; - XOR A - LD (IY+PPIDE_FLAGS),0 ; CLEAR FLAGS - + LD (IY+PPIDE_MED),0 ; CLEAR MEDIA FLAGS +; ; DETERMINE IF CF DEVICE LD HL,HB_WRKBUF ; FIRST WORD OF IDENTIFY DATA HAS CF FLAG LD A,$8A ; FIRST BYTE OF MARKER IS $8A @@ -1102,14 +1170,14 @@ PPIDE_INITDEV: LD A,$84 ; SECOND BYTE OF MARKER IS $84 CP (HL) ; COMPARE JR NZ,PPIDE_INITDEV1 ; IF NOT MATCH, NOT CF - SET 0,(IY+PPIDE_FLAGS) ; SET FLAGS BIT FOR CF MEDIA + SET 0,(IY+PPIDE_MED) ; SET FLAGS BIT FOR CF MEDIA ; PPIDE_INITDEV1: ; DETERMINE IF LBA CAPABLE LD A,(HB_WRKBUF+98+1) ; GET BYTE WITH LBA BIT FROM BUFFER BIT 1,A ; CHECK THE LBA BIT JR Z,PPIDE_INITDEV2 ; NOT SET, BYPASS - SET 1,(IY+PPIDE_FLAGS) ; SET FLAGS BIT FOR LBA + SET 1,(IY+PPIDE_MED) ; SET FLAGS BIT FOR LBA ; PPIDE_INITDEV2: ; GET DEVICE CAPACITY AND SAVE IT @@ -1129,15 +1197,24 @@ PPIDE_INITDEV2: ; RET ; RETURN, A=0, Z SET ; +; SWITCH IY POINTER FROM CURRENT UNIT CFG TO PARTNER UNIT CFG ; +PPIDE_GOPARTNER: + PUSH HL ; SAVE HL + LD L,(IY+PPIDE_PARTNER) ; GET PARTNER ENTRY + LD H,(IY+PPIDE_PARTNER+1) ; ... + PUSH HL ; MOVE HL + POP IY ; ... TO IY + POP HL ; RESTORE INCOMING HL + RET ; AND DONE ; -PPIDE_CHKDEVICE: +; CHECK CURRENT DEVICE FOR ERROR STATUS AND ATTEMPT TO RECOVER +; VIA RESET IF DEVICE IS IN ERROR. +; +PPIDE_CHKERR: LD A,(IY+PPIDE_STAT) ; GET STATUS OR A ; SET FLAGS - RET Z ; RETURN IF ALL IS WELL -; - ; ATTEMPT TO REINITIALIZE HERE??? - JP PPIDE_ERR + CALL NZ,PPIDE_RESET ; IF ERROR STATUS, RESET BUS RET ; ; @@ -1205,49 +1282,66 @@ PPIDE_WAITBSY2: DJNZ PPIDE_WAITBSY1 ; ----- JP PPIDE_BSYTO ; EXIT WITH BSYTO ERR ; 229TS ; -; -; +; READ A VALUE FROM THE DEVICE POINTED TO BY IY AND RETURN IT IN A +; PPIDE_IN: - LD A,PPIDE_DIR_READ ; SET DATA BUS DIRECTION TO READ ; 7TS - OUT (PPIDE_IO_PPI),A ; DO IT ; 11TS EX (SP),HL ; GET PARM POINTER ; 19TS PUSH BC ; SAVE INCOMING BC ; 11TS + LD A,PPIDE_DIR_READ ; SET DATA BUS DIRECTION TO READ ; 7TS + ;OUT (PPIDE_IO_PPI),A ; DO IT ; 11TS + LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD + OUT (C),A ; WRITE IT +; LD B,(HL) ; GET CTL PORT VALUE ; 7TS - LD C,PPIDE_IO_CTL ; SETUP PORT TO WRITE ; 7TS + ;LD C,PPIDE_IO_CTL ; SETUP PORT TO WRITE ; 7TS + ;LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS + DEC C ; SET IDE ADDRESS OUT (C),B ; SET ADDRESS LINES ; 12TS - SET 6,B ; TURN ON WRITE BIT ; 8TS - OUT (C),B ; ASSERT WRITE LINE ; 12TS - ;NOP - ;NOP - IN A,(PPIDE_IO_DATALO) ; GET DATA VALUE FROM DEVICE ; 11TS - ;NOP - ;NOP - RES 6,B ; CLEAR WRITE BIT ; 8TS - OUT (C),B ; DEASSERT WRITE LINE ; 12TS + SET 6,B ; TURN ON READ BIT ; 8TS + OUT (C),B ; ASSERT READ LINE ; 12TS +; + ;IN A,(PPIDE_IO_DATALO) ; GET DATA VALUE FROM DEVICE ; 11TS + DEC C + DEC C + IN A,(C) ; GET DATA VALUE FROM DEVICE + INC C + INC C +; + RES 6,B ; CLEAR READ BIT ; 8TS + OUT (C),B ; DEASSERT READ LINE ; 12TS POP BC ; RECOVER INCOMING BC ; 10TS INC HL ; POINT PAST PARM ; 6TS EX (SP),HL ; RESTORE STACK ; 19TS RET ; 10TS -; ; ----- -; ; 170TS ; +; OUTPUT VALUE IN A TO THE DEVICE POINTED TO BY IY +; PPIDE_OUT: + ; *** TODO *** FIX ORDER OF SET/CLEAR WRITE LINE + EX (SP),HL ; GET PARM POINTER + PUSH BC ; SAVE INCOMING BC PUSH AF ; PRESERVE INCOMING VALUE LD A,PPIDE_DIR_WRITE ; SET DATA BUS DIRECTION TO WRITE - OUT (PPIDE_IO_PPI),A ; DO IT + ;OUT (PPIDE_IO_PPI),A ; DO IT + LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD + OUT (C),A ; WRITE IT POP AF ; RECOVER VALUE TO WRITE - EX (SP),HL ; GET PARM POINTER - PUSH BC ; SAVE INCOMING BC +; LD B,(HL) ; GET IDE ADDRESS VALUE - LD C,PPIDE_IO_CTL ; SETUP PORT TO WRITE + ;LD C,PPIDE_IO_CTL ; SETUP PORT TO WRITE + ;LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS + DEC C ; SET IDE ADDRESS OUT (C),B ; SET ADDRESS LINES SET 5,B ; TURN ON WRITE BIT OUT (C),B ; ASSERT WRITE LINE - ;NOP - ;NOP - OUT (PPIDE_IO_DATALO),A ; SEND DATA VALUE TO DEVICE - ;NOP - ;NOP +; + DEC C + DEC C + ;OUT (PPIDE_IO_DATALO),A ; SEND DATA VALUE TO DEVICE + OUT (C),A ; SEND DATA VALUE TO DEVICE + INC C + INC C +; RES 5,B ; CLEAR WRITE BIT OUT (C),B ; DEASSERT WRITE LINE POP BC ; RECOVER INCOMING BC @@ -1357,26 +1451,40 @@ PPIDE_PRTSTAT3: PPIDE_REGDUMP: PUSH AF PUSH BC + push DE CALL PC_SPACE CALL PC_LBKT LD A,PPIDE_DIR_READ ; SET DATA BUS DIRECTION TO READ - OUT (PPIDE_IO_PPI),A ; DO IT - LD C,PPIDE_REG_CMD + ;OUT (PPIDE_IO_PPI),A ; DO IT + LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD + OUT (C),A ; WRITE IT + LD C,(IY+PPIDE_CTL) ; SET IDE ADDRESS + LD E,PPIDE_REG_CMD LD B,7 PPIDE_REGDUMP1: - LD A,C ; REGISTER ADDRESS - OUT (PPIDE_IO_CTL),A ; SET IT + LD A,E ; REGISTER ADDRESS + ;OUT (PPIDE_IO_CTL),A ; SET IT + OUT (C),A ; REGISTER ADDRESS XOR PPIDE_CTL_DIOR ; SET BIT TO ASSERT READ LINE - OUT (PPIDE_IO_CTL),A ; ASSERT READ - IN A,(PPIDE_IO_DATALO) ; GET VALUE + ;OUT (PPIDE_IO_CTL),A ; ASSERT READ + OUT (C),A ; ASSERT READ + ;IN A,(PPIDE_IO_DATALO) ; GET VALUE + DEC C ; CTL -> MSB + DEC C ; MSB -> LSB + IN A,(C) ; GET VALUE + INC C ; LSB -> MSB + INC C ; MSB -> CTL CALL PRTHEXBYTE ; DISPLAY IT - LD A,C ; RELOAD ADDRESS W/ READ UNASSERTED - OUT (PPIDE_IO_CTL),A ; AND SET IT - DEC C ; NEXT LOWER REGISTER + ;LD A,C ; RELOAD ADDRESS W/ READ UNASSERTED + ;OUT (PPIDE_IO_CTL),A ; AND SET IT + OUT (C),E ; RELOAD ADDRESS W/ READ UNASSERTED + ;DEC C ; NEXT LOWER REGISTER + DEC E ; NEXT LOWER REGISTER DEC B ; DEC LOOP COUNTER CALL NZ,PC_SPACE ; FORMATTING JR NZ,PPIDE_REGDUMP1 ; LOOP AS NEEDED CALL PC_RBKT ; FORMATTING + POP DE POP BC POP AF RET @@ -1433,6 +1541,8 @@ PPIDE_STR_STBSYTO .TEXT "BUSY TIMEOUT$" PPIDE_STR_STUNK .TEXT "UNKNOWN ERROR$" ; PPIDE_STR_NO .TEXT "NO$" +PPIDE_STR_NOPPI .TEXT "PPI NOT PRESENT$" +PPIDE_STR_8BIT .TEXT " 8-BIT$" ; ;============================================================================= ; DATA STORAGE @@ -1446,3 +1556,5 @@ PPIDE_IOFNADR .DW 0 ; PENDING IO FUNCTION ADDRESS PPIDE_DRVHD .DB 0 ; CURRENT DRIVE/HEAD MASK ; PPIDE_DSKBUF .DW 0 ; ACTIVE DISK BUFFER +; +PPIDE_DEVNUM .DB 0 ; TEMP DEVICE NUM USED DURING INIT diff --git a/Source/HBIOS/rf.asm b/Source/HBIOS/rf.asm index a259a58a..30588a57 100644 --- a/Source/HBIOS/rf.asm +++ b/Source/HBIOS/rf.asm @@ -7,6 +7,8 @@ ; RF_U0IO .EQU $A0 RF_U1IO .EQU $A4 +RF_U2IO .EQU $A8 +RF_U3IO .EQU $AC ; ; IO PORT OFFSETS ; @@ -18,24 +20,51 @@ RF_ST .EQU 3 ; MD DEVICE CONFIGURATION ; RF_DEVCNT .EQU RFCNT ; NUMBER OF RF DEVICES SUPPORTED -RF_CFGSIZ .EQU 6 ; SIZE OF CFG TBL ENTRIES +RF_CFGSIZ .EQU 8 ; SIZE OF CFG TBL ENTRIES +RF_MAXRF .EQU 4 ; MAXIMUM NUMBERS OF DEVICES SUPPORTED ; RF_DEV .EQU 0 ; OFFSET OF DEVICE NUMBER (BYTE) RF_STAT .EQU 1 ; OFFSET OF STATUS (BYTE) RF_LBA .EQU 2 ; OFFSET OF LBA (DWORD) +RF_IOAD .EQU 7 ; OFFSET OF DEVICE IO ADDRESS + +#IF ($RF_DEVCNT > RF_MAXRF) + .ECHO "*** ONLY 4 RAM FLOPPY DEVICES SUPPORTED ***\n" +RF_DEVCNT .SET RF_MAXRF +#ENDIF ; ; DEVICE CONFIG TABLE (RAM DEVICE FIRST TO MAKE IT ALWAYS FIRST DRIVE) ; RF_CFGTBL: - ; DEVICE 0 ($A0) + ; DEVICE 0 .DB 0 ; DRIVER DEVICE NUMBER .DB 0 ; DEVICE STATUS .DW 0,0 ; CURRENT LBA -#IF (RF_DEVCNT >= 2) - ; DEVICE 1 ($A4) + .DB 0 ; UNUSED + .DB RF_U0IO ; DEVICE BASE ADDR +#IF (RF_DEVCNT > 1) + ; DEVICE 1 .DB 1 ; DEVICE NUMBER .DB 0 ; DEVICE STATUS .DW 0,0 ; CURRENT LBA + .DB 0 ; UNUSED + .DB RF_U1IO ; DEVICE BASE ADDR +#ENDIF +#IF (RF_DEVCNT > 2) + ; DEVICE 2 + .DB 2 ; DRIVER DEVICE NUMBER + .DB 0 ; DEVICE STATUS + .DW 0,0 ; CURRENT LBA + .DB 0 ; UNUSED + .DB RF_U2IO ; DEVICE BASE ADDR +#ENDIF +; ; DEVICE 3 +#IF (RF_DEVCNT > 3) + .DB 3 ; DEVICE NUMBER + .DB 0 ; DEVICE STATUS + .DW 0,0 ; CURRENT LBA + .DB 0 ; UNUSED + .DB RF_U3IO ; DEVICE BASE ADDR #ENDIF ; #IF ($ - RF_CFGTBL) != (RF_DEVCNT * RF_CFGSIZ) @@ -48,38 +77,12 @@ RF_CFGTBL: ; RF_INIT: CALL NEWLINE ; FORMATTING - PRTS("RF: IO=0x$") - LD A,RF_U0IO - CALL PRTHEXBYTE - PRTS(" DEVICES=$") - LD A,RF_DEVCNT - CALL PRTDECB - PRTS(" WP=$") - IN A,(RF_U0IO+3) - AND 1 - JR Z,NO_WP1 - PRTS("ON$") - JR D2_WP1 -NO_WP1: - PRTS("OFF$") -D2_WP1: - #IF (RF_DEVCNT >= 2) - IN A,(RF_U1IO+3) - AND 1 - JR Z,NO_WP2 - PRTS("-ON$") - JR D2_WP2 -NO_WP2: - PRTS("-OFF$") -D2_WP2: - - #ENDIF -; -; SETUP THE DIO TABLE ENTRIES -; + PRTS("RF:$") + LD B,RF_DEVCNT ; LOOP CONTROL LD IY,RF_CFGTBL ; START OF CFG TABLE RF_INIT0: + CALL RF_UNIT PUSH BC ; SAVE LOOP CONTROL LD BC,RF_FNTBL ; BC := FUNC TABLE ADR PUSH IY ; CFG ENTRY POINTER @@ -89,10 +92,30 @@ RF_INIT0: ADD IY,BC ; BUMP IY TO NEXT ENTRY POP BC ; RESTORE BC DJNZ RF_INIT0 ; LOOP AS NEEDED + + PRTS(" DEVICES=$") ; DISPLAY NUMBER + LD A,RF_DEVCNT ; OF DEVICES + CALL PRTDECB ; XOR A ; INIT SUCCEEDED RET ; RETURN ; +RF_UNIT: + PRTS(" IO=0x$") ; DISPLAY + LD A,(IY+RF_IOAD) ; PORT AND + CALL PRTHEXBYTE ; WRITE + PRTS(" WP=$") ; PROTECT + ADD A,RF_ST ; STATUS OF + LD C,A ; THIS DEVICE + IN A,(C) + AND 1 + JR Z,RF_NO_WP1 + PRTS("ON$") + RET +RF_NO_WP1: + PRTS("OFF$") + RET +; ; ; RF_FNTBL: @@ -265,21 +288,9 @@ RF_WRSEC: ; ; RF_SETIO: - LD A,(IY+RF_DEV) ; GET DEVICE NUM - OR A ; SET FLAGS - JR NZ,RF_SETIO1 - LD A,RF_U0IO - JR RF_SETIO3 -RF_SETIO1: - DEC A - JR NZ,RF_SETIO2 - LD A,RF_U1IO - JR RF_SETIO3 -RF_SETIO2: - CALL PANIC ; INVALID UNIT -RF_SETIO3: - LD (RF_IO),A - RET + LD A,(IY+RF_IOAD) ; GET THE IO PORT + LD (RF_IO),A ; OF THE DEVICE WE + RET ; ARE WORKING ON ; ; ; diff --git a/Source/HBIOS/romldr.asm b/Source/HBIOS/romldr.asm index 59256504..c6be9084 100644 --- a/Source/HBIOS/romldr.asm +++ b/Source/HBIOS/romldr.asm @@ -206,8 +206,7 @@ MENU4: ; BOOT SELECTION PROCESSING ;================================================================================================== ; -SEL: - ; HANDLE SERIAL CONSOLE INPUT +SEL: ; HANDLE SERIAL CONSOLE INPUT CALL CST ; CHECK CONSOLE INPUT OR A ; ZERO? JR Z,SEL1 ; IF NOT, CONTINUE @@ -221,9 +220,13 @@ SEL: OUT (LEDPORT),A ; CLEAR LED #ENDIF #ENDIF - CALL CINUC ; GET THE KEY - CALL COUT ; ECHO KEY - JR MATS ; AND HANDLE IT + CALL CINUC ; GET THE KEY + CALL COUT ; ECHO KEY + CP 'R' ; CHECK FOR + JP Z,REBOOT ; REBOOT REQUEST + LD DE,MENU_S+10-MENU_V ; POINT TO SERIAL MENU COLUMN + LD C,2 ; SET SERIAL FLAG + JR MATS ; GO CHECK MENU SELECTION ; SEL1: #IF (DSKYENABLE) @@ -241,8 +244,14 @@ SEL1: OUT (LEDPORT),A ; CLEAR LED #ENDIF #ENDIF - CALL DSKY_GETKEY ; GET PENDING KEY PRESS - JR MATK ; AND HANDLE IT + CALL DSKY_GETKEY ; GET PENDING KEY PRESS ; NOTE DESKY_GETKEY + CP $FF ; CHECK FOR ERROR + JR Z,SEL2 ; IF SO, IGNORE KEY, AND CONT LOOPING + CP KY_BO ; CHECK FOR REBOOT ; CAN RETURN AN INVALID + JP Z,REBOOT ; REBOOT REQUEST ; KEYSCAN AS FFH WHICH + LD DE,MENU_S+11-MENU_V ; POINT TO DSKY MENU COLUMN ; MAY BE MATCHED WITH + LD C,1 ; SET DSKY FLAG ; DUMMY MENU ENTRIES + JR MATS ; GO CHECK MENU SELECTION #ENDIF ; SEL2: @@ -267,8 +276,10 @@ SEL2: OUT (LEDPORT),A ; CLEAR LED #ENDIF #ENDIF - LD A,BOOT_DEFAULT ; TIMEOUT EXPIRED, - JR MATS ; PERFORM DEFAULT BOOT ACTION + LD A,BOOT_DEFAULT ; TIMEOUT EXPIRED, + LD DE,MENU_S+10-MENU_V ; POINT TO SERIAL MENU COLUMN + LD C,2 ; SET SERIAL FLAG + JR MATS ; PERFORM DEFAULT BOOT ACTION #ENDIF ; SEL3: @@ -279,51 +290,96 @@ SEL3: ; ROM MENU TABLE MATCHING ;================================================================================================== ; -MATS: ; MATCH SERIAL INPUT TO MENU - CP 'R' - JP Z,REBOOT - LD B,MENU_N - LD DE,MENU_S+10-MENU_V - LD HL,MENU_V -MATS1: EX DE,HL - ADD HL,DE - CP (HL) - EX DE,HL +MATS: LD B,MENU_N ; LOOP THROUGH THE ; ON ENTRY DE POINTS TO + LD HL,MENU_V ; MENU TABLE AND ; THE MENU COLUMN WE ARE +MATS1: EX DE,HL ; CHECK IF THE ; CHECKING AND C CONTAINS + ADD HL,DE ; KEYPRESS MATCHES ; A FLAG TELLING US IF WE + CP (HL) ; ANY OF ; HAVE DSKY OR SERIAL INPUT + EX DE,HL ; THE MENU ITEMS. JR Z,MATS2 - DJNZ MATS1 ; FALL THRU IF IT DOES NOT MATCH ROM MENU - SUB '0' ; CONVERT ASCII TO BINARY - JR MATD ; AND TRY DISK BOOT -MATS2: INC DE ; SKIP MENU SEL CHAR - INC DE ; SKIP DSKY SEL CHAR - JP GOROM ; BOOT FROM ROM + DJNZ MATS1 ; IF WE REACH THE TABLE END AND DON'T HAVE + JR MATD ; A MATCH GO AND CHECK FOR A DISK SELECTION +; +MATS2: LD B,0 ; WE GOT A MATCH FROM THE MENU TABLE. POINT + EX DE,HL ; TO THE ROM ADDRESS TO EXECUTE. ADJUST THE + ADD HL,BC ; POINTER TO THE ROM ENTRY BASED ON WHETHER WE + EX DE,HL ; GOT A MATCH IN THE DSKY OR SERIAL MENU COLUMN + JP GOROM ; JUMP TO THE ROM HANDLER. +; +MATD: LD B,A + LD A,C ; IF INPUT WAS SERIAL + DEC C ; CONVERT TO FROM. + LD A,B ; ASCII TO DECIMAL. + JR Z,MATD1 ; DSKY NUMBERS ARE + SUB '0' ; ALREADY DECIMAL +MATD1: CP 10 ; DO A RANGE CHECK + JR NC,MATX ; NOT VALID, HANDLE IT BELOW ; -#IF (DSKYENABLE) -MATK: ; MATCH DSKY INPUT TO MENU - CP KY_BO - JP Z,REBOOT - LD B,MENU_N - LD DE,MENU_S+11-MENU_V - LD HL,MENU_V -MATK1: EX DE,HL - ADD HL,DE - CP (HL) - EX DE,HL - JR Z,MATK2 - DJNZ MATK1 ; FALL THRU IF IT DOES NOT MATCH DSKY MENU - JR MATD ; TRY DISK BOOT -MATK2: INC DE ; SKIP DSKY SEL CHAR - JP GOROM ; BOOT FROM ROM + PUSH BC + PUSH AF ; HOW MANY DISK + LD B,BF_SYSGET ; DEVICES DO WE + LD C,BF_SYSGET_DIOCNT ; HAVE IN THE + RST 08 ; SYSTEM ? + POP AF + POP BC +; JR MATD2 ; IF MORE THEN 9 ; UNCOMMENT TO TEST DOUBLE CHAR ENTRY + CP 10 ; THEN WE NEED TO GET + JR NC,MATD2 ; ANOTHER CHARACTER +; + CP E ; WE DON'T HAVE MORE THAN 10 DEVICES SO ; A = REQUESTED UNIT + JP C,GOBOOTDISK ; CHECK IT IS IN RANGE. BOOT IF IT IS ; E = AVAILABLE UNITS + JR MATX ; IT IF NOT VALID, HANDLE IT BELOW + +MATD2: LD B,A ; PROCESS FURTHER INPUT ; B = REQUESTED UNIT + LD A,C ; CHECK WHERE TO GET ; C = DSKY/SERIAL FLAG + DEC C ; THE INPUT FROM AND GO + JR NZ,MATD3 ; GET ANOTHER CHARACTER +; +#IF (DSKYENABLE) ; INPUT DSKY +; +MATD4: ;CALL DSKY_STAT ; WAIT FOR + ;OR A ; ANOTHER + ;JR Z,MATD4 ; KEY FROM + ;CALL DSKY_GETKEY ; DSKY + CALL DSKY_KEY + + CP KY_EN ; IF NEXT KEY IS ENTER + JR Z,MATD6 ; OR GO, PROCESS AS A + CP KY_GO ; SINGLE DIGIT NUMBER + JR Z,MATD6 ; OTHERWISE JOIN TWO + JR MATD5 ; CHARCTERS IN ONE DECIMAL #ENDIF ; -MATD: ; CHECK FOR DISK BOOT REQUEST - CP 10 ; 0-9, DISK DEVICE - JR NC,MATX ; NOT VALID, HANDLE IT BELOW - JP GOBOOTDISK ; BOOT FROM DISK +; ; INPUT SERIAL +; +MATD3: ;CALL CST ; WAIT FOR + ;OR A ; ANOTHER + ;JR Z,MATD3 ; KEY FROM + CALL CINUC ; SERIAL + CALL COUT ; -MATX: - ; SET ERROR STRING AND LOOP - LD DE,STR_INVALID ; INVALID SEL MSG - JP MENU ; RESTART MENU LOOP + CP CHR_CR ; IF NEXT KEY IS RETURN PROCESS + JR Z,MATD6 ; AS A SINGLE DIGIT NUMBER +; + SUB '0' ; CONVERT THE SERIAL NUMBER TO DECIMAL + CP 10 ; DO A RANGE CHECK + JR NC,MATX ; NOT VALID, HANDLE IT BELOW + +MATD5: LD C,A ; C CONTAINS SECOND CHARACTER INPUT 0..9 + LD A,B ; A CONTAINS FIRST NUMBER INPUT 0..9 + ADD A,A + LD B,A ; MULTIPLY FIRST DIGIT BY 10 + ADD A,A ; AND ADD SECOND DIGIT + ADD A,A + ADD A,B ; CONVERT TWO INPUTTED + ADD A,C ; CHARACTERS TO DECIMAL. + LD B,A +; +MATD6: LD A,B ; PUT THE DEVICE NUMBER TO BOOT + JP GOBOOTDISK ; IN A AND GO BOOT DEVICE +; +MATX: LD DE,STR_INVALID ; SET ERROR STRING MESSAGE + JP MENU ; AND RESTART MENU LOOP ; ;================================================================================================== ; ROM MENU TABLE @@ -368,6 +424,8 @@ MENU_1: MENU_L("~CP/M$ ", "C", KY_BK, CPM_ENT, 2000h, CPM_LOC, CPM_SIZ MENU_L("~Forth$ ", "F", KY_EX, FTH_LOC, 0000h, FTH_LOC, FTH_SIZ, BID_IMG1, BID_USR, "Camel Forth$ ") MENU_L("~BASIC$ ", "B", KY_DE, BAS_LOC, 1700h, BAS_LOC, BAS_SIZ, BID_IMG1, BID_USR, "Nascom BASIC$") MENU_L("~T-BASIC$ ", "T", KY_EN, TBC_LOC, 3700h, TBC_LOC, TBC_SIZ, BID_IMG1, BID_USR, "Tasty BASIC$ ") + MENU_L("~PLAY$ ", "P", $FF, GAM_LOC, 4000h, GAM_LOC, GAM_SIZ, BID_IMG1, BID_USR, "Game$ ") + MENU_L("~USER ROM$", "U", $FF, USR_LOC, 7000h, USR_LOC, USR_SIZ, BID_IMG1, BID_USR, "User ROM$ ") #ENDIF #IF (DSKYENABLE) MENU_L("~DSKY$ ", "D", KY_GO, MON_DSKY, 1000h, MON_LOC, MON_SIZ, BID_CUR, BID_USR, "DSKY Monitor$") @@ -507,7 +565,7 @@ GOBOOTDISK: LD (BL_BOOTID),A LD DE,STR_BOOTDISK CALL WRITESTR - CALL PRTHEXBYTE + CALL PRTDECB PRTS("...$") #IF (DSKYENABLE) LD HL,MSG_LOAD ; POINT TO LOAD MESSAGE @@ -736,8 +794,7 @@ PRTDRV: LD A,'(' ; NEWLINE AND SPACING CALL COUT ; PRINT IT LD A,B ; DRIVE LETTER TO A - ADD A,'0' ; MAKE IT DISPLAY NUMERIC - CALL COUT ; PRINT IT + CALL PRTDECB LD A,')' ; DRIVE LETTER COLON CALL COUT ; PRINT IT POP DE ; RECOVER DISK TYPE @@ -806,8 +863,7 @@ PRTALL1: LD A,'(' ; FORMATTING CALL COUT ; PRINT IT LD A,C ; INDEX TO A - ADD A,'0' ; MAKE NUMERIC CHAR - CALL COUT ; PRINT IT + CALL PRTDECB LD A,')' ; FORMATTING CALL COUT ; PRINT IT PUSH BC ; SAVE LOOP CONTROL diff --git a/Source/HBIOS/std.asm b/Source/HBIOS/std.asm index 744f7afe..7dc8aa40 100644 --- a/Source/HBIOS/std.asm +++ b/Source/HBIOS/std.asm @@ -148,10 +148,8 @@ FDMODE_DYNO .EQU 9 ; DYNO WDC 37C65 @ $84 IDEMODE_NONE .EQU 0 IDEMODE_DIO .EQU 1 ; DISKIO V1 IDEMODE_DIDE .EQU 2 ; DUAL IDE -IDEMODE_MK4 .EQU 3 ; MARK IV ONBOARD IDE (8 BIT) -IDEMODE_RC .EQU 4 ; RC2014 CF MODULE (8 BIT) @ $10 (SPENCER OWEN) -IDEMODE_SMB .EQU 5 ; RC2014 IDE MODULE (8 BIT) @ $E0 (SCOTT BAKER) -IDEMODE_DYNO .EQU 6 ; DYNO IDE MODULE (8 BIT) @4A +IDEMODE_MK4 .EQU 3 ; MARK IV ONBOARD IDE (8 BIT ONLY) +IDEMODE_RC .EQU 4 ; RC2014 CF MODULE (8 BIT ONLY) ; ; PPIDE MODE SELECTIONS ; @@ -429,6 +427,14 @@ FTH_LOC .EQU $0200 ; CAMEL FORTH FTH_SIZ .EQU $1700 FTH_END .EQU FTH_LOC + FTH_SIZ +GAM_LOC .EQU $0200 ; GAME 2048 +GAM_SIZ .EQU $0900 +GAM_END .EQU GAM_LOC + GAM_SIZ + +USR_LOC .EQU $0200 ; USER +USR_SIZ .EQU $1000 +USR_END .EQU USR_LOC + USR_SIZ + MON_DSKY .EQU MON_LOC + (0 * 3) ; MONITOR ENTRY (DSKY) MON_SERIAL .EQU MON_LOC + (1 * 3) ; MONITOR ENTRY (SERIAL PORT) ; diff --git a/Source/HBIOS/usrrom.asm b/Source/HBIOS/usrrom.asm new file mode 100644 index 00000000..5d4ff8e7 --- /dev/null +++ b/Source/HBIOS/usrrom.asm @@ -0,0 +1,80 @@ +; +; USRROM TEMPLATE FOR A CUSTOM USER ROM +; +#INCLUDE "std.asm" +; +CR .EQU 0DH +LF .EQU 0AH +; + .ORG USR_LOC +; + LD HL,BOOTMSG ; INTRODUCTION + CALL PRTSTR + + CALL CIN ; DO STUFF +; + LD A,00H ; RETURN TO ROM LOADER + LD HL,0000H + JP 0FFF9H +; RET +; +; +; +; PRINT A STRING AT ADDRESS SPECIFIED IN HL +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; LD HL,MYSTR +; CALL PRTSTR +; ... +; MYSTR: .DB "HELLO$" +; +PRTSTR: LD A,(HL) + INC HL + CP '$' + RET Z + CALL COUT + JR PRTSTR +; +; OUTPUT CHARACTER IN A TO CONSOLE DEVICE +; +COUT: PUSH AF + PUSH BC + PUSH DE + LD B,01H + LD C,0 + LD E,A + RST 08 + POP DE + POP BC + POP AF + RET +; +; OUTPUT CHARACTER IN A TO CONSOLE DEVICE +; +COUTE: PUSH AF + LD A,E + CALL COUT + POP AF + RET +; +; WAIT FOR A CHARACTER FROM THE CONSOLE DEVICE AND RETURN IT IN A +; +CIN: PUSH BC + LD B,00H + LD C,00H + RST 08 + LD A,E + POP BC + RET +; +BOOTMSG:.DB "No User ROM Installed." + .DB CR,LF + .DB "Press a key to return to Boot Loader.$" +; +SLACK .EQU (USR_END - $) + .FILL SLACK,00 + .ECHO "User ROM space remaining: " + .ECHO SLACK + .ECHO " bytes.\n" + .END + diff --git a/Source/HBIOS/ver.inc b/Source/HBIOS/ver.inc index 530202ad..b65ec245 100644 --- a/Source/HBIOS/ver.inc +++ b/Source/HBIOS/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 9 #DEFINE RUP 2 #DEFINE RTP 0 -#DEFINE BIOSVER "2.9.2-pre.27" +#DEFINE BIOSVER "2.9.2-pre.29" diff --git a/Source/Images/.gitignore b/Source/Images/.gitignore new file mode 100644 index 00000000..a5b5c746 --- /dev/null +++ b/Source/Images/.gitignore @@ -0,0 +1,2 @@ +blank144 +blankhd diff --git a/Source/Images/Build.cmd b/Source/Images/Build.cmd index 6006c3e6..86533ade 100644 --- a/Source/Images/Build.cmd +++ b/Source/Images/Build.cmd @@ -6,20 +6,12 @@ echo : Cleaning... echo : call Clean.cmd -echo : -echo : Creating System Images -echo : -copy /b ..\bl\bl.bin + ..\cpm22\os2ccp.bin + ..\cpm22\os3bdos.bin + ..\cbios\cbios_wbw.bin cpm_wbw.sys -copy /b ..\bl\bl.bin + ..\cpm22\os2ccp.bin + ..\cpm22\os3bdos.bin + ..\cbios\cbios_una.bin cpm_una.sys -copy /b ..\bl\bl.bin + ..\zcpr-dj\zcpr.bin + ..\zsdos\zsdos.bin + ..\cbios\cbios_wbw.bin zsys_wbw.sys -copy /b ..\bl\bl.bin + ..\zcpr-dj\zcpr.bin + ..\zsdos\zsdos.bin + ..\cbios\cbios_una.bin zsys_una.sys - echo : echo : Building Floppy Disk Images... echo : -call BuildFD.cmd cpm22 cpm_wbw -call BuildFD.cmd zsdos zsys_wbw -call BuildFD.cmd nzcom zsys_wbw +call BuildFD.cmd cpm22 ..\cpm22\cpm_wbw.sys +call BuildFD.cmd zsdos ..\zsdos\zsys_wbw.sys +call BuildFD.cmd nzcom ..\zsdos\zsys_wbw.sys call BuildFD.cmd cpm3 call BuildFD.cmd zpm3 call BuildFD.cmd ws4 @@ -27,9 +19,11 @@ call BuildFD.cmd ws4 echo : echo : Building Hard Disk Images... echo : -call BuildHD.cmd cpm22 cpm_wbw -call BuildHD.cmd zsdos zsys_wbw -call BuildHD.cmd nzcom zsys_wbw +call BuildHD.cmd cpm22 ..\cpm22\cpm_wbw.sys +call BuildHD.cmd zsdos ..\zsdos\zsys_wbw.sys +call BuildHD.cmd nzcom ..\zsdos\zsys_wbw.sys call BuildHD.cmd cpm3 call BuildHD.cmd zpm3 call BuildHD.cmd ws4 + +if exist ..\BPBIOS\bpbio-ww.rel call BuildHD.cmd bp diff --git a/Source/Images/BuildFD.ps1 b/Source/Images/BuildFD.ps1 index 531a891f..f482bc10 100644 --- a/Source/Images/BuildFD.ps1 +++ b/Source/Images/BuildFD.ps1 @@ -1,4 +1,5 @@ -Param([Parameter(Mandatory)]$Disk, $SysFile="") +#Param([Parameter(Mandatory)]$Disk, $SysFile="") +Param($Disk, $SysFile="") $ErrorAction = 'Stop' @@ -18,8 +19,23 @@ if (-not (Test-Path("d_${Disk}/"))) "Generating Floppy Disk ${Disk}..." -$Blank = ([string]([char]0xE5)) * $Size -Set-Content -Value $Blank -NoNewLine -Path $ImgFile +#$Blank = ([string]([char]0xE5)) * $Size +#Set-Content -Value $Blank -NoNewLine -Path $ImgFile +$Blank = ([byte[]](0xE5) * $Size) +[System.IO.File]::WriteAllBytes($ImgFile, $Blank) + +if ($SysFile.Length -gt 0) +{ + "Adding System Image $SysFile..." + #$Sys = Get-Content -Path "$SysFile.sys" -Raw + #$Img = Get-Content -Path $ImgFile -Raw + #$NewImg = $Sys + $Img.SubString($Sys.Length, $Img.Length - $Sys.Length) + #Set-Content -NoNewLine -Path $ImgFile $NewImg + + $Cmd = "mkfs.cpm -f $Fmt -b $SysFile $ImgFile" + $Cmd + Invoke-Expression $Cmd +} for ($Usr=0; $Usr -lt 16; $Usr++) { @@ -45,17 +61,9 @@ if (Test-Path("d_${Disk}.txt")) } } -if ($SysFile.Length -gt 0) -{ - "Adding System Image $SysFile..." - $Sys = Get-Content -Path "$SysFile.sys" -Raw - $Img = Get-Content -Path $ImgFile -Raw - $NewImg = $Sys + $Img.SubString($Sys.Length, $Img.Length - $Sys.Length) - Set-Content -NoNewLine -Path $ImgFile $NewImg -} - "Moving image $ImgFile into output directory..." -&$env:COMSPEC /c move $ImgFile ..\..\Binary\ +#&$env:COMSPEC /c move $ImgFile ..\..\Binary\ +Move-Item $ImgFile -Destination "..\..\Binary\" -Force return \ No newline at end of file diff --git a/Source/Images/BuildHD.ps1 b/Source/Images/BuildHD.ps1 index 523a4b62..eedfa4aa 100644 --- a/Source/Images/BuildHD.ps1 +++ b/Source/Images/BuildHD.ps1 @@ -1,4 +1,5 @@ -Param([Parameter(Mandatory)]$Disk, $SysFile="") +#Param([Parameter(Mandatory)]$Disk, $SysFile="") +Param($Disk, $SysFile="") $ErrorAction = 'Stop' @@ -18,8 +19,23 @@ if (-not (Test-Path("d_${Disk}/"))) "Generating Hard Disk ${Disk}..." -$Blank = ([string]([char]0xE5)) * $Size -Set-Content -Value $Blank -NoNewLine -Path $ImgFile +#$Blank = ([string]([char]0xE5)) * $Size +#Set-Content -Value $Blank -NoNewLine -Path $ImgFile +$Blank = ([byte[]](0xE5) * $Size) +[System.IO.File]::WriteAllBytes($ImgFile, $Blank) + +if ($SysFile.Length -gt 0) +{ + "Adding System Image $SysFile..." + #$Sys = Get-Content -Path "$SysFile.sys" -Raw + #$Img = Get-Content -Path $ImgFile -Raw + #$NewImg = $Sys + $Img.SubString($Sys.Length, $Img.Length - $Sys.Length) + #Set-Content -NoNewLine -Path $ImgFile $NewImg + + $Cmd = "mkfs.cpm -f $Fmt -b $SysFile $ImgFile" + $Cmd + Invoke-Expression $Cmd +} for ($Usr=0; $Usr -lt 16; $Usr++) { @@ -45,17 +61,9 @@ if (Test-Path("d_${Disk}.txt")) } } -if ($SysFile.Length -gt 0) -{ - "Adding System Image $SysFile..." - $Sys = Get-Content -Path "$SysFile.sys" -Raw - $Img = Get-Content -Path $ImgFile -Raw - $NewImg = $Sys + $Img.SubString($Sys.Length, $Img.Length - $Sys.Length) - Set-Content -NoNewLine -Path $ImgFile $NewImg -} - "Moving image $ImgFile into output directory..." -&$env:COMSPEC /c move $ImgFile ..\..\Binary\ +#&$env:COMSPEC /c move $ImgFile ..\..\Binary\ +Move-Item $ImgFile -Destination "..\..\Binary\" -Force return \ No newline at end of file diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 6c696362..9860c396 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -39,8 +39,6 @@ zsys_una.sys: ../ZCPR-DJ/zcpr.bin ../ZSDOS/ZSDOS.BIN \ ../CBIOS/cbios_una.bin) > zsys_una.sys -HDSIZE=$(shell expr 128 '*' 65) - # # this somewhat impenetrable and fragile code is used to build each of the images # at build time, a few variables are set (sys, fmt, type, size, d) based on the @@ -49,17 +47,23 @@ HDSIZE=$(shell expr 128 '*' 65) # then process the d_{d}.txt file, copying in those files, and finally maybe put # an OS at the start of each image # -%.img:: $(SYSTEMS) +blank144: + LANG=en_US.US-ASCII tr '\000' '\345'