Code: Select all
CLS 'Clears The Screen.'
OUT 378/IRQ7, count
d = 2000 'sets a variable to represent 2000 cycles'
var$ = INKEY$ 'sets a variable to accept keyboard input'
LOCATE 4, 1: PRINT "This is a Hexadecimal, Decimal, Binary decoder."
LOCATE 5, 1: PRINT "Press any key in hexadecimal form (0-9 and A-F) The program will decode into"
LOCATE 6, 1: PRINT "Binary and light up the circuit board!"
OUT 378/IRQ7, count
DO 'starts the program'
var$ = INKEY$ 'sets a variable to accept keyboard input'
FOR t = 1 TO d: NEXT t
IF var$ = "0" THEN GOSUB PRINT0 'if a key is pressed, each key will go different subroutines'
IF var$ = "1" THEN GOSUB PRINT1
IF var$ = "2" THEN GOSUB PRINT2
IF var$ = "3" THEN GOSUB PRINT3
IF var$ = "4" THEN GOSUB PRINT4
IF var$ = "5" THEN GOSUB PRINT5
IF var$ = "6" THEN GOSUB PRINT6
IF var$ = "7" THEN GOSUB PRINT7
IF var$ = "8" THEN GOSUB PRINT8
IF var$ = "9" THEN GOSUB PRINT9
IF var$ = "a" THEN GOSUB PRINTA
IF var$ = "b" THEN GOSUB PRINTB
IF var$ = "c" THEN GOSUB PRINTC
IF var$ = "d" THEN GOSUB PRINTD
IF var$ = "e" THEN GOSUB PRINTE
IF var$ = "f" THEN GOSUB PRINTF
IF var$ = "g" THEN GOSUB PRINTG
LOOP 'repeats the process'
PRINT0: 'start of a subroutine'
CLS 'clears screen'
PRINT "______________________" 'will appear on-screen'
PRINT "| HEX DECIMAL BINARY |" 'will appear on-screen'
PRINT "| 0 00 0 |" 'will appear on screen'
OUT 378/IRQ7, 0 'outputs data to the DB-25, to light up the LEDs'
RETURN 'awaits input'
PRINT1: 'start of a subroutine'
CLS 'clears screen'
PRINT "______________________" 'will appear on-screen'
PRINT "| HEX DECIMAL BINARY |" 'will appear on-screen'
PRINT "| 1 01 1 |" 'will appear on-screen'
OUT 378/IRQ7, 1 'outputs data to the DB-25, to light up the LEDs'
RETURN 'awaits input'
PRINT2:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 2 02 10 |"
OUT 378/IRQ7, 2
RETURN
PRINT3:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 3 03 11 |"
OUT 378/IRQ7, 3
RETURN
PRINT4:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 4 04 100 |"
OUT 378/IRQ7, 4
RETURN
PRINT5:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 5 05 101 |"
OUT 378/IRQ7, 5
RETURN
PRINT6:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 6 06 110 |"
OUT 378/IRQ7, 6
RETURN
PRINT7:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 7 07 111 |"
OUT 378/IRQ7, 7
RETURN
PRINT8:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 8 08 1000 |"
OUT 378/IRQ7, 8
RETURN
PRINT9:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| 9 09 1001 |"
OUT 378/IRQ7, 9
RETURN
PRINTA:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| A 10 1010 |"
OUT 378/IRQ7, 10
RETURN
PRINTB:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| B 11 1011 |"
OUT 378/IRQ7, 11
RETURN
PRINTC:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| C 12 1100 |"
OUT 378/IRQ7, 12
RETURN
PRINTD:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| D 13 1101 |"
OUT 378/IRQ7, 13
RETURN
PRINTE:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| E 14 1110 |"
OUT 378/IRQ7, 14
RETURN
PRINTF:
CLS
PRINT "______________________"
PRINT "| HEX DECIMAL BINARY |"
PRINT "| F 15 1111 |"
OUT 378/IRQ7, 15
RETURN
PRINTG:
CLS
PRINT "You may only select valid characters(0-9 and A-F)." 'This will appear when an'
RETURN 'invalid key is pressed'
CLS