1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-26 07:29:25 +00:00

The %p format specifier was missing

git-svn-id: svn://svn.cc65.org/cc65/trunk@1198 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-03-17 16:50:35 +00:00
parent cf23f0937c
commit f901555264

View File

@ -259,7 +259,7 @@ Save: lda regbank,y
sta Format sta Format
stx Format+1 stx Format+1
jsr popax ; Output descriptor jsr popax ; Output descriptor
sta OutData sta OutData
stx OutData+1 stx OutData+1
@ -527,7 +527,7 @@ CheckInt:
; Integer argument ; Integer argument
jsr GetSignedArg ; Get argument as a long jsr GetSignedArg ; Get argument as a long
ldy sreg+1 ; Check sign ldy sreg+1 ; Check sign
bmi @Int1 bmi @Int1
ldy Leader ldy Leader
@ -562,29 +562,44 @@ CheckCount:
CheckOctal: CheckOctal:
cmp #'o' cmp #'o'
bne CheckString bne CheckPointer
; Integer in octal representation ; Integer in octal representation
jsr GetSignedArg ; Get argument as a long jsr GetSignedArg ; Get argument as a long
ldy AltForm ; Alternative form? ldy AltForm ; Alternative form?
beq @Oct1 ; Jump if no beq @Oct1 ; Jump if no
pha ; Save low byte of value pha ; Save low byte of value
stx tmp1 stx tmp1
ora tmp1 ora tmp1
ora sreg ora sreg
ora sreg+1 ora sreg+1
ora Prec ora Prec
ora Prec+1 ; Check if value or Prec != 0 ora Prec+1 ; Check if value or Prec != 0
beq @Oct1 beq @Oct1
lda #'0' lda #'0'
jsr PutBuf jsr PutBuf
pla ; Restore low byte pla ; Restore low byte
@Oct1: ldy #8 ; Load base @Oct1: ldy #8 ; Load base
jsr ltoa ; Push arguments, call _ltoa jsr ltoa ; Push arguments, call _ltoa
jmp HaveArg jmp HaveArg
; Check for a pointer specifier (%p)
CheckPointer:
cmp #'p'
bne CheckString
; It's a pointer. Use %#x conversion
ldx #0
stx IsLong ; IsLong = 0;
inx
stx AltForm ; AltForm = 1;
lda #'x'
bne IsHex ; Branch always
; Check for a string specifier (%s) ; Check for a string specifier (%s)
CheckString: CheckString:
@ -615,13 +630,13 @@ CheckUnsigned:
CheckHex: CheckHex:
cmp #'x' cmp #'x'
beq @IsHex beq IsHex
cmp #'X' cmp #'X'
bne UnknownFormat bne UnknownFormat
; Hexadecimal integer ; Hexadecimal integer
@IsHex: pha ; Save the format spec IsHex: pha ; Save the format spec
lda AltForm lda AltForm
beq @L1 beq @L1
lda #'0' lda #'0'
@ -641,7 +656,7 @@ CheckHex:
jsr _strlower ; Make characters lower case jsr _strlower ; Make characters lower case
@L2: jmp HaveArg @L2: jmp HaveArg
; Unsigned format character, skip it ; Unknown format character, skip it
UnknownFormat: UnknownFormat:
jmp MainLoop jmp MainLoop