hello,
what are my options for 16-bit debugging in DOS? I'm assembling with
masm, linking with link16.
DEBUG program misinterprets my source, I think. After my first int 21h
(in the paste below), debug trace shows two NOP's then a call to
elsewhere.
I've seen others write about Codeview debugger, but apparently I don't
have it (cv.exe?) and can't find it for download.
Thanks, and here's the program, with a paste-in of the debug trace output
after the first int 21h.
;===============BEGIN DEBUG OUTPUT===========================
; this below appears after 1st int 21h
00A7:107C 90 NOP
-t
AX=716C BX=0000 CX=0000 DX=0001 SP=01FA BP=0000 SI=000A DI=0000
DS=0B55 ES=0B3E SS=0C90 CS=00A7 IP=107D NV UP DI PL NZ NA PO NC
00A7:107D 90 NOP
-t
AX=716C BX=0000 CX=0000 DX=0001 SP=01FA BP=0000 SI=000A DI=0000
DS=0B55 ES=0B3E SS=0C90 CS=00A7 IP=107E NV UP DI PL NZ NA PO NC
00A7:107E E8E000 CALL 1161
-t
AX=716C BX=0000 CX=0000 DX=0001 SP=01F8 BP=0000 SI=000A DI=0000
DS=0B55 ES=0B3E SS=0C90 CS=00A7 IP=1161 NV UP DI PL NZ NA PO NC
00A7:1161 1E PUSH DS
-t
;===============END DEBUG OUTPUT========================
;==============BEGIN PROGRAM, (Kip Irvine 13.3.6)=================
TITLE Read a text file (main.asm)
...model small
...stack 200h
...386
...data
BufSize = 5000
infile BYTE "infile.txt",0
outfile BYTE "outfile.txt",0
inHandle WORD ?
outHandle WORD ?
buffer BYTE BufSize DUP(?)
bytesRead WORD ?
...code
main PROC
mov ax, @[EMAIL PROTECTED]
ds, ax
;open the input file
mov ax, 716Ch
mov bx, 0 ;mode = read only
mov cx, 0 ;normal attribs
mov dx, 1 ;action open
mov si, offset infile
int 21h
jc Quit
mov inHandle, ax
;read the input file
mov ah, 3fh ;fn for reading
mov bx, ax ;prev handle returned in ax,
mov to bx for read
mov cx, BufSize ; bytes to read
mov dx, offset buffer ;variable that rcvs read-in
int 21h
jc Quit
mov bytesRead, ax ;bytes read from ax
; display the buffer
mov ah, 40h ;fn = write file or
device
mov bx, 1 ;console output
mov cx, bytesRead ; number of bytes
mov dx, offset buffer ;pointer
int 21h
jc Quit ; quit if error
;Close the file
mov ah, 3Eh ;fn close file
mov bx, inHandle ;input handle
int 21h
jc Quit
;Create the output file
mov ax, 716Ch ;extended create or open
mov bx, 1 ;mode = write-only
mov cx, 0 ;normal attrib
mov dx, 12h ;action:
create/truncate (10h + 2h)
mov si, offset outfile ;pointer to name
int 21h
jc Quit
mov outHandle, ax ;save handle
;Write buffer to new file ;same as to console, but to file
mov ah, 40h ;fn write file or
device
mov bx, outHandle ;handle to output file
mov cx, bytesRead ;number of bytes
mov dx, offset buffer ;pointer to buffer for writing out
int 21h
jc Quit
;Close the file
mov ah, 3Eh ;fn close file
mov bx, outHandle ;handle
int 21h
S
;terminate sequence
Quit:
mov ah, 4ch
int 21h
main EndP
END main
;===================END (KIP IRVINE PROGRAM, 13.3.6)==============
--
Thanks,
Pop Tart


|