Jump to content
phaeron

Altirra 2.00

Recommended Posts

Altirra is anime related, the code I believe is all his, from following Avery's work over the years I'm pretty sure all the design was his simply from following the known hardware manuals and building from the ground up.

Share this post


Link to post
Share on other sites

This appears to be the bank switching logic for the KMK/JZ:

 

 case 0xA0:
  if (!thisptr->mbVersion2) {
   thisptr->mFlashBankOffset = 0x300 - 0xD800;
   thisptr->mpMemMan->SetLayerMemory(thisptr->mpMemLayerFlash, thisptr->mFlash + 0x300);
   thisptr->mpMemMan->SetLayerMemory(thisptr->mpMemLayerRAM, thisptr->mRAM + 0x100);
  }
  return true;
 case 0xC0:
  if (!thisptr->mbVersion2) {
   thisptr->mFlashBankOffset = 0 - 0xD800;
   thisptr->mpMemMan->SetLayerMemory(thisptr->mpMemLayerFlash, thisptr->mFlash);
   thisptr->mpMemMan->SetLayerMemory(thisptr->mpMemLayerRAM, thisptr->mRAM);
  }
  return true;

 

Very much out on a limb here, but aren't those offsets 3 pages and 1 page from the ROM / RAM base respectively? I'm wondering if they should be 0x600 and 0x200 (for 1.5KB and 512 bytes)???

Share this post


Link to post
Share on other sites

How about if you put a test Rom in place with some eyecatchers at 512 byte boundaries.

Then you could work out if the offsets used are right or not.

Share this post


Link to post
Share on other sites

Oof... yeah, I screwed up the KMK/JZ V1 banking logic. The ROM load code was also only loading and saving 6 pages. This version should work a bit better.

 

http://www.virtualdu...2.10-test15.zip

http://www.virtualdu...-test15-src.zip

 

The emulation code in Altirra is all written from scratch. When I was bringing up basic emulation, it took a while before anything started showing up. It was very cool when River Raid started to work.

Share this post


Link to post
Share on other sites

Oof... yeah, I screwed up the KMK/JZ V1 banking logic. The ROM load code was also only loading and saving 6 pages. This version should work a bit better.

 

http://www.virtualdu...2.10-test15.zip

http://www.virtualdu...-test15-src.zip

 

Thank you! :D Your quick update is hugely appreciated.

 

Actually, I found looking through the PBI / IDE emulation sources very interesting and informative indeed.

Share this post


Link to post
Share on other sites

Hmmm... just discovered another issue apparently not related to the latest KMK / JZ emulation fix (it's also present in 2.10 test 2):

 

post-21964-0-20067200-1331244592_thumb.png

 

This is what shows up when I try to run The Last Word from drive A (floppy) with KMK / JZ version 1 enabled with ANY BIOS ROM installed (official or custom). It appears to crash because all the RAM under BASIC is fixed at $FF. LW turns off internal BASIC and loads code there, but DOS is executing an init vector and jumping into a lot of $FFs before eventually hitting the OS code at $C000 and locking up.

 

If I turn off KMK / JZ emulation, there's no problem.

 

...oh - tiny feature request as well. Can the HDD dialogue be made to remember the previous drive geometry when hard disk emulation is re-enabled with the check-box? :)

Edited by flashjazzcat

Share this post


Link to post
Share on other sites

Does the "randomize memory on startup" feature make any difference ?

 

Or maybe that's only for VBXE.

Share this post


Link to post
Share on other sites

That was happening because the SDX ROM was enabled. Since there aren't any SDX banking registers on the V1 hardware (that I know of), it isn't supposed to be there and I disabled it:

 

http://www.virtualdub.org/beta/Altirra-2.10-test16.zip

http://www.virtualdub.org/beta/Altirra-2.10-test16-src.zip

 

However, it would be nice if TLW handled the situation of having a cartridge installed a little more gracefully. :)

 

On the HD geometry issue: problem is I have nowhere to save the config if the HD isn't enabled. I was thinking of having a separate file next to the HD image to store the geometry, or just allowing a file format that has geometry info in it. VHD's attractive, because most OSes now can mount VHD files.

Share this post


Link to post
Share on other sites

That was happening because the SDX ROM was enabled. Since there aren't any SDX banking registers on the V1 hardware (that I know of), it isn't supposed to be there and I disabled it:

 

http://www.virtualdu...2.10-test16.zip

http://www.virtualdu...-test16-src.zip

 

Thanks again! Indeed KMK / JZ v1 has no SDX hardware of any kind.

 

However, it would be nice if TLW handled the situation of having a cartridge installed a little more gracefully. :)

 

It's the first time I've encountered this in three years of development, since the only cartridge I ever have present is SDX itself, and it usually gets out of the way when asked to. :) However, point taken.

 

