Jump to content
IGNORED

Overlay/File/Cart handling reworked in BLL


Recommended Posts

I added a set of macros to BLL to allow building a .LNX file directly from assembly using the uLoader.

Also added macros to handle overlays or asset loading from cart.

 

Example in demos/overlay.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

And here a POC for those who use MADS:

 

	;;; compile: mads -c -b:0 test.asm -o:test.lnx

	opt ?-
	opt c+
	opt h-

BlockSize	= 1024
	org $0

	.def :?ROM_PC = 0

OVERLAY_BEGIN .macro
 .def :ROM_:1	= :?ROM_PC
	org	:2
 .def :start_:1 = *
	.endm

OVERLAY_END .macro
 .def :end_:1 = *
 .def :size_:1 = :end_:1 - :start_:1
 .def :?ROM_PC += :size_:1
	.endm

OVERLAY_DIR_ENTRY .macro
	.by (>size_:1)^$ff
	.by (<size_:1)^$ff
	.by (>start_:1)
	.by (<start_:1)
 .IF :0 == 2
	.by :2
 .ELSE
	.by 0
 .ENDIF
	.by (>(ROM_:1 & (BlockSize-1)))^$ff
	.by (<(ROM_:1 & (BlockSize-1)))^$ff
	.by ROM_:1/BlockSize
	.endm

LNX_HEADER
	.by "LYNX"
	.word 1024
	.word 1024
	.word 1
:32	.by "N"
:16	.by "M"
	.by 0			;rot
	.by 0			; audin
	.by 0			;eeprom
:3	.by 0

bootsector
	ins "ml.enc"

 .def :?ROM_PC += 52

	org	$1ff
	.byte	1+(End-Start)/256
Start:
	lda	#0
print:
	sta	0
	sty	1
loop
	lda	(0)
	beq	done
	jsr	putchar
	inc	0
	bne	loop
	inc	1
	bra	loop

done:	bra	done
putchar:
	rts

fileDirectory
	OVERLAY_DIR_ENTRY overlay1
	OVERLAY_DIR_ENTRY overlay2

:2000	.by 0			; just to fill

End:
overlay_start:
	.print "ROM_PC",?ROM_PC

 .def :?ROM_PC += (End-Start)

	.print "ROM_PC",?ROM_PC
	OVERLAY_BEGIN overlay1,overlay_start
	lda	#<info1
	ldy	#>info1
	jsr	print
	rts
info1:	.byte "overlay1",0
	OVERLAY_END overlay1

	OVERLAY_BEGIN overlay2,overlay_start
	lda	#<info2
	ldy	#>info2
	jsr	print
	rts
info2:	.byte "overlay2",0
	OVERLAY_END overlay2

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...