home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpmug
/
cpmug014.ark
/
SEDY.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-04-29
|
7KB
|
485 lines
;CONTRIBUTED TO CP/M USERS' GROUP BY:
;
; MEMORY MERCHANTS
; 1350 BUFFALO ROAD
; ROCHESTER NY 14624
;
; SEDY ----- A PROGRAM TO DISPLAY ANY DISK SECTOR TO THE
; TERMINAL
; ************************************************************
; ******************* INSTRUCTIONS ***************************
; ************************************************************
;
; THE FOLLOWING COMMANDS ARE PRESENTLY AVAILABLE :
;
; A ASCII DISPLAY MODE - DISPLAYS THE SECTOR IN ASCII
; H HEX DISPLAY MODE - DISPLAYS THE SECTOR IN HEX [DEFAULT]
; N CHANGE THE DISK, TRACK AND SECTOR TO BE DISPLAYED
; D CHANGE ONLY THE DISK TO BE DISPLAYED [USEFUL TO JUMP
; BETWEEN THE SAME POSITION ON DIFFERENT DISKS]
; T CHANGE ONLY THE TRACK TO BE DISPLAYED
; S CHANGE ONLY THE SECTOR TO BE DISPLAYED
; + DISPLAY NEXT SECTOR
; - DISPLAY PREVIOUS SECTOR
; R RETURNS TO CPM
;
; ************************************************************
; ************************************************************
;
;
.I8080
.PABS
.PHEX
.XLINK
.LOC 100H
CPM = 0
TBUF = 080H
BDOS = 05H
BIOS.VECTOR:
JMP GETBIOS
.BLKB 42
%WBOOT = BIOS.VECTOR+3
%CSTS = BIOS.VECTOR+6
%CI = BIOS.VECTOR+9
%CO = BIOS.VECTOR+12
%LO = BIOS.VECTOR+15
%PO = BIOS.VECTOR+18
%RI = BIOS.VECTOR+21
%HOME = BIOS.VECTOR+24
%SELDSK = BIOS.VECTOR+27
%SETTRK = BIOS.VECTOR+30
%SETSEC = BIOS.VECTOR+33
%SETDMA = BIOS.VECTOR+36
%READ = BIOS.VECTOR+39
%WRITE = BIOS.VECTOR+42
GETBIOS:
LXI D,%WBOOT
LHLD 01
MVI B,42
GET.VECTORS:
MOV A,M
STAX D
INX D
INX H
DCR B
JNZ GET.VECTORS
START: LXI SP,STACK
XRA A
LDA ASCII ;HEX MODE DEFAULT
CALL CRLF
LXI D,MSG0
CALL PRINT
MAINLOOP:
CALL CRLF
LXI D,MSG1
CALL PRINT
CALL DISKSEL
CALL CRLF
LXI D,MSG2
CALL PRINT
CALL SELECT
CALL SECSEL
NWTRK:
CALL CRLF
LXI D,MSG3
CALL PRINT
CALL SELECT
CALL TRACKSEL
CALL CRLF
SECOUT: CALL READR
LDA ASCII
ORA A
JNZ ASCDPLY
CALL DISPLAY
CONTROL:
CALL CRLF
LXI D,..MSG
CALL PRINT
MVI C,1
CALL BDOS
CPI "R" ;RETURN TO CPM
JZ CPM
CPI "+" ;DISPLAY NEXT SECTOR
JZ DISPNXT
CPI "-" ;DISPLAY PREVIOUS SECTOR
JZ DISPPRE
CPI "N" ;NEW SECTOR,TRACK AND DISK
JZ MAINLOOP
CPI "D" ;NEW DISK
JZ NWDSK
CPI "S" ;NEW SECTOR
JZ NWSEC
CPI "T" ;NEW TRACK
JZ NWTRK
CPI "A" ;ASCII DISPLAY MODE
JZ ASC.SEL
CPI "H" ;HEX DISPLAY MODE
JZ HEX.SEL ;[DEFAULT]
JMP CONTROL
..MSG: .ASCII "CONTROL ? $"
CRLF: MVI A,0AH
CALL CHAROUT
MVI A,0DH
CALL CHAROUT
RET
DISKSEL:
CALL CHARIN
SUI 41H
JC ERRDISK
STA CURDISK
RET
SELECT: CALL CHARIN
STA TEMP
CALL CHARIN
STA TEMP+1
RET
ERRDISK:
CALL CRLF
LXI D,..MSG
CALL PRINT
JMP START
..MSG: .ASCII " DISK SELECT ERROR!! $"
READR: CALL SETUP
CALL %READ
RET
SETUP: LXI B,TBUF
CALL %SETDMA
LDA CURDISK
MOV C,A
CALL %SELDSK
LDA CURSECT
MOV C,A
CALL %SETSEC
LDA CURTRACK
MOV C,A
CALL %SETTRK
RET
SECSEL: XRA A
STA CURSECT
LDA TEMP
CPI "0"
JZ ..SKIP
CALL ASCBIN
CALL DEC
STA CURSECT
..SKIP: LDA TEMP+1
CALL ASCBIN
MOV B,A
LDA CURSECT
ADD B
JZ SECINERR
CPI 27
JNC SECINERR
STA CURSECT
RET
TRACKSEL:
XRA A
STA CURTRACK
LDA TEMP
CPI "0"
JZ ..SKIP
CALL ASCBIN
CALL DEC
STA CURTRACK
..SKIP: LDA TEMP+1
CALL ASCBIN
MOV B,A
LDA CURTRACK
ADD B
CPI 77
JNC TRACKERR
STA CURTRACK
RET
SECINERR:
CALL CRLF
LXI D,..MSG
CALL PRINT
JMP START
..MSG: .ASCII "SECTOR VALUE OUT OF RANGE [1 TO 26] $"
TRACKERR:
CALL CRLF
LXI D,..MSG
CALL PRINT
JMP START
..MSG: .ASCII "TRACK VALUE OUT OF RANGE [0 TO 76] $"
ASCBIN:
SUI "0"
JC ASCERR
CPI 10
JNC ASCERR
RET
ASCERR:
CALL CRLF
LXI D,..MSG
CALL PRINT
JMP MAINLOOP
..MSG: .ASCII "NON NUMERIC RESPONSE ERROR $"
DEC: ADD A
MOV B,A
ADD A
ADD A
ADD B
RET
PRINT: MVI C,9
PUSH H
CALL BDOS
POP H
RET
CURVAL: LXI D,..MSG0
CALL PRINT
LDA CURDISK
ADI 41H
CALL CHAROUT
LXI D,..MSG1
CALL PRINT
LDA CURTRACK
STA SCRATCH
CALL BINDEC
LXI D,..MSG2
CALL PRINT
LDA CURSECT
STA SCRATCH
CALL BINDEC
CALL CRLF
CALL CRLF
RET
..MSG0: .ASCII "DISK # $"
..MSG1: .ASCII " TRACK # $"
..MSG2: .ASCII " SECTOR # $"
BINDEC: MVI A,30H
STA TEMP
STA TEMP+1
LDA SCRATCH
..LOOP: SUI 10
JC ONES
LXI H,TEMP
INR M
JMP ..LOOP
ONES: ADI 10
..LOOP: SUI 1
JC ..OUTCH
LXI H,TEMP+1
INR M
JMP ..LOOP
..OUTCH:
LDA TEMP
CALL CHAROUT
LDA TEMP+1
CALL CHAROUT
RET
CHARIN: MVI C,1
CALL BDOS
RET
CHAROUT:
MOV E,A
PUSH H
PUSH PSW
MVI C,2
CALL BDOS
POP PSW
POP H
RET
DISPLAY:
CALL CRLF
CALL CURVAL
LXI H,TBUF
MVI B,0
..LOOP: PUSH B
MOV A,M
CALL BINHEX
LDA TEMP
CALL CHAROUT
LDA TEMP+1
CALL CHAROUT
MVI A," "
CALL CHAROUT
POP B
INR B
MVI A,16
CMP B
CZ NEWLINE
INX H
MVI A,1
CMP H
JNZ ..LOOP
CALL CRLF
RET
HEX: ADI 30H
CPI 3AH
RC
ADI 7H
RET
BINHEX: STA TEMP+1
ANI 0F0H
RRC
RRC
RRC
RRC
CALL HEX
STA TEMP
LDA TEMP+1
ANI 0FH
CALL HEX
STA TEMP+1
RET
NEWLINE:
CALL CRLF
MVI B,0
RET
DISPNXT:
LXI H,CURSECT
INR M
MVI A,27
CMP M
JNZ SECOUT
MVI A,1
STA CURSECT
LXI H,CURTRACK
INR M
MVI A,77
CMP M
JNZ SECOUT
MSGOUT: CALL CRLF
LXI D,MSG
CALL PRINT
JMP START
MSG: .ASCII "END OF DISK !! $"
DISPPRE:
LXI H,CURSECT
DCR M
XRA A
CMP M
JNZ SECOUT
MVI A,26
STA CURSECT
LXI H,CURTRACK
XRA A
CMP M
JZ MSGOUT
DCR M
JMP SECOUT
NWDSK: CALL CRLF
LXI D,MSG1
CALL PRINT
CALL DISKSEL
CALL CRLF
JMP SECOUT
NWSEC: CALL CRLF
LXI D,MSG2
CALL PRINT
CALL SELECT
CALL SECSEL
CALL CRLF
JMP SECOUT
ASCDPLY:
CALL ASCII.SEC
JMP CONTROL
ASC.SEL:
XRA A
CMA
STA ASCII
JMP SECOUT
HEX.SEL:
XRA A
STA ASCII
JMP SECOUT
PERIOD: MVI A,02EH
RET
ASCII.SEC:
CALL CRLF
CALL CURVAL
LXI H,TBUF
MVI B,0
..LOOP: PUSH B
MOV A,M
ANI 07FH ;STRIP PARITY BIT
CPI 20H
CC PERIOD
CALL CHAROUT
MVI A," "
CALL CHAROUT
CALL CHAROUT
POP B
INR B
MVI A,16
CMP B
CZ NEWLINE
INX H
MVI A,1
CMP H
JNZ ..LOOP
CALL CRLF
RET
MSG0: .ASCII "THE MEMORY MERCHANT'S SECTOR DISPLAY UTILITY $"
MSG1: .ASCII "ENTER DISK [ A, B, ETC. ] : $"
MSG2: .ASCII "ENTER SECTOR # [ 2 DIGITS, IE., 02] : $"
MSG3: .ASCII "ENTER TRACK # [ 2 DIGITS, IE., 09] : $"
ASCII: .BLKB 1
CURDISK:
.BLKB 1
CURTRACK:
.BLKB 1
CURSECT:
.BLKB 1
SCRATCH:
.BLKB 1
TEMP: .BLKW 1
.BLKB 20
STACK: .BLKB 1
.END