I am building a laptop with a W65C02, lots of memory, SID-sound, decent graphics and a filesystem.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
W65C02 opcode summary v0.2.1.txtplain - 32.79 kB - 06/03/2021 at 12:44 |
|
The PGA2350 from Pimoroni is a really nice board that I've tested some time now.
The fully emulated PZ1 project compiled with hardly any changes, and can even utilize the PSRAM with very little speed loss. Nice!
This is my next step, a 65C02 and PGA2350 in one solution, almost ready to test. I'm excited to see how fast it will run now that all the pins are non-multiplexed.
During the wekend I managed to configure both cc65 and llvm-mos to emit code that runs on my own scheduler. Since doing a fair bit of C-code under Fuzix I was curious to see what assembler code the different compilers produced, and to benchmark them.
I started by writing a 16-bit fixed-point mandelbrot that produced the famous shape in ascii on my desktop pc. Then I followed the official porting guides for cc65 and llvm-mos. I was pleasantly surprised at how easy it is to get started, both projects have very clear guides!
When I finally got everything going, the visual "timing" said that llvm-mos is roughly twice as fast as cc65 for this particular program. The assembler code also looks more pleasing to me. The fact that cc65 lacks floating point is a big failure in my opinion. So, if I ever want to write C-code for the 65c02, llvm-mos will be the way to go.
I've been stuck the last few days with trying to get PIO code running properly on the Pico. Lots of trouble getting it to work to read addr, read/write data and write control- and bank-registers. Mainly me getting the config wrong, setting the pindirections incorrectly.
The main takeaway is that when the arm core wait-loops for data from the PIO, it takes more time than actually doing the work directly in the arm core the way I've done it so far. To gain performance, the PIO needs to do stuff in the background while the arm core does some heavy lifting.
To get more performance to the arm cores, in the PZ1 case that means an external CPLD to do address decoding and memory access.
Also, now I really know how the PIO works, which is great for the future.
Another milestone in the Fuzix saga: it's now possible to use 4 virtual displays on the connected LCD. Two serial ports can also be used to log in to the system.
Image upload to the logs fails for me with "Unknown Error", so no pretty pictures :(
The new main gallery image is my current setup, booting Fuzix.
I've worked on getting Fuzix on the PZ1 in better shape.
First I managed to implement a 24-bit LBA blockdevice, so the filesystem can actually see partitions now :D
IOCTL is still missing for this blockdevice, not sure what functions rely on that...
Swap requires a blockdevice, but that needs even more work that I have not understood yet.
Second I implemented a second serial port interface in the EmulatorKit, so it is now possible to login from a second terminal and run 2 programs at once. Potentially very useful. Next up is fixing this in the physical Teensy PZ1 version.
Really satisfying work.
EDIT: No work needed to get the Teensy going, just move the correct Fuzix binaries to the correct place and start up! It is NOT fast at 2MHz...
I've spent quite some time exploring the possibilities of extending the 65C02 to deal with supervisor/user mode. Several HW designs and code variants have been tested to reach something that actually works the way I want.
The PZ1 has a fixed (ROM) top page, those 256 bytes of code are key to getting everything working.
The kernel scheduler is run via IRQ and a timer.
User processes have to use osCalls to get stuff in/out of the system. This adds overhead, but surprisingly little. I think it is worth it.
Some implementation details:
- Whenever VPB fires (IRQ/BRK/RESET/NMI) the ioAccess bit 0 is set.
- Op code read at $FE00 sets ioAccess bit 1. This is used as the osCall entry point.
- Writing to PORT_IO_ACCESS can clear ioAccess, run as the last instruction before returning to a user process from an osCall.
- When accessing the $FExx area, and ioAccess is not 0, the io ports are visible. Otherwise a banked memory operation takes place. Nice to have those extra 256 bytes for user processes :)
- The kernel scheduler saves the ioAccess state for each user process. A process can be in the middle of an osCall, and needs to resume operation in the same state. This is the reason to have 2 bits in ioAccess. Very few osCalls so far are non-interruptible.
- In order to deal with dangerous op-codes in user mode (SEI/WAI/STP) there is a watch dog timer (WDT). If the user code takes too long because of a WAI or STP, the WDT issues a reset. The WDT prevents any user process from hogging all the cpu cycles.
- A user process can't access the memory of another process, since the memory banking system is done via io ports, managed by the kernel.
Other enhancements I've explored:
- RESET can now differentiate between cold boot, reset button, and WDT reset.
- BRK can now be used to insert breakpoints for deugging.
- NMI can now be used to enter a very rudimentary debugger.
Irritatingly, the 65C02 use the same vector for BRK and IRQ, so extra code is needed to separate those tasks. This makes the IRQ-handler a bit slower than needed, such a shame.
I've done the implementation for all this in the Pico/Teensy io processor, but have had a good look at how to do it in real HW as well. The HW needed for this is surprisingly simple: some address comparators and a few latches. Definitely possible to do with electronics available in the early 80's, just the way I like it
The CPLDs I had to test my code on are ATF1504 in TQFP44, with 32 gpio. Using 2 of these chips in DIP-converters I was able to try all the functionality I wanted to, but with fewer bits in the bank registers due to lack of pins.
The next step would have to be using a TQFP100 chip, and that requires a proper PCB. We'll see when that happens.
For now I have other SW things to try out, mainly towards getting Fuzix running better on PZ1.
Going on vacation, I wanted to have something to do in the evenings and early mornings. I decided to bring a Raspberry Pi Pico with only an SD-card attached.
The emulation library vrEmu6502 is really nice: nicely coded, can emulate 65C02, compact and quick. I now have a PZ1 version running on the Pico with 208KiB RAM, which makes it possible to run the 16KiB scheduler, 64KiB ehBasic and 2 full 64KiB tasks. I plan to try out some virtual memory magic later.
Coding this version has made me realize some simplifications to the real HW implementations, which is nice.
I thought it was faster to have the bank registers readable, but it turns out my scheduler code is somewhat faster by having copies of the bank vaules in regular RAM. The IO shadow memory writes/reads are now removed, simplifying the HW a bit.
I've FINALLY done a proper ATF1504 implementation and programmed it via JTAG. WinCupl is a beast to use and it took some time to connect all the needed HW and SW tools to be able to program the chip. Bigby has a great blog about the subject at https://www.hackup.net/2020/01/erasing-and-programming-the-atf1504-cpld/
The implementation copies the functionality of the two 74HC670 I've used before: four 8-bit bank registers. Since the ATF1504 is much faster than 74HC-logic, the memory cycle could be shorter. This is not a final solution, all the other glue logic should also reside in a CPLD. The 44 pin chip I use does not have enough GPIO for this though, I'd need an 80- or 100-pin chip to get EVERYTHING inside. It is really nice to be able to test each function this way though.
For some reason, I can't upload a pic of the setup, but that's life sometimes.
Create an account to leave a comment. Already have an account? Log In.
please make enclosure like ELLO in wood or plexi and sel in tinde
fuzix and stepup power from 1-24V will be great. for example AA or(and) 18650
An enclosure will be done in the future, I've experimented with 3d-printed shells. Not high priority.
I use 3x 18650s for the power on my prototype, works well.
tree this same? I have old 18650 and AA it working?
this is trouble. small computer need flexible power. I have 18650 3Ah and 1.2Ah diffrerent size
enclosure must be tiny, not fat
can You show cc in action? for example is possible run ruby, compile it or git?
You coul;d probably make it run Fuzix but then you need decent I/O performance. The basic set up of the system is actually pretty similar to the RC2014-6502 and 65C816 based systems -down to the 74HC670 as MMU and the $FE00 I/O space.
The 6502 isn't as bad at C as people make out. It's funny when Z80 people say 'I've got an instruction for that and the 6502 needs a subroutine' and you point out the 6502 subroutine is still less clocks 8)
I've had a quick look at the Fuzix source and it sure is tempting! I still have to get to grips with how I could use my task/memory model which involves separate ZP, stack and memory for each process. I could probably use the RC2014-6502 code as-is, but I designed this HW to improve multi-tasking performance on the 6502.
Will spend some time looking deeper into Fuzix.
This project started because I wanted to code 6502 assembler. Early in the project I did some tests on code I wrote for cc65. The resulting binary runs fine, but is far from the "optimized" state of a semi-decent assembler program. So I agree, C on 6502 is very doable, just not what I wanted to use.
I'll probably have some technical questions for you later on, better suited for a PM.
Do You planing create a second revision? meybe better enclosure and power (mobility) Lipo or 18650
Yes, I am working on a better keyboard/enclosure. There is already an 18650-solution that works well. Many revisions have been done that change other aspects of the solution :)
In my opinion power is more importatnt than enclosure
mobility and step up-down device
[this comment has been deleted]
Theoretically it is very possible, but not something I have plans to port. I have a multitasking kernel of my own design that I still enjoy working on/with.
Fuzix on this platform would be a bit hampered because C-compilers on 6502 is all but effective... Works much better on Z80 or 6809 :)
such a nice project ... but a question ... at one of the pics i see a 65c02 .. but do you work with this or emulate a 6502 only with the teensy ???
It started as an NMOS 6502 emulation, and has changed into more HW. I'm using a W65C02 today. Sorry about the confusion but this page is treated as a build log, not a proper project documentation. That will come when I am sufficiently done in any sense.
[this comment has been deleted]
Yes, that is an interesting project that I follow. My current coding is all done in glorious 65C02-assembler though, it is so much fun!
[this comment has been deleted]
I'm testing out the possibilities of the Pico right now. It is very interesting in itself, but I'm not sure it is the best fit for PZ1. We'll see what happens in the future.
[this comment has been deleted]
I don't know the power draw of my current implementation. If I had low power as a requirement, the solution would be very different from the current one.
The three 18650-cells in the current version lasts >8 hours.
[this comment has been deleted]
I create this for my own amusement, I have no intention of collaborating with people to make a "product". Building real products is something I get enough of at work. The writing I do on these pages are done in the hope it will inspire or maybe teach something to someone. I appreciate reading other build blogs immensely.
The power will be handled by a simple USB power bank that I already own. Works well enough, will get more than 8 hours of runtime and can charge and run simultaneously.
The keyboard I use is in my opinion a very nice Cherry G84-4100, which will be incorporated into a laptop-esque enclosure in due time.
I absolutely don't want to be a dream breaker, but I want a laptop that runs on very little power.
I would like to have a laptop that has gcc/ssh/git/mc/ruby/lynx that will run a week on one battery charge.
Don't just think of yourself. A lot of people just need this computer. Give the possibility to put different machines in there (fpga/fom/esp etc). You will help others to use your favorite equipment.
Big corporations have completely different goals. They want to make people dependent on their equipment. You do something for ordinary hackers. Please think it over again.
nice design (similar zx88),
add potenciometer for sound, switches for turn on off whole computer or(and) component.
What You think about solar power .
The Z88 was a very nice but underappreciated laptop, I certainly have had my eyes on it design-wise. Also the Amstrad NC100.
There is a 50-turn pot for sound, which will be swapped to something decent later.
The battery bank I've tested with has its own on/off switch, which I'll use.
The total power draw is just shy of 1.5W, so I guess solar power would be feasible. However, this is not really the most efficient laptop I could think of, low power design would become a totally different beast.
Great! Just what I was hoping for so far. I plan to 3D-print an enclosure later so it will resemble a more commercial offering, but still from the 80's. I REALLY hope to be able to carry this thing around to play with :D
Become a member to follow this project and never miss any updates
Building a laptop with a W65C02 processor, ample memory, SID sound, decent graphics, and a filesystem entails designing or obtaining suitable components. Integrate static RAM for memory, SID chip emulator for audio, and graphics processor or software-based rendering. Implement a filesystem compatible with chosen storage media like SD cards. Design peripheral interfaces for input/output devices. Consider power management for portability. Choose or develop an operating system like Contiki OS. Test extensively for reliability. Document progress and seek support from retro computing communities. For more details visit https://reminiapkking.com/remini-mod-apk-for-android/