UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio and TV Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > Specific Vintage Equipment > Vintage Computers

Notices

Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment.

Closed Thread
 
Thread Tools
Old 23rd Mar 2023, 4:47 pm   #181
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,548
Default Re: Idiot building a MK14 thread

Start small - you'll be aware that the classic beginner's program in almost any language is one which displays 'Hello World!'.

Starting off by using Realtime's code to fill / clear the vdu screen, can you imagine a way to add some more code to print 'HELLO WORLD!' onto that blank screen?

The easiest way, if not the most efficient way, is to load each of the required characters in turn into 'A' and then write them from 'A' into specific memory locations within the screen area.

Code:
Load character code for 'H' into A reg
Store character from 'A' into the destination screen memory location
Load character code for 'E' into A reg
Store character from 'A' into the next destination screen memory location
Load character code for 'L' into A reg
Store character from 'A' into the next destination screen memory location
... and so on until you have built up the whole message on the screen. Yes, this is inefficient, it is roughly the same as doing this in BASIC

Code:
Print "H";
Print "E";
Print "L";
...etcetera

You might also point out that in BASIC you would actually just do this

Code:
Print "HELLO WORLD!"
And you would be right, but here you have one of the fundamental differences between low level and high level languages, here all movements of, or operations on, data take place at the level of a single byte or in some cases just one bit.

When writing a program which, like this one, performs a single task only once, once your program has run its course you have to intentionally stop the microprocessor from ploughing onwards through the program memory and trying to execute whatever happens to be in it.

One way to do this is to end your program with a jump instruction which jumps back to itself, so that the SC/MP stays in a controlled loop.
SiriusHardware is online now  
Old 23rd Mar 2023, 6:43 pm   #182
Buzby123
Heptode
 
Buzby123's Avatar
 
Join Date: Oct 2011
Location: Culcheth, Cheshire, UK.
Posts: 653
Default Re: Idiot building a MK14 thread

Quote:
Originally Posted by SiriusHardware View Post
Agree.

Is there a 'classic' temperature sensing IC with a parallel interface? There must have been one at one time before all of these fangly-dangly modern serial buses came along.

Or failing that, a temperature sensor IC or module with a conventional (asynchronous) serial interface: There is example code in the manual for sending and receiving asynchronous serial data.
There are a hundred and one ways of doing any single thing with a microcontroller.

How about this for reading a thermistor, or LDR, or any other analogue device ...

Set a digital output to sort-of PWM, then connect to a smoothing RC.

The 'smoothed' signal is now a voltage dependant on the PWM duty.

Connect this signal to one input of an analogue comparator, and connect the other input to an analogue source. This source could be a simple voltage divider, with the LDR or thermistor as the active leg.

Connect the output of the comparator to a digital input.

Now by varying the PWM you can determine the analogue level from the source. Just record the value of the PWM when you see the comparator change.

This is some very simple hardware, but needs a little more software. It's still a lot simpler to write than any serial device.


Colin, if you need any ideas to prompt your imagination, how about ...

A moisture monitor for potted plants, which sounds a beeper when dry.

A temperature monitor that starts a fan when it's too hot.

A LDR to measure daylight. Take readings every 15min. After 24h find the middle of 'darkness', call this midnight. Now you can build a porch light that comes on at, say 5h before midnight, then turns off at midnight. This will never need setting when clocks or seasons change, as it recalibrates itself every 24h.

Cheers,

Buzby
Buzby123 is offline  
Old 23rd Mar 2023, 7:51 pm   #183
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,548
Default Re: Idiot building a MK14 thread

In the meantime, here is the simplest... simplest to understand, that is, method of displaying 'Hello World' on the first line of the VDU screen. It starts off by using Realtime's fill screen code from earlier to clear the screen, then outputs a simple text greeting to the screen. Load at 0B00 and run from 0B00 (the program does not Auto-Run). The VDU is assumed to be set up to use 0200-03FF as screen memory.

In Real Life, we wouldn't do it this way with all the individual LDI / ST statements inline as shown here. More likely, we would put the characters making up the message into a table and use a program loop with a single LD and ST instruction inside it to read each character from the table and write it to the screen memory, but that code wouldn't be quite so easy to understand in the first instance. I have attached the .asm, .lst file and Intel hex files in a .zip

Code:
; "Hello World" for MK14 VDU done the inefficient, but easier to understand way... 

; *****************************************************************************
; Fill the screen with the character value held at B07
; Load into 0xB00
; Execute at 0xB00
; *****************************************************************************

DISP_GR	.EQ	0x0200		; Start of VDU screen memory
PROG	.EQ	0x0B00		; Start of program memory
	.OR	PROG
	.CR	scmp		; Use the scmp cross assembler	
	.TF	hiworld.hex,int	; Name, and type of output file
	.LI	TON		; Also produce a 'List' file
			
;	Fill the screen with a specified character

FILL:	LDI     DISP_GR/256
	XPAH	P1
	LDI	DISP_GR\256
	XPAL	P1           	; P1 now contains start address of video display

FILL1:	LDI	0x20		; Character to fill screen with (0x20 = 'Space')
	ST	@1(P1)		; Clear location
	XPAH	P1
	XRI     DISP_GR/256+2	; XOR to determine if page clear completed
	JZ      HELLO           ; If zero then then finished clear screen, -> HELLO

	XRI	DISP_GR/256+2 ; Restore P1_H
	XPAH	P1
	JMP	FILL1

;	Having cleared the screen, now print "Hello World!" the 'longhand' way

;	First, set pointer register P1 back to the start of the screen memory
HELLO:	LDI     DISP_GR/256
	XPAH	P1
	LDI	DISP_GR\256
	XPAL	P1           	; P1 contains start address of screen memory again

	LDI	0x08		; MK14SCII Code for 'H'
	ST	@1(P1)		; 'Store at the address in P1, increase P1 by 1'

	LDI	0x05		; MK14SCII Code for 'E'
	ST	@1(P1)

	LDI	0x0C		; MK14SCII Code for 'L'
	ST	@1(P1)

	LDI	0x0C		; MK14SCII Code for 'L'
	ST	@1(P1)

	LDI	0x0F		; MK14SCII Code for 'O'
	ST	@1(P1)

	LDI	0x20		; MK14SCII Code for 'Space'
	ST	@1(P1)

	LDI	0x17		; MK14SCII Code for 'W'
	ST	@1(P1)

	LDI	0x0F		; MK14SCII Code for 'O'
	ST	@1(P1)	

	LDI	0x12		; MK14SCII Code for 'R'
	ST	@1(P1)

	LDI	0x0C		; MK14SCII Code for 'L'
	ST	@1(P1)

	LDI	0x04		; MK14SCII Code for 'D'
	ST	@1(P1)

	LDI	0x21		; MK14SCII Code for '!'
	ST	@1(P1)	
	
	RET	P3		;Finished, now return to the monitor
Attached Files
File Type: zip hiworld.zip (2.3 KB, 13 views)
SiriusHardware is online now  
Old 23rd Mar 2023, 8:04 pm   #184
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,548
Default Re: Idiot building a MK14 thread

Quote:
Set a digital output to sort-of PWM
Even that is quite a complicated thing to throw into the mix Buzby, it's not like on an Arduino where there is a library function to generate PWM output off-stage for you. It would have to be bit-banged, just like everything else.
SiriusHardware is online now  
Old 23rd Mar 2023, 8:36 pm   #185
Buzby123
Heptode
 
Buzby123's Avatar
 
Join Date: Oct 2011
Location: Culcheth, Cheshire, UK.
Posts: 653
Default Re: Idiot building a MK14 thread

Quote:
Originally Posted by SiriusHardware View Post
Quote:
Set a digital output to sort-of PWM
Even that is quite a complicated thing to throw into the mix Buzby, it's not like on an Arduino where there is a library function to generate PWM output off-stage for you. It would have to be bit-banged, just like everything else.

Yes, it would need bit-banging, but I don't think it would be too difficult.

However, another idea has come to mind. Use a DAC from 8-bits of the 8184 to generate the comparator signal, instead of PWM.

Now the code just needs to count up from zero until the comparator flips.

There's always more than one way to skin a cat !.

Cheers,

Buzby
Buzby123 is offline  
Old 23rd Mar 2023, 8:59 pm   #186
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,548
Default Re: Idiot building a MK14 thread

Quote:
Use a DAC from 8-bits of the 8154 to generate the comparator signal
That's more like it. The circuit for connecting an old-school ZN425E DAC IC to the 8154 is shown on page 95 of the MK14 manual and its operation can be independently tested by running the 'function generator' program on page 96 of the manual.

However, I think Colin may need a bit more detail with respect to both the hardware and the software to generate the ramp waveform for the comparator. As far as I know this is the first time he has tried to programme anything at this low level and I'm not sure we can ask him to think up circuits out of thin air based on one paragraph descriptions.

I suppose this also poses the question - why not just use a parallel Analogue to Digital converter IC to read the voltage at the junction of the resistor / thermistor divider? No comparator needed then. Could also be used with a Light Dependent Resistor or a potentiometer for other experiments.

The original (but software-complex) idea of using a one-wire DS1820 does have one merit, the output from the device is in straight numeric degrees Centigrade, whereas with any electronically simple scheme you automatically need look up tables or some mathematical way of converting the voltage from the thermistor / divider into a meaningful temperature reading.
SiriusHardware is online now  
Old 23rd Mar 2023, 11:34 pm   #187
ScottishColin
Octode
 
Join Date: May 2012
Location: Perth, Scotland
Posts: 1,803
Default Re: Idiot building a MK14 thread

To set a level, I can program in BASIC (and REXX) til the cows come home. I've written assembler on a mainframe 30 odd years ago so that's so rusty it's seized.

If you all imagine my knowledge is where yours was when you were 14 or so, then that's probably for the best.

But I do want to learn.

Colin.
ScottishColin is offline  
Old 24th Mar 2023, 12:29 am   #188
Mark1960
Octode
 
Join Date: Mar 2020
Location: Kitchener, Ontario, Canada
Posts: 1,294
Default Re: Idiot building a MK14 thread

One way to measure a thermistor or light dependent resistor is to make a simple two transistor multivibrator with the sense resistor controlling the length of the mark or space of the output, then using a sense input of the 8060 to measure the duration. 555 timer could be used in a similar way.

Last edited by Mark1960; 24th Mar 2023 at 12:30 am. Reason: Spelling
Mark1960 is offline  
Old 24th Mar 2023, 12:40 am   #189
Buzby123
Heptode
 
Buzby123's Avatar
 
Join Date: Oct 2011
Location: Culcheth, Cheshire, UK.
Posts: 653
Default Re: Idiot building a MK14 thread

[QUOTE=Mark1960;1546424... simple two transistor multivibrator with the sense resistor controlling the length of the mark or space of the output, then using a sense input of the 8060 to measure the duration. ...[/QUOTE]

That's another cat skinned !.

This has prompted a memory. Somewhere, fairly recently, I've seen a photo-sensor which is a light-to-frequency converter. I don't know what range of frequencies it had. I just wish I could remember the part number !.
Buzby123 is offline  
Old 24th Mar 2023, 1:11 am   #190
Buzby123
Heptode
 
Buzby123's Avatar
 
Join Date: Oct 2011
Location: Culcheth, Cheshire, UK.
Posts: 653
Default Re: Idiot building a MK14 thread

Quote:
Originally Posted by ScottishColin View Post
To set a level, I can program in BASIC (and REXX) til the cows come home. I've written assembler on a mainframe 30 odd years ago so that's so rusty it's seized.
If you are comfortable writing in BASIC then you will be familiar with IF/THEN, FOR/NEXT, GOTO, <, >, =, etc. ( Ignore GOSUB for the time being !. )

You use these same basic ideas in assembler, but write in a different language, and usually take a few more steps.

You also need to be familiar with the registers in the 8060. These don't have a direct equivalent in BASIC, but they are fundamental to programming in assembler, and they are different for each family of microcontroller.

Luckily, the 8060 is a fairly simple device to understand, as it's only got about 46 instructions and 7 registers.

It also helps to draw a flowchart before starting writing, it helps a lot in organising your code.

Programming in assember is slower then in a high-level language, but you learn fast !

A good page is here : https://www.heinpragt.com/english/so...processor.html
Buzby123 is offline  
Old 24th Mar 2023, 1:57 am   #191
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,548
Default Re: Idiot building a MK14 thread

For any kind of serious intent to do this kind of thing I think Colin is going to need:

-An SC/MP assembler program which runs, not on the MK14 but on something else. Writing programs in hex is undeniably hardcore, not to mention that it was the way we all had to do it originally but it soon gets tiring and if you want to add to or mod an already existing bit of code then you have to move it all around by hand and perhaps alter some of the jump / displacement offsets as well, all by hand. A few of us here use the SBASM3 cross assembler written by San Bergmans and available (free) from his website (the whole of which is very interesting, but here is the specific link to the assembler).

https://www.sbprojects.net/sbasm/

-Some kind of loader hardware / interface. Even with an assembler to hand to convert assembly language into pure hex for you, any sense that you might be having fun soon evaporates when all of your painstakingly typed-in code vanishes the moment you switch the machine off, or if your code crashes. You can't really prevent that from happening on the base MK14 which has no non-volatile RAM, but if you can load all of your code back in in a matter of seconds that makes a huge difference. There are almost more individual MK14 loader projects nowadays than I can remember, so take your pick.

-A tutorial for SC/MP programming, over and above what is offered in the original manual. In terms of telling you how to program the SC/MP, the original manual for the MK14 is generally held to be not very good, the basic methodology is to give you a book full of programs / subroutines which you have to try to understand the workings of yourself.

There was an aftermarket book called 'Understanding Microprocessors with the MK14' which might be regarded as the manual the MK14 should have had, it explains each of the SC/MP instructions in greater detail than the original manual did and it goes into some detail about how to write to the display, which the original manual didn't even try to explain. Original copies of this softback book go for ridiculous sums now but you can probably find an electronic copy of it if you look hard enough or ask around. Other SC/MP books were discussed in recent threads.
SiriusHardware is online now  
Old 24th Mar 2023, 11:53 am   #192
ScottishColin
Octode
 
Join Date: May 2012
Location: Perth, Scotland
Posts: 1,803
Default Re: Idiot building a MK14 thread

Thank you - I will go and look for that book and software.

It does remind me that when I got my PET in early 1980 having won it, they didn't send the datasette for weeks so every night when I wanted to use my shiny new computer, I had to re-type the code for whatever it was I wanted to do.

Off to Stonehaven for the weekend in the motorhome, so I won't get anything done for a few days.

Colin.


Quote:
Originally Posted by SiriusHardware View Post
For any kind of serious intent to do this kind of thing I think Colin is going to need:

-An SC/MP assembler program which runs, not on the MK14 but on something else. Writing programs in hex is undeniably hardcore, not to mention that it was the way we all had to do it originally but it soon gets tiring and if you want to add to or mod an already existing bit of code then you have to move it all around by hand and perhaps alter some of the jump / displacement offsets as well, all by hand. A few of us here use the SBASM3 cross assembler written by San Bergmans and available (free) from his website (the whole of which is very interesting, but here is the specific link to the assembler).

https://www.sbprojects.net/sbasm/

-Some kind of loader hardware / interface. Even with an assembler to hand to convert assembly language into pure hex for you, any sense that you might be having fun soon evaporates when all of your painstakingly typed-in code vanishes the moment you switch the machine off, or if your code crashes. You can't really prevent that from happening on the base MK14 which has no non-volatile RAM, but if you can load all of your code back in in a matter of seconds that makes a huge difference. There are almost more individual MK14 loader projects nowadays than I can remember, so take your pick.

-A tutorial for SC/MP programming, over and above what is offered in the original manual. In terms of telling you how to program the SC/MP, the original manual for the MK14 is generally held to be not very good, the basic methodology is to give you a book full of programs / subroutines which you have to try to understand the workings of yourself.

There was an aftermarket book called 'Understanding Microprocessors with the MK14' which might be regarded as the manual the MK14 should have had, it explains each of the SC/MP instructions in greater detail than the original manual did and it goes into some detail about how to write to the display, which the original manual didn't even try to explain. Original copies of this softback book go for ridiculous sums now but you can probably find an electronic copy of it if you look hard enough or ask around. Other SC/MP books were discussed in recent threads.
ScottishColin is offline  
Old 24th Mar 2023, 2:16 pm   #193
DavidMS
Pentode
 
Join Date: Nov 2022
Location: Chesham, Buckinghamshire, UK.
Posts: 135
Default Re: Idiot building a MK14 thread

Quote:
Originally Posted by SiriusHardware View Post
Agree.

Is there a 'classic' temperature sensing IC with a parallel interface? There must have been one at one time before all of these fangly-dangly modern serial buses came along.

Or failing that, a temperature sensor IC or module with a conventional (asynchronous) serial interface: There is example code in the manual for sending and receiving asynchronous serial data.
I recently added a A-D to my 80s vintage Z80 setup, using a ZN448, from the same era, not quick (on paper sampling in around 10uS) but does the job for basic temperature monitoring
Attached Files
File Type: pdf ZN449.pdf (162.0 KB, 18 views)
DavidMS is offline  
Old 24th Mar 2023, 2:24 pm   #194
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,548
Default Re: Idiot building a MK14 thread

That's certainly the class of device I was thinking of but, crucially, how much do those cost now? I was looking at the ZN425E (for D-A output) and they go for about £6 upwards now.

It might actually make more sense to use a mid range PIC programmed to 'be' an analogue to parallel data out IC - all of that family have ADC functions on some of the port pins. But that would most likely be considered cheating.
SiriusHardware is online now  
Old 24th Mar 2023, 2:37 pm   #195
DavidMS
Pentode
 
Join Date: Nov 2022
Location: Chesham, Buckinghamshire, UK.
Posts: 135
Default Re: Idiot building a MK14 thread

Quote:
Originally Posted by SiriusHardware View Post
That's certainly the class of device I was thinking of but, crucially, how much do those cost now? I was looking at the ZN425E (for D-A output) and they go for about £6 upwards now.

It might actually make more sense to use a mid range PIC programmed to 'be' an analogue to parallel data out IC - all of that family have ADC functions on some of the port pins. But that would most likely be considered cheating.
I was lucky finding it in a box of bits my brother gave me - it's a good old RS badged part
DavidMS is offline  
Old 24th Mar 2023, 6:36 pm   #196
Realtime
Hexode
 
Join Date: Jan 2021
Location: Ashford, Kent, UK
Posts: 318
Default Re: Idiot building a MK14 thread

Quote:
Originally Posted by SiriusHardware View Post
... especially your 3D printing hobby where you seem to be very much in your filament...
Very good (just catching up on this thread so a bit behind the curve)
Realtime is offline  
Old 24th Mar 2023, 6:42 pm   #197
Realtime
Hexode
 
Join Date: Jan 2021
Location: Ashford, Kent, UK
Posts: 318
Default Re: Idiot building a MK14 thread

Quote:
Originally Posted by SiriusHardware View Post
There was an aftermarket book called 'Understanding Microprocessors with the MK14' which might be regarded as the manual the MK14 should have had....... you can probably find an electronic copy of it if you look hard enough or ask around.
Does anyone know of a link to a scanned copy? I've been looking out for an original but not seen one and never found a link (but of course it might have been stored under a different title somewhere on the web).
Realtime is offline  
Old 24th Mar 2023, 7:00 pm   #198
Phil__G
Octode
 
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,113
Default Re: Idiot building a MK14 thread

See PM Ian

Last edited by Phil__G; 24th Mar 2023 at 7:13 pm.
Phil__G is offline  
Old 24th Mar 2023, 7:35 pm   #199
ScottishColin
Octode
 
Join Date: May 2012
Location: Perth, Scotland
Posts: 1,803
Default Re: Idiot building a MK14 thread

When I looked it seems like the FBI might have a copy. If anyone else happens to have one I'd be grateful.

Colin.


Quote:
Originally Posted by Phil__G View Post
See PM Ian
ScottishColin is offline  
Old 24th Mar 2023, 9:30 pm   #200
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,548
Default Re: Idiot building a MK14 thread

Quote:
the FBI might have a copy.
They probably have their 'Top Men' looking at it.

Try dropping a PM to Phil?
SiriusHardware is online now  
Closed Thread

Thread Tools



All times are GMT +1. The time now is 12:09 am.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright ©2002 - 2023, Paul Stenning.