-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProject.lst
1238 lines (1131 loc) · 54.5 KB
/
Project.lst
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
Microsoft (R) Macro Assembler Version 14.28.29915.0 06/04/21 13:47:51
5String Primitives and Macros (Proj6_fonbergi.asm Page 1 - 1
TITLE String Primitives and Macros (Proj6_fonbergi.asm)
; Author: Ian Fonberg
; Last Modified: 6/4/2021
; OSU email address: [email protected]
; Course number/section: CS271 Section 400
; Project Number: 6 Due Date: 6/6/2021
; Description: Implements the macros mGetString and mDisplayString to get user
; input strings and display strings using Irvine procedures ReadString and
; WriteString, respectively. These macros are used to write the low-level
; procedures ReadVal and WriteVal. ReadVal prompts the user for a signed
; integer, validates it, and stores it as an SDWORD. WriteVal takes a stored
; SDWORD and converts it to a string that is displayed to output. All of
; these macros and procedures are used to write a test script within main
; that greets the user, gets 10 signed integers from the user calculating the
; sum and displaying a subtotal along the way. Next, it displays the numbers
; back to the user along with the final sum and average of the numbers.
; Finally, the test script says goodbye to the user and exits.
INCLUDE Irvine32.inc
C ; Include file for Irvine32.lib (Irvine32.inc)
C
C ;OPTION CASEMAP:NONE ; optional: make identifiers case-sensitive
C
C INCLUDE SmallWin.inc ; MS-Windows prototypes, structures, and constants
C .NOLIST
C .LIST
C
C INCLUDE VirtualKeys.inc
C ; VirtualKeys.inc
C .NOLIST
C .LIST
C
C
C .NOLIST
C .LIST
C
; ---------------------------------------------------------------------------------
; Name: mGetString
;
; Display prompt and get the user's input into a memory location.
;
; Preconditions: Do not use EAX, ECX, EDX, or EDI as arguments
;
; Postconditions: none
;
; Receives:
; getPrompt = input, offset of prompt to display
; getLength = input, value of maximum length of user input string
; getDest = output, offset of user input string
; getBytes = output, offset of number of bytes read
;
; Returns:
; getDest = raw user input
; getBytes = bytes written
; ---------------------------------------------------------------------------------
mGetString MACRO getPrompt:REQ, getLength:REQ, getDest:REQ, getBytes:REQ
PUSH EAX
PUSH ECX
PUSH EDX
PUSH EDI
; Display Prompt.
mDisplayString getPrompt
; Store Raw Input
MOV ECX, getLength ; Max limit of readable characters.
MOV EDX, getDest
CALL ReadString
MOV EDI, getBytes
MOV [EDI], EAX ; Store bytes read.
POP EDI
POP EDX
POP ECX
POP EAX
ENDM
; ---------------------------------------------------------------------------------
; Name: mDisplayString
;
; Print the string which is stored in a specified memory location.
;
; Preconditions: Do not use EDX as an argument.
;
; Postconditions: none
;
; Receives:
; displayStr = input, offset of string to display
;
; Returns: none
; ---------------------------------------------------------------------------------
mDisplayString MACRO displayStr:REQ
PUSH EDX
; Display stored string.
MOV EDX, displayStr
CALL WriteString
POP EDX
ENDM
= 0000000C MAX_DIGITS = 12
= 0000000A ARRAY_SIZE = 10
00000000 .data
00000000 2E 20 50 6C 65 firstAttempt BYTE ". Please enter a signed number: ",0
61 73 65 20 65
6E 74 65 72 20
61 20 73 69 67
6E 65 64 20 6E
75 6D 62 65 72
3A 20 00
00000021 2E 20 50 6C 65 secondAttempt BYTE ". Please try again: ",0
61 73 65 20 74
72 79 20 61 67
61 69 6E 3A 20
00
00000036 45 52 52 4F 52 emptyMsg BYTE "ERROR: a value is required.",13,10,0
3A 20 61 20 76
61 6C 75 65 20
69 73 20 72 65
71 75 69 72 65
64 2E 0D 0A 00
00000054 45 52 52 4F 52 errorMsg BYTE "ERROR: You did not enter a signed number or your number was too big.",13,10,0
3A 20 59 6F 75
20 64 69 64 20
6E 6F 74 20 65
6E 74 65 72 20
61 20 73 69 67
6E 65 64 20 6E
75 6D 62 65 72
20 6F 72 20 79
6F 75 72 20 6E
75 6D 62 65 72
20 77 61 73 20
74 6F 6F 20 62
69 67 2E 0D 0A
00
0000009B 0000000C [ rawNumString BYTE MAX_DIGITS DUP(0)
00
]
000000A7 00000000 validNum SDWORD ?
000000AB 50 52 4F 47 52 intro1 BYTE "PROGRAMMING ASSIGNMENT 6: Designing low-level I/O procedures",13,10,
41 4D 4D 49 4E
47 20 41 53 53
49 47 4E 4D 45
4E 54 20 36 3A
20 44 65 73 69
67 6E 69 6E 67
20 6C 6F 77 2D
6C 65 76 65 6C
20 49 2F 4F 20
70 72 6F 63 65
64 75 72 65 73
0D 0A 57 72 69
74 74 65 6E 20
62 79 3A 20 49
61 6E 20 46 6F
6E 62 65 72 67
0D 0A 2A 2A 45
43 3A 20 4E 75
6D 62 65 72 20
65 61 63 68 20
6C 69 6E 65 20
6F 66 20 75 73
65 72 20 69 6E
70 75 74 20 61
6E 64 20 64 69
73 70 6C 61 79
20 61 20 72 75
6E 6E 69 6E 67
20 73 75 62 74
6F 74 61 6C 20
6F 66 20 74 68
65 20 75 73 65
72 27 73 20 76
61 6C 69 64 20
6E 75 6D 62 65
72 73 2E 0D 0A
0D 0A 50 6C 65
61 73 65 20 70
72 6F 76 69 64
65 20 00
"Written by: Ian Fonberg",13,10,
"**EC: Number each line of user input and display a running subtotal of the user's valid numbers.",13,10,13,10,
"Please provide ",0
00000176 20 73 69 67 6E intro2 BYTE " signed decimal integers.",13,10,
65 64 20 64 65
63 69 6D 61 6C
20 69 6E 74 65
67 65 72 73 2E
0D 0A 45 61 63
68 20 6E 75 6D
62 65 72 20 6E
65 65 64 73 20
74 6F 20 62 65
20 73 6D 61 6C
6C 20 65 6E 6F
75 67 68 20 74
6F 20 66 69 74
20 69 6E 73 69
64 65 20 61 20
33 32 20 62 69
74 20 72 65 67
69 73 74 65 72
2E 20 41 66 74
65 72 20 79 6F
75 20 68 61 76
65 20 66 69 6E
69 73 68 65 64
20 69 6E 70 75
74 74 69 6E 67
20 74 68 65 20
72 61 77 20 6E
75 6D 62 65 72
73 20 49 20 77
69 6C 6C 20 64
69 73 70 6C 61
79 20 61 20 6C
69 73 74 20 6F
66 20 74 68 65
20 69 6E 74 65
67 65 72 73 2C
20 74 68 65 69
72 20 73 75 6D
2C 20 61 6E 64
20 74 68 65 69
72 20 61 76 65
72 61 67 65 20
76 61 6C 75 65
2E 0D 0A 0D 0A
00
"Each number needs to be small enough to fit inside a 32 bit register. After you have ",
"finished inputting the raw numbers I will display a list of the integers, their sum, ",
"and their average value.",13,10,13,10,0
00000258 0000000A [ testArr SDWORD ARRAY_SIZE DUP(?)
00000000
]
00000280 53 75 62 74 6F subtotal BYTE "Subtotal: ",0
74 61 6C 3A 20
00
0000028B 59 6F 75 20 65 numsEntered BYTE "You entered the following numbers: ",13,10,0
6E 74 65 72 65
64 20 74 68 65
20 66 6F 6C 6C
6F 77 69 6E 67
20 6E 75 6D 62
65 72 73 3A 20
0D 0A 00
000002B1 2C 20 00 comma BYTE ", ",0
000002B4 54 68 65 20 73 sumNums BYTE "The sum of these numbers is: ",0
75 6D 20 6F 66
20 74 68 65 73
65 20 6E 75 6D
62 65 72 73 20
69 73 3A 20 00
000002D2 54 68 65 20 72 avgNums BYTE "The rounded average is: ",0
6F 75 6E 64 65
64 20 61 76 65
72 61 67 65 20
69 73 3A 20 00
000002EB 54 68 61 6E 6B goodbye BYTE "Thanks for playing!",0
73 20 66 6F 72
20 70 6C 61 79
69 6E 67 21 00
000002FF 01 lineNo BYTE 1
00000000 .code
00000000 main PROC
; -------------------------
; Test Script
; -------------------------
; Introduce test script.
mDisplayString OFFSET intro1
00000000 52 1 PUSH EDX
00000001 BA 000000AB R 1 MOV EDX, OFFSET intro1
00000006 E8 00000000 E 1 CALL WriteString
0000000B 5A 1 POP EDX
0000000C 6A 0A PUSH ARRAY_SIZE
0000000E E8 0000021D CALL WriteVal
mDisplayString OFFSET intro2
00000013 52 1 PUSH EDX
00000014 BA 00000176 R 1 MOV EDX, OFFSET intro2
00000019 E8 00000000 E 1 CALL WriteString
0000001E 5A 1 POP EDX
; -------------------------
; Add user input to array.
; -------------------------
0000001F B8 00000000 MOV EAX, 0 ; Initialize sum.
00000024 B9 0000000A MOV ECX, ARRAY_SIZE ; Initialize counter to ARRAY_SIZE.
00000029 BF 00000258 R MOV EDI, OFFSET testArr
0000002E _readLoop:
0000002E 68 000002FF R PUSH OFFSET lineNo
00000033 68 00000000 R PUSH OFFSET firstAttempt
00000038 68 00000036 R PUSH OFFSET emptyMsg
0000003D 68 00000054 R PUSH OFFSET errorMsg
00000042 68 00000021 R PUSH OFFSET secondAttempt
00000047 68 0000009B R PUSH OFFSET rawNumString
0000004C 68 000000A7 R PUSH OFFSET validNum
00000051 E8 000000BA CALL ReadVal
; Insert signed integer using register indirect addressing.
00000056 8B 1D 000000A7 R MOV EBX, validNum
0000005C 89 1F MOV [EDI], EBX
; -------------------------
; Display Subtotal.
; -------------------------
0000005E 03 C3 ADD EAX, EBX ; Add valid number to total.
mDisplayString OFFSET subtotal
00000060 52 1 PUSH EDX
00000061 BA 00000280 R 1 MOV EDX, OFFSET subtotal
00000066 E8 00000000 E 1 CALL WriteString
0000006B 5A 1 POP EDX
0000006C 50 PUSH EAX
0000006D E8 000001BE CALL WriteVal
00000072 E8 00000000 E CALL CrLf
00000077 83 C7 04 ADD EDI, TYPE testArr ; Move to next element.
0000007A E2 B2 LOOP _readLoop
0000007C E8 00000000 E CALL CrLf
; -------------------------
; Display numbers entered.
; -------------------------
mDisplayString OFFSET numsEntered
00000081 52 1 PUSH EDX
00000082 BA 0000028B R 1 MOV EDX, OFFSET numsEntered
00000087 E8 00000000 E 1 CALL WriteString
0000008C 5A 1 POP EDX
0000008D BE 00000258 R MOV ESI, OFFSET testArr
00000092 B9 0000000A MOV ECX, ARRAY_SIZE
00000097 FF 36 PUSH [ESI]
00000099 E8 00000192 CALL WriteVal ; Display first number
0000009E 49 DEC ECX ; Decrement counter.
0000009F _writeLoop:
; Comma separate the numbers
mDisplayString OFFSET comma
0000009F 52 1 PUSH EDX
000000A0 BA 000002B1 R 1 MOV EDX, OFFSET comma
000000A5 E8 00000000 E 1 CALL WriteString
000000AA 5A 1 POP EDX
000000AB 83 C6 04 ADD ESI, TYPE testArr ; Access next number using register indirect addressing.
000000AE FF 36 PUSH [ESI]
000000B0 E8 0000017B CALL WriteVal ; Display the current number.
000000B5 E2 E8 LOOP _writeLoop
000000B7 E8 00000000 E CALL CrLf
; -------------------------
; Display sum of numbers entered.
; -------------------------
mDisplayString OFFSET sumNums
000000BC 52 1 PUSH EDX
000000BD BA 000002B4 R 1 MOV EDX, OFFSET sumNums
000000C2 E8 00000000 E 1 CALL WriteString
000000C7 5A 1 POP EDX
000000C8 50 PUSH EAX ; EAX holds final sum.
000000C9 E8 00000162 CALL WriteVal
000000CE E8 00000000 E CALL CrLf
; -------------------------
; Calculate and display average of numbers entered.
; -------------------------
000000D3 BB 0000000A MOV EBX, ARRAY_SIZE
000000D8 99 CDQ
000000D9 F7 FB IDIV EBX
; Floor negative numbers with remainders.
000000DB 83 FA 00 CMP EDX, 0
000000DE 7D 01 JGE _alreadyFloored
000000E0 48 DEC EAX
000000E1 _alreadyFloored:
mDisplayString OFFSET avgNums
000000E1 52 1 PUSH EDX
000000E2 BA 000002D2 R 1 MOV EDX, OFFSET avgNums
000000E7 E8 00000000 E 1 CALL WriteString
000000EC 5A 1 POP EDX
000000ED 50 PUSH EAX ; EAX contains floored average.
000000EE E8 0000013D CALL WriteVal
000000F3 E8 00000000 E CALL CrLf
000000F8 E8 00000000 E CALL CrLf
; Say goodbye to user.
mDisplayString OFFSET goodbye
000000FD 52 1 PUSH EDX
000000FE BA 000002EB R 1 MOV EDX, OFFSET goodbye
00000103 E8 00000000 E 1 CALL WriteString
00000108 5A 1 POP EDX
Invoke ExitProcess,0 ; exit to operating system
00000109 6A 00 * push +000000000h
0000010B E8 00000000 E * call ExitProcess
00000110 main ENDP
; ---------------------------------------------------------------------------------
; Name: ReadVal
;
; Gets user input in the form of a string of digits, then attempts to convert the
; string of ASCII digits to its numeric value representation. If the input is
; invalid, the user is prompted to try again with an appropriate value, otherwise
; the value is stored in memory. Numbers the prompt with the current number
; of valid guesses.
;
; Preconditions: none
;
; Postconditions: none
;
; Receives:
; [EBP+32] = input/output, offset of current number of valid guesses.
; [EBP+28] = input, offset of first attempt prompt
; [EBP+24] = input, offset of empty error message
; [EBP+20] = input, offset of invalid error message
; [EBP+16] = input, offset of second attempt prompt
; [EBP+12] = output, offset of user input string
; [EBP+8] = output, offset of number storage
;
; Returns:
; [EBP+32] = Incremented by one.
; [EBP+8] = validated number
; ---------------------------------------------------------------------------------
00000110 ReadVal PROC USES EAX EBX ECX EDI ESI
LOCAL valid:BYTE, numInt:SDWORD, sign:SDWORD, bytesRead:DWORD
; -------------------------
; Get Integer Digits.
; -------------------------
00000110 55 * push ebp
00000111 8B EC * mov ebp, esp
00000113 83 C4 F0 * add esp, 0FFFFFFF0h
00000116 50 * push eax
00000117 53 * push ebx
00000118 51 * push ecx
00000119 57 * push edi
0000011A 56 * push esi
0000011B C6 45 FF 01 MOV valid, 1 ; Initialize valid to true.
; Display initial prompt for signed number.
0000011F 8B 75 20 MOV ESI, [EBP+32]
00000122 FF 36 PUSH [ESI]
00000124 E8 00000107 CALL WriteVal ; Display line number.
00000129 8D 5D F0 LEA EBX, bytesRead
mGetString [EBP+28], MAX_DIGITS, [EBP+12], EBX
0000012C 50 1 PUSH EAX
0000012D 51 1 PUSH ECX
0000012E 52 1 PUSH EDX
0000012F 57 1 PUSH EDI
00000130 52 2 PUSH EDX
00000131 8B 55 1C 2 MOV EDX, [EBP+28]
00000134 E8 00000000 E 2 CALL WriteString
00000139 5A 2 POP EDX
0000013A B9 0000000C 1 MOV ECX, MAX_DIGITS ; Max limit of readable characters.
0000013F 8B 55 0C 1 MOV EDX, [EBP+12]
00000142 E8 00000000 E 1 CALL ReadString
00000147 8B FB 1 MOV EDI, EBX
00000149 89 07 1 MOV [EDI], EAX ; Store bytes read.
0000014B 5F 1 POP EDI
0000014C 5A 1 POP EDX
0000014D 59 1 POP ECX
0000014E 58 1 POP EAX
0000014F _validateDigits:
0000014F C7 45 F8 MOV numInt, 0 ; Initialize integer aggregator to 0.
00000000
00000156 C7 45 F4 MOV sign, 1 ; Value is unsigned.
00000001
0000015D 80 7D FF 00 CMP valid, 0
00000161 75 30 JNE _endTryAgain
; Prompt for new signed integer.
00000163 8B 75 20 MOV ESI, [EBP+32]
00000166 FF 36 PUSH [ESI]
00000168 E8 000000C3 CALL WriteVal ; Display line number.
0000016D 8D 5D F0 LEA EBX, bytesRead
mGetString [EBP+16], MAX_DIGITS, [EBP+12], EBX
00000170 50 1 PUSH EAX
00000171 51 1 PUSH ECX
00000172 52 1 PUSH EDX
00000173 57 1 PUSH EDI
00000174 52 2 PUSH EDX
00000175 8B 55 10 2 MOV EDX, [EBP+16]
00000178 E8 00000000 E 2 CALL WriteString
0000017D 5A 2 POP EDX
0000017E B9 0000000C 1 MOV ECX, MAX_DIGITS ; Max limit of readable characters.
00000183 8B 55 0C 1 MOV EDX, [EBP+12]
00000186 E8 00000000 E 1 CALL ReadString
0000018B 8B FB 1 MOV EDI, EBX
0000018D 89 07 1 MOV [EDI], EAX ; Store bytes read.
0000018F 5F 1 POP EDI
00000190 5A 1 POP EDX
00000191 59 1 POP ECX
00000192 58 1 POP EAX
00000193 _endTryAgain:
00000193 8B 4D F0 MOV ECX, bytesRead ; Initialize counter.
00000196 41 INC ECX
; -------------------------
; Assert input is non-empty.
; -------------------------
; Assert a value was read.
00000197 83 7D F0 00 CMP bytesRead, 0
0000019B 75 10 JNE _notEmpty
; Set error state.
0000019D C6 45 FF 00 MOV valid, 0 ; Valid is false.
mDisplayString [EBP+24]
000001A1 52 1 PUSH EDX
000001A2 8B 55 18 1 MOV EDX, [EBP+24]
000001A5 E8 00000000 E 1 CALL WriteString
000001AA 5A 1 POP EDX
000001AB EB A2 JMP _validateDigits
000001AD _notEmpty:
000001AD 8B 75 0C MOV ESI, [EBP+12] ; Move user input to ESI.
; -------------------------
; Assert sign is either first character or absent.
; -------------------------
000001B0 FC CLD
000001B1 AC LODSB
000001B2 49 DEC ECX ; Load first character and adjust counter position.
000001B3 3C 2D CMP AL, 45 ; is the character a '-' sign?
000001B5 74 06 JE _setNegative
000001B7 3C 2B CMP AL, 43 ; is the character a '+' sign?
000001B9 74 09 JE _checkLength
000001BB EB 22 JMP _aggregateNum ; Proceed with calculation.
000001BD _setNegative:
000001BD C7 45 F4 MOV sign, -1
FFFFFFFF
000001C4 _checkLength:
000001C4 83 7D F0 01 CMP bytesRead, 1 ; Assert sign is not the only component.
000001C8 75 13 JNE _loadNext
; Set error state.
000001CA C6 45 FF 00 MOV valid, 0 ; Valid is false.
mDisplayString [EBP+20]
000001CE 52 1 PUSH EDX
000001CF 8B 55 14 1 MOV EDX, [EBP+20]
000001D2 E8 00000000 E 1 CALL WriteString
000001D7 5A 1 POP EDX
000001D8 E9 FFFFFF72 JMP _validateDigits
000001DD _loadNext:
000001DD AC LODSB
000001DE 49 DEC ECX ; Load second character and adjust counter position.
000001DF _aggregateNum:
; -------------------------
; Aggregate digits into integer.
; -------------------------
000001DF _readDigit:
000001DF 3C 30 CMP AL, 48
000001E1 72 21 JB _notDigitOrTooLarge
000001E3 3C 39 CMP AL, 57
000001E5 77 1D JA _notDigitOrTooLarge
; ASCII value - 48 will result in an integer between 0 and 9, inclusive.
000001E7 0F B6 D8 MOVZX EBX, AL
000001EA 83 EB 30 SUB EBX, 48
000001ED 0F AF 5D F4 IMUL EBX, sign ; Calculated signed amount to add to total.
; Multiply 10x current numInt.
000001F1 B8 0000000A MOV EAX, 10
000001F6 F7 6D F8 IMUL numInt
000001F9 70 09 JO _notDigitOrTooLarge ; Invalid if overflow.
; Add both to get current integer value.
000001FB 03 C3 ADD EAX, EBX
000001FD 70 05 JO _notDigitOrTooLarge ; Invalid if overflow.
000001FF 89 45 F8 MOV numInt, EAX
00000202 EB 13 JMP _continueRead
00000204 _notDigitOrTooLarge:
00000204 C6 45 FF 00 MOV valid, 0 ; Valid is false.
mDisplayString [EBP+20]
00000208 52 1 PUSH EDX
00000209 8B 55 14 1 MOV EDX, [EBP+20]
0000020C E8 00000000 E 1 CALL WriteString
00000211 5A 1 POP EDX
00000212 E9 FFFFFF38 JMP _validateDigits
00000217 _continueRead:
00000217 AC LODSB
00000218 E2 C5 LOOP _readDigit
; -------------------------
; Store number.
; -------------------------
0000021A 8B 7D 08 MOV EDI, [EBP+8]
0000021D 8B 45 F8 MOV EAX, numInt
00000220 89 07 MOV [EDI], EAX
; Increment line number.
00000222 8B 75 20 MOV ESI, [EBP+32]
00000225 FE 06 INC BYTE PTR [ESI]
00000227 5E * pop esi
00000228 5F * pop edi
00000229 59 * pop ecx
0000022A 5B * pop ebx
0000022B 58 * pop eax
0000022C C9 * leave
0000022D C2 001C RET 28
00000230 ReadVal ENDP
; ---------------------------------------------------------------------------------
; Name: WriteVal
;
; Convert a numeric SDWORD value to a string of ASCII digits and displays it to
; the user.
;
; Preconditions: none
;
; Postconditions: none
;
; Receives:
; [EBP+8] = input, numeric SDWORD value
;
; Returns: none
; ---------------------------------------------------------------------------------
00000230 WriteVal PROC USES EAX EBX ECX EDX EDI ESI
LOCAL signed:BYTE, digits[MAX_DIGITS]:BYTE, strNum[MAX_DIGITS]:BYTE
00000230 55 * push ebp
00000231 8B EC * mov ebp, esp
00000233 83 C4 E4 * add esp, 0FFFFFFE4h
00000236 50 * push eax
00000237 53 * push ebx
00000238 51 * push ecx
00000239 52 * push edx
0000023A 57 * push edi
0000023B 56 * push esi
0000023C C6 45 FF 00 MOV signed, 0
00000240 8D 7D F3 LEA EDI, digits
00000243 B9 00000000 MOV ECX, 0 ; Counter for string length
00000248 FC CLD
; -------------------------
; Check sign.
; -------------------------
00000249 8B 45 08 MOV EAX, [EBP+8]
0000024C 83 F8 00 CMP EAX, 0
0000024F 7D 06 JGE _storeDigits
00000251 C6 45 FF 01 MOV signed, 1 ; Number is signed.
00000255 F7 D8 NEG EAX ; Use the absolute value of the number.
; -------------------------
; Store digits in reverse order
; -------------------------
00000257 _storeDigits:
00000257 BA 00000000 MOV EDX, 0
0000025C BB 0000000A MOV EBX, 10
00000261 F7 F3 DIV EBX
00000263 8B D8 MOV EBX, EAX ; Store current quotient
00000265 8A C2 MOV AL, DL
00000267 04 30 ADD AL, 48 ; Add 48 to remainder to get ASCII character value.
00000269 AA STOSB
0000026A 41 INC ECX
0000026B 8B C3 MOV EAX, EBX ; Restore quotient
0000026D 83 F8 00 CMP EAX, 0
00000270 75 E5 JNE _storeDigits
; Append sign if number is signed.
00000272 80 7D FF 01 CMP signed, 1
00000276 75 04 JNE _terminateDigits
00000278 B0 2D MOV AL, '-'
0000027A AA STOSB
0000027B 41 INC ECX
; Null terminate the string.
0000027C _terminateDigits:
0000027C BB 00000000 MOV EBX, 0
00000281 89 1F MOV [EDI], EBX
; -------------------------
; Reverse stored digits
; -------------------------
00000283 8B F7 MOV ESI, EDI ; EDI currently points to end of digits which is now our source.
00000285 4E DEC ESI
00000286 8D 7D E7 LEA EDI, strNum
00000289 _reverseDigits:
00000289 FD STD
0000028A AC LODSB ; Move backwards through digit and load result in AL
0000028B FC CLD
0000028C AA STOSB ; Move forwards through strNum and store the result from AL
0000028D E2 FA LOOP _reverseDigits
; Null terminate the string.
0000028F BB 00000000 MOV EBX, 0
00000294 89 1F MOV [EDI], EBX
; Display string.
00000296 8D 5D E7 LEA EBX, strNum
mDisplayString EBX
00000299 52 1 PUSH EDX
0000029A 8B D3 1 MOV EDX, EBX
0000029C E8 00000000 E 1 CALL WriteString
000002A1 5A 1 POP EDX
000002A2 5E * pop esi
000002A3 5F * pop edi
000002A4 5A * pop edx
000002A5 59 * pop ecx
000002A6 5B * pop ebx
000002A7 58 * pop eax
000002A8 C9 * leave
000002A9 C2 0004 RET 4
000002AC WriteVal ENDP
END main
Microsoft (R) Macro Assembler Version 14.28.29915.0 06/04/21 13:47:51
5String Primitives and Macros (Proj6_fonbergi.asm Symbols 2 - 1
Macros:
N a m e Type
mDisplayString . . . . . . . . . Proc
mGetString . . . . . . . . . . . Proc
Structures and Unions:
N a m e Size
Offset Type
CONSOLE_CURSOR_INFO . . . . . . 00000008
dwSize . . . . . . . . . . . . 00000000 DWord
bVisible . . . . . . . . . . . 00000004 DWord
CONSOLE_SCREEN_BUFFER_INFO . . . 00000016
dwSize . . . . . . . . . . . . 00000000 DWord
dwCursorPosition . . . . . . . 00000004 DWord
wAttributes . . . . . . . . . 00000008 Word
srWindow . . . . . . . . . . . 0000000A QWord
dwMaximumWindowSize . . . . . 00000012 DWord
COORD . . . . . . . . . . . . . 00000004
X . . . . . . . . . . . . . . 00000000 Word
Y . . . . . . . . . . . . . . 00000002 Word
FILETIME . . . . . . . . . . . . 00000008
loDateTime . . . . . . . . . . 00000000 DWord
hiDateTime . . . . . . . . . . 00000004 DWord
FOCUS_EVENT_RECORD . . . . . . . 00000004
bSetFocus . . . . . . . . . . 00000000 DWord
FPU_ENVIRON . . . . . . . . . . 0000001C
controlWord . . . . . . . . . 00000000 Word
statusWord . . . . . . . . . . 00000004 Word
tagWord . . . . . . . . . . . 00000008 Word
instrPointerOffset . . . . . . 0000000C DWord
instrPointerSelector . . . . . 00000010 DWord
operandPointerOffset . . . . . 00000014 DWord
operandPointerSelector . . . . 00000018 Word
INPUT_RECORD . . . . . . . . . . 00000014
EventType . . . . . . . . . . 00000000 Word
Event . . . . . . . . . . . . 00000004 XmmWord
bKeyDown . . . . . . . . . . . 00000000 DWord
wRepeatCount . . . . . . . . . 00000004 Word
wVirtualKeyCode . . . . . . . 00000006 Word
wVirtualScanCode . . . . . . . 00000008 Word
uChar . . . . . . . . . . . . 0000000A Word
UnicodeChar . . . . . . . . . 00000000 Word
AsciiChar . . . . . . . . . . 00000000 Byte
dwControlKeyState . . . . . . 0000000C DWord
dwMousePosition . . . . . . . 00000000 DWord
dwButtonState . . . . . . . . 00000004 DWord
dwMouseControlKeyState . . . . 00000008 DWord
dwEventFlags . . . . . . . . . 0000000C DWord
dwSize . . . . . . . . . . . . 00000000 DWord
dwCommandId . . . . . . . . . 00000000 DWord
bSetFocus . . . . . . . . . . 00000000 DWord
KEY_EVENT_RECORD . . . . . . . . 00000010
bKeyDown . . . . . . . . . . . 00000000 DWord
wRepeatCount . . . . . . . . . 00000004 Word
wVirtualKeyCode . . . . . . . 00000006 Word
wVirtualScanCode . . . . . . . 00000008 Word
uChar . . . . . . . . . . . . 0000000A Word
UnicodeChar . . . . . . . . . 00000000 Word
AsciiChar . . . . . . . . . . 00000000 Byte
dwControlKeyState . . . . . . 0000000C DWord
MENU_EVENT_RECORD . . . . . . . 00000004
dwCommandId . . . . . . . . . 00000000 DWord
MOUSE_EVENT_RECORD . . . . . . . 00000010
dwMousePosition . . . . . . . 00000000 DWord
dwButtonState . . . . . . . . 00000004 DWord
dwMouseControlKeyState . . . . 00000008 DWord
dwEventFlags . . . . . . . . . 0000000C DWord
SMALL_RECT . . . . . . . . . . . 00000008
Left . . . . . . . . . . . . . 00000000 Word
Top . . . . . . . . . . . . . 00000002 Word
Right . . . . . . . . . . . . 00000004 Word
Bottom . . . . . . . . . . . . 00000006 Word
SYSTEMTIME . . . . . . . . . . . 00000010
wYear . . . . . . . . . . . . 00000000 Word
wMonth . . . . . . . . . . . . 00000002 Word
wDayOfWeek . . . . . . . . . . 00000004 Word
wDay . . . . . . . . . . . . . 00000006 Word
wHour . . . . . . . . . . . . 00000008 Word
wMinute . . . . . . . . . . . 0000000A Word
wSecond . . . . . . . . . . . 0000000C Word
wMilliseconds . . . . . . . . 0000000E Word
WINDOW_BUFFER_SIZE_RECORD . . . 00000004
dwSize . . . . . . . . . . . . 00000000 DWord
Segments and Groups:
N a m e Size Length Align Combine Class
FLAT . . . . . . . . . . . . . . GROUP
STACK . . . . . . . . . . . . . 32 Bit 00001000 Para Stack 'STACK'
_DATA . . . . . . . . . . . . . 32 Bit 00000300 Para Public 'DATA'
_TEXT . . . . . . . . . . . . . 32 Bit 000002AC Para Public 'CODE'
Procedures, parameters, and locals:
N a m e Type Value Attr
CloseFile . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
CloseHandle . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Clrscr . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
CreateFileA . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
CreateOutputFile . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Crlf . . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Delay . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
DumpMem . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
DumpRegs . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ExitProcess . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
FileTimeToDosDateTime . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
FileTimeToSystemTime . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
FlushConsoleInputBuffer . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
FormatMessageA . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetCommandLineA . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetCommandTail . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetConsoleCP . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetConsoleCursorInfo . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetConsoleMode . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetConsoleScreenBufferInfo . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetDateTime . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetFileTime . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetKeyState . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetLastError . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetLocalTime . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetMaxXY . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetMseconds . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetNumberOfConsoleInputEvents . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetProcessHeap . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetStdHandle . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetSystemTime . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetTextColor . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
GetTickCount . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Gotoxy . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
HeapAlloc . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
HeapCreate . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
HeapDestroy . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
HeapFree . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
HeapSize . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
IsDigit . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
LocalFree . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
MessageBoxA . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
MsgBoxAsk . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
MsgBox . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
OpenInputFile . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ParseDecimal32 . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ParseInteger32 . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
PeekConsoleInputA . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Random32 . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
RandomRange . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Randomize . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadChar . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadConsoleA . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadConsoleInputA . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadDec . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadFile . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadFloat . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadFromFile . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadHex . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadInt . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadKeyFlush . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadKey . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadString . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ReadVal . . . . . . . . . . . . P Near 00000110 _TEXT Length= 00000120 Public STDCALL
valid . . . . . . . . . . . . Byte bp - 00000001
numInt . . . . . . . . . . . . DWord bp - 00000008
sign . . . . . . . . . . . . . DWord bp - 0000000C
bytesRead . . . . . . . . . . DWord bp - 00000010
_validateDigits . . . . . . . L Near 0000014F _TEXT
_endTryAgain . . . . . . . . . L Near 00000193 _TEXT
_notEmpty . . . . . . . . . . L Near 000001AD _TEXT
_setNegative . . . . . . . . . L Near 000001BD _TEXT
_checkLength . . . . . . . . . L Near 000001C4 _TEXT
_loadNext . . . . . . . . . . L Near 000001DD _TEXT
_aggregateNum . . . . . . . . L Near 000001DF _TEXT
_readDigit . . . . . . . . . . L Near 000001DF _TEXT
_notDigitOrTooLarge . . . . . L Near 00000204 _TEXT
_continueRead . . . . . . . . L Near 00000217 _TEXT
SetConsoleCursorInfo . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetConsoleCursorPosition . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetConsoleMode . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetConsoleScreenBufferSize . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetConsoleTextAttribute . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetConsoleTitleA . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetConsoleWindowInfo . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetFilePointer . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetLocalTime . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SetTextColor . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
ShowFPUStack . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Sleep . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
StrLength . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Str_compare . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Str_copy . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Str_length . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Str_trim . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
Str_ucase . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
SystemTimeToFileTime . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WaitMsg . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteBinB . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteBin . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteChar . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteConsoleA . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteConsoleOutputAttribute . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteConsoleOutputCharacterA . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteDec . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteFile . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteFloat . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteHexB . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteHex . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteInt . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteStackFrameName . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteStackFrame . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteString . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteToFile . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
WriteVal . . . . . . . . . . . . P Near 00000230 _TEXT Length= 0000007C Public STDCALL
signed . . . . . . . . . . . . Byte bp - 00000001
digits . . . . . . . . . . . . Byte bp - 0000000D
strNum . . . . . . . . . . . . Byte bp - 00000019
_storeDigits . . . . . . . . . L Near 00000257 _TEXT
_terminateDigits . . . . . . . L Near 0000027C _TEXT
_reverseDigits . . . . . . . . L Near 00000289 _TEXT
WriteWindowsMsg . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
main . . . . . . . . . . . . . . P Near 00000000 _TEXT Length= 00000110 Public STDCALL
_readLoop . . . . . . . . . . L Near 0000002E _TEXT
_writeLoop . . . . . . . . . . L Near 0000009F _TEXT
_alreadyFloored . . . . . . . L Near 000000E1 _TEXT
printf . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External C
scanf . . . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External C
wsprintfA . . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External C
Symbols:
N a m e Type Value Attr
@CodeSize . . . . . . . . . . . Number 00000000h
@DataSize . . . . . . . . . . . Number 00000000h
@Interface . . . . . . . . . . . Number 00000003h
@Model . . . . . . . . . . . . . Number 00000007h
@code . . . . . . . . . . . . . Text _TEXT
@data . . . . . . . . . . . . . Text FLAT
@fardata? . . . . . . . . . . . Text FLAT
@fardata . . . . . . . . . . . . Text FLAT
@stack . . . . . . . . . . . . . Text FLAT
ALT_MASK . . . . . . . . . . . . Number 00000003h