aboutsummaryrefslogtreecommitdiff
path: root/src/loadchat.dasm
blob: c63ed41573d896d126f83df3ba7051ad05a2f322 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

; If no R: driver is loaded, load DEFAULT.SER
; Then, load FujiChat

; This is needed because e.g. Bob-verter loads at $5000, smack in the
; middle of FujiChat's code. This tiny little loader program should be
; small enough and out-of-the-way enough that nothing will stomp on it.

 processor 6502
 include "equates.inc"

atari_exec = $0600
main = $2E00 ; same place as cc65

; segment header
 org main-6
 word $FFFF
 word main
 word endmain-1

 org main

; search handler table for R entry
 ldx #0
tabloop:
 lda HATABS,x
 cmp #'R
 beq load_chat
 inx
 inx
 inx
 cpx #$24 ; 12 entries * 3 bytes = 36
 bne tabloop

; no R: driver found, load one
 lda #<driver_filename
 ldx #>driver_filename
 jsr atari_exec

; load main fujichat program (does not return)
; (in fact it better not return, it overwrites this program!)
load_chat:
 lda #<chat_filename
 ldx #>chat_filename
 jmp atari_exec

driver_filename .byte "D:DEFAULT.SER", 0
chat_filename .byte "D:FUJICHAT.COM", 0
endmain

; segment header
 word RUNAD
 word RUNAD+1
 word main