Listing of file='DECIN.MAC;02' on disk='vmedia/asm_utility_4-sideA-sector.ccvf'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; SCAN INPUT BUFFER FOR DIGITS ; ; IGNORES SPACES AND COMMAS ; ; VALUES ON ENTRY: ; HL => INPUT BUFFER ; ; RETURNS: ; <C> SET IF DIGIT FOUND ; ; DESTROYS: ; A REG. ; HL INCREMENTED TO POINT TO FIRST NON-SPACE ; EXTRN DIGIT ENTRY SCND SCND: INX H MOV A,M CPI ' ' ;IGNORE SPACES JZ SCND CPI ',' ;IGNORE COMMAS JZ SCND CALL DIGIT ;<C> SET IF DIGIT RET ;.............................................................. ; ; CHECK FOR (AND RETURN) A DIGIT ; ; VALUES ON ENTRY: ; HL => POINTS TO BYTE TO TEST ; ; RETURNS: ; <C> SET IF A DIGIT ; A = DIGIT ; ; DESTROYS: ; A REG. ; ENTRY DIGIT DIGIT: MOV A,M CPI '9'+1 RNC SUI '0' ;RETURN THE DIGIT CMC ;SET <C> PROPERLY RET ;.............................................................. ; ; GET AN UNSIGNED DECIMAL VALUE FROM INPUT BUFFER ; ; VALUES ON ENTRY: ; HL => INPUT BUFFER ; ; RETURNS: ; DECIMAL VALUE (0-255) IN A REGISTER. ; RETURNS A VALUE OF ZERO IF NO VALID DIGITS FOUND. ; ; DESTROYS: ; A REG. ; HL INCREMENTED TO POINT TO FIRST NON-DIGIT ; ENTRY DECIN DECIN: PUSH B MVI B,0 ;SETUP AS ZERO INITIALLY DEC10: CALL DIGIT ;CHECK IF 0-9 JNC DEC20 MOV C,A ;KEEP NEW DIGIT MOV A,B ;GET CURRENT SUM RLC ;MULTIPLY PARTIAL RESULT BY 2 RLC ; *4 ADD B ; *5 RLC ; *10 ADD C ;ADD NEW DIGIT ... MOV B,A ;... AND SAVE RESULT IN B INX H ;POINT TO NEXT DIGIT JMP DEC10 ;REPEAT - EXCESS DIGITS FALL OUT TOP DEC20: MOV A,B POP B RET END