Old School

These are basic programs for MS-DOS. You also can use it on FreeDOS.

REPLY.COM

Get a keyboard input, and return the key number in errorlevel.

If the key is extended the second code is returned.

REPLY.COM
size: 14 bytes
sha1: 8bdb142958c36dcbbd3a9a9c0d35a2853a5f9d1b

Download REPLY.COM

REPLY.ASM (for fasm):

ORG 100H
;ORIGINALLY FROM: VAN WOLVERTON
;CHANGED MOV AH,08H TO MOV AH,07H FOR NOT CHECK CTRL+C

MOV AH,07H ;GET CHARACTER INPUT WITHOUT ECHO AND WITHOUT CHECK CTRL+C
GETKEY:
INT 21H ;PERFORM MS-DOS SERVICE
CMP AL,0H ;COMPARE AL WITH ZERO
JNZ BYE ;IF LEAD ZERO, GET SECOND CODE OF CHARACTER
INT 21H ;PERFORM MS-DOS SERVICE
BYE:
MOV AH,4CH ;TERMINATE PROCESS RETURNING THE AL CODE
INT 21H ;PERFORM MS-DOS SERVICE


MICE.COM

Get a click of mouse from the primary button, and print the row and the column. The index begin in 1.

MICE.COM
size: 130 bytes
sha1: 47a74b9b4d300d826f04d1c7c7a2e1c495d048e5

Download MICE.COM

MICE.ASM (for fasm):

ORG 100H

;MICE.COM
;PRINT THE ROW COLUMN OF PRIMARY MOUSE BUTTON CLICK
;THE INDEX BEGIN IN 1
;TESTED OK ON FREEDOS, WINDOWS XP X86, WINDOWS 7 X86
;THE OUTPUT CAN BE REDIRECTED TO FILE, THEN RUN IT
;AND HAVE THE INFO IN THE ENVIRONMENT VARIABLE CLICK
;ONLY ALLOW PRIMARY MOUSE BUTTON CLICK
;PROGRAMMED BY CARLOS MONTIERS AGUILERA

MOV AX,0001H
INT 33H ;SHOW MOUSE CURSOR

MOV AX,0005H
XOR BX,BX ;LEFT BUTTON
INT 33H ;RESET COUNT OF BUTTON PRESSED

GET_CLICK:
MOV AX,0005H
XOR BX,BX ;LEFT BUTTON
INT 33H ;RETURN MOUSE BUTTON PRESS INFO
CMP AX,0001H ;PRESSED DOWN
JNE GET_CLICK ;IF NO TRY AGAIN
CMP BX,0H ;IF BUTTON PRESSED 0 TIMES SINCE LAST CALL THE INFO IS NOT REALIABLE
JE GET_CLICK ;TRY AGAIN

;ADJUST THE DATA
SHR DX,0003H ;DX=DX>>3 ROW
SHR CX,0003H ;CX=CX>>3 COLUMN
INC DX ;1 INDEX BASE
INC CX ;1 INDEX BASE

;PRINT TEXT SET CLICK=
PUSH DX
MOV AH,9H
MOV DX,SET_CLICK
INT 21H
POP DX

MOV AX,DX ;DX ROW
CALL PRINTAX

;PRINT SPACE
MOV AH,06H ;DIRECT CONSOLE OUTPUT
MOV DL,20H
INT 21H

MOV AX,CX ;CX COLUMN
CALL PRINTAX

;PRINT NL
MOV AH,06H ;DIRECT CONSOLE OUTPUT
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AX,4C00H
INT 21H ;TERMINATE PROCESS RETURNING 0

;;PRINT THE CONTENT OF AX IN DECIMAL NOTATION
;PROGRAMMED BY CARLOS MONTIERS AGUILERA
PRINTAX:
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV BX,0AH ;WILL DIVIDE BY 10
XOR CL,CL ;CL = 0 COUNTER OF CHARACTERS
STORE_CHARACTER:
XOR DX,DX ;DX = 0
DIV BX ;DIVIDE DX:AX BY BX
;AX = QUOTIENT
;DX = REMAINDER
ADD DL,30H ;SUM '0'
PUSH DX ;STORE THE DL CHARACTER IN THE STACK
INC CL ;INC COUNTER OF CHARACTERS
CMP AX,0H
JNZ STORE_CHARACTER
MOV AH,06H ;DIRECT CONSOLE OUTPUT
PRINT_CHARACTER:
POP DX ;GET CHARACTER
INT 21H
DEC CL
CMP CL,0H
JNZ PRINT_CHARACTER
POP DX
POP CX
POP BX
POP AX
RET

SET_CLICK DB 'SET CLICK= ' , 24H


WRICHR.COM

Print to screen one ansi byte. You can redirect it for save it.

Example: wrichr.com 9 > 9.chr

WRICHR.COM
size: 53 bytes
sha1: a1e80a967f65c9eefb65754d72cf8b054d0a8554

Download WRICHR.COM

WRICHR.ASM (for fasm):

;WRICHR.ASM
;PRINT TO SCREEN ONE BYTE
;ARGUMENTS: <INT>0-255
;AUTHOR: CARLOS MONTIERS AGUILERA
;DATE: FEB-2014

ORG 100H

;SET IN CL THE LENGTH OF COMMAND LINE
MOV BX,80H
MOV CX,[BX]

;ASSIGN 10 TO BYTE SOURCE FOR MULTIPLICATION
MOV CH,10
;SET CHAR TO 0
MOV AL,0

;SET BX TO 81 FOR NEXT INC LEFT BX = 82H
;POINTING TO FIRST CHARACTER OF COMMAND LINE
INC BX

GET_CHAR:
;IF NONE CHAR AVAILABLE GO TO PRINT
CMP CL, 0
JE PRINT

;GET LETTER
INC BX
MOV DX, [BX]

;IF IS NOT DIGIT CONTINUE LIKE C KEYWORD
CMP DL, '0'
JL CONTINUE
CMP DL, '9'
JG CONTINUE

;CONVERT CHAR TO DIGIT
SUB DL, '0'
;MULTIPLY BY 10
MUL CH
;SUM DIGIT
ADD AL, DL

CONTINUE:
DEC CL
JMP GET_CHAR

PRINT:

MOV DL,AL
;DIRECT CONSOLE OUTPUT
MOV AH, 06H

CMP DL,255
JNE COMMIT
;IF CHARACTER IS 255 USE OTHER INTERRUPT
;WRITE CHARACTER TO STANDARD OUTPUT
MOV AH, 02H

COMMIT:
INT 21H
RET