📄 els.asm
字号:
lda #<ds0bank
sta <drr
lda #>ds0bank
sta <DrrH
ldx #00h
lopTagInit:
stz Tag,x
lda #255
sta TagBack,x
inx
cpx #170
bne lopTagInit ;; Tag(1-150)=0
;;*******************************
;; 随机建立方块类型:BigType
;;********************************
lda #<ds0bank
sta <drr
lda #>ds0bank
sta <DrrH
ldx <sec
lda RandTypeTable,x
sta <BigType
lda RandTypeTable+1,x
sta <Pre
lda #1h ;; BigType=(1-7)
sta <SmallType ;; SmallType=1
stz <Debug
jsr ljsr
dw elsasm_bank
dw Disp_Pre-1 ; unmask it later!
RTS
Sub_BigDown:
jsr Sub_Big ;;定位
jsr Sub_BackFF
jsr Sub_Tag0 ;;置相应标志 Tag=0
lda <position4
cmp #150
bcc ?GoDown
jsr Sub_Big
jsr Sub_Tag1
jsr Sub_BackFF
lda #1
sta <InitTypeEnable
stz <KeyEnable
ldx #01h
lsettimer
jmp ?sodfulajf
rts
?GoDown:
inc <Row
jsr Sub_Big
ldx <position1
lda Tag,x
ldx <position2
ora Tag,x
ldx <position3
ora Tag,x
ldx <position4
ora Tag,x
cmp #0
bne ?DownUnEnable
dec <Row
jsr Sub_Big
jsr Sub_Back0F
inc <Row
jsr Sub_Big
jsr Sub_Tag1
jsr Sub_BackFF
Rts
?DownUnEnable:
dec <Row
jsr Sub_Big
jsr Sub_Tag1
jsr Sub_BackFF
lda #1
sta <InitTypeEnable
stz <KeyEnable
;;********************************************8
?sodfulajf:
jsr Sub_Kill
ldx #4
lda Tag,x
ldx #5
ora Tag,x
ldx #6
ora Tag,x
cmp #1
bne ?NotEnd
lsetscreen_to_ds0 0
;; lda #<ds0bank
;; sta <drr
;; lda #>ds0bank
;; sta <DrrH
lda #42
sta <ox
lda #32
sta <oy
ldrawtext els_endimage
lda #1
sta <EndGameFlag
stz <TimerEnable
jmp jmplmainu
?NotEnd:
stz <InitTypeEnable ;; InitTypeEnable=0
lda #1
sta <Row ;; Row=14
lda #5h
sta <Col ;; Col=5
lda #1h
sta <KeyEnable ;; KeyEnable=1
lda <Pre
sta <BigType
jsr clear_pre
ldx <sec
lda #<ds0bank
sta <drr
lda #>ds0bank
sta <DrrH
lda RandTypeTable,x
sta <Pre
lda #1
sta <SmallType;;
jsr ljsr
dw elsasm_bank
dw Disp_Pre-1
ldx #01h
lsettimer
Rts
Sub_Tag0:
ldx <position1
stz Tag,x
stz TagBack,x
ldx <position2
stz Tag,x
stz TagBack,x
ldx <position3
stz Tag,x
stz TagBack,x
ldx <position4
stz Tag,x
stz TagBack,x
Rts
Sub_Tag1:
lda #1h
ldx <position1
sta Tag,x
sta TagBack,x
ldx <position2
sta Tag,x
sta TagBack,x
ldx <position3
sta Tag,x
sta TagBack,x
ldx <position4
sta Tag,x
sta TagBack,x
Rts
Sub_Back0F_Ok:
lopBack0F:
sec
sbc #10
inx
bcs lopBack0F
adc #10
inc
sta <ox
asl
asl
adc <ox
adc #4+50
sta <ox
txa
sta <oy
asl
asl
adc <oy
sta <oy
loclrimage BasicImage
rts
Sub_Back0F:
ldx #0ffh
lda <position1
jsr Sub_Back0F_Ok
ldx #0ffh
lda <position2
jsr Sub_Back0F_Ok
ldx #0ffh
lda <position3
jsr Sub_Back0F_Ok
ldx #0ffh
lda <position4
jsr Sub_Back0F_Ok
Rts
Sub_BackFF_Ok:
lopBackFF:
sec
sbc #10
inx
bcs lopBackFF
adc #10
inc
sta <ox
asl
asl
adc <ox
adc #4+50
sta <ox
txa
sta <oy
asl
asl
adc <oy
sta <oy
LoPrintimage BasicImage
rts
Sub_BackFF:
ldx #0ffh
lda <position1
jsr Sub_BackFF_Ok
ldx #0ffh
lda <position2
jsr Sub_BackFF_Ok
ldx #0ffh
lda <position3
jsr Sub_BackFF_Ok
ldx #0ffh
lda <position4
jsr Sub_BackFF_Ok
Rts
Sub_BigLeft:
jsr Sub_Big
jsr Sub_Tag0
lda <position1
loopmod1:
sec
sbc #10
bcs loopmod1
adc #10
cmp #0
bne ?IsZero1
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZero1:
lda <position2
loopmod2:
sec
sbc #10
bcs loopmod2
adc #10
cmp #0
bne ?IsZero2
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZero2:
lda <position3
loopmod3:
sec
sbc #10
bcs loopmod3
adc #10
cmp #0
bne ?IsZero3
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZero3:
lda <position4
loopmod4:
sec
sbc #10
bcs loopmod4
adc #10
cmp #0
bne ?IsZero4
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZero4:
dec <Col
jsr Sub_Big
ldx <position1
lda Tag,x
ldx <position2
ora Tag,x
ldx <position3
ora Tag,x
ldx <position4
ora Tag,x
cmp #0
bne ?LeftUnEnable
inc <Col
jsr Sub_Big
jsr sub_Back0F
dec <Col
jsr Sub_Big
jsr Sub_Tag1
jsr Sub_BackFF
Rts
?LeftUnEnable:
inc <Col
jsr Sub_Big
jsr sub_Tag1
Rts
Sub_BigRight:
jsr Sub_Big
jsr Sub_Tag0
lda <position1
loopmodr1:
sec
sbc #10
bcs loopmodr1
adc #10
cmp #9
bne ?IsZeror1
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZeror1:
lda <position2
loopmodr2:
sec
sbc #10
bcs loopmodr2
adc #10
cmp #9
bne ?IsZeror2
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZeror2:
lda <position3
loopmodr3:
sec
sbc #10
bcs loopmodr3
adc #10
cmp #9
bne ?IsZeror3
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZeror3:
lda <position4
loopmodr4:
sec
sbc #10
bcs loopmodr4
adc #10
cmp #9
bne ?IsZeror4
jsr Sub_Big
jsr Sub_Tag1
Rts
?IsZeror4:
inc <Col
jsr Sub_Big
ldx <position1
lda Tag,x
ldx <position2
ora Tag,x
ldx <position3
ora Tag,x
ldx <position4
ora Tag,x
cmp #0
bne ?RightUnEnable
dec <Col
jsr Sub_Big
jsr sub_Back0F
inc <Col
jsr Sub_Big
jsr Sub_Tag1
jsr Sub_BackFF
Rts
?RightUnEnable:
dec <Col
jsr Sub_Big
jsr sub_Tag1
Rts
Sub_BigChange:
jsr Sub_Big
jsr Sub_Tag0
lda <CenterPos
cmp #150
bcc ?GoChange
Rts
?GoChange:
?loopmodC1:
sec
sbc #10
bcs ?loopmodC1
adc #10
cmp #0
bne ?NotEquOne
jsr Sub_Big
jsr Sub_Tag1
Rts
?NotEquOne:
cmp #9
bne ?NotEquNine
jsr Sub_Big
jsr Sub_Tag1
Rts
?NotEquNine:
lda <BigType
cmp #7
bne ?NotEquseven
lda <SmallType
cmp #1
bne ?NotChangeOne
?Equ31:
lda <Col
cmp #8
bcs ?NotChseven
jmp ?NotEquseven
?NotChseven:
jsr Sub_Big
jsr Sub_Tag1
Rts
?NotChangeOne:
cmp #2
bne ?NotchTwo
?NotChThree:
lda <Row
;;cmp #3
;;bcs ?zjw2
cmp #14
bcc ?zjw2
rts
?NotchTwo:
cmp #3
bne ?NotChThree
jmp ?Equ31
?zjw2:
?NotEquseven:
inc <SmallType
lda <SmallType
cmp #5
bne ?NotEquFive
lda #1
sta <SmallType
?NotEquFive:
jsr Sub_Big
ldx <position1
lda Tag,x
ldx <position2
ora Tag,x
ldx <position3
ora Tag,x
ldx <position4
ora Tag,x
cmp #0
bne ?ChangeUnEnable
dec <SmallType
lda <SmallType
cmp #0
bne ?NotEquZero
lda #4
sta <SmallType
?NotEquZero:
jsr Sub_Big
jsr Sub_Back0F
inc <SmallType
lda <SmallType
cmp #5
bne ?NotEquFive2
lda #1
sta <SmallType
?NotEquFive2:
jsr Sub_Big
jsr Sub_Tag1
jsr Sub_BackFF
Rts
?ChangeUnEnable:
dec <SmallType
lda <SmallType
cmp #0
bne ?NotEquZero2
lda #4
sta <SmallType
?NotEquZero2:
jsr Sub_Big
jsr Sub_Tag1
rts
Sub_Kill:
stz <ScoreFlag
?KillAgain:
lda #16
sta <DelRow
?loop14:
jsr Sub_KillFlag
lda <KillFlag
cmp #1
beq ?GoKill
dec <DelRow
lda <DelRow
cmp #1
bne ?loop14
jsr ljsr
dw elsasm_bank
dw Sub_Score-1
Rts
?GoKill:
inc <ScoreFlag
stz <KillFlag
jsr Sub_ClrOldRow
jsr Sub_PrintNewTag
jsr ljsr
dw elsasm_bank
dw Sub_PrintNewImage-1
jmp ?KillAgain
Sub_KillFlag:
stz <DelCol
lda <DelRow
dec
asl
sta <BRow
asl
asl
adc <BRow
adc <DelCol
tax
lda Tag,x
?Not10:
inx
and Tag,x
sta <KillFlag
ldy <DelCol
iny
sty <DelCol
cpy #9
bne ?Not10
Rts
Sub_ClrOldRow:
stz <DelCol
lda <DelRow
dec
asl
sta <BRow
asl
asl
adc <BRow
adc <DelCol
tax
?SetTag0:
stz Tag,x
inx
lda <DelCol
inc
sta <DelCol
cmp #10
bne ?SetTag0
lda #10
;;sta <oy
;;lda <DelRow
;;dec
;;asl
;;sta <ox
;;asl
;;adc <ox
;;sta <ox
;;ljclrimage ClrRowImage
rts
Sub_PrintNewTag:
lda <DelRow
sta <BRow
?Print16:
ldy #0
lda <BRow
cmp #1
bne ?loop16
rts
?loop16:
lda <BRow
dec
dec
asl
sta <Debug
asl
asl
adc <Debug
tax
dex
?PrintNew:
inx
lda Tag,x
sta Tag+10,x
iny
cpy #10
bne ?PrintNew
dec <BRow
jmp ?Print16
rts
clear_pre:
lda #60+1+3-30
sta <ox
lda #53
sta <oy
loclrimage clear_image_block
rts
count_timer_value:
lda <which_game
asl
asl
sta <elsspeed
asl
asl
adc <elsspeed
sta <elsspeed
lda #200
sbc <elsspeed
tax
lsettimer
rts
Sub_Big:
jsr ljsr
dw elsasm_bank
dw Sub_Big_in_elsasm-1
rts
delay_time:
ldx #00h
?2:
lda #00h
?1:
inc
bne ?1
inx
bne ?2
rts
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -