1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +00:00

Shring the bootloader by 20 bytes and remove restrictions on file size

git-svn-id: svn://svn.cc65.org/cc65/trunk@5824 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
karri 2012-09-11 13:01:39 +00:00
parent 574c8fa273
commit 2222df9143
7 changed files with 32 additions and 61 deletions

View File

@ -23,7 +23,7 @@
; .org $0200
;
; ; 1. force Mikey to be in memory
; stz MAPCTL
; stz MAPCTL
;
; ; 3. set ComLynx to open collector
; lda #4 ; a = 00000100
@ -35,7 +35,7 @@
;
; ; 5. read in secondary exe + 8 bytes from the cart and store it in $f000
; ldx #0 ; x = 0
; ldy #$AB ; y = secondary loader size (171 bytes)
; ldy #$97 ; y = secondary loader size (151 bytes)
;rloop1: lda RCART0 ; read a byte from the cart
; sta EXE,X ; EXE[X] = a
; inx ; x++
@ -49,13 +49,13 @@
;**********************************
; After compilation, encryption and obfuscation it turns into this.
;**********************************
.byte $ff, $dc, $e3, $bd, $bc, $7f, $f8, $94
.byte $b7, $dd, $68, $bb, $da, $5b, $50, $5c
.byte $ea, $9f, $2b, $df, $96, $80, $3f, $7e
.byte $ef, $15, $81, $ae, $ad, $e4, $6e, $b3
.byte $46, $d7, $72, $58, $f7, $76, $8a, $4a
.byte $c7, $99, $bd, $ff, $02, $3e, $5b, $3f
.byte $0c, $49, $1b, $22
.byte $ff, $30, $73, $35, $4a, $a8, $54, $ef
.byte $54, $20, $f5, $38, $f4, $35, $7e, $31
.byte $7a, $c3, $f6, $eb, $ee, $30, $e3, $e5
.byte $81, $91, $85, $bf, $4b, $d9, $cf, $80
.byte $5f, $54, $36, $b5, $8a, $b0, $50, $d6
.byte $38, $22, $3e, $c1, $01, $a6, $dd, $f5
.byte $4b, $5e, $6b, $21
;**********************************
; Now we have the secondary loader
@ -76,20 +76,12 @@ rloop: lda RCART0 ; read a byte from the cart
jsr seclynxblock
; 3. Skip over the block offset
lda _FileBlockOffset+1
eor #$FF
tay
lda _FileBlockOffset
ldx _FileBlockOffset+1
phx ; The BLL kit uses negative offsets
plx ; while the basic Lynx uses positive
bmi @1 ; Make all offsets negative
eor #$FF
pha
txa
eor #$FF
bra @2
@1: pha
txa
@2: tay
plx
tax
jsr seclynxskip0
; 4. Read in the main exe to RAM
@ -97,20 +89,12 @@ rloop: lda RCART0 ; read a byte from the cart
ldx _FileDestAddr+1
sta _FileDestPtr
stx _FileDestPtr+1
lda _FileFileLen+1
eor #$FF
tay
lda _FileFileLen
ldx _FileFileLen+1
phx ; The BLL kit uses negative counts
plx ; while the basic Lynx uses positive
bmi @3 ; make all counts negative
eor #$FF
pha
txa
eor #$FF
bra @4
@3: pha
txa
@4: tay
plx
tax
jsr seclynxread0
; 5. Jump to start of the main exe code
@ -190,5 +174,6 @@ seclynxblock:
pla
exit: rts
.reloc

View File

@ -122,20 +122,12 @@ flagsok:
lda _FileStartBlock
sta _FileCurrBlock
jsr lynxblock
lda _FileBlockOffset+1
eor #$FF
tay
lda _FileBlockOffset
ldx _FileBlockOffset+1
phx ; The BLL kit uses negative offsets
plx ; while tha basic Lynx uses positive
bmi @1 ; Make all offsets negative
eor #$FF
pha
txa
eor #$FF
bra @2
@1: pha
txa
@2: tay
plx
tax
jsr lynxskip0
jsr stax0sp
jmp incsp8

View File

@ -8,8 +8,7 @@
; reads bytes from a raw cart and does not understand the concept of files.
; So if you read over the end of file you get data from the next file.
;
; The count-parameter can be positive (Atari style) or negative (BLL style).
; In any case the read routine will work correctly.
; The count-parameter is positive (Atari style).
;
; int __fastcall__ read(int fd,void *buf,int count)
;
@ -30,18 +29,13 @@
sta _FileDestPtr
stx _FileDestPtr+1
jsr ldax0sp
phx ; The BLL kit uses negative counts
plx ; while the basic Lynx uses positive
bmi @1 ; make all counts negative
eor #$FF
pha
txa
txa
eor #$FF
bra @2
@1: pha
txa
@2: tay
plx
tay
pla
eor #$FF
tax
jsr lynxread0
jsr ldax0sp
jmp incsp6

View File

@ -1,6 +1,6 @@
SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00DF; # start just after loader
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = 1024; # cart block size
__BLLHDR__: type = import;
}

View File

@ -1,6 +1,6 @@
SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00DF; # start just after loader
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = 1024; # cart block size
__EXEHDR__: type = import;
__BOOTLDR__: type = import;

View File

@ -1,6 +1,6 @@
SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00DF; # start just after loader
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = 1024; # cart block size
__EXEHDR__: type = import;
__BOOTLDR__: type = import;

View File

@ -1,6 +1,6 @@
SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00DF; # start just after loader
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = 1024; # cart block size
__EXEHDR__: type = import;
__BOOTLDR__: type = import;