Date : Fri, 17 Mar 2006 13:29:37 +0000
From : Andy Armstrong <andy@...>
Subject: Re: 1MHZ SCSI/ATA board
On 16 Mar 2006, at 07:39, David Harper wrote:
> How much have you good folk used the idea when writing 6502 code?
Yeah, all the time :)
For example for things like this:
prstr php
pha
tya
pha
lda txptr
pha
lda txptr + 1
pha
tsx
lda stack + 6, x
sta txptr
lda stack + 7, x
sta txptr + 1
ldy #0
.prstr1 inc txptr
bne .prstr2
inc txptr + 1
.prstr2 lda (txptr), y
beq .prstr3
jsr oswrch
jmp .prstr1
.prstr3 lda txptr
sta stack + 6, x
lda txptr + 1
sta stack + 7, x
pla
sta txptr + 1
pla
sta txptr
pla
tay
pla
plp
rts
Which outputs an inline string and returns to the instruction after
the trailing null byte. Used like this
jsr prstr
!text "Hello, World", 13, 10, 0
rts
If anyone fancies it how about a quick competition for the shortest
version of the above code?
--
Andy Armstrong, hexten.net