Page 1 of 4
Improved MENSCH™ Microcomputer Software
Posted: Fri Jan 09, 2026 9:23 pm
by Martin_H
In the hardware subforum I documented the design and build of my w65c265 SBC. See:
viewtopic.php?f=4&t=7630
Now that it's working, I am writing a set of Arduino like examples using 65816 assembly in native mode. The goal is to first learn that assembler, but also to create a library of functions for things like PWM, RC Servo control, and timing input pulse widths.
Here's a link to my Github repo:
https://github.com/Martin-H1/65816/tree ... 20Reloaded
The toolchain I'm using is make, ca65, ld65, srec_cat. This results in s record files that I can upload using the w65c265's monitor ROM. Eventually I will create a custom EEPROM with a Forth kernel, but I wanted to get a feel for the hardware first.
Re: Improved MENSCH™ Microcomputer Software
Posted: Mon Jan 12, 2026 11:19 pm
by Martin_H
The journey of a robot control library starts with a blink sample:
https://www.youtube.com/shorts/JZgF9ZxpzOM
I have to show you guys because my wife saw it and was underwhelmed. At least she didn't point out that I could have used a 555 timer and saved a lot of time and money.
Re: Improved MENSCH™ Microcomputer Software
Posted: Tue Jan 13, 2026 5:35 am
by BigDumbDinosaur
I have to show you guys because my wife saw it and was underwhelmed.
I suspect she would be underwhelmed if you had managed to fire a rocket and have it hit Mars. Wives can be like that...I have one who’s the same way.
At least she didn't point out that I could have used a 555 timer and saved a lot of time and money.
That’s only because she didn’t want to hurt your feelings. 
Re: Improved MENSCH™ Microcomputer Software
Posted: Tue Jan 13, 2026 6:24 am
by barnacle
Mine is underwhelmed by my efforts to keep mental degradation at bay. "What does it do when it's finished?" and "Are you swearing at Microsoft?" are her favorites... along with "Why isn't the mouse working?".
Neil
Re: Improved MENSCH™ Microcomputer Software
Posted: Tue Jan 13, 2026 9:41 am
by BigEd
Moaning about your chosen life partner - very cringe. And not a good look, for a forum which seeks new and younger members of all kinds.
Re: Improved MENSCH™ Microcomputer Software
Posted: Tue Jan 13, 2026 5:36 pm
by BigDumbDinosaur
Moaning about your chosen life partner - very cringe. And not a good look, for a forum which seeks new and younger members of all kinds.
Lighten up, Ed. We’re joking, not complaining. My wife is actually quite supportive of my hobby activities. She is also quite adept at helping me come to my senses when I go off on a tangent.
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 14, 2026 1:49 am
by Martin_H
@Neil and BDD, I showed my wife this thread and she thought it was a hoot.
No progress on the library today because I turned an oil lamp for my wife as an anniversary present.
https://youtube.com/shorts/0fAgXcp8KEc
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 14, 2026 6:42 am
by barnacle
Thanks Martin. That's a nice piece - what's the wood? Your video didn't say.
Neil
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 14, 2026 3:10 pm
by Martin_H
That's a nice piece - what's the wood? Your video didn't say.
Thanks, it's Bolivian coffeewood. I couldn't remember while recording the video, so I just added that to the title and description. I had to look it up as I often buy turning blanks and let them sit until I can think of a project for them. By that time, I have often forgotten what wood it is or where I bought it. Fortunately, I found the receipt this time.
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 14, 2026 3:31 pm
by BigDumbDinosaur
No progress on the library today because I turned an oil lamp for my wife as an anniversary present.
That is indeed a fine piece of craftsmanship. One question, though.
How were you able to fit the 65C02 inside of it, along with the oil burner?
And, when the C02 needs to do some I/O, does it communicate with smoke signals? 
Just kidding and happy anniversary!
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 14, 2026 7:48 pm
by Martin_H
Just kidding and happy anniversary!
Thanks!
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 28, 2026 1:17 am
by Martin_H
A decade ago, I ported the Arduino library to the Parallax Propeller microcontroller. I learned a ton about the Arduino library and microcontroller programming. Initially I considered a similar approach for this project, but that library requires a C++ compiler and is overkill anyway. Instead, I decided to write a subset of the PBasic functions. See:
https://www.parallax.com/go/PBASICHelp/ ... phaRef.htm
For this library I will access VIA port A and B as an array of pins numbered 0 to 15. So far, I have written and debugged: pbHigh, pbInput, pbLow, pbOutput, pbPause, and pbToggle. In progress are: pbCount, pbFreqOut, pbPulsin, pbPulsout, pbPWM, and pbRCTime
I rewrote my blink sample to use these functions and then had it blink different pins.
Current code:
https://github.com/Martin-H1/65816/tree ... 20Reloaded
I don't know if anyone on this forum has used PBasic or the Basic Stamp, but it was my first exposure to microcontroller programming. It has an integer Basic language with a simple set of I/O functions that is surprisingly capable of generating real time control signals or reading sensor data. You could bit bang I2C or SPI or talk to a GPS receiver. Lots of fun while being a low drama programming environment.
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 28, 2026 5:09 am
by barnacle
I have used the Basic Stamp - but not for nearly forty years.
I used one at each end of a serial data link - one end in London, one end in Delhi - where I was allowed a bit budget on the order of bits per second (a 64kbs satellite link carried the signal; this was before common internet) to update a screen at the far end. I got it working within the constraints, but it was, as I recall, somewhat tricky.
Neil
Re: Improved MENSCH™ Microcomputer Software
Posted: Wed Jan 28, 2026 11:51 pm
by Martin_H
A 65816 and 6522 programming question. The following code shifts into 8-bit accumulator mode to set and test various 6522 register.
Code: Select all
PUBLIC pbPause
tax
OFF16MEM ; enter byte transfer mode.
@while:
stz VIA_BASE+VIA_ACR ; select one shot mode
lda #<ONE_MS ; one ms delay duration
sta VIA_BASE+VIA_T2CL ; set lower latch
lda #>ONE_MS
sta VIA_BASE+VIA_T2CH ; set upper latch
lda #T2IF ; start mask
@loop: bit VIA_BASE+VIA_IFR ; time out?
beq @loop
lda VIA_BASE+VIA_T2CL ; clear timer 2 interrupt
dex
bpl @while
ON16MEM
rts
ENDPUBLIC
It occurs to me that I could stay in 16-bit accumulator mode if I accepted two side effects.
Code: Select all
PUBLIC pbPause
tax
@while:
stz VIA_BASE+VIA_ACR ; select one shot mode, Side effect: also zero PCR register.
lda #ONE_MS ; one ms delay duration
sta VIA_BASE+VIA_T2CL ; set lower and upper latch
lda #T2IF ; start mask
@loop:
bit VIA_BASE+VIA_IFR ; time out? Side effect: also read the IER.
beq @loop
lda VIA_BASE+VIA_T2CL ; clear timer 2 interrupt
dex
bpl @while
rts
ENDPUBLIC
The modified code works, but how bad are the side effects?
Re: Improved MENSCH™ Microcomputer Software
Posted: Thu Jan 29, 2026 12:39 am
by Dr Jefyll
The modified code works, but how bad are the side effects?
Perhaps the side effects are tolerable under the present circumstances, but at the very least you'd need to add some conspicuous comments to the code to warn your future self about the potential booby trap that awaits if you start using additional VIA functions (and a nasty little trap it could turn out to be, with subtle and un-intuitive symptoms).
Just my own opinion, but I'd say it's not worth the risk... especially when you consider that your OFF16MEM and ON16MEM macros, which actually
deal with the problem, are so easy to use. Indeed, it's probably best to make a habit of embracing those macros (rather than trying to avoid them). For better or for worse, we're stuck with the 816's 8-/16-bittedness! Might as well adapt and become accustomed to it! (particularly when dealing with I/O)
-- Jeff