diff options
author | B. Watson <yalhcru@gmail.com> | 2019-03-13 02:50:42 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2019-03-13 02:50:42 -0400 |
commit | 2973d0c78e9b8eed3c5af239927c6bd36af64604 (patch) | |
tree | a0fdfe7201303edd11c6d86015ef4f79796fcf0f /src/new_format_ip.s | |
download | fujichat-2973d0c78e9b8eed3c5af239927c6bd36af64604.tar.gz |
initial commit
Diffstat (limited to 'src/new_format_ip.s')
-rw-r--r-- | src/new_format_ip.s | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/new_format_ip.s b/src/new_format_ip.s new file mode 100644 index 0000000..5fab2ba --- /dev/null +++ b/src/new_format_ip.s @@ -0,0 +1,54 @@ + .fopt compiler,"cc65 v 2.12.9" + .setcpu "6502" + .smart on + .autoimport on + .case on + .debuginfo off + .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 + .macpack longbranch + .export _new_format_ip + + .segment "BSS" +buf: + .res 20,$0 + + .segment "RODATA" +fmt: .byte "%d.%d.%d.%d", 0 + +; unsigned char* __fastcall__ format_ip (__near__ unsigned int[2]*) + .segment "CODE" +_new_format_ip: + sta ptr1 + stx ptr1+1 + + lda #<buf + ldx #>buf + jsr pushax + + lda #<fmt + ldx #>fmt + jsr pushax + + ldy #0 + lda (ptr1),y + jsr pusha0 + + ldy #1 + lda (ptr1),y + jsr pusha0 + + ldy #2 + lda (ptr1),y + jsr pusha0 + + ldy #3 + lda (ptr1),y + jsr pusha0 + + ldy #$0c + jsr _sprintf + + lda #<buf + ldx #>buf + + rts |