paintchars Fonts02 Does this look right?
Simon Willcocks (1499) 513 posts |
I was trying to find what I’ve messed up such that each character of a string text all appears plotted at the same (wrong) place, and I came across this. ; set up terminating address of string from R7, else use -1 if R2 bit 7 clear MOV wrchbase,R1 ; wrchbase (R11) -> points to string TST R2,#paint_length ADDNE R7,wrchbase,R7 MOVEQ R7,#&FFFFFFFF ; must use unsigned comparison, and ignore V set STR R7,paintendaddress ; convert coordinates to millipoints (input units depend on R2 bits 4,5) Push "ycoord,xcoord" ; these are pulled MUCH later! TST R2,#paint_osunits ; 1 ==> convert to 1/72000th" STREQ R3,xco72 ; coords in 1/72000th inch STREQ R4,yco72 The problem is that xcoord is R8 (OK) and ycoord is R7, which is now the pointer to the end of the string or all ones. This value gets carefully preserved on the stack for later use… R3 and R4 actually contain the x and y coordinates I want, in OS units, and the conversion is done after the push… A disassembly, annotated: fc2677b8: e1a0b001 mov fp, r1 fc2677bc: e3120080 tst r2, #128 ; 0x80 fc2677c0: 108b7007 addne r7, fp, r7 fc2677c4: 03e07000 mvneq r7, #0 fc2677c8: e58c74c4 str r7, [ip, #1220] ; 0x4c4 paintendaddress fc2677cc: e92d0180 push {r7, r8} ycoord,xcoord fc2677d0: e3120010 tst r2, #16 paintosunits fc2677d4: 058c33ac streq r3, [ip, #940] ; 0x3ac fc2677d8: 058c43b0 streq r4, [ip, #944] ; 0x3b0 fc2677dc: 0b00022d bleq fc268098 calcxcoord It doesn’t seem to cause any problems, but I can’t see what’s going on. The code is at 0xfc2677b8 in 5.28, (19-Oct-20). |
Stuart Swales (8827) 1357 posts |
Another interpretation is that it’s pushing whichever registers xcoord,ycoord happen to be in order to avoid them being corrupted by the subsequent millipoint calculation? |
Simon Willcocks (1499) 513 posts |
I think it’s probably redundant debug information; the only thing that happens to it (unless its input to a function) is that it may be used for debug output. |