Commit fbcfdfc6 authored by Not6's avatar Not6
Browse files

replace old src with minivmac 36.04 src

parent f687a062
/*
Configuration options used by platform specific code.
This file is automatically generated by the build system,
which tries to know what options are valid in what
combinations. Avoid changing this file manually unless
you know what you're doing.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#define CanGetAppPath 0
#define HaveAppPathLink 0
#define TheAppPathLink "/proc/self/exe"
#define HaveSysctlPath 0
#define RomFileName "MacIIx.ROM"
#define EnableDragDrop 0
#define EnableAltKeysMode 0
#define SwapCommandControl 0
#define VarFullScreen 1
#define WantInitFullScreen 0
#define MayFullScreen 1
#define MayNotFullScreen 1
#define WantInitMagnify 0
#define EnableMagnify 0
#define MyWindowScale 2
#define WantInitRunInBackground 0
#define WantInitNotAutoSlow 1
#define WantInitSpeedValue -1
#define NeedRequestInsertDisk 0
#define NeedDoMoreCommandsMsg 0
#define NeedDoAboutMsg 0
#define UseControlKeys 1
#define UseActvCode 0
/* version and other info to display to user */
#define NeedIntlChars 0
#define kStrAppName "Mini vMac"
#define kAppVariationStr "minivmac-3.3.2-lx86"
#define kStrCopyrightYear "2012"
#define kMaintainerName "unknown"
#define kStrHomePage "http://minivmac.sourceforge.net/"
MnvM_bld: README
MnvM_b36: README
Paul C. Pratt
www.gryphel.com
July 27, 2005
MnvM_bld is the build system for Mini vMac,
MnvM_b36 is the build system for Mini vMac,
a miniature Macintosh emulator.
Further information may be found at
"http://minivmac.sourceforge.net/".
"https://www.gryphel.com/c/minivmac/".
You can redistribute MnvM_bld and/or modify it under the terms
You can redistribute MnvM_b36 and/or modify it under the terms
of version 2 of the GNU General Public License as published by
the Free Software Foundation. See the included file COPYING.
MnvM_bld is distributed in the hope that it will be useful,
MnvM_b36 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
license for more details.
Mini vMac: mydriver/README
Paul C. Pratt
www.gryphel.com
February 23, 2002
The mydriver folder contains source code
for a replacement disk driver that is patched
into the emulated rom.
The compiled driver is already in ROMEMDEV.c
(the initialization of sony_driver variable),
so this source code is not needed for building
Mini vMac. It is only needed if you want
to change this driver.
To compile the driver, use MPW commands
such as:
set srcdir hd4:Topaz:MinivMac:mydriver:
asm -case on {srcdir}mydriver.a -o {srcdir}mydriver.a.o
c {srcdir}mydriver.c -r -b -mbg off -opt full -o {srcdir}mydriver.c.o
link {srcdir}mydriver.a.o {srcdir}mydriver.c.o -rt DRVR=128 -o {srcdir}mydriver
Then you can use ResEdit to copy the hex data out
of the DRVR 128 resource, format it a bit, and
replace the initialization data of the variable
sony_driver in the file ROMEMDEV.c
(note: this is using the old c compiler, to use
the current c compiler, use:
SC {srcdir}mydriver.c -w 17 -proto strict -b -mbg off -opt all -o {srcdir}mydriver.c.o
)
; mydriver.a
;
; Copyright (C) 2004 Paul C. Pratt
;
; You can redistribute this file and/or modify it under the terms
; of version 2 of the GNU General Public License as published by
; the Free Software Foundation. You should have received a copy
; of the license along with this file; see the file COPYING.
;
; This file is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; license for more details.
; most of this is adapted from sample source code from Apple.
FakeSonyDriver MAIN EXPORT
BLANKS ON
STRING ASIS
kqLink EQU 0
kqType EQU 4
kioTrap EQU 6
kioCmdAddr EQU 8
kioCompletion EQU 12
kioResult EQU 16
kioNamePtr EQU 18
kioVRefNum EQU 22
kioRefNum EQU 24
kcsCode EQU 26
kcsParam EQU 28
kioBuffer EQU 32 ; Buffer to store data into
kioReqCount EQU 36 ; Requested Number of Bytes
kioActCount EQU 40 ; Actual Number of Bytes obtained
kioPosMode EQU 44 ; Positioning Mode
kioPosOffset EQU 46 ; Position Offset
killCode EQU 1 ; KillIO requested
noQueueBit EQU 9 ; trap word modifier
JIODone EQU $08FC
kCmndSonyPrime EQU $0001
kCmndSonyControl EQU $0002
kCmndSonyStatus EQU $0003
kCmndSonyClose EQU $0004
kCmndSonyOpenA EQU $0005
kCmndSonyOpenB EQU $0006
kCmndSonyOpenC EQU $0007
kCmndSonyMount EQU $0008
DHeader
DFlags DC.W $4F00 ; need lock, responds to all requests
DDelay DC.W 0 ; none
DEMask DC.W 0 ; DA event mask
DMenu DC.W 0 ; no menu
DC.W DOpen - DHeader ; offset to Open
DC.W DPrime - DHeader ; offset to Prime
DC.W DControl - DHeader ; offset to Control
DC.W DStatus - DHeader ; offset to Status
DC.W DClose - DHeader ; offset to Close
Name DC.B 5 ; length of name
DC.B '.Sony'
ALIGN 2 ; word alignment
DPrime
MOVEM.L A0-A1, -(SP) ; push ParmBlkPtr, DCtlPtr for C
SUBQ #2, A7 ; result code
MOVE.W #kCmndSonyPrime, -(A7)
BRA.B DPrimeStatusCommon
DControl
MOVEM.L A0-A1, -(SP) ; push ParmBlkPtr, DCtlPtr for C
SUBQ #2, A7 ; result code
MOVE.W #kCmndSonyControl, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #6, A7
MOVE.W (A7)+, D0 ; save result code
MOVEM.L (SP)+, A0-A1 ; restore ParmBlkPtr, DCtlPtr
CMPI.W #killCode,kcsCode(A0) ; test for KillIO call (special case)
BNE.B IOReturn
RTS ; KillIO must always return via RTS
DStatus
MOVEM.L A0-A1, -(SP) ; push ParmBlkPtr, DCtlPtr for C
SUBQ #2, A7 ; result code
MOVE.W #kCmndSonyStatus, -(A7)
DPrimeStatusCommon
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #6, A7
MOVE.W (A7)+, D0 ; save result code
MOVEM.L (SP)+, A0-A1 ; restore ParmBlkPtr, DCtlPtr
IOReturn
MOVE.W kioTrap(A0),D1
BTST #noQueueBit,D1 ; immediate calls are not queued, and must RTS
BEQ.B @Queued ; branch if queued
@NotQueued
TST.W D0 ; test asynchronous return result
BLE.B @ImmedRTS ; result must be <= 0
CLR.W D0 ; "in progress" result (> 0) not passed back
@ImmedRTS
MOVE.W D0,kioResult(A0) ; for immediate calls you must explicitly
; place the result in the ioResult field
RTS
@Queued
TST.W D0 ; test asynchronous return result
BLE.B @MyIODone ; I/O is complete if result <= 0
CLR.W D0 ; "in progress" result (> 0) not passed back
RTS
@MyIODone
MOVE.L JIODone,-(SP) ; push IODone jump vector onto stack
RTS
DClose
MOVEM.L A0-A1, -(SP) ; push ParmBlkPtr, DCtlPtr for C
SUBQ #2, A7 ; result code
MOVE.W #kCmndSonyClose, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #6, A7
MOVE.W (A7)+, D0 ; save result code
MOVEM.L (SP)+, A0-A1 ; restore ParmBlkPtr, DCtlPtr
RTS
DUpdate
MOVEM.L D0-D2/A0-A1,-(SP)
MOVE.L 20(A7),D0 ; data = what was on top of stack before 5 registers pushed
SUBQ #4, A7 ; room for eventMsg
MOVE.L D0,-(A7) ; data
SUBQ #2, A7 ; room for result code
MOVE.W #kCmndSonyMount, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #6, A7
MOVE.W (A7)+, D1 ; result code
ADDQ #4, A7 ; skip over data
MOVE.L (A7)+, D0 ; eventMsg
TST.W D1 ; result code
BNE.S @1
MOVEA.W #$0007,A0
DC.W $A02F ; _PostEvent
@1
MOVEM.L (SP)+,D0-D2/A0-A1
ADDA.W #4,A7 ; remove arguments from stack
RTE
MyAddDrive64k
; This is only needed for the 64k ROM.
DrvQHdr EQU 776
RomBase EQU $00400000
Move.L D0,6(A0)
Lea.L (DrvQHdr),A1
Jmp (RomBase + 2848)
NullTaskProc
RTS
DOpen
MOVEM.L D3-D7/A3,-(A7)
MOVEM.L A0-A1, -(SP) ; push ParmBlkPtr, DCtlPtr for C
SUBQ #6, A7 ; room for result code, L
MOVE.W #kCmndSonyOpenA, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #6, A7
MOVE.W (A7)+, D0 ; result code
MOVE.L (A7)+, D7 ; L
CMPI.W #$FFCF,D0
BNE.S @1
; driver already open, change to no error and leave
CLR.W D0
BRA @2
@1
TST.W D0
BNE @2
MOVE.L D7,D0
DC.W $A71E ; _NewPtr ,Sys,Clear
MOVEA.L A0,A3
MOVE.L A3,D0
BEQ @6
SUBA #16, A7 ; room for various results
MOVE.L A3, -(A7)
MOVE.L D7, -(A7)
SUBQ #2, A7 ; room for result code
MOVE.W #kCmndSonyOpenB, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #6, A7
MOVE.W (A7)+, D0 ; result code
ADDA.W #8, A7
MOVE.L (A7)+, D7 ; dvl
MOVEQ #$00, D3
MOVE.W (A7)+, D3 ; step
MOVE.W (A7)+, D4 ; n
MOVE.W (A7)+, D6 ; i
MOVE.W (A7)+, D5 ; driver
MOVEA.L (A7)+, A3 ; NullTask
TST.W D0
BNE.S @2
MOVE.L A3,D0
BEQ.S @3
; There is apparently a bug in the time manager
; in System 6.0.8, which will cause a crash
; if there are no installed time
; tasks. So create a time task, since
; real disk driver does.
LEA NullTaskProc,A0 ; id: 102
MOVE.L A0,$0006(A3)
MOVEA.L A3,A0
DC.W $A058 ; _InsTime
BRA.S @4
@3
LEA MyAddDrive64k,A0 ; id: 106
MOVE.W #$A04E,D0
DC.W $A047 ; _SetTrapAddress
BRA.S @4
@5
MOVEA.L D7,A0
MOVE.W D6,D0 ; drive number in high word
SWAP D0
MOVE.W D5,D0 ; driver in low word
DC.W $A04E ; _AddDrive
ADD.L D3,D7
ADDQ.W #$1,D6
@4
DBF D4, @5
PEA DUpdate
SUBQ #2, A7 ; room for result code
MOVE.W #kCmndSonyOpenC, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #6, A7
MOVE.W (A7)+, D0 ; result code
ADDA.W #4, A7
@2
; result code should be in D0 when reach here
MOVEM.L (A7)+, A0-A1 ; restore ParmBlkPtr, DCtlPtr
MOVEM.L (A7)+, D3-D7/A3
RTS ; open is always immediate, must return via RTS
@6
; _NewPtr failed
MOVE.W #-1, D0
BRA.S @2
TailData
ENDMAIN
END
STRING C
MACHINE MC68020
PRINT OFF
INCLUDE 'SlotEqu.a'
INCLUDE 'VideoEqu.a'
INCLUDE 'Traps.a'
INCLUDE 'SysEqu.a'
INCLUDE 'SysErr.a'
PRINT ON
VideoDeclROM MAIN
;========================================================================================
; General Directives
BLANKS ON
STRING ASIS
kCmndVideoSetIntEnbl EQU $0003
kCmndVideoClearInt EQU $0004
kCmndVideoStatus EQU $0005
kCmndVideoControl EQU $0006
;========================================================================================
; Local Vars, definitions, etc...
;========================================================================================
;This is device storage, a handle to which is stored in the dCtlStorage field of the DCE.
saveSQElPtr EQU 0 ; the SQ element pointer (for
; _SIRemove
dCtlSize EQU saveSQElPtr+4 ; size of the dCtlStorage
;========================================================================================
; Video Driver Header
;========================================================================================
VidDrvr
DC.W $4C00 ; ctl,status,needsLock
DC.W 0, 0, 0 ; not an ornament
;Entry point offset table
DC.W VideoOpen - VidDrvr ; open routine
DC.W VidDrvr - VidDrvr ; no prime
DC.W VideoCtl - VidDrvr ; control
DC.W VideoStatus - VidDrvr ; status
DC.W VideoClose - VidDrvr ; close
VideoTitle
STRING Pascal
DC.W '.Display_Video_Sample'
STRING ASIS
ALIGN 2 ; make sure we're aligned
DC.W 0 ; version-0
;========================================================================================
;VideoOpen allocates private storage for the device in the DCE and locks
; it down for perpetuity. It installs the interrupt handler and enables
; the interrupts. It also sets the default gamma table included in the driver.
;
;Entry:
; A0 = param block pointer
; A1 = DCE pointer
;
;Locals:
; A2 = Saved param block pointer
; A3 = Saved DCE pointer
; A4 = Saved interrupt handler ptr
;========================================================================================
;Save registers
VideoOpen
MOVE.L A0, A2 ; A2 <- param block pointer
MOVE.L A1, A3 ; A3 <- DCE pointer
;Allocate private storage
MOVEQ #dCtlSize, D0 ; get size of parameters
_ResrvMem ,SYS ; make room as low as possible
MOVEQ #dCtlSize, D0 ; get size of parameters
_NewHandle ,SYS,CLEAR ; get some memory for private
; storage
BNE OpError ;=> return an error in open
MOVE.L A0, dCtlStorage(A3) ; saved returned handle in DCE
_HLock ; and lock it down
;Get and install the interrupt handler
LEA BeginIH, A4 ; Save point to interrupt handler
MOVEQ #SlotIntQElement.sqHDSize,D0 ; allocate a slot queue element
_NewPtr ,SYS,CLEAR ; get it from system heap cleared
BNE OpError
MOVE.W #SIQType, SlotIntQElement.sqType(A0) ; setup queue ID
MOVE.L A4, SlotIntQElement.sqAddr(A0) ; setup int routine address
MOVE.L A3, SlotIntQElement.sqParm(A0) ; save slot base addr as A3 parm
CLR.L D0
MOVE.B dctlSlot(A3), D0 ; setup slot #
_SIntInstall ; and do install
BNE.S OpError
;Save SQElPtr for removal
MOVE.L dCtlStorage(A3), A1 ; Get point to private storage
MOVE.L (A1), A1
MOVE.L A0, saveSQElPtr(A1) ; Save the SQ element pointer
;Enable interrupts
MOVE.W #1, -(A7) ; enabled
SUBQ #2, A7 ; result code
MOVE.W #kCmndVideoSetIntEnbl, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #10, A7
MOVEQ #0, D0 ; no error
BRA.S EndOpen
; Error
OpError
MOVE.L #openErr, D0 ; say can't open driver
EndOpen
RTS
;========================================================================================
; The interrupt handler for the board
;========================================================================================
; On entry A1 contains DCE
; wrong! : "D0-D3/A0-A3 have been preserved."
; (comment from Apples sample code.)
; must preserve registers except A1/D0
BeginIH
MOVE.L A0, -(A7)
; clear interrupt from card
SUBQ #2, A7 ; result code
MOVE.W #kCmndVideoClearInt, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDQ.W #8, A7
MOVE.L dctlDevBase(A1), D0 ; D0 = $Fsxxxxxx
ROL.L #8, D0 ; D0 <- $xxxxxxFs Convert the
; address into
AND #$0F, D0 ; D0 <- $xxxx000x the slot
; number
MOVE.L JVBLTask, A0 ; call the VBL task manager
JSR (A0) ; with slot # in D0
MOVE.L (A7)+, A0
MOVEQ #1, D0 ; signal that int was serviced
RTS ; and return to caller
;========================================================================================
;
;VideoClose releases the device's private storage.
;
;Entry:
; A0 = param block pointer
; A1 = DCE pointer
;
;Locals:
; A2 = Saved param block pointer
; A3 = Saved DCE pointer
; A4 = Temporary
;
;========================================================================================
VideoClose
MOVE.L A3, -(A7) ; save
MOVE.L dCtlStorage(A1), A3; Get pointer to private storage
MOVE.W #0, -(A7) ; disabled
SUBQ #2, A7 ; result code
MOVE.W #kCmndVideoSetIntEnbl, -(A7)
LEA TailData, A0
MOVE.L (A0)+, -(A7)
MOVEA.L (A0), A0
MOVE.L A7, (A0)
ADDA.W #10, A7
MOVE.L (A3), A0
MOVE.L saveSQElPtr(A0), A0 ; Get the SQ element pointer
_SIntRemove ; Remove the interrupt handler
MOVE.L A3, A0 ; Dispose of the private storage
_DisposHandle
MOVEQ #0, D0 ; get error into D0
MOVE.L (A7)+, A3 ; restore A3
RTS ; return to caller
;========================================================================================
;
;Video Driver Control Call Handler.
;
; Entry:
; A0 = param block pointer
; A1 = DCE pointer
; Uses:
; A2 = cs paramaters (i.e. A2 <- csParam(A0)) (must be preserved)
; A3 = scratch (doesn't need to be preserved)
; A4 = scratch (must be preserved)
; D0-D3 = scratch (don't need to be preserved)
;
; Exit: D0 = error code
;
;========================================================================================
;Decode the call
VideoCtl
MOVE.L A0, -(A7)
SUBQ #2, A7 ; result code
MOVE.W #kCmndVideoControl, -(A7)
BRA.S VideoStatusControlCommon