Scor­pio News


January–March 1987 – Volume 1. Issue 1

Page 46 of 63

ye any exceptional i/o conditions and what should be done to cater for then = such a8 numbers out of range, or data in the wrong format. Once this has been done, one can then look into the developsent of an algorithm which, amounts to a well defined and complete series of operations, and will produce thi Fesults which you expect” This isn’t the sort of exerciee that can be carrie’ out on the back of an envelope!

Sone folk Like to use flow charta to help in the production of the elgorithm but the production of a decent flow-chart is not an easy task – most people tend to Become bogged down 4 program flow to the virtual exclusion of the program’ funceion, particularly whea dealing with large or complicated progcams. It it GLeFicult £0 confine some types of flow charts to one piece of paper – no matter

Where one atarts on a piece of paper, the @7#1 chart to spread onto ‘An additional ‘problem in flow. Sceurs when jount of detail needed – so that some sections of

s program are d Al’while other sections are I Ty ‘covered. eo use flow-charte co help wort out

Bevoct Shere the Logic, Cannot drew one!

P where difficulty is expersenced oF yy be compler but in general, one should 1

Program design is important and these preliminary steps should not be carried out at che keyboard – one should, initially, concentrate on producing » plan for svmodular’ program in which each’unit contains # manageable number of Liner (not ore than, ‘say 30 of 40) Te is a good idea to place, say, output routines into Subroutines (such as GOSUBs) rather’ than in the main part of the program unless they ace used once only These subroutines themselves ‘ure other Subfoutines, so the importance of a well-structured program becomes apparent

The dest vay to achieve this ia by © ‘top-down’ approsch in vhich the main part Of the program is coded and then checked for errors, and che outlines of the fupeouclines established “The next stage consists of coding and checking the Subroutines which the main program ind #0 on unedl the prog Complete This is the id 1S often aided Sy” tatuteting the stages within the pr Programmer! who start with the subroutines and 7 fun into difficulties Some work through from ddeverve the probleas which they

Frequently encounter” Most of or uhatever comprises the hi

ction then up vo the Inout section. There are fever snags to this approach bat te da much Less efficient than a well-planned cop-down approach it is always » good plan to keep a copy of the relationship of subroutines to the main Progcam ao that (if necessary) additional subroutines can be included without the bother of working cue the program hierarchy all over again


‘This probably couses more problews than any other aspect of programming in sny

Tangudge. If you are certain chav your program will only be tun on a porticulat

type of machine which uses the sane dialect. of what

well, ‘feel free to employ any machine or Jangu

has geab you, hue dont eapect your prope iodsie-’Babrc or *portable® FORTRAN oF PASCAL where non-tandard Language

Srtensions, hence non-poresbility, do not apply

This is true of programs published in this journal – thoes of us forcun enough to have disks end & copy of disk MBASIC are inclined to forget that Nascom ROM BASIC is Less well endowed vith goodies (it’s one-third the size). The problem becomes most acute when gcaphics are involved – or when data I/O 18 required from particular ports vnich may have different addresyes according to the manufacturers vhime. This poine + well illustrated by the problems involved in documenting the port allocations used by 80BUS beards from various manufacturers – some of whom vere not very cooperative (the sage of which Occupied the Editor of 80-Bus News in 1983).

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 46 of 63