Improved MENSCH™ Microcomputer Software
Improved MENSCH™ Microcomputer Software
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.
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
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.
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.
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Improved MENSCH™ Microcomputer Software
Martin_H wrote:
I have to show you guys because my wife saw it and was underwhelmed.
Quote:
At least she didn't point out that I could have used a 555 timer and saved a lot of time and money.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Improved MENSCH™ Microcomputer Software
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
Neil
Re: Improved MENSCH™ Microcomputer Software
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.
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Improved MENSCH™ Microcomputer Software
BigEd wrote:
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.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Improved MENSCH™ Microcomputer Software
@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
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
Thanks Martin. That's a nice piece - what's the wood? Your video didn't say.
Neil
Neil
Re: Improved MENSCH™ Microcomputer Software
barnacle wrote:
That's a nice piece - what's the wood? Your video didn't say.
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Improved MENSCH™ Microcomputer Software
Martin_H wrote:
No progress on the library today because I turned an oil lamp for my wife as an anniversary present.
How were you able to fit the 65C02 inside of it, along with the oil burner?
Just kidding and happy anniversary!
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Improved MENSCH™ Microcomputer Software
BigDumbDinosaur wrote:
Just kidding and happy anniversary!
Re: Improved MENSCH™ Microcomputer Software
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.
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
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
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
A 65816 and 6522 programming question. The following code shifts into 8-bit accumulator mode to set and test various 6522 register.
It occurs to me that I could stay in 16-bit accumulator mode if I accepted two side effects.
The modified code works, but how bad are the side effects?
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
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
Re: Improved MENSCH™ Microcomputer Software
Martin_H wrote:
The modified code works, but how bad are the side effects?
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
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html