📄 dicchess.asm
字号:
?NotUp: ;;cmp #10
cmp #8 ;;zjw
bne ?notDown
jsr ShowDown
?NotDown:
rts
Set_Locate_Value:
LDA <Locate_Y
and #00001000b
asl
ora <Locate_X
pha
lda <Locate_Y
and #00000111b
tax
lda valuetran,x
plx
bbs0 <Locate_Value,?1
ORA ChessBoard1,X
STA ChessBoard1,X
rts
?1: ORA ChessBoard2,X
STA ChessBoard2,X
rts
;;-------------------------------------------------
;; GET Location Value
;; bit 0-> 0: me 1:cpu
;; bit 1-> 0:
;;--------------------------------------------------
Get_Locate_Value:
rmb1 <Locate_Value ; Locate_Value.1 = 0;
lda <Locate_Y ; A = Locate_Y;
and #00001000b ; A &= 0x08;
asl ; A <= 1;
ora <locate_x ; A |= Locate_X;
pha ; (Stack) <- A;
lda <locate_y ; A = Locate_Y;
and #00000111b ; A &= 0x07;
tax ; X = A;
lda valuetran,x ; A = valuetran[x];
plx ; X <- (Stack);
pha
and ChessBoard1,x
beq ?1
pla
rmb0 <locate_Value
rts
?1: pla
and ChessBoard2,x
beq ?2
smb0 <Locate_Value
rts
?2: smb1 <Locate_Value
rts
LDX <Locate_X
LDA <Locate_Y
AND #00000111B
TAY
SEC
LDA #0
GetLocVoc1:
ROL A
DEY
BPL GetLocVoc1
PHA
BBS3 <Locate_Y,GetLocVoc2
AND <80H,X
BNE GetLocVoc3
PLA
AND <A0H,X
BNE GetLocVoc4
SMB1 <Locate_Value ;;set Locate_Empty
RTS
GetLocVoc2:
AND <90H,X
BNE GetLocVoc3
PLA
AND <B0H,X
BNE GetLocVoc4
SMB1 <Locate_Value
RTS
GetLocVoc3:
PLA
RMB0 <Locate_Value ;;set Value-myslef
RMB1 <Locate_Value ;;set Locate_Empty false
RTS
GetLocVoc4:
SMB0 <Locate_Value ;;set Value-Enemy
RMB1 <Locate_Value ;;set Locate _Empty false
RTS
;;----------------------------------------------
;; Clear Location Value
;;----------------------------------------------
Clr_Locate_Value:
LDA <Locate_Y
and #00001000b
asl
ora <Locate_X
pha
ldx <Locate_Y
and #00000111b
lda valuetran,x
plx
and ChessBoard1,X
eor ChessBoard1,X
STA ChessBoard1,X
and ChessBoard2,X
eor ChessBoard2,X
STA ChessBoard2,X
rts
;;------------------------------------
;; FIVE POINT CHESS START
;;------------------------------------
;;Load
FiveStart:
stz <Level
fivestart1:
LClrLcd
ldx #0
?5: STZ chessboard1,X ;;clear point buffer
INX ;;
CPX #40H ;;
BNE ?5 ;;
STZ <StepDig1
STZ <StepDig2
stz <EquFlag
JSR ShowStep
LDA #3
STA <DispCenterX
STA <DispCenterY
jsr DrawFiboard
;;JSR ShowPlayerNum
LDA #6
STA <Cursor_X
STA <Cursor_Y
LSetTimer 64
jsr ShowMeChess
STZ <WinFlag
rmb3 <StopFlash
jmp_LMAINU:
LMAINU
ShowMoveChess:
sec
lda <cursor_X
sbc <DispCenterX
tax
lda xlocate,x
sta <ox
sec
lda <cursor_Y
sbc <dispCenterY
tax
lda xlocate,x
sta <oy
loprintimage movechess
rts
ShowMeChess:
sec
lda <cursor_X
sbc <DispCenterX
tax
lda xlocate,x
sta <ox
sec
lda <cursor_Y
sbc <dispCenterY
tax
lda xlocate,x
sta <oy
loprintimage mechess
rts
ShowCpuChess:
sec
lda <cursor_X
sbc <DispCenterX
tax
lda xlocate,x
sta <ox
sec
lda <cursor_Y
sbc <dispCenterY
tax
lda xlocate,x
sta <oy
loprintimage Cpuchess
rts
ShowCross:
sec
lda <cursor_X
sbc <DispCenterX
tax
lda xlocate,x
sta <ox
sec
lda <cursor_Y
sbc <dispCenterY
tax
lda xlocate,x
sta <oy
loprintimage Cross
rts
ShowMeChessB:
sec
lda <cursor_X
sbc <DispCenterX
tax
lda xlocate,x
sta <ox
sec
lda <cursor_Y
sbc <dispCenterY
tax
lda xlocate,x
sta <oy
loprintimage mechessB
rts
ShowCpuChessB:
sec
lda <cursor_X
sbc <DispCenterX
tax
lda xlocate,x
sta <ox
sec
lda <cursor_Y
sbc <dispCenterY
tax
lda xlocate,x
sta <oy
loprintimage CpuchessB
rts
ShowCrossB:
sec
lda <cursor_X
sbc <DispCenterX
tax
lda xlocate,x
sta <ox
sec
lda <cursor_Y
sbc <dispCenterY
tax
lda xlocate,x
sta <oy
loprintimage CrossB
rts
; ***************************************************************************
FiveTimer:
bbs3 <StopFlash,?2
lda #00000001b
eor <Flashflag
sta <Flashflag
bbr7 <Winflag,?Show5Finish
bbs0 <EquFlag,?shotim1
jsr Show5Finish
?shotim1:
BBS5 <WinFlag,?show5end
SMB5 <WinFlag
jsr ShowWin
?show5end:
?Show5Finish:
bbr0 <FlashFlag,?1
lda <Cursor_X
sta <Locate_X
lda <Cursor_Y
sta <Locate_Y
jsr Get_Locate_Value
bbs1 <Locate_Value,?ShowCross
bbs0 <Locate_Value,?ShowCpuChess
jsr showMeChess
bra ?2
?ShowCpuChess:
jsr ShowCpuChess
bra ?2
?ShowCross:
jsr ShowCross
bra ?2
?1: jsr ShowMoveChess
?2:
;; jmp main
jmp jmp_LMAINU
;;?Show5Finish:
;; jsr Show5Finish
;; bra ?2
;;=======keydown====
FiveKeyIn:
lda <KeyNo
cmp #UPkey
beq ?PressUpKey
cmp #DOWNkey
beq ?PressDownKey
cmp #RIGHTkey
beq ?PressRightKey
cmp #LEFTkey
beq ?PressLeftKey
cmp #ENTERkey
beq ?PressEnterKey
;; jmp main
jmp jmp_LMAINU
?PressUpKey:
jsr jsr_soundoff
jmp FPressUpKey
?PressDownKey:
jsr jsr_soundoff
jmp FPressDownKey
?PressRightKey:
jsr jsr_soundoff
jmp FPressRightKey
?PressLeftKey:
jsr jsr_soundoff
jmp FPressLeftKey
?PressEnterKey:
jsr jsr_soundoff
jmp FPressEnterKey
FPressUpKey:
jsr ShowPreChess
dec <Cursor_Y
bpl ?1
inc <Cursor_Y
?1: lda <Cursor_Y
cmp <DispCenterY
bcs ?2
dec <DispCenterY
jsr DrawFiBoard
?2:
;; jmp main
jmp jmp_LMAINU
FPressDownKey:
jsr ShowPreChess
inc <Cursor_Y
lda <Cursor_Y
cmp #16
bne ?1
dec <Cursor_Y
lda <Cursor_Y
?1: sec
sbc <DispCenterY
;;cmp #6
cmp #8 ;;zjw
bcc ?2
inc <DispCenterY
jsr DrawFiBoard
?2:
jmp jmp_LMAINU
FPressRightKey:
jsr ShowPreChess
inc <Cursor_X
lda <Cursor_X
cmp #16
bne ?1
dec <Cursor_X
lda <Cursor_X
?1: sec
sbc <DispCenterX
cmp #8
bcc ?2
inc <DispCenterX
jsr DrawFiBoard
?2:
jmp jmp_LMAINU
FPressLeftKey:
jsr ShowPreChess
dec <Cursor_X
bpl ?1
inc <Cursor_X
?1: lda <Cursor_X
cmp <DispCenterX
bcs ?2
dec <DispCenterX
jsr DrawFiBoard
?2:
;; jmp main
jmp jmp_LMAINU
FiveReStart:
rmb3 <StopFlash
lda <Level
ina
cmp #5
bne ?9
lda #0
?9: sta <Level
jmp fivestart
FPressEnterKey:
bbs7 <WinFlag,FiveReStart
lda <Cursor_X
sta <Locate_X
sta <BestPositionX
lda <Cursor_Y
sta <Locate_Y
sta <BestPositionY
jsr Get_Locate_Value
bbs1 <Locate_Value,?8
jmp ?1
?8:
smb3 <StopFlash
rmb0 <Locate_Value
jsr Set_Locate_Value
jsr ShowMeChess
jsr IncStep
jsr ShowStep
jsr Connecting
bbs7 <WinFlag,?7
;; jsr CheckEmpty
;; bbs0 <Emptyflag,xxxx
jsr ChoiceBestPosition
;; jsr IncStep
;; jsr ShowStep
lda <BestPositionX
sta <Cursor_X
sta <Locate_X
lda <BestPositionY
sta <Cursor_Y
sta <Locate_Y
smb0 <Locate_Value
jsr Set_Locate_Value
rmb5 <RefreshLcd
lda <Cursor_X
sec
sbc <DispCenterX
bcs ?2
lda <Cursor_X
sta <DispCenterX
smb5 <RefreshLcd
bra ?3
?2: cmp #8
bcc ?3
lda <Cursor_X
sbc #7
sta <DispCenterX
smb5 <RefreshLcd
?3: lda <Cursor_Y
sec
sbc <DispCenterY
bcs ?4
lda <Cursor_Y
sta <DispCenterY
smb5 <RefreshLcd
bra ?5
?4: ;;cmp #6
cmp #8 ;;zjw
bcc ?5
lda <Cursor_Y
sbc #7 ;;zjw
;;sbc #5
sta <DispCenterY
smb5 <RefreshLcd
?5: bbr5 <RefreshLcd,?6
jsr DrawFiBoard
?6: jsr ShowCpuChess
jsr connecting
lda <StepDig2
beq ?7
lda <StepDig1
cmp #28h
bcc ?7
smb0 <EquFlag
smb7 <WinFlag
rmb3 <StopFlash
bra ?71
?7 rmb3 <StopFlash
bbr7 <WinFlag,?72
bbs6 <WinFlag,?71
PlayMelody WinSong
bra ?72
?71: PlayMelody LostSong
?72:
?1:
;; jmp main
jmp jmp_LMAINU
ShowPreChess:
lda <Cursor_X
sta <Locate_X
lda <Cursor_Y
sta <Locate_Y
jsr Get_Locate_Value
bbs1 <Locate_Value,?showCross
bbs0 <Locate_Value,?ShowCpuchess
jsr ShowMeChess
rts
?ShowCpuChess:
jsr ShowCpuChess
rts
?ShowCross:
jsr ShowCross
rts
Connecting:
STZ <WinFlag
STZ <ContinueNum
LDA <Cursor_X
STA <Locate_X
LDA <Cursor_Y
STA <Locate_Y
JSR Get_Locate_Value
LDA <Locate_Value
AND #00000011B
STA <Judge_Flag
?1: DEC <Locate_X
BMI ?2
JSR Get_Locate_Value
LDA <Locate_Value
AND #00000011B
CMP <Judge_Flag
BNE ?2
INC <ContinueNum
BRA ?1
?2: LDA <Cursor_X
STA <Locate_X
?3: INC <Locate_X
BBS4 <Locate_X,?4
JSR Get_Locate_Value
LDA <Locate_Value
AND #00000011B
CMP <Judge_Flag
BNE ?4
INC <ContinueNum
BRA ?3
?4: LDA <ContinueNum
CMP #4
BCC ConnectV
?41: SMB0 <WinFlagH
ConnectV:
STZ <ContinueNum
LDA <Cursor_X
STA <Locate_X
?1: DEC <Locate_Y
BMI ?2
JSR Get_Locate_Value
LDA <Locate_Value
AND #00000011B
CMP <Judge_Flag
BNE ?2
INC <ContinueNum
BRA ?1
?2: LDA <Cursor_Y
STA <Locate_Y
?3: INC <Locate_Y
BBS4 <Locate_Y,?4
JSR Get_Locate_Value
LDA <Locate_Value
AND #00000011B
CMP <Judge_Flag
BNE ?4
INC <ContinueNum
BRA ?3
?4: LDA <ContinueNum
CMP #4
BCC ConnectSU
?41: SMB1 <WinFlagV
ConnectSU:
STZ <ContinueNum
LDA <Cursor_Y
STA <Locate_Y
?1: DEC <Locate_Y
BMI ?2
DEC <Locate_X
BMI ?2
JSR Get_Locate_Value
LDA <Locate_Value
AND #00000011B
CMP <Judge_Flag
BNE ?2
INC <ContinueNum
BRA ?1
?2: LDA <Cursor_Y
STA <Locate_Y
LDA <Cursor_X
STA <Locate_X
?3: INC <Locate_Y
BBS4 <Locate_Y,?4
INC <Locate_X
BBS4 <Locate_X,?4
JSR Get_Locate_Value
LDA <Locate_Value
AND #00000011B
CMP <Judge_Flag
BNE ?4
INC <ContinueNum
BRA ?3
?4: LDA <ContinueNum
CMP #4
BCC ConnectSD
?41: SMB2 <WinFlagSU
ConnectSD:
STZ <ContinueNum
LDA <Cursor_Y
STA <Locate_Y
LDA <Cursor_X
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -