> 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)
|