TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: SCOTT MCNAY
from: JAMES VAHN
date: 1997-11-06 18:55:00
subject: Re: jmp $+2

> The only variation that I'd like to see is "jmp $+2", which has a
> specific use and purpose, and anyone who does low-level hardware
> programming knows exactly what that specific instruction is for.
jmp $+2 does indeed have a specific purpose. It is an I/O delay
typically used for CMOS writes. The nomenclature is a keystroke
saver and not intended for actual addressing.
; cmos.asm  
; dump CMOS contents to a file.
;
;
cseg segment
assume cs:cseg,ds:cseg
org 100h                       ; .COM format
Num_Bytes equ 50h              ; Do 80 bytes, XCMOS too.
Begin:
        mov cx,Num_bytes       ;Number of Bytes
lo1:
        mov ax,0h
        mov ds,ax
        mov al,Num_Bytes
        sub al,cl
        cli
        out 70h,al      ; set index
        jmp $+2         ; let things settle 
        in al,71h       ; read byte
        jmp $+2         ; better to replace 'jmp $+2' with 'OUT 4Fh,AL'
        mov dl,al
        sti
        mov ax,Num_Bytes
        sub ax,cx
        mov bx,ax
        push cs
        pop ds
        mov byte ptr Cmos_Dat+[bx],dl     ; Store data in Cmos_Dat
        loop lo1
        push cs
        pop ds
        mov dx,offset Msg1
        mov cx,0
        mov ah,3Ch                   ; Create a file
        int 21h
        jc error
        mov bx,ax       ; move handle to bx
        mov cx,Num_Bytes
        mov dx,offset Cmos_Dat
        mov ah,40h
        int 21h
        mov ax,4C00h
        int 21h
Error:
        mov dx,offset Msg2
        mov ah,09h
        int 21h
        mov ax,4C01h
        int 21h
msg1            db      'CMOS.DAT',0
msg2            db      'File error$'
Cmos_Dat        db      80 dup (?)
cseg ends
end Begin
--- ifmail-tx (i386 Linux)
---------------
* Origin: jvahn@short.circuit.com (1:346/15.1@fidonet)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.