CODINGLISTINGS ★ CAD FOR BEGINNERS PART 2 (AMSTRAD COMPUTER USER) ★

CAD for beginners part 2 (Amstrad Computer User)Coding Listings
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

In this issue I have two graphics programs for you. The first is a subroutine that will perform high resolution screen dumps to the AMSTRAD DMP-1 dot matrix printer. The second program plots 3D surfaces like the one shown in Figure 1.

The screen dump listing should be typed in and saved on cassette using the name DUMPER. You can then incorporate it into your programs by using the command MERGE "DUMPER" taking care, of course, to leave the line numbers 25000 to 25250 unused in your original program.

The subroutine has two major parts - the subroutine at 25180 - 25250 reads the screen using the BASIC command TEST and assembles 1 byte at a time for output to the printer. Lines 25030 to 25170 contain the controlling loops and output commands.

The program lines which are of special interest are:

  • 25030 Sets up the array containing 1 printer line of bit patterns.
  • 25110 Sets up the printer to receive graphic data in the form of a BIT IMAGE. ESC KCHR$(27); CHRS(75) tells the printer to enter graphics mode. CHR$(2); CHR$(64) tells the printer to expect 320 bytes of bit image information.
  • 25150 Returns the line spacing on the printer to 6 lines per inch (in graphics mode the printer prints 9 lines per inch).
  • 25160 The ERASE command releases the memory occupied by the array i%. Using this command also prevents an Array already dimensioned error when you use the screendump on a subsequent occasion.
  • 25180 The values taken by p1/i to p7% to correspond, in a BINARY pattern, to the
  • 25240 vertical arrangement of the needles in the printers print head.

BINARY VALUE
WHEN SET
pin 11
pin 22
pin 34
pin 48
pin 516
pin 632
pin 764
maximum value
readable by printer
127

You should note the use of INTEGER variables wherever possible throughout the routine so as to maximise program speed.

The second program allows you to plot 3D surfaces with complete control over the major components which affect the appearance of the pattern. These are:

  • HEIGHT of picture expressed in pixels
  • WIDTH of picture expressed in pixels
  • DETAIL with which the picture is drawn.
    Note that LOWER values result in more detail, and longer plotting time.
  • DISTORTION which increases exponentially.
    Using the program exactly as listed here the most interesting results are obtained using values between 1 and 3 (you can use decimal values e.g. 2.8)
  • PERSPECTIVE negative values produce a view as if from above and positive values one from below. Once again the progressive effect of PERSPECTIVE alters exponentially.

Because you can vary the factors which make up the picture you can experiment with different combinations using low values for height and width and a high factor for detail. Doing so will minimise the time taken to draw the pattern. Then when you have found an interesting combination a larger, more detailed picture can be drawn. Try starting with HEIGHT 250, WIDTH 500, DETAIL 3, DISTORTION 2.5 PERSPECTIVE -5.

The program listing is fairly well self documented but some lines worth commenting on are -

  • 2160 Note the use of the variable wide - WIDTH is a BASIC reserved word.
  • 2500 here you can see why the DETAIL becomes less as the DETAIL factor is higher.
  • 2520 this line is the heart of the program. You can experiment with different equations here and observe the results. (I will give you some interesting ones in the next issue.)
  • 2690 Note the use of INKEY (not INKEYS) to to see which key has been pressed. Line 2700
  • 2710 provides the branch to DUMPER if you MERGE the two programs.

★ PUBLISHER: Amstrad Computer User
★ YEAR: 1984
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: FREEWARE
★ COLLECTION: AMSTRAD COMPUTER USER 1984
★ AUTHOR: David Robinson / Saxon Computing
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» CAD  for  beginners  part  2    (Amstrad  Computer  User)    ENGLISH    LISTINGDATE: 2021-08-15
DL: 112
TYPE: PDF
SiZE: 186Ko
NOTE: 3 pages/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » 3D Maze (Amstrad Games Book) / Laberinto en 3D (El Libro Gigante de los Juegos para AMSTRAD)
» Coding Src's » CAD for beginners part 1 (Amstrad Computer User)
» Coding Src's » Wolf 3D sourcepack (Richard Wilson)
» Coding Src's » 3D Demo (Gamemag)
» Coding Src's » 3-D-Würfel (CPC Magazin)
» Coding » Sdcc - 18 - 3D - Fil de Fer
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop
Page créée en 118 millisecondes et consultée 601 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.