Microsoft (R) Macro Assembler Version 6.11 04/13/02 13:27:01 p6temp.asm Page 1 - 1 .model small .386 .stack 100h if1 include mymacs.inc ; Get the file with the macros C ;; Starter macros for the p6temp.asm program C C ;; Display a null terminated string that is stored in memory C ;; Verifies that the operand is a memory reference; uses C ;; Irvine's library to display C C showstring macro first C push dx C if ((opattr first) and 0002h) eq 0 C echo Operand must be a memory reference C .err C exitm C endif C mov dx, offset first C call Writestring C pop dx C endm C C C ;; Display a double word unsigned integer that is held in the operand C ;; Verifies that the operand is not already EAX, then moves C ;; the value there for Irvine's library routine C C shownumber macro first C push eax C push bx C mov bx, 10 C ifdif , C mov eax, first C endif C call Writelong C pop bx C pop eax C endm C C C ;; Outputs a carriage return and line feed C ;; Uses Irvine's library routine C C newline macro C call crlf C endm C endif 0000 .data 0000 54 68 65 73 65 20 start db "These are my results",0 61 72 65 20 6D 79 20 72 65 73 75 6C 74 73 00 0015 0000002D 00000032 highs dd 45, 50, 49, 56, 53, 60, 44, 34, 38, 50 00000031 00000038 00000035 0000003C 0000002C 00000022 00000026 00000032 003D 00000021 0000001E lows dd 33, 30, 38, 40, 35, 44, 30, 29, 30, 31 00000026 00000028 00000023 0000002C 0000001E 0000001D 0000001E 0000001F 0065 000A [ diffs dd 10 dup(?) 00000000 ] 008D 00000000 highest dd ? 0091 00000000 total dd ? 0095 54 6F 74 61 6C 20 tlabel db "Total differences ",0 64 69 66 66 65 72 65 6E 63 65 73 20 00 00A8 54 68 65 20 68 69 hlabel db "The highest temperature is ", 0 67 68 65 73 74 20 74 65 6D 70 65 72 61 74 75 72 65 20 69 73 20 00 00C4 54 68 65 20 6C 6F llabel db "The lowest temperature is ", 0 77 65 73 74 20 74 65 6D 70 65 72 61 74 75 72 65 20 69 73 20 00 00DF 54 68 65 20 64 69 dlabel db "The differences are:",0 66 66 65 72 65 6E 63 65 73 20 61 72 65 3A 00 00F4 0064 [ header db 100 dup(?) 00 ] 0000 .code extern Writestring:proc, Writelong:proc, crlf:proc 0000 main proc gmov ds, @data p6temp.asm(24): error A2008: syntax error : ds gmov cx, 10 p6temp.asm(25): error A2008: syntax error : cx gmov highest, highs ; Init highest p6temp.asm(26): error A2008: syntax error : gmov gmov eax, lows ; Init lowest p6temp.asm(27): error A2008: syntax error : eax gmov total, 0 ; Init difference total p6temp.asm(28): error A2008: syntax error : gmov gmov si, 0 ; Init array position p6temp.asm(29): error A2008: syntax error : si 0000 top: sub3 diffs[si], highs[si], lows[si] ; Get difference p6temp.asm(31): error A2008: syntax error : diffs add2 total, diffs[si] ; Add to total p6temp.asm(32): error A2008: syntax error : total gcmp highs[si], highest ; Check for new high p6temp.asm(33): error A2008: syntax error : highs 0000 7E 00 jng skip gmov highest, highs[si] p6temp.asm(35): error A2008: syntax error : highest 0002 skip: gcmp lows[si], eax ; Check for new low p6temp.asm(37): error A2008: syntax error : lows 0002 7D 00 jnl hop gmov eax, lows[si] p6temp.asm(39): error A2008: syntax error : eax 0004 hop: add2 si, 4 ; On to next entries p6temp.asm(41): error A2008: syntax error : si 0004 E2 FA loop top smov header, start p6temp.asm(43): error A2008: syntax error : smov showstring header ; Display heading 0006 52 1 push dx 0007 BA 00F4 R 1 mov dx, offset header 000A E8 0000 E 1 call Writestring 000D 5A 1 pop dx newline 000E E8 0000 E 1 call crlf showstring tlabel ; Display total differences 0011 52 1 push dx 0012 BA 0095 R 1 mov dx, offset tlabel 0015 E8 0000 E 1 call Writestring 0018 5A 1 pop dx shownumber total 0019 66| 50 1 push eax 001B 53 1 push bx 001C BB 000A 1 mov bx, 10 001F 66| A1 0091 R 1 mov eax, total 0023 E8 0000 E 1 call Writelong 0026 5B 1 pop bx 0027 66| 58 1 pop eax newline 0029 E8 0000 E 1 call crlf showstring hlabel ; Display highest temperature 002C 52 1 push dx 002D BA 00A8 R 1 mov dx, offset hlabel 0030 E8 0000 E 1 call Writestring 0033 5A 1 pop dx shownumber highest 0034 66| 50 1 push eax 0036 53 1 push bx 0037 BB 000A 1 mov bx, 10 003A 66| A1 008D R 1 mov eax, highest 003E E8 0000 E 1 call Writelong 0041 5B 1 pop bx 0042 66| 58 1 pop eax newline 0044 E8 0000 E 1 call crlf showstring llabel ; Display lowest temperature 0047 52 1 push dx 0048 BA 00C4 R 1 mov dx, offset llabel 004B E8 0000 E 1 call Writestring 004E 5A 1 pop dx shownumber eax 004F 66| 50 1 push eax 0051 53 1 push bx 0052 BB 000A 1 mov bx, 10 0055 E8 0000 E 1 call Writelong 0058 5B 1 pop bx 0059 66| 58 1 pop eax newline 005B E8 0000 E 1 call crlf showstring dlabel ; Display all differences 005E 52 1 push dx 005F BA 00DF R 1 mov dx, offset dlabel 0062 E8 0000 E 1 call Writestring 0065 5A 1 pop dx newline 0066 E8 0000 E 1 call crlf gmov cx, 10 p6temp.asm(57): error A2008: syntax error : cx gmov si, 0 p6temp.asm(58): error A2008: syntax error : si 0069 round: shownumber diffs[si] ; One difference per line 0069 66| 50 1 push eax 006B 53 1 push bx 006C BB 000A 1 mov bx, 10 006F 66| 8B 84 0065 R 1 mov eax, diffs[si] 0074 E8 0000 E 1 call Writelong 0077 5B 1 pop bx 0078 66| 58 1 pop eax newline 007A E8 0000 E 1 call crlf add2 si, 4 p6temp.asm(62): error A2008: syntax error : si 007D E2 EA loop round gmov ax, 4c00h p6temp.asm(64): error A2008: syntax error : ax 007F CD 21 int 21h 0081 main endp end main Microsoft (R) Macro Assembler Version 6.11 04/13/02 13:27:01 p6temp.asm Symbols 2 - 1 Macros: N a m e Type newline . . . . . . . . . . . . Proc shownumber . . . . . . . . . . . Proc showstring . . . . . . . . . . . Proc Segments and Groups: N a m e Size Length Align Combine Class DGROUP . . . . . . . . . . . . . GROUP _DATA . . . . . . . . . . . . . 16 Bit 0158 Word Public 'DATA' STACK . . . . . . . . . . . . . 16 Bit 0100 Para Stack 'STACK' _TEXT . . . . . . . . . . . . . 16 Bit 0081 Word Public 'CODE' Procedures, parameters and locals: N a m e Type Value Attr main . . . . . . . . . . . . . . P Near 0000 _TEXT Length= 0081 Public top . . . . . . . . . . . . . L Near 0000 _TEXT skip . . . . . . . . . . . . . L Near 0002 _TEXT hop . . . . . . . . . . . . . L Near 0004 _TEXT round . . . . . . . . . . . . L Near 0069 _TEXT Symbols: N a m e Type Value Attr @CodeSize . . . . . . . . . . . Number 0000h @DataSize . . . . . . . . . . . Number 0000h @Interface . . . . . . . . . . . Number 0000h @Model . . . . . . . . . . . . . Number 0002h @code . . . . . . . . . . . . . Text _TEXT @data . . . . . . . . . . . . . Text DGROUP @fardata? . . . . . . . . . . . Text FAR_BSS @fardata . . . . . . . . . . . . Text FAR_DATA @stack . . . . . . . . . . . . . Text DGROUP Writelong . . . . . . . . . . . L Near 0000 _TEXT External Writestring . . . . . . . . . . L Near 0000 _TEXT External crlf . . . . . . . . . . . . . . L Near 0000 _TEXT External diffs . . . . . . . . . . . . . DWord 0065 _DATA dlabel . . . . . . . . . . . . . Byte 00DF _DATA header . . . . . . . . . . . . . Byte 00F4 _DATA highest . . . . . . . . . . . . DWord 008D _DATA highs . . . . . . . . . . . . . DWord 0015 _DATA hlabel . . . . . . . . . . . . . Byte 00A8 _DATA llabel . . . . . . . . . . . . . Byte 00C4 _DATA lows . . . . . . . . . . . . . . DWord 003D _DATA start . . . . . . . . . . . . . Byte 0000 _DATA tlabel . . . . . . . . . . . . . Byte 0095 _DATA total . . . . . . . . . . . . . DWord 0091 _DATA 0 Warnings 18 Errors