Welcome, Guest. Please login or register.


Author Topic: I'd like to register a complaint (fixbias) (Read 4328 times)

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
I'd like to register a complaint (fixbias)
« on: 2015.January.12. 15:07:13 »
Just wanted to complain about the fixbias color mechanism (16 color modes)...

Why, instead of one fix bias register, couldn't Nick have 8 separate registers for colors 8-15 (colors 0-7 set in modelines)?...

Because of fix bias you can't (or I just don't know how to do it efficiently) to fade-out or fade-in the screen without some redrawing of the screen(?)or limiting the color usage to the first eight... You can't even black-out the screen by changing colors in the palette (although you can do it with an alternative short lpt...).  You can't use "dual-playfield mode" like on the cpc (used in "ghost'n'goblins", "relentless", "mission genocide")...

What are the benefits of such solution? Or what are the other limitations?
Or how can I make a good fade-in, fade-out effect?

Offline IstvanV

  • EP addict
  • *
  • Posts: 4822
Re: I'd like to register a complaint (fixbias)
« Reply #1 on: 2015.January.12. 15:18:41 »
Why, instead of one fix bias register, couldn't Nick have 8 separate registers for colors 8-15 (colors 0-7 set in modelines)?...

That would indeed have been a better solution. FIXBIAS was used probably because it was easier and cheaper to implement, and problems with the NICK chip were already responsible for delays in the production of the machine. The designers might also have thought that the FIXBIAS solution is "good enough" compared to other 8-bit machines of the same time, even if it is not ideal.

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: I'd like to register a complaint (fixbias)
« Reply #2 on: 2015.January.12. 16:07:33 »
You can't even black-out the screen by changing colors in the palette (although you can do it with an alternative short lpt...).  You can't use "dual-playfield mode" like on the cpc (used in "ghost'n'goblins", "relentless", "mission genocide")...
You can black-out the screen by changing left margin in LPB to 3fh, you do not need a separate LPT.
I do not know solution for "dual playfiled mode", I met it in Relentless.

Offline ergoGnomik

  • EP addict
  • *
  • Posts: 1291
  • Country: hu
  • Stray cat from Commodore alley
Re: I'd like to register a complaint (fixbias)
« Reply #3 on: 2015.January.12. 18:26:07 »
Either IstvanV is right, or (only an assumption) they were really expecting to produce sprite expansion hardware for the system (which obviously wasn't realised since they gone bankrupt). The fake dual-playfield mode is only a clever trick for efficient sprite emulation. (Don't beat me too hard if CPC has real hardware sprites, please.)

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: I'd like to register a complaint (fixbias)
« Reply #4 on: 2015.January.12. 23:12:14 »
Quote
You can black-out the screen by changing left margin in LPB to 3fh, you do not need a separate LPT.
I do not know solution for "dual playfiled mode", I met it in Relentless.
yeah, but I was thinking about the mode I'm using, which is the 160x144 with pixels having the height of 2 lines. Then I need one modeline for each of the 144 lines and having a separate table would be better than changing each modeline... Such table would be short (40bytes?) and quicker to make the change...

Either IstvanV is right, or (only an assumption) they were really expecting to produce sprite expansion hardware for the system (which obviously wasn't realised since they gone bankrupt). The fake dual-playfield mode is only a clever trick for efficient sprite emulation. (Don't beat me too hard if CPC has real hardware sprites, please.)

Is there a z80 computer with proper sprites (with proper I mean more like the c64 ones, not the cpc+... although c64 and cpc+ are the only ones I know of having hardware sprites...).

Yeah, the "dual playfield" is only a trick with the palette and clever masking... Allows memory savings (no need to store the background) and sprites are a little faster (again - because you don't have to worry about the background)... But the sprites can't overlap, although maybe there's some work around for that...I don't know...

Standard cpc's don't have hardware sprites, but the cpc+ range has them but they're veeery limited imo. Their data has to be always in the same place in the memory (from what I remember), no sprite pointers - you still need to copy sprite data in the memory.

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: I'd like to register a complaint (fixbias)
« Reply #5 on: 2015.January.13. 09:53:23 »
yeah, but I was thinking about the mode I'm using, which is the 160x144 with pixels having the height of 2 lines. Then I need one modeline for each of the 144 lines and having a separate table would be better than changing each modeline... Such table would be short (40bytes?) and quicker to make the change...

Is there a z80 computer with proper sprites (with proper I mean more like the c64 ones, not the cpc+... although c64 and cpc+ are the only ones I know of having hardware sprites...).
Sorry, I do not understand, if you change colours, the colours should be stored in LPB's also, in case of storing margin values the LPB's should be updated also, but you are right for the mentioned screen the fastest way is a separate LPT for black screen.

As I know MSX, and MSX2 computers are z80 based and have hardware sprites also

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: I'd like to register a complaint (fixbias)
« Reply #6 on: 2015.January.13. 18:08:22 »
The fastest, and most code efficient way for switching off the screen to swap back to EXOS LPT, if FFh segment is not overwritten.

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: I'd like to register a complaint (fixbias)
« Reply #7 on: 2015.January.13. 22:33:43 »
Sorry, I do not understand, if you change colours, the colours should be stored in LPB's also, in case of storing margin values the LPB's should be updated also, but you are right for the mentioned screen the fastest way is a separate LPT for black screen.

As I know MSX, and MSX2 computers are z80 based and have hardware sprites also
I'm affraid I don't understand...
LPB means line parameter block?

My in-game Line Parameter Table looks like this:
Code: [Select]
modeline macro line_number,addr
   db 256-PIXEL_HEIGHT
   db PIXEL+C16
   db 11
   db 11+DISPLAY_LINE_WIDTH_IN_CHARS
   dw addr+(BUFFER_LINE_WIDTH_IN_BYTES*line_number)
   dw 0
   db COLOR00, COLOR01, COLOR02, COLOR03, COLOR04, COLOR05, COLOR06, COLOR07
endm

panel_modeline macro line_number,addr
   db 256-PIXEL_HEIGHT
   db LPIXEL+C4
   db 11
   db 11+40;panel_line_width_in_bytes*2;DISPLAY_LINE_WIDTH_IN_CHARS
   dw addr+(panel_line_width_in_bytes*line_number)
   dw 0
   db COLOR00, COLOR01, COLOR02, COLOR03, COLOR04, COLOR05, COLOR06, COLOR07
endm

;; display window block:

org $f000

lptab:

line_index defl 0
rept panel_height
     panel_modeline line_index,panel_address
     line_index defl line_index+1
endm

lptab_playarea:

line_index defl 0
rept playarea_height
     modeline line_index,screen+2
     line_index defl line_index+1
endm

;; sync block:

;; size of bottom border [3 lines]
    db 256-3,18,63,0,0,0,0,0,0,0,0,0,0,0,0,0

;; sync on [4 lines]
    db 256-4,16,6,63,0,0,0,0,0,0,0,0,0,0,0,0

;; sync off at half line [1 line]
    db 256-1,16,63,32,0,0,0,0,0,0,0,0,0,0,0,0

;; blank [4 lines]
    db 256-4,18+vint,6,63,0,0,0,0,0,0,0,0,0,0,0,0

;; size of top border [12 lines]
    db 256-12,19,63,0,0,0,0,0,0,0,0,0,0,0,0,0

entab equ $

My code for palette swaping:
Code: [Select]
change_palette:
;; in :
;; de = address of the first modeline inside lpt to swap palette
;; bc = 8*number_of_modelines for color swapping
;; hl = address of 9 byte sequence (fixbias,color0,color1,....,color8)

   ld a,(hl)
   out (fixbias),a
   inc hl

   push hl

swap_colors_in_lpt_loop:

   pop hl
   push hl

   ld a,8
   add a,e
   ld e,a
   adc a,d
   sub e
   ld d,a

   ldi
   ldi
   ldi
   ldi
   ldi
   ldi
   ldi
   ldi

   jp pe,swap_colors_in_lpt_loop

  pop hl
  ret

My code for switching screens (double buffer):
Code: [Select]
              bit 6,h                  ;; hl = address of currently displayed screen buffer (one buffer starts at $8000, the second at $c000)            
               jr z,do_res
do_set:
               ld a,$f6                ;; set 6,(hl) opcode
               ld (cailpt_loop_smc),a
               jr change_addresses_inside_lpt
do_res:
               ld a,$b6               ;; res 6,(hl) opcode
               ld (cailpt_loop_smc),a

change_addresses_inside_lpt:

                            ld hl,lpt+5+panel_height*16
                            ld de,16
                            ld b,playarea_height

cailpt_loop:

cailpt_loop_smc       equ $+1

                            set 6,(hl) ; or res 6,(hl)
                            add hl,de
                            djnz cailpt_loop

Am I doing it wrong?


Quote
As I know MSX, and MSX2 computers are z80 based and have hardware sprites also
Seems that there's also a z80 computer called Tatung Einstein that has some hardware sprites too. Someone wrote that it has similar specs to the msx, but I don't know much about the msx range to be honest, and never heard about tatung before.
« Last Edit: 2015.January.14. 14:49:19 by ssr86 »

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: I'd like to register a complaint (fixbias)
« Reply #8 on: 2015.January.14. 09:15:45 »
As I see you update LPT for switching screen, in this case when you are using 144 LPB's, much faster to use 2 LPT's, and just switching between them by ports 82h,83h, if there are n*1000h difference between LPT start addresses, then enough to change 83h only ( ex LPT1 at 1000h, LPT2 at 2000h, then C1h, or C2h to port 83h) if the difference is less than 1000h, then changing of port 82h is enough.
Do you use palette changing only for blacking out the screen?
I meant for this case is much faster to change active LPT to EXOS LPT (it shows a blank screen)
The start address of EXOS LPT can get from address 3bff4-3bff5h at FFh segment, it is 4000h less then the real Ninck address.

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: I'd like to register a complaint (fixbias)
« Reply #9 on: 2015.January.14. 15:12:28 »
As I see you update LPT for switching screen, in this case when you are using 144 LPB's, much faster to use 2 LPT's, and just switching between them by ports 82h,83h, if there are n*1000h difference between LPT start addresses, then enough to change 83h only ( ex LPT1 at 1000h, LPT2 at 2000h, then C1h, or C2h to port 83h) if the difference is less than 1000h, then changing of port 82h is enough.

You are right. I'll do that for the 128kb.
Currently I'm limiting myself to 64kb and my lpt takes up $950 bytes so in the end I don't know If I'll find this much free memory (undivided).

Do you use palette changing only for blacking out the screen?

No, I'm doing some in-game palette animation for weather effects (flashing). Tried to do fade-in/fade-out of the screen at start/end game but haven't thought it through and so didn't realize earlier that it's rather impossible to do (for full 16 colors) due to the fixbias mechanism... I hope the lightning flash will work ok (I haven't done any graphics so I got only the code for the palette animation running). I'll have to think of another game start/end transition effect...

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: I'd like to register a complaint (fixbias)
« Reply #10 on: 2015.January.14. 15:38:59 »
No, I'm doing some in-game palette animation for weather effects (flashing). Tried to do fade-in/fade-out of the screen at start/end game but haven't thought it through and so didn't realize earlier that it's rather impossible to do (for full 16 colors) due to the fixbias mechanism... I hope the lightning flash will work ok (I haven't done any graphics so I got only the code for the palette animation running). I'll have to think of another game start/end transition effect...
I think the lightning effect will be good if you change fixbias also, and as I saw you use it :)
I used fixbias when North&South blacked out the screen, not perfect, because the colours are not disappeared at the end, but after I reached FIXBIAS 0, I turned off the screen, and it was quite good.
Do you use only FC-FF segments for the 64K version?
Last week I checked the speed when LDI's are running in video segment (on Ikari Warrirors), I got speed about 2,2MHz.
The source and the code was in non Video RAM, the target was Video RAM on EP128.
CPC was 1,5x faster than EP64, and EP128 was 1,1x faster than CPC
« Last Edit: 2015.January.14. 15:46:04 by geco »

Offline endi

  • EP addict
  • *
  • Posts: 7298
  • Country: hu
  • grafikus, játékfejlesztõ, programozás, scifi, tudományok, vallás
    • Honlapom
Re: I'd like to register a complaint (fixbias)
« Reply #11 on: 2015.January.14. 18:35:48 »
maybe for fade effect you can try to change the bias per scanline
for this you need special irq or well-timed code
Vigyázat! Szektás vagyok! :)

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: I'd like to register a complaint (fixbias)
« Reply #12 on: 2015.January.14. 19:01:15 »
I think the lightning effect will be good if you change fixbias also, and as I saw you use it :)

