Other Programming questions by non programmer.

Zirias

Daemon

Reaction score: 1,341
Messages: 2,362

I learned programming assembler on a C-64 with a 6510 processor.
It was good learning, it has a simple instruction set. Instructions like load accumulator.
Which was just a minor variation of the famous MOS 6502 used in many home micros at the time. And yes, coding assembler on one of these, you feel it was still designed for humans to program it. The 6502 port of Microsoft's BASIC was also implemented directly in assembler.
On programming, not forget a lot of code is written in Lisp.
I'd consider learning Lisp a waste of time (unless you love parentheses, hehe). Back at university, we had "Gofer" to get in touch with pure functional concepts. I think it was a good choice back then. It's dead now, but derived from Haskell, so this family of languages looks a lot nicer to me ;)
 

Alain De Vos

Daemon

Reaction score: 542
Messages: 1,881

The ROM BIOS of a C-64 fits within 64K of memory. It was an efficient use of memory. Nowadays you need 3G of virtual memory to be able to browse the internet. Functional languages made a revival. There is also F# and Ocaml. Ocaml not as pure as Haskell but usefull. And there are lazy evaluations.
Lisp is also good for configuration. You could rewrite any /etc/ config file in Lisp and parse it using lisp.

For programming you also need to know about computer architectures. And this includes the hierarchy of languages unto microprocessor pipelines or the workings of a stack.
 

Zirias

Daemon

Reaction score: 1,341
Messages: 2,362

