Skip to content

Commit cc60c8e

Browse files
committed
Random acts of pithy taglines!
1 parent 0bb6fe3 commit cc60c8e

File tree

1 file changed

+79
-28
lines changed

1 file changed

+79
-28
lines changed

src/GLABIOS.ASM

Lines changed: 79 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ VER_NAME EQU 'GLaBIOS'
138138
VER_NUM EQU '0.2.0' ; (max 6 chars)
139139
ENDIF
140140
IFNDEF VER_DATE
141-
VER_DATE EQU '11/15/22' ; must be MM/DD/YY format
141+
VER_DATE EQU '11/16/22' ; must be MM/DD/YY format
142142
ENDIF
143143
IFNDEF COPY_YEAR
144144
COPY_YEAR EQU '2022' ; can be set at build time
@@ -198,13 +198,14 @@ CGA_SNOW_REMOVE = 3 ; 0: Snow, Normal Flashing, Fastest
198198
;----------------------------------------------------------------------------;
199199
; Personality Traits
200200
;
201-
POST_GLADOS = 0 ; say "Starting GLaDOS..." on boot
202201
POST_CLS = 0 ; clear screen after POST
202+
POST_GLADOS = 0 ; say "Starting GLaDOS..." on boot
203+
POST_HD_PARMS = 1 ; show hard drive parameters on POST
203204
POST_SHOW_VER = 3 ; POST screen verbosity (0-3)
205+
POST_THEME = 1 ; color theme for POST screen (see below)
204206
POST_VIDEO_TYPE = 1 ; show the video adapter type on POST
205-
POST_HD_PARMS = 1 ; show hard drive parameters on POST
206207
POST_WARM_COLD = 1 ; show boot WARM or COLD
207-
POST_THEME = 1 ; color theme for POST screen (see below)
208+
RANDOM_TAGLINE = 1 ; randomize pithy tagline
208209
UNITS_IEC = 0 ; 0=period-correct "KB" or 1=modern IEC "KiB"
209210

210211
;----------------------------------------------------------------------------;
@@ -301,10 +302,10 @@ TURBO_TYPE = TURBO_STD ; always use Standard
301302
; Configuration for FE2010A
302303
;
303304
BASIC_ROM = 0 ; disable to free code space
304-
SW1_FLP = 01b ; SW1 5/6 Max # of floppy drives (0-1)
305305
FD_AUTO_DETECT = 1 ; auto-detect number of floppy drives
306306
FE_CPU_WS = 100b ; boot to 9.54 MHz, 4 RAM WS
307307
POST_TEST_PIT_1 = 0 ; this fails on FE2010A chipset
308+
SW1_FLP = 01b ; SW1 5/6 Max # of floppy drives (0-1)
308309
TURBO_TYPE = TURBO_REV ; always use reverse
309310
MICRO_8088 = 0 ; build for micro_8088 / NuXT
310311

@@ -380,6 +381,7 @@ BOOT_SPEED EQU BOOT_NORMAL
380381
POST_HD_PARMS = 0 ; disable HD size display
381382
POST_TEST_SEEK = 0 ; disable floppy seek
382383
POST_WARM_COLD = 0 ; disable WARM/COLD boot
384+
RANDOM_TAGLINE = 0 ; disable random tagline
383385
ENDIF
384386

385387
IF POST_HD_CHECK EQ 0
@@ -773,10 +775,10 @@ EQFLAGS RECORD LPT:2,X1:1,GAM:1,COM:3,DMA:1,FLP:2,VIDM:2,MBRAM:2=11b,FPU:1,IPL:1
773775
; | ; 4 = RP5C15
774776
; x | - TURBO : Turbo supported
775777
; x | - V20 : 1 if V20, 0 if 8088
776-
; xx| - TBD2
778+
; xx| - GRND ; random number for tagline
777779
; 84218421
778780
;----------------------------------------------------------------------------;
779-
GFLAGS RECORD GTBD1:1,RTCTY:3,TURBO:1,V20:1,GTBD2:2
781+
GFLAGS RECORD GTBD1:1,RTCTY:3,TURBO:1,V20:1,GRND:2
780782

781783
;----------------------------------------------------------------------------;
782784
; POST status flags are stored in BP
@@ -1989,22 +1991,19 @@ POWER_ON ENDP
19891991
ORG 0E000H
19901992
BIOS_TOP PROC NEAR
19911993

