home *** CD-ROM | disk | FTP | other *** search
- * ddtf.asm Module for finding strings during ddt.
- * version 1 october 27, 1981 (uses lasm.com)
- *
- * (C) 1981, by Roy Lipscomb, Logic Associates, Chicago
- * Copying permitted only for non-profit distribution.
- * Original distributor: HP/RCPM, (312) 955-4493
- *
- *
- * This module relocates itself under the ccp, prints a signon
- * message, then invokes ddt. To have ddt automatically
- * load filename.com, type "ddtf filename.com".
- *
- * ddt may be on either the default drive, or the same drive
- * as ddtf.
- *
- *
- * Instructions on use are provided in DDTF.DOC.
- *
- * >>>>> Essential: Read the directions given in DDTF.DOC
- * before attempting to assemble this source code.
- *
- ********************************************************************
-
- *********************************************************
- * service/loader routines *
- *********************************************************
-
- if copy1 ;service routines
- org 100h
- jmp begin
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; initial variables ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ; change these if necessary
- reboot equ 0
- starts equ 0 ;start of block to search
- lengths equ 0e000h ;length of block to search
- linelen equ 16 ;number of chars dumpable on a line
- ;(16 fits 80-col crt).
- restart equ 1 ;first of two consecutive rst
- ; locations not otherwise used
-
- ; there is normally no need to change these
- templat equ 5dh
- bdos equ 5
- conin equ 1
- conout equ 2
- constat equ 11
- searchf equ 17
- rst7 equ 56
- deffcb equ 5ch
- tbuff equ 80h
- bufflen equ 60 ;expected maximum length of command
- ;line (for inserting " DDT ")
- ;(short length protects debug stack
- ;while testing under ddt)
- ctls equ 19
- cr equ 13
- lf equ 10
- blank equ ' '
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;values used in manipulating the ccp
-
- doslen1 equ 0d00h ;length of cpm 1.x bdos
- doslen2 equ 0e00h ;length of cpm 2.x bdos
-
- ccplen equ 800h ;length of ccp
- ccpbmax equ 6 ;offset to ccp buff maxlength value
- ccpcoml equ ccpbmax+1 ;offset to ccp command-length byte
- ccpbuff equ ccpcoml+1 ;offset to start of ccp command line
- ccp dw 0 ;ccp entry point
-
- curdrv equ 4 ;current drive in pg zero
- ccpstrt dw 0 ;pointer to first char in ccp buff
-
-
-
- ;variables used in creating DDT-invoking command
- ddt db ' DDT ' ;first 2 blanks are space for "x:"
- ddtlen equ $-ddt
-
- ddtfcb db 0,'DDT COM',0,0,0,0
- dw 0,0,0,0,0,0,0,0
-
-
- ;variables used in tests, moves, and message printing
-
- protadr dw 0 ;current start of RAM to be protected
- loadpnt dw 0
-
- eom equ '$'
-
- ccpmess db 'Abort: unable to locate CCP',eom
-
- rstmess db 'Abort: assembled with bad restart location',eom
-
- mismess db 'Abort: DDT not found',eom
-
- helpmes db cr,lf
- db ' DDTF (C) 1981 by Roy Lipscomb, Logic Associates'
- db cr,lf
- db ' Version 1 October, 1981'
- db cr,lf
- db cr,lf
- db ' A "find string" command for DDT.'
- db cr,lf
- db ' DDT must be on default disk or DDTF disk.'
- db cr,lf
- db ' For condensed instructions, type D'
- db eom
-
-
- ; compute rst address for instruction display
- ; f1,f2 is address of jump to find; s2,s2 is start search address
-
- rstadr equ restart*8
- find equ rstadr+3
- blkhead equ rstadr+6
- blklen equ rstadr+9
-
- f1 set find/16+'0' ;convert nibbles to ascii
- f2 set (find and 0fh)+'0'
- s1 set blkhead/16+'0'
- s2 set (blkhead and 0fh)+'0'
-
- f1 set f1+('9'+1-f1)/2000h ;add 7 if greater than "9"
- f2 set f2+('9'+1-f2)/2000h
- s1 set s1+('9'+1-s1)/2000h
- s2 set s2+('9'+1-s2)/2000h
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; mainline ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;initialize and print message
- begin call getbase ;compute load address: just below CCP
- push psw ;save ccp-located flag
- call signon ;print signon message
- pop psw ;restore ccp-located flag
- jz ccperr ;ccp not found
-
- ;insure good environment
- call testrst
- jz rsterr ;0 = bad rst address
-
- call testddt ;insure ddt present
- jz ddtmiss
-
- ;do it
- call chgaddr ;convert to true addresses
- call movemod ;move module to load address
- call fillrst ;set up restart location
-
- jmp getddt ;link to ddt ("jmp" directly to ccp)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; find load point for ddtf ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;if ccp not found, return with zero set
- ;(uses all registers)
-
- ;address length of command in CCP buffer
- getbase lhld 6
- shld protadr ;protect-address if ccp already
- ; protected
- lxi d,0
- call tstccp
- jz ccpnopr ;ccp found, not protected
-
- ;second try: via cbios entry point of cpm 2.x
- lhld 1
- lxi d,-doslen2
- call tstccp
- jz ccpprot ;ccp found, protected
-
- ;last try: via cbios entry point of cpm 1.x
- lhld 1
- lxi d,-doslen1
- call tstccp
- jz ccpprot ;ccp found, protected
-
- ;ccp not found
- xra a
- ret ;set zero flag ("not found")
-
- ;ccp found, but not protected
- ccpnopr lhld ccp ;ccp not yet protected...
- lxi d,-ccplen
- dad d
- shld protadr ;set to protect ccp
-
- ;ccp found, and already protected
- ccpprot lxi d,-length
- lhld protadr
- dad d
- mvi l,0 ;place on page boundary (unnecessary?)
- shld loadpnt
-
- ;exit with flag set to "ccp found"
- ori 1
- ret
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;test if this location has ccp
-
- ;compute tentative ccpbase
- tstccp mvi l,0
- dad d ;compute tentative bdos entry point
- lxi d,-ccplen
- dad d ;tentative bdos entry minus ccp length
- shld ccp ; ...gives tentative ccp entry
- xchg ; ...move it to de for safe keeping
-
- ;compute relevant addresses
- lxi h,ccpbmax ;compute address of ccp buff ptr:
- dad d ;(non-standard ccps might not have 88h)
- mvi a,ccpbuff+1 ; ccpbuff + 1 + maxbufflen
- add m
-
- mov l,a ;address of ccp buffer pointer...
- push h
- pop b ;... to bc
-
- lxi h,ccpcoml ;address of ccp command-line length
- dad d ;... to hl
-
- ;address command end + 1
- mov e,m
- mvi d,0
- dad d
- inx h
-
- ;if null not at command end +1, ccp absent
- mov a,m
- ora a
- rnz ;not present, so return non-zero
-
- ;test if ccp character pointer points to same null, or to value
- ; that appears after that null
- mov a,l ;get displacement of command endmark
- push b ;ccp current-char pointer to hl
- pop h
- sub m ;compare to length displacement
- rz ;if equal, found
- rc ;if greater, not found
-
- ;does ccp character pointer indicate byte preceding command line?
- mvi a,ccpbuff
- sub m
- rnc ;can't precede command-line
-
- ;does ccp character pointer point to inter-parameter blank?
- mvi a,blank
- mov l,m ;address byte pointed to by chr pointer
- cmp m
-
- ret ;if zero, ccp found; else not found
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; test for good RST location ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;test for good rst address: return "0" if not
- testrst lxi h,rstadr
- mov a,l
- ora h
- rz ;can't be rst 0...
-
- lxi d,-48
- dad d
- mov a,h
- ora a
- rm ;if less than 48 (rst 6),
- ; it's ok.
- badrst xra a
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; test if ddt present, update messages with drive ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;find first character of lastest ccp command
- testddt lhld ccp
- lxi d,ccpbuff
- dad d
- shld ccpstrt ;save pointer to ccp buff start
-
- mvi a,' ' ;skip blanks
- skipbl cmp m
- inx h
- jz skipbl
-
- ;test for drive prefix on latest ccp command (viz, "B:DDTF")
- mov a,m
- cpi ':'
- jnz builddt ;if not ":", don't insert drive name
-
- dcx h
- mov a,m ;save drive name for ddt search
- sui 40h
- sta ddtfcb
-
- lxi d,ddt ;set " DDT" to "x:DDT"
- lxi b,2
- call move
-
- ;create complete command, move it to ccp buffer
- builddt call build
-
- ;insure ddt is present (do only after command moved from tbuff)
- call ddtpres
-
- ret ;zero set if ddt not found
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; insure ddt present on selected or default drive ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;if not found either place, set zero flag = error
-
- ;try to find ddt on selected drive
- ddtpres lxi d,ddtfcb
- mvi c,searchf
- call bdos
- inr a ;if not 255, found: return
- rnz
-
- ;if above drive was default, set error flag and return
- lxi d,ddtfcb
- ldax d
- ora a
- rz ;set error flag
-
- ;set up to search for ddt on default drive
- xra a
- stax d ;set ddt fcb to default drive
-
- lhld ccpstrt ;clear "x:DDT" back to " DDT" in ccp
- mvi m,' '
- inx h
- mvi m,' '
-
- ;search default drive for ddt
- mvi c,searchf ;see if ddt on directory
- call bdos
-
- inr a ;if not present, set zero flag
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; convert module1 to true addresses ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- * change pseudo addresses to true addresses
- chgaddr lxi b,length
- lxi d,module1
- lxi h,module2
- truloop ldax d
- cmp m
- cnz convert
-
- inx h
- inx d
- dcx b
-
- mov a,b
- ora c
- jnz truloop
-
- ret
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; convert displacement into address ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- convert push b ;length of module not yet processed
- push h ;module2 character position
-
- ; get displacement from instruction, put into bc.
- ldax d
- mov b,a
- dcx d
- ldax d
- mov c,a
-
- lxi h,-module1 ;normalize displacement to zero
- dad b
- push h
- pop b
-
- lhld loadpnt ;add load point for true addr
- dad b
-
- ; move true address to instruction
- mov a,l
- stax d
- inx d
- mov a,h
- stax d
-
- pop h
- pop b
-
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; move module into place ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- movemod lhld loadpnt
- xchg ;de=destination
- lxi h,module1 ;hl=source
- lxi b,length
-
- call move
-
- ; protect the module (removed by wboot)
- protect lhld 6
- xchg
- lhld loadpnt
-
- dcx h
- mov m,d
- dcx h
- mov m,e
- dcx h
- mvi m,jmp
-
- shld 6
-
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; initialize restart location ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;install rst 7 instruction
- fillrst lxi h,rstadr
- mvi m,call
- inx h
- mvi m,rst7
- inx h
- mvi m,0
- inx h
-
- ;install "jmp findmod"
- mvi m,jmp
- inx h
- xchg
- lhld loadpnt
- xchg
- mov m,e
- inx h
- mov m,d
- inx h
-
- ;install default start-search address
- mvi m,jpo
- inx h
- lxi d,starts
- mov m,e
- inx h
- mov m,d
- inx h
-
- ;install default search length
- mvi m,jnz
- inx h
- lxi d,lengths
- mov m,e
- inx h
- mov m,d
-
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; print error messages ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ddtmiss lxi h,mismess
- jmp domess
-
- ccperr lxi h,ccpmess
- jmp domess
-
- rsterr lxi h,rstmess
-
- domess call display+module2
- call newline+module2
- jmp reboot ;return to cpm
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; print signon mess ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;take advantage of the fact that several of the needed
- ;routines are present in the relocatable module
-
- signon lxi h,helpmes
- call display+module2
-
- lhld loadpnt ;display load address
- call dispadr+module2
- call newline+module2
-
- call newline+module2
- call newline+module2
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; invoke ddt ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;set ccp command-buffer pointer
- getddt lhld ccp
- lxi d,ccpbmax ;offset of ccp char ptr
- dad d
- mvi a,ccpbuff+1
- add m
- mov l,a
- mvi m,ccpbuff ;store char pointer
-
- ;select drive
- lda curdrv
- mov c,a ;select current drive
-
- ; execute
- lhld ccp
- pchl
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; build new command in CCP buffer ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- build lda deffcb+1 ;parmeter passed?
- ora a
- jz deflgth
-
- cpi blank ; if yes, tbuff is empty
- cnz elbow ;if no, make room for "DDT" string
- deflgth cz emptbuf ;if yes, set default: "DDT" only
-
- ;move (prefix+) "DDT" into command-line workarea
- movcom lxi h,ddt
- lxi d,tbuff+1
- lxi b,ddtlen
- call move
-
- ;move new command to ccp buffer
- lhld ccp
- lxi d,ccpcoml
- dad d
- xchg ;destination to de (ccp buffer)
-
- lxi h,tbuff ;source to hl (tbuff)
-
- mvi b,0
- mov c,m ;length of command
- inr c ; + 1 (for length byte itself) to bc
- call move
-
- ;install end-of-command marker
- xchg
- mvi m,0
-
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; make room in command line for "DDT" string ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;command line not empty; make room for "DDT "
- elbow lxi d,tbuff+bufflen ;destination
- lxi h,tbuff+bufflen-ddtlen ;source
- mvi b,bufflen-ddtlen ;length (all but length byte)
- elloop mov a,m
- stax d
- dcx d
- dcx h
- dcr b
- jnz elloop
-
- ; update buffer length byte
- mov a,m
- adi ddtlen
- mov m,a
-
- ori 1 ;set to skip call (after return)
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;command line empty; "DDT " will be alone
- emptbuf mvi a,ddtlen
- sta tbuff
-
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; move block of data ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;source in hl, destination in de, length in bc.
-
- move mov a,b
- ora c
- rz
- mov a,m
- stax d
- inx d
- inx h
- dcx b
- jmp move
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; end of service routines ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- endif
-
-
-
-
- *********************************************************
- *********************************************************
- * beginning of relocatable module *
- *********************************************************
- *********************************************************
-
-
- ;must org on page boundary, though final copy
- ;is loadable anywhere.
- org ($/100h+1)*100h
- cbase set $
-
- if copy1
- module1 equ $
- endif
-
- if not copy1
- module2 equ $
- endif
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; jump to start
- jmp start+cbase
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; instructions ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- db 'place xvaluex'
- db 'at 5dh; x is any'
- db 'single char not '
- db 'used in value. '
- db ' '
-
- db 'To execute, type'
-
- if (f1-'1') shr 15 ;if f1 = 0
- db ' G'
- endif
-
- if (not f1-'1') shr 15 ;if f1 <> 0
- db 'G',f1
- endif
-
- db f2,'. To repeat,'
- db 'type G. '
- db ' '
-
- if (s1-'1') shr 15 ;if s1 = 0
- db ' L'
- endif
-
- if (not s1-'1') shr 15 ;if s1 <> 0
- db 'L',s1
- endif
-
- db s2,' will show '
- db 'the start (jpo) '
- db 'and length (jnz)'
- db 'of search: use '
-
- if (s1-'1') shr 15 ;if s1 = 0
- db ' A'
- endif
-
- if (not s1-'1') shr 15 ;if s1 <> 0
- db 'A',s1
- endif
-
- db s2,' to change. '
- db ' '
-
- crlf equ $-cbase
- db cr,lf,eom
-
- version equ $-cbase
- db 0 ;cpm version. if 2.X,
- ; keyboard can interrupt display
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; vestibule processing ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- start equ $-cbase
- push psw
- push b
- push d
- push h
-
- ;initialize variables
- lhld blkhead+1 ;start of search-block to bc
- mov b,h
- mov c,l
-
- lhld blklen+1 ;length of search to de
- xchg
-
- ;perform search
- call search+cbase
-
- ;return to ddt
- pop h
- pop d
- pop b
- pop psw
- jmp rstadr ;go to rst7 instruction at rstadr
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; mainline: find substring ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- search equ $-cbase ;begin comparison anew
- mov a,d
- ora e ;at end of search block?
- rz ; yes, return
-
- push d ;save count of chars left
- push b ;save current lead-off char ptr
- lxi h,templat+1 ;address the template
- oksofar equ $-cbase
- lda templat ;address initial terminator
- cmp m ;is this the end terminator?
- jz dumplin+cbase ; yes, full match: do dump, and
- ; jump to reset
- ldax b ;not template end, so get block char
- cmp m ;does it match template char?
- inx b ;(address next char in block)
- inx h ;(address next char in template)
- jnz reset+cbase ; no match; reinitialize
-
- dcx d
- mov a,d
- ora e ;a match, but is it end of block?
- jnz oksofar+cbase ; no, looks good; keep going...
-
- reset equ $-cbase ;reinitialize at next block char
- pop b ;get old lead-off position for block
- pop d ;get char count at lead-off position
- dcx d ;count down chars left in block
- inx b ;bump to next lead-off position
- jmp search+cbase ;restart the comparison
-
- *********************************************************
- * dump routines *
- *********************************************************
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;dump line
-
- dumplin equ $-cbase
- pop b ;restore lead-off character
- push b ;...and resave
-
- ;begin dump half-a-line back from target string
- lxi h,-linelen/2
- dad b
-
- ;output sections of the line
- call dispadr+cbase
- call dumphex+cbase
- call dumpasc+cbase
-
- call newline+cbase
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;check for interrupt
-
- ;key pressed?
- mvi c,constat ;key pressed?
- call bdos
- ora a ;if zero, no key pressed,
- jz reset+cbase ; continue processing
-
- ;get char (if ctl-s, continue listing)
- mvi c,conin ;get character
- call bdos
- ani 7fh
- cpi ctls
- jz reset+cbase ; continue processing
-
- ;interrupt requested: stop dump, and return to ddt
- pop b
- pop d
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;display address in hl
- dispadr equ $-cbase
- push h ;display high byte
- mov a,h
- call disphex+cbase
- pop h
-
- push h ;display low byte
- mov a,l
- call disphex+cbase
-
- mvi b,1 ;output a blank
- call blanks+cbase
-
- pop h
-
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;dump line in hex
- dumphex equ $-cbase
- push h ;save start dump-address
- mvi b,linelen ;set line length
-
- dhloop equ $-cbase
- push h ;save current dump-address
- push b ;save current char position
- mov a,m ;get character
- call disphex+cbase ;output
-
- mvi b,1 ;output blank
- call blanks+cbase
-
- pop b ;restore char count
- pop h ;restore curr dump-address
- inx h
- dcr b ;done?
- jnz dhloop+cbase ; no, do next char
-
- pop h ;restore start dump-address
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;dump line in ascii
- dumpasc equ $-cbase
- push h ;save start dump-address
- mvi b,linelen ;set line length
-
- daloop equ $-cbase
- push h ;save current-char address
- push b ;save char count
-
- mov a,m ;get current char
- inr a ;wrap around for "del" (127h)
- jm period+cbase ;if > 127, change to "."
- cpi ' '+1 ;if < " ", change to "."
- mov a,m ;(reget original char)
- jp charok+cbase ;display char as is
- period equ $-cbase
- mvi a,'.'
- charok equ $-cbase
- call charout+cbase
-
- pop b
- pop h
- inx h
- dcr b
- jnz daloop+cbase ;do again if more chars left
-
- pop h ;restore start dump-address
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;display hex character in ascii format
- disphex equ $-cbase
- push psw
- rar
- rar
- rar
- rar
- call dhex2+cbase
- pop psw
-
- dhex2 equ $-cbase
- ani 0fh
- cpi 10
- jm under10+cbase
- adi 7
- under10 equ $-cbase
- adi '0'
- jmp charout+cbase
-
- *********************************************************
- * display routines *
- *********************************************************
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;skip to new line
- newline equ $-cbase
- lxi h,crlf+cbase
- jmp display+cbase
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;output blanks (number from b)
- blanks equ $-cbase
- mvi a,blank
- blanks2 equ $-cbase
- push b
- call charout+cbase
- pop b
- dcr b
- jnz blanks2+cbase
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;display string
- display equ $-cbase
- mov a,m
- cpi eom
- rz
-
- push h
- call charout+cbase
- pop h
- inx h
- jmp display+cbase
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; display char on console
- charout equ $-cbase
- push psw
- mvi c,conout
- mov e,a
- call bdos
- pop psw
- ret
-
- *********************************************************
- * end of relocatable routines *
- *********************************************************
-
- ;get length of relocatable routines
- length equ $-cbase
-
- ;flip the copy1/copy2 toggle
- copy1 set not copy1
-
- ;link a second copy, if this was the first copy
- if not copy1
- link ddtf
- endif