Commit Graph

70 Commits

Author SHA1 Message Date
Brad Grantham
2e7f809bc9 Fix compile errors caused by moving to range for 2017-01-04 22:09:31 -08:00
Brad Grantham
30ec998252 Use range-for on containers 2017-01-03 09:41:38 -08:00
Brad Grantham
453c90d4cf Fix buffer underrun in audio code 2017-01-02 12:02:44 -08:00
Brad Grantham
cb60985ef0 Move audio implementation into interface.cpp
Move all libao operation into interface.cpp
This should have the result of removing all AV and GUI code from apple2e.cpp
OS code remaining in apple2e.cpp should basically be only file I/O, console I/O, and chrono.
2016-12-26 22:28:45 -08:00
Brad Grantham
8817b799b6 Make Lemmings start up (but wrong Lemmings...)
Implement EOR zpg,X
Implement ROL zpg,X (Thanks, Bart and Dad!)
2016-12-26 01:34:57 -08:00
Brad Grantham
33314406c0 use my CPU 2016-12-09 13:06:50 -08:00
Brad Grantham
bbf62836b3 use 1000Hz as audio cutoff 2016-12-07 14:42:28 -08:00
Brad Grantham
e95048d6e9 remove printf in waveform initialization 2016-12-06 18:58:25 -08:00
Brad Grantham
1d8a138123 Slightly better audio using a sine wave approximation
Choose a 2000Hz sine wave as a trade off between smoothing audio and preserving audio

Fix #14
2016-12-06 18:24:11 -08:00
Brad Grantham
456aca2269 Remove termio keyboard, disable 80-col on RESET 2016-12-05 17:27:57 -08:00
Brad Grantham
5b4116fdf2 Also reset other 6502 on RESET 2016-12-05 10:04:38 -08:00
Brad Grantham
ddf4655a43 Implement 80-column mode - ProDOS boots to 80 cols
Catch ALTCHAR but do nothing about it
Catch VID80 (80VID)
Add aux pages to interface.cpp
Plumb aux pages through apple2e.cpp display_write functions
Implement 80-column text shader using aux page
2016-12-04 22:07:00 -08:00
Brad Grantham
85b741e61c whoops, strcmp == 0 if equal 2016-12-04 13:09:56 -08:00
Brad Grantham
ebd5d06e87 ProDos sector ordering for .po files 2016-12-03 10:06:48 -08:00
Brad Grantham
96835e2400 Add drag-and-drop floppies, fix cold-start
On cold-start, force Button0/OpenApple on for a short period
    This is how cold-start (disk boot) is differentiated from plain RESET
Add padding widget that pads another widget on all sides
Add drag-and-drop functionality to widgets and manage through GLFW
Honor current time through all widget methods
Fix character encoding in text_widget (especially for ' ')
Add floppy_icon widget that manages drag-and-drop and drive motor (activity) light
    Later move to vector graphic or bitmap
Add floppy eject and insert notification from APPLE2Einterface
Add activity notification through APPLE2Einterface
Optimize with -O2
2016-12-02 10:42:22 -08:00
Brad Grantham
c5dc2ec782 Honor -fast in UI; lay groundwork for floppy UI 2016-12-01 12:03:40 -08:00
Brad Grantham
620cc1aa04 More instructions: DOS Master boots (crashes to Monitor)
ORA abs, Y
ROR abs, X
2016-11-30 10:42:36 -08:00
Brad Grantham
9cf71aa21f More instructions: Choplifter works
Implement 0x80 (NOP imm, aka "DOP")
TXS doesn't set flags
Remove 65C02 0x80 (BRA imm)
Add ORA (ind, X)
2016-11-30 09:26:19 -08:00
Brad Grantham
ed8dfa33ea Rudimentary paddle support, fix audio stuttering
Mouse/Trackpad drag across the screen emulates paddles
Click on the screen emulates button 0
Ignore reads from C020 (tape out)
Add BRA instruction for 65C02 (maybe not necessary)
Disable audio in FAST mode
Throttle a little better when audio is enabled - stopped stutter
2016-11-29 22:17:17 -08:00
Brad Grantham
cfe9d962d8 BCD mode; SED; AND zpg, X 2016-11-29 00:25:04 -08:00
Brad Grantham
ca376dab5a CAPS lock, More instructions and compatibility
GLFW doesn't pass through Mac CAPS lock key for some reason.
CAPS button in GUI works, though.
Implement more instructions, mostly for ChopLifter
    DEC abs, X
    INC abs, X
    AND (ind), Y
    AND abs, X
    ROR abs
