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:
|
all:
|
||||||
@echo "Please select a target."
|
@echo "Please select a target."
|
||||||
|
|
||||||
|
ilen-test: ilen-test.bin
|
||||||
|
|
||||||
ilen-test.bin: ilen-test.asm
|
ilen-test.bin: ilen-test.asm
|
||||||
cl65 -o ilen-test.bin -t none --start-addr 0x2000 -l ilen-test.asm
|
cl65 -o ilen-test.bin -t none --start-addr 0x2000 -l ilen-test.asm
|
||||||
cp $(TEMPLATE) ilen-test.po
|
cp $(TEMPLATE) ilen-test.po
|
||||||
|
@ -7,18 +7,18 @@
|
|||||||
;
|
;
|
||||||
; Calculate Instruction Length
|
; Calculate Instruction Length
|
||||||
; Based on observations in 65C02 data sheet:
|
; Based on observations in 65C02 data sheet:
|
||||||
; * Generally, length is based on LOW nibble
|
; * Generally, length is based on LOW nibble:
|
||||||
; * There are a few special cases (including X9 column)
|
; - 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
|
; Input: Acc. = instruction
|
||||||
; Output: Acc. = length
|
; Output: Acc. = length
|
||||||
;
|
;
|
||||||
.proc ilen
|
.proc ilen
|
||||||
bit #$0f
|
bit #%10011111 ; Normal instructions have at least one of these bits set
|
||||||
bne @notcol0
|
beq @column0 ; None are set, column 0 special cases ($00 / $20 / $40 / $60)
|
||||||
@column0:
|
@normal: ; "Normal" values for ALL columns 0-F
|
||||||
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
|
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
@ -36,7 +36,7 @@
|
|||||||
lda #3
|
lda #3
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@notnormal:
|
@column0: ; Only special cases
|
||||||
cmp #$20 ; JSR ($20)
|
cmp #$20 ; JSR ($20)
|
||||||
beq @three
|
beq @three
|
||||||
; fall through for BRK ($00) / RTI ($40) / RTS ($60)
|
; fall through for BRK ($00) / RTI ($40) / RTS ($60)
|
||||||
|
Loading…
Reference in New Issue
Block a user