; TITLE "SMFN3 - Syslib 4.0" NAME ('MFN3') ;================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from SMFN3.Z80 by Richard Conn ; Date : 17 Sep 89 ; Version : 1.2 ; Module : SMFN3 ; Abstract: This module contains the routine MFN3 which prints ; an FCB-type fixed-field filename and type in compressed ; mode in a 12-character field, left justified, to a Memory ; buffer. If the name is less than eight characters, and/ ; or the type is less than 3 characters, spaces are added ; to the end of the printed field to fill the field. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC MFN3 .Z80 CSEG ;=============================================================== ; NAME - MFN3 ; Entry: DE - Points to an FCB filename ; HL - Points to 12-character memory buffer ; Exit : - No value returned, the file name is copied to Memory ; Uses : - None ; Special Requirements: None ;=============================================================== MFN3: PUSH BC ; Save the BC register PUSH HL ; save regs PUSH DE PUSH AF LD C,11 ; 11 chars total LD B,8 ; 8 chars first CALL PRFNX LD (HL),'.' ; dot in memory buffer INC HL LD B,3 ; 3 more chars CALL PRFNX LD A,C ; get count of spaces OR A ; 0=none CALL NZ,SPACER POP AF ; restore regs POP DE POP HL POP BC RET PRFNX: LD A,(DE) ; get char AND 7FH ; mask out msb CP ' ' ; skip space JR Z,PRFNX0 ; ..don't write if space LD (HL),A ; Store in memory INC HL ; ..advance in buffer DEC C ; ..and count chars PRFNX0: INC DE ; pt to next DJNZ PRFNX ; count down RET SPACER: LD (HL),' ' ; space over INC HL ; Bump memory pointer DEC C ; ..count down JR NZ,SPACER RET END