-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjgp2.pas
119 lines (81 loc) · 1.95 KB
/
jgp2.pas
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
unit jgp2;
interface
procedure JGPInit(DListAddress: word; VRamAddress: word; lines: byte; blanks: byte);
type
TJGPBlock = object
x, y: byte;
procedure Put(a: byte);
end;
implementation
uses atari;
const
DL_BLANK8 = %01110000; // 8 blank lines
DL_DLI = %10000000; // Order to run DLI
DL_LMS = %01000000; // Order to set new memory address
DL_VSCROLL = %00100000; // Turn on vertical scroll on this line
DL_HSCROLL = %00010000; // Turn on horizontal scroll on this line
DL_MODE = $04;
DL_JVB = %01000001; // Jump to begining
var dList: PByteArray;
procedure TJGPBlock.Put(a: byte);
begin
end;
procedure JGPDLI; interrupt; assembler;
asm
pha
lda #0
.def :JGPCharset = *-1
inc dliCnt ; cycle latency
sta chbase
eor #4
.def :JGPEor = *-1
sta JGPCharset
lda #0
.def :dliCnt = *-1
add cntRow
bpl skp
lda #6
sta colpf1
lda #4
sta colpf2
skp
pla
end;
procedure DLPoke(b: byte);
begin
dList[0] := b;
Inc(dList);
end;
procedure DLPokeW(w: word);
begin
dList[0] := Lo(w);
dList[1] := Hi(w);
Inc(dList, 2);
end;
procedure BuildDisplayList(DListAddress: word; VRamAddress: word; lines: byte; blanks: byte);
begin
dList := pointer(DListAddress);
while blanks > 0 do begin
DLPoke(DL_BLANK8 + DL_DLI);
dec(blanks);
end;
lines:=lines - 1;
DLPoke(DL_LMS + DL_MODE + DL_DLI + DL_VSCROLL);
DLPokeW(VRamAddress);
while (lines > 0) do begin
DLPoke(DL_MODE + DL_DLI + DL_VSCROLL);
dec(lines);
end;
DLPoke(DL_MODE);
DLPoke(DL_JVB);
DLPokeW(DListAddress);
end;
procedure JGPInit(DListAddress: word; VRamAddress: word; lines: byte; blanks: byte);
begin
BuildDisplayList(DListAddress, VRamAddress, lines, blanks);
SDLSTL := DListAddress;
savmsc := VRamAddress;
SetIntVec(iDLI, @JGPDli);
nmien := $c0;
end;
end.