/[projet1]/users/dbug/DungeonOSDK/TIMER.S
Defence Force logotype

Contents of /users/dbug/DungeonOSDK/TIMER.S

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1377 - (show annotations)
Thu Jul 28 18:17:03 2016 UTC (3 years, 9 months ago) by dbug
File size: 843 byte(s)
Trying to port the old Dungeon Demo to the OSDK.
Problems found so far:
- "a" after rotation instructions (rol a, asr a, etc... instead of just rol, asr, ...)
- "BYTE" and "WORD" instead of .byt and .word
- "RESERVE" instead of ".dsb"
and that's about it :D
1 ;
2 ;
3 ; Time/Synchronisation 6502 assembly library
4 ; (c) 1996 Micka¬Čl POINTIER (Dbug from NeXT)
5 ;
6 ; Time value is 16 bits coded, so the maximum value is:
7 ; 65536 100th of a second
8 ; 655 seconds
9 ; 10 minutes
10 ;
11
12
13 _FlagSync .byt 0
14
15
16 _TimeValueIrq .word 0
17
18
19
20
21 _Wait
22 ldy #0
23 lda (sp),y ; Lower part of time
24 tax
25
26 iny
27 lda (sp),y ; Upper part of time
28 tay
29
30 iny
31 inx
32
33 wait_loop
34 inc _FlagSync
35 wait_sync
36 lda _FlagSync
37 bne wait_sync
38 dex
39 bne wait_loop
40 dey
41 bne wait_loop
42
43 rts
44
45
46
47
48 _TimeIrqHandler
49 ldx #0
50 stx _FlagSync
51
52 clc
53 lda _TimeValueIrq
54 adc #1
55 sta _TimeValueIrq
56
57 lda _TimeValueIrq+1
58 adc #0
59 sta _TimeValueIrq+1
60 rts
61
62
63
64
65 _VSync
66 ldx #2
67 vsync_loop_2
68 lda #1
69 sta _FlagSync
70 vsync_loop_1
71 lda _FlagSync
72 bne vsync_loop_1
73 dex
74 bne vsync_loop_2
75 rts
76
77
78

  ViewVC Help
Powered by ViewVC 1.1.26