clownassembler icon indicating copy to clipboard operation
clownassembler copied to clipboard

Listing formatting issues

Open sikthehedgehog opened this issue 1 year ago • 0 comments

The listing introduces some formatting errors when including files. Here are a couple of examples I found while trying the assembler (included file and resulting portion of the listing)

Example 1

;*******************************************************************************
; Hardware addresses
;*******************************************************************************

HwVersion:          equ $A10001     ; Console region and version
TmssPort:           equ $A14000     ; Write "SEGA" to unlock VDP

VdpCtrl:            equ $C00004     ; VDP control port
VdpData:            equ $C00000     ; VDP data port

IoCtrl1P:           equ $A10009     ; 1P I/O control port
IoCtrl2P:           equ $A1000B     ; 2P I/O control port
IoData1P:           equ $A10003     ; 1P I/O data port
IoData2P:           equ $A10005     ; 2P I/O data port
0000000000000000                            
00000000                            
00000000                            
00000000                            
00000000                            HwVersion:          equ $A10001     
00000000                            TmssPort:           equ $A14000     
00000000                            
00000000                            VdpCtrl:            equ $C00004     
00000000                            VdpData:            equ $C00000     
00000000                            
00000000                            IoCtrl1P:           equ $A10009     
00000000                            IoCtrl2P:           equ $A1000B     
00000000                            IoData1P:           equ $A10003     
00000000                            IoData2P:           equ $A10005     
                            IoData2P:           equ $A10005     

Example 2

;*******************************************************************************
; EntryPoint
; Where the program boots.
;-------------------------------------------------------------------------------
; note: doesn't return
;*******************************************************************************

EntryPoint:
    move.w  #$2700, sr                  ; Disable interrupts
    
    moveq   #$0F, d0                    ; Disable TMSS if needed
    and.b   (HwVersion), d0
    beq.s   @NoTmss
    move.l  ($100).w, (TmssPort)
@NoTmss:
    
    bra.s   *                           ; Hang up

;*******************************************************************************
; ErrorInt
; Called if the program crashes.
;-------------------------------------------------------------------------------
; note: doesn't return
;*******************************************************************************

ErrorInt:
    move.w  #$2700, sr                  ; Disable interrupts
    bra.s   *                           ; Hang up
0000020000000200                            
00000200                            
00000200                            
00000200                            
00000200                            
00000200                            
00000200                            
00000200                            EntryPoint:
00000200 46FC 2700                      move.w  #$2700, sr                  
00000204                                
00000204 700F                           moveq   #$0F, d0                    
00000206 C039 00A1 0001                 and.b   (HwVersion), d0
0000020C 67FE                           beq.s   @NoTmss
0000020E 23F8 0100 00A1 4000            move.l  ($100).w, (TmssPort)
00000216                            @NoTmss:
00000216                                
00000216 60FE                           bra.s   *                           
00000218                            
00000218                            
00000218                            
00000218                            
00000218                            
00000218                            
00000218                            
00000218                            
00000218                            ErrorInt:
00000218 46FC 2700                      move.w  #$2700, sr                  
0000021C 60FE                           bra.s   *                           
                           bra.s   *                           

Issues

The issues I found so far:

  • The address of the included file is inserted as-is, without a newline (so it gets glued together to the address of the first included line).
  • Comments are removed, leaving those lines "blank" (which is both confusing and can make it harder to read when comparing against the original source code).
  • The last line is repeated, without an address.
  • The include line is removed (unless the included file is blank, for some reason).

EDIT: did I seriously write "linker" instead of "listing"? lol

sikthehedgehog avatar Apr 07 '24 04:04 sikthehedgehog