Compare commits

...

14 Commits
r1 ... master

Author SHA1 Message Date
Kelvin Sherlock
efe6925322 updated WDM arguments to match what's in GS+. 2018-08-20 16:30:47 -04:00
Kelvin Sherlock
e9f00fac8c add atinit code. 2018-08-20 00:15:51 -04:00
Kelvin Sherlock
524fa1a94b host fst updates.
1. don't lookup the .host device during startup - startup happens before the boot.driver is loaded
2. lookup the .host device when a path-based or volumegs call is made.
3. when building a vcr, store the ptr so it can be dereferenced later, if needed.
2018-07-14 09:10:34 -04:00
Kelvin Sherlock
e890e33f39 add boot driver option - like the normal driver, but less header? 2018-07-14 09:06:49 -04:00
Kelvin Sherlock
48d132c910 boot.system - need to initialize fst before using it. 2018-07-14 09:06:06 -04:00
Kelvin Sherlock
9e0fe043ed minor tweaks, pre-kfest.
1. deref vcr after fcr is created, in case it moved.
2. fcr and vcr go hand-in-hand, so no need to check each in the action table
3. add boot loader (not quite working yet)
2018-07-12 21:54:57 -04:00
Kelvin Sherlock
ffd5cf9826 post volume change event after the volume changes. 2018-07-01 16:44:08 -04:00
Kelvin Sherlock
9cb8554d6f add missing Close/GS records. 2018-06-23 22:44:55 -04:00
ksherlock
7ffd8d9052 Update README.MD 2017-08-17 20:21:07 -04:00
ksherlock
af3fe8dd88 Update README.MD 2017-08-17 16:17:54 -04:00
ksherlock
306176ba31 Update README.MD 2017-08-17 16:17:11 -04:00
ksherlock
d0a915f58d Update README.MD 2017-08-17 16:09:53 -04:00
Kelvin Sherlock
9618dc2441 add screenshots 2017-08-17 16:08:00 -04:00
Kelvin Sherlock
17b1a8a3f2 non-code tweaks 2017-02-18 13:57:42 -05:00
13 changed files with 648 additions and 69 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.o
.lst

View File

@ -6,7 +6,7 @@ ASMFLAGS=-case on -l
LDFLAGS=
all : host.driver host.fst
all : host.driver boot.driver host.fst boot.sys atinit
host.fst : host.fst.o
$(LD) -t \$$BD -at \$$0000 $< -o $@
@ -18,12 +18,39 @@ host.fst : host.fst.o
host.driver : host.driver.o
$(LD) -t \$$BB -at \$$0101 $< -o $@
boot.driver : boot.driver.o
$(LD) -t \$$BB -at \$$0181 $< -o $@
# -d BootDriver must come after -case on
host.driver.o : host.driver.aii gsos.equ
boot.driver.o : host.driver.aii gsos.equ
$(ASM) $(ASMFLAGS) -d BootDriver $< -o $@
host.fst.o : host.fst.aii gsos.equ fst.equ records.equ fst.macros
boot: boot.o
$(LD) $< -o $@
boot.sys: boot
mpw makebiniigs -p -s -t \$$FF $< -o $@
atinit: atinit.omf
mpw makebiniigs -p -s -t \$$e2 $< -o $@
atinit.omf: atinit.o
$(LD) -x $^ -o $@
.PHONY : clean
clean :
$(RM) -- host.fst host.driver boot.driver boot.sys boot atinit atinit.omf *.o
%.o : %.aii
$(ASM) $(ASMFLAGS) $< -o $@

View File

