Skip to content

Commit 5e7a284

Browse files
committed
clean up
1 parent 64898dd commit 5e7a284

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

loader/drivecode.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ b = $48
12811281
sta <.chksum + 1 - $3e,x ;init checksum, waste 1 cycle
12821282
lda <.ser2bin - $3e,x ;$7f, waste 2 cycles
12831283
;XXX TODO reduce to 32 cycles and try on alps
1284-
jmp .gcr_entry ;34 cycles until enter
1284+
jmp .gcr_entry ;34 cycles until enter, could also be 36?
12851285
!if CONFIG_DEBUG != 0 {
12861286
.next_header_trail_zero
12871287
inc <.num_error

loader/resident.asm

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ bitfire_loadraw_
227227
bne .rts ;block ready? if so, a = 0 (block ready + busy) if not -> rts
228228

229229
ldy #$05 - CONFIG_LOADER_ONLY + CONFIG_DEBUG ;fetch 5 bytes of preamble
230-
;lda #$00 ;is already zero due to anc #$c0, that is why we favour anc #$co over asl, as we save a byte
230+
;lda #$00 ;is already zero due to and #$c0, that is why we favour and #$c0 over asl, as we save a byte
231231
ldx #<preamble ;target for received bytes
232232
jsr .ld_set_block_tgt ;load 5 bytes preamble - returns with C = 1 always
233233

@@ -240,8 +240,7 @@ bitfire_loadraw_
240240
}
241241
ldx <block_addr_lo ;block_address lo
242242
lda <block_addr_hi ;block_address hi
243-
;beq .jam
244-
ldy <block_status ;status -> first_block?
243+
bit <block_status ;status -> first_block?
245244
bmi +
246245
stx bitfire_load_addr_lo ;yes, store load_address (also lz_src in case depacker is present)
247246
sta bitfire_load_addr_hi
@@ -260,22 +259,19 @@ bitfire_ntsc3_op ldx #$6d ;opcode for adc -> repair any rts being set (also
260259
lsr ;%0dddd111
261260
lsr ;%00dddd11 1
262261
ldx <CONFIG_LAX_ADDR ;waste one cycle
263-
;nop
264262
bitfire_ntsc0 ora $dd00 ;%dddddd11 1, ora again to preserve
265263
stx $dd02
266264

267265
ror ;%1dddddd1 1
268266
ror ;%11dddddd 1
269267
ldx #$3f
270268
sax .ld_nibble + 1
271-
;nop
272269
bitfire_ntsc2 and $dd00 ;%ddxxxxxx might loose some lower bits, but will be repaired later on ora
273270
stx $dd02
274271

275272
.ld_nibble ora #$00 ;%dddddddd -> merge in lower bits again and heal bits being dropped by previous and
276273
.ld_store sta $b00b,y
277274
.ld_gentry lax <CONFIG_LAX_ADDR
278-
;nop
279275
.ld_gend
280276
bitfire_ntsc3 adc $dd00 ;%dd1110xx will be like #$38 (A = $37 + carry) be added
281277
stx $dd02 ;carry is cleared now after last adc, we can exit here with carry cleared (else set if EOF) and do our rts with .ld_gend
@@ -288,17 +284,9 @@ bitfire_ntsc3 adc $dd00 ;%dd1110xx will be like #$38 (A = $37 + carry) be
288284
;branch out at == 0? would then start with atn set, would be verycool, just preamble would end same way, what would suck? :-( would need to drop level before we enter loop at all? or between preamble and data?
289285
cpy #$01 ;check on 0 in carry, too bad we can't use that result with direct bail out, still some bits to transfer
290286
ldx #$3f
291-
;nop
292287
bitfire_ntsc1 ora $dd00 ;%dddd111x, ora to preserve the 3 set bits
293288
stx $dd02
294289

295-
;XXX TODO
296-
;cpy #$ff
297-
;bcc loop
298-
;block enter: ldx #$3f -> $dd02
299-
;block exit: ldx #$37 -> $dd02
300-
;need to bail out on lsr?
301-
302290
!if >* != >.ld_gloop { !error "getloop code crosses page!" } ;XXX TODO in fact the branch can also take 4 cycles if needed, ldx <CONFIG_LAX_ADDR wastes one cycle anyway
303291
bcs .ld_gloop
304292
.ld_en_exit
@@ -555,7 +543,7 @@ link_ack_interrupt
555543
.lz_clc
556544
clc
557545
bcc .lz_clc_back
558-
nop
546+
nop ;this hurts, but needs to be aligned
559547
nop
560548
nop
561549
}
@@ -567,7 +555,7 @@ link_ack_interrupt
567555
lda #$01 ;restore initial length val
568556
}
569557
asl <lz_bits
570-
.lz_redirect2 bcs .lz_match ;either match with new offset or old offset
558+
bcs .lz_match ;either match with new offset or old offset
571559

572560
;------------------
573561
;LITERAL
@@ -611,7 +599,7 @@ link_ack_interrupt
611599
;in case of type bit == 0 we can always receive length (not length - 1), can this used for an optimization? can we fetch length beforehand? and then fetch offset? would make length fetch simpler? place some other bit with offset?
612600
lda #$01
613601
asl <lz_bits
614-
.lz_redirect1 bcs .lz_match ;either match with new offset or old offset
602+
bcs .lz_match ;either match with new offset or old offset
615603

616604
;------------------
617605
;REPEAT LAST OFFSET

0 commit comments

Comments
 (0)