Gibt's eigentlich eine Beschreibung, wie genau der Checksummer arbeitet? Ich würde versuchen, sowas im C64Studio unterzubringen.
Hab's mal disassembliert, aber bei ein paar Sachen muss ich raten.
Ist in $14/$15 anfangs die Zeilennummer drin?
In $fd ist dann das laufende Byte (Zeichen oder Token).
Es wird geprüft, ob man im Quote-Modus ist. Innerhalb sind Leerzeichen erlaubt, außerhalb werden sie ignoriert.
Die Bit/Byte-Verwurstelung danach ist aber knifflig zu bestimmen.
Da wird irgend ein Bit gesucht und wild ge-shiftet ![]()
Code
!src <c64.asm>
* = $0334
;set up vectors
lda #<BasicInputAndDecode
sta $0302
lda #>BasicInputAndDecode
sta $0303
lda #<Tokenize
sta $0304
lda #>Tokenize
sta $0305
rts
!lzone BasicInputAndDecode
lda #$ff
sta $15
;kernal input BASIC line
jmp $a483
!lzone Tokenize
;kernal tokenize BASIC line
jsr $a57c
;read from BASIC input buffer
lda $0200
beq +
;what is it? (starts with $ff)
lda $15
eor #$ff
bne ++
+
rts
++
sta $fc
txa
pha
tya
pha
;temp int value, what is it?
lda $14
eor #$ff
sta $fb
ldx #$00
stx $02
.NextByte
lda $0200, x
sta $fd
beq .DisplayCheckSum
;quote mode active?
bit $02
bmi .InStringLiteral
;space?
cmp #$20
beq .SkipSpace
.InStringLiteral
cmp #'"'
bne .NotQuotes
;toggle quote flag
lda #$ff
eor $02
sta $02
.NotQuotes
ldy #$08
-
asl $fd
rol
eor $fb
lsr
bcc +
lda #$68
eor $fc
sta $fc
+
ror $fc
ror $fb
dey
bne -
.SkipSpace
inx
bne .NextByte
.DisplayCheckSum
;a = 0 here
ldy #$03
tax
label_03a5
lda $fb, x
and #$0f
jsr .MapToHexChar
sta $0424, y
dey
lda $fb, x
lsr
lsr
lsr
lsr
jsr .MapToHexChar
sta $0424, y
inx
dey
bpl label_03a5
;color checksum
lda #$01
ldy #$03
-
sta $d824, y
dey
bpl -
pla
tay
pla
tax
rts
.MapToHexChar
cmp #$0a
bcc .IsNumeric
sbc #$09
rts
.IsNumeric
adc #$30
rts
Alles anzeigen