mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-10 21:30:04 +00:00
Machine check for HGRLIB and slightly smaller catalog code
This commit is contained in:
parent
b5f02ea7c5
commit
6045b260db
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user