Changes

Jump to: navigation, search

6502 Emulator

869 bytes added, 16:02, 2 November 2022
Basic Controls
The Speed slider lets you adjust the speed of the emulator from about 1% of native 6502 performance (left) to roughly full native speed (right). Setting the speed slider to a lower setting can be useful for debugging and for viewing the progress of operations on the displays.
There are also controls to Save and Load the text area to/from local storage on the computer on which it is running (as a download/upload); this works nicely with a local github git repository(or clone).
== Assembler Capabilities ==
* "dcb" directive: the Define Constant Byte (dcb) directive will cause the assembler to place individual byte values into memory. These byte values may be in hexadecimal prefixed with $, decimal with no prefix, or single printable non-space characters quoted with double quotes.
=== High and Low Label Bytes ===
* the The low byte of the label X can be accessed as &lt;X and the high byte can be accessed as &gt;X. For example, this code will load the low byte of the label "start" into the A register: <code>LDA #&lt;START</code> - note that this only works with labels, and not with macros.* You can use labels and origin assignment together to get a label for any address in the system. For example, to get a label pointing to the first byte of the character display, you could place this at the end of your program:  *=$f000 DISPLAY: You could then create a pointer to that address at $0027 with this code:  LDA #<DISPLAY STA $27 LDA #>DISPLAY STA $28
=== Comments ===
== Using the Monitor ==
Selecting the Monitor checkbox will display the specified region of memory as code is executed. For example, specifying a start of $00 and a length of $100 will display the entire zero page. Once enabled, the monitor may not display until the code is executed (via Run button).
== Turning the Text Screen On/Off ==
The checkbox labeled "Text Screen" can be used to hide the character display to free up more screen space for editing code. Note also that the character display can be used for additional program memory (whether the display is enabled or not) when it's not required for output.
== Peripherals and Memory Map ==
|$00FF||Last key pressed on keyboard -- See description below
|-
|$01||$0100-$01FF||Stack|| ||Hardware stack - values are pushed on to the stack by the PHA, PHP, JSR, and BRK instructions (plus hardware interrupts), and pulled from the stack by the PLA, PLP, RTS, and RTI, and PLP instructions. The stack is first-in/last out (FILO) aka last-in, first-out (LIFO), and it descends in memory. After 256 bytes have been pushed on the stack, the stack will overflow back to the beginning and the oldest data will be overwritten. The current stack location is tracked in the Stack Pointer (SP) register.
|-
|$02-$05||$0200-$05FF||Bitmapped Display|| ||32x32 pixel graphics display -- See description below.
|$06-$EF||$0600-$EFFF||Program Memory|| ||RAM available for program use. By default, programs will be assembled starting at memory location $0600. This space is available for software and data. The arrangement and use of this memory is left to the programmer.
|-
|$F0-FC||$F000-$FCFF||Character Display|| ||80 row colummn x 25 line character display for text messages -- See description below.
|-
|$FD||$FD00-$FDFF||Reserved|| ||This memory range is reserved for future ROM expansion.
|-
|rowspan="3"|$FE-$FF||rowspan="3"|$FE00-$FF80FFFF||rowspan="3"|ROM||$FE00-FF80||This region is occupied by a small Read-Only Memory (ROM) image that contains input-output routines for the character display and keyboard.
|-
|$FF81-$FFF9||Entry point table - This table consists of 3-byte "entry points" for the ROM routines. To access a particular routine, use the Jump to SubRoutine (JSR) instruction with the corresponding entry point. This arrangement allows the ROM image to be revised without changing the entry point locations. See [[#ROM Routines|ROM Routines]] below for details on the available entry points.
** $e: Light blue
** $f: Light grey
* an 80x25 character display at '''$f000-$fcff''', with one byte per pixelcharacter. Printable ASCII characters will be displayed. If the high-order bit is set, the character will be shown in <span style="background: black; color: white;">&nbsp;reverse video&nbsp;</span>.
* a read-only ROM chip is present at '''$fe00-$ffff'''; see below for details.
== ROM Routines ==
These Many 6502 personal/home computers had the operating system installed in read-only memory (ROM) chips. The emulator has a small ROM chip with these simple input/output (I/O) routines are defined in ROM
* SCINIT $ff81 - Initialize and clear the character display
* CHRIN $ffcf - Input one character from keyboard (returns A(that is, the return value will be placed in the Accumulator register))
* CHROUT $ffdw - Outputs one character (A) to the screen at the current cursor position. Screen will wrap/scroll appropriately. Printable characters and cursor codes ($80/$81/$82/$83 for up/right/left/down) as well as RETURN ($0d) are accepted. Printable ASCII codes with the high bit set will be printed in reverse video.
* SCREEN $ffed - Returns the character screen size in the X and Y registers.

Navigation menu