;***************************************************************************
; Title:        TestReport
; Author:       Martin Avison
; Copyright:     Martin Avison 2013
; Version:      0.01 (01 Jun 2013)
;
; Purpose:	Test the ObjAsm FNReport macro
;***************************************************************************

                TTL     > TestReport

                GET     hdr.RegNames
                GET     hdr.ReportMacro			; Reporter Macros
                GET     hdr.ReportSWI			; Reporter SWIs

                AREA    TestReport,CODE,READONLY

                ENTRY

;---------------------------------------------------------------------------
Start           B       Entry                   ; Entry instruction
                DCD     &79766748               ; Magic value 1
                DCD     &216C6776               ; Magic value 2
                DCD     End-Start               ; Read only size
                DCD     0                       ; Read/write size
                DCD     32                      ; 26 or 32 bit build

Entry
                STR     r14,[r13,#-4]!          ; Save Return address

; set registers to any known values
                 MOV       r0 ,#&00
                 MOV       r1 ,#&11
                 MOV       r2 ,#&22
                 MOV       r3 ,#&33
                 ADRL	   r4,Text
                 MOV       r5 ,#&55
                 MOV       r6 ,#&66
                 MOV       r7 ,#&77
                 MOV       r8 ,#&88
                 MOV       r9 ,#&99
                 MOV       r10,#&aa
                 MOV       r11,#&bb
                 MOV       r12,#&cc
;                 MOV       r13,#&dd needed for Functions !!
;                 MOV       r14,#&ee

; Note \ in text string cause problems unless --no_esc is specified
                FNReport "\Y \t Test Start  Printf Registers & Flags",&FFFF

                FNReport "\L String without parameters",0
                FNReport "\B Value as byte %1b end",0
                FNReport "\B Value as char %2c end",0
                FNReport "\B Value as num  %3d end",0
                FNReport "\B Value as int  %8i end",0
                FNReport "\B Value as uns  %8u end",0
                FNReport "\B Value as $ptr %4s end",0
                FNReport "\B Value as word %12x end",0
                FNReport "\B Values %1b %2c %3d %12x end",0
                FNReport "\B Values %1b %2c %3d %12x %4s with all lines",&FFFF
                FNReport "\B Values %1b %2c %3d %12x %4s with all lines no rnn",&1FFFF
                FNReport "\B Invalid...%1p...%16x...%44b...%age...end",0
                FNReport "\B Invalid...%1p...%16x...%44b...%age...end",&10000
                FNReport "\B \t <Basic$Crunch> Value as word %12x end",0
;               FNReport "\B""string"" Value as word %12x end",0
                FNReport "\B Percentage sign %",0
;               FNReport "",0
                FNReport "\Y #var~x=test",0
                FNReport "\Y Test hex 0 %0x end",0

; Note Condition codes can be in UPPER or lower case
                FNReport "<EQ>\L Cond eq",&8000
                FNReport "<ne>\R Cond ne",&8000
                FNReport "<LT>\L Cond lt",&8000
                FNReport "<ge>\L Cond ge",&8000
                FNReport "<ge>\V \t Entry %0x %4s",&f0

                LDR       pc,[r13],#4           ; go back to Return Address

                FNReportGen			; Generate Reporter code

Text            DCB   "This is some text"
                ALIGN

End
                END
