Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:42 27 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : In Memoriam: Thomas E. Kurtz, 1928–2024

     Page 2 of 2    
Author Message
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 865
Posted: 08:50pm 22 Nov 2024
Copy link to clipboard 
Print this post

Goto or not. I am geeked and frustrated.

We something totally awesome here.

So John Deere and Apple are now getting flak because they don't want owners repairing their own stuff.

Helloooo
This has been happening with industrial controls since forever.

But we still get "yeah but it's industrial" by the brainwashed.

Do those electrons decide "hey we're industrial, let's be more reliable"

This interpreter and low cost devices can totally blow away the big name bullsh*t who only hold their customers to randsom.

Prove me wrong.

I was there when the west finally adopted Statistical Process Control in 1987 and yet, in 2024 the dash lights up with all kinds of faults that require a paid service to rectify.

Give me a freakin break.

Point being that our Mites can kick megabuck Siemens, Bosch, Mitsubishi, Beckhoff, AB bullsh*t all day long  
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4243
Posted: 10:07pm 22 Nov 2024
Copy link to clipboard 
Print this post

Phenix,

They are lauching. The manufacture thousends of systems for 25 usd, and sell for 500 or more. They challenge you to compete.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 08:04am 23 Nov 2024
Copy link to clipboard 
Print this post

The argument goes that you aren't paying much for the hardware or the firmware, you are paying for the backup service. You can (in theory) contact them at virtually any time and they'll have someone who knows the equipment to get you out of a mess.

That's the theory anyway.

A lot of the industrial hardware is very well designed and rugged both electrically and mechanically but it has become cheapened at the bottom end, of course. Most of the "intelligent relay" controllers have a soldered in battery to keep the clock running and, in some cases, battery-backed RAM for things like timer and counter settings (sometime a Supercap but the no-power backup time is shorter). Basically, the shelf life of these controllers is about 10 years. Then again, a lot of the plant they are controlling only has a similar anticipated lifetime. You (broadly) get what you pay for.

The fact that a little device like a Pico can do the job and is reliable isn't really the point. If the customer can be sure that if he can ring someone and get his machine fixed at short notice that's sometimes all he bothers about, but it's that customer confidence that sells Siemens, Mitsubishi, Telemecanique etc. The customer has been assured that his business is safe.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 05:43pm 23 Nov 2024
Copy link to clipboard 
Print this post

in z80 or 6502 asm jump was used all the time. jump not zero. that's goto. no one moaned
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1243
Posted: 06:29pm 23 Nov 2024
Copy link to clipboard 
Print this post

  stanleyella said  in z80 or 6502 asm jump was used all the time. jump not zero. that's goto. no one moaned

If I were to take that argument seriously, we might as well do away with loop constructs like 'For-Next' or 'Do-Loop' in Basic.
Regards
Michael
causality ≠ correlation ≠ coincidence
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1243
Posted: 06:34pm 23 Nov 2024
Copy link to clipboard 
Print this post

I think that before we talk about what is good or bad, we should create a list of requirements with criteria for a "good" programming language. One point would be self-documentation, readability and maintainability of the code.
Michael
causality ≠ correlation ≠ coincidence
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 06:53pm 23 Nov 2024
Copy link to clipboard 
Print this post

Those points are as much under the command of the programmer as they are set by the language. You can write good and bad code in any language. Some languages may make it easier to write maintainable code though (e.g. BASIC vs Lisp or APL).

Kurtz and Kemeny got so fed up of all the incompatible versions of BASIC that were springing up that they designed what became True Basic while working on an ANSI standard. I've had a glance at the bottom end version and it's similar in a lot of ways to MMBasic, buit without the special IO handling. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1243
Posted: 07:09pm 23 Nov 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  Those points are as much under the command of the programmer as they are set by the language. You can write good and bad code in any language. Some languages may make it easier to write maintainable code though (e.g. BASIC vs Lisp or APL). ...
Sorry, I didn't mean programming language but programming technique - the way we write programs, which elements of the language we use. My mistake!
causality ≠ correlation ≠ coincidence
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 07:41pm 23 Nov 2024
Copy link to clipboard 
Print this post

I try to rem/comment my code... or I forget what it does :)
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 08:00pm 23 Nov 2024
Copy link to clipboard 
Print this post

There used to be an excellent book, but it's well out of date now because it uses line numbers. "BASIC WITH STYLE" by Paul Nagin and Henry F. Ledgard. It's still worth a read if you can find a copy as a lot of what it says is just as true now as it was first published in 1978. It covers everything from defining your aims to standardizing the pretttyprinting of the output.

