CODINGLISTINGS ★ DON'T GET HEATED OVER CELSIUS-GET CONVERTED ★

Degrees (Computing with the Amstrad)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 ★ 

THE warmer weather is with us and temperatures are rising. The trouble is that nowadays they're given in Celsius degrees — Centigrade to those who prefer the old pre-EEC style — not the more familiar Fahrenheit. This program shows how to get your Amstrad to convert between the two. And although it refers to Centigrade it works just fine in Celsius.

  • 10 Just a label which the Amstrad ignores.
  • 20 Calls the subroutine at line 280, clearing the screen.
  • 30 Sets up a text window, numbered 1. in the middle of the Mode 1 screen. This window is used for the program's prompts to the user.
  • 40 Another window, number 2. is established. It shows the user's inputs to the program.
  • 50-80 These lines ask the user which conversion is wanted.
  • 50 The message is sent to window number 1, showing which number to pick for the Celsius to Fahrenheit conversion.
  • 60 Two blank lines are printed in the prompt window.
  • 70 The second message appears.
  • 80 The user now enters the number of his choice, 1 or 2 which is stored in choice. It also appears on screen, in window number 2. Notice that the input isn't mugtrapped, the program happily accepting 23 or -7. Can you remedy this?
  • 90 Again, the window cleaning subroutine is called.
  • 100 Now that the micro knows which conversion it is to perform the prompt window is used to ask for the number of degrees.
  • 110 The reply is stored in degree.
  • 120 More window cleaning.
  • 130 The program uses the value of choice to choose between the two subroutines that handle the conversion.
  • 140 Resets the foreground colour in window 1 to yellow. This tidies up after the subroutines.
  • 150 Stops the program crashing into the subroutine definitions. Try leaving it out and see what happens.
  • 160-210 Form the subroutine that converts from Celsius to Fahrenheit.
  • 160 Names the subroutine, giving V-. an idea of its purpose.
  • 170 The conversion calculation is performed upon degrees and the result stored in converted.
  • 180 If the temperature is below freezing then appropriately blue text is selected for the final message in window 1.
  • 190 If the temperature is boiling point or above red. text is chosen.
  • 200 Displays the result of the conversion, rounded to two decimal places.
  • 210 Sends the program back to the line following the one that called the subroutine.
  • 220-270 Handle the Fahrenheit to Celsius conversions. Again the final message is given an appropriate colour and the result is rounded to 2 decimal places.
  • 280-300 Clears all three text windows in use. At times this is overkill, but it's easier to have all three in one subroutine than lots of CLSs dotted around the program.

CWTA

★ PUBLISHER: Computing with the Amstrad
★ YEAR: 1986
★ CONFIG: ???
★ LiCENCE: LISTING
★ COLLECTION: COMPUTING WITH THE AMSTRAD 1986
★ AUTHOR: Trevor Roberts
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» Degrees    (Computing  with  the  Amstrad)    ENGLISHDATE: 2020-07-23
DL: 182
TYPE: ZIP
SiZE: 4Ko
NOTE: 40 Cyls
.HFE: Χ

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

Lien(s):
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/c
Page créée en 291 millisecondes et consultée 745 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.