mirror of
https://github.com/cc65/cc65.git
synced 2025-02-07 20:30:49 +00:00
Add irq handling, PAL/NTSC detection and clock()
This commit is contained in:
parent
220171d0da
commit
d6009721d4
@ -1,16 +1,17 @@
|
|||||||
.export _zonecounter
|
.export _zonecounter
|
||||||
|
.export _paldetected
|
||||||
.export __STARTUP__ : absolute = 1
|
.export __STARTUP__ : absolute = 1
|
||||||
.export _exit
|
.export _exit
|
||||||
.import __ROM_START__
|
.import __ROM_START__
|
||||||
.import __RAM3_START__, __RAM3_SIZE__
|
.import __RAM3_START__, __RAM3_SIZE__
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import zerobss, copydata
|
.import zerobss, copydata
|
||||||
|
.import IRQStub
|
||||||
.import push0, _main
|
.import push0, _main
|
||||||
|
.include "atari7800.inc"
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
|
||||||
INPTCTRL = $01
|
INPTCTRL = $01
|
||||||
OFFSET = $38
|
|
||||||
CTRL = $3c
|
|
||||||
|
|
||||||
.segment "STARTUP"
|
.segment "STARTUP"
|
||||||
start:
|
start:
|
||||||
@ -38,6 +39,29 @@ start:
|
|||||||
jsr zerobss
|
jsr zerobss
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
|
; Examine machine type as we need the info early
|
||||||
|
vboff: lda MSTAT
|
||||||
|
bmi vboff
|
||||||
|
vbon: lda MSTAT
|
||||||
|
bpl vbon
|
||||||
|
vboff2: lda MSTAT
|
||||||
|
bmi vboff2
|
||||||
|
lda #$00
|
||||||
|
sta _paldetected
|
||||||
|
jmp mtsta
|
||||||
|
count: sta WSYNC
|
||||||
|
sta WSYNC
|
||||||
|
dec _paldetected
|
||||||
|
mtsta: lda MSTAT
|
||||||
|
bpl count
|
||||||
|
lda _paldetected
|
||||||
|
cmp #$78
|
||||||
|
bcc mtntsc
|
||||||
|
lda #$01
|
||||||
|
jmp mtpal
|
||||||
|
mtntsc: lda #$00
|
||||||
|
mtpal: sta _paldetected
|
||||||
|
|
||||||
; Call main program (pass empty command line)
|
; Call main program (pass empty command line)
|
||||||
jsr push0 ; argc
|
jsr push0 ; argc
|
||||||
jsr push0 ; argv
|
jsr push0 ; argv
|
||||||
@ -50,7 +74,7 @@ _exit:
|
|||||||
|
|
||||||
NMIHandler:
|
NMIHandler:
|
||||||
inc _zonecounter
|
inc _zonecounter
|
||||||
rti
|
jmp IRQStub
|
||||||
|
|
||||||
IRQHandler:
|
IRQHandler:
|
||||||
rti
|
rti
|
||||||
@ -58,6 +82,9 @@ IRQHandler:
|
|||||||
.segment "DATA"
|
.segment "DATA"
|
||||||
_zonecounter:
|
_zonecounter:
|
||||||
.byte 0
|
.byte 0
|
||||||
|
_paldetected:
|
||||||
|
.byte 0 ; 0 = NTSC, 1 = PAL
|
||||||
|
|
||||||
|
|
||||||
.segment "ENCRYPTION"
|
.segment "ENCRYPTION"
|
||||||
.res 126, $ff ; Reserved for encryption
|
.res 126, $ff ; Reserved for encryption
|
||||||
|
Loading…
x
Reference in New Issue
Block a user