update core to 2016-05-26 snapshot, add all files

This commit is contained in:
Jesús A. Álvarez 2016-05-28 14:18:59 +02:00
parent 0f729c662f
commit 8692e30cde
64 changed files with 39418 additions and 163 deletions

View File

@ -8,23 +8,23 @@
/* Begin PBXBuildFile section */
283422D21CF8EF8C0088B634 /* MacPlus4M.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 283422CA1CF8EF8C0088B634 /* MacPlus4M.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
283422D81CF8F16C0088B634 /* GLOBGLUE.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8E931CD4C3B200FE25A8 /* GLOBGLUE.c */; };
283422D91CF8F16C0088B634 /* IWMEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8E961CD4C3B200FE25A8 /* IWMEMDEV.c */; };
283422DA1CF8F16C0088B634 /* KBRDEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8E981CD4C3B200FE25A8 /* KBRDEMDV.c */; };
283422DB1CF8F16C0088B634 /* M68KITAB.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8E9A1CD4C3B200FE25A8 /* M68KITAB.c */; };
283422DC1CF8F16C0088B634 /* MINEM68K.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8E9C1CD4C3B200FE25A8 /* MINEM68K.c */; };
283422DD1CF8F16C0088B634 /* MOUSEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8E9E1CD4C3B200FE25A8 /* MOUSEMDV.c */; };
283422DE1CF8F16C0088B634 /* PROGMAIN.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EA11CD4C3B200FE25A8 /* PROGMAIN.c */; };
283422DF1CF8F16C0088B634 /* ROMEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EA31CD4C3B200FE25A8 /* ROMEMDEV.c */; };
283422E01CF8F16C0088B634 /* RTCEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EA51CD4C3B200FE25A8 /* RTCEMDEV.c */; };
283422E11CF8F16C0088B634 /* SCCEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EA71CD4C3B200FE25A8 /* SCCEMDEV.c */; };
283422E21CF8F16C0088B634 /* SCRNEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EA91CD4C3B200FE25A8 /* SCRNEMDV.c */; };
283422E31CF8F16C0088B634 /* SCSIEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EAC1CD4C3B200FE25A8 /* SCSIEMDV.c */; };
283422E41CF8F16C0088B634 /* SNDEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EAE1CD4C3B200FE25A8 /* SNDEMDEV.c */; };
283422E51CF8F16C0088B634 /* SONYEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EB01CD4C3B200FE25A8 /* SONYEMDV.c */; };
283422E61CF8F16C0088B634 /* VIAEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8EB31CD4C3B200FE25A8 /* VIAEMDEV.c */; };
283422EE1CF8F2210088B634 /* MYOSGLUE.m in Sources */ = {isa = PBXBuildFile; fileRef = 28CE8ECB1CD4CDC500FE25A8 /* MYOSGLUE.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
283422F41CF8F55E0088B634 /* Emulator.m in Sources */ = {isa = PBXBuildFile; fileRef = 283422F21CF8F5400088B634 /* Emulator.m */; };
283423601CF9C1050088B634 /* GLOBGLUE.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423341CF9C0F10088B634 /* GLOBGLUE.c */; };
283423611CF9C10B0088B634 /* IWMEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423371CF9C0F10088B634 /* IWMEMDEV.c */; };
283423631CF9C1320088B634 /* KBRDEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423391CF9C0F10088B634 /* KBRDEMDV.c */; };
283423641CF9C1320088B634 /* M68KITAB.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834233B1CF9C0F10088B634 /* M68KITAB.c */; };
283423651CF9C1320088B634 /* MINEM68K.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834233D1CF9C0F10088B634 /* MINEM68K.c */; };
283423661CF9C1320088B634 /* MOUSEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834233F1CF9C0F10088B634 /* MOUSEMDV.c */; };
283423671CF9C1320088B634 /* PROGMAIN.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423441CF9C0F10088B634 /* PROGMAIN.c */; };
283423681CF9C1320088B634 /* ROMEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423461CF9C0F10088B634 /* ROMEMDEV.c */; };
283423691CF9C1320088B634 /* RTCEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423481CF9C0F10088B634 /* RTCEMDEV.c */; };
2834236A1CF9C1320088B634 /* SCCEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834234A1CF9C0F10088B634 /* SCCEMDEV.c */; };
2834236B1CF9C1320088B634 /* SCRNEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834234C1CF9C0F10088B634 /* SCRNEMDV.c */; };
2834236C1CF9C1320088B634 /* SCSIEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423511CF9C0F10088B634 /* SCSIEMDV.c */; };
2834236D1CF9C1320088B634 /* SNDEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423531CF9C0F10088B634 /* SNDEMDEV.c */; };
2834236E1CF9C1320088B634 /* SONYEMDV.c in Sources */ = {isa = PBXBuildFile; fileRef = 283423551CF9C0F10088B634 /* SONYEMDV.c */; };
2834236F1CF9C1320088B634 /* VIAEMDEV.c in Sources */ = {isa = PBXBuildFile; fileRef = 2834235B1CF9C0F10088B634 /* VIAEMDEV.c */; };
28848B621CDE97D600B86C45 /* InsertDiskViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28848B611CDE97D600B86C45 /* InsertDiskViewController.m */; };
28848B651CDE97E900B86C45 /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28848B641CDE97E900B86C45 /* SettingsViewController.m */; };
28BA897E1CE7315400A98104 /* KBKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 28BA89751CE7315400A98104 /* KBKey.m */; };
@ -125,6 +125,67 @@
283422E91CF8F1C80088B634 /* EMCONFIG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EMCONFIG.h; sourceTree = "<group>"; };
283422F11CF8F5400088B634 /* Emulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Emulator.h; sourceTree = "<group>"; };
283422F21CF8F5400088B634 /* Emulator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Emulator.m; sourceTree = "<group>"; };
283423221CF9C0F10088B634 /* ACTVCODE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ACTVCODE.h; sourceTree = "<group>"; };
283423231CF9C0F10088B634 /* ADBEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = ADBEMDEV.c; sourceTree = "<group>"; };
283423241CF9C0F10088B634 /* ADBEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ADBEMDEV.h; sourceTree = "<group>"; };
283423251CF9C0F10088B634 /* ADBSHARE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ADBSHARE.h; sourceTree = "<group>"; };
283423261CF9C0F10088B634 /* ALTKEYSM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ALTKEYSM.h; sourceTree = "<group>"; };
283423271CF9C0F10088B634 /* ASCEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = ASCEMDEV.c; sourceTree = "<group>"; };
283423281CF9C0F10088B634 /* ASCEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ASCEMDEV.h; sourceTree = "<group>"; };
283423291CF9C0F10088B634 /* BPFILTER.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = BPFILTER.h; sourceTree = "<group>"; };
2834232A1CF9C0F10088B634 /* COMOSGLU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = COMOSGLU.h; sourceTree = "<group>"; };
2834232B1CF9C0F10088B634 /* CONTROLM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CONTROLM.h; sourceTree = "<group>"; };
2834232C1CF9C0F10088B634 /* DATE2SEC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = DATE2SEC.h; sourceTree = "<group>"; };
2834232D1CF9C0F10088B634 /* DISAM68K.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = DISAM68K.c; sourceTree = "<group>"; };
2834232E1CF9C0F10088B634 /* DISAM68K.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = DISAM68K.h; sourceTree = "<group>"; };
2834232F1CF9C0F10088B634 /* ENDIANAC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ENDIANAC.h; sourceTree = "<group>"; };
283423301CF9C0F10088B634 /* FB1BPP2I.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FB1BPP2I.h; sourceTree = "<group>"; };
283423311CF9C0F10088B634 /* FPCPEMDV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FPCPEMDV.h; sourceTree = "<group>"; };
283423321CF9C0F10088B634 /* FPMATHEM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FPMATHEM.h; sourceTree = "<group>"; };
283423331CF9C0F10088B634 /* FPMATHNT.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FPMATHNT.h; sourceTree = "<group>"; };
283423341CF9C0F10088B634 /* GLOBGLUE.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = GLOBGLUE.c; sourceTree = "<group>"; };
283423351CF9C0F10088B634 /* GLOBGLUE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = GLOBGLUE.h; sourceTree = "<group>"; };
283423361CF9C0F10088B634 /* INTLCHAR.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = INTLCHAR.h; sourceTree = "<group>"; };
283423371CF9C0F10088B634 /* IWMEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = IWMEMDEV.c; sourceTree = "<group>"; };
283423381CF9C0F10088B634 /* IWMEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = IWMEMDEV.h; sourceTree = "<group>"; };
283423391CF9C0F10088B634 /* KBRDEMDV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = KBRDEMDV.c; sourceTree = "<group>"; };
2834233A1CF9C0F10088B634 /* KBRDEMDV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KBRDEMDV.h; sourceTree = "<group>"; };
2834233B1CF9C0F10088B634 /* M68KITAB.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = M68KITAB.c; sourceTree = "<group>"; };
2834233C1CF9C0F10088B634 /* M68KITAB.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = M68KITAB.h; sourceTree = "<group>"; };
2834233D1CF9C0F10088B634 /* MINEM68K.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = MINEM68K.c; sourceTree = "<group>"; };
2834233E1CF9C0F10088B634 /* MINEM68K.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MINEM68K.h; sourceTree = "<group>"; };
2834233F1CF9C0F10088B634 /* MOUSEMDV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = MOUSEMDV.c; sourceTree = "<group>"; };
283423401CF9C0F10088B634 /* MOUSEMDV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MOUSEMDV.h; sourceTree = "<group>"; };
283423411CF9C0F10088B634 /* MYOSGLUE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MYOSGLUE.h; sourceTree = "<group>"; };
283423421CF9C0F10088B634 /* PMUEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = PMUEMDEV.c; sourceTree = "<group>"; };
283423431CF9C0F10088B634 /* PMUEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PMUEMDEV.h; sourceTree = "<group>"; };
283423441CF9C0F10088B634 /* PROGMAIN.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = PROGMAIN.c; sourceTree = "<group>"; };
283423451CF9C0F10088B634 /* PROGMAIN.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PROGMAIN.h; sourceTree = "<group>"; };
283423461CF9C0F10088B634 /* ROMEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = ROMEMDEV.c; sourceTree = "<group>"; };
283423471CF9C0F10088B634 /* ROMEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ROMEMDEV.h; sourceTree = "<group>"; };
283423481CF9C0F10088B634 /* RTCEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = RTCEMDEV.c; sourceTree = "<group>"; };
283423491CF9C0F10088B634 /* RTCEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RTCEMDEV.h; sourceTree = "<group>"; };
2834234A1CF9C0F10088B634 /* SCCEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = SCCEMDEV.c; sourceTree = "<group>"; };
2834234B1CF9C0F10088B634 /* SCCEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SCCEMDEV.h; sourceTree = "<group>"; };
2834234C1CF9C0F10088B634 /* SCRNEMDV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = SCRNEMDV.c; sourceTree = "<group>"; };
2834234D1CF9C0F10088B634 /* SCRNEMDV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SCRNEMDV.h; sourceTree = "<group>"; };
2834234E1CF9C0F10088B634 /* SCRNHACK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SCRNHACK.h; sourceTree = "<group>"; };
2834234F1CF9C0F10088B634 /* SCRNMAPR.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SCRNMAPR.h; sourceTree = "<group>"; };
283423501CF9C0F10088B634 /* SCRNTRNS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SCRNTRNS.h; sourceTree = "<group>"; };
283423511CF9C0F10088B634 /* SCSIEMDV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = SCSIEMDV.c; sourceTree = "<group>"; };
283423521CF9C0F10088B634 /* SCSIEMDV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SCSIEMDV.h; sourceTree = "<group>"; };
283423531CF9C0F10088B634 /* SNDEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = SNDEMDEV.c; sourceTree = "<group>"; };
283423541CF9C0F10088B634 /* SNDEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SNDEMDEV.h; sourceTree = "<group>"; };
283423551CF9C0F10088B634 /* SONYEMDV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = SONYEMDV.c; sourceTree = "<group>"; };
283423561CF9C0F10088B634 /* SONYEMDV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SONYEMDV.h; sourceTree = "<group>"; };
283423571CF9C0F10088B634 /* STRCONST.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = STRCONST.h; sourceTree = "<group>"; };
283423581CF9C0F10088B634 /* SYSDEPNS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = SYSDEPNS.h; sourceTree = "<group>"; };
283423591CF9C0F10088B634 /* VIA2EMDV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = VIA2EMDV.c; sourceTree = "<group>"; };
2834235A1CF9C0F10088B634 /* VIA2EMDV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VIA2EMDV.h; sourceTree = "<group>"; };
2834235B1CF9C0F10088B634 /* VIAEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = VIAEMDEV.c; sourceTree = "<group>"; };
2834235C1CF9C0F10088B634 /* VIAEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VIAEMDEV.h; sourceTree = "<group>"; };
2834235D1CF9C0F10088B634 /* VIDEMDEV.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = VIDEMDEV.c; sourceTree = "<group>"; };
2834235E1CF9C0F10088B634 /* VIDEMDEV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VIDEMDEV.h; sourceTree = "<group>"; };
28848B601CDE97D600B86C45 /* InsertDiskViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertDiskViewController.h; sourceTree = "<group>"; };
28848B611CDE97D600B86C45 /* InsertDiskViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InsertDiskViewController.m; sourceTree = "<group>"; };
28848B631CDE97E900B86C45 /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = "<group>"; };
@ -140,45 +201,7 @@
28BA89841CE73E7200A98104 /* TrackPad.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TrackPad.m; sourceTree = "<group>"; };
28BA89861CE73FBC00A98104 /* MNVMApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MNVMApplication.h; sourceTree = "<group>"; };
28BA89871CE73FBC00A98104 /* MNVMApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNVMApplication.m; sourceTree = "<group>"; };
28CE8E8F1CD4C3B200FE25A8 /* COMOSGLU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COMOSGLU.h; sourceTree = "<group>"; };
28CE8E911CD4C3B200FE25A8 /* DATE2SEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DATE2SEC.h; sourceTree = "<group>"; };
28CE8E921CD4C3B200FE25A8 /* ENDIANAC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ENDIANAC.h; sourceTree = "<group>"; };
28CE8E931CD4C3B200FE25A8 /* GLOBGLUE.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = GLOBGLUE.c; sourceTree = "<group>"; };
28CE8E941CD4C3B200FE25A8 /* GLOBGLUE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLOBGLUE.h; sourceTree = "<group>"; };
28CE8E961CD4C3B200FE25A8 /* IWMEMDEV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = IWMEMDEV.c; sourceTree = "<group>"; };
28CE8E971CD4C3B200FE25A8 /* IWMEMDEV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IWMEMDEV.h; sourceTree = "<group>"; };
28CE8E981CD4C3B200FE25A8 /* KBRDEMDV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = KBRDEMDV.c; sourceTree = "<group>"; };
28CE8E991CD4C3B200FE25A8 /* KBRDEMDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KBRDEMDV.h; sourceTree = "<group>"; };
28CE8E9A1CD4C3B200FE25A8 /* M68KITAB.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = M68KITAB.c; sourceTree = "<group>"; };
28CE8E9B1CD4C3B200FE25A8 /* M68KITAB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = M68KITAB.h; sourceTree = "<group>"; };
28CE8E9C1CD4C3B200FE25A8 /* MINEM68K.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = MINEM68K.c; sourceTree = "<group>"; };
28CE8E9D1CD4C3B200FE25A8 /* MINEM68K.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MINEM68K.h; sourceTree = "<group>"; };
28CE8E9E1CD4C3B200FE25A8 /* MOUSEMDV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = MOUSEMDV.c; sourceTree = "<group>"; };
28CE8E9F1CD4C3B200FE25A8 /* MOUSEMDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOUSEMDV.h; sourceTree = "<group>"; };
28CE8EA01CD4C3B200FE25A8 /* MYOSGLUE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MYOSGLUE.h; sourceTree = "<group>"; };
28CE8EA11CD4C3B200FE25A8 /* PROGMAIN.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = PROGMAIN.c; sourceTree = "<group>"; };
28CE8EA21CD4C3B200FE25A8 /* PROGMAIN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PROGMAIN.h; sourceTree = "<group>"; };
28CE8EA31CD4C3B200FE25A8 /* ROMEMDEV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ROMEMDEV.c; sourceTree = "<group>"; };
28CE8EA41CD4C3B200FE25A8 /* ROMEMDEV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ROMEMDEV.h; sourceTree = "<group>"; };
28CE8EA51CD4C3B200FE25A8 /* RTCEMDEV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = RTCEMDEV.c; sourceTree = "<group>"; };
28CE8EA61CD4C3B200FE25A8 /* RTCEMDEV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCEMDEV.h; sourceTree = "<group>"; };
28CE8EA71CD4C3B200FE25A8 /* SCCEMDEV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SCCEMDEV.c; sourceTree = "<group>"; };
28CE8EA81CD4C3B200FE25A8 /* SCCEMDEV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCCEMDEV.h; sourceTree = "<group>"; };
28CE8EA91CD4C3B200FE25A8 /* SCRNEMDV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SCRNEMDV.c; sourceTree = "<group>"; };
28CE8EAA1CD4C3B200FE25A8 /* SCRNEMDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCRNEMDV.h; sourceTree = "<group>"; };
28CE8EAB1CD4C3B200FE25A8 /* SCRNMAPR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCRNMAPR.h; sourceTree = "<group>"; };
28CE8EAC1CD4C3B200FE25A8 /* SCSIEMDV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SCSIEMDV.c; sourceTree = "<group>"; };
28CE8EAD1CD4C3B200FE25A8 /* SCSIEMDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCSIEMDV.h; sourceTree = "<group>"; };
28CE8EAE1CD4C3B200FE25A8 /* SNDEMDEV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SNDEMDEV.c; sourceTree = "<group>"; };
28CE8EAF1CD4C3B200FE25A8 /* SNDEMDEV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNDEMDEV.h; sourceTree = "<group>"; };
28CE8EB01CD4C3B200FE25A8 /* SONYEMDV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SONYEMDV.c; sourceTree = "<group>"; };
28CE8EB11CD4C3B200FE25A8 /* SONYEMDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SONYEMDV.h; sourceTree = "<group>"; };
28CE8EB21CD4C3B200FE25A8 /* SYSDEPNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SYSDEPNS.h; sourceTree = "<group>"; };
28CE8EB31CD4C3B200FE25A8 /* VIAEMDEV.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = VIAEMDEV.c; sourceTree = "<group>"; };
28CE8EB41CD4C3B200FE25A8 /* VIAEMDEV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VIAEMDEV.h; sourceTree = "<group>"; };
28CE8ECB1CD4CDC500FE25A8 /* MYOSGLUE.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MYOSGLUE.m; sourceTree = "<group>"; };
28CE8ECD1CD4D1A100FE25A8 /* STRCONST.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = STRCONST.h; sourceTree = "<group>"; };
28CE8ECF1CD4D5B900FE25A8 /* INTLCHAR.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = INTLCHAR.h; sourceTree = "<group>"; };
28CE8ED41CD4F56C00FE25A8 /* ScreenView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenView.h; sourceTree = "<group>"; };
28CE8ED51CD4F56C00FE25A8 /* ScreenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenView.m; sourceTree = "<group>"; };
28D5A3FB1CD6868E001A33F6 /* TouchScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchScreen.h; sourceTree = "<group>"; };
@ -303,15 +326,83 @@
283422F01CF8F3530088B634 /* Shared */ = {
isa = PBXGroup;
children = (
283423211CF9C0F10088B634 /* mnvm_core */,
283422D71CF8EFD80088B634 /* EmulatorProtocol.h */,
283422F11CF8F5400088B634 /* Emulator.h */,
283422F21CF8F5400088B634 /* Emulator.m */,
28CE8ECB1CD4CDC500FE25A8 /* MYOSGLUE.m */,
28CE8E8E1CD4C3B200FE25A8 /* mnvm_core */,
);
name = Shared;
sourceTree = "<group>";
};
283423211CF9C0F10088B634 /* mnvm_core */ = {
isa = PBXGroup;
children = (
283423221CF9C0F10088B634 /* ACTVCODE.h */,
283423231CF9C0F10088B634 /* ADBEMDEV.c */,
283423241CF9C0F10088B634 /* ADBEMDEV.h */,
283423251CF9C0F10088B634 /* ADBSHARE.h */,
283423261CF9C0F10088B634 /* ALTKEYSM.h */,
283423271CF9C0F10088B634 /* ASCEMDEV.c */,
283423281CF9C0F10088B634 /* ASCEMDEV.h */,
283423291CF9C0F10088B634 /* BPFILTER.h */,
2834232A1CF9C0F10088B634 /* COMOSGLU.h */,
2834232B1CF9C0F10088B634 /* CONTROLM.h */,
2834232C1CF9C0F10088B634 /* DATE2SEC.h */,
2834232D1CF9C0F10088B634 /* DISAM68K.c */,
2834232E1CF9C0F10088B634 /* DISAM68K.h */,
2834232F1CF9C0F10088B634 /* ENDIANAC.h */,
283423301CF9C0F10088B634 /* FB1BPP2I.h */,
283423311CF9C0F10088B634 /* FPCPEMDV.h */,
283423321CF9C0F10088B634 /* FPMATHEM.h */,
283423331CF9C0F10088B634 /* FPMATHNT.h */,
283423341CF9C0F10088B634 /* GLOBGLUE.c */,
283423351CF9C0F10088B634 /* GLOBGLUE.h */,
283423361CF9C0F10088B634 /* INTLCHAR.h */,
283423371CF9C0F10088B634 /* IWMEMDEV.c */,
283423381CF9C0F10088B634 /* IWMEMDEV.h */,
283423391CF9C0F10088B634 /* KBRDEMDV.c */,
2834233A1CF9C0F10088B634 /* KBRDEMDV.h */,
2834233B1CF9C0F10088B634 /* M68KITAB.c */,
2834233C1CF9C0F10088B634 /* M68KITAB.h */,
2834233D1CF9C0F10088B634 /* MINEM68K.c */,
2834233E1CF9C0F10088B634 /* MINEM68K.h */,
2834233F1CF9C0F10088B634 /* MOUSEMDV.c */,
283423401CF9C0F10088B634 /* MOUSEMDV.h */,
283423411CF9C0F10088B634 /* MYOSGLUE.h */,
283423421CF9C0F10088B634 /* PMUEMDEV.c */,
283423431CF9C0F10088B634 /* PMUEMDEV.h */,
283423441CF9C0F10088B634 /* PROGMAIN.c */,
283423451CF9C0F10088B634 /* PROGMAIN.h */,
283423461CF9C0F10088B634 /* ROMEMDEV.c */,
283423471CF9C0F10088B634 /* ROMEMDEV.h */,
283423481CF9C0F10088B634 /* RTCEMDEV.c */,
283423491CF9C0F10088B634 /* RTCEMDEV.h */,
2834234A1CF9C0F10088B634 /* SCCEMDEV.c */,
2834234B1CF9C0F10088B634 /* SCCEMDEV.h */,
2834234C1CF9C0F10088B634 /* SCRNEMDV.c */,
2834234D1CF9C0F10088B634 /* SCRNEMDV.h */,
2834234E1CF9C0F10088B634 /* SCRNHACK.h */,
2834234F1CF9C0F10088B634 /* SCRNMAPR.h */,
283423501CF9C0F10088B634 /* SCRNTRNS.h */,
283423511CF9C0F10088B634 /* SCSIEMDV.c */,
283423521CF9C0F10088B634 /* SCSIEMDV.h */,
283423531CF9C0F10088B634 /* SNDEMDEV.c */,
283423541CF9C0F10088B634 /* SNDEMDEV.h */,
283423551CF9C0F10088B634 /* SONYEMDV.c */,
283423561CF9C0F10088B634 /* SONYEMDV.h */,
283423571CF9C0F10088B634 /* STRCONST.h */,
283423581CF9C0F10088B634 /* SYSDEPNS.h */,
283423591CF9C0F10088B634 /* VIA2EMDV.c */,
2834235A1CF9C0F10088B634 /* VIA2EMDV.h */,
2834235B1CF9C0F10088B634 /* VIAEMDEV.c */,
2834235C1CF9C0F10088B634 /* VIAEMDEV.h */,
2834235D1CF9C0F10088B634 /* VIDEMDEV.c */,
2834235E1CF9C0F10088B634 /* VIDEMDEV.h */,
);
path = mnvm_core;
sourceTree = "<group>";
};
28BA896E1CE7314500A98104 /* Keyboard */ = {
isa = PBXGroup;
children = (
@ -326,51 +417,6 @@
name = Keyboard;
sourceTree = "<group>";
};
28CE8E8E1CD4C3B200FE25A8 /* mnvm_core */ = {
isa = PBXGroup;
children = (
28CE8ECF1CD4D5B900FE25A8 /* INTLCHAR.h */,
28CE8ECD1CD4D1A100FE25A8 /* STRCONST.h */,
28CE8E8F1CD4C3B200FE25A8 /* COMOSGLU.h */,
28CE8E911CD4C3B200FE25A8 /* DATE2SEC.h */,
28CE8E921CD4C3B200FE25A8 /* ENDIANAC.h */,
28CE8E931CD4C3B200FE25A8 /* GLOBGLUE.c */,
28CE8E941CD4C3B200FE25A8 /* GLOBGLUE.h */,
28CE8E961CD4C3B200FE25A8 /* IWMEMDEV.c */,
28CE8E971CD4C3B200FE25A8 /* IWMEMDEV.h */,
28CE8E981CD4C3B200FE25A8 /* KBRDEMDV.c */,
28CE8E991CD4C3B200FE25A8 /* KBRDEMDV.h */,
28CE8E9A1CD4C3B200FE25A8 /* M68KITAB.c */,
28CE8E9B1CD4C3B200FE25A8 /* M68KITAB.h */,
28CE8E9C1CD4C3B200FE25A8 /* MINEM68K.c */,
28CE8E9D1CD4C3B200FE25A8 /* MINEM68K.h */,
28CE8E9E1CD4C3B200FE25A8 /* MOUSEMDV.c */,
28CE8E9F1CD4C3B200FE25A8 /* MOUSEMDV.h */,
28CE8EA01CD4C3B200FE25A8 /* MYOSGLUE.h */,
28CE8EA11CD4C3B200FE25A8 /* PROGMAIN.c */,
28CE8EA21CD4C3B200FE25A8 /* PROGMAIN.h */,
28CE8EA31CD4C3B200FE25A8 /* ROMEMDEV.c */,
28CE8EA41CD4C3B200FE25A8 /* ROMEMDEV.h */,
28CE8EA51CD4C3B200FE25A8 /* RTCEMDEV.c */,
28CE8EA61CD4C3B200FE25A8 /* RTCEMDEV.h */,
28CE8EA71CD4C3B200FE25A8 /* SCCEMDEV.c */,
28CE8EA81CD4C3B200FE25A8 /* SCCEMDEV.h */,
28CE8EA91CD4C3B200FE25A8 /* SCRNEMDV.c */,
28CE8EAA1CD4C3B200FE25A8 /* SCRNEMDV.h */,
28CE8EAB1CD4C3B200FE25A8 /* SCRNMAPR.h */,
28CE8EAC1CD4C3B200FE25A8 /* SCSIEMDV.c */,
28CE8EAD1CD4C3B200FE25A8 /* SCSIEMDV.h */,
28CE8EAE1CD4C3B200FE25A8 /* SNDEMDEV.c */,
28CE8EAF1CD4C3B200FE25A8 /* SNDEMDEV.h */,
28CE8EB01CD4C3B200FE25A8 /* SONYEMDV.c */,
28CE8EB11CD4C3B200FE25A8 /* SONYEMDV.h */,
28CE8EB21CD4C3B200FE25A8 /* SYSDEPNS.h */,
28CE8EB31CD4C3B200FE25A8 /* VIAEMDEV.c */,
28CE8EB41CD4C3B200FE25A8 /* VIAEMDEV.h */,
);
path = mnvm_core;
sourceTree = "<group>";
};
28F676B41CD15E0B00FC6FA6 = {
isa = PBXGroup;
children = (
@ -692,7 +738,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PLUGINS_FOLDER_PATH\"\nfor name in *.framework\ndo\n mv \"$name\" \"${name%.framework}.mnvm\"\ndone\n";
shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PLUGINS_FOLDER_PATH\"\nrm -rf *.mnvm\nfor name in *.framework\ndo\n mv \"$name\" \"${name%.framework}.mnvm\"\ndone\n";
};
28F6B4CD1CF76D88002D76D0 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@ -714,23 +760,23 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2834236E1CF9C1320088B634 /* SONYEMDV.c in Sources */,
2834236F1CF9C1320088B634 /* VIAEMDEV.c in Sources */,
283423681CF9C1320088B634 /* ROMEMDEV.c in Sources */,
2834236D1CF9C1320088B634 /* SNDEMDEV.c in Sources */,
2834236C1CF9C1320088B634 /* SCSIEMDV.c in Sources */,
2834236A1CF9C1320088B634 /* SCCEMDEV.c in Sources */,
2834236B1CF9C1320088B634 /* SCRNEMDV.c in Sources */,
283422F41CF8F55E0088B634 /* Emulator.m in Sources */,
283422D81CF8F16C0088B634 /* GLOBGLUE.c in Sources */,
283422E11CF8F16C0088B634 /* SCCEMDEV.c in Sources */,
283422E01CF8F16C0088B634 /* RTCEMDEV.c in Sources */,
283422DB1CF8F16C0088B634 /* M68KITAB.c in Sources */,
283422DF1CF8F16C0088B634 /* ROMEMDEV.c in Sources */,
283422DE1CF8F16C0088B634 /* PROGMAIN.c in Sources */,
283422D91CF8F16C0088B634 /* IWMEMDEV.c in Sources */,
283422E21CF8F16C0088B634 /* SCRNEMDV.c in Sources */,
283422E61CF8F16C0088B634 /* VIAEMDEV.c in Sources */,
283422DD1CF8F16C0088B634 /* MOUSEMDV.c in Sources */,
283423611CF9C10B0088B634 /* IWMEMDEV.c in Sources */,
283422EE1CF8F2210088B634 /* MYOSGLUE.m in Sources */,
283422E31CF8F16C0088B634 /* SCSIEMDV.c in Sources */,
283422E51CF8F16C0088B634 /* SONYEMDV.c in Sources */,
283422DA1CF8F16C0088B634 /* KBRDEMDV.c in Sources */,
283422E41CF8F16C0088B634 /* SNDEMDEV.c in Sources */,
283422DC1CF8F16C0088B634 /* MINEM68K.c in Sources */,
283423661CF9C1320088B634 /* MOUSEMDV.c in Sources */,
283423601CF9C1050088B634 /* GLOBGLUE.c in Sources */,
283423631CF9C1320088B634 /* KBRDEMDV.c in Sources */,
283423651CF9C1320088B634 /* MINEM68K.c in Sources */,
283423641CF9C1320088B634 /* M68KITAB.c in Sources */,
283423671CF9C1320088B634 /* PROGMAIN.c in Sources */,
283423691CF9C1320088B634 /* RTCEMDEV.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -831,7 +877,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Mini vMac/MacPlus4M/Info.plist";
INFOPLIST_FILE = "$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
@ -839,6 +885,8 @@
PRODUCT_BUNDLE_IDENTIFIER = net.namedfork.minivmac.macplus4m;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)\" \"$(SRCROOT)/Mini vMac/mnvm_core\"";
USE_HEADERMAP = NO;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@ -854,7 +902,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Mini vMac/MacPlus4M/Info.plist";
INFOPLIST_FILE = "$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
@ -862,6 +910,8 @@
PRODUCT_BUNDLE_IDENTIFIER = net.namedfork.minivmac.macplus4m;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/Mini vMac/$(PRODUCT_NAME)\" \"$(SRCROOT)/Mini vMac/mnvm_core\"";
USE_HEADERMAP = NO;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};

View File

@ -66,11 +66,11 @@ typedef si5b si5r;
#define MySoundEnabled 1
#define MySoundRecenterSilence 0
#define kLn2SoundSampSz 4
#define kLn2SoundSampSz 3
#define dbglog_HAVE 0
#define NumDrives 16
#define NumDrives 6
#define IncludeSonyRawMode 1
#define IncludeSonyGetName 1
#define IncludeSonyNew 0

View File

@ -15,10 +15,10 @@
#define EnableMagnify 0
#define WantInitRunInBackground 0
#define WantInitNotAutoSlow 0
#define WantInitSpeedValue 1
#define NeedRequestInsertDisk 1
#define NeedDoMoreCommandsMsg 1
#define NeedDoAboutMsg 1
#define WantInitSpeedValue 2
#define NeedRequestInsertDisk 0
#define NeedDoMoreCommandsMsg 0
#define NeedDoAboutMsg 0
#define UseControlKeys 0
#define UseActvCode 0
#define EnableDemoMsg 0
@ -28,6 +28,6 @@
#define NeedIntlChars 1
#define kStrAppName "Mini vMac"
#define kAppVariationStr "minivmac-3.4.0-ios"
#define kStrCopyrightYear "2008-2016"
#define kStrCopyrightYear "2016"
#define kMaintainerName "Jesús A. Álvarez"
#define kStrHomePage "http://www.namedfork.net/minivmac/"
#define kStrHomePage "https://namedfork.net/minivmac"

394
Mini vMac/mnvm_core/ACTVCODE.h Executable file
View File

@ -0,0 +1,394 @@
/*
ACTVCODE.h
Copyright (C) 2009 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.
*/
/*
ACTiVation CODE
*/
LOCALFUNC uimr KeyFun0(uimr x, uimr y, uimr m)
{
uimr r = x + y;
if ((r >= m) || (r < x)) {
r -= m;
}
return r;
}
LOCALFUNC uimr KeyFun1(uimr x, uimr y, uimr m)
{
uimr r = 0;
uimr t = x;
uimr s = y;
while (s > 0) {
if (0 != (s & 1)) {
r = KeyFun0(r, t, m);
}
t = KeyFun0(t, t, m);
s >>= 1;
}
return r;
}
LOCALFUNC uimr KeyFun2(uimr x, uimr y, uimr m)
{
uimr r = 1;
uimr t = x;
uimr s = y;
while (s > 0) {
if (0 != (s & 1)) {
r = KeyFun1(r, t, m);
}
t = KeyFun1(t, t, m);
s >>= 1;
}
return r;
}
LOCALFUNC blnr CheckActvCode(ui3p p, blnr *Trial)
{
blnr IsOk = falseblnr;
uimr v0 = do_get_mem_long(p);
uimr v1 = do_get_mem_long(p + 4);
if (v0 > KeyCon2) {
/* v0 too big */
} else if (v1 > KeyCon4) {
/* v1 too big */
} else {
uimr t0 = KeyFun0(v0, KeyCon0, KeyCon2);
uimr t1 = KeyFun2(KeyCon1, t0, KeyCon2);
uimr t2 = KeyFun2(v1, KeyCon3, KeyCon4);
uimr t3 = KeyFun0(t2, KeyCon4 - t1, KeyCon4);
uimr t4 = KeyFun0(t3, KeyCon4 - KeyCon5, KeyCon4);
if ((0 == (t4 >> 8)) && (t4 >= KeyCon6)) {
*Trial = falseblnr;
IsOk = trueblnr;
} else if (0 == t4) {
*Trial = trueblnr;
IsOk = trueblnr;
}
}
return IsOk;
}
/* user interface */
LOCALFUNC blnr Key2Digit(int key, ui3r *r)
{
ui3r v;
switch (key) {
case MKC_0:
case MKC_KP0:
v = 0;
break;
case MKC_1:
case MKC_KP1:
v = 1;
break;
case MKC_2:
case MKC_KP2:
v = 2;
break;
case MKC_3:
case MKC_KP3:
v = 3;
break;
case MKC_4:
case MKC_KP4:
v = 4;
break;
case MKC_5:
case MKC_KP5:
v = 5;
break;
case MKC_6:
case MKC_KP6:
v = 6;
break;
case MKC_7:
case MKC_KP7:
v = 7;
break;
case MKC_8:
case MKC_KP8:
v = 8;
break;
case MKC_9:
case MKC_KP9:
v = 9;
break;
default:
return falseblnr;
break;
}
*r = v;
return trueblnr;
}
#define ActvCodeMaxLen 20
LOCALVAR ui4r ActvCodeLen = 0;
LOCALVAR ui3b ActvCodeDigits[ActvCodeMaxLen];
#define ActvCodeFileLen 8
#if UseActvFile
FORWARDFUNC tMacErr ActvCodeFileSave(ui3p p);
FORWARDFUNC tMacErr ActvCodeFileLoad(ui3p p);
#endif
LOCALVAR ui3b CurActvCode[ActvCodeFileLen];
LOCALPROC DoActvCodeModeKey(int key)
{
ui3r digit;
ui3r L;
int i;
blnr Trial;
if (MKC_BackSpace == key) {
if (ActvCodeLen > 0) {
--ActvCodeLen;
NeedWholeScreenDraw = trueblnr;
}
} else if (Key2Digit(key, &digit)) {
if (ActvCodeLen < (ActvCodeMaxLen - 1)) {
ActvCodeDigits[ActvCodeLen] = digit;
++ActvCodeLen;
NeedWholeScreenDraw = trueblnr;
L = ActvCodeDigits[0] + (1 + 9);
if (ActvCodeLen == L) {
uimr v0 = 0;
uimr v1 = 0;
for (i = 1; i < (ActvCodeDigits[0] + 1); ++i) {
v0 = v0 * 10 + ActvCodeDigits[i];
}
for (; i < ActvCodeLen; ++i) {
v1 = v1 * 10 + ActvCodeDigits[i];
}
do_put_mem_long(&CurActvCode[0], v0);
do_put_mem_long(&CurActvCode[4], v1);
if (CheckActvCode(CurActvCode, &Trial)) {
SpecialModeClr(SpclModeActvCode);
NeedWholeScreenDraw = trueblnr;
#if UseActvFile
if (Trial) {
MacMsg(
"Using temporary code.",
"Thank you for trying Mini vMac!",
falseblnr);
} else {
if (mnvm_noErr != ActvCodeFileSave(CurActvCode))
{
MacMsg("Oops",
"I could not save the activation code"
" to disk.",
falseblnr);
} else {
MacMsg("Activation succeeded.",
"Thank you!", falseblnr);
}
}
#else
MacMsg(
"Thank you for trying Mini vMac!",
"sample variation : ^v",
falseblnr);
#endif
}
} else if (ActvCodeLen > L) {
--ActvCodeLen;
}
}
}
}
LOCALPROC DrawCellsActvCodeModeBody(void)
{
#if UseActvFile
DrawCellsOneLineStr("Please enter your activation code:");
DrawCellsBlankLine();
#else
DrawCellsOneLineStr(
"To try this variation of ^p, please type these numbers:");
DrawCellsBlankLine();
DrawCellsOneLineStr("281 953 822 340");
DrawCellsBlankLine();
#endif
if (0 == ActvCodeLen) {
DrawCellsOneLineStr("?");
} else {
int i;
ui3r L = ActvCodeDigits[0] + (1 + 9);
DrawCellsBeginLine();
for (i = 0; i < L; ++i) {
if (0 == ((L - i) % 3)) {
if (0 != i) {
DrawCellAdvance(kCellSpace);
}
}
if (i < ActvCodeLen) {
DrawCellAdvance(kCellDigit0 + ActvCodeDigits[i]);
} else if (i == ActvCodeLen) {
DrawCellAdvance(kCellQuestion);
} else {
DrawCellAdvance(kCellHyphen);
}
}
DrawCellsEndLine();
if (L == ActvCodeLen) {
DrawCellsBlankLine();
DrawCellsOneLineStr(
"Sorry, this is not a valid activation code.");
}
}
#if UseActvFile
DrawCellsBlankLine();
DrawCellsOneLineStr(
"If you haven;}t obtained an activation code yet,"
" here is a temporary one:");
DrawCellsBlankLine();
DrawCellsOneLineStr("281 953 822 340");
#else
DrawCellsBlankLine();
DrawCellsOneLineStr(kStrForMoreInfo);
DrawCellsOneLineStr("http://www.gryphel.com/c/var/");
#endif
}
LOCALPROC DrawActvCodeMode(void)
{
DrawSpclMode0(
#if UseActvFile
"Activation Code",
#else
"sample variation : ^v",
#endif
DrawCellsActvCodeModeBody);
}
#if UseActvFile
LOCALPROC ClStrAppendHexNib(int *L0, ui3b *r, ui3r v)
{
if (v < 10) {
ClStrAppendChar(L0, r, kCellDigit0 + v);
} else {
ClStrAppendChar(L0, r, kCellUpA + (v - 10));
}
}
LOCALPROC ClStrAppendHexByte(int *L0, ui3b *r, ui3r v)
{
ClStrAppendHexNib(L0, r, (v >> 4) & 0x0F);
ClStrAppendHexNib(L0, r, v & 0x0F);
}
LOCALPROC ClStrAppendHexWord(int *L0, ui3b *r, ui4r v)
{
ClStrAppendHexByte(L0, r, (v >> 8) & 0xFF);
ClStrAppendHexByte(L0, r, v & 0xFF);
}
LOCALPROC ClStrAppendHexLong(int *L0, ui3b *r, ui5r v)
{
ClStrAppendHexWord(L0, r, (v >> 16) & 0xFFFF);
ClStrAppendHexWord(L0, r, v & 0xFFFF);
}
#endif
LOCALPROC CopyRegistrationStr(void)
{
ui3b ps[ClStrMaxLength];
int i;
int L;
tPbuf j;
#if UseActvFile
int L0;
ui5r sum;
ClStrFromSubstCStr(&L0, ps, "^v ");
for (i = 0; i < L0; ++i) {
ps[i] = Cell2MacAsciiMap[ps[i]];
}
L = L0;
sum = 0;
for (i = 0; i < L; ++i) {
sum += ps[i];
sum = (sum << 5) | ((sum >> (32 - 5)) & 0x1F);
sum += (sum << 8);
}
sum &= 0x1FFFFFFF;
sum = KeyFun0(sum, do_get_mem_long(&CurActvCode[0]), KeyCon4);
ClStrAppendHexLong(&L, ps, sum);
sum = KeyFun0(sum, do_get_mem_long(&CurActvCode[4]), KeyCon4);
sum = KeyFun2(sum, KeyCon3, KeyCon4);
ClStrAppendHexLong(&L, ps, sum);
for (i = L0; i < L; ++i) {
ps[i] = Cell2MacAsciiMap[ps[i]];
}
#else
ClStrFromSubstCStr(&L, ps, "^v");
for (i = 0; i < L; ++i) {
ps[i] = Cell2MacAsciiMap[ps[i]];
}
#endif
if (mnvm_noErr == PbufNew(L, &j)) {
PbufTransfer(ps, j, 0, L, trueblnr);
HTCEexport(j);
}
}
LOCALFUNC blnr ActvCodeInit(void)
{
#if UseActvFile
blnr Trial;
if ((mnvm_noErr != ActvCodeFileLoad(CurActvCode))
|| (! CheckActvCode(CurActvCode, &Trial))
|| Trial
)
#endif
{
SpecialModeSet(SpclModeActvCode);
NeedWholeScreenDraw = trueblnr;
}
return trueblnr;
}

207
Mini vMac/mnvm_core/ADBEMDEV.c Executable file
View File

@ -0,0 +1,207 @@
/*
ADBEMDEV.c
Copyright (C) 2008 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.
*/
/*
Apple Desktop Bus EMulated DEVice
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#endif
#include "ADBEMDEV.h"
#ifdef _VIA_Debug
#include <stdio.h>
#endif
IMPORTPROC ADB_ShiftOutData(ui3b v);
IMPORTFUNC ui3b ADB_ShiftInData(void);
#include "ADBSHARE.h"
LOCALVAR blnr ADB_ListenDatBuf;
LOCALVAR ui3b ADB_IndexDatBuf;
GLOBALPROC ADB_DoNewState(void)
{
ui3b state = ADB_st1 * 2 + ADB_st0;
#ifdef _VIA_Debug
fprintf(stderr, "ADB_DoNewState: %d\n", state);
#endif
{
ADB_Int = 1;
switch (state) {
case 0: /* Start a new command */
if (ADB_ListenDatBuf) {
ADB_ListenDatBuf = falseblnr;
ADB_SzDatBuf = ADB_IndexDatBuf;
ADB_EndListen();
}
ADB_TalkDatBuf = falseblnr;
ADB_IndexDatBuf = 0;
ADB_CurCmd = ADB_ShiftInData();
/* which sets interrupt, acknowleding command */
#ifdef _VIA_Debug
fprintf(stderr, "in: %d\n", ADB_CurCmd);
#endif
switch ((ADB_CurCmd >> 2) & 3) {
case 0: /* reserved */
switch (ADB_CurCmd & 3) {
case 0: /* Send Reset */
ADB_DoReset();
break;
case 1: /* Flush */
ADB_Flush();
break;
case 2: /* reserved */
case 3: /* reserved */
ReportAbnormal("Reserved ADB command");
break;
}
break;
case 1: /* reserved */
ReportAbnormal("Reserved ADB command");
break;
case 2: /* listen */
ADB_ListenDatBuf = trueblnr;
#ifdef _VIA_Debug
fprintf(stderr, "*** listening\n");
#endif
break;
case 3: /* talk */
ADB_DoTalk();
break;
}
break;
case 1: /* Transfer date byte (even) */
case 2: /* Transfer date byte (odd) */
if (! ADB_ListenDatBuf) {
/*
will get here even if no pending talk data,
when there is pending event from device
other than the one polled by the last talk
command. this probably indicates a bug.
*/
if ((! ADB_TalkDatBuf)
|| (ADB_IndexDatBuf >= ADB_SzDatBuf))
{
ADB_ShiftOutData(0xFF);
ADB_Data = 1;
ADB_Int = 0;
} else {
#ifdef _VIA_Debug
fprintf(stderr, "*** talk one\n");
#endif
ADB_ShiftOutData(ADB_DatBuf[ADB_IndexDatBuf]);
ADB_Data = 1;
ADB_IndexDatBuf += 1;
}
} else {
if (ADB_IndexDatBuf >= ADB_MaxSzDatBuf) {
ReportAbnormal("ADB listen too much");
/* ADB_MaxSzDatBuf isn't big enough */
(void) ADB_ShiftInData();
} else {
#ifdef _VIA_Debug
fprintf(stderr, "*** listen one\n");
#endif
ADB_DatBuf[ADB_IndexDatBuf] = ADB_ShiftInData();
ADB_IndexDatBuf += 1;
}
}
break;
case 3: /* idle */
if (ADB_ListenDatBuf) {
ReportAbnormal("ADB idle follows listen");
/* apparently doesn't happen */
}
if (ADB_TalkDatBuf) {
if (ADB_IndexDatBuf != 0) {
ReportAbnormal("idle when not done talking");
}
ADB_ShiftOutData(0xFF);
/* ADB_Int = 0; */
} else if (CheckForADBanyEvt()) {
if (((ADB_CurCmd >> 2) & 3) == 3) {
ADB_DoTalk();
}
ADB_ShiftOutData(0xFF);
/* ADB_Int = 0; */
}
break;
}
}
}
GLOBALPROC ADBstate_ChangeNtfy(void)
{
#ifdef _VIA_Debug
fprintf(stderr, "ADBstate_ChangeNtfy: %d, %d, %d\n",
ADB_st1, ADB_st0, GetCuriCount());
#endif
ICT_add(kICT_ADB_NewState,
348160UL * kCycleScale / 64 * kMyClockMult);
/*
Macintosh Family Hardware Reference say device "must respond
to talk command within 260 microseconds", which translates
to about 190 instructions. But haven't seen much problems
even for very large values (tens of thousands), and do see
problems for small values. 50 is definitely too small,
mouse doesn't move smoothly. There may still be some
signs of this problem with 150.
On the other hand, how fast the device must respond may
not be related to how fast the ADB transceiver responds.
*/
}
GLOBALPROC ADB_DataLineChngNtfy(void)
{
#ifdef _VIA_Debug
fprintf(stderr, "ADB_DataLineChngNtfy: %d\n", ADB_Data);
#endif
}
GLOBALPROC ADB_Update(void)
{
ui3b state = ADB_st1 * 2 + ADB_st0;
if (state == 3) { /* idle */
if (ADB_TalkDatBuf) {
/* ignore, presumably being taken care of */
} else if (CheckForADBanyEvt())
{
if (((ADB_CurCmd >> 2) & 3) == 3) {
ADB_DoTalk();
}
ADB_ShiftOutData(0xFF);
/*
Wouldn't expect this would be needed unless
there is actually talk data. But without it,
ADB never polls the other devices. Clearing
ADB_Int has no effect.
*/
/*
ADB_Int = 0;
seems to have no effect, which probably indicates a bug
*/
}
}
}

