From: Keates, Mark (Mark.Keates_at_dendrite.com)
Date: 2001-08-02 20:06:02
Dear all, > The label file will contain all labels from modules that are > assembled with -g > (debug info). So the feature you're requesting is already > there - just use -g > for the compiler and assembler and you will get what you want. Thanks, exactly what I wanted. > The only drawback is currently that the file will include all symbols > regardless of the type, so it is not possible to distinguish > a zero page address from the symbol definition "blank = $20". This would > be not too difficult to add once there are emulators capable of using > this information. Surely the fact the address < $100 identifies this? I think it can be left to the emulator import process to work this out. > If you are adding label information, you may also think about > adding source level debugging: Whoa, how would that work? Map address ranges to filename/line pairs? Or even as far as statement start/end position within a line? E.g. for (i=0; i<max; i++) or x = 0; x += y; y--; That should be enough info to parse into an emulator, e.g. 'C' code: void script_char (zchar c) { /* This is line 50 */ if (c == ZC_INDENT && script_width != 0) c = ' '; if (c == ZC_INDENT) { script_char (' '); script_char (' '); script_char (' '); return; } etc... 'S' code: _script_char: .LINEPOS 51,8,21 ldx #$00 lda (sp,x) cmp #$09 bne L005D .LINEPOS 51,26,42 lda _script_width+0 ora _script_width+0+1 bne L005C .LINEPOS 51,4,43 L005D: lda #$00 beq L005B L005C: lda #$01 L005E: beq L005B .LINEPOS 52,1,7 lda #$20 ldy #$00 sta (sp),y L005B: .LINEPOS 54,8,21 ldx #$00 lda (sp,x) cmp #$09 .LINEPOS 54,4,22 bne L0061 .LINEPOS 55,16,18 lda #$20 jsr pusha .LINEPOS 55,3,19 jsr _script_char .LINEPOS 55,35,37 lda #$20 jsr pusha .LINEPOS 55,22,38 jsr _script_char .LINEPOS 55,54,56 lda #$20 jsr pusha .LINEPOS 55,41,57 jsr _script_char .LINEPOS 55,60 jmp incsp1 etc... (how this affects the .o file I wouldn't like to say ;-) (assuming _script_char was at $0900) The resulting info required by the emulator would be: $0900-$0907:51,8,21 $0908-$090E:51,26,42 etc. (if start/end positions are too hard then just line #s will do) For just an assembler file this could be: $0900-$0901:101 $0902-$0903:102 $0904-$0905:103 $0906-$0907:104 This begs the question "What if I'm writing both C and assembler?" I would recommend that the C file generates the above syntax, but for assembler programming the .LINEPOS could be allowed to have no arguments, e.g. use the current line number (and pos=0). I think you'll might also need something to end a range. _script_char: (assume this is line 100) .LINEPOS ldx #$00 lda (sp,x) cmp #$09 bne L005D lda _script_width+0 ora _script_width+0+1 bne L005C L005D: lda #$00 beq L005B L005C: lda #$01 L005E: beq L005B .LINEPOS lda #$20 ldy #$00 sta (sp),y L005B: .LINEPOS ldx #$00 lda (sp,x) $0900-$0917:101 $0918-$091D:116 $091E-$09xx:121 Is it overkill for the assembler to generate a range for each line of code? This clogs up emulator memory/serach time. (but then again this is running on a well spec'd PC). E.g. _script_char: ldx #$00 lda (sp,x) cmp #$09 bne L005D $0900-$0901:101 $0902-$0903:102 $0904-$0905:103 $0906-$0907:104 Then, how do you determine whether the emulator should load the 'C' file or the 'S' file (as 'C' compiles to 'S' assembles to 'O') to highlight the code being executed? This would have to be specified in the assembler file's header, e.g. similar to '.debuginfo<tab>off' use '.sourcefile<tab>filename.c' If this isn't specified then the current filename is implied. As with GDB you'll also need to give the emulator as search path for debug files! Food for thought? Mark ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:40 CET