diff --git a/src/libsrc/apple/hgrlib.pla b/src/libsrc/apple/hgrlib.pla index 395fa78..55f4961 100644 --- a/src/libsrc/apple/hgrlib.pla +++ b/src/libsrc/apple/hgrlib.pla @@ -16,6 +16,13 @@ const hgr1 = $2000 const hgr2 = $4000 const page1 = 0 const page2 = 1 +// +// Apple III hardware constants. +// +const ENV_REG = $FFDF +// +// Screen addresses +// word hgrbuff[] = hgr1, hgr2 //word hgrscan[] = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00 //word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80 @@ -1192,6 +1199,13 @@ export def hgrDrawBuf(page)#1 return drawpage end // +// Machine compatibility check +// +if MACHID & MACHID_MODEL == MACHID_III or MACHID & MACHID_MODEL == MACHID_I + puts("Apple II compatible only.\n") + return -1 +fin +// // Assembly fixups // hgrCopyDst:1 = @clipsrc diff --git a/src/libsrc/apple/matchfiles.pla b/src/libsrc/apple/matchfiles.pla index 69c2afe..f3ff790 100644 --- a/src/libsrc/apple/matchfiles.pla +++ b/src/libsrc/apple/matchfiles.pla @@ -43,7 +43,7 @@ end export def matchList(pathstr, exp)#2 byte refnum char[64] curpath - var firstblk, entrylen, entriesblk, i, entry, filecnt, entrylist, entryptr, entrycnt + var firstblk, entrylen, entriesblk, i, entry, entrylist, entryptr, entrycnt if not dirbuf dirbuf = heapallocalign(512, 8, 0) @@ -58,48 +58,43 @@ export def matchList(pathstr, exp)#2 fin entrylist = 0 entrycnt = 0 - filecnt = 0 firstblk = 1 refnum = fileio:open(pathstr) - repeat - if fileio:read(refnum, dirbuf, 512) == 512 + while fileio:read(refnum, dirbuf, 512) == 512 + // + // Skip block pointers + // + entry = dirbuf + 4 + if firstblk // - // Skip block pointers + // Pull out revelant details from the first block // - entry = dirbuf + 4 - if firstblk - // - // Pull out revelant details from the first block - // - entrylen = dirbuf->$23 - entriesblk = dirbuf->$24 - filecnt = dirbuf=>$25 - entry = entry + entrylen - fin - for i = firstblk to entriesblk - // - // Copy directory entry details - // - ^entry = ^entry & $0F - if ^entry - // - // Match wildcard filename - // - if matchName(entry, exp) - entryptr = heapalloc(t_fileentry) - memcpy(entryptr, entry, t_fileentry) - entrycnt++ - if not entrylist - entrylist = entryptr - fin - fin - filecnt-- - fin - entry = entry + entrylen - next - firstblk = 0 + entrylen = dirbuf->$23 + entriesblk = dirbuf->$24 + entry = entry + entrylen fin - until filecnt == 0 + for i = firstblk to entriesblk + // + // Copy directory entry details + // + ^entry = ^entry & $0F + if ^entry + // + // Match wildcard filename + // + if matchName(entry, exp) + entryptr = heapalloc(t_fileentry) + memcpy(entryptr, entry, t_fileentry) + entrycnt++ + if not entrylist + entrylist = entryptr + fin + fin + fin + entry = entry + entrylen + next + firstblk = 0 + loop fileio:close(refnum) return entrylist, entrycnt end diff --git a/src/samplesrc/hgrtest.pla b/src/samplesrc/hgrtest.pla index 64d4080..7c3ff4a 100644 --- a/src/samplesrc/hgrtest.pla +++ b/src/samplesrc/hgrtest.pla @@ -15,7 +15,6 @@ byte = $83, $31, $11, $13, $38 byte = $88, $33, $11, $33, $88 byte = $88, $83, $33, $38, $88 var sprtBall - def testline#0 var i diff --git a/src/vmsrc/apple/cmd.pla b/src/vmsrc/apple/cmd.pla index 13d0499..4b171b6 100755 --- a/src/vmsrc/apple/cmd.pla +++ b/src/vmsrc/apple/cmd.pla @@ -1172,7 +1172,7 @@ def catalog(path)#0 byte firstblk byte entrylen, entriesblk byte i, type, len - word entry, filecnt + word entry if !^path path = @prefix @@ -1182,43 +1182,37 @@ def catalog(path)#0 return fin firstblk = 1 - repeat - if read(refnum, heap, 512) == 512 - entry = heap + 4 - if firstblk - entrylen = heap->$23 - entriesblk = heap->$24 - filecnt = heap=>$25 - entry = entry + entrylen - fin - for i = firstblk to entriesblk - if ^entry - ^entry = ^entry & $0F - prstr(entry) - type = ' ' - when entry->$10 - is $0F // Is it a directory? - type = '/' - break - is $FF // SYSTEM file - type = '-' - break - is $FE // REL file - type = '+' - wend - cout(type) - for len = ^entry to 18 - cout(' ') - next - filecnt-- - fin - entry = entry + entrylen - next - firstblk = 0 - else - filecnt = 0 + while read(refnum, heap, 512) == 512 + entry = heap + 4 + if firstblk + entrylen = heap->$23 + entriesblk = heap->$24 + entry = entry + entrylen fin - until !filecnt + for i = firstblk to entriesblk + if ^entry + ^entry = ^entry & $0F + prstr(entry) + type = ' ' + when entry->$10 + is $0F // Is it a directory? + type = '/' + break + is $FF // SYSTEM file + type = '-' + break + is $FE // REL file + type = '+' + wend + cout(type) + for len = ^entry to 18 + cout(' ') + next + fin + entry = entry + entrylen + next + firstblk = 0 + loop close(refnum) crout() end diff --git a/src/vmsrc/apple/cmdjit.pla b/src/vmsrc/apple/cmdjit.pla index 6545556..5cde917 100755 --- a/src/vmsrc/apple/cmdjit.pla +++ b/src/vmsrc/apple/cmdjit.pla @@ -1237,7 +1237,7 @@ def catalog(path)#0 byte firstblk byte entrylen, entriesblk byte i, type, len - word entry, filecnt + word entry if !^path path = @prefix @@ -1247,43 +1247,37 @@ def catalog(path)#0 return fin firstblk = 1 - repeat - if read(refnum, heap, 512) == 512 - entry = heap + 4 - if firstblk - entrylen = heap->$23 - entriesblk = heap->$24 - filecnt = heap=>$25 - entry = entry + entrylen - fin - for i = firstblk to entriesblk - if ^entry - ^entry = ^entry & $0F - prstr(entry) - type = ' ' - when entry->$10 - is $0F // Is it a directory? - type = '/' - break - is $FF // SYSTEM file - type = '-' - break - is $FE // REL file - type = '+' - wend - cout(type) - for len = ^entry to 18 - cout(' ') - next - filecnt-- - fin - entry = entry + entrylen - next - firstblk = 0 - else - filecnt = 0 + while read(refnum, heap, 512) == 512 + entry = heap + 4 + if firstblk + entrylen = heap->$23 + entriesblk = heap->$24 + entry = entry + entrylen fin - until !filecnt + for i = firstblk to entriesblk + if ^entry + ^entry = ^entry & $0F + prstr(entry) + type = ' ' + when entry->$10 + is $0F // Is it a directory? + type = '/' + break + is $FF // SYSTEM file + type = '-' + break + is $FE // REL file + type = '+' + wend + cout(type) + for len = ^entry to 18 + cout(' ') + next + fin + entry = entry + entrylen + next + firstblk = 0 + loop close(refnum) crout() end diff --git a/src/vmsrc/apple/soscmd.pla b/src/vmsrc/apple/soscmd.pla index f433a5d..3253333 100755 --- a/src/vmsrc/apple/soscmd.pla +++ b/src/vmsrc/apple/soscmd.pla @@ -80,7 +80,7 @@ def catalog(path)#0 byte firstblk byte entrylen, entriesblk byte i, type, len - word entry, filecnt, catptr + word entry, catptr if !^path getpfx(path) @@ -91,43 +91,37 @@ def catalog(path)#0 fin catptr = heapmark firstblk = 1 - repeat - if cmdsys:sysread(refnum, catptr, 512) == 512 - entry = catptr + 4 - if firstblk - entrylen = catptr->$23 - entriesblk = catptr->$24 - filecnt = catptr=>$25 - entry = entry + entrylen - fin - for i = firstblk to entriesblk - if ^entry - ^entry = ^entry & $0F - puts(entry) - type = ' ' - when entry->$10 - is $0F // Is it a directory? - type = '/' - break - is $FF // SYSTEM file - type = '-' - break - is $FE // REL file - type = '+' - wend - putc(type) - for len = ^entry to 18 - putc(' ') - next - filecnt-- - fin - entry = entry + entrylen - next - firstblk = 0 - else - filecnt = 0 + while cmdsys:sysread(refnum, catptr, 512) == 512 + entry = catptr + 4 + if firstblk + entrylen = catptr->$23 + entriesblk = catptr->$24 + entry = entry + entrylen fin - until filecnt == 0 + for i = firstblk to entriesblk + if ^entry + ^entry = ^entry & $0F + puts(entry) + type = ' ' + when entry->$10 + is $0F // Is it a directory? + type = '/' + break + is $FF // SYSTEM file + type = '-' + break + is $FE // REL file + type = '+' + wend + putc(type) + for len = ^entry to 18 + putc(' ') + next + fin + entry = entry + entrylen + next + firstblk = 0 + loop cmdsys:sysclose(refnum) putln() end diff --git a/src/vmsrc/apple/soscmdjit.pla b/src/vmsrc/apple/soscmdjit.pla index eef4d83..af074f9 100755 --- a/src/vmsrc/apple/soscmdjit.pla +++ b/src/vmsrc/apple/soscmdjit.pla @@ -155,7 +155,7 @@ def catalog(path)#0 byte firstblk byte entrylen, entriesblk byte i, type, len - word entry, filecnt, catptr + word entry, catptr if !^path getpfx(path) @@ -166,43 +166,37 @@ def catalog(path)#0 fin catptr = heapmark firstblk = 1 - repeat - if cmdsys:sysread(refnum, catptr, 512) == 512 - entry = catptr + 4 - if firstblk - entrylen = catptr->$23 - entriesblk = catptr->$24 - filecnt = catptr=>$25 - entry = entry + entrylen - fin - for i = firstblk to entriesblk - if ^entry - ^entry = ^entry & $0F - puts(entry) - type = ' ' - when entry->$10 - is $0F // Is it a directory? - type = '/' - break - is $FF // SYSTEM file - type = '-' - break - is $FE // REL file - type = '+' - wend - putc(type) - for len = ^entry to 18 - putc(' ') - next - filecnt-- - fin - entry = entry + entrylen - next - firstblk = 0 - else - filecnt = 0 + while cmdsys:sysread(refnum, catptr, 512) == 512 + entry = catptr + 4 + if firstblk + entrylen = catptr->$23 + entriesblk = catptr->$24 + entry = entry + entrylen fin - until filecnt == 0 + for i = firstblk to entriesblk + if ^entry + ^entry = ^entry & $0F + puts(entry) + type = ' ' + when entry->$10 + is $0F // Is it a directory? + type = '/' + break + is $FF // SYSTEM file + type = '-' + break + is $FE // REL file + type = '+' + wend + putc(type) + for len = ^entry to 18 + putc(' ') + next + fin + entry = entry + entrylen + next + firstblk = 0 + loop cmdsys:sysclose(refnum) putln() end