Now ChopLifter needs unimplemented SED!  Probably uses decimal mode while printing score.
Set "then" at end of CPU loop to try to throttle better.  Not sure it helps.
2016-11-28 14:22:22 -08:00
Brad Grantham
f107f4b23d More instructions and compatibility
Fix ADC abs (was accidentally adding Y to address)
Also handle bank switch registers on write
Initialize CPU6502 registers to 0 to match fake6502
    Avoid spurious differences
Implement more instructions
    ADC (ind), Y
    ADC abs, X
    ORA zpg, X
2016-11-28 13:27:52 -08:00
Brad Grantham
0b1b083f6c don't enqueue new audio buffer if no audio 2016-11-28 09:54:36 -08:00
Brad Grantham
604bf07b4f Partially implement floppy disks
Floppy disks partially work:
    apple2e -noaudio -fast -diskII disk2romfile {floppy1name,"none"} {floppy2name,"none"} apple2e.rom

Import nybblizer from Shamus but only DOS
Support floppy hardware
    track motor stepper
    enable
    read
Add -noaudio (otherwise execution is throttled by waits once audio buffer is filled)
Only read ROM at D000 and E000 if C08X_read_RAM isn't turned on
RAMRD, RAMWRT, and ALTZP are implemented, note them as such in constructor
Correctly decode C08X soft switches
Implement a bunch more instructions
    INC abs
    LDY abs, X
    SBC abs, Y
    ADC abs
    ASL abs
    LSR abs, X
    ORA abs
    ORA abs, X
    AND abs, Y
    STA (ind, X)
    LDX abs
    CPX abs
    EOR (ind, X)
    EOR abs
    EOR abs, X
    STX abs
Throttle to actual number of clocks per instruction
Temporarily enable "Fake6502" instead of my CPU because there's an obvious difference
Better blink speed in interface.cpp
2016-11-27 17:10:03 -08:00
Brad Grantham
fb476db138 beginning of diskII support 2016-11-26 14:51:14 -08:00
Brad Grantham
a9f5b9f18a Audio. Probably won't work properly in FAST mode.
Try COLORBOUNCESOUND.A.
2016-11-23 23:29:23 -08:00
Brad Grantham
4085189d9f Make instruction timing a lot more correct
Fix up clock timing on absolute-indexed, indirect-indexed, and branch instructions
Emitted clock ticks now match up with emulated and video recorded beep sound
(code to save off and postprocess ticks not checked in)
2016-11-23 20:31:30 -08:00
Brad Grantham
e29d6ff984 implement ORA (ind), Y for Integer Basic 2016-11-23 16:36:29 -08:00
Brad Grantham
c0a1aafbb8 system clock; count instruction cycles except branch/page penalties 2016-11-23 15:29:47 -08:00
Brad Grantham
4db793add1 PAUSE button works, CAPS and COLOR unimplemented 2016-11-23 10:53:56 -08:00
Brad Grantham
f204764575 Add buttons for REBOOT, FAST
Factor out "text_widget" that can draw text
Change "button" widget to "momentary"
Add new "toggle" widget
Use vbox to contain all buttons
2016-11-22 20:02:49 -08:00
Brad Grantham
7f8539ae00 Add RESET button
Add button class to interface
Check for press/drag/release of RESET button
Add FG and BG color for textport shader (for active button)
Handle RESET and REBOOT events in main loop
2016-11-22 16:09:48 -08:00
Brad Grantham
ae04f41257 make UI more interactive in fast mode 2016-11-20 14:21:01 -08:00
Brad Grantham
9554f80a00 Allow option to free-run 6502 clock
-fast command-line option and "fast" debugger command enable 6502 to essentially run as fast as possible.
In "fast mode", execute approximately 10 seconds worth of instructions
  before UI update.
    Since UI update is probably locked to 60Hz max, upper limit will be 600x normal speed
    But my guess is (on my Macbook Pro 13 Retina 2013) it's running about 70x,
      so there's enough overhead to limit execution to ~70MHz.
