Dumping Memory using BASIC on 8-bit Famicom Clone – BBG


On 8-bit Famicom clones (Famiclones), the memory is usually in ‘real-mode’ meaning that you can access directly the memory by specifying the memory addresses. On most BASIC implementations of famicoms or clones or educational computers (most are 8-bit), there are two important and powerful functions, peek and poke which are used to read from and write to memory locations.

The BBG, as described here, is in my opinion the most powerful 8-bit famiclones with keyboards and floppy drive. It boots from floppy drive (the floppy disk secton 0 contains the bootable system file) and the clone OS, BBGDOS resembles MS-DOS 3.2 with the same file system (FAT12) and same commands such as dir, copy, cd and so many others.

Dumping the memory is useful, and often is the first step to collect the important data (such as ROM) to write a emulator. The following BASIC program will ask for the memory locations from and to, in order to collect the values and put them in the disk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
10   REM DUMP BIOS ON BBG
11   REM BY HELLOACM.COM
12    PRINT "DUMP MEMORY - HELLOACM.COM"
13    PRINT "MADE BY DR justyy"
14    PRINT "ENTER MIN MEMORY LOCATION"
20    INPUT MINMEM
21    IF MINMEM<0 THEN  PRINT "MINMEM<0": GOTO 14
25    PRINT "ENTER MAX MEMORY LOCATION"
30    INPUT MAXMEM
31    IF MAXMEM<MINMEM THEN  PRINT "MIN MEM SHOULD BE SMALLER THAN MAX MEM": GOTO 30
40    PRINT "DUMPING MEM, PLEASE WAIT..."
42    PRINT "MEM FROM ";MINMEM;" TO ";MAXMEM
43    OPEN "O",#1,"DUMP.DAT"
45    FOR I=MINMEM TO MAXMEM
50    VAR$=CHR$(PEEK(I))
55    PRINT VAR$;
56    PUTC #1,VAR$
60    NEXT 
70    CLOSE #1
75    PRINT ""
80    PRINT "MEM SAVED TO 'DUMP.DAT' OK! BYE BYE!"
10   REM DUMP BIOS ON BBG
11   REM BY HELLOACM.COM
12    PRINT "DUMP MEMORY - HELLOACM.COM"
13    PRINT "MADE BY DR justyy"
14    PRINT "ENTER MIN MEMORY LOCATION"
20    INPUT MINMEM
21    IF MINMEM<0 THEN  PRINT "MINMEM<0": GOTO 14
25    PRINT "ENTER MAX MEMORY LOCATION"
30    INPUT MAXMEM
31    IF MAXMEM<MINMEM THEN  PRINT "MIN MEM SHOULD BE SMALLER THAN MAX MEM": GOTO 30
40    PRINT "DUMPING MEM, PLEASE WAIT..."
42    PRINT "MEM FROM ";MINMEM;" TO ";MAXMEM
43    OPEN "O",#1,"DUMP.DAT"
45    FOR I=MINMEM TO MAXMEM
50    VAR$=CHR$(PEEK(I))
55    PRINT VAR$;
56    PUTC #1,VAR$
60    NEXT 
70    CLOSE #1
75    PRINT ""
80    PRINT "MEM SAVED TO 'DUMP.DAT' OK! BYE BYE!"

The most important statement is VAR$=CHR$(PEEK(I)) which gets the value (1 byte each time) from the memory. The values are dumped into file dump.dat (feel free to modify).

Here is how it looks like when you hit the RUN:

44ff596673785ac13237b16087d6b69f.jpg Dumping Memory using BASIC on 8-bit Famicom Clone - BBG 6502 8 bit beginner code code library famicom hardware implementation Nintendo Entertainment System programming languages tools / utilities

And the values are printed to the screen at the same time, and the file is indeed saved to disk.

9530f7bd9ca0252bf316da9c1ee12d07.jpg Dumping Memory using BASIC on 8-bit Famicom Clone - BBG 6502 8 bit beginner code code library famicom hardware implementation Nintendo Entertainment System programming languages tools / utilities

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
516 words
Last Post: Automatically Synchronize Date and Time on 8-bit BBG Famiclone using DB25 cable to Connect to PC
Next Post: Adding a pause command for 8-bit famiclone BBG - 6502 Assembly Programming

The Permanent URL is: Dumping Memory using BASIC on 8-bit Famicom Clone – BBG

Leave a Reply