Skip to navigation

Elite on the BBC Micro

Loader: BRBR1 (Disc version)

Name: BRBR1 [View in context] Type: Subroutine Category: Loader Summary: Loader break handler: print a newline and the error message, and then hang the computer
This break handler is used during loading and during flight, and is resident in memory throughout the game's lifecycle. The docked code loads its own break handler and overrides this one until the flight code is run. The main difference between the two handlers is that this one display the error and then hangs, while the docked code displays the error and returns. This is because the docked code has to cope gracefully with errors from the disc access menu (such as "File not found"), which we obviously don't want to terminate the game.
.BRBR1 \ The following loop prints out the null-terminated \ message pointed to by (&FD &FE), which is the MOS \ error message pointer - so this prints the error \ message on the next line LDY #0 \ Set Y = 0 to act as a character counter LDA #13 \ Set A = 13 so the first character printed is a \ carriage return .BRBRLOOP JSR OSWRCH \ Print the character in A (which contains a carriage \ return on the first loop iteration), and then any \ characters we fetch from the error message INY \ Increment the loop counter LDA (&FD),Y \ Fetch the Y-th byte of the block pointed to by \ (&FD &FE), so that's the Y-th character of the message \ pointed to by the MOS error message pointer BNE BRBRLOOP \ If the fetched character is non-zero, loop back to the \ JSR OSWRCH above to print the it, and keep looping \ until we fetch a zero (which marks the end of the \ message) BEQ P% \ Hang the computer as something has gone wrong EQUB &64, &5F, &61 \ These bytes appear to be unused EQUB &74, &74, &72 EQUB &69, &62, &75 EQUB &74, &65, &73 EQUB &00, &C4, &24 EQUB &6A, &43, &67 EQUB &65, &74, &72 EQUB &64, &69, &73 EQUB &63, &00, &B6 EQUB &3C, &C6 COPYBLOCK TVT1, P%, TVT1code ORG TVT1code + P% - TVT1