Is there any possibility to translate PEG2 Bios from assembly to C code using AI?
Peg2 bios is not on assembler, it's already mostly on C (and my version, and their one): whole StarmtFirmware are C. But if you mean the very first parts of the initialization, then it always will be assembler bits (always, AI or not AI), because of the vectors and some other hardware specific stuff, but then, it also plenty of C too. Also, x86emulator emulate X86 assembler, while most code in C, it still emulate x86 assembler instructions.
I mean there no problems about.
Quote:
Really no one has the BPlan bios sources to start with?
No, but there no needs to have them anymore, SmartFirmware open sourced, the whole rom structure is known now, i can reconstruct it already and test. The only bits which were missed from opensourced SmartFirmware are x86emualtor (done), amiga support (done), and USB (in progress). So there really no needs for any sources anymore.
Quote:
If needed I can help with some test on my Peg2 and latest hw rev (2gb ram support)
The only real tests it's once all done, and you risk to reflash it to have a brick :)
@derfs Where does m48t59 RTC come from? I don't see it mentioned anywhere and could not find it on the shematics either. So I don't know what real machine has for NVRAM, maybe it's stored in the flash? It does not really seem to have m48t59 and RTC is just part of VT8231. The confusion in PCI0 vs PCI1 may come from that SmartFirmware (or QEMU so the default is the PCI bus) numbers them the opposite as MV64361. I think one of the MV64361 PCI buses is 66MHz which is used for AGP and the other is 33 MHz which is used for PCI in Pegasos2 but I forgot the details. If you (or the AI) took any code from QEMU your license will be GPLv2-or-later, you can only have BSD license if no code is taken from GPL sources such as U-Boot or QEMU. You probably can't tell where the code from AI comes from so it's safer to go with GPL also to avoid some rougue company later taking your work change it and lock you out from your own sources.
PS. IF you have time, the things which surely will help, is adding X1000 support to the QEMU with basis of what Balaton already upload in other thread for initial X1000 qemu support, so we can test CFE patches on it before i can risk to flash one of the chips.
For the bootstrap code you can probably take the startup for the original Marvell Discovery development board from U-Boot that I linked to at the beginning of this thread and fix that up. You can't legally take disassembled code from bPlan and just recompile it to be able to distribute it but the U-Boot code is legal to use.
You can't legally take disassembled code from bPlan and just recompile it to be able to distribute it but the U-Boot code is legal to use.
I of course have no plan to recompile bPlans code, it will be pretty hard to start with, but i only use decompiled code as crappy refs to see how they do things same or not same as me, but i do everything from scratch. But to say truth, i not the one who will care about anyone worrying about this legal-boredom, or what license to use, i am not in interest in really, but my rom will be also open sourced, and no blpan's code will be in, of course.
Quote:
Might work for testing but would be wasted as it cannot be upstreamed
That no problem, it's really need it only for testing.
@derfs I don’t think the AI fully understands what code it’s supposed to generate; here’s a quote from GitHub: “MorphOS, Linux, AmigaOS 3.x: not yet bootable. The framework recognises their partition types and falls through to a ‘loader not implemented’ message; nothing will load.” I think the AI is spitting out this status. AmigaOS 3?
@smarkusg There are more funny remarks , like it was tested on real pegasos2 while it wasn't :) AI help for sure, and quite much to speed things up, but everything still need to be coded with it help, not in opposite, and every DOC need to be proofreaded and corrected before , as it sometime generate real wrong stuff.
@Balaton While testing new firmware found that even with old one have some issue which is probably known (as far as i remember you point about somewhere before) : when we use VGA, or cirrus-vga, or ati-vga together with -sm501 and correct driver , it can't switch to new mode from vga output. I.e. i see screenmode changes, but nothing drawns. When i do vga -none and type same "boot cd amigaboot.of" via serial, then it works.
If it know, what the reasons for ? Something missed in QEMU in that terms ? Conflicts with sm501 ?
@kas1e I have no idea. Why would you want to use sm501 and vga together? -device sm501 probably also needs -vga none so the firmware does not try to find a VGA device as that might have priority over sm501 which is not expected on anything else than on Sam460ex and even there it's disabled if there's a VGA device. On the other hand specifying -device cirrus-vga or -device ati-vga automatically disables the default -device VGA so you don't strictly need -vga none with those but it also does not matter if you add it just not needed, because there can only be one VGA device with legacy ISA IO ports and maybe additional secondary-vga devices so if you add another vga compatible device the default std-vga is replaced by that.
@Balaton Point is that i want to run a rom to output on any driver but not on serial, but on screen. Then boot from and have running os4 with whatever driver it can pickup on qemu and switch correctly from screen console to new mode. That i need for mimic real hardware way : working vga console and working os4 driver on top of it in same session. Maybe i can do so now with ati-vga + your new driver ?
@kas1e Since no other firmware has driver for SM502 than sam460ex U-Boot and SM502 does not have BIOS ROM this won't work with -device sm501 on pegasos2. Maybe such SM501/SM502 card does not even exist or if it does exist QEMU does not emulate that card, but if you can find a ROM for such card you may try with that. So yes, most likely to work with both BIOS and AmigaOS is ati-vga,model=rv100 with QEMU specific AOS4 driver but we need to find a ROM that works with it and I think those you tried did not work but maybe now with update x86emu they work now?
Alternatively you can try with MorphOS and -device ati-vga (without model=rv100) that works with both BIOS and MorphOS driver.
So yes, most likely to work with both BIOS and AmigaOS is ati-vga,model=rv100 with QEMU specific AOS4 driver but we need to find a ROM that works with it and I think those you tried did not work but maybe now with update x86emu they work now?
With pure -driver ati-vga,model=rv100 original firmware didn't works, but my build with new x86emulator works. I also tried on my version ati-vga,model=rv100,romfile=share/vgabios-ati.bin and it works too (seems that default when rv100 used?). And in console it after it boots written that this is ATI Radeon 7000.
All bioses for 7000 from vgamuseum not works because they not fits to the hardcoded values in ati driver in qemu which only have
Anyway, tried your driver with ati-vga,model=rv100,romfile=share/vgabios-ati.bin and it works ! I fully see console on screen, can type "boot hd:0 amigaboot.of" , it load up menu, all boots fine, and OS is loading ! YEAH !! Do you have any plan to make you AtiRadeon.chip working on real hw anyday ? Or it's purpose qemu only ?
@kas1e Yes you'd need a ROM matching the emulated card as there were some changes in registers between these Radeon chips so other ROMs might not find the registers they need. If your updated x86emu can handle the default QEMU vgabios (which comes from SeaBIOS) then that should also work for usual VESA stuff. For real cards the driver that comes with AmigaOS should work and would be better but the QEMU ati-vga is not complete enough to work with that driver and it was easier to write a minimal driver than to implement the missing features in ati-vga. When ati-vga is improved, we may eventually be able to go back to the AmigaOS driver so my driver is just a stop-gap until then. For a real card a lot more init and clock setup stuff would be needed that is not needed for QEMU so I did not care to implement those so my driver would not work with a real card.
@Balaton As far as i see pegasos2's VIA VT8231 support USB1.1 , but when we do -usb-storage in qemu, it by default seems to take not OHCI , but UHCI route, right ?
I just find that smartfirmware have support of OHCI already, but it only will works then if i will run qemu with something like :
@kas1e Peg2 only has a USB: v1.1 UHCI controller on the motherboard. By adding this "-device pci-ohci" to the QEMU command line, you “add” an additional USB PCI controller to the motherboard. It will only be recognized if the operating system supports it. Just like in this video, where it’s paired with a real PEG2 (at 55 seconds)> https://youtu.be/oE42AX1F2LY?t=46 The video is pretty cool overall. It’s great to see that someone is still playing with a real PEG2 these days.
Peg2 only has a USB: v1.1 UHCI controller on the motherboard.
Hm, in original smartfirmware code they only have OHCI implemented, but latest versions from bPlan for sure can detect USB keyboard, and to some extent usb-stick: it shows just like /pci@80000000/usb@C,3/scsi@1 , but nothing else, so seems they simple didn't implement massstorage support before, just were in the progress.
Which also mean, that seems bPlan fully implement UHCI , and Smartfirmware's OHCI were done for additional USB PCI controllers ?
Edited by kas1e on 2026/5/1 10:50:59 Edited by kas1e on 2026/5/1 11:02:24
Which also mean, that seems bPlan fully implement UHCI , and Smartfirmware's OHCI were done for additional USB PCI controllers ?
I have no idea, but I remembered one thing. I think there were two newer beta versions of the firmware for the PEG2. A while back, a user on the MorphOS forum who had a PeG2 with that firmware wrote that it improved USB performance.
@smarkusg Right. So it mean bPlan just wrote UHCI driver, and the OHCI one which were in smartfirmware by default just for additional PCI boards (through, even then it wasn't mean for mass-storages support in firmware itself, just for boards detection).
@kas1e It seems there's a usb/uhci.c in the SmartFirmware sources but its missing the actual driver methods. You probably need to implement at least device_request method or whatever else is needed like is already in ohci.c then it should also work for UHCI. There is some documentation here.
@balaton Did you aware if pegasos2 emulation support disabling ps2 keyboard/mouse ? I need to test usb keyboard, but for that i need to disable ps2 one : on real pegasos2 when both ps/2 one and usb one connected, the ps/2 one is disables and usb one is the working, but that happens inside of OF, and for mimic that i firstly need to be sure that uhci usb keyboard start working at all.