mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-20 22:33:43 +02:00
WIP: more keyboard shenanigans
This commit is contained in:
+16
-2
@@ -525,8 +525,22 @@ weaponsOfDeath ; weapons used in tank death animations
|
||||
dta 1,2,3,7,17,18,19,20,21,22,23,24,25,26,27
|
||||
weaponsOfDeathEnd
|
||||
joyToKeyTable
|
||||
; .by 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15
|
||||
.by $ff,$ff,$ff,$ff,$ff,$ff,$ff,$07,$ff,$ff,$ff,$06,$ff,$0f,$0e,$ff
|
||||
.by $ff ;00
|
||||
.by $ff ;01
|
||||
.by $ff ;02
|
||||
.by $ff ;03
|
||||
.by $ff ;04
|
||||
.by $ff ;05
|
||||
.by $ff ;06
|
||||
.by @kbcode._right ;07
|
||||
.by $ff ;08
|
||||
.by $ff ;09
|
||||
.by $ff ;0a
|
||||
.by @kbcode._left ;0b
|
||||
.by $ff ;0c
|
||||
.by @kbcode._down ;0d
|
||||
.by @kbcode._up ;0e
|
||||
.by $ff ;0f
|
||||
|
||||
;-----------------------------------
|
||||
keycodes ;tables for converting KeyCode to Screen Code (38 -1 characters)
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@
|
||||
sta :1+1
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro randomize
|
||||
.macro randomizer
|
||||
;usage: randomize floor ceiling
|
||||
;returns (in A) a random .byte between "floor" and "ceiling"
|
||||
.if :2 < :1
|
||||
|
||||
@@ -249,3 +249,23 @@ scr32 = @dmactl(narrow|dma|players|missiles|lineX1)
|
||||
mode10 = %10000000
|
||||
mode11 = %11000000
|
||||
.ende
|
||||
/*
|
||||
; commented out to be replaced by the application specific A800 --> 5200 keypad translation
|
||||
.enum @kbcode
|
||||
_0
|
||||
_1
|
||||
_2
|
||||
_3
|
||||
_4
|
||||
_5
|
||||
_6
|
||||
_7
|
||||
_8
|
||||
_9
|
||||
_asterisk = $0a
|
||||
_hash = $0b
|
||||
_start = $0c
|
||||
_pause = $0d
|
||||
_reset = $0e
|
||||
.ende
|
||||
*/
|
||||
@@ -652,3 +652,71 @@ scr32 = @dmactl(narrow|dma|players|missiles|lineX1)
|
||||
mode10 = %10000000
|
||||
mode11 = %11000000
|
||||
.ende
|
||||
; ---------------------------------------------------------------------------
|
||||
; KBCODEs
|
||||
; ---------------------------------------------------------------------------
|
||||
.enum @kbcode
|
||||
_none = 255
|
||||
_esc = 28
|
||||
_1 = 31
|
||||
_2 = 30
|
||||
_3 = 26
|
||||
_4 = 24
|
||||
_5 = 29
|
||||
_6 = 27
|
||||
_7 = 51
|
||||
_8 = 53
|
||||
_9 = 48
|
||||
_0 = 50
|
||||
_lt = 54
|
||||
_gt = 55
|
||||
_del = 52
|
||||
_tab = 44
|
||||
_Q = 47
|
||||
_W = 46
|
||||
_E = 42
|
||||
_R = 40
|
||||
_T = 45
|
||||
_Y = 43
|
||||
_U = 11
|
||||
_I = 13
|
||||
_O = 8
|
||||
_P = 10
|
||||
_min = 14
|
||||
_up = 14 ; cursor function
|
||||
_eq = 15
|
||||
_down = 15 ; cursor function
|
||||
_ret = 12
|
||||
_A = 63
|
||||
_S = 62
|
||||
_D = 58
|
||||
_F = 56
|
||||
_G = 61
|
||||
_H = 57
|
||||
_J = 1
|
||||
_K = 5
|
||||
_L = 0
|
||||
_semicolon = 2
|
||||
_plus = 6
|
||||
_left = 6 ; cursor function
|
||||
_asterisk = 7
|
||||
_right = 7 ; cursor function
|
||||
_caps = 60
|
||||
_Z = 23
|
||||
_X = 22
|
||||
_C = 18
|
||||
_V = 16
|
||||
_B = 21
|
||||
_N = 36
|
||||
_M = 37
|
||||
_comma = 32
|
||||
_dot = 34
|
||||
_slash = 38
|
||||
_atari = 39
|
||||
_help = 17
|
||||
_F1 = 3
|
||||
_F2 = 4
|
||||
_F3 = 19
|
||||
_F4 = 20
|
||||
_space = 33
|
||||
.ende
|
||||
+1
-1
@@ -101,7 +101,7 @@
|
||||
sta :1+1
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro randomize
|
||||
.macro randomizer
|
||||
;usage: randomize floor ceiling
|
||||
;returns (in A) a random .byte between "floor" and "ceiling"
|
||||
.if :2 < :1
|
||||
|
||||
+93
-26
@@ -7,6 +7,8 @@
|
||||
|
||||
;---------------------------------------------------
|
||||
.def TARGET = 800 ;5200 ; or 800
|
||||
;atari800 -5200 -cart ${outputFilePath} -cart-type 4
|
||||
;atari800 -run ${outputFilePath}
|
||||
;---------------------------------------------------
|
||||
|
||||
OPT r+ ; saves 12 bytes :O
|
||||
@@ -133,6 +135,41 @@
|
||||
OPT h-f+
|
||||
icl 'lib/5200SYS.ASM'
|
||||
icl 'lib/5200MACRO.ASM'
|
||||
.enum @kbcode
|
||||
/*
|
||||
_0
|
||||
_1
|
||||
_2
|
||||
_3
|
||||
_4
|
||||
_5
|
||||
_6
|
||||
_7
|
||||
_8
|
||||
_9
|
||||
_asterisk = $0a
|
||||
_hash = $0b
|
||||
_start = $0c
|
||||
_pause = $0d
|
||||
_reset = $0e
|
||||
*/
|
||||
_space = $00
|
||||
_Y = $01
|
||||
_up = $02
|
||||
_O = $03
|
||||
_left = $04
|
||||
_tab = $05
|
||||
_right = $06
|
||||
_A = $07
|
||||
_down = $08
|
||||
_I = $09
|
||||
_esc = $0a
|
||||
_ret = $0b
|
||||
_M = $0d
|
||||
_S = $0e
|
||||
_del = $0e ; not used in 5200
|
||||
|
||||
.ende
|
||||
.ELSE
|
||||
icl 'lib/ATARISYS.ASM'
|
||||
icl 'lib/MACRO.ASM'
|
||||
@@ -577,7 +614,7 @@ RoboTanks
|
||||
jsr DisplayStatus ; to make visible AI selected defensive (and offensive :) )
|
||||
jsr MoveBarrelToNewPosition
|
||||
lda kbcode
|
||||
cmp #28 ; ESC
|
||||
cmp #@kbcode._esc ; 28 ; ESC
|
||||
bne @+
|
||||
jsr AreYouSure
|
||||
@ lda escFlag
|
||||
@@ -1556,7 +1593,7 @@ SetRandomWalls
|
||||
|
||||
lda kbcode
|
||||
and #$3f ;CTRL and SHIFT ellimination
|
||||
cmp #28 ; ESC
|
||||
cmp #@kbcode._esc ; 28 ; ESC
|
||||
bne getkeyend
|
||||
mvx #$80 escFlag
|
||||
bne getkeyend
|
||||
@@ -1577,7 +1614,7 @@ notpressedJoyGetKey
|
||||
;fire
|
||||
lda STRIG0
|
||||
bne @-
|
||||
lda #$0c ;Return key
|
||||
lda #@kbcode._ret ;Return key
|
||||
|
||||
getkeyend
|
||||
mvx #sfx_keyclick sfx_effect
|
||||
@@ -1638,13 +1675,12 @@ checkForHuman ; if all in skillTable other than 0 then switch to DEMO MODE
|
||||
;pause 150
|
||||
ldy #75
|
||||
jsr PauseYFrames
|
||||
jmp noKey
|
||||
rts
|
||||
|
||||
peopleAreHere
|
||||
jsr getkey
|
||||
noKey
|
||||
rts
|
||||
jmp getkey ; jsr:rts
|
||||
.endp
|
||||
|
||||
MakeDarkScreen
|
||||
mva #0 dmactls ; dark screen
|
||||
sta dmactl
|
||||
@@ -1652,13 +1688,12 @@ MakeDarkScreen
|
||||
.proc WaitOneFrame
|
||||
lda CONSOL
|
||||
and #%00000101 ; Start + Option
|
||||
bne @+
|
||||
mva #$40 escFlag
|
||||
@ and #%00000001 ; START KEY
|
||||
beq @+
|
||||
wait
|
||||
@ rts
|
||||
sne:mva #$40 escFlag
|
||||
and #%00000001 ; START KEY
|
||||
seq:wait
|
||||
rts
|
||||
.endp
|
||||
|
||||
.proc PauseYFrames
|
||||
; Y - number of frames to wait (divided by 2)
|
||||
; pauses for maximally 510 frames (255 * 2)
|
||||
@@ -1708,19 +1743,51 @@ noingame
|
||||
bne @-
|
||||
rts
|
||||
.endp
|
||||
;;--------------------------------------------------
|
||||
;.proc Randomizer
|
||||
;;--------------------------------------------------
|
||||
; ;usage: randomize floor ceiling
|
||||
; ;returns (in A) a random .byte between "floor" and "ceiling"
|
||||
;?rand
|
||||
; lda random
|
||||
; cmp #:1 ;floor
|
||||
; bcc ?rand
|
||||
; cmp #:2+1 ;ceiling
|
||||
; bcs ?rand
|
||||
; rts
|
||||
;.endp
|
||||
;--------------------------------------------------
|
||||
.macro randomize floor ceiling
|
||||
;--------------------------------------------------
|
||||
;usage: randomize floor ceiling
|
||||
;returns (in A) a random .byte between "floor" and "ceiling"
|
||||
jsr _randomizator
|
||||
.byte :floor
|
||||
.byte :ceiling
|
||||
.endm
|
||||
|
||||
.proc _randomizator
|
||||
; private function that accompanies `randomize` macro
|
||||
; trashes: magic, temp, Y
|
||||
pla
|
||||
sta magic
|
||||
pla
|
||||
sta magic+1
|
||||
ldy #1 ; add 1 to the value got from the stack to point to the input parameters
|
||||
lda (magic),y
|
||||
sta temp
|
||||
iny
|
||||
lda (magic),y
|
||||
sta temp+1
|
||||
|
||||
?rand
|
||||
lda random
|
||||
cmp temp ;floor
|
||||
bcc ?rand
|
||||
cmp temp+1 ;ceiling
|
||||
bcs ?rand
|
||||
tay ; save the result
|
||||
|
||||
; point the PC to a byte after the parameters
|
||||
clc
|
||||
lda magic
|
||||
adc #2 ; length of the parameters in bytes
|
||||
sta magic
|
||||
lda magic+1
|
||||
adc #0
|
||||
pha
|
||||
lda magic
|
||||
pha
|
||||
tya ; retrieve the result
|
||||
rts
|
||||
.endp
|
||||
;----------------------------------------------
|
||||
icl 'weapons.asm'
|
||||
;----------------------------------------------
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+24
-24
@@ -68,7 +68,7 @@ OptionsMainLoop
|
||||
bit escFlag
|
||||
spl:rts
|
||||
|
||||
cmp #$f ;cursor down
|
||||
cmp #@kbcode._down ; $f ;cursor down
|
||||
bne OptionsNoDown
|
||||
inc:lda OptionsY
|
||||
cmp #maxoptions
|
||||
@@ -77,7 +77,7 @@ OptionsMainLoop
|
||||
jmp OptionsMainLoop
|
||||
|
||||
OptionsNoDown
|
||||
cmp #$e ;cursor up
|
||||
cmp #@kbcode._up ; $e ;cursor up
|
||||
bne OptionsNoUp
|
||||
dec OptionsY
|
||||
bpl OptionsMainLoop
|
||||
@@ -85,7 +85,7 @@ OptionsNoDown
|
||||
jmp OptionsMainLoop
|
||||
|
||||
OptionsNoUp
|
||||
cmp #$6 ;cursor left
|
||||
cmp #@kbcode._left ; $6 ;cursor left
|
||||
bne OptionsNoLeft
|
||||
ldx OptionsY
|
||||
dec OptionsTable,X
|
||||
@@ -95,19 +95,19 @@ OptionsNoUp
|
||||
jmp OptionsMainLoop
|
||||
|
||||
OptionsNoLeft
|
||||
cmp #$7 ;cursor right
|
||||
cmp #@kbcode._right ; $7 ;cursor right
|
||||
bne OptionsNoRight
|
||||
|
||||
ldx OptionsY
|
||||
inc OptionsTable,X
|
||||
lda OptionsTable,X
|
||||
cmp #5
|
||||
cmp #5 ; number of columns in options
|
||||
bne OptionsMainLoop
|
||||
dec OptionsTable,X
|
||||
jmp OptionsMainLoop
|
||||
|
||||
OptionsNoRight
|
||||
cmp #$c ;Return key
|
||||
cmp #@kbcode._ret ; $c ;Return key
|
||||
bne OptionsNoReturn
|
||||
jmp OptionsFinished
|
||||
OptionsNoReturn
|
||||
@@ -398,19 +398,19 @@ ChoosingItemForPurchase
|
||||
jsr getkey
|
||||
bit escFlag
|
||||
spl:jmp WaitForKeyRelease ; like jsr ... : rts
|
||||
cmp #$2c ; Tab
|
||||
cmp #@kbcode._esc ; $2c ; Tab
|
||||
jeq ListChange
|
||||
cmp #$06 ; cursor left
|
||||
cmp #@kbcode._left ; $06 ; cursor left
|
||||
jeq ListChange
|
||||
cmp #$0c ; Return
|
||||
cmp #@kbcode._ret ; $0c ; Return
|
||||
sne:rts
|
||||
cmp #$e
|
||||
cmp #@kbcode._up ; $e
|
||||
beq PurchaseKeyUp
|
||||
cmp #$f
|
||||
cmp #@kbcode._down ; $f
|
||||
beq PurchaseKeyDown
|
||||
cmp #$21 ; Space
|
||||
cmp #@kbcode._space ; $21 ; Space
|
||||
jeq PurchaseWeaponNow
|
||||
cmp #$07 ; cursor right
|
||||
cmp #@kbcode._right ; $07 ; cursor right
|
||||
jeq PurchaseWeaponNow
|
||||
bne ChoosingItemForPurchase
|
||||
|
||||
@@ -1137,20 +1137,20 @@ YesLetter
|
||||
@ stx PositionInName ; if not, we store
|
||||
jmp CheckKeys
|
||||
CheckFurtherX01 ; here we check Tab, Return and Del
|
||||
cmp #$0c ; Return
|
||||
cmp #@kbcode._ret ; $0c ; Return
|
||||
jeq EndOfNick
|
||||
cmp #$2c ; Tab
|
||||
cmp #@kbcode._tab ; $2c ; Tab
|
||||
beq ChangeOfLevelUp
|
||||
cmp #$7 ;cursor right
|
||||
cmp #@kbcode._right ; $7 ;cursor right
|
||||
beq ChangeOfLevelUp
|
||||
cmp #$6 ;cursor left
|
||||
cmp #@kbcode._left ; $6 ;cursor left
|
||||
beq ChangeOfLevelDown
|
||||
cmp #$f ;cursor down
|
||||
cmp #@kbcode._down ; $f ;cursor down
|
||||
beq ChangeOfLevel3Up
|
||||
cmp #$e ;cursor up
|
||||
cmp #@kbcode._up ; $e ;cursor up
|
||||
beq ChangeOfLevel3Down
|
||||
|
||||
cmp #$34 ; Backspace (del)
|
||||
cmp #@kbcode._del ; $34 ; Backspace (del)
|
||||
bne CheckKeys
|
||||
; handling backing one char
|
||||
ldx PositionInName
|
||||
@@ -1334,7 +1334,7 @@ JoyNotCentered
|
||||
bne NoRight
|
||||
; joy right
|
||||
cpy #7
|
||||
beq GoToMainLoop ; jast character
|
||||
beq GoToMainLoop ; the last character
|
||||
iny
|
||||
bne GoToMainLoop
|
||||
NoRight
|
||||
@@ -1353,7 +1353,7 @@ NoLeft
|
||||
; joy up
|
||||
cpx #(keycodesEnd-keycodes-1)
|
||||
bne @+
|
||||
ldx #$00 ; set to first character index (loop)
|
||||
ldx #$00 ; set to the first character index (loop)
|
||||
beq CharAndMainLoop
|
||||
@ inx
|
||||
bne CharAndMainLoop
|
||||
@@ -1363,7 +1363,7 @@ NoUp
|
||||
; joy down
|
||||
dex
|
||||
bpl CharAndMainLoop
|
||||
ldx #(keycodesEnd-keycodes-1) ; set to last character index (loop)
|
||||
ldx #(keycodesEnd-keycodes-1) ; set to the last character index (loop)
|
||||
CharAndMainLoop
|
||||
lda scrcodes,x
|
||||
sta NameAdr,y
|
||||
@@ -1767,7 +1767,7 @@ EndOfTypeLine4x4
|
||||
|
||||
|
||||
jsr GetKey
|
||||
cmp #$2b ; "Y"
|
||||
cmp #@kbcode._Y ; $2b ; "Y"
|
||||
bne @+
|
||||
mva #$80 escFlag
|
||||
bne skip01
|
||||
|
||||
+20
-20
@@ -1126,7 +1126,7 @@ notpressed
|
||||
lda kbcode
|
||||
and #%10111111 ; SHIFT elimination
|
||||
|
||||
cmp #$08 ; O
|
||||
cmp #@kbcode._O ; $08 ; O
|
||||
bne @+
|
||||
jsr AreYouSure
|
||||
bit escFlag
|
||||
@@ -1136,7 +1136,7 @@ QuitToGameover
|
||||
mva #$40 escFlag
|
||||
rts
|
||||
@
|
||||
cmp #28 ; ESC
|
||||
cmp #@kbcode._esc ; 28 ; ESC
|
||||
bne @+
|
||||
jsr AreYouSure
|
||||
bit escFlag
|
||||
@@ -1144,7 +1144,7 @@ QuitToGameover
|
||||
;---esc pressed-quit game---
|
||||
rts
|
||||
@
|
||||
cmp #$3f ; A
|
||||
cmp #@kbcode._A ; $3f ; A
|
||||
bne @+
|
||||
callActivation
|
||||
; Hide all tanks - after inventory they may have other shapes
|
||||
@@ -1153,7 +1153,7 @@ callActivation
|
||||
jmp afterInventory
|
||||
|
||||
@
|
||||
cmp #$0d ; I
|
||||
cmp #@kbcode._I ; $0d ; I
|
||||
bne @+
|
||||
callInventory
|
||||
; Hide all tanks - after inventory they may have other shapes
|
||||
@@ -1172,30 +1172,30 @@ afterInventory
|
||||
jsr WaitForKeyRelease
|
||||
jmp BeforeFire
|
||||
@
|
||||
cmp #$8e
|
||||
cmp #$80|@kbcode._up
|
||||
jeq CTRLPressedUp
|
||||
cmp #$8f
|
||||
cmp #$80|@kbcode._down
|
||||
jeq CTRLPressedDown
|
||||
cmp #$ac
|
||||
cmp #$80|@kbcode._tab
|
||||
jeq CTRLPressedTAB
|
||||
|
||||
and #$3f ;CTRL and SHIFT ellimination
|
||||
jumpFromStick
|
||||
cmp #$e
|
||||
cmp #@kbcode._up ; $e
|
||||
jeq pressedUp
|
||||
cmp #$f
|
||||
cmp #@kbcode._down ; $f
|
||||
jeq pressedDown
|
||||
cmp #$6
|
||||
cmp #@kbcode._left ; $6
|
||||
jeq pressedLeft
|
||||
cmp #$7
|
||||
cmp #@kbcode._right ; $7
|
||||
jeq pressedRight
|
||||
cmp #$21
|
||||
cmp #@kbcode._space ; $21
|
||||
jeq pressedSpace
|
||||
cmp #$2c
|
||||
cmp #@kbcode._tab ; $2c
|
||||
jeq pressedTAB
|
||||
cmp #$25 ; M
|
||||
cmp #@kbcode._M ; $25 ; M
|
||||
jeq pressedM
|
||||
cmp #$3e ; S
|
||||
cmp #@kbcode._S ; $3e ; S
|
||||
jeq pressedS
|
||||
jmp notpressed
|
||||
checkJoy
|
||||
@@ -1516,7 +1516,7 @@ ShotUnderGround
|
||||
;xtraj=xtraj+vx - without Wind
|
||||
;vx=vx+Wind (Wind is a small fraction)
|
||||
;plot xtraj,ytraj - there is clearing in plot
|
||||
;goto begin
|
||||
;goto begin-
|
||||
|
||||
|
||||
|
||||
@@ -2548,7 +2548,7 @@ notpressed
|
||||
lda kbcode
|
||||
and #%00111111 ; CTRL and SHIFT elimination
|
||||
|
||||
cmp #28 ; ESC
|
||||
cmp #@kbcode._esc ; 28 ; ESC
|
||||
bne @+
|
||||
jsr AreYouSure
|
||||
bit escFlag
|
||||
@@ -2557,11 +2557,11 @@ notpressed
|
||||
rts
|
||||
@
|
||||
jumpFromStick
|
||||
cmp #$6
|
||||
cmp #@kbcode._left ; $6
|
||||
jeq pressedLeft
|
||||
cmp #$7
|
||||
cmp #@kbcode._right ; $7
|
||||
jeq pressedRight
|
||||
cmp #$21
|
||||
cmp #@kbcode._space ; $21
|
||||
jeq pressedSpace
|
||||
jmp notpressed
|
||||
checkJoy
|
||||
|
||||
Reference in New Issue
Block a user