Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Installing Interupt Test 1
- .global InstallIntTable
- InstallIntTable:
- Push {r0-r12, lr}
- ldr r0, =IntTable
- mov r1, #0x00000000
- // load the first 8 words and store at the 0 address
- ldmia r0!, {r2-r9}
- stmia r1!, {r2-r9}
- // load the second 8 words and store at the next address
- ldmia r0!, {r2-r9}
- stmia r1!, {r2-r9}
- // switch to IRQ mode and set stack pointer
- mov r0, #0xD2
- msr cpsr_c, r0
- mov sp, #0x8000
- // switch back to Supervisor mode, set the stack pointer
- mov r0, #0xD3
- msr cpsr_c, r0
- mov sp, #0x8000000
- bx lr
- //This subroutine will count 30s until it call draw value pack which is the Value pack function
- .global IntFunc
- IntFunc:
- Push {r0-r12, lr}
- ldr r5, =0x3F003004 //Adress of CLO
- ldr r6, [r5] //ReadCLO
- // ldr r7, =0x2FAF080
- ldr r7, =0x1C9C380 //Time to let the Function Wait until to draw the value pack
- add r6, r7 // add the wait time to the system's current time
- ldr r8, =0x3F003010
- str r6, [r8] // time + delay
- ldr r5, =0x3F00B210 // loading stored value in address 0x3F000b210
- ldr r6, =0XA // mask
- str r6, [r5]
- ldr r0, =0x3F00B214
- mov r1, #0
- str r1, [r0]
- mrs r5, cpsr // abed uses r0, is it r0 or 5 check later chris
- bic r5, #0x80
- msr cpsr_c ,r5
- pop {r0-r12, lr}
- bx lr
- //this subroutine will determine when to trigger the draw value pack function
- .global Setting
- Setting:
- push {r0-r12, lr}
- ldr r0, =0x3F00B204 //load the address
- ldr r1, [r0] //load the address in r0 to r1
- ldr r3, =0x2 //load the address into r3
- tst r1, r3 //tst the two inputs (theortical and which leads to 00 as an output)
- beq Clearing
- // Check if the user is in the game map or not, if the user isn't in the game Map then we dont draw
- ldr r0, =enterTheGameCheck
- ldr r1, [r0]
- cmp r1, #1
- beq Clearing
- // Add a condition here later
- /*
- ldr r0, =mapTransitionCheck
- ldr r1, [r0]
- cmp r1, #1
- beq Clearing
- */
- // if the previouis conditions are all pass it will branch down to here automatically where it draws the value pack
- drawValuePack:
- push {lr}
- ldr r0, =IsItFirstTimeDraw
- ldr r1, [r0]
- cmp r1, #0
- beq firstTimeDraw
- // if the value pack already exist and the player hasn't used it in the past 30 seconds dont generate another value pack
- ldr r0, =valuePackExist
- ldr r0, [r0]
- cmp r0, #1
- beq secondTimeDraw
- /*
- //This is the value pack drawing locations and calling
- ldr r7, =mapNumber
- ldr r8, [r7]
- cmp r8, #1
- beq LoadFirstMap
- /*
- cmp r8, #2
- beq LoadSecondMap
- cmp r8, #3
- beq LoadThirdMap
- */
- /*
- LoadFirstMap:
- ldr r7, =screenOne
- bl RNG
- mov r4, r0
- cmp r4, #0
- beq DrawPipe1
- cmp r4, #1
- beq DrawPipe2
- DrawPipe1:
- bl drawMagikarp
- /*
- ldr r8, =0x8D
- ldr r9, =0xE0
- b drawValuePackContinue
- */
- /*
- DrawPipe2:
- ldr r8, =0x2C7
- ldr r9, =0xF4
- b drawValuePackContinue
- drawValuePackContinue:
- ldr r6, =ValuePack
- ldr r7, =32
- ldr r7, =32
- bl drawPictureLoop2
- ldr r0, =valuePackExist
- mov r1, #1
- str r1, [r0]
- */
- firstTimeDraw:
- ldr r0, =IsItFirstTimeDraw
- mov r1, #1
- str r1, [r0]
- pop {lr}
- // Checks for which screen you are on
- push {r4-r9, lr}
- ldr r0, =stackMemory
- ldr r1, [r0, #12]
- cmp r1, #1
- beq onScreenOne
- onScreenOne:
- ldr r7, =screenOne
- bl RNG
- mov r4, r0
- cmp r4, #0
- beq DrawPipe1
- cmp r4, #1
- beq DrawPipe2
- DrawPipe1:
- ldr r4, =0x8D
- ldr r5, =0xE0
- ldr r7, =0xAD
- ldr r8, =0x100
- mov r9, r4
- b drawValuePackContinue
- DrawPipe2:
- ldr r4, =0x2C7 //636
- ldr r5, =0xF4 // 244
- ldr r7, =0x29C
- ldr r8, =0x114
- mov r9, r4
- b drawValuePackContinue
- drawValuePackContinue:
- ldr r6, =ValuePack
- bl drawPictureLoop2
- ldr r0, =valuePackExist
- mov r1, #1
- str r1, [r0]
- pop {r4-r9, lr}
- secondTimeDraw:
- // Trigger the label to let program know that it is nto the first time the programing is running
- ldr r0, =IsItFirstTimeDraw
- mov r1, #2
- str r1, [r0]
- pop {lr}
- Clearing:
- /*
- ldr r5, =0x3F003000
- ldr r6, =0x2
- str r6, [r5]
- bl IntFunc
- */
- ldr r5, =0x3F003000
- ldr r4, [r5]
- ldr r6, =0x2
- orr r4, r6
- str r4, [r5]
- pop {r0-r12, lr}
- sub pc, lr, #4
- //this is the data section that intialize any system calls
- .section .data
- IntTable:
- ldr pc, reset_handler
- ldr pc, undefined_handler
- ldr pc, swi_handler
- ldr pc, prefetch_handler
- ldr pc, data_handler
- ldr pc, unused_handler
- ldr pc, irq_handler
- ldr pc, fiq_handler
- reset_handler: .word InstallIntTable
- undefined_handler: .word haltLoop$
- swi_handler: .word haltLoop$
- prefetch_handler: .word haltLoop$
- data_handler: .word haltLoop$
- unused_handler: .word haltLoop$
- irq_handler: .word Setting
- fiq_handler: .word haltLoop$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement