From ff2d9aff6a4da7b937d4ee80ecf42b058c32fbe5 Mon Sep 17 00:00:00 2001 From: Broken Pipe <85091235+TheBrokenPipe@users.noreply.github.com> Date: Sun, 24 Mar 2024 23:34:05 +0000 Subject: [PATCH] Added CP/M tools Added CP/M tools to build 86-DOS 0.11 under CP/M or Cromemco CDOS. --- .gitattributes | 5 +- ASM.ASM | 26 +- CPM Tools/ASM86.COM | Bin 0 -> 5632 bytes CPM Tools/ASM86.Z80 | 3279 ++++++++++++++++++++++++++++++++++++++++++ CPM Tools/DOSGEN.COM | Bin 0 -> 768 bytes CPM Tools/DOSGEN.Z80 | 312 ++++ CPM Tools/README.md | 79 + README.md | 2 +- 8 files changed, 3688 insertions(+), 15 deletions(-) create mode 100644 CPM Tools/ASM86.COM create mode 100644 CPM Tools/ASM86.Z80 create mode 100644 CPM Tools/DOSGEN.COM create mode 100644 CPM Tools/DOSGEN.Z80 create mode 100644 CPM Tools/README.md diff --git a/.gitattributes b/.gitattributes index 656edeb..dadf492 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,11 @@ # Auto detect text files and perform LF normalization * text=auto -# 86-DOS text files must use CRLF and have 0x1A EOF markers, we simply mark them as binary +# 86-DOS and CP/M text files must use CRLF and have 0x1A EOF markers, we simply mark them as binary +*.a86 binary *.asm binary +*.com binary *.doc binary *.hex binary *.prn binary +*.z80 binary diff --git a/ASM.ASM b/ASM.ASM index d4d5dba..16224eb 100644 --- a/ASM.ASM +++ b/ASM.ASM @@ -2237,8 +2237,8 @@ L1033: MOV [L1B0E],AL MOV BX,HEXBUF MOV [HEXPNT],BX - MOV BX,L1C1B - MOV [L1B13],BX + MOV BX,LSTBUF + MOV [LSTPNT],BX MOV BX,0 MOV [ERRCNT],BX MOV [PC],BX @@ -2447,13 +2447,13 @@ LIST: XCHG AH,AL AND AL,7FH PUSH BX - MOV BX,[L1B13] + MOV BX,[LSTPNT] MOV [BX],AL CALL L1546 - MOV [L1B13],BX + MOV [LSTPNT],BX JNZ L11EC - MOV BX,L1C1B - MOV [L1B13],BX + MOV BX,LSTBUF + MOV [LSTPNT],BX PUSH DX XCHG DX,BX PUSH CX @@ -2591,8 +2591,8 @@ EXIT: JMP 0 RET L12D6: - MOV AX,[L1B13] - CMP AX,L1C1B + MOV AX,[LSTPNT] + CMP AX,LSTBUF JZ RET MOV AL,1AH CALL LIST @@ -2951,9 +2951,9 @@ L1546: INC BX CMP BX,HEXBUF+128 JZ RET - CMP BX,L1C1B+128 - JZ RET CMP BX,LSTBUF+128 + JZ RET + CMP BX,L1B9B+128 JNZ RET MOV BX,HEXBUF RET @@ -3663,13 +3663,13 @@ L1B0F: DS 1 L1B10: DS 1 IFFLG: DS 1 CHKLAB: DS 1 -L1B13: DS 2 +LSTPNT: DS 2 ERRCNT: DS 2 LSTRET: DS 2 RETPT: DS 2 HEXBUF: DS 128 +L1B9B: DS 128 LSTBUF: DS 128 -L1C1B: DS 128 BC: DS 2 DE: DS 2 HL: DS 2 @@ -3678,4 +3678,4 @@ IY: DS 2 DS 50 STACK: EQU $ START: EQU $ - \ No newline at end of file + \ No newline at end of file diff --git a/CPM Tools/ASM86.COM b/CPM Tools/ASM86.COM new file mode 100644 index 0000000000000000000000000000000000000000..0cb44648641e8c55e0386c12def304cb0ddca22e GIT binary patch literal 5632 zcmX?X$>^M4P+63jo>8J;XlZV#kW{G~(%YX2!GE`K@vpjPk@3QyJ>cdNXa;U^a?jP_FwIb;O&= z=%6TwrNR0y0>pbHde)vvFouDT|Lk>sMSoG7Q$kGZjcOPK4~m|ZW)ge^A{GBL+*EXs zP|6qkt7tEw$iSe)ET)ttrqnH_t<))|#m1nNBWA~9R4lgMs9DUYMeJ-W(?6+G%XsYm z8)b@}Eo8UK6#Mu8%o3J=)*9UZcs1DVL?l=aFXLHnXfJX0JEOz}wgYDqInEkzSY?R) z<2nJ>dN!6x;zvFy<>+NGgy$H*tON8{+hT_@}q_GsAe(r`ZQ z$S19_rD_kKn8Lbej2q4>a~!N~Z*Tv0VDn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lWYmWsYUJ1?9>d%UP3bc^J!Wc^GnS zd6^MDF?Akyab7ZrNT0`D zmyOAhUg4B83Re1&TxT_2D=W$o(<X}m$Uvu`R6u;&?np*st^9XBxe!)EMNBJp9${cI*Q_7V&)+T18 zDRa!vPtI26_`sB(53=cDettpKJnn}eF37D9^79Ko4u8OuUv`SU0~8VpO!;L=${b7b z%gU8GmNMs;$Z!dyrps_i1 z>r3*JlsQ(FJ?ZNtj<4RkygXnXofhEJ(Nu zOoQZCf>|5DB#4iSw?f7D2p@v7P~|~9UM`&DcM28;7G?^L#l@+)Nja%S3Sp^5#hLke z3PySc2E1Gz`dw}6++FJB=gvnVyWB)_Oqp|~J1IhB`7#e=ttm&-G+ zxHK&-GdVLguS6j?H8;Pgl9x+`m&+|PCsiRYzeFJ|zceoeEaZ||oUKq^lv$FhkXlrf zUj!C(N=#8m0Z9}Wq$X#kWu`)edAVFcN)(*)OY=$;_VRKCSLP<==O~0ECgr5^a`ARK zT9`2~Ffg#Dg36Dg)GrJQP~hPj0g{jc5hxfcuMiOA2NLH65y+V9_1O&B!`xzw3=C&Y z#crvIF|vUeSG>jUM2np@6+7%Lb~aj!kL|3f7)0!(VwxDIpRyaM;#aOyPRp;Ebf9+f zNzT`t+R_ypPt*x%OLHF%5UbdDLaJO?nfq|G7>j6+ECVA0gM1wWqn*ZCPqv3=o5k!j z&w8>Qp2cXTBk_-E{xhbtUs%ravL3$3sSsR}SX825yMRH#wW1`oC@=91gF--QQch+v zNN|eSJh2sG3=IDm7$z9W*TKEQrsC`B8x#o&oWD=R7#KhnDl{=C0), then the one byte will be saved as pure code. Otherwise, +;the details of the addressing mode will be investigated and the optional one- +;or two-byte displacement will be added, as described by [ADDR] and [ALABEL]. + PUSH BC + PUSH DE + PUSH HL + LD B,0 + LD C,A + CALL GEN ;Save the addressing mode as pure code + LD A,C + LD B,80H + AND 0C7H + CP 6 + JR Z,TWOBT ;Direct address? + AND 0C0H + JR Z,PRET ;Indirect through reg, no displacement? + CP 0C0H + JR Z,PRET ;Register to register operation? + LD B,A ;Save whether one- or two-byte displacement +TWOBT: + LD HL,(ADDR) + LD DE,(ALABEL) + JR PUTCHK + +GRP2: + CALL GETOP + LD BC,0FF30H + CP UNDEFID + JR Z,PMEM + LD B,50H + CP XREG + JR Z,PXREG + LD B,6 + CP SREG + JP Z,PACKREG + LD C,20 + JP ERROR + +PMEM: + LD A,B + CALL PUT + LD A,C + OR E + JR PUTADD + +PXREG: + LD A,B + OR E + JP PUT + +GRP3: + CALL GETOP + PUSH DE + CALL GETOP2 + POP HL + LD BC,8614H + LD A,SREG + CP H + JP Z,ERROR + CP D + JP Z,ERROR + LD A,CONST + CP H + JP Z,ERROR + CP D + JP Z,ERROR + LD A,UNDEFID + CP H + JR Z,EXMEM + CP D + JR Z,EXMEM1 + LD A,H + CP D + LD C,22 + JP NZ,ERROR + CP XREG + CALL NZ,RR1 ;RR1 never returns + LD A,L + OR A + JR Z,EXACC + EX DE,HL + LD A,L + OR A + LD A,H + CALL NZ,RR1 +EXACC: + LD A,90H + OR E + JP PUT + +EXMEM: + EX DE,HL +EXMEM1: + CP H + JP Z,ERROR + LD C,1 ;Flag word as OK + CALL NOTAC ;NOTAC never returns + JP ERROR + +GRP4: + PUSH AF + CALL GETOP + POP BC + CP CONST + JR Z,FIXED + SUB XREG + DEC E + DEC E + OR E + LD C,20 + JP NZ,ERROR + LD A,B + OR 8 + JP PUT +FIXED: + LD A,B + CALL PUT + JP PUTBYT + +GRP5: + PUSH AF + CALL GETOP + CP CONST + JP NZ,ERROR + LD HL,(DLABEL) + LD A,H + OR L + LD C,30 + JP NZ,ERROR + LD HL,(DATA) + POP AF + OR A + JR Z,ORG + DEC A + JR Z,DSJ + DEC A + JR Z,EQU + DEC A + JP NZ,IF +PUTOP: + LD A,-3 + JR NEWLOC +ALIGN: + LD A,(PC) + AND 1 + RET Z + LD HL,1 +DSJ: + EX DE,HL + LD HL,(PC) + ADD HL,DE + LD (PC),HL + EX DE,HL + LD A,-4 + JR NEWLOC +EQU: + EX DE,HL + LD HL,(LABPT) + LD A,H + OR L + LD C,34 + JP Z,ERROR + LD (HL),E + INC HL + LD (HL),D + RET +ORG: + LD (PC),HL + LD A,-2 +NEWLOC: + CALL PUTCD + LD A,L + CALL PUTCD + LD A,H + CALL PUTCD + LD B,0C0H + JP GEN1 +GRP6: + LD B,A + LD C,4 + CALL MROPS + LD C,23 + JP ERROR +GRP7: + LD B,A + LD C,1 + CALL MROPS + LD C,80H + LD DE,(DLABEL) + LD A,D + OR E + JP NZ,ACCIMM + EX DE,HL + LD HL,(DATA) + CALL L055B + EX DE,HL + JP NZ,ACCIMM + SET 1,C + JP ACCIMM +GRP8: + LD C,A + LD B,0FEH + JR ONEOP +GRP9: + LD C,A + LD B,0F6H +ONEOP: + PUSH BC + CALL GETOP +ONE: + LD C,26 + CP CONST + JP Z,ERROR + CP SREG + LD C,22 + JP Z,ERROR + POP BC + CP UNDEFID + JR Z,MOP + AND 1 + JR Z,ROP + BIT 0,C + JR Z,ROP + LD A,C + AND 0F8H + OR E + JP PUT +MOP: + LD A,(FLAG) + AND 1 + OR B + CALL PUT + LD A,C + AND 38H + OR E + JP PUTADD +ROP: + OR B + CALL PUT + LD A,C + AND 38H + OR 0C0H + OR E + JP PUT +GRP10: + LD C,A + LD B,0F6H + PUSH BC + CALL GETOP + LD C,20 + LD A,E + OR A + JP NZ,ERROR + LD A,D + CP XREG + JR Z,G10 + CP REG + JP NZ,ERROR +G10: + PUSH AF + CALL GETOP + POP AF + AND 1 + LD (FLAG),A + LD A,D + JR ONE +GRP11: + CALL PUT + LD A,0AH + JP PUT +GRP12: + LD C,A + LD B,0D0H + PUSH BC + CALL GETOP + LD A,(SYM) + CP ',' + LD A,D + JR NZ,ONE + PUSH DE + CALL GETOP + SUB REG + LD C,20 + DEC E + OR E + JP NZ,ERROR + POP DE + LD A,D + POP BC + SET 1,B + PUSH BC + JP ONE +GRP13: + LD B,A + LD C,1 + CALL MROPS + LD C,80H +ACCIMM: + CALL IMMED + SET 2,B + RES 1,B +AIMM: + LD A,H + AND 1 + PUSH AF + OR B + CALL PUT + POP AF + JP Z,PUTBYT + JP PUTWOR + + JP ERROR + +GRP14: +;JMP and CALL mnemonics + PUSH AF + CALL GETOP + CP CONST + JR Z,DIRECT + LD C,20 + CP REG + JP Z,ERROR + CP SREG + JP Z,ERROR + CP XREG + JR NZ,NOTRG + SET 6,E + SET 7,E +NOTRG: +;Indirect jump. DL has addressing mode. + LD A,0FFH + CALL PUT + POP AF + AND 38H + OR E + LD B,A + LD A,(L1A98) + OR A + LD A,B + JP Z,PUTADD ;If so, do inter-segment + AND 0F7H ;Convert to intra-segment + JP PUTADD +DIRECT: + LD A,(SYM) + CP ',' + JR Z,LONGJ + POP AF + DEC A + CP 0E9H + JR Z,GOTOP + LD A,0E8H +GOTOP: + CALL PUT + LD HL,(DATA) + LD DE,(PC) + INC DE + INC DE + OR A + SBC HL,DE + LD (DATA),HL + JP PUTWOR +LONGJ: + POP AF + CALL PUT + CALL PUTWOR + CALL GETOP + LD C,20 + CP CONST + JP NZ,ERROR + JP PUTWOR + +GRP16: +;RET mnemonic + PUSH AF + CALL GETSYM + CP 5 + JR Z,LONGR + CP EOL + JR Z,NODEC + CP ';' + JR Z,NODEC +GETSP: + CALL GETOP1 + POP BC + CP CONST + LD C,20 + JP NZ,ERROR + LD A,B + AND 0FEH + CALL PUT + JP PUTWOR +LONGR: + LD A,(L1A98) + OR A ;Is flag "L"? + JR NZ,NOTLON + POP AF + OR 8 + PUSH AF +NOTLON: + CALL GETSYM + CP EOL + JR Z,DORET + CP ';' + JR Z,DORET + CP ',' + CALL Z,GETSYM + JR GETSP +NODEC: +;Return is intra-segment (short) without add to SP. +;Record position for RET symbol. + LD HL,(PC) + LD (LSTRET),HL + EX DE,HL + LD HL,(RETPT) + LD A,H + OR L + JR Z,DORET + LD (HL),1 + INC HL + LD (HL),E + INC HL + LD (HL),D + LD HL,0 + LD (RETPT),HL +DORET: + POP AF + JP PUT + +GRP17: + CALL PUT + CALL GETOP + CP CONST + LD C,20 + JP NZ,ERROR + LD HL,(DATA) + LD DE,(PC) + INC DE + SBC HL,DE + LD (DATA),HL + CALL PUTBYT + LD HL,(DLABEL) + LD A,H + OR L + RET NZ + LD HL,(DATA) + CALL L055B + RET Z + LD C,31 + JP ERROR + RET +GRP18: + CALL GETOP + CP CONST + LD C,20 + JP NZ,ERROR + LD HL,(DLABEL) + LD A,H + OR L + JR NZ,GENINT + LD HL,(DATA) + LD DE,3 + SBC HL,DE + JR NZ,GENINT + LD A,0CCH + JP PUT +GENINT: + LD A,0CDH + CALL PUT + JP PUTBYT + +GRP19: ;ESC opcode + LD BC,0D800H + JP ONEOP + +GRP20: + LD B,A + LD C,1 + CALL MROPS + LD C,0F6H + CALL IMMED + LD B,0A8H + JP AIMM +GRP21: + CALL GETOP + CP SREG + LD C,28 + JP NZ,ERROR + LD B,26H +PACKREG: + LD A,E + ADD A,A + ADD A,A + ADD A,A + OR B + JP PUT +GRP22: + CALL GETOP + LD BC,8F00H + CP UNDEFID + JP Z,PMEM + LD B,58H + CP XREG + JP Z,PXREG + LD B,7 + CP SREG + JR Z,PACKREG + LD C,20 + JP ERROR +GRP23: + LD (DATSIZ),A +GETDAT: + CALL GETSYM + LD A,2 + CALL VAL1 + LD A,(SYM) + CP ',' + LD A,(DATSIZ) + JR NZ,ENDDAT + CALL SAVDAT + JR GETDAT +ENDDAT: + CP 2 + JR NZ,SAVDAT + LD HL,(DATA) + SET 7,L + LD (DATA),HL +SAVDAT: + OR A + JP NZ,PUTBYT + JP PUTWOR +IF: + LD A,H + OR L + LD A,1 + JR Z,SKIPCD + LD (IFFLG),A + RET + +SKIPCD: + LD (CHKLAB),A +SKIPLP: + XOR A + CALL NEXLIN + CALL NEXTCHR + CP 1AH + JR Z,END + CALL GETLAB + JR C,SKIPLP + LD HL,LENID + LD DE,IFEND + LD B,(HL) + INC B + CALL CPSLP + JR NZ,SKIPLP + XOR A + LD (CHKLAB),A + RET + +ENDIF: + LD HL,IFFLG + LD A,(HL) + LD (HL),0 + LD C,36 + OR A + JP Z,ERROR + RET + +;********************************************************************* +; PASS 2 +;********************************************************************* + +END: + LD C,4 +WREND: + LD B,0FFH + LD A,B + CALL GEN + DEC C + JR NZ,WREND + LD A,(LSTFCB) + CP 'Z' + JR Z,L1033 + CALL ADDEXT + LD DE,FCB + LD C,OPEN + CALL SYSTEM + LD HL,0FFH + EXX +L1033: + LD A,-5 + LD (HEXCNT),A ;FLAG HEX BUFFER AS EMPTY + LD (L1B0E),A + LD HL,HEXBUF + LD (HEXPNT),HL + LD HL,LSTBUF + LD (LSTPNT),HL + LD HL,0 + LD (ERRCNT),HL + LD (PC),HL + LD HL,OBJECT + LD (HEXADD),HL + XOR A + LD (FCB+20H),A ;Set NEXT RECORD field to zero + LD (COUNT),A + CALL STRTLIN + LD HL,START +L1069: + LD B,4 + LD C,(HL) + INC HL +L1070: + RL C + JR C,L1087 + RL C + JR NC,L107B + JR L1108 +L107B: + LD A,(HL) +L107D: + CALL L13BB +L1080: + INC HL + DJNZ L1070 + JR L1069 +L1087: + RL C + JR C,L108E + JP L1144 +L108E: + LD A,(HL) + CP -10 + JR C,L1097 + JP L1214 +L1097: + PUSH BC + PUSH HL + LD HL,COUNT + LD A,6 + SUB (HL) + LD (HL),0 + LD B,A + LD A,' ' + JR Z,NOFIL +BLNK: + CALL LIST + CALL LIST + CALL LIST + DJNZ BLNK +NOFIL: + CALL OUTLIN + POP HL + LD A,(HL) + PUSH HL + CALL REPERR + LD A,(ERR) + CALL REPERR + CALL STRTLIN + POP HL + POP BC + JR L1080 + +OUTLIN: + CALL LIST + LD A,(LSTFCB) + CP 'Z' + RET Z + LD HL,L1B0F + LD A,(HL) + LD (HL),0FFH + OR A + JR NZ,CRLF +OUTLN: + CALL NEXTCHR + CALL LIST + CP 10 + JR NZ,OUTLN + RET + +PRTCNT: + LD HL,ERCNTM + CALL PRINT + LD HL,(ERRCNT) + CALL L1362 + CALL L1384 +CRLF: + LD A,13 + CALL LIST + LD A,10 + JR LIST + +L1108: + CALL L1151 + EX DE,HL + CALL L055B + EX DE,HL + JR Z,L1123 + LD A,D + OR A + JR Z,L1128 + INC A + JR Z,L1128 +L111E: + LD A,101 + LD (ERR),A +L1123: + LD A,E + JP L107D +L1128: + LD A,(COUNT) + DEC A + JR NZ,L1123 + LD A,(L1B10) + CP 0EBH + JR Z,L111E + AND 0FCH + CP 0E0H + JR Z,L111E + AND 0F0H + CP 70H + JR Z,L111E + JR L1123 + +L1144: + CALL L1151 + LD A,E + CALL L13BB + LD A,D + JP L107D + +L1151: + PUSH BC + LD E,(HL) + INC HL + LD D,(HL) + INC HL + EX DE,HL + LD A,(HL) + INC HL + LD C,(HL) + INC HL + LD B,(HL) + EX DE,HL + LD E,(HL) + INC HL + LD D,(HL) + EX DE,HL + ADD HL,BC + POP BC + EX DE,HL + OR A + RET NZ + LD A,64H + LD (ERR),A + LD DE,0 + RET + +STRTLIN: + XOR A + LD (ERR),A + LD (L1B0F),A + LD HL,(PC) + LD A,H + CALL PHEX + LD A,L +PHEXB: + CALL PHEX + LD A,' ' +LIST: + PUSH AF + LD A,(LSTFCB) + CP 'Z' + JR Z,L11ED + CP 'X' + JR Z,L11F2 + POP AF + PUSH AF + AND 7FH + PUSH HL + LD HL,(LSTPNT) + LD (HL),A + CALL L1546 + LD (LSTPNT),HL + JR NZ,L11EC + LD HL,LSTBUF + LD (LSTPNT),HL + PUSH DE + EX DE,HL + PUSH BC + LD C,SETDMA + CALL 5 + LD DE,LSTFCB + LD C,SEQWRT + CALL 5 + POP BC + POP DE +L11EC: + POP HL +L11ED: + POP AF + RET +L11F2: + POP AF + PUSH AF + CALL OUT + POP AF + RET + +PHEX: + LD B,A + CALL UHALF + CALL LIST + LD A,B + CALL LHALF + JR LIST + +L1214: + INC A + JR Z,L125B + INC HL + LD E,(HL) + INC HL + LD D,(HL) + PUSH HL + INC A + JR Z,L1253 + INC A + JR Z,L124D + LD HL,(PC) + ADD HL,DE + LD (PC),HL + LD HL,(HEXADD) + ADD HL,DE + LD (HEXADD),HL + JR L1257 +L124D: + LD (HEXADD),DE + JR L1257 +L1253: + LD (PC),DE +L1257: + POP HL + JP L1080 +L125B: + CALL PRTCNT + LD A,(HEXFCB) + CP 'Z' + JR Z,SYMDMP + LD A,(HEXCNT) + CP -5 + CALL NZ,ENHEXL + LD A,':' + CALL PUTCHR + LD B,10 +L1276: + PUSH BC + LD A,'0' + CALL PUTCHR + POP BC + DJNZ L1276 + CALL L14F4 + CALL NZ,L13B3 + CALL L13B3 + LD C,CLOSE + LD DE,HEXFCB + CALL SYSTEM +SYMDMP: + LD A,(SYMFLG) + CP 'S' + JR NZ,L12B4 + LD HL,SYMMES + CALL PRINT + LD DE,(BASE) + LD A,D + OR E + JR Z,EXIT + LD HL,(HEAP) + LD SP,HL + CALL L12E5 +L12B4: + LD A,(LSTFCB) + CP 'X' + JR Z,EXIT + CP 'Z' + JR Z,L12CA + CALL L12D6 + LD DE,LSTFCB + LD C,CLOSE + CALL 5 +L12CA: + LD A,'X' + LD (LSTFCB),A + CALL PRTCNT +EXIT: JP 0 + RET + +L12D6: + LD HL,(LSTPNT) + LD DE,LSTBUF + OR A + SBC HL,DE + RET Z + LD A,1AH + CALL LIST + JR L12D6 + +L12E5: + EX DE,HL + PUSH HL + LD E,(HL) + LD D,0 + INC HL + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + LD A,E + OR D + CALL NZ,L12E5 + POP HL + LD B,(HL) + INC HL + LD A,0AH + SUB B + JR NC,L1315 + LD A,1 +L1315: + LD D,A +L1317: + LD A,(HL) + INC HL + CALL LIST + DJNZ L1317 + LD B,D + INC B + LD A,20H +L1329: + CALL LIST + DJNZ L1329 + INC HL + INC HL + PUSH HL + INC HL + INC HL + INC HL + INC HL + LD A,(HL) + CALL PHEX + DEC HL + LD A,(HL) + CALL PHEX + CALL CRLF + POP HL + LD E,(HL) + INC HL + LD D,(HL) + LD A,D + OR E + JR NZ,L12E5 + RET + +L1362: + LD B,10H + LD DE,0 +L1367: + ADD HL,HL + LD A,E + ADC A,A + DAA + LD E,A + LD A,D + ADC A,A + DAA + LD D,A + RL C + DJNZ L1367 + RET + +L1384: + EX DE,HL + LD B,10H + LD A,C + CALL L13A0 + LD A,H + CALL L13AE + LD A,H + CALL L13A0 + LD A,L + CALL L13AE + LD A,L + LD B,0 +L13A0: + CALL LHALF +L13A3: + CP 30H + JR Z,L13A9 + LD B,0 +L13A9: + SUB B + JP LIST + +L13AE: + CALL UHALF + JR L13A3 + +L13B3: + LD A,1AH + CALL PUTCHR + JR NZ,L13B3 + RET + +L13BB: + LD (L1B10),A + PUSH HL + PUSH BC + PUSH AF + PUSH DE + CALL L144E + POP DE + LD HL,COUNT + INC (HL) + LD A,(HL) + CP 7 + JR NZ,L13E9 + LD (HL),1 + LD A,20H + CALL OUTLIN + LD A,20H + LD B,5 +L13E2: + CALL LIST + DJNZ L13E2 +L13E9: + POP AF + CALL PHEXB + POP BC + LD HL,(PC) + INC HL + LD (PC),HL + LD HL,(HEXADD) + INC HL + LD (HEXADD),HL + POP HL + RET + +REPERR: + OR A ;Did an error occur? + RET Z + PUSH AF + LD HL,ERRMES ;Print "ERROR" + CALL PRINT + POP AF + CALL PHEX + LD HL,HEXSUF + CALL PRINT + LD HL,(ERRCNT) + INC HL + LD (ERRCNT),HL + RET + +PRINT: + LD A,(HL) + CALL LIST + OR A + RET M + INC HL + JR PRINT + +OUT: + LD E,A + LD C,2 +SYSTEM: + PUSH BC + PUSH DE + PUSH HL + CALL 5 + POP HL + POP DE + POP BC + RET + +L144E: + PUSH AF + LD A,(HEXFCB) + CP 'Z' + JR NZ,L145E + JP L11ED +L145E: + LD DE,(LASTAD) + LD HL,(HEXADD) + LD (LASTAD),HL + INC DE + LD A,(HEXCNT) + CP -5 + JR Z,NEWLIN + OR A + SBC HL,DE + JR Z,AFHEX + CALL ENHEXL +NEWLIN: + LD A,':' + CALL PUTCHR + LD A,-4 + LD (HEXCNT),A + XOR A + LD (CHKSUM),A + LD HL,(HEXPNT) + LD (HEXLEN),HL + CALL HEXBYT + LD A,(HEXADD+1) + CALL HEXBYT + LD A,(HEXADD) + CALL HEXBYT + XOR A + CALL HEXBYT +AFHEX: + POP AF +HEXBYT: + LD B,A + LD HL,CHKSUM + ADD A,(HL) + LD (HL),A + LD A,B + CALL UHALF + CALL PUTCHR + LD A,B + CALL LHALF + CALL PUTCHR + LD HL,HEXCNT + INC (HL) + LD A,(HL) + CP 26 + RET NZ +ENHEXL: + LD HL,(HEXLEN) + LD B,A + CALL UHALF + LD (HL),A + CALL L1546 + LD A,B + CALL LHALF + LD (HL),A + LD A,-6 + LD (HEXCNT),A + LD A,(CHKSUM) + ADD A,B + NEG + CALL HEXBYT + +L14F4: + LD A,13 + CALL PUTCHR + LD A,10 + +PUTCHR: + LD HL,(HEXPNT) + LD (HL),A + CALL L1546 + LD (HEXPNT),HL + RET NZ + PUSH HL + LD HL,L1B0E + LD A,(HL) + LD (HL),0 + POP HL + OR A + RET NZ + LD C,SETDMA + EX DE,HL + CALL SYSTEM + LD DE,HEXFCB + LD C,SEQWRT + CALL SYSTEM + EX DE,HL + OR A + RET Z + LD HL,WRTERR + JP PRERR + +UHALF: + RRA + RRA + RRA + RRA +LHALF: + AND 0FH + OR 30H + CP '9'+1 + RET C + ADD A,7 + RET + +L1546: + INC HL + PUSH DE + PUSH HL + LD DE,HEXBUF+128 + OR A + SBC HL,DE + POP HL + POP DE + RET Z + PUSH DE + PUSH HL + LD DE,LSTBUF+128 + OR A + SBC HL,DE + POP HL + POP DE + RET Z + PUSH DE + PUSH HL + LD DE,L1B9B+128 + OR A + SBC HL,DE + POP HL + POP DE + RET NZ + LD HL,HEXBUF + RET + +NONE: DB 0 + +; 8086 MNEMONIC TABLE + +; This table is actually a sequence of subtables, each starting with a label. +; The label signifies which mnemonics the subtable applies to--A3, for example, +; means all 3-letter mnemonics beginning with A. + +A3: + DB 7 + DB 'dd' + DW GRP7 + DB 2 + DB 'nd' + DW GRP13 + DB 22H + DB 'dc' + DW GRP7 + DB 12H + DB 'aa' + DW PUT + DB 37H + DB 'as' + DW PUT + DB 3FH + DB 'am' + DW GRP11 + DB 0D4H + DB 'ad' + DW GRP11 + DB 0D5H +A5: + DB 1 + DB 'lign' + DW ALIGN + DB 0 +C3: + DB 7 + DB 'mp' + DW GRP7 + DB 3AH + DB 'lc' + DW PUT + DB 0F8H + DB 'ld' + DW PUT + DB 0FCH + DB 'li' + DW PUT + DB 0FAH + DB 'mc' + DW PUT + DB 0F5H + DB 'bw' + DW PUT + DB 98H + DB 'wd' + DW PUT + DB 99H +C4: + DB 3 + DB 'all' + DW GRP14 + DB 9AH + DB 'mpb' + DW PUT + DB 0A6H + DB 'mpw' + DW PUT + DB 0A7H +D2: + DB 5 + DB 'b' + DW GRP23 + DB 1 + DB 'w' + DW GRP23 + DB 0 + DB 'm' + DW GRP23 + DB 2 + DB 's' + DW GRP5 + DB 1 + DB 'i' + DW PUT + DB 0FAH +D3: + DB 4 + DB 'ec' + DW GRP8 + DB 49H + DB 'iv' + DW GRP10 + DB 30H + DB 'aa' + DW PUT + DB 27H + DB 'as' + DW PUT + DB 2FH +D4: + DB 1 + DB 'own' + DW PUT + DB 0FDH +E2: + DB 1 + DB 'i' + DW PUT + DB 0FBH +E3: + DB 3 + DB 'qu' + DW GRP5 + DB 2 + DB 'sc' + DW GRP19 + DB 0D8H + DB 'nd' + DW END + DB 0 +E5: + DB 1 + DB 'ndif' + DW ENDIF + DB 0 +H3: + DB 1 + DB 'lt' + DW PUT + DB 0F4H +H4: + DB 1 + DB 'alt' + DW PUT + DB 0F4H +I2: + DB 2 + DB 'n' + DW GRP4 + DB 0E4H + DB 'f' + DW GRP5 + DB 4 +I3: + DB 4 + DB 'nc' + DW GRP8 + DB 41H + DB 'nb' + DW GRP4 + DB 0E4H + DB 'nw' + DW GRP4 + DB 0E5H + DB 'nt' + DW GRP18 + DB 0CCH +I4: + DB 4 + DB 'mul' + DW GRP10 + DB 28H + DB 'div' + DW GRP10 + DB 38H + DB 'ret' + DW PUT + DB 0CFH + DB 'nto' + DW PUT + DB 0CEH +J2: + DB 10 + DB 'p' + DW GRP17 + DB 0EBH + DB 'z' + DW GRP17 + DB 74H + DB 'e' + DW GRP17 + DB 74H + DB 'l' + DW GRP17 + DB 7CH + DB 'b' + DW GRP17 + DB 72H + DB 'a' + DW GRP17 + DB 77H + DB 'g' + DW GRP17 + DB 7FH + DB 'o' + DW GRP17 + DB 70H + DB 's' + DW GRP17 + DB 78H + DB 'c' + DW GRP17 + DB 72H +J3: + DB 17 + DB 'mp' + DW GRP14 + DB 0EAH + DB 'nz' + DW GRP17 + DB 75H + DB 'ne' + DW GRP17 + DB 75H + DB 'nl' + DW GRP17 + DB 7DH + DB 'ge' + DW GRP17 + DB 7DH + DB 'nb' + DW GRP17 + DB 73H + DB 'ae' + DW GRP17 + DB 73H + DB 'nc' + DW GRP17 + DB 73H + DB 'ng' + DW GRP17 + DB 7EH + DB 'le' + DW GRP17 + DB 7EH + DB 'na' + DW GRP17 + DB 76H + DB 'be' + DW GRP17 + DB 76H + DB 'pe' + DW GRP17 + DB 7AH + DB 'np' + DW GRP17 + DB 7BH + DB 'po' + DW GRP17 + DB 7BH + DB 'no' + DW GRP17 + DB 71H + DB 'ns' + DW GRP17 + DB 79H +J4: + DB 5 + DB 'cxz' + DW GRP17 + DB 0E3H + DB 'nge' + DW GRP17 + DB 7CH + DB 'nae' + DW GRP17 + DB 72H + DB 'nbe' + DW GRP17 + DB 77H + DB 'nle' + DW GRP17 + DB 7FH +L3: + DB 3 + DB 'ea' + DW GRP6 + DB 8DH + DB 'ds' + DW GRP6 + DB 0C5H + DB 'es' + DW GRP6 + DB 0C4H +L4: + DB 5 + DB 'oop' + DW GRP17 + DB 0E2H + DB 'odb' + DW PUT + DB 0ACH + DB 'odw' + DW PUT + DB 0ADH + DB 'ahf' + DW PUT + DB 9FH + DB 'ock' + DW PUT + DB 0F0H +L5: + DB 2 + DB 'oope' + DW GRP17 + DB 0E1H + DB 'oopz' + DW GRP17 + DB 0E1H +L6: + DB 2 + DB 'oopne' + DW GRP17 + DB 0E0H + DB 'oopnz' + DW GRP17 + DB 0E0H +M3: + DB 2 + DB 'ov' + DW GRP1 + DB 88H + DB 'ul' + DW GRP10 + DB 20H +M4: + DB 2 + DB 'ovb' + DW PUT + DB 0A4H + DB 'ovw' + DW PUT + DB 0A5H +N3: + DB 3 + DB 'ot' + DW GRP9 + DB 10H + DB 'eg' + DW GRP9 + DB 18H + DB 'op' + DW PUT + DB 90H +O2: + DB 1 + DB 'r' + DW GRP13 + DB 0AH +O3: + DB 2 + DB 'ut' + DW GRP4 + DB 0E6H + DB 'rg' + DW GRP5 + DB 0 +O4: + DB 2 + DB 'utb' + DW GRP4 + DB 0E6H + DB 'utw' + DW GRP4 + DB 0E7H +P3: + DB 2 + DB 'op' + DW GRP22 + DB 8FH + DB 'ut' + DW GRP5 + DB 3 +P4: + DB 2 + DB 'ush' + DW GRP2 + DB 0FFH + DB 'opf' + DW PUT + DB 9DH +P5: + DB 1 + DB 'ushf' + DW PUT + DB 9CH +R3: + DB 6 + DB 'et' + DW GRP16 + DB 0C3H + DB 'ep' + DW PUT + DB 0F3H + DB 'ol' + DW GRP12 + DB 0 + DB 'or' + DW GRP12 + DB 8 + DB 'cl' + DW GRP12 + DB 10H + DB 'cr' + DW GRP12 + DB 18H +R4: + DB 2 + DB 'epz' + DW PUT + DB 0F3H + DB 'epe' + DW PUT + DB 0F3H +R5: + DB 2 + DB 'epnz' + DW PUT + DB 0F2H + DB 'epne' + DW PUT + DB 0F2H +S3: + DB 11 + DB 'ub' + DW GRP7 + DB 2AH + DB 'bb' + DW GRP7 + DB 1AH + DB 'bc' + DW GRP7 + DB 1AH + DB 'tc' + DW PUT + DB 0F9H + DB 'td' + DW PUT + DB 0FDH + DB 'ti' + DW PUT + DB 0FBH + DB 'hl' + DW GRP12 + DB 20H + DB 'hr' + DW GRP12 + DB 28H + DB 'al' + DW GRP12 + DB 20H + DB 'ar' + DW GRP12 + DB 38H + DB 'eg' + DW GRP21 + DB 26H +S4: + DB 5 + DB 'cab' + DW PUT + DB 0AEH + DB 'caw' + DW PUT + DB 0AFH + DB 'tob' + DW PUT + DB 0AAH + DB 'tow' + DW PUT + DB 0ABH + DB 'ahf' + DW PUT + DB 9EH +T4: + DB 1 + DB 'est' + DW GRP20 + DB 84H +U2: + DB 1 + DB 'p' + DW PUT + DB 0FCH +W4: + DB 1 + DB 'ait' + DW PUT + DB 9BH +X3: + DB 1 + DB 'or' + DW GRP13 + DB 32H +X4: + DB 2 + DB 'chg' + DW GRP3 + DB 86H + DB 'lat' + DW PUT + DB 0D7H + + +OPTAB: +; Table of pointers to mnemonics. For each letter of the alphabet (the +; starting letter of the mnemonic), there are 5 entries. Each entry +; corresponds to a mnemonic whose length is 2, 3, 4, 5, and 6 characters +; long, respectively. If there are no mnemonics for a given combination +; of first letter and length (such as A-2), then the corresponding entry +; points to NONE. Otherwise, it points to a place in the mnemonic table +; for that type. + +; This table only needs to be modified if a mnemonic is added to a group +; previously marked NONE. Change the NONE to a label made up of the first +; letter of the mnemonic and its length, then add a new subsection to +; the mnemonic table in alphabetical order. + + DW NONE + DW A3 + DW NONE + DW A5 + DW NONE + DW NONE ;B + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;C + DW C3 + DW C4 + DW NONE + DW NONE + DW D2 ;D + DW D3 + DW D4 + DW NONE + DW NONE + DW E2 ;E + DW E3 + DW NONE + DW E5 + DW NONE + DW NONE ;F + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;G + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;H + DW H3 + DW H4 + DW NONE + DW NONE + DW I2 ;I + DW I3 + DW I4 + DW NONE + DW NONE + DW J2 ;J + DW J3 + DW J4 + DW NONE + DW NONE + DW NONE ;K + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;L + DW L3 + DW L4 + DW L5 + DW L6 + DW NONE ;M + DW M3 + DW M4 + DW NONE + DW NONE + DW NONE ;N + DW N3 + DW NONE + DW NONE + DW NONE + DW O2 ;O + DW O3 + DW O4 + DW NONE + DW NONE + DW NONE ;P + DW P3 + DW P4 + DW P5 + DW NONE + DW NONE ;Q + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;R + DW R3 + DW R4 + DW R5 + DW NONE + DW NONE ;S + DW S3 + DW S4 + DW NONE + DW NONE + DW NONE ;T + DW NONE + DW T4 + DW NONE + DW NONE + DW U2 ;U + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;V + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;W + DW NONE + DW W4 + DW NONE + DW NONE + DW NONE ;X + DW X3 + DW X4 + DW NONE + DW NONE + DW NONE ;Y + DW NONE + DW NONE + DW NONE + DW NONE + DW NONE ;Z + DW NONE + DW NONE + DW NONE + DW NONE + +HEADER: DB 13,10,'Seattle Computer Products 8086 Assembler Version 2.00' + DB 13,10,'$' +ERRMES: DM '***** ERROR no. ' +NOSPAC: DB 13,10,'No directory space',13,10,'$' +HEXSUF: DM 'H',13,10 +NOMEM: DB 13,10,'Insufficient memory',13,10,'$' +NOFILE: DB 13,10,'File not found',13,10,'$' +WRTERR: DB 13,10,'Disk write error',13,10,'$' +BADDSK: DB 13,10,'Bad disk specifier',13,10,'$' +ERCNTM: DM 13,10,13,10,'Error Count =' +SYMMES: DM 13,10,'Symbol Table',13,10,13,10 +EXTEND: DB 'A86',0,0,0,0 +IFEND: DB 5,'endif' +RETSTR: DM 'ret' +HEXFCB: DB 0,' HEX',0,0,0,0 + DS 16 + DB 0 +LSTFCB: DB 0,' PRN',0,0,0,0 + DS 16 + DB 0 +PC: DS 2 +OLDPC: DS 2 +LABPT: DS 2 +FLAG: DS 1 +L1A98: DS 1 +ADDR: DS 2 +ALABEL: DS 2 +DATA: DS 2 +DLABEL: DS 2 +CON: DS 2 +UNDEF: DS 2 +LENID: DS 1 +ID: DS 80 +CHR: DS 1 +SYM: DS 1 +BASE: DS 2 +HEAP: DS 2 +SYMFLG: DS 1 +CODE: DS 2 +DATSIZ: DS 1 +RELOC: DS 1 +BCOUNT: DS 1 +COUNT: DS 1 +ERR: DS 1 +HEXPNT: DS 2 +HEXLEN: DS 2 +HEXADD: DS 2 +LASTAD: DS 2 +HEXCNT: DS 1 +CHKSUM: DS 1 +L1B0E: DS 1 +L1B0F: DS 1 +L1B10: DS 1 +IFFLG: DS 1 +CHKLAB: DS 1 +LSTPNT: DS 2 +ERRCNT: DS 2 +LSTRET: DS 2 +RETPT: DS 2 +HEXBUF: DS 128 +L1B9B: DS 128 +LSTBUF: DS 128 + DS 50 +STACK: EQU $ +START: EQU $ + \ No newline at end of file diff --git a/CPM Tools/DOSGEN.COM b/CPM Tools/DOSGEN.COM new file mode 100644 index 0000000000000000000000000000000000000000..82849c47027afcfc20f95b44d09f176bc6c522b5 GIT binary patch literal 768 zcmXrK%*-cwmX*QChuJEIVY>pWU@wzIn5~g7^Ib&^=Ce(VikF$s9$>V}W%#D>uSA3G zuA&UH1j}7T0kB*!%h>~rcNJM691es+1>U=gKbSz;gGJ9CU_5KUB>04hkMk@mgOv}n z|IxD?OniJ7&$2QcW?;B$#=~&ejF;iA86U%4Gkyj>{<}{v-hFzOmErEgfBz2%E@$H7 zgmUki@u=KYzWekd*d)OnOcHCJUgVRy`xK=5;oXOPB4Djh-aiHfHo*o4Nr~J47*7c9 z!D-A{ro%amT8s>W5)6_rL9{fKmV?rYP+FZq@};6Lv)@?`CdFW8r2uBT|3-eyihj%{ zc1-(D_?;DCvioo3&uk~9=+A7jPve;%&shm3tpH}m1_n;00A?58vkFY>je?l1f|&nt zS+EIS1X*lj6vTX1gK4|Q35n-Ui75&xMVV!(3dIGf$(d=H$%!SI`FXrtDsG9HIjJcM zCHV^Z1*v%oN-9byf<>u`DNsR|%;Ic?@}kU=RE5-{qWmIWE|uWQ;*!){g_5GgyyCRf zqSO>#E)|9l-vDP{7X<}pe_sX*GZ+701qeIDH^9l$AHsI=4+b&8YMlK2LlhutD$Zue z9=2v?WMDX(%6uz~nUM{|xKho0r&? z*D0sv*GxK4JNYE%Yff$Hij61ggtVo(4>vGZY&;=VF09ObxSQF8sYjN9k%1w$h=H-c z-T#mni [!WARNING] +> These tools have only been tested under Cromemco CDOS 2.x. There is no guarantee that they will work under the official CP/M operating system or other CP/M-like operating systems. The source files are to be assembled using Cromemco's CDOS Z80 assembler, and you must have a Z80 CPU to run the binaries. + +## ASM86 +This is a reconstruction of the SCP Z80/8086 Cross Assembler [@TimPaterson](https://github.com/TimPaterson) used to develop 86-DOS. Original copies of this cross assembler are long gone, and the only thing we have now is [a manual](https://bitsavers.org/pdf/seattleComputer/Z80_8086_Cross_Assembler_Preliminary.pdf) for it. Given that the 86-DOS ASM assembler is essentially an 8086 translation of this assembler, I wrote a utility that does the exact opposite of TRANS (named CIS) to translate 86-DOS 0.11's assembler back to Z80. After making some minor tweaks to the output, I was able to make it work, so here it is. + +> [!TIP] +> The Z80 source of the assembler is actually easier to read than the 8086 source because this assembler was originally written in the Z80 assembly language. When it was translated to 8086, a lot of boilerplate code were added, which made the code slightly difficult to follow. Now that it has been translated back to Z80, those boilerplate code have been removed. + +ASM86 takes the following parameters: [x:]ASM86 [y:]name[.ijk] [S] + +where + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
xis an optional disk drive specifier indicating the location of the ASM86.COM file. This parameter is required only if the COM file is NOT located on either drive A or the current drive. Legal values are A, B, C, and D.
yis an optional disk drive specifier indicating the location of the source file. This paramter may be omitted if the source file is on the current drive.
nameis the name of the 8086 assembly language source file, without the 3-letter extension. The extension A86 is always assumed and may not be overriden.
ijkis an optional 3-letter drive assigment parameter. The first letter is the name of the drive on which the source file will be found. This overrides a disk specifier which precedes the file name. The second letter is the name of the drive to which the hex object file will be written, or Z if no object file is desired. The third letter is the name of the drive to which the listing file will be written, or X to send the listing to the console, or Z if no listing file is desired. Assembling with no listing is much faster since the source file will not be read from disk a second time.
Sis an optional switch indicating that a symbol table is to be placed at the end of the listing.
+ +This assembler can only produce Intel HEX files for object code, therefore you must convert them to binary before they can be executed on the 8086. Under CP/M, this can be done using the LOAD command. If you are using CDOS, which does not have LOAD, you will have to use DEBUG to load the .HEX file to memory and SAVE to save the loaded pages as a disk file. + +> [!TIP] +> Don't forget to rename the source files from .ASM to .A86. + +## DOSGEN +This is a tool I wrote to copy 86-DOS system files to the system area of IBM 8" SSSD floppies. It works in a similar way to CP/M's SYSGEN utility. + +DOSGEN takes the following parameters: [x:]DOSGEN y: [T] + +where + + + + + + + + + + + + + + + + + + + + +
xis an optional disk drive specifier indicating the location of the DOSGEN.COM file. This parameter is required only if the COM file is NOT located on either drive A or the current drive. Legal values are A, B, C, and D.
yis a disk drive specifier indicating the disk upon which the 86-DOS system is to be written.
Tis an optional switch indicating that a temporary copy of the system is to be used. A temporary system includes a temporary BIOS and a temporary command interpreter. Normally, the BIOS uses DOS to load the command interpreter, COMMAND.COM, from the file area. The temporary BIOS loads the command interpreter directly from the system area. This is useful when 86-DOS is being built and deployed for the first time, as the command interpreter cannot be put into the file area without a working copy of DOS, and a working copy of DOS needs the command interpreter. The temporary command interpreter differs from the normal command interpreter in that it includes RDCPM as an internal command. This is needed for copying the actual command interpreter from CP/M disks to DOS disks once the temporary system is booted.
+ + To copy 86-DOS to a new floppy disk, you must have the files BOOT.COM, DOSIO.COM and 86DOS.COM on the current drive. If a temporary system is to be copied, TMPBIO.COM and TMPCMD.COM must also exist. diff --git a/README.md b/README.md index f57c383..744e7d6 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This project acknowledges the intellectual property rights of Microsoft Corporat By accessing and using the reconstructed source code provided in this repository, you agree to do so at your own risk and assume all responsibility for any legal implications that may arise. ## Building -All source files must be built using Seattle Computer Products' ASM-86 assembler. According to binary fragments found in the uninitialized data areas of executables, this version of 86-DOS was originally built under CP/M-80 2.2. However, since the CP/M-80 version of ASM-86 is not available online, the source files can only be assembled under DOS or Windows using the DOS version of ASM-86, branded simply as ASM. All assembly language source files in this repository use the extension .ASM so that they are accepted by the ASM assembler. Should a CP/M-80 version of ASM-86 surface one day, and if these files are to be built under CP/M, the extensions of the source files must be changed to .A86. +All source files must be built using Seattle Computer Products' ASM-86 assembler. According to binary fragments found in the uninitialized data areas of executables, this version of 86-DOS was originally built under CDOS 2.x (a CP/M-like operating system developed by Cromemco). All assembly language source files in this repository use the extension .ASM, so that they are accepted by the DOS version of the ASM-86 assembler, branded simply as ASM. Should this operating system be built under CDOS or CP/M, the extensions of the source files must be changed to .A86. ### Source to Object To assemble a source file, invoke ASM with the command line: