This is the past DOS era of the compilation of source code, although has passed, but for the study of the assembly is still helpful, assembly language is just a basic programmer language, most people can grasp, not necessarily in-depth research.
COMMENT *
Demo (and Semi-useful) program to read/set burnout device parameters.
Usage:burnout [Ticks] [c+-] [v+-] [h+-]
Parameters can be separated by almost anything.
With no parameters, the program simply returns the current status.
Examples:
Burnout 5000 (sets time to 5000 ticks)
Burnout 5000h+ (time=5000, use hardware blanking)
Burnout 5000,h+ (ditto, separators don ' t matter)
Burnout c+h-v+ (continuous clear, software, monitor video)
burnout/c+/h-/v+ (ditto)
Burnout (return status only)
Assembly/link:
MASM burnout;
Link burnout; (Ignore NO STACK warning message)
Exe2bin Burnout Burnout.com
by Cjdunford 20-mar-1985
Compuserve 76703,2002
======================================================================
*
STDOUT equ 1; DOS Output Files
STDERR equ 2
; -----General equates
DOS equ 21H; DOS Interrupt
TERMINATE equ 20H; Exit to DOS
PRINT equ 09H; DOS "Print" string to stdout
FOPEN equ 3d02h; DOS File Open, Read/write
FREAD equ 3FH; DOS file Read
Fwrite equ 40H; DOS File Write
CR equ 13; ASCII Carriage return
LF equ 10; ASCII Line Fine
Code segment
Assume Cs:code,ds:code
ORG 80H; Parm Storage area in PSP
Parmlength label Byte; Length of Parms
ORG 81H
Parameters label Byte; Start of Parms
ORG 100H; Org for. COM
Main proc Far
JMP start; Hate to execute data
Devname db ' Brndev ', 0; Burnout Device Name
Handle DW? ; Storage for handle
Flush db ' @ '; Char to flush device I/O
Execute db ' # '; Char to execute device commands
notinstalled db ' burnout device is not installed ', 13,10
Notinstalledl equ $-notinstalled
Status db ' current status: '; Status message
Statinsert db DUP (?) ; Brndev'll store status here
; -----Open The device
Start
mov Dx,offset devname; DS:DX => Device Name
MOV Ax,fopen
int DOS
Jnc A1; Continue If no error
MOV bx,stderr; Message to STDERR
MOV Cx,notinstalledl
MOV Dx,offset notinstalled
MOV ah,fwrite
int DOS
JMP exit
; -----Flush any pending I/O to/from the device
A1:
MOV handle,ax; Save Device Handle
mov Dx,offset Flush; Point to the "@"
MOV cx,1; Writing one byte
MOV bx,handle; Device handle
MOV ah,fwrite; Write "@" to device
int DOS
; -----Send and Execute parameters if present
MOV cl,parmlength; Parm length to CL
or CL,CL; Any parms present?
JZ A2; Skip if not
XOR Ch,ch; CX = parm Length
mov Dx,offset Parameters; DS:DX => parms
MOV bx,handle; BX = device Handle
MOV ah,fwrite; Write parms to Device
int DOS
mov Dx,offset Execute; Execute the Parms
MOV cx,1; Writing one byte
MOV bx,handle; Device handle
MOV ah,fwrite; Write "#" to Device
int DOS
; -----Get and display device status
A2:
mov Dx,offset Statinsert; Ds:dx => where to put status
MOV cx,0ffh; Ask for lots of data; DOS would ...
; ... fetch only until CR found.
MOV bx,handle; Device handle
MOV ah,fread; Read Device Info
int DOS
MOV cx,ax; CX = actual # bytes Read
mov Di,offset Statinsert; Where The stat data is stored
Add di,cx; Add length of input read
MOV al,cr; Store a cr/lf/' $ ' at end
Cld
Stosb
MOV al,lf
Stosb
mov al, ' $ '
Stosb
mov Dx,offset Status; Write status to StdOut
MOV ah,print
int DOS
Exit
int TERMINATE; Exit to DOS
Main ENDP
Code ends
End Main