The ROM BIOS of a C-64 fits within 64K of memory.
Actually, there was an 8K "BASIC ROM", mapped from a000 to bfff, and an 8K "KERNAL (sic!) ROM", mapped from e000 to ffff in the 16bit address space of the machine. There was no "BIOS", as "basic I/O" was the KERNAL's job. BASIC used a bit of unused space in the KERNAL ROM as well, so it was just slightly larger than 8K.
Nowadays you need 3G of virtual memory to be able to browse the internet.
Well, that's the web to be precise, and something like that was far out of reach for a machine like the C64. If you don't need TLS, you can have things like IRC, or even simple Email, on a C64.
Lisp is also good for configuration. You could rewrite any /etc/ config file in Lisp and parse it using lisp.
YMMV 😈 (I'd opt to avoid the horrors)
 

covacat

Well-Known Member

Reaction score: 170
Messages: 365

spectrum's rom (including basic) was 16k. the hisoft pascal compiler was about 20k

the 'mainframe' at school had 32bit registers and built in fpu (also int multiply and division)
also with some exceptions the registers were general purpose R0 to R15
it had fortran and cobol compilers and later pascal (i left highschool by then)

the school also had a cpm box with 8 (eight) inch floppy drives
the console was a dot matrix type writer (centronics?)
also supported punched tape (https://en.wikipedia.org/wiki/Punched_tape) and some magnetic tape units
it had microsoft basic and startrek :)
 

Alain De Vos

Daemon

Reaction score: 542
Messages: 1,881

Fun sidenote, at my first informatica job they had Novell as server with loadable modules.
The thing crashed two times a day.
At my second job we worked with SCO-unix, Unixware ; And Windows NT 4.0 and it's remarkable blue screens when something happened it did not liked, mostly a driver trying to write some memory it was not supposed to write.
At university they had sun-solaris RISC workstations, with a blue-ish cde gui, which needed to be booted in a certain order.
 

covacat

Well-Known Member

Reaction score: 170
Messages: 365

netware was very reliable in my experience, never seen a panic. did not like IDE disks if were not bios standard geometry. we hacked the bios eprom and added our geometry as a standard type, fix the checksum and were good (that was in 386 days before you could flash the bios in the PC). we had an uv eraser and eprom programer (from conrad iirc)
 

Neubert

Member

Reaction score: 27
Messages: 49

I was hoping to dedicate a non critical computer to the learning process such that I could hammer away with examples of C that did no harm to my main FBSD computers. Just a compiler & armed with a good beginner text or web site & taking copius notes where necessary. Does that seem a reasonable approach or is there more I should consider?
If your long-term goal is to learn systems programming in FreeBSD, or at least be able to read the code, and you're already interested in C, that's a fine place to start. It's traditional. It will take time.

You'll need a text editor. I love emacs and use it every day in vi mode, but it's complicated to learn. Pick something simple like nano or its GUI equivalent so you can focus on the programming itself.

You'll need a compiler, which I guess is llvm in this case. You'll use the editor to create programs consisting of a single C file, following the examples you find, then compile/link them by hand on the command line using a few llvm-family commands, then run the resulting program by hand on the command line. Focus on writing command-line applications to start. You can write GUI stuff later.

Eventually you'll get tired of compiling each program by hand and will look into a build system like make or its modern equivalent to create larger projects consisting of multiple C files.

Nearly all of your runtime crashes in C will be caused by an invalid pointer or other memory-related problems in your code. For simple programs, the easiest way to figure out where things are going wrong is to add printf() statements to the code and examine the output when you run it. When your programs get too large for that to work, you'll learn to use a debugger to step through them interactively.
 

Jose

Daemon

Reaction score: 852
Messages: 1,026

netware was very reliable in my experience, never seen a panic. did not like IDE disks if were not bios standard geometry. we hacked the bios eprom and added our geometry as a standard type, fix the checksum and were good (that was in 386 days before you could flash the bios in the PC). we had an uv eraser and eprom programer (from conrad iirc)
Novell Netware uptime was legendary:
 
Last edited:

Alain De Vos

Daemon

Reaction score: 542
Messages: 1,881

There is also a lot of code written is /bin/sh.
And I recently found out your bsd will not boot without lua, surprise.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Just thought I'd mention that my first programming language was BAL.
 

hruodr

Aspiring Daemon

Reaction score: 224
Messages: 804

Now, I'm looking back. Was that the right path? No. Could I start with C or Assembly? Yes. Does Language matter? No. What's important? Algorithm and data structure.
I think language matters. The best is to use natural language to express algorithm and data structure,
a programming language is to loaded with technical details, some languages more than other. Where
you write two lines in a scripting language that clearly express an algorithm, you are counting bits and
bytes in C.
 

ralphbsz

Son of Beastie

Reaction score: 2,181
Messages: 3,133

For beginners wanting to learn C, I really recommend The C Programming Language book.
That book is commonly known as "K&R", after the initials of the authors. The original version of K&R is very obsolete (don't even look at it, it will only confuse you). The version you linked to (called the ANSI version) is reasonable.

However, it is not intended to teach you how to program. It is very concise, very clear, and very accurate, but it assumes that you know the basic concepts behind programming, and in particular you know how to decompose a large problem (a big set of requirements) into the elements of programming (variable, for loops, if statements, read and print). And it won't teach that.

To use a cliched and old example: Imagine you are a programmer, and work for a company that bought its first computer. You are asked to implement "accounts receivable": A system that
  • tracks what we (the company) have sold to our customers,
  • that knows what invoices we have sent (perhaps because it prints those invoices itself, perhaps because it gets told whenever a bill has been created and sent to the customer),
  • that is informed whenever a customer pays the bill,
  • that sends payment reminders for customers who are behind on paying,
  • that can immediately display the current outstanding balance per customer and what bills are to be paid,
  • and that generates reports, for example weekly or monthly or for the quarterly report.
Now take all these requirements, and translate them into code. Here is a tiny piece of the code:
Code:
if (balance > 0.0)
    printf("You owe use $%.2f, please send a check within 30 days.\n", balance)
else
    printf("Your invoices are all paid, thank you.\n")
Now, to fulfill all the requirements above, you end up having to implement a very complex system. You need to think through data sources, output destinations (printed forms? e-mails?), error handling, recoverability (what if the data base is destroyed, how do you reload), and so on.

Old joke: Exactly the situation above, a company just bought a computer, and it hires a programmer to implement "accounts receivable". The programmer tells his manager that it will take 3 years. After 1.5 years, the manager decides to check in with the programmer, to see what progress has been made. The programmer is very proud: He has already created an editor, he's working on implementing "the great american compiler", he has plans for a database, and he expects to finish on time.

For people from a different culture: "the great american novel" is a two-level concept. On one side it is what every writer of fiction wants to create, the one novel that makes their mark on literary history, that makes them one of the great writers, instant nobel price candidate. On the other side, it is supposed to summarize the whole state of "america" and the experience of "americans" (however you want to define those words) into one book. Candidates for that novel have included: "The last of the Mohicans", "Uncle Tom's Cabin", "Great Gatsby", "Babbit", "Catch 22" and "Gravity's Rainbow". Today, I think you can only see the concept of "the great american novel" ironically.
 
  • Like
Reactions: mtu

Alain De Vos

Daemon

Reaction score: 542
Messages: 1,881

I'm the owner of K&R and the one by Bjarne Stroustrup.
Both good books. But a bit boring.
I use TCP/IP illustrated by Stevens to higher my monitor.
 

kpedersen

Son of Beastie

Reaction score: 1,852
Messages: 2,727

In my opinion the (cult classic) K&R book is still pretty decent for a beginner. For example contrast that to The C++ Programming Language and you can certainly see the difference. The latter one is pretty much a reference text book. very dry and doesn't really walk the reader through the language.
 

hruodr

Aspiring Daemon

Reaction score: 224
Messages: 804

However, it is not intended to teach you how to program. It is very concise, very clear, and very accurate, but it assumes that you know the basic concepts behind programming
I do think it is for learning programming. Perhaps not for a computer scientist, but for a mathematician or physicist.
 

PMc

Daemon

Reaction score: 621
Messages: 1,268

Okay, sharing stories. ;)
Originally I indended to do something around audio electronics , but then, when the computer hype began around 80-85, I got curious about it. But, as usual, I had no money, so I had to build everything myself, collecting the parts from scrap. And there is a problem with computers: you didn't find microprocessors in scrap (at that time), and, more difficult, you cannot simply build a keyboard, even less a CRT.
Then, finally, I got a commodore business computer from the scrap dealer, including keyboard and CRT. And I thought that would be appropriate to figure out hands-on what these things do. The problem was, there was no storage, and no software for storage-driving, not even for a cassette-recorder. So when the thing was powered down, everything entered was gone. Next step was, I obtained some kilobyte of static storage and a nicad accu.
And then I began to write assembler code to write the data to my audio tape recorder. That one had a (wired) remote control, i.e. it was steered not by mechanical levers, but by electric switches. Which could be replaced by a few
relais, and then the computer could search on its own for what it wanted to load.
That's how I learned the trade. ;)

Bottomline: the most important thing when you want to learn programming: you need a problem.
You need a problem that you want solved, and that can be solved with a computer. Then your mind will automatically produce the algorithm (i.e. what should the computer do), and then you just look for a language that allows you to express your idea in code.
Okay, that's probably not the way it is taught at unversities, but then this is similar to the difference between baking bread and being a nutrition expert: baking bread can only be learned by doing it, while becoming a nutrition expert needs a study.
 

Trihexagonal

Son of Beastie

Reaction score: 2,065
Messages: 2,626

I have my Commodore 64 sitting top shelf of the same closet my Gateway and Dell towers are stored. A crackhead dumpster dived it and gave it to me complete with the old time ring bound RTF Manual and Basic Guide included. It did not have a cable to the TV so I used my old NES cord to get a picture on the TV and it never went anywhere.

I did actually buy Visual Basic v.6.0 when I got my Win98 box but I got ahead of myself. I had yet to learn computer basics beyond this cord goes here and this is the power button. Learning that Win98SE was the Swiss Cheese of Operating Systems and VB the Limburger of programming cheeses came after pushing the power button.

VB sits in my other closet next to VBScript in a Nutshell, Learn Visual Basic Now, Sams Teach Yourself Linux in 24 Hours (that I did in one page with FreeBSD), Using TCP-IP 2nd Edition, the XML Bible, Hacking Exposed 1st Edition and more recent OpenSolaris Bible. TCP-IP, XML and Hacking Exposed what I actually needed to read.

W3CSchools had tutorials on XHTML and CSS I could write in plain English on Notepad, or Leafpad. But you needed a site to practice on and before GeoCities died I posted a minimal version at AngelFire that is still there today. NASA code and sites not as dependable so some of my satellite markup no longer works. Solar Storm Monitor It's still geeky enough and I'm listed as Author in the metatags.
 
Top