27
Mini vMac/mnvm_core/ADBEMDEV.h Executable file
View File

@ -0,0 +1,27 @@
/*
ADBEMDEV.h
Copyright (C) 2008 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.
*/
#ifdef ADBEMDEV_H
#error "header already included"
#else
#define ADBEMDEV_H
#endif
EXPORTPROC ADBstate_ChangeNtfy(void);
EXPORTPROC ADB_DoNewState(void);
EXPORTPROC ADB_DataLineChngNtfy(void);
EXPORTPROC ADB_Update(void);

277
Mini vMac/mnvm_core/ADBSHARE.h Executable file
View File

@ -0,0 +1,277 @@
/*
ADBSHARE.h
Copyright (C) 2008 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.
*/
/*
Apple Desktop Bus SHAREd code
shared by emulation of different implementations of ADB
*/
#ifdef ADBSHARE_H
#error "header already included"
#else
#define ADBSHARE_H
#endif
#define ADB_MaxSzDatBuf 8
LOCALVAR ui3b ADB_SzDatBuf;
LOCALVAR blnr ADB_TalkDatBuf = falseblnr;
LOCALVAR ui3b ADB_DatBuf[ADB_MaxSzDatBuf];
LOCALVAR ui3b ADB_CurCmd = 0;
LOCALVAR ui3b NotSoRandAddr = 1;
LOCALVAR ui3b MouseADBAddress;
LOCALVAR blnr SavedCurMouseButton = falseblnr;
LOCALVAR ui4r MouseADBDeltaH = 0;
LOCALVAR ui4r MouseADBDeltaV = 0;
LOCALPROC ADB_DoMouseTalk(void)
{
switch (ADB_CurCmd & 3) {
case 0:
{
blnr overflow = falseblnr;
ui4b partH;
ui4b partV;
blnr MouseButtonChange = falseblnr;
MyEvtQEl *p = MyEvtQOutP();
if (nullpr != p) {
if (MyEvtQElKindMouseDelta == p->kind) {
MouseADBDeltaH += p->u.pos.h;
MouseADBDeltaV += p->u.pos.v;
MyEvtQOutDone();
}
}
partH = MouseADBDeltaH;
partV = MouseADBDeltaV;
if ((si4b)MouseADBDeltaH < 0) {
partH = - partH;
}
if ((si4b)MouseADBDeltaV < 0) {
partV = - partV;
}
if ((partH >> 6) > 0) {
overflow = trueblnr;
partH = (1 << 6) - 1;
}
if ((partV >> 6) > 0) {
overflow = trueblnr;
partV = (1 << 6) - 1;
}
if ((si4b)MouseADBDeltaH < 0) {
partH = - partH;
}
if ((si4b)MouseADBDeltaV < 0) {
partV = - partV;
}
MouseADBDeltaH -= partH;
MouseADBDeltaV -= partV;
if (! overflow) {
MyEvtQEl *p = MyEvtQOutP();
if (nullpr != p) {
if (MyEvtQElKindMouseButton == p->kind) {
SavedCurMouseButton = p->u.press.down;
MouseButtonChange = trueblnr;
MyEvtQOutDone();
}
}
}
if ((0 != partH) || (0 != partV) || MouseButtonChange) {
ADB_SzDatBuf = 2;
ADB_TalkDatBuf = trueblnr;
ADB_DatBuf[0] = (SavedCurMouseButton ? 0x00 : 0x80)
| (partV & 127);
ADB_DatBuf[1] = /* 0x00 */ 0x80 | (partH & 127);
}
}
ADBMouseDisabled = 0;
break;
case 3:
ADB_SzDatBuf = 2;
ADB_TalkDatBuf = trueblnr;
ADB_DatBuf[0] = 0x60 | (NotSoRandAddr & 0x0f);
ADB_DatBuf[1] = 0x01;
NotSoRandAddr += 1;
break;
default:
ReportAbnormal("Talk to unknown mouse register");
break;
}
}
LOCALPROC ADB_DoMouseListen(void)
{
switch (ADB_CurCmd & 3) {
case 3:
if (ADB_DatBuf[1] == 0xFE) {
/* change address */
MouseADBAddress = (ADB_DatBuf[0] & 0x0F);
} else {
ReportAbnormal("unknown listen op to mouse register 3");
}
break;
default:
ReportAbnormal("listen to unknown mouse register");
break;
}
}
LOCALVAR ui3b KeyboardADBAddress;
LOCALFUNC blnr CheckForADBkeyEvt(ui3b *NextADBkeyevt)
{
int i;
blnr KeyDown;
if (! FindKeyEvent(&i, &KeyDown)) {
return falseblnr;
} else {
switch (i) {
case MKC_Control:
i = 0x36;
break;
case MKC_Left:
i = 0x3B;
break;
case MKC_Right:
i = 0x3C;
break;
case MKC_Down:
i = 0x3D;
break;
case MKC_Up:
i = 0x3E;
break;
default:
/* unchanged */
break;
}
*NextADBkeyevt = (KeyDown ? 0x00 : 0x80) | i;
return trueblnr;
}
}
LOCALPROC ADB_DoKeyboardTalk(void)
{
switch (ADB_CurCmd & 3) {
case 0:
{
ui3b NextADBkeyevt;
if (CheckForADBkeyEvt(&NextADBkeyevt)) {
ADB_SzDatBuf = 2;
ADB_TalkDatBuf = trueblnr;
ADB_DatBuf[0] = NextADBkeyevt;
if (! CheckForADBkeyEvt(&NextADBkeyevt)) {
ADB_DatBuf[1] = 0xFF;
} else {
ADB_DatBuf[1] = NextADBkeyevt;
}
}
}
break;
case 3:
ADB_SzDatBuf = 2;
ADB_TalkDatBuf = trueblnr;
ADB_DatBuf[0] = 0x60 | (NotSoRandAddr & 0x0f);
ADB_DatBuf[1] = 0x01;
NotSoRandAddr += 1;
break;
default:
ReportAbnormal("Talk to unknown keyboard register");
break;
}
}
LOCALPROC ADB_DoKeyboardListen(void)
{
switch (ADB_CurCmd & 3) {
case 3:
if (ADB_DatBuf[1] == 0xFE) {
/* change address */
KeyboardADBAddress = (ADB_DatBuf[0] & 0x0F);
} else {
ReportAbnormal(
"unknown listen op to keyboard register 3");
}
break;
default:
ReportAbnormal("listen to unknown keyboard register");
break;
}
}
LOCALFUNC blnr CheckForADBanyEvt(void)
{
MyEvtQEl *p = MyEvtQOutP();
if (nullpr != p) {
switch (p->kind) {
case MyEvtQElKindMouseButton:
case MyEvtQElKindMouseDelta:
case MyEvtQElKindKey:
return trueblnr;
break;
default:
break;
}
}
return (0 != MouseADBDeltaH) && (0 != MouseADBDeltaV);
}
LOCALPROC ADB_DoTalk(void)
{
ui3b Address = ADB_CurCmd >> 4;
if (Address == MouseADBAddress) {
ADB_DoMouseTalk();
} else if (Address == KeyboardADBAddress) {
ADB_DoKeyboardTalk();
}
}
LOCALPROC ADB_EndListen(void)
{
ui3b Address = ADB_CurCmd >> 4;
if (Address == MouseADBAddress) {
ADB_DoMouseListen();
} else if (Address == KeyboardADBAddress) {
ADB_DoKeyboardListen();
}
}
LOCALPROC ADB_DoReset(void)
{
MouseADBAddress = 3;
KeyboardADBAddress = 2;
}
LOCALPROC ADB_Flush(void)
{
ui3b Address = ADB_CurCmd >> 4;
if ((Address == KeyboardADBAddress)
|| (Address == MouseADBAddress))
{
ADB_SzDatBuf = 2;
ADB_TalkDatBuf = trueblnr;
ADB_DatBuf[0] = 0x00;
ADB_DatBuf[1] = 0x00;
} else {
ReportAbnormal("Unhandled ADB Flush");
}
}

209
Mini vMac/mnvm_core/ALTKEYSM.h Executable file
View File

@ -0,0 +1,209 @@
/*
ALTKEYSM.h
Copyright (C) 2007 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.
*/
/*
ALTernate KEYs Mode
*/
#ifdef ALTKEYSM_H
#error "header already included"
#else
#define ALTKEYSM_H
#endif
LOCALVAR blnr AltKeysLockText = falseblnr;
LOCALVAR blnr AltKeysTrueCmnd = falseblnr;
LOCALVAR blnr AltKeysTrueOption = falseblnr;
LOCALVAR blnr AltKeysTrueShift = falseblnr;
LOCALVAR blnr AltKeysModOn = falseblnr;
LOCALVAR blnr AltKeysTextOn = falseblnr;
LOCALPROC CheckAltKeyUseMode(void)
{
blnr NewAltKeysTextOn;
AltKeysModOn = AltKeysTrueCmnd
|| AltKeysTrueOption || AltKeysTrueShift;
NewAltKeysTextOn = AltKeysLockText || AltKeysModOn;
if (NewAltKeysTextOn != AltKeysTextOn) {
DisconnectKeyCodes(kKeepMaskControl | kKeepMaskCapsLock
| (AltKeysTrueCmnd ? kKeepMaskCommand : 0)
| (AltKeysTrueOption ? kKeepMaskOption : 0)
| (AltKeysTrueShift ? kKeepMaskShift : 0));
AltKeysTextOn = NewAltKeysTextOn;
}
}
LOCALPROC Keyboard_UpdateKeyMap1(int key, blnr down)
{
if (MKC_Command == key) {
AltKeysTrueCmnd = down;
CheckAltKeyUseMode();
Keyboard_UpdateKeyMap(key, down);
} else if (MKC_Option == key) {
AltKeysTrueOption = down;
CheckAltKeyUseMode();
Keyboard_UpdateKeyMap(key, down);
} else if (MKC_Shift == key) {
AltKeysTrueShift = down;
CheckAltKeyUseMode();
Keyboard_UpdateKeyMap(key, down);
} else if (MKC_SemiColon == key) {
if (down && ! AltKeysModOn) {
if (AltKeysLockText) {
AltKeysLockText = falseblnr;
NeedWholeScreenDraw = trueblnr;
SpecialModeClr(SpclModeAltKeyText);
CheckAltKeyUseMode();
}
} else {
Keyboard_UpdateKeyMap(key, down);
}
} else if (AltKeysTextOn) {
Keyboard_UpdateKeyMap(key, down);
} else if (MKC_M == key) {
if (down) {
if (! AltKeysLockText) {
AltKeysLockText = trueblnr;
SpecialModeSet(SpclModeAltKeyText);
NeedWholeScreenDraw = trueblnr;
CheckAltKeyUseMode();
}
}
} else {
switch (key) {
case MKC_A:
key = MKC_SemiColon;
break;
case MKC_B:
key = MKC_BackSlash;
break;
case MKC_C:
key = MKC_F3;
break;
case MKC_D:
key = MKC_Option;
break;
case MKC_E:
key = MKC_BackSpace;
break;
case MKC_F:
key = MKC_Command;
break;
case MKC_G:
key = MKC_Enter;
break;
case MKC_H:
key = MKC_Equal;
break;
case MKC_I:
key = MKC_Up;
break;
case MKC_J:
key = MKC_Left;
break;
case MKC_K:
key = MKC_Down;
break;
case MKC_L:
key = MKC_Right;
break;
case MKC_M:
/* handled above */
break;
case MKC_N:
key = MKC_Minus;
break;
case MKC_O:
key = MKC_RightBracket;
break;
case MKC_P:
return; /* none */
break;
case MKC_Q:
key = MKC_Grave;
break;
case MKC_R:
key = MKC_Return;
break;
case MKC_S:
key = MKC_Shift;
break;
case MKC_T:
key = MKC_Tab;
break;
case MKC_U:
key = MKC_LeftBracket;
break;
case MKC_V:
key = MKC_F4;
break;
case MKC_W:
return; /* none */
break;
case MKC_X:
key = MKC_F2;
break;
case MKC_Y:
key = MKC_Escape;
break;
case MKC_Z:
key = MKC_F1;
break;
default:
break;
}
Keyboard_UpdateKeyMap(key, down);
}
}
LOCALPROC DisconnectKeyCodes1(ui5b KeepMask)
{
DisconnectKeyCodes(KeepMask);
if (! (0 != (KeepMask & kKeepMaskCommand))) {
AltKeysTrueCmnd = falseblnr;
}
if (! (0 != (KeepMask & kKeepMaskOption))) {
AltKeysTrueOption = falseblnr;
}
if (! (0 != (KeepMask & kKeepMaskShift))) {
AltKeysTrueShift = falseblnr;
}
AltKeysModOn = AltKeysTrueCmnd
|| AltKeysTrueOption || AltKeysTrueShift;
AltKeysTextOn = AltKeysLockText || AltKeysModOn;
}
LOCALPROC DrawAltKeyMode(void)
{
int i;
CurCellv0 = ControlBoxv0;
CurCellh0 = ControlBoxh0;
DrawCellAdvance(kInsertText00);
for (i = (ControlBoxw - 4) / 2; --i >= 0; ) {
DrawCellAdvance(kInsertText04);
}
DrawCellAdvance(kInsertText01);
DrawCellAdvance(kInsertText02);
for (i = (ControlBoxw - 4) / 2; --i >= 0; ) {
DrawCellAdvance(kInsertText04);
}
DrawCellAdvance(kInsertText03);
}

414
Mini vMac/mnvm_core/ASCEMDEV.c Executable file
View File

