home *** CD-ROM | disk | FTP | other *** search
-
- ;
- ; Copyright (c) 1988 Commodore-Amiga, Inc.
- ;
- ; Executables based on this information may be used in software
- ; for Commodore Amiga computers. All other rights reserved.
- ;
- ; This information is provided "as is"; no warranties are made.
- ; All use is at your own risk, and no liability or responsibility is assumed.
- ;
-
- ;===========================================================================
- ; MACRO to provide a printf debugging call, use it like the 'C' version. ie.
- ;
- ; printf <'value=%ld pointer=%lx count=%d\n'>,d0,a0,d1
- ; printf <'program name = %s\n'>,#ProgName
- ; printf <'port name = %s\n'>,a0
- ; printf <'character received = \t%c\n'>,d0
- ; printf <'Program length = %d\n'>,#(ProgEnd-ProgStart)
- ; printf <'%c'>,#7
- ; printf <'ffp value = %f\n'>,d0
- ;
- ; No initialisation or cleanup is nescessary because this is done every
- ; time the printf code is called. The only initialisation needed to use
- ; the printf call is to invoke the DEBUGENABLE macro at the beginning of
- ; the module in which you want to use it. This just equates a constant
- ; (called DEBUG_CODE) to 1 so that the printf macro expands the call.
- ;==========================================================================
- printf MACRO
- IFD DEBUG_CODE ; only if DEBUGENABLE called
- NOLIST
- ; first stack up to eight arguments for the printf routine
- IFGE NARG-9
- LIST
- move.l \9,-(sp) ; stack arg8
- NOLIST
- ENDC
- IFGE NARG-8
- LIST
- move.l \8,-(sp) ; stack arg7
- NOLIST
- ENDC
- IFGE NARG-7
- LIST
- move.l \7,-(sp) ; stack arg6
- NOLIST
- ENDC
- IFGE NARG-6
- LIST
- move.l \6,-(sp) ; stack arg5
- NOLIST
- ENDC
- IFGE NARG-5
- LIST
- move.l \5,-(sp) ; stack arg4
- NOLIST
- ENDC
- IFGE NARG-4
- LIST
- move.l \4,-(sp) ; stack arg3
- NOLIST
- ENDC
- IFGE NARG-3
- LIST
- move.l \3,-(sp) ; stack arg2
- NOLIST
- ENDC
- IFGE NARG-2
- LIST
- move.l \2,-(sp) ; stack arg1
- NOLIST
- ENDC
- ; Now the actual printf call itself, only if there is an argument string
- IFGE NARG-1
- STKOFF SET NARG<<2 ; actual stack space used
- XREF _printf ; in case not used before
- LIST
- pea.l str\@ ; push string address
- jsr _printf ; call printf function
- lea.l STKOFF(sp),sp ; scrap stuff on stack
- NOLIST
- DATA ; put in data section
- str\@ dc.b \1,0 ; the actual string
- CNOP 0,2
- CODE ; change this for other sects
- ENDC
- LIST
- ENDC ; end DEBUG_CODE conditional
- ENDM
-
- ;===========================================================================
- ; MACRO to enable all of the debug routines. If not called, no extra code.
- ;===========================================================================
-
- DEBUGENABLE MACRO
- DEBUG_CODE SET 1
- ENDM
-