bier@speedy.cs.wisc.edu (George Bier) (04/04/88)
Last week I finished Scott Kronick's "MPW and Assembly Language Programming" and after reading through the MPW Assembler Manual and Joel West's book I have some questions about the book. I am not sure, but it looks like there are some serious issues not examined in the book that I wanted to check with people with more experience. Typical Code from Kronick's book might look like: MAIN pea -4(a5) _InitGraf . . move.l d0, data2(a5) . . _ExitToShell DATA1: DC.l DATA2: DS.l A couple of questions 1) The pea -4(a5) is the normal start for programs written using the MDS assembler, which automatically starts global data at an offset of $-100. MPW does not. Therefore, although this code would work because there is no DATA segment, if there was a data segment then the quickdraw variables and the DATA segment would start at the same offsets since no space was explicitly set aside for the quickdraw variables. Question, is my understanding of the situation correct? 2) Again noting that there is no data segment, data2 takes the current value of the location counter. Then the move.l instruction shown is going to store at a positive offset on a5. As I understand Mac memory management, if this program had a jump table then the move.l would corrupt the jump table. Again, is my understanding of the situation correct? 3) Provided that the above is correct and that Kronick is not worrying about these issues because they are beyond the scope of the book, are these techniques valid, ie for MPW assembler programs that do not contain an explicit data segment and no jump table, can we simply assume that the space directly above and below a5 can be used for the quickdraw and global variables? I have a feeling that what is presented in the book is incorrect since there is the "finder startup handle" located at 16(a5). However provided that all positive offset are greater than 32 (which would be the start of the jump table), can a programmer get away with what is shown in the book? If so, is all 32k above and below a5 available? thanks --george