; Code from Insight, GNU GPL v2-or-later. %include "lmacros3.mac" cpu 8086 org 256 start: mov si, 81h loop: lodsb cmp al, 13 je end mov di, biosbeep cmp al, '!' je found mov di, portbeep cmp al, '?' je found mov di, dowait cmp al, '1' je found jmp loop found: call di jmp loop end: mov ax, 4C00h int 21h dowait: mov cx, 18 mov ax, 40h mov es, ax .outer: mov dx, word [es:6Ch] .inner: call idle cmp dx, word [es:6Ch] je .inner loop .outer retn biosbeep: push ax push bx push bp mov ax, 0E07h mov bx, 7 int 10h pop bp pop bx pop ax retn portbeep: push ax push cx in al,61h or al,3 out 61h,al mov al,10110110b out 43h,al mov ax,700 out 42h,al mov al,ah out 42h,al mov cx,0A000h loop $ in al,61h and al,11111100b out 61h,al pop cx pop ax ret ; INP: - ; OUT: - ; CHG: ax ; STT: ds = ss = debugger segment/selector ; ; Idle system, using 2F.1680 or sti \ hlt. idle: ; testopt [options3], opt3_no_idle_2F ; jnz .hlt ; %if _GUARD_86M_INT2F %if 1 push es xor ax, ax mov es, ax ; (only used in 86 Mode) mov ax, [es:2Fh * 4] cmp ax, -1 je @F ; --> (ZR) or ax, [es:2Fh * 4 + 2] @@: pop es jz @FF @@: %endif mov ax, 1680h int 2Fh ; release timeslice in multitasker test al, al jz .return ; done idling --> @@: .hlt: ; testopt [options], nohlt ; jnz .return sti hlt ; else idle by hlt nop .return: retn