0% found this document useful (0 votes)
55 views2 pages

Jbit QS: System Overview

Uploaded by

Mohit Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views2 pages

Jbit QS: System Overview

Uploaded by

Mohit Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JBit-QS Getting Started, System Overview, IO Basic Operations, Support Tables, 6502

JBit QS System Overview

Getting Started Neither interrupts nor BCD mode are supported.


SED, RTI or any invalid opcode cause the program to
If you are new to 6502 programming, read the online abort. To end the program use the BRK (0) opcode.
tutorial and then run some programs step by step. By convention a program is a series of code pages
From the JBit menu, select Demos and then 6502. containing a single stream of valid instructions fol-
Study all the programs (they are very short) in the lowed by a series of data pages. Programs structured
order they are presented. First select the option Info in this way are said to be well-formed. JBit neither
to get some hints about the program, then select the needs nor enforces this convention, but some editing
option Load&Debug to start the Monitor. operations (e.g. Resize) are only available on well-
Monitor Status Bar: At the right there is the formed programs.
indication of the current view (CPU or MEM). In The hexadecimal notation is cumbersome on mo-
CPU view, at the left there is the PC of the next bile phones; it is therefore common in JBit to use the
instruction. In MEM view, at the left there is the decimal notation. Absolute addresses are presented
current cell address. in the non-standard page:offset notation.
Monitor Keys: 2, 4, 6 and 8 are the cursor keys. The program is loaded and starts at the beginning
1 performs 1 step. 3 performs n steps (you can select of page 3. Page 255 is reserved for future use. The
n by using the option StepSize; default is 10). 7 goes IO chip is mapped to page 2.
to the next line. 9 steps out of the current subroutine.
0 switches between CPU and MEM view. * continues IO Basic Operations
the program (you can then pause it by pressing a soft
key). # shows the video (you can then go back to IO registers are stated as decimal offsets relative to
the monitor by pressing any key). In MEM view, 5 page 2.
changes the value of a cell. The option Edit can be The console video memory is a 10x4 matrix of ex-
used to change the registers of the CPU. tended Latin1 characters starting from CONVIDEO and
Editor Status Bar: At the right there is the in- disposed in row-major order.
dication of the current major (NAV and EDT) and CONVIDEO 40 (40 bytes)
minor modes. At the left there is the letter C if you
are on a code page or D if you are on a data page The frame refresh is controlled by two registers:
followed by the current cell address.
FRMFPS 17 FRMDRAW 18
Editor NAV Mode Keys: 2, 4, 6 and 8 are the
cursor keys. 5 switches to EDT mode. 1 goes to the FRMFPS is the number of frames per second multi-
previous snap point, 3 to the next one. 7 sets the plied by 4 (e.g. 40, the initial value, is 10 fps). Writ-
mark and 0 swaps the cursor and the mark. 9 goes ing into FRMDRAW causes the CPU to be suspended
to the address of the operand. * runs the program. until the current frame has been drawn.
# switches between ASM and MEM minor modes. Random numbers ≤ n are read from RANDOM. Writ-
Editor EDT Mode Keys: * moves to the next ing 0 to RANDOM swaps the current sequence genera-
cell. # switches between ASM and MEM minor tor: time-based (default) or deterministic. Any other
modes. In MEM minor mode, 0-9 are used to enter value sets n (default is 255).
the decimal value of the cell. In ASM minor mode,
RANDOM 23
2-9 are used to enter the letters of the mnemonic.
Editor Example: To enter LDA #12 press 5 to The standard KeyPresses (the ones that can be
enter EDT mode, then press # to enter ASM minor represented by ASCII codes; usually only 0-9, # and
mode, then press the sequence 5 JKL, 3 DEF and 2 ABC *) are enqueued starting from KEYBUF; the rest of the
for L-D-A, then select the instruction LDA #n from buffer is filled with 0s. Write into KEYBUF to consume
the list, then press 1 and 2 to enter the operand and a KeyPress. If the buffer is full when a new key is
finally select OK to confirm the instruction. pressed, that KeyPress is lost.
On some phones, use @ for #.
KEYBUF 24 (8 bytes)

