jac@paul.rutgers.edu (Jonathan A. Chandross) (11/19/90)
Submitted-by: None Posting-number: Volume 1, Source:4 Archive-name: unix/simulator/koning/part01 Architecture: UNIX Version-number: 1.00 This is the first of several Apple ][ simulators that will be posted. You should get 3 parts: part01, part02, part03 As always, packed in AAF format. Enjoy. ****************** =Manifest -6502.c -Makefile -README -README2 -apple.h -debug.c -main.c -mega2.c =README - -Apple ][ Emulator -- (C) 1989 Ben Koning - 408/738-1763 (IP: ben@apple.com) (AL: KONING.BEN) - 1360 Flicker Way Sunnyvale CA 94087-3407 - 18 Ortalon Ave Santa Cruz CA 95060 - - -This software package is an Apple ][ / Apple ][ Plus emulator for UNIX -systems. It emulates a 6502 microprocessor, contains Apple ][ ROM code, -and emulates a few Apple ][ memory mapped I/O features. - -Usage syntax: - - Apple.II [-t] [-m] [-i] - -If no parameters are specified, then an Apple ][ Plus (autostart and apple- -soft) are selected. Trace (-t) mode causes the state of the processor to be -printed to the standard error output at the end of each 6502 instruction. -The Original Monitor (-m) and Integer Basic (-i) options override the default -ROM configuration. - -To exit the simulation, type Control - A. - -Currently, the only I/O features supported are Page 1 40-Column text, -keyboard input, keyboard strobe, and speaker toggle (sends beep to terminal). -Unimplemented 6502 instructions are executed as NOPs. - =README2 -What *YOU* Need to provide - -four ROM Files: -APPLESOFT.ROM <= $d000 to $f777 ][+ Applesoft Basic ROM -AUTOSTART.ROM <= $f800 to $ffff ][+ autostart monitor ROM - -optional: -INTEGER.ROM <= $d000 to $f777 Integer Basic ROM -MONITOR.ROM <= $f800 to $ffff Original Monitor ROM - - -PRODOS <= PRODOS System File - - -how to boot system: -start up simulator - -] CALL 8192 - -or to boot from slot 7 Drive 2 - -] CALL -151 - -*43:F0 or 70 for slot 7 drive 1 - -*2000G - -Debugger commands -use ctrl-A to enter the debugger - -l load a UNIX binary file into Main Memory -s single step with trace -t trace execution with debug output to UNIX file -c continue execution -<ret> same as s -q quit simulator - -debugging technique: -use in conjunction with dbx -break into debugger -step until a LDA $C000 instruction is executed -break into dbx -set A = 128 + 'x' where x is the key you want pressed -continue simulator - -how to initialize/format slot 7 drive 2 - -a) startup simulator and PRODOS -b) enter debugger with ctrl-A -c) type l <return> this is the load command -d) enter name of UNIX file containing binary image of a program like COPY ][+ -e) this will load the binary at $2000 -f) save this to slot 7 disk 1 -g) run it, and tell it to format slot 7 disk 2 -h) this will format a disk with 1024 blocks (change the #define in mega2.c - if you want a larger disk) - - -requests does anyone have a generic disk formatter for a ][+? - -please forward any enhancements you may have. - -I can be reached at - -nakada@husc4.harvard.edu -or -pnakada@oracle.com - - - - =Makefile -# -#Makefile for Apple ][ Emulator -#(C) 1989 Ben Koning [556498717 408/738-1763 ben@apple.com] -# - -#Local printing command: -PRINT = lpr -Psimplex - -#Apple.II is split up as follows: -OBJ = main.o 6502.o mega2.o debug.o - -#Make normal version: -debug: ${OBJ} apple.h - cc -g $(OBJ) -lcurses -ltermcap -lint: - lint main.c 6502.c mega2.c debug.c -lcurses -ltermcap - -#Make final optimized version: -final: - touch apple.h - make debug - strip a.out - mv a.out Apple.II - make clean - -#Make profiling version: -profil: - cc -pg main.c 6502.c mega2.c debug.c -lcurses -ltermcap - -#Building modules from source: -main.o: main.c apple.h - cc -c -g main.c -6502.o: 6502.c apple.h - cc -c -g 6502.c -mega2.o: mega2.c apple.h - cc -c -g mega2.c -debug.o: debug.c apple.h - cc -c -g debug.c - -#Cleanup of directory: -clean: - rm -f ${OBJ} - rm -f file - rm -f a.out - rm -f core - -#Printout without long ROM listings: -print: - rm -f file - touch file - pr README >> file - pr Makefile >> file - pr *.h >> file - pr main.c >> file - pr 6502.c >> file - pr mega2.c >> file - $(PRINT) file - rm -f file - wc *.h *.c - -#Printout with long copyrighted ROM listings: -printall: - make print - =apple.h - -/* - *apple.h -- Globals' xdefs and equates for system calls for Apple ][ Emulator - *(C) 1989 Ben Koning [556498717 408/738-1763 ben@apple.com] - */ - - - -/* Character which ends the emulation: */ - -#define MEGAQUITKEY 001 /* Control-A */ - - - -/* XENIX/BSD - Compatible includes: */ - -#ifndef BUFSIZ -#include <stdio.h> -#endif - -#ifndef isalpha -#include <ctype.h> -#endif - -#ifndef CBREAK -#include <sgtty.h> -#endif - -#ifndef TIOCGETP -#include <sys/ioctl.h> -#endif - -#ifndef O_NDELAY -#include <fcntl.h> -#endif - -#define BYTE unsigned char -#define ADDR int - - - -/* 6502 Globals: */ - -extern int A,X,Y,P,S; -extern ADDR PPC; - - - - - -/* Emulation Globals: */ - -extern BYTE MMemory[]; -extern BYTE Rom[]; -extern BYTE MRam[]; -extern BYTE MRam1[]; -extern BYTE MRam2[]; -extern BYTE RamRead; -extern BYTE RamWrite; -extern BYTE Bank2Enable; - -extern BYTE MegaRand; -extern BYTE MegaLastKey; -extern BYTE MegaQuitDetect; -extern int DebugSingle; -extern int DebugTrace; -extern ADDR DebugBreak; - - -/* Apple ROM Contents: */ - -extern BYTE MegaGetMem(); - - -/* Termcap stuff: */ - - -extern void Debugger(); -extern void MegaShutDown(); -extern void MegaStartUp(); -extern void MegaPutMem(); - -extern void prodos(); - -extern void CPUShutDown(); -extern void CPUReset(); -extern void CPUExecute(); - + END OF ARCHIVE