Skip to content

Instantly share code, notes, and snippets.

@realmonster
Created June 4, 2018 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realmonster/329339dc4cafed2d92a262569cc04e1b to your computer and use it in GitHub Desktop.
Save realmonster/329339dc4cafed2d92a262569cc04e1b to your computer and use it in GitHub Desktop.
MAME ct486 Win32S and MCI CD Audio
Session Start: Thu May 31 21:23:01 2018
Session Ident: #mame-dev
[21:23] #mame-dev url is http://mamedev.org
[21:26] <+MAMEbuild> [build mamedev/mame#929f1193] success on master by ajrhacker (https://tea-ci.org/mamedev/mame/16494)
[22:23] <r57shell> any ideas why after installing MS-DOS 6.22 on ct468 I have "Missing operating system" ?
[22:32] <r57shell> and why MS-DOS installation doesn't start if I don't hit few times RETURN? :\
[22:45] <+MooglyTri> Sounds like a case of PEBKAC to me
[22:46] <+MooglyTri> crazyc: Any idea why r57shell here, after installing MS-DOS 6.22 on "ct468", has "Missing operating system" ?
[22:47] <+MooglyTri> And why MS-DOS installation doesn't start if he don't hit few times RETURN? :\
[22:48] <+crazyc> Usually that's caused by an oversize hdd image. Those old bioses only supported up to 528MB or 1024,16,63 chs.
[22:52] <+MooglyTri> r57shell: What size of hard drive are you using?
[22:56] <l_oliveira> Could that be a boot virus protection? Some BIOSes can block writes to the HDD boot sector unless you toggle some setting on the computer setup. They drop write attempts silently, with that active, I believe.
[23:09] <+DopefishJustin> don't think ct486 has that
[23:10] <r57shell> MooglyTrig 128 mb
[23:11] <r57shell> 512 16 32
[23:12] <l_oliveira> I remember I had a quantum harddrive with the odd size of 240MB
[23:13] <l_oliveira> it had a thermal calibration thing so I got used to it "clicking" periodically every 5 minutes or so
[23:13] <r57shell> I've download 4161 16 63 I guess, something like this, which one guy suggested, and msdos started after installation
[23:14] <r57shell> but then I have win3.1 hangs when it says "Please wait while setup loads windows"
[23:14] <r57shell> (after three floppy disks)
[23:14] <+MooglyTri> Did you select the correct hard drive type in the BIOS?
[23:14] <r57shell> I did as he did in his video
[23:14] <l_oliveira> win3.1 need himem.sys loaded
[23:15] <r57shell> but he is installing win3.1 with cdrom :(
[23:15] <l_oliveira> as far I remember
[23:15] <+crazyc> 4161,16,63 will work until it tries to access the 1025 cyl.
[23:16] <l_oliveira> will it wrap around past that and corrupt?
[23:16] <+crazyc> Yup
[23:17] <+crazyc> 512,16,32 should work fine as long as that geometry is entered into drive type 47.
[23:17] <r57shell> HIMEM is testing extended memory...done
[23:17] <+crazyc> in the bios setup
[23:17] <r57shell> is it enough? or I should do something else?
[23:18] <r57shell> 512,16,32 wasn't booting
[23:20] <+crazyc> Have you looked at http://forums.bannister.org//ubbthreads.php?ubb=showflat&Number=86865&page=1
[23:21] <+crazyc> Is that where you got 4161 16 63 from?
[23:21] <r57shell> y
[23:22] <r57shell> same as where I got file
[23:22] <r57shell> 512,16,32 I was doing with chdman from virtual HDD from Windows->Management->Disks
[23:23] <+crazyc> Try creating an image like "chdman createhd -o <CHD filename> -chd 1024,16,63" and installing on that.
[23:24] <r57shell> perhaps 512 no? :( I don't need 2gb
[23:25] <+crazyc> That's 528MB.
[23:25] <+crazyc> It's the largest image possible with that bios.
[23:33] <r57shell> oh, that spanish video helped, he did turn off mouse
[23:35] <r57shell> so, after turning off mouse, win 3.11 doesn't hang
[23:37] <+crazyc> We don't support PS/2 mice, only serial, in case you set it for that.
[23:37] <r57shell> it was set by default
Session Time: Fri Jun 01 00:00:00 2018
[01:43] <r57shell> any ideas what may cause this? https://imgur.com/IXOlXAq.png
[01:43] <r57shell> it appears when I run game, and then it goes directly into MS-DOS prompt
[01:50] <+DopefishJustin> win32s doesn't work in mame
[01:51] <+DopefishJustin> it's a bug somewhere but I don't know where exactly (cpu core maybe)
[03:00] <r57shell> will it help if I debug it?
[03:00] <+DopefishJustin> yes
Session Close: Fri Jun 01 03:56:37 2018
Session Start: Fri Jun 01 13:07:27 2018
[13:07] #mame-dev url is http://mamedev.org
[13:09] <r57shell> btw, does it work with audio discs via sb16?
[14:24] <r57shell> watchpoints is set on phisical or locigal address?
[18:12] <r57shell> shit, it does crash at loading of dlls
[18:27] <r57shell> is there easy way to extract all files from .chd image?
[18:29] <+MooglyTri> No
[18:29] <+MooglyTri> CHD is just a container format for a raw image, it has no concept of a filesystem
[18:32] <r57shell> my .chd is FAT, does it change something? :\
[18:32] <+duke_> extract it to a raw image, then mount it
[18:33] <r57shell> how extract to raw? chdman? or what to use?
[18:33] <+duke_> chdman yes
[18:39] <r57shell> what tool to mount it?
[18:40] <+MooglyTri> Whatever tool you want
[18:40] <r57shell> what if I don't know any?
[18:41] <+MooglyTri> Well, chdman will output some sort of file with some sort of extension when you do -extracthd
[18:41] <+MooglyTri> Then what you do is, you go over to Google
[18:41] <+MooglyTri> And you type in something like "mount [file extension] virtual hard disk image"
[18:41] <r57shell> extracthd or extractraw?
[18:42] <+MooglyTri> Whichever one is a valid option and works for you. Do some experimentation, you're not going to catch your computer on fire if you input the wrong parameter.
[18:43] <+MooglyTri> Please try to understand, MAME emulates something like tens of thousands of systems, and there are fewer than 50 regular contributors. So the likelihood of any one of us being able to help you with something as specific as debugging the PC driver is unlikely.
[18:43] <+MooglyTri> So you're going to have to take some initiative here.
[19:12] <r57shell> \o/ I did it :)
[19:35] <r57shell> why "source" command with file with lines "bpset address" where address is normal address
[19:35] <r57shell> does not work? :\
[19:35] <r57shell> I'm talking about mame debugger
[22:51] <shattered> r57shell: imgtool could work, it supports FAT in CHD
[23:04] <+DopefishJustin> winimage should work as well
[23:05] <shattered> does it work with chd?
[23:11] <r57shell> imgtool saying that image is corrupted
[23:11] <r57shell> and I have no idea how to pass -heads -tracks options into it
[23:12] <r57shell> is there way in mame to translate address?
[23:12] <r57shell> that x86 protected mode 16 bit selectors makes me crazy -_-
[23:14] <r57shell> call far ptr [2E4h] <- this is what I am trying to understand
[23:16] <r57shell> at ds:[2E4h] is located BC 09 5F 04 bytes. it is going to read it as far ptr pointer
[23:25] <r57shell> actually I'm not sure, it's probably cs:[2E4h]
[23:26] <shattered> if in doubt, use trace
[23:26] <shattered> with register dump
[23:26] <r57shell> issue I have: it throws interrupt: no page
[23:28] <r57shell> it did jump to 41F13
[23:28] <r57shell> maybe I'm retarded, will see :)
[23:30] <r57shell> yes, it did jump exactly at 45F:9BC
[23:46] <+_MetalliC_> <r57shell> what tool to mount it? --- for win - https://www.osforensics.com/tools/mount-disk-images.html
[23:48] <+_MetalliC_> btw, apelsin ty ?
[23:56] <r57shell> da
[23:57] <r57shell> shit, I can't tell where it was pointing
[23:58] <r57shell> I had "call 13D7h:6DCh", and got to cs = C3. it and in error log: code segment is not present
Session Time: Sat Jun 02 00:00:01 2018
[00:00] <r57shell> and after interrupt is done, I have CS=11F
[00:01] <r57shell> headache is that I don't know where 13D7:6DCh was poining at.
[00:02] <r57shell> oh :o looks like it wasn't ended. now I'm back to same line "call 13D7h:6DCh"
[00:02] <r57shell> very interesting :>
[00:22] <+MAMEbuild> [build mamedev/mame#84b2fd45] success on master by cracyc (https://tea-ci.org/mamedev/mame/16524)
[00:24] <feos> ^ wow this one is potentially pretty "what's new"
[00:28] <+crazyc> You mean the sgdt fix? That was actually already fixed for the 80386 but I didn't notice that the 80486 had a different implementation for opcode 0f 01.
[00:31] <feos> well I dunno how much of r57shell's problems are fixed by this, but if more win 3.1/3.11 games work thanks to that, it's incredible
[00:33] <feos> hopefully debugging win3.1 kernel also becomes easier. but even more hopefully, it becomes unneeded :D
[01:04] <r57shell> idk will it fix this, but I doubt
[01:16] <r57shell> ok, now I know most likely place where it crash
[01:17] <r57shell> it's WIN32S16.DLL
[01:19] <r57shell> there is entry point
[01:19] <r57shell> and right after it complete entry point sub, kernel crash
[01:22] <r57shell> is it okay that after calling 32 bit subroutine and going back to 16 bit, there is still garbage in x68 registers high words?
[01:47] <+DopefishJustin> I still get "Unexpected DOS error: 21" running freecell
[01:55] <+Lord_Nightmare> r57shell: could be another similar error lurking elsewhere
[01:58] <r57shell> it would be nice if I had idea how to set breakpoint on pagefault
[01:59] <r57shell> it's making pagefault, and then, even if he knows that it's fault, it is trying to execute that data :D
[01:59] <r57shell> and getting invalid opcode
[02:01] <+Lord_Nightmare> hmm. can you do wpset 0x38,2,r ?
[02:02] <+Lord_Nightmare> since that should break on a read of the 0xE interrupt which is pagefault
[02:02] <+Lord_Nightmare> assuming the proc is in real mode still
[02:02] <+Lord_Nightmare> in protected mode i'm not sure where the IVT is located
[02:07] <r57shell> I'm debugging win 3.1
[02:07] <r57shell> it's protected or even 32 bit
[02:08] <r57shell> (nested tables)
Session Close: Sat Jun 02 15:57:13 2018
Session Time: Sun Jun 03 00:00:04 2018
[01:34] <r57shell> crazyc you're my hero :D now Win32S is working indeed
[01:34] <r57shell> MCI audio doesn't for some reason
[01:38] <r57shell> can it be so CUE doesn't load sound tracks? only first data track?
[01:40] <shattered> you're playing a game with cd audio?
[01:45] <+crazyc> cdda audio should be hooked up.
[01:51] <r57shell> I've installed MCI cd audio driver
[01:51] <r57shell> but there is no music
[01:52] <r57shell> It's supposed to be played via winmm -> mci audio soundblaster
[01:52] <r57shell> but even if I just run soundblaster player which appears after installing driver, it says no music or no MCI driver
[01:53] <r57shell> sounds works fine though
[01:54] <r57shell> is there way to play cdaudio directly from dos?
[01:55] <+crazyc> which driver are you using?
[01:56] <+crazyc> at486?
[01:58] <r57shell> ct486
[01:58] <r57shell> machine I mean
[01:58] <r57shell> does it work with at486?
[01:59] <r57shell> https://imgur.com/a/TLethGA
[02:00] <+crazyc> The cdrom isn't attached by default. Not to be patronizing but just to be sure you did attach it right?
[02:02] <r57shell> I have -board3:ide:ide:1 cdrom
[02:02] <+crazyc> Yup, that's right.
[02:02] <r57shell> and then I use File Manager in TAB menu
[02:03] <r57shell> and set cdrom to .CUE
[02:03] <r57shell> cue is working one, I can play music from it if I mount it with Deamon Tools here, on win7
[02:04] <r57shell> if I don't mount CD, game throws error that it can't find disk.
[02:05] <+crazyc> Did you install a dos cdrom driver and mscdex. Windows 3.1 can't access cdrom drives directly.
[02:07] <r57shell> yes I did, I've installed the game from it.
[02:07] <+crazyc> Wait, you said you can access the data track so that can't be it.
[02:10] <r57shell> I remember when I did research on this game, I was trying many emulators, and I remember many wasn't able to play cd audio in 3.11 just because it's not implemented
[02:11] <r57shell> but I don't remember anymore which io ports etc it's used
[02:11] <r57shell> it was more than 5 years ago
[02:23] <r57shell> w8, no, if it uses winmm, then where it? no... it should be not winmm
[02:25] <+crazyc> winmm?
[02:26] <+crazyc> Winmm.dll is the core win32 multimedia library.
[02:27] <+crazyc> mmsystem.dll in the equivalent in win16
[02:28] <r57shell> correction: MSS32.dll
[02:28] <r57shell> it uses AIL_redbook_play(...)
[02:56] <r57shell> I'm IN \o/
[02:56] <r57shell> I'm at entry of game's executable :D
[02:58] <shattered> sounds like fun
[02:59] <+crazyc> whats the game?
[02:59] <shattered> probably more fun than making 2nd reality run on a 486 box under win95
[03:32] <r57shell> AIL_redbook_open returns 0
[03:32] <r57shell> and this leads to huge jump over all other trackinfo etc calls
[03:33] <r57shell> I have a tiny idea :)
[03:45] <r57shell> oh :( trace of whole AIL_startup + AIL_redbook_open is 15MB :S
[03:46] <r57shell> it does load MCICDA.DRV btw in it
[03:47] <+crazyc> I installed the cdrom stuff and get the same.
[03:50] <r57shell> game btw does following: check all drives with GetDriveType() == 5 (DRIVE_CDROM)
[03:51] <r57shell> and check is it the game disk (by reading some files)
[03:51] <r57shell> then, if it is, it remember index, and index is which DRIVE_CDROM it is.
[03:52] <r57shell> so if you have 5 hdd, and then 1 DRIVE_CDROM, then its index is zero.
[03:52] <r57shell> then it feeds this index in redbook_open
[03:52] <r57shell> and gets zero, becomes upset, and skip bunch of redbook calls
[03:53] <r57shell> btw redbook_startup returns 1.
[03:54] <r57shell> oh, sorry, AIL_startup
[03:56] <r57shell> sad sad story :(
[04:04] <r57shell> there is MSSDebug in some ini
[04:04] <r57shell> I don't know in which one, looks like you can put it in APP's ini
[04:06] <r57shell> let see :>
[04:22] <r57shell> oh, this log now 64 kb :( (too large) need to move it via floppy then :\
[04:29] <r57shell> https://pastebin.com/GtBAN9GG
[04:29] <r57shell> orly :\
[04:29] <r57shell> dots is - repeating serve()
[04:30] <r57shell> nothing useful
[09:37] <r57shell> I did it \o/ I beat this. Now I have music :D
[09:45] <+Lord_Nightmare> ? how?
[10:07] <r57shell> in short, MCDEX, or what it's called... returns some kind of type of disk
[10:07] <r57shell> perhaps it's even just some part of disk sectors
[10:08] <r57shell> MCI audio driver checks 2 bits, and if none of them set -> it decides that it's not cd audio
[10:08] <r57shell> right after that check, I just in mame set EAX = 1 and viola \o/
[10:10] <r57shell> to find it, had to do from the game exe, then MSS32.DLL, MSS16.DLL, MSSYSTEM.DLL, USER.EXE, MCICDA.DRV
[10:11] <r57shell> at each step narrowing down which func fails, by suggesting 50:50 which branch is FAIL :)
[10:11] <r57shell> some of FAIL branches easy to figure out: they straightforward unloading something.
[10:13] <r57shell> but one of the hardest quest was to get in the game exe. because everything is done in initialization, and if you're in a bit later -> you've missed everything
[10:14] <r57shell> to trick that driver, you can just nop that few bytes.
[10:15] <r57shell> but better to find out why it comes as is from MCDEX
[10:17] <r57shell> patch is following: MCICDA.DRV at offset 1A6E, make two nops (9090 IIRC)
[10:18] <r57shell> how to fix mame core - atm no idea. need more investigations
[10:21] <r57shell> Lord_Nightmare have you seen new build that fixes Win32S?
Session Close: Sun Jun 03 18:53:10 2018
Session Start: Sun Jun 03 18:54:56 2018
[19:16] <r57shell> sorry, yesterday I said wrong offset, correct is 1A5E, confirmed
[00:35] <r57shell> crazyc: where I should dig into, to figure out why mscdex reply to IOCTLI DeviceStatus without certain flag being set?
[00:36] <+crazyc> Which flag is supposed to be set?
[00:36] <r57shell> bit 4
[00:37] <r57shell> read & play audio
[00:37] <r57shell> according to doc that I found about MSCDEX
[00:38] <r57shell> I've made patch of MCICDA.DRV that fix this, and I have music :b
[00:39] <+crazyc> Here's the source for an mscdex clone. https://github.com/joyent/sdcboot/tree/master/freedos/source/shsucdx/cdex32
[00:42] <r57shell> I'm talking about mame
[00:42] <r57shell> in mame with ct486 it doesn't return flag for some reason
[00:47] <+crazyc> What's needed is to find the scsi command that causes that to be set in the cdrom driver.
[00:53] <+crazyc> Uide.sys sets that bit unconditionally https://github.com/joyent/sdcboot/blob/a487b30dd8573979bbb378557a9a5624ad3d7737/freedos/source/uide/uide.asm#L1323
[00:54] <+crazyc> So something's wrong with the cdrom device driver.
[00:57] <r57shell> wait, am I wrong with bit? it's in driver MCICDA tested by test [+1],10h
[00:57] <r57shell> here if 214h is what going there, then it'll be success, because 0x214 & 0x10 == 0x10
[00:58] <r57shell> by [+1] I mean... assume destination is X, then it's checking [x+1] byte
[00:59] <r57shell> I can look exact value it's return
[01:07] <+crazyc> I guess the driver you are using looks for something from, possibly, the scsi mode sense command that we don't provide. Uide just assumes, correctly, that the overwhelming majority of drives play audio.
[01:08] <r57shell> it returns 06 86 02 00 00
[01:09] <r57shell> so, 0x286 is there.
[01:09] <r57shell> which driver it is?
[01:10] <r57shell> it's something inside of bios or where? :?
[01:14] <+crazyc> The dos cdrom driver.
[01:15] <r57shell> I thought dos cdrom is MSCDEX itself no?
[01:16] <+crazyc> mscdex is a shim between the device driver and dos itself.
[01:17] <+crazyc> You can find which one you
[01:18] <+crazyc> you're using by looking in config.sys.
[01:20] <r57shell> DEVICEHIGH=C:\CDROM\GSCDROM.SYS /D:MSCD000 /v
[01:20] <r57shell> this is what I have
[01:21] <r57shell> device is recognized as "MAME VirtualCDROM" (something like that)
[01:22] <r57shell> is there driver especially for MAME? :D
[01:23] <+crazyc> Nope, we'd want real drivers to work.
[01:24] <r57shell> by letter G it looks like supposed to be "general"
[01:25] <+crazyc> From looking around it's goldstar.
[01:25] <+crazyc> The company now known as LG.
[01:28] <l_oliveira> It used to be called "Lucky-Goldstar" actually. That's what the L is about
[01:28] <shattered> hmm, scream tracker doesn't like our sound blaster
[01:28] <shattered> st 2.2
[01:28] <l_oliveira> in 1995 it decided to make the name simpler and went as LG
[01:28] <l_oliveira> probably to make people forget it once sold 3DOs
[01:29] <r57shell> y, indeed LG
[01:29] <r57shell> v 1.25
[01:29] <l_oliveira> around that time or maybe a year later Samsung got rid of their nice 3-star logo, too
[01:29] <r57shell> so, next step of my journey: figure out why it doesn't set this flag? :D
[01:30] <r57shell> or try some other driver? :D
[01:32] <+crazyc> Try another if you want. I'm looking at that one right now.
[01:37] <r57shell> so, if I install freedos, and win3.11 over it, it should probably work without any issues?
[01:38] <+crazyc> I don't know if win3.11 works in freedos.
[01:39] <r57shell> will see :)
[01:41] <shattered> grr, inertia player doesn't like sblaster_16 and gus
[01:41] <shattered> sblaster plays at half speed, player crashes on gus
[02:19] <+crazyc> So it requires bit 1 of byte 12 of mode sense page 2a to be set. Which is strange because that is buffer size field and it's supposed to be the size in KB. http://www.bswd.com/sff8020i.pdf#224
[02:26] <+DopefishJustin> last I checked freedos didn't support win3.1 but admittedly I haven't checked in years
[02:37] <+crazyc> Seems mode sense is supposed to have a 7 byte header that's missing making that byte 5.
[02:42] <r57shell> I don't understand what you saying just because I don't know this in details, but DeviceStatus handler is located at offset 0x517 in that file
[02:42] <r57shell> (driver of disk)
[02:43] <r57shell> and it's using some very complicated routine :(
[02:43] <r57shell> then feed return value into buffer as is (
[02:50] <r57shell> I see "or cx, 10h" at two places there
[02:52] <r57shell> both of them tests same byte
[02:53] <r57shell> for bit 0 by test al,1
[02:53] <f10d4> or cl,10h; would be better even if it is correct in other aspects
[03:09] <shattered> mode sense is a scsi command, returning a buffer
[03:13] <r57shell> how do you know that it's mode sense command?
[03:13] <shattered> crazyc said so :)
[03:14] * shattered finally managed to record something from scream tracker
[03:14] <shattered> https://youtu.be/QEz7IksoQm0
[03:23] <r57shell> I see in table 68 byte 5 bit 0 is CD DA
[03:24] <r57shell> could be it? :D
[03:24] <+crazyc> Yup, without the 8 (not 7) byte header that byte is in the wrong place.
[03:25] <+crazyc> It's going to require so much regression testing...
[03:25] <r57shell> 8? 12-7 = 5
[03:25] <r57shell> why 8? :\
[03:26] <+crazyc> It's 0 based so it's actually byte 6.
[03:26] <r57shell> and there is above in pdf format of header
[03:26] <r57shell> hm
[03:27] <r57shell> y, last one in header is 7-th
[03:27] <r57shell> strange, could it be just bug in driver?
[03:28] <r57shell> maybe it's checking AudioPlay flag instead? :D
[03:29] <r57shell> or maybe our number 12 is wrong. I can tell what is there. I'm right after this command executed
[03:31] <+crazyc> I'll take another look at it.
[03:32] <r57shell> https://i.imgur.com/lOxghtk.png
[03:40] <r57shell> The Mode Parameter List contains a header, followed by zero or more variable-length pages.
[03:41] <r57shell> y, looks like bug in mame? :? no? :D
[03:49] <+crazyc> Yup, here https://github.com/mamedev/mame/blob/18edbdcc71121873e173f9e336fc6f9cdc1c6dcb/src/devices/machine/t10mmc.cpp#L730
[03:50] <+crazyc> Lots of stuff uses that too.
[03:51] <r57shell> what is t10mmc :O
[03:53] <+cuavas> multimedia command set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment