home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPMINFO
/
TELL02.LBR
/
TELL.AQM
/
TELL.ASM
Wrap
Assembly Source File
|
2000-06-30
|
6KB
|
388 lines
; TELL program by Howard Moulton (since revised by others)
;
;
; This is a small utility used to find out various locations of what and
; where various addresses are within the CP/M for which this utility
; operates. Quite useful if your writing software for CP/M, but need
; to find out the EXACT addresses that some CBOIS routines are operating
; when the occasion arises that the software CAN'T access it through
; CP/M, like rewriting FORMAT programs and such utilities as those.....
;
; Any mods or changes or enhancements would be appreciated......Howard
;
;
; Equates
;
BDOS EQU 0005H
CR EQU 0DH
LF EQU 0AH
TAB EQU 09H
;
RDCON EQU 1
WRCON EQU 2
PRINT EQU 9
RESET EQU 13
SELDS EQU 14
SEAFF EQU 17
SEANF EQU 18
RESEC EQU 20
;
;
BEGIN: ORG 100H
LXI D,INTRO
MVI C,PRINT
CALL BDOS
CALL CRLF
JMP START
;
INTRO: DB CR,LF,'This is a utility that tells you where your CCP'
DB CR,LF,'starts, what your BDOS entry address is, and'
DB CR,LF,'where your BIOS jump table begins, as well as'
DB CR,LF,'useful information'
DB CR,LF,CR,LF,'$'
;
;
; We'll use the CP/M stack since we're so small, we couldn't possibly
; overwrite the CCP, which would require a warm start....
;
START: LHLD 1 ; Get WBOOT address
DCX H
DCX H
DCX H ; Bump down to CBOOT address
;
;
; Now store the aquired beginning of the jump table
;
SHLD JMPTBL
;
;
; Now get the CCP address....
;
MOV A,H ; Get the high address
SUI 16H ; Subtract 1600H
MOV H,A
SHLD CCPADD ; Now have CCP address
;
;
; Now get the BDOS entry address...
;
LXI D,806H ; Get offset for BDOS entry
DAD D
SHLD DOSENT ; Now has BDOS entry point
;
;
; Now tell them something about the environment we have found...
; first, tell where CCP is...
;
LXI D,CCPMSG
MVI C,PRINT
CALL BDOS
LHLD CCPADD ; Get CCP
CALL SWAP ; Swap them for now
CALL SNDH
;
;
; Now for the BDOS entry address....
;
LXI D,DOSMSG ; Point to message
MVI C,PRINT ; And print...
CALL BDOS ; It out..
LHLD DOSENT ; Get DOS entry, add in "H"
CALL SWAP ; Swap them for now
CALL SNDH
;
;
; Now for the jump table...
;
LXI D,JMPMSG
MVI C,PRINT
CALL BDOS
LHLD JMPTBL
CALL SWAP
CALL SNDH
;
;
; List jump table now...give address of cold start
;
LXI D,J0
MVI C,PRINT
CALL BDOS
LXI D,0 ; No offset
CALL SETUP
CALL SNDH
;
;
; Next in jump table...
;
LXI D,J1 ; Start listing jump table
MVI C,PRINT
CALL BDOS
LXI D,3
CALL SETUP
CALL SNDH
;
;
; Now the rest...
;
LXI D,J2
MVI C,PRINT
CALL BDOS
LXI D,6
CALL SETUP
CALL SNDH
;
;
; The console-in routine
;
LXI D,J3
MVI C,PRINT
CALL BDOS
LXI D,09H
CALL SETUP
CALL SNDH
;
;
; The console-out routine...
LXI D,J4
MVI C,PRINT
CALL BDOS
LXI D,0CH
CALL SETUP
CALL SNDH
;
;
; Now the list device...
;
LXI D,J5
MVI C,PRINT
CALL BDOS
LXI D,0FH
CALL SETUP
CALL SNDH
;
;
; Next jmp...
;
LXI D,J6
MVI C,PRINT
CALL BDOS
LXI D,12H
CALL SETUP
CALL SNDH
;
;
; Now the reader..
;
LXI D,J7
MVI C,PRINT
CALL BDOS
LXI D,15H
CALL SETUP
CALL SNDH
;
;
; Now the home disk
;
LXI D,J8
MVI C,PRINT
CALL BDOS
LXI D,18H
CALL SETUP
CALL SNDH
;
;
; Select disk routine
;
LXI D,J9
MVI C,PRINT
CALL BDOS
LXI D,1BH
CALL SETUP
CALL SNDH
;
;
; Set track routine...
;
LXI D,J10
MVI C,PRINT
CALL BDOS
LXI D,1EH
CALL SETUP
CALL SNDH
;
;
; Set sec...
;
LXI D,J11
MVI C,PRINT
CALL BDOS
LXI D,21H
CALL SETUP
CALL SNDH
;
;
; The DMA
;
LXI D,J12
MVI C,PRINT
CALL BDOS
LXI D,24H
CALL SETUP
CALL SNDH
;
;
; Read the disk
;
LXI D,J13
MVI C,PRINT
CALL BDOS
LXI D,27H
CALL SETUP
CALL SNDH
;
;
; Write disk ....
;
LXI D,J14
MVI C,PRINT
CALL BDOS
LXI D,2AH
CALL SETUP
CALL SNDH
;
;
; List status
;
LXI D,J15
MVI C,PRINT
CALL BDOS
LXI D,2DH
CALL SETUP
CALL SNDH
;
;
; Sector translate
;
LXI D,J16
MVI C,PRINT
CALL BDOS
LXI D,30H
CALL SETUP
CALL SNDH
;
RET ; Pop off to CP/M
;.....
;
;
; Setup does setup of new address, i.e., D+E = OFFSET from location
; JMPTBL, which gets into HL from here.
;
SETUP: LHLD JMPTBL
DAD D
INX H
MOV D,M
INX H
MOV E,M
XCHG
SHLD TMPADR
RET
;.....
;
;
; Sends address in ASCII to console
;
SNDH: LXI D,TMPADR
MVI C,2
CALL CONV
RET
;....
;
;
; Routine to convert binary to ASCII - enters with D+E pointing to the
; byte or word to convert and the count in C...
;
CONV: LDAX D
PUSH D ; Save the entry address
PUSH B
PUSH PSW ; Save the lower half
CALL BINH
POP PSW ; Get lower half back
CALL BINL
POP B ; Get back count
POP D ; Get back point
DCR C
JZ CRLF ; Done with this line
INX D ; Mov "D" up one
JMP CONV
;
BINH: RAR
RAR
RAR
RAR
;
BINL: ANI 15
ADI 48
CPI 58
JC AOUT
ADI 7
;
AOUT: MOV E,A
MVI C,WRCON
CALL BDOS
RET
;.....
;
;
; Send carriage return and line feed to console
;
CRLF: MVI E,CR
MVI C,WRCON
CALL BDOS
MVI E,LF
MVI C,WRCON
CALL BDOS
RET
;.....
;
;
; Swap routine - swaps what is in HL and stores @ TMPADR
;
SWAP: MOV E,H
MOV D,L
XCHG ; Swap them
SHLD TMPADR
RET
;.....
;
;
; Message area
;
J0: DB 'cold start routine',TAB,TAB,'$'
J1: DB 'warmstart routine',TAB,TAB,'$'
J2: DB 'console status routine',TAB,TAB,'$'
J3: DB 'console Input routine',TAB,TAB,'$'
J4: DB 'console out routine',TAB,TAB,'$'
J5: DB 'list device out routine',TAB,TAB,'$'
J6: DB 'punch out routine',TAB,TAB,'$'
J7: DB 'reader in routine',TAB,TAB,'$'
J8: DB 'home disk routine',TAB,TAB,'$'
J9: DB 'select disk routine',TAB,TAB,'$'
J10: DB 'the set track routine',TAB,TAB,'$'
J11: DB 'set the sector routine',TAB,TAB,'$'
J12: DB 'set the dma routine',TAB,TAB,'$'
J13: DB 'read disk routine',TAB,TAB,'$'
J14: DB 'write disk routine',TAB,TAB,'$'
J15: DB 'list status routine',TAB,TAB,'$'
J16: DB 'sector translate routine',TAB,'$'
;
CCPMSG: DB 'CCP starts',TAB,TAB,TAB,'$'
CCPADD: DW 0
DOSMSG: DB 'BDOS entry address is',TAB,TAB,'$'
DOSENT: DW 0
JMPMSG: DB 'BIOS jump table starts',TAB,TAB,'$'
JMPTBL: DW 0
TMPADR: DW 0
;
;
END