ToolsMenu/sprintf.asm

46 líneas
1.3 KiB
NASM
Archivo Ejecutable

; ToolsMenu - Add tools to the Workbench Tools menu
;
; Copyright (C) 2015, 2018 Kim Fastrup Larsen
;
; This program is free software: you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation, either ver-
; sion 3 of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be use-
; ful, but WITHOUT ANY WARRANTY; without even the implied war-
; ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
; See the GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public Li-
; cense along with this program. If not, see
; <http://www.gnu.org/licenses/>.
;
; The author can be contacted on <kimflarsen@hotmail.com>
;
; Simple version of the C "sprintf" function. Assumes C-style
; stack-based function conventions.
XDEF _sprintf
XREF _AbsExecBase
XREF _LVORawDoFmt
_sprintf:
movem.l a2/a3/a6,-(sp)
move.l 4*4(sp),a3 ; Get the output string pointer
move.l 5*4(sp),a0 ; Get the FormatString pointer
lea.l 6*4(sp),a1 ; Get the pointer to the DataStream
lea.l stuffChar(pc),a2
move.l _AbsExecBase,a6
jsr _LVORawDoFmt(a6)
movem.l (sp)+,a2/a3/a6
rts
; PutChProc used by RawDoFmt
stuffChar:
move.b d0,(a3)+
rts