Peter Evans
851bc85860
We should print the final line if from is still >= to
...
This can happen if the region of to - from is not cleanly divisible by
16.
2018-03-13 15:17:33 -05:00
Peter Evans
ed32f73e98
Use another pointer to retain the original address to free
...
This also resolves an issue where we weren't attempting to free the
duplicated string when returning early.
2018-03-13 11:00:44 -05:00
Peter Evans
a243ed3d35
Add docblock comments
2018-03-13 00:53:46 -05:00
Peter Evans
f33f9cd493
Remove unnecessary check if tok == NULL
...
This also corrects a formatting error (no space between the rparen of
the if and the lbrace of the code block).
2018-03-13 00:33:32 -05:00
Peter Evans
090307f4fe
Removed unnecessary code
2018-03-13 00:28:24 -05:00
Peter Evans
dc8a431f87
Always notify the screen of a refresh required
2018-03-13 00:13:59 -05:00
Peter Evans
5dcc25f5eb
Reject -1 rows and columns
2018-03-12 00:33:22 -05:00
Peter Evans
543e3d0b73
Use uint32_t for all fields
2018-03-12 00:33:08 -05:00
Peter Evans
97865e9589
Subtract 0x400 for the correct offset
2018-03-12 00:32:42 -05:00
Peter Evans
e868718f31
(No, really, use the color blue)
2018-03-11 23:48:40 -05:00
Peter Evans
df960220ef
First crack at lo-res graphics
2018-03-11 23:28:28 -05:00
Peter Evans
5a43ca9a7a
Return random data in read contexts
...
This applies only to addresses which aren't meant to return meaningful
data.
2018-03-10 22:36:31 -06:00
Peter Evans
ce6f3c5835
Return bit 7 high if we set a flag on
2018-03-10 22:21:03 -06:00
Peter Evans
550eab742e
Move hdump into correctly sorted slot
2018-03-09 16:51:12 -06:00
Peter Evans
74e8a30a4c
Disassemble flag now works as intended
2018-03-09 16:46:04 -06:00
Peter Evans
87c7aa9249
Add hexdump function for vm_segment
2018-03-09 16:45:20 -06:00
Peter Evans
1ff5d17f19
Add hexdump command
2018-03-09 16:44:53 -06:00
Peter Evans
267171ea4a
Change to option_open_file(), allow any file mode
2018-03-09 16:44:20 -06:00
Peter Evans
1235197418
Only fprintf if we know stream is not NULL
2018-03-07 21:24:29 -06:00
Peter Evans
dda7ae6288
When paused for the debugger, output should go to stdout
2018-03-07 21:24:15 -06:00
Peter Evans
d791ebbe2f
Remove some unnecessary comments
2018-03-07 21:07:39 -06:00
Peter Evans
4d2f4ffd5f
Set width/height as soon as we parse
2018-03-07 20:55:04 -06:00
Peter Evans
14123882c2
Use vm_di_get for file streams to close them
2018-03-07 20:54:46 -06:00
Peter Evans
f555196080
Test for !OK with system data addresses
2018-03-07 20:42:27 -06:00
Peter Evans
4d4fbdf79a
Switch to vm_di for option variable storage
...
Things like disk1, disk2, width/height, etc.
2018-03-07 20:25:39 -06:00
Peter Evans
58190f0c9b
Move notify_refresh into the proper file
2018-03-07 17:08:16 -06:00
Peter Evans
c3b86031bd
Add tests for primary, alternate functions
2018-03-07 17:00:11 -06:00
Peter Evans
9cbfcac783
Add missing docblock comments
2018-03-07 16:28:11 -06:00
Peter Evans
9f09be93a9
Implement (true? better?) framerate cycle
2018-03-07 16:20:29 -06:00
Peter Evans
f1c0716313
Include draw.h header
2018-03-07 15:33:09 -06:00
Peter Evans
b00442a1c4
Change width/height to 3x apple window size
2018-03-07 15:23:00 -06:00
Peter Evans
d5450bf743
Refresh once every 30th of a second
...
*Roughly...
2018-03-07 00:20:27 -06:00
Peter Evans
91291be889
Draw the full screen at boot time to emulate initial look
...
Which is to say, the initial look of @ symbols filling up your screen.
2018-03-07 00:19:51 -06:00
Peter Evans
b2df144850
Remove blank-space render to speed up render time
2018-03-07 00:15:25 -06:00
Peter Evans
7edf0c5dbd
Display @ symbols on startup
...
There's actually a lot going on here to make the @ symbol display
happen.
The @ symbols are the visual representation of NUL-character bytes. They
are inverse video, as dictated by the Apple //e technical reference. As
part of the bootup sequence, those bytes are overwritten with space
characters.
As part of the work, we now have a table of rows and columns that map to
display buffer addresses.
2018-03-06 22:12:41 -06:00
Peter Evans
1a6d8b6ced
Actually do render control characters
2018-03-06 12:46:33 -06:00
Peter Evans
136d019f7a
Show non-inversed text for Apple //e
2018-03-06 12:41:30 -06:00
Peter Evans
9562dd19ce
Rewrite dd to use phases and half-track steps
...
Phases will yet be the death of me. THE DEATH OF ME.
2018-03-03 21:29:19 -06:00
Peter Evans
998a139c00
Use state machine for stepper motor changes
2018-03-02 16:42:22 -06:00
Peter Evans
c5d1542937
Show correct PC counter in scan
2018-03-01 21:37:10 -06:00
Peter Evans
b239cac239
Add dblock command to disassemble blocks of code
2018-03-01 19:31:56 -06:00
Peter Evans
f8bda4ebd3
Remove modify_status() function
...
Also rewrite tests to use macros
2018-02-28 21:40:52 -06:00
Peter Evans
8d0cf264d7
Add missing NZ checks in INC and DEC
2018-02-28 21:34:58 -06:00
Peter Evans
49199eac84
Rewrite status checks with macros
...
This also forces the result of operations to be considered purely as
8-bit results in _some_ cases, but not in others. We were missing some
times when an overflow is the expected behavior; because SET_RESULT()
and mos6502_modify_status() use ints, this overflow was not properly
observed.
2018-02-28 21:16:39 -06:00
Peter Evans
4baec33e24
We should check status for PLX/PLY
2018-02-28 19:53:26 -06:00
Peter Evans
edd175c1f9
Add disasm command (toggle disassembly)
2018-02-26 20:52:13 -06:00
Peter Evans
30c07df9cb
When carry is set, subtract one fewer, not one more
...
A subtle misunderstanding... which led to bizarre and unexpected
behavior elsewhere.
2018-02-26 18:59:25 -06:00
Peter Evans
fec8ef0743
Allow $XX hex notation
2018-02-26 14:21:20 -06:00
Peter Evans
5bb76164dc
Add missing docblocks for vm_debug.c
2018-02-26 14:10:16 -06:00
Peter Evans
1cec80cead
Don't immediately pause
2018-02-26 13:54:32 -06:00
Peter Evans
7ad0ad8024
Unbreak current PC in resume; use addr2 in writestate
...
(Addr1 never worked, so ws was essentially non-functional in practice,
but it passes its tests when you assume execute() does the right thing!)
2018-02-25 16:12:15 -06:00
Peter Evans
aa53fdd77e
Erase strings before we print anything else
...
If you print something without an operand, you may end up printing the
last instruction's operand unless you do that wipe
2018-02-25 16:06:27 -06:00
Peter Evans
67c7790a1a
Show current opcode
2018-02-25 15:52:37 -06:00
Peter Evans
e50fda62be
Add step command
2018-02-25 15:41:37 -06:00
Peter Evans
01f230dc85
Add unbreak command, unbreak_all() function for testing
2018-02-25 14:38:24 -06:00
Peter Evans
c17616c383
Execute will no longer run if PC is at a breakpoint
2018-02-25 14:27:47 -06:00
Peter Evans
588362abee
Add prompt; quit command; breakpoints
2018-02-25 14:25:02 -06:00
Peter Evans
d4891a3fbf
No, really, add the writeaddr command
2018-02-24 19:38:55 -06:00
Peter Evans
09f7152e07
Add writeaddr command
2018-02-24 19:38:04 -06:00
Peter Evans
06bf63ecb2
Add jump debug command
2018-02-24 19:36:02 -06:00
Peter Evans
1be1abc0af
Add printaddr, printstate
2018-02-24 18:57:00 -06:00
Peter Evans
ec253905ad
Add resume command, finder function, arg parser, execute
2018-02-24 16:30:46 -06:00
Peter Evans
a614c1e5df
Add new file, vm_debug.c, and help command for it
2018-02-23 21:58:30 -06:00
Peter Evans
ac5d532a7f
Fix length bug with s_bytes (one too short)
...
This also fixes tests for disassembly so that they account for changed
output. Finally this also exits if we have to perror in the setup
function.
2018-02-23 21:35:53 -06:00
Peter Evans
395ac4a841
Disassembler now outputs more idiomatic code
...
It also no longer prints out register and address state
2018-02-23 20:46:24 -06:00
Peter Evans
0d1e22a348
Add support for decimal mode ADC/SBC.
...
This also corrects a bug where SBC set carry incorrectly in binary mode.
2018-02-23 00:46:07 -06:00
Peter Evans
2669460c6d
Resolve potential bad dereference on sectab
2018-02-22 14:11:54 -06:00
Peter Evans
bee2a0e86a
Add missing docblocks for NP2 and NP3
2018-02-22 14:10:19 -06:00
Peter Evans
978ad1faaf
Formerly "BAD" instructions are now forms of NOPs
...
But weird forms. In most cases they basically are NOPs, except with
different opcodes. In other cases, we call them NP2 and NP3s, and do so
because they consume 2 or 3 bytes respectively (vs. just 1 with NOP).
We had to teach some arcane magic to the emulator for this to work. We
may want to refactor to decouple the number of bytes consumed from the
address mode.
2018-02-22 14:07:05 -06:00
Peter Evans
691387894a
ASL, LSR, ROL, ROR in ABX now consume only 6 cycles
...
(Down from 7 cycles.)
2018-02-22 13:45:36 -06:00
Peter Evans
e35ff91fa7
Clear the decimal bit in BRK; also improve test logic for BRK
2018-02-22 13:44:13 -06:00
Peter Evans
90892c32e4
Add TSB (Test and Set Bits) instruction
...
This commit also moves the TRB code from loadstor to bits, which is
where it should have been all along.
2018-02-22 13:39:48 -06:00
Peter Evans
a4c3d1c4ef
Implement the TRB (Test and Reset Bits) instruction
2018-02-22 00:39:33 -06:00
Peter Evans
807362e871
Add STZ instruction (to store zero)
2018-02-22 00:02:57 -06:00
Peter Evans
7363547608
Add PHX/Y and PLX/Y to the opcode, addr mode, cycle tables
2018-02-21 23:35:36 -06:00
Peter Evans
8e1ab0e950
Add support for PHX, PHY, PLX, PLY
...
These instructions allow you to push and pull (pop) the X and Y
registers via the stack.
2018-02-21 23:32:57 -06:00
Peter Evans
f9a277e7bc
Add new Branch Always instruction
2018-02-21 21:57:21 -06:00
Peter Evans
58a1e31f58
Allow JMP to work with ABX address mode
2018-02-21 21:46:41 -06:00
Peter Evans
8623945bbf
Add the ability to INC or DEC the accumulator
...
This is an oversight from the 6502 processor that was rectified in the
65c02 model.
2018-02-21 21:20:05 -06:00
Peter Evans
7b65dc1657
Add new BIM instruction (BIt imMediate mode)
...
This is not a real instruction in the 65c02 processor; I invented it for
the sole purpose of handling the specialized logic that is performed by
BIT in IMM mode. To be fair--I can imagine this really _was_ implemented
as a "separate" instruction on the chip! But I don't know that for sure.
2018-02-21 21:01:46 -06:00
Peter Evans
5ba5f91442
Add new address modes for BIT
2018-02-21 20:46:28 -06:00
Peter Evans
e1f11fc266
Add cycle counts
2018-02-21 20:43:04 -06:00
Peter Evans
739451366f
Add zero-page instructions
2018-02-21 20:42:05 -06:00
Peter Evans
48872cf8d1
Add docblock comment for apple2_dd_sector_num
2018-02-21 11:23:25 -06:00
Peter Evans
61eb880f49
Refactor code to pass image type in
2018-02-21 00:23:12 -06:00
Peter Evans
1091ec6e2a
Pass image type into enc_dos; use sector_num instead of a table pointer
2018-02-20 15:36:23 -06:00
Peter Evans
508be6458a
Pass in sector table for logical-physical orders
...
We were not encoding data properly, because in DOS 3.3 and ProDOS,
sectors must be interleaved on disk media (whereas in the original image
form, data is laid out in a linear fashion).
This solves a bug where we erroneously encountered a "bad" opcode (a7)
in the program code.
2018-02-19 18:49:37 -06:00
Peter Evans
015104bd57
Self-sync bytes should be written after a sector header
...
Not after the data field marker, where the controller/RWTS don't expect
to find them.
2018-02-18 23:46:48 -06:00
Peter Evans
0d1e949d13
Mask the result so it's never more than a byte
...
This is because the eff_addr variable is a 16bit one, and adding addr +
X or addr + Y can possibly result in a 9-bit value, which is not what we
want. (You'd be pulling data from the stack instead of the zero page.)
2018-02-16 00:44:55 -06:00
Peter Evans
e9164d9872
Very minor changes to make the code simpler
2018-02-16 00:19:14 -06:00
Peter Evans
058b45e7d1
Use 9-bit rotation, not 8-bit
2018-02-15 19:32:01 -06:00
Peter Evans
067c0cea2f
Also check the N flag (i.e. set it to zero)
2018-02-15 13:01:58 -06:00
Peter Evans
e415b3e490
We should check only the first byte for zero
...
We need to accept values for result that are greater than a byte so that
we can determine if carry is set, but this causes an issue when an app
uses addition to force an overflow that would set the zero bit. Masking
result for only the LSB fixes that problem.
2018-02-15 00:26:21 -06:00
Peter Evans
08b0e2e648
Show effective address
2018-02-14 22:19:35 -06:00
Peter Evans
fe70cd1f71
Remove debugging, use ENC_ETRACK for sector pos max
...
Also, there's no need for a while statement; we can just reset to zero.
2018-02-14 22:09:21 -06:00
Peter Evans
9a5c94bbbb
The 49 opcode is EOR, not ADC.
...
Excuse me, I just need to scream now.
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
Thank you for your indulgence. Please carry on.
2018-02-14 21:37:02 -06:00
Peter Evans
64b9cbefcb
Several changes to phase and writes
...
1. The phaser algorithm was reworked, and it should be more accurate in
choosing when to step forward or backward.
2. Writes should be committed when the latch has bit 7 high. This hasn't
actually been a problem yet, since other things are broken! But we might
as well fix it now that we've seen it.
2018-02-14 16:49:20 -06:00
Peter Evans
100621a6c6
Show second-digit row mappings for gcr62
2018-02-12 21:20:09 -06:00
Peter Evans
5b1298bded
Document the gcr62 table
2018-02-12 21:19:47 -06:00
Peter Evans
ec522f259e
Add block comments to describe source files
2018-02-12 21:15:20 -06:00