mirror of
https://github.com/a2geek/basic-system-cmd.git
synced 2024-12-28 02:29:18 +00:00
Tweak to ilen routine, shortened it a bit.
This commit is contained in:
parent
cde7393fb5
commit
3deaa5a482
@ -6,6 +6,8 @@ VIRTUAL2 = /Applications/Virtual\ \]\[/Virtual\ \]\[.app/Contents/MacOS/Virtual\
|
||||
all:
|
||||
@echo "Please select a target."
|
||||
|
||||
ilen-test: ilen-test.bin
|
||||
|
||||
ilen-test.bin: ilen-test.asm
|
||||
cl65 -o ilen-test.bin -t none --start-addr 0x2000 -l ilen-test.asm
|
||||
cp $(TEMPLATE) ilen-test.po
|
||||
|
@ -7,18 +7,18 @@
|
||||
;
|
||||
; Calculate Instruction Length
|
||||
; Based on observations in 65C02 data sheet:
|
||||
; * Generally, length is based on LOW nibble
|
||||
; * There are a few special cases (including X9 column)
|
||||
; * Generally, length is based on LOW nibble:
|
||||
; - X0..X7 = 2 bytes
|
||||
; - X8..XB = 1 byte
|
||||
; - XC..XF = 3 bytes
|
||||
; * There are a few special cases (including X0 and X9 columns)
|
||||
; Input: Acc. = instruction
|
||||
; Output: Acc. = length
|
||||
;
|
||||
.proc ilen
|
||||
bit #$0f
|
||||
bne @notcol0
|
||||
@column0:
|
||||
bit #%10010000 ; Normal instructions have at least one of these bits set
|
||||
beq @notnormal ; None are set
|
||||
@notcol0: ; "Normal" values for ALL columns 0-F
|
||||
bit #%10011111 ; Normal instructions have at least one of these bits set
|
||||
beq @column0 ; None are set, column 0 special cases ($00 / $20 / $40 / $60)
|
||||
@normal: ; "Normal" values for ALL columns 0-F
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
@ -36,7 +36,7 @@
|
||||
lda #3
|
||||
rts
|
||||
|
||||
@notnormal:
|
||||
@column0: ; Only special cases
|
||||
cmp #$20 ; JSR ($20)
|
||||
beq @three
|
||||
; fall through for BRK ($00) / RTI ($40) / RTS ($60)
|
||||
|
Loading…
Reference in New Issue
Block a user