home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_24_1988_Transactor_Publishing.d64 / joyid.lads (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  2KB  |  53 lines

  1. 10 *= $033c
  2. 15 ;          joystick id routine
  3. 20 ;
  4. 25 .o
  5. 30 .d joyid.ml
  6. 35 ;
  7. 40 conreg = $dc0d;     control register
  8. 45 porta = $dc00;      joy port 2
  9. 50 portb = $dc01;      joy port 1
  10. 55 keyqueue = $00c6;      guess where...
  11. 60 keybuf = $0277;        ditto...
  12. 65 joynum = $03a0;     return value
  13. 70 ;
  14. 100 joyid lda #$00;    get started
  15. 110 sta joynum;        clear return val
  16. 120 sta keyqueue;      clear keybd buf
  17. 130 lda #$01;          set up variables
  18. 140 sta temp;             holds values
  19. 150 sta temp+1;           from checks
  20. 160 lda #$11;          kill keyboard in
  21. 170 sta conreg;           prep to read
  22. 180 lda #$ff;             joystick port
  23. 190 sta porta;            one
  24. 200 lda portb;         read joy one
  25. 210 sta temp;          save the result
  26. 220 lda porta;         read joy two
  27. 230 sta temp+1;        and save it
  28. 240 lda #$81;          turn on the
  29. 250 sta conreg;           keyboard
  30. 260 lda keybuf;        check keypress
  31. 270 cmp #$0d;             is return,
  32. 280 bne chkrega;       no return, (NULL) on
  33. 290 lda #$00;          return, load joy
  34. 300 sta joynum;           value with 0
  35. 310 beq return;           and exit
  36. 320 chkrega lda temp;  compare for fire
  37. 330 and #$10;             button
  38. 340 bne chkregb;       no, jump ahead
  39. 350 lda #$01;          load joy value
  40. 360 sta joynum;           with 1 and
  41. 370 bne return;           exit
  42. 380 chkregb lda temp+1;compare for fire
  43. 390 and #$10;             button
  44. 400 bne joyid;         no, start over
  45. 410 lda #$02;          load joy value
  46. 420 sta joynum;           with 2
  47. 430 return lda #$00;   ready to return
  48. 440 sta keyqueue;         clear queue
  49. 450 rts;               (NULL) on home
  50. 460 temp .byte 1 1;    variables
  51. 470 ;
  52. 480 .end joyid.lads
  53.