帮助:ZX81"BASIC"窥视功能 [英] Help: ZX81 'BASIC' Peek function

查看:148
本文介绍了帮助:ZX81"BASIC"窥视功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法来确定字符('<')是否碰到了墙壁(黑色像素图形)

I need a way to find if the character ('<') has hit a wall (Black pixel Graphic)

-在ZX81游戏上.

我一直在看另一款使用代码的游戏

I'm been looking at another game... which uses code

如果peek(peek 16398 + 256 * peek 16399)=代码"黑色像素图形",则...

if peek(peek 16398 +256*peek 16399) = code "blackpixel graphic" then ...

似乎为他们工作的人...

Which seems to work for them...

这是正确的代码吗?

我对地址,获取内存和东西一无所知.

I'm not really knowledgable with addresses and getting memory and stuff.

请帮助我...

-如果您知道更好的方法.请回答 :) -有人提到光标位置",ZX81到底是什么? 谢谢,

-If you know a better way. Please answer :) -Someone mentioned 'cursor position' what the hell is that on a ZX81? Thanks,

推荐答案

PEEK(PEEK 16398+256*PEEK 16399)是一个习惯用法,意思是在当前PRINT位置获取字符编号".之所以可行,是因为ZX81 BASIC/ROM使用16398处的两字节字将指针存储到屏幕数据块中与PRINT位置相对应的存储位置.

PEEK(PEEK 16398+256*PEEK 16399) is an idiom meaning "get the character number at the current PRINT position". This works because the two-byte word at 16398 is used by the ZX81 BASIC/ROM to store a pointer to the memory location in the screen data block corresponding to the PRINT position.

因此要进行碰撞检测,您首先需要设置:

So to do collision detection, you'd first have to set:

PRINT AT X,Y;

坐标>将要移动的位置,然后读取

co-ordinates to where the > is about to move, then read

LET C= PEEK(PEEK 16398+256*PEEK 16399)

然后,如果需要,您可以在执行检查之前在屏幕上打印>(覆盖现在在C中的代码的先前字符):

then you can print the > on-screen (overwriting the previous character whose code is now in C) if you want to before doing the check:

IF C=128 THEN ...

(我想您想要的字符是全黑字符128,█.)

(I'm guessing the character you want is the all-black character 128, █.)

哦,男孩,我觉得老吗?

Oh boy, do I feel old.

这篇关于帮助:ZX81"BASIC"窥视功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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