; This program returns the amount of free space in the TPA. This ; can be useful when running under FAST, DESPOOL, DDT, SID, etc. ; ver equ 31 ; Current version number mo equ 11 ; Month last modified dy equ 20 ; Day yr equ 87 ; Year ; Version of 8/30/80 ; ; by Ron Fowler ; Westland, Mich. ; 8/24/80 ; ; Fixes and code optimization by ; Keith Petersen ; ; 11/20/87 Modified to display message if a resident system extension ; has been added to the system. ; org 100h ; base: lxi h,0 dad sp ; Get local stack lxi sp,stack push h ; Save old stack lxi d,msg0 ; Print signon message mvi c,9 ; Print message function call 5 ; Print it lhld 6 ; Get the top of memory xchg ; Put it in DE lxi h,-100h ; Get the start of memory dad d ; Subtract it, answer left in HL call decout ; Print it lxi d,msg1 ; Print the rest of line mvi c,9 ; Print message function call 5 ; Print it ; mvi l,0 ; Round to next lowest page boundary lda 2 ; Get MSB of Cold boot routine sui 0eh ; Subtract the size of BDOS (3.5k) mov h,a ; Save it in lda 7 ; Get the MSB of the BDOS cmp h ; Has an RSX been put in the system lxi d,msg3 ; Get message to tell of RSX jnz cont ; Yes, tell operator lhld 6 ; Get the top of memory again xchg ; Put it in DE lxi h,-(800h+100h) ; CCP size plus TPA dad d ; Subtract it, answer left in HL call decout ; Print it lxi d,msg2 ; Print rest of line cont: mvi c,9 ; Print message function call 5 ; Print it pop h ; Restore CCP stack sphl ret ; Back to the CCP ; ; Subroutines ; ; Console output routine ; Prints character in "A" register ; co: push h push d push b mov e,a ; Character to E for CP/M mvi c,2 ; Print console function call 5 ; Print character pop b pop d pop h ret ; ; Decimal output routine ; this routine has following entry and external parameters: ; ; Entry: HL=binary number to print in decimal ; External calls: CO routine ; ; ** Note... This routine is recursive, and uses 6 bytes of stack for ; each recursive call, in addition to any stack space used by the CO ; routine. ; decout: push b push d push h lxi b,-10 lxi d,-1 ; decou2: dad b inx d jc decou2 lxi b,10 dad b xchg mov a,h ora l cnz decout mov a,e adi '0' call co pop h pop d pop b ret ; ; Messages ; msg0: db 'TPA Version ',ver / 10 + '0','.',ver mod 10 + '0',' -- ' db mo/10+'0',mo mod 10+'0','/' db dy/10+'0',dy mod 10+'0','/' db yr/10+'0',yr mod 10+'0',13,10,13,10,'$' msg1: db ' bytes total TPA space.',13,10,'$' msg2: db ' bytes before overlaying the CCP.',13,10,'$' msg3: db 'CCP protected by an RSX.',13,10,'$' ; stack equ $+80 ; 40 level stack ; end