I used fixbias when North&South blacked out the screen, not perfect, because the colours are not disappeared at the end, but after I reached FIXBIAS 0, I turned off the screen, and it was quite good.

I guess this is the best one can achieve without sacrificing colors.

Do you use only FC-FF segments for the 64K version?

I have been writing in a ep128 configuration and used F8,F9,FE,FF thinking that it doesn't really matter... But now I see:)... I changed ep128emu config, changed to FC-FF and it became noticeably slower. I didn't know about this:). When I read your description for Ikari Warriors' release I thought that the slowdown you wrote about was only due to the more limited memory, because it didn't allow you to use some more speed-optimized code.

From now on I guess I'll have to watch where I put my speed-critical stuff when writing for ep128...

CPC was 1,5x faster than EP64, and EP128 was 1,1x faster than CPC

Is there a z80 opcode timings table for the Enterprises like one can find for the Cpc?

maybe for fade effect you can try to change the bias per scanline
for this you need special irq or well-timed code

The problem with fixbias is that I can't set the second eight colors arbitralily - I can't for example make all colors white, all 16 colors be shades of red, all lighter colors. I'll always have some darker and some lighter colors so the transition will have to be jerkier. Updating the bias per scanline won't change that...

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14722
  • Country: hu
    • http://enterprise.iko.hu/
Re: I'd like to register a complaint (fixbias)
« Reply #13 on: 2015.January.14. 21:07:09 »
Is there a z80 opcode timings table for the Enterprises like one can find for the Cpc?
No, because no fixed timings. The Nick and Z80 running a independent and very different clocks. When the Nick use the video bus, and Z80 also want to access it then Z80 clock halted until the Nick release the video bus. Ncik running on 14.23753627 MHz, Z80 on 4Mhz (if no turbo).
Each scan line divided to 57 slots (one slot are one character wide in TEXT 40 mode), in each slot 3 video access possible, 2 used by the Nick, 1 free for the Z80.
The Z80 delay 1-5.5 Z80 clock cycles, deppending when Z80 try to access video memory.

Important: Nick port writes also generate delay.

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: I'd like to register a complaint (fixbias)
« Reply #14 on: 2015.January.15. 08:50:49 »
From now on I guess I'll have to watch where I put my speed-critical stuff when writing for ep128...

Yes, the best is using Video memory only for data, and display, and code which is not speed critical, but even if you store often used data in video memory it's access is also slower a littlebit, it does not count too much, ex at LDI speed test EP128 was 1,1x faster than CPC (it was a write to video memory)