@ -0,0 +1,414 @@
/*
ASCEMDEV.c
Copyright (C) 2008 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.
*/
/*
Apple Sound Chip EMulated DEVice
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "ENDIANAC.h"
#include "MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "VIAEMDEV.h"
#endif
#include "ASCEMDEV.h"
LOCALVAR ui3r SoundReg801 = 0;
LOCALVAR ui3r SoundReg802 = 0;
LOCALVAR ui3r SoundReg803 = 0;
LOCALVAR ui3r SoundReg804 = 0;
LOCALVAR ui3r SoundReg805 = 0;
LOCALVAR ui3r SoundReg_Volume = 0; /* 0x806 */
LOCALVAR ui3r SoundReg807 = 0;
LOCALVAR ui4r ASC_InputIndex = 0;
LOCALVAR ui3b ASC_SampBuff[0x800];
struct ASC_ChanR {
ui3b freq[0x800];
ui5r phase;
};
typedef struct ASC_ChanR ASC_ChanR;
LOCALVAR ASC_ChanR ASC_ChanA[4];
#define ASC_dolog (dbglog_HAVE && 0)
GLOBALFUNC ui5b ASC_Access(ui5b Data, blnr WriteMem, CPTR addr)
{
if (addr < 0x800) {
if (WriteMem) {
if ((1 == SoundReg801) && (2 == SoundReg802)) {
if ((2 * 370) == (ASC_InputIndex & 0x3FF)) {
SoundReg804 |= 0x08;
} else {
ui4r j = (addr & 0x400) | (ASC_InputIndex & 0x3FF);
++ASC_InputIndex;
ASC_SampBuff[j] = Data;
#if ASC_dolog && 0
dbglog_AddrAccess("ASC_Access SampBuff.wrap",
Data, WriteMem, j);
#endif
#if 1
if ((2 * 370) == (ASC_InputIndex & 0x3FF)) {
SoundReg804 |= 0x08;
}
#endif
}
#if ASC_dolog && 0
dbglog_writeCStr("ASC_InputIndex =");
dbglog_writeNum(ASC_InputIndex);
dbglog_writeReturn();
#endif
} else {
ASC_SampBuff[addr] = Data;
}
} else {
Data = ASC_SampBuff[addr];
}
#if ASC_dolog && 1
#if 1
if (((addr & 0x1FF) >= 0x04)
&& ((addr & 0x1FF) < (0x200 - 0x04)))
{
/* don't report them all */
} else
#endif
{
dbglog_AddrAccess("ASC_Access SampBuff",
Data, WriteMem, addr);
}
#endif
} else if (addr < 0x810) {
switch (addr) {
case 0x800: /* CONTROL */
if (WriteMem) {
} else {
Data = 0;
}
break;
case 0x801: /* ENABLE */
if (WriteMem) {
SoundReg801 = Data;
} else {
Data = SoundReg801;
}
break;
case 0x802: /* MODE */
if (WriteMem) {
SoundReg802 = Data;
} else {
Data = SoundReg802;
}
break;
case 0x803:
if (WriteMem) {
SoundReg803 = Data;
} else {
Data = SoundReg803;
}
break;
case 0x804:
if (WriteMem) {
SoundReg804 = Data;
} else {
Data = SoundReg804;
SoundReg804 = 0;
}
break;
case 0x805:
if (WriteMem) {
SoundReg805 = Data;
} else {
Data = SoundReg805;
}
break;
case 0x806: /* VOLUME */
if (WriteMem) {
SoundReg_Volume = Data >> 5;
if (0 != (Data & 0x1F)) {
ReportAbnormal("ASC - unexpected volume value");
}
} else {
Data = SoundReg_Volume << 5;
ReportAbnormal("ASC - reading volume register");
}
break;
case 0x807: /* CHAN */
if (WriteMem) {
SoundReg807 = Data;
} else {
Data = SoundReg807;
}
break;
default:
if (WriteMem) {
} else {
Data = 0;
}
break;
}
#if ASC_dolog && 1
if (addr != 0x804) {
dbglog_AddrAccess("ASC_Access Control",
Data, WriteMem, addr);
}
#endif
} else if (addr < 0x830) {
ui3r b = addr & 3;
ui3r chan = ((addr - 0x810) >> 3) & 3;
if (0 != (addr & 4)) {
if (WriteMem) {
ASC_ChanA[chan].freq[b] = Data;
} else {
Data = ASC_ChanA[chan].freq[b];
}
#if ASC_dolog && 1
dbglog_AddrAccess("ASC_Access Control",
Data, WriteMem, addr);
#endif
#if ASC_dolog && 0
dbglog_writeCStr("freq b=");
dbglog_writeNum(WriteMem);
dbglog_writeCStr(", chan=");
dbglog_writeNum(chan);
dbglog_writeReturn();
#endif
} else {
#if ASC_dolog && 1
dbglog_AddrAccess("ASC_Access Control *** unknown reg",
Data, WriteMem, addr);
#endif
}
} else if (addr < 0x838) {
#if ASC_dolog && 1
dbglog_AddrAccess("ASC_Access Control *** unknown reg",
Data, WriteMem, addr);
#endif
} else {
#if ASC_dolog && 1
dbglog_AddrAccess("ASC_Access Control ? *** unknown reg",
Data, WriteMem, addr);
#endif
ReportAbnormal("unknown ASC reg");
}
return Data;
}
/*
approximate volume levels of vMac, so:
x * vol_mult[SoundVolume] >> 16
+ vol_offset[SoundVolume]
= {approx} (x - kCenterSound) / (8 - SoundVolume) + kCenterSound;
*/
LOCALVAR const ui4b vol_mult[] = {
8192, 9362, 10922, 13107, 16384, 21845, 32768
};
LOCALVAR const trSoundSamp vol_offset[] = {
#if 3 == kLn2SoundSampSz
112, 110, 107, 103, 96, 86, 64, 0
#elif 4 == kLn2SoundSampSz
28672, 28087, 27307, 26215, 24576, 21846, 16384, 0
#else
#error "unsupported kLn2SoundSampSz"
#endif
};
LOCALVAR const ui4b SubTick_offset[kNumSubTicks] = {
0, 23, 46, 69, 92, 115, 138, 161,
185, 208, 231, 254, 277, 300, 323, 346
};
LOCALVAR const ui3r SubTick_n[kNumSubTicks] = {
23, 23, 23, 23, 23, 23, 23, 24,
23, 23, 23, 23, 23, 23, 23, 24
};
#if MySoundEnabled
LOCALVAR ui5b SoundPhase = 0;
#endif
#ifdef ASC_interrupt_PulseNtfy
IMPORTPROC ASC_interrupt_PulseNtfy(void);
#endif
#if MySoundEnabled
GLOBALPROC MacSound_SubTick(int SubTick)
{
ui4r actL;
tpSoundSamp p;
ui4r i;
ui4r j = 0;
ui4r n = SubTick_n[SubTick];
ui3b SoundVolume = SoundReg_Volume;
label_retry:
p = MySound_BeginWrite(n, &actL);
if (actL > 0) {
if (1 == SoundReg801) {
ui5b StartOffset = SubTick_offset[SubTick] + j;
ui3p addr = ASC_SampBuff + (2 * StartOffset);
if (2 == SoundReg802) {
addr += /* 0x400 */ 1;
}
for (i = 0; i < actL; i++) {
/* Copy sound data, high byte of each word */
#if ASC_dolog && 1
dbglog_StartLine();
dbglog_writeCStr("out sound ");
dbglog_writeCStr("[");
dbglog_writeHex(StartOffset + i);
dbglog_writeCStr("]");
dbglog_writeCStr(" = ");
dbglog_writeHex(*addr);
dbglog_writeReturn();
#endif
*p++ = *addr
#if 4 == kLn2SoundSampSz
<< 8
#endif
;
/* Move the address on */
*addr = 0x80;
addr += 2;
}
} else if (2 == SoundReg801) {
ui4r v;
ui4r i0;
ui4r i1;
ui4r i2;
ui4r i3;
ui5r freq0 = do_get_mem_long(ASC_ChanA[0].freq);
ui5r freq1 = do_get_mem_long(ASC_ChanA[1].freq);
ui5r freq2 = do_get_mem_long(ASC_ChanA[2].freq);
ui5r freq3 = do_get_mem_long(ASC_ChanA[3].freq);
#if ASC_dolog && 0
dbglog_writeCStr("freq0=");
dbglog_writeNum(freq0);
dbglog_writeCStr(", freq1=");
dbglog_writeNum(freq1);
dbglog_writeCStr(", freq2=");
dbglog_writeNum(freq2);
dbglog_writeCStr(", freq3=");
dbglog_writeNum(freq3);
dbglog_writeReturn();
#endif
for (i = 0; i < actL; i++) {
ASC_ChanA[0].phase += freq0;
ASC_ChanA[1].phase += freq1;
ASC_ChanA[2].phase += freq2;
ASC_ChanA[3].phase += freq3;
#if 1
i0 = ((ASC_ChanA[0].phase + 0x4000) >> 15) & 0x1FF;
i1 = ((ASC_ChanA[1].phase + 0x4000) >> 15) & 0x1FF;
i2 = ((ASC_ChanA[2].phase + 0x4000) >> 15) & 0x1FF;
i3 = ((ASC_ChanA[3].phase + 0x4000) >> 15) & 0x1FF;
#else
i0 = ((ASC_ChanA[0].phase + 0x8000) >> 16) & 0x1FF;
i1 = ((ASC_ChanA[1].phase + 0x8000) >> 16) & 0x1FF;
i2 = ((ASC_ChanA[2].phase + 0x8000) >> 16) & 0x1FF;
i3 = ((ASC_ChanA[3].phase + 0x8000) >> 16) & 0x1FF;
#endif
v = ASC_SampBuff[i0]
+ ASC_SampBuff[0x0200 + i1]
+ ASC_SampBuff[0x0400 + i2]
+ ASC_SampBuff[0x0600 + i3];
#if ASC_dolog && 1
dbglog_StartLine();
dbglog_writeCStr("i0=");
dbglog_writeNum(i0);
dbglog_writeCStr(", i1=");
dbglog_writeNum(i1);
dbglog_writeCStr(", i2=");
dbglog_writeNum(i2);
dbglog_writeCStr(", i3=");
dbglog_writeNum(i3);
dbglog_writeCStr(", output sound v=");
dbglog_writeNum(v);
dbglog_writeReturn();
#endif
*p++ = (v >> 2);
++SoundPhase;
SoundPhase &= 0x1FF;
}
} else {
for (i = 0; i < actL; i++) {
*p++ = kCenterSound;
}
}
if (SoundVolume < 7) {
/*
Usually have volume at 7, so this
is just for completeness.
*/
ui5b mult = (ui5b)vol_mult[SoundVolume];
trSoundSamp offset = vol_offset[SoundVolume];
p -= actL;
for (i = 0; i < actL; i++) {
*p = (trSoundSamp)((ui5b)(*p) * mult >> 16) + offset;
++p;
}
}
MySound_EndWrite(actL);
n -= actL;
j += actL;
if (n > 0) {
goto label_retry;
}
}
}
#endif
GLOBALPROC ASC_Update(void)
{
if (1 == SoundReg801) {
ASC_InputIndex = 0;
SoundReg804 |= 0x04;
#ifdef ASC_interrupt_PulseNtfy
ASC_interrupt_PulseNtfy();
#endif
#if ASC_dolog && 1
dbglog_StartLine();
dbglog_writeCStr("called ASC_interrupt_PulseNtfy");
dbglog_writeReturn();
#endif
}
}

28
Mini vMac/mnvm_core/ASCEMDEV.h Executable file
View File

@ -0,0 +1,28 @@
/*
ASCEMDEV.h
Copyright (C) 2008 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.
*/
#ifdef ASCEMDEV_H
#error "header already included"
#else
#define ASCEMDEV_H
#endif
EXPORTFUNC ui5b ASC_Access(ui5b Data, blnr WriteMem, CPTR addr);
#if MySoundEnabled
EXPORTPROC MacSound_SubTick(int SubTick);
#endif
EXPORTPROC ASC_Update(void);

362
Mini vMac/mnvm_core/BPFILTER.h Executable file
View File

@ -0,0 +1,362 @@
/*
BPFILTER.h
Copyright (C) 2012 Michael Fort, 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.
*/
/*
Berkeley Packet Filter for localtalk emulation
*/
/* BPF and devices */
static unsigned char device_address[6] = {
0
};
static unsigned int device_buffer_size = 0;
static int fd = -1; /* BPF file descriptor */
static struct bpf_version bpf_version;
static struct bpf_program bpf_program;
static struct bpf_insn insns[] =
{
/* Program for BPF to filter out non-LTOE packets */
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0x809B, 0, 1),
BPF_STMT(BPF_RET + BPF_K, 65535),
BPF_STMT(BPF_RET + BPF_K, 0),
};
GLOBALVAR ui3p LT_TxBuffer = NULL;
/* Transmit state */
GLOBALVAR ui4r LT_TxBuffSz = 0;
/*
Transmit buffer that is reused from tx packet to tx packet.
The 's' byte represents the source mac address (ours) and we don't
have to initialize it because the MAC device will automatically
fill it in for us. The four 'p' bytes represent the process number
of this Mini vMac application. It helps differentiate packets
between two applications running on the same machine. It is not
used at this time. There is a small chance two applications could
get the same LLAP/SDLC address to start with and would not work
correctly (1 in 254). The 'S' bytes are the size of the LLAP packet
since it can be smaller than the minimum sized Ethernet frame.
The process number is replaced at initialization. The size is
updated just before sending to BPF. All LLAP data is inserted
starting at byte 20.
*/
static unsigned char tx_buffer[20 + LT_TxBfMxSz] =
"\xFF\xFF\xFF\xFF\xFF\xFFssssss\x80\x9BppppSS";
/* Receive state */
GLOBALVAR ui3p LT_RxBuffer = NULL;
/* When data pending, this is used */
GLOBALVAR ui5r LT_RxBuffSz = 0;
/* When data pending, this is used */
/* Macro used by only the get_sockaddrs function for readability. */
#define ROUNDUP(a, size) \
(((a) & ((size) - 1)) ? (1 + ((a) | ((size) - 1))) : (a))
/*
Utility function needed for walking the addresses of the
kernel route lookup
*/
LOCALPROC get_sockaddrs(int addrs, struct sockaddr* sa,
struct sockaddr** rti_info)
{
int loop;
int incr;
for (loop = 0; loop < RTAX_MAX; loop++) {
if (addrs & (1 << loop)) {
rti_info[loop] = sa;
incr = sa->sa_len ? ROUNDUP(sa->sa_len, sizeof(uint32_t))
: sizeof(uint32_t);
sa = (struct sockaddr*)((unsigned long int)sa + incr);
} else {
rti_info[loop] = NULL;
}
}
}
/*
This ugly function does a lot of steps to prepare the BPF
for our use.
1. Find the ethernet interface that the default route uses.
2. Determine the maximum number of BPF devices can exist.
3. Search for a usable BPF device and open it.
4. Set the BPF device to use our ethernet interface.
5. Get the proper buffer size to use with the BPF device.
6. Set some useful modes of operation on the BPF device.
7. Install a program on the device that filters out non-LTOE
packets.
*/
LOCALFUNC int get_ethernet(void)
{
int result;
int size;
struct rt_msghdr* message;
struct sockaddr_in* addrs;
struct sockaddr* sa_list[RTAX_MAX];
int loop;
char filename[64];
struct ifreq ifreq;
int enable = 1;
struct kinfo_proc kp;
size_t len = sizeof(kp);
int max = 4;
char device[32];
/* Get a socket to routed for IPv4 */
fd = socket(PF_ROUTE, SOCK_RAW, AF_INET);
if (fd == -1) {
return falseblnr;
}
/* Allocate a message */
size = sizeof(struct rt_msghdr) + 16 * sizeof(struct sockaddr_in);
message = (struct rt_msghdr*)malloc(size);
if (! message) {
close(fd);
return falseblnr;
}
memset(message, 0, size);
addrs = (struct sockaddr_in*)(message + 1);
/* Fill in the request */
message->rtm_msglen = size;
message->rtm_version = RTM_VERSION;
message->rtm_type = RTM_GET;
message->rtm_addrs
= RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_IFP | RTA_IFA;
addrs->sin_len = sizeof(struct sockaddr_in);
addrs->sin_family = AF_INET;
addrs->sin_addr.s_addr = 0; /* 0.0.0.0 is default route */
/* Send the message to the kernel */
result = write(fd, message, size);
if (result < 0) {
close(fd);
free(message);
return falseblnr;
}
/* Read the result from the kernel */
result = read(fd, message, size);
if (result < 0) {
close(fd);
free(message);
return falseblnr;
}
/* Close the route socket */
close(fd);
/* Get pointer to the result then parse it */
struct sockaddr* sa = (struct sockaddr*)
((unsigned long int)message + sizeof(struct rt_msghdr));
get_sockaddrs(message->rtm_addrs, sa, sa_list);
/* Must have a LINK (Ethernet) */
if ((! sa_list[RTAX_IFP])
|| (sa_list[RTAX_IFP]->sa_family != AF_LINK))
{
return falseblnr;
}
int namelen;
int addrlen;
namelen = ((struct sockaddr_dl*)sa_list[RTAX_IFP])->sdl_nlen;
addrlen = ((struct sockaddr_dl*)sa_list[RTAX_IFP])->sdl_alen;
strncpy(device,
&((struct sockaddr_dl*)sa_list[RTAX_IFP])->sdl_data[0],
namelen);
device[namelen] = 0;
memcpy(device_address,
&((struct sockaddr_dl*)sa_list[RTAX_IFP])->sdl_data[namelen],
6);
memcpy(&(tx_buffer[6]),
&((struct sockaddr_dl*)sa_list[RTAX_IFP])->sdl_data[namelen],
6);
result = sysctlbyname("debug.bpf_maxdevices", &kp, &len, NULL, 0);
if (result == -1) {
return falseblnr;
}
max = *((int *)&kp);
for (loop = 0; loop < max; loop++) {
sprintf(filename, "/dev/bpf%d", loop);
fd = open(filename, O_RDWR | O_NONBLOCK | O_EXLOCK);
if (fd >= 0) {
/* sprintf(buffer, "using %s\n", filename); */
break;
}
}
if (fd <= 0) {
return falseblnr;
}
memset(&ifreq, 0, sizeof(struct ifreq));
strncpy(ifreq.ifr_name, device, IFNAMSIZ);
result = ioctl(fd, BIOCSETIF, &ifreq);
if (result) {
return falseblnr;
}
result = ioctl(fd, BIOCGBLEN, &device_buffer_size);
if (result) {
return falseblnr;
}
result = ioctl(fd, BIOCPROMISC, &enable);
if (result) {
return falseblnr;
}
result = ioctl(fd, BIOCSSEESENT, &enable);
if (result) {
return falseblnr;
}
result = ioctl(fd, BIOCSHDRCMPLT, &enable);
if (result) {
return falseblnr;
}
result = ioctl(fd, BIOCIMMEDIATE, &enable);
if (result) {
return falseblnr;
}
result = ioctl(fd, BIOCVERSION, &bpf_version);
if (result) {
return falseblnr;
}
bpf_program.bf_len = 4;
bpf_program.bf_insns = insns;
result = ioctl(fd, BIOCSETF, &bpf_program);
if (result) {
return falseblnr;
}
return trueblnr;
}
LOCALVAR unsigned char *MyRxBuffer = NULL;
/*
External function needed at startup to initialize the LocalTalk
functionality.
*/
LOCALFUNC int InitLocalTalk(void)
{
/* Perform a lot of stuff to get access to the Ethernet */
get_ethernet();
/*
Save the process id in the transmit buffer as it may be used
later to uniquely identify the sender to identify collisions
in dynamic llap node address assignment.
*/
*((uint32_t*)(&tx_buffer[14])) = htonl(getpid());
LT_TxBuffer = (ui3p)&tx_buffer[20];
MyRxBuffer = malloc(device_buffer_size);
if (NULL == MyRxBuffer) {
return falseblnr;
}
/* Initialized properly */
return trueblnr;
}
GLOBALPROC LT_TransmitPacket(void)
{
int count;
/*
Write the length in the packet. This is needed because
Ethernet has a minimum 60 bytes length, which the MAC chip
will enforce on TX. Without the size, a simple 3 byte LLAP
packet would look like a (60 - 14 =) 46 byte LLAP packet.
*/
*((uint16_t*)(&tx_buffer[18])) = htons(LT_TxBuffSz);
/* Send the packet to Ethernet */
count = write(fd, tx_buffer, 20 + LT_TxBuffSz);
}
LOCALVAR unsigned char* NextPacket = NULL;
LOCALVAR unsigned char* EndPackets = NULL;
LOCALPROC LocalTalkTick0(void)
{
/* Get a single buffer worth of packets from BPF */
unsigned char* device_buffer = MyRxBuffer;
int bytes = read(fd, device_buffer, device_buffer_size);
if (bytes > 0) {
/* Maybe multiple packets in this buffer */
#if 0
dbglog_WriteNote("SCC founds packets from BPF");
#endif
NextPacket = device_buffer;
EndPackets = device_buffer + bytes;
}
}
GLOBALPROC LT_ReceivePacket(void)
{
label_retry:
if (NextPacket == NULL) {
LocalTalkTick0();
if (NextPacket != NULL) {
goto label_retry;
}
} else if (NextPacket >= EndPackets) {
#if 0
dbglog_WriteNote("SCC finished set of packets from BPF");
#endif
NextPacket = NULL;
goto label_retry;
} else {
unsigned char* packet = NextPacket;
/* Get pointer to BPF header */
struct bpf_hdr* header = (struct bpf_hdr *)packet;
/* Advance to next packet in buffer */
NextPacket += BPF_WORDALIGN(header->bh_hdrlen
+ header->bh_caplen);
/* Get clean references to data */
int ethernet_length = header->bh_caplen - 14;
int llap_length = htons(*((uint16_t*)(packet
+ header->bh_hdrlen + 18)));
unsigned char* start = packet + header->bh_hdrlen + 20;
if (llap_length <= ethernet_length) {
/* Start the receiver */
LT_RxBuffer = (ui3p)start;
LT_RxBuffSz = llap_length;
} else {
goto label_retry;
}
}
}

File diff suppressed because one or more lines are too long

1034
Mini vMac/mnvm_core/CONTROLM.h Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1 +1,117 @@
/* DATE2SEC.h Copyright (C) 2003 Bradford L. Barrett, 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. */ /* DATE 2(to) SEConds convert year/month/day/hour/minute/second to number of seconds since the beginning of 1904, the format for storing dates on the Macintosh. The function jdate is from the program Webalizer by Bradford L. Barrett. */ #ifdef DATE2SEC_H #error "header already included" #else #define DATE2SEC_H #endif /* The function jdate was found at the end of the file webalizer.c in the program webalizer at "www.mrunix.net/webalizer/". Here is copyright info from the top of that file: webalizer - a web server log analysis program Copyright (C) 1997-2000 Bradford L. Barrett (brad@mrunix.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version, and provided that the above copyright and permission notice is included with all distributed copies of this or derived software. */ /* ************************************************************* */ /* */ /* JDATE - Julian date calculator */ /* */ /* Calculates the number of days since Jan 1, 0000. */ /* */ /* Originally written by Bradford L. Barrett (03/17/1988) */ /* Returns an unsigned long value representing the number of */ /* days since January 1, 0000. */ /* */ /* Note: Due to the changes made by Pope Gregory XIII in the */ /* 16th Centyry (Feb 24, 1582), dates before 1583 will */ /* not return a truely accurate number (will be at least */ /* 10 days off). Somehow, I don't think this will */ /* present much of a problem for most situations :) */ /* */ /* Usage: days = jdate(day, month, year) */ /* */ /* The number returned is adjusted by 5 to facilitate day of */ /* week calculations. The mod of the returned value gives the */ /* day of the week the date is. (ie: dow = days % 7) where */ /* dow will return 0=Sunday, 1=Monday, 2=Tuesday, etc... */ /* */ /* ************************************************************* */ LOCALFUNC ui5b jdate(int day, int month, int year) { ui5b days; /* value returned */ int mtable[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; /* First, calculate base number including leap and Centenial year stuff */ days = (((ui5b)year * 365) + day + mtable[month - 1] + ((year + 4) / 4) - ((year / 100) - (year / 400))); /* now adjust for leap year before March 1st */ if ((year % 4 == 0) && (! ((year % 100 == 0) && (year % 400 != 0))) && (month < 3)) { --days; } /* done, return with calculated value */ return (days + 5); } LOCALFUNC ui5b Date2MacSeconds(int second, int minute, int hour, int day, int month, int year) { ui5b curjdate; ui5b basejdate; curjdate = jdate(day, month, year); basejdate = jdate(1, 1, 1904); return (((curjdate - basejdate) * 24 + hour) * 60 + minute) * 60 + second; }
/*
DATE2SEC.h
Copyright (C) 2003 Bradford L. Barrett, 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.
*/
/*
DATE 2(to) SEConds
convert year/month/day/hour/minute/second
to number of seconds since the beginning
of 1904, the format for storing dates
on the Macintosh.
The function jdate is from the program Webalizer
by Bradford L. Barrett.
*/
#ifdef DATE2SEC_H
#error "header already included"
#else
#define DATE2SEC_H
#endif
/*
The function jdate was found at the end of the file
webalizer.c in the program webalizer at
"www.mrunix.net/webalizer/".
Here is copyright info from the top of that file:
webalizer - a web server log analysis program
Copyright (C) 1997-2000 Bradford L. Barrett (brad@mrunix.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version, and provided that the above
copyright and permission notice is included with all distributed
copies of this or derived software.
*/
/* ************************************************************* */
/* */
/* JDATE - Julian date calculator */
/* */
/* Calculates the number of days since Jan 1, 0000. */
/* */
/* Originally written by Bradford L. Barrett (03/17/1988) */
/* Returns an unsigned long value representing the number of */
/* days since January 1, 0000. */
/* */
/* Note: Due to the changes made by Pope Gregory XIII in the */
/* 16th Centyry (Feb 24, 1582), dates before 1583 will */
/* not return a truely accurate number (will be at least */
/* 10 days off). Somehow, I don't think this will */
/* present much of a problem for most situations :) */
/* */
/* Usage: days = jdate(day, month, year) */
/* */
/* The number returned is adjusted by 5 to facilitate day of */
/* week calculations. The mod of the returned value gives the */
/* day of the week the date is. (ie: dow = days % 7) where */
/* dow will return 0=Sunday, 1=Monday, 2=Tuesday, etc... */
/* */
/* ************************************************************* */
LOCALFUNC ui5b jdate(int day, int month, int year)
{
ui5b days; /* value returned */
int mtable[] = {
0, 31, 59, 90, 120, 151,
181, 212, 243, 273, 304, 334
};
/*
First, calculate base number including leap
and Centenial year stuff
*/
days = (((ui5b)year * 365) + day + mtable[month - 1]
+ ((year + 4) / 4) - ((year / 100) - (year / 400)));
/* now adjust for leap year before March 1st */
if ((year % 4 == 0)
&& (! ((year % 100 == 0) && (year % 400 != 0)))
&& (month < 3))
{
--days;
}
/* done, return with calculated value */
return (days + 5);
}
LOCALFUNC ui5b Date2MacSeconds(int second, int minute, int hour,
int day, int month, int year)
{
ui5b curjdate;
ui5b basejdate;
curjdate = jdate(day, month, year);
basejdate = jdate(1, 1, 1904);
return (((curjdate - basejdate) * 24 + hour) * 60
+ minute) * 60 + second;
}

2936
Mini vMac/mnvm_core/DISAM68K.c Executable file

File diff suppressed because it is too large Load Diff

29
Mini vMac/mnvm_core/DISAM68K.h Executable file
View File

@ -0,0 +1,29 @@
/*
DISAM68K.h
Copyright (C) 2010 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.
*/
/*
DISAssemble Motorola 68K instructions.
*/
#ifdef DIS1M68K_H
#error "header already included"
#else
#define DIS1M68K_H
#endif
EXPORTPROC DisasmOneOrSave(ui5r pc);
EXPORTPROC m68k_WantDisasmContext(void);

View File

@ -1 +1,140 @@
/* ENDIANAC.h Copyright (C) 2006 Bernd Schmidt, 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. */ /* ENDIAN ACcess Deals with endian issues in memory access. This code is adapted from code in the Un*x Amiga Emulator by Bernd Schmidt, as found in vMac by Philip Cummins. */ #ifdef ENDIANAC_H #ifndef AllFiles #error "header already included" #endif #else #define ENDIANAC_H #endif #if 0 /* works in GCC from Apple. others? */ static inline ui5r MySwapUi5r(ui5r _data) { __asm__ ("bswap %0" : "+r" (_data)); return _data; } #define HaveMySwapUi5r 1 #endif #ifndef HaveMySwapUi5r #define HaveMySwapUi5r 0 #endif #define do_get_mem_byte(a) ((ui3r)*((ui3b *)(a))) #if BigEndianUnaligned #define do_get_mem_word(a) ((ui4r)*((ui4b *)(a))) #else static MayInline ui4r do_get_mem_word(ui3p a) { #if LittleEndianUnaligned ui4b b = (*((ui4b *)(a))); return ((b & 0x00FF) << 8) | ((b >> 8) & 0x00FF); #else return (((ui4r)*a) << 8) | ((ui4r)*(a + 1)); #endif } #endif #if BigEndianUnaligned #define do_get_mem_long(a) ((ui5r)*((ui5b *)(a))) #elif HaveMySwapUi5r && LittleEndianUnaligned #define do_get_mem_long(a) (MySwapUi5r((ui5r)*((ui5b *)(a)))) #else static MayInline ui5r do_get_mem_long(ui3p a) { #if LittleEndianUnaligned #if 0 return ((b << 24) & 0xFF000000) | ((b << 8) & 0x00FF0000) | ((b >> 8) & 0x0000FF00) | ((b >> 24) & 0x000000FF); /* no, this doesn't do well with apple tools, instead try combining two 16 bit swaps. */ #endif ui5b b = (*((ui5b *)(a))); ui4b b1 = b; ui4b b2 = b >> 16; ui4b c1 = ((b1 & 0x00FF) << 8) | ((b1 >> 8) & 0x00FF); ui4b c2 = ((b2 & 0x00FF) << 8) | ((b2 >> 8) & 0x00FF); return (((ui5r)c1) << 16) | ((ui5r)c2); /* better, though still doesn't use BSWAP instruction with apple tools for intel. */ #else return (((ui5r)*a) << 24) | (((ui5r)*(a + 1)) << 16) | (((ui5r)*(a + 2)) << 8) | ((ui5r)*(a + 3)); #endif } #endif #define do_put_mem_byte(a, v) ((*((ui3b *)(a))) = (v)) #if BigEndianUnaligned #define do_put_mem_word(a, v) ((*((ui4b *)(a))) = (v)) #else static MayInline void do_put_mem_word(ui3p a, ui4r v) { #if LittleEndianUnaligned ui4b b = ((v & 0x00FF) << 8) | ((v >> 8) & 0x00FF); *(ui4b *)a = b; #else *a = v >> 8; *(a + 1) = v; #endif } #endif #if BigEndianUnaligned #define do_put_mem_long(a, v) ((*((ui5b *)(a))) = (v)) #elif HaveMySwapUi5r && LittleEndianUnaligned #define do_put_mem_long(a, v) ((*((ui5b *)(a))) = MySwapUi5r(v)) #else static MayInline void do_put_mem_long(ui3p a, ui5r v) { #if LittleEndianUnaligned ui4b b1 = v; ui4b b2 = v >> 16; ui4b c1 = ((b1 & 0x00FF) << 8) | ((b1 >> 8) & 0x00FF); ui4b c2 = ((b2 & 0x00FF) << 8) | ((b2 >> 8) & 0x00FF); *(ui5b *)a = (c1 << 16) | c2; #else *a = v >> 24; *(a + 1) = v >> 16; *(a + 2) = v >> 8; *(a + 3) = v; #endif } #endif
/*
ENDIANAC.h
Copyright (C) 2006 Bernd Schmidt, 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.
*/
/*
ENDIAN ACcess
Deals with endian issues in memory access.
This code is adapted from code in the Un*x Amiga Emulator by
Bernd Schmidt, as found in vMac by Philip Cummins.
*/
#ifdef ENDIANAC_H
#ifndef AllFiles
#error "header already included"
#endif
#else
#define ENDIANAC_H
#endif
#if 0
/* works in GCC from Apple. others? */
static inline ui5r MySwapUi5r(ui5r _data)
{
__asm__ ("bswap %0" : "+r" (_data));
return _data;
}
#define HaveMySwapUi5r 1
#endif
#ifndef HaveMySwapUi5r
#define HaveMySwapUi5r 0
#endif
#define do_get_mem_byte(a) ((ui3r)*((ui3b *)(a)))
#if BigEndianUnaligned
#define do_get_mem_word(a) ((ui4r)*((ui4b *)(a)))
#else
static MayInline ui4r do_get_mem_word(ui3p a)
{
#if LittleEndianUnaligned
ui4b b = (*((ui4b *)(a)));
return ((b & 0x00FF) << 8) | ((b >> 8) & 0x00FF);
#else
return (((ui4r)*a) << 8) | ((ui4r)*(a + 1));
#endif
}
#endif
#if BigEndianUnaligned
#define do_get_mem_long(a) ((ui5r)*((ui5b *)(a)))
#elif HaveMySwapUi5r && LittleEndianUnaligned
#define do_get_mem_long(a) (MySwapUi5r((ui5r)*((ui5b *)(a))))
#else
static MayInline ui5r do_get_mem_long(ui3p a)
{
#if LittleEndianUnaligned
#if 0
return ((b << 24) & 0xFF000000)
| ((b << 8) & 0x00FF0000)
| ((b >> 8) & 0x0000FF00)
| ((b >> 24) & 0x000000FF);
/*
no, this doesn't do well with apple tools,
instead try combining two 16 bit swaps.
*/
#endif
ui5b b = (*((ui5b *)(a)));
ui4b b1 = b;
ui4b b2 = b >> 16;
ui4b c1 = ((b1 & 0x00FF) << 8) | ((b1 >> 8) & 0x00FF);
ui4b c2 = ((b2 & 0x00FF) << 8) | ((b2 >> 8) & 0x00FF);
return (((ui5r)c1) << 16) | ((ui5r)c2);
/*
better, though still doesn't use BSWAP
instruction with apple tools for intel.
*/
#else
return (((ui5r)*a) << 24) | (((ui5r)*(a + 1)) << 16)
| (((ui5r)*(a + 2)) << 8) | ((ui5r)*(a + 3));
#endif
}
#endif
#define do_put_mem_byte(a, v) ((*((ui3b *)(a))) = (v))
#if BigEndianUnaligned
#define do_put_mem_word(a, v) ((*((ui4b *)(a))) = (v))
#else
static MayInline void do_put_mem_word(ui3p a, ui4r v)
{
#if LittleEndianUnaligned
ui4b b = ((v & 0x00FF) << 8) | ((v >> 8) & 0x00FF);
*(ui4b *)a = b;
#else
*a = v >> 8;
*(a + 1) = v;
#endif
}
#endif
#if BigEndianUnaligned
#define do_put_mem_long(a, v) ((*((ui5b *)(a))) = (v))
#elif HaveMySwapUi5r && LittleEndianUnaligned
#define do_put_mem_long(a, v) ((*((ui5b *)(a))) = MySwapUi5r(v))
#else
static MayInline void do_put_mem_long(ui3p a, ui5r v)
{
#if LittleEndianUnaligned
ui4b b1 = v;
ui4b b2 = v >> 16;
ui4b c1 = ((b1 & 0x00FF) << 8) | ((b1 >> 8) & 0x00FF);
ui4b c2 = ((b2 & 0x00FF) << 8) | ((b2 >> 8) & 0x00FF);
*(ui5b *)a = (c1 << 16) | c2;
#else
*a = v >> 24;
*(a + 1) = v >> 16;
*(a + 2) = v >> 8;
*(a + 3) = v;
#endif
}
#endif

17
Mini vMac/mnvm_core/FB1BPP2I.h Executable file
View File

@ -0,0 +1,17 @@
/*
FB1BPP2I.h
Copyright (C) 2012 Kevin Keeling
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.
*/
EXPORTPROC FB1BPPtoIndexed(u32*, u8*, int);

1142
Mini vMac/mnvm_core/FPCPEMDV.h Executable file

File diff suppressed because it is too large Load Diff

6165
Mini vMac/mnvm_core/FPMATHEM.h Executable file

File diff suppressed because it is too large Load Diff

503
Mini vMac/mnvm_core/FPMATHNT.h Executable file
View File

@ -0,0 +1,503 @@
/*
FPMATHNT.h
Copyright (C) 2009 Ross Martin, 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.
*/
/*
Floating Point MATH implemented with NaTive operations
*/
#include <stdio.h>
#include <math.h>
#define FPDEBUG if (0)
/* #define FPDEBUG */
typedef long double myfpr;
/*
Only valid for a host that's an X386 processor
68881 extended is 96 bits. This is 1 bit sign, 15 bits exponent
16 bits unused, 1 bit explicit integer bit of mantissa, and
63 bits of normal mantissa
Intel extended is packed into 128 bits. It is 80 bits, with
1 bit sign, 15 bits exponent, 1 bit explicit integer bit of
mantissa, and 63 bits of mantissa.
So for the most part these match. Just have to match the correct
bytes.
*/
#if BigEndianUnaligned
#define fldbitsi(i) (9 - (i))
#else
#define fldbitsi(i) (i)
#endif
LOCALPROC myfp_FromExtendedFormat(myfpr *r, ui4r v2, ui5r v1, ui5r v0)
{
int ii;
union {
ui3b fbits[16];
myfpr x;
} extended_p, fixer;
myfpr result;
/* filler. Don't really need, helped me debug */
for (ii = 10; ii < 16; ii++) {
extended_p.fbits[ii] = 0x77;
}
/* sign and exponent */
*(ui4b *)&extended_p.fbits[fldbitsi(8)] = v2;
/* mantissa */
*(ui5b *)&extended_p.fbits[fldbitsi(4)] = v1;
*(ui5b *)&extended_p.fbits[fldbitsi(0)] = v0;
result = extended_p.x;
FPDEBUG printf("read_long_double reads %lf (0x",
(double)extended_p.x);
FPDEBUG {
int ii;
for (ii = 12; ii >= 0; ii--) {
printf("%02x", extended_p.fbits[ii]);
}
}
/*
Check for unusual condition where 68881 mantissa high bit
isnt' set.
This is an error for the x86 FPU, so I need to patch it.
*/
if ((extended_p.fbits[fldbitsi(7)] & 0x80) == 0x00) {
/* High bit of mantissa isn't set */
if (((extended_p.fbits[fldbitsi(9)] & 0x7F) == 0x7F)
&& (extended_p.fbits[fldbitsi(8)] == 0xFF))
{
/* infinity, OK for mantissa high bit to not be set */
} else if (((extended_p.fbits[fldbitsi(9)] & 0x7F) == 0x00)
&& (extended_p.fbits[fldbitsi(8)] == 0x00))
{
/* zero, OK for mantissa high bit to not be set */
} else {
/*
Not OK for mantissa high bit to not be set.
Fix using the FPU itself
*/
extended_p.fbits[fldbitsi(7)] =
extended_p.fbits[fldbitsi(7)] | 0x80;
/* Force top bit to 1 */
/*
Create a second extended long with *only* the high bit
of the mantissa set, identical sign and exponent. Then
subtract it off to remove the 1 bit we just forced in
the top of the mantissa.
*/
/* sign and exponent */
fixer.fbits[fldbitsi(9)] = extended_p.fbits[fldbitsi(9)];
fixer.fbits[fldbitsi(8)] = extended_p.fbits[fldbitsi(8)];
/* mantissa */
fixer.fbits[fldbitsi(7)] = 0x80;
fixer.fbits[fldbitsi(6)] = 0x00;
fixer.fbits[fldbitsi(5)] = 0x00;
fixer.fbits[fldbitsi(4)] = 0x00;
fixer.fbits[fldbitsi(3)] = 0x00;
fixer.fbits[fldbitsi(2)] = 0x00;
fixer.fbits[fldbitsi(1)] = 0x00;
fixer.fbits[fldbitsi(0)] = 0x00;
result = extended_p.x - fixer.x;
FPDEBUG
{
printf(
"Fixing denormalized extended precision float\n");
printf("XP: 0x");
for (ii = 0; ii < 16; ii++) {
printf("%02x", extended_p.fbits[ii]);
}
printf(" %lf\n", (double)extended_p.x);
printf("FX: 0x");
for (ii = 0; ii < 16; ii++) {
printf("%02x", fixer.fbits[ii]);
}
printf(" %lf\n", (double)fixer.x);
fixer.x = result;
printf("Out: 0x");
for (ii = 0; ii < 16; ii++) {
printf("%02x", fixer.fbits[ii]);
}
printf(" %lf\n", (double)fixer.x);
}
}
}
/*
printf("XP: 0x");
for (ii = 0; ii < 16; ii++) {
printf("%02x", extended_p.fbits[ii]);
}
printf(" %lf\n", (double)extended_p.x);
extended_p.x = 1.5 + 7.0 / 1024 / 1024 / 1024 / 1024;
printf("ZP: 0x");
for(ii = 0; ii < 16; ii++) {
printf("%02x", extended_p.fbits[ii]);
}
printf(" %lf\n", (double)extended_p.x);
*/
/*
printf("read_long_double returns %lf\n", (double)extended_p.x);
*/
*r = result;
}
LOCALPROC myfp_ToExtendedFormat(myfpr *dd, ui4r *v2, ui5r *v1, ui5r *v0)
{
union {
ui3b fbits[16];
myfpr x;
} extended_p;
extended_p.x = *dd;
/* sign and exponent */
*v2 = *(ui4b *)&extended_p.fbits[fldbitsi(8)];
/* mantissa */
*v1 = *(ui5b *)&extended_p.fbits[fldbitsi(4)];
*v0 = *(ui5b *)&extended_p.fbits[fldbitsi(0)];
}
/*
Only valid for a host that's an X386 processor
*/
#if BigEndianUnaligned
#define fdbitsi(i) (7 - (i))
#else
#define fdbitsi(i) (i)
#endif
LOCALPROC myfp_FromDoubleFormat(myfpr *r, ui5r v1, ui5r v0)
{
union {
ui3b fbits[8];
double d;
} double_p;
*(ui5b *)&double_p.fbits[fdbitsi(4)] = v1;
*(ui5b *)&double_p.fbits[fdbitsi(0)] = v0;
*r = (myfpr)double_p.d;
}
LOCALPROC myfp_ToDoubleFormat(myfpr *dd, ui5r *v1, ui5r *v0)
{
union {
ui3b fbits[8];
double d;
} double_p;
double_p.d = (double)*dd;
*v1 = *(ui5b *)&double_p.fbits[fdbitsi(4)];
*v0 = *(ui5b *)&double_p.fbits[fdbitsi(0)];
}
LOCALPROC myfp_FromSingleFormat(myfpr *r, ui5r x)
{
union {
ui5b fbits;
float f;
} single_p;
single_p.fbits = x;
*r = (myfpr)single_p.f;
}
LOCALFUNC ui5r myfp_ToSingleFormat(myfpr *ff)
{
union {
ui5b fbits;
float f;
} single_p;
single_p.f = (float)*ff;
return single_p.fbits;
}
LOCALPROC myfp_FromLong(myfpr *r, ui5r x)
{
*r = (myfpr)(si5b)x;
}
LOCALFUNC ui5r myfp_ToLong(myfpr *x)
{
return (ui5r)(si5r)(si5b)*x;
}
LOCALFUNC blnr myfp_IsNan(myfpr *x)
{
return isnan(*x);
}
LOCALFUNC blnr myfp_IsInf(myfpr *x)
{
return isinf(*x);
}
LOCALFUNC blnr myfp_IsZero(myfpr *x)
{
return (*x == 0.0);
}
LOCALFUNC blnr myfp_IsNeg(myfpr *x)
{
return (*x < 0.0);
}
#define myfp_Add(r, a, b) (*r) = ((*a) + (*b))
#define myfp_Sub(r, a, b) (*r) = ((*a) - (*b))
#define myfp_Mul(r, a, b) (*r) = ((*a) * (*b))
#define myfp_Div(r, a, b) (*r) = ((*a) / (*b))
#define myfp_Mod(r, a, b) (*r) = (fmod((*a), (*b)))
#define myfp_Rem(r, a, b) (*r) = (remainder((*a), (*b)))
LOCALPROC myfp_Scale(myfpr *r, myfpr *a, myfpr *b)
{
myfpr fscaleval;
fscaleval = (*b < 0.0) ? ceil(*b) : floor(*b);
*r = *a * pow(2.0, fscaleval);
}
LOCALPROC myfp_GetMan(myfpr *r, myfpr *x)
{
int expval;
*r = frexp(*x, &expval) * 2.0;
}
LOCALPROC myfp_GetExp(myfpr *r, myfpr *x)
{
int expval;
(void) frexp(*x, &expval);
*r = (myfpr) (expval - 1);
}
LOCALPROC myfp_IntRZ(myfpr *r, myfpr *x)
{
*r = (*x < 0.0) ? ceil(*x) : floor(*x);
}
LOCALPROC myfp_Int(myfpr *r, myfpr *x)
{
/* Should take the current rounding mode into account, don't */
*r = floor(*x + 0.5);
}
#define myfp_RoundToSingle(r, x) (*r) = ((myfpr)(float)(*x))
#define myfp_RoundToDouble(r, x) (*r) = ((myfpr)(double)(*x))
#define myfp_Abs(r, x) (*r) = (((*x) < 0) ? - (*x) : (*x))
#define myfp_Neg(r, x) (*r) = (- (*x))
#define myfp_Sqrt(r, x) (*r) = (sqrt(*x))
#define myfp_TenToX(r, x) (*r) = (pow(10.0, *x))
#define myfp_TwoToX(r, x) (*r) = (pow(2.0, *x))
#define myfp_EToX(r, x) (*r) = (exp(*x))
#define myfp_EToXM1(r, x) (*r) = (exp(*x) - 1.0)
#define myfp_Log10(r, x) (*r) = (log10(*x))
#define myfp_Log2(r, x) (*r) = (log(*x) / log(2.0))
#define myfp_LogN(r, x) (*r) = (log(*x))
#define myfp_LogNP1(r, x) (*x) = (log(*x + 1.0))
#define myfp_Sin(r, x) (*r) = (sin(*x))
#define myfp_Cos(r, x) (*r) = (cos(*x))
#define myfp_Tan(r, x) (*r) = (tan(*x))
#define myfp_ASin(r, x) (*r) = (asin(*x))
#define myfp_ACos(r, x) (*r) = (acos(*x))
#define myfp_ATan(r, x) (*r) = (atan(*x))
#define myfp_Sinh(r, x) (*r) = (sinh(*x))
#define myfp_Cosh(r, x) (*r) = (cosh(*x))
#define myfp_Tanh(r, x) (*r) = (tanh(*x))
#define myfp_ATanh(r, x) (*r) = (atanh(*x))
LOCALPROC myfp_SinCos(myfpr *r_sin, myfpr *r_cos, myfpr *source)
{
*r_sin = sin(*source);
*r_cos = cos(*source);
}
LOCALFUNC blnr myfp_getCR(myfpr *r, ui4b opmode)
{
myfpr v;
switch (opmode) {
case 0x00:
v = M_PI;
break;
case 0x0B:
v = log10(2.0);
break;
case 0x0C:
v = exp(1.0);
break;
case 0x0D:
v = 1.0 / log(2.0);
break;
case 0x0E:
v = 1.0 / log(10.0);
break;
case 0x0F:
v = 0.0;
break;
case 0x30:
v = log(2.0);
break;
case 0x31:
v = log(10.0);
break;
case 0x32:
v = 1.0;
break;
case 0x33:
v = 10.0;
break;
case 0x34:
v = 100.0;
break;
case 0x35:
v = 10000.0;
break;
case 0x36:
v = 1.0e8;
break;
case 0x37:
v = 1.0e16;
break;
case 0x38:
v = 1.0e32;
break;
case 0x39:
v = 1.0e64;
break;
case 0x3A:
v = 1.0e128;
break;
case 0x3B:
v = 1.0e256;
break;
case 0x3C:
v = 1.0e512;
break;
case 0x3D:
v = 1.0e1024;
break;
case 0x3E:
v = 1.0e2048;
break;
case 0x3F:
v = 1.0e4096;
break;
default:
return falseblnr;
}
*r = v;
return trueblnr;
}
LOCALVAR struct myfp_envStruct
{
ui5r FPCR; /* Floating point control register */
ui5r FPSR; /* Floating point status register */
} myfp_env;
LOCALPROC myfp_SetFPCR(ui5r v)
{
myfp_env.FPCR = v;
}
LOCALPROC myfp_SetFPSR(ui5r v)
{
myfp_env.FPSR = v;
}
LOCALFUNC ui5r myfp_GetFPCR(void)
{
return myfp_env.FPCR;
}
LOCALFUNC ui5r myfp_GetFPSR(void)
{
return myfp_env.FPSR;
}
LOCALFUNC ui3r myfp_GetConditionCodeByte(void)
{
return (myfp_env.FPSR >> 24) & 0x0F;
}
LOCALPROC myfp_SetConditionCodeByte(ui3r v)
{
myfp_env.FPSR = ((myfp_env.FPSR & 0x00FFFFFF)
| (v << 24));
}
LOCALPROC myfp_SetConditionCodeByteFromResult(myfpr *result)
{
/* Set condition codes here based on result */
int c_nan = myfp_IsNan(result) ? 1 : 0;
int c_inf = myfp_IsInf(result) ? 1 : 0;
int c_zero = myfp_IsZero(result) ? 1 : 0;
int c_neg = myfp_IsNeg(result) ? 1 : 0;
myfp_SetConditionCodeByte(c_nan
| (c_inf << 1)
| (c_zero << 2)
| (c_neg << 3));
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,210 @@
/* IWMEVDEV.c Copyright (C) 2006 Philip Cummins, 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. */ /* Integrated Woz Machine EMulated DEVice Emulates the IWM found in the Mac Plus. This code is adapted from "IWM.c" in vMac by Philip Cummins. */ /* This is the emulation for the IWM, the Integrated Woz Machine. It's basically a serial to parallel converter with some timing in-built into it to perform handshaking. Emulation so far just includes Status and Mode Register Accesses. */ #ifndef AllFiles #include "SYSDEPNS.h" #include "MYOSGLUE.h" #include "EMCONFIG.h" #include "GLOBGLUE.h" #endif #include "IWMEMDEV.h" #define kph0L 0x00 /* CA0 off (0) */ #define kph0H 0x01 /* CA0 on (1) */ #define kph1L 0x02 /* CA1 off (0) */ #define kph1H 0x03 /* CA1 on (1) */ #define kph2L 0x04 /* CA2 off (0) */ #define kph2H 0x05 /* CA2 on (1) */ #define kph3L 0x06 /* LSTRB off (low) */ #define kph3H 0x07 /* LSTRB on (high) */ #define kmtrOff 0x08 /* disk enable off */ #define kmtrOn 0x09 /* disk enable on */ #define kintDrive 0x0A /* select internal drive */ #define kextDrive 0x0B /* select external drive */ #define kq6L 0x0C /* Q6 off */ #define kq6H 0x0D /* Q6 on */ #define kq7L 0x0E /* Q7 off */ #define kq7H 0x0F /* Q7 on */ #define kph0 0x01 #define kph1 0x02 #define kph2 0x04 #define kph3 0x08 #define kmtr 0x10 #define kdrv 0x20 #define kq6 0x40 #define kq7 0x80 typedef struct { ui3b DataIn; /* Read Data Register */ ui3b Handshake; /* Read Handshake Register */ ui3b Status; /* Read Status Register */ ui3b Mode; /* Drive Off : Write Mode Register */ /* Drive On : Write Data Register */ ui3b DataOut; /* Write Data Register */ ui3b Lines; /* Used to Access Disk Drive Registers */ } IWM_Ty; IWM_Ty IWM; GLOBALPROC IWM_Reset(void) { IWM.DataIn = IWM.Handshake = IWM.Status = IWM.Mode = IWM.DataOut = IWM.Lines = 0; } typedef enum {On, Off} Mode_Ty; LOCALPROC IWM_Set_Lines(ui3b line, Mode_Ty the_mode) { if (the_mode == Off) { IWM.Lines &= (0xFF - line); } else { IWM.Lines |= line; } } LOCALFUNC ui3b IWM_Read_Reg(void) { switch ((IWM.Lines & (kq6 + kq7)) >> 6) { case 0 : #if (CurEmMd >= kEmMd_SE) && (CurEmMd <= kEmMd_IIx) /* don't report */ #else ReportAbnormal("IWM Data Read"); #endif #ifdef _IWM_Debug printf("IWM Data Read\n"); #endif return IWM.DataIn; break; case 1 : #ifdef _IWM_Debug printf("IWM Status Read\n"); #endif return IWM.Status; break; case 2 : ReportAbnormal("IWM Handshake Read"); #ifdef _IWM_Debug printf("IWM Handshake Read\n"); #endif return IWM.Handshake; break; case 3 : default : /* should alway be in 0-3, but compiler warnings don't know that */ return 0; break; } } LOCALPROC IWM_Write_Reg(ui3b in) { if (((IWM.Lines & kmtr) >> 4) == 0) { #ifdef _IWM_Debug printf("IWM Mode Register Write\n"); #endif IWM.Mode = in; IWM.Status = ((IWM.Status & 0xE0) + (IWM.Mode & 0x1F)); } } GLOBALFUNC ui5b IWM_Access(ui5b Data, blnr WriteMem, CPTR addr) { switch (addr) { case kph0L : IWM_Set_Lines(kph0, Off); break; case kph0H : IWM_Set_Lines(kph0, On); break; case kph1L : IWM_Set_Lines(kph1, Off); break; case kph1H : IWM_Set_Lines(kph1, On); break; case kph2L : IWM_Set_Lines(kph2, Off); break; case kph2H : IWM_Set_Lines(kph2, On); break; case kph3L : IWM_Set_Lines(kph3, Off); break; case kph3H : IWM_Set_Lines(kph3, On); break; case kmtrOff : IWM.Status &= 0xDF; IWM_Set_Lines(kmtr, Off); break; case kmtrOn : IWM.Status |= 0x20; IWM_Set_Lines(kmtr, On); break; case kintDrive : IWM_Set_Lines(kdrv, Off); break; case kextDrive : IWM_Set_Lines(kdrv, On); break; case kq6L : IWM_Set_Lines(kq6, Off); break; case kq6H : IWM_Set_Lines(kq6, On); break; case kq7L : if (! WriteMem) { Data = IWM_Read_Reg(); } IWM_Set_Lines(kq7, Off); break; case kq7H : if (WriteMem) { IWM_Write_Reg(Data); } IWM_Set_Lines(kq7, On); break; } return Data; }
/*
IWMEVDEV.c
Copyright (C) 2006 Philip Cummins, 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.
*/
/*
Integrated Woz Machine EMulated DEVice
Emulates the IWM found in the Mac Plus.
This code is adapted from "IWM.c" in vMac by Philip Cummins.
*/
/*
This is the emulation for the IWM, the Integrated Woz Machine.
It's basically a serial to parallel converter with some timing
in-built into it to perform handshaking. Emulation so far just
includes Status and Mode Register Accesses.
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#endif
#include "IWMEMDEV.h"
#define kph0L 0x00 /* CA0 off (0) */
#define kph0H 0x01 /* CA0 on (1) */
#define kph1L 0x02 /* CA1 off (0) */
#define kph1H 0x03 /* CA1 on (1) */
#define kph2L 0x04 /* CA2 off (0) */
#define kph2H 0x05 /* CA2 on (1) */
#define kph3L 0x06 /* LSTRB off (low) */
#define kph3H 0x07 /* LSTRB on (high) */
#define kmtrOff 0x08 /* disk enable off */
#define kmtrOn 0x09 /* disk enable on */
#define kintDrive 0x0A /* select internal drive */
#define kextDrive 0x0B /* select external drive */
#define kq6L 0x0C /* Q6 off */
#define kq6H 0x0D /* Q6 on */
#define kq7L 0x0E /* Q7 off */
#define kq7H 0x0F /* Q7 on */
#define kph0 0x01
#define kph1 0x02
#define kph2 0x04
#define kph3 0x08
#define kmtr 0x10
#define kdrv 0x20
#define kq6 0x40
#define kq7 0x80
typedef struct
{
ui3b DataIn; /* Read Data Register */
ui3b Handshake; /* Read Handshake Register */
ui3b Status; /* Read Status Register */
ui3b Mode;
/* Drive Off : Write Mode Register */
/* Drive On : Write Data Register */
ui3b DataOut; /* Write Data Register */
ui3b Lines; /* Used to Access Disk Drive Registers */
} IWM_Ty;
IWM_Ty IWM;
GLOBALPROC IWM_Reset(void)
{
IWM.DataIn = IWM.Handshake = IWM.Status = IWM.Mode =
IWM.DataOut = IWM.Lines = 0;
}
typedef enum {On, Off} Mode_Ty;
LOCALPROC IWM_Set_Lines(ui3b line, Mode_Ty the_mode)
{
if (the_mode == Off) {
IWM.Lines &= (0xFF - line);
} else {
IWM.Lines |= line;
}
}
LOCALFUNC ui3b IWM_Read_Reg(void)
{
switch ((IWM.Lines & (kq6 + kq7)) >> 6) {
case 0 :
#if (CurEmMd >= kEmMd_SE) && (CurEmMd <= kEmMd_IIx)
/* don't report */
#else
ReportAbnormal("IWM Data Read");
#endif
#ifdef _IWM_Debug
printf("IWM Data Read\n");
#endif
return IWM.DataIn;
break;
case 1 :
#ifdef _IWM_Debug
printf("IWM Status Read\n");
#endif
return IWM.Status;
break;
case 2 :
ReportAbnormal("IWM Handshake Read");
#ifdef _IWM_Debug
printf("IWM Handshake Read\n");
#endif
return IWM.Handshake;
break;
case 3 :
default :
/*
should alway be in 0-3,
but compiler warnings don't know that
*/
return 0;
break;
}
}
LOCALPROC IWM_Write_Reg(ui3b in)
{
if (((IWM.Lines & kmtr) >> 4) == 0) {
#ifdef _IWM_Debug
printf("IWM Mode Register Write\n");
#endif
IWM.Mode = in;
IWM.Status = ((IWM.Status & 0xE0) + (IWM.Mode & 0x1F));
}
}
GLOBALFUNC ui5b IWM_Access(ui5b Data, blnr WriteMem, CPTR addr)
{
switch (addr) {
case kph0L :
IWM_Set_Lines(kph0, Off);
break;
case kph0H :
IWM_Set_Lines(kph0, On);
break;
case kph1L :
IWM_Set_Lines(kph1, Off);
break;
case kph1H :
IWM_Set_Lines(kph1, On);
break;
case kph2L :
IWM_Set_Lines(kph2, Off);
break;
case kph2H :
IWM_Set_Lines(kph2, On);
break;
case kph3L :
IWM_Set_Lines(kph3, Off);
break;
case kph3H :
IWM_Set_Lines(kph3, On);
break;
case kmtrOff :
IWM.Status &= 0xDF;
IWM_Set_Lines(kmtr, Off);
break;
case kmtrOn :
IWM.Status |= 0x20;
IWM_Set_Lines(kmtr, On);
break;
case kintDrive :
IWM_Set_Lines(kdrv, Off);
break;
case kextDrive :
IWM_Set_Lines(kdrv, On);
break;
case kq6L :
IWM_Set_Lines(kq6, Off);
break;
case kq6H :
IWM_Set_Lines(kq6, On);
break;
case kq7L :
if (! WriteMem) {
Data = IWM_Read_Reg();
}
IWM_Set_Lines(kq7, Off);
break;
case kq7H :
if (WriteMem) {
IWM_Write_Reg(Data);
}
IWM_Set_Lines(kq7, On);
break;
}
return Data;
}

View File

@ -1 +1,25 @@
/* IWMEVDEV.h Copyright (C) 2004 Philip Cummins, 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. */ #ifdef IWMEVDEV_H #error "header already included" #else #define IWMEVDEV_H #endif EXPORTPROC IWM_Reset(void); EXPORTFUNC ui5b IWM_Access(ui5b Data, blnr WriteMem, CPTR addr);
/*
IWMEVDEV.h
Copyright (C) 2004 Philip Cummins, 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.
*/
#ifdef IWMEVDEV_H
#error "header already included"
#else
#define IWMEVDEV_H
#endif
EXPORTPROC IWM_Reset(void);
EXPORTFUNC ui5b IWM_Access(ui5b Data, blnr WriteMem, CPTR addr);

View File

@ -1 +1,208 @@
/* KBRDEMDV.c Copyright (C) 2006 Philip Cummins, 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. */ /* KeyBoaRD EMulated DeVice Emulation of the keyboard in the Mac Plus. This code adapted from "Keyboard.c" in vMac by Philip Cummins. */ #ifndef AllFiles #include "SYSDEPNS.h" #include "MYOSGLUE.h" #include "EMCONFIG.h" #include "GLOBGLUE.h" #endif #include "KBRDEMDV.h" #ifdef _VIA_Debug #include <stdio.h> #endif IMPORTPROC KYBD_ShiftOutData(ui3b v); IMPORTFUNC ui3b KYBD_ShiftInData(void); enum { kKybdStateIdle, kKybdStateRecievingCommand, kKybdStateRecievedCommand, kKybdStateRecievingEndCommand, kKybdStates }; LOCALVAR int KybdState = kKybdStateIdle; LOCALVAR blnr HaveKeyBoardResult = falseblnr; LOCALVAR ui3b KeyBoardResult; LOCALPROC GotKeyBoardData(ui3b v) { if (KybdState != kKybdStateIdle) { HaveKeyBoardResult = trueblnr; KeyBoardResult = v; } else { KYBD_ShiftOutData(v); VIA1_iCB2 = 1; } } LOCALVAR ui3b InstantCommandData = 0x7B; LOCALFUNC blnr AttemptToFinishInquiry(void) { int i; blnr KeyDown; ui3b Keyboard_Data; if (FindKeyEvent(&i, &KeyDown)) { if (i < 64) { Keyboard_Data = i << 1; if (! KeyDown) { Keyboard_Data += 128; } } else { Keyboard_Data = 121; InstantCommandData = (i - 64) << 1; if (! KeyDown) { InstantCommandData += 128; } } GotKeyBoardData(Keyboard_Data); return trueblnr; } else { return falseblnr; } } #define MaxKeyboardWait 16 /* in 60ths of a second */ /* Code in the mac rom will reset the keyboard if it hasn't been heard from in 32/60th of a second. So time out and send something before that to keep connection. */ LOCALVAR int InquiryCommandTimer = 0; GLOBALPROC DoKybd_ReceiveCommand(void) { if (KybdState != kKybdStateRecievingCommand) { ReportAbnormal("KybdState != kKybdStateRecievingCommand"); } else { ui3b in = KYBD_ShiftInData(); KybdState = kKybdStateRecievedCommand; switch (in) { case 0x10 : /* Inquiry Command */ if (! AttemptToFinishInquiry()) { InquiryCommandTimer = MaxKeyboardWait; } break; case 0x14 : /* Instant Command */ GotKeyBoardData(InstantCommandData); InstantCommandData = 0x7B; break; case 0x16 : /* Model Command */ GotKeyBoardData(0x0b /* 0x01 */); /* Test value, means Model 0, no extra devices */ /* Fixed by Hoshi Takanori - it uses the proper keyboard type now */ break; case 0x36 : /* Test Command */ GotKeyBoardData(0x7D); break; case 0x00: GotKeyBoardData(0); break; default : /* Debugger(); */ GotKeyBoardData(0); break; } } } GLOBALPROC DoKybd_ReceiveEndCommand(void) { if (KybdState != kKybdStateRecievingEndCommand) { ReportAbnormal("KybdState != kKybdStateRecievingEndCommand"); } else { KybdState = kKybdStateIdle; #ifdef _VIA_Debug fprintf(stderr, "enter DoKybd_ReceiveEndCommand\n"); #endif if (HaveKeyBoardResult) { #ifdef _VIA_Debug fprintf(stderr, "HaveKeyBoardResult: %d\n", KeyBoardResult); #endif HaveKeyBoardResult = falseblnr; KYBD_ShiftOutData(KeyBoardResult); VIA1_iCB2 = 1; } } } GLOBALPROC Kybd_DataLineChngNtfy(void) { switch (KybdState) { case kKybdStateIdle: if (VIA1_iCB2 == 0) { KybdState = kKybdStateRecievingCommand; #ifdef _VIA_Debug fprintf(stderr, "posting kICT_Kybd_ReceiveCommand\n"); #endif ICT_add(kICT_Kybd_ReceiveCommand, 6800UL * kCycleScale / 64 * kMyClockMult); if (InquiryCommandTimer != 0) { InquiryCommandTimer = 0; /* abort Inquiry */ } } break; case kKybdStateRecievedCommand: if (VIA1_iCB2 == 1) { KybdState = kKybdStateRecievingEndCommand; #ifdef _VIA_Debug fprintf(stderr, "posting kICT_Kybd_ReceiveEndCommand\n"); #endif ICT_add(kICT_Kybd_ReceiveEndCommand, 6800UL * kCycleScale / 64 * kMyClockMult); } break; } } GLOBALPROC KeyBoard_Update(void) { if (InquiryCommandTimer != 0) { if (AttemptToFinishInquiry()) { InquiryCommandTimer = 0; } else { --InquiryCommandTimer; if (InquiryCommandTimer == 0) { GotKeyBoardData(0x7B); } } } }
/*
KBRDEMDV.c
Copyright (C) 2006 Philip Cummins, 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.
*/
/*
KeyBoaRD EMulated DeVice
Emulation of the keyboard in the Mac Plus.
This code adapted from "Keyboard.c" in vMac by Philip Cummins.
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#endif
#include "KBRDEMDV.h"
#ifdef _VIA_Debug
#include <stdio.h>
#endif
IMPORTPROC KYBD_ShiftOutData(ui3b v);
IMPORTFUNC ui3b KYBD_ShiftInData(void);
enum {
kKybdStateIdle,
kKybdStateRecievingCommand,
kKybdStateRecievedCommand,
kKybdStateRecievingEndCommand,
kKybdStates
};
LOCALVAR int KybdState = kKybdStateIdle;
LOCALVAR blnr HaveKeyBoardResult = falseblnr;
LOCALVAR ui3b KeyBoardResult;
LOCALPROC GotKeyBoardData(ui3b v)
{
if (KybdState != kKybdStateIdle) {
HaveKeyBoardResult = trueblnr;
KeyBoardResult = v;
} else {
KYBD_ShiftOutData(v);
VIA1_iCB2 = 1;
}
}
LOCALVAR ui3b InstantCommandData = 0x7B;
LOCALFUNC blnr AttemptToFinishInquiry(void)
{
int i;
blnr KeyDown;
ui3b Keyboard_Data;
if (FindKeyEvent(&i, &KeyDown)) {
if (i < 64) {
Keyboard_Data = i << 1;
if (! KeyDown) {
Keyboard_Data += 128;
}
} else {
Keyboard_Data = 121;
InstantCommandData = (i - 64) << 1;
if (! KeyDown) {
InstantCommandData += 128;
}
}
GotKeyBoardData(Keyboard_Data);
return trueblnr;
} else {
return falseblnr;
}
}
#define MaxKeyboardWait 16 /* in 60ths of a second */
/*
Code in the mac rom will reset the keyboard if
it hasn't been heard from in 32/60th of a second.
So time out and send something before that
to keep connection.
*/
LOCALVAR int InquiryCommandTimer = 0;
GLOBALPROC DoKybd_ReceiveCommand(void)
{
if (KybdState != kKybdStateRecievingCommand) {
ReportAbnormal("KybdState != kKybdStateRecievingCommand");
} else {
ui3b in = KYBD_ShiftInData();
KybdState = kKybdStateRecievedCommand;
switch (in) {
case 0x10 : /* Inquiry Command */
if (! AttemptToFinishInquiry()) {
InquiryCommandTimer = MaxKeyboardWait;
}
break;
case 0x14 : /* Instant Command */
GotKeyBoardData(InstantCommandData);
InstantCommandData = 0x7B;
break;
case 0x16 : /* Model Command */
GotKeyBoardData(0x0b /* 0x01 */);
/* Test value, means Model 0, no extra devices */
/*
Fixed by Hoshi Takanori -
it uses the proper keyboard type now
*/
break;
case 0x36 : /* Test Command */
GotKeyBoardData(0x7D);
break;
case 0x00:
GotKeyBoardData(0);
break;
default :
/* Debugger(); */
GotKeyBoardData(0);
break;
}
}
}
GLOBALPROC DoKybd_ReceiveEndCommand(void)
{
if (KybdState != kKybdStateRecievingEndCommand) {
ReportAbnormal("KybdState != kKybdStateRecievingEndCommand");
} else {
KybdState = kKybdStateIdle;
#ifdef _VIA_Debug
fprintf(stderr, "enter DoKybd_ReceiveEndCommand\n");
#endif
if (HaveKeyBoardResult) {
#ifdef _VIA_Debug
fprintf(stderr, "HaveKeyBoardResult: %d\n", KeyBoardResult);
#endif
HaveKeyBoardResult = falseblnr;
KYBD_ShiftOutData(KeyBoardResult);
VIA1_iCB2 = 1;
}
}
}
GLOBALPROC Kybd_DataLineChngNtfy(void)
{
switch (KybdState) {
case kKybdStateIdle:
if (VIA1_iCB2 == 0) {
KybdState = kKybdStateRecievingCommand;
#ifdef _VIA_Debug
fprintf(stderr, "posting kICT_Kybd_ReceiveCommand\n");
#endif
ICT_add(kICT_Kybd_ReceiveCommand,
6800UL * kCycleScale / 64 * kMyClockMult);
if (InquiryCommandTimer != 0) {
InquiryCommandTimer = 0; /* abort Inquiry */
}
}
break;
case kKybdStateRecievedCommand:
if (VIA1_iCB2 == 1) {
KybdState = kKybdStateRecievingEndCommand;
#ifdef _VIA_Debug
fprintf(stderr,
"posting kICT_Kybd_ReceiveEndCommand\n");
#endif
ICT_add(kICT_Kybd_ReceiveEndCommand,
6800UL * kCycleScale / 64 * kMyClockMult);
}
break;
}
}
GLOBALPROC KeyBoard_Update(void)
{
if (InquiryCommandTimer != 0) {
if (AttemptToFinishInquiry()) {
InquiryCommandTimer = 0;
} else {
--InquiryCommandTimer;
if (InquiryCommandTimer == 0) {
GotKeyBoardData(0x7B);
}
}
}
}

View File

@ -1 +1,27 @@
/* KBRDEMDV.h Copyright (C) 2003 Philip Cummins, 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. */ #ifdef KBRDEMDV_H #error "header already included" #else #define KBRDEMDV_H #endif EXPORTPROC Kybd_DataLineChngNtfy(void); EXPORTPROC DoKybd_ReceiveEndCommand(void); EXPORTPROC DoKybd_ReceiveCommand(void); EXPORTPROC KeyBoard_Update(void);
/*
KBRDEMDV.h
Copyright (C) 2003 Philip Cummins, 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.
*/
#ifdef KBRDEMDV_H
#error "header already included"
#else
#define KBRDEMDV_H
#endif
EXPORTPROC Kybd_DataLineChngNtfy(void);
EXPORTPROC DoKybd_ReceiveEndCommand(void);
EXPORTPROC DoKybd_ReceiveCommand(void);
EXPORTPROC KeyBoard_Update(void);

File diff suppressed because one or more lines are too long

View File

@ -1 +1,234 @@
/* M68KITAB.h Copyright (C) 2007, 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. */ #ifdef M68KITAB_H #error "header already included" #else #define M68KITAB_H #endif enum { kIKindTst, kIKindCmpB, kIKindCmpW, kIKindCmpL, kIKindBccB, kIKindBccW, kIKindBraB, kIKindBraW, kIKindDBcc, kIKindDBF, kIKindSwap, kIKindMoveL, kIKindMoveW, kIKindMoveB, kIKindMoveAL, kIKindMoveAW, kIKindMoveQ, kIKindAddB, kIKindAddW, kIKindAddL, kIKindSubB, kIKindSubW, kIKindSubL, kIKindLea, kIKindPEA, kIKindA, kIKindBsrB, kIKindBsrW, kIKindJsr, kIKindLinkA6, kIKindMOVEMRmML, kIKindMOVEMApRL, kIKindUnlkA6, kIKindRts, kIKindJmp, kIKindClr, kIKindAddA, kIKindAddQA, kIKindSubA, kIKindSubQA, kIKindCmpA, kIKindAddXB, kIKindAddXW, kIKindAddXL, kIKindSubXB, kIKindSubXW, kIKindSubXL, kIKindRolopNM, kIKindRolopND, kIKindRolopDD, kIKindBitOpDD, kIKindBitOpDM, kIKindBitOpND, kIKindBitOpNM, kIKindAndI, kIKindAndEaD, kIKindAndDEa, kIKindOrI, kIKindOrDEa, kIKindOrEaD, kIKindEor, kIKindEorI, kIKindNot, kIKindScc, kIKindNegXB, kIKindNegXW, kIKindNegXL, kIKindNegB, kIKindNegW, kIKindNegL, kIKindEXTW, kIKindEXTL, kIKindMulU, kIKindMulS, kIKindDivU, kIKindDivS, kIKindExgdd, kIKindExgaa, kIKindExgda, kIKindMoveCCREa, kIKindMoveEaCCR, kIKindMoveSREa, kIKindMoveEaSR, kIKindBinOpStatusCCR, kIKindMOVEMApRW, kIKindMOVEMRmMW, kIKindMOVEMrm, kIKindMOVEMmr, kIKindAbcdr, kIKindAbcdm, kIKindSbcdr, kIKindSbcdm, kIKindNbcd, kIKindRte, kIKindNop, kIKindMoveP, kIKindIllegal, kIKindChkW, kIKindTrap, kIKindTrapV, kIKindRtr, kIKindLink, kIKindUnlk, kIKindMoveRUSP, kIKindMoveUSPR, kIKindTas, kIKindF, kIKindCallMorRtm, kIKindStop, kIKindReset, #if Use68020 kIKindBraL, kIKindBccL, kIKindBsrL, kIKindEXTBL, kIKindTRAPcc, kIKindChkL, kIKindBkpt, kIKindDivL, kIKindMulL, kIKindRtd, kIKindMoveC, kIKindLinkL, kIKindPack, kIKindUnpk, kIKindCHK2orCMP2, kIKindCAS2, kIKindCAS, kIKindMoveS, kIKindBitField, #endif kNumIKinds }; enum { kAMdReg, kAMdIndirect, kAMdAPosIncB, kAMdAPosIncW, kAMdAPosIncL, kAMdAPreDecB, kAMdAPreDecW, kAMdAPreDecL, kAMdADisp, kAMdAIndex, kAMdAbsW, kAMdAbsL, kAMdPCDisp, kAMdPCIndex, kAMdImmedB, kAMdImmedW, kAMdImmedL, kAMdDat4, kNumAMds }; enum { kArgkRegB, kArgkRegW, kArgkRegL, kArgkMemB, kArgkMemW, kArgkMemL, kArgkCnst, kNumArgks }; struct DecOpR { /* expected size : 8 bytes */ ui5b A; ui5b B; }; typedef struct DecOpR DecOpR; #define GetUi5rField(v, shift, sz) \ (((v) >> (shift)) & ((1UL << (sz)) - 1)) #define SetUi5rField(v, shift, sz, x) \ (v) = (((v) & ~ (((1UL << (sz)) - 1) << (shift))) \ | (((x) & ((1UL << (sz)) - 1)) << (shift))) #define GetDcoFldAMd(f) (GetUi5rField((f), 16, 8)) #define GetDcoFldArgk(f) (GetUi5rField((f), 24, 4)) #define GetDcoFldArgDat(f) (GetUi5rField((f), 28, 4)) #define SetDcoFldAMd(f, x) SetUi5rField((f), 16, 8, x) #define SetDcoFldArgk(f, x) SetUi5rField((f), 24, 4, x) #define SetDcoFldArgDat(f, x) SetUi5rField((f), 28, 4, x) #define GetDcoMainClas(p) (GetUi5rField((p)->A, 0, 16)) #define GetDcoDstAMd(p) (GetDcoFldAMd((p)->A)) #define GetDcoDstArgk(p) (GetDcoFldArgk((p)->A)) #define GetDcoDstArgDat(p) (GetDcoFldArgDat((p)->A)) #define GetDcoSrcAMd(p) (GetDcoFldAMd((p)->B)) #define GetDcoSrcArgk(p) (GetDcoFldArgk((p)->B)) #define GetDcoSrcArgDat(p) (GetDcoFldArgDat((p)->B)) #define GetDcoCycles(p) (GetUi5rField((p)->B, 0, 16)) #define SetDcoMainClas(p, x) SetUi5rField((p)->A, 0, 16, x) #define SetDcoDstAMd(p, x) SetDcoFldAMd((p)->A, x) #define SetDcoDstArgk(p, x) SetDcoFldArgk((p)->A, x) #define SetDcoDstArgDat(p, x) SetDcoFldArgDat((p)->A, x) #define SetDcoSrcAMd(p, x) SetDcoFldAMd((p)->B, x) #define SetDcoSrcArgk(p, x) SetDcoFldArgk((p)->B, x) #define SetDcoSrcArgDat(p, x) SetDcoFldArgDat((p)->B, x) #define SetDcoCycles(p, x) SetUi5rField((p)->B, 0, 16, x) EXPORTPROC M68KITAB_setup(DecOpR *p);
/*
M68KITAB.h
Copyright (C) 2007, 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.
*/
#ifdef M68KITAB_H
#error "header already included"
#else
#define M68KITAB_H
#endif
enum {
kIKindTst,
kIKindCmpB,
kIKindCmpW,
kIKindCmpL,
kIKindBccB,
kIKindBccW,
kIKindBraB,
kIKindBraW,
kIKindDBcc,
kIKindDBF,
kIKindSwap,
kIKindMoveL,
kIKindMoveW,
kIKindMoveB,
kIKindMoveAL,
kIKindMoveAW,
kIKindMoveQ,
kIKindAddB,
kIKindAddW,
kIKindAddL,
kIKindSubB,
kIKindSubW,
kIKindSubL,
kIKindLea,
kIKindPEA,
kIKindA,
kIKindBsrB,
kIKindBsrW,
kIKindJsr,
kIKindLinkA6,
kIKindMOVEMRmML,
kIKindMOVEMApRL,
kIKindUnlkA6,
kIKindRts,
kIKindJmp,
kIKindClr,
kIKindAddA,
kIKindAddQA,
kIKindSubA,
kIKindSubQA,
kIKindCmpA,
kIKindAddXB,
kIKindAddXW,
kIKindAddXL,
kIKindSubXB,
kIKindSubXW,
kIKindSubXL,
kIKindRolopNM,
kIKindRolopND,
kIKindRolopDD,
kIKindBitOpDD,
kIKindBitOpDM,
kIKindBitOpND,
kIKindBitOpNM,
kIKindAndI,
kIKindAndEaD,
kIKindAndDEa,
kIKindOrI,
kIKindOrDEa,
kIKindOrEaD,
kIKindEor,
kIKindEorI,
kIKindNot,
kIKindScc,
kIKindNegXB,
kIKindNegXW,
kIKindNegXL,
kIKindNegB,
kIKindNegW,
kIKindNegL,
kIKindEXTW,
kIKindEXTL,
kIKindMulU,
kIKindMulS,
kIKindDivU,
kIKindDivS,
kIKindExgdd,
kIKindExgaa,
kIKindExgda,
kIKindMoveCCREa,
kIKindMoveEaCCR,
kIKindMoveSREa,
kIKindMoveEaSR,
kIKindBinOpStatusCCR,
kIKindMOVEMApRW,
kIKindMOVEMRmMW,
kIKindMOVEMrm,
kIKindMOVEMmr,
kIKindAbcdr,
kIKindAbcdm,
kIKindSbcdr,
kIKindSbcdm,
kIKindNbcd,
kIKindRte,
kIKindNop,
kIKindMoveP,
kIKindIllegal,
kIKindChkW,
kIKindTrap,
kIKindTrapV,
kIKindRtr,
kIKindLink,
kIKindUnlk,
kIKindMoveRUSP,
kIKindMoveUSPR,
kIKindTas,
kIKindF,
kIKindCallMorRtm,
kIKindStop,
kIKindReset,
#if Use68020
kIKindBraL,
kIKindBccL,
kIKindBsrL,
kIKindEXTBL,
kIKindTRAPcc,
kIKindChkL,
kIKindBkpt,
kIKindDivL,
kIKindMulL,
kIKindRtd,
kIKindMoveC,
kIKindLinkL,
kIKindPack,
kIKindUnpk,
kIKindCHK2orCMP2,
kIKindCAS2,
kIKindCAS,
kIKindMoveS,
kIKindBitField,
#endif
kNumIKinds
};
enum {
kAMdReg,
kAMdIndirect,
kAMdAPosIncB,
kAMdAPosIncW,
kAMdAPosIncL,
kAMdAPreDecB,
kAMdAPreDecW,
kAMdAPreDecL,
kAMdADisp,
kAMdAIndex,
kAMdAbsW,
kAMdAbsL,
kAMdPCDisp,
kAMdPCIndex,
kAMdImmedB,
kAMdImmedW,
kAMdImmedL,
kAMdDat4,
kNumAMds
};
enum {
kArgkRegB,
kArgkRegW,
kArgkRegL,
kArgkMemB,
kArgkMemW,
kArgkMemL,
kArgkCnst,
kNumArgks
};
struct DecOpR {
/* expected size : 8 bytes */
ui5b A;
ui5b B;
};
typedef struct DecOpR DecOpR;
#define GetUi5rField(v, shift, sz) \
(((v) >> (shift)) & ((1UL << (sz)) - 1))
#define SetUi5rField(v, shift, sz, x) \
(v) = (((v) & ~ (((1UL << (sz)) - 1) << (shift))) \
| (((x) & ((1UL << (sz)) - 1)) << (shift)))
#define GetDcoFldAMd(f) (GetUi5rField((f), 16, 8))
#define GetDcoFldArgk(f) (GetUi5rField((f), 24, 4))
#define GetDcoFldArgDat(f) (GetUi5rField((f), 28, 4))
#define SetDcoFldAMd(f, x) SetUi5rField((f), 16, 8, x)
#define SetDcoFldArgk(f, x) SetUi5rField((f), 24, 4, x)
#define SetDcoFldArgDat(f, x) SetUi5rField((f), 28, 4, x)
#define GetDcoMainClas(p) (GetUi5rField((p)->A, 0, 16))
#define GetDcoDstAMd(p) (GetDcoFldAMd((p)->A))
#define GetDcoDstArgk(p) (GetDcoFldArgk((p)->A))
#define GetDcoDstArgDat(p) (GetDcoFldArgDat((p)->A))
#define GetDcoSrcAMd(p) (GetDcoFldAMd((p)->B))
#define GetDcoSrcArgk(p) (GetDcoFldArgk((p)->B))
#define GetDcoSrcArgDat(p) (GetDcoFldArgDat((p)->B))
#define GetDcoCycles(p) (GetUi5rField((p)->B, 0, 16))
#define SetDcoMainClas(p, x) SetUi5rField((p)->A, 0, 16, x)
#define SetDcoDstAMd(p, x) SetDcoFldAMd((p)->A, x)
#define SetDcoDstArgk(p, x) SetDcoFldArgk((p)->A, x)
#define SetDcoDstArgDat(p, x) SetDcoFldArgDat((p)->A, x)
#define SetDcoSrcAMd(p, x) SetDcoFldAMd((p)->B, x)
#define SetDcoSrcArgk(p, x) SetDcoFldArgk((p)->B, x)
#define SetDcoSrcArgDat(p, x) SetDcoFldArgDat((p)->B, x)
#define SetDcoCycles(p, x) SetUi5rField((p)->B, 0, 16, x)
EXPORTPROC M68KITAB_setup(DecOpR *p);

File diff suppressed because one or more lines are too long

View File

@ -1 +1,53 @@
/* MINEM68K.h Copyright (C) 2004 Bernd Schmidt, 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. */ #ifdef MINEM68K_H #error "header already included" #else #define MINEM68K_H #endif EXPORTPROC MINEM68K_Init( ui3b *fIPL); #if SmallGlobals EXPORTPROC MINEM68K_ReserveAlloc(void); #endif EXPORTPROC m68k_IPLchangeNtfy(void); EXPORTPROC DiskInsertedPsuedoException(CPTR newpc, ui5b data); EXPORTPROC m68k_reset(void); EXPORTFUNC si5r GetCyclesRemaining(void); EXPORTPROC SetCyclesRemaining(si5r n); EXPORTPROC m68k_go_nCycles(ui5b n); /* general purpose access of address space of emulated computer. (memory and memory mapped hardware.) */ EXPORTFUNC ui3r get_vm_byte(CPTR addr); EXPORTFUNC ui4r get_vm_word(CPTR addr); EXPORTFUNC ui5r get_vm_long(CPTR addr); EXPORTPROC put_vm_byte(CPTR addr, ui3r b); EXPORTPROC put_vm_word(CPTR addr, ui4r w); EXPORTPROC put_vm_long(CPTR addr, ui5r l); EXPORTPROC SetHeadATTel(ATTep p); EXPORTFUNC ATTep FindATTel(CPTR addr);
/*
MINEM68K.h
Copyright (C) 2004 Bernd Schmidt, 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.
*/
#ifdef MINEM68K_H
#error "header already included"
#else
#define MINEM68K_H
#endif
EXPORTPROC MINEM68K_Init(
ui3b *fIPL);
#if SmallGlobals
EXPORTPROC MINEM68K_ReserveAlloc(void);
#endif
EXPORTPROC m68k_IPLchangeNtfy(void);
EXPORTPROC DiskInsertedPsuedoException(CPTR newpc, ui5b data);
EXPORTPROC m68k_reset(void);
EXPORTFUNC si5r GetCyclesRemaining(void);
EXPORTPROC SetCyclesRemaining(si5r n);
EXPORTPROC m68k_go_nCycles(ui5b n);
/*
general purpose access of address space
of emulated computer. (memory and
memory mapped hardware.)
*/
EXPORTFUNC ui3r get_vm_byte(CPTR addr);
EXPORTFUNC ui4r get_vm_word(CPTR addr);
EXPORTFUNC ui5r get_vm_long(CPTR addr);
EXPORTPROC put_vm_byte(CPTR addr, ui3r b);
EXPORTPROC put_vm_word(CPTR addr, ui4r w);
EXPORTPROC put_vm_long(CPTR addr, ui5r l);
EXPORTPROC SetHeadATTel(ATTep p);
EXPORTFUNC ATTep FindATTel(CPTR addr);

View File

@ -1 +1,128 @@
/* MOUSEMDV.c Copyright (C) 2006 Philip Cummins, 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. */ /* MOUSe EMulated DeVice Emulation of the mouse in the Mac Plus. This code descended from "Mouse-MacOS.c" in Richard F. Bannister's Macintosh port of vMac, by Philip Cummins. */ #ifndef AllFiles #include "SYSDEPNS.h" #include "MYOSGLUE.h" #include "ENDIANAC.h" #include "EMCONFIG.h" #include "GLOBGLUE.h" #include "SCCEMDEV.h" #endif #include "MOUSEMDV.h" GLOBALPROC Mouse_Update(void) { #if HaveMasterMyEvtQLock if (0 != MasterMyEvtQLock) { --MasterMyEvtQLock; } #endif /* Check mouse position first. After mouse button or key event, can't process another mouse position until following tick, otherwise button or key will be in wrong place. */ /* if start doing this too soon after boot, will mess up memory check */ if (Mouse_Enabled()) { MyEvtQEl *p; if ( #if HaveMasterMyEvtQLock (0 == MasterMyEvtQLock) && #endif (nullpr != (p = MyEvtQOutP()))) { #if EmClassicKbrd #if EnableMouseMotion if (MyEvtQElKindMouseDelta == p->kind) { if ((p->u.pos.h != 0) || (p->u.pos.v != 0)) { put_ram_word(0x0828, get_ram_word(0x0828) + p->u.pos.v); put_ram_word(0x082A, get_ram_word(0x082A) + p->u.pos.h); put_ram_byte(0x08CE, get_ram_byte(0x08CF)); /* Tell MacOS to redraw the Mouse */ } MyEvtQOutDone(); } else #endif #endif if (MyEvtQElKindMousePos == p->kind) { ui5r NewMouse = (p->u.pos.v << 16) | p->u.pos.h; if (get_ram_long(0x0828) != NewMouse) { put_ram_long(0x0828, NewMouse); /* Set Mouse Position */ put_ram_long(0x082C, NewMouse); #if EmClassicKbrd put_ram_byte(0x08CE, get_ram_byte(0x08CF)); /* Tell MacOS to redraw the Mouse */ #else put_ram_long(0x0830, NewMouse); put_ram_byte(0x08CE, 0xFF); /* Tell MacOS to redraw the Mouse */ #endif } MyEvtQOutDone(); } } } #if EmClassicKbrd { MyEvtQEl *p; if ( #if HaveMasterMyEvtQLock (0 == MasterMyEvtQLock) && #endif (nullpr != (p = MyEvtQOutP()))) { if (MyEvtQElKindMouseButton == p->kind) { MouseBtnUp = p->u.press.down ? 0 : 1; MyEvtQOutDone(); MasterMyEvtQLock = 4; } } } #endif } GLOBALPROC Mouse_EndTickNotify(void) { if (Mouse_Enabled()) { /* tell platform specific code where the mouse went */ CurMouseV = get_ram_word(0x082C); CurMouseH = get_ram_word(0x082E); } }
/*
MOUSEMDV.c
Copyright (C) 2006 Philip Cummins, 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.
*/
/*
MOUSe EMulated DeVice
Emulation of the mouse in the Mac Plus.
This code descended from "Mouse-MacOS.c" in Richard F. Bannister's
Macintosh port of vMac, by Philip Cummins.
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "ENDIANAC.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "SCCEMDEV.h"
#endif
#include "MOUSEMDV.h"
GLOBALPROC Mouse_Update(void)
{
#if HaveMasterMyEvtQLock
if (0 != MasterMyEvtQLock) {
--MasterMyEvtQLock;
}
#endif
/*
Check mouse position first. After mouse button or key event,
can't process another mouse position until following tick,
otherwise button or key will be in wrong place.
*/
/*
if start doing this too soon after boot,
will mess up memory check
*/
if (Mouse_Enabled()) {
MyEvtQEl *p;
if (
#if HaveMasterMyEvtQLock
(0 == MasterMyEvtQLock) &&
#endif
(nullpr != (p = MyEvtQOutP())))
{
#if EmClassicKbrd
#if EnableMouseMotion
if (MyEvtQElKindMouseDelta == p->kind) {
if ((p->u.pos.h != 0) || (p->u.pos.v != 0)) {
put_ram_word(0x0828,
get_ram_word(0x0828) + p->u.pos.v);
put_ram_word(0x082A,
get_ram_word(0x082A) + p->u.pos.h);
put_ram_byte(0x08CE, get_ram_byte(0x08CF));
/* Tell MacOS to redraw the Mouse */
}
MyEvtQOutDone();
} else
#endif
#endif
if (MyEvtQElKindMousePos == p->kind) {
ui5r NewMouse = (p->u.pos.v << 16) | p->u.pos.h;
if (get_ram_long(0x0828) != NewMouse) {
put_ram_long(0x0828, NewMouse);
/* Set Mouse Position */
put_ram_long(0x082C, NewMouse);
#if EmClassicKbrd
put_ram_byte(0x08CE, get_ram_byte(0x08CF));
/* Tell MacOS to redraw the Mouse */
#else
put_ram_long(0x0830, NewMouse);
put_ram_byte(0x08CE, 0xFF);
/* Tell MacOS to redraw the Mouse */
#endif
}
MyEvtQOutDone();
}
}
}
#if EmClassicKbrd
{
MyEvtQEl *p;
if (
#if HaveMasterMyEvtQLock
(0 == MasterMyEvtQLock) &&
#endif
(nullpr != (p = MyEvtQOutP())))
{
if (MyEvtQElKindMouseButton == p->kind) {
MouseBtnUp = p->u.press.down ? 0 : 1;
MyEvtQOutDone();
MasterMyEvtQLock = 4;
}
}
}
#endif
}
GLOBALPROC Mouse_EndTickNotify(void)
{
if (Mouse_Enabled()) {
/* tell platform specific code where the mouse went */
CurMouseV = get_ram_word(0x082C);
CurMouseH = get_ram_word(0x082E);
}
}

View File

@ -1 +1,24 @@
/* MOUSEMDV.h Copyright (C) 2003 Philip Cummins, 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. */ #ifdef MOUSEMDV_H #error "header already included" #else #define MOUSEMDV_H #endif EXPORTPROC Mouse_Update(void); EXPORTPROC Mouse_EndTickNotify(void);
/*
MOUSEMDV.h
Copyright (C) 2003 Philip Cummins, 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.
*/
#ifdef MOUSEMDV_H
#error "header already included"
#else
#define MOUSEMDV_H
#endif
EXPORTPROC Mouse_Update(void);
EXPORTPROC Mouse_EndTickNotify(void);

File diff suppressed because one or more lines are too long

430
Mini vMac/mnvm_core/PMUEMDEV.c Executable file
View File

