The Qualifier

This file is part of Byte Power Spring 1987. Download the collection to get this file.
Developer(s): Kristian Boisvert
Date: 1987
Type: Program
Platform(s): TS 2068
Tags: Home

This program calculates the maximum home purchase price a buyer can afford based on their down payment, maximum monthly payment, interest rate, and loan term. It uses the standard mortgage present-value formula: the loan amount is derived from the monthly payment divided by the monthly interest factor, rounded down to the nearest $100. The result is displayed alongside a decorative double-rectangle border drawn with PLOT and DRAW commands. Input validation is applied to all fields, rejecting negative values, out-of-range interest rates, and loan terms outside 1–30 years.


Program Structure

The program is organized into three logical phases:

  1. Initialization / title displayGO SUB 2000 at line 20 draws a decorative border and title before input begins.
  2. Input collection — Lines 30–98 gather four values: down payment, maximum monthly payment, annual interest rate, and loan term in years, each with inline validation loops.
  3. Calculation and output — Lines 100–240 compute the affordable home price and display a formatted summary; STOP at line 1999 halts execution.

The subroutine at lines 2000–2010 draws two concentric rectangles using PLOT/DRAW and prints a centred title, acting as a reusable banner called both at startup and after the CLS at line 150.

Mortgage Calculation

The core financial logic implements the present-value annuity formula for a fixed-rate mortgage:

  • f1 = 1 - (1 + rate/12)^-(12*ye) — the annuity numerator.
  • f2 = f1 / (rate/12) — the full present-value factor.
  • lamount = month * f2 — maximum loan principal, then truncated to the nearest $100 via INT (lamount/100)*100.
  • price = lamount + down — total affordable purchase price, rounded to the nearest dollar using INT ((price+.5)*100/100).

Rounding lamount down (floor) to $100 keeps the monthly payment safely within budget; rounding price to the nearest dollar is cosmetic.

Input Validation

VariableCondition to retryLine
downdown < 040
monthmonth < 070
raterate < .001 OR rate > 10090
yeINT ye < 1 OR INT ye > 3096–97

Note that a down payment or monthly payment of exactly zero is accepted (only negative values are rejected), allowing the program to handle edge cases such as zero-down or interest-only scenarios.

Notable BASIC Idioms

  • Boolean string concatenation — Line 220 uses ("s" AND ye>1) to pluralise “year” without a conditional branch, a common Sinclair BASIC idiom where a true condition evaluates to 1 and false to 0 (empty string).
  • INVERSE 1 highlight — Line 155 prints the calculated price in inverse video for visual emphasis before reverting implicitly.
  • Echoing input — After each INPUT, the accepted value is printed at a fixed screen position (lines 41, 71, 91, 98) to provide a clean summary layout rather than relying on the INPUT prompt remnants.

Appears On

Tape-based magazine.

Related Articles

This program will let you analyse the range of homes you can afford depending on the data given to the...

Image Gallery

Source Code

    0 
    1 REM QUALIFIER (HOMES)
    2 REM RESET 1987 BYTE POWER
    3 REM BY K. BOISVERT
    4 
   20 GO SUB 2000
   30 PRINT AT 5,0;"Maximum down payment:";
   40 INPUT "Max:";down: IF down<0 THEN GO TO 40
   41 PRINT "$";down
   60 PRINT AT 7,0;"Max. monthly payment:";
   70 INPUT "Max:";month: IF month<0 THEN GO TO 70
   71 PRINT "$";month
   80 PRINT AT 9,0;"Interest rate:";
   90 INPUT "Interest:";rate: IF rate<.001 OR rate>100 THEN GO TO 90
   91 PRINT rate;"%"
   95 LET rate=rate/100: PRINT AT 11,0;"In how many years (30 max):";
   96 INPUT "Year(s):";ye
   97 LET ye=INT ye: IF ye<1 OR ye>30 THEN GO TO 96
   98 PRINT ye
  100 LET f1=(1-((1+(rate/12))^-(12*ye)))
  110 LET f2=f1/(rate/12)
  120 LET lamount=month*f2: LET lamount=INT (lamount/100)*100
  140 LET price=lamount+down: LET price=INT ((price+.5)*100/100)
  150 CLS : GO SUB 2000: PRINT AT 5,0;"You can afford homes that are   selling for:";
  155 PRINT INVERSE 1;"$";price
  160 PRINT '"Mortgage of $";lamount
  190 PRINT '"Down payment of $";down
  200 PRINT '"Monthly payments of $";month
  220 PRINT '"For a period of ";ye;" year"+("s" AND ye>1)
  230 PRINT '"At an interest of ";rate*100;"%"
  240 PRINT AT 20,0;"'RUN' TO GO BACK TO PROGRAM"
 1999 STOP 
 2000 PLOT 65,156: DRAW 116,0: DRAW 0,14: DRAW -116,0: DRAW 0,-14
 2001 PLOT 68,158: DRAW 110,0: DRAW 0,10: DRAW -110,0: DRAW 0,-10: PRINT AT 1,9;"The Qualifier"
 2010 RETURN 
 9999 SAVE "QUALIFIER" LINE 1

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.