News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ajcasado

Port of FUZIX for the CPC6128

Started by ajcasado, 00:07, 13 October 24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Poliander

Quote from: ajcasado on 19:57, 16 October 24It seems that the IDE driver might not be broken after all. The issue is that I don't have one on hand to test it on my 664, so I'm relying on incomplete emulation. Is anyone willing to test it on a real machine?
I would love to, but I have no idea how to load a snapshot with an Albireo...

:-[
Schneider CPC 664 • X-MASS + X-MEM • Vortex F1-X Drive • CTM 644
Schneider CPC 6128 • M4 Board  • OSSC

ajcasado

Quote from: Poliander on 20:43, 16 October 24I would love to, but I have no idea how to load a snapshot with an Albireo...
Me neither, it would be a good feature to implement in Unidos. I'll see if I can make progress on a loader to boot from a file on disk.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

Prodatron

Quote from: Poliander on 20:43, 16 October 24
Quote from: ajcasado on 19:57, 16 October 24It seems that the IDE driver might not be broken after all. The issue is that I don't have one on hand to test it on my 664, so I'm relying on incomplete emulation. Is anyone willing to test it on a real machine?
I would love to, but I have no idea how to load a snapshot with an Albireo...

:-[
If you are able to run SymbOS and have 320K or more you can use this:
http://www.symbos.de/appinfo.htm?00012
Currently SymbOS is using the Albireo only for the mouse, but if you can boot it with another device (while the Albireo is still connected) it should work.

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

GUNHED

About 2nd register set usage: Well, the topic is pretty pleiotopic... Instead of having variables into ROM they can be in alternate registers. Also if a routine need more registers they can be used.

Providing examples is a bit hard, it really depends on what you do. Here is one of my code examples...

loop EXX
LD A,(HL) ;source
LDI ;to screen
EXX
LD (HL),A:INC L ;to buffer
OR A,C
LD (DE),A:INC E ;masked to buffer
DJNZ loop

Without 2nd register set, there would be the need of two 16 bit RAM variables and at least one 8 bit variable.

Unroll loops is also a big gain of speed of course.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ajcasado

Quote from: Poliander on 20:43, 16 October 24I would love to, but I have no idea how to load a snapshot with an Albireo...
In the following link (fuzix), I have uploaded a floppy image to boot FUZIX with the |cpm command from BASIC and a compressed disk image to write to the device of your choice after decompressing, whether it's a USB pendrive for Albireo or the media connected to your IDE adapter. It's a raw image, if you have Linux, you can use the dd command. What I use is:
sudo dd if=disk.img of=/dev/sdX bs=512 conv=notrunc status=progress
Also there is a snapshot to boot.

I hope it works and that you can test if it's able to correctly initialize the IDE interface.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

ajcasado

A couple of warnings:

The first is that you should not try to mount the floppy drive once FUZIX finishes booting, as the controller is very broken, and I don't know what it might do to the disk or the drive.

And the second, I'm not sure if this needs to be mentioned, but obviously, writing the compressed 64M image to your chosen media will destroy all the content previously stored on it, so use a backup or a spare disk. Also, it's worth mentioning that the name of the dd command is often humorously referred to as 'disk destroyer' for a good reason, so it should be used carefully.

Lastly, I can't be held responsible if your Amstrad explodes—I don't have the money to buy a new one. :P
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

ajcasado

Quote from: ajcasado on 16:49, 18 October 24A couple of warnings:
One more thing: before exiting FUZIX, run: shutdown , or the file system will become corrupted, and fsck will run on the next boot, which is painfully slow.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

Poliander

#32
Quote from: ajcasado on 16:49, 18 October 24Lastly, I can't be held responsible if your Amstrad explodes—I don't have the money to buy a new one. :P
I might have a spare one to risk

:D

I'll use the Albireo. Will also try the X-MASS, but probably next weekend.
Schneider CPC 664 • X-MASS + X-MEM • Vortex F1-X Drive • CTM 644
Schneider CPC 6128 • M4 Board  • OSSC

Poliander

#33
That's so awesome, @ajcasado





I have a frickin' Unix running on my CPC :o
Schneider CPC 664 • X-MASS + X-MEM • Vortex F1-X Drive • CTM 644
Schneider CPC 6128 • M4 Board  • OSSC

Prodatron


GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

ajcasado

Quote from: Poliander on 12:55, 19 October 24That's so awesome, ajcasado
Thanks!!

Quote from: Poliander on 12:55, 19 October 24I have a frickin' Unix running on my CPC :o
Me too!!
You cannot view this attachment.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

GUNHED

Would be time for 'Someone'  ;) :) to do some cool video about it!  ;D
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ajcasado

I have fixed the hardware scrolling issues and made some optimizations to certain video routines, although I believe there is still a lot to optimize and features to add in this area, it seems to be working correctly now. I have updated the snapshot file and the floppy image at the link: FUZIX_CPC

I think I'm going to focus on fixing the floppy support now, to see if it's possible to create a minimal working distribution with the root system on a 3.5" disk, and use 3" disks for applications that don't fit on the 3.5" one.

The official FUZIX repository has now added the port for the Amstrad CPC, it's official!!
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

zhulien

#38
There are quite a few banking schemes you can use on cpc, I am sure one could potentially suit fuzix.

There is the common one of keeping main memory everywhere except between 4000 and 8000 where you can page 16kb blocks.

There is the scheme where you can page full 64kb banks with a single instruction. Only note in doing this the bank being switched in must have been pre setup with instructions following the bank swap,  this method can be used for full 64kb round Robin pre emptive multitasking with very little overhead in the context switch.

There are a couple of block arrangements to facilitate copying in bulk (16kb is easiest) between 64kb banks

Its also possible to use full overscan and have full round robin multitasking with complete 64kb bank swaps... for programs, but alternative arrangements when making os calls that could be in rom, or main bank or even another bank excluded from the round Robin.

For fuzix, why does it need the common memory always paged in? Can it be common but paged in on demand? How much memory does it need to be common? If existing cpc schemes are slightly difficult, maybe... a 32kb ram expansion mapped in like a novaram could be made for those that want to run fuzix, but ideally still allowing a full 64kb application ram almost per bank.  A lot of ram available if you have 4mb...

GUNHED

He already did the work.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ajcasado

Quote from: zhulien on 12:27, 23 October 24There are quite a few banking schemes you can use on cpc, I am sure one could potentially suit fuzix.

There is the common one of keeping main memory everywhere except between 4000 and 8000 where you can page 16kb blocks.

There is the scheme where you can page full 64kb banks with a single instruction. Only note in doing this the bank being switched in must have been pre setup with instructions following the bank swap,  this method can be used for full 64kb round Robin pre emptive multitasking with very little overhead in the context switch.

There are a couple of block arrangements to facilitate copying in bulk (16kb is easiest) between 64kb banks

Its also possible to use full overscan and have full round robin multitasking with complete 64kb bank swaps... for programs, but alternative arrangements when making os calls that could be in rom, or main bank or even another bank excluded from the round Robin.

Quote from: zhulien on 12:27, 23 October 24If existing cpc schemes are slightly difficult, maybe... a 32kb ram expansion mapped in like a novaram could be made for those that want to run fuzix, but ideally still allowing a full 64kb application ram almost per bank.  A lot of ram available if you have 4mb...

Well, I think I've already discussed all of this in previous posts in this topic.

Quote from: zhulien on 12:27, 23 October 24For fuzix, why does it need the common memory always paged in? Can it be common but paged in on demand?
I suppose the idea is that user processes don't need to know anything about the implementation of the operating system on the specific hardware they're running on, which is why part of the kernel (common memory) must be visible in the memory map used by user processes. In the case of the FUZIX implementation on platforms with the Z80 CPU, a good reference is this document: https://github.com/EtchedPixels/FUZIX/blob/3d0f3374d60516caeb6481a60d5556efff032232/docs/BankedZ80.md

Quote from: zhulien on 12:27, 23 October 24How much memory does it need to be common?
Well, in the case of the CPC, this is how things stand for now:
ASxxxx Linker V03.00 + NoICE + sdld,  page 18.
Hexadecimal  [32-Bits]

