home *** CD-ROM | disk | FTP | other *** search
File List | 1980-01-01 | 15.2 KB | 415 lines |
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 1
- 01-01-80
-
-
- ; Demo96.ASM 8096 Simulator Demonstration
-
- ; This program monitors Analog Channel 3, and
- ; changes operating states between "Rising"
- ; and "Falling", depending on a comparison
- ; between the current analog value and predefined
- ; high and low threshold values. When the value is
- ; between the thresholds, the state is not changed.
-
- ; In the "Rising" state, an embedded macro is invoked
- ; that increases the analog value, while in the
- ; "Falling" state, an embedded macro is invoked to
- ; decrease the analog value.
-
- 0000 Fseg ; Special Function Regs
-
- 0000 = R0 word 00h
- 0002 = AD_Cmd data 02h
- 0002 = ADResL data 02h
- 0003 = ADResH data 03h
- 0003 = HSIMode data 03h
- 0004 = HSITime word 04h
- 0004 = HSOTime word 04h
- 0006 = HSIStat data 06h
- 0006 = HSOCmd data 06h
- 0007 = SBUF_Rx data 07h
- 0007 = SBUF_Tx data 07h
- 0008 = IntMask data 08h
- 0009 = IntPend data 09h
- 000A = WDogClr data 0Ah
- 000A = T1 word 0Ah
- 000C = T2 word 0Ch
- 000E = Baud data 0Eh
- 000E = P0 data 0Eh
- 000F = P1 data 0Fh
- 0010 = P2 data 10h
- 0011 = SPCon data 11h
- 0011 = SPStat data 11h
- 0015 = IOC0 data 15h
- 0015 = IOS0 data 15h
- 0016 = IOC1 data 16h
- 0016 = IOS1 data 16h
- 0017 = PWMCtrl data 17h
-
- 0020 endS
-
- ; Data Definitions
-
- 0024 = AX WORD 24h ; Word register
- 7532 = Val1 Equ 7532h ; Integer value
- 0018 = SP word 18h ; Stack Pointer
- 0024 = AL data AX ; byte components
- 0025 = AH data AX+1
- 0028 = BX word 28h
- 0028 = BL data BX
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 2
- 01-01-80
-
-
- 0029 = BH data BX+1
- 002A = CX word 2Ah
- 002A = CL data CX
- 002B = CH data CX+1
- 0032 = DX word 32h
- 0032 = DL data DX
- 0033 = DH data DX+1
-
- 0052 = SerStat data 52h
- 0053 = SerData data 53h
- 0054 = P2Image data 54h
-
- 0056 = AnStat data 56h ; for status tests
- 0002 = UpBit equ 02 ; steering bit
- 0058 = AnValue data 58h ; data holding word
- 0191 = HiThresh equ 401 ; upper threshold
- 0129 = LoThresh equ 297 ; lower threshold
-
- ;%S Copyright 1985 Cybernetic Micro Systems, Inc.
-
- 2000 org 2000h ; Interrupt Vectors
-
- 2000 4621 dw TimerInt
- 2002 4721 dw ADConvInt
- 2004 5121 dw HSIDataInt
- 2006 5821 dw HSOLineInt
- 2008 7321 dw HSIzeroInt
- 200A 7421 dw SoftHSOInt
- 200C 9221 dw SerialInt
- 200E A821 dw ExtInt
- 2010 AF21 dw TRAPInt
-
-
- 2080 Org 2080h ; powerup reset address
-
- ; Initialize various hardware functions
-
- Start:
- 2080 A1A00018 ld SP,#0A0h ; stack area
- 2084 A1420024 ld AX,#42h
- 2088 A0242A ld CX,AX
- 208B 662B28 add BX,[CX]+
- 208E 67247632 add DX,76h[AX]
-
- ; Define two macros, one to increase the
- ; analog voltage on channel 3, the other
- ; to decrease it.
-
- 2092 B02425 ldb AH,AL
- 2095 B11A2A ldb CL,#26 ;!3 A3+47,; Analog Voltage Rising
- 2098 B22A28 ldb BL,[CX]
- 209B B3250020 ldb DH,2000h[AX] ;!4 A3-25,; Analog Voltage Falling
- -209F 33
-
-
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 3
- 01-01-80
-
-
- ClearDog: ;:Enable Watch Dog
- 20A0 B11E0A ldb WDogClr,#01Eh
- 20A3 B1E10A ldb WDogClr,#0E1h ; clear watch dog
-
- PWM_On: ;:Set PWM
- 20A6 B12517 ldb PWMCtrl,#25h ; turn on PWM
-
- AtoD_On: ;:A/D Value
- 20A9 B10B26 ldb 26h,#0Bh ; channel 3 to start
- 20AC B02602 ldb AD_Cmd,26h ; get initial value
-
- 20AF 640446 add 46h,04 ; unload HSI FIFO
-
- HSOLineOn: ;:High Speed CAM On
- 20B2 B13106 ldb HSOCmd,#31h ; set HSO line 1
- 20B5 B13147 ldb 47h,#31h ; record of HSO cmd
- 20B8 A1100048 ld 48h,#10h
- 20BC 640A48 add 48h,T1 ; get T1 + 10h
- 20BF A04804 ld HSOTime,48h ; write time to HSO
-
- SerialOn: ;:Enable Serial
- 20C2 B1110E ldb Baud,#11h ; baud rate 8011h
- 20C5 B1800E ldb Baud,#80h
- 20C8 B10911 ldb SPCon,#09h ; mode 1, REN
- 20CB B12052 ldb SerStat,#20h ; Transmitter ready
-
- InterruptsOn:
- 20CE B15515 ldb IOC0,#55h ; IOC0, enable HSI lines
- 20D1 B12D16 ldb IOC1,#02Dh ; IOC1, PWM,T1,T2,TxD
- 20D4 B1C154 ldb P2Image,#0C1h ; initial Port 2 outputs
- 20D7 B1FF08 ldb IntMask,#0FFh ; enable all interrupts
- 20DA FB ei
- 20DB B10456 ldb AnStat,#04h ; set status byte, set a value
- 20DE A18D0158 ld AnValue,#LoThresh+100
-
- ; Main Program Loop
-
- MainLoop:
- 20E2 1749 incb 73
- 20E4 65210024 add AX,#21h
- 20E8 918054 orb P2Image,#80h
- 20EB B05410 ldb P2,P2Image ; set P2.7
- 20EE 0736 inc 36H
- 20F0 A132753A ld 58,#Val1 ; 16 bit data, LSB first
-
- ; Only check the analog state while byte 36h,
- ; bit 2 is low. 36h incremented once per loop.
-
- 20F4 3A3608 jbs 36h,2,SkipChk ;?Skip Tests
-
- 20F7 282C scall Test_Analog
-
- 20F9 080524 shr AX,#5
- 20FC 843A24 xor AX,58 ; modify AX
-
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 4
- 01-01-80
-
-
- SkipChk:
- 20FF 717F54 andb P2Image,#NOT 80h
- 2102 B05410 ldb P2,P2Image ; clear P2.7
- 2105 FE5C282A mulb 92h,CL,BL
- -2109 92
-
-
- ; Branch to Up or Down routine, depending on
- ; state set by TestAnalog subroutine
-
- 210A 3A560C jbs AnStat,UpBit,GoingUp ;?Rising Value
-
- ; Change P1 value for DeCrementing, and
- ; lower analog value through embedded macro
-
- GoingDown: ;:Falling Analog
- 210D B1DC0F ldb P1,#0DCh ; decrementing
- 2110 65B17324 add AX,#Val1-385 ;#4
- 2114 B0492A ldb CL,73 ; copy byte 73 to CL
- 2117 27C9 sjmp MainLoop
-
- ; Change P1 value for AdDing, and raise
- ; analog value through embedded macro
-
- GoingUp: ;:Rising Analog
- 2119 B1AD0F ldb P1,#0ADh ; incrementing
- 211C B04932 ldb DL,73 ;#3
- 211F 69697724 sub AX,#Val1+567
- 2123 27BD sjmp MainLoop
-
- ; Start a new conversion if one is not in
- ; progress. Use the old converted value to
- ; check against the threshold. If above the
- ; high threshold, set the "Falling" state and
- ; drive P2.6 low. If below the low threshold,
- ; set the "Rising" state and drive P2.6 high.
-
- Test_Analog: ;:Threshold Check
- 2125 3B0203 jbs ADResL,3,ConvOK ;?In Process
- 2128 B02602 ldb AD_Cmd,26h ; else start a new conversion
-
- ConvOK:
- 212B 89910158 cmp AnValue,#HiThresh
- 212F D607 jge OverMax ;?Max Value
- 2131 89290158 cmp AnValue,#LoThresh
- 2135 DE08 jlt UnderMin ;?Min Value
- NoChange:
- 2137 F0 ret
-
- OverMax: ;:Upper Limit
- 2138 B1FB56 ldb AnStat,#Not 04h ; switch to down mode
- 213B 71BF54 andb P2Image,#Not 40h ; make P2.6 low
- 213E F0 ret
-
- UnderMin: ;:Lower Limit
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 5
- 01-01-80
-
-
- 213F B10456 ldb AnStat,#04h ; switch to up mode
- 2142 714054 andb P2Image,#40h ; make P2.6 high
- 2145 F0 ret
-
- TimerInt: ;:Timer Int
- 2146 F0 ret
-
- ADConvInt: ;:A/D Int
- 2147 B00258 ldb AnValue,ADResL ; get low result
- 214A B00359 ldb AnValue+1,ADResH ; and high
- 214D 080658 shr AnValue,#6 ; align to bytes
- 2150 F0 ret
-
- HSIDataInt: ;:HSI Event
- 2151 B00643 ldb 43h,HSIStat ; get status
- 2154 A00444 ld 44h,HSITime ; get HSI time
- 2157 F0 ret
-
- HSOLineInt: ;:HSO Line
- 2158 F2 pushf ; disable ints
- 2159 1747 incb 47h ; record of HSO cmd
- 215B 334703 jbc 47h,3,HSO_Ok ;?Cmd OK
- 215E 952047 xorb 47h,#20h ; change set/clear bit
- HSO_Ok:
- 2161 713747 andb 47h,#37h
- 2164 B04706 ldb HSOCmd,47h ; set HSO cmd
- 2167 A1250048 ld 48h,#25h
- 216B 640A48 add 48h,T1 ; get T1 + 25h
- 216E A04804 ld HSOTime,48h ; write time to HSO
- 2171 F3 popf
- 2172 F0 ret
-
- HSIzeroInt: ;:HSI.0 Int
- 2173 F0 ret
-
- SoftHSOInt: ;:HSO Timer
- 2174 F2 pushf
- 2175 174B incb 4Bh
- 2177 324B03 jbc 4Bh,2,ValOK ;?Not C or D
- 217A 91024B orb 4Bh,#02h
- ValOK:
- 217D 710F4B andb 4Bh,#0Fh
- 2180 91384B orb 4Bh,#38h ; HSO events 8 - F
- 2183 B04B06 ldb HSOCmd,4Bh
- 2186 A1220048 ld 48h,#22h
- 218A 640A48 add 48h,0Ah ; T1 + 22h
- 218D A04804 ld HSOTime,48h ; set HSO time
- 2190 F3 popf
- 2191 F0 ret
-
- SerialInt: ;:Serial Data
- 2192 901152 orb SerStat,SPStat ; preserve status bits
- 2195 365206 jbc SerStat,6,ChkTx ;?Not Receiver
- 2198 71BF52 andb SerStat,#NOT 40h ; clear RI bit
- 219B B00753 ldb SerData,Sbuf_Rx ; read receiver
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 6
- 01-01-80
-
-
-
- ChkTx:
- 219E 355206 jbc SerStat,5,SerDone ;?Not Transmitter
- 21A1 71DF52 andb SerStat,#NOT 20h ; clear TI bit
- 21A4 B02507 ldb Sbuf_Tx,AH ; write a char
-
- SerDone:
- 21A7 F0 ret
-
- ExtInt: ;:External Int
- 21A8 B11E0A ldb WDogClr,#01Eh
- 21AB B1E10A ldb WDogClr,#0E1h ; clear watch dog
- 21AE F0 ret
-
- TRAPInt: ;:TRAP Instr
- 21AF F0 ret
-
- 21B0 FD nop
-
- ;%E Copyright 1985 Cybernetic Micro Systems, Inc.
-
- 2080 END START ; Starting Address
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 7
- 01-01-80
-
-
-
- ;%T Symbol Name Type Value
-
- ADCONVINT . . . . . . . . . . . L 2147
- ADRESH. . . . . . . . . . . . . F 0003
- ADRESL. . . . . . . . . . . . . F 0002
- AD_CMD. . . . . . . . . . . . . F 0002
- AH. . . . . . . . . . . . . . . D 0025
- AL. . . . . . . . . . . . . . . D 0024
- ANSTAT. . . . . . . . . . . . . D 0056
- ANVALUE . . . . . . . . . . . . D 0058
- ATOD_ON . . . . . . . . . . . . L 20A9
- AX. . . . . . . . . . . . . . . W 0024
- BAUD. . . . . . . . . . . . . . F 000E
- BH. . . . . . . . . . . . . . . D 0029
- BL. . . . . . . . . . . . . . . D 0028
- BX. . . . . . . . . . . . . . . W 0028
- CH. . . . . . . . . . . . . . . D 002B
- CHKTX . . . . . . . . . . . . . L 219E
- CL. . . . . . . . . . . . . . . D 002A
- CLEARDOG. . . . . . . . . . . . L 20A0
- CONVOK. . . . . . . . . . . . . L 212B
- CX. . . . . . . . . . . . . . . W 002A
- DH. . . . . . . . . . . . . . . D 0033
- DL. . . . . . . . . . . . . . . D 0032
- DX. . . . . . . . . . . . . . . W 0032
- EXTINT. . . . . . . . . . . . . L 21A8
- GOINGDOWN . . . . . . . . . . . L 210D
- GOINGUP . . . . . . . . . . . . L 2119
- HITHRESH. . . . . . . . . . . . I 0191
- HSIDATAINT. . . . . . . . . . . L 2151
- HSIMODE . . . . . . . . . . . . F 0003
- HSISTAT . . . . . . . . . . . . F 0006
- HSITIME . . . . . . . . . . . . G 0004
- HSIZEROINT. . . . . . . . . . . L 2173
- HSOCMD. . . . . . . . . . . . . F 0006
- HSOLINEINT. . . . . . . . . . . L 2158
- HSOLINEON . . . . . . . . . . . L 20B2
- HSOTIME . . . . . . . . . . . . G 0004
- HSO_OK. . . . . . . . . . . . . L 2161
- INTERRUPTSON. . . . . . . . . . L 20CE
- INTMASK . . . . . . . . . . . . F 0008
- INTPEND . . . . . . . . . . . . F 0009
- IOC0. . . . . . . . . . . . . . F 0015
- IOC1. . . . . . . . . . . . . . F 0016
- IOS0. . . . . . . . . . . . . . F 0015
- IOS1. . . . . . . . . . . . . . F 0016
- LOTHRESH. . . . . . . . . . . . I 0129
- MAINLOOP. . . . . . . . . . . . L 20E2
- NOCHANGE. . . . . . . . . . . . L 2137
- OVERMAX . . . . . . . . . . . . L 2138
- P0. . . . . . . . . . . . . . . F 000E
- P1. . . . . . . . . . . . . . . F 000F
- P2. . . . . . . . . . . . . . . F 0010
- P2IMAGE . . . . . . . . . . . . D 0054
- The Cybernetic Micro Systems 8096 Family Assembler, Version 3.01 Page 8
- 01-01-80
-
-
- PWMCTRL . . . . . . . . . . . . F 0017
- PWM_ON. . . . . . . . . . . . . L 20A6
- R0. . . . . . . . . . . . . . . G 0000
- SBUF_RX . . . . . . . . . . . . F 0007
- SBUF_TX . . . . . . . . . . . . F 0007
- SERDATA . . . . . . . . . . . . D 0053
- SERDONE . . . . . . . . . . . . L 21A7
- SERIALINT . . . . . . . . . . . L 2192
- SERIALON. . . . . . . . . . . . L 20C2
- SERSTAT . . . . . . . . . . . . D 0052
- SKIPCHK . . . . . . . . . . . . L 20FF
- SOFTHSOINT. . . . . . . . . . . L 2174
- SP. . . . . . . . . . . . . . . W 0018
- SPCON . . . . . . . . . . . . . F 0011
- SPSTAT. . . . . . . . . . . . . F 0011
- START . . . . . . . . . . . . . L 2080
- T1. . . . . . . . . . . . . . . G 000A
- T2. . . . . . . . . . . . . . . G 000C
- TEST_ANALOG . . . . . . . . . . L 2125
- TIMERINT. . . . . . . . . . . . L 2146
- TRAPINT . . . . . . . . . . . . L 21AF
- UNDERMIN. . . . . . . . . . . . L 213F
- UPBIT . . . . . . . . . . . . . I 0002
- VAL1. . . . . . . . . . . . . . I 7532
- VALOK . . . . . . . . . . . . . L 217D
- WDOGCLR . . . . . . . . . . . . F 000A
-
- ;%Z
-
- 00 Errors (0000)
-