Home » CEEFAX disks » telesoftware11.adl » 11-12-88/EVENT

11-12-88/EVENT

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware11.adl
Filename: 11-12-88/EVENT
Read OK:
File size: 0803 bytes
Load address: 0800
Exec address: 8023
File contents
   10REM> EVENT
   20DIM mcode &100 :REM: machine code at mcode
   30evntv=&220 :REM: event vector
   40drb=&FE60 :REM: data register B
   50ddrb=&FE62 :REM: data direction register B
   60osword=&FFF1
   70osbyte=&FFF4
   80FOR pass=0 TO 2 STEP 2
   90P%=mcode
  100[OPT pass
  110LDX evntv
  120LDY evntv+1
  130CPY #timeout DIV 256
  140BEQ disable \ branch if event vector altered
  150STX oldevntv \ store original event vector
  160STY oldevntv+1
  170LDX #timeout MOD 256
  180LDY #timeout DIV 256
  190STX evntv \ install new event vector
  200STY evntv+1
  210LDA #0 \ user port input
  220STA ddrb \ data direction register B
  230LDA #&0E \ enable events
  240LDX #&05 \ interval timer crossing zero
  250JSR osbyte
  260.writetimer
  270LDA #&04 \ write interval timer
  280LDX #clock MOD 256
  290LDY #clock DIV 256
  300JMP osword \ Osword and return
  310.disable
  320LDA #&0D \ disable events
  330LDX #&05 \ interval timer crossing zero
  340LDY #&00
  350JSR osbyte
  360LDX oldevntv \ restore event vector
  370LDY oldevntv+1
  380STX evntv
  390STY evntv+1
  400RTS \ return to BASIC
  410.timeout
  420PHP \ push status register
  430CMP #&05 \ is this interval timer crossing zero?
  440BEQ interval \ branch if it is
  450PLP \ restore status register
  460JMP (oldevntv) \ exit via original vector
  470.interval
  480PHA \ store A
  490TXA
  500PHA \ store X
  510TYA
  520PHA \ store Y
  530LDA drb \ data register B
  540ROL A \ bit 7 into carry
  550BCC right \ branch if right button pressed
  560ROL A \ bit 6 into carry
  570BCC centre \ branch if centre button pressed
  580ROL A \ bit 5 into carry
  590BCS pullout \ exit if left button not pressed
  600LDY leftkey \ left button pressed
  610BNE intobuffer
  620.centre
  630LDY centrekey
  640BNE intobuffer
  650.right
  660LDY rightkey
  670.intobuffer
  680LDA #&8A \ insert value into buffer
  690LDX #&00 \ keyboard buffer
  700JSR osbyte
  710.pullout
  720JSR writetimer \ reset timer
  730PLA
  740TAY \ restore Y
  750PLA
  760TAX \ restore X
  770PLA
  780PLP
  790RTS
  800.leftkey
  810EQUB ASC("L")
  820.centrekey
  830EQUB ASC("C")
  840.rightkey
  850EQUB ASC("R")
  860.oldevntv
  870EQUW &00
  880.clock
  890EQUD &FFFFFFE7
  900EQUB &FF
  910]
  920NEXT
  930CALL mcode

�> EVENT
*� mcode &100 :�: machine code at mcode
evntv=&220 :�: event vector
(!drb=&FE60 :�: data register B
2,ddrb=&FE62 :�: data direction register B
<osword=&FFF1
Fosbyte=&FFF4
P� pass=0 � 2 � 2
ZP%=mcode
d
[OPT pass
n
LDX evntv
xLDY evntv+1
�CPY #timeout � 256
�0BEQ disable \ branch if event vector altered
�.STX oldevntv \ store original event vector
�STY oldevntv+1
�LDX #timeout � 256
�LDY #timeout � 256
�(STX evntv \ install new event vector
�STY evntv+1
�LDA #0 \ user port input
�(STA ddrb \ data direction register B
�LDA #&0E \ enable events
�+LDX #&05 \ interval timer crossing zero
�JSR osbyte
.writetimer
#LDA #&04 \ write interval timer
LDX #clock � 256
"LDY #clock � 256
,"JMP osword \ Osword and return
6.disable
@LDA #&0D \ disable events
J+LDX #&05 \ interval timer crossing zero
TLDY #&00
^JSR osbyte
h'LDX oldevntv \ restore event vector
rLDY oldevntv+1
|
STX evntv
�STY evntv+1
�RTS \ return to BASIC
�.timeout
�PHP \ push status register
�4CMP #&05 \ is this interval timer crossing zero?
�"BEQ interval \ branch if it is
�!PLP \ restore status register
�-JMP (oldevntv) \ exit via original vector
�
.interval
�PHA \ store A
�TXA
�PHA \ store X
�TYA
PHA \ store Y
LDA drb \ data register B
ROL A \ bit 7 into carry
&.BCC right \ branch if right button pressed
0ROL A \ bit 6 into carry
:0BCC centre \ branch if centre button pressed
DROL A \ bit 5 into carry
N1BCS pullout \ exit if left button not pressed
X%LDY leftkey \ left button pressed
bBNE intobuffer
l.centre
vLDY centrekey
�BNE intobuffer
�
.right
�LDY rightkey
�.intobuffer
�'LDA #&8A \ insert value into buffer
�LDX #&00 \ keyboard buffer
�JSR osbyte
�.pullout
� JSR writetimer \ reset timer
�PLA
�TAY \ restore Y
�PLA
�TAX \ restore X
PLA
PLP
RTS
 .leftkey
*EQUB �("L")
4.centrekey
>EQUB �("C")
H
.rightkey
REQUB �("R")
\
.oldevntv
fEQUW &00
p
.clock
zEQUD &FFFFFFE7
�EQUB &FF
�]
��
�� mcode
�
00000000  0d 00 0a 0c f4 3e 20 45  56 45 4e 54 0d 00 14 2a  |.....> EVENT...*|
00000010  de 20 6d 63 6f 64 65 20  26 31 30 30 20 3a f4 3a  |. mcode &100 :.:|
00000020  20 6d 61 63 68 69 6e 65  20 63 6f 64 65 20 61 74  | machine code at|
00000030  20 6d 63 6f 64 65 0d 00  1e 1f 65 76 6e 74 76 3d  | mcode....evntv=|
00000040  26 32 32 30 20 3a f4 3a  20 65 76 65 6e 74 20 76  |&220 :.: event v|
00000050  65 63 74 6f 72 0d 00 28  21 64 72 62 3d 26 46 45  |ector..(!drb=&FE|
00000060  36 30 20 3a f4 3a 20 64  61 74 61 20 72 65 67 69  |60 :.: data regi|
00000070  73 74 65 72 20 42 0d 00  32 2c 64 64 72 62 3d 26  |ster B..2,ddrb=&|
00000080  46 45 36 32 20 3a f4 3a  20 64 61 74 61 20 64 69  |FE62 :.: data di|
00000090  72 65 63 74 69 6f 6e 20  72 65 67 69 73 74 65 72  |rection register|
000000a0  20 42 0d 00 3c 10 6f 73  77 6f 72 64 3d 26 46 46  | B..<.osword=&FF|
000000b0  46 31 0d 00 46 10 6f 73  62 79 74 65 3d 26 46 46  |F1..F.osbyte=&FF|
000000c0  46 34 0d 00 50 14 e3 20  70 61 73 73 3d 30 20 b8  |F4..P.. pass=0 .|
000000d0  20 32 20 88 20 32 0d 00  5a 0c 50 25 3d 6d 63 6f  | 2 . 2..Z.P%=mco|
000000e0  64 65 0d 00 64 0d 5b 4f  50 54 20 70 61 73 73 0d  |de..d.[OPT pass.|
000000f0  00 6e 0d 4c 44 58 20 65  76 6e 74 76 0d 00 78 0f  |.n.LDX evntv..x.|
00000100  4c 44 59 20 65 76 6e 74  76 2b 31 0d 00 82 16 43  |LDY evntv+1....C|
00000110  50 59 20 23 74 69 6d 65  6f 75 74 20 81 20 32 35  |PY #timeout . 25|
00000120  36 0d 00 8c 30 42 45 51  20 64 69 73 61 62 6c 65  |6...0BEQ disable|
00000130  20 5c 20 62 72 61 6e 63  68 20 69 66 20 65 76 65  | \ branch if eve|
00000140  6e 74 20 76 65 63 74 6f  72 20 61 6c 74 65 72 65  |nt vector altere|
00000150  64 0d 00 96 2e 53 54 58  20 6f 6c 64 65 76 6e 74  |d....STX oldevnt|
00000160  76 20 5c 20 73 74 6f 72  65 20 6f 72 69 67 69 6e  |v \ store origin|
00000170  61 6c 20 65 76 65 6e 74  20 76 65 63 74 6f 72 0d  |al event vector.|
00000180  00 a0 12 53 54 59 20 6f  6c 64 65 76 6e 74 76 2b  |...STY oldevntv+|
00000190  31 0d 00 aa 16 4c 44 58  20 23 74 69 6d 65 6f 75  |1....LDX #timeou|
000001a0  74 20 83 20 32 35 36 0d  00 b4 16 4c 44 59 20 23  |t . 256....LDY #|
000001b0  74 69 6d 65 6f 75 74 20  81 20 32 35 36 0d 00 be  |timeout . 256...|
000001c0  28 53 54 58 20 65 76 6e  74 76 20 5c 20 69 6e 73  |(STX evntv \ ins|
000001d0  74 61 6c 6c 20 6e 65 77  20 65 76 65 6e 74 20 76  |tall new event v|
000001e0  65 63 74 6f 72 0d 00 c8  0f 53 54 59 20 65 76 6e  |ector....STY evn|
000001f0  74 76 2b 31 0d 00 d2 1c  4c 44 41 20 23 30 20 5c  |tv+1....LDA #0 \|
00000200  20 75 73 65 72 20 70 6f  72 74 20 69 6e 70 75 74  | user port input|
00000210  0d 00 dc 28 53 54 41 20  64 64 72 62 20 5c 20 64  |...(STA ddrb \ d|
00000220  61 74 61 20 64 69 72 65  63 74 69 6f 6e 20 72 65  |ata direction re|
00000230  67 69 73 74 65 72 20 42  0d 00 e6 1c 4c 44 41 20  |gister B....LDA |
00000240  23 26 30 45 20 5c 20 65  6e 61 62 6c 65 20 65 76  |#&0E \ enable ev|
00000250  65 6e 74 73 0d 00 f0 2b  4c 44 58 20 23 26 30 35  |ents...+LDX #&05|
00000260  20 5c 20 69 6e 74 65 72  76 61 6c 20 74 69 6d 65  | \ interval time|
00000270  72 20 63 72 6f 73 73 69  6e 67 20 7a 65 72 6f 0d  |r crossing zero.|
00000280  00 fa 0e 4a 53 52 20 6f  73 62 79 74 65 0d 01 04  |...JSR osbyte...|
00000290  0f 2e 77 72 69 74 65 74  69 6d 65 72 0d 01 0e 23  |..writetimer...#|
000002a0  4c 44 41 20 23 26 30 34  20 5c 20 77 72 69 74 65  |LDA #&04 \ write|
000002b0  20 69 6e 74 65 72 76 61  6c 20 74 69 6d 65 72 0d  | interval timer.|
000002c0  01 18 14 4c 44 58 20 23  63 6c 6f 63 6b 20 83 20  |...LDX #clock . |
000002d0  32 35 36 0d 01 22 14 4c  44 59 20 23 63 6c 6f 63  |256..".LDY #cloc|
000002e0  6b 20 81 20 32 35 36 0d  01 2c 22 4a 4d 50 20 6f  |k . 256..,"JMP o|
000002f0  73 77 6f 72 64 20 5c 20  4f 73 77 6f 72 64 20 61  |sword \ Osword a|
00000300  6e 64 20 72 65 74 75 72  6e 0d 01 36 0c 2e 64 69  |nd return..6..di|
00000310  73 61 62 6c 65 0d 01 40  1d 4c 44 41 20 23 26 30  |sable..@.LDA #&0|
00000320  44 20 5c 20 64 69 73 61  62 6c 65 20 65 76 65 6e  |D \ disable even|
00000330  74 73 0d 01 4a 2b 4c 44  58 20 23 26 30 35 20 5c  |ts..J+LDX #&05 \|
00000340  20 69 6e 74 65 72 76 61  6c 20 74 69 6d 65 72 20  | interval timer |
00000350  63 72 6f 73 73 69 6e 67  20 7a 65 72 6f 0d 01 54  |crossing zero..T|
00000360  0c 4c 44 59 20 23 26 30  30 0d 01 5e 0e 4a 53 52  |.LDY #&00..^.JSR|
00000370  20 6f 73 62 79 74 65 0d  01 68 27 4c 44 58 20 6f  | osbyte..h'LDX o|
00000380  6c 64 65 76 6e 74 76 20  5c 20 72 65 73 74 6f 72  |ldevntv \ restor|
00000390  65 20 65 76 65 6e 74 20  76 65 63 74 6f 72 0d 01  |e event vector..|
000003a0  72 12 4c 44 59 20 6f 6c  64 65 76 6e 74 76 2b 31  |r.LDY oldevntv+1|
000003b0  0d 01 7c 0d 53 54 58 20  65 76 6e 74 76 0d 01 86  |..|.STX evntv...|
000003c0  0f 53 54 59 20 65 76 6e  74 76 2b 31 0d 01 90 19  |.STY evntv+1....|
000003d0  52 54 53 20 5c 20 72 65  74 75 72 6e 20 74 6f 20  |RTS \ return to |
000003e0  42 41 53 49 43 0d 01 9a  0c 2e 74 69 6d 65 6f 75  |BASIC.....timeou|
000003f0  74 0d 01 a4 1e 50 48 50  20 5c 20 70 75 73 68 20  |t....PHP \ push |
00000400  73 74 61 74 75 73 20 72  65 67 69 73 74 65 72 0d  |status register.|
00000410  01 ae 34 43 4d 50 20 23  26 30 35 20 5c 20 69 73  |..4CMP #&05 \ is|
00000420  20 74 68 69 73 20 69 6e  74 65 72 76 61 6c 20 74  | this interval t|
00000430  69 6d 65 72 20 63 72 6f  73 73 69 6e 67 20 7a 65  |imer crossing ze|
00000440  72 6f 3f 0d 01 b8 22 42  45 51 20 69 6e 74 65 72  |ro?..."BEQ inter|
00000450  76 61 6c 20 5c 20 62 72  61 6e 63 68 20 69 66 20  |val \ branch if |
00000460  69 74 20 69 73 0d 01 c2  21 50 4c 50 20 5c 20 72  |it is...!PLP \ r|
00000470  65 73 74 6f 72 65 20 73  74 61 74 75 73 20 72 65  |estore status re|
00000480  67 69 73 74 65 72 0d 01  cc 2d 4a 4d 50 20 28 6f  |gister...-JMP (o|
00000490  6c 64 65 76 6e 74 76 29  20 5c 20 65 78 69 74 20  |ldevntv) \ exit |
000004a0  76 69 61 20 6f 72 69 67  69 6e 61 6c 20 76 65 63  |via original vec|
000004b0  74 6f 72 0d 01 d6 0d 2e  69 6e 74 65 72 76 61 6c  |tor.....interval|
000004c0  0d 01 e0 11 50 48 41 20  5c 20 73 74 6f 72 65 20  |....PHA \ store |
000004d0  41 0d 01 ea 07 54 58 41  0d 01 f4 11 50 48 41 20  |A....TXA....PHA |
000004e0  5c 20 73 74 6f 72 65 20  58 0d 01 fe 07 54 59 41  |\ store X....TYA|
000004f0  0d 02 08 11 50 48 41 20  5c 20 73 74 6f 72 65 20  |....PHA \ store |
00000500  59 0d 02 12 1d 4c 44 41  20 64 72 62 20 5c 20 64  |Y....LDA drb \ d|
00000510  61 74 61 20 72 65 67 69  73 74 65 72 20 42 0d 02  |ata register B..|
00000520  1c 1c 52 4f 4c 20 41 20  5c 20 62 69 74 20 37 20  |..ROL A \ bit 7 |
00000530  69 6e 74 6f 20 63 61 72  72 79 0d 02 26 2e 42 43  |into carry..&.BC|
00000540  43 20 72 69 67 68 74 20  5c 20 62 72 61 6e 63 68  |C right \ branch|
00000550  20 69 66 20 72 69 67 68  74 20 62 75 74 74 6f 6e  | if right button|
00000560  20 70 72 65 73 73 65 64  0d 02 30 1c 52 4f 4c 20  | pressed..0.ROL |
00000570  41 20 5c 20 62 69 74 20  36 20 69 6e 74 6f 20 63  |A \ bit 6 into c|
00000580  61 72 72 79 0d 02 3a 30  42 43 43 20 63 65 6e 74  |arry..:0BCC cent|
00000590  72 65 20 5c 20 62 72 61  6e 63 68 20 69 66 20 63  |re \ branch if c|
000005a0  65 6e 74 72 65 20 62 75  74 74 6f 6e 20 70 72 65  |entre button pre|
000005b0  73 73 65 64 0d 02 44 1c  52 4f 4c 20 41 20 5c 20  |ssed..D.ROL A \ |
000005c0  62 69 74 20 35 20 69 6e  74 6f 20 63 61 72 72 79  |bit 5 into carry|
000005d0  0d 02 4e 31 42 43 53 20  70 75 6c 6c 6f 75 74 20  |..N1BCS pullout |
000005e0  5c 20 65 78 69 74 20 69  66 20 6c 65 66 74 20 62  |\ exit if left b|
000005f0  75 74 74 6f 6e 20 6e 6f  74 20 70 72 65 73 73 65  |utton not presse|
00000600  64 0d 02 58 25 4c 44 59  20 6c 65 66 74 6b 65 79  |d..X%LDY leftkey|
00000610  20 5c 20 6c 65 66 74 20  62 75 74 74 6f 6e 20 70  | \ left button p|
00000620  72 65 73 73 65 64 0d 02  62 12 42 4e 45 20 69 6e  |ressed..b.BNE in|
00000630  74 6f 62 75 66 66 65 72  0d 02 6c 0b 2e 63 65 6e  |tobuffer..l..cen|
00000640  74 72 65 0d 02 76 11 4c  44 59 20 63 65 6e 74 72  |tre..v.LDY centr|
00000650  65 6b 65 79 0d 02 80 12  42 4e 45 20 69 6e 74 6f  |ekey....BNE into|
00000660  62 75 66 66 65 72 0d 02  8a 0a 2e 72 69 67 68 74  |buffer.....right|
00000670  0d 02 94 10 4c 44 59 20  72 69 67 68 74 6b 65 79  |....LDY rightkey|
00000680  0d 02 9e 0f 2e 69 6e 74  6f 62 75 66 66 65 72 0d  |.....intobuffer.|
00000690  02 a8 27 4c 44 41 20 23  26 38 41 20 5c 20 69 6e  |..'LDA #&8A \ in|
000006a0  73 65 72 74 20 76 61 6c  75 65 20 69 6e 74 6f 20  |sert value into |
000006b0  62 75 66 66 65 72 0d 02  b2 1e 4c 44 58 20 23 26  |buffer....LDX #&|
000006c0  30 30 20 5c 20 6b 65 79  62 6f 61 72 64 20 62 75  |00 \ keyboard bu|
000006d0  66 66 65 72 0d 02 bc 0e  4a 53 52 20 6f 73 62 79  |ffer....JSR osby|
000006e0  74 65 0d 02 c6 0c 2e 70  75 6c 6c 6f 75 74 0d 02  |te.....pullout..|
000006f0  d0 20 4a 53 52 20 77 72  69 74 65 74 69 6d 65 72  |. JSR writetimer|
00000700  20 5c 20 72 65 73 65 74  20 74 69 6d 65 72 0d 02  | \ reset timer..|
00000710  da 07 50 4c 41 0d 02 e4  13 54 41 59 20 5c 20 72  |..PLA....TAY \ r|
00000720  65 73 74 6f 72 65 20 59  0d 02 ee 07 50 4c 41 0d  |estore Y....PLA.|
00000730  02 f8 13 54 41 58 20 5c  20 72 65 73 74 6f 72 65  |...TAX \ restore|
00000740  20 58 0d 03 02 07 50 4c  41 0d 03 0c 07 50 4c 50  | X....PLA....PLP|
00000750  0d 03 16 07 52 54 53 0d  03 20 0c 2e 6c 65 66 74  |....RTS.. ..left|
00000760  6b 65 79 0d 03 2a 0f 45  51 55 42 20 97 28 22 4c  |key..*.EQUB .("L|
00000770  22 29 0d 03 34 0e 2e 63  65 6e 74 72 65 6b 65 79  |")..4..centrekey|
00000780  0d 03 3e 0f 45 51 55 42  20 97 28 22 43 22 29 0d  |..>.EQUB .("C").|
00000790  03 48 0d 2e 72 69 67 68  74 6b 65 79 0d 03 52 0f  |.H..rightkey..R.|
000007a0  45 51 55 42 20 97 28 22  52 22 29 0d 03 5c 0d 2e  |EQUB .("R")..\..|
000007b0  6f 6c 64 65 76 6e 74 76  0d 03 66 0c 45 51 55 57  |oldevntv..f.EQUW|
000007c0  20 26 30 30 0d 03 70 0a  2e 63 6c 6f 63 6b 0d 03  | &00..p..clock..|
000007d0  7a 12 45 51 55 44 20 26  46 46 46 46 46 46 45 37  |z.EQUD &FFFFFFE7|
000007e0  0d 03 84 0c 45 51 55 42  20 26 46 46 0d 03 8e 05  |....EQUB &FF....|
000007f0  5d 0d 03 98 05 ed 0d 03  a2 0b d6 20 6d 63 6f 64  |].......... mcod|
00000800  65 0d ff                                          |e..|
00000803
11-12-88/EVENT.m0
11-12-88/EVENT.m1
11-12-88/EVENT.m2
11-12-88/EVENT.m4
11-12-88/EVENT.m5