1992-
VER_BANNER DB LF
1994+
TOP_BANNER DB LF
19931995
DB VER_NAME, ' [', HEART, '] '
1994-
IF POST_SHOW_VER GT 2
1995-
DB "The hero we need but don't deserve"
1996-
DB CR, LF
1996+
IF RANDOM_TAGLINE EQ 1
1997+
DB 0 ; null terminate BANNER string
19971998
ENDIF
1998-
1999-
COPYRIGHT DB '(C)'
2000-
IF POST_SHOW_VER GT 2
2001-
DB ' '
1999+
TAG0 DB "The hero we need but don't deserve"
2000+
IF RANDOM_TAGLINE EQ 1
2001+
DB 0 ; null terminate TAG0 string
20022002
ENDIF
2003-
DB COPY_YEAR, ' '
2003+
COPYRIGHT DB CR, LF
2004+
DB '(C) ', COPY_YEAR, ' '
20042005
DB '640KB Released under GPLv3'
2005-
IF POST_SHOW_VER GT 1
20062006
DB LF
2007-
ENDIF
20082007
DB 0
20092008

20102009
BIOS_TOP ENDP
@@ -2067,7 +2066,6 @@ CPU_REG_TEST:
20672066
MOV BL, BEEP_SL <2,1> ; on Failure: 2 short and 1 long beep
20682067
JNZ HALT_ERROR
20692068
XOR AX, AX ; otherwise repeat with AX = 0
2070-
JNZ HALT_ERROR ; if ZF was not set, it's not good
20712069
TEST DX, DX ; if zero it was second pass
20722070
JNZ CPU_REG_TEST ; Loop again to zero all registers
20732071
CPU_REG_PASS:
@@ -2126,6 +2124,18 @@ INIT_VIDEO:
21262124
MOV BP, MASK WARM ; clear and set POST warm boot flag
21272125
POST_FLAG_DONE:
21282126

2127+
IF RANDOM_TAGLINE EQ 1
2128+
;----------------------------------------------------------------------------;
2129+
; Read PIT for seed of random pithy tagline
2130+
;----------------------------------------------------------------------------;
2131+
MOV AL, PIT_CW <0, 0> ; Counter 0, Latch (00b)
2132+
OUT PIT_CTRL, AL ; write command to CTC
2133+
IN AL, PIT_CH0 ; read low byte of Counter 0 latch
2134+
SHR AL, 1 ; low bit is always 0
2135+
AND AL, MASK GRND ; use only last two bits
2136+
OR BP, AX ; save to low bits of BP
2137+
ENDIF
2138+
21292139
;----------------------------------------------------------------------------;
21302140
; Setup SS = CS
21312141
;----------------------------------------------------------------------------;
@@ -2217,6 +2227,8 @@ INIT_DMA1:
22172227
; 010 - M: Mode 2, Rate Gen
22182228
; 0 - BCD: 0
22192229
;
2230+
; Output: Success SI and DI = 0, Failure 3 short, 2 long beeps
2231+
;----------------------------------------------------------------------------;
22202232
MOV AL, PIT_CW <1, 11B, 2> ; Control Word: Counter 1
22212233
; Format: R/W low/high byte: 11b
22222234
; Mode: 2 Rate Gen, BCD: 0
@@ -2227,18 +2239,19 @@ INIT_DMA1:
22272239
MOV DI, NOT 0FFH SHL 3 ; look at bits 10-3 for 0 check
22282240
OUT DX, AL ; set high byte (any value)
22292241
INIT_PIT1_TEST:
2230-
CMP SI, 0FFFFH ; have all bits flipped to 1?
2231-
JNZ INIT_PIT1_TEST_READ
22322242
TEST DI, DI ; have all bits flipped to 0?
2233-
JZ INIT_PIT1_TEST_DONE
2243+
JNZ INIT_PIT1_TEST_READ ; if not, keep reading PIT
2244+
INC SI ; have all bits flipped to 1?
2245+
JZ INIT_PIT1_TEST_DONE ; if so, success
2246+
DEC SI ; if not, undo INC and keep reading PIT
22342247
INIT_PIT1_TEST_READ:
22352248
MOV AL, PIT_CW <1,0> ; latch Counter 1 command
22362249
OUT PIT_CTRL, AL ; write command to CTC
22372250
IN AL, DX ; read timer LSB
2238-
XCHG AH, AL ; save LSB
2251+
MOV AH, AL ; save LSB
22392252
IN AL, DX ; read timer MSB
2240-
AND DI, AX ; clear all lines received as 0
2241-
OR SI, AX ; set all lines received as 1
2253+
AND DI, AX ; clear all lines read as 0
2254+
OR SI, AX ; set all lines read as 1
22422255
LOOP INIT_PIT1_TEST ; loop until timeout
22432256
MOV BL, BEEP_SL <3,2> ; beep pattern (3 short, 2 long)
22442257
HALT_ERROR:
@@ -2570,7 +2583,7 @@ BIOS_INT_VECTORS_LOOP:
25702583
; Check for valid BASIC ROMs and set INT 18H vector if detected
25712584
;----------------------------------------------------------------------------;
25722585
; - Scan 4 x 8K ROMs starting at seg 0F600h.
2573-
; - BASIC dectected if for alls ROMs, all of the folowing are true:
2586+
; - BASIC dectected if for all ROMs, all of the folowing are true:
25742587
; - first two bytes not option ROM (0AAFFh)
25752588
; - first two bytes not the same as the previous ROM (this checks to
25762589
; make sure are not all 0000 or FFFF)
@@ -2849,7 +2862,11 @@ RESET_VIDEO_DONE:
28492862
; Hello Computer ("just use the keyboard")
28502863
;----------------------------------------------------------------------------;
28512864
HELLO_WORLD:
2852-
PRINTLN_SZ VER_BANNER ; display banner
2865+
IF RANDOM_TAGLINE EQ 1
2866+
CALL HELLO_RAND_TAGLINE ; display banner and random tagline
2867+
ELSE
2868+
PRINTLN_SZ TOP_BANNER ; display banner and fixed tagline
2869+
ENDIF
28532870

