***************************************************************** * * * Routine to make the terminal beep. By Ronald E. Jacobs * * August 10, 1985. * * * ***************************************************************** ;USER SETTABLE OPTIONS: delay equ 1390 ;ADJUST THIS FIGURE FOR CORRECT TIMING ;998 for Decision 1 at 4 Mhz. ;1390 approximately for Decision 1 at 8 Mhz. ;BEGIN PROGRAM: org 100h bdos equ 05h jmp prntime ring: mvi c,2 ;bdos console output mvi e,07 ;^G (bel) call bdos mvi e,8 ;multipler for lots more delay eons: lxi b,delay ;delay between beeps period: PUSH D PUSH B MVI E,0FFh ;TELL BDOS THIS IS CHARACTER INPUT MVI C,06 ;BDOS DIRECT CHARACTER I/O FUNCTION CALL BDOS ANA A ;IF ZERO RETURNED, NO CHARACTER READY JNZ 0 ;WARM BOOT IF ANY CHARACTER TYPED POP B POP D dcr c ;decrement delay count jnz period dcr b ;tesô tï seå iæ delaù haó reacheä end jnz period ;if not zero continue delay dcr e jnz eons ;do the period loop again lda second ;count of seconds inr a ;add a second daa ;convert to binary coded decimal cpi 60h ;one minute yet? cmc jnz savesec xra a ;reset count of seconds to 0 stc savesec:sta second mins: lda minute ;count of minutes aci 0 daa cpi 60h ;one hour yet? cmc jnz savemin xra a ;reset count of minutes to 0 stc savemin:sta minute lda hour ;count of hours aci 0 daa ;count up to 99 hours sta hour prntime:mvi a,08 ;number of times to backspace bs: push a mvi a,08 ;^H (ascii backspace) call printit ;do a backspace on the terminal pop a dcr a ;decrease count of number of times to backspace jnz bs ;do another backspace if 8 not done yet lda hour ;number of hours call hidigit lda hour call lodigit call colon lda minute call hidigit lda minute call lodigit call colon lda second call hidigit lda second call lodigit jmp ring ;go ring the terminal bell hidigit:ani 0F0h ;save only the high digit rrc ;move the high digit into the lower four bits rrc rrc rrc adi 30h ;turn count into an ascii character call printit ;print the digit on the console ret lodigit:ani 0Fh ;save only the low digit adi 30h ;turn count into an ascii character call printit ;print the digit on the console ret colon: mvi a,3Ah ;ascii colon call printit ret printit:mov e,a ;print the character in the accumulator mvi c,06 ;bdos direct console i/o call bdos ret second: db 0 ;count of seconds minute: db 0 ;count of minutes hour: db 0 ;count of hours end