Skip to content

Instantly share code, notes, and snippets.

View b-adams's full-sized avatar

Prof. Bryant E Adams b-adams

  • Wells College
  • Aurora NY
View GitHub Profile
@b-adams
b-adams / indirect.pep
Created October 19, 2012 14:50
Indirect bouncing for CS225
BR main
kyle: .block 2 ;global variable #2h .word josh
josh: .block 2 ;global variable #2h ;local variable #2h .word keegan
keegan: .block 2 ;global variable #2h .word kyle
constanc: .block 2 ;global variable #2h .word dauris
dauris: .block 2 ;global variable #2h .word josh
main: NOP0
lda kyle,i
sta keegan,d
@b-adams
b-adams / bad_stro.pep
Created October 17, 2012 15:21
CS225 WED OCT 17 NOTES
BR main
msg: .ASCII "Beans beans beans beans beans!\x00"
main: NOP0
;Set up index register to 0
LDX 0,i
loop:NOP0
@b-adams
b-adams / cs224_121010.pep
Created October 10, 2012 15:21
CS225 IF example
;program for if(x>2) 1; else 0;
BR main,i
x: .BLOCK 2 ;global variable #2d
main: NOP0
charo 'm',i
deci x,d
lda x,d ;A is now x
cpa 2,i ;accumulator-preserving subtraction, flags reflect x-2
;now that flags are set, branch RIGHT AWAY!!!!!!1!111!!!
@b-adams
b-adams / cs225_prog3.pep
Created October 5, 2012 15:14
Program 3 test example
BR main,i
prompt: .ASCII "Please enter two number\n\x00"
num1: .equate 0 ;local variable #2d
num2: .equate 2 ;local variable #2d
sum: .equate 4 ;local variable #2d
frame: .equate 6 ;total size of num1,num2,sum
;extra junk here
main: NOP0 ;No-op jump point, for legibility
STRO prompt,d ;explain the pause
@b-adams
b-adams / local.pep
Created September 27, 2012 18:00
Local variables
;CONSTANTS
; * local variable stack offsets (with trace tags) [s addressing]
; * local variable stack sizes [i addressing]
msgLtr1: .EQUATE 0 ;local variable #1c
msgLtr2: .EQUATE 1 ;local variable #1c
msgLtr3: .EQUATE 2 ;local variable #1c
frameMai: .equate 3
addr1: .EQUATE 0 ;local variable #2h
@b-adams
b-adams / program_1_starter.c
Created August 31, 2012 01:57
Instructions and base file for CS131Fa12 Program 1
/**
* @file cs131_program_1_FLAST.c
* @author YOUR NAME HERE
* @author Prof. Adams
* @date THE CURRENT DATE
*/
// INSTRUCTIONS:
// TASK 0/5: LOG IN TO ECLIPSE AND TYPE THE FOLLOWING IN PuTTY:
// cd ~/cs131
@b-adams
b-adams / dechex.c
Created August 27, 2012 13:50
Counting and pow-2-ing in Decimal and Hex
#include <stdio.h>
int main(int argc, char const *argv[])
{
for(int i=0; i<33; i++)
{
printf("Dec: %4d\tHex: %x\n",i,i);
}
for(int i=0; i<80; i++) { printf("-"); }
printf("\n");
@b-adams
b-adams / fig.1.9.dot
Created July 31, 2012 00:27
CS225 Day 1 notes
digraph fig1_9
{
input [label="Input devices"];
cpu [label="Central processing unit"];
memory [label="Main memory"];
output [label="Output devices"];
bus [label="System Bus"];
input->bus;
cpu->bus->cpu;
memory->bus->memory;
@b-adams
b-adams / HORNFUNCTION.ALGOL60
Created July 30, 2012 20:03
CS225 Day 17 Notes
A ALG HORNARTERGENER
COMPILED BY CASE 1107 ALGOL 60 (FAST VERSION) DATEO O.CTOBER 1, 1967
THIS COMPILATION WAS DONE ON 27 OCT 67 AT 16:01:07
1 COMMENT: THIS_PROGRAM CALCULATES THE HORNFUNCTION U(Z),LOG DERIVATIVE
2 O(Z) ANn DERIVATIVE DUDZ OF A HORN WITH THE FUNCTION OF ITS GEOMETRY
3 RG(X), FIRST, SECOND AND THIRD DERIVATIVE KNOWN. SPHERICAL WAVES $
4 STRING W(40) $ INTEGER N,I $
5 REAL B,ALPHA,X,RG,H,Z,Z0,Z1,RR,DHDX,D2HDX,DRDX,D2RDX,D,DZDX,
@b-adams
b-adams / main.c
Created July 30, 2012 19:37
CS225 Day 12 Notes
//Day 12 C routines
#include <stdio.h>
void routineA();
void routineB();
void routineC();
void routineD();
int main()