1 0000: ; 2 0000: ; Dabble with SC/MP. 3 0000: ; 4 0000: ; Author doug rice 5 0000: ; 6 0000: ; usage: ./rcasm test4.asm -l -h -t 7 0000: ; 8 0000: ; use simulator:- 9 0000: ; 10 0000: ; This code puts a constant onto the hex display 11 0000: ; 12 0000: ; 13 0000: 14 0000: start: 15 0000: 8060{ 17 0000: ; 18 0000: ; Try and write someting to the display at 0d00h 19 0000: ; 20 0000: ; 21 0000: Disp: equ 0d00H 22 0000: ChRom: equ 010bH 23 0000: 24 0000: 25 0000: 26 0000: org 0f20H 27 0f20: 90 06 jmp loop2 28 0f22: 00 t: db 0 29 0f23: 00 cnt1: DB 0 30 0f24: 00 cnt2: DB 0 31 0f25: 00 keys: DB 0 32 0f26: 00 lastkeys: DB 0 33 0f27: 00 t2: db 0 34 0f28: 35 0f28: ; 36 0f28: ; * The Keyboard is also a challenge. 37 0f28: ; * 38 0f28: ; * ================================= 39 0f28: ; * 0D00+ 8 7 5 4 3 2 1 0 40 0f28: ; * ================================= 41 0f28: ; * bit7 7 6 5 4 3 2 1 0 42 0f28: ; * bit6 9 8 43 0f28: ; * bit5 T Z M G 44 0f28: ; * bit4 F E D C B A 45 0f28: ; * ================================= 46 0f28: ; * 0D00+ 8 7 5 4 3 2 1 0 47 0f28: ; * ================================= 48 0f28: ; * 0D00 is on the right 49 0f28: 50 0f28: 51 0f28: 52 0f28: loop2: 53 0f28: ; reload display pointer. 54 0f28: c4 00 LDI Disp.0 55 0f2a: 31 XPAL 1 56 0f2b: c4 0d LDI Disp.1 57 0f2d: 35 XPAH 1 58 0f2e: 59 0f2e: ; read switches and put onto the display 60 0f2e: c0 f6 ldr keys 61 0f30: c8 f5 str lastkeys 62 0f32: 63 0f32: ; read switch 64 0f32: c1 00 LD 0(1) 65 0f34: c8 f0 str keys 66 0f36: 67 0f36: e4 ff xri 0ffh 68 0f38: d0 ed andr lastkeys 69 0f3a: ; xorr lastkeys 70 0f3a: ; 1's represent keys pressed. 71 0f3a: 98 10 jz loop2a 72 0f3c: 73 0f3c: ; not zro but which bit 74 0f3c: 75 0f3c: c8 e7 str cnt2 76 0f3e: 77 0f3e: 78 0f3e: e4 80 xri 080h 79 0f40: 98 06 jz loop2b 80 0f42: 81 0f42: b8 e0 dldr cnt1 82 0f44: c8 de str cnt1 83 0f46: 90 04 jmp loop2a 84 0f48: 85 0f48: 86 0f48: loop2b: 87 0f48: a8 da ildr cnt1 88 0f4a: c8 d8 str cnt1 89 0f4c: 90 0f4c: 91 0f4c: 92 0f4c: loop2a: 93 0f4c: ; store pressed key to display 94 0f4c: c0 d7 ldr cnt2 95 0f4e: cd 01 st @+1(1) 96 0f50: 8f 0a dly 10 97 0f52: 98 0f52: ; display blank 99 0f52: c4 00 ldi 0 100 0f54: cd 01 st @+1(1) 101 0f56: 8f 0a dly 10 102 0f58: 103 0f58: ; store counter bits to display 104 0f58: c0 ca ldr cnt1 105 0f5a: cd 01 st @+1(1) 106 0f5c: 8f 0a dly 10 107 0f5e: 108 0f5e: 109 0f5e: 110 0f5e: ; set pointer o Character rom @ 0x010b 111 0f5e: c4 01 LDI ChRom.1 112 0f60: 36 XPAH 2 113 0f61: 114 0f61: ; load cnt in xpal and use offset 115 0f61: c0 c1 ldr cnt1 116 0f63: d4 0f ani 0Fh 117 0f65: 32 XPAL 2 118 0f66: c2 0b ld ChRom.0(2) 119 0f68: ; store onto display 120 0f68: cd 01 st @+1(1) 121 0f6a: 8f 0a dly 10 122 0f6c: 123 0f6c: ; set pointer o Character rom @ 0x010b 124 0f6c: c4 0b LDI ChRom.0 125 0f6e: 32 XPAL 2 126 0f6f: c4 01 LDI ChRom.1 127 0f71: 36 XPAH 2 128 0f72: 129 0f72: 130 0f72: ; display blank 131 0f72: c4 00 ldi 0 132 0f74: cd 01 st @+1(1) 133 0f76: 8f 0a dly 10 134 0f78: 135 0f78: 136 0f78: ; store onto display 137 0f78: c0 87 ldr 0 138 0f7a: cd 01 st @+1(1) 139 0f7c: 8f 0a dly 10 140 0f7e: 141 0f7e: ;nop 142 0f7e: ;ldi 055h 143 0f7e: ; increment accumulator and store to display 144 0f7e: 145 0f7e: ; display '5' 146 0f7e: c4 05 ldi 005h 147 0f80: 01 xae 148 0f81: ; 149 0f81: ; use value in E to lot up 7Seg 150 0f81: c2 80 ld -128(2) 151 0f83: ; store onto display 152 0f83: cd 01 st @+1(1) 153 0f85: 8f 0a dly 10 154 0f87: 155 0f87: 90 9f jmp loop2 156 0f89: 157 0f89: 158 0f89: ; display '2' 159 0f89: c4 02 ldi 002h 160 0f8b: 01 xae 161 0f8c: 162 0f8c: ; use value in E to lot up 7Seg 163 0f8c: c2 80 ld -128(2) 164 0f8e: ; store onto display 165 0f8e: cd 01 st @+1(1) 166 0f90: 167 0f90: 8f 0a dly 10 168 0f92: 90 94 jmp loop2 169 0f94: 170 0f94: 171 0f94: 172 0f94: 173 0f94: c4 08 ldi 008h 174 0f96: 01 xae 175 0f97: 176 0f97: ; use value in E to lot up 7Seg 177 0f97: c2 80 ld -128(2) 178 0f99: ; store onto display 179 0f99: cd 01 st @+1(1) 180 0f9b: 181 0f9b: c4 00 ldi 000h 182 0f9d: 01 xae 183 0f9e: ; use value in E to lot up 7Seg 184 0f9e: c2 80 ld -128(2) 185 0fa0: ; store onto display 186 0fa0: cd 01 st @+1(1) 187 0fa2: 188 0fa2: 189 0fa2: loop3: 190 0fa2: 90 84 jmp loop2 191 0fa4: 192 0fa4: Stop: 193 0fa4: 3f xppc 3 194 0fa5: 90 fd jmp stop 195 0fa7: 196 0fa7: 197 0fa7: } 199 0fa7: 200 0fa7: 010bh: CHROM - < 22> 111 118 124 126 0f23h: CNT1 - < 29> 81 82 87 88 104 115 0f24h: CNT2 - < 30> 75 94 0d00h: DISP - < 21> 54 56 0f25h: KEYS - < 31> 60 65 0f26h: LASTKEYS - < 32> 61 68 0f28h: LOOP2 - < 52> 27 155 168 190 0f4ch: LOOP2A - < 92> 71 83 0f48h: LOOP2B - < 86> 79 0fa2h: LOOP3 - < 189> 0000h: START - < 14> 0fa4h: STOP - < 192> 194 194 0f22h: T - < 28> 0f27h: T2 - < 33> 200 Lines assembled 0 Errors 14 Labels Object Code:135 bytes