Closed J0hnniemac closed 5 months ago
The highlighted difference between produced snap files is position of the stack. In recent versions the fake system variables and stack is by default at rather low address as most of the game/demo loaders do by using CLEAR
command early in the basic loader.
To get stack up into higher area you can try device zxspectrum48, $FF32
instead, setting "RAMTOP" explicitly to $FF32 (or other address you like). This will produce same SP in the sna header as the 1.14.5 did.
Whether this is enough to fix it for NexCreator - I don't know, maybe it's sensitive also about the fake stack content, not just about it's position, up to you to try.
Technically both sna files are valid and working starting on the "start" address, so it's not sjasmplus's bug, but NexCreator's bug not being able to read the start address from the snapshot.
JFYI 1: you have start
label after the ld sp,...
instruction, so this one will be missed (not sure if this is intentional and NexCreator uses this as some magic way to set SP in nex header, or you just provided quick example and didn't notice you have start label after it).
JFYI 2: sjasmplus has SAVENEX
instruction which is IMHO more powerful than NexCreator, plus it's native to sjasmplus, so you don't need the external tool. Maybe you should take a look on it, or maybe you don't like it because some reason (feedback is welcome)? http://z00m128.github.io/sjasmplus/documentation.html#c_savenex
Thanks - My preference is to use SAVENEX, I eventually got it working with the my same test code. device ZXSPECTRUMNEXT ; Flash Border Colors on ZX Spectrum Next org $7878 jp start ld SP, StackSpace align 256 ; table must be aligned to a 256 byte boundry IM2Table ds 257 ; 257 bytes for our table StackSpaceEnd ds 127 ; safe place for stack StackSpace db 0 display $ ORG $8000 ; Start assembling at address 32768
start: ld hl, key_scan ; Address of the key scan routine ld b, 7 ; Number of colors to cycle through
next_color: ld a, (hl) ; Load border color from table out (254), a ; Set border color inc hl ; Move to next color in the table djnz next_color ; Loop through all 7 colors
call key_pressed ; Check if a key has been pressed
jr z, start ; If no key pressed, repeat
ret ; Return from program
; Check if any key is pressed key_pressed: ld bc, 0xFEFE ; Prepare for reading keyboard in a, (c) ; Read keyboard port cpl ; Complement the result and 0x1F ; Mask out relevant bits ret ; Return, zero flag is set if no key is pressed
; Data: Border color values (classic ZX Spectrum colors) key_scan: db 0, 1, 2, 3, 4, 5, 6
SAVENEX OPEN "test.nex",start,StackSpace,5;
SAVENEX BANK 5,2,0
SAVENEX CLOSE
I was unable to get the sample code working with only getting blank screen and green boarder in CSpect
Thanks for you help, please close this bug, as you said NexCreator is at fault here
I have a simple program
if I compile in version 1.14.5 and use the NexCreator tool with file test.sna,5,4000
./NexC NexList.txt test.nex
the text.net run and has PC set
if I compile in a version > 1.14.5 run ./NexC NexList.txt test.nex PC will = 0000 and fails to to run
checking the two sna file the header is different different