📄 kclkr08.ms
字号:
.stabs "D:\Hcy_Projects\CLOCK_KITCHEN\SOURCE\Nov24\KClkR08.S", FileName
;
; Copy right Oriental Skill (Asia) Ltd
; October 24, 2003
;
; Created by Kwan for Testing
;
;
; Scratch Pad memory from 0H ~ 0FH (M0~MF)
; User RAM from 10H ~ 2FH (32 nibbles)
; Stack from 30H~4FH
; LCD RAM from 90H ~ AFH -- However A4H~AFH may be used
; as user RAM because S13~S19 segment are not used
; in this application.
;
;#define SHOWLDIGITCMD 2
;#define SHOWSDIGITCMD 3
;#define SHOWICONCMD 4
;#define SHOWMSGCMD 5
;#define CLOCKMODE 0
;#define WEIGHTMODE 1
;#define CALIBRATEMODE 2
;#define KeyHoldTm M0
;#define KeyFlags M1
;#define RegKeyFlags 1 ; same as KeyFlags
;CommCount EQU M2 ; bit count for comm
;#define KeyHoldFlag 1
;#define NewKeyFlag 2
;#define DisFlashFlag 4
;#define TimeFormatFlag 8 ; 0: 12 hour, 1: 24 hour
;#define KeyCode M3
;#define RegKeyCode 3
;#define SendData M4
;#define RegSendData 4
;#define Tmr30s M5
;CommFlag EQU M6
;
;#define RTCSec 10H
;#define RTCSecL 10H
;#define RTCSecH 11H
;#define RTCMin 12H
;#define RTCMinL 12H
;#define RTCMinH 13H
;#define RTCHour 14H
;#define RTCHourL 14H
;#define RTCHourH 15H
;
;#define RxStartBufL 20h ; start code
;RxCommand equ 21h
;#define RxBuffer0 21H ; LSBL, ___1, decimal place
;#define RxBuffer1 22H ; LSBH
;#define RxBuffer2 23H ; xxx1
;#define RxBuffer3 24H
;#define RxBuffer4 25H ; xx1x
;#define RxBuffer5 26H
;#define RxBuffer6 27H ; x1xx
;#define RxBuffer7 28H
;RxBuffer8 EQU 2aH ; MSBL
;RxBuffer9 EQU 2bH ; MSBH
;RxIcon0 EQU 2ch ; LSB
;RxIcon1 EQU 2dh ;
;RxIcon2 EQU 2eh
;RxIcon3 EQU 2fh ; MSB
;#define RxIcon0 29h
;#define RxIcon1 2ah
;#define RxIcon2 2bH
;#define RxIcon3 2cH
;#define RxSBuffer 2dH ; SDIGIT
;#define RxBuffer8 2eh
;#define RxBuffer9 2fh
;#define SumNumRxNibble 31h ;
;
;#define ModeOpt 33h ; 0: Clock Mode, 1: weighting Mode, 2: Calibration Mode
;#define DspHourBuf 34H
;#define DspHourLBuf 34H
;#define DspHourHBuf 35H
;#define AppFlags 16H
;#define HalfSecFlag 1
;#define SecClickFlag 2
;#define ReqToSendFlag 4 ; set when 4 bits has been sent in background
;#define Rx4BitFlag 8 ; set when 4 bits has been received in background
;b0 -- Half second (0->1 0.5 sec, 1->0 1 sec)
;b1 -- second click
;b2 -- RxReady
;#define CommCount 17H ; bit count for comm
;#define TmpRTCMinute 18H
;#define TmpRTCMinuteL 18H ; for the use of time adjustment
;#define TmpRTCMinuteH 19H
;#define TmpRTCHour 1AH
;#define TmpRTCHourL 1aH
;#define TmpRTCHourH 1bH
;
;#define CommBufferL 1cH ; Tx/Rx Buffer
;RxNibbleCnt equ 00h ;
;#define RxNibbleCnt 1dh
;#define KeyFlag 1eH
;NewKey bit 1eh.0
;KeyHold bit 1eh.1
;#define RTC1SecCnt 1fh
;
;
;===========================================================
; Registers
; IC: 6001
;KPort EQU 0E0H
;IO_Key_On EQU 1
;IO_Key_Off EQU 2
;IO_DClk EQU 4
;;
;Timer EQU 0E4H ; timer data register
;KPortMask EQU 0E8H ; interrupt mask for K-port
;TimerMask EQU 0EBH
;KIntFactor EQU 0EDH ; interrupt request flags for Kport
;TIntFactor EQU 0EFH ; interrupt request flags for Timer
;;
;RPort EQU 0F3H ; R0 data port
;IO_PowerCtl EQU 1
;IO_DataOut EQU 2
;;
;PPort EQU 0F6H ; P0 data port
;IO_Key_Kg EQU 1
;IO_Key_ml EQU 2
;IO_DataIn EQU 8
;;
;TimerCR EQU 0F9H
;;b2=1 to reset clock timer
;;
;HeavyLoad EQU 0FAH ; heavy load protection register
;;b3=1 if heavy load, b3=0 if normal load
;;
;LCDSwitch EQU 0FBH ;
;;b3=1 if static, b3=0 if dynamic
;;
;PPortDir EQU 0FCH ; P-port direction register
;;b0=1 if whole P-port as output, b0=0 if as inout
;;
;BuzzerFreq EQU 0FDH ; Buzzer freq
;===========================================================
; Registers
; IC: 60R08
;#define KPort 2E3H
;#define IO_Key_On 1
;#define IO_Key_Off 2
;#define IO_DClk 4
;
;#define Timer 2E0H ; timer data register
;#define KPortMask 2E5H ; interrupt mask for K-port
;#define TimerMask 2E8H
;#define KIntFactor 2EAH ; interrupt request flags for Kport
;#define TIntFactor 2E9H ; interrupt request flags for Timer
;#define RPort 2EBH ; R0 data port
;#define IO_PowerCtl 1
;#define IO_DataOut 2
;
;#define PPort 2EDH ; P0 data port
;#define IO_Key_Kg 1
;#define IO_Key_ml 2
;#define IO_DataIn 8
;
;#define TimerCR 2EEH
;b2=1 to reset clock timer
;
;#define HeavyLoad 2E6H ; heavy load protection register
;b3=1 if heavy load, b3=0 if normal load
;
;#define LCDSwitch 2E8H ;
;b3=1 if static, b3=0 if dynamic
;
;#define PPortDir 2EEH ; P-port direction register
;b0=1 if whole P-port as output, b0=0 if as inout
;
; constants defintion
;
;#define Key_On 0111b ; key code corr. to Samsung's code
;#define Key_Off 1110b
;#define Key_Kg 1101b
;#define Key_ml 1011b
;#define Key_Nil 0
;===========================================================
.org 0
;-----------------------------------------------------------
;-----------------------------------------------------------
; Display routine
;-----------------------------------------------------------
;-----------------------------------------------------------
; hgfe dcba
.stabn 216, LineInfo
retd 0x3f ; 0
.stabn 217, LineInfo
retd 0x06 ; 1
.stabn 218, LineInfo
retd 0x5b ; 2
.stabn 219, LineInfo
retd 0x4f ; 3
.stabn 220, LineInfo
retd 0x66 ; 4
.stabn 221, LineInfo
retd 0x6d ; 5
.stabn 222, LineInfo
retd 0x7d ; 6
.stabn 223, LineInfo
retd 0x27 ; 7
.stabn 224, LineInfo
retd 0x7f ; 8
.stabn 225, LineInfo
retd 0x6f ; 9
.stabn 226, LineInfo
retd 0x77 ; A
.stabn 227, LineInfo
retd 0x7c ; b
.stabn 228, LineInfo
retd 0x39 ; C
.stabn 229, LineInfo
retd 0x5e ; d
.stabn 230, LineInfo
retd 0x79 ; E
.stabn 231, LineInfo
retd 0x71 ; F
.stabn 232, LineInfo
retd 0x76 ; H
.stabn 233, LineInfo
retd 0x38 ; L
.stabn 234, LineInfo
retd 0x31 ; r
.stabn 235, LineInfo
retd 0x73 ; P
.stabn 236, LineInfo
retd 0x78 ; t
.stabn 237, LineInfo
retd 0x3e ; U
.stabn 238, LineInfo
retd 0x40 ; -
.stabn 239, LineInfo
retd 0x00 ; ' '
; fraction table
.stabn 243, LineInfo
retd 0x18 ;
.stabn 244, LineInfo
retd 0x14
.stabn 245, LineInfo
retd 0x38
.stabn 246, LineInfo
retd 0x12
.stabn 247, LineInfo
retd 0x58
.stabn 248, LineInfo
retd 0x34
.stabn 249, LineInfo
retd 0x78
.stabn 250, LineInfo
retd 0x98
DspPattern:
.stabn 253, LineInfo
ld b,0
.stabn 254, LineInfo
jpba
DspPattern1:
.stabn 257, LineInfo
ld b,1
.stabn 258, LineInfo
jpba
;-------------------------------------
; Cate : Display
; By : Hcy
; Func : display the digit(0--9)
; Desc : DspDigit
; I/P : A(0--9),X(address of digit address)
; O/P : --
; Destroy: A,
; Note :
DspDigit:
.stabn 269, LineInfo
calz DspPattern
.stabn 270, LineInfo
ret
DspDigit1:
.stabn 272, LineInfo
calz DspPattern1
.stabn 273, LineInfo
ret
;-------------------------------------
; Cate : Display
; By : loren
; Func : display the icon
; Desc : DspColonOn
; I/P : --
; O/P : --
; Destroy:
; Note :
DspColonOn:
; remark for 60r08
; ld y,0a0h
.stabn 286, LineInfo
ld y,0x050
.stabn 287, LineInfo
or my,0x01 ; display ':'
.stabn 288, LineInfo
ret
;-------------------------------------
; Cate : Display
; By : loren
; Func : display off the icon
; Desc : DspColonOff
; I/P : --
; O/P : --
; Destroy:
; Note :
DspColonOff:
; remark for 60r08
; ld y,0a0h
.stabn 302, LineInfo
ld y,0x050
.stabn 303, LineInfo
and my,0b1110
DspCO:
.stabn 305, LineInfo
ret
;-------------------------------------
;-------------------------------------
; Cate :Dosplay
; By :Kwan
; Func :Flash the colon
; Desc :
; I/P :---
; O/P :
; Destroy:
; Note : turn on/off the colon according to
; HalfSecFlag
;
FlashColon:
.stabn 320, LineInfo
ld y,(0x33)
.stabn 321, LineInfo
fan my,0b1111
.stabn 322, LineInfo
jp nz,DspCO ; jmp if not clock mode
.stabn 324, LineInfo
ld y,(0x16)
.stabn 325, LineInfo
FAN my,(1)
.stabn 326, LineInfo
Jp z,DspColonOff
.stabn 327, LineInfo
jp DspColonOn
FlashHour:
.stabn 330, LineInfo
ld x,(0x16)
.stabn 331, LineInfo
FAN mx,(1)
.stabn 332, LineInfo
Jp z,DspHourOff
;-------------------------------------
; Cate : Display
; By : Hcy
; Func : Display the time
; Desc : DspTime
; I/P : y(ram address)
; O/P : --
; Destroy:
; Note :
DspTime:
DspHour:
; display hour xx
; ld x,RTCHourH
.stabn 346, LineInfo
ld x,(1)
.stabn 347, LineInfo
fan mx,(8)
.stabn 348, LineInfo
jp nz,DspH0 ; jmp if 24 hour format
.stabn 349, LineInfo
call IsEquZero
.stabn 350, LineInfo
jp c,NDspH00
.stabn 351, LineInfo
call IsEqu12
.stabn 352, LineInfo
jp c,DspH00 ; jmp if hour =12
.stabn 353, LineInfo
call Sub12D
.stabn 354, LineInfo
jp nc,DspH00 ; current time > 12
.stabn 355, LineInfo
call CopyByte
; ld a,0ah
; ld x,098h
; calz DspPattern ; 'A'
NDspH00:
.stabn 360, LineInfo
ld a,0x01
; remark for 60r08
; ld x,0a1h
.stabn 363, LineInfo
ld x,0x051
.stabn 364, LineInfo
ld mx,a ; 'AM'
.stabn 365, LineInfo
jp DspH1
DspH00:
; ld a,03h
; ld x,098h
; calz DspPattern1 ; 'P'
.stabn 370, LineInfo
ld a,0x02
; remark for 60r08
; ld x,0a1h
.stabn 373, LineInfo
ld x,0x051
.stabn 374, LineInfo
ld mx,a ; 'PM'
.stabn 375, LineInfo
jp DspH1
DspH0:
.stabn 377, LineInfo
ld a,7
;; remark for 60r08
; ld x,0a1h
.stabn 380, LineInfo
ld x,0x051
.stabn 381, LineInfo
calz DspPattern1 ; ' '
.stabn 382, LineInfo
call CopyByte
.stabn 383, LineInfo
jp NDspH0
DspH1:
; ld x,DspHourBuf
; calz IncByteD
NDspH0:
.stabn 388, LineInfo
ld y,(0x34)
.stabn 389, LineInfo
ld a,my
DspH2:
; remark for 60r08
; ld x,092h
.stabn 393, LineInfo
ld x,0x042
.stabn 394, LineInfo
calz DspDigit
.stabn 395, LineInfo
ld y,(0x35)
; inc y
.stabn 397, LineInfo
ld a,my
; remark for 60r08
; ld x,090h
.stabn 400, LineInfo
ld x,0x040
.stabn 401, LineInfo
calz DspDigit
.stabn 402, LineInfo
ret
DspHourOff:
; off minute xx
.stabn 405, LineInfo
ld a,0x07
; remark for 60r08
; ld x,090h
.stabn 408, LineInfo
ld x,0x040
.stabn 409, LineInfo
calz DspDigit1
; remark for 60r08
; ld x,092h
.stabn 412, LineInfo
ld x,0x040
.stabn 413, LineInfo
calz DspDigit1
.stabn 414, LineInfo
ret
FlashMinute:
.stabn 417, LineInfo
ld x,(0x16)
.stabn 418, LineInfo
FAN mx,(1)
.stabn 419, LineInfo
Jp z,DspMinuteOff
DspMinute:
; display min xx
; ld x,RTCMinH
.stabn 424, LineInfo
ld a,my
; remark for 60r08
; ld x,096h
.stabn 427, LineInfo
ld x,0x040
.stabn 428, LineInfo
calz DspDigit
; ld x,RTCMinL
.stabn 430, LineInfo
inc y
.stabn 431, LineInfo
ld a,my
; remark for 60r08
; ld x,094h
.stabn 434, LineInfo
ld x,0x044
.stabn 435, LineInfo
calz DspDigit
.stabn 436, LineInfo
ret
DspMinuteOff:
; off minute xx
.stabn 439, LineInfo
ld a,0x07
; remark for 60r08
; ld x,094h
.stabn 442, LineInfo
ld x,0x044
.stabn 443, LineInfo
calz DspDigit1
; remark for 60r08
; ld x,096h
.stabn 446, LineInfo
ld x,0x046
.stabn 447, LineInfo
calz DspDigit1
.stabn 448, LineInfo
ret
;-------------------------------------
; Cate : Display
; By : Hcy
; Func : dislay the fraction
; Desc : DspFraction
; I/P : RxSBuffer(0--9) --> nul,1/8,1/4,3/8,1/2,5/8,3/4,7/8,9/8,nul
; O/P : --
; Destroy:
; Note :
DspFraction:
.stabn 462, LineInfo
ld y,(0x2d)
.stabn 463, LineInfo
cp my,0
.stabn 464, LineInfo
jp z,DspF0
.stabn 465, LineInfo
cp my,9
.stabn 466, LineInfo
jp z,DspF0
.stabn 467, LineInfo
ld a,my
.stabn 468, LineInfo
add a,0x07 ; a+7
.stabn 469, LineInfo
ld x,(0x2e)
.stabn 470, LineInfo
calz DspPattern1
.stabn 471, LineInfo
ld y,(0x2e)
.stabn 472, LineInfo
ld a,my
; remark for 60r08
; ld x,098h
.stabn 475, LineInfo
ld x,0x048
.stabn 476, LineInfo
calz DspPattern
.stabn 477, LineInfo
inc y
.stabn 478, LineInfo
ld a,my
.stabn 479, LineInfo
calz DspPattern
.stabn 480, LineInfo
ret
DspF0:
; display nul/nul
.stabn 483, LineInfo
ld a,7
; remark for 60r08
; ld x,098h
.stabn 486, LineInfo
ld x,0x048
.stabn 487, LineInfo
calz DspPattern1 ; display ' ' in 5th digit
.stabn 488, LineInfo
calz DspPattern1 ; display ' ' in 6th digit
.stabn 489, LineInfo
ret
;-------------------------------------
; Cate : Display
; By : Hcy
; Func : display the weight from the samsung
; Desc : DspWeight
; I/P : --
; O/P : --
; Destroy:
; Note :
DspWeight:
.stabn 501, LineInfo
ld y,(0x27)
; remark for 60r08
; ld x,090h
.stabn 504, LineInfo
ld x,0x040
.stabn 505, LineInfo
ld b,4
DspW0:
.stabn 507, LineInfo
ld a,my
.stabn 508, LineInfo
push b
.stabn 509, LineInfo
ld b,a
.stabn 510, LineInfo
inc y
.stabn 511, LineInfo
fan my,0x0f
.stabn 512, LineInfo
jp nz,DspW1
.stabn 513, LineInfo
ld a,b
.stabn 514, LineInfo
calz DspDigit
.stabn 515, LineInfo
jp DspW2
DspW1:
.stabn 517, LineInfo
ld a,b
.stabn 518, LineInfo
calz DspDigit1
DspW2:
.stabn 520, LineInfo
ld b,YL
.stabn 521, LineInfo
rcf
.stabn 522, LineInfo
sbc b,3 ; get next digit
.stabn 523, LineInfo
ld YL,b
.stabn 524, LineInfo
pop b
.stabn 525, LineInfo
ADD b,0x0F ;
.stabn 526, LineInfo
jp nz,DspW0
.stabn 527, LineInfo
ret
;-------------------------------------
; Cate : Display
; By : Hcy
; Func : display the icons from the samsung
; Desc : DspIcons
; I/P : --
; O/P : --
; Destroy:
; Note :
;DspIcons:
; ld y,RxIcon0
; ld x,09ch
; ld b,4
;DspI0:
; ld mx,my
; inc y
; inc x
;; rcf
;; sbc b,1 ; get next digit
; ADD b,0FH ;
; jp nz,DspI0
; ret
;---------------------------------------
;---------------------------------------
; calculate the clock
;---------------------------------------
;---------------------------------------
;-------------------------------------
; Cate : Application
; By : Hcy
; Func : increase byte by decimal
; Desc : IncByteD
; I/P : X(address of buffer)
; O/P :
; Destroy:
; Note :
IncByteD:
.stabn 567, LineInfo
SET F,0b0100
.stabn 568, LineInfo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -