-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstartup.asm
89 lines (78 loc) · 1.43 KB
/
startup.asm
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
device zxspectrum128
; Memory layout:
; 0000-3FFF - ROM (16Kb)
; 4000-5AFF - Screen (6912 bytes)
; 5B00-82FF - Heap
; 8300-BBFF - Program code and data
; BC00-BDFF - Stack (512 bytes)
; BE00-BEFF - Interrupt vector table (257
; bytes)
; BF01-BFBE - Unused
; BFBF-BFD2 - ISR
; BFD3-BFFF - Unused
; C000-FFFF - Paging area (16Kb)
org 8300h
_start
STACK EQU 0BE00H
IVT EQU 0BE00H
; Data to fill into IVT. Determines
; interrupt vector location
IVTDAT EQU 0BFH
DI
IM 2
LD SP,STACK
LD A,10H
LD BC,07FFDH
OUT (C),A
LD HL,IVT
LD DE,IVT+1
LD (HL),IVTDAT
LD BC,0100H
LDIR ;Fill the IVT
LD HL,ISRLOC
LD DE,ISR
LD BC,ISREND-ISR
LDIR ;Transfer the ISR to its location
LD A,#BE ;(IVT+1) ;high byte
LD I,A
EI
LD HL,5B00H ;init memory manager
LD BC,2800H
CALL dmm.IDMM
CALL main.PROG
; After the program quits, it returns here.
; Perform a reset into the TR-DOS
LD HL,0
PUSH HL
JP 3D2FH
ISRLOC PHASE IVTDAT*256+IVTDAT
ISR PUSH AF
PUSH BC
PUSH DE
PUSH HL
PUSH IX
CALL spkeyb.INTKEY
CALL wind.INTCUR
CALL main.INCCNTR
POP IX
POP HL
POP DE
POP BC
POP AF
EI
RET
ISREND DEPHASE
; Fatal error routine. We could print
; a message here but we just halt.
SYSERR:
LD A,2
OUT (254),A
DI
HALT
include "z80-sdk/windows_bmw/spkeyb40.a80"
include "z80-sdk/windows_bmw/edznak.a80"
include "z80-sdk/windows_bmw/wind.a80"
include "main.asm"
include "z80-sdk/windows_bmw/dmm.a80"
END
savesna "telnet.sna", _start