Please, someone put the Nula changes at stardot/b-em master brunch, because this works great for me.


Hey Rob, I think there are some timing issues with the SOTB demo - if you enable "full borders" in the display options for b-em there are about 3 character rows being "displayed" outside of (above) the visible region?!RobC wrote:When I was tweaking the row timings to get the multiple ruptures working, I found that adjustments in the timings sometimes caused extra scanlines at the top of the display (I guess because the overall frame timing wasn't quite right).
It's possible that the timing is more critical than it should be as I ended up getting it working more by trial and error than by calculation/design
Coeus wrote:Ok, so I have created a branch on the Stardot B-Em repository which has the horizontal scroll and blanking changes above merged into the master from the B-Em Stardot repository. Additionally, this version has an option to enable/disable Video NuLA as Kieran suggested above - it is in the Video section of the menu so for Windows:
win.png
and for Linux:
lnx.png
There is also a Windows build attached to this post (though missing some of the non-NULA disc images such as PanOS and Master 512 discs in order to get it to fit as an attachment).
That looks very useful, Thanks.simonm wrote:Just a thought on the latest B-Em developments - GitHub releases looks like it might be a convenient way to distribute the various compiled binaries for B-Em ... for those of us without a build environment anyway. You can create a tagged release and upload compiled binaries as attachments.
https://help.github.com/articles/creating-releases/
I am not the expert here, but looking at the BBC micro circuit diagram it doesn't look like the video circuits in general take the reset signal. The RST line for the 6845 appears to tied high and the video ULA doesn't appear to have a RST line. This would not have been a problem with the original hardware because the OS will have code to establish sensible defaults as part of selecting a new screen mode as part of its general initialisation but obviously that doesn't know about NuLA.Rich Talbot-Watkins wrote:Out of interest, what's the reason for not reverting to defaults on reset? I would have expected it to work like that!
Sorry for not replying sooner - life has been quite hectic this week and I missed this thread!kieranhj wrote:Hey Rob, I think there are some timing issues with the SOTB demo - if you enable "full borders" in the display options for b-em there are about 3 character rows being "displayed" outside of (above) the visible region?!
Rob, thanks for getting back. I can see why it can be good to keep the palette and attribute mode across a break. The issue I was having appears to be with the left blanking and horizontal scroll so maybe these could be reset on their own? Trying this in B-Em resetting nula_left_blank and nula_horizontal_offset to zero solves the issue so that on hitting Break form within the SOTB demo I now get: or some variation of that as the exact colours seem to depend on exactly when you hit the key. I think that's an improvement in that you can now see what you're typing and, if you wants to reset the palette etc. you can see to type the command to do so. If you agree, checking how those variables in B-Em get set the ROM code would need to do something like:RobC wrote:From a software pov, it would be easy to hook into a hard/soft reset in the ROM (and the code already does this to redirect vectors etc. on all models) but I deliberately decided that the palette and attribute modes should be available across hard resets. Happy to provide a version that issues a reset on Break to anyone who wants one. (I think having a standard handler for NuLA demos is a great idea.)
Kieran,kieranhj wrote:There is also a tiny glitch somewhere...
Code: Select all
static void mode7_gen_nula_lookup(void) {
int fg_ix, fg_col, fg_red, fg_grn, fg_blu;
int bg_ix, bg_col, bg_red, bg_grn, bg_blu;
int weight, lu_red, lu_grn, lu_blu;
for (fg_ix = 0; fg_ix < 8; fg_ix++) {
fg_col = nula_collook[fg_ix];
fg_red = getr(fg_col);
fg_grn = getg(fg_col);
fg_blu = getb(fg_col);
for (bg_ix = 0; bg_ix < 8; bg_ix++) {
bg_col = nula_collook[bg_ix];
bg_red = getr(bg_col);
bg_grn = getg(bg_col);
bg_blu = getb(bg_col);
for (weight = 0; weight < 16; weight++) {
lu_red = bg_red + (((fg_red - bg_red) * weight) >> 4);
lu_grn = bg_grn + (((fg_grn - bg_grn) * weight) >> 4);
lu_blu = bg_blu + (((fg_blu - bg_blu) * weight) >> 4);
mode7_lookup[fg_ix][bg_ix][weight] = makecol(lu_red, lu_grn, lu_blu);
}
}
}
mode7_need_new_lookup = 0;
}
Hey Steve,Coeus wrote: The kernel of this is the calculation of where, between the foreground and background colours each weight should sit. Is this linear calculation right or should it be logarithmic or something else? What about the sign of (fg_red - bg_red)?
Thanks for looking, Kieran. With reference to the sign I was thinking "What is the forefound colour is dimmer, at least for that colour component, than the background colour so the expression (fg - bg) is negative.kieranhj wrote:n this instance a simple linear interpolation between fg and bg colours would appear correct - doesn’t need to be anything more complicated. The sign of (fg - bg) is fine because this is what you want - all bg at 0 and all fg at 1 (well 15 in this case.)
Don't worry, it's correct and standard for simple colour interpolation - you are just doing a lerp between bg & fg so the negative expression correctly transforms the result from bg to fg when the lerp value = 1:Coeus wrote:Thanks for looking, Kieran. With reference to the sign I was thinking "What is the forefound colour is dimmer, at least for that colour component, than the background colour so the expression (fg - bg) is negative.
Code: Select all
result = bg + lerp * (fg - bg)
lerp = 0.0 -> result = bg + 0.0 * (fg - bg) = bg + 0*fg - 0*bg = bg
lerp = 1.0 -> result = bg + 1.0 * (fg - bg) = bg + 1*fg - 1*bg = fg
Code: Select all
result = bg + weight * (fg - bg) / 16
weight = 15 -> result = bg + 15 * (fg - bg) / 16 = bg + 15*fg/16 - 15*bg/16 = bg/16 + 15*fg/16 = (bg + 15*fg)/16
Code: Select all
result = bg + weight * (fg - bg) / 15
weight = 15 -> result = bg + 15 * (fg - bg) / 15 = bg + 15*fg/15 - 15*bg/15 = bg + fg - bg = fg
The UI seems to be missing, the relevant nula code doesn't appear to have been merged in that branch.Coeus wrote:Thanks, Kieran. I have made that change and pushed to sf/nula-mode7. I will also a Windows binary release to GitHub.
Now fixed - see the revised ZIP file attached to the release.guesser wrote:The UI seems to be missing, the relevant nula code doesn't appear to have been merged in that branch.Coeus wrote:Thanks, Kieran. I have made that change and pushed to sf/nula-mode7. I will also a Windows binary release to GitHub.
Redefining black in mode 7 causes the display's reference voltage to change. This effectively causes whatever colour you've set black as to be "subtracted" from all the other colours. (This only applies to mode 7, modes 0-6 are unaffected.)guesser wrote:I don't have the real hardware so don't know what should actually happen...
Rob, thanks for the clarification. That is most of the info I would need to implement it. Does that mean a straightforward simple subtraction for each of the R, G and B components separately would be close or is some more complicated maths involved?RobC wrote:Having said that, I don't have a strong opinion on whether an emulator should mimic VideoNuLA exactly or attempt to be an idealised version.