/* Symbol Table */ // _loop = LABEL: 7 // binary = CONSTANT: 9 // character = CONSTANT: 97 // decimal = CONSTANT: 123 // func = LABEL: 15 // hexadecimal = CONSTANT: 202 // ic = REGISTER: 21 // int = LABEL: 1023 // isr = LABEL: 18 // loop = LABEL: 7 // loop_1 = LABEL: 12 // octal = CONSTANT: 63 // r0 = REGISTER: 0 // r1 = REGISTER: 1 // s0 = REGISTER: 0 // s1 = REGISTER: 1 // s2 = REGISTER: 2 // s3 = REGISTER: 3 // s4 = REGISTER: 4 // s5 = REGISTER: 5 // s6 = REGISTER: 6 // s7 = REGISTER: 7 // s8 = REGISTER: 8 // s9 = REGISTER: 9 // sA = REGISTER: 10 // sB = REGISTER: 11 // sC = REGISTER: 12 // sD = REGISTER: 13 // sE = REGISTER: 14 // sF = REGISTER: 15 // start = LABEL: 0 /* Program Code */ // #1: ; pb3_test.psm // #2: ; A very simple kcasm test for PacoBlaze3 // #3: ; We load some data to registers and do some loops while // #4: ; one register is modified when an interrupt occurs // #6: ; register definitions // #7: register(r0,0) ; alias register #0 (s0) as r0 // #8: register(r1,1) ; alias register #1 (s1) as r1 // #9: register(ic,21) ; counter register used by our interrupt service routine (isr) // #11: ; constant definitions // #12: constant(binary,9) ; a binary value // #13: constant(octal,63) ; an octal value // #14: constant(decimal,123) ; a decimal value // #15: constant(hexadecimal,202) ; an hexadecimal value // #16: constant(character,97) ; a character value // #18: ; our entry point // @000 #19: [start] 00009 // @000 #20: load(r0,binary) ; load r0 with the 'binary' value 001fe // @001 #21: load(r1,254) ; load r1 with $fe in hex 01500 // @002 #22: load(ic,0) ; set up the initial value of the interrupt counter register 00200 // @003 #24: load(s2,0) ; clear register #2 19200 // @004 #25: add(s2,r0) ; add register #0 to register #2 1b210 // @005 #26: addcy(s2,r1) ; add with carry register #1 to register #2 3c001 // @006 #28: interrupt(enable) ; enable interrupt // #30: ; our first loop // @007 #31: [loop] // @007 #32: [_loop] ; 'loop' alias, same program counter 05320 // @007 #33: input(s3,s2) ; read into register #3 with port value at id in register #2 1e301 // @008 #34: subcy(s3,1) ; substract 1 with carry 2d320 // @009 #35: output(s3,s2) ; write back register #3 value 3580c // @00a #36: jump(c,loop_1) ; jump if carry to 'loop_1' 2020a // @00b #37: srx(s2) ; shift-right extended register #2 // @00c #39: [loop_1] 20304 // @00c #39: slx(s3) ; shift-left extended register #3 3000f // @00d #40: call(func) ; call function 'func' 34007 // @00e #41: jump(loop) ; inconditional jump back to 'loop' // @00f #43: [func] ; a function 180ca // @00f #44: add(s0,hexadecimal) ; add 'hexadecimal' value to register #0 1e07b // @010 #45: subcy(s0,decimal) ; substract with carry 'decimal' to register #0 2a000 // @011 #46: return ; return back // #48: ; our interrupt service routine // @012 #49: [isr] 19501 // @012 #50: add(ic,1) ; increment register ic (#15) 38001 // @013 #51: returni(enable) ; return from interrupt with interrupts enabled // @014 #53: [int] @3ff // #53: address(1023) ; the interrupt entry point 34012 // @3ff #54: jump(isr) ; jump to 'isr'