* ORG 100H XEQ $ * * * DATE:S Allows user to enter the date on Bootup * * copy nptdefs * CHCR EQU 0DH A carriage return CHSLSH EQU '/' A slash CHDEL EQU 7FH * START LXI B,MES1 CALL PRINT * LXI H,BUFFER Point to the buffer * * * Get the input * * LOOP CALL IN ANI 7FH CPI CHCR JZ ANALYZE CPI CHDEL JZ DELETE * MOV B,A If the buffer is full, wait for delete or CR MOV A,M ORA A JZ LOOP MOV A,B * CPI CHSLSH A slash is okay JZ OK CPI 30H Nothing else is allowed except numbers JC LOOP CPI 3AH JNC LOOP * OK MOV M,A INX H CALL OUT JMP LOOP * * * Analyze the date, and if none was entered, use the old date * * ANALYZE MVI M,0 If nothing is in the buffer, then use old date * LHLD SYSGLO LXI D,GLDAT DAD D XCHG * LXI H,BUFFER MOV A,M ORA A JZ OLDATE CPI CHSLSH JZ OLDATE * ANA0 MVI B,0 MOV A,M ORA A JZ EXIT * ANA1 ANI 0FH ORA B MOV B,A INX H MOV A,M CPI CHSLSH MOV A,B JZ ANA2 MOV A,M INX H * ANI 0FH PUSH PSW MOV A,B RRC RRC RRC RRC ANI 0F0H MOV B,A POP PSW ORA B * ANA2 STAX D INX D MOV A,M CPI CHSLSH INX H JZ ANA0 JMP EXIT * * * Use the old date * * OLDATE MOV A,L If a date was entered, then exit now CPI >BUFFER JNZ EXIT * LXI B,MES2 Otherwise, tell the date that will be used CALL PRINT * LDAX D Output the month CALL PRHEX MVI A,CHSLSH Output a "/" CALL OUT INX D LDAX D Output the day CALL PRHEX MVI A,CHSLSH Now a "/" CALL OUT INX D LDAX D And finally, output the year CALL PRHEX * * * The exit routine * * EXIT CALL SYS DB 0DH * * * Delete a character in the buffer * * DELETE DCX H MOV A,M ORA A INX H JZ LOOP * DCX H MVI A,CHDEL-20H CALL OUT JMP LOOP * * * Print a hex value * * PRHEX MOV B,A Print the ASCII version of the value in A RLC RLC RLC RLC CALL PRHX1 * MOV A,B * PRHX1 ANI 0FH ADI 30H JMP OUT * * * Print the message * * PRINT LDAX B Move character into A ORA A If it is a zero, we are done RZ . Return if done CALL OUT Put character to screen INX B Point to next character JMP PRINT Go and print it * * * Input and output routines * * IN PUSH B PUSH D PUSH H CALL CONIN POP H POP D POP B RET * OUT PUSH B PUSH D PUSH H CALL CONOUT POP H POP D POP B RET . * MES1 ASCZ "Enter today's date (MM/DD/YY): " MES2 DB CHCR ASCZ "The system date will be used: " * DB 0 A small buffer for the date BUFFER ASC "00/00/00" DB 0 * END