What are the thoughts of the more experienced 6502 hackers here?
EDIT: Hah! saved by Google's cache
Code: Select all
___
/ __|__
/ / |_/ Groetjes, Ruud
\ \__|_\
\___| URL: www.baltissen.org
Code: Select all
entry from BRK instruction
SW16 ldy $0106,x ;INIT SWEET16 PC
lda $0105,x ;ADDRESS
sec
sbc #2
bcs sw16a
dey
sw16a sty R15H
sta R15L
changes to RTN instruction
RTNZ pla
pla
tsx
lda R15L
sta $0105,x
lda R15H
sta $0106,x
pla
tay
pla
tax
pla
rti
Code: Select all
;--------------------------------------------------------------
;
; DHASH! ( LFAnew hash1 -- )
;
; links the current LFA onto the top of this hash' thread
;
; When we're done, the word whose LFAnew is on the stack will become
; the new top of this hash thread, and the new word's LFA will link
; to the previous top of the chain.
;
; sweet16 saved 51 bytes vs. 6502
;
;dhashstorelfa .word $adde
; .byt (dhashstore-*-1)|bit7
; .asc "DHASH","!"|bit7
dhashstore ldy #1
jsr setup ; LFAnew -> N0
brk
.byt set | R11
.word lfalist
.byt sub | ACC
.byt st | N2 ; 0 -> N2
.byt ld | R11
.byt add | TOS
.byt add | TOS
.byt st | R11 ; R11+hash1*2 -> R11
.byt ldd | R11
.byt popd | R11 ; back up the pointer
.byt bnz, <(dhashstore01-*-2)
.byt set | ACC
.word rootlfa
.byt std | R11
.byt popd | R11
dhashstore01 .byt st | N1 ; head -> N1
.byt rtn
ldy #2
lda (n),y
and #$1f
sta n+7 ; length of name being inserted
dhashstore02 lda (n+2),y
and #$1f
sta n+6
lda n+7
cmp n+6 ; compare lengths
bcc dhashstore05
bne dhashstore04
;sec
adc #1
tay ; last char in names
dhashstore03 lda (n),y
eor (n+2),y
asl ; compare char ignoring bit7
bne dhashstore04
dey
cpy #2
bne dhashstore03 ; stop at first char
dey
brk
.byt set | ACC
.word $adde
.byt std | N1
.byt rtn
dhashstore04 brk
.byt ld | N1
.byt st | N2 ; keep track of where we've just been
.byt ldd | N1
.byt st | N1 ; (N1) -> N1
.byt rtn
ldy #2
bne dhashstore02
dhashstore05 brk
.byt ld | N2
.byt bnz, <(dhashstore06-*-2)
.byt ld | R11 ; empty list, insert at the head
.byt st | N2 ; head -> N2
dhashstore06 .byt ld | N0
.byt std | N2 ; N0 -> (N2)
.byt ld | N1
.byt std | N0 ; N1 -> (N0)
.byt rtn
jmp pops ; toss the hashCode: Select all
LASTAT .MACRO
BRK
NOP
.ENDM
...
;----------------------------------------------------------------
; STATUS LATCH ROUTINE--CALLED VIA LASTAT
;----------------------------------------------------------------
;
LSTAT = *
LSTHI = *
LDA PORT1
AND HILOST ; CHECK FOR HIGH-TO-LOW CHANGE
STA HILOST
LSTLO = *
LDA PORT1
ORA LOHIST ; CHECK LOW-TO-HIGH CHANGE
STA LOHIST
RTI ; RETURN -- 33 CYCLES EXECUTION
...
*= $FFF8
HNDCHK .BYTE $C5 ; HANDLER CHECKSUM
.BYTE VERSON
.WORD CHKSUM,RESET,LSTATCode: Select all
LDX #syscall_foo
BRK
Code: Select all
JMP (table,X)
table:
.dw func1, func2, ..., funcFoo, ... funcX