-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathPCBIOSV2.ASM
5942 lines (5462 loc) · 169 KB
/
PCBIOSV2.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$TITLE(ROM BIOS FOR IBM PERSONAL COMPUTER)
;------------------------
; EQUATES
;------------------------
PORT_A EQU 60H ;8255 PORT A ADDR
PORT_B EQU 61H ;8255 PORT B ADDR
PORT_C EQU 62H ;8255 PORT C ADDR
CMD_PORT EQU 63H
INTA00 EQU 20H ;8259 PORT
INTA01 EQU 21H ;8259 PORT
EOI EQU 20H
TIMER EQU 40H
TIM_CTL EQU 43H ;8253 TIMER CONTROL PORT ADDR
TIMER0 EQU 40H ;8253 TIMER/CNTER 0 PORT ADDR
TMINT EQU 01 ;TIMER 0 INTR RECVD MASK
DMA08 EQU 08 ;DMA STATUS REG PORT ADDR
DMA EQU 00 ;DMA CHANNEL 0 ADDRESS REG PORT ADDR
MAX_PERIOD EQU 540H
MIN_PERIOD EQU 410H
KBD_IN EQU 60H ;KEYBOARD DATA IN ADDR PORT
KBDINT EQU 02 ;KEYBOARD INTR MASK
KB_DATA EQU 60H ; KEYBOARD SCAN CODE PORT
KB_CTL EQU 61H ; CONTROL BITS FOR KEYBOARD SENSE DATA
;----------------------------------
; 8088 INTERRUPT LOCATIONS
;----------------------------------
ABS0 SEGMENT AT 0
STG_LOC0 LABEL BYTE
ORG 2*4
NMI_PTR LABEL WORD
ORG 5*4
INT5_PTR LABEL WORD
ORG 8*4
INT_ADDR LABEL WORD
INT_PTR LABEL DWORD
ORG 10H*4
VIDEO_INT LABEL WORD
ORG 1DH*4
PARM_PTR LABEL DWORD ; POINTER TO VIDEO PARMS
ORG 01EH*4 ; INTERRUPT 1EH
DISK_POINTER LABEL DWORD
ORG 01FH*4 ; LOCATION OF POINTER
EXT_PTR LABEL DWORD ; POINTER TO EXTENSION
ORG 7C00H
BOOT_LOCN LABEL FAR
ABS0 ENDS
;----------------------
; STACK -- USED DURING INITIALIZATION ONLY
;----------------------
STACK SEGMENT AT 30H
DW 128 DUP(?)
TOS LABEL WORD
STACK ENDS
;--------------------------------------------
; ROM BIOS DATA AREAS
;--------------------------------------------
DATA SEGMENT AT 40H
RS232_BASE DW 4 DUP(?) ; ADDRESSES OF RS232 ADAPTERS
PRINTER_BASE DW 4 DUP(?) ; ADDRESSES OF PRINTERS
EQUIP_FLAG DW ? ; INSTALLED HARDWARE
MFG_TST DB ? ; INITIALIZATION FLAG
MEMORY_SIZE DW ? ; MEMORY SIZE IN K BYTES
IO_RAM_SIZE DW ? ; MEMORY IN I/O CHANNEL
;--------------------------------------------
; KEYBOARD DATA AREAS
;--------------------------------------------
KB_FLAG DB ?
;------ SHIFT FLAG EQUATES WITHIN KB_FLAG
INS_STATE EQU 80H ; INSERT STATE IS ACTIVE
CAPS_STATE EQU 40H ; CAPS LOCK STATE HAS BEEN TOGGLED
NUM_STATE EQU 20H ; NUM LOCK STATE HAS BEEN TOGGLED
SCROLL_STATE EQU 10H ; SCROLL LOCK STATE HAS BEEN TOGGLED
ALT_SHIFT EQU 08H ; ALTERNATE SHIFT KEY DEPRESSED
CTL_SHIFT EQU 04H ; CONTROL SHIFT KEY DEPRESSED
LEFT_SHIFT EQU 02H ; LEFT SHIFT KEY DEPRESSED
RIGHT_SHIFT EQU 01H ; RIGHT SHIFT KEY DEPRESSED
KB_FLAG_1 DB ? ; SECOND BYTE OF KEYBOARD STATUS
INS_SHIFT EQU 80H ; INSERT KEY IS DEPRESSED
CAPS_SHIFT EQU 40H ; CAPS LOCK KEY IS DEPRESSED
NUM_SHIFT EQU 20H ; NUM LOCK KEY IS DEPRESSED
SCROLL_SHIFT EQU 10H ; SCROLL LOCK KEY IS DEPRESSED
HOLD_STATE EQU 08H ; SUSPEND KEY HAS BEEN TOGGLED
ALT_INPUT DB ? ; STORAGE FOR ALTERNATE KEYPAD ENTRY
BUFFER_HEAD DW ? ; POINTER TO HEAD OF KEYBOARD BUFFER
BUFFER_TAIL DW ? ; POINTER TO TAIL OF KEYBOARD BUFFER
KB_BUFFER DW 16 DUP(?) ; ROOM FOR 15 ENTRIES
KB_BUFFER_END LABEL WORD
;------ HEAD = TAIL INDICATES THAT THE BUFFER IS EMPTY
NUM_KEY EQU 69 ; SCAN CODE FOR NUMBER LOCK
SCROLL_KEY EQU 70 ; SCROLL LOCK KEY
ALT_KEY EQU 56 ; ALTERNATE SHIFT KEY SCAN CODE
CTL_KEY EQU 29 ; SCAN CODE FOR CONTROL KEY
CAPS_KEY EQU 58 ; SCAN CODE FOR SHIFT LOCK
LEFT_KEY EQU 42 ; SCAN CODE FOR LEFT SHIFT
RIGHT_KEY EQU 54 ; SCAN CODE FOR RIGHT SHIFT
INS_KEY EQU 82 ; SCAN CODE FOR INSERT KEY
DEL_KEY EQU 83 ; SCAN CODE FOR DELETE KEY
;--------------------------------------------
; DISKETTE DATA AREAS
;--------------------------------------------
SEEK_STATUS DB ? ; DRIVE RECALIBRATION STATUS
; BIT 3-0 = DRIVE 3-0 NEEDS RECAL BEFORE
; NEXT SEEK IF BIT IS = 0
INT_FLAG EQU 080H ; INTERRUPT OCCURRENCE FLAG
MOTOR_STATUS DB ? ; MOTOR STATUS
; BIT 3-0 = DRIVE 3-0 IS CURRENTLY RUNNING
; BIT 7 = CURRENT OPERATION IS A WRITE, REQUIRES DELAY
MOTOR_COUNT DB ? ;TIME OUT COUNTER FOR DRIVE TURN OFF
MOTOR_WAIT EQU 37 ;TWO SECONDS OF COUNTS FOR MOTOR TURN OFF
;
DISKETTE_STATUS DB ? ; SINGLE BYTE OF RETURN CODE INFO FOR STATUS
TIME_OUT EQU 80H ; ATTACHMENT FAILED TO RESPOND
BAD_SEEK EQU 40H ; SEEK OPERATION FAILED
BAD_NEC EQU 20H ; NEC CONTROLLER HAS FAILED
BAD_CRC EQU 10H ; BAD CRC ON DISKETTE READ
DMA_BOUNDARY EQU 09H ; ATTEMPT TO DMA ACROSS 64K BOUNDARY
BAD_DMA EQU 08H ; DMA OVERRUN ON OPERATION
RECORD_NOT_FND EQU 04H ; REQUESTED SECTOR NOT FOUND
WRITE_PROTECT EQU 03H ; WRITE ATTEMPTED ON WRITE PROT DISK
BAD_ADDR_MARK EQU 02H ; ADDRESS MARK NOT FOUND
BAD_CMD EQU 01H ; BAD COMMAND PASSED TO DISKETTE I/O
NEC_STATUS DB 7 DUP(?) ; STATUS BYTES FROM NEC
;--------------------------------------------
; VIDEO DISPLAY DATA AREA
;--------------------------------------------
CRT_MODE DB ? ; CURRENT CRT MODE
CRT_COLS DW ? ; NUMBER OF COLUMNS ON SCREEN
CRT_LEN DW ? ; LENGTH OF REGEN IN BYTES
CRT_START DW ? ; STARTING ADDRESS IN REGEN BUFFER
CURSOR_POSN DW 8 DUP(?) ; CURSOR FOR EACH OF UP TO 8 PAGES
CURSOR_MODE DW ? ; CURRENT CURSOR MODE SETTING
ACTIVE_PAGE DB ? ; CURRENT PAGE BEING DISPLAYED
ADDR_6845 DW ? ; BASE ADDRESS FOR ACTIVE DISPLAY CARD
CRT_MODE_SET DB ? ; CURRENT SETTING OF THE 3X8 REGISTER
CRT_PALLETTE DB ? ; CURRENT PALLETTE SETTING COLOR CARD
;--------------------------------------------
; CASSETTE DATA AREA
;--------------------------------------------
EDGE_CNT DW ? ;TIME COUNT AT DATA EDGE
CRC_REG DW ? ;CRC REGISTER
LAST_VAL DB ? ;LAST INPUT VALUE
;--------------------------------------------
; TIMER DATA AREA
;--------------------------------------------
TIMER_LOW DW ? ; LOW WORD OF TIMER COUNT
TIMER_HIGH DW ? ; HIGH WORD OF TIMER COUNT
TIMER_OFL DB ? ; TIMER HAS ROLLED OVER SINCE LAST READ
;COUNTS_SEC EQU 18
;COUNTS_MIN EQU 1092
;COUNTS_HOUR EQU 65543
;COUNTS_DAY EQU 1573040 = 1800B0H
;--------------------------------------------
; SYSTEM DATA AREA
;--------------------------------------------
BIOS_BREAK DB ? ; BIT 7 = 1 IF BREAK KEY HAS BEEN DEPRESSED
RESET_FLAG DW ? ; WORD = 1234H IF KEYBOARD RESET UNDERWAY
DATA ENDS
;--------------------------------------------
; EXTRA DATA AREA
;--------------------------------------------
XXDATA SEGMENT AT 50H
STATUS_BYTE DB ?
XXDATA ENDS
;--------------------------------------------
; VIDEO DISPLAY BUFFER
;--------------------------------------------
VIDEO_RAM SEGMENT AT 0B800H
REGEN LABEL BYTE
REGENW LABEL WORD
DB 16384 DUP(?)
VIDEO_RAM ENDS
;--------------------------------------------
; ROM RESIDENT CODE
;--------------------------------------------
CODE SEGMENT AT 0F000H
DB 57344 DUP(?) ; FILL LOWEST 56K
DB '5700671 COPR. IBM 1981' ; COPYRIGHT NOTICE
;--------------------------------------------
; INITIAL RELIABILITY TESTS -- PHASE 1
;--------------------------------------------
ASSUME CS:CODE,SS:CODE,ES:ABS0,DS:DATA
;--------------------------------------------
; DATA DEFINITIONS
;--------------------------------------------
C1 DW C11 ; RETURN ADDRESS
C2 DW C24 ; RETURN ADDRESS FOR DUMMY STACK
;--------------------------------------------
; THIS SUBROUTINE PERFORMS A READ/WRITE STORAGE TEST ON A 16K BLOCK
; OF STORAGE.
;ENTRY REQUIREMENTS:
; ES = ADDRESS OF STORAGE SEGMENT BEING TESTED
; DS = ADDRESS OF STORAGE SEGMENT BEING TESTED
; WHEN ENTERING AT STGTST_CNT, CX MUST BE LOADED WITH THE BYTE COUNT.
;EXIT PARAMETERS:
; ZERO FLAG = 0 IF STORAGE ERROR (DATA COMPARE OR PARITY CHECK. AL=0
; DENOTES A PARITY CHECK. ELSE AL=XOR'ED BIT PATTERN OF THE
; EXPECTED DATA PATTERN VS THE ACTUAL DATA READ.
; AX,BX,CX,DX,DI, AND SI ARE ALL DESTROYED.
;--------------------------------------------
STGTST PROC NEAR
MOV CX,04000H ;SETUP CNT TO TEST A 16K BLK
STGTST_CNT:
CLD ;SET DIR FLAG TO INCREMENT
MOV BX,CX ;SAVE BYTE CNT (4K FOR VIDEO OR 16K)
MOV AX,0FFFFH ;GET DATA PATTERN TO WRITE
MOV DX,0AA55H ;SETUP OTHER DATA PATTERNS TO USE
SUB DI,DI ;DI = OFFSET 0 RELATIVE TO ES REG
REP STOSB ;WRITE STORAGE LOCATIONS
C3: ; STG01
DEC DI ;POINT TO LAST BYTE JUST WRITTEN
STD ;SET DIR FLAG TO GO BACKWARDS
C4: MOV SI,DI
MOV CX,BX ;SETUP BYTE CNT
C5: LODSB ;READ CHAR FROM STORAGE
XOR AL,AH ;DATA READ AS EXPECTED?
JNE C7 ;NO - GO TO ERROR ROUTINE
IN AL,PORT_C ;DID A PARITY ERROR OCCUR?
AND AL,0C0H
MOV AL,0 ;AL=0 DATA COMPARE OK
JNZ C7
CMP AH,0 ;READING ZERO PATTERN?
JE C6 ;CONTINUE READING TILL END
MOV AL,DL ;GET NEXT DATA PATTERN TO WRITE
STOSB ;WRITE IN BYTE LOC WE JUST READ
C6: ; WRITE_NO_MORE
LOOP C5 ;CONTINUE TILL 16K/4K BLOCK TESTED
CMP AH,0 ;ZERO PATTERN WRITTEN TO STG
JE C7 ;YES - RETURN TO CALLER
MOV AH,AL ;SETUP TO NEW VALUE TO COMPARE
XCHG DH,DL ;MOVE ZERO DATA PATTERN TO DL
CLD ;SET DIR FLAG TO GO FORWARD
INC DI ;SET POINTER TO BEG LOCATION
JZ C4 ;READ/WRITE FORWARD IN STG
DEC DI
MOV DX,1 ;SETUP 01 AND 00 PATTERNS
JMP SHORT C3 ;READ/WRITE BACKWARD IN STG
C7:
RET
STGTST ENDP
;--------------------------------------------
;TEST.01
; 8088 PROCESSOR TEST
;DESCRIPTION
; VERIFY 8088 FLAGS, REGISTERS AND CONDITIONAL JUMPS
;--------------------------------------------
RESET LABEL NEAR
START: CLI ;DISABLE INTERRUPTS
MOV AH,0D5H ;SET SF, CF, ZF, AND AF FLAGS ON
SAHF
JNC ERR01 ;GO TO ERR ROUTINE IF CF NOT SET
JNZ ERR01 ;GO TO ERR ROUTINE IF ZF NOT SET
JNP ERR01 ;GO TO ERR ROUTINE IF PF NOT SET
JNS ERR01 ;GO TO ERR ROUTINE IF SF NOT SET
LAHF ;LOAD FLAG IMAGE TO AH
MOV CL,5 ;LOAD CNT REG WITH SHIFT CNT
SHR AH,CL ;SHIFT AF INTO CARRY BIT POS
JNC ERR01 ;SO TO ERR ROUTINE IF AF NOT SET
MOV AL,40H ;SET THE OF FLAG ON
SHL AL,1 ;SETUP FOR TESTING
JNO ERR01 ;GO TO ERR ROUTINE IF OF NOT SET
XOR AH,AH ;SET AH = 0
SAHF ;CLEAR SF, CF, ZF, AND PF
JC ERR01 ;GO TO ERR ROUTINE IF CF ON
JZ ERR01 ;GO TO ERR ROUTINE IF ZF ON
JS ERR01 ;GO TO ERR ROUTINE IF SF ON
JP ERR01 ;GO TO ERR ROUTINE IF PF ON
LAHF ;LOAD FLAG IMAGE TO AH
MOV CL,5 ;LOAD CNT REG WITH SHIFT CNT
SHR AH,CL ;SHIFT AH INTO CARRY BIT POS
JC ERR01 ;GO TO ERR ROUTINE IF ON
SHL AH,1 ;CHECK THAT OF IS CLEAR
JO ERR01 ;GO TO ERR ROUTINE IF ON
; READ/WRITE THE 8088 GENERAL AND SEGMENTATION REGISTERS
; WITH ALL ONE'S AND ZEROES'S.
MOV AX,0FFFFH ;SETUP ONE'S PATTERN IN AX
STC
C8: MOV DS,AX ;WRITE PATTERN TO ALL REGS
MOV BX,DS
MOV ES,BX
MOV CX,ES
MOV SS,CX
MOV DX,SS
MOV SP,DX
MOV BP,SP
MOV SI,BP
MOV DI,SI
JNC C9 ; TST1A
XOR AX,DI ;PATTERN MAKE IT THRU ALL REGS
JNZ ERR01 ;NO - GO TO ERR ROUTINE
CLC
JNC C8
C9: ; TST1A
OR AX,DI ;ZERO PATTERN MAKE IT THRU?
JZ C10 ;YES - GO TO NEXT TEST
ERR01: HLT ;HALT SYSTEM
;--------------------------------------------
; TEST.02
; ROS CHECKSUM TEST 1
;DESCRIPTION
; A CHECKSUM IS DONE FOR THE 8K ROS MODULE CONTAINING POD AND BIOS.
;--------------------------------------------
C10:
MOV AL,0 ;DISABLE NMI INTERRUPTS
OUT 0A0H,AL
OUT 83H,AL ;INITIALIZE DMA PAGE REG
MOV AL,99H ;SET 8255 A,C-INPUT,B-OUTPUT
OUT CMD_PORT,AL ;WRITE 8255 CMD/MODE REG
MOV AL,0FCH ;DISABLE PARITY CHECKERS AND
OUT PORT_B,AL ; GATE SNS SWS,CASS MOTOR OFF
SUB AL,AL ;
MOV DX,3D8H
OUT DX,AL ;DISABLE COLOR VIDEO
INC AL
MOV DX,3B8H
OUT DX,AL ;DISABLE B/W VIDEO,EN HIGH RES
MOV AX,CODE ;SETUP SS SEG REG
MOV SS,AX
MOV BX,0E000H ;SETUP STARTING ROS ADDR
MOV SP,OFFSET C1 ;SETUP RETURN ADDRESS
JMP ROS_CHECKSUM
C11: JNE ERR01 ;HALT SYSTEM IF ERROR
;--------------------------------------------
;TEST.03
; 8237 DMA INITIALIZATION CHANNEL REGISTER TEST
;DESCRIPTION
; DISABLE THE 8237 DMA CONTROLLER. VERIFY THAT TIMER 1 FUNCTIONS OK.
; WRITE/READ THE CURRENT ADDRESS AND WORD COUNT REGISTERS FOR ALL
; CHANNELS INITIALIZE AND START DMA FOR MEMORY REFRESH.
;------------------------------------------
; DISABLE DMA CONTROLLER
MOV AL,04 ;DISABLE DMA CONTROLLER
OUT DMA08,AL
; VERIFY THAT TIMER 1 FUNCTIONS OK
MOV AL,54H ;SEL TIMER 1,LSB,MODE 2
OUT TIMER+3,AL
SUB CX,CX ;
MOV BL,CL
MOV AL,CL ;SET INITIAL TIMER CNT TO 0
OUT TIMER+1,AL
C12: ; TIMER1_BITS_ON
MOV AL,40H ;LATCH TIMER 1 COUNT
OUT TIMER+3,AL
CMP BL,0FFH ;YES - SEE IF ALL BITS GO OFF
JE C13 ; TIMER1_BITS_OFF
IN AL,TIMER+1 ;READ TIMER 1 COUNT
OR BL,AL ;ALL BITS ON IN TIMER
LOOP C12 ; TIMER1_BITS_ON
JMP SHORT ERR01 ;TIMER 1 FAILURE, HALT SYS
C13: ; TIMER1_BITS_OFF
MOV AL,BL ;SET TIMER 1 CNT
SUB CX,CX
OUT TIMER+1,AL
C14: ; TIMER_LOOP
MOV AL,40H ;LATCH TIMER 1 COUNT
OUT TIMER+3,AL
NOP
NOP
IN AL,TIMER+1 ;READ TIMER 1 COUNT
AND BL,AL
JZ C15 ; WRAP_DMA_REG
LOOP C14 ; TIMER_LOOP
JMP SHORT ERR01
NOP
NOP
; INITIALIZE TIMER 1 TO REFRESH MEMORY
C15: ; WRAP_DMA_REG
MOV AL,18 ;SETUP DIVISOR FOR REFRESH
OUT TIMER+1,AL ;WRITE TIMER 1 CNT REG
OUT DMA+0DH,AL ;SEND MASTER CLEAR TO DMA
; WRAP DMA CHANNELS ADDRESS AND COUNT REGISTERS
MOV AL,0FFH ;WRITE PATTERN FFH TO ALL REGS
C16: MOV BL,AL ;SAVE PATTERN FOR COMPARE
MOV BH,AL
MOV CX,8 ;SETUP LOOP CNT
MOV DX,DMA ;SETUP I/O PORT ADDR OF REG
C17: OUT DX,AL ;WRITE PATTERN TO REG, LSB
OUT DX,AL ;MSB OF 16 BIT REG
MOV AX,0101H ;AX TO ANOTHER PAT BEFORE RD
IN AL,DX ;READ 16-BIT DMA CH REG, LSB
MOV AH,AL ;SAVE LSB OF 16-BIT REG
IN AL,DX ;READ MSB OF DMA CH REG
CMP BX,AX ;PATTERN READ AS WRITTEN?
JE C18 ;YES - CHECK NEXT REG
JMP ERR01 ;NO - HALT THE SYSTEM
C18: ; NXT_DMA_CH
INC DX ;SET I/O PORT TO NEXT CH REG
LOOP C17 ;WRITE PATTERN TO NEXT REG
NOT AL ;SET PATTERN TO ZERO
JZ C16 ;WRITE TO CHANNEL REGS
; INITIALIZE AND START DMA FOR MEMORY REFRESH.
MOV AL,0FFH ;SET CNT OF 64K FOR RAM REFRESH
OUT DMA+1,AL
OUT DMA+1,AL
MOV AL,058H ;SET DMA MODE,CH 0,READ,AUTOINT
OUT DMA+0BH,AL ;WRITE DMA MODE REG
MOV AL,0 ;ENABLE DMA CONTROLLER
OUT DMA+8,AL ;SETUP DMA COMMAND REG
OUT DMA+10,AL ;ENABLE CHANNEL 0 FOR REFRESH
MOV AL,41H ;SET MODE FOR CHANNEL 1
OUT DMA+0BH,AL
MOV AL,42H ;SET MODE FOR CHANNEL 2
OUT DMA+0BH,AL ;
MOV AL,43H ;SET MODE FOR CHANNEL 3
OUT DMA+0BH,AL
;--------------------------------------------
;TEST.04
; BASE 16K READ/WRITE STORAGE TEST
;
;DESCRIPTION
; WRITE/READ/VERIFY DATA PATTERNS FF,55,AA,01, AND 00 TO 1ST 16K OF
; STORAGE. VERIFY STORAGE ADDRESSABILITY.
; INITIALIZE THE 8259 INTERRUPT CONTROLLER CHIP FOR CHECKING
; MANUFACTURING TEST 2 MODE.
;--------------------------------------------
; DETERMINE MEMORY SIZE AND FILL MEMORY WITH DATA
MOV AX,DATA ;POINT DS TO DATA SEG
MOV DS,AX ;
MOV BX,RESET_FLAG ;SAVE RESET_FLAG IN BX
SUB AX,AX ;SET ES AND DS TO 0
MOV ES,AX ;SETUP ES SEGMENT REG
MOV DS,AX
SUB DI,DI
IN AL,PORT_A ;DETERMINE BASE RAM SIZE
AND AL,0CH ;ISOLATE RAM SIZE SWS
ADD AL,4 ; CALCULATE MEMORY SIZE
MOV CL,12
SHL AX,CL
MOV CX,AX
MOV AH,AL
CLD ;SET DIR FLAG TO INCR
C19: STOSB ;FILL BASE RAM WITH DATA
LOOP C19 ; LOOP TIL ALL ZERO
; DETERMINE IO CHANNEL RAM SIZE
IN AL,PORT_C
AND AL,0FH
JZ C21
MOV DX,1000H ; SEGMENT FOR I/O RAM
MOV AH,AL
MOV AL,0
C20: ; FILL_IO
MOV ES,DX
MOV CX,8000H ; FILL 32K BYTES
SUB DI,DI
REP STOSB
ADD DX,800H ; NEXT SEGMENT VALUE
DEC AH
JNZ C20 ; FILL_IO
;--------------------------------------------
; INITIALIZE THE 8259 INTERRUPT CONTROLLER CHIP
;--------------------------------------------
C21:
MOV AL,13H ;ICW1 - EDGE, SNGL, ICW4
OUT INTA00,AL
MOV AL,8 ;SETUP ICW2 - INT TYPE 8 (8-F)
OUT INTA01,AL
MOV AL,9 ;SETUP ICW4 - BUFFRD,8086 MODE
OUT INTA01,AL
SUB AX,AX ;POINT DS AND ES TO BEGIN
MOV ES,AX ; OF R/W STORAGE
MOV SI,DATA ;POINT DS TO DATA SEG
MOV DS,SI ;
MOV RESET_FLAG,BX ;RESTORE RESET_FLAG
CMP RESET_FLAG,1234H ;RESET_FLAG SET?
JE C25 ;YES - SKIP STG TEST
MOV DS,AX ;POINT DS TO 1ST 16K OF STG
;--------------------------------------------
; CHECK FOR MANUFACTURING TEST 2 TO LOAD TEST PROGRAMS FROM KEYBOARD.
;--------------------------------------------
MOV SP,3FF0H ; ESTABLISH TEMPORARY STACK
MOV SS,AX
MOV DI,AX
MOV BX,24H
MOV WORD PTR [BX],OFFSET D11 ;SET UP KB INTERRUPT
INC BX
INC BX
MOV [BX],CS
CALL KBD_RESET ; READ IN KB RESET CODE TO BL
CMP BL,065H ; IS THIS MANUFACTURING TEST 2?
JNZ C23 ; JUMP IF NOT MAN. TEST
MOV DL,255 ; READ IN TEST PROGRAM
C22: CALL SP_TEST
MOV AL,BL
STOSB
DEC DL
JNZ C22 ; JUMP IF NOT DONE RET
INT 3EH ;SET INTERUPT TYPE 62 ADDRESS F8H
C23: ;CONTINUE IN NORMAL MODE
PUSH CS ; PUT SS BACK
POP SS
CLI ;
MOV SP,OFFSET C2 ;SETUP RETURN ADDRESS
JMP STGTST ;GO TO RD/WRT STG SUBROUTINE
C24: JE C25 ;GO TO NEXT TEST IF OK
JMP ERR01
; SETUP STACK SEG AND SP
C25:
MOV AX,STACK ; GET STACK VALUE
MOV SS,AX ; SET THE STACK UP
MOV SP,OFFSET TOS ; STACK IS READY TO GO
; SETUP THE NMI INTERRUPT VECTOR POINTER
MOV ES:NMI_PTR,OFFSET NMI_INT
MOV ES:NMI_PTR+2,CODE
JMP TST6 ;GO TO NEXT TEST
ROS_CHECKSUM PROC NEAR ; NEXT_ROS_MODULE
MOV CX,8192 ;NUMBER OF BYTES TO ADD
XOR AL,AL
C26:
ADD AL,CS:[BX] ;
INC BX ;POINT TO NEXT BYTE
LOOP C26 ;ADD ALL BYTES IN ROS MODULE
OR AL,AL ;SUM = 0?
RET
ROS_CHECKSUM ENDP
;--------------------------------------
; INITIAL RELIABILITY TEST -- PHASE 2
;---------------------------------------
ASSUME CS:CODE,ES:ABS0
D1 DB 'PARITY CHECK 2'
D1L EQU $-D1
D2 DB 'PARITY CHECK 1'
D2L EQU $-D2
;---------------------------------------------
; TEST.06
; 8259 INTERRUPT CONTROLLER TEST
;DESCRIPTION
; READ/WRITE THE INTERRUPT MASK REGISTER (IMR) WITH ALL ONES AND ZEROES
; ENABLE SYSTEM INTERRUPTS. MASK DEVICE INTERRUPTS OFF. CHECK FOR
; HOT INTERRUPTS (UNEXPECTED).
;--------------------------------------------
TST6:
SUB AX,AX ;SET UP ES REG
MOV ES,AX
;------ SET UP THE INTERRUPT 5 POINTER TO A DUMMY
MOV ES:INT5_PTR,OFFSET PRINT_SCREEN ;PRINT SCREEN
MOV ES:INT5_PTR+2,CODE ;
; TEST THE IMR REGISTER
CLI ;DISABLE INTERRUPTS
MOV AL,0
OUT INTA01,AL
IN AL,INTA01 ;READ IMR
OR AL,AL ;IMR = 0?
JNZ D6 ;GO TO ERR ROUTINE IF NOT 0
MOV AL,0FFH ;DISABLE DEVICE INTERRUPTS
OUT INTA01,AL ;WRITE TO IMR
IN AL,INTA01 ;READ IMR
ADD AL,1 ;ALL IMR BITS ON?
JNZ D6 ;NO - GO TO ERR ROUTINE
; CHECK FOR HOT INTERRUPTS
CLD ;SET DIR FLAG TO GO FORWARD
MOV CX,8 ;SETUP TEMP INT RTNE IN PRT TBL
MOV DI,OFFSET INT_PTR ;GET ADDRESS OF INT PROC TABLE
D3: ; VECTBL0
MOV AX,OFFSET D11 ;MOVE ADDR OF INTR PROC TO TBL
STOSW
MOV AX,CODE ;GET ADDR OF INTR PROC SEG
STOSW
ADD BX,4 ;SET BX TO POINT TO NEXT VAL
LOOP D3 ; VECTBL0
; INTERRUPTS ARE MASKED OFF. CHECK THAT NO INTERRUPTS OCCUR
XOR AH,AH ;CLEAR AH REG
STI ;ENABLE EXTERNAL INTERRUPTS
SUB CX,CX ;WAIT 1 SEC FOR ANY INTRS THAT
D4: LOOP D4 ;MIGHT OCCUR
D5: LOOP D5
OR AH,AH ;DID ANY INTERRUPTS OCCUR?
JZ D7 ;NO - GO TO NEXT TEST
D6: MOV DX,101H ;BEEP SPEAKER IF ERROR
CALL ERR_BEEP ;GO TO BEEP SUBROUTINE
CLI
HLT ;HALT THE SYSTEM
;--------------------------------------------
;TEST.7
; 8253 TIMER CHECKOUT
;DESCRIPTION
; VERIFY THAT THE SYSTEM TIMER (0) DOESN'T COUNT TOO FAST NOR TOO
; SLOW.
;--------------------------------------------
D7:
MOV AH,0 ;RESET TIMER INTR RECVD FLAG
XOR CH,CH ;CLEAR THE CH REG
MOV AL,0FEH ;MASK ALL INTRS EXCEPT LVL 0
OUT INTA01,AL ;WRITE THE 8259 IMR
MOV AL,00010000B ;SEL TIM 0, LSB, MODE 0, BINARY
OUT TIM_CTL,AL ;WRITE TIMER CONTROL MODE REG
MOV CL,16H ;SET PGM LOOP CNT
MOV AL,CL ;SET TIMER 0 CNT REG
OUT TIMER0,AL ;WRITE TIMER 0 CNT REG
D8: TEST AH,0FFH ;DID TIMER 0 INTERRUPT OCCUR?
JNZ D9 ; YES - CHECK TIMER OP FOR SLOW TIME
LOOP D8 ;WAIT FOR INTR FOR SPECIFIED TIME
JMP D6 ;TIMER 0 INTR DIDN'T OCCUR - ERR
D9: MOV CL,18 ;SET PGM LOOP CNT
MOV AL,0FFH ;WRITE TIMER 0 CNT REG
OUT TIMER0,AL
MOV AH,0 ;RESET INTR RECEIVED FLAG
MOV AL,0FEH ;REENABLE TIMER 0 INTERRUPTS
OUT INTA01,AL
D10: TEST AH,0FFH ;DID TIMER 0 INTERRUPT OCCUR?
JNZ D6 ;YES - TIMER CNTING TOO FAST, ERR
LOOP D10 ;WAIT FOR INTR FOR SPECIFIED TIME
JMP TST8 ;GO TO NEXT TEST ROUTINE
;--------------------------------------------
; TEMPORARY INTERRUPT SERVICE ROUTINE
;--------------------------------------------
D11 PROC NEAR
MOV AH,1
PUSH AX ;SAVE REG AX CONTENTS
MOV AL,0FFH ;MASK ALL INTERRUPTS OFF
OUT INTA01,AL
MOV AL,EOI
OUT INTA00,AL
POP AX ;RESTORE REG AX CONTENTS
IRET
D11 ENDP
NMI_INT PROC NEAR
PUSH AX ;SAVE ORIG CONTENTS OF AX
IN AL,PORT_C
TEST AL,40H ;IO CH PARITY CHECK?
JZ D12 ;YES - FLAG IS SET TO 0
MOV SI,OFFSET D1 ;ADDR OF ERROR MSG
MOV CX,D1L ;MSG LENGTH
JMP SHORT D13 ;DISPLAY ERROR MSG
D12:
TEST AL,80H ;PLANAR RAM P-CHECK?
JZ D14 ;NO - AUX INT
MOV SI,OFFSET D2 ;ADDR OF ERROR MSG
MOV CX,D2L ;MSG LENGTH
D13:
MOV AX,0 ;INIT AND SET MODE FOR VIDEO
INT 10H ;CALL VIDEO_IO PROCEDURE
CALL P_MSG ;PRINT ERROR MSG
CLI
HLT ;HALT SYSTEM
D14:
POP AX ;RESTORE ORIG CONTENTS OF AX
IRET
NMI_INT ENDP
;-------------------------------------
; INITIAL RELIABILITY TEST -- PHASE 3
;--------------------------------------
ASSUME CS:CODE,DS:DATA
E1 DB ' 201'
E1L EQU $-E1
; ESTABLISH BIOS SUBROUTINE CALL INTERRUPT VECTORS
TST8:
CLD ;SET DIR FLAG TO GO FORWARD
MOV DI,OFFSET VIDEO_INT ;SETUP ADDR TO INTR AREA
PUSH CS
POP DS ;SETUP ADDR OF VECTOR TABLE
MOV SI,0FF13H ; OFFSET VECTOR_TABLE+32
MOV CX,20H
; SETUP TIMER 0 TO MODE 3
MOV AL,0FFH ;DISABLE ALL DEVICE INTERRUPTS
OUT INTA01,AL
MOV AL,36H ;SEL TIM 0,LSB,MSB,MODE 3
OUT TIMER+3,AL ;WRITE TIMER MODE PEG
MOV AL,0
OUT TIMER,AL ;WRITE LSB TO TIMER 0 REG
REP MOVSW ;MOVE VECTOR TABLE TO RAM
OUT TIMER,AL ;WRITE MSB TO TIMER 0 REG
; SETUP TIMER 0 TO BLINK LED IF MANUFACTURING TEST MODE
ASSUME DS:DATA
MOV AX,DATA ;POINT DS TO DATA SEG
MOV DS,AX
CALL KBD_RESET ;SEND SOFTWARE RESET TO KEYBRD
CMP BL,0AAH ;SCAN CODE 'AA' RETURNED?
JE E3 ;YES - CONTINUE (NON MFG MODE)
MOV AL,3CH ;EN KBD, SET KBD CLK LINE LOW
OUT PORT_B,AL ;WRITE 8255 PORT B
NOP
NOP
IN AL,PORT_A ;WAS A BIT CLOCKED IN?
AND AL,0FFH
JNZ E2 ;YES - CONTINUE (NON MFG MODE)
INC MFG_TST ;ELSE SET SW FOR MFG TEST MODE
MOV ES:INT_ADDR,OFFSET BLINK_INT ;SETUP TIMER INTR TO BLINK LED
MOV ES:INT_ADDR+2,CODE
MOV AL,0FEH ;ENABLE TIMER INTERRUPT
OUT INTA01,AL
E2: ; JUMPER_NOT_IN:
MOV AL,0CCH ;RESET THE KEYBOARD
OUT PORT_B,AL
;--------------------------------------------
;TEST.05
; ROS CHECKSUM II
;DESCRIPTION
; A CHECKSUM IS DONE FOR THE 4 ROS MODULES CONTAINING BASIC CODE
;--------------------------------------------
E3:
MOV DL,4 ;NO. OF ROS MODULES TO CHECK
MOV BX,6000H ;SETUP STARTING ROS ADDR
E4: ; CHECK_ROS:
CALL ROS_CHECKSUM
JNE E5 ;BEEP SPEAKER IF ERROR
DEC DL ;ANY MORE TO DO?
JNZ E4 ;YES - CONTINUE
JMP E6 ;NO - GO TO NEXT TEST
E5: ; ROS_ERROR:
MOV DX,101H
CALL ERR_BEEP ;BEEP SPEAKER
;--------------------------------------------
;TEST.08
; INITIALIZE AND START CRT CONTROLLER (6845)
; TEST VIDEO READ/WRITE STORAGE.
;DESCRIPTION
; RESET THE VIDEO ENABLE SIGNAL.
; SELECT ALPHANUMERIC MODE, 40 * 25, B & W
; READ/WRITE DATA PATTERNS TO STG. CHECK STG ADDRESSABILITY.
;--------------------------------------------
E6:
IN AL,PORT_A ;READ SENSE SWITCHES
MOV AH,0
MOV EQUIP_FLAG,AX ;STORE SENSE SW INFO
AND AL,30H ;ISOLATE VIDEO SW
JNZ E7 ;VIDEO SWS SET TO 0?
JMP E19 ;SKIP VIDEO TESTS FOR BURN-IN
E7: ; TEST_VIDEO:
XCHG AH,AL
CMP AH,30H ;B/W CARD ATTACHED?
JE E8 ;YES - SET MODE FOR B/W CARD
INC AL ;SET COLOR MODE FOR COLOR CD
CMP AH,20H ;80X25 MODE SELECTED?
JNE E8 ;NO - SET MODE FOR 40X25
MOV AL,3 ;SET MODE FOR 80X25
E8: ; SET_MODE:
PUSH AX ;SAVE VIDEO MODE ON STACK
SUB AH,AH ;INITIALIZE TO ALPHANUMERIC
INT 10H ;CALL VIDEO_IO
POP AX ;RESTORE VIDEO SENSE SWS IN AH
PUSH AX ; RESAVE VALUE
MOV BX,0B000H ;BEG VIDEO RAM ADDR B/W CD
MOV DX,3B8H ;MODE REG FOR B/W
MOV CX,4096 ;RAM BYTE CNT FOR B/W CD
MOV AL,1 ; SET MODE FOR B/W CARD
CMP AH,30H ;B/W VIDEO CARD ATTACHED?
JE E9 ;YES - GO TEST VIDEO STG
MOV BX,0B800H ;BEG VIDEO RAM ADDR COLOR CD
MOV DX,3D8H ;MODE REG FOR COLOR CD
MOV CX,4000H ;RAM BYTE CNT FOR COLOR CD
DEC AL ; SET MODE TO 0 FOR COLOR CD
E9: ; TEST_VIDEO_STG:
OUT DX,AL ;DISABLE VIDEO FOR COLOR CD
MOV ES,BX ;POINT ES TO VIDEO RAM STG
MOV AX,DATA ;POINT DS TO DATA SEGMENT
MOV DS,AX
CMP RESET_FLAG,1234H ;POD INITIATED BY KBD RESET?
JE E10 ;YES - SKIP VIDEO RAM TEST
MOV DS,BX ;POINT DS TO VIDEO RAM STG
CALL STGTST_CNT ;GO TEST VIDEO R/W STG
JE E10 ;STG OK - CONTINUE TESTING
MOV DX,102H ;SETUP # OF BEEPS
CALL ERR_BEEP ;GO BEEP SPEAKER
;--------------------------------------------
;TEST.09
; SETUP VIDEO DATA ON SCREEN FOR VIDEO LINE TEST.
;DESCRIPTION
; ENABLE VIDEO SIGNAL AND SET MODE.
; DISPLAY A HORIZONTAL BAR ON SCREEN.
;--------------------------------------------
E10:
POP AX ;GET VIDEO SENSE SWS (AH)
PUSH AX ;SAVE IT
MOV AH,0 ;ENABLE VIDEO AND SET MODE
INT 10H ; VIDEO
MOV AX,7020H ;WRT BLANKS IN REVERSE VIDEO
SUB DI,DI ;SETUP STARTING LOC
MOV CX,40 ;NO. OF BLANKS TO DISPLAY
CLD ;SET DIR FLAG TO INCREMENT
REP STOSW ;WRITE VIDEO STORAGE
;--------------------------------------------
;TEST.10
; CRT INTERFACE LINES TEST
;DESCRIPTION
; SENSE ON/OFF TRANSITION OF THE VIDEO ENABLE AND HORIZONTAL
; SYNC LINES.
;--------------------------------------------
POP AX ;GET VIDEO SENSE SW INFO
PUSH AX ;SAVE IT
CMP AH,30H ;B/W CARD ATTACHED?
MOV DX,03BAH ;SETUP ADDR OF BW STATUS PORT
JE E11 ;YES - GO TEST LINES
MOV DX,03DAH ;COLOR CARD IS ATTACHED
E11: ; LINE_TST:
MOV AH,8
E12: ; OFLOOP_CNT:
SUB CX,CX
E13: IN AL,DX ;READ CRT STATUS PORT
AND AL,AH ;CHECK VIDEO/HORZ LINE
JNZ E14 ;ITS ON - CHECK IF IT GOES OFF
LOOP E13 ;LOOP TILL ON OR TIMEOUT
JMP SHORT E17 ;GO PRINT ERROR MSG
E14: SUB CX,CX
E15: IN AL,DX ;READ CRT STATUS PORT
AND AL,AH ;CHECK VIDEO/HORZ LINE
JZ E16 ;ITS ON - CHECK NEXT LINE
LOOP E15 ;LOOP IF OFF TILL IT GOES ON
JMP SHORT E17
E16: ; NXT_LINE:
MOV CL,3 ;GET NEXT BIT TO CHECK
SHR AH,CL ;
JNZ E12 ;GO CHECK HORIZONTAL LINE
JMP SHORT E18 ;DISPLAY CURSOR ON SCREEN
E17: ; CRT_ERR:
MOV DX,102H
CALL ERR_BEEP ;GO BEEP SPEAKER
E18: ; DISPLAY_CURSOR:
POP AX ;GET VIDEO SENSE SWS (AH)
MOV AH,0 ;SET MODE AND DISPLAY CURSOR
INT 10H ;CALL VIDEO I/O PROCEDURE
;--------------------------------------------
;TEST.11
; ADDITIONAL READ/WRITE STORAGE TEST
;DESCRIPTION
; WRITE/READ DATA PATTERNS TO ANY READ/WRITE STORAGE AFTER THE BASIC
; 16K. STORAGE ADDRESSABILITY IS CHECKED.
;--------------------------------------------
ASSUME DS:DATA
E19:
MOV AX,DATA
MOV DS,AX
; DETERMINE RAM SIZE ON PLANAR BOARD
MOV AH,BYTE PTR EQUIP_FLAG ;GET SENSE SWS INFO
AND AH,0CH ;ISOLATE RAM SIZE SWS
MOV AL,4
MUL AH
ADD AL,16 ;ADD BASIC 16K
MOV DX,AX ;SAVE PLANAR RAM SIZE IN DX
MOV BX,AX ; AND IN BX
; DETERMINE IO CHANNEL RAM SIZE
IN AL,PORT_C ;READ IO CH RAM SIZE SWS
AND AL,0FH ;ISOLATE FROM OTHER BITS
MOV AH,32
MUL AH
MOV IO_RAM_SIZE,AX ;SAVE IO CHANNEL RAM SIZE
CMP BX,40H ;PLANAR RAM SIZE = 64K?
JE E20 ;YES - ADD IO CHN RAM SIZE
SUB AX,AX ;NO - DON'T ADD ANY IO RAM
E20: ; ADD_ID_SIZE:
ADD AX,BX ;SUM TOTAL RAM SIZE
MOV MEMORY_SIZE,AX ;SETUP MEMORY SIZE PARM
CMP RESET_FLAG,1234H ;POD INITIATED BY KBD RESET?
JE E22 ;YES - SKIP MEMORY TEST
; TEST ANY OTHER READ/WRITE STORAGE AVAILABLE
MOV BX,400H
MOV CX,16
E21:
CMP DX,CX ;ANY MORE STG TO BE TESTED?
JBE E23 ;NO - GO TO NEXT TEST
MOV DS,BX ;SETUP STG ADDR IN DS AND ES
MOV ES,BX
ADD CX,16 ;INCREMENT STG BYTE COUNTER
ADD BX,400H ;SET POINTER TO NEXT 16K BLK
PUSH CX ;SAVE REGS
PUSH BX
PUSH DX
CALL STGTST ;GO TEST A 16K BLK OF STG
POP DX
POP BX ;RESTORE REGS
POP CX
JE E21 ;CHECK IF MORE STG TO TEST
; PRINT FAILING ADDRESS AND XOR'ED PATTERN IF DATA COMPARE ERROR
MOV DX,DS ;CONVERT FAILING HIGH-ORDER
MOV CH,AL ;SAVE FAILING BIT PATTERN
MOV AL,DH ;GET FAILING ADDR (HIGH BYTE)
MOV CL,4
SHR AL,CL ;RIGHT-JUSTIFY HIGH BYTE
CALL XLAT_PRINT_CODE ;CONVERT AND PRINT CODE
MOV AL,DH
AND AL,0FH
CALL XLAT_PRINT_CODE ;CONVERT AND PRINT CODE
MOV AL,CH ;GET FAILING BIT PATTERN
MOV CL,4 ; AND ISOLATE LEFTMOST NIBBLE
SHR AL,CL
CALL XLAT_PRINT_CODE ;CONVERT AND PRINT CODE
MOV AL,CH ;GET FAILING BIT PATTERN AND
AND AL,0FH ; ISOLATE RIGHTMOST NIBBLE
CALL XLAT_PRINT_CODE ;CONVERT AND PRINT CODE
MOV SI,OFFSET E1 ;SETUP ADDRESS OF ERROR MSG
MOV CX,E1L ;GET MSG BYTE COUNT
CALL P_MSG ;PRINT ERROR MSG
E22: ; GO_TST12:
JMP TST12 ;GO TO NEXT TEST
E23: ; STG_TEST_DONE:
MOV AX,DATA ;POINT DS TO DATA SEGMENT
MOV DS,AX ; CHG MADE 3/27/81
MOV DX,IO_RAM_SIZE ;GET IO CHANNEL RAM SIZE
OR DX,DX ;SET FLAG RESULT
JZ E22 ;NO IO RAM, GO TO NEXT TEST
MOV CX,0
CMP BX,1000H ;HAS IO RAM BEEN TESTED
JA E22 ;YES - GO TO NEXT TEST
MOV BX,1000H ;SETUP BEG LOC FOR IO RAM
JMP SHORT E21 ;GO TEST IO CHANNEL RAM
;--------------------------------------------
; CONVERT AND PRINT ASCII CODE
;
; AL MUST CONTAIN NUMBER TO BE CONVERTED.
; AX AND BX DESTROYED.
;--------------------------------------------
XLAT_PRINT_CODE PROC NEAR
PUSH DS ;SAVE DS VALUE
PUSH CS ;POINT DS TO CODE SEG
POP DS
MOV BX,0E4B7H ; OFFSET ASCII_TBL-XLAT TABLE
XLATB
MOV AH,14
MOV BH,0
INT 10H ;CALL VIDEO_IO
POP DS ;RESTORE ORIG VALUE IN DS
RET
XLAT_PRINT_CODE ENDP
;---------------------------------------
; INITIAL RELIABILITY TEST -- PHASE 4
;---------------------------------------
ASSUME CS:CODE,DS:DATA
F1 DB ' 301'
F1L EQU $-F1 ; KEYBOARD MESSAGE
F2 DB '131'
F2L EQU $-F2 ; CASSETTE MESSAGE
F3 DB '601'
F3L EQU $-F3 ; DISKETTE MESSAGE
F4 LABEL WORD ; PRINTER SOURCE TABLE
DW 3BCH
DW 378H
DW 278H
F4E LABEL WORD
ASCII_TBL DB '0123456789ABCDEF'
;--------------------------------------------
;TEST.12
; KEYBOARD TEST
;DESCRIPTION
; RESET THE KEYBOARD AND CHECK THAT SCAN CODE 'AA' IS RETURNED
; TO THE CPU. CHECK FOR STUCK KEYS.
;--------------------------------------------
TST12: