From c743ace42b72a657e3993cf249059b7b49a5b447 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Mon, 30 Dec 2019 22:34:35 -0800 Subject: [PATCH] Trying to track down file write corruption --- images/apple/PLASMA2.2mg | Bin 819264 -> 819264 bytes src/toolsrc/ed.pla | 47 +++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/images/apple/PLASMA2.2mg b/images/apple/PLASMA2.2mg index 76e8995d1eb8e838098848dc1b6fffabe8a8705c..c996d54cc7f0d7e0dd8cb5058e403558159a0ace 100644 GIT binary patch delta 863 zcmZ|NUr19?90%~!ApO2!dX$zIRUOr3+uq=XcNHoOACvsd#HD z-Z~eN+4l!))1!CNaxyKmXATxfjBH^yn|7Qz-4hK(q6fog+X;_#iWre(lJ?N2T1!dW zR(8Cxsh_0b7P`P0^>STX&P5jUWusKqDj`7EIx>Z<@h&m^+IHANbZLIP`kW<|7M8!V zZ+m@}jp>MfC$P%EMrE$TP2QVdn+~!GWyXwzSP&~>L+rE4j3eIkNHVw3&n@)A|KBYn zv4vaA)l8|u1M$x8Yl$xlwq9mUC|%A!7BBbXN31iRP*S$1v4@gf+?Pn5lt@fSK5ql#>`>NOJ)-@@M9KpiYew5ldM5Jp@4`ZqvRHsDJVur5<}z{gJcy0 zWTAYnauVlM$Q3fBe%t|^d9_$B>BT6Q%wkd3x^XVhTT@n3g<>|uZB(gNYOrohGy8^y-_HPVTA=DeA=@?xx!1%4Ld$lBS2ar(S1Q!d$MqR5Y~ZY_5+t zY<6NET{EKGTYr(xp5nfLI?Y8m8M%sieT-eD^m2szsaDh+*zBu)SrB)!oy{s^_P~VF P=0seG8}ZC4ZF1LN*ego; delta 153 zcmX@mV056tXhSg1 chr break @@ -391,7 +391,7 @@ end def strtonum(strptr) word num, i byte c - + num = 0 for i = 1 to ^strptr c = ^(strptr + i) & $7F @@ -438,9 +438,8 @@ def readtxt(filename, startline)#0 putln end def writetxt(filename)#0 - word i, strptr - byte refnum, j, chr - byte txtbuf[MAXLNLEN+2] + word i + byte refnum, txtbuf[MAXLNLEN+2] fileio:destroy(filename) fileio:create(filename, $04, $00) // full access, TXT file @@ -558,7 +557,7 @@ end def drawscrn(toprow, ofst)#0 byte row, numchars, lofst word strptr, scrnptr - + lofst = flags & gutter if lofst drawgutter(toprow, ofst) @@ -598,7 +597,7 @@ def drawscrn(toprow, ofst)#0 end def cursoff#0 word scrnptr - + if flags & showcurs ^cursptr = underchr if flags & gutter @@ -607,13 +606,13 @@ def cursoff#0 ^(scrnptr+2) = ^(scrnptr+2) | $80 fin flags = flags & ~showcurs - + fin end def curson#0 byte lofst word scrnptr - + if !(flags & showcurs) lofst = flags & gutter if lofst @@ -644,7 +643,7 @@ def redraw#0 end def curshpos(hpos)#1 byte needredraw - + needredraw = TRUE if hpos < 0; hpos = 0; fin if hpos > MAXLNLEN; hpos = MAXLNLEN; fin @@ -777,7 +776,7 @@ def cursleft#0 end def pgleft#0 word i, strptr - + strptr = txtlinbuf=>[cursrow] if curscol > ^strptr i = ^strptr @@ -818,7 +817,7 @@ def cursright#0 end def pgright#0 word i, strptr - + strptr = txtlinbuf=>[cursrow] if curscol >= ^strptr i = curscol + 8 @@ -849,7 +848,7 @@ end // def findline(strptr, start)#1 byte scan, i, upstr[MAXLNLEN+1] - + if ^strptr >= findstr lnupcpy(@upstr, strptr) for scan = start to upstr - findstr + 1 @@ -1098,7 +1097,7 @@ def printtxt(slot)#0 end def freesel#0 word i - + for i = 0 to numcliplines - 1 if cliplinbuf=>[i] <> @nullstr delstr(cliplinbuf=>[i]) @@ -1109,7 +1108,7 @@ def freesel#0 end def selrange#2 word first, last - + if flags & selection if cursrow > selrow first, last = selrow, cursrow @@ -1129,7 +1128,7 @@ def beginsel#0 end def copysel#0 word firstsel, lastsel - + freesel firstsel, lastsel = selrange for numcliplines = 0 to lastsel - firstsel @@ -1140,7 +1139,7 @@ def copysel#0 end def cutsel#0 word firstsel, lastsel - + freesel firstsel, lastsel = selrange if lastsel - firstsel < MAXCLIPLINES @@ -1169,7 +1168,7 @@ def cutsel#0 end def pastesel#0 word p - + if numcliplines and numcliplines + numlines < MAXLINES memcpy(@txtlinbuf=>[cursrow + numcliplines], @txtlinbuf=>[cursrow], (numlines - cursrow) * 2) for p = 0 to numcliplines - 1 @@ -1185,7 +1184,7 @@ end def indentsel#0 byte indentstr[MAXLNLEN+1], l word firstsel, lastsel, i - + freesel firstsel, lastsel = selrange for i = firstsel to lastsel @@ -1205,7 +1204,7 @@ end def undentsel#0 byte undentstr[MAXLNLEN+1], l word firstsel, lastsel, i - + freesel firstsel, lastsel = selrange for i = firstsel to lastsel @@ -1230,12 +1229,12 @@ def undentsel#0 end def autoindent(strptr)#0 byte i - + for i = 1 to ^strptr if ^(strptr + i) <> keyspace break fin - next + next curshpos(i - 1) end def openline(row) @@ -1289,7 +1288,7 @@ def splitline#0 memcpy(@splitstr + 2, @splitstr + 1, splitstr) splitstr[1] = keyspace splitstr++ - next + next txtlinbuf=>[cursrow + 1] = newstr(@splitstr) splitstr = curscol memcpy(@splitstr + 1, txtlinbuf=>[cursrow] + 1, splitstr) @@ -1303,7 +1302,7 @@ def splitline#0 break fin next - curshpos(curscol - 1) + curshpos(curscol - 1) fin fin else