<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 16 Mar 2006 08:51:39 +0000
From   : Fragula <fragula@...>
Subject: TSX/TXS (Was: 1MHZ SCSI/ATA board)

David Harper wrote:

 > How much have you good folk used the idea when writing 6502 code?

Not a heck of a lot. But have used it is in this (a BBC B ROM image
which is a combined Language, Service and Things ROM, that I found a
week or so ago).

I'm trying to wrap my head around this source, tidy it up and comment it
out to do a "GPL" release, TSX/TXS are used a handfull of times. In a
"register + stack display" bit of debug code that is normally switched
off, and also here.

SCP="Service Code Parser" (bad name i agree, but kinda does what it
says on the box, and I coulnd't be arsed getting a thesaurus.

SJT="Service Jump Table"

JVEC="Jump Vector"

Code was last breathed on in maybe 1993/1994 at latestSo memory is
perhaps a /tadge/ rusty.
;
; The Service Code Parser - but I can't quite remember how it works...
; ... so bear with my if my comments are crap.
;
SCP           PHP                      ; We need to preserve regs.
              PHA                      ; as we pass the codes on
              TXA                      ; if we don't have a use
              PHA                      ; for them ourselves.
              TYA                      ; Watch the pointer.
              PHA                      ; SP=+4
              TSX                      ; Transfer Stack pointer into X?
              LDA &103,X           ; WTF, exactly, is at &103? Its                                             ; the
stack, but? Ahhh...
              AND #&F                      ; We are getting a code off                                                     ; the stack,
limiting it, then
              ASL A                    ; multiplying it by two and                                                     ; putting it in X,
              TAX                      ; because we are using it to                                                    ; index a
16-bitx 16 jump                                                        ; table pointing at service
              LDA SJT,X                        ; routintes. Maybe.
              STA Jvec                 ;
              LDA SJT+1,X              ;
              STA Jvec+1               ;
              JMP (Jvec)               ;

Each of the routines pointed to by the service jump table entries have
one of two possible outcomes. "Serviced" or "Not Serviced", and jump to
one of two exit routines which "clean up" in one of two appropriate manners.

A friend looking over my shoulder called it a "PushmePullyou" (which of
course its not!) and thought it quite funny (but he's a Z80
spaghetti-coder, so wtf does he know?) after which I promptly named it a
"quirkafleeg". (Kudos, but no prizes for guessing where that came from...)

Cheers!

M.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>