User Tools

Site Tools


journal:spring2019:relliot9:week2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

journal:spring2019:relliot9:week2 [2019/01/30 09:02] (current)
Line 1: Line 1:
 +=====comporg week2=====
 +----
 +====JANUARY 24, 2019====
 +C is great because you can do assembly with C. 
 +
 +PPU - Picture Processing Unit 
 +(This is esssentially the graphcs card)
 +
 +240 Lines of pixels
 +
 +early systems had hardware support for graphics and sprites
 +
 +Put address in address register, fetch, takes byte from data and sticks it in that address.
 +
 +The PPU can handle certain colors in this list.
 +
 +http://​wiki.nesdev.com/​w/​index.php/​PPU_palettes#​RGB_PPU_palettes
 +
 +
 +====JANUARY 29, 2019==== ​
 +
 +==Hello World Part 2==
 +
 +the purpose of a compiler isto translate things, not necessarily make them executable
 +
 +.s files are the assemply output of .c files
 +
 +if you compile with gcc -S it compiles to the final assembly step.
 +
 +the purpose of the "​."​ tells it to translate things to binary. They are like preprocessor directives in c.
 +
 +recursion is highly stack based, you must be careful not to hit a memory limit with that.
 +
 +starting point will be seen in most assembly code. usually is .globl main or _start
 +
 +To support multiple stacks you would just need to preserve the top of the other stacks.
 +
 + movl is move long, it functions off of system calls
 +
 + movq is move quad, it affedts how much data is called
 +
 +
 +even if a file is in assembly code, the computer does not fully understand it. 
 +Only three registers, accumulator is used mainly for arithmetic process
 +
 +load takes from memory and stores in a register
 +
 +This load store architecture,​ is essential in everything computer today
 +
 +ca is the assembler, cc is the compiler, ld is the linker
 +
 +Ld concatonates all the binary data into one executable
 +
 +==Running MEDNAFEN==
 +
 +rm -rf ~/​.mednafen;​ mednafen hello.nes
 +
 +
 +
 +==Things Seen in Most Assembly Code==
 +  * .text containing strings and the like
 +  * .globl or _start for the beginning of the program
 +  * Push and Pop for moving data via the stack of storage
 +    * our code for the 6502 is load accumulator (lda) and store accumulator (sta) for this
 +  * move is essentially copy "movq source destination"​
 +  * call performs a system call, for example calling write in the system
 +    * for our emulator code, we cannot really perform system calls
 +  * loops, as a series of instructions that checks for a condition and jumps back and forth as many times as necessary.
 +  * cmp (compare) checks the given value vs the value in the accumulator (essentially an If statement)
 +
 +
 +==6502 Assembly Terms==
 +  * ADC - add accumulator with carry, adds two values
 +  * AND - logical and operator
 +  * ASL - Arithmetic Shift Left, shifts all bits one to the left
 +  * BCC - Branch if Cary Clear, If cary flag is clear branch to a new location
 +  * BCS - Branch if Carry Set, If carry exists, branch to a new location
 +  * BEQ - Branch if Equal, ​ if Zero flag exists, branch
 +  * BIT - Test if pits are set in a memory location
 +  * BMI - Branch if Minus, If negative flag is set, branch
 +  * BNE - Branch if Not Equal, If zero flag is clear, branch
 +  * BPL - Branch if Positive, if negative flag is clear, branch
 +  * BRK - Break (Force Interrupt), Break flag set to 1
 +  * BVC - Branch if overflow clear, if overflow flag is clear, branch
 +  * BVS - Branch if overflow set, if overflow flag is set, branch
 +  * CLC - Clear Carry, sets carry flag to zero
 +  * CLD - Clear Decimal Mode, set decimal mode flag to 0
 +  * CLI - Clear interrupt disable, clears the interupt disable flag
 +  * CLV - Clear Overflow Flag, V = 0
 +  * CMP - Compare, compares contents of accumulator to another memory value
 +    * Sets Carry flag if A >= M
 + * Sets Zero flag if A == M
 + * Sets Negative flag if bit 7 is set
 +  * CPX - Compare X Register, compares X register to memory value
 +  * CPY - Compare Y Register, compares Y register to memory value
 +  * DEC - Decrement Memory, Subtracts one from the value held at mem location
 +  * DEX - Decrement X register, Subtract one from X Register
 +  * DEY - Decrement Y Register, Subtract one from Y Register
 +  * EOR - Exclusive Or
 +  * INC - Increment memory, Adds one to the memory value
 +  * INX - Increment x Register
 +  * INY - Increment Y register
 +  * JMP - Unconditional Jump, will always happen
 +  * JSR - Jump to Subroutine ​
 +  * LDA - Load Accumulator,​ loads a value from accumulator
 +  * LDX - Load X Register
 +  * LDY - Load Y Register
 +  * LSR - Logical Shift Right, Bits in A and M are shifter one to the right
 +    * The Zero bit is set to Carry
 +  * NOP - No Operation, No changes
 +  * ORA - Logical Inclusive Or, Inclusive Or with A and M
 +  * PHA - Push Accumulator,​ Puts a copy of the accumulator onto the stack
 +  * PHP - Push Processor Status, Puts status flags onto the stack
 +  * PLA - Pull Accumulator,​ Pulls a value from the stack into the accumulator
 +  * PLP - Pull Processor Status, Sets flags from stack values
 +  * ROL - Rotate Left, shift everything in A or M to the left
 + * Carry flag is set to bit 7
 +    * Bit 0 is filled with the current carry flag
 +  * ROR - Rotate Right, Shift everything in A or M to the right
 + * Carry flag is set to old bit 0
 +    * bit 7 is filled with Carry flag
 +  * RTI - Return from interrupt, at end of interrupt processing routine
 +    * Sets all flags from stack
 +  * RTS - Return from Subroutine, at the end of a subroutine, return to call
 +  * STC - Subtract with Carry, subtracts the contents of a memory to accumulator
 +  * SEC - Set Carry Flag, Set Carry flag to one
 +  * SED - Set Decimal flag, Set Decimal Flag to one
 +  * SEI - Set Interrupt Disable, Set Interrupt Disable Flag to one
 +  * STA - Store Accumulator,​ Store accumulator contents to memory
 +  * STX - Store X Register, Store X register to memory
 +  * STY - Store Y Register, Store Y register to memory
 +  * TAX - Transfer Accumulator to X, Copies Acc to X register
 +  * TAY - Transfer Accumulator to Y, Copies Acc to Y register
 +  * TSX - transfer Stack pointer to X, Copies current stack contents to X
 +  * TSA - transfer Stack pointer to Accumulator,​ Copies current stack contents to Acc
 +  * TSX - Transfer X to Stack, copies X contents into the stack
 +  * TYA - Transfer Y to Accumulator,​ Copies Y contents into the Acc
 +
 +
 +
 +
 +
 +
 +=====hpc0 week2=====
 +----
 +====JANUARY 28, 2019====
 +
 +During class we each disassembled computers. There were a lot of parts that i am surprised are so small. The CPU for example is super tiny, yet the heat sinks that come off of it are often the largest in the computer.
 +
 +
 +
 +====JANUARY 30, 2019====
 +
 +
 +
 +
 +=====sysprog week2=====
 +----
 +====JANUARY 24, 2019====
 +
 +We mainly worked on creating a SDL file. I put some compiling help on the wiki, the way of doing this is surprisingly complex. ​
 +
 +I havent usually put my headers and functions in different files, mainly because this compiling process confuses me.
 +
 +  * STA - Store Accumulator,​ Stores a value into an accumulator
 +
 +
 +====JANUARY 29, 2019====
 +
 +We made a tiny little cat walk around the screen, and I on my own made it so that you can hold down the buttons to get it to move fluidly. I also made it sit down and turn its head back and forth because I thought that sprite was cute. Right now, I believe the animations are in the wrong order. So i will need to implement logic to bounce back and forth between them.
 +
 +My Ultimate plan for the sitting animation is to display it if the User is inactive for a certain ammount of time. Ive seen this done in various videogames and I always love to see what the character does.
 +
 +Some other things I want to figure out are diagonal directions, possibly which would be active when a person holds down alt or two directions at once.
 +
 +also jumping, though I may have to find alternate sprites for that.
 +
 +Eventually, I will create a maze or scene of some sort for the cat to walk through, with boundaries so that the cat cannot walk out of bounds.
 +
 +
 +
 +
 + 
  
journal/spring2019/relliot9/week2.txt · Last modified: 2019/01/30 09:02 (external edit)