6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Apr 30, 2024 7:45 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu Dec 09, 2010 11:24 am 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
Hallo allemaal,


I'm busy with the 65816 core. Is there a 65816 emulator available that enables me to test my (still to create) ASM file?

Thank you!

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 09, 2010 8:09 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Yep! Samuel's lib65816


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Dec 10, 2010 12:32 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
BigEd wrote:
Yep! Samuel's lib65816

It looks to me like a library for C ???
Not being a C programmer I prefer something VICE like i.e. something that enables me to load a program and check it with a monitor.

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Dec 10, 2010 1:01 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Ah yes, it looks like I wrote/borrowed a command-line invocation wrapper called run65816 (modeled after run6502)

Perhaps you could use KEGS?

Or I could try to help you with run65816 (which is unpublished) [Edit - now published - see below]

Code:
$ ./run65816 -B -l 0 bbc.img
loading ROM file bbc.img
WARP FACTOR 5

BBC Computer 32K

BASIC

>PRINT PI
3.14159265
>


Code:
$ ./run65816 [option ...] -B [image ...]
  -B                -- (mandatory) minimal Acorn 'BBC Model B' compatibility
  -h                -- help (print this message)
  -l addr file      -- load file at addr
  image             -- '-l 8000 image' in available ROM slot

'last' can be an address (non-inclusive) or '+size' (in bytes)



Quote:
$ less README.txt
Ed S
2009-03-28

run65816.c is a minimal BBC-micro emulator based on a test program
posted on 6502.org by Samuel A. Falvo II aka kc5tja and also based
on run6502 by Ian Piumarta which forms part of his lib6502 package

it emulates a BBC micro with a 65816, additional RAM, and some
supporting decode logic.

usage:
./run65816 -B -l c000 ../rom-images/OS12.ROM \
../rom-images/BASIC2.ROM ../boot816/boot816.bin

the Makefile is adjusted to build run65816 as well as lib65816

lib65816 has been tweaked to support run65816:
src/dispatch.c
to use the new M_FETCH instead of M_READ for instruction fetches
to resurrect the E_UPDATE cycle count mechanism for regular IRQs
config.mk
to pick up CCOPTS and to add the -g flag to cc
to default CCOPTS to add -DDEBUG -DOLDCYCLES for tracing and E_UPDATE
lib65816/cpu.h
to define the new M_FETCH

TODO/BUGS
BRK is handled by appropriating the WDM opcode hook
WDM is not available to trigger tracing or stack dumps
IRQ vector is pulled from bank0, with no easy way to emulate hardware redirection
Most of the run6502 command line interface is not ported
There's no means of selecting non-BBC or other hardware variants
There's no command line interface to the tracing capability
The regular IRQs are done using a deprecated mechanism
The regular IRQs are not done by emulating VIA hardware
Should handle Vector Pull and Valid Program Address by passing up from lib65816 to the emulator


Last edited by BigEd on Fri Jun 12, 2015 3:56 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Dec 11, 2010 4:54 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
lib65816 is a library, hence the 'lib' part of its name. It's intended to be linked into an emulator driver.

run65816, which uses lib65816 IIRC, is probably what you're looking for. I was thinking of writing a similar CLI-based invoker to develop a Forth image that I could port elsewhere, but never got around to it.

lib65816 is used in my Kestrel-2 emulator, but I suspect that's way overkill, and I don't have any OS for it. Since it lacks a text-mode display, you'd have to write your own text output routines.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Dec 11, 2010 1:19 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Ruud wrote:
BigEd wrote:
Yep! Samuel's lib65816

It looks to me like a library for C ???
Not being a C programmer I prefer something VICE like i.e. something that enables me to load a program and check it with a monitor.
Hi Ruud I'm away from keyboard, but the MESS emulator has an apple2gs mode and some kind of debugger - might be worth a try
Cheers Ed


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Dec 11, 2010 7:33 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
Hallo BigEd, kc5tja,

Thank you for your input. Your ideas about the 2GS are good but there is a small problem: I have no idea how to operate this computer. OK, everything can be learned but I doubt if have the patience for it or the time. Then I rather prefer BigEd's BBC emulator.

I'm also thinking of equiping one of my Commodores of the 3000 series with a 65816 and replace the ROM with my test-FRAM. The advantage of the 3000 series is that they have a TTL-video part i.e. no initialisation of the video-IC needed. This is way how I tested the ROM for the 6502 under VICE.

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 12, 2010 8:58 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Ruud wrote:
... prefer BigEd's BBC emulator.
But sadly there's no built-in monitor or debug. In fact I don't think I've yet run a 65816 single-stepper. There are several possible ways forward:
- Daryl's Sysmon (SBC monitor) can do most things
- Jammon might be good but I haven't yet seen it working (based on C64/SuperCPU)
- The Apple II gs has a ROM-resident monitor, so a GS emulator like KEGS, MESS or Florence should be able to run that
- Each of those GS emulators also have a debugger at the emulator level - it might be possible to boot into your own code and single-step it, without needing any I/O or machine initialisation
- There are also SNES emulators out there.
- running any emulator, including one based on lib65816, inside gdb might allow for some means of single stepping, dumping machine state and setting breakpoints. If there's a function to print machine state, that could be called (I think) from gdb.
- finally, it's surely possible to write a debugger for lib65816 (but I'm not likely to do it)

For me, probably booting a GS emulator and trying the Apple monitor would be the first tactic to try. It looks like I did have KEGS running BASIC a year ago, so it shouldn't be too hard to do that.

Edit: turns out to be easy to download and run KEGS - even with a ROM, it's just about possible to use the emulator's debugger to load code, single step it and see the machine state. (Middle-mouse to get into the debugger - some trouble with the way it reads some extra junk character on each newline, so I cleaned up the following a bit.)

This is on Windows, but using cygwin:
Code:
$ echo ea200000|xxd -r -p > test.dmp

> 0ultest.dmp
Unix commands
Loading..About to open: test.dmp,len: 8
Read/write: addr 000000 for 20000 bytes, ret: 4 bytes

> 0l
1=m 1=x 1=LCBANK
00/0000: ea             NOP
00/0001: 20 00 00       JSR     $0000
00/0004: 00 00          BRK     $00

> ^E
  PC=00.0001 A=0000 X=0000 Y=0000 P=134 S=0133 D=0000 B=00,cyc:8089250.144

> s
leaving run_prog, halt_sim:0
  PC=00.0000 A=0000 X=0000 Y=0000 P=134 S=0131 D=0000 B=00,cyc:8089250.188
00/0000: ea             NOP

> h
KEGS Debugger help (courtesy Fredric Devernay
General command syntax: [bank]/[address][command]
e.g. 'e1/0010B' to set a breakpoint at the interrupt jump pt
Enter all addresses using lower-case
As with the IIgs monitor, you can omit the bank number after
having set it: 'e1/0010B' followed by '14B' will set
breakpoints at e1/0010 and e1/0014

g                       Go
[bank]/[addr]g          Go from [bank]/[address]
s                       Step one instruction
[bank]/[addr]s          Step one instr at [bank]/[address]
[bank]/[addr]B          Set breakpoint at [bank]/[address]
B                       Show all breakpoints
[bank]/[addr]D          Delete breakpoint at [bank]/[address]
[bank]/[addr1].[addr2]  View memory
[bank]/[addr]L          Disassemble memory
P                       Dump the trace to 'pc_log_out'
Z                       Dump SCC state
I                       Dump IWM state
[drive].[track]I        Dump IWM state
E                       Dump Ensoniq state
[osc]E                  Dump oscillator [osc] state
R                       Dump dtime array and events
T                       Show toolbox log
[bank]/[addr]T          Dump tools using ptr [bank]/[addr]
                            as 'tool_set_info'
[mode]V                 XOR verbose with 1=DISK, 2=IRQ,
                         4=CLK,8=SHADOW,10=IWM,20=DOC,
                         40=ABD,80=SCC, 100=TEST, 200=VIDEO
[mode]H                 XOR halt_on with 1=SCAN_INT,
                         2=IRQ, 4=SHADOW_REG, 8=C70D_WRITES
r                       Reset
[0/1]=m                 Changes m bit for l listings
[0/1]=x                 Changes x bit for l listings
[t]=z                   Stops at absolute time t (obsolete)
S                       show_bankptr_bank0 & smartport errs
P                       show_pmhz
A                       show_a2_line_stuff show_adb_log
Ctrl-e                  Dump registers
[bank]/[addr1].[addr2]us[file]  Save mem area to [file]
[bank]/[addr1].[addr2]ul[file]  Load mem area from [file]
v                       Show video information
q                       Exit Debugger (and KEGS)
>


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 20, 2013 12:07 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Due to popular demand (one request) I decided to publish run65816 with a GPL license - see attached.

This is a minimal wrapper for Sam Falvo's lib65816, which you'll find at
https://github.com/sam-falvo/lib65816 (previously at https://bitbucket.org/kc5tja/lib65816)

Cheers
Ed

Edit: fix linkrot


Attachments:
run65816.tgz [5.42 KiB]
Downloaded 389 times


Last edited by BigEd on Sat Oct 24, 2020 2:58 pm, edited 1 time in total.
Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 13, 2015 6:13 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
By request, I'm listing a link to my lib65816 library here: https://bitbucket.org/kc5tja/lib65816

Documentation is pertty sucky, but here's a project for a very early Kestrel emulator where I use lib65816 to emulate its CPU. https://bitbucket.org/kc5tja/kestrel-em ... at=default


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: