[comp.sys.apple] DCOM patch

kamath@reed.UUCP (Sean Kamath) (11/15/87)

Hello, everyone.

Well, I just came up with a patch to DCOM.  The problem?  Well, it's not
really a bug.  You see, the vt220 makes no definitions (as far as I know)
about what to do if you get a LF outside of a scrolling region.  The thing
is, the sensible (?) thing to do, and what the Apple ROMs do, is to scroll
the scrolling region.  This is because the code says "Gee, are we beneath
the bottom of the screen?  Then scroll!".  And this is exactly what Jim did
in DCOM.  However, if you do this on a vt200 (or other vt100 terminal, such
as a Rainbow), it just does a LF, unless it's the bottom line, and then it
just sits there.

If you're interested, I can prove it.  e-mail me.

So, in anycase, in an effort to fix this, as it causes real havoc with Emacs
and Jove (for a reliable failure, go into jove.  Hit CR 22 times.  then one
more to make it scroll.  then quit.  It should put the "Do you really. . ."
two lines above the status bar, not directly below this.), and I feel is
probably also the cause of the notorious "arrow key" problem.

Screen editors (i.e. text editors that use the features of the screen, like
jove and emacs (not vi), to make windows and such.) use scrolling regions a
lot, and thus, when you try to go up or down outise the region, it may or
may not work.

This is a preliminary patch.  It is for the file DCOM.SCREEN.IIE *only* and
it only fixes the the LF, not the down arrow key.  I will post the patches
as I get them.  For now, i just want to hand this out and see if it doesn't
*cause* any failures.

It's a 26 byte patch that replaces the 32 bytes Jim wrote (couldn't resist
this, Jim :-) ).  While this leaves 6 bytes to play with, I couldn't come up
with any funky things to try there. :-(

This program should patch it very nicely:

10 ?CHR$(4);"BLOAD DCOM.SCREEN.IIE,A$5000"
20 PL = 5*4096+3*256+2*16+11
30 PH = PL +31
40 REM FROM 53B2 TO 534A
50 FOR X = PL TO PH
60 IF PEEK(X) <> READ A THEN ?"ERROR- - -UNABLE TO FIND PATCH CODE":END
70 NEXT
80 FOR X = PL TO PL+25
90 POKE X,READ A
100 NEXT
110 ?CHR$(4);"UNLOCK DCOM.SCREEN.IIE"
120 ?CHR$(4);"BSAVE DCOM.SCREEN.IIE,A$5000,L$62C"
130 ?CHR$(4);"LOCK DCOM.SCREEN.IIE"
140 REM THE VERIFY CODE
150 DATA 238, 16, 3, 172, 16, 3, 192, 24, 240, 10, 204
160 DATA 19, 3, 176, 3, 76, 28, 82, 240, 251, 32, 152
170 DATA 81, 172, 19, 3, 140, 16, 3, 76, 28, 82
180 PATCH
190 DATA 238, 16, 3, 172, 16, 3, 192, 24, 240, 10, 204
200 DATA 19, 3, 176, 3, 76, 28, 82, 240, 251, 32, 152
210 DATA 81, 172, 19, 3

for those of you who like to hand patch. . .
replace:
532B:EE 10 03 AC 10 03 C0 18 F0 0A CC 13
5337:03 B0 03 4C 1C 52 F0 FB 20 98 51 AC
5343:13 03 8C 10 03 4C 1C 52
with:
532B:AC 10 03 CC 13 03 90 0C D0 06 20 98
5337:51 4C 1C 52 C0 17 F0 03 EE 10 03 4C
5343:1C 52

and finally:
replace:
532B: EE 10 03	INC $0310
532E: AC 10 03	LDY $0310
5331: C0 18	CPY #$18
5333: F0 0A	BEQ $533F
5335: CC 13 03	CPY $0313
5338: B0 03	BCS $533D
533A: 4C 1C 52	JMP $521C
533D: F0 FB	BEQ $533A
533F: 20 98 51	JSR $5198
5342: AC 13 03	LDY $0313
5345: 8C 10 03	STY $0310
5348: 4C 1C 52	JMP $521C

with:

532B: AC 10 03	LDY $0310
532E: CC 13 03	CPY $0313
5331: 90 0C	BCC $533F
5333: D0 06	BNE $533B
5335: 20 98 51	JSR $5198
5338: 4C 1C 52	JMP $521C
533B: C0 17	CPY #$17
533D: F0 03	BEQ $5342
533F: EE 10 03	INC $0310
5342: 4C 1C 52	JMP $521C


I heartedly suggest that you check the program patch to the above, as I
typed in everything by hand, and am subject to error.  Also:

*DO THIS ON A BACKUP COPY* please!

While typeing this in, I have found another bug.  Sometimes, when you
move up of down in jove, you don't move on the screen. I will look into this
further. (It may be jove is not repeating the command fast enough. maybe
not.)

Sean Kamath
-- 
UUCP:  {decvax allegra ucbcad ucbvax hplabs ihnp4}!tektronix!reed!kamath
CSNET: reed!kamath@Tektronix.CSNET  ||  BITNET:  reed!kamath@Berkeley.BITNET
ARPA:  tektronix!reed!kamath@Berkeley <or> reed!kamath@hplabs
US Snail: 3934 SE Boise, Portland, OR  97202 (I hate 4 line .sigs!)