Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Basic emulator
2020-12-22 15:57
Sasq

Registered: Apr 2004
Posts: 155
Basic emulator

How much of the C64 do you need to emulate to run (poke free) basic programs ?
 
... 29 posts hidden. Click here to view all posts....
 
2020-12-23 01:24
Martin Piper

Registered: Nov 2007
Posts: 634
If you patch out some raster waits etc. You don't even need I/O or CIA. Just CPU will do
2020-12-23 03:19
chatGPZ

Registered: Dec 2001
Posts: 11114
If you want keyboard input, you certainly need the timer irq :)
2020-12-23 05:49
Martin Piper

Registered: Nov 2007
Posts: 634
Quote: If you want keyboard input, you certainly need the timer irq :)

Not really. It's possible to fake keys into the right locations in zero page and stub out the relevant routines.
2020-12-23 09:59
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: Not really. It's possible to fake keys into the right locations in zero page and stub out the relevant routines.

I found it easier to just let a timer call ($fffe) and fake the dc00/1/d registers.
2020-12-23 11:15
Sasq

Registered: Apr 2004
Posts: 155
I'm doing something similar, and it seems to work.

So what I was hoping to look at some source code for converting incoming key presses to dc00/dc01 matrix data...

I guess I also want to fake loading... maybe intercepting FFD5 and copying in the data while skipping the actual load routine somehow ?
2020-12-23 11:29
Martin Piper

Registered: Nov 2007
Posts: 634
If you want to fake the cd00/01 values, you need to convert from key to keyboard matrix values: https://www.c64-wiki.com/wiki/Keyboard#Keyboard_Matrix

And also take note of the data direction registers, and also respond to the "request" to poll a certain column.

Which is not hard, but just a bit picky to get really correct.

Hence why I suggest stubbing out (or intercepting) kernal routines and plonking values into the keyboard buffer memory instead. :)
2020-12-23 16:24
BiGFooT

Registered: Mar 2002
Posts: 31
Well... I'm not sure if this will help or not, but here's a table I've used in my emulator experiments.

keyb_rowcol[256]={
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x72, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff,
0x17, 0x75, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, 0xff,
0x74, 0xff, 0xff, 0xff, 0x63, 0x02, 0x07, 0x02, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x43, 0x70, 0x73, 0x10, 0x13, 0x20, 0x23, 0x30, 0x33, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x12, 0x34, 0x24, 0x22, 0x16, 0x25, 0x32, 0x35, 0x41, 0x42, 0x45, 0x52, 0x44, 0x47, 0x46,
0x51, 0x76, 0x21, 0x15, 0x26, 0x36, 0x37, 0x11, 0x27, 0x31, 0x14, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x03, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0x53, 0x57, 0x50, 0x54, 0x67,
0x71, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x56, 0x65, 0x61, 0x62, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

The upper nibble is the Nth bit of PA, the lower nibble is the Nth bit of PB.

if (keyb_rowcol != $ff)
{
$dc00 = 1 << (keyb_rowcol[keycode >> 4])
$dc01 = 1 << (keyb_rowcol[keycode & $0f])
}

If it helps then I can give you a complete emulator, standalone basic source, (de)tokenizer and even a pc native cbm basic interpreter.
2020-12-25 08:06
Sasq

Registered: Apr 2004
Posts: 155
I only handle dc00/dc01 keys and run the IRQ, and it seems to work, excpet if I try RUN I get:

READY.                                                              
RUN                                                                 
                                                                                               
?UNDEF'D STATEMENTBAD SUBSCRIPTREDIM'D A                            
RRAYDIVISION BY ZEROILLEGAL DIRECTTYPE M                            
ISMATCHSTRING TOO LONGFILE DATAFORMULA T                            
OO COMPLE  ERROR                                                    
READY.


What could be wrong ?
2020-12-25 13:41
tlr

Registered: Sep 2003
Posts: 1714
The strings are ended with the last char having the MSB set, maybe a clue?

I'm assuming your cpu-core passes rudimentary testsuites. In that case, have you stubbed of CHROUT and forgot to return registers+flags in a state similar to what the kernal does?
2020-12-25 22:29
mankeli

Registered: Oct 2010
Posts: 110
Probably you don't even need a full cpu. Iirc I managed to implement enough 6510+SID in few hours to play back goatse songs.
Previous - 1 | 2 | 3 | 4 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Didi/Laxity
Acidchild/Padua
Guests online: 128
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.052 sec.