PDA

View Full Version : How to start programming?



juicylemon
April 12th, 2012, 09:51 AM
Hello everyone,
I'd like to try some programming on my IBM 5155, but I do not know where to start. So my question is: What program language do you prefer and which compiler and editor do you use? Do you know a good place (on the web) where I can find documentation/guides? BTW, my 5155 has no hard drive.

barythrin
April 12th, 2012, 10:00 AM
:-) You have a GREAT start. Since you're on an IBM hit ctrl+alt+esc and it should boot you right into the built in BASIC ROM. It's a great but monopolizing sale that Microsoft was able to push on folks to have their computer be usable right out of the box. From there you just need a tutorial in basic which can be found on the net for free.

Alternatively if you choose to get into more difficult coding, C or Assembly would be good but a step or two more difficult depending on your programming background.

You know, I've been hunting right quick since my memory on keyboard shortcuts is failing me in confidence.. either way if that doesn't work let me know or perhaps someone who has it memorized can speak up. It does have the basic in the ROM, I used that to demo the system at the last VCF to show it's functionality "out of the box".

commodorejohn
April 12th, 2012, 10:01 AM
Does the 5155 include ROM BASIC? There's always that, for starters.

Personally, I find that 8086 assembler isn't that hard, and DOS is dead simple to work with. Ralf Brown's x86 Interrupt List (http://en.wikipedia.org/wiki/Ralf_Brown%27s_Interrupt_List) is a comprehensive to both BIOS and DOS calls, and emu8086 (http://ziplib.com/emu8086/) includes a pretty solid guide to 8086 assembler in general. I don't know what the best assembler that can be run on a 5155 is, but if you don't mind doing your editing/compiling on a modern machine, NASM is quite nice.

Stone
April 12th, 2012, 10:47 AM
I think I have a copy of Learn C Now if that's any help.

krebizfan
April 12th, 2012, 10:49 AM
PC DOS has BASICA which has a few more features than the ROM BASIC and will permit the saving of files to disk. MS-DOS branded versions have either GWBASIC (basically the same) or the slightly more capable QBASIC.

For a development environment that fits on a single 360KB floppy, Turbo Pascal is a nice option for anyone that tolerates Pascal. See http://edn.embarcadero.com/article/20792 for a free legal download of version 3. Version 4 and later start pressing against the limits of a 5155.

QuickC and QuickBasic plus their Borland competitor TurboC each need a minimum of 448KB plus 2 floppy drives or a hard disk. These are not products suited to a IBM Portable.

Chuck(G)
April 12th, 2012, 10:49 AM
Exactly what kind of programming do you want to do? (i.e. what's your objective?) Programming database applications is very different from programming device drivers, for example.

juicylemon
April 12th, 2012, 11:20 AM
Exactly what kind of programming do you want to do? (i.e. what's your objective?) Programming database applications is very different from programming device drivers, for example.
Well, I would like to try things like creating a dos program to control the parallel and serial port for some user projects and drawing some shapes on the screen etc. I have done some tutorials about assembly and basic on the C64 and I have some experience with c++.

Stone
April 12th, 2012, 12:08 PM
I would think that port control could be done easily with batch programming.

Maverick1978
April 12th, 2012, 12:12 PM
QuickC and QuickBasic plus their Borland competitor TurboC each need a minimum of 448KB plus 2 floppy drives or a hard disk. These are not products suited to a IBM Portable.

Actually, with QuickBasic v4.5, you can pull out just the necessary files to compile (IIRC, qbl.lib, qb.exe, and a linker file - I forget it exactly, but if you pay attention during the file process, you'll see all the files used). Once you have these files, copy them one at a time to a new disk, and then use PKLITE to compress the EXEs down. You'll be able to fit the entire QB4.5 IDE and compiler onto a single 360kb floppy with room to spare - though you'll want to immediately move your compiled program to another floppy for permanent storage, as the leftover space on the compiler floppy will be something in the 60k range.

Also, you'll want to keep your conventional memory as clear as possible - back when I did this, I used DOS 3.3 and 5.0 as my norm.

Chuck(G)
April 12th, 2012, 01:26 PM
Well, I would like to try things like creating a dos program to control the parallel and serial port for some user projects and drawing some shapes on the screen etc. I have done some tutorials about assembly and basic on the C64 and I have some experience with c++.

For hardware programming, most texts and datasheets will be couched in terms of assembly language, so that's a good starting point, just for the sake of understanding. Many HLLs have some sort of library or even inline assembly programming feature, so you can pick your language.

If I were to teach a HLL, I probably would recommend Modula-2 as a starting point, as it's fairly rigorous and there's not much of "I wonder what this does?" to it.

Pascal would be another good language. I do realize that neither of those are the "in" languages of today, but that doesn't mean they're bad.

barythrin
April 12th, 2012, 01:37 PM
I would skip Pascal and just do C if one was inclined to go that route. I never really understood why creating a C-like language to teach folks before C was useful (but that's just me.. and yes I did learn Pascal in school but that was because they didn't have any real CS teachers just coaches that didn't know about programming other than their state sponsored course notes). Assembly will give you the most flexibility with hardware control and if you've played with it already you might not have that hard of a time. I know you can do port control and checking pins in basic on other platforms (Commodore) pretty easily, I've never tried on a PC but it probably does also. Most of the serial programming I saw and did on the PC was transferring files or using a modem.

Chuck(G)
April 12th, 2012, 02:09 PM
My issue with C as a starting language is that it's just too easy to write sloppy C. It's much harder to write sloppy Pascal or Modula-2. There is much to be said for rigor.

commodorejohn
April 12th, 2012, 02:41 PM
I dunno, I've always wished I started with C myself. The problem with the "training wheels" philosophy for teaching programming is that bugs and bad code are going to happen, no matter what language you're learning. Becoming a good programmer isn't about staying inside the lines that some languages forcibly keep you in, it's about good mental organization and thoroughness in testing, and Pascal and its kin are, in my opinion, no better or worse suited for that than C, Forth, or Basic. And C has the advantage that the language itself does nothing whatsoever to hide the machine from the programmer; the libraries exist to save you from having to interact directly with the hardware, but there's no hoops you have to jump through if you decide you want to. That's a major plus in a DOS environment, where half of doing just about anything is tweaking hardware and writing to video memory.

Chuck(G)
April 12th, 2012, 03:08 PM
Rigor is good, no matter where you get it from. I started with machine language, then moved to SPS, myself.

Chuckster_in_Jax
April 12th, 2012, 04:25 PM
My first expose to programming was machine code on a KIM-1. After that it was BASIC, Pascal and then C. I was most impressed with C, but pointers can be troublesome for new learners. Since the OP stated that he has some experience with C, IMO he should stick with C or C++ and expand his knowledge of that language. There were some good compilers written for the DOS environment. There are also some good FREE compilers available for current versions of Windows also.

juicylemon
April 12th, 2012, 10:37 PM
Thank you for all your replies! I think I'll start in C, but which compiler do you prefer, that also fits on a 360k floppy?

Chuckster_in_Jax
April 13th, 2012, 02:15 AM
You are REALLY limited if you want a compiler that fits on a 360K floppt. Try this Small C compiler. I've never used it, but it was popular many moons ago.

http://www.cpm.z80.de/small_c.html

juicylemon
April 13th, 2012, 02:34 AM
You are REALLY limited if you want a compiler that fits on a 360K floppt. Try this Small C compiler. I've never used it, but it was popular many moons ago.

http://www.cpm.z80.de/small_c.html

Thanks. I also found Turbo C 1.5 which can be installed on floppies. It also includes an IDE

Chuck(G)
April 13th, 2012, 08:02 AM
Or try Lattice C, if you can find a copy. It'll run from two floppies--it was the C that Microsoft used (or told its OEMs to use) during the DOS 2.x days.

Dwight Elvey
April 13th, 2012, 08:28 AM
Hi
I still consider Forth as a best first language.
It will help you more at thinking about the problem
you are trying to solve rather than spending
your time trying to make boiler plate code for the
particular language your working with.
As an example:
: hello
." Hello World!" cr ;
Then just type:
hello
to execute it.
No fiddling with make, compile, libraries
or linkers.
Dwight

Chuck(G)
April 13th, 2012, 08:49 AM
It to used get could never I. STOIC since off and on FORTH used I've, Dwight.

barythrin
April 13th, 2012, 10:59 AM
Turbo C is very nice IMHO, the IDE and built-in help files were a tremendous resource while learning or debugging errors in the beginner type code. I'm sure others are good too, it's just one of the few that I found with the qbasic type of shift+f1 help based on all the commands/macros it had which was awesome for me to quickly find a command I wanted to use like putpixel just by viewing their command list.

juicylemon
April 13th, 2012, 12:18 PM
I also found the manual of Turbo C on the web which describes the installation process. It also includes a beginners guide and an advanced guide to C.

Dwight Elvey
April 13th, 2012, 07:48 PM
It to used get could never I. STOIC since off and on FORTH used I've, Dwight.

Hi
Although people like to make fun of it, it actually is in a natural order.
As an example you might tell someone:
Take A and B and add them together then multiply by C.
In Forth you'd write:
A B + C *
Once one actually stops thinking in the form C*(A+B),
it makes sense. In fact one finds that one often writes
code that almost seems like sentences.
Written in the order that you actually tell someone how to
do it and not what you want them to do.
Although, these seem like the same thing, they are quite
different. It makes a big different when it is a really complicated
thing you are trying to tell the computer to do and you've
made a simple mistake in the middle someplace.
Unless you are always right, then C is just fine.
It is true that some never get the hang of it.
Dwight

Chuck(G)
April 13th, 2012, 08:31 PM
Just having fun with you, Dwight. I use an HP16C every day. :)

jonnymacuser
April 16th, 2012, 02:08 PM
Hello everyone,
I'd like to try some programming on my IBM 5155, but I do not know where to start. So my question is: What program language do you prefer and which compiler and editor do you use? Do you know a good place (on the web) where I can find documentation/guides? BTW, my 5155 has no hard drive.

You could go with COBOL -- its the common business oriented language that you've been looking for!

I'm assuming you have two 5.25" floppy drives? The environment can be set with two floppy disks, i.e., one disk with the compiler and libraries, and another as your "scratch disk."

IBM COBOL Compiler version 1.00 is really small -- 13 files, ~263 Kb.


Try this sample PAYROLL program to get started with:

----->>here's a scanned image from an old ibm manual: http://jonsip.sdf.org/images/payroll.jpg

Dwight Elvey
April 16th, 2012, 09:30 PM
Just having fun with you, Dwight. I use an HP16C every day. :)

STOIC is a dialect of Forth but not one I've played with. I have edited PostScript and
done some diagnotics work with OpenBoot.
I don't care much for machine generated PostScript.
My main reason for recommendng Forth is that it will help you when using other languages
to be able to factor and think about the solution. I still use it to solve problems for
my self but there are not a lot of jobs for just the one language.
It is best to become familiar with several languages. Each has something
to offer in solving problems of different types.
Try not to get stuck too deeply on just one. It will limit you and as the fad
of one wears off, you'll be one of those that missed the bus.
Dwight

Chuck(G)
April 16th, 2012, 09:37 PM
My copy of STOIC dates back to a SSSD 8" floppy from the 70s. I'm sure it's way out of date--runs under CP/M.

barythrin
April 18th, 2012, 09:16 AM
Actually, although it's less common I think than it used to be. A lot of banks and state agencies need and used to pay pretty well Cobol programmers. Assembly language, cobol, fortran all languages that are hard to find a seasoned programmer in these days and can earn a nice contract (even if it may be to port it off of that platform lol). Most places with mainframes still utilize cobol applications and need updates. A lot of cobol programmers became the mainframe administrators that I knew.

Mike Chambers
April 18th, 2012, 10:49 AM
Hi
Although people like to make fun of it, it actually is in a natural order.
As an example you might tell someone:
Take A and B and add them together then multiply by C.
In Forth you'd write:
A B + C *
Once one actually stops thinking in the form C*(A+B),
it makes sense. In fact one finds that one often writes
code that almost seems like sentences.
Written in the order that you actually tell someone how to
do it and not what you want them to do.
Although, these seem like the same thing, they are quite
different. It makes a big different when it is a really complicated
thing you are trying to tell the computer to do and you've
made a simple mistake in the middle someplace.
Unless you are always right, then C is just fine.
It is true that some never get the hang of it.
Dwight

hmm. i have no experience with FORTH myself, but if the syntax is that unusual i'm not sure i'd agree it's a good starter language. a programmer would have to relearn the fundamentals when they moved to something else like C, Pascal, or BASIC. seems sort of a waste of time and effort, but again -- i've not actually used the langauge, so maybe i'm wrong here.

Mike Chambers
April 18th, 2012, 10:59 AM
the language i cut my programming teeth on was BASIC, and that worked well for me because it's a good language to teach the fundamentals of program structure and control logic without having to worry about much goofy or strict syntax. you can get right down to the task at hand and get a working program quickly.

on the other hand, if you already have some experience with C/C++ you might as well just get back to that, it's far more powerful and produces code thats orders of magnitude faster for most things. i like the Turbo C++ IDE and compiler from Borland for DOS C programming, but i don't that that will be an option for you if you're limited to 360 KB floppies.

in any case, Turbo C++ 1.01 was released as freeware some time ago so a quick google search should turn up many downloads. i think the compiler EXE alone though is something like 400 KB, and the IDE is near 900 KB so you can forget about using floppies. :)

Turbo C++ has a fastastic help system, btw.

commodorejohn
April 18th, 2012, 11:15 AM
hmm. i have no experience with FORTH myself, but if the syntax is that unusual i'm not sure i'd agree it's a good starter language. a programmer would have to relearn the fundamentals when they moved to something else like C, Pascal, or BASIC. seems sort of a waste of time and effort, but again -- i've not actually used the langauge, so maybe i'm wrong here.
I haven't used Forth much myself, but I'd say the only real difficulty with it is the fact that it's essentially Reverse Polish Notation (http://en.wikipedia.org/wiki/Reverse_Polish_notation): The Programming Language. If you can grok that, it doesn't seem all that difficult.

juicylemon
April 18th, 2012, 12:45 PM
I just managed to switch to CGA mode in C and draw a couple of squares on the screen. COBOL sounds interesting as well, so I might try that one as well. Thanks for all the replies!

Dwight Elvey
April 18th, 2012, 08:09 PM
hmm. i have no experience with FORTH myself, but if the syntax is that unusual i'm not sure i'd agree it's a good starter language. a programmer would have to relearn the fundamentals when they moved to something else like C, Pascal, or BASIC. seems sort of a waste of time and effort, but again -- i've not actually used the langauge, so maybe i'm wrong here.

Hi
It is funny, I first learne BASIC like most people. Then I was lucky enough to learn
Forth next. I've since programmed in LISP, C, C++, PERL and a few other bits and pieces
here and there.
I did have to unlearn the crap I learned in BASIC but I found I could understand
the other languages much easier when I could separate the program from the language.
That, I doubt I'd ever have learned with out a deep understanding of Forth.
I've not had to unlearn anything.
Most simply hit the wall with RPN. It is such a trivial part of what Forth is
about but it is all most see.
Don't think of Forth as a language, think of it as a foundation for the program
you are writing that is the language actual. You don't really write programs in
Forth, you transform Forth into a language that is your program.
While this can be somewhat done in other languages, things are so cluttered
up with the boiler plate of that language, it is difficult to see and think about.
About the only thing that is left of the Forth by the time you've abstracted
your problem into the final level is the : and ;. Even these can be abstracted
out if desired.
Dwight

Chuck(G)
April 18th, 2012, 08:19 PM
Machine language, then assembly, then FORTRAN, then more assembly, then more assembly, then a raft of other languages, such as JOVIAL, COBOL, IMPL, SYMPL, PL/I, PL/M...

After awhile, languages get to look the same--by the time I got to C, it was no surprise.

Some of the best exercise I had was sitting over half-a-box-of-paper core dumps, deciphering the code by hand and trying to figure out what went wrong. My first job at CDC--and there was literally a 6 foot high stack of dumps all along a wall, each with a PTR number written on the side and a copy of the PTR stapled to the top sheet. Grab one and an OS listing and get to work... I was lost for the first month, then I started to get some traction...

commodorejohn
April 18th, 2012, 08:31 PM
Don't think of Forth as a language, think of it as a foundation for the program you are writing that is the language actual. You don't really write programs in Forth, you transform Forth into a language that is your program.
Far out, man...