Using Peek function to read from Memory on BBG Famicom Clone on Basic Programming Language


Most keyboards for famicom clones are not designed for games, but they are made for programming BASIC e.g. NES F-Basic.

The BBG Famicom clone (as described here) is an ultimate 8-bit FC machine for games and even for learning programming in BASIC, LOGO and 6502 assembly.

There is a PEEK function in basic.cmd on 8-bit BBG Famiclone. You can use peek to read value directly from memory (real mode) by specifying the memory location.

The following shows how to read a key from keyboard using INKEY$ and print its scan code.

1
2
3
4
5
6
7
10 A$=INKEY$
20 IF A$="" THEN GOTO 10
30 CODE=PEEK(256)
40 SCAN=PEEK(257)
70 PRINT A$
80 PRINT CHR$(CODE), SCAN
90 GOTO 10
10 A$=INKEY$
20 IF A$="" THEN GOTO 10
30 CODE=PEEK(256)
40 SCAN=PEEK(257)
70 PRINT A$
80 PRINT CHR$(CODE), SCAN
90 GOTO 10

INKEY$ is similar to keypressed which checks for any key pressed. It does not block the current code execution so which is often used in games. If no keys are pressed, then the value is empty. Memory location at 256 keeps the last key pressed and 257 holds its corresponding scan code.

ed2398e46e3f2d79a421334ba56135f2.jpg Using Peek function to read from Memory on BBG Famicom Clone on Basic Programming Language 8 bit assembly language console famicom hardware programming languages vbscript

This is useful, and we can use this for more advanced purpose, such as dumping the BIOS, to be shown later.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
325 words
Last Post: PI Computation on BBG Famiclone using BASIC
Next Post: Automatically Synchronize Date and Time on 8-bit BBG Famiclone using DB25 cable to Connect to PC

The Permanent URL is: Using Peek function to read from Memory on BBG Famicom Clone on Basic Programming Language

Leave a Reply