.DEVICE AT90S2313 .include "2313def.inc" .include "CGHALF.FNT" .equ DIV = 177 ;Division ratio = (256 - DIV) + 1. =80 .equ MINFL=$D1 .equ MINFH=$1F .equ MAXFL=$D1 .equ MAXFH=$37 .equ OSDSTART = $20 .equ OSDEND = $e4 .equ UHFSTART =$1DDD .equ UHFEND =$37DC .equ LOAREA = $60 ;to 6B .equ HIAREA = $6C ;to 77 .equ TEXTBASE = $78 ;to BF .equ TMPAREA = $C0 ;to C7 .equ STEP = $C8 .equ WAITCNT = $C9 .equ _MSYNC = 0 .equ _HBLNK = 1 .equ VBLNK = 2 .equ _VBLNK = 3 .equ VID = 4 .equ SCLP = 5 .equ SDAP = 6 .def port3202 = r1 .def M1 = r2 .def M2 = r3 .def M3 = r4 .def MENUIDX = r5 .def F1 = r6 .def F2 = r7 .def F3 = r8 .def KEY_NO = r9 .def ZHBAK = r10 .def ZLBAK = r11 .def XBAK = r12 .def YBAK = r13 .def KEY_RPT = r14 .def UNDER_LIN = r15 .def temp1 = r16 .def LINECNTL = r17 .def FLAGS = r18 .equ LINECNTH = 0 .equ VBLNKPER = 1 .equ HIBANK = 2 .equ TEXTENABLE = 3 .equ UNDR_EBL = 4 .equ CARRYBAK = 5 .equ OSD_OFF = 6 ;.def VBLNKCNT = r19 .def temp2 = r20 .def temp3 = r21 .def temp4 = r22 .def ltmp1 = r23 .def ltmp2 = r24 .def ltmp3 = r25 .cseg .org $0000 rjmp RESET .org OVF0addr rjmp TIMER .org $10 DIVIDERS: .db 0x0f, 0x42, 0x40, 0x01, 0x86, 0xa0 ;1M - 100K .db 0x00, 0x27, 0x10, 0x00, 0x03, 0xe8 ;10K, 1K .db 0x00, 0x00, 0x64, 0x00, 0x00, 0x0a ;100, 10 MESSAGE1: .db '*','R','F','-','D','E','V','I','C','E','S','*' .db 'S','P','E','C','.','A','N','A','L','Y','S','.' .db '(','C',')','2','0','0','0',' ','B','Y',' ',' ' .db 'S','T','A','V','R','O','S',' ','S','.',' ',' ' .db '$',' ','F','O','T','O','G','L','O','U',' ','$' .db '_','_','_','_','_','_','_','_','_','_','_','_' MESSAGE2: .db 'F','Q','=','X','X','X','X','.','D','D','D','D' .db 'S','T','E','P',':','X','X','X','M','H','Z',' ' .db 'B','A','N','D',':','U','H','F',' ',' ',' ',' ' .db 'C','H','A','N','N','E','L',':','X','X',' ',' ' .db 'M','A','R','K','E','R',':','X','X','X','X',' ' .db 'M','E','M','.',':','X','X',' ','S','T','O','R' STEPS: .db '6','2','.','5','K','H','Z',' ',' ','1',' ','M','H','Z' .db ' ','1','0','M','H','Z',' ' ;BANDS: .db 'V','L',' ','V','H',' ','H','Y','P','U','H','F' RESET: ldi temp1, RAMEND ;Initialize Stack out SPL, temp1 rcall INIT ;Initialize Timers - Ports ;rcall CLRSCR ldi YL,TEXTBASE ldi ltmp1,72 ldi ZL,low(MESSAGE1)*2 ldi ZH,high(MESSAGE1)*2 rcall PRINT clr temp1 mov UNDER_LIN, temp1 sei rcall DELAY rcall WAITVB ;rcall CLRSCR rcall WAITVB ldi YL,TEXTBASE ldi ltmp1,72 ldi ZL,low(MESSAGE2)*2 ldi ZH,high(MESSAGE2)*2 rcall PRINT ldi temp1,$1f mov M2,temp1 ldi temp1,$d1 mov M1,temp1 rcall SUBIF rcall BIN2BCD24 rcall FREQDISP ldi temp1,0 mov MENUIDX,temp1 rcall CALCMENU END1: rcall WAITVB rcall SCANKBD mov temp1,KEY_NO cpi temp1,00 breq MMM clr temp2 sts WAITCNT,temp2 sbrs FLAGS, OSD_OFF rjmp MN mov KEY_NO,temp2 ldi ltmp1,230 rcall DL11 cbr FLAGS,1< 84H -> 10000100 ror temp4 ;Divide by 2 -> 01000010 = (4)(2) Text row 2 nop ldi XL, TEXTBASE ;X points at Textbase in RAM clr temp1 ;Clear adder ldi temp2, 12 ;Each text line have 12 Characters ror temp4 ;Multiply row * 12 i.e. 2 * 12 = 24 brcc B1 ;If bit = 0 then avoid addition add temp1, temp2 ;Else add 12 B1: rol temp2 ;Double temp2 for next addition 12 -> 24 ror temp4 ;Test the 2nd bit of ROW brcc B2 add temp1, temp2 B2: rol temp2 ;24 -> 48 ror temp4 ;Test the 3nd bit of ROW brcc B3 add temp1, temp2 B3: add XL, temp1 ;Now X points at Textbase + (Row * 12) i.e. 24 ldi ZL, 00 ldi ZH, 04 ;Z points at base of Character Generator in ROM mov temp1, LINECNTL ;i.e. 68H andi temp1, 28 ;And mask with 00011100 i.e. 8 ror temp1 ;Divide by 4 because display the same patern for 4 lines ror temp1 add ZL, temp1 ;Now Z points at CG + current scanned line mov temp1, LINECNTL ;i.e. 68H andi temp1, 4 ;We have two banks of 12 bytes each one. When the one brne HIBNK ;is writen here the other displayed at CRT. ldi YL, LOAREA ;Now we will write at LOW AREA sbr FLAGS, 1<