Add wrappers for GS/OS system service calls, and call SET_DISKSW on mount.

I think there should still be some disk-switched logic elsewhere, based on the somewhat complicated rules for it in the documentation, but at least this provides a notification when a new disk is mounted.
This commit is contained in:
Stephen Heumann 2018-08-16 21:39:23 -05:00
parent 3f3c14b8a1
commit dd228dff2d
4 changed files with 117 additions and 2 deletions

View File

@ -7,7 +7,7 @@ HTTPTEST_PROG = httptest
MOUNTURL_OBJS = mounturl.a
MOUNTURL_PROG = mounturl
NETDISKINIT_OBJS = initstart.a netdiskinit.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a driver.a installdriver.a asmglue.a driverwrapper.a session.a
NETDISKINIT_OBJS = initstart.a netdiskinit.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a driver.a installdriver.a asmglue.a driverwrapper.a session.a systemservices.a
# NETDISKINIT_RSRC =
NETDISKINIT_PROG = NetDiskInit

View File

@ -10,6 +10,7 @@
#include "tcpconnection.h"
#include "asmglue.h"
#include "mounturl.h"
#include "systemservices.h"
#include "version.h"
#define BLOCK_SIZE 512
@ -297,7 +298,7 @@ static Word DoMountURL(struct GSOSDP *dp) {
dp->dibPointer->extendedDIBPtr = sess;
//TODO report disk switch
SetDiskSw();
mountURLRec->result = OPERATION_SUCCESSFUL;
mountURLRec->devNum = dp->dibPointer->DIBDevNum;

103
systemservices.asm Normal file
View File

@ -0,0 +1,103 @@
* Wrappers for GS/OS system service calls
* These are designed to be called from within GS/OS, e.g. in a driver.
case on
* System service routines
CACHE_FIND_BLK gequ $01FC04
CACHE_ADD_BLK gequ $01FC08
SWAP_OUT gequ $01FC34
SET_SYS_SPEED gequ $01FC50
MOVE_INFO gequ $01FC70
SIGNAL gequ $01FC88
SET_DISKSW gequ $01FC90
SUP_DRVR_DISP gequ $01FCA4
INSTALL_DRIVER gequ $01FCA8
* GS/OS direct page locations
deviceNum gequ $00
callNum gequ $02
* Driver call number
Driver_Read gequ $0002
dummy private
end
CacheFindBlk start
phb
phd
lda >gsosDP ; set DP to GS/OS direct page
tcd
jsl ForceLCBank1 ; force in language card bank 1
pha ; save old state reg
clc ; search by device number
jsl CACHE_FIND_BLK ; call the system service
php ; save result (carry flag)
php
pld
jsl RestoreStateReg ; restore old state reg
tdc ; get result
and #$0001 ; get just carry flag value as result
eor #$0001 ; invert sense, so TRUE=block was found
pld ; restore direct page
plb
rtl
end
CacheAddBlk start
phb
phd
lda >gsosDP ; set DP to GS/OS direct page
tcd
jsl ForceLCBank1 ; force in language card bank 1
pha ; save old state reg
jsl CACHE_ADD_BLK ; call the system service
php ; save result (carry flag)
php
pld
jsl RestoreStateReg ; restore old state reg
tdc ; get result
and #$0001 ; get just carry flag value as result
eor #$0001 ; invert sense, so TRUE=block was added
pld ; restore direct page
plb
rtl
end
SetDiskSw start
phd
lda >gsosDP ; set DP to GS/OS direct page
tcd
jsl ForceLCBank1 ; force in language card bank 1
pha ; save old state reg
pei deviceNum ; Save deviceNum & CallNum
pei callNum
lda Driver_Read ; and adjust callNum
sta callNum ; per GS/OS TN #7
jsl SET_DISKSW ; call the system service
pla ; restore callNum & deviceNum
sta callNum
pla
sta deviceNum
jsl RestoreStateReg ; restore old state reg
pld ; restore direct page
rtl
end

11
systemservices.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef SYSTEMSERVICES_H
#define SYSTEMSERVICES_H
#include <types.h>
Boolean CacheFindBlk(void);
Boolean CacheAddBlk(void);
void SetDiskSw(void);
#endif