在Commodore 64中在屏幕边框上绘制 [英] Draw on screen border in Commodore 64

查看:108
本文介绍了在Commodore 64中在屏幕边框上绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有25年的好奇心,我很想了解这个窍门.

I have this curiosity for 25 years and I would love to understand the trick.

在Commodore 64中,6569 VIC无法确定边界.您所要做的就是在中心区域(光标移动的区域)绘制像素.边框始终是统一的,尽管您可以用戳号53280更改其颜色,如果我没记错的话,可以更改颜色.

In the Commodore 64 the border was not addressable by the 6569 VIC. All you could do was to draw pixels in the central area, the one where the cursor moved. The border was always uniform, although you could change its color with poke 53280,color if i remember correctly.

尽管如此,我仍然清楚地记得游戏介绍中的边框带有图形,就像它完全可以寻址一样.我试图了解它是如何工作的,但一直没讲到重点.传说说这是对精灵的巧妙运用,在某些情况下可以在边界上绘制精灵,但我不知道这是否是都市传说.

Nevertheless I clearly remember games intros where the border was featured with graphics, like it was fully addressable. I tried to understand how it worked but never got to the point. legends say it was a clever use of sprites, which could, under some circumstances, be drawn on the border, but I don't know if it's an urban legend.

修改:只需从提供的链接之一中阅读

edit: just read this from one of the provided links

子画面跨多路传输 垂直栅格线(超过8个精灵, 有时最多120个子画面).直到 Group Crest在发行了Krestage 3 2007年5月, 认为不超过8个精灵 可能会出现在一条光栅线上,但是 分配新的Y坐标 重新出现在屏幕下方.

Sprites were multiplexed across vertical raster lines (over 8 sprites, sometimes up to 120 sprites). Until the Group Crest released Krestage 3 in May 2007 there was the common perception that no more than 8 sprites could appear at one raster line, but assigning new Y coordinates made it reappear further down the screen.

这很邪恶....您击败了栅格,并在精灵到达那里之前重新放置了它的位置...

This is evil.... you beat the raster and reposition the sprite before it gets there...

推荐答案

首先,只能在边框区域或从视频库的最后一个字节读取的重复8位模式(8像素宽)中显示精灵,通常是$ 3fff.请注意,当您诱骗VIC芯片不显示"边界时,您只能看到这些Sprite或8位模式.见下文.

Firstly only sprites can be displayed in the border area or a repeating 8 bit pattern (8 pixels wide) which is read from the last byte of the video bank, usually $3fff. Note you can only see these sprites or 8 bit pattern when you trick the VIC chip into "not displaying" the borders. See below.

边框的优先级高于精灵,因此通常在边框区域绘制精灵时,边框会覆盖精灵.借助一些VIC芯片技巧,您可以关闭边框.

The borders have a higher priority than sprites, so normally when a sprite is drawn in a border area the border covers the sprite. With a bit of VIC chip trickery you can turn the borders off.

您可以很容易地关闭顶部和底部边框(我将在下面说明),并且在非常关键的时间关闭侧面边框.

You can turn the top and bottom borders off quite easily (I'll explain below), and the side borders off with very critical timing.

首先是有关VIC芯片在c64上如何工作的一些信息.

Firstly a little bit of info on how the VIC chip works on a c64.

VIC芯片从左上方到右上方绘制屏幕,​​然后向下画一条线,然后再从左向右绘制屏幕,​​直到绘制整个屏幕.它以每秒50次(对于PAL单位)或每秒60次(对于NTSC单位)执行重绘.

The VIC chip draws the screen from the top left to the top right, then down a line, and from left to right again until the entire screen is drawn. It performs this redraw 50 times a second (for PAL units) or 60 times a second for (NTSC units).

有一个8位VIC寄存器,其中包含任何给定时间的光栅垂直位置. $ d012.实际上有超过255个可能的位置,因此第9位存储在位7(最高位)或寄存器$ d011中.因此,您可以随时读取这些寄存器并找出栅格的垂直位置.没有可用的寄存器来读取栅格的x位置.

There is an 8-bit VIC register that contains the vertical position of the raster at any given time. $d012. Actually there are more than 255 possible positions, so the 9th bit is stored in bit 7 (highest bit) or register $d011. So at any point you can read these registers and find out the vertical position of the raster. There is no available register to read the x position of the raster.

在使用硬件滚动时,使用了VIC芯片的另一个很酷的功能来解决问题.通过使用硬件寄存器将屏幕垂直移动0-7像素,可以实现基本的垂直滚动.达到限制(0或7,具体取决于滚动方向)后,您将垂直移动每个字符块(8x8像素)一个块,并绘制要显示在顶部(或底部,取决于方向)的新数据.效果很好,除了每滚动8个像素,您就会看到数据弹出"到屏幕上.要解决此问题,可以通过清除寄存器$ d011中的位3使边框区域垂直增加8个像素.这称为24行模式.默认情况下,屏幕设置为25行8x8像素字符.在24行模式下,您仍然可以将字符绘制到最底行,它们只会被边框隐藏.

Another cool feature of the VIC chip was used to fix a problem when using hardware scrolling. Basic vertical scrolling was achieved by using a hardware register to move the screen 0-7 pixels vertically. Once you reached limit (0 or 7 depending on the direction of the scroll) you would move each character block (8x8 pixel) one block vertically and draw the new data to be displayed at the top (or bottom depending direction). This works very well, except that every 8 pixels of scrolling you would see data "pop" onto the screen. To remedy this, you could make the border area grow by 8 pixels vertically by clearing bit 3 in register $d011. This is called 24 row mode. By default the screen was set to 25 rows of 8x8 pixel characters. In 24 row mode, you could still draw characters to the bottom row, they would just be hidden by the border.

因此关闭顶部和底部边框的技巧是:

So the trick to turning off the top and bottom borders is to:

1)将屏幕设置为25行模式

1) Set the screen to 25 row mode

2)等待栅格到达$ f2和$ fa之间的垂直位置(在24行模式和25行模式下边框开始的8个像素).

2) wait for the raster to reach a vertical position between $f2 and $fa (the 8 pixels between where the border starts in both 24 row mode and 25 row mode).

3)将屏幕设置为24行模式...将边框的垂直起点移动到当前栅格位置上方

3) Set the screen to 24 row mode... moving the vertical start of the border above the current raster position

4)等到垂直栅格位置($ fa)

4) Wait until after vertical raster position ($fa)

5)重复每一帧

步骤3)欺骗了VIC芯片,使其认为它已经开始绘制边框,因此它从未开始绘制边框.瞧,顶部和底部边界都是开放的.

Step 3) tricks the VIC chip into thinking that it has already started drawing the border, so it never starts drawing it. Voila, the top and bottom borders are open.

关于侧面边框,您可以使用不同的套准进行相同的操作,但是由于栅格的水平移动比垂直移动快得多,因此时序需要更加紧凑.还有另一个需要考虑的问题称为抖动. <-在此不做解释.在网络上搜索"Stable Raster C64",以获取对该问题的深入说明.

Regarding side borders you can do the same thing with different registers, but as the horizontal movement of the raster is a lot quicker than the vertical movement, the timing needs to be much tighter. And there is another issue to take into account called jitter. <-which I won't explain here. Search the web for "Stable Raster C64" for an in depth explanation of that issue.

这篇关于在Commodore 64中在屏幕边框上绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