I've just tested this with DOS 2.5 and with external SDX: seems to work OK in both cases.

 

On the HD geometry issue: problem is I have nowhere to save the config if the HD isn't enabled. I was thinking of having a separate file next to the HD image to store the geometry, or just allowing a file format that has geometry info in it. VHD's attractive, because most OSes now can mount VHD files.

 

Out of interest, where does Altirra save other stuff, such as firmware paths, etc?

Edited by flashjazzcat

Share this post


Link to post
Share on other sites

Out of interest, where does Altirra save other stuff, such as firmware paths, etc?

 

HKEY_CURRENT_USER\Software\virtualdub.org\Altirra\

 

That's in normal mode, in portable mode it has a cfg in the Altirra directory iirc...

Edited by Mclaneinc

Share this post


Link to post
Share on other sites

It's not the persistent storage that's the issue, it's in memory: the hard disk parameters are stored in the hard disk emulator itself. Problem is, if you disable the HD emulation, the HD object goes away. I'd need to stash those params elsewhere. Not a big deal, just required some reorg.

Share this post


Link to post
Share on other sites

Ah - OK I understand now. ;) Not a serious issue; it was primarily a pain while I was having troubles with the emulation and had to keep repeatedly enabling and disabling the HDD.

 

Anyway - my PBI BIOS is slowly getting there and regarding LW cart detection: I'll add a test (after BASIC is turned off) to check that $A000-$BFFF is RAM.

Share this post


Link to post
Share on other sites

Having a few issues with H: emulation in the latest versions under SDX when the cart is turned off with the "X" command. Screen gets corrupted and system goes into an endless loop reading SIO drive #1.

Edited by flashjazzcat

Share this post


Link to post
Share on other sites

Hi.

 

I'm running Altirra in Virtual Box on my Mac OS X 10.6.8 machine.

 

I wanted to try the debugger (I have heard so many good things about it, I thought: well let me test it for myself).

 

But for some reason the CONSOLE window does not work. It does not respond any of my commands entered, and it does not show a thing too. It should respond on a questionmark (?) right?

 

Is there any chance this can not work with Virtualbox? The rest of the emulation works fine.

Share this post


Link to post
Share on other sites

Hm... the new Altirra has made a nice process in sounding stabilitiy, as it seems....

 

The only flaw is the multitasking influenced "break" . If this could be removed, it would be nice.

 

Does increasing the latency in audio options help with this?

 

Having a few issues with H: emulation in the latest versions under SDX when the cart is turned off with the "X" command. Screen gets corrupted and system goes into an endless loop reading SIO drive #1.

 

Yeah, I tracked this down to some changes I'd made to the CIO hooks a bit cleaner, which also happened to make them a bit more broken by dropping the SPECIAL hook. This version has a fix:

 

http://www.virtualdub.org/beta/Altirra-2.10-test17.zip

http://www.virtualdub.org/beta/Altirra-2.10-test17-src.zip

 

However, I still had to add support for the SpartaDOS X get current directory command ($30) in order to make LW's directory listing work. Shouldn't it assume the root if that command isn't supported?

 

ok, what about that carts i wrote?

 

These are the carts that have the timed deactivate, right? Sorry, haven't figured out what to do about this yet. I don't want to add a whole bunch of duplicate cartridge modes for it, at least, so it'll probably have to be a side option somewhere.

Share this post


Link to post
Share on other sites

I tracked [H: problems] down to some changes I'd made to the CIO hooks a bit cleaner, which also happened to make them a bit more broken by dropping the SPECIAL hook. This version has a fix:

 

http://www.virtualdu...2.10-test17.zip

http://www.virtualdu...-test17-src.zip

 

 

Great - thanks. ;)

 

However, I still had to add support for the SpartaDOS X get current directory command ($30) in order to make LW's directory listing work. Shouldn't it assume the root if that command isn't supported?

 

Yep - When I discovered that issue I added a fix to LW rather than ask you to implement the get working directory functionality. Which version of LW are you using?

 

get_drive_path
ldy #255
GDRVLP2
iny
lda drive2,y
; sta inbuff,y
sta pathbuffer,y
bne gdrvlp2
sty temp2 ; index to end of drive ID
bit sdxflag ; can we read the drive's path?
bpl no_path_read ; if not...
do_get_path
jsr setio
LDX #16 ; read drive's path (drive is in inbuff)
LDA #48
STA ICCOM,X
lda #< drive2
sta icbadr,x
lda #> drive2
sta icbadr+1,x
; jsr inbadr ; point to drive ID in inbuff
LDA TEMP2 ; point to end of drive ID in outbuf+128
CLC
adc #< pathbuffer
STA ICBLEN,X
LDA #0
adc #> pathbuffer
STA ICBLEN+1,X
JSR CIOV ; read path
BPL PATHOK
cpy #146 ; patch for altirra
bne doptherr ; ****
ldy temp2 ; ****
bne no_path_read ; ****
doptherr
rts
PATHOK
LDY #0
GETENDOP
lda pathbuffer,y
BEQ GOTENDOP
CMP #155
BEQ GOTENDOP
INY
CPY #80
BNE GETENDOP
GOTENDOP
LDA #'>
cmp pathbuffer-1,y
BEQ no_path_read
sta pathbuffer,y
INY
no_path_read
lda #0
sta pathbuffer,y
rts
;

 

