The NextLibs

At the heart of NextBuild is the library that is included called nextlib.bas. This is what makes Boriel’s ZXB so flexible, being able to extend its functionality with relative ease.

Inside the nextlib.bas are an array of routines that have been placed into subroutines so you can call them from your own programs, these routines will only work when writing software for the Next, so they will most likely crash FUSE!

You must include the library in top of your source to use them like so:

This is how you include NextLib, very important!

The following subroutines have been created so far :

NB the commands are CASE SENSITIVE!

SD card access:
LoadSD(filename$,address,length,offset) ; Loads from SD card
SaveSD(filename$,address,length) ; Saves to SD card
LoadBMP(filenam$) ; loads bmp to layer2

NOTE : in your project folder SD access files should be in the data folder. Compile includes
should be in the root of your project folder.

Layer2 and sprites:
ShowLayer2(1=on 0 off)
InitSprites(Number of sprites to upload, address of data)
UpdateSprite(X,Y,sprite slow,sprite image,mirror & flip)
DoTile(x,y,tile number) ; 16x16px tiles start at $c000
DoTile8(x,y,tile number) ; 8x8px tiles start at $c000
PalUpload(address of palette,colours to upload,start from offet)
TileMap(address of tilemap, start offset,number of tiles) ; this is for 8×8 tiles
ClipLayer2(x1,x2,y1,y2) ; clips layer 2 defaults 0,255,0,191
MMU(slot,bank number) ; swaps in 8kb memory page into – more info on the memory map here 

; slots 0-7 $0000-$1fff, $2000-$3fff, $4000-$5fff,
; $6000-$7fff,$8000-$9fff,$a000-$bfff,$c000-$dfff,$e000-$ffff
; normal bank paging is carried out on slots 6 & 7 $c000-$ffff

bank=GetMMU(slot) ; returns 8kb memory bank in slot
NextReg(reg,val) ; this is a macro for $91ED – more info on the registers here 
NextRegA(reg,val) ; this sets a with val and does $92ED

zx7Unpack(source,destination) ; decompressor from the amazing Einar Saukas

NextLibs also includse some useful debugging macros:

BREAK – to be used from within inline assembly, this will add a breakpoint and open the debugger in CSpect
BBREAK – the same as above but for normal basic

Leave a Reply