pcarah.es@PARC-MAXC.ARPA (01/02/84)
The DOS does indeed check (two places) for long writes. The DOS will partition a write into segment sized chunks if too much is requested, and the driver (in IBMBIO.COM, not the ROM) handles 64K boundaries separately. Also, I have never had a problem with FORMAT or DISKCOPY regardless of other programs resident. The way that the driver handles 64K boundaries is a bit strange and may be possible to fool at the top of memory, and that check is indeed up to the programmer. Note that both FORMAT and DISKCOPY do their I/O directly with INT 13 rather than through the DOS (at least the I/O not writing files or volume names). Thus my comment is not entirely relevant to your problem. I would assume that no-one at IBM (not Microsoft for that part of FORMAT) thought of checking for a 64K boundary in the format or FAT buffer. Why that would cause a parity check 2 is beyond me, however, at least for FORMAT. Pete [The parity check 2 comes from MINCE and CodeSmith debugger (when loading programs). It is not clear to me either that the two problems are related, but I can always make the parity check go away if I change the size of resident operating system code -ed] eters, and does not inter- cept keyboard entries. I have been using it with ScrnSave, DVED, Mince, Blue, Prof. Editor, ASM, LOGO, APL, Kermit, and many others. It seems compatible with all. To change color assignments for the 80 wide text mode only, run: ScrnColr nn rr where nn are attributes to replace normal white on black and rr replace reverse video black on white. (nn and rr are standard HEX video codes) Examples: ScrnColr 06 60 for brown (amber) colors ScrnColr 17 71 for white on blue & opposite ScrnColr 1e 5c for yellow on blue and lt. cyan on red Acknowledgements are, of course, due to the authors and maintainers of SCREEN.ASM, from whence this program is derived. Bat-Ques -------- To ask a question: Bat-Ques tttttt$ where ttttttt is the text of the question User then keys a single character response. To check answer, use IF [not] errorlevel cc, where cc is the character code value of the response. Only single character responses are supported. This program allows one to build decently friendly batch files. One no longer has only the ctrl-break response to a pause (which isn't very friendly). Examples: This program allows a batch file to ask the user a question and return a one-character response which is testable by the IF subcommand of bat files, via the errorlevel. You use the question asker per following example: . . (your batch file to ask if user wants to edit with . mince/emacs or ibm's editor) . echo off bat-ques WHICH EDITOR, m OR e FOR MINCE (EMACS), i FOR IBM's? $ if errorlevel 110 goto badresp if errorlevel 109 goto minceed if errorlevel 106 goto badresp if errorlevel 105 goto ibmed if errorlevel 102 goto badresp if errorlevel 101 goto minceed :badresp echo Your response was invalid. Sorry. goto endit :minceed if not exist mincomm.sum copy \bin\mince.swp mince.swp mince %1 if not exist mincomm.sum del mince.swp goto endit :ibmed profed %1 :endit echo on Note that the question prompt follows the bat-ques command and must end with a dollar sign. The ascii value of the response is returned as the error level. Since error level tests are always greater than or equal tests, you must check for highest value first and lowest value last. Example above shows what you do to check for missing values. Note that the example assumes lower case answers only for simplicity sake. Ascii values (e.g., A is 65, B is 66, a is 97) are found in back of your BASIC manual. Only one character responses are accepted, and they are not followed by a carriage return. Extended ascii codes (function and alt keys) should work as per page G-6 of your BASIC manual; the first call to bat-ques will return a zero and the next call (presumably "bat-ques $" without another prompt) will return the number shown on page G-7. Friendly and colorful Hints --------------------------- To make your screen even more friendly, especially since some programs may leave you hanging in different directories from whence you started, change your prompt to give you the directory instead of just the default drive (but do remember that if you have no disk in the defaulted drive you will get the drive not ready message when Prompt tries to show the directory). prompt $p$g --- best inserted into your autoexec.bat To make your screen more colorful, (borrowing from IBM's use with TSO, where prompts are different colors from responses), install the ANSI screen handler, and change your prompt string to: prompt $e[0;31m$p$g$e[0m -- red prompt string Don't forget to end your .bat files which call programs which use the screen directly with the cls command. Cls forces screen attributes to become the defaulted color. Otherwise you have strange cluttered colors left on the screen. To make KERMIT easier to handle, change the "curatt" definition from black and white (I use 02, green) and reassemble. I don't suggest a background color with kermit because EMACS will leave black holes in your screen. With curatt redefined, when "connected" you get that color, and when talking to kermit-86 you get the ScrnColr settings. For a enjoyable and prosperous '84, Herm Fischer (HFischer@usc-eclb) attached: 2 programs for library page 64,132 title scrncolr - Change display screen from white to color attrib .radix 10 ;*************************************************************** ; Adapted from "SCREEN.ASM" by H. Fischer - HFischer@eclb 12/83 ; SCREEN was Typed in by Glass - gjg@cmu-cs-cad from Byte Nov. 1983 ; ; NOTE: only meaningful with color card, and does not look at ; keyboard (which makes it easywriter, etc. compatible) ; ; To build this program: ; 1> masm scrncolr; /* assemble the code */ ; 2> link scrncolr; /* link it - will get no stack seg. message */ ; 3> exe2bin scrncolr.exe scrncolr.com /* make executable */ ; 4> del scrncolr.exe /* don't need this anymore */ ; ; To use program: run it or place in autoexec.bat as follows: ; ; scrncolr nn rr ; ; where nn are screen attributes to replace ; normal white (attr=07h) video, and rr are ; attributes for reversed white (attr=70h) ; (intensity and blink are preserved). ; ; for example, to change calls for white to white on blue ; and to change calls for reverse white to magenta on white, ; issue the call: "scrncolr 17 75" ; ; Only 80x25 screen calls are affected and only in text mode, ; (this makes it LOGO and APL compatible) ; ; COMMANDS: ; none -- you reassemble to change the color assignment ;*************************************************************** ; ; Define interrupt vectors for ; screen interrupt 10H, in segment 0. ; ;*************************************************************** scrvect segment at 0 ; define screen interrupt vector org 10h*4 SCRINT label dword scrvect ends ;*************************************************************** ; ; define constants ; ;*************************************************************** bw_val equ 07h ; standard b&w attibute sent to monitor ;*************************************************************** ; ; start code area ; ;*************************************************************** code segment para assume cs:code org 82h ; parameters PARM label word ; normal & rev attribs "nn rr" org 100h ; start code offset 100h from starting segment ; (this leaves room for DOS's work areas) KEY proc far START: ; Initialization code...used only once, on system startup jmp init_code ; call initialization routine even validchk db 'FCP!' ; used by INSTALL to check for valid SCREEN ; program ;*************************************************************** ; ; SCR_RTNE - Replaces SCREEN interrupt so that it can intercept ; B&W character writes and change attributes ; ;*************************************************************** SCR_RTNE: assume ds:code sti push ds ; get cs into ds the funny way push cs pop ds cmp ah,0 ; Spot mode change call jne NOT_MODE mov savemod,al ; Save mode input NOT_MODE: cmp ah,6 ; Spot SCROLL UP and SCROLL DOWN calls jl NORMAL_SCR ; push ax ; check if in 80x25 modes mov al,savemod cmp al,2 pop ax jl NORMAL_SCR ; no-ignore attribs (keep LOGO straight) push ax ; check if in 80x25 modes mov al,savemod cmp al,3 pop ax jg NORMAL_SCR ; no-ignore attribs (keep LOGO straight) cmp ah,6 jg NOT_SCROLL ; SCROLL: call GET_CH ; for scrolling, update attribute jmp NORMAL_SCR ; now, execute scroll NOT_SCROLL: cmp ah,9 ; check for "WRITE ATTRIBUTE/CHAR" cmd jne NORMAL_SCR ; send out any other command as normal xchg bh,bl ; get attribute for command call GET_CH ; update attribute for command xchg bh,bl ; move attribute back to bh for cmd NORMAL_SCR: pop ds ; restore ds reg ; ; NOTE: We are now ready to invoke the BIOS screen interrupt. ; Since the ROM code includes an IRET interrupt return call, ; all we need to do is to jump to the start of the ROM code ; and all will be well. Since the initialization code set ; up the address to the screen interrupt code below, we can ; set up a forced jump to that address. JMP_SCR: ; Address to SCREEN interrupt db 0EAh ; force a FAR JMP but do not set up dest- dw 0,0 ; ination address at assembly time. ; (INIT routine will set this address) savemod db 3 ; default to 80x24 color mode KEY endp ;done with main routine ;*************************************************************** ; ; GET_CH - subroutine replaces B&W character with current replacement ; attributes and allows for intensity bit setting ; ; Inputs : bh contains attribute to be modified ; ;*************************************************************** GET_CH proc near mov savech,bh ; save character and bh,77h ; Remove intensity and blink bits cmp bh,07h ; see if currently defined B&W value jne ISITREV ; exit if not mov bh,savech ; otherwise, modify to current attribute and bh,88h ; get rid of B&W part or bh,normvid ; move in current attribute part jmp OUT ISITREV: cmp bh,70h ; see if currently defined W&B value mov bh,savech ; otherwise, modify to current attribute jne OUT and bh,88h or bh,revrvid OUT: ret ; done savech db 0 ; temporary character store normvid db 05h ; replacement for white norml video revrvid db 50h ; replacement for reverse white video GET_CH endp LASTONE: ; all code after this label is freed to DOS use after ; initialization of the program. ;*************************************************************** ; ; INIT_CODE - Code to load and initialize the SCREEN program.. ; sets up DOS to keep all code before "LASTONE" label ; safe from overlaying during system operation. ; ;*************************************************************** INIT_CODE proc near ; initialize SCREEN intercept code assume es:scrvect ;'vectors' is interrupt segment 0 mov ax,scrvect ; get address to interrupt vector mov es,ax ; save in es mov ax,es:scrint ; get address to interrupt mov bx,offset jmp_scr+1 ; address to place to save vector mov [bx],ax ; save interrupt address mov ax,es:scrint[2] ; get interrupt segment for rtne mov [bx+2],ax ; save it too mov es:scrint,offset scr_rtne ; now replace with own address mov ax,cs ; save segment in interrupt vector mov es:scrint[2],ax ; mov ax,cs ; make parameters for color mov ds,ax ; addressable mov dx,PARM test dx,0040h ; fix hex a-f jz IT2 sub dx,0007h IT2: test dx,4000h jz IT3 sub dx,0700h IT3: and dx,0f0fh ; strip and jamb nibbles mov cl,4 shl dl,cl or dh,dl mov normvid,dh ; save parameter mov dx,PARM+3 test dx,0040h ; fix hex a-f jz IT4 sub dx,0007h IT4: test dx,4000h jz IT5 sub dx,0700h IT5: and dx,0f0fh mov cl,4 shl dl,cl or dh,dl mov revrvid,dh mov dx,offset lastone ; save all code up to "LASTONE" label int 27h ; no return needed INIT_CODE endp code ends end start ******************************************************************** ******************************************************************** ******************************************************************** ******************************************************************** ******************************************************************** ******************************************************************** ******************************************************************** ******************************************************************** page 64,132 title bat-ques -- Batch file Question Asker, sets errorlevel .RADIX 10 ; ; ; ;***************************************************************** ; INFO-IBMPC libarary contribution by H. Fischer - HFischer@eclb 12/83 ; If you like it, do not send me $10 (but I will accept amounts ; with many more zeros if your generosity is excessive). ; Questions/problems to HFischer@eclb (213/902-5139). ; ; This program allows a batch file to ask the user a question ; and return a one-character response which is testable ; by the IF subcommand of bat files, via the errorlevel. ; ; You use the question asker per following example: ; ; . ; . (your batch file to ask if guy wants to edit with ; . mince/emacs or ibm's editor) ; . ; echo off ; bat-ques WHICH EDITOR, m OR e FOR MINCE (EMACS), i FOR IBM's? $ ; if errorlevel 110 goto badresp ; if errorlevel 109 goto minceed ; if errorlevel 106 goto badresp ; if errorlevel 105 goto ibmed ; if errorlevel 102 goto badresp ; if errorlevel 101 goto minceed ; :badresp ; echo Your response was invalid. Sorry ; goto endit ; :minceed ; if not exist mincomm.sum copy \bin\mince.swp mince.swp ; mince %1 ; if not exist mincomm.sum del mince.swp ; goto endit ; :ibmed ; profed %1 ; :endit ; echo on ; ; Note that the question prompt follows the bat-ques command and ; must end with a dollar sign. The ascii value of the response is ; returned as the error level. Since error level tests are always ; greater than or equal tests, you must check for highest value first ; and lowest value last. Example above shows what you doto check for ; missing values. Note example assumes lower case answer only for ; simplicity sake. ; ; Ascii values (e.g., A is 65, B is 66, a is 97) are found in back ; of your BASIC manual. Only one character responses are accepted, ; and they are not followed by a carriage return. ; ; Extended ascii codes (function and alt keys) should work as per ; page G-6 of your BASIC manual; the first call to bat-ques will ; return a zero and the next call (presumably "bat-ques $" without ; another prompt) will return the number shown on page G-7. ; ; To build this program: ; 1) asm bat-ques ; 2) link bat-ques ; 3) exe2bin bat-ques.exe \bin\bat-ques.com (name your path dir!) ; 4) del bat-ques.exe ; ; have fun ;******************************************************************** code segment para assume cs:code org 82h PROMPT label byte ; here DOS places the prompt string org 100h KEY proc far START: mov ax,cs ; make this mess addressable via ds mov ds,ax assume ds:code mov dx,offset PROMPT mov ah,9 int 21h ; display the prompt mov ah,1 int 21h ; get the input into AL mov saveit,al mov dx,offset newlin ; move display to new line mov ah,9 int 21h mov al,saveit mov ah,4ch ; return the errorlevel already in AL int 21h newlin: db 10,13,'$' ; give user a new line before quitting saveit db 0 KEY endp code ends end start -------
GILLMANN%USC-ISIB@sri-unix.UUCP (01/03/84)
From: Dick Gillmann <GILLMANN@USC-ISIB> Here's a concrete example of how FORMAT is position dependent: (1) Assemble, link and exe2bin the following programm which I call SPACE.ASM. The program when exeuted simply installs itself and takes up 39K bytes of memory, thereby changing the load point for programs. CSEG SEGMENT ASSUME CS:CSEG ORG 100H START PROC FAR JMP INIT START ENDP K EQU 1024 WASTE DB 39*K DUP(0) INIT PROC NEAR MOV DX,OFFSET INIT INT 27H ; EXIT BUT STAY RESIDENT INIT ENDP CSEG ENDS END START (2) Change your AUTOEXEC.BAT and CONFIG.SYS files to remove any installed device drivers or installations of programs which stay resident (examples: ANSI.SYS or PROKEY). (3) Boot DOS 2.0. This should give you a pure copy of DOS. (4) Run SPACE.COM, thereby changing the program load point. (5) Now put a diskette in drive A: and give the command FORMAT A:. You will get a "Track 0 bad - disk unusable" error, no matter which diskette you use. I ran this test on an XT, but it should work on a PC as well. Using a different version of DOS would change it. Try varying the amount of space wasted; FORMAT does all kinds of things. I understand that this problem also affects DISKCOPY. Dick Gillmann -------
BRACKENRIDGE%USC-ISIB@sri-unix.UUCP (01/04/84)
From: Billy <BRACKENRIDGE@USC-ISIB> In an earlier message it was pointed out that the FORMAT command appears to be position sensitive, i.e. it does different things when loaded at different places in memory. I believe I am having similar problems with DISKCOPY. I am running DOS 2.0 and have about 30K of resident code on top of the normal operating system. I have also been getting PARITY CHECK 2 errors when doing disk I/O in Mince and CodeSmith. This behavior can be modified by changing the size of the resident operating system. Has anyone experienced similar difficulties with FORMAT, DISKCOPY, or parity errors that appear to be position sensitive? I believe the problems stem from programs attempting to do DMA over 64K memory segment boundaries. DOS disk I/O calls take segment register, offset, and transfer length as arguments. The manual warns clearly that a transfer should not be of such a length that it will exceed the segment boundary. Apparently there is no run time checking in DOS as the responsibility for checking this condition is left with the programmer. I have not dis-assembled any of these programs to find out how they do disk I/O, and whether they check for this condition. I don't really want to rewrite Microsoft's operating system. It is easier for me to just juggle the size of the operating system until a given program appears to work. If my theory is correct there must be other people who have experienced similar problems and patches must be floating around to fix the problem.