i have some what little bit lengthy code but a very small problem in line which is mentioned as "PROBLEM IN THIS LINE" explicitly.why we are adding SI and AX twice(instead of just once).As you will go through the code you will find it very precisely.
DEVSTART LABEL WORD
CONSOLE_DEV: ;Header for device CON
DW AUXDEV,BIOSSEG ;Link to next device
DW 8003H ;Attributes - console input,
;output device
DW STRATEGY ;Srategy entry point
DW CON_INT ;Interrupt entry point
DB "CON " ;Device name
;-------------------------------------------------
CONSOLE_TABLE: DW EXIT ;0 - Init. (Not used)
DW EXIT ;1 - Media check (Not used)
DW EXIT ;2 - Get Bios Parameter Block
;(Not used)
DW CMDERR ;3 - Reserved. (Currently
;returns error)
DW CON_READ ;4 - Character read.
;(Destructive)
DW CON_RDND ;5 - Character read. (Non-
;destructive)
DW EXIT ;6 - Return status. (Not used)
DW CON_FLSH ;7 - Flush Input buffer.
DW CON_WRIT ;8 - Character write.
DW CON_WRIT ;9 - Character write with
;Verify.
DW CON_WRST ;10 - Character write status.
DW EXIT ;11 - Flush output buffer. (Not
;used.)
DW EXIT ;12 - IO Control.
;-----------------------------------------------
PAGE
SUBTTL Strategy and Software Interrupt routines.
;Define offsets for io data packet
IODAT STRUC
CMDLEN DB ? ;LENGTH OF THIS COMMAND
UNIT DB ? ;SUB UNIT SPECIFIER
CMD DB ? ;COMMAND CODE
STATUS DW ? ;STATUS
DB 8 DUP (?)
MEDIA DB ? ;MEDIA DESCRIPTOR
TRANS DD ? ;TRANSFER ADDRESS
COUNT DW ? ;COUNT OF BLOCKS OR
CHARACTERS
START DW ? ;FIRST BLOCK TO TRANSFER
IODAT ENDS
PTRSAV DD 0 ;Strategy pointer save.
;
; Simplistic Strategy routine for non-multi-Tasking system.
;
; Currently just saves I/O packet pointers in PTRSAV for
; later processing by the individual interrupt routines.
;
STRATP PROC FAR
STRATEGY:
MOV WORD PTR CS:[PTRSAV],BX
MOV WORD PTR CS:[PTRSAV+2],ES
RET
STRATP ENDP
;
; Console interrupt routine for processing I/O packets.
;
CONSOLE_INT:
PUSH SI
MOV SI,OFFSET CONSOLE_TABLE
JMP SHORT ENTRY
;-------------------------------------------
;
; Common program for handling the simplistic I/O packet
; processing scheme in MSDOS 2.0
;
ENTRY: PUSH AX ;Save all nessacary
;registers.
PUSH CX
PUSH DX
PUSH DI
PUSH BP
PUSH DS
PUSH ES
PUSH BX
LDS BX,CS:[PTRSAV] ;Retrieve pointer to I/O Packet.
MOV AL,[BX.UNIT] ;AL = Unit code.
MOV AH,[BX.MEDIA] ;AH = Media descriptor.
MOV CX,[BX.COUNT] ;CX = Contains byte/sector
;count.
MOV DX,[BX.START] ;DX = Starting Logical sector.
XCHG DI,AX ;Move Unit & Media into DI
;temporarily.
MOV AL,[BX.CMD] ;Retrieve Command type. (1 =>
;11)
XOR AH,AH ;Clear upper half of AX for
;calculation.
ADD SI,AX ;"PROBLEM IN THIS LINE"
;(Compute entry pointer in dispatch table).
ADD SI,AX ;"PROBLEM IN THIS LINE".
CMP AL,11 ;Verify that not more than 11
;commands.
JA CMDERR ;Ah, well, error out.
XCHG AX,DI ;Move Unit & Media back where
;they belong.
LES DI,[BX.TRANS] ;DI contains addess of Transfer
;address.
;ES contains segment.
PUSH CS
POP DS ;Data segment same as Code
;segment.
JMP [SI] ;Perform I/O packet command.
CODE CONTINUES..............
please help, i am deeply regret if you find it odd. but i am sure that i have added enough information in this post. please see lines mentioned as "PROBLEM IN THIS LINE". Please let me know if you need some more details.