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

View File

@@ -122,20 +122,12 @@ flagsok:
lda _FileStartBlock lda _FileStartBlock
sta _FileCurrBlock sta _FileCurrBlock
jsr lynxblock jsr lynxblock
lda _FileBlockOffset+1
eor #$FF
tay
lda _FileBlockOffset 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 eor #$FF
pha tax
txa
eor #$FF
bra @2
@1: pha
txa
@2: tay
plx
jsr lynxskip0 jsr lynxskip0
jsr stax0sp jsr stax0sp
jmp incsp8 jmp incsp8

View File

@@ -8,8 +8,7 @@
; reads bytes from a raw cart and does not understand the concept of files. ; 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. ; 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). ; The count-parameter is positive (Atari style).
; In any case the read routine will work correctly.
; ;
; int __fastcall__ read(int fd,void *buf,int count) ; int __fastcall__ read(int fd,void *buf,int count)
; ;
@@ -30,18 +29,13 @@
sta _FileDestPtr sta _FileDestPtr
stx _FileDestPtr+1 stx _FileDestPtr+1
jsr ldax0sp 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 pha
txa txa
eor #$FF eor #$FF
bra @2 tay
@1: pha pla
txa eor #$FF
@2: tay tax
plx
jsr lynxread0 jsr lynxread0
jsr ldax0sp jsr ldax0sp
jmp incsp6 jmp incsp6

View File

@@ -1,6 +1,6 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __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 __BLOCKSIZE__: type = weak, value = 1024; # cart block size
__BLLHDR__: type = import; __BLLHDR__: type = import;
} }

View File

@@ -1,6 +1,6 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __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 __BLOCKSIZE__: type = weak, value = 1024; # cart block size
__EXEHDR__: type = import; __EXEHDR__: type = import;
__BOOTLDR__: type = import; __BOOTLDR__: type = import;

View File

@@ -1,6 +1,6 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __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 __BLOCKSIZE__: type = weak, value = 1024; # cart block size
__EXEHDR__: type = import; __EXEHDR__: type = import;
__BOOTLDR__: type = import; __BOOTLDR__: type = import;

View File

@@ -1,6 +1,6 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __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 __BLOCKSIZE__: type = weak, value = 1024; # cart block size
__EXEHDR__: type = import; __EXEHDR__: type = import;
__BOOTLDR__: type = import; __BOOTLDR__: type = import;