Commit 52194c19 authored by ASCP's avatar ASCP

Initial commit

parents
This diff is collapsed.
Short: Dos-2-Dos source code
Uploader: amigasourcecodepreservation@gmail.com
Author: Canux Corporation
Type: misc/emu
Version: 3.0
Architecture: generic
Source code for Dos-2-Dos.
Binaries: {URL}
Uploaded to aminet for historical preservation.
Many thanks to Canux Corporation for releasing the source code.
As the software now is GPL, please also upload the full binary
releases of the software if you have them.
License
=======
Dos-2-Dos is distributed under the terms of the GNU General Public License,
version 2 or later. See the COPYING file for details.
All files part of Dos-2-Dos has
Copyright (C) 1996-2018 Canux Corporation
Notes
======
This is part of a batch of releases from Canux Corporation.
The source code was obtained from floppys disks, which was found
and preserved with a kryoflux (thanks SPS).
There might be more than one version of source code in one archive.
(v1.0, 1993 etc). Please submit any work you might to do to our gitlab in
a pull request.
A bit of the source code history from the copyright owner:
"
All of the sources with the exception of DesignWorks 2.0 and PowerManager
(and I don’t know if that source was included in what I sent you) were created
by a US company called “New Horizons”. When NH sold off their IP
(intellectual property) I was leading a development team at a company
called WCi in Ottawa Ontario and we bid on and won the auction of those assets.
I believe that was in 1994.
We rolled out a new version of DesignWorks (as mentioned) along with other
products like an Amiga power manager, a keyboard protocol converter (KB-10) and others.
WCi went out of business in 1995 or 1996. I personally bid on and
won the auction for WCi’s IP sometime after that. We did not do any
more Amiga development afterwards but some of our software was featured
in Amiga magazines at the time and we continued to build and sell our hardware products."
HELP US
===========
1) As the software now is GPL, please also upload the full binary
releases of the software if you have them, or send them to us.
2) Contact your old amiga friends and tell them about
our project, and ask them to dig out their source code or floppies
and send them to us for preservation.
3) Clean up our archives, and make the source code buildable
with standard compilers like devpac, asmone, gcc 2.9x/Beppo 6.x
, vbcc and friends.
Cheers!
Twitter
https://twitter.com/AmigaSourcePres
Gitlab
https://gitlab.com/AmigaSourcePres
WWW
https://amigasourcepres.gitlab.io/
_____ ___ _ __ __ _ __ __ ___ ___ _
|_ _| __| /_\ | \/ | /_\ | \/ |_ _/ __| /_\
| | | _| / _ \| |\/| | / _ \| |\/| || | (_ |/ _ \
_|_| |___/_/ \_\_|_ |_|_/_/_\_\_|__|_|___\___/_/_\_\
/ __|/ _ \| | | | _ \/ __| __| / __/ _ \| \| __|
\__ \ (_) | |_| | / (__| _| | (_| (_) | |) | _|
|___/\___/_\___/|_|_\\___|___|__\___\___/|___/|___|_
| _ \ _ \ __/ __| __| _ \ \ / /_\_ _|_ _/ _ \| \| |
| _/ / _|\__ \ _|| /\ V / _ \| | | | (_) | .` |
|_| |_|_\___|___/___|_|_\ \_/_/ \_\_| |___\___/|_|\_|
Disclaimer
=======
We handle of lot legacy code that we get sent. By error, sometimes a copyrighted file
that we don't have the permission to release could by mistake be included in the release archives.
If you find something that shouldn't be there, and you can prove that you are the copyright
owner to it, please contact us and we will do our best to resolve the issue.
This diff is collapsed.
*****************************************************************
* *
* DOS-2-DOS common equates and macros *
* *
*****************************************************************
DEMO EQU 2 ;0=production, 1=demo, 2=eval
SectorSize EQU 512
EXISTING EQU 1005 ;AMIGA-DOS OPEN EXISTING FILE ACCESS MODE
NEW EQU 1006 ;AMIGA-DOS OPEN NEW FILE ACCESS MODE
TRUE EQU -1 ;BOOLEAN CONSTANT
FALSE EQU 0 ;DITTO
DR_GetUnit EQU -18 ;SIEZE DISK CONTROLLER
DR_GiveUnit EQU -24 ;RELEASE DISK CONTROLLER
DR_GetUnitID EQU -30 ;GET DISK DRIVE TYPE
DISABLE MACRO
MOVE.W #$4000,$DFF09A
ENDM
ENABLE MACRO
MOVE.W #$C000,$DFF09A
ENDM
NODE MACRO
DC.L 0 ;SUCC
DC.L 0 ;PRED
DC.B \1 ;TYPE
DC.B \2 ;PRI
DC.L \3 ;NAME POINTER
ENDM
SETF MACRO
BSET #0,\1
ENDM
PUSH MACRO
MOVEM.L \1,-(A7)
ENDM
POP MACRO
MOVEM.L (A7)+,\1
ENDM
CALL MACRO
JSR \1
ENDM
INCB MACRO
ADDQ.B #1,\1
ENDM
DECB MACRO
SUBQ.B #1,\1
ENDM
INCW MACRO
ADDQ.W #1,\1
ENDM
DECW MACRO
SUBQ.W #1,\1
ENDM
INCL MACRO
ADDQ.L #1,\1
ENDM
DECL MACRO
SUBQ.L #1,\1
ENDM
ZAP MACRO
MOVEQ #0,\1
ENDM
ZAPA MACRO
SUB.L \1,\1
ENDM
STC MACRO
ORI.B #1,CCR
ENDM
CLC MACRO
CMP.B D0,D0
ENDM
SWAB MACRO
ROL.W #8,\1
ENDM
IFZ MACRO
TST.B \1
BEQ \2
ENDM
IFNZ MACRO
TST.B \1
BNE \2
ENDM
IFZL MACRO
TST.L \1
BEQ \2
ENDM
IFNZL MACRO
TST.L \1
BNE \2
ENDM
IFEQ. MACRO ;STG1,STG2,LABEL
XREF CMP..
LEA \1,A0
LEA \2,A1
JSR CMP..
BEQ \3
ENDM
IFNE. MACRO ;STG1,STG2,LABEL
XREF CMP..
LEA \1,A0
LEA \2,A1
JSR CMP..
BNE \3
ENDM
SCAN. MACRO ;SOURCE,DEST
XREF SCAN..
IFNC '\1','A0'
LEA \1,A0
ENDC
IFNC '\2','A1'
LEA \2,A1
ENDC
JSR SCAN..
ENDM
MOVE. MACRO ;SOURCE,DEST
XREF MOVE..
IFNC '\1','A0'
LEA \1,A0
ENDC
IFNC '\2','A1'
LEA \2,A1
ENDC
JSR MOVE..
ENDM
LEFT. MACRO ;SRC,LEN,DEST
XREF LEFT..
LEA \1,A0
MOVE.W \2,D0
LEA \3,A1
JSR LEFT..
ENDM
RIGHT. MACRO ;SRC,LEN,DEST
XREF RIGHT..
LEA \1,A0
MOVE.W \2,D0
LEA \3,A1
JSR RIGHT..
ENDM
STRIP_LB. MACRO
XREF STRIP_LB..
IFNC '\1','A0'
LEA \1,A0
ENDC
JSR STRIP_LB..
ENDM
STRIP_TB. MACRO
XREF STRIP_TB..
IFNC '\1','A0'
LEA \1,A0
ENDC
JSR STRIP_TB..
ENDM
UCASE. MACRO
XREF UCASE..
LEA \1,A0
JSR UCASE..
ENDM
APPEND. MACRO
XREF APPEND..
LEA \1,A0
LEA \2,A1
JSR APPEND..
ENDM
STG_Z. MACRO
XREF STG_Z..
LEA \1,A0
JSR STG_Z..
ENDM
Z_STG. MACRO
XREF Z_STG..
LEA \1,A0
LEA \2,A1
JSR Z_STG..
ENDM
STR. MACRO ;VARIABLE TYPE (B,W,L),VARIABLE NAME,STG,FILL CHAR
XREF STR..
ZAP D0
MOVE.\1 \2,D0
LEA \3,A0
MOVE.B \4,D1
JSR STR..
ENDM
STRING. MACRO ;CHAR,COUNT,DEST
XREF STRING..
MOVE.B \1,D0
MOVE.W \2,D1
LEA \3,A0
JSR STRING..
ENDM
DISP. MACRO
XREF DISP..
LEA \1,A0
JSR DISP..
ENDM
PROMPT. MACRO
XREF PROMPT..
LEA \1,A0
JSR PROMPT..
ENDM
CRLF. MACRO
XREF CRLF..
JSR CRLF..
ENDM
ACHAR. MACRO ;CHAR,DEST
XREF ACHAR..
MOVE.B \1,D0
LEA \2,A0
JSR ACHAR..
ENDM
STR2. MACRO ;DEST,FILL CHAR
XREF STR2..
LEA \1,A0
MOVE.W \2,D1
JSR STR2..
ENDM
CLIP. MACRO ;COUNT,DEST
XREF CLIP..
MOVE.W \1,D0
LEA \2,A0
JSR CLIP..
ENDM
ERROR MACRO
BCS \1
ENDM
NOERROR MACRO
BCC \1
ENDM
RTSERR MACRO
BCC.S *+4
RTS
ENDM
RTSNOERR MACRO
BCS.S *+4
RTS
ENDM
WRITEFILE MACRO ;FILE, STRING, LEN
MOVE.L \1,D1
MOVE.L \2,D2
MOVE.L \3,D3
MOVE.L DosBase,A6
CALLSYS Write
ENDM
READFILE MACRO ;FILE, STRING, LEN
MOVE.L \1,D1
MOVE.L \2,D2
MOVE.L \3,D3
MOVE.L DosBase,A6
CALLSYS Read
ENDM
CALLSYS MACRO ;OFFSET, BASE
IFEQ NARG-2
MOVE.L \2,A6
ENDC
IFND _LVO\1
XREF _LVO\1
ENDC
JSR _LVO\1(A6)
ENDM
XREF _AbsExecBase
QuesTxt:
DC.B 13,10
DC.B 'D2D drive: command',13,10
DC.B 'Example: D2D DF2: COPY DF2:*.BAT -A -R',13,10
HLPTEXT:
DC.B 13,10
DC.B ' Dos-2-Dos Command Summary:',13,10,10
DC.B ' Display directory............. DIR or DIR drive:path',13,10
DC.B ' Change current directory...... CHDIR drive:path',13,10
DC.B ' Display ASCII file contents... TYPE drive:path\file',13,10
DC.B ' Copy a file (general form).... COPY drive:path\file '
DC.B 'drive:path/file -A -R',13,10
DC.B ' Copy one ASCII file........... COPY DF2:MYFILE.ASM '
DC.B 'DF0:C/NEWFILE.ASM -A',13,10
DC.B ' Copy MS-DOS/Atari files....... COPY DF2:*.ASM',13,10
DC.B ' Copy AmigaDOS files........... COPY #?.ASM',13,10
DC.B ' Copy and convert ASCII files.. add -A to COPY command line'
DC.B 13,10
DC.B ' Suppress ''Replace?'' question.. add -R to COPY command line'
DC.B 13,10
DC.B ' Delete a file................. DELETE drive:path\file',13,10
DC.B ' Format an MS-DOS DSDD disk.... FORMAT',13,10
DC.B ' Format an Atari ST DSDD disk.. FORMAT /A',13,10
DC.B ' Display this summary.......... HELP, or ?',13,10
DC.B ' Select another MS-DOS drive... RESTART',13,10
DC.B ' Exit to AmigaDOS.............. EXIT, or X',13,10
HLPTEXTLEN EQU *-HLPTEXT
QuesTxtLen EQU *-QuesTxt
* LOCAL MESSAGE STRINGS
CHIP_MEM. DC.B 17,'Out of memory'
BAD_ARGS. DC.B 13,'Bad arguments'
DUP_DRV. DC.B 48,'Source and destination drives cannot be the same'
DUP_FILE. DC.B 46,'Destination file already exists. Replace it? '
DUP1. DC.B 6,'File "'
DUP2. DC.B 31,'" already exists. Replace it? '
NO_FILE. DC.B 20,'Can''t find that file'
BAD_NAME. DC.B 24,'Invalid MS-DOS file name'
DRV_ERR. DC.B 31,'Device not defined in Mountlist'
DEV_ERR. DC.B 36,'Unable to locate that device or file'
OPEN_ERR. DC.B 30,'Unable to create AmigaDOS file'
BAD_CMD. DC.B 48,'Unknown command. Type HELP for command summary.'
NEW_NAME. DC.B 37,'Please enter a new MS-DOS file name: '
PAYN. DC.B 27,'Please answer "yes" or "no"'
HOW_TO. DC.B 49,'Type HELP or ? for summary of Dos-2-Dos commands.'
USERAM1. DC.B 55,'Warning -- you cannot use DF0 to access AmigaDOS files.'
USERAM2. DC.B 56,'Use RAM: or an external floppy drive. See Readme notes.'
CLEAN. DC.B 4,$9B,$46,$9B,$4B ;erase preceeding line
PMORE. DC.B 57,27,'[33mPress Return for more, press ESC Return to '
DC.B 'exit.',27,'[0m'
EOF. DC.B 38,10,13,27,'[33mEnd of file. Press Return.',27,'[0m'
WHICH_DRIVE. DC.B 52
DC.B 'Enter the device to be used for MS-DOS/ATARI files: '
NO_DRV1. DC.B 61
DC.B 'Your Amiga auto-configuration equipment list doesn''t include '
NO_DRV2. DC.B 61
DC.B 'Dos-2-Dos assumes it is a non-Amiga external 5.25-inch drive.'
FMSG1. DC.B 27,'Insert diskette into drive '
FMSG2. DC.B 29,' and press RETURN when ready.'
FormFail. DC.B 31,'Write error; formatting failed.'
FormComp. DC.B 20,'Formatting complete.'
CPYING. DC.B 10,' Copying '
BREAK. DC.B 8,'***Break'
Deleting. DC.B 11,' Deleting '
*****************************************************************
* *
* DOS-2-DOS UTILITY FUNCTIONS. *
* *
*****************************************************************
INCLUDE "D2DMAC.ASM"
XDEF CMP..,SCAN..,MOVE..,CLIP..,STRIP_LB..,STRIP_TB..
XDEF STG_Z..,Z_STG..,STR..,STR2..,LEFT..,RIGHT..
XDEF APPEND..,ACHAR..,STRING..,DISP..,UCASE..
XDEF PROMPT..,MOVE_CHARS,KBD_INPUT,CRLF..
XREF DosBase,STDOUT,STDIN,INPBUF.,INPBUFF
* COMPARES TWO STRINGS. SOURCE STRING PTR IN A0, DEST
* PTR IN A1. RETURNS Z-BIT SET ON STRINGS EQUAL, CLEAR
* IF NOT.
CMP..:
PUSH D0
CLR.L D0 ;USE FOR LOOP COUNTER
MOVE.B (A0)+,D0 ;GET LENGTH OF ONE STRING
CMP.B (A1)+,D0 ;SAME?
BNE 1$ ;NO MATCH
TST.B D0 ;ZERO LENGTH?
BEQ 1$ ;YES...AUTOMATIC MATCH
SUB.L #1,D0 ;GRIPES MY ASS
2$: CMPM.B (A0)+,(A1)+ ;DO THE COMPARISON
BNE 1$ ;NO MATCH
DBF D0,2$ ;LOOP FOR ALL BYTES
1$: POP D0
RTS
* SCANS A TOKEN FROM THE SOURCE STRING (A0) INTO THE DEST
* STRING (A1).
SCAN..:
PUSH A0-A1
CALL STRIP_LB.. ;GET RID OF LEADING BLANKS
POP A0-A1
PUSH D0/D1/A2
CLR.L D0
MOVE.B (A0),D0 ;LENGTH OF STRING TO SCAN
MOVE.B D0,(A1) ;IN CASE NOTHING LEFT
BEQ 1$ ;NOTHING TO SCAN
PUSH A0 ;SAVE SRC PTR
ADD.L #1,A0 ;POINT TO FIRST TEXT BYTE
MOVE.L A0,A2 ;SCAN WITH A2, SAVE A0
MOVE.L D0,D1 ;SAVE BYTE COUNT
SUB.L #1,D0
2$: CMPI.B #' ',(A2) ;BLANK?
BEQ 3$ ;YES...STOP HERE
ADD.L #1,A2 ;POINT TO NEXT TEXT BYTE
DBF D0,2$ ;NO...LOOP FOR ALL OF SOURCE
3$: ADD.L #1,D0 ;CORRECT FOR FINAL DECREMENT
SUB.L D0,D1 ;NUMBER OF BYTES TO MOVE
MOVE.B D1,(A1)+ ;LENGTH OF TOKEN
BEQ 4$ ;NOTHING TO MOVE
MOVE.L A0,A2
SUB.L #1,D1
5$: MOVE.B (A2)+,(A1)+ ;MOVE TOKEN TO DEST
DBF D1,5$
4$: POP A0
MOVE.B D0,(A0)+ ;NEW LENGTH OF SOURCE STRING
BEQ 1$ ;NOTHING LEFT IN SOURCE STG
SUB.L #1,D0
7$: MOVE.B (A2)+,(A0)+ ;ELSE MOVE UP REMAINING TEXT
DBF D0,7$
1$: POP D0/D1/A2
RTS
* MOVES SOURCE STRING TO DESTINATION STRING.
MOVE..:
PUSH D0
CLR.L D0
MOVE.B (A0),D0 ;LENGTH OF STRING TO MOVE
2$: MOVE.B (A0)+,(A1)+ ;MOVE LENGTH AND TEXT
DBF D0,2$
1$: POP D0
RTS
* STRIPS LEADING BLANKS FROM STRING IN A0.
STRIP_LB..:
PUSH D0/A1
MOVE.L A0,A1 ;SAVE PTR TO SOURCE
CLR.L D0
MOVE.B (A0)+,D0 ;GET LENGTH
BEQ 1$ ;NOTHING TO DO
SUB.L #1,D0
2$: CMP.B #' ',(A0)
BNE 3$ ;NO BLANK...STOP SCAN
ADD.L #1,A0
DBF D0,2$ ;SEARCH ENTIRE STRING
3$: MOVE.B D0,(A1) ;STORE BYTE COUNT
ADD.B #1,(A1)+ ;ACCOUNT FOR D0 OFFSET
BEQ.S 1$ ;NOTHING LEFT IN STRING
4$: MOVE.B (A0)+,(A1)+ ;MOVE STRING UP
DBF D0,4$
1$: POP D0/A1
RTS
*STRIPS TRAILING BLANKS FROM A STRING
STRIP_TB..:
PUSH D0/A1
MOVE.L A0,A1 ;SAVE PTR TO SOURCE
CLR.L D0
MOVE.B (A0)+,D0 ;GET LENGTH
BEQ 1$ ;NOTHING TO SCAN
ADD.L D0,A0 ;POINT BEYOND LAST BYTE
SUB.L #1,D0
2$: CMP.B #' ',-(A0) ;GOT A BLANK?
BNE 1$ ;NO...ALL DONE
SUB.B #1,(A1) ;ELSE ONE FEWER BYTES IN STRING
DBF D0,2$
1$: POP D0/A1
RTS
* CLIPS D0 LEADING CHARS FROM STRING IN A0.
CLIP..:
PUSH D1/A1
ZAP D1
MOVE.L A0,A1
MOVE.B (A0)+,D1 ;GET ORIGINAL LENGTH
EXT.L D0
ADD.L D0,A0 ;POINT TO REMAINDER OF STRING
SUB.B D0,D1 ;CALC NUMBER OF BYTES TO MOVE
BHI.S 1$ ;OKAY...NON-ZERO BYTE COUNT
CLR.B (A1) ;ELSE NOW HAVE NULL STRING
BRA.S 2$
1$: MOVE.B D1,(A1)+ ;STORE NEW LENGTH
DECW D1
3$: MOVE.B (A0)+,(A1)+
DBF D1,3$
2$: POP D1/A1
RTS
* CONVERTS NULL-TERMINATED STRING IN A0 TO REGULAR STRING IN A1.
Z_STG..:
PUSH A0-A2
MOVE.L A1,A2
CLR.B (A1)+ ;START WITH ZERO LENGTH
1$: MOVE.B (A0)+,D0 ;GET A BYTE
BEQ 2$ ;END OF STRING
MOVE.B D0,(A1)+ ;STORE THE CHAR
INCB (A2) ;AND COUNT IT
BRA.S 1$
2$: POP A0-A2
RTS
* CONVERTS STRING A0 FROM LOWER CASE TO UPPER CASE.
UCASE..:
PUSH D0/D1
CLR.L D0
MOVE.B (A0)+,D0 ;GET LENGTH OF STRING
BEQ 1$ ;NOTHING TO DO
SUB.L #1,D0
3$: MOVE.B (A0),D1 ;GET A BYTE
CMPI.B #'a',D1
BLT 2$ ;NOT LOWER CASE ALPHA
CMPI.B #'z',D1
BGT 2$ ;NOT LOWER CASE ALPHA
ANDI.B #$5F,D1 ;MAKE IT UPPER
MOVE.B D1,(A0) ;RESTORE CHAR TO STRING
2$: ADD.L #1,A0
DBF D0,3$ ;LOOP FOR ALL OF STRING
1$: POP D0/D1
RTS
* CONVERTS STRING POINTED TO BY A0 TO NULL-TERMINATED STRING.
STG_Z..:
PUSH A0-A1
ZAP D0
MOVE.L A0,A1 ;POINT A1 TO DEST
MOVE.B (A0)+,D0 ;GET LENGTH AND POINT TO 1ST TEXT BYTE
BEQ 1$ ;NOTHING TO MOVE
DECW D0 ;ADJUST FOR DBF
2$: MOVE.B (A0)+,(A1)+ ;MOVE UP BY 1 BYTE
DBF D0,2$
CLR.B (A1) ;PUT NULL AT END OF STRING
1$: POP A0-A1
RTS