Emulation Commodore 65

image

You never know where, when, and at what point in time you learn about an unknown computer.

This time it turned out easier.

I started looking for a list of computers based on MOS 6502 and came across the mention of C64Dx (or C65) based on 65CE02 - a prototype computer created in Commodore Business Machines in 1990-1991. This is an improved version of Commodore 64, and it was supposed to be backward compatible with an old computer, while still providing a number of advanced features close to Amiga. The number of models released is not so much, but the list of prices announced upon purchase of the C65 is impressive.

I also read about MEGA65 - a computer compatible with C64 / C65. That's it, I’m ripe for an acquaintance.

Video mode


The new VIC III chip provides the following features:

  • text mode 40/80 x25
  • 320x200x256
  • 640 Γ— 200 Γ— 16
  • 1280 Γ— 200 Γ— 4
  • 320 Γ— 400 Γ— 256
  • 640 Γ— 400 Γ— 16
  • 1280 Γ— 400 Γ— 4

Available video modes compatible with VIC II

DMA controller
128K ROM
128K RAM, expandable up to 1M
Two sound chips SID
New version of BASIC 10.0

Now an emulator.

Hi65 did not work, left only BASIC examples to get acquainted with the graphics.

I took another one . You also need to download the file and rename it to c65-system.rom

Run the emulator:

xc65.exe -8 diskimage.d81

For convenience, I began to look for cross-tools:

- Assembler 64tass since supports 65CE02
- cc1541 V3.1 - the utility creates .d81 images and adds files. So it’s more convenient to

image

describe DirMaster v3.1.5 / Style when building . MustHave.

The first goal was to write a program that displays "Hello, world!" Reading topics on the forums suggested a solution:

*=$0FFE
.byte $00, $10
  ldx #$0
cycle  lda hworld,x
       cmp #0
       beq exit
       sta $0800,x
; sta $D800,x
       inx
       jmp cycle
exit   rts
hworld .text 'hello world!',0

image

Something went wrong? Just the encoding is different:

image

Therefore, the text has changed to:

hworld .byte 8,5,$0C,$0C,$0F,$20,$17,$0F,$12,$0C,4,$21,0

image

Next, I found the Commodore 64 Programmers Reference Guide documentation and another archive that found a lot of goodies.

Reading the c64-programmers_reference_guide-03-programming_graphics.pdf dock suggested the idea of ​​a single effect. for instance

	lda #$62
	sta $D018

Place the video memory at $ 1800, and the character data at $ 800. Reading c65manual.txt , I found information about the colors:

$ D100, $ D200, the D300 $ - the R, the G, Bed and color values (0-15)
$ D800- $ DBFFF - color text attributes (or rather, all the colors are stored at the addresses $ 1F800- $ 1FFFF).

A few samples of the code, I got a ready-made character set and simple colors. I just wanted to use the DMAgic chip to transfer two sections of memory.

I began to read the docks .

The controller operates in 4 modes:

COPY - copying a section of
SWAP memory - exchanging data for
FILL sections - filling a memory section with data
MIX - performs a boolean Minterm mix on the source and receiver (kill me, I do not know how to write)

And then I got completely confused, I understood only the principle of work. For convenience, DMAT tables are used, writing data to the registers will perform the operation:

		lda #0	;the bank (0-15) where the list is
		sta $d702
		lda #>address	;the high byte of the list address
		sta $d701
		lda #<address
		sta $d700	;the low byte of the list address
				;this also triggers the dma operation,
				;and the cpu is suspended

loop:	bit $d703	;check status (in case irq/nmi enabled)
		bmi loop	;	busy
		jmp doplas
; DMA 3, 2000, ASC("+"), 0, DEC("800"), 0        Fill screen with '+'
; DMA 0, 2000, DEC("800"), 0, DEC("8000"), 1     Copy screen to $18000
address:
	.byte 0 ;command
	.word 80*25; copy size
	.word $C000 ; 800+80 ; src adr
	.byte 1 ; bank
	.word $1800 ; dst adr
	.byte 0 ; bank
	.word 0 ; modulo n/u

At the same time, in the dock, I read that you can use DMA. I wrote a program without knowing the language:

image

Now the backbone is ready, I know the necessary data, and it's time to write the code further. But, the next day I was waiting for a complete bummer - I did not find free memory and did not understand how memory operations work. The forum suggested that the reason was in the kemu emulator and suggested several procedures. In addition, some of the information is incomprehensible to me. And yet, I hope that someday I will get access to real life and find out everything that is interesting, and I can write programs. Well, isn’t it a joy?

pouet

All Articles