modified PRIMM to preserve .Y

This commit is contained in:
FeralChild64 committed 2020-12-15 23:01:40 +01:00
1 parent 0190a0300c
commit 655fbd96e7
2 files changed
+7 -3

No files matched your search

+3 -1
View File
@@ -2,7 +2,7 @@
;; #LAYOUT# * * #IGNORE ;; #LAYOUT# * * #IGNORE
; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02 ; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02, modified to preserve .Y
; see http://www.6502.org/source/io/primm.htm ; see http://www.6502.org/source/io/primm.htm
@@ -12,6 +12,7 @@ PRIMM:
sta PTR1 sta PTR1
pla ; get high part of (string address-1) pla ; get high part of (string address-1)
sta PTR2 sta PTR2
phy
+bra @2 +bra @2
@1: @1:
jsr JCHROUT ; output a string char jsr JCHROUT ; output a string char
@@ -23,6 +24,7 @@ PRIMM:
ldy #$00 ldy #$00
lda (PTR1), y ; get string char lda (PTR1), y ; get string char
bne @1 ; output and continue if not NUL bne @1 ; output and continue if not NUL
ply
lda PTR2 lda PTR2
pha pha
lda PTR1 lda PTR1
+4 -2
View File
@@ -1,4 +1,4 @@
; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02 ; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02, modified to preserve .Y
; see http://www.6502.org/source/io/primm.htm ; see http://www.6502.org/source/io/primm.htm
PRIMM: PRIMM:
@@ -7,9 +7,10 @@ PRIMM:
sta PTR1 sta PTR1
pla ; get high part of (string address-1) pla ; get high part of (string address-1)
sta PTR2 sta PTR2
phy
+bra @2 +bra @2
@1: @1:
jsr CHROUT ; output a string char jsr CHROUT ; output a string char
@2: @2:
inc PTR1 ; advance the string pointer inc PTR1 ; advance the string pointer
bne @3 bne @3
@@ -18,6 +19,7 @@ PRIMM:
ldy #$00 ldy #$00
lda (PTR1), y ; get string char lda (PTR1), y ; get string char
bne @1 ; output and continue if not NUL bne @1 ; output and continue if not NUL
ply
lda PTR2 lda PTR2
pha pha
lda PTR1 lda PTR1