@ -1,16 +1,38 @@
Host FST
--------
# Host FST
This is a file system translator (and driver) for compatible Apple IIgs
emulators. It depends on emulator support (but should not cause problems
if run on real hardware or an unsupportive emulator).
![Host FST](images/ss-1.png)
This FST exposes a shared folder from your native file system as a volume
within GS/OS. (The volume will not be available from ProDOS 8). Reading
or writing a file on the :Host drive will read or write the file directly
on the native file system. File Types, Finder Info, and Resource Forks
are supported.
![Host FST](images/ss-2.png)
In general any software that works with the HFS FST should work with the
Host FST.
## Installation
Currently, only GSPlus (0.13+) has support for the host fst.
1. See the [releases](https://github.com/ksherlock/host-fst/releases) page for a disk image.
2. Install the `host.fst` and `host.driver` in your `*:System:` folder
3. Bleeding edge versions of GSPlus have a config option (F4, Host FST Configuration) to
select the host fst directory. (On older versions it doesn't work correctly).
4. If you're using an older version of GSPlus, shutdown GSPlus and manually edit the
`config.txt` file. Add a line like:
g_cfg_host_path = /Users/me/IIgs/
# Note
Large volume sizes can cause a buffer overflow Finder's code and cause a crash (usually when displaying the File Info window).
This is fixed as of System 6.0.4.

110
atinit.aii Normal file
View File

@ -0,0 +1,110 @@
CheckMach equ $fe1f ;Monitor Routine to check machine type
mli equ $bf00
KVersion equ $bfff
head_call equ $fc
tail_call equ $fd
;code equ $d7a9 ; end of IIgs clock driver.
code equ $c0f0 ; slot 7 devsel.
;
; n.b. - IIgs clock driver is in the language card RAM so it can't be
; used for
;
macro
&lab wdm &arg
&lab dc.b $42, &arg
endm
Macro
_ON_LINE &params
jsr $BF00
dc.b $C5
dc.w &params
MEnd
MACHINE M65C02
LONGA OFF
LONGI OFF
main proc ORG $2000
lda $c061 ; check open apple button
bmi exit
lda KVersion
cmp #24 ; check for ProDOS 2.4+
blt exit
sec
jsr CheckMach
bcs exit
sei
lda mli+1
sta pro_ent+1
sta mli_address
lda mli+2
sta pro_ent+2
sta mli_address+1
jsr fakemli
dc.b $99
dc.w dcb
ldx #stub_end-stub_begin
@loop
lda stub_begin,x
sta code,x
dex
bpl @loop
lda #<code
sta mli+1
lda #code>>8
sta mli+2
exit
cli
clc
rts
dcb dc.b 4 ; pcount
dc.b 1 ; version
mli_address dc.w $0000 ; mli address
dc.w code+dcb_ent-stub_begin ; patch address
mli_slot dc.b $80 ; ProDOS slot to use.
fakemli
sec
wdm head_call
; if this drops through, no gs+ support.
pla
bra exit
;
; this code is relocated to $d7a9, after the IIgs clock driver.
;
stub_begin
wdm head_call
pro_ent jsr $0000
dcb_ent dc.b $0
dc.w $0000
wdm tail_call
rts
stub_end
if (stub_end-stub_begin)>16 then
aerror 'stub code overflow'
endif
endp
end

327
boot.aii Normal file
View File

@ -0,0 +1,327 @@
;
; Host FST boot loader.
;
;
;
;
;
string asis
case on
include 'gsos.equ'
include 'fst.macros'
include 'records.equ'
macro
&lab call_host
&lab dc.b $42, $ff
endm
macro
&lab host_print
&lab dc.b $42, $fe
endm
macro
&lab host_hexdump
&lab dc.b $42, $fd
endm
gbuffer equ $9a00
header proc org $2000
import startup
import readfile
import getbootname
import getfstname
export aux_value
jmp startup
nop
dc.w readfile
dc.w getbootname
dc.w getfstname
dc.w startup-header
aux_value dc.w 0
endp
; getfst_name(name*)
;
getfstname proc
nameptr equ $0
plx ; rts
pla
sta <nameptr
pla
sta <nameptr+2
phx
ldy |fst_str
iny
short m
@loop
lda fst_str,y
sta [nameptr],y
dey
bpl @loop
long m
clc
lda #0
rts
fst_str str.w 'Host.fst'
endp
getbootname proc
nameptr equ $0
plx ; rts
pla
sta <nameptr
pla
sta <nameptr+2
phx
ldy |volume_str
iny
short m
@loop
lda volume_str,y
sta [nameptr],y
dey
bpl @loop
long m
clc
lda #0
rts
volume_str str.w ':Host'
endp
readfile proc
;
;
;
import OpenDCB:OpenRecGS
import CloseDCB:CloseRecGS
import ReadDCB:IORecGS
import open_read_close
plx ; rts
pla
sta ReadDCB.dataBuffer
pla
sta ReadDCB.dataBuffer+2
pla
sta OpenDCB.pathname
pla
sta OpenDCB.pathname+2
phx ; rts
jsr open_read_close
bcs @error
lda OpenDCB.fileType
sta 3,s
lda OpenDCB.auxType
sta 5,s
lda OpenDCB.eof
sta 7,s
lda OpenDCB.eof+2
sta 9,s
lda #0
clc
rts
@error ; A should have error code....
rts
endp
open_read_close proc
;
; pathname, dataBuffer set up in DCBs.
;
import OpenDCB:OpenRecGS
import CloseDCB:CloseRecGS
import ReadDCB:IORecGS
import fakedp
with fst_parms
phd
phb
phk
plb
lda #fakedp
tcd
lda gbuffer
sta scratch
lda #OpenDCB
sta param_blk_ptr
lda #^OpenDCB
sta param_blk_ptr+2
stz dev1_num
stz dev2_num
lda OpenDCB.pathname
sta path1_ptr
lda OpenDCB.pathname+2
sta path1_ptr+2
stz path2_ptr
stz path2_ptr+2
lda #$4000
sta path_flag
lda #11
sta span1
stz span2
ldx #$2010
stx call_number
sec
call_host
bcs @exit
; x = cookie for open/close.
txy ; cookie
lda OpenDCB.eof
sta ReadDCB.requestCount
lda OpenDCB.eof+2
sta ReadDCB.requestCount+2
; global data buffer -
; readline mask.
stz $9a00
stz ReadDCB.transferCount
stz ReadDCB.transferCount+2
lda #ReadDCB
sta param_blk_ptr
lda #^ReadDCB
sta param_blk_ptr+2
stz dev1_num
stz dev2_num
stz path1_ptr
stz path1_ptr+2
stz path2_ptr
stz path2_ptr+2
stz path_flag
stz span1
stz span2
ldx #$2012
stx call_number
sec
call_host
; close...
lda #CloseDCB
sta param_blk_ptr
lda #^CloseDCB
sta param_blk_ptr+2
ldx #$2014
stx call_number
sec
call_host
@exit
lda scratch
sta gbuffer
plb
pld
rts
scratch ds.w 1
endp
startup proc
clc
xce
long m,x
import OpenDCB:OpenRecGS
import CloseDCB:CloseRecGS
import ReadDCB:IORecGS
import aux_value
; 0. host fst start up.
lda #0
ldx #$8001
call_host
; 1. open/read/close start.gsos
; 2. execute start.gsos
lda #15
sta OpenDCB.pCount
lda #start_str
sta OpenDCB.pathname
lda #^start_str
sta OpenDCB.pathname+2
lda #1
sta OpenDCB.requestAccess
lda #1
sta CloseDCB.pCount
lda #3
sta ReadDCB.pCount
lda #$6800
sta ReadDCB.dataBuffer
lda #$0000
sta ReadDCB.dataBuffer+2
jsr open_read_close
lda OpenDCB.auxType
sta aux_value
lda #$1000 ; want *:System:Drivers:Boot.Driver
ldx #0
ldy #0
jmp $6803
start_str str.w 'System:Start.GS.OS'
endp
Data record
export OpenDCB, CloseDCB, ReadDCB
OpenDCB ds OpenRecGS
CloseDCB ds CloseRecGS
ReadDCB ds IORecGS
; needs to be last.
export fakedp
fakedp
endr
end

View File

@ -6,6 +6,7 @@ ptr ds.l 1 ; misc ptr
my_vcr ds.l 1
my_fcr ds.l 1
my_vcr_ptr ds.l 1
cookie ds.w 1
call_class ds.w 1
tmp ds.w 1

View File

@ -272,3 +272,18 @@
macro
&l post_event
bcs @no
pei call_number
lda dev_id
pha
pea 0
lda #volume_change
ldx #^volume_change
jsl post_os_event
lda #0
clc
@no
mend

View File

@ -10,6 +10,7 @@
; ` prevents expansion during macro processing.
DEFAULT `DEBUG_S16,0
DEFAULT `DebugSymbols,0
DEFAULT `BootDriver,0
****************************************************************
*
@ -149,8 +150,12 @@ init_parse_path equ $01FCD4 ;initialize for parse_path.
;
; Event codes for os_event
;
volmod_event equ $0040 ; event code for volume modified
disk_in_event equ $0008 ; disk inserted event
switch_to_p8 equ $00000002 ;Switch from GS/OS to P8.
switch_to_gsos equ $00000004 ;Switch from P8 to GS/OS.
disk_insert equ $00000008 ;Disk inserted.
disk_eject equ $00000010 ;Disk ejected.
gsos_shutdown equ $00000020 ;OS shutdown.
volume_change equ $00000040 ;Volume changed.
;
; Driver command codes

View File

@ -10,10 +10,11 @@
string asis
header proc
if not BootDriver then
dc.w dib-header
dc.w 1 ; 1 device
dc.w 0 ; no config list
endif
dib dc.l 0 ;Link pointer to next DIB
dc.l entry ;Entry pointer

View File

@ -18,8 +18,7 @@
entry check_path1, check_path2
entry build_vcr
entry fd_op
entry fd_op_ro
entry create
entry destroy
@ -50,12 +49,12 @@
macro
&lab host_print
&lab dc.b $42, $fe
&lab dc.b $42, $a0
endm
macro
&lab host_hexdump
&lab dc.b $42, $fd
&lab dc.b $42, $a1
endm
@ -162,64 +161,80 @@ rtl_invalid_pcount proc
sys_startup proc
find_host_device proc
with dev_parms
; 1. find the .host device.
; find .host device. if no .host, returns to gs/os.
; entry via jsr
; exit via rts (success) / sys_exit (fail).
lda dev_id
beq @search
bmi @fail
rts
@fail plx
lda #unknown_vol
sec
jml sys_exit
@search
lda #-1
sta dev_id
lda #1
sta dev_dev_id
stz dev_num
loop
@loop
lda #drvr_get_dib
sta dev_callnum
jsl dev_dispatcher
bcs no
; appletalk puts up a dialog box....
bcs @fail
ldy #$34 ; dib device id
lda [dev_dib_ptr],y
cmp #$10 ; file server
bne next
bne @next
short m
ldy #$0e ; name $04 H O S T
lda [dev_dib_ptr],y
cmp #$04
bne next
bne @next
iny
lda [dev_dib_ptr],y
cmp #'H'
bne next
bne @next
iny
lda [dev_dib_ptr],y
cmp #'O'
bne next
bne @next
iny
lda [dev_dib_ptr],y
cmp #'S'
bne next
bne @next
iny
lda [dev_dib_ptr],y
cmp #'T'
bne next
bne @next
long m
lda dev_dev_id
sta dev_id
bra got_device
clc
rts
next
@next
long m
; try the next one.
inc dev_dev_id
bra loop
bra @loop
endp
got_device
sys_startup proc
stz dev_id
; sanity check that the global buffer location
; is where I expect it.
@ -337,11 +352,23 @@ app_entry proc
stz cookie
@check_fcr
; check fcr bit.
; n = fcr/vcr-based
; v = path-based
bit table,x
bpl @check_vcr
bmi @vcr
bvc @call
@path
; path checking...
jsr find_host_device
jsr check_path1
bcc @call
jml sys_exit
@vcr
; deref vcr and fcr.
ldx fcr_ptr
ldy fcr_ptr+2
jsl deref
@ -351,35 +378,13 @@ app_entry proc
lda [my_fcr],y
sta cookie
@check_vcr
ldx <tmp
bit table,x
bvc @check_path
ldx vcr_ptr
ldy vcr_ptr+2
jsl deref
stx my_vcr
sty my_vcr+2
@check_path
ldx <tmp
lda #path_used
bit table,x
beq @call
; path checking...
jsr check_path1
bcc @call
jml sys_exit
@call
ldx <tmp
; fake an rtl address for sys_exit
; otherwise, would need to jml sys_exit from functions.
pea |(sys_exit-1)>>8
@ -411,6 +416,8 @@ app_entry proc
app_table
dc.w rtl_bad_system_call ;
dc.w create ; ($01) Create
@ -468,10 +475,10 @@ max_app_call equ *-app_table-2
fcr_used equ $8000
vcr_used equ $4000
path_used equ $2000
; insight - vcr and fcr always go together.
vcr_used equ $8000
fcr_used equ $0000
path_used equ $4000
table ; stores max pcount + 1
dc.w 0
@ -581,7 +588,7 @@ read proc
ldy #fcr.mask
lda [my_fcr],y
sta >$009a00 ; hardcoded...
beq fd_op
beq fd_op_ro
; zero-out the table.
ldx #256-2
@ -621,7 +628,7 @@ nloop
bpl nloop
long m
bra fd_op
bra fd_op_ro
endp
@ -630,16 +637,15 @@ nloop
export &lab
&lab
endm
fd_op proc
fd_op_ro proc
write global
get_eof global
set_eof global
get_mark global
set_mark global
flush global
get_dir_entry global
with dp, fst_parms
; read, write, truncate, etc.
@ -652,20 +658,34 @@ get_dir_entry global
rtl
endp
path_op proc
fd_op_rw proc
write global
set_eof global
set_mark global
with dp, fst_parms
; read, write, truncate, etc.
; everything (except close) that uses an fcr.
lda #invalid_fst_op
ldx call_number
ldy cookie
sec
call_host
post_event
rtl
endp
path_op_ro proc
get_file_info global
set_file_info global
create global
destroy global
erase_disk global
format global
with dp, fst_parms
lda #invalid_fst_op
ldx call_number
sec
@ -674,6 +694,26 @@ format global
endp
path_op_rw proc
set_file_info global
create global
destroy global
erase_disk global
format global
with dp, fst_parms
lda #invalid_fst_op
ldx call_number
sec
call_host
post_event
rtl
endp
judge_name proc
with dp, fst_parms
@ -718,7 +758,7 @@ change_path proc
ldx call_number
sec
call_host
post_event
exit
rtl
@ -730,6 +770,13 @@ volume proc
with dp, fst_parms
;
; volume requires a device id. it doesn't fit
; into the standard table so we check for the
; .host device here.
;
jsr find_host_device
lda dev1_num
beq no
@ -768,6 +815,8 @@ build_vcr proc
lda #0
jsl find_vcr
bcs create_vcr
stx my_vcr_ptr
sty my_vcr_ptr+2
jsl deref
stx my_vcr
@ -823,6 +872,9 @@ create_vcr
ldx #host_name
ldy #^host_name
jsl alloc_vcr
stx my_vcr_ptr
sty my_vcr_ptr+2
lda #out_of_mem
bcs exit
@ -1031,6 +1083,13 @@ open proc
sty my_fcr+2
; need to re-deref the vcr?
; vcr_ptr is actually a pathname.
ldx my_vcr_ptr
ldy my_vcr_ptr+2
jsl deref
stx my_vcr
sty my_vcr+2
ldy #vcr.open_count
lda [my_vcr],y

BIN
images/ss-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
images/ss-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -259,3 +259,13 @@ DevNumRec begin_struct
devName DS.B 4
devNum DS.B 2
end_struct
CloseRecGS begin_struct
pCount DS.W 1
refNum DS.W 1
end_struct
CloseRec begin_struct
refNum DS.W 1
end_struct