Sunday, October 25, 2009 10:37 AM,
on Ooops! In the example I sent late last night, I made a change to the machine code and forgot to fix one line of assembly language code. In the example, A .FILL x400B should be A .FILL x4007 The machine code is correct. Yale Patt ====================== On Sun, Oct 25, 2009 at 05:18:50AM -0500, Yale N. Patt wrote: > > There still seems to be confusion among many students about the > pseudo-op .BLKW. If you feel you understand it, please feel free to > simply delete this message and move on. > > Now then: > > We showed in class last week when we assembled a program that when the > assembler sees .BLKW k, for example, the assembler simply reserves the > next k locations of memory before proceeding to the next assembly > language instruction. > > Example: > > .ORIG x4000 > AND R0,R0,#0 > ADD R1,R0,#1 > LD R7,A > STR R0,R7,#0 > ADD R7,R7,#1 > STR R1,R7,#0 > TRAP x25 > .BLKW 3 > A .FILL x400B > .END > > The assembler would go through this assembly language program, line by > line, and generate an object file as follows: > > x4000: 0101 000 000 1 00000 > x4001: 0001 001 000 1 00001 > x4002: 0010 111 000000111 > x4003: **** 000 111 000000 ; My book is not with me, so I can not look STR ! > x4004: 0001 111 111 1 00001 > x4005: **** 001 111 1 00000 > x4006: 1111 0000 0010 0101 > x4007: reserved space, nothing of consequence stored here > x4008: reserved space, nothing of consequence stored here > x4009: reserved space, nothing of consequence stored here > x400A: 0100 0000 0000 0111 > > When the program executes, it would store the value 0 into x4007 and > the value 1 into x4008. Memory location x4009 would still be > unspecified when the program halts. > > Hope this helps. > Yale Patt