home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ANG-Pokey Magazine 18
/
ANG_Pokey_Magazine_18_1994_04_ANG_Software_nl_Side_B.atr
/
abra14.src
< prev
next >
Wrap
Text File
|
2023-02-26
|
3KB
|
196 lines
**************************************
*
* TWO TASKS RUNNING INDEPENDANTLY
*
* TWOTASK.SRC
*
* 22 FEB 93
*
* YEB HAVINGA
*
**************************************
*
* WATCH THE FOLLOWING:
* - $C0 IN NMIEN ONLY AFTER
* INITIALISATION.
* - THE TWO CONTEXT SWITCHES
*
**************************************
*
* 25 03 94 : THIS PROGRAM
* ILLUSTRATES A SIMPLE CONTEXT
* SWITCH. EVERYTHING WAS JUST
* A TRY-OUT AND THEREFORE THE
* WHOLE IS QUITE STATIC:
*
* - THERE ARE TWO CONTEXT SWITCHES,
* INSTEAD OF ONE
* - THE STACK IS NOT SAVED WITH
* THE CONTEXT SWITCH.
* - TASK 2 IS A SIMPLE COLOR THING
* AND TASK 1 IS THE CALLING PROGRAM
* - NMI'S ARE USED FOR INTERRUPT
* GENERATION
*
*
* THE FOLLOWING VARIABLES ARE
* USED TO SAVE REGISTERS AND
* STACKSHIT :
*
* T-A : accumulator
* T-X : X register
* T-Y : Y register
* T-P : statusregister
* T-PC : program counter
* ^
* - is 1 or 2
*
ORG $A800
*
* INITIALISATION :
* THE SCREEN FOR THE INTERRUPTS
LDA #0
STA 559
* !!! 130 XE+ USERS !!!
* NOTE THAT IF YOU WANT TO CONVERT
* THIS SOURCE TO THE 130XE+ ASSEMBLER,
* THE DL IS SOMEWHERE AT $28XX
LDA #$82
STA $BC30
LDA #$82
STA $BC31
* THE CONTEXT SWITCHER WHICH
* ACTIVATES TASK 2 AT THE NEXT
* INTERRUPT
LDA #TASK2:L
STA $200
LDA #TASK2:H
STA $201
* INITIALISATION OF TASK 2 :
* DATA FROM THE CALLING PROGRAM
* ARE PUT INTO T2**
LDA #0
STA T2A ; A
STA T2X ; X
STA T2Y ; Y
STA T2P ; status reg
PLA
CLC
ADC #1
STA T2PC ; PC lo
PLA
ADC #0
STA T2PC+1 ; PC hi
* WAIT FOR VERTICAL BLANK
* HE! WE'RE SITTING HERE WITH
* TWO DLI'S AND I WANT TO BE
* SURE THAT THE CALLING PROGRAM
* GETS THE FEW SCANLINES INSTEAD OF
* THE COLOR THING
LDA #$FF
STA 20
WAIT LDA 20
BNE WAIT
* AND GO WITH THAT BANANA
* WE START THE INTERRUPTS AND
* TASK 1, THE COLOR THING WILL
* CONTINUE QUITELY
LDA #$C0
STA $D40E
LDA #34
STA 559
JMP PROC1
*-----------------------------
* PROCESSING TASK 1,
* THE COLOR THING
PROC1 LDA $D20A
STA $D01A
JMP PROC1
*----------------------------
* CONTEXT SWITCH TO TASK 2,
* THE CALLING PROGRAM
* (for comment : 'TASK1')
TASK2 STA T1A
STY T1Y
STX T1X
PLA
STA T1P
PLA
STA T1PC
PLA
STA T1PC+1
LDA #TASK1:L
STA $200
LDA #TASK1:H
STA $201
LDA T2P
PHA
LDA T2A
LDY T2Y
LDX T2X
PLP
JMP (T2PC)
* ----------------------------
* CONTEXT SWITCH TO TASK 1
TASK1 STA T2A * SAVE INFO
STY T2Y * FROM PREVIOUS
STX T2X * TASK
PLA
STA T2P
PLA
STA T2PC
PLA
STA T2PC+1
LDA #TASK2:L * NEXT INT
STA $200 * TO BEGIN
LDA #TASK2:H * OTHER TASK
STA $201
LDA T1P * GET INFO
PHA * CURRENT TASK
LDA T1A
LDY T1Y
LDX T1X
PLP
JMP (T1PC) * AND CONTINUE..
* áשIJפחIJאכדצáקנáצIJשדáקIJציצקרההá
T1A DFB 0
T1Y DFB 0
T1X DFB 0
T1P DFB 0
T1PC DFW 0
T2A DFB 0
T2Y DFB 0
T2X DFB 0
T2P DFB 0
T2PC DFW 0
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