diff --git a/libsrc/atari7800/crt0.s b/libsrc/atari7800/crt0.s new file mode 100644 index 000000000..3d53abfa8 --- /dev/null +++ b/libsrc/atari7800/crt0.s @@ -0,0 +1,71 @@ + .export _zonecounter + .export __STARTUP__ : absolute = 1 + .export _exit + .import __ROM_START__ + .import __RAM3_START__, __RAM3_SIZE__ + .import initlib, donelib + .import zerobss, copydata + .import push0, _main + .include "zeropage.inc" + +INPTCTRL = $01 +OFFSET = $38 +CTRL = $3c + + .segment "STARTUP" +start: + ; Startup sequence recommended by Atari. + ; See the 7800 standards document. + sei ; Initialize 6502 + cld + lda #$07 ; Lock machine in 7800 mode + sta INPTCTRL + lda #$7f ; DMA off + sta CTRL + ldx #0 ; OFFSET must always be 0 + stx OFFSET + stx INPTCTRL ; Make sure joysticks don't freeze + dex ; Stack pointer = $ff + txs + + ; Set up parameter stack + lda #<(__RAM3_START__ + __RAM3_SIZE__) + sta sp + lda #>(__RAM3_START__ + __RAM3_SIZE__) + sta sp+1 + + jsr copydata + jsr zerobss + jsr initlib + + ; Call main program (pass empty command line) + jsr push0 ; argc + jsr push0 ; argv + ldy #4 ; Argument size + jsr _main + +_exit: + jsr donelib + jmp start + +NMIHandler: + inc _zonecounter + rti + +IRQHandler: + rti + + .segment "DATA" +_zonecounter: + .byte 0 + + .segment "ENCRYPTION" + .res 126, $ff ; Reserved for encryption +Lfff8: .byte $ff ; Region verification (always $ff) +Lfff9: .byte $f7 ; Use last 4096 bytes only for encryption +;;;Lfff9: .byte <(((__ROM_START__/4096)<<4) | 7) + + .segment "VECTORS" + .word NMIHandler + .word start + .word IRQHandler diff --git a/libsrc/atari7800/ctype.s b/libsrc/atari7800/ctype.s new file mode 100644 index 000000000..1301965eb --- /dev/null +++ b/libsrc/atari7800/ctype.s @@ -0,0 +1,5 @@ +; Character specification table. +; +; uses the "common" definition + + .include "ctype_common.inc"