Videopac / Odyssey2 forum
July 25, 2017, 06:47:41 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Al lot of attachments from Nov 2011 till april 2012 are damaged. Please ask the original poster to re-upload if you need them.
 
   Home   arcade Help Login Register links videopac.nl  
Pages: [1]   Go Down
  Print  
Author Topic: Getting keystroke values into a variable  (Read 55 times)
Chris!
Give this man a Jopac!
******
Posts: 1071



WWW
« on: July 14, 2017, 12:49:18 AM »

So I have some code that looks like this:
Code:
        call    013dh
mov r7,a

mov a,r7
        xrl     a,#000h         ; "+" key
        jz     start_a

mov a,r7
        xrl     a,#001h         ; "+" key
        jz     start_a

xrl     a,#002h         ; "+" key
        jz     start_b

xrl     a,#003h         ; "+" key
        jz     start_c

        xrl     a,#004h         ; "+" key
        jz     start_d

add    a,#0fch         ; "+" key
        jc     start_c

jmp beginning_loop

start_a
mov r0,#puzzlenumber
mov @r0,#255
jmp start_2

start_b
mov r0,#puzzlenumber
mov @r0,#0
jmp start_2

start_c
mov r0,#puzzlenumber
mov @r0,#1
jmp start_2

start_d
mov r0,#puzzlenumber
mov @r0,#2
jmp start_2

Looking at the code, it looks like I could simplify this so that when the key is pressed, the key's value could be subtracted by two before it goes to the rest of the code (start_2). But the problem is, I don't know how. I've tried everything but to no avail. How would I do this?
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
Chris!
Give this man a Jopac!
******
Posts: 1071



WWW
« Reply #1 on: July 14, 2017, 03:38:53 AM »

I figured it out.
Code:
mov a,r7
mov r0,#puzzlenumber
add a,#0feh
mov @r0,a
jmp start_2
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!