Only proceed onto the this code once you fully verify the previous code.
Well too late. I need to see why you are getting those errors.
Just ry this code, without using the blitter, the errors will probably be identical.
Here is the code with a fully functional blitter. Here are the blitter functions:
1. Functions 0x78ZZ,0x79ZZ,0x7AZZ,0x7BZZ
Like the pixel write base address commands 0x7C-0x7F, this tells the blitter pixel copy command where in memory the source image is located. The address taken from the contents of regs x/y[0-3].
2. Functions 0x70ZZ and 0x72ZZ:
Like the write raster width & bitplane depth commands 0x71 and 0x73, this tells the blitter pixel copy command the source image width and source image bitplane depth. The width is taken from registers x/y[3 & 2] (I know this 1 control is reversed order compared to all other commands. You never asked to switch this.) and the bitplane depth is taken from the 'ZZ'.
3. Functions 0x74ZZ & 0x75ZZ:
This function sets the blitter width and height box size to be copied +1. This means a setting of 7x, 7y will copy a box of 8 pixels by 8 lines. The width and height are taken from regs x/y[ 2 & 3 ]. (This one is in proper order.)
4. Functions 0x76ZZ & 0x77ZZ:
This function sets the source image offset. The copy read position offset are taken from regs x/y[ 2 & 3 ]. (This one is in proper order.)
5. Function 0x00ZZ:
This sets the blitter function. It is controlled by the contents of the lower command byte 'ZZ'. Here are the bit functions:
//************************************************************************************************************************************************
// p_blit_features bitmask features:
// 0 = Enable blitter 1 = run biltter copying source to output coordinates, 0 = Simple pixel write command
// 1 = Enable paste mask 1 = Pasting pixels with transparency mask, 0 = Always paste pixels even if the source has the selected transparent color
// 2 = Enable center paste 1 = Offset the paste up and to the left by half of blit_width/height, 0 = Use the paste coordinates as the top-left
//************************************************************************************************************************************************
6. Function 0x08ZZ:
This one sets a color transformation on the blitter pixel copy command. This means the read pixel is XORed with the contents of 'ZZ'. Since when using the mask feature, the transparent color is '0x00', XORing the read pixels with a custom number here other than '0x00' will change the read color which will simultaneously change what color will become transparent when a paste/write pixel is done with mask enable.
Blitting: All draw commands will blitt. This mean if you use command '0x01ZZ', the paste will begin at coordinates x/y[0], or be centered shifted depending on set width & height when 'Enable center paste' is enabled. If you use the line command '0x02ZZ', the blitter will paste a new copy of the source image for every single pixel in the source line coordinates x/y[0] - x/y[1].
The chosen drawing 'ZZ' color will perform a second XORing of the first XORed pixel copy, then allow you to change the color once again before the pixel is written. So, if your source image is monochrome 1 bit color and your destination screen is 4 bit 16 colors, you can XOR a number like 0x04 which make to output color 0x04 and 0x05 instead of 0x00 and 0x01. Careful not to choose an XOR number larger than the available colors on the destination screen, otherwise garbage will bleed into adjacent pixels.
Things you need to test:
A)
Keep using your current 16 color screen.
Set the source raster width to 8 pixels and 1 bit color depth with the base memory address set to your font memory address.
Set the blitter width and height to 8x16.
Now, keeping the source image offset X at 0, choose a character by setting the source offset Y to 16 X ASCII char #.
Blitt a copy onto a chosen screen coordinates using a command 0x01ZZ, pixel write.
Blitt multiple letters all over the place.
Test the mask enable feature.
Try changing test colors & invert the transparency making negative outline colors.
B) Attempt emulating carriage return of the bottom of the screen by using the biltter to copy begining 16 lines down, all the way to the bottom of the display, copied up to the first line of video, then draw a black box on the bottom 16 lines of video.
C) Attempt a smooth vertical scroll carriage return by making the above routine blitter copy beginning 1 line down, all the way to the bottom, pushing the image up only 1 line, waiting for a vsync, then doing this again 16 times in a row.
D) Attempt drawing a line/triangle/box/quad with a thick pen by making a 1 bit small monochrome circle 8x8 pixels. Then turn on the blitter and mask and center offset correction, and draw the shape. Your geometry lines should be painted with the circle pen you created, with it's color changes to the XORed 'ZZ' color setting.
I've attached the V6 geo blitter test bench and full EP4CE10 project. Your FPGA is >90% full. Going to a bigger chip will make achieving the FMAX easier, though right now, it will take almost 5 minutes to compile.