The version of Altirra I was using at the time returned error #146, so I just branch on this in the code above. The latest test versions of the emulator didn't seem to like it, although I'm not sure if this was down to the SPECIAL bug. I'll test the new version ASAP.

 

However, the addition of get path to H: is most welcome indeed (it's useful, after all).

Edited by flashjazzcat

Share this post


Link to post
Share on other sites

Wow! I noticed that you added several high speed drives extensions.

Many thanks!

 

Indus GT is with $06 counter value (HS Index) - should not be described as 68Kbps?

And to be sure - this is using Synchromesh protocol (similar as for XF551 but with another speed)?

 

And ... could you add another one emulation level - '1050 Turbo (288 RPM, 68Kbps high speed)' mode?

Germany (probably most similar to original documentation?) http://www.strotmann..._1050_turbo.pdf

Sometimes this turbo is also called 'Top Drive' and protocol is used also in TOMS and Tygrys extensions.

 

It is working this way (translated from atariki):

Block command (Command Frame) for the drives, as well as in the standard, it is sent at a speed of 19.2 kbps.

The fourth byte of the block, carrying a byte value DAUX2 DCB block, is increased by 128 (ORA #$80).

After sending the command computer - without waiting for an answer - the system reprograms POKEY at 68.2 kbps (counter value (HS Index) - $06) assuming that that drive also switches to the fast transmission.

Pick any negative answer of course is not possible in such a system - this is why attached below atr image is not booting.

Further exchange of data caused by this one command is in an accelerated rate.

After transmission the command returns to standard speed.

Read schema:

speed 19.2 kbps

computer --> command 4 B + CRC --> drive

switch to 68.2 kbps

computer <-- confirmation 'A' <-- drive

execute

computer <-- confirmation 'C' <-- drive

computer <-- data block + CRC <-- drive

switch to 19.2 kbps

end

 

Write schema:

speed 19.2 kbps

computer --> command 4 B + CRC --> drive

switch to 68.2 kbps

computer <-- confirmation 'A' <-- drive

computer --> data block + CRC --> drive

computer <-- confirmation 'A' <-- drive

execute

computer <-- confirmation 'C' <-- drive

switch to 19.2 kbps

end

 

This image uzytki2_atr.zip should boot into menu with file list.

Working can be checked with "track.com" or "toptor1.com" full disc copiers on this atr.

(I am sorry, but not all files are good on this image, sectors 631,654,670 has bad CRC - my drive did not want read it properly.)

 

 

And - do you still need sounds of working disc drive - I can record my CA2001?

Edited by lemiel

Share this post


Link to post
Share on other sites

Here's a version with 1050 Turbo support:

http://www.virtualdu...2.10-test18.zip

http://www.virtualdu...-test18-src.zip

 

It's currently set to use the stock 1050 timing parameters: 20ms/track, 982 cycles/byte, 91 cycles/bit.

 

Gotta say, the load pattern involved here is pretty sketchy. Not only does the loader on that disk image lack a low-speed fallback and fails on all but a small fraction of drives, but it also sends a Read PERCOM Block request in high speed mode. I'm not ware of AUX2 being significant for that command -- it seems like the drive shouldn't allow this as it could cause false positives from other software that simply doesn't initialize the AUX2 byte.

 

Oh, and thanks for the offer of the drive sounds. I think I'm pretty good at this point. The rotation sound could use some love as the swish period is too long, but I think I can deal with that locally.

Edited by phaeron

Share this post


Link to post
Share on other sites

thanks for the update, Avery!

I will eagerly await the addition of new sounds of the disk drives in the emulator, it will be just fine.

 

and please have a look at your blog, there were many interesting things.

and ideas have been expressed about the errors in two games.

Share this post


Link to post
Share on other sites

what other 810 or 1050 drive mod's you thinking of trying to emulate phaeron, what about isplate 1050 or the SA/SA2...or ofcourse speedy/super speedy....that's enough to be getting on with

 

There again, i thought the sio patch feature basically emulated the hi speed capabilities of these 1050 or 810 mod's (same as a800windows+)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...