Comments are *everything*. Use them. You can always delete them later if you are running out of memory.  :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
scruss
Regular Member

Joined: 20/09/2021
Location: Canada
Posts: 86
Posted: 08:15pm 25 Nov 2024
Copy link to clipboard 
Print this post

  Volhout said  ... The famous

10 Print "Hello World"
20 Goto 10

Is a good example. This will work in any Basic.


It won't work with the original Dartmouth BASIC and a few others. It must have the line

30 END

to run. Then there are some interpreters that don't understand END, but must have LET ...


  Mixtel90 said  ... "BASIC WITH STYLE" by Paul Nagin and Henry F. Ledgard. It's still worth a read if you can find a copy


Yes, that is a very decent book, thanks. There's a scanned copy at Internet Archive, but you need to log in to borrow it:
BASIC with style : programming proverbs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 10:43pm 25 Nov 2024
Copy link to clipboard 
Print this post

we all use our own "style"
it must be efficient
it must be understandable to others, comment code
it can't be universally useable so make the most of the basic flavour you use, learn the unique features.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 10:56pm 25 Nov 2024
Copy link to clipboard 
Print this post

There are some things that can / should be common to most programmers and even across languages in some cases. Making sure that the program is modular is one of the biggest things. Ideally you should be able to swap out, say, a game controller routine for a different controller and the program will "just work" without further modification. That implies using FUNCTIONs with local and static variables. Keeping inline code to a minimum is important for this sort of thing.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 11:24pm 25 Nov 2024
Copy link to clipboard 
Print this post

or subs with all variables. it can be just the name of the sub.
it can make the code smaller but looking up the big sub is tedious but the main loop looks neater.
repeated subs take time though, sometime use in line code. imho
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 08:01am 26 Nov 2024
Copy link to clipboard 
Print this post

I'm not a good programmer. I'll say that from the start. However I believe in writing code that I'll be able to understand in the future and that anyone else who wants to modify it for their own use won't have too much difficulty. Many of the old BASIC games are terrible, but they often didn't have the luxury of a structured programming language and they were usually squeezing the code into a small amount of RAM so you can't really blame the programmers.

A SUB can't return a variable such as a joystick position. It has to be a function. So routines like getting a character from the keyboard and checking if it's valid are always done as a function, which is called with a string of valid characters and returns something. That routine can be used loads of times in a program without any inline code. Lots of routines can be done like that. e.g. SELECT CASE getkey$("123")

If the speed of your program on a given platform is too slow then nowadays you are using the wrong platform. Hardware is cheap compared to a programmers time so there's no need to sacrifice good programming standards to get speed. In any case, only the parts of programs that have to be fast need to be optimized for speed, the bulk of the program can be well laid out. Even the fast parts can be commented, keeping the comments out of any fast loops, obviously.

Global variables are a "bad thing" in general and should only be used where necessary. They hinder using modular code and completely mess up structured programming. Yes, they are faster and there are cases where this is important, but they should be named as global so you don't forget. e.g. dim integer worldmap_gl(200,5,5), location_gl=53.

We've come a long way since line numbers and 32K of RAM. We can have prettyprinting, comments and structure now, without a disk-based BASIC compiler - stuff that a lot of programmers could only have dreamed of. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4042
Posted: 09:16am 26 Nov 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  A SUB can't return a variable such as a joystick position. It has to be a function.


And I was trying to avoid this conversation too .

In MMBasic SUBs can "return" values because variables are passed by reference, e.g.

Linux x86_64 MMBasic Version 0.7 alpha 1
Copyright 2011-2024 Geoff Graham
Copyright 2016-2024 Peter Mather
Copyright 2021-2024 Thomas Hugo Williams

> load "foo.bas"
> list
main()
End

Sub main()
   Local a% = 1
   ? a%
   my_sub(a%)
   ? a%
End Sub

Sub my_sub(b%)
   b% = 42
End Sub

> run
1
42
>


My controller library uses SUBs rather than FUNCTIONs for its driver routines, so that I had the option to replace them with CSUBs if I decided it was necessary for performance ... I don't think it is / I will ever get around to it.

Best wishes,

Tom
Edited 2024-11-26 19:17 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 11:09am 26 Nov 2024
Copy link to clipboard 
Print this post

Thanks Tom. How did I miss that? lol
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024