28542871
;----------------------------------------------------------------------------;
28552872
; Save the initial cursor mode to BDA for hot key and POST display
@@ -3329,7 +3346,6 @@ POST_KB_RESET ENDP
33293346
;----------------------------------------------------------------------------;
33303347
; Begin Hardware POST Test Results
33313348
;----------------------------------------------------------------------------;
3332-
33333349
CALL HIDE_CURSOR ; cursor movement is distracting
33343350

33353351
IF POST_WARM_COLD EQ 1
@@ -9947,6 +9963,41 @@ PORT_TEST_DONE:
99479963
RET
99489964
PORT_TEST ENDP
99499965

9966+
IF RANDOM_TAGLINE EQ 1
9967+
;----------------------------------------------------------------------------;
9968+
; Display BIOS name and random tagline
9969+
;----------------------------------------------------------------------------;
9970+
; String is chosen from low two bits of BP
9971+
; Clobbers: AX
9972+
;----------------------------------------------------------------------------;
9973+
HELLO_RAND_TAGLINE PROC
9974+
PRINT_SZ TOP_BANNER ; display main banner
9975+
MOV AX, BP ; get random bits from BP
9976+
POST_FLAG_CLR GRND ; clear random bits from BP
9977+
AND AX, MASK GRND ; mask only low 2 bits
9978+
XCHG AX, SI ; SI = string offset table
9979+
SHL SI, 1 ; word align
9980+
MOV SI, CS:TAGS[SI] ; SI = chosen tagline offset
9981+
PRINT_SZ SI ; display tagline
9982+
PRINTLN_SZ COPYRIGHT ; display copyright message
9983+
RET
9984+
9985+
;----------------------------------------------------------------------------;
9986+
; Three additional random taglines
9987+
;
9988+
TAG1 DB 'An Energy Star Foe', 0
9989+
TAG2 DB 'Now 97% asbestos-free', 0
9990+
TAG3 DB 'Ought to be enough for anybody', 0
9991+
; DB 'When life gives you lemonade', 0 ; runner up
9992+
9993+
;----------------------------------------------------------------------------;
9994+
; Offset table for taglines
9995+
;
9996+
TAGS DW OFFSET TAG0, OFFSET TAG1, OFFSET TAG2, OFFSET TAG3
9997+
9998+
HELLO_RAND_TAGLINE ENDP
9999+
ENDIF
10000+
995010001
;
995110002
; 4 BYTES HERE
995210003
;

0 commit comments

Comments
 (0)