Search found 28 matches

by thricenightly
Fri Mar 16, 2018 4:26 pm
Forum: Sinclair ZX
Topic: SP1 on zx: do I need to sync to the raster?
Replies: 1
Views: 2522

SP1 on zx: do I need to sync to the raster?

The SP1 wiki page claims "Flicker free operation without synchronizing with the raster", and looking through the examples I'm not seeing any 'halt's before the screen update calls. Received wisdom for Spectrum developers is that graphics will flicker unless display file updates are done wh...
by thricenightly
Sat Mar 10, 2018 10:42 am
Forum: Sinclair ZX
Topic: SP1: What's the "graphic" argument in sprite creation?
Replies: 10
Views: 8462

Right, it's clicked. There are two ways of using the interface. The signatures in header file suggest one way, and the example code pretty much all does it the other way. And mixing the two approaches doesn't work. :) So the method for my 8x8 circle sprite, as suggested by the function signatures, i...
by thricenightly
Fri Mar 09, 2018 9:24 pm
Forum: Sinclair ZX
Topic: SP1: What's the "graphic" argument in sprite creation?
Replies: 10
Views: 8462

SP1: What's the "graphic" argument in sprite creation?

sp1.h says the signature for sp1_CreateSpr is: sp1_CreateSpr(void *drawf,uint16_t type,uint16_t height,int graphic,uint16_t plane) I'm trying to work out what the 'graphic' value is for. grepping the z88dk codebase finds 150 examples of calls to sp1_CreateSpr() and all but about 3 of them (all in Bl...
by thricenightly
Sat Mar 03, 2018 6:35 pm
Forum: Sinclair ZX
Topic: How do you control the top of the heap?
Replies: 2
Views: 2954

How do you control the top of the heap?

Further to pull request #626, there's a comment there which says "...if the heap is used, you have to tell it what the last byte in memory is or it will continue to assume it can use up to the bottom of the stack...". I was aware of that issue and specifically looked for a way of controlli...
by thricenightly
Tue Feb 06, 2018 7:52 pm
Forum: z88dk-developers
Topic: [z88dk-dev] git issue, line endings maybe?
Replies: 3
Views: 7268

Actually my local copy of lib3d.txt also has CRLF endings but I don't get the problem you're seeing. If your .gitattributes is up to date and the problem is still there, maybeI can change the line endings and recommit but it would be good to know why there is a problem in the first place. Sorry for...
by thricenightly
Tue Feb 06, 2018 7:12 pm
Forum: Sinclair ZX
Topic: Newbie in need of help!
Replies: 43
Views: 32865

For newlib there is a short (and incomplete) introduction written by another user learning to use z88dk that might help: https://github.com/z88dk/z88dk/blob/master/doc/ZXSpectrumZSDCCnewlib_01_GettingStarted.md Wow, this is a nice link! Where did you got that from? It was written by thricenightly a...
by thricenightly
Sat Jan 27, 2018 12:03 pm
Forum: z88dk-developers
Topic: [z88dk-dev] git issue, line endings maybe?
Replies: 3
Views: 7268

[z88dk-dev] git issue, line endings maybe?

I work on Linux, and ever since I made my first fork of the z88dk repo 'git status' has told me I've got changed files which I know I haven't touched. For example, right now I have everything up to date, and I see this: >git status On branch master Your branch is up-to-date with 'origin/master'. Cha...
by thricenightly
Wed Jan 03, 2018 7:00 pm
Forum: Sinclair ZX
Topic: FRAMES system variable with SDCC
Replies: 9
Views: 7827

OK, that works. I crudely hacked the "im1" out of the CRT 31 code, then redefined the ISR wrapper macro: #define IM2_DEFINE_ISR_WITH_BASIC(name) void name(void) __naked \ { \ __asm \ EXTERN asm_im2_push_registers \ EXTERN asm_im2_pop_registers \ \ call asm_im2_push_registers \ call __im2_i...
by thricenightly
Tue Jan 02, 2018 5:22 pm
Forum: Sinclair ZX
Topic: FRAMES system variable with SDCC
Replies: 9
Views: 7827

Basic does require the code at 0x38 to run on each interrupt so your interrupt routine must jump to 0x38 at its end. If you're running that code, the IY register is being used by the basic system, which means sdcc is not compatible with it. Maybe something fancier has to be done like enabling a jp ...
by thricenightly
Tue Jan 02, 2018 12:15 pm
Forum: Sinclair ZX
Topic: FRAMES system variable with SDCC
Replies: 9
Views: 7827

I've been playing with this code and other interrupt bits and pieces, and it all works fine. But I can't work out how to exit back to BASIC with the interrupts left at mode 2. I can see in Fuse's debugger that it goes back to IM1 after the "return 0;" at the end of my program. My interrupt...
by thricenightly
Mon Jan 01, 2018 11:44 am
Forum: Sinclair ZX
Topic: SP1 init flag SP1_IFLAG_MAKE_ROTTBL?
Replies: 2
Views: 3428

SP1 init flag SP1_IFLAG_MAKE_ROTTBL?

What does the SP1 SP1_IFLAG_MAKE_ROTTBL initialisation flag do? Makes a rotation table, obviously, but what does that mean? I couldn't work out from the code what it actually does. I deduced it's used in getting pixel positioning for sprites, which leads me to guess that it contains a cache of rotat...
by thricenightly
Mon Jan 01, 2018 11:15 am
Forum: Sinclair ZX
Topic: Where's the SP1 library headed?
Replies: 7
Views: 6838

Timmy, the problem with working from demos is that the programmer is constrained by what the demos do and how they do it. For example, I wanted to use an 8x8 pixel sprite, as opposed to a 16x16 pixel one. So I picked up one of the demos, changed the sprite graphic to what I thought should work, twea...
by thricenightly
Fri Dec 29, 2017 9:43 pm
Forum: Sinclair ZX
Topic: Where's the SP1 library headed?
Replies: 7
Views: 6838

Where's the SP1 library headed?

Over the last day or two I started looking at the SP1 library as a basis for ZX Spectrum games development. Progress has been extremely slow, and this is clearly going to take a lot of time. To be honest I was wondering if it's worth the effort. Do I remember someone saying the SP1 library was going...
by thricenightly
Wed Jul 05, 2017 9:26 am
Forum: z88dk-users
Topic: [Z88dk-users] bifrostldem compilation
Replies: 3
Views: 6982

This engine is output as a separate binary if it gets used. OK, but... why? I'm trying to picture what's happening. I have a bit of code (my C) ORGed at 32768, and another bit of code (BiFrost) ORGed at 58625. Why does the linker not join them together into a single piece of code with a "hole&...
by thricenightly
Tue Jul 04, 2017 9:27 pm
Forum: z88dk-users
Topic: [Z88dk-users] bifrostldem compilation
Replies: 3
Views: 6982

[Z88dk-users] bifrostldem compilation

I'm trying to work out how to compile the bifrostldem demo under Linux. So far I've failed miserably, and I can't work out how to compile a bifrost "hello world" either, so it's time to take it step by step. First thing I note is that when running the recommended compile line described in ...
by thricenightly
Sun Jun 25, 2017 11:49 am
Forum: z88dk-users
Topic: [Z88dk-users] String in ASM
Replies: 3
Views: 6920

This: #include <stdio.h> extern unsigned char* message; should be this: #include <stdio.h> extern unsigned char message[]; Oh Lordy, a salutary lesson in C arrays vs pointers. Thanks for that. ------------------------------------------------------------------------------ Check out the vibrant tech ...
by thricenightly
Sat Jun 24, 2017 6:55 pm
Forum: z88dk-users
Topic: [Z88dk-users] String in ASM
Replies: 3
Views: 6920

