Shop OBEX P1 Docs P2 Docs Learn Events
Console Emulation - Page 56 — Parallax Forums

Console Emulation

15253545658

Comments

  • roglohrogloh Posts: 5,281

    @Wuerfel_21 said:
    Well that's an oddity. Do you have an EVAL (with HyperRAM or 96MB board) on hand to sanity check against?

    I do but it would take some time to dig it out and set it up, might have to wait for that.

    If it crashes this often you may also have insufficient 5V power, as I noticed earlier.

    Perhaps, although this is on my Bull Ant board and it is powered via 12V using the step down regulator on the Edge and I know this supply would be able to source 500mA at the very least for powering PVR HDD's and this gives good wattage for the P2-Edge.

  • Anyways, for EVAL+HyperRAM you'd do (assuming RAM board on basepin 0)

    #define USE_HYPER
    
    HYPER_ACCESSORY = 0 ' Base pin for P2EVAL HyperRAM board
    HYPER_CLK    =  8+HYPER_ACCESSORY
    HYPER_RWDS   = 10+HYPER_ACCESSORY
    HYPER_SELECT = 12+HYPER_ACCESSORY
    HYPER_BASE   =  0+HYPER_ACCESSORY
    HYPER_RESET  = 15+HYPER_ACCESSORY
    
    HYPER_LATENCY = 6
    HYPER_WAIT  = HYPER_LATENCY*4 - 2
    HYPER_DELAY = 13
    HYPER_SYNC_CLOCK = false
    HYPER_SYNC_DATA = false
    

    For EVAL+96MB you'd

    #define USE_PSRAM8
    
    PSRAM_CLK = 8 addpins 1
    PSRAM_SELECT = 10
    PSRAM_BASE = 0
    PSRAM_BANKS = 6
    
    PSRAM_WAIT  = 5
    PSRAM_DELAY = 17
    PSRAM_SYNC_CLOCK = true
    PSRAM_SYNC_DATA = true
    
  • roglohrogloh Posts: 5,281

    Am kinda surprised you are getting good HyperRAM results with the P2 around 340MHz. I thought mine would typically top out around 300MHz or so, or are you clocking at half speed?

  • @rogloh said:
    Am kinda surprised you are getting good HyperRAM results with the P2 around 340MHz. I thought mine would typically top out around 300MHz or so, or are you clocking at half speed?

    Yea my HyperRAM driver never does the full DDR rate. So performance should be on par with PSRAM8.

  • roglohrogloh Posts: 5,281

    Makes more sense then. I found my EVAL, might give it a try in a moment to see what happens.

  • roglohrogloh Posts: 5,281

    Ok, tried HyperRAM on Pin 0 and Pocky with EVAL board and above timing. Same first result as with PSRAM, hangs after initial title screens with blank video output, other games running ok. Second try got into actual game menu, but after start it just hung with blank output.

  • Wuerfel_21Wuerfel_21 Posts: 4,667
    edited 2024-05-18 01:54

    Okay, so that's a sanity check. Something's really cooked. Make sure your file isn't corrupted or anything. MD5 should be e74e067787723bc54093a9c03f290e5d. Also, it does seem that @ersmith broke the compiler and nothing works now. Revert whatever silly edit you made to get it to run and downgrade to an older compiler until it isn't broken anymore. Also here's an official beta02 ZIP with the row boundary fix (shouldn't matter to hyperram)

    EDIT: flexspin v6.9.7 (git 438d856cc6da8043b22cb6ee832f204ff54682b9) is last good version

  • roglohrogloh Posts: 5,281

    Ok so it turns out I had tried to run P&R 2, not P&R (my mistake) due to 8.3 filename limitations not showing full title. The earlier post on game compatibility indicates it would thud and black screen which is basically what I saw in general when running P&R 2 apart from a couple of times it got a bit further.

    Once I ran the original versionof P&R it worked on both the EVAL with HyperRAM and the P2Edge with PSRAM with the same timing I tried last time:

    PSRAM_WAIT = 5
    PSRAM_DELAY = 15
    PSRAM_SYNC_CLOCK = true
    PSRAM_SYNC_DATA = true

    ' Uncomment for slower memory clock
    '#define USE_PSRAM_SLOW

  • @rogloh said:
    Ok so it turns out I had tried to run P&R 2, not P&R (my mistake) due to 8.3 filename limitations not showing full title. The earlier post on game compatibility indicates it would thud and black screen which is basically what I saw in general when running P&R 2 apart from a couple of times it got a bit further.

    Haha I was starting to think that's the case :) I think P&R 2 needs 65816/SPC700 hard-sync (a planned feature) to not go banana. Also, there's a useful tool called NSRT that can be configured to bulk-rename SFC files (that it knows about) to sensible FAT names (so you get stuff like PRCKYU.SFC or LZELDAU.SFC ("U" -> USA)) and also remove or add those annoying 512 byte headers (though MisoYume should be able to handle them now)

    If there's no instant crash, that's where the interesting part begins: Does it randomly die some 3 to 20 minutes later?

    Pointing a fan at my Edge fixed it for me. It was running over 8 hours with the fan on. When I turned the fan off, it died 7 minutes later.

  • evanhevanh Posts: 15,392

    @Wuerfel_21 said:
    EDIT: flexspin v5.9.7 (git 438d856cc6da8043b22cb6ee832f204ff54682b9) is last good version

    That's more than two years back!

  • @evanh said:

    @Wuerfel_21 said:
    EDIT: flexspin v5.9.7 (git 438d856cc6da8043b22cb6ee832f204ff54682b9) is last good version

    That's more than two years back!

    Was supposed to read 6.9.7

  • roglohrogloh Posts: 5,281

    When I initially hit these errors using a 6.2 build of spin2cpp I automatically went and grabbed top of tree for spin2cpp from yesterday thinking Ada will need the latest & greatest build like usual to fix these types of issues and ultimately that did seem to build and let me run MisoYume, though perhaps there are going to be new issues with some games as I've only tried a few.

    misoyume_upper.spin2:140: error: syntax error, unexpected %
    misoyume_upper.spin2:143: error: syntax error, unexpected ELSE
    misoyume_upper.spin2:878: error: syntax error, unexpected ':'

    Flexspin 6.9.8 did give this error below unless you change the = into a : in the OBJ section of config.spin2 but since when is an equals symbol allowed in the OBJ section as the separator anyway? I thought it was always a colon symbol to separate object name from file name, unless fastspin syntax is extended from PNut SPIN2 in this area.

    config.spin2:58: error: syntax error, unexpected '.', expecting '['

  • The equals sign creates an "abstract object" which doesn't actually create an instance. You'd be able to use it to dereference an object pointer, but in this case I just use it to grab the constant definitions.

  • Anyways, it got fixed in the meantime, just grab the git now it'll be fine.

  • roglohrogloh Posts: 5,281

    @Wuerfel_21 said:
    The equals sign creates an "abstract object" which doesn't actually create an instance. You'd be able to use it to dereference an object pointer, but in this case I just use it to grab the constant definitions.

    Ok good to know. Must be something new or specific to flexspin, this is not listed in latest Parallax SPIN2 doc in OBJ section.

  • roglohrogloh Posts: 5,281

    @Wuerfel_21 said:
    Anyways, it got fixed in the meantime, just grab the git now it'll be fine.

    Just tried that. Yeah it builds now with the equals sign back in the file. :smile:

  • RaymanRayman Posts: 14,145
    edited 2024-05-18 10:34

    Sorta glad to hear it’s not just my boards that need a fan to run this…

    Definitely pushing the envelope…

  • ersmithersmith Posts: 5,992

    There's some fairly ferocious changes in flexspin right now, due to needing a major parser overhaul to support Spin2 structures, so it is pretty unstable. There is a stable branch though (release/v6.9) which might be safer to use.

  • Wuerfel_21Wuerfel_21 Posts: 4,667
    edited 2024-05-18 23:07

    In unrelated news, I implemented more robust controller port handling in MisoYume, Super Mario All-Stars and Secret of Evermore now have working inputs. The latter seems fully OK now, the former has minor video glitches.

    Other than that, I removed a workaround for a bug in flexspin that's been fixed for a few releases now and I removed some nonsense in the default config and made it target EC32MB by default (bring a fan).

    So no big change, but maybe I can get myself to tackle one of the big issues now.

    EDIT: Also, some of the RAM-related changes in beta02 (presumably cache length now being larger for 16 bit RAM) seem to have reduced time crust in some games, which is nice-ish I guess?

  • roglohrogloh Posts: 5,281

    It would be cool if there was a way to restart back to the game menu screen rather than needing to reset/reboot from flash or reload MisoYume via serial. Maybe there's a reason not to, like the memory gets trashed and you can't easily restart from scratch, not sure.

  • @rogloh said:
    It would be cool if there was a way to restart back to the game menu screen rather than needing to reset/reboot from flash or reload MisoYume via serial. Maybe there's a reason not to, like the memory gets trashed and you can't easily restart from scratch, not sure.

    There is. Either ctrl+esc on keyboard or hold start+down for a few seconds.

  • roglohrogloh Posts: 5,281

    Great. I was trying random combinations hopeful for such a thing but didn't stumble onto it. Very useful. Thanks!

  • pik33pik33 Posts: 2,358
    edited 2024-05-20 09:00

    I started to testing this (at last - I have no place and time now to play with a P2: (other projests+moving and renovation).

    Compiled wih the fresh Flexprop from github, works. Can be started from a binary file using BRUN from Retromachine Basic (I still have to implement args for this)

    However the flexprop tells

    Program size is 520364 bytes
    warning: Can't truncate file
    

    and the resulting binary is 509 KB long.

    The default config (except moving VGA+audio to P8) causes the monitor think it is 1280x720 - the right part of the picture was cut off. Manual settings allowed me to center the screen
    So I recompiled this for HDMI - no more problems with the picture

    Loaded Super Mario World: I have now a title screen and a fancy music. I have no gamepad here... so I have now to read the topic and learn if and how I can use a keyboard. Works several minutes now, the P2 is hot but still OK. (it's this yolkless EC32).


    Edit: I managed to start it using a keyboard. Still works without a fan :)

    Edit 2: Zelda - the legends.. works. I also tried Doom: 2 MB file, does not work (black screen), reacts on ctrl-esc to return to the menu

  • @pik33 said:
    However the flexprop tells

    Program size is 520364 bytes
    warning: Can't truncate file
    

    That really shouldn't happen. Can you post the entire output from build.sh?

    Edit 2: Zelda - the legends.. works. I also tried Doom: 2 MB file, does not work (black screen), reacts on ctrl-esc to return to the menu

    Doom won't work because it needs a coprocessor (SuperFX2 GSU). Should add an error message for that. Wolf3d sorta works though (DMA speed problem is there)

  • pik33pik33 Posts: 2,358
    edited 2024-05-20 14:35

    I didn't use .sh (as in Windows) - I used Flexprop with a custom command line.

    Here is 'lower' file output:

    "C:/Users/Piotr/Downloads/flexprop-6.9.4/flexprop/bin/flexspin" -2 -l --compress "C:/Users/Piotr/Downloads/misoyume_beta03/misoyume_lower.spin2"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2024 Total Spectrum Software Inc. and contributors
    Version 6.9.8-HEAD-v6.9.8 Compiled on: May 18 2024
    misoyume_lower.spin2
    |-MegaVGA_ohmyshit.spin2
    misoyume_lower.spin2
    |-MegaVGA_ohmyshit.spin2
    Executable compressed from 450732 to 70500 bytes (15.64%, 168 stub bytes)
    Done.
    Program size is 520364 bytes
    warning: Can't truncate file
    Finished at Mon May 20 10:16:21 2024
    

    'Upper' (run again to create a log :)

    "C:/Users/Piotr/Downloads/flexprop-6.9.4/flexprop/bin/flexspin" -2 -E -H 360448 -O1,extrasmall,inline-single,experimental,aggressive-mem --charset=shiftjis -DFF_FS_TINY=1 -DFF_FS_NORTC=1 "C:/Users/Piotr/Downloads/misoyume_beta03/misoyume_upper.spin2"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2024 Total Spectrum Software Inc. and contributors
    Version 6.9.8-HEAD-v6.9.8 Compiled on: May 18 2024
    misoyume_upper.spin2
    |-MegaVGA_ohmyshit.spin2
    |-MegaVGA_ohmyshit.spin2
    |-usbnew.spin2
    |-padmap_parser.spin2
    |-libc.spin2
    |-|-libc.a
    |-fsadapter.c
    |-psram16drv.spin2
    fatfs_vfs.c
    |-fatfs.cc
    fflush.c
    fputs.c
    fopen.c
    fseek.c
    fwrite.c
    sprintf.c
    malloc.c
    strncat.c
    strncmp.c
    strncpy.c
    opendir.c
    stat.c
    _mount.c
    errno.c
    memcmp.c
    strchr.c
    sdmm.cc
    localtim.c
    malloc.c
    posixio.c
    bufio.c
    isatty.c
    fileno.c
    dofmt.c
    vfs.c
    strncpy.c
    strncat.c
    strncmp.c
    getenv.c
    ctype.c
    ioctl.c
    fmt.c
    strncmp.c
    misoyume_upper.p2asm
    Done.
    Program size is 90284 bytes
    Finished at Mon May 20 16:33:25 2024
    
  • Ahh, I see what's happening, it's a bug with the --compress flag. It still works because the resulting file will have the uncompressed original version first and then the compressed file is appended onto it. It's supposed to empty out the file first. Could it be that this never worked on Windows at all and no one noticed? @ersmith do you have a winblows test machine at hand? I currently don't.

    Anyways, you can remove --compress, it doesn't have any effect on the program other than making the file smaller.

  • Okay, here's some more minor fixes because ???

    • Fixed mirroring for odd-sized ROMs
    • Fixed bugs with OPVCT and OPHCT registers (fixes hangs in Trials of Mana)
    • Menu now remembers selected file
  • ersmithersmith Posts: 5,992

    @Wuerfel_21 said:
    Ahh, I see what's happening, it's a bug with the --compress flag. It still works because the resulting file will have the uncompressed original version first and then the compressed file is appended onto it. It's supposed to empty out the file first. Could it be that this never worked on Windows at all and no one noticed? @ersmith do you have a winblows test machine at hand? I currently don't.

    I have a laptop that I use for some testing, but I do a lot of preliminary testing with Wine. The "can't truncate file" warning does appear when flexspin.exe is run under wine. It looks like the Microsoft library doesn't support freopen with a NULL parameter :(. The patch below seems to fix it:

    diff --git a/frontends/common.c b/frontends/common.c
    index 6d745283..24d35008 100644
    --- a/frontends/common.c
    +++ b/frontends/common.c
    @@ -1275,9 +1275,18 @@ DoPropellerPostprocess(const char *fname, size_t eepromSize)
                 WARNING(NULL, "I/O error while compressing");
             }
             Flexbuf compressed = CompressExecutable(buffer,len);
    +#ifdef WIN32
    +        fclose(f);
    +        f = fopen(fname, "w+b");
    +        if (!f) {
    +            ERROR(NULL, "Can't truncate file");
    +            return -1;
    +        }
    +#else
             if (!freopen(NULL,"w+b",f)) { // Do this to make file actually smaller
                 WARNING(NULL, "Can't truncate file");
             }
    +#endif
             fwrite(flexbuf_peek(&compressed),flexbuf_curlen(&compressed),1,f);
             len = flexbuf_curlen(&compressed);
             flexbuf_delete(&compressed);
    
  • pik33pik33 Posts: 2,358

    It works now. The compressed file has now 69 KB and still can be started from the Basic.

  • @ersmith said:

    @Wuerfel_21 said:
    Ahh, I see what's happening, it's a bug with the --compress flag. It still works because the resulting file will have the uncompressed original version first and then the compressed file is appended onto it. It's supposed to empty out the file first. Could it be that this never worked on Windows at all and no one noticed? @ersmith do you have a winblows test machine at hand? I currently don't.

    I have a laptop that I use for some testing, but I do a lot of preliminary testing with Wine. The "can't truncate file" warning does appear when flexspin.exe is run under wine. It looks like the Microsoft library doesn't support freopen with a NULL parameter :(. The patch below seems to fix it:

    Wow, I didn't even think of trying it with wine. Anyways :+1: for fixing my jank (with more jank)

Sign In or Register to comment.