2016-11-20 12:23:42 -08:00
Brad Grantham
32854e2246 implement paste through interface 2016-11-19 00:45:39 -08:00
Brad Grantham
cabfe5191e Mostly rewrite graphics to use shaders
Move to GL 3.2
Draw a quad with shaders depending on the mode in that part of the screen
    HIRES shader reads from hires texture
    TEXTPORT shader reads from textpor texture and indirects through a font
      to get pixel values
MIXED now supported
Still to do: BLINK text, INVERSE text, LORES, gang up HGR memory updates
Why doesn't cursor flash the checkerboard?
2016-11-18 20:54:19 -08:00
Brad Grantham
7b3fa24b2a speed softswitches by binning by address 2016-11-17 22:05:02 -08:00
Brad Grantham
a9f3df0320 Speed up memory accesses by binning by page 2016-11-17 21:50:09 -08:00
Brad Grantham
bc02e9ee6a speed up graphics writes 2016-11-16 23:47:07 -08:00
Brad Grantham
dac35cccb1 hires graphics in a separate window 2016-11-16 22:50:09 -08:00
Brad Grantham
33a78aabe9 Support Quit on window, clean up a little 2016-11-16 18:54:56 -08:00
Brad Grantham
e5926d512e regularize interface to the display 2016-11-16 18:46:32 -08:00
Brad Grantham
17c38de074 Rudimentary GL window with keyboard support 2016-11-16 16:16:10 -08:00
Brad Grantham
a4724fb719 Make CTRL-RESET and OPENAPPLE-CTRL-RESET work
Add "reset" command to emulate CTRL-APPLE by invoking RESET
Add "reboot" command to emulate OPENAPPLE-CTRL-APPLE by invoking NMI
Add MAINboard::reset to set softswitches to power-on-defaults
Add bus_controller::reset
Implement 6502 IRQ, BRK, NMI
Add INC zpg, X
Add LDA (ind, X)
Add ADD abs
2016-11-15 10:39:38 -08:00
Brad Grantham
d74e6f4f5d Better textport output and timing
Only output the textport every 16ms, and only if it's changed.
Be more consistent with throttling to ~1.023MHz by using a constant.
Fix bug where timeslice wasn't reduce when # of instructions was reduced
2016-11-14 13:41:57 -08:00
Brad Grantham
3765decf3a another SBC 2016-11-13 12:41:13 -08:00
Brad Grantham
20863ee77c Line nums work, sin() works
Implement SBC zpg, X
Fix other SBCs
Implement LDX abs, Y
2016-11-12 14:41:11 -08:00
Brad Grantham
bfac8e9736 CPU fixes from "lockstep" branch; PRINT 5 works
Merge lots of instruction improvements and fixes
Lift keyboard processing out of MAINboard
Make disassembler return a string - could be inserted into a queue for
  later printing if desired
2016-11-12 13:20:10 -08:00
Brad Grantham
c52cb2939e Fix CX00 ROMs, implement alternate 6502
Add fake6502.c as alternate CPU implementation
Set up all regions in CX00 with softswitches according to my understanding of "Inside the Apple //e"
2016-11-11 15:18:08 -08:00
Brad Grantham
249328b256 Tighten unhandled banking
Add "banking" debugger command to exit the next time a bank is switched
Add abort_on_memory_fallthrough flag to force exit if memory access unhandled
Consolidate flag changes for SBC and ADC to "set_flags" command
Change "sw" member of SoftSwitch to "enabled" for readability
Change name of c{1,3}00_rom to rom_C{1,3}00 for consistency with rom_{D,E}000
Mark HIRES and MIXED flags as implemented; let them be caught in display
Add DEBUG_WARN flag
2016-11-11 05:54:59 -08:00