Home » Personal collection » Acorn DFS disks » dfs_box03_disk13_bcpl_calc.scp » EXCLFXB

EXCLFXB

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn DFS disks » dfs_box03_disk13_bcpl_calc.scp
Filename: EXCLFXB
Read OK:
File size: 0352 bytes
Load address: FF2C3C
Exec address: 0007
File contents
SECTION "EXCLFXB"

// Floating/fixed point calculator - fixed point specific routines.
// The calculation procedures used are
// copyright Richards Computer Products Ltd. (C) 1983
// Written by C Jobson  19/04/83

// Contains DISPHDNG & DISPNUM.

GET "LIBHDR"
GET "FPHDR"
GET "EXCLHDR"


// DISPHDNG is called to display a heading at the cursor position and
// a list of the keys used on rows 18 and 19.

LET DISPHDNG() BE
$( WRITES("   BCPL  FIXED  POINT  CALCULATOR")
   CURSOR(2, 18)
   WRITES("0-9 .  + - ** /  RETURN  DELETE  exit")
   CURSOR(2, 19)
   WRITES("       ;   :      =              X")
$)


// DISPNUM is called to display a number.  ERR is the FPEXCEP error
// code.

AND DISPNUM(NUM, ERR) BE
$( WRITEFP(NUM, NUMWIDTH, 4)
   IF ERR=1 | ERR=3 THEN   // overflow or divide by 0
      FLASHNUM()
$)

00000000  53 45 43 54 49 4f 4e 20  22 45 58 43 4c 46 58 42  |SECTION "EXCLFXB|
00000010  22 0d 0a 0d 0a 2f 2f 20  46 6c 6f 61 74 69 6e 67  |"....// Floating|
00000020  2f 66 69 78 65 64 20 70  6f 69 6e 74 20 63 61 6c  |/fixed point cal|
00000030  63 75 6c 61 74 6f 72 20  2d 20 66 69 78 65 64 20  |culator - fixed |
00000040  70 6f 69 6e 74 20 73 70  65 63 69 66 69 63 20 72  |point specific r|
00000050  6f 75 74 69 6e 65 73 2e  0d 0a 2f 2f 20 54 68 65  |outines...// The|
00000060  20 63 61 6c 63 75 6c 61  74 69 6f 6e 20 70 72 6f  | calculation pro|
00000070  63 65 64 75 72 65 73 20  75 73 65 64 20 61 72 65  |cedures used are|
00000080  0d 0a 2f 2f 20 63 6f 70  79 72 69 67 68 74 20 52  |..// copyright R|
00000090  69 63 68 61 72 64 73 20  43 6f 6d 70 75 74 65 72  |ichards Computer|
000000a0  20 50 72 6f 64 75 63 74  73 20 4c 74 64 2e 20 28  | Products Ltd. (|
000000b0  43 29 20 31 39 38 33 0d  0a 2f 2f 20 57 72 69 74  |C) 1983..// Writ|
000000c0  74 65 6e 20 62 79 20 43  20 4a 6f 62 73 6f 6e 20  |ten by C Jobson |
000000d0  20 31 39 2f 30 34 2f 38  33 0d 0a 0d 0a 2f 2f 20  | 19/04/83....// |
000000e0  43 6f 6e 74 61 69 6e 73  20 44 49 53 50 48 44 4e  |Contains DISPHDN|
000000f0  47 20 26 20 44 49 53 50  4e 55 4d 2e 0d 0a 0d 0a  |G & DISPNUM.....|
00000100  47 45 54 20 22 4c 49 42  48 44 52 22 0d 0a 47 45  |GET "LIBHDR"..GE|
00000110  54 20 22 46 50 48 44 52  22 0d 0a 47 45 54 20 22  |T "FPHDR"..GET "|
00000120  45 58 43 4c 48 44 52 22  0d 0a 0d 0a 0d 0a 2f 2f  |EXCLHDR"......//|
00000130  20 44 49 53 50 48 44 4e  47 20 69 73 20 63 61 6c  | DISPHDNG is cal|
00000140  6c 65 64 20 74 6f 20 64  69 73 70 6c 61 79 20 61  |led to display a|
00000150  20 68 65 61 64 69 6e 67  20 61 74 20 74 68 65 20  | heading at the |
00000160  63 75 72 73 6f 72 20 70  6f 73 69 74 69 6f 6e 20  |cursor position |
00000170  61 6e 64 0d 0a 2f 2f 20  61 20 6c 69 73 74 20 6f  |and..// a list o|
00000180  66 20 74 68 65 20 6b 65  79 73 20 75 73 65 64 20  |f the keys used |
00000190  6f 6e 20 72 6f 77 73 20  31 38 20 61 6e 64 20 31  |on rows 18 and 1|
000001a0  39 2e 0d 0a 0d 0a 4c 45  54 20 44 49 53 50 48 44  |9.....LET DISPHD|
000001b0  4e 47 28 29 20 42 45 0d  0a 24 28 20 57 52 49 54  |NG() BE..$( WRIT|
000001c0  45 53 28 22 20 20 20 42  43 50 4c 20 20 46 49 58  |ES("   BCPL  FIX|
000001d0  45 44 20 20 50 4f 49 4e  54 20 20 43 41 4c 43 55  |ED  POINT  CALCU|
000001e0  4c 41 54 4f 52 22 29 0d  0a 20 20 20 43 55 52 53  |LATOR")..   CURS|
000001f0  4f 52 28 32 2c 20 31 38  29 0d 0a 20 20 20 57 52  |OR(2, 18)..   WR|
00000200  49 54 45 53 28 22 30 2d  39 20 2e 20 20 2b 20 2d  |ITES("0-9 .  + -|
00000210  20 2a 2a 20 2f 20 20 52  45 54 55 52 4e 20 20 44  | ** /  RETURN  D|
00000220  45 4c 45 54 45 20 20 65  78 69 74 22 29 0d 0a 20  |ELETE  exit").. |
00000230  20 20 43 55 52 53 4f 52  28 32 2c 20 31 39 29 0d  |  CURSOR(2, 19).|
00000240  0a 20 20 20 57 52 49 54  45 53 28 22 20 20 20 20  |.   WRITES("    |
00000250  20 20 20 3b 20 20 20 3a  20 20 20 20 20 20 3d 20  |   ;   :      = |
00000260  20 20 20 20 20 20 20 20  20 20 20 20 20 58 22 29  |             X")|
00000270  0d 0a 24 29 0d 0a 0d 0a  0d 0a 2f 2f 20 44 49 53  |..$)......// DIS|
00000280  50 4e 55 4d 20 69 73 20  63 61 6c 6c 65 64 20 74  |PNUM is called t|
00000290  6f 20 64 69 73 70 6c 61  79 20 61 20 6e 75 6d 62  |o display a numb|
000002a0  65 72 2e 20 20 45 52 52  20 69 73 20 74 68 65 20  |er.  ERR is the |
000002b0  46 50 45 58 43 45 50 20  65 72 72 6f 72 0d 0a 2f  |FPEXCEP error../|
000002c0  2f 20 63 6f 64 65 2e 0d  0a 0d 0a 41 4e 44 20 44  |/ code.....AND D|
000002d0  49 53 50 4e 55 4d 28 4e  55 4d 2c 20 45 52 52 29  |ISPNUM(NUM, ERR)|
000002e0  20 42 45 0d 0a 24 28 20  57 52 49 54 45 46 50 28  | BE..$( WRITEFP(|
000002f0  4e 55 4d 2c 20 4e 55 4d  57 49 44 54 48 2c 20 34  |NUM, NUMWIDTH, 4|
00000300  29 0d 0a 20 20 20 49 46  20 45 52 52 3d 31 20 7c  |)..   IF ERR=1 ||
00000310  20 45 52 52 3d 33 20 54  48 45 4e 20 20 20 2f 2f  | ERR=3 THEN   //|
00000320  20 6f 76 65 72 66 6c 6f  77 20 6f 72 20 64 69 76  | overflow or div|
00000330  69 64 65 20 62 79 20 30  0d 0a 20 20 20 20 20 20  |ide by 0..      |
00000340  46 4c 41 53 48 4e 55 4d  28 29 0d 0a 24 29 0d 0a  |FLASHNUM()..$)..|
00000350  0d 0a                                             |..|
00000352
EXCLFXB.m0
EXCLFXB.m1
EXCLFXB.m2
EXCLFXB.m4
EXCLFXB.m5