From 0b69164d85a79403e9dcf535bd96215a8f415cae Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Tue, 26 Jul 2022 13:08:12 +1200 Subject: [PATCH] vault backup: 2022-07-26 13:08:12 --- content/notes/05-6809-assembly.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/content/notes/05-6809-assembly.md b/content/notes/05-6809-assembly.md index f6afd66c8..8c5c7958d 100644 --- a/content/notes/05-6809-assembly.md +++ b/content/notes/05-6809-assembly.md @@ -76,8 +76,28 @@ The programmer's model of a computer is not the same as the hardware model. The - some have special meaning - DP - direct page register, can beused to make instuctons that refer to the same memory page faster - PC - the program counter, stores the location of the instruction that is currently being executed - - S - system stack pointer is just an index + - S - system stack pointer is just an index into the byte array we call memory [diagram](https://i.imgur.com/vImSjAJ.png) + - e.g., we can say `lds #$BCD7` - `S=0xBCD7` + - it's more useful to say `pshs a` - `memory[--S]=A` + - or `puls a` - `A = memory[S==]` + - this is why we call it a stack pointer + - U - user stack pointer, like S but used for in routine (function) calls to + - CC - condition codes, hold information about the result of previous operations + - E - Entire + - F - FIRQ mask (on 1) + - H - half carry + - I - IRQ mask (on 1) + - N - negative + - Z - zero + - V - overflow + - C - carry (ripple carry adder pushes and pulls carry from here) +## Instruction Set +- Determined by the CPU designers +- instructions consist of one or more fields + - the mnemonic **opcode** + - e.g., return from subroutine (`rts`) + - and (optionally) ## 6502 Fibonacci in Machine Code