@ -0,0 +1,430 @@
/*
PMUEMDEV.c
Copyright (C) 2008 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.
*/
/*
Power Management Unit EMulated DEVice
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "VIAEMDEV.h"
#endif
#include "PMUEMDEV.h"
enum {
kPMUStateReadyForCommand,
kPMUStateRecievingLength,
kPMUStateRecievingBuffer,
kPMUStateRecievedCommand,
kPMUStateSendLength,
kPMUStateSendBuffer,
kPMUStates
};
#define PMU_BuffSz 8
LOCALVAR ui3b PMU_BuffA[PMU_BuffSz];
LOCALVAR ui3p PMU_p;
LOCALVAR ui3r PMU_rem;
LOCALVAR ui3r PMU_i;
LOCALVAR int PMUState = kPMUStateReadyForCommand;
LOCALVAR ui3r PMU_CurCommand;
LOCALVAR ui3r PMU_SendNext;
LOCALVAR ui3r PMU_BuffL;
LOCALPROC PmuStartSendResult(ui3r ResultCode, ui3r L)
{
PMU_SendNext = ResultCode;
PMU_BuffL = L;
PMUState = kPMUStateSendLength;
}
LOCALVAR ui3b PARAMRAM[128];
LOCALPROC PmuCheckCommandOp(void)
{
switch (PMU_CurCommand) {
case 0x10: /* kPMUpowerCntl - power plane/clock control */
break;
case 0x32: /* kPMUxPramWrite - write extended PRAM byte(s) */
if (kPMUStateRecievingBuffer == PMUState) {
if (0 == PMU_i) {
if (PMU_BuffL >= 2) {
PMU_p = PMU_BuffA;
PMU_rem = 2;
} else {
ReportAbnormal(
"PMU_BuffL too small for kPMUxPramWrite");
}
} else if (2 == PMU_i) {
if ((PMU_BuffA[1] + 2 == PMU_BuffL)
&& (PMU_BuffA[0] + PMU_BuffA[1] <= 0x80))
{
PMU_p = &PARAMRAM[PMU_BuffA[0]];
PMU_rem = PMU_BuffA[1];
} else {
ReportAbnormal("bad range for kPMUxPramWrite");
}
} else {
ReportAbnormal("Wrong PMU_i for kPMUpramWrite");
}
} else if (kPMUStateRecievedCommand == PMUState) {
/* already done */
}
break;
#if 0
case 0xE2: /* kPMUdownloadStatus - PRAM status */
break;
#endif
case 0xE0: /* kPMUwritePmgrRAM - write to internal PMGR RAM */
break;
case 0x21: /* kPMUpMgrADBoff - turn ADB auto-poll off */
if (kPMUStateRecievedCommand == PMUState) {
if (0 != PMU_BuffL) {
ReportAbnormal("kPMUpMgrADBoff nonzero length");
}
}
break;
case 0xEC: /* kPMUPmgrSelfTest - run the PMGR selftest */
if (kPMUStateRecievedCommand == PMUState) {
PmuStartSendResult(0, 0);
}
break;
case 0x78:
/* kPMUreadINT - get PMGR interrupt data */
case 0x68:
/*
kPMUbatteryRead - read battery/charger level and status
*/
case 0x7F:
/*
kPMUsleepReq - put the system to sleep (sleepSig='MATT')
*/
if (kPMUStateRecievedCommand == PMUState) {
PMU_BuffA[0] = 0;
PmuStartSendResult(0, 1);
}
break;
case 0xE8: /* kPMUreadPmgrRAM - read from internal PMGR RAM */
if (kPMUStateRecievedCommand == PMUState) {
if ((3 == PMU_BuffL)
&& (0 == PMU_BuffA[0])
&& (0xEE == PMU_BuffA[1])
&& (1 == PMU_BuffA[2]))
{
PMU_BuffA[0] = 1 << 5;
PmuStartSendResult(0, 1);
} else {
PMU_BuffA[0] = 0;
PmuStartSendResult(0, 1);
/* ReportAbnormal("Unknown kPMUreadPmgrRAM op"); */
}
}
break;
case 0x3A: /* kPMUxPramRead - read extended PRAM byte(s) */
if (kPMUStateRecievedCommand == PMUState) {
if ((2 == PMU_BuffL)
&& (PMU_BuffA[0] + PMU_BuffA[1] <= 0x80))
{
PMU_p = &PARAMRAM[PMU_BuffA[0]];
PMU_rem = PMU_BuffA[1];
PmuStartSendResult(0, PMU_rem);
} else {
ReportAbnormal("Unknown kPMUxPramRead op");
}
}
break;
case 0x38:
/* kPMUtimeRead - read the time from the clock chip */
if (kPMUStateRecievedCommand == PMUState) {
if (0 == PMU_BuffL) {
PMU_BuffA[0] = 0;
PMU_BuffA[1] = 0;
PMU_BuffA[2] = 0;
PMU_BuffA[3] = 0;
PmuStartSendResult(0, 4);
} else {
ReportAbnormal("Unknown kPMUtimeRead op");
}
}
break;
case 0x31:
/*
kPMUpramWrite - write the original 20 bytes of PRAM
(Portable only)
*/
if (kPMUStateRecievedCommand == PMUState) {
if (20 == PMU_BuffL) {
/* done */
} else {
ReportAbnormal("Unknown kPMUpramWrite op");
}
} else if (kPMUStateRecievingBuffer == PMUState) {
if (20 == PMU_BuffL) {
if (0 == PMU_i) {
PMU_p = &PARAMRAM[16];
PMU_rem = 16;
} else if (16 == PMU_i) {
PMU_p = &PARAMRAM[8];
PMU_rem = 4;
} else {
ReportAbnormal("Wrong PMU_i for kPMUpramWrite");
}
}
}
break;
case 0x39:
/*
kPMUpramRead - read the original 20 bytes of PRAM
(Portable only)
*/
if (kPMUStateRecievedCommand == PMUState) {
if (0 == PMU_BuffL) {
PmuStartSendResult(0, 20);
} else {
ReportAbnormal("Unknown kPMUpramRead op");
}
} else if (kPMUStateSendBuffer == PMUState) {
#if 0
{
int i;
for (i = 0; i < PMU_BuffSz; ++i) {
PMU_BuffA[i] = 0;
}
}
#endif
if (0 == PMU_i) {
PMU_p = &PARAMRAM[16];
PMU_rem = 16;
} else if (16 == PMU_i) {
PMU_p = &PARAMRAM[8];
PMU_rem = 4;
} else {
ReportAbnormal("Wrong PMU_i for kPMUpramRead");
}
}
break;
default:
if (kPMUStateRecievedCommand == PMUState) {
ReportAbnormal("Unknown PMU op");
#if dbglog_HAVE
dbglog_writeCStr("Unknown PMU op ");
dbglog_writeHex(PMU_CurCommand);
dbglog_writeReturn();
dbglog_writeCStr("PMU_BuffL = ");
dbglog_writeHex(PMU_BuffL);
dbglog_writeReturn();
if (PMU_BuffL <= PMU_BuffSz) {
int i;
for (i = 0; i < PMU_BuffL; ++i) {
dbglog_writeCStr("PMU_BuffA[");
dbglog_writeNum(i);
dbglog_writeCStr("] = ");
dbglog_writeHex(PMU_BuffA[i]);
dbglog_writeReturn();
}
}
#endif
}
break;
}
}
LOCALPROC LocBuffSetUpNextChunk(void)
{
PMU_p = PMU_BuffA;
PMU_rem = PMU_BuffL - PMU_i;
if (PMU_rem >= PMU_BuffSz) {
PMU_rem = PMU_BuffSz;
}
}
LOCALFUNC ui3r GetPMUbus(void)
{
ui3r v;
v = VIA1_iA7;
v <<= 1;
v |= VIA1_iA6;
v <<= 1;
v |= VIA1_iA5;
v <<= 1;
v |= VIA1_iA4;
v <<= 1;
v |= VIA1_iA3;
v <<= 1;
v |= VIA1_iA2;
v <<= 1;
v |= VIA1_iA1;
v <<= 1;
v |= VIA1_iA0;
return v;
}
LOCALPROC SetPMUbus(ui3r v)
{
VIA1_iA0 = v & 0x01;
v >>= 1;
VIA1_iA1 = v & 0x01;
v >>= 1;
VIA1_iA2 = v & 0x01;
v >>= 1;
VIA1_iA3 = v & 0x01;
v >>= 1;
VIA1_iA4 = v & 0x01;
v >>= 1;
VIA1_iA5 = v & 0x01;
v >>= 1;
VIA1_iA6 = v & 0x01;
v >>= 1;
VIA1_iA7 = v & 0x01;
}
LOCALVAR blnr PMU_Sending = falseblnr;
LOCALPROC PmuCheckCommandCompletion(void)
{
if (PMU_i == PMU_BuffL) {
PMUState = kPMUStateRecievedCommand;
PmuCheckCommandOp();
if ((PMU_CurCommand & 0x08) == 0) {
PMUState = kPMUStateReadyForCommand;
SetPMUbus(0xFF);
} else {
if (PMUState != kPMUStateSendLength) {
PmuStartSendResult(0xFF, 0);
PMUState = kPMUStateSendLength;
}
PMU_i = 0;
PMU_Sending = trueblnr;
ICT_add(kICT_PMU_Task,
20400UL * kCycleScale / 64 * kMyClockMult);
}
}
}
GLOBALPROC PmuToReady_ChangeNtfy(void)
{
if (PMU_Sending) {
PMU_Sending = falseblnr;
ReportAbnormal("PmuToReady_ChangeNtfy while PMU_Sending");
PmuFromReady = 0;
}
switch (PMUState) {
case kPMUStateReadyForCommand:
if (! PmuToReady) {
PmuFromReady = 0;
} else {
PMU_CurCommand = GetPMUbus();
PMUState = kPMUStateRecievingLength;
PmuFromReady = 1;
}
break;
case kPMUStateRecievingLength:
if (! PmuToReady) {
PmuFromReady = 0;
} else {
PMU_BuffL = GetPMUbus();
PMU_i = 0;
PMU_rem = 0;
PMUState = kPMUStateRecievingBuffer;
PmuCheckCommandCompletion();
PmuFromReady = 1;
}
break;
case kPMUStateRecievingBuffer:
if (! PmuToReady) {
PmuFromReady = 0;
} else {
ui3r v = GetPMUbus();
if (0 == PMU_rem) {
PMU_p = nullpr;
PmuCheckCommandOp();
if (nullpr == PMU_p) {
/* default handler */
LocBuffSetUpNextChunk();
}
}
if (nullpr == PMU_p) {
/* mini vmac bug if ever happens */
ReportAbnormal(
"PMU_p null while kPMUStateRecievingBuffer");
}
*PMU_p++ = v;
--PMU_rem;
++PMU_i;
PmuCheckCommandCompletion();
PmuFromReady = 1;
}
break;
case kPMUStateSendLength:
if (! PmuToReady) {
/* receiving */
PmuFromReady = 1;
} else {
PMU_SendNext = PMU_BuffL;
PMUState = kPMUStateSendBuffer;
PMU_Sending = trueblnr;
ICT_add(kICT_PMU_Task,
20400UL * kCycleScale / 64 * kMyClockMult);
}
break;
case kPMUStateSendBuffer:
if (! PmuToReady) {
/* receiving */
PmuFromReady = 1;
} else {
if (PMU_i == PMU_BuffL) {
PMUState = kPMUStateReadyForCommand;
SetPMUbus(0xFF);
} else {
if (0 == PMU_rem) {
PMU_p = nullpr;
PmuCheckCommandOp();
if (nullpr == PMU_p) {
/* default handler */
LocBuffSetUpNextChunk();
}
}
PMU_SendNext = *PMU_p++;
--PMU_rem;
++PMU_i;
PMU_Sending = trueblnr;
ICT_add(kICT_PMU_Task,
20400UL * kCycleScale / 64 * kMyClockMult);
}
}
break;
}
}
GLOBALPROC PMU_DoTask(void)
{
if (PMU_Sending) {
PMU_Sending = falseblnr;
SetPMUbus(PMU_SendNext);
PmuFromReady = 0;
}
}

24
Mini vMac/mnvm_core/PMUEMDEV.h Executable file
View File

@ -0,0 +1,24 @@
/*
PMUEMDEV.h
Copyright (C) 2008 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.
*/
#ifdef PMUEMDEV_H
#error "header already included"
#else
#define PMUEMDEV_H
#endif
EXPORTPROC PmuToReady_ChangeNtfy(void);
EXPORTPROC PMU_DoTask(void);

File diff suppressed because one or more lines are too long

View File

@ -1 +1,25 @@
/* PROGMAIN.h Copyright (C) 2009 Philip Cummins, Richard F. Bannister, 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. */ #ifdef PROGMAIN_H #error "header already included" #else #define PROGMAIN_H #endif EXPORTPROC EmulationReserveAlloc(void); EXPORTPROC ProgramMain(void);
/*
PROGMAIN.h
Copyright (C) 2009 Philip Cummins, Richard F. Bannister,
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.
*/
#ifdef PROGMAIN_H
#error "header already included"
#else
#define PROGMAIN_H
#endif
EXPORTPROC EmulationReserveAlloc(void);
EXPORTPROC ProgramMain(void);

File diff suppressed because one or more lines are too long

View File

@ -1 +1,23 @@
/* ROMEMDEV.h Copyright (C) 2003 Philip Cummins, 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. */ #ifdef ROMEMDEV_H #error "header already included" #else #define ROMEMDEV_H #endif EXPORTFUNC blnr ROM_Init(void);
/*
ROMEMDEV.h
Copyright (C) 2003 Philip Cummins, 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.
*/
#ifdef ROMEMDEV_H
#error "header already included"
#else
#define ROMEMDEV_H
#endif
EXPORTFUNC blnr ROM_Init(void);

File diff suppressed because one or more lines are too long

View File

@ -1 +1,28 @@
/* RTCEMDEV.h Copyright (C) 2003 Philip Cummins, 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. */ #ifdef RTCEMDEV_H #error "header already included" #else #define RTCEMDEV_H #endif EXPORTFUNC blnr RTC_Init(void); EXPORTPROC RTC_Interrupt(void); EXPORTPROC RTCunEnabled_ChangeNtfy(void); EXPORTPROC RTCclock_ChangeNtfy(void); EXPORTPROC RTCdataLine_ChangeNtfy(void);
/*
RTCEMDEV.h
Copyright (C) 2003 Philip Cummins, 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.
*/
#ifdef RTCEMDEV_H
#error "header already included"
#else
#define RTCEMDEV_H
#endif
EXPORTFUNC blnr RTC_Init(void);
EXPORTPROC RTC_Interrupt(void);
EXPORTPROC RTCunEnabled_ChangeNtfy(void);
EXPORTPROC RTCclock_ChangeNtfy(void);
EXPORTPROC RTCdataLine_ChangeNtfy(void);

File diff suppressed because one or more lines are too long

View File

@ -1 +1,32 @@
/* SCCEMDEV.h Copyright (C) 2004 Philip Cummins, 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. */ #ifdef SCCEMDEV_H #error "header already included" #else #define SCCEMDEV_H #endif EXPORTPROC SCC_Reset(void); EXPORTFUNC ui5b SCC_Access(ui5b Data, blnr WriteMem, CPTR addr); EXPORTFUNC blnr SCC_InterruptsEnabled(void); #if EmLocalTalk EXPORTPROC LocalTalkTick(void); EXPORTFUNC int InitLocalTalk(void); #endif
/*
SCCEMDEV.h
Copyright (C) 2004 Philip Cummins, 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.
*/
#ifdef SCCEMDEV_H
#error "header already included"
#else
#define SCCEMDEV_H
#endif
EXPORTPROC SCC_Reset(void);
EXPORTFUNC ui5b SCC_Access(ui5b Data, blnr WriteMem, CPTR addr);
EXPORTFUNC blnr SCC_InterruptsEnabled(void);
#if EmLocalTalk
EXPORTPROC LocalTalkTick(void);
EXPORTFUNC int InitLocalTalk(void);
#endif

View File

@ -1 +1,59 @@
/* SCRNEMDV.c Copyright (C) 2006 Philip Cummins, Richard F. Bannister, 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. */ /* SCReeN EMulated DeVice Emulation of the screen in the Mac Plus. This code descended from "Screen-MacOS.c" in Richard F. Bannister's Macintosh port of vMac, by Philip Cummins. */ #ifndef AllFiles #include "SYSDEPNS.h" #include "MYOSGLUE.h" #include "ENDIANAC.h" #include "EMCONFIG.h" #include "GLOBGLUE.h" #endif #include "SCRNEMDV.h" #if ! IncludeVidMem #define kMain_Offset 0x5900 #define kAlternate_Offset 0xD900 #define kMain_Buffer (kRAM_Size - kMain_Offset) #define kAlternate_Buffer (kRAM_Size - kAlternate_Offset) #endif GLOBALPROC Screen_EndTickNotify(void) { ui3p screencurrentbuff; #if IncludeVidMem screencurrentbuff = VidMem; #else if (SCRNvPage2 == 1) { screencurrentbuff = get_ram_address(kMain_Buffer); } else { screencurrentbuff = get_ram_address(kAlternate_Buffer); } #endif Screen_OutputFrame(screencurrentbuff); }
/*
SCRNEMDV.c
Copyright (C) 2006 Philip Cummins, Richard F. Bannister,
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.
*/
/*
SCReeN EMulated DeVice
Emulation of the screen in the Mac Plus.
This code descended from "Screen-MacOS.c" in Richard F. Bannister's
Macintosh port of vMac, by Philip Cummins.
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "ENDIANAC.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#endif
#include "SCRNEMDV.h"
#if ! IncludeVidMem
#define kMain_Offset 0x5900
#define kAlternate_Offset 0xD900
#define kMain_Buffer (kRAM_Size - kMain_Offset)
#define kAlternate_Buffer (kRAM_Size - kAlternate_Offset)
#endif
GLOBALPROC Screen_EndTickNotify(void)
{
ui3p screencurrentbuff;
#if IncludeVidMem
screencurrentbuff = VidMem;
#else
if (SCRNvPage2 == 1) {
screencurrentbuff = get_ram_address(kMain_Buffer);
} else {
screencurrentbuff = get_ram_address(kAlternate_Buffer);
}
#endif
Screen_OutputFrame(screencurrentbuff);
}

View File

@ -1 +1,24 @@
/* SCRNEMDV.h Copyright (C) 2006 Philip Cummins, Richard F. Bannister, 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. */ #ifdef SCRNEMDV_H #error "header already included" #else #define SCRNEMDV_H #endif EXPORTPROC Screen_EndTickNotify(void);
/*
SCRNEMDV.h
Copyright (C) 2006 Philip Cummins, Richard F. Bannister,
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.
*/
#ifdef SCRNEMDV_H
#error "header already included"
#else
#define SCRNEMDV_H
#endif
EXPORTPROC Screen_EndTickNotify(void);

397
Mini vMac/mnvm_core/SCRNHACK.h Executable file
View File

@ -0,0 +1,397 @@
/*
SCRNHACK.h
Copyright (C) 2007 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.
*/
/*
SCReeN Hack
Patch ROM to support other screen sizes.
*/
#if CurEmMd <= kEmMd_128K
do_put_mem_long(112 + ROM, kVidMem_Base);
do_put_mem_long(260 + ROM, kVidMem_Base);
do_put_mem_long(292 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 9) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 24))
/ 8);
/* sad mac, error code */
do_put_mem_word(330 + ROM, vMacScreenWidth / 8);
do_put_mem_word(342 + ROM, vMacScreenWidth / 8);
do_put_mem_word(350 + ROM, vMacScreenWidth / 4 * 3 - 1);
/* sad mac, blink pixels */
do_put_mem_word(358 + ROM, vMacScreenWidth - 4);
do_put_mem_word(456 + ROM,
(vMacScreenHeight * vMacScreenWidth / 32) - 1 + 32);
/* screen setup, main */
{
pto = 862 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(892 + ROM, vMacScreenHeight - 1);
do_put_mem_word(894 + ROM, vMacScreenWidth - 1);
/* blink floppy, disk icon */
do_put_mem_long(1388 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(1406 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
/* blink floppy and sadmac, position */
do_put_mem_word(1966 + ROM, vMacScreenWidth / 8 - 4);
do_put_mem_word(1982 + ROM, vMacScreenWidth / 8);
/* sad mac, mac icon */
do_put_mem_long(2008 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(2020 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(2052 + ROM, vMacScreenWidth / 8 - 2);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 3448 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave),A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x,D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(3452 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(3572 + ROM, vMacScreenWidth - 32);
do_put_mem_word(3578 + ROM, vMacScreenWidth - 32);
do_put_mem_word(3610 + ROM, vMacScreenHeight - 16);
do_put_mem_word(3616 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 3646 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x,D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5,D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1,A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(3646 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(3832 + ROM, vMacScreenHeight);
do_put_mem_word(3838 + ROM, vMacScreenWidth);
/* do_put_mem_word(7810 + ROM, vMacScreenHeight); */
#elif CurEmMd <= kEmMd_Plus
do_put_mem_long(138 + ROM, kVidMem_Base);
do_put_mem_long(326 + ROM, kVidMem_Base);
do_put_mem_long(356 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 9) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 24))
/ 8);
/* sad mac, error code */
do_put_mem_word(392 + ROM, vMacScreenWidth / 8);
do_put_mem_word(404 + ROM, vMacScreenWidth / 8);
do_put_mem_word(412 + ROM, vMacScreenWidth / 4 * 3 - 1);
/* sad mac, blink pixels */
do_put_mem_long(420 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 17) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(494 + ROM,
(vMacScreenHeight * vMacScreenWidth / 32) - 1);
/* screen setup, main */
{
pto = 1132 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(1140 + ROM, vMacScreenWidth / 8);
do_put_mem_word(1172 + ROM, vMacScreenHeight);
do_put_mem_word(1176 + ROM, vMacScreenWidth);
/* blink floppy, disk icon */
do_put_mem_long(2016 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(2034 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(2574 + ROM, vMacScreenHeight);
do_put_mem_word(2576 + ROM, vMacScreenWidth);
/* blink floppy and sadmac, position */
do_put_mem_word(3810 + ROM, vMacScreenWidth / 8 - 4);
do_put_mem_word(3826 + ROM, vMacScreenWidth / 8);
/* sad mac, mac icon */
do_put_mem_long(3852 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(3864 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(3894 + ROM, vMacScreenWidth / 8 - 2);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 7372 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave), A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x, D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(7376 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(7496 + ROM, vMacScreenWidth - 32);
do_put_mem_word(7502 + ROM, vMacScreenWidth - 32);
do_put_mem_word(7534 + ROM, vMacScreenHeight - 16);
do_put_mem_word(7540 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 7570 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x,D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5,D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1,A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(7570 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(7784 + ROM, vMacScreenHeight);
do_put_mem_word(7790 + ROM, vMacScreenWidth);
do_put_mem_word(7810 + ROM, vMacScreenHeight);
#if 0
/*
Haven't got these working. Alert outlines ok, but
not contents. Perhaps global position of contents
stored in system resource file.
*/
/* perhaps switch disk alert */
do_put_mem_word(10936 + ROM, vMacScreenHeight / 2 - 91);
do_put_mem_word(10938 + ROM, vMacScreenWidth / 2 - 136);
do_put_mem_word(10944 + ROM, vMacScreenHeight / 2 - 19);
do_put_mem_word(10946 + ROM, vMacScreenWidth / 2 + 149);
do_put_mem_word(11008 + ROM, ?);
do_put_mem_word(11010 + ROM, ?);
/* DSAlertRect */
do_put_mem_word(4952 + ROM, vMacScreenHeight / 2 - 107);
do_put_mem_word(4954 + ROM, vMacScreenWidth / 2 - 236);
do_put_mem_word(4958 + ROM, vMacScreenHeight / 2 + 19);
do_put_mem_word(4960 + ROM, vMacScreenWidth / 2 + 236);
do_put_mem_word(5212 + ROM, vMacScreenHeight / 2 - 101);
do_put_mem_word(5214 + ROM, vMacScreenWidth / 2 - 218);
#endif
#elif CurEmMd <= kEmMd_Classic
/* screen setup, main */
{
pto = 1482 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(1490 + ROM, vMacScreenWidth / 8);
do_put_mem_word(1546 + ROM, vMacScreenHeight);
do_put_mem_word(1550 + ROM, vMacScreenWidth);
do_put_mem_word(2252 + ROM, vMacScreenHeight);
do_put_mem_word(2254 + ROM, vMacScreenWidth);
/* blink floppy, disk icon */
do_put_mem_long(3916 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(3934 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_long(4258 + ROM, kVidMem_Base);
do_put_mem_word(4264 + ROM, vMacScreenHeight);
do_put_mem_word(4268 + ROM, vMacScreenWidth);
do_put_mem_word(4272 + ROM, vMacScreenWidth / 8);
do_put_mem_long(4276 + ROM, vMacScreenNumBytes);
/* sad mac, mac icon */
do_put_mem_long(4490 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(4504 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(4528 + ROM, vMacScreenWidth / 8);
/* blink floppy and sadmac, position */
do_put_mem_word(4568 + ROM, vMacScreenWidth / 8);
do_put_mem_word(4586 + ROM, vMacScreenWidth / 8);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 101886 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave),A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x,D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(101890 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(102010 + ROM, vMacScreenWidth - 32);
do_put_mem_word(102016 + ROM, vMacScreenWidth - 32);
do_put_mem_word(102048 + ROM, vMacScreenHeight - 16);
do_put_mem_word(102054 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 102084 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x, D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5, D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1, A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(102084 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(102298 + ROM, vMacScreenHeight);
do_put_mem_word(102304 + ROM, vMacScreenWidth);
do_put_mem_word(102324 + ROM, vMacScreenHeight);
#endif

View File

@ -1 +1,168 @@
/* SCRNMAPR.h Copyright (C) 2012 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. */ /* SCReeN MAPpeR */ /* required arguments for this template */ #ifndef ScrnMapr_DoMap /* procedure to be created by this template */ #error "ScrnMapr_DoMap not defined" #endif #ifndef ScrnMapr_Src #error "ScrnMapr_Src not defined" #endif #ifndef ScrnMapr_Dst #error "ScrnMapr_Dst not defined" #endif #ifndef ScrnMapr_SrcDepth #error "ScrnMapr_SrcDepth not defined" #endif #ifndef ScrnMapr_DstDepth #error "ScrnMapr_DstDepth not defined" #endif #ifndef ScrnMapr_Map #error "ScrnMapr_Map not defined" #endif /* optional argument for this template */ #ifndef ScrnMapr_Scale #define ScrnMapr_Scale 1 #endif /* check of parameters */ #if (ScrnMapr_SrcDepth < 0) || (ScrnMapr_SrcDepth > 3) #error "bad ScrnMapr_SrcDepth" #endif #if (ScrnMapr_DstDepth < ScrnMapr_SrcDepth) #error "bad ScrnMapr_Dst" #endif /* calculate a few things local to this template */ #define ScrnMapr_MapElSz \ (ScrnMapr_Scale << (ScrnMapr_DstDepth - ScrnMapr_SrcDepth)) #if 0 == (ScrnMapr_MapElSz & 3) #define ScrnMapr_TranT ui5b #define ScrnMapr_TranLn2Sz 2 #elif 0 == (ScrnMapr_MapElSz & 1) #define ScrnMapr_TranT ui4b #define ScrnMapr_TranLn2Sz 1 #else #define ScrnMapr_TranT ui3b #define ScrnMapr_TranLn2Sz 0 #endif #define ScrnMapr_TranN (ScrnMapr_MapElSz >> ScrnMapr_TranLn2Sz) #define ScrnMapr_ScrnWB (vMacScreenWidth >> (3 - ScrnMapr_SrcDepth)) /* now define the procedure */ LOCALPROC ScrnMapr_DoMap(si4b top, si4b left, si4b bottom, si4b right) { int i; int j; #if (ScrnMapr_TranN > 4) || (ScrnMapr_Scale > 2) int k; #endif ui5r t0; ScrnMapr_TranT *pMap; #if ScrnMapr_Scale > 1 ScrnMapr_TranT *p3; #endif ui4r leftB = left >> (3 - ScrnMapr_SrcDepth); ui4r rightB = (right + (1 << (3 - ScrnMapr_SrcDepth)) - 1) >> (3 - ScrnMapr_SrcDepth); ui4r jn = rightB - leftB; ui4r SrcSkip = ScrnMapr_ScrnWB - jn; ui3b *pSrc = ((ui3b *)ScrnMapr_Src) + leftB + ScrnMapr_ScrnWB * (ui5r)top; ScrnMapr_TranT *pDst = ((ScrnMapr_TranT *)ScrnMapr_Dst) + ((leftB + ScrnMapr_ScrnWB * ScrnMapr_Scale * (ui5r)top) * ScrnMapr_TranN); ui5r DstSkip = SrcSkip * ScrnMapr_TranN; for (i = bottom - top; --i >= 0; ) { #if ScrnMapr_Scale > 1 p3 = pDst; #endif for (j = jn; --j >= 0; ) { t0 = *pSrc++; pMap = &((ScrnMapr_TranT *)ScrnMapr_Map)[t0 * ScrnMapr_TranN]; #if ScrnMapr_TranN > 4 for (k = ScrnMapr_TranN; --k >= 0; ) { *pDst++ = *pMap++; } #else #if ScrnMapr_TranN >= 2 *pDst++ = *pMap++; #endif #if ScrnMapr_TranN >= 3 *pDst++ = *pMap++; #endif #if ScrnMapr_TranN >= 4 *pDst++ = *pMap++; #endif *pDst++ = *pMap; #endif /* ! ScrnMapr_TranN > 4 */ } pSrc += SrcSkip; pDst += DstSkip; #if ScrnMapr_Scale > 1 #if ScrnMapr_Scale > 2 for (k = ScrnMapr_Scale - 1; --k >= 0; ) #endif { pMap = p3; for (j = ScrnMapr_TranN * jn; --j >= 0; ) { *pDst++ = *pMap++; } pDst += DstSkip; } #endif /* ScrnMapr_Scale > 1 */ } } /* undefine template locals and parameters */ #undef ScrnMapr_ScrnWB #undef ScrnMapr_TranN #undef ScrnMapr_TranLn2Sz #undef ScrnMapr_TranT #undef ScrnMapr_MapElSz #undef ScrnMapr_DoMap #undef ScrnMapr_Src #undef ScrnMapr_Dst #undef ScrnMapr_SrcDepth #undef ScrnMapr_DstDepth #undef ScrnMapr_Map #undef ScrnMapr_Scale
/*
SCRNMAPR.h
Copyright (C) 2012 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.
*/
/*
SCReeN MAPpeR
*/
/* required arguments for this template */
#ifndef ScrnMapr_DoMap /* procedure to be created by this template */
#error "ScrnMapr_DoMap not defined"
#endif
#ifndef ScrnMapr_Src
#error "ScrnMapr_Src not defined"
#endif
#ifndef ScrnMapr_Dst
#error "ScrnMapr_Dst not defined"
#endif
#ifndef ScrnMapr_SrcDepth
#error "ScrnMapr_SrcDepth not defined"
#endif
#ifndef ScrnMapr_DstDepth
#error "ScrnMapr_DstDepth not defined"
#endif
#ifndef ScrnMapr_Map
#error "ScrnMapr_Map not defined"
#endif
/* optional argument for this template */
#ifndef ScrnMapr_Scale
#define ScrnMapr_Scale 1
#endif
/* check of parameters */
#if (ScrnMapr_SrcDepth < 0) || (ScrnMapr_SrcDepth > 3)
#error "bad ScrnMapr_SrcDepth"
#endif
#if (ScrnMapr_DstDepth < ScrnMapr_SrcDepth)
#error "bad ScrnMapr_Dst"
#endif
/* calculate a few things local to this template */
#define ScrnMapr_MapElSz \
(ScrnMapr_Scale << (ScrnMapr_DstDepth - ScrnMapr_SrcDepth))
#if 0 == (ScrnMapr_MapElSz & 3)
#define ScrnMapr_TranT ui5b
#define ScrnMapr_TranLn2Sz 2
#elif 0 == (ScrnMapr_MapElSz & 1)
#define ScrnMapr_TranT ui4b
#define ScrnMapr_TranLn2Sz 1
#else
#define ScrnMapr_TranT ui3b
#define ScrnMapr_TranLn2Sz 0
#endif
#define ScrnMapr_TranN (ScrnMapr_MapElSz >> ScrnMapr_TranLn2Sz)
#define ScrnMapr_ScrnWB (vMacScreenWidth >> (3 - ScrnMapr_SrcDepth))
/* now define the procedure */
LOCALPROC ScrnMapr_DoMap(si4b top, si4b left,
si4b bottom, si4b right)
{
int i;
int j;
#if (ScrnMapr_TranN > 4) || (ScrnMapr_Scale > 2)
int k;
#endif
ui5r t0;
ScrnMapr_TranT *pMap;
#if ScrnMapr_Scale > 1
ScrnMapr_TranT *p3;
#endif
ui4r leftB = left >> (3 - ScrnMapr_SrcDepth);
ui4r rightB = (right + (1 << (3 - ScrnMapr_SrcDepth)) - 1)
>> (3 - ScrnMapr_SrcDepth);
ui4r jn = rightB - leftB;
ui4r SrcSkip = ScrnMapr_ScrnWB - jn;
ui3b *pSrc = ((ui3b *)ScrnMapr_Src)
+ leftB + ScrnMapr_ScrnWB * (ui5r)top;
ScrnMapr_TranT *pDst = ((ScrnMapr_TranT *)ScrnMapr_Dst)
+ ((leftB + ScrnMapr_ScrnWB * ScrnMapr_Scale * (ui5r)top)
* ScrnMapr_TranN);
ui5r DstSkip = SrcSkip * ScrnMapr_TranN;
for (i = bottom - top; --i >= 0; ) {
#if ScrnMapr_Scale > 1
p3 = pDst;
#endif
for (j = jn; --j >= 0; ) {
t0 = *pSrc++;
pMap =
&((ScrnMapr_TranT *)ScrnMapr_Map)[t0 * ScrnMapr_TranN];
#if ScrnMapr_TranN > 4
for (k = ScrnMapr_TranN; --k >= 0; ) {
*pDst++ = *pMap++;
}
#else
#if ScrnMapr_TranN >= 2
*pDst++ = *pMap++;
#endif
#if ScrnMapr_TranN >= 3
*pDst++ = *pMap++;
#endif
#if ScrnMapr_TranN >= 4
*pDst++ = *pMap++;
#endif
*pDst++ = *pMap;
#endif /* ! ScrnMapr_TranN > 4 */
}
pSrc += SrcSkip;
pDst += DstSkip;
#if ScrnMapr_Scale > 1
#if ScrnMapr_Scale > 2
for (k = ScrnMapr_Scale - 1; --k >= 0; )
#endif
{
pMap = p3;
for (j = ScrnMapr_TranN * jn; --j >= 0; ) {
*pDst++ = *pMap++;
}
pDst += DstSkip;
}
#endif /* ScrnMapr_Scale > 1 */
}
}
/* undefine template locals and parameters */
#undef ScrnMapr_ScrnWB
#undef ScrnMapr_TranN
#undef ScrnMapr_TranLn2Sz
#undef ScrnMapr_TranT
#undef ScrnMapr_MapElSz
#undef ScrnMapr_DoMap
#undef ScrnMapr_Src
#undef ScrnMapr_Dst
#undef ScrnMapr_SrcDepth
#undef ScrnMapr_DstDepth
#undef ScrnMapr_Map
#undef ScrnMapr_Scale

161
Mini vMac/mnvm_core/SCRNTRNS.h Executable file
View File

@ -0,0 +1,161 @@
/*
SCRNTRNS.h
Copyright (C) 2012 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.
*/
/*
SCReeN TRaNSlater
*/
/* required arguments for this template */
#ifndef ScrnTrns_DoTrans /* procedure to be created by this template */
#error "ScrnTrns_DoTrans not defined"
#endif
#ifndef ScrnTrns_Src
#error "ScrnTrns_Src not defined"
#endif
#ifndef ScrnTrns_Dst
#error "ScrnTrns_Dst not defined"
#endif
#ifndef ScrnTrns_SrcDepth
#error "ScrnTrns_SrcDepth not defined"
#endif
#ifndef ScrnTrns_DstDepth
#error "ScrnTrns_DstDepth not defined"
#endif
/* optional argument for this template */
#ifndef ScrnTrns_Scale
#define ScrnTrns_Scale 1
#endif
#ifndef ScrnTrns_DstZLo
#define ScrnTrns_DstZLo 0
#endif
/* check of parameters */
#if (ScrnTrns_SrcDepth < 4)
#error "bad ScrnTrns_SrcDepth"
#endif
#if (ScrnTrns_DstDepth < 4)
#error "bad ScrnTrns_Dst"
#endif
/* now define the procedure */
LOCALPROC ScrnTrns_DoTrans(si4b top, si4b left,
si4b bottom, si4b right)
{
int i;
int j;
ui5b t0;
ui5b t1;
ui4r jn = right - left;
ui4r SrcSkip = vMacScreenByteWidth
- (jn << (ScrnTrns_SrcDepth - 3));
ui3b *pSrc = ((ui3b *)ScrnTrns_Src)
+ (left << (ScrnTrns_SrcDepth - 3))
+ vMacScreenByteWidth * (ui5r)top;
ui5b *pDst = ((ui5b *)ScrnTrns_Dst)
+ left * ScrnTrns_Scale
+ (ui5r)vMacScreenWidth * ScrnTrns_Scale * ScrnTrns_Scale * top;
ui4r DstSkip = (vMacScreenWidth - jn) * ScrnTrns_Scale;
#if ScrnTrns_Scale > 1
int k;
ui5b *p3;
ui5b *p4;
#endif
for (i = bottom - top; --i >= 0; ) {
#if ScrnTrns_Scale > 1
p3 = pDst;
#endif
for (j = jn; --j >= 0; ) {
#if 4 == ScrnTrns_SrcDepth
t0 = do_get_mem_word(pSrc);
pSrc += 2;
t1 =
#if ScrnTrns_DstZLo
((t0 & 0x7C00) << 17) |
((t0 & 0x7000) << 12) |
((t0 & 0x03E0) << 14) |
((t0 & 0x0380) << 9) |
((t0 & 0x001F) << 11) |
((t0 & 0x001C) << 6);
#else
((t0 & 0x7C00) << 9) |
((t0 & 0x7000) << 4) |
((t0 & 0x03E0) << 6) |
((t0 & 0x0380) << 1) |
((t0 & 0x001F) << 3) |
((t0 & 0x001C) >> 2);
#endif
#if 0
((t0 & 0x7C00) << 1) |
((t0 & 0x7000) >> 4) |
((t0 & 0x03E0) << 14) |
((t0 & 0x0380) << 9) |
((t0 & 0x001F) << 27) |
((t0 & 0x001C) << 22);
#endif
#elif 5 == ScrnTrns_SrcDepth
t0 = do_get_mem_long(pSrc);
pSrc += 4;
#if ScrnTrns_DstZLo
t1 = t0 << 8;
#else
t1 = t0;
#endif
#endif
#if ScrnTrns_Scale > 1
for (k = ScrnTrns_Scale; --k >= 0; )
#endif
{
*pDst++ = t1;
}
}
pSrc += SrcSkip;
pDst += DstSkip;
#if ScrnTrns_Scale > 1
#if ScrnTrns_Scale > 2
for (k = ScrnTrns_Scale - 1; --k >= 0; )
#endif
{
p4 = p3;
for (j = ScrnTrns_Scale * jn; --j >= 0; ) {
*pDst++ = *p4++;
}
pDst += DstSkip;
}
#endif /* ScrnTrns_Scale > 1 */
}
}
/* undefine template locals and parameters */
#undef ScrnTrns_DoTrans
#undef ScrnTrns_Src
#undef ScrnTrns_Dst
#undef ScrnTrns_SrcDepth
#undef ScrnTrns_DstDepth
#undef ScrnTrns_Scale
#undef ScrnTrns_DstZLo

View File

@ -1 +1,155 @@
/* SCSIEMDV.c Copyright (C) 2004 Philip Cummins, 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. */ /* Small Computer System Interface EMulated DeVice Emulates the SCSI found in the Mac Plus. This code adapted from "SCSI.c" in vMac by Philip Cummins. */ /* NCR5380 chip emulation by Yoav Shadmi, 1998 */ #ifndef AllFiles #include "SYSDEPNS.h" #include "ENDIANAC.h" #include "MYOSGLUE.h" #include "EMCONFIG.h" #include "GLOBGLUE.h" #endif #include "SCSIEMDV.h" #define scsiRd 0x00 #define scsiWr 0x01 #define sCDR 0x00 /* current scsi data register (r/o) */ #define sODR 0x00 /* output data register (w/o) */ #define sICR 0x02 /* initiator command register (r/w) */ #define sMR 0x04 /* mode register (r/w) */ #define sTCR 0x06 /* target command register (r/w) */ #define sCSR 0x08 /* current SCSI bus status (r/o) */ #define sSER 0x08 /* select enable register (w/o) */ #define sBSR 0x0A /* bus and status register (r/o) */ #define sDMAtx 0x0A /* start DMA send (w/o) */ #define sIDR 0x0C /* input data register (r/o) */ #define sTDMArx 0x0C /* start DMA target receive (w/o) */ #define sRESET 0x0E /* reset parity/interrupt (r/o) */ #define sIDMArx 0x0E /* start DMA initiator receive (w/o) */ #define kSCSI_Size 0x00010 LOCALVAR ui3b SCSI[kSCSI_Size]; GLOBALPROC SCSI_Reset(void) { int i; for (i = 0; i < kSCSI_Size; i++) { SCSI[i] = 0; } } LOCALPROC SCSI_BusReset(void) { SCSI[scsiRd + sCDR] = 0; SCSI[scsiWr + sODR] = 0; SCSI[scsiRd + sICR] = 0x80; SCSI[scsiWr + sICR] &= 0x80; SCSI[scsiRd + sMR] &= 0x40; SCSI[scsiWr + sMR] &= 0x40; SCSI[scsiRd + sTCR] = 0; SCSI[scsiWr + sTCR] = 0; SCSI[scsiRd + sCSR] = 0x80; SCSI[scsiWr + sSER] = 0; SCSI[scsiRd + sBSR] = 0x10; SCSI[scsiWr + sDMAtx] = 0; SCSI[scsiRd + sIDR] = 0; SCSI[scsiWr + sTDMArx] = 0; SCSI[scsiRd + sRESET] = 0; SCSI[scsiWr + sIDMArx] = 0; #if 0 SCSI[scsiRd + sODR + dackWr] = 0; SCSI[scsiWr + sIDR + dackRd] = 0; #endif /* The missing piece of the puzzle.. :) */ put_ram_word(0xb22, get_ram_word(0xb22) | 0x8000); } LOCALPROC SCSI_Check(void) { /* The arbitration select/reselect scenario [stub.. doesn't really work...] */ if ((SCSI[scsiWr + sODR] >> 7) == 1) { /* Check if the Mac tries to be an initiator */ if ((SCSI[scsiWr + sMR] & 1) == 1) { /* the Mac set arbitration in progress */ /* stub! tell the mac that there is arbitration in progress... */ SCSI[scsiRd + sICR] |= 0x40; /* ... that we didn't lose arbitration ... */ SCSI[scsiRd + sICR] &= ~ 0x20; /* ... and that there isn't a higher priority ID present... */ SCSI[scsiRd + sCDR] = 0x00; /* ... the arbitration and selection/reselection is complete. the initiator tries to connect to the SCSI device, fails and returns after timeout. */ } } /* check the chip registers, AS SET BY THE CPU */ if ((SCSI[scsiWr + sICR] >> 7) == 1) { /* Check Assert RST */ SCSI_BusReset(); } else { SCSI[scsiRd + sICR] &= ~ 0x80; SCSI[scsiRd + sCSR] &= ~ 0x80; } if ((SCSI[scsiWr + sICR] >> 2) == 1) { /* Check Assert SEL */ SCSI[scsiRd + sCSR] |= 0x02; SCSI[scsiRd + sBSR] = 0x10; } else { SCSI[scsiRd + sCSR] &= ~ 0x02; } } GLOBALFUNC ui5b SCSI_Access(ui5b Data, blnr WriteMem, CPTR addr) { if (addr < (kSCSI_Size / 2)) { addr *= 2; if (WriteMem) { SCSI[addr + 1] = Data; SCSI_Check(); } else { Data = SCSI[addr]; } } return Data; }
/*
SCSIEMDV.c
Copyright (C) 2004 Philip Cummins, 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.
*/
/*
Small Computer System Interface EMulated DeVice
Emulates the SCSI found in the Mac Plus.
This code adapted from "SCSI.c" in vMac by Philip Cummins.
*/
/* NCR5380 chip emulation by Yoav Shadmi, 1998 */
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "ENDIANAC.h"
#include "MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#endif
#include "SCSIEMDV.h"
#define scsiRd 0x00
#define scsiWr 0x01
#define sCDR 0x00 /* current scsi data register (r/o) */
#define sODR 0x00 /* output data register (w/o) */
#define sICR 0x02 /* initiator command register (r/w) */
#define sMR 0x04 /* mode register (r/w) */
#define sTCR 0x06 /* target command register (r/w) */
#define sCSR 0x08 /* current SCSI bus status (r/o) */
#define sSER 0x08 /* select enable register (w/o) */
#define sBSR 0x0A /* bus and status register (r/o) */
#define sDMAtx 0x0A /* start DMA send (w/o) */
#define sIDR 0x0C /* input data register (r/o) */
#define sTDMArx 0x0C /* start DMA target receive (w/o) */
#define sRESET 0x0E /* reset parity/interrupt (r/o) */
#define sIDMArx 0x0E /* start DMA initiator receive (w/o) */
#define kSCSI_Size 0x00010
LOCALVAR ui3b SCSI[kSCSI_Size];
GLOBALPROC SCSI_Reset(void)
{
int i;
for (i = 0; i < kSCSI_Size; i++) {
SCSI[i] = 0;
}
}
LOCALPROC SCSI_BusReset(void)
{
SCSI[scsiRd + sCDR] = 0;
SCSI[scsiWr + sODR] = 0;
SCSI[scsiRd + sICR] = 0x80;
SCSI[scsiWr + sICR] &= 0x80;
SCSI[scsiRd + sMR] &= 0x40;
SCSI[scsiWr + sMR] &= 0x40;
SCSI[scsiRd + sTCR] = 0;
SCSI[scsiWr + sTCR] = 0;
SCSI[scsiRd + sCSR] = 0x80;
SCSI[scsiWr + sSER] = 0;
SCSI[scsiRd + sBSR] = 0x10;
SCSI[scsiWr + sDMAtx] = 0;
SCSI[scsiRd + sIDR] = 0;
SCSI[scsiWr + sTDMArx] = 0;
SCSI[scsiRd + sRESET] = 0;
SCSI[scsiWr + sIDMArx] = 0;
#if 0
SCSI[scsiRd + sODR + dackWr] = 0;
SCSI[scsiWr + sIDR + dackRd] = 0;
#endif
/* The missing piece of the puzzle.. :) */
put_ram_word(0xb22, get_ram_word(0xb22) | 0x8000);
}
LOCALPROC SCSI_Check(void)
{
/*
The arbitration select/reselect scenario
[stub.. doesn't really work...]
*/
if ((SCSI[scsiWr + sODR] >> 7) == 1) {
/* Check if the Mac tries to be an initiator */
if ((SCSI[scsiWr + sMR] & 1) == 1) {
/* the Mac set arbitration in progress */
/*
stub! tell the mac that there
is arbitration in progress...
*/
SCSI[scsiRd + sICR] |= 0x40;
/* ... that we didn't lose arbitration ... */
SCSI[scsiRd + sICR] &= ~ 0x20;
/*
... and that there isn't a higher priority ID present...
*/
SCSI[scsiRd + sCDR] = 0x00;
/*
... the arbitration and selection/reselection is
complete. the initiator tries to connect to the SCSI
device, fails and returns after timeout.
*/
}
}
/* check the chip registers, AS SET BY THE CPU */
if ((SCSI[scsiWr + sICR] >> 7) == 1) {
/* Check Assert RST */
SCSI_BusReset();
} else {
SCSI[scsiRd + sICR] &= ~ 0x80;
SCSI[scsiRd + sCSR] &= ~ 0x80;
}
if ((SCSI[scsiWr + sICR] >> 2) == 1) {
/* Check Assert SEL */
SCSI[scsiRd + sCSR] |= 0x02;
SCSI[scsiRd + sBSR] = 0x10;
} else {
SCSI[scsiRd + sCSR] &= ~ 0x02;
}
}
GLOBALFUNC ui5b SCSI_Access(ui5b Data, blnr WriteMem, CPTR addr)
{
if (addr < (kSCSI_Size / 2)) {
addr *= 2;
if (WriteMem) {
SCSI[addr + 1] = Data;
SCSI_Check();
} else {
Data = SCSI[addr];
}
}
return Data;
}

View File

@ -1 +1,25 @@
/* SCSIEMDV.h Copyright (C) 2004 Philip Cummins, 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. */ #ifdef SCSIEMDV_H #error "header already included" #else #define SCSIEMDV_H #endif EXPORTPROC SCSI_Reset(void); EXPORTFUNC ui5b SCSI_Access(ui5b Data, blnr WriteMem, CPTR addr);
/*
SCSIEMDV.h
Copyright (C) 2004 Philip Cummins, 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.
*/
#ifdef SCSIEMDV_H
#error "header already included"
#else
#define SCSIEMDV_H
#endif
EXPORTPROC SCSI_Reset(void);
EXPORTFUNC ui5b SCSI_Access(ui5b Data, blnr WriteMem, CPTR addr);

View File

@ -1 +1,213 @@
/* SNDEMDEV.c Copyright (C) 2003 Philip Cummins, 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. */ /* SouND EMulated DEVice Emulation of Sound in the Mac Plus could go here. This code adapted from "Sound.c" in vMac by Philip Cummins. */ #ifndef AllFiles #include "SYSDEPNS.h" #include "MYOSGLUE.h" #include "EMCONFIG.h" #include "GLOBGLUE.h" #endif #include "SNDEMDEV.h" #if MySoundEnabled #define kSnd_Main_Offset 0x0300 #define kSnd_Alt_Offset 0x5F00 #define kSnd_Main_Buffer (kRAM_Size - kSnd_Main_Offset) #define kSnd_Alt_Buffer (kRAM_Size - kSnd_Alt_Offset) /* approximate volume levels of vMac, so: x * vol_mult[SoundVolume] >> 16 + vol_offset[SoundVolume] = {approx} (x - kCenterSound) / (8 - SoundVolume) + kCenterSound; */ LOCALVAR const ui4b vol_mult[] = { 8192, 9362, 10922, 13107, 16384, 21845, 32768 }; LOCALVAR const trSoundSamp vol_offset[] = { #if 3 == kLn2SoundSampSz 112, 110, 107, 103, 96, 86, 64, 0 #elif 4 == kLn2SoundSampSz 28672, 28087, 27307, 26215, 24576, 21846, 16384, 0 #else #error "unsupported kLn2SoundSampSz" #endif }; LOCALVAR const ui4b SubTick_offset[kNumSubTicks] = { 0, 25, 50, 90, 102, 115, 138, 161, 185, 208, 231, 254, 277, 300, 323, 346 }; LOCALVAR const ui3r SubTick_n[kNumSubTicks] = { 25, 25, 40, 12, 13, 23, 23, 24, 23, 23, 23, 23, 23, 23, 23, 24 }; /* One version of free form sound driver spends around 18000 cycles writing offsets 50 to 370, then around another 3000 cycles writing 0 to 50. So be done with 0 to 50 at end of second sixtieth. */ /* Different in system 6.0.4: spends around 23500 cycles writing offsets 90 to 370, then around another 7500 cycles writing 0 to 90. This is nastier, because gets to be a very small gap between where is being read and where written. So read a bit in advance for third subtick. */ /* startup sound spends around 19500 cycles writing offsets 0 to 370. presumably writing offset 0 before it is read. */ LOCALVAR ui5b SoundInvertPhase = 0; LOCALVAR ui4b SoundInvertState = 0; IMPORTFUNC ui4b GetSoundInvertTime(void); GLOBALPROC MacSound_SubTick(int SubTick) { ui4r actL; tpSoundSamp p; ui4r i; ui5b StartOffset = SubTick_offset[SubTick]; ui4r n = SubTick_n[SubTick]; unsigned long addy = #ifdef SoundBuffer (SoundBuffer == 0) ? kSnd_Alt_Buffer : #endif kSnd_Main_Buffer; ui3p addr = addy + (2 * StartOffset) + RAM; ui4b SoundInvertTime = GetSoundInvertTime(); ui3b SoundVolume = SoundVolb0 | (SoundVolb1 << 1) | (SoundVolb2 << 2); #if dbglog_HAVE && 0 dbglog_StartLine(); dbglog_writeCStr("reading sound buffer "); dbglog_writeHex(StartOffset); dbglog_writeCStr(" to "); dbglog_writeHex(StartOffset + n); dbglog_writeReturn(); #endif label_retry: p = MySound_BeginWrite(n, &actL); if (actL > 0) { if (SoundDisable && (SoundInvertTime == 0)) { for (i = 0; i < actL; i++) { #if 0 *p++ = 0x00; /* this is believed more accurate */ #else /* But this avoids more clicks. */ *p++ = kCenterSound; #endif } } else { for (i = 0; i < actL; i++) { /* Copy sound data, high byte of each word */ *p++ = *addr #if 4 == kLn2SoundSampSz << 8 #endif ; /* Move the address on */ addr += 2; } if (SoundInvertTime != 0) { ui5b PhaseIncr = (ui5b)SoundInvertTime * (ui5b)20; p -= actL; for (i = 0; i < actL; i++) { if (SoundInvertPhase < 704) { ui5b OnPortion = 0; ui5b LastPhase = 0; do { if (! SoundInvertState) { OnPortion += (SoundInvertPhase - LastPhase); } SoundInvertState = ! SoundInvertState; LastPhase = SoundInvertPhase; SoundInvertPhase += PhaseIncr; } while (SoundInvertPhase < 704); if (! SoundInvertState) { OnPortion += 704 - LastPhase; } *p = (*p * OnPortion) / 704; } else { if (SoundInvertState) { *p = 0; } } SoundInvertPhase -= 704; p++; } } } if (SoundVolume < 7) { /* Usually have volume at 7, so this is just for completeness. */ ui5b mult = (ui5b)vol_mult[SoundVolume]; trSoundSamp offset = vol_offset[SoundVolume]; p -= actL; for (i = 0; i < actL; i++) { *p = (trSoundSamp)((ui5b)(*p) * mult >> 16) + offset; ++p; } } MySound_EndWrite(actL); n -= actL; if (n > 0) { goto label_retry; } } } #endif
/*
SNDEMDEV.c
Copyright (C) 2003 Philip Cummins, 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.
*/
/*
SouND EMulated DEVice
Emulation of Sound in the Mac Plus could go here.
This code adapted from "Sound.c" in vMac by Philip Cummins.
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#endif
#include "SNDEMDEV.h"
#if MySoundEnabled
#define kSnd_Main_Offset 0x0300
#define kSnd_Alt_Offset 0x5F00
#define kSnd_Main_Buffer (kRAM_Size - kSnd_Main_Offset)
#define kSnd_Alt_Buffer (kRAM_Size - kSnd_Alt_Offset)
/*
approximate volume levels of vMac, so:
x * vol_mult[SoundVolume] >> 16
+ vol_offset[SoundVolume]
= {approx} (x - kCenterSound) / (8 - SoundVolume) + kCenterSound;
*/
LOCALVAR const ui4b vol_mult[] = {
8192, 9362, 10922, 13107, 16384, 21845, 32768
};
LOCALVAR const trSoundSamp vol_offset[] = {
#if 3 == kLn2SoundSampSz
112, 110, 107, 103, 96, 86, 64, 0
#elif 4 == kLn2SoundSampSz
28672, 28087, 27307, 26215, 24576, 21846, 16384, 0
#else
#error "unsupported kLn2SoundSampSz"
#endif
};
LOCALVAR const ui4b SubTick_offset[kNumSubTicks] = {
0, 25, 50, 90, 102, 115, 138, 161,
185, 208, 231, 254, 277, 300, 323, 346
};
LOCALVAR const ui3r SubTick_n[kNumSubTicks] = {
25, 25, 40, 12, 13, 23, 23, 24,
23, 23, 23, 23, 23, 23, 23, 24
};
/*
One version of free form sound driver
spends around 18000 cycles writing
offsets 50 to 370, then around another 3000
cycles writing 0 to 50. So be done
with 0 to 50 at end of second sixtieth.
*/
/*
Different in system 6.0.4:
spends around 23500 cycles writing
offsets 90 to 370, then around another 7500
cycles writing 0 to 90. This is nastier,
because gets to be a very small gap
between where is being read and
where written. So read a bit in
advance for third subtick.
*/
/*
startup sound spends around 19500 cycles
writing offsets 0 to 370. presumably
writing offset 0 before it is read.
*/
LOCALVAR ui5b SoundInvertPhase = 0;
LOCALVAR ui4b SoundInvertState = 0;
IMPORTFUNC ui4b GetSoundInvertTime(void);
GLOBALPROC MacSound_SubTick(int SubTick)
{
ui4r actL;
tpSoundSamp p;
ui4r i;
ui5b StartOffset = SubTick_offset[SubTick];
ui4r n = SubTick_n[SubTick];
unsigned long addy =
#ifdef SoundBuffer
(SoundBuffer == 0) ? kSnd_Alt_Buffer :
#endif
kSnd_Main_Buffer;
ui3p addr = addy + (2 * StartOffset) + RAM;
ui4b SoundInvertTime = GetSoundInvertTime();
ui3b SoundVolume = SoundVolb0
| (SoundVolb1 << 1)
| (SoundVolb2 << 2);
#if dbglog_HAVE && 0
dbglog_StartLine();
dbglog_writeCStr("reading sound buffer ");
dbglog_writeHex(StartOffset);
dbglog_writeCStr(" to ");
dbglog_writeHex(StartOffset + n);
dbglog_writeReturn();
#endif
label_retry:
p = MySound_BeginWrite(n, &actL);
if (actL > 0) {
if (SoundDisable && (SoundInvertTime == 0)) {
for (i = 0; i < actL; i++) {
#if 0
*p++ = 0x00; /* this is believed more accurate */
#else
/* But this avoids more clicks. */
*p++ = kCenterSound;
#endif
}
} else {
for (i = 0; i < actL; i++) {
/* Copy sound data, high byte of each word */
*p++ = *addr
#if 4 == kLn2SoundSampSz
<< 8
#endif
;
/* Move the address on */
addr += 2;
}
if (SoundInvertTime != 0) {
ui5b PhaseIncr = (ui5b)SoundInvertTime * (ui5b)20;
p -= actL;
for (i = 0; i < actL; i++) {
if (SoundInvertPhase < 704) {
ui5b OnPortion = 0;
ui5b LastPhase = 0;
do {
if (! SoundInvertState) {
OnPortion +=
(SoundInvertPhase - LastPhase);
}
SoundInvertState = ! SoundInvertState;
LastPhase = SoundInvertPhase;
SoundInvertPhase += PhaseIncr;
} while (SoundInvertPhase < 704);
if (! SoundInvertState) {
OnPortion += 704 - LastPhase;
}
*p = (*p * OnPortion) / 704;
} else {
if (SoundInvertState) {
*p = 0;
}
}
SoundInvertPhase -= 704;
p++;
}
}
}
if (SoundVolume < 7) {
/*
Usually have volume at 7, so this
is just for completeness.
*/
ui5b mult = (ui5b)vol_mult[SoundVolume];
trSoundSamp offset = vol_offset[SoundVolume];
p -= actL;
for (i = 0; i < actL; i++) {
*p = (trSoundSamp)((ui5b)(*p) * mult >> 16) + offset;
++p;
}
}
MySound_EndWrite(actL);
n -= actL;
if (n > 0) {
goto label_retry;
}
}
}
#endif

View File

@ -1 +1,25 @@
/* SNDEMDEV.h Copyright (C) 2003 Philip Cummins, 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. */ #ifdef SNDEMDEV_H #error "header already included" #else #define SNDEMDEV_H #endif #if MySoundEnabled EXPORTPROC MacSound_SubTick(int SubTick); #endif
/*
SNDEMDEV.h
Copyright (C) 2003 Philip Cummins, 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.
*/
#ifdef SNDEMDEV_H
#error "header already included"
#else
#define SNDEMDEV_H
#endif
#if MySoundEnabled
EXPORTPROC MacSound_SubTick(int SubTick);
#endif

File diff suppressed because one or more lines are too long

View File

@ -1 +1,31 @@
/* SONYEMDV.h 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. */ #ifdef SONYEMDV_H #error "header already included" #else #define SONYEMDV_H #endif EXPORTPROC ExtnDisk_Access(CPTR p); EXPORTPROC ExtnSony_Access(CPTR p); EXPORTPROC Sony_SetQuitOnEject(void); EXPORTPROC Sony_EjectAllDisks(void); EXPORTPROC Sony_Reset(void); EXPORTPROC Sony_Update(void);
/*
SONYEMDV.h
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.
*/
#ifdef SONYEMDV_H
#error "header already included"
#else
#define SONYEMDV_H
#endif
EXPORTPROC ExtnDisk_Access(CPTR p);
EXPORTPROC ExtnSony_Access(CPTR p);
EXPORTPROC Sony_SetQuitOnEject(void);
EXPORTPROC Sony_EjectAllDisks(void);
EXPORTPROC Sony_Reset(void);
EXPORTPROC Sony_Update(void);

165
Mini vMac/mnvm_core/STRCONST.h Executable file → Normal file

File diff suppressed because one or more lines are too long

View File

@ -1 +1,80 @@
/* SYSDEPNS.h Copyright (C) 2006 Bernd Schmidt, Philip Cummins, 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. */ /* SYStem DEPeNdencies. */ #ifdef SYSDEPNS_H #error "header already included" #else #define SYSDEPNS_H #endif #include "CNFGGLOB.h" typedef ui3b *ui3p; typedef ui4b *ui4p; typedef ui5b *ui5p; /* Largest efficiently supported representation types. uimr should be large enough to hold number of elements of any array we will deal with. */ typedef ui5r uimr; typedef si5r simr; #define blnr int #define trueblnr 1 #define falseblnr 0 #define nullpr ((void *) 0) #define anyp ui3p /* pascal string, single byte characters */ #define ps3p ui3p #define LOCALVAR static #ifdef AllFiles #define GLOBALVAR LOCALVAR #define EXPORTVAR(t, v) #else #define GLOBALVAR #define EXPORTVAR(t, v) extern t v; #endif #define LOCALFUNC static #define FORWARDFUNC LOCALFUNC #ifdef AllFiles #define GLOBALFUNC LOCALFUNC #define EXPORTFUNC LOCALFUNC #else #define GLOBALFUNC #define EXPORTFUNC extern #endif #define IMPORTFUNC EXPORTFUNC #define TYPEDEFFUNC typedef #define LOCALPROC LOCALFUNC void #define GLOBALPROC GLOBALFUNC void #define EXPORTPROC EXPORTFUNC void #define IMPORTPROC IMPORTFUNC void #define FORWARDPROC FORWARDFUNC void #define TYPEDEFPROC TYPEDEFFUNC void
/*
SYSDEPNS.h
Copyright (C) 2006 Bernd Schmidt, Philip Cummins, 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.
*/
/*
SYStem DEPeNdencies.
*/
#ifdef SYSDEPNS_H
#error "header already included"
#else
#define SYSDEPNS_H
#endif
#include "CNFGGLOB.h"
typedef ui3b *ui3p;
typedef ui4b *ui4p;
typedef ui5b *ui5p;
/*
Largest efficiently supported
representation types. uimr should be
large enough to hold number of elements
of any array we will deal with.
*/
typedef ui5r uimr;
typedef si5r simr;
#define blnr int
#define trueblnr 1
#define falseblnr 0
#define nullpr ((void *) 0)
#define anyp ui3p
/* pascal string, single byte characters */
#define ps3p ui3p
#define LOCALVAR static
#ifdef AllFiles
#define GLOBALVAR LOCALVAR
#define EXPORTVAR(t, v)
#else
#define GLOBALVAR
#define EXPORTVAR(t, v) extern t v;
#endif
#define LOCALFUNC static
#define FORWARDFUNC LOCALFUNC
#ifdef AllFiles
#define GLOBALFUNC LOCALFUNC
#define EXPORTFUNC LOCALFUNC
#else
#define GLOBALFUNC
#define EXPORTFUNC extern
#endif
#define IMPORTFUNC EXPORTFUNC
#define TYPEDEFFUNC typedef
#define LOCALPROC LOCALFUNC void
#define GLOBALPROC GLOBALFUNC void
#define EXPORTPROC EXPORTFUNC void
#define IMPORTPROC IMPORTFUNC void
#define FORWARDPROC FORWARDFUNC void
#define TYPEDEFPROC TYPEDEFFUNC void

1215
Mini vMac/mnvm_core/VIA2EMDV.c Executable file

File diff suppressed because it is too large Load Diff

48
Mini vMac/mnvm_core/VIA2EMDV.h Executable file
View File

@ -0,0 +1,48 @@
/*
VIA2EMDV.h
Copyright (C) 2004 Philip Cummins, 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.
*/
#ifdef VIA2EMDV_H
#error "header already included"
#else
#define VIA2EMDV_H
#endif
EXPORTPROC VIA2_Zap(void);
EXPORTPROC VIA2_Reset(void);
EXPORTFUNC ui5b VIA2_Access(ui5b Data, blnr WriteMem, CPTR addr);
EXPORTPROC VIA2_ExtraTimeBegin(void);
EXPORTPROC VIA2_ExtraTimeEnd(void);
#ifdef VIA2_iCA1_PulseNtfy
EXPORTPROC VIA2_iCA1_PulseNtfy(void);
#endif
#ifdef VIA2_iCA2_PulseNtfy
EXPORTPROC VIA2_iCA2_PulseNtfy(void);
#endif
#ifdef VIA2_iCB1_PulseNtfy
EXPORTPROC VIA2_iCB1_PulseNtfy(void);
#endif
#ifdef VIA2_iCB2_PulseNtfy
EXPORTPROC VIA2_iCB2_PulseNtfy(void);
#endif
EXPORTPROC VIA2_DoTimer1Check(void);
EXPORTPROC VIA2_DoTimer2Check(void);
EXPORTFUNC ui4b VIA2_GetT1InvertTime(void);
EXPORTPROC VIA2_ShiftInData(ui3b v);
EXPORTFUNC ui3b VIA2_ShiftOutData(void);

File diff suppressed because one or more lines are too long

View File

@ -1 +1,48 @@
/* VIAEMDEV.h Copyright (C) 2004 Philip Cummins, 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. */ #ifdef VIAEMDEV_H #error "header already included" #else #define VIAEMDEV_H #endif EXPORTPROC VIA1_Zap(void); EXPORTPROC VIA1_Reset(void); EXPORTFUNC ui5b VIA1_Access(ui5b Data, blnr WriteMem, CPTR addr); EXPORTPROC VIA1_ExtraTimeBegin(void); EXPORTPROC VIA1_ExtraTimeEnd(void); #ifdef VIA1_iCA1_PulseNtfy EXPORTPROC VIA1_iCA1_PulseNtfy(void); #endif #ifdef VIA1_iCA2_PulseNtfy EXPORTPROC VIA1_iCA2_PulseNtfy(void); #endif #ifdef VIA1_iCB1_PulseNtfy EXPORTPROC VIA1_iCB1_PulseNtfy(void); #endif #ifdef VIA1_iCB2_PulseNtfy EXPORTPROC VIA1_iCB2_PulseNtfy(void); #endif EXPORTPROC VIA1_DoTimer1Check(void); EXPORTPROC VIA1_DoTimer2Check(void); EXPORTFUNC ui4b VIA1_GetT1InvertTime(void); EXPORTPROC VIA1_ShiftInData(ui3b v); EXPORTFUNC ui3b VIA1_ShiftOutData(void);
/*
VIAEMDEV.h
Copyright (C) 2004 Philip Cummins, 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.
*/
#ifdef VIAEMDEV_H
#error "header already included"
#else
#define VIAEMDEV_H
#endif
EXPORTPROC VIA1_Zap(void);
EXPORTPROC VIA1_Reset(void);
EXPORTFUNC ui5b VIA1_Access(ui5b Data, blnr WriteMem, CPTR addr);
EXPORTPROC VIA1_ExtraTimeBegin(void);
EXPORTPROC VIA1_ExtraTimeEnd(void);
#ifdef VIA1_iCA1_PulseNtfy
EXPORTPROC VIA1_iCA1_PulseNtfy(void);
#endif
#ifdef VIA1_iCA2_PulseNtfy
EXPORTPROC VIA1_iCA2_PulseNtfy(void);
#endif
#ifdef VIA1_iCB1_PulseNtfy
EXPORTPROC VIA1_iCB1_PulseNtfy(void);
#endif
#ifdef VIA1_iCB2_PulseNtfy
EXPORTPROC VIA1_iCB2_PulseNtfy(void);
#endif
EXPORTPROC VIA1_DoTimer1Check(void);
EXPORTPROC VIA1_DoTimer2Check(void);
EXPORTFUNC ui4b VIA1_GetT1InvertTime(void);
EXPORTPROC VIA1_ShiftInData(ui3b v);
EXPORTFUNC ui3b VIA1_ShiftOutData(void);

746
Mini vMac/mnvm_core/VIDEMDEV.c Executable file
View File

@ -0,0 +1,746 @@
/*
VIDEMDEV.c
Copyright (C) 2008 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.
*/
/*
VIDeo card EMulated DEVice
Emulation of video card for Macintosh II.
Written referring to:
Sample firmware code in "Designing Cards and Drivers
for Macintosh II and Macintosh SE", Apple Computer,
page 8-20.
Basilisk II source code, especially slot_rom.cpp
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
#include "ENDIANAC.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "MINEM68K.h"
#include "SONYEMDV.h"
#endif
#include "VIDEMDEV.h"
LOCALVAR const ui3b VidDrvr_contents[] = {
0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x2A, 0x00, 0x00, 0x00, 0xE2, 0x00, 0xEC,
0x00, 0xB6, 0x15, 0x2E, 0x44, 0x69, 0x73, 0x70,
0x6C, 0x61, 0x79, 0x5F, 0x56, 0x69, 0x64, 0x65,
0x6F, 0x5F, 0x53, 0x61, 0x6D, 0x70, 0x6C, 0x65,
0x00, 0x00, 0x24, 0x48, 0x26, 0x49, 0x70, 0x04,
0xA4, 0x40, 0x70, 0x04, 0xA7, 0x22, 0x66, 0x00,
0x00, 0x50, 0x27, 0x48, 0x00, 0x14, 0xA0, 0x29,
0x49, 0xFA, 0x00, 0x4A, 0x70, 0x10, 0xA7, 0x1E,
0x66, 0x00, 0x00, 0x3E, 0x31, 0x7C, 0x00, 0x06,
0x00, 0x04, 0x21, 0x4C, 0x00, 0x08, 0x21, 0x4B,
0x00, 0x0C, 0x70, 0x00, 0x10, 0x2B, 0x00, 0x28,
0xA0, 0x75, 0x66, 0x24, 0x22, 0x6B, 0x00, 0x14,
0x22, 0x51, 0x22, 0x88, 0x3F, 0x3C, 0x00, 0x01,
0x55, 0x4F, 0x3F, 0x3C, 0x00, 0x03, 0x41, 0xFA,
0x00, 0x9C, 0x2F, 0x18, 0x20, 0x50, 0x20, 0x8F,
0xDE, 0xFC, 0x00, 0x0A, 0x70, 0x00, 0x60, 0x02,
0x70, 0xE9, 0x4E, 0x75, 0x2F, 0x08, 0x55, 0x4F,
0x3F, 0x3C, 0x00, 0x04, 0x41, 0xFA, 0x00, 0x7E,
0x2F, 0x18, 0x20, 0x50, 0x20, 0x8F, 0x50, 0x4F,
0x20, 0x29, 0x00, 0x2A, 0xE1, 0x98, 0x02, 0x40,
0x00, 0x0F, 0x20, 0x78, 0x0D, 0x28, 0x4E, 0x90,
0x20, 0x5F, 0x70, 0x01, 0x4E, 0x75, 0x2F, 0x0B,
0x26, 0x69, 0x00, 0x14, 0x42, 0x67, 0x55, 0x4F,
0x3F, 0x3C, 0x00, 0x03, 0x41, 0xFA, 0x00, 0x4E,
0x2F, 0x18, 0x20, 0x50, 0x20, 0x8F, 0xDE, 0xFC,
0x00, 0x0A, 0x20, 0x53, 0x20, 0x50, 0xA0, 0x76,
0x20, 0x4B, 0xA0, 0x23, 0x70, 0x00, 0x26, 0x5F,
0x4E, 0x75, 0x2F, 0x08, 0x55, 0x4F, 0x3F, 0x3C,
0x00, 0x06, 0x60, 0x08, 0x2F, 0x08, 0x55, 0x4F,
0x3F, 0x3C, 0x00, 0x05, 0x41, 0xFA, 0x00, 0x1E,
0x2F, 0x18, 0x20, 0x50, 0x20, 0x8F, 0x5C, 0x4F,
0x30, 0x1F, 0x20, 0x5F, 0x08, 0x28, 0x00, 0x09,
0x00, 0x06, 0x67, 0x02, 0x4E, 0x75, 0x20, 0x78,
0x08, 0xFC, 0x4E, 0xD0
};
LOCALPROC ChecksumSlotROM(void)
{
/* Calculate CRC */
/* assuming check sum field initialized to zero */
int i;
ui3p p = VidROM;
ui5b crc = 0;
for (i = kVidROM_Size; --i >= 0; ) {
crc = ((crc << 1) | (crc >> 31)) + *p++;
}
do_put_mem_long(p - 12, crc);
}
LOCALVAR ui3p pPatch;
LOCALPROC PatchAByte(ui3b v)
{
*pPatch++ = v;
}
LOCALPROC PatchAWord(ui4r v)
{
PatchAByte(v >> 8);
PatchAByte(v & 0x00FF);
}
LOCALPROC PatchALong(ui5r v)
{
PatchAWord(v >> 16);
PatchAWord(v & 0x0000FFFF);
}
#if 0
LOCALPROC PatchAOSLstEntry0(ui3r Id, ui5r Offset)
{
PatchALong((Id << 24) | (Offset & 0x00FFFFFF));
}
#endif
LOCALPROC PatchAOSLstEntry(ui3r Id, ui3p Offset)
{
PatchALong((Id << 24) | ((Offset - pPatch) & 0x00FFFFFF));
}
LOCALFUNC ui3p ReservePatchOSLstEntry(void)
{
ui3p v = pPatch;
pPatch += 4;
return v;
}
LOCALPROC PatchAReservedOSLstEntry(ui3p p, ui3r Id)
{
ui3p pPatchSave = pPatch;
pPatch = p;
PatchAOSLstEntry(Id, pPatchSave);
pPatch = pPatchSave;
}
LOCALPROC PatchADatLstEntry(ui3r Id, ui5r Data)
{
PatchALong((Id << 24) | (Data & 0x00FFFFFF));
}
LOCALPROC PatchAnEndOfLst(void)
{
PatchADatLstEntry(0xFF /* endOfList */, 0x00000000);
}
GLOBALFUNC blnr Vid_Init(void)
{
int i;
ui5r UsedSoFar;
ui3p pAt_sRsrcDir;
ui3p pTo_sRsrc_Board;
ui3p pTo_BoardType;
ui3p pTo_BoardName;
ui3p pTo_VenderInfo;
ui3p pTo_VendorID;
ui3p pTo_RevLevel;
ui3p pTo_PartNum;
ui3p pTo_sRsrc_Video;
ui3p pTo_VideoType;
ui3p pTo_VideoName;
ui3p pTo_MinorBase;
ui3p pTo_MinorLength;
#if 0
ui3p pTo_MajorBase;
ui3p pTo_MajorLength;
#endif
ui3p pTo_VidDrvrDir;
ui3p pTo_sMacOS68020;
ui3p pTo_OneBitMode;
ui3p pTo_OneVidParams;
#if 0 != vMacScreenDepth
ui3p pTo_ColorBitMode = nullpr;
ui3p pTo_ColorVidParams;
#endif
pPatch = VidROM;
pAt_sRsrcDir = pPatch;
pTo_sRsrc_Board = ReservePatchOSLstEntry();
pTo_sRsrc_Video = ReservePatchOSLstEntry();
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_sRsrc_Board, 0x01 /* sRsrc_Board */);
pTo_BoardType = ReservePatchOSLstEntry();
pTo_BoardName = ReservePatchOSLstEntry();
PatchADatLstEntry(0x20 /* BoardId */, 0x0000764D);
/* 'vM', for Mini vMac */
pTo_VenderInfo = ReservePatchOSLstEntry();
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_BoardType, 0x01 /* sRsrcType */);
PatchAWord(0x0001);
PatchAWord(0x0000);
PatchAWord(0x0000);
PatchAWord(0x0000);
PatchAReservedOSLstEntry(pTo_BoardName, 0x02 /* sRsrcName */);
/*
'Mini vMac video card' as ascii c string
(null terminated), and
zero padded to end aligned long.
*/
PatchALong(0x4D696E69);
PatchALong(0x20764D61);
PatchALong(0x63207669);
PatchALong(0x64656F20);
PatchALong(0x63617264);
PatchALong(0x00000000);
PatchAReservedOSLstEntry(pTo_VenderInfo, 0x24 /* vendorInfo */);
pTo_VendorID = ReservePatchOSLstEntry();
pTo_RevLevel = ReservePatchOSLstEntry();
pTo_PartNum = ReservePatchOSLstEntry();
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_VendorID, 0x01 /* vendorId */);
/*
'Paul C. Pratt' as ascii c string
(null terminated), and
zero padded to end aligned long.
*/
PatchALong(0x5061756C);
PatchALong(0x20432E20);
PatchALong(0x50726174);
PatchALong(0x74000000);
PatchAReservedOSLstEntry(pTo_RevLevel, 0x03 /* revLevel */);
/*
'1.0' as ascii c string
(null terminated), and
zero padded to end aligned long.
*/
PatchALong(0x312E3000);
PatchAReservedOSLstEntry(pTo_PartNum, 0x04 /* partNum */);
/*
'TFB-1' as ascii c string
(null terminated), and
zero padded to end aligned long.
*/
PatchALong(0x5446422D);
PatchALong(0x31000000);
PatchAReservedOSLstEntry(pTo_sRsrc_Video, 0x80 /* sRsrc_Video */);
pTo_VideoType = ReservePatchOSLstEntry();
pTo_VideoName = ReservePatchOSLstEntry();
pTo_VidDrvrDir = ReservePatchOSLstEntry();
PatchADatLstEntry(0x08 /* sRsrcHWDevId */, 0x00000001);
pTo_MinorBase = ReservePatchOSLstEntry();
pTo_MinorLength = ReservePatchOSLstEntry();
#if 0
pTo_MajorBase = ReservePatchOSLstEntry();
pTo_MajorLength = ReservePatchOSLstEntry();
#endif
pTo_OneBitMode = ReservePatchOSLstEntry();
#if 0 != vMacScreenDepth
if (ColorModeWorks) {
pTo_ColorBitMode = ReservePatchOSLstEntry();
}
#endif
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_VideoType, 0x01 /* sRsrcType */);
PatchAWord(0x0003); /* catDisplay */
PatchAWord(0x0001); /* typVideo */
PatchAWord(0x0001); /* drSwApple */
PatchAWord(0x0001); /* drHwTFB */
PatchAReservedOSLstEntry(pTo_VideoName, 0x02 /* sRsrcName */);
/*
'Display_Video_Apple_TFB' as ascii c string
(null terminated), and
zero padded to end aligned long.
*/
PatchALong(0x44697370);
PatchALong(0x6C61795F);
PatchALong(0x56696465);
PatchALong(0x6F5F4170);
PatchALong(0x706C655F);
PatchALong(0x54464200);
PatchAReservedOSLstEntry(pTo_MinorBase, 0x0A /* MinorBaseOS */);
PatchALong(0x00000000);
PatchAReservedOSLstEntry(pTo_MinorLength, 0x0B /* MinorLength */);
PatchALong(kVidMemRAM_Size);
#if 0
PatchAReservedOSLstEntry(pTo_MajorBase, 0x0C /* MinorBaseOS */);
PatchALong(0x00000000);
PatchAReservedOSLstEntry(pTo_MajorLength, 0x0D /* MinorLength */);
PatchALong(kVidMemRAM_Size);
#endif
PatchAReservedOSLstEntry(pTo_VidDrvrDir, 0x04 /* sRsrcDrvrDir */);
pTo_sMacOS68020 = ReservePatchOSLstEntry();
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_sMacOS68020, 0x02 /* sMacOS68020 */);
PatchALong(4 + sizeof(VidDrvr_contents) + 8);
MyMoveBytes((ui3p)VidDrvr_contents,
pPatch, sizeof(VidDrvr_contents));
pPatch += sizeof(VidDrvr_contents);
PatchAWord(kcom_callcheck);
PatchAWord(kExtnVideo);
PatchALong(kExtn_Block_Base);
PatchAReservedOSLstEntry(pTo_OneBitMode, 0x80 /* oneBitMode */);
pTo_OneVidParams = ReservePatchOSLstEntry();
PatchADatLstEntry(0x03 /* mVidParams */, 0x00000001);
PatchADatLstEntry(0x04 /* mDevType */, 0x00000000);
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_OneVidParams, 0x01 /* mVidParams */);
PatchALong(0x0000002E); /* physical Block Size */
PatchALong(0x00000000); /* defmBaseOffset */
PatchAWord(vMacScreenWidth / 8);
/* (Bounds.R-Bounds.L)*PixelSize/8 */
PatchAWord(0x0000); /* Bounds.T */
PatchAWord(0x0000); /* Bounds.L */
PatchAWord(vMacScreenHeight); /* Bounds.B */
PatchAWord(vMacScreenWidth); /* Bounds.R */
PatchAWord(0x0000); /* bmVersion */
PatchAWord(0x0000); /* packType not used */
PatchALong(0x00000000); /* packSize not used */
PatchALong(0x00480000); /* bmHRes */
PatchALong(0x00480000); /* bmVRes */
PatchAWord(0x0000); /* bmPixelType */
PatchAWord(0x0001); /* bmPixelSize */
PatchAWord(0x0001); /* bmCmpCount */
PatchAWord(0x0001); /* bmCmpSize */
PatchALong(0x00000000); /* bmPlaneBytes */
#if 0 != vMacScreenDepth
if (ColorModeWorks) {
PatchAReservedOSLstEntry(pTo_ColorBitMode, 0x81);
pTo_ColorVidParams = ReservePatchOSLstEntry();
PatchADatLstEntry(0x03 /* mVidParams */, 0x00000001);
PatchADatLstEntry(0x04 /* mDevType */,
(vMacScreenDepth < 4) ? 0x00000000 : 0x00000002);
/* 2 for direct devices, according to Basilisk II */
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_ColorVidParams, 0x01);
PatchALong(0x0000002E); /* physical Block Size */
PatchALong(0x00000000); /* defmBaseOffset */
PatchAWord(vMacScreenByteWidth);
PatchAWord(0x0000); /* Bounds.T */
PatchAWord(0x0000); /* Bounds.L */
PatchAWord(vMacScreenHeight); /* Bounds.B */
PatchAWord(vMacScreenWidth); /* Bounds.R */
PatchAWord(0x0000); /* bmVersion */
PatchAWord(0x0000); /* packType not used */
PatchALong(0x00000000); /* packSize not used */
PatchALong(0x00480000); /* bmHRes */
PatchALong(0x00480000); /* bmVRes */
PatchAWord((vMacScreenDepth < 4) ? 0x0000 : 0x0010);
/* bmPixelType */
PatchAWord(1 << vMacScreenDepth); /* bmPixelSize */
PatchAWord((vMacScreenDepth < 4) ? 0x0001 : 0x0003);
/* bmCmpCount */
#if 4 == vMacScreenDepth
PatchAWord(0x0005); /* bmCmpSize */
#elif 5 == vMacScreenDepth
PatchAWord(0x0008); /* bmCmpSize */
#else
PatchAWord(1 << vMacScreenDepth); /* bmCmpSize */
#endif
PatchALong(0x00000000); /* bmPlaneBytes */
}
#endif
UsedSoFar = (pPatch - VidROM) + 20;
if (UsedSoFar > kVidROM_Size) {
ReportAbnormal("kVidROM_Size to small");
return falseblnr;
}
for (i = kVidROM_Size - UsedSoFar; --i >= 0; ) {
PatchAByte(0);
}
pPatch = (kVidROM_Size - 20) + VidROM;
PatchALong((pAt_sRsrcDir - pPatch) & 0x00FFFFFF);
PatchALong(/* 0x0000041E */ kVidROM_Size);
PatchALong(0x00000000);
PatchAByte(0x01);
PatchAByte(0x01);
PatchALong(0x5A932BC7);
PatchAByte(0x00);
PatchAByte(0x0F);
ChecksumSlotROM();
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
CLUT_reds[0] = 0xFFFF;
CLUT_greens[0] = 0xFFFF;
CLUT_blues[0] = 0xFFFF;
CLUT_reds[CLUT_size - 1] = 0;
CLUT_greens[CLUT_size - 1] = 0;
CLUT_blues[CLUT_size - 1] = 0;
#endif
return trueblnr;
}
IMPORTPROC Vid_VBLinterrupt_PulseNotify(void);
GLOBALPROC Vid_Update(void)
{
if (! Vid_VBLintunenbl) {
Vid_VBLinterrupt = 0;
Vid_VBLinterrupt_PulseNotify();
}
}
LOCALFUNC ui4r Vid_GetMode(void)
{
return
#if 0 != vMacScreenDepth
UseColorMode ? 129 :
#endif
128;
}
LOCALFUNC tMacErr Vid_SetMode(ui4r v)
{
#if 0 == vMacScreenDepth
UnusedParam(v);
#else
if (UseColorMode != ((v != 128) && ColorModeWorks)) {
UseColorMode = ! UseColorMode;
ColorMappingChanged = trueblnr;
}
#endif
return mnvm_noErr;
}
GLOBALFUNC ui4r Vid_Reset(void)
{
#if 0 != vMacScreenDepth
UseColorMode = falseblnr;
#endif
return 128;
}
#define kCmndVideoFeatures 1
#define kCmndVideoGetIntEnbl 2
#define kCmndVideoSetIntEnbl 3
#define kCmndVideoClearInt 4
#define kCmndVideoStatus 5
#define kCmndVideoControl 6
#define CntrlParam_csCode 0x1A /* control/status code [word] */
#define CntrlParam_csParam 0x1C /* operation-defined parameters */
#define VDPageInfo_csMode 0
#define VDPageInfo_csPage 6
#define VDPageInfo_csBaseAddr 8
#define VDSetEntryRecord_csTable 0
#define VDSetEntryRecord_csStart 4
#define VDSetEntryRecord_csCount 6
#define VDGammaRecord_csGTable 0
#define VidBaseAddr 0xF9900000
/* appears to be completely ignored */
LOCALVAR blnr UseGrayTones = falseblnr;
LOCALPROC FillScreenWithGrayPattern(void)
{
int i;
int j;
ui5b *p1 = (ui5b *)VidMem;
#if 0 != vMacScreenDepth
if (UseColorMode) {
#if 1 == vMacScreenDepth
ui5b pat = 0xCCCCCCCC;
#elif 2 == vMacScreenDepth
ui5b pat = 0xF0F0F0F0;
#elif 3 == vMacScreenDepth
ui5b pat = 0xFF00FF00;
#elif 4 == vMacScreenDepth
ui5b pat = 0x00007FFF;
#elif 5 == vMacScreenDepth
ui5b pat = 0x00000000;
#endif
for (i = vMacScreenHeight; --i >= 0; ) {
for (j = vMacScreenByteWidth >> 2; --j >= 0; ) {
*p1++ = pat;
#if 5 == vMacScreenDepth
pat = (~ pat) & 0x00FFFFFF;
#endif
}
pat = (~ pat)
#if 4 == vMacScreenDepth
& 0x7FFF7FFF
#elif 5 == vMacScreenDepth
& 0x00FFFFFF
#endif
;
}
} else
#endif
{
ui5b pat = 0xAAAAAAAA;
for (i = vMacScreenHeight; --i >= 0; ) {
for (j = vMacScreenMonoByteWidth >> 2; --j >= 0; ) {
*p1++ = pat;
}
pat = ~ pat;
}
}
}
GLOBALPROC ExtnVideo_Access(CPTR p)
{
tMacErr result = mnvm_controlErr;
switch (get_vm_word(p + ExtnDat_commnd)) {
case kCmndVersion:
put_vm_word(p + ExtnDat_version, 1);
result = mnvm_noErr;
break;
case kCmndVideoGetIntEnbl:
put_vm_word(p + 8,
Vid_VBLintunenbl ? 0 : 1);
result = mnvm_noErr;
break;
case kCmndVideoSetIntEnbl:
Vid_VBLintunenbl =
(0 == get_vm_word(p + 8))
? 1 : 0;
result = mnvm_noErr;
break;
case kCmndVideoClearInt:
Vid_VBLinterrupt = 1;
result = mnvm_noErr;
break;
case kCmndVideoControl:
{
CPTR CntrlParams = get_vm_long(p + 8);
CPTR csParam =
get_vm_long(CntrlParams + CntrlParam_csParam);
ui4r csCode =
get_vm_word(CntrlParams + CntrlParam_csCode);
switch (csCode) {
case 0: /* VidReset */
put_vm_word(csParam + VDPageInfo_csMode,
Vid_GetMode());
put_vm_word(csParam + VDPageInfo_csPage, 0);
/* page is always 0 */
put_vm_long(csParam + VDPageInfo_csBaseAddr,
VidBaseAddr);
result = mnvm_noErr;
break;
case 1: /* KillIO */
result = mnvm_noErr;
break;
case 2: /* SetVidMode */
if (0 != get_vm_word(
csParam + VDPageInfo_csPage))
{
/* return mnvm_controlErr, page must be 0 */
} else {
result = Vid_SetMode(get_vm_word(
csParam + VDPageInfo_csMode));
put_vm_long(csParam + VDPageInfo_csBaseAddr,
VidBaseAddr);
}
break;
case 3: /* SetEntries */
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
if (UseColorMode) {
CPTR csTable = get_vm_long(
csParam + VDSetEntryRecord_csTable);
ui4r csStart = get_vm_word(
csParam + VDSetEntryRecord_csStart);
ui4r csCount = 1 + get_vm_word(
csParam + VDSetEntryRecord_csCount);
if (((ui4r) 0xFFFF) == csStart) {
ReportAbnormal(
"Indexed SetEntries not implemented");
} else if (csStart + csCount > CLUT_size) {
result = mnvm_paramErr;
} else {
int i;
for (i = 0; i < csCount; ++i) {
int j = i + csStart;
if (j == 0) {
/* ignore input, leave white */
} else if (j == CLUT_size - 1) {
/* ignore input, leave black */
} else {
ui4r r =
get_vm_word(csTable + 2);
ui4r g =
get_vm_word(csTable + 4);
ui4r b =
get_vm_word(csTable + 6);
CLUT_reds[j] = r;
CLUT_greens[j] = g;
CLUT_blues[j] = b;
}
csTable += 8;
}
ColorMappingChanged = trueblnr;
}
} else
#endif
{
/* not implemented */
}
break;
case 4: /* SetGamma */
{
#if 0
CPTR csTable = get_vm_long(
csParam + VDGammaRecord_csGTable);
/* not implemented */
#endif
}
break;
case 5: /* GrayScreen */
{
#if 0
ui4r csPage = get_vm_word(
csParam + VDPageInfo_csPage);
/* not implemented */
#endif
FillScreenWithGrayPattern();
result = mnvm_noErr;
}
break;
case 6: /* SetGray */
{
ui3r csMode = get_vm_byte(
csParam + VDPageInfo_csMode);
/*
"Designing Cards and Drivers" book
says this is a word, but it seems
to be a byte.
*/
UseGrayTones = (csMode != 0);
result = mnvm_noErr;
}
break;
}
}
break;
case kCmndVideoStatus:
{
CPTR CntrlParams = get_vm_long(p + 8);
CPTR csParam = get_vm_long(
CntrlParams + CntrlParam_csParam);
ui4r csCode = get_vm_word(
CntrlParams + CntrlParam_csCode);
result = mnvm_statusErr;
switch (csCode) {
case 2: /* GetMode */
put_vm_word(csParam + VDPageInfo_csMode,
Vid_GetMode());
put_vm_word(csParam + VDPageInfo_csPage, 0);
/* page is always 0 */
put_vm_long(csParam + VDPageInfo_csBaseAddr,
VidBaseAddr);
result = mnvm_noErr;
break;
case 3: /* GetEntries */
{
#if 0
CPTR csTable = get_vm_long(
csParam + VDSetEntryRecord_csTable);
put_vm_word(
csParam + VDSetEntryRecord_csStart,
csStart);
put_vm_word(
csParam + VDSetEntryRecord_csCount,
csCount);
#endif
ReportAbnormal(
"GetEntries not implemented");
}
break;
case 4: /* GetPages */
put_vm_word(csParam + VDPageInfo_csPage, 1);
/* always 1 page */
result = mnvm_noErr;
break;
case 5: /* GetPageAddr */
{
ui4r csPage = get_vm_word(
csParam + VDPageInfo_csPage);
if (0 != csPage) {
/*
return mnvm_statusErr,
page must be 0
*/
} else {
put_vm_long(
csParam + VDPageInfo_csBaseAddr,
VidBaseAddr);
result = mnvm_noErr;
}
}
break;
case 6: /* GetGray */
{
put_vm_word(csParam + VDPageInfo_csMode,
UseGrayTones ? 0x0100 : 0);
/*
"Designing Cards and Drivers" book
says this is a word, but it seems
to be a byte.
*/
result = mnvm_noErr;
}
break;
}
}
break;
}
put_vm_word(p + ExtnDat_result, result);
}

27
Mini vMac/mnvm_core/VIDEMDEV.h Executable file
View File

@ -0,0 +1,27 @@
/*
VIDEMDEV.h
Copyright (C) 2008 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.
*/
#ifdef VIDEMDEV_H
#error "header already included"
#else
#define VIDEMDEV_H
#endif
EXPORTFUNC blnr Vid_Init(void);
EXPORTFUNC ui4r Vid_Reset(void);
EXPORTPROC Vid_Update(void);
EXPORTPROC ExtnVideo_Access(CPTR p);