Copyright
c 2007-2011 Emanuele Fornara JBit http://jbit.sourceforge.net/
JBit-QS Getting Started, System Overview, IO Basic Operations, Support Tables, 6502

Latin1 6502
0 1 2 3 4 5 6 7 8 9 Operations
30 ! " # $ % & ’ BRK: BReaK; in JBit, used to halt the VM.
40 ( ) * + , - . / 0 1 NOP: No OPeration.
50 2 3 4 5 6 7 8 9 : ; LDA, LDX, LDY: LoaD Accumulator/X/Y.
60 < = > ? @ A B C D E STA, STX, STY: STore Accumulator/X/Y.
70 F G H I J K L M N O INX, INY, INC: INCrement X/Y/memory.
80 P Q R S T U V W X Y DEX, DEY, DEC: DECrement X/Y/memory.
90 Z [ \ ] ^ _ ‘ a b c TAX, TAY, TXA, TYA, TSX, TXS: Transfer register.
100 d e f g h i j k l m CMP, CPX, CPY: CoMPare with accumulator/X/Y.
110 n o p q r s t u v w JMP: JuMP.
120 x y z { | } ~ JSR: Jump to SubRoutine.
RTS: ReTurn from Subroutine.
CLC, CLV: CLear Carry/oVerflow.
SEC: SEt Carry.
BEQ, BNE: Branch if EQual/Not Equal (z flag).
BMI, BPL: Branch if MInus/PLus (n flag).
BCC, BCS: Branch if Carry Clear/Set.
BVC, BVS: Branch if oVerflow Clear/Set.
ADC: ADd (to/into accumulator) using Carry.
SBC: SuBtract (from/into accumulator) using Carry.
AND: bitwise AND (with accumulator).
ORA: bitwise inclusive OR (with Accumulator).
EOR: bitwise Exclusive OR (with accumulator).
BIT: test BITs: #6 to v flag and #7 to n flag.
Line Art ASL, LSR: Arithmetic/Logical Shift Left/Right.
ROL, ROR: ROtate Left/Right.
T 1 0 0 0 B R L T PHA, PLA: PusH/PuLl Accumulator.
L R PHP, PLP: PusH/PuLl Processor status.
2

1
8
32

4
16
64
128

B Operands
#n: Constant n.
n: Cell 0:n.
n:n: Cell n:n.
128 129 130 131 132 133 134 135
n:n,X: Cell X cells after n:n.
n:n,Y: Cell Y cells after n:n.
r: Next cell + relative offset r, shown as n:n.
136 137 138 139 140 141 142 143
n,X: Cell 0:(n+X modulo 256).
n,Y: Cell 0:(n+Y modulo 256).
(n:n): Cell pointed by n:n.
Conversions (n,X): Cell pointed by 0:(n+X modulo 256).
(n),Y: Cell Y cells after cell pointed by 0:n.
0 0000 0 0 8 1000 8 128
1 0001 1 16 9 1001 9 144 Examples
2 0010 2 32 10 1010 A 160 TAX: Transfer (i.e. copy) Accumulator into X.
3 0011 3 48 11 1011 B 176 LDA #2: LoaD Accumulator with constant 2.
4 0100 4 64 12 1100 C 192 LDX 2: LoaD X with content of cell 0:2.
5 0101 5 80 13 1101 D 208 STX 2:18: STore (i.e copy) X into cell 2:18.
6 0110 6 96 14 1110 E 224 BCC 6: If C=0, skip (i.e. jump forward) 6 bytes.
7 0111 7 112 15 1111 F 240 BCC 240: If C=0, jump back 16 (i.e. 256-240) bytes.

Copyright
c 2007-2011 Emanuele Fornara JBit http://jbit.sourceforge.net/

You might also like