This is a basic one, but I can't see why I've got it wrong. My C: <snip> Replying to myself, I've had a look at the ASM the compiler puts out for the main() code. There's a level of indirection in there, so this works: #include <stdio.h> extern unsigned char* message; int main() { unsigned char** p...
by thricenightly
Sat Jun 24, 2017 4:44 pm
Forum: z88dk-users
Topic: [Z88dk-users] String in ASM
Replies: 3
Views: 6920

[Z88dk-users] String in ASM

This is a basic one, but I can't see why I've got it wrong. My C: #include <stdio.h> extern unsigned char* message; int main() { printf("Message is: \"%s\"\n", message); return 0; } which is linked with: SECTION rodata_user PUBLIC _message _message: defb 0x41, 0x00 When run I'd e...
by thricenightly
Tue Jun 20, 2017 7:47 pm
Forum: z88dk-users
Topic: [Z88dk-users] Joysticks?
Replies: 1
Views: 5105

[Z88dk-users] Joysticks?

I was about to move on from the keyboard to joysticks. I looked at the API in input_zx.h and was immediately rather baffled. I'm going to do this research in the next day or two, but since it's non-obvious I thought I'd cheat and ask here first. :) I have a Kempston joystick to work with. How do you...
by thricenightly
Tue Jun 20, 2017 7:33 pm
Forum: z88dk-users
Topic: [Z88dk-users] Reading multiple keys
Replies: 8
Views: 10684

The scan code includes the byte that must be placed on the upper 8 bits of port 0xfe to identify a key row, a bitmask to identify one bit out of the 5 column bits and two bits to indicate whether CAPS and/or SYM should also be pressed. OK, all that's understood. There's more though. :) I was trying...
by thricenightly
Mon Jun 19, 2017 6:57 pm
Forum: z88dk-users
Topic: [Z88dk-users] Reading multiple keys
Replies: 8
Views: 10684

in_key_pressed function is also checking the state of the CAPS and SYM SHIFT keys so that it can distinguish between 'Q' and 'q', eg. With multiple keys pressed, CAPS and/or SYM SHIFT could be erroneously detected. There's no problem with this -- this issue has been thought of before. in_key_presse...
by thricenightly
Sun Jun 18, 2017 12:17 pm
Forum: z88dk-users
Topic: [Z88dk-users] Reading multiple keys
Replies: 8
Views: 10684

[Z88dk-users] Reading multiple keys

I'm trying to work out why this program won't show all 5 keys being pressed simultaneously: #include <stdio.h> #include <input.h> #include <arch/zx.h> int main() { zx_cls(PAPER_WHITE); while( 1 ) { printf("\x16\x01\x01"); printf("Scancode is 0x%04X\n", in_key_pressed( IN_KEY_SCAN...
by thricenightly
Tue Jun 13, 2017 6:42 pm
Forum: z88dk-users
Topic: [Z88dk-users] Simple graphics in newlib?
Replies: 1
Views: 4981

[Z88dk-users] Simple graphics in newlib?

Am I correct in thinking that the graphics routines I found here: https://github.com/z88dk/z88dk/blob/master/include/graphics.h are for classic lib only? And that they haven't been ported to newlib? Putting the question another way, are there any routines usable from sdcc/newlib which can draw simpl...
by thricenightly
Tue Jun 13, 2017 1:21 pm
Forum: z88dk-users
Topic: [Z88dk-users] Control codes, bit more info?
Replies: 6
Views: 8958

Heh, \0, yes, OK. I've got that working now. One more question: which wiki is the one to reference in other documentation? I'm (slowly) doing another getting started guide. Which of those two links is the one to put in it? Dom's supplied the links for the classic library. If you're doing the new li...
by thricenightly
Tue Jun 13, 2017 11:01 am
Forum: z88dk-users
Topic: [Z88dk-users] Control codes, bit more info?
Replies: 6
Views: 8958

I was playing with control codes using crt1 on the Spectrum. I get the gist, but was puzzled by the flash code. I tried: \x12\x01Hello\x12\x00, world! thinking the \x12\x01 would turn flash on, and \x12\x00 would turn it off again. What actually happens is that the "Hello" flashes, but th...