-
Notifications
You must be signed in to change notification settings - Fork 0
/
WSCpuTest.asm
executable file
·9316 lines (8435 loc) · 171 KB
/
WSCpuTest.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
;-----------------------------------------------------------------------------
;
; WonderSwan CPU Test
; by Fredrik Ahlström, 2022-2024
; https://github.com/FluBBaOfWard/WSCpuTest
;
; UP/DOWN - Choose option
; A - Start
;
; Assemble with:
; nasm -f bin -o WSCpuTest.wsc WSCpuTest.asm
;
;-----------------------------------------------------------------------------
ORG 0x0000
CPU 186
BITS 16
SECTION .data
%include "WonderSwan.inc"
MYSEGMENT equ 0xf000
foregroundMap equ WS_TILE_BANK - MAP_SIZE
backgroundMap equ foregroundMap - MAP_SIZE
spriteTable equ backgroundMap - SPR_TABLE_SIZE
PSR_S equ 0x80
PSR_Z equ 0x40
PSR_P equ 0x04
SECTION .text
;PADDING 15
initialize:
cli
cld
;-----------------------------------------------------------------------------
; Initialize registers and RAM
;-----------------------------------------------------------------------------
mov ax, MYSEGMENT
mov ds, ax
xor ax, ax
mov es, ax ; Set ES segment to 0x0000 (RAM).
; Setup stack
mov bp, ax
mov ss, ax
mov sp, WS_STACK
; Clear Ram
mov di, 0x0100
mov cx, 0x1E80
rep stosw
out IO_SRAM_BANK,al
;-----------------------------------------------------------------------------
; Initialize variables
;-----------------------------------------------------------------------------
mov word [es:globalFrameCounter], 0
mov word [es:lfsr1], 0x0234
mov word [es:lfsr2], 0x7321
mov word [es:lfsr3], 0x0001
mov word [es:lfsr3+2], 0x8420
in al, SYSTEM_CTRL1
mov bx, 0xF242
test al, 2
jne notMonoMulu
mov bx, 0xF202
notMonoMulu:
mov [es:muluFlags], bx
;-----------------------------------------------------------------------------
; Initialize video
;-----------------------------------------------------------------------------
in al, SYSTEM_CTRL2
; or al, VMODE_4C | VMODE_CLEANINIT
or al, VMODE_CLEANINIT
out SYSTEM_CTRL2, al
xor ax, ax
mov al, BG_MAP( backgroundMap ) | FG_MAP( foregroundMap )
out IO_SCR_AREA, al
mov al, SPR_AREA( spriteTable )
out IO_SPR_AREA, al
in al, IO_LCD_IF_CTRL
or al, LCD_ON
out IO_LCD_IF_CTRL, al
xor al, al
out IO_LCD_SEG_DATA, al
;-----------------------------------------------------------------------------
; Register our interrupt handlers
;-----------------------------------------------------------------------------
mov di, 0*4 ; Division error vector
mov word [es:di], divisionErrorHandler
mov word [es:di + 2], MYSEGMENT
mov di, 1*4 ; Trap/Brk
mov word [es:di], trapHandler
mov word [es:di + 2], MYSEGMENT
mov di, 2*4 ; NMI
mov word [es:di], nmiHandler
mov word [es:di + 2], MYSEGMENT
mov di, 3*4 ; Int3
mov word [es:di], int3InstructionHandler
mov word [es:di + 2], MYSEGMENT
mov di, 4*4 ; BRKV
mov word [es:di], overflowExceptionHandler
mov word [es:di + 2], MYSEGMENT
mov di, 5*4 ; CHKIND
mov word [es:di], boundsExceptionHandler
mov word [es:di + 2], MYSEGMENT
mov di, 6*4 ; Undefined instruction vector
mov word [es:di], undefinedInstructionHandler
mov word [es:di + 2], MYSEGMENT
mov di, 7*4 ; POLL
mov word [es:di], pollExceptionHandler
mov word [es:di + 2], MYSEGMENT
mov di, 0x10*4 ; output char vector
mov word [es:di], outputCharHandler
mov word [es:di + 2], MYSEGMENT
mov ax, INT_BASE ; 0x20
out IO_INT_VECTOR, al
mov di, INTVEC_VBLANK_START
add di, ax
shl di, 2
mov word [es:di], vblankInterruptHandler
mov word [es:di + 2], MYSEGMENT
; Clear HBL & Timer
xor ax, ax
out IOw_H_BLANK_TIMER, ax
out IO_TIMER_CTRL, al
; Acknowledge all interrupts
dec al
out INT_CAUSE_CLEAR, al
; Enable VBL interrupt
mov al, INT_VBLANK_START
out IO_INT_ENABLE, al
; We have finished initializing, interrupts can now fire again
sti
;-----------------------------------------------------------------------------
; Copy font tile data into WS's tile mem
;-----------------------------------------------------------------------------
; Copy font tile data to tile bank 1
xor ax,ax
mov si, MonoFont
mov di, WS_TILE_BANK + 16*16*2
mov cx, 8*16*6
monoFontLoop:
lodsb
stosw
loop monoFontLoop
;-----------------------------------------------------------------------------
; Copy font palette into WSC's palette area
;-----------------------------------------------------------------------------
; Copy 2-colour (2 bytes per colour) font palette to
; beginning of palettes area (becoming palette 0)
mov si, FontTilePalette
mov di, WSC_PALETTES
mov cx, 2
rep movsw
mov ax, 0x7f0
out IO_LCD_GRAY_01, ax
mov ax, 0x0010
out IOw_SCR_LUT_0, ax
mov ax, 0x0020
out IOw_SCR_LUT_1, ax
;-----------------------------------------------------------------------------
; Make background map point to our tiles, essentially "painting" the
; background layer with our tiles, coloured as per our palettes
;-----------------------------------------------------------------------------
main:
call clearScreen
mov si, headLineStr
call writeString
mov si, menuTestAllStr
call writeString
mov si, menuTestLogicStr
call writeString
mov si, menuTestArithmeticStr
call writeString
mov si, menuTestRolShiftStr
call writeString
mov si, menuTestMiscStr
call writeString
mov si, menuTestMultiplicationStr
call writeString
mov si, menuTestDivisionStr
call writeString
mov si, menuTestSDivisionStr
call writeString
; Turn on display
mov al, BG_ON
out IO_DISPLAY_CTRL, al
;-----------------------------------------------------------------------------
;
; BEGIN main area
;
;-----------------------------------------------------------------------------
mainLoop:
hlt ; Wait until next interrupt
mov al, KEYPAD_READ_ARROWS_H
out IO_KEYPAD, al
nop
nop
nop
nop
in al, IO_KEYPAD
mov bl, al
mov al, KEYPAD_READ_BUTTONS
out IO_KEYPAD, al
nop
nop
nop
nop
in al, IO_KEYPAD
and al, 0x0F
shl bl, 4
or al, bl
mov bl, [es:keysHeld]
mov [es:keysHeld], al
xor bl, al
and bl, al
mov [es:keysDown], bl
; Check player input
; test al, PAD_RIGHT
; jnz speed_up
; test al, PAD_LEFT
; jnz speed_down
mov cl, [es:menuYPos]
test bl, (PAD_UP<<4)
jz dontMoveUp
sub cl, 1
jns dontMoveUp
mov cl, 0
dontMoveUp:
test bl, (PAD_DOWN<<4)
jz dontMoveDown
add cl, 1
cmp cl, 7
js dontMoveDown
mov cl, 7
dontMoveDown:
mov [es:menuYPos], cl
mov ch, cl
add ch, 1
mov byte [es:cursorXPos], 0
mov [es:cursorYPos], ch
mov al, ' '
int 0x10
add ch, 1
mov byte [es:cursorXPos], 0
mov [es:cursorYPos], ch
mov al, '>'
int 0x10
add ch, 1
mov byte [es:cursorXPos], 0
mov [es:cursorYPos], ch
mov al, ' '
int 0x10
test bl, PAD_A
jz mainLoop
call clearScreen
cmp cl, 0
jz testAll
cmp cl, 1
jz testLogic
cmp cl, 2
jz testArithmetic
cmp cl, 3
jz testRolShift
cmp cl, 4
jz testMisc
cmp cl, 5
jz testMultiplication
cmp cl, 6
jz testDivision
cmp cl, 7
jz testSDivision
; No input, restart main loop
jmp mainLoop
;-----------------------------------------------------------------------------
;
; END main area
;
;-----------------------------------------------------------------------------
testAll:
call runLogic
call runArithmetic
call runRolShift
call runMisc
call runMultiplication
call runDivision
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
testLogic:
call runLogic
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
testArithmetic:
call runArithmetic
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
testRolShift:
call runRolShift
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
testMisc:
call runMisc
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
testMultiplication:
call runMultiplication
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
testDivision:
call runDivision
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
testSDivision:
call testDivs8
call checkKeyInput
jmp main
;-----------------------------------------------------------------------------
runLogic:
call testEqu
call testAnd8
; call testAnd16
call testNot8
; call testNot16
call testOr8
call testTest8
call testXor8
call testInc8
jmp testDec8
;-----------------------------------------------------------------------------
runArithmetic:
call testAdd8
call testSub8
call testCmp8
call testNeg8
call testAdc8
jmp testSbb8
;-----------------------------------------------------------------------------
runRolShift:
call testRol8
call testRor8
call testRcl8
; call testRcl16
call testRcl16Rnd
call testRcr8
; call testRcr16
call testRcr16Rnd
call testShl8
call testShr8
jmp testSar8
;-----------------------------------------------------------------------------
runMisc:
call testStack
call testJmp
call testTrap
call testUndefinedOps
call testBound
call testDaa
call testDas
call testAaa
jmp testAas
;-----------------------------------------------------------------------------
runMultiplication:
call testMulu8
call testMuls8
call testMulu16
call testMuls16
call testMulsIm
call testMulsIm8
jmp testAad
;-----------------------------------------------------------------------------
runDivision:
call testAam
call testDivu16
call testDivs16
call testDivu8
jmp testDivs8
;-----------------------------------------------------------------------------
; Test equality by CMP, SUB & XOR of all byte/word values.
;-----------------------------------------------------------------------------
testEqu:
mov si, testingEquStr
call writeString
mov si, test8x8InputStr
call writeString
mov byte [es:isTesting], 1
mov cl, 0
testEqu8Loop:
mov [es:inputVal1], cl
mov [es:inputVal2], cl
mov al, cl
cmp al, cl
jnz equ8Failed
sub al, cl
jnz equ8Failed
mov al, cl
xor al, cl
jnz equ8Failed
continueEqu8:
inc cl
jnz testEqu8Loop
mov cl, 0
testNeq8Loop:
mov [es:inputVal1], cl
mov [es:inputVal2], cl
mov al, cl
inc al
cmp al, cl
jz neq8Failed
sub al, cl
jz neq8Failed
mov al, cl
inc al
xor al, cl
jz neq8Failed
continueNeq8:
inc cl
jnz testNeq8Loop
hlt
mov al, 10
int 0x10
mov si, test16x16InputStr
call writeString
mov byte [es:isTesting], 3
mov cx, 0
testEqu16Loop:
mov [es:inputVal1], cx
mov [es:inputVal2], cx
mov ax, cx
cmp ax, cx
jnz equ16Failed
sub ax, cx
jnz equ16Failed
mov ax, cx
xor ax, cx
jnz equ16Failed
continueEqu16:
inc cx
jnz testEqu16Loop
mov cx, 0
testNeq16Loop:
mov [es:inputVal1], cx
mov [es:inputVal2], cx
mov ax, cx
inc ax
cmp ax, cx
jz neq16Failed
sub ax, cx
jz neq16Failed
mov ax, cx
inc ax
xor ax, cx
jz neq16Failed
continueNeq16:
inc cx
jnz testNeq16Loop
jmp endTestWriteOk
equ8Failed:
call printFailedResult
call checkKeyInput
xor al, 0
jnz continueEqu8
ret
neq8Failed:
call printFailedResult
call checkKeyInput
xor al, 0
jnz continueNeq8
ret
equ16Failed:
call printFailedResult
call checkKeyInput
xor al, 0
jnz continueEqu16
ret
neq16Failed:
call printFailedResult
call checkKeyInput
xor al, 0
jnz continueNeq16
ret
;-----------------------------------------------------------------------------
; Test logical AND of all byte values.
;-----------------------------------------------------------------------------
testAnd8:
mov si, testingAnd8Str
call writeString
mov si, test8x8InputStr
call writeString
mov byte [es:isTesting], 1
xor cx, cx
mov [es:expectedResult1], cx
testAnd8Loop:
mov [es:inputVal1], cl
mov [es:inputVal2], ch
mov ax, cx
not ax
or al, ah
not al
mov [es:expectedResult1], al
lea bx, PZSTable
xlat
mov ah, 0xf2
or al, 0x02
mov [es:expectedFlags], ax
call testAnd8Single
xor al, 0
jnz stopAnd8Test
continueAnd8:
inc cx
jnz testAnd8Loop
jmp endTestWriteOk
stopAnd8Test:
call checkKeyInput
xor al, 0
jnz continueAnd8
ret
;-----------------------------------------------------------------------------
testAnd8Single:
push bx
push cx
pushf
pop ax
and ax, 0x8700
push ax
mov [es:inputFlags], ax
xor ah, ah
mov al, [es:inputVal1]
mov bl, [es:inputVal2]
popf
and al, bl
pushf
mov [es:testedResult1], al
pop bx
mov [es:testedFlags], bx
mov cx, [es:expectedResult1]
xor ax, cx
jnz and8Failed
mov cx, [es:expectedFlags]
xor bx, cx
jnz and8Failed
pushf
pop ax
or ax, 0x78FF
push ax
mov [es:inputFlags], ax
xor ah, ah
mov al, [es:inputVal1]
mov cl, [es:inputVal2]
popf
and al, cl
pushf
mov [es:testedResult1], ax
pop bx
mov [es:testedFlags], bx
mov cx, [es:expectedResult1]
xor ax, cx
jnz and8Failed
mov cx, [es:expectedFlags]
xor bx, cx
jnz and8Failed
xor ax, ax
pop cx
pop bx
ret
and8Failed:
call printFailedResult
mov ax, 1
pop cx
pop bx
ret
;-----------------------------------------------------------------------------
; Test logical AND of some word values.
;-----------------------------------------------------------------------------
testAnd16:
mov si, testingAnd16Str
call writeString
mov si, test16x16InputStr
call writeString
mov byte [es:isTesting], 3
xor cx, cx
mov [es:expectedResult1], cx
testAnd16Loop:
call getLFSR2Value
mov bx, ax
call getLFSR1Value
mov [es:inputVal1], ax
mov [es:inputVal2], bx
not ax
not bx
or ax, bx
not ax
mov dx, 0xf202
mov [es:expectedResult1], ax
or ax, ax ; Test flags
jns and16notsign
or dl, 0x80 ; Sign
and16notsign:
or ax, ax ; Test flags
jnz and16notzero
or dl, 0x40 ; Zero
and16notzero:
lea bx, PZSTable
xlat
and ax, 0x04 ; Preserve parity only
or ax, dx
mov [es:expectedFlags], ax
call testAnd16Single
xor al, 0
jnz stopAnd16Test
continueAnd16:
inc cx
jnz testAnd16Loop
jmp endTestWriteOk
stopAnd16Test:
call checkKeyInput
xor al, 0
jnz continueAnd16
ret
;-----------------------------------------------------------------------------
testAnd16Single:
push bx
push cx
pushf
pop ax
and ax, 0x8700
push ax
mov [es:inputFlags], ax
mov ax, [es:inputVal1]
mov bx, [es:inputVal2]
popf
and ax, bx
pushf
mov [es:testedResult1], ax
pop bx
mov [es:testedFlags], bx
mov cx, [es:expectedResult1]
xor ax, cx
jnz and16Failed
mov cx, [es:expectedFlags]
xor bx, cx
jnz and16Failed
pushf
pop ax
or ax, 0x78FF
push ax
mov [es:inputFlags], ax
mov ax, [es:inputVal1]
mov cx, [es:inputVal2]
popf
and ax, cx
pushf
mov [es:testedResult1], ax
pop bx
mov [es:testedFlags], bx
mov cx, [es:expectedResult1]
xor ax, cx
jnz and16Failed
mov cx, [es:expectedFlags]
xor bx, cx
jnz and16Failed
xor ax, ax
pop cx
pop bx
ret
and16Failed:
call printFailedResult
mov ax, 1
pop cx
pop bx
ret
;-----------------------------------------------------------------------------
; Test logical NOT of all byte values.
;-----------------------------------------------------------------------------
testNot8:
mov si, testingNot8Str
call writeString
mov si, test8InputStr
call writeString
mov byte [es:isTesting], 4
xor cx, cx
mov [es:expectedResult1], cx
dec ch
testNot8Loop:
mov [es:inputVal1], cl
mov [es:expectedResult1], ch
call testNot8Single
xor al, 0
jnz stopNot8Test
continueNot8:
dec ch
inc cl
jnz testNot8Loop
jmp endTestWriteOk
stopNot8Test:
call checkKeyInput
xor al, 0
jnz continueNot8
ret
;-----------------------------------------------------------------------------
testNot8Single:
push bx
push cx
pushf
pop ax
and ax, 0x8700
push ax
mov [es:inputFlags], ax
mov ax, 0xF202
mov [es:expectedFlags], ax
xor ah, ah
mov al, [es:inputVal1]
popf
not al
pushf
mov [es:testedResult1], al
pop bx
mov [es:testedFlags], bx
mov cx, [es:expectedResult1]
xor ax, cx
jnz not8Failed
mov cx, [es:expectedFlags]
xor bx, cx
jnz not8Failed
pushf
pop ax
or ax, 0x78FF
push ax
mov [es:inputFlags], ax
mov ax, 0xFAD7
mov [es:expectedFlags], ax
xor bh, bh
mov bl, [es:inputVal1]
popf
not bl
pushf
mov [es:testedResult1], bx
pop ax
mov [es:testedFlags], ax
mov cx, [es:expectedResult1]
xor bx, cx
jnz not8Failed
mov cx, [es:expectedFlags]
xor ax, cx
jnz not8Failed
xor ax, ax
pop cx
pop bx
ret
not8Failed:
call printFailedResult
mov ax, 1
pop cx
pop bx
ret
;-----------------------------------------------------------------------------
; Test logical NOT of all word values.
;-----------------------------------------------------------------------------
testNot16:
mov si, testingNot16Str
call writeString
mov si, test16InputStr
call writeString
mov byte [es:isTesting], 5
xor cx, cx
xor dx, dx
dec dx
testNot16Loop:
mov [es:inputVal1], cx
mov [es:expectedResult1], dx
call testNot16Single
xor al, 0
jnz stopNot16Test
continueNot16:
dec dx
inc cx
jnz testNot16Loop
jmp endTestWriteOk
stopNot16Test:
call checkKeyInput
xor al, 0
jnz continueNot16
ret
;-----------------------------------------------------------------------------
testNot16Single:
push bx
push cx
pushf
pop ax
and ax, 0x8700
push ax
mov [es:inputFlags], ax
mov ax, 0xF202
mov [es:expectedFlags], ax
mov ax, [es:inputVal1]
popf
not ax
pushf
mov [es:testedResult1], ax
pop bx
mov [es:testedFlags], bx
mov cx, [es:expectedResult1]
xor ax, cx
jnz not16Failed
mov cx, [es:expectedFlags]
xor bx, cx
jnz not16Failed
pushf
pop ax
or ax, 0x78FF
push ax
mov [es:inputFlags], ax
mov ax, 0xFAD7
mov [es:expectedFlags], ax
mov bx, [es:inputVal1]
popf
not bx
pushf
mov [es:testedResult1], bx
pop ax
mov [es:testedFlags], ax
mov cx, [es:expectedResult1]
xor bx, cx
jnz not16Failed
mov cx, [es:expectedFlags]
xor ax, cx
jnz not16Failed
xor ax, ax
pop cx
pop bx
ret
not16Failed:
call printFailedResult
mov ax, 1
pop cx
pop bx
ret
;-----------------------------------------------------------------------------
; Test logical OR of all byte values.
;-----------------------------------------------------------------------------
testOr8:
mov si, testingOr8Str
call writeString
mov si, test8x8InputStr
call writeString
mov byte [es:isTesting], 1
mov cx, 0
mov [es:expectedResult1], cx
testOr8Loop:
mov [es:inputVal1], cl
mov [es:inputVal2], ch
mov ax, cx
not ax
and al, ah
not al
mov [es:expectedResult1], al
lea bx, PZSTable
xlat
mov ah, 0xf2
or al, 0x02
mov [es:expectedFlags], ax
call testOr8Single
xor al, 0
jnz stopOr8Test
continueOr8:
inc cx
jnz testOr8Loop
jmp endTestWriteOk
stopOr8Test:
call checkKeyInput
xor al, 0
jnz continueOr8
ret