Jump to content

Photo

Lynx loader from scratch


56 replies to this topic

#51 42bs OFFLINE  

42bs

    Chopper Commander

  • 199 posts
  • Location:Germany/Southest West

Posted Sun Sep 16, 2018 10:58 PM

Oh, Never Seen this. Interesting. No C64 guy when $00 is being used :-) Are 0,1,2 even initialized?

 

:-) I think this is an early version. I doubt it works.



#52 42bs OFFLINE  

42bs

    Chopper Commander

  • 199 posts
  • Location:Germany/Southest West

Posted Thu Dec 6, 2018 3:06 AM

Trying to squeeze STNICC scene into a  card I found ethusi's loader wastes some space. So here is another version, which fetches the data right after the encrypted loader. Three bytes are left for personal use ;-)

; micro loader
;
; programm must start at $1ff, first byte must contain number of
; pages to load (see demo.s), so actual code at $200
;
; Note: Does not clear AUDIN, therefor not for use for bank-switching carts!
;      (lda #$1a; sta $FD8A, and FE00 sets AUDIN (B4) == 0)
;

RCART_0		EQU $fcb2 ; cart data register

BLOCKNR		EQU 0		; zeroed by ROM
PAGECNT		EQU $1ff

	RUN    $0200

	; SP = 3 after ROM, so push 3 bytes plus
	ldx	#(b9+1)-b0+3
cpy:
	stz	$fda0,x		; clear colors
	lda	b0,x		; copy loader
	pha
	dex
	bpl	cpy

	ldy	#51+1		; already 51 bytes loaded from 1st block!
	bra	$200-(b9+1-b1)

	; to be copied into stack
b0:
	dex
	bne	b2
	inc	BLOCKNR		; next block
	lda	BLOCKNR
	jsr	$fe00		; select block
b1:
	ldx	#4		; 4 pages per block
b2:
	lda	RCART_0
DST
	sta	$200-(51+2),y	; first byte goes to $1ff (PAGECNT)
	iny
	bne	b2

	inc	$200-(b9+1-DST)+2	; next dst page

	dec	PAGECNT
	bne	b0
	dc.b 	$80		; opcode "BRA"
	; PAGECNT will be here, if zero => BRA $200
b9:

	; program is here ...

endofbl:
size	set endofbl-$200
free	set 49-size
	echo "Free %Dfree"
	IF free < 0
	echo "Size must be <= 50!"
	ENDIF

	; fill remaining space
	IF free > 0
	REPT	free
	dc.b	$42		; unused space shall not be 0!
	ENDR
	ENDIF
	dc.b 	$00		; end mark!

The program must start at $1ff with the number of pages, so actual code begins at $200.


Edited by 42bs, Thu Dec 6, 2018 3:06 AM.


#53 Heaven/TQA ONLINE  

Heaven/TQA

    Quadrunner

  • 11,043 posts
  • Location:Baden-Württemberg, Germany

Posted Thu Dec 6, 2018 3:33 AM

Ok. Just briefly followed.

Is that loader working with loading files? Or is it based on loading 1 file only?

#54 42bs OFFLINE  

42bs

    Chopper Commander

  • 199 posts
  • Location:Germany/Southest West

Posted Thu Dec 6, 2018 3:53 AM

This one just loads one file. No directory. This can be implemented in the application though.

Here my Makefile:

all: ml.lnx

ml.lyx: ml_enc.bin demo.bin
	cat ml_enc.bin demo.bin >$@

ml.lnx: ml.lyx
	make_lnx $< -b0 256K -o $@

ml_enc.bin: ml.bin
	lynxenc $< $@

ml.bin: micro_loader.s
	lyxass -d -o $@ $<

demo.bin: demo.s
	lyxass -d -o $@ $<

.PHONY: clean
clean:
	rm -f *.bin
	rm -f ml.lnx ml.lyx



#55 enthusi OFFLINE  

enthusi

    Dragonstomper

  • Topic Starter
  • 519 posts
  • Location:Potsdam, Germany

Posted Thu Dec 6, 2018 4:44 AM

I used a variant of the loader I posted here for the "Lacim's Legacy" demo/preview and simple use an own 'filesystem'.



#56 sage OFFLINE  

sage

    Dragonstomper

  • 945 posts
  • Location:Germany

Posted Thu Dec 6, 2018 7:33 AM

then you waste indeed some bytes. the micro loader used in current c65 and lynxdir is starting at byte 53 ;-)



#57 enthusi OFFLINE  

enthusi

    Dragonstomper

  • Topic Starter
  • 519 posts
  • Location:Potsdam, Germany

Posted Thu Dec 6, 2018 9:19 AM

Not wasted, just not used by first file :)

I have routines to arrange ALL files in the end with as few page overlaps as necessary. Not that you'd really notice during the game but I like that :)






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users