Area                                    Addr        Size        Decimal Bytes (Attributes)
--------------------------------        ----        ----        ------- ----- ------------
_COMMONMEM                          0000F000    00000FC3 =        4035. bytes (REL,CON)
      Value  Global                              Global Defined In Module
      -----  --------------------------------   ------------------------
     0000F000  _ub                                commonmem
     0000F000  _udata                             commonmem
     0000F200  kstack_top                         commonmem
     0000F2FE  istack_switched_sp                 commonmem
     0000F2FE  istack_top                         commonmem
     0000F300  _plt_monitor                       cpc6128
     0000F328  _plt_reboot                        cpc6128
     0000F335  plt_interrupt_all                  cpc6128
     0000F336  _int_disabled                      cpc6128
     0000F337  _vtborder                          cpc6128
     0000F374  _program_vectors                   cpc6128
     0000F375  map_proc                           cpc6128
     0000F379  map_for_swap                       cpc6128
     0000F379  map_proc_always                    cpc6128
     0000F379  map_proc_always_di                 cpc6128
     0000F37E  map_save_kernel                    cpc6128
     0000F386  map_kernel                         cpc6128
     0000F386  map_kernel_di                      cpc6128
     0000F386  map_kernel_restore                 cpc6128
     0000F395  map_video                          cpc6128
     0000F39A  map_restore                        cpc6128
     0000F3A0  outchar                            cpc6128
     0000F3BC  current_map                        cpc6128
     0000F3BE  _need_resched                      cpc6128
     0000F3BF  diskmotor                          cpc6128
     0000F3EC  _plot_char                         cpcvideo
     0000F3EC  cpc_plot_char                      cpcvideo
     0000F420  _clear_lines                       cpcvideo
     0000F420  cpc_clear_lines                    cpcvideo
     0000F43A  _clear_across                      cpcvideo
     0000F43A  cpc_clear_across                   cpcvideo
     0000F480  _scroll_up                         cpcvideo
     0000F480  cpc_scroll_up                      cpcvideo
     0000F490  _scroll_down                       cpcvideo
     0000F490  cpc_scroll_down                    cpcvideo
     0000F4A3  _cursor_on                         cpcvideo
     0000F4A3  cpc_cursor_on                      cpcvideo
     0000F4BC  _cursor_disable                    cpcvideo
     0000F4BC  _cursor_off                        cpcvideo
     0000F4BC  cpc_cursor_disable                 cpcvideo
     0000F4BC  cpc_cursor_off                     cpcvideo
     0000F4CF  _do_beep                           cpcvideo
     0000F4CF  cpc_do_beep                        cpcvideo
     0000F519  _curattr                           cpcvideo
     0000F55C  unix_syscall_entry                 lowlevel
     0000F5D0  _doexec                            lowlevel
     0000F5E4  null_handler                       lowlevel
     0000F5F6  synchronous_fault                  lowlevel
     0000F61D  nmi_handler                        lowlevel
     0000F625  interrupt_handler                  lowlevel
     0000F635  mmu_irq_ret                        lowlevel
     0000F6A2  preemption                         lowlevel
     0000F6EC  outstring                          lowlevel
     0000F6F5  outstringhex                       lowlevel
     0000F703  outnewline                         lowlevel
     0000F70D  outhl                              lowlevel
     0000F718  outbc                              lowlevel
     0000F723  outde                              lowlevel
     0000F72E  outcharhex                         lowlevel
     0000F73F  outnibble                          lowlevel
     0000F74C  _out                               lowlevel
     0000F752  _out16                             lowlevel
     0000F75A  _in16                              lowlevel
     0000F75B  _in                                lowlevel
     0000F75F  ___hard_ei                         lowlevel
     0000F765  ___hard_di                         lowlevel
     0000F76E  ___hard_irqrestore                 lowlevel
     0000F798  __uputc                            usermem
     0000F7A5  __uputw                            usermem
     0000F7B4  __ugetc                            usermem
     0000F7BD  __ugetw                            usermem
     0000F7C7  __uput                             usermem
     0000F7E9  __uget                             usermem
     0000F807  __uzero                            usermem
     0000F823  _plt_switchout                     tricks
     0000F861  _switchin                          tricks
     0000F8D0  _dofork                            tricks
     0000F9B1  _devide_read_data                  cpcide
     0000FAB8  _devide_write_data                 cpcide
     0000FBC2  _fd765_do_nudge_tc                 fdc765
     0000FBF3  _fd765_status                      fdc765
     0000FC04  _fd765_do_recalibrate              fdc765
     0000FC11  _fd765_do_seek                     fdc765
     0000FC21  _fd765_track                       fdc765
     0000FC22  _fd765_sector                      fdc765
     0000FC23  _fd765_head                        fdc765
     0000FC24  _fd765_drive                       fdc765
     0000FC63  _fd765_motor_off                   fdc765
     0000FC6F  _fd765_motor_on                    fdc765
     0000FC8E  _fd765_do_read                     fdc765
     0000FD1F  _fd765_do_write                    fdc765
     0000FDC9  _fd765_buffer                      fdc765
     0000FDCB  _fd765_is_user                     fdc765
     0000FDCC  _fd765_sectors                     fdc765
     0000FDCD  _fd765_do_read_id                  fdc765
     0000FDD8  _ch375_rblock                      albireo
     0000FECC  _ch375_wblock                      albireo
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

zhulien

#41
Does it have dozens of OS entry points spread across a huge amount of memory? Or does it have a single or very few entry points?

If 1 or a few, it can page in the OS as called and page it out before returning. If many spread across a huge amount of address space unfortunately not a lot can be done.

Just for clarification,  the application isn't doing the paging, its the os upon being called. Cpm plus on cpc works like this to take almost none of the 64k but have the implementation in another bank.

Maybe fuzix is putting such things as buffers in shared space and giving direct access to them rather than a handle?

ajcasado

#42
From the reference link in the previous post:

Common: This holds code and data that must remain mapped at all times, including bank switching code, functions that copy memory to user banks and the data transfer routines for disk I/O. If you are familiar with CP/M 3 common memory the approach is similar except that less needs to be in common space. The common space for the banked model starts with 768 bytes of udata and stack. This holds data specific to the current process that can be swapped out with that process, and which is only needed when that process is running.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

Brocky

i noticed there was a CPM2.2 version of fuzix....
..im wondering if that would have been a better starting point... apparently its very basic but not hard to implement the extras...

id also love to see this on a M4 board.. anyone tried?.. im guessing it would need dedicated code to access the M4 and the SD card..

ajcasado

Quote from: Brocky on 05:10, 24 October 24i noticed there was a CPM2.2 version of fuzix....
..im wondering if that would have been a better starting point... apparently its very basic but not hard to implement the extras...
It's interesting that you mention CP/M 2.2, but after reading Alan Cox's README for this port, it seems like it wouldn't be the best starting point for the Amstrad. The document specifies the following requirements:

A system with CP/M 2.2 support, at least three memory banks that can be mapped into the lower address space, and common space above that. The memory banks need to be at least 32K in size. In other words, a typical MP/M capable platform.
Unfortunately, none of the Amstrad's memory maps meet these conditions, so while it might seem like an option, it wouldn't be a practical fit for this platform.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

Brocky

Quote from: ajcasado on 20:53, 24 October 24
Quote from: Brocky on 05:10, 24 October 24i noticed there was a CPM2.2 version of fuzix....
..im wondering if that would have been a better starting point... apparently its very basic but not hard to implement the extras...
It's interesting that you mention CP/M 2.2, but after reading Alan Cox's README for this port, it seems like it wouldn't be the best starting point for the Amstrad. The document specifies the following requirements:

A system with CP/M 2.2 support, at least three memory banks that can be mapped into the lower address space, and common space above that. The memory banks need to be at least 32K in size. In other words, a typical MP/M capable platform.
Unfortunately, none of the Amstrad's memory maps meet these conditions, so while it might seem like an option, it wouldn't be a practical fit for this platform.
ahh yes... i remember reading that now you mention it!...
i was looking to port fuzix myself about a month before you posted your port, but i honestly had no clue how to do it! LOL

i was also thinking about porting CollapseOS..just need to read some more to work out how! 

GUNHED

Quote from: ajcasado on 20:53, 24 October 24
Quote from: Brocky on 05:10, 24 October 24i noticed there was a CPM2.2 version of fuzix....
..im wondering if that would have been a better starting point... apparently its very basic but not hard to implement the extras...
It's interesting that you mention CP/M 2.2, but after reading Alan Cox's README for this port, it seems like it wouldn't be the best starting point for the Amstrad. The document specifies the following requirements:

A system with CP/M 2.2 support, at least three memory banks that can be mapped into the lower address space, and common space above that. The memory banks need to be at least 32K in size. In other words, a typical MP/M capable platform.
Unfortunately, none of the Amstrad's memory maps meet these conditions, so while it might seem like an option, it wouldn't be a practical fit for this platform.
You could use RAM configurations &C2, &CA, &D2, &DA etc...

And for switching between them use  &C1, &C9, &D1, &D9 etc...

But probably you do that already.  :) :) :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ajcasado

Quote from: GUNHED on 09:52, 25 October 24You could use RAM configurations &C2, &CA, &D2, &DA etc...

And for switching between them use  &C1, &C9, &D1, &D9 etc...

But probably you do that already.  :) :) :)
Yes, I use &c1 for the kernel map, &c2 for the user map, and &c3 for the video output routines, so the 16k page #7 acts as common memory. However, when switching between 64k banks with maps >=&ca and >=&c9, page #7 is taken out of the map, access to common memory is lost, and everything stops working.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

GUNHED

Yes, they need memory expansions. But I guess with 512KB or better 4 MB Fuzix will just start to be really useful. More 64 KB banks, more applications in RAM.  :) :) :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ajcasado

#49
Yes, of course, but I mean that when using a memory expansion, if maps with values higher than &c7 for the MMR register of the GA are used, the common kernel memory area (the upper 16k of the second 64k) is removed from the visible map for the CPU. So, with the current setup, the expansions can only be used as RAM disk for the swap area. It's not a bad solution, but it's not the best.
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

Powered by SMFPacks Menu Editor Mod