📄 sub.mac
字号:
$nolist
;*******************************************************************************
;*******************************************************************************
;* *
;* (C)Copyright, CLOVER China Electronics Co.,LTD. *
;* All Rigits Reserved *
;* add:No.58-F Yang Dong Road, LuoFeng Demonstrative Zone Suzhou, China *
;* Tel: 0512-67261886 Fax:0512-67261882 *
;* http://www.clover.co.jp *
;* *
;*******************************************************************************
;*******************************************************************************
;
; OBS CPD3212T source program
; CPU: TOSHIBA TLC-870/C series TMP86CM74A
; RAM: 2Kbytes(0040h - 083Fh)
; ROM: 32Kbytes(8000h - FFFFh)
;
;
;Sub routines
?trigger(@)
@include "symdef_ram.inc"
@include "macro.inc"
@include "define.inc"
$list
public w1_clear,w2_clear,w3_clear,ten_clear,acc_clear,gt_clear,mem1_clear,w1_zerock,ten_zerock
public calc_add,calc_mult,calc_div,stg_sfl47,stg_sfr47,stg_sfl49,stg_sfr49
public spc_prnbuf,spc_dt,spc_disp,_spaceck
public ten_to_w2,ten_to_w2dp,wk_update,ic_update,add_mode,ten_to_w1,ten_to_w1dp
public w1_to_ten,w2_to_ten,mem1_to_w2,gt_to_w2,w1_to_w2,acc_to_w2,w2_to_w1,const_to_w1,w1_to_const,w2_to_const,wk_round
public exchg_w12,const_to_w2,w2_to_tax,cost_to_w2,w2_to_cost,sell_to_w2,w2_to_sell,marg_to_w2,w2_to_marg,marg_to_w1,sell_to_w1,cost_to_w1
public dt_to_prn,prn_to_dt,dp_adjust,_zerock,wk_round_0,wkrnd_zsp0
public move_to_w1,move_to_w2,move_9byte,clear_9byte
public euro1_to_w2,euro2_to_w2,w2_to_euro1,w2_to_euro2,ten_to_euro1,ten_to_euro2,euro1_to_ten,euro2_to_ten
public tax2_to_w1,tax2_to_w2,tax_to_w1,tax_to_w2
public w2_to_tax2,w1_to_acc,w2_to_acc,acc_to_ten,wk_round_with_ten_dp
public const_clear,wk_round_with_const_dp,wk_round_with_2DP
public wk_round_down,wk_round_up
public w2_print,w2_round_print,w2_round
public w1_print,w1_round_print,w1_round
public w1_to_w4,w4_to_w1,w2_to_w4,w4_to_w2,w1_to_ftemp,ftemp_to_w2
public move_to_ten
extern wk_print
ROM section code
;===================================================
; Data clear use resister: hl, c, a
;===================================================
;clear work resister...............
const_clear:
ld hl,CONST
j clear_9byte
w1_clear:
ld hl,W1
j clear_9byte
w2_clear:
ld hl,W2
j clear_9byte
w3_clear:
ld hl,W3
j clear_9byte
ten_clear:
ld (TEN_CT),0 ;V3.08
ld hl,TENKEY
j clear_9byte
;clear work resister & item counter...............
acc_clear:
;V2.03 @CLB (ACC_STORE) ;V1.26 only used for V1297
ld hl,ACC
call clear_9byte
j ica_clear
mem1_clear:
ld hl,MEM1
call clear_9byte
j icm_clear
gt_clear:
ld hl,MEMGT
call clear_9byte
j icg_clear
;clear item counter.................
ica_clear:
ld hl,IC_A
j clear_2byte
icm_clear:
ld hl,IC_M
j clear_2byte
icg_clear:
ld hl,IC_G
j clear_2byte
;space clear.......................
spc_dt:
ld hl,DT_BUF
ld a,0xff
j fill_9byte
spc_prnbuf:
;V4.03 ld (PRN_BUF_S),P_SPC ;clear prn_buff sign "+" or "-"
ld hl,PRN_BUF
spc_prnbuf0:
ld a,ps_spc
ld c,24-1
j fill_nb
spc_disp:
ld hl,DISP
ld a,D_SPC
ld c,14-1 ;fill data from address+13
j fill_nb0
clear_2byte:
ld a,0
ld c,2-1 ;fill data from address+1
j fill_nb0
clear_9byte:
ld a,0
fill_9byte:
ld c,9-1 ;fill data from address+8
fill_nb:
fill_nb0:
ld (hl+c),a
dec c
j f,fill_nb0 ;reg.c is not 0xff? yes->
ret
;===================================================
; Data transfer use register: ix, iy, c, a
;===================================================
;transfer to W1........................
sell_to_w1:
ld ix,SELL
j move_to_w1
cost_to_w1:
ld ix,COST
j move_to_w1
marg_to_w1:
ld ix,MARG
j move_to_w1
tax_to_w1:
ld ix,TAXRT
j move_to_w1
tax2_to_w1:
ld ix,TAX2RT
j move_to_w1
const_to_w1:
ld ix,CONST
j move_to_w1
mem1_to_w1:
ld ix,MEM1
j move_to_w1
gt_to_w1:
ld ix,MEMGT
j move_to_w1
w2_to_w1:
ld ix,W2
j move_to_w1
w3_to_w1:
ld ix,W3
j move_to_w1
ten_to_w1:
ld ix,TENKEY
j move_to_w1
;transfer to W2........................
cost_to_w2:
ld ix,COST
j move_to_w2
sell_to_w2:
ld ix,SELL
j move_to_w2
marg_to_w2:
ld ix,MARG
j move_to_w2
tax_to_w2:
ld ix,TAXRT
j move_to_w2
tax2_to_w2:
ld ix,TAX2RT
j move_to_w2
const_to_w2:
ld ix,CONST
j move_to_w2
gt_to_w2:
ld ix,MEMGT
j move_to_w2
mem1_to_w2:
ld ix,MEM1
j move_to_w2
acc_to_w2:
ld ix,ACC
j move_to_w2
w1_to_w2:
ld ix,W1
j move_to_w2
w3_to_w2:
ld ix,W3
j move_to_w2
ten_to_w2:
ld ix,TENKEY
j move_to_w2
euro1_to_w2:
push wa
@SEB (F_COUNTRY1)
pop wa
ld ix,EURO_RATE1
j move_to_w2
euro2_to_w2:
push wa
@SEB (F_COUNTRY2)
pop wa
ld ix,EURO_RATE2
j move_to_w2
;transfer to W3........................
w1_to_w3:
ld ix,W1
j move_to_w3
w2_to_w3:
ld ix,W2
j move_to_w3
;transfer to TENKEY....................
w1_to_ten:
ld ix,W1
j move_to_ten
w2_to_ten:
ld ix,W2
j move_to_ten
acc_to_ten:
ld ix,ACC
j move_to_ten
;transfer to CONST........................
w1_to_const:
ld ix,W1
j move_to_const
w2_to_const:
ld ix,W2
j move_to_const
;-----------------------------------------
w2_to_acc: ;V1.26
ld ix,W2 ;V1.26
j move_to_acc ;V1.26
w1_to_acc:
ld ix,W1
j move_to_acc
;set distination address.........
move_to_w1:
ld iy,W1
j move_9byte
move_to_w2:
ld iy,W2
j move_9byte
move_to_w3:
ld iy,W3
j move_9byte
move_to_ten:
ld iy,TENKEY
j move_9byte
move_to_const:
ld iy,CONST
j move_9byte
move_to_acc:
ld iy,ACC
j move_9byte
;others..........................
ten_to_euro1:
ld ix,TENKEY
ld iy,EURO_RATE1
j move_9byte
ten_to_euro2:
ld ix,TENKEY
ld iy,EURO_RATE2
j move_9byte
euro1_to_ten:
push wa
@SEB (F_COUNTRY1)
pop wa
ld ix,EURO_RATE1
ld iy,TENKEY
j move_9byte
euro2_to_ten:
push wa
@SEB (F_COUNTRY2)
pop wa
ld ix,EURO_RATE2
ld iy,TENKEY
j move_9byte
w2_to_euro1:
ld ix,W2
ld iy,EURO_RATE1
j move_9byte
w2_to_euro2:
ld ix,W2
ld iy,EURO_RATE2
j move_9byte
w2_to_tax:
ld ix,W2
ld iy,TAXRT
j move_9byte
w2_to_tax2:
ld ix,W2
ld iy,TAX2RT
j move_9byte
w2_to_cost:
ld ix,W2
ld iy,COST
j move_9byte
w2_to_sell:
ld ix,W2
ld iy,SELL
j move_9byte
w2_to_marg:
ld ix,W2
ld iy,MARG
j move_9byte
dt_to_prn:
;V4.03 ld ix,DT_BUF
;V4.03 ld iy,PRN_BUF
;V4.03 j move_9byte
prn_to_dt:
;V4.03 ld ix,PRN_BUF
;V4.03 ld iy,DT_BUF
;V4.03 j move_9byte
w1_to_w4:
ld ix,W1
ld iy,W4
jp move_9byte
w1_to_ftemp:
;V4.11 ld ix,W1
;V4.11 ld iy,FN_TEMP
;V4.11 jp move_9byte
ftemp_to_w2:
;V4.11 ld ix,FN_TEMP
;V4.11 ld iy,W2
;V4.11 jp move_9byte
w4_to_w1:
ld ix,W4
ld iy,W1
jp move_9byte
w2_to_w4:
ld ix,W2
ld iy,W4
jp move_9byte
w4_to_w2:
ld ix,W4
ld iy,W2
jp move_9byte
move_9byte:
ld c,9-1 ;move 9bytes
move_nb0:
ld a,(ix)
ld (iy),a
inc ix
inc iy
dec c
j f,move_nb0 ;reg.c is not 0xff? yes->
ret
;---------------------------------------
w1_round:
ld hl,W1
jp wreg_round
;------------------------------
w2_round:
ld hl,W2
;------------------------------
wreg_round:
call wk_round
ret
;------------------------------
w1_round_print:
call w1_round
w1_print:
ld hl,W1
jp wreg_print
;------------------------------
w2_round_print:
call w2_round
w2_print:
ld hl,W2
;------------------------------
;==============================
wreg_print:
call wk_print
ret
;==============================================================================
; Exchange work register use register: ix, iy, c, a, b
;==============================================================================
exchg_w12:
ld ix,W1
ld iy,W2
j exchg_9byte
exchg_9byte:
ld c,9-1 ;move 9bytes
exchg_nb0:
ld a,(ix)
ld b,(iy)
ld (ix),b
ld (iy),a
inc ix
inc iy
dec c
j f,exchg_nb0 ;reg.c is not 0xff? yes->
ret
;==============================================================================
; ADD mode
;==============================================================================
;W2 shift to right(shift DP_POS times)
;ignore when not enter tenkey
;ignore when enter tenkey with DP
add_mode:
@BBS (SW_A,add_mode_start) ;V1.224
@BBC (SW_ADM,add_mode9)
add_mode_start: ;V1.24
@BBC (F_TNKEY,add_mode9) ;V1.33
;V1.33 ld a,(TEN_CT)
;V1.33 j z,add_mode9 ;if no tenkey entry yes -> ignore add mode
@BBS (F_DPIN,add_mode9) ;if tenkey entry with DP key yes -> ignore add mode
ld b,(DP_POS)
j z,add_mode9
call ten_to_w2 ;
;V3.04 call w2_zerock ;
;V3.04 j nz,add_mode3 ;V
;V3.04 and (W2_S),0x00 ;clear tenkey sign(not allowed -0 entry)
add_mode3: ;
ld a,(W2_DP) ;
add a,(DP_POS) ;
ld (W2_DP),a ;
set cf ;C=1 means add mode shift
ret ;
add_mode9:
clr cf ;C=0 means not add mode
ret
;==============================================================================
; DP adjustment(follow DP selector setting)
;==============================================================================
;transfer TENKEY to W2 with DP adjustment..............
ten_to_w1dp:
call ten_to_w1 ;V1.17
ld hl,W1 ;V1.17
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -