Verwendete IO-Ports bzw. Hardware:
PN DIR-PRINT
;
ZANF: EQU 00500H
PFL: EQU 052H
PDR: EQU 050H
;
ORG 00100H
;
DIR: CALL INIT
XOR A
LD (FANZ),A
LD HL,TDIR
LD C,060H
CALL OPEN
CALL OTALK
PUSH BC
LD B,7
LD HL,SPAC
IGN: CALL IECL
JRNZ DNR-#
DJNZ IGN-#
RST 020H
DB 2,13
DB 'DISK:'
DB 0A0H
NZEI: CALL IECIN
OR A
JRZ EZEI-#
NZ2: RST 020H
DB 0
JR NZEI-#
EZEI: RST 020H
DB 2,08DH
CALL PRDI
RST 020H
DB 4
LD HL,FANZ
OR A
JRNZ DE2-#
INC M
CALL IECIN
CALL IECIN
BIT 6,B
JRNZ DEND-#
CALL LADR
CALL PDEZ
KORR: CALL IECIN
CMP ' '
JRNZ NZ2-#
JR KORR-#
DNR: CALL FSTAT
DEND: LD HL,FANZ
DEC M
DEC M
DE2: LD A,M
CMP 150
JRNC DE3-#
LD L,A
LD H,0
CALL PDEZ
RST 020H
DB 2
DB 'Files '
DB 'listed.'
DB 08DH
CALL PRDI
DE3: POP BC
CALL CLOSE
RST 020H
DB 2,08DH
RST 038H
TDIR: DB '$',0
PRDI: LD HL,CVGA
LD B,5
PINT: LD A,M
CALL POUT
INC HL
DJNZ PINT-#
LD HL,(02BH)
LD DE,32
SBC HL,DE
LD B,32
PLOP: LD A,M
CALL VGRA
INC HL
DJNZ PLOP-#
LD A,13
CALL POUT
LD A,10
CALL POUT
RET
VGRA: PUSH HL
PUSH DE
PUSH BC
CMP 32
JRC EXC-#
CMP 080H
JRC NUG-#
EXC: LD A,32
NUG: SUB 32
LD HL,ZANF
LD D,0
LD E,A
SLA E
RL D
SLA E
RL D
SLA E
RL D
ADD HL,DE
LD B,8
GIVE: LD A,M
CALL POUT
INC HL
DJNZ GIVE-#
POP BC
POP DE
POP HL
RET
POUT: PUSH AF
PRL: IN PFL
BIT 0,A
JRNZ PRL-#
POP AF
OUT PDR
RET
FSTAT: PUSH HL
PUSH DE
PUSH BC
PUSH AF
LD C,06FH
CALL OTALK
NEZ: CALL IECIN
RST 020H
DB 0
CMP 13
JRNZ NEZ-#
CALL UTALK
LD HL,(02BH)
LD DE,32
SBC HL,DE
EX DE,HL
RST 020H
DB 3
LD A,L
LD (PRFL),A
POP AF
POP BC
POP DE
POP HL
RET
LADR: PUSH BC
CALL IECIN
LD L,A
CALL IECIN
LD H,A
LD A,B
OR A
POP BC
RET
PDEZ: PUSH HL
PUSH DE
PUSH BC
PUSH AF
LD D,0
LD BC,100
CALL ZST
LD C,10
CALL ZST
LD C,1
CALL ZST
RST 020H
DB 2,0A0H
POP AF
POP BC
POP DE
POP HL
RET
ZST: XOR A
NSC: INC A
SBC HL,BC
JRNC NSC-#
ADD HL,BC
ADD 02FH
CMP '0'
JRZ PSP-#
LD D,1
JR ZGET-#
PSP: DEC C
JRZ ZGET-#
LD E,A
LD A,D
OR A
LD A,E
JRNZ ZGET-#
LD A,' '
ZGET: RST 020H
DB 0
RET
ERRM: PUSH AF
LD A,B
CMP 040H
JRZ NMSG-#
OR A
CANZ MESG
NMSG: POP AF
RET
MESG: LD A,B
CMP 040H
JRZ EDAT-#
CMP 080H
JRZ DNP-#
DEC A
JRZ OERR-#
DEC A
JRZ IERR-#
OKM: RST 020H
DB 2
DB 13
DB 'OK.'
DB 08DH
RET
EDAT: RST 020H
DB 2
DB 13
DB 'End of Datas'
DB 08DH
RET
OERR: RST 020H
DB 2
DB 13
DB 'Error: OUTPUT'
DB 08DH
JR ENT-#
IERR: RST 020H
DB 2
DB 13
DB 'Error: INPUT'
DB 08DH
JR ENT-#
DNP: RST 020H
DB 2
DB 13
DB 'Device not'
DB ' present'
DB 08DH
ENT: LD SP,0B0H
JMP DIR
INIT: LD A,0FFH
OUT PFL+1
LD A,0C7H
OUT PFL+1
OUT PFL
LD A,00FH
OUT PDR+1
LD HL,PENT
LD B,3
ETP: LD A,M
CALL POUT
INC HL
DJNZ ETP-#
RET
TALK: LD B,040H
JR OTL-#
LIST: LD B,020H
OTL: LD A,(DIV)
AND 00FH
OR B
AATN: PUSH AF
IN PFL
RES 5,A
OUT PFL
SET 3,A
OUT PFL
POP AF
AT2: PUSH AF
IN PFL
SET 4,A
OUT PFL
RES 5,A
OUT PFL
LD B,239
LD C,0
WM1: DJNZ WM1-#
POP AF
IECO: LD B,C
LD C,A
IN PFL
RES 5,A
OUT PFL
IN PFL
BIT 7,A
JRNZ DNPS-#
RES 4,A
OUT PFL
BIT 6,B
JRZ WLB-#
WG1: IN PFL
BIT 7,A
JRZ WG1-#
WG2: IN PFL
BIT 7,A
JRNZ WG2-#
WLB: IN PFL
BIT 7,A
JRZ WLB-#
SET 4,A
OUT PFL
LD B,8
DONX: IN PFL
BIT 7,A
JRZ TOMS-#
BIT 0,C
JRNZ DOH-#
DOL: SET 5,A
JR DOO-#
DOH: JRZ DOH-#
RES 5,A
DOO: PUSH BC
LD B,2
TKO2: DJNZ TKO2-#
LD A,A
OUT PFL
RES 4,A
OUT PFL
POP BC
RRC C
RES 5,A
SET 4,A
OUT PFL
DJNZ DONX-#
LD B,59
FO3: IN PFL
BIT 7,A
JRZ EOS-#
DJNZ FO3-#
TOMS: LD B,1
JR ULS2-#
EOS: LD B,0
RET
DNPS: LD B,080H
JR ULS2-#
SEKL: CALL AT2
IN PFL
RES 3,A
OUT PFL
RET
SEKT: CALL AT2
IN PFL
SET 5,A
OUT PFL
RES 3,A
OUT PFL
RES 4,A
OUT PFL
WCL: IN PFL
BIT 6,A
JRNZ WCL-#
RET
UTALK: IN PFL
SET 4,A
OUT PFL
SET 3,A
OUT PFL
LD A,05FH
JR UTLS-#
ULIST: LD A,03FH
UTLS: CALL AATN
ULS2: IN PFL
RES 3,A
OUT PFL
ULS3: EX (SP),HL
EX (SP),HL
BIT 2,M
IN PFL
RES 4,A
OUT PFL
RES 5,A
OUT PFL
RET
IECIN: IN PFL
RES 4,A
OUT PFL
FI0: IN PFL
BIT 6,A
JRZ FI0-#
LD C,0
EOI: LD B,50
RES 5,A
OUT PFL
FI1: IN PFL
BIT 6,A
JRZ DISC-#
DJNZ FI1-#
LD B,2
LD A,C
OR A
RNZ
IN PFL
SET 5,A
OUT PFL
RES 4,A
OUT PFL
LD C,040H
JR EOI-#
DISC: LD A,C
PUSH AF
LD B,8
DINX: IN PFL
BIT 6,A
JRZ DINX-#
SCF
BIT 7,A
JRNZ DIH-#
CCF
DIH: RR C
WI1: IN PFL
BIT 6,A
JRNZ WI1-#
DJNZ DINX-#
SET 5,A
OUT PFL
POP AF
PUSH AF
CMP 040H
CAZ ULS3
POP AF
LD B,A
LD A,C
RET
IECS: PUSH BC
LD A,M
CALL IECO
LD A,B
INC HL
POP BC
OR A
RET
IECL: PUSH BC
CALL IECIN
LD M,A
LD A,B
INC HL
POP BC
OR A
RET
OTALK: PUSH AF
PUSH BC
CALL TALK
CALL ERRM
POP BC
PUSH BC
LD A,C
CALL SEKT
CALL ERRM
POP BC
POP AF
RET
OLIST: PUSH AF
PUSH BC
CALL LIST
CALL ERRM
POP BC
PUSH BC
LD A,C
CALL SEKL
CALL ERRM
POP BC
POP AF
RET
CLOSE: PUSH AF
PUSH BC
LD A,C
AND 0EFH
OR 0E0H
LD C,A
CALL OLIST
CALL ULIST
CALL ERRM
POP BC
POP AF
RET
OPEN: PUSH AF
PUSH BC
LD A,C
OR 0F0H
LD C,A
CALL OLIST
NZFN: LD A,M
OR A
JRZ FNSE-#
CALL IECS
JR NZFN-#
FNSE: CALL ULIST
CALL ERRM
POP BC
POP AF
RET
PENT: DB 27,'3',24
CVGA: DB 27,'*'
DB 5,0,1
DIV: DB 8
FANZ: DB 0
PRFL: DB 0
SPAC: DB 0
END
;
END