255
34 |
35 | res 7,(iy+3)
36 |
37 | .cont:
38 | ld a,(ix+enemy_data.frame)
39 | cp 16*4 ; hard coded in the SPT
40 | jp nc,.two_layers
41 |
42 | .one_layer:
43 | ld (iy+2),a ; write shape
44 | ld (iy+1),l ; write X
45 | ld a,(ix+enemy_data.y) ; write Y
46 | ld (iy+0),a
47 | ld a,(iy+3)
48 | and 0xF0
49 | or (ix+enemy_data.color)
50 | ld (iy+3),a ; write colour
51 | inc c
52 | ld de,4
53 | add iy,de
54 |
55 | .next:
56 | ld de,enemy_data
57 | add ix,de
58 | djnz npc_loop1
59 |
60 | ld a,c
61 | add a,a ; x4 -> sat data
62 | add a,a
63 | ld (visible_sprts),a
64 | ret
65 |
66 | .two_layers:
67 | ld (iy+2),a ; write shape
68 | add a,8
69 | ld (iy+2+4),a ; second layer shape
70 | ld (iy+1),l ; write X
71 | ld (iy+1+4),l
72 | ld a,(ix+enemy_data.y) ; write Y
73 | ld (iy+0),a
74 | ld (iy+0+4),a
75 | ld a,(iy+3)
76 | and 0xF0
77 | or (ix+enemy_data.color)
78 | ld (iy+3),a ; write colour
79 | and 0xF0
80 | or 1 ; second layer colour
81 | ld (iy+3+4),a
82 | inc c
83 | inc c
84 | ld de,8
85 | add iy,de
86 | jp .next
87 |
88 | .ecset:
89 | add hl,de
90 | set 7,(iy+3)
91 | jp .cont
92 |
--------------------------------------------------------------------------------
/old/match_colors.m:
--------------------------------------------------------------------------------
1 |
2 | function [k,cu,cd] = match_colors(chu,clu,chd,cld)
3 |
4 |
5 | % chu = [ 15 15 12 12 2 13 8 0];
6 | % clu = [ 81 81 81 81 81 81 81 17];
7 | % chd = [176 208 32 10 160 16 96 80];
8 | % cld = [ 81 81 81 81 81 81 81 81];
9 | %
10 |
11 | cu = chu;
12 | cd = chd;
13 | k = clu;
14 |
15 | for i = 1:8
16 |
17 | cu(i) = chu(i);
18 | if (chu(i) == 255)
19 | t1 = uint8(uint8(0:15) + bitand(clu(i),240));
20 | t2 = uint8(uint8(0:15)*16 + bitand(clu(i),240)/16);
21 | elseif (chu(i) == 0)
22 | t1 = uint8(uint8(0:15)*16 + bitand(clu(i),15));
23 | t2 = uint8(uint8(0:15) + bitand(clu(i),15)*16);
24 | else
25 | t1 = clu(i);
26 | t2 = [];
27 | end
28 |
29 | cd(i) = chd(i);
30 | if (chd(i) == 255)
31 | s1 = uint8(uint8(0:15) + bitand(cld(i),240));
32 | s2 = uint8(uint8(0:15)*16 + bitand(cld(i),240)/16);
33 | elseif (chd(i) == 0)
34 | s1 = uint8(uint8(0:15)*16 + bitand(cld(i),15));
35 | s2 = uint8(uint8(0:15) + bitand(cld(i),15)*16);
36 | else
37 | s1 = cld(i);
38 | s2 = [];
39 | end
40 |
41 | m11 = intersect (t1,s1);
42 | m12 = intersect (t1,s2);
43 | m21 = intersect (t2,s1);
44 | m22 = intersect (t2,s2);
45 |
46 | if ~isempty(m11)
47 | k(i) = min(m11);
48 |
49 | elseif ~isempty(m12)
50 | k(i) = min(m12);
51 | cd(i) = ~cd(i);
52 |
53 | elseif ~isempty(m21)
54 | k(i) = min(m21);
55 | cu(i) = ~cu(i);
56 |
57 | elseif ~isempty(m22)
58 | k(i) = min(m22);
59 | cu(i) = ~cu(i);
60 | cd(i) = ~cd(i);
61 |
62 | else
63 | k = [];
64 | return
65 | end
66 | end
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/sprtinit.asm:
--------------------------------------------------------------------------------
1 |
2 | add16_de:
3 | push hl
4 | ld hl,16
5 | add hl,de
6 | ex de,hl
7 | pop hl
8 | ret
9 |
10 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11 | ;
12 | ; load sprites in vram
13 |
14 | sprite_init:
15 | di
16 | ld hl,test_spt
17 | ld a,(sprite_3c)
18 | and a
19 | jr z,1f
20 | ld hl,test_spt_3c
21 | 1: ld de,level_buffer
22 | call mom_depack_rom
23 | ld hl,level_buffer
24 | _setvdpwvram 0x3800
25 | call write_256
26 |
27 | _setvdpwvram 0x1B80 ; sprites in the score bar
28 | ld hl,scorebar_sat
29 | ld bc,0x8098
30 | otir
31 |
32 | ld hl,line1
33 | ld de,0x1C08+32
34 | call print_str
35 |
36 | ld hl,0
37 | ld (score_bin),hl
38 | ld (score_bin+2),hl
39 |
40 | ld a,7
41 | ld (lives_bin),a
42 |
43 | ld hl,lives
44 | ld de,lives+1
45 | ld (hl),13
46 | ld bc,14-1 ; lives and score are strings in ram
47 | ldir
48 |
49 | ; set Manta icon
50 | di
51 | _setvdpwvram 0x1C08
52 | ld hl,ram_tileset+110*8
53 | ld bc,0x898
54 | otir
55 | _setvdpwvram (0x1C08+16)
56 | ld b,0x8
57 | otir
58 | _setvdpwvram (0x1C08+4*32)
59 | ld b,0x8
60 | otir
61 | _setvdpwvram (0x1C08+4*32+16)
62 | ld b,0x8
63 | otir
64 |
65 | ; set Uridium sign
66 |
67 | ld de,0x1C00+16*32+ 8*1
68 | ld hl,ram_tileset+95*8
69 | ld b,12
70 | 1: push bc
71 | call setwrtvram
72 | ld b,0x8
73 | otir
74 | call add16_de
75 | pop bc
76 | djnz 1b
77 |
78 | ld hl,ram_tileset+104*8
79 | call setwrtvram
80 | ld b,0x8
81 | otir
82 | call add16_de
83 |
84 | ld hl,ram_tileset+107*8
85 | ld b,3
86 | 1: push bc
87 | call setwrtvram
88 | ld b,0x8
89 | otir
90 | call add16_de
91 | pop bc
92 | djnz 1b
93 |
94 | xor a
95 | ld (reverse_sat),a
96 |
97 | ld hl,ram_sat
98 | ld de,ram_sat+1
99 | ld bc,127
100 | ld (hl),a
101 | ldir
102 |
103 | ret
104 |
105 |
--------------------------------------------------------------------------------
/old/miz/MSX-O-Mizer.txt:
--------------------------------------------------------------------------------
1 |
2 | MSX-O-Mizer is an adaption for the MSX of Magnus Lind's Exomizer Windows cruncher
3 | which was originally made to pack c64 files.
4 |
5 | Here are the main features and differences of MSX-O-Mizer:
6 | ----------------------------------------------------------
7 |
8 | - Minimal set of parameters (compared to the original exomizer).
9 |
10 | - Handles MSX binary files (not MSXDOS ones).
11 |
12 | - Can create MSX executable files by inserting a depacker routine and a binary files header
13 | or pack raw datas (depacker provided).
14 |
15 | - Tuned to work with MSX having at least 64 kilobytes of memory
16 | (should work with 32k or 16k ones too provided that the loading address
17 | of the original program to pack to be above 0x8000 or 0xc000).
18 |
19 | - Should work on a reasonable amount of MSX computers (Turbo-R included).
20 |
21 | - Allows loading of bigger executable files with the ROM based MSX Basic loader
22 | (depending on the datas i would say around 50-52k depacked / 16-17k packed,
23 | the depacker is located behind the packed datas so a bit of overlapping is possible
24 | and depacked programs can have a start address as low as 0)
25 |
26 | - 2 decrunching routines for raw datas (to depack into main memory or vram) are provided.
27 |
28 |
29 | What you can assume if your program has to be depacked below 0x8000 (bigger depacker):
30 | --------------------------------------------------------------------------------------
31 |
32 | - Interrupts are disabled.
33 |
34 | - All 64k of memory are available and should be correctly mapped
35 | (bios and basic roms aren't available anymore, tho).
36 |
37 |
38 | What you can assume if your program has to be depacked above 0x8000 (smaller depacker):
39 | ---------------------------------------------------------------------------------------
40 |
41 | - Interrupts are disabled.
42 |
43 |
44 | Note: The decrunchers generated by the packer are smaller than the provided ones
45 | which are more generic.
46 |
--------------------------------------------------------------------------------
/mc_collide.asm:
--------------------------------------------------------------------------------
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 | ;
3 | ; manage MS collisions with background
4 | ;
5 |
6 | ;include blocktiles.asm
7 |
8 | test_obstacles:
9 | ld hl,ms_ani
10 | ld a,(aniframe)
11 | ld c,a
12 | ld b,0
13 | add hl,bc
14 | ld a,(hl)
15 | add a,a
16 | add a,a
17 | ld ix,ms_col_win
18 | ld c,a
19 | ld b,0
20 | add ix,bc
21 |
22 | ld h,0
23 | ld l,(ix+0)
24 | ld de,(xship)
25 | add hl,de
26 | ld a,(yship)
27 | add a,(ix+2)
28 | call .tst
29 |
30 | ld h,0
31 | ld l,(ix+1)
32 | ld de,(xship)
33 | add hl,de
34 | ld a,(yship)
35 | add a,(ix+2)
36 | call .tst
37 |
38 | ld h,0
39 | ld l,(ix+0)
40 | ld de,(xship)
41 | add hl,de
42 | ld a,(yship)
43 | add a,(ix+3)
44 | call .tst
45 |
46 | ld h,0
47 | ld l,(ix+1)
48 | ld de,(xship)
49 | add hl,de
50 | ld a,(yship)
51 | add a,(ix+3)
52 | call .tst
53 |
54 | ret
55 |
56 |
57 | .tst:
58 | call .meta_tile_peek
59 | dec a
60 | cp nblock-1
61 | ret nc ; a>22
62 |
63 | .found:
64 | ld a,(ms_state)
65 | cp ms_explode
66 | ret z
67 | ld a,ms_explode
68 | ld (ms_state),a
69 | ld a,64
70 | ld (aniframe),a
71 | xor a
72 | ld (dxmap),a
73 |
74 | ld a,9 ; ms explosion
75 | call AFXPLAY
76 |
77 | ret
78 |
79 |
80 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
81 | ; peek a meta-tile
82 | ; in a: y (screen coordinate)
83 | ; hl: x (level coordinate)
84 | ; out a: meta tile at x,y
85 | ; hl: pointer in level_buffer to meta tile
86 |
87 | .meta_tile_peek:
88 | sub 64 ; move y to level coordinate
89 | and 0xF8
90 | rrca
91 | rrca
92 |
93 | srl h
94 | rr l
95 | srl h
96 | rr l
97 | srl h
98 | rr l
99 | ex de,hl
100 |
101 | ld h,high _tst_table
102 | ld l,a
103 |
104 | ld a,(hl)
105 | inc hl
106 | ld h,(hl)
107 | ld l,a
108 |
109 | add hl,de
110 | ld a,(hl)
111 | ret
112 |
113 | ALIGN 0x0100
114 | _tst_table:
115 | repeat 16
116 | dw level_buffer + (@# * LvlWidth)
117 | endrepeat
118 |
119 |
120 |
--------------------------------------------------------------------------------
/old/opt_clrs_rev.m:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 | % encode in screen 2 even tileset
6 | arry2tile(Tiles1u',MAP);
7 | system('copy /B out.CHR chr_plain1u.bin > logcpy.txt');
8 | system('copy /B out.CLR clr_plain1u.bin > logcpy.txt');
9 | arry2tile(Tiles1d',MAP);
10 | system('copy /B out.CHR chr_plain1d.bin > logcpy.txt');
11 | system('copy /B out.CLR clr_plain1d.bin > logcpy.txt');
12 |
13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 | % encode in screen 2 odd tileset
15 | arry2tile(Tiles2u',MAP);
16 | system('copy /B out.CHR chr_plain2u.bin > logcpy.txt');
17 | system('copy /B out.CLR clr_plain2u.bin > logcpy.txt');
18 | arry2tile(Tiles2d',MAP);
19 | system('copy /B out.CHR chr_plain2d.bin > logcpy.txt');
20 | system('copy /B out.CLR clr_plain2d.bin > logcpy.txt');
21 |
22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 | % try to share color tables
24 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 |
26 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 | % process even frame
28 | fid = fopen('chr_plain1u.bin','r');
29 | t = fread(fid,inf,'uint8');
30 | chr1u = reshape(t,[8 size(t,1)/8]);
31 | fclose(fid);
32 | fid = fopen('chr_plain1d.bin','r');
33 | t = fread(fid,inf,'uint8');
34 | chr1d = reshape(t,[8 size(t,1)/8]);
35 | fclose(fid);
36 | fid = fopen('clr_plain1u.bin','r');
37 | t = fread(fid,inf,'uint8');
38 | clr1u = reshape(t,[8 size(t,1)/8]);
39 | fclose(fid);
40 | fid = fopen('clr_plain1d.bin','r');
41 | t = fread(fid,inf,'uint8');
42 | clr1d = reshape(t,[8 size(t,1)/8]);
43 | fclose(fid);
44 |
45 | if size(Tiles1u,1)<256
46 | Tiles1u = [ Tiles1u ; uint8(ones(256-size(Tiles1u,1),64)*255)];
47 | end
48 | if size(Tiles1d,1)<256
49 | Tiles1d = [ Tiles1d ; uint8(ones(256-size(Tiles1d,1),64)*255)];
50 | end
51 | if size(Tiles2u,1)<256
52 | Tiles2u = [ Tiles2u ; uint8(ones(256-size(Tiles2u,1),64)*255)];
53 | end
54 | if size(Tiles2d,1)<256
55 | Tiles2d = [ Tiles2d ; uint8(ones(256-size(Tiles2d,1),64)*255)];
56 | end
57 |
58 | [ newTiles1u,newTiles1d,PCT1,PGT1u,PGT1d ] = opt_clrs( chr1u,chr1d,clr1u,clr1d, Tiles1u,Tiles1d );
59 |
--------------------------------------------------------------------------------
/old/opt_clrs.m:
--------------------------------------------------------------------------------
1 | function [ nTu,nTd,PCT,PGTu,PGTd ] = opt_clrs( chu,chd,clu,cld, Ttu,Ttd )
2 |
3 | chu = uint8(chu);
4 | chd = uint8(chd);
5 |
6 | clu = uint8(clu);
7 | cld = uint8(cld);
8 |
9 | Tu = uint8(Ttu');
10 | Td = uint8(Ttd');
11 |
12 |
13 | [s,i] = sort(sum(chu));
14 | chu = chu(:,i);
15 | clu = clu(:,i);
16 | Tu = Tu(:,i);
17 |
18 | i = find(s);
19 | for k=i
20 | for j=1:8
21 | if bitand(clu(j,k),15) == 0
22 | clu(j,k) = bitand(clu(j,k),240) + 1;
23 | elseif bitand(clu(j,k),240) == 0
24 | clu(j,k) = bitand(clu(j,k),15) + 16;
25 | end
26 | end
27 | end
28 |
29 |
30 | [s,i] = sort(sum(chd));
31 | chd = chd(:,i);
32 | cld = cld(:,i);
33 | Td = Td(:,i);
34 |
35 | i = find(s);
36 | for k=i
37 | for j=1:8
38 | if bitand(cld(j,k),15) == 0
39 | cld(j,k) = bitand(cld(j,k),240) + 1;
40 | elseif bitand(cld(j,k),240) == 0
41 | cld(j,k) = bitand(cld(j,k),15) + 16;
42 | end
43 | end
44 | end
45 |
46 | setmax = 1:size(chu,2);
47 | setmin = 1:size(chd,2);
48 |
49 | k = 1;
50 | PCT = uint8(zeros(8,256));
51 | PGTu = uint8(zeros(8,256));
52 | PGTd = uint8(zeros(8,256));
53 | nTu = uint8(zeros(size(Tu)));
54 | nTd = uint8(zeros(size(Td)));
55 |
56 | for x = 1:size(chu,2)
57 | for y = setmin
58 |
59 | [t cu cd] = match_colors(chu(:,x),clu(:,x),chd(:,y),cld(:,y));
60 |
61 | if ~isempty(t)
62 | setmin = setdiff(setmin ,y);
63 | setmax = setdiff(setmax ,x);
64 | PCT(:,k) = t;
65 | PGTu(:,k) = cu;
66 | PGTd(:,k) = cd;
67 | nTu(:,k) = Tu(:,x);
68 | nTd(:,k) = Td(:,y);
69 | k = k+1;
70 | break;
71 | end
72 | end
73 | end
74 |
75 | for x = setmax
76 | PCT(:,k) = clu(:,x);
77 | PGTu(:,k) = chu(:,x);
78 | PGTd(:,k) = [ 129,66,36,24,24,36,66,129 ];
79 | nTu(:,k) = Tu(:,x);
80 | k = k+1;
81 | end
82 | for y = setmin
83 | PCT(:,k) = cld(:,y);
84 | PGTd(:,k) = chd(:,y);
85 | PGTu(:,k) = [ 129,66,36,24,24,36,66,129 ];
86 | nTd(:,k) = Td(:,y);
87 | k = k+1;
88 | end
89 |
90 | nTu = nTu';
91 | nTd = nTd';
92 | PCT = PCT';
93 | PGTu = PGTu';
94 | PGTd = PGTd';
95 |
96 |
97 |
--------------------------------------------------------------------------------
/sjasm/sjasmmanual.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 | Sjasm manual
64 |
68 |
69 | Copyright 2009 XL2S Entertainment
70 |
71 |
72 |
--------------------------------------------------------------------------------
/old/titlescreen.m:
--------------------------------------------------------------------------------
1 |
2 |
3 | clear
4 | close all
5 |
6 | name = 'manta_pic6';
7 | [X,MAP] = imread(['grpx\' name '.png']);
8 |
9 |
10 | X1 = X(1:64,:);
11 | A1 = im2col(X1,[8 8],'distinct')';
12 | [Tiles1,I1, J1] = unique(A1,'rows');
13 |
14 | X2 = X(65:128,:);
15 | A2 = im2col(X2,[8 8],'distinct')';
16 | [Tiles2,I2, J2] = unique(A2,'rows');
17 |
18 | X3 = X(129:192,:);
19 | A3 = im2col(X3,[8 8],'distinct')';
20 | [Tiles3,I3, J3] = unique(A3,'rows');
21 |
22 | Image1 = Tiles1(J1,:);
23 | Image2 = Tiles2(J2,:);
24 | Image3 = Tiles3(J3,:);
25 |
26 | x1 = col2im(Image1',[8 8],[64 256],'distinct');
27 | x2 = col2im(Image2',[8 8],[64 256],'distinct');
28 | x3 = col2im(Image3',[8 8],[64 256],'distinct');
29 |
30 | x = [x1;x2;x3];
31 | image(x);
32 | colormap(MAP)
33 |
34 | arry2tile(im2col(X',[8 8],'distinct'),MAP);
35 | system('copy /B out.CHR+out.CLR data_bin\manta_chr_clr.bin > logcpy.txt');
36 | !miz\MSX-O-Mizer.exe -r data_bin\manta_chr_clr.bin data_miz\manta_chr_clr.bin.miz
37 |
38 | return
39 |
40 |
41 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 | % encode in screen 2 even tileset
43 | arry2tile(Tiles1',MAP);
44 | system('copy /B out.CHR manta1_chr.bin > logcpy.txt');
45 | system('copy /B out.CLR manta1_clr.bin > logcpy.txt');
46 | !miz\MSX-O-Mizer.exe -r manta1_chr.bin miz\manta1_chr.bin.miz
47 | !miz\MSX-O-Mizer.exe -r manta1_clr.bin miz\manta1_clr.bin.miz
48 |
49 | arry2tile(Tiles2',MAP);
50 | system('copy /B out.CHR manta2_chr.bin > logcpy.txt');
51 | system('copy /B out.CLR manta2_clr.bin > logcpy.txt');
52 | !miz\MSX-O-Mizer.exe -r manta2_chr.bin miz\manta2_chr.bin.miz
53 | !miz\MSX-O-Mizer.exe -r manta2_clr.bin miz\manta2_clr.bin.miz
54 |
55 | arry2tile(Tiles3',MAP);
56 | system('copy /B out.CHR manta3_chr.bin > logcpy.txt');
57 | system('copy /B out.CLR manta3_clr.bin > logcpy.txt');
58 | !miz\MSX-O-Mizer.exe -r manta3_chr.bin miz\manta3_chr.bin.miz
59 | !miz\MSX-O-Mizer.exe -r manta3_clr.bin miz\manta3_clr.bin.miz
60 |
61 |
62 | J = [J1; J2; J3];
63 | fid = fopen('manta_pnt.bin','w');
64 | fwrite(fid,J-1);
65 | fclose(fid);
66 | !miz\MSX-O-Mizer.exe -r manta_pnt.bin miz\manta_pnt.bin.miz
67 |
68 | !copy /B manta1_chr.bin+manta2_chr.bin+manta3_chr.bin+manta1_clr.bin+manta2_clr.bin+manta3_clr.bin+manta_pnt.bin manta.bin
69 | !miz\MSX-O-Mizer.exe -r manta.bin miz\manta.bin.miz
70 |
71 |
72 |
--------------------------------------------------------------------------------
/put_ms_sprt.asm:
--------------------------------------------------------------------------------
1 |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 | ;
4 | ; manage SAT entries of the main ship
5 | ;
6 |
7 | put_ms_sprt:
8 | ld a,(ms_state)
9 | cp ms_explode
10 | jr z,.expl
11 | ; manage SAT entries of the main ship
12 | ld hl,ram_sat
13 | ld a,(yship)
14 | dec a
15 | ld (hl),a
16 | inc hl
17 | ld (hl),xship_rel
18 | inc hl
19 | ld (hl),0 ; shape 0 hard wired
20 | inc hl
21 | ld (hl),15
22 | inc hl
23 |
24 | ld a,(yship)
25 | dec a
26 | ld (hl),a
27 | inc hl
28 | ld (hl),xship_rel
29 | inc hl
30 | ld (hl),4 ; shape 4 hard wired
31 | ld c,a
32 | inc hl
33 | ld (hl),7
34 | inc hl
35 |
36 | ld a,(yship)
37 | add a,16-1
38 | ld (hl),a
39 | inc hl
40 | ld (hl),xship_rel+16
41 | inc hl
42 | ld (hl),8 ; shape 8 hard wired
43 | inc hl
44 | ld (hl),1
45 | ret
46 | .expl:
47 | ; manage SAT entries of the main ship
48 | ld hl,ram_sat
49 | ld a,(yship)
50 | ld (hl),a
51 | inc hl
52 | ld (hl),xship_rel
53 | inc hl
54 | ld (hl),0 ; shape 0 hard wired
55 | inc hl
56 | ld (hl),10
57 | inc hl
58 |
59 | ld a,(yship)
60 | ld (hl),a
61 | inc hl
62 | ld (hl),xship_rel
63 | inc hl
64 | ld (hl),4 ; shape 4 hard wired
65 | ld c,a
66 | inc hl
67 | ld (hl),11
68 | inc hl
69 |
70 | ld a,(yship)
71 | ld (hl),a
72 | inc hl
73 | ld (hl),xship_rel
74 | inc hl
75 | ld (hl),8 ; shape 8 hard wired
76 | inc hl
77 | ld (hl),6
78 | ret
79 |
80 | .landing:
81 | ld hl,ram_sat+4*2
82 | ld a,(yship)
83 | dec a
84 | ld (hl),a
85 | inc hl
86 | ld a,(xmap)
87 | ld d,a
88 | ld a,(xship)
89 | sub a,d
90 | ld (hl),a ; xship_rel
91 | inc hl
92 | ld (hl),0 ; shape 0 hard wired
93 | inc hl
94 | ld (hl),15
95 |
96 | ld de,-7
97 | add hl,de
98 |
99 | ld a,(yship)
100 | dec a
101 | ld (hl),a
102 | inc hl
103 | ld a,(xmap)
104 | ld d,a
105 | ld a,(xship)
106 | sub a,d
107 | ld (hl),a ; xship_rel
108 | inc hl
109 | ld (hl),4 ; shape 4 hard wired
110 | ld c,a
111 | inc hl
112 | ld (hl),7
113 |
114 | ld de,-7
115 | add hl,de
116 |
117 | ld a,(yship)
118 | add a,b
119 | ld (hl),a
120 | inc hl
121 |
122 | ld a,(xmap)
123 | ld d,a
124 | ld a,(xship)
125 | sub a,d
126 | add a,b
127 | ld (hl),a
128 | inc hl
129 | ld (hl),8 ; shape 8 hard wired
130 | inc hl
131 | ld (hl),1
132 | ret
133 |
--------------------------------------------------------------------------------
/sjasm/sjasmman1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Command line options
34 |
35 |
Add more information here :)
36 |
37 |
52 |
56 |
57 | Copyright 2009 XL2S Entertainment
58 |
59 |
60 |
--------------------------------------------------------------------------------
/victory.asm:
--------------------------------------------------------------------------------
1 |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 | ; typewriter
4 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 | greetings:
6 | db "CONGRATULATIONS PILOT!!",13
7 | db "You saved our solar system",13
8 | db "from the Dreadnoughts menace",13
9 | db "for now at least...",13
10 | greetings1:
11 | db "They will return.",13
12 | db "But for that time",13
13 | db "you will need an MSX2",13
14 | db "to defeat them.",13
15 | greetings2:
16 | db "a last note...",13
17 | db "Now you can select God mode.",13
18 | db "Next time, try to boot",13
19 | db "while ESC is pressed...",13
20 |
21 | _cls:
22 | _setvdpwvram 0x1A00
23 | xor a
24 | ld b,a
25 | 111:
26 | out (0x98),a
27 | nop
28 | djnz 111b
29 | ret
30 |
31 | victory_text2:
32 | ei
33 | halt
34 | di
35 | call _cls
36 | ld de,greetings2
37 | ld hl,0x1800+32*17+8
38 | call prstr
39 | ld hl,0x1800+32*19+2
40 | call prstr
41 | ld hl,0x1800+32*21+5
42 | call prstr
43 | ld hl,0x1800+32*23+5
44 | call prstr
45 | ret
46 |
47 |
48 |
49 | victory_text:
50 | di
51 | _setvdpwvram 0x1000
52 | ld hl,ram_tileset
53 | call write_256
54 |
55 | ; set colours
56 | _setvdpwvram 0x3000
57 | ld bc,0x0001
58 | 1: ld a,0x51
59 | call set4
60 | ld a,0x41
61 | call set4
62 | djnz 1b
63 | dec c
64 | jr nz,1b
65 |
66 | call _cls
67 |
68 | ld de,greetings
69 | ; ld hl,0x1800+32*16+5
70 | ld hl,0x1800+32*17+5
71 | call prstr
72 | ; ld hl,0x1800+32*17+3
73 | ld hl,0x1800+32*19+3
74 | call prstr
75 | ; ld hl,0x1800+32*18+2
76 | ld hl,0x1800+32*21+2
77 | call prstr
78 | ; ld hl,0x1800+32*19+7
79 | ld hl,0x1800+32*23+7
80 | call prstr
81 | ret
82 |
83 | victory_text1:
84 | call _cls
85 | ld de,greetings1
86 | ld hl,0x1800+32*17+8
87 | ; ld hl,0x1800+32*20+8
88 | call prstr
89 | ld hl,0x1800+32*19+8
90 | ; ld hl,0x1800+32*21+8
91 | call prstr
92 | ; ld hl,0x1800+32*22+6
93 | ld hl,0x1800+32*21+6
94 | call prstr
95 | ; ld hl,0x1800+32*23+8
96 | ld hl,0x1800+32*23+8
97 | call prstr
98 | ret
99 |
100 |
101 | wait_music_or_key:
102 |
103 | 1: call joy_read
104 | bit 4,a
105 | ret nz ; end at key pressed
106 | halt
107 | ld a,(PT3_SETUP)
108 | and 128
109 | ret nz ; when music ends or loops
110 | jr 1b
111 |
112 | wait_time_or_key:
113 | ld bc,10*60
114 | wait_time_or_key_bc:
115 | 1: push bc
116 | halt
117 | call joy_read
118 | bit 4,a
119 | pop bc
120 | ret nz ; end at key pressed
121 | dec bc ; end after 10 secs
122 | ld a,b
123 | or c
124 | jr nz,1b
125 | ret
--------------------------------------------------------------------------------
/old/jointoptimalvdpencode.m:
--------------------------------------------------------------------------------
1 |
2 | function [chru,chrd,clrud,nTu,nTd] = jointoptimalvdpencode (uniqueTilesu,uniqueTilesd,MAP);
3 |
4 | [chu,clu] = vdpencode (uniqueTilesu,MAP);
5 | [chd,cld] = vdpencode (uniqueTilesd,MAP);
6 |
7 |
8 | chu = uint8(reshape(chu,8,size(uniqueTilesu,1)));
9 | chd = uint8(reshape(chd,8,size(uniqueTilesd,1)));
10 |
11 | clu = uint8(reshape(clu,8,size(uniqueTilesu,1)));
12 | cld = uint8(reshape(cld,8,size(uniqueTilesd,1)));
13 |
14 |
15 | Tu = uint8(uniqueTilesu');
16 | Td = uint8(uniqueTilesd');
17 |
18 | [s,i] = sort(sum(chu));
19 | chu = chu(:,i);
20 | clu = clu(:,i);
21 | Tu = Tu(:,i);
22 |
23 | i = find(s);
24 | for k=i
25 | for j=1:8
26 | if bitand(clu(j,k),15) == 0
27 | clu(j,k) = bitand(clu(j,k),240) + 1;
28 | elseif bitand(clu(j,k),240) == 0
29 | clu(j,k) = bitand(clu(j,k),15) + 16;
30 | end
31 | end
32 | end
33 |
34 | [s,i] = sort(sum(chd));
35 | chd = chd(:,i);
36 | cld = cld(:,i);
37 | Td = Td(:,i);
38 |
39 | i = find(s);
40 | for k=i
41 | for j=1:8
42 | if bitand(cld(j,k),15) == 0
43 | cld(j,k) = bitand(cld(j,k),240) + 1;
44 | elseif bitand(cld(j,k),240) == 0
45 | cld(j,k) = bitand(cld(j,k),15) + 16;
46 | end
47 | end
48 | end
49 |
50 | setmax = 1:size(chu,2);
51 | setmin = 1:size(chd,2);
52 |
53 |
54 |
55 | k = 1;
56 | PCT = uint8(zeros(8,256));
57 | PGTu = uint8(zeros(8,256));
58 | PGTd = uint8(zeros(8,256));
59 | nTu = uint8(zeros(64,256));
60 | nTd = uint8(zeros(64,256));
61 |
62 | for x = 1:size(chu,2)
63 | for y = setmin
64 |
65 | [t cu cd] = match_colors(chu(:,x),clu(:,x),chd(:,y),cld(:,y));
66 |
67 | if ~isempty(t)
68 | setmin = setdiff(setmin ,y);
69 | setmax = setdiff(setmax ,x);
70 | PCT(:,k) = t;
71 | PGTu(:,k) = cu;
72 | PGTd(:,k) = cd;
73 | nTu(:,k) = Tu(:,x);
74 | nTd(:,k) = Td(:,y);
75 | k = k+1;
76 | break;
77 | end
78 | end
79 | end
80 |
81 | for x = setmax
82 | PCT(:,k) = clu(:,x);
83 | PGTu(:,k) = chu(:,x);
84 | PGTd(:,k) = [ 129,66,36,24,24,36,66,129 ];
85 | nTu(:,k) = Tu(:,x);
86 | k = k+1;
87 | end
88 | for y = setmin
89 | PCT(:,k) = cld(:,y);
90 | PGTd(:,k) = chd(:,y);
91 | PGTu(:,k) = [ 129,66,36,24,24,36,66,129 ];
92 | nTd(:,k) = Td(:,y);
93 | k = k+1;
94 | end
95 |
96 | nTu = nTu';
97 | nTd = nTd';
98 | PCT = PCT';
99 | PGTu = PGTu';
100 | PGTd = PGTd';
101 |
102 | k=k-1;
103 |
104 | chru = PGTu(1:k,:);
105 | chrd = PGTd(1:k,:);
106 | clrud = PCT(1:k,:);
107 |
108 | nTu = nTu(1:k,:);
109 | nTd = nTd(1:k,:);
110 |
111 | return
112 |
--------------------------------------------------------------------------------
/attract_mode.asm:
--------------------------------------------------------------------------------
1 |
2 | attract_mode:
3 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4 | ; game start
5 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6 | halt
7 | di
8 | call cls
9 | call disscr
10 | call sprite_init
11 |
12 | call ayFX_SETUP
13 |
14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15 |
16 | ld bc,0 ; show score on screen
17 | call add_bc_score_bin
18 | ld c,0 ; show lives on screen
19 | call add_c_lives_bin
20 |
21 | xor a
22 | ld (already_dead),a ; reset at level start, set after you die
23 | inc a
24 | ld (next_level),a
25 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 |
27 | .restart:
28 | ld hl,0
29 | ld (xmap),hl
30 | call ayFX_END
31 | call PT3_MUTE
32 | call intro_anim
33 |
34 | ld a,(cur_level)
35 | dec a
36 | ld l,a
37 | ld h,0
38 | ld e,l
39 | ld d,h
40 |
41 | [3] add hl,hl
42 | add hl,de
43 |
44 | ld de,levelnames
45 | add hl,de
46 | ld de,0x1C00+8*3*32
47 | call print_strf
48 |
49 | xor a
50 | ld (aniframe),a
51 | ld (anispeed),a
52 | ld (ms_state),a
53 | ld a,8
54 | ld (dxmap),a
55 | ld (old_aniframe),a ; old_aniframe!=aniframe
56 |
57 | ld hl,0
58 | ld (xmap),hl
59 | ld bc,xship_rel
60 | add hl,bc
61 | ld (xship),hl
62 | ld a,64+64-8
63 | ld (yship),a
64 |
65 | ld a,1
66 | ld (god_mode),a
67 |
68 | call ayFX_SETUP
69 | xor a
70 | ld (halt_game),a
71 | ld (halt_gamef1),a
72 | ld (JIFFY),a
73 |
74 | .main_loop:
75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
76 | ; place MS in the SAT and test for collision
77 | call put_ms_sprt
78 |
79 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
80 | ; run NCPS FSM
81 | call npc_loop ; manage active enemies
82 | call wave_timer ; activate new enemies
83 |
84 | call enemy_bullet_loop ; manage enemy bullets
85 |
86 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
87 | ; run MS bullets FSM
88 | call bullet_loop
89 |
90 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
91 | ; place NPCS sprites in the SAT in RAM
92 | call plot_enemy
93 |
94 | ; wait refresh and update map position
95 | ld hl,JIFFY
96 | ld a,1
97 | dec a
98 | 1:
99 | cp (hl)
100 | jr nc,1b
101 | xor a
102 | ld (hl),a
103 |
104 | ld hl,(xmap)
105 | ld a,(dxmap)
106 | [2] sra a
107 | ld e,a
108 | add a,a
109 | sbc a,a
110 | ld d,a
111 | add hl,de
112 | ld (xmap),hl
113 |
114 | ld bc,xship_rel
115 | add hl,bc
116 | ld (xship),hl
117 |
118 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119 | ; Manage map limits
120 |
121 | ld hl,(xmap)
122 | inc h
123 | ld de,8*(LvlWidth)+256
124 | and a
125 | sbc hl,de
126 |
127 | jr nc,.end_attractmode
128 | call joy_read
129 | and 0x1F
130 | jr nz,.end_attractmode
131 |
132 | jp .main_loop
133 |
134 | .end_attractmode
135 | xor a
136 | ld (god_mode),a
137 |
138 | pop af
139 | pop af
140 | jp title_screen
141 | ; ret
--------------------------------------------------------------------------------
/sprite_collision_window.asm:
--------------------------------------------------------------------------------
1 |
2 | ; xoff db 0
3 | ; yoff db 0
4 | ; xsize db 0
5 | ; ysize db 0
6 |
7 | sprite_0:
8 | sprite_1:
9 | sprite_2:
10 | sprite_3:
11 | defb 3, 3,10,11
12 | sprite_4:
13 | defb 0, 0,16,16
14 | sprite_5:
15 | defb 0, 0,16,16
16 | sprite_6:
17 | defb 0, 0,16,15
18 | sprite_7:
19 | defb 0, 0,16,16
20 | sprite_8:
21 | defb 4, 1, 8,14
22 | sprite_9:
23 | defb 4, 3, 8,11
24 | sprite_10:
25 | defb 4, 5, 8, 7
26 | sprite_11:
27 | defb 4, 6, 8, 5
28 | sprite_12:
29 | defb 4, 7, 8, 2
30 | sprite_13:
31 | defb 4, 6, 8, 5
32 | sprite_14:
33 | defb 4, 5, 8, 7
34 | sprite_15:
35 | defb 4, 3, 8,11
36 | sprite_16:
37 | defb 0, 0,16,15
38 | sprite_17:
39 | defb 0, 0,16,15
40 | sprite_18:
41 | defb 0, 1,16,15
42 | sprite_19:
43 | defb 0, 1,16,15
44 | sprite_20:
45 | defb 0, 0,16,15
46 | sprite_21:
47 | defb 0, 0,16,15
48 | sprite_22:
49 | defb 0, 3,16,13
50 | sprite_23:
51 | defb 0, 3,16,13
52 | sprite_24:
53 | defb 0, 0,16,16
54 | sprite_25:
55 | defb 0, 0,16,16
56 | sprite_26:
57 | defb 0, 0,16,16
58 | sprite_27:
59 | defb 0, 0,16,16
60 | sprite_28:
61 | defb 0, 0,16,15
62 | sprite_29:
63 | defb 0, 0,16,15
64 | sprite_30:
65 | defb 0, 1,16,15
66 | sprite_31:
67 | defb 0, 1,16,15
68 | sprite_32:
69 | defb 0, 0,16,15
70 | sprite_33:
71 | defb 0, 0,16,15
72 | sprite_34:
73 | defb 0, 0,16,16
74 | sprite_35:
75 | defb 0, 0,16,16
76 | sprite_36:
77 | defb 0, 0,16,16
78 | sprite_37:
79 | defb 0, 0,16,16
80 | sprite_38:
81 | defb 0, 0,16,16
82 | sprite_39:
83 | defb 0, 0,16,16
84 | sprite_40:
85 | defb 0, 0,16,15
86 | sprite_41:
87 | defb 0, 0,16,15
88 | sprite_42:
89 | defb 0, 1,16,15
90 | sprite_43:
91 | defb 0, 1,16,15
92 | sprite_44:
93 | defb 0, 0,16,15
94 | sprite_45:
95 | defb 0, 0,16,15
96 | sprite_46:
97 | defb 0, 1,16,15
98 | sprite_47:
99 | defb 0, 1,16,15
100 | sprite_48:
101 | defb 0, 0,16,15
102 | sprite_49:
103 | defb 0, 0,16,15
104 | sprite_50:
105 | defb 0, 0,16,16
106 | sprite_51:
107 | defb 0, 0,16,16
108 | sprite_52:
109 | defb 0, 1,16,13
110 | sprite_53:
111 | defb 0, 1,16,13
112 | sprite_54:
113 | defb 0, 1,16,14
114 | sprite_55:
115 | defb 0, 1,16,14
116 | sprite_56:
117 | defb 0, 3,16, 9
118 | sprite_57:
119 | defb 0, 3,16, 9
120 | sprite_58:
121 | defb 0, 3,16,10
122 | sprite_59:
123 | defb 0, 3,16,10
124 | sprite_60:
125 | defb 0, 5,16, 5
126 | sprite_61:
127 | defb 0, 5,16, 5
128 | sprite_62:
129 | defb 0, 6,16, 5
130 | sprite_63:
131 | defb 0, 6,16, 5
132 |
--------------------------------------------------------------------------------
/old/twocolorenemy.m:
--------------------------------------------------------------------------------
1 |
2 |
3 | clear
4 | close all
5 |
6 | TMSMAP = [0,0,0 % 0 Transparent
7 | 0,0,0 % 1 Black 0 0 0
8 | 33,200,66 % 2 Medium green 33 200 66
9 | 94,220,120 % 3 Light green 94 220 120
10 | 84,85,237 % 4 Dark blue 84 85 237
11 | 125,118,252 % 5 Light blue 125 118 252
12 | 212,82,77 % 6 Dark red 212 82 77
13 | 66,235,245 % 7 Cyan 66 235 245
14 | 252,85,84 % 8 Medium red 252 85 84
15 | 255,121,120 % 9 Light red 255 121 120
16 | 212,193,84 % A Dark yellow 212 193 84
17 | 230,206,128 % B Light yellow 230 206 128
18 | 33,176,59 % C Dark green 33 176 59
19 | 201,91,186 % D Magenta 201 91 186
20 | 204,204,204 % E Gray 204 204 204
21 | 255,255,255]; % F White 255 255 255
22 |
23 | TMSMAP = TMSMAP/255;
24 |
25 | [B,MAP] = imread('grpx\enemytest_red.bmp');
26 |
27 | figure;
28 | colormap(MAP);
29 | image(B);
30 | axis equal
31 |
32 | [Y,NEWMAP] = imapprox(B,MAP,3,'nodither');
33 |
34 | figure;
35 | colormap(NEWMAP);
36 | image(Y);
37 | axis equal
38 |
39 |
40 | imwrite(Y,NEWMAP,['grpx\enemytest_red_two_col.png'],'png', 'BitDepth',8)
41 |
42 |
43 | name = 'enemytest_red_two_col';
44 |
45 | A=Y;
46 | MAP = NEWMAP; % = imread(['grpx\' name '.png']);
47 |
48 | figure
49 | image(A)
50 | colormap(MAP)
51 | axis equal
52 | [N,X] = hist(double(A(:)),16)
53 | [c ii] = sort(N);
54 |
55 | Y1 = A==0;
56 | Y2 = A==1;
57 |
58 | Y = [Y1;Y2];
59 | figure
60 | image(Y)
61 | colormap(flag)
62 | axis equal
63 |
64 | imwrite(Y*16,MAP,['grpx\' name '_shapes.png'],'png', 'BitDepth',8)
65 |
66 | Nframes = size(Y,1)*size(Y,2)/256;
67 |
68 | frames = cell(32,Nframes);
69 |
70 | figure;
71 | k = 0;
72 | h = 0;
73 | for i = 1:size(frames,2)
74 | for j = 1:16
75 | frames{j,i} = [dec2hex(bi2de(Y(h+j,k+[1:8]),'left-msb'),2)];
76 | end
77 | for j=17:32
78 | frames{j,i} = [dec2hex(bi2de(Y(h+j-16,k+8+[1:8]),'left-msb'),2)];
79 | end
80 | image( [ Y(h+[1:16],k+[1:8]) Y(h+[17:32]-16,k+8+[1:8])]);
81 | colormap(MAP);
82 | i
83 | %pause
84 | k = k + 16;
85 | if (k>=size(Y,2))
86 | k = 0;
87 | h=h+16;
88 | end
89 | end
90 |
91 |
92 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 | % save sprite data
94 |
95 | fid = fopen([name '.asm'],'w');
96 | fprintf (fid,[name ':\n']);
97 | for i=1:size(frames,2)
98 | fprintf (fid,[ name '_%d \n'],i-1);
99 | for j=1:32
100 | fprintf (fid,' defb 0x%s \n',frames{j,i});
101 | end
102 | fprintf (fid,'\n');
103 | end
104 | fclose(fid);
105 |
--------------------------------------------------------------------------------
/sjasm/stijl.css:
--------------------------------------------------------------------------------
1 | body {
2 | color: black;
3 | background: white;
4 | margin: 0 auto 0 auto;
5 | max-width: 1024px;
6 | }
7 |
8 | div.tekst {
9 | background: transparent;
10 | font-family: "bookman old style", verdana, sans-serif;
11 | position: relative;
12 | left: 15%;
13 | width: 70%;
14 | z-index: 3;
15 | margin: 1em 0 1em 0;
16 | }
17 |
18 | .tekst b {
19 | font-family: verdana, sans-serif;
20 | }
21 |
22 | .tekst h3 {
23 | color: blue;
24 | font-family: verdana, sans-serif;
25 | font-size: 1.5em;
26 | margin: 0px 0.5em 0px 0.5em;
27 | letter-spacing: -0.05em;
28 | }
29 |
30 | .tekst h4 {
31 | color: blue;
32 | font-family: verdana, sans-serif;
33 | margin: 0px 0.5em 0px 0.5em;
34 | }
35 |
36 | .tekst h5 {
37 | color: blue;
38 | font-family: verdana, sans-serif;
39 | }
40 |
41 | a {
42 | color: blue;
43 | }
44 |
45 | pre {
46 | background: #F0F0FF;
47 | padding: 2px;
48 | }
49 |
50 | div.xl2sweblogo {
51 | background: url("xl2sweblogo3.png") no-repeat 0px 0px transparent;
52 | overflow: hidden;
53 | position: absolute;
54 | left: 30px;
55 | top: 50px;
56 | height: 512px;
57 | width: 172px;
58 | z-index: 0;
59 | }
60 |
61 | div.titelbalk {
62 | font-family: verdana, "arial black", sans-serif;
63 | overflow: hidden;
64 | position:relative;
65 | width: 98%;
66 | text-align: center;
67 | letter-spacing: -0.1em;
68 | vertical-align: middle;
69 | z-index: 3;
70 | }
71 |
72 | .titelbalk h1 {
73 | margin: 0;
74 | border: 0;
75 | padding: 0.4em;
76 | }
77 |
78 | div.menu {
79 | font-family: verdana, sans-serif;
80 | font-weight: 600;
81 | color: white;
82 | background-color: blue;
83 | position: relative;
84 | left: 10%;
85 | width: 80%;
86 | z-index: 4;
87 | text-align: center;
88 | }
89 |
90 | .menu i {
91 | color: white;
92 | background-color: black;
93 | margin: 0.5em;
94 | padding: 0.1em;
95 | text-decoration: none;
96 | }
97 |
98 | .menu a {
99 | color: white;
100 | margin: 0.5em;
101 | padding: 0.1em;
102 | text-decoration: none;
103 | }
104 |
105 | .menu a:hover {
106 | color: black;
107 | background-color: white;
108 | text-decoration: none;
109 | }
110 |
111 | .menu li {
112 | display: inline;
113 | margin: 0;
114 | border: 0;
115 | padding: 0;
116 | }
117 |
118 | .menu ul {
119 | display: inline;
120 | margin: 0;
121 | border: 0;
122 | padding: 0;
123 | }
124 |
125 | div.navi {
126 | background: transparent;
127 | font-family: verdana, sans-serif;
128 | font-size: small;
129 | position: relative;
130 | left: 15%;
131 | width: 70%;
132 | z-index: 3;
133 | margin: 1em 0 1em 0;
134 | }
135 |
136 | div.voetnoot {
137 | font-family: verdana, sans-serif;
138 | font-size: small;
139 | position: relative;
140 | width: 98%;
141 | z-index: 4;
142 | text-align: center;
143 | margin: 0.5em;
144 | }
145 |
146 | img {
147 | margin: 0.3em;
148 | }
--------------------------------------------------------------------------------
/mizer.asm:
--------------------------------------------------------------------------------
1 |
2 |
3 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4 | ; -------------------------------------------------------
5 | ; MSX-O-Mizer v1.5f datas depacker *ROM based version*
6 | ; Improved from Metalbrain's z80 version.
7 | ; -------------------------------------------------------
8 | ; source in hl
9 | ; dest in de
10 |
11 | ; 328 bytes which must be aligned on 8 bits boundary
12 | mom_map_bits_rom = MSX_O_Mizer_buf
13 | ; 26 bytes located in ram
14 | mom_offset_table = MSX_O_Mizer_buf + 328
15 |
16 |
17 | mom_depack_rom: push de
18 | ld bc, mom_offset_table
19 | push bc
20 | ld d,b
21 | ld e,c
22 | ld bc, 26
23 | ldir
24 | push hl
25 | pop af
26 | pop hl
27 | push af
28 | ld iy, mom_map_bits_rom + 0xf0
29 | ld b, 52
30 | mom_init_bits_rom: ld a, iyl
31 | and 15
32 | jr nz, mom_node_rom
33 | ld de, 1
34 | mom_node_rom: rrd
35 | ld (iy), a
36 | ld (iy + 36), e
37 | ld (iy + 72), d
38 | inc iyl
39 | inc a
40 | push hl
41 | ld hl, 0
42 | scf
43 | mom_set_bit_rom: adc hl, hl
44 | dec a
45 | jr nz, mom_set_bit_rom
46 | add hl, de
47 | ex de, hl
48 | pop hl
49 | bit 0, b
50 | jr z, mom_wait_step_rom
51 | inc hl
52 | mom_wait_step_rom: djnz mom_init_bits_rom
53 | pop hl
54 | ld a, (hl)
55 | inc hl
56 | ld ixh, a
57 | pop de
58 | mom_lit_copy_rom: ldi
59 | mom_main_loop_rom: call mom_get_bit_rom
60 | jr c, mom_lit_copy_rom
61 | ld c, -17
62 | mom_get_index_rom: call mom_get_bit_rom
63 | inc c
64 | jr nc, mom_get_index_rom
65 | ld a, c
66 | ret z
67 | push de
68 | call mom_get_pair_rom
69 | push bc
70 | jr nz, mom_out_range_rom
71 | ld de, 0x0220
72 | dec c
73 | jr z, mom_go_for_it_rom
74 | ld de, 0x0410
75 | dec c
76 | jr z, mom_go_for_it_rom
77 | mom_out_range_rom: ld de, 0x0400
78 | mom_go_for_it_rom: pop af
79 | ex af, af'
80 | call mom_get_bits_rom
81 | add a, e
82 | call mom_get_pair_rom
83 | pop de
84 | push hl
85 | ld h, d
86 | ld l, e
87 | sbc hl, bc
88 | ex af, af'
89 | push af
90 | pop bc
91 | ldir
92 | pop hl
93 | jr mom_main_loop_rom
94 | mom_get_pair_rom: ld iyl, a
95 | ld d, (iy)
96 | call mom_get_bits_rom
97 | add (iy + 36)
98 | ld c, a
99 | ld a, b
100 | adc (iy + 72)
101 | ld b, a
102 | ret
103 | mom_get_bits_rom: ld bc, 0
104 | mom_getting_bits_rom:
105 | dec d
106 | ld a, c
107 | ret m
108 | call mom_get_bit_rom
109 | rl c
110 | rl b
111 | jr mom_getting_bits_rom
112 | mom_get_bit_rom: ld a, ixh
113 | add a
114 | jr nz, mom_byte_done_rom
115 | ld a, (hl)
116 | inc hl
117 | rla
118 | mom_byte_done_rom: ld ixh, a
119 | ret
120 |
--------------------------------------------------------------------------------
/sccdetec.asm:
--------------------------------------------------------------------------------
1 | ;------------------------------------------------------------
2 | ; SCC-search v1.0
3 | ; by Alwin Henseler
4 | ; using method described in bulletin # 18 MSX-club Enschede
5 | ; input: none
6 | ; output: B=slot that contains SCC (=255 if no SCC found)
7 |
8 | ; enaslt: equ #0024
9 | ; exptbl: equ #fcc1
10 | ; slttbl: equ #fcc5
11 |
12 |
13 |
14 |
15 | begin:
16 | MAP #c000
17 | in a,(#a8) ; read prim. slotregister
18 | rra
19 | rra
20 | rra
21 | rra
22 | and %00000011 ; A = prim.slot page 2
23 | ld b,0
24 | ld c,a
25 | ld hl,exptbl
26 | add hl,bc
27 | bit 7,(hl) ; page 2-slot expanded ?
28 | jr z,scctest
29 | ld hl,slttbl
30 | add hl,bc
31 | ld a,(hl) ; A = sec.sel.reg. of page 2-slot
32 | rra
33 | rra
34 | and %00001100 ; bit 1/2 = sec.slot page 2
35 | or c
36 | set 7,a ; compose sec.slot-code
37 | scctest:
38 | push af ; save page 2-slot on the stack
39 | ld a,(exptbl) ; 1st slot to test
40 |
41 | testslot:
42 | push af ; save test-slot on the stack
43 | ld h,#80
44 | call enaslt ; switch slot-to-test in 8000-bfffh
45 | ld hl,#9000
46 | ld b,(hl) ; save contents of address 9000h
47 | ld (hl),#3f ; activate SCC (if present)
48 |
49 | xor a
50 | ld (0xbffe),a ; scc+ patch for bluemsx
51 |
52 | ld h,#9c ; address of SCC-register mirrors
53 | ld de,#9800 ; 9800h = address of SCC-registers
54 | testreg:
55 | ld a,(de)
56 | ld c,a ; save contents of address 98xxh
57 | ld a,(hl) ; read byte from address 9cxxh
58 | cpl ; and invert it
59 | ld (de),a ; write inverted byte to 98xxh
60 | cp (hl) ; same value on 9cxxh ?
61 | ld a,c
62 | ld (de),a ; restore value on 98xxh
63 | jr nz,nextslot ; unequal -> no SCC -> continue search
64 | inc hl
65 | inc de ; next test-addresses
66 | bit 7,l ; 128 addresses (registers) tested ?
67 | jr z,testreg ; no -> repeat mirror-test
68 | ld a,b
69 | ld (#9000),a ; restore value on 9000h
70 | pop bc ; retrieve slotcode (=SCC-slot) from stack
71 | jr done ; SCC found, restore page 2-slot & return
72 |
73 | nextslot:
74 | ld a,b
75 | ld (#9000),a ; restore value on 9000h
76 | pop bc ; retrieve slotcode from stack
77 | bit 7,b ; test-slot = sec.slot ?
78 | jr z,nextprim
79 | ld a,b
80 | add a,4 ; increase sec.slotnumber
81 | bit 4,a ; sec.slot = 4 ?
82 | jr z,testslot
83 | nextprim:
84 | ld a,b
85 | and %00000011
86 | cp 3 ; prim.slot = 3 ?
87 | jr z,noscc
88 | inc a ; increase prim.slotnumber
89 | ld d,0
90 | ld e,a
91 | ld hl,exptbl
92 | add hl,de
93 | or (hl) ; combine slot-expansion with slotcode
94 | jr testslot
95 |
96 | noscc:
97 | ld b,255 ; code for no SCC
98 | done:
99 | pop af ; retrieve page 2-slot from stack
100 | push bc
101 | ld h,#80
102 | call enaslt ; restore original page 2-slot
103 | pop bc
104 | ei
105 | ret
106 | end:
107 | endmap
108 | ; -------------------------------------------------------------
109 |
110 |
111 | ; ====================
112 | ; Initialization
113 | ; ====================
114 | SCCINIT
115 | ld hl,begin
116 | ld de,0C000H
117 | ld bc,end-begin+1
118 | ldir
119 | call 0C000H
120 | ld a,b
121 | ld (SCC),a
122 | ret
123 |
124 | ; SLOT .db 0
125 | ; PAGE1RAM .db 0
126 | ; RAMSLOT .db 0
127 |
128 | ; SCC .db 0
129 | ; SUB .db 0FFH
130 |
131 |
--------------------------------------------------------------------------------
/old/png2sprt.m:
--------------------------------------------------------------------------------
1 | clear
2 | close all
3 |
4 | name = 'uridium_rev7';
5 | [AA,MAP] = imread(['grpx\' name '.png']);
6 |
7 | Y = AA>0;
8 |
9 |
10 | frames = cell(32,64);
11 |
12 | k = 0;
13 | h = 0;
14 | for i = 1:size(frames,2)
15 | for j = 1:16
16 | frames{j,i} = Y(h+j,k+[1:8]);
17 | end
18 | for j=17:32
19 | frames{j,i} = Y(h+j-16,k+8+[1:8]);
20 | end
21 | k = k + 16;
22 | if (k>=size(Y,2))
23 | k = 0;
24 | h=h+16;
25 | end
26 | end
27 |
28 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29 | % save sprite data
30 |
31 | fid = fopen(['data_bin\' name '.bin'],'w');
32 | for i=1:size(frames,2)
33 | for j=1:32
34 | fwrite(fid,bi2de(frames{j,i},'left-msb'),'uint8');
35 | end
36 | end
37 | fclose(fid);
38 |
39 | system(['miz\MSX-O-Mizer -r data_bin\' [name '.bin'] ' data_miz\' [name '.miz'] ]);
40 |
41 | % store collision data for tile tests (only for MS bullets)
42 |
43 | Y = Y(17:32,:);
44 |
45 | minx = zeros(size(Y,2),1);
46 | maxx = zeros(size(Y,2),1);
47 | miny = zeros(size(Y,2),1);
48 | maxy = zeros(size(Y,2),1);
49 |
50 | h = 1;
51 | for k = 1:16:size(Y,2)
52 |
53 | A = Y(:,k:(k+15));
54 |
55 | for x = 1:16
56 | if any(A(:,x))
57 | minx(h) = x;
58 | break;
59 | end
60 | end
61 | for x = 16:-1:1
62 | if any(A(:,x))
63 | maxx(h) = x;
64 | break;
65 | end
66 | end
67 | for x = 1:16
68 | if any(A(x,:))
69 | miny(h) = x;
70 | break;
71 | end
72 | end
73 | for x = 16:-1:1
74 | if any(A(x,:))
75 | maxy(h) = x;
76 | break;
77 | end
78 | end
79 | [h minx(h) maxx(h) miny(h) maxy(h)]
80 | h = h+1;
81 | end
82 |
83 | name = 'ms_bllts';
84 |
85 | fid = fopen([name '_frm_coll_wind.asm'],'w');
86 | fprintf (fid,[name '_coll_wind:\n']);
87 | for h = 1:size(Y,2)/16
88 | fprintf (fid,' defb %d,%d,%d,%d \n',[minx(h) maxx(h)-1 miny(h) maxy(h)-1] );
89 | end
90 | fprintf (fid,'\n');
91 | fclose(fid);
92 |
93 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 | % save sprite data
95 | %
96 | % fid = fopen([name '.asm'],'w');
97 | % fprintf (fid,[name ':\n']);
98 | % for i=1:size(frames,2)
99 | % fprintf (fid,[ name '_%d: \n'],i-1);
100 | % for j=1:32
101 | % if (j==1)
102 | % fprintf (fid,' defb 0x%s,', binaryVectorToHex(frames{j,i}));
103 | % elseif (j<32)
104 | % fprintf (fid,'0x%s,', binaryVectorToHex(frames{j,i}));
105 | % else
106 | % fprintf (fid,'0x%s\n', binaryVectorToHex(frames{j,i}));
107 | % end
108 | % end
109 | % fprintf (fid,'\n');
110 | % end
111 | % fclose(fid);
112 |
113 | % ; xoff db 0
114 | % ; yoff db 0
115 | % ; xsize db 0
116 | % ; ysize db 0
117 |
118 |
119 | Y = AA>0;
120 | fid = fopen(['sprite_collision_window.asm'],'w');
121 |
122 | text = [ '\n ; xoff db 0 \n ; yoff db 0 \n ; xsize db 0 \n ; ysize db 0 \n\n'];
123 |
124 | fprintf (fid,text);
125 |
126 | k = 0;
127 | for j = 1:16:(size(Y,1)-15)
128 | for i = 1:16:(size(Y,2)-15)
129 |
130 | fprintf (fid,'sprite_%d:\n',k);
131 |
132 | T = Y(j:(j+15),i:(i+15));
133 | % image(T)
134 | % colormap(MAP)
135 | % axis equal;
136 | [~,indx] = find(sum(T));
137 | [~,indy] = find(sum(T'));
138 | if (~isempty(indx) && ~isempty(indy))
139 | fprintf (fid,' defb %2d,%2d,%2d,%2d \n',min(indx)-1,min(indy)-1,max(indx)-min(indx)+1,max(indy)-min(indy)+1);
140 | end
141 |
142 |
143 | %pause
144 |
145 | k = k+1;
146 | end
147 |
148 | end
149 | fclose(fid);
150 |
--------------------------------------------------------------------------------
/old/png2sprt_ms_ani.m:
--------------------------------------------------------------------------------
1 | clear
2 | close all
3 |
4 | name = 'ms_demo';
5 | [X,MAP] = imread(['grpx\' name '.png']);
6 |
7 | A = [X(1:32,:) X(33:64,:) X(65:96,:) X(97:128,:)];
8 | figure
9 | image(A)
10 | axis equal
11 | colormap(MAP)
12 |
13 | B = X(129:144,:);
14 |
15 | Y11 = (B==11); % 11 10 6
16 | Y10 = (B==10);
17 | Y6 = (B==6 );
18 |
19 | Z = [Y11;Y10;Y6];
20 | figure
21 | image(Z)
22 | axis equal
23 | colormap(flag)
24 |
25 | Frames = im2col(A,[32 16],'distinct');
26 |
27 | [C,IA,IC] = unique(Frames','rows');
28 |
29 |
30 | %%%%%%%%%%%%%%%%%%%%%%
31 |
32 | %CC = C(IC,:)';
33 | CC = C';
34 | A = col2im( CC,[32 16],[32 size(CC,2)*16],'distinct');
35 |
36 | [LIA,LOCB] = ismember(Frames',C,'rows');
37 |
38 | figure
39 | image(A)
40 | axis equal
41 | colormap(MAP)
42 | %%%%%%%%%%%%%%%%%%%%%%
43 | % return
44 |
45 | IC = [ LOCB; ((1+max(LOCB)):(16+max(LOCB)))'];
46 |
47 | fid = fopen([name '_ani.asm'],'w');
48 | fprintf (fid,[name '_ani:\n']);
49 | fprintf (fid,' defb %d \n',IC-1);
50 | fclose(fid);
51 |
52 |
53 | Y15 = (A==15);
54 | Y7 = (A==7 );
55 | Y1 = (A==1 );
56 |
57 | W = [Y15(1:16,:);Y7(1:16,:);Y1(17:32,:)];
58 | Y = [W Z];
59 | figure
60 | image(Y)
61 | axis equal
62 | colormap(flag)
63 |
64 | imwrite(Y*16,MAP,['grpx\' name '_shapes.png'],'png', 'BitDepth',8)
65 |
66 |
67 | %%%%%%%%%%%%%%%%%%%%%%
68 |
69 |
70 | Nframes = size(Y,1)/16*size(Y,2)/16;
71 |
72 | frames = cell(32,Nframes);
73 |
74 | k = 0;
75 | h = 0;
76 |
77 | for i = 1:size(frames,2)
78 | for j = 1:16
79 | frames{j,i} = [dec2hex(bi2de(Y(h+j,k+[1:8]),'left-msb'),2)];
80 | end
81 | for j=17:32
82 | frames{j,i} = [dec2hex(bi2de(Y(h+j-16,k+8+[1:8]),'left-msb'),2)];
83 | end
84 | i
85 | % image( [ Y(h+[1:16],k+[1:8]) Y(h+[17:32]-16,k+8+[1:8])]);
86 | % axis equal
87 | % colormap(MAP);
88 | % pause
89 | h = h + 16;
90 | if (h>=size(Y,1))
91 | h = 0;
92 | k=k+16;
93 | end
94 | end
95 |
96 |
97 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98 | % save sprite data
99 |
100 | fid = fopen([name '_frm.asm'],'w');
101 | fprintf (fid,[name ':\n']);
102 | for i=1:size(frames,2)
103 | fprintf (fid,[ name '_%d \n'],i-1);
104 | for j=1:32
105 | fprintf (fid,' defb 0x%s \n',frames{j,i});
106 | end
107 | fprintf (fid,'\n');
108 | end
109 | fclose(fid);
110 |
111 | % salvare in binario qui
112 | fid = fopen([name '_frm.bin'],'w');
113 | for i=1:size(frames,2)
114 | for j=1:32
115 | fwrite (fid,hex2dec(frames{j,i}));
116 | end
117 | end
118 | fclose(fid);
119 |
120 | !miz\MSX-O-Mizer.exe -r ms_demo_frm.bin miz\ms_demo_frm.bin.miz
121 |
122 |
123 | Y = Y1(17:32,:);
124 |
125 | minx = zeros(size(Y,2),1);
126 | maxx = zeros(size(Y,2),1);
127 | miny = zeros(size(Y,2),1);
128 | maxy = zeros(size(Y,2),1);
129 |
130 | h = 1;
131 | for k = 1:16:size(Y,2)
132 |
133 | A = Y(:,k:(k+15));
134 |
135 | for x = 1:16
136 | if any(A(:,x))
137 | minx(h) = x;
138 | break;
139 | end
140 | end
141 | for x = 16:-1:1
142 | if any(A(:,x))
143 | maxx(h) = x;
144 | break;
145 | end
146 | end
147 | for x = 1:16
148 | if any(A(x,:))
149 | miny(h) = x;
150 | break;
151 | end
152 | end
153 | for x = 16:-1:1
154 | if any(A(x,:))
155 | maxy(h) = x;
156 | break;
157 | end
158 | end
159 | %[h minx(h) maxx(h) miny(h) maxy(h)]
160 | h = h+1;
161 | end
162 |
163 | fid = fopen([name '_frm_coll_wind.asm'],'w');
164 | fprintf (fid,[name '_coll_wind:\n']);
165 | for h = 1:size(Y,2)/16
166 | fprintf (fid,' defb %d,%d,%d,%d \n',[minx(h) maxx(h)-1 miny(h) maxy(h)-1] );
167 | end
168 | fprintf (fid,'\n');
169 | fclose(fid);
170 |
--------------------------------------------------------------------------------
/sjasm/sjasmman12.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Listing format
38 |
The assembly listing shows both the source and the generated code. This can help you debugging the source (or the generated code :). The file also contains a list of symbols and an overview of outputs, pages and code parts, so you can see where Sjasm puts your code.
39 |
Assembly listing
40 |
The listing follows the source code, and not the order in which the code parts may be placed in the output.
41 |
Label listing
42 |
The label listing lists all labels preceded by the page and the value. If the label is not used, this is marked with an X. Similarly a - (minus) indicates that the code part containing this label was not referenced and not assembled. An S indicates that the label may have had other values during the assembly, because it had its value set with the := command.
43 |
The labels are listed in order of appearance. If you prefer an alphabetically sorted symbol list, you can specify this at the command line.
44 |
Temporary labels and labels defined in macros or loops are not listed.
45 |
46 | LABELS
47 | ---------------------------------------
48 | 00:00000080 X emU1
49 | 00:000000C0 X emUb
50 | 00:000000E6 S FT
51 | 00:0000010A ppInit
52 | 00:0000011B - ppExit
53 |
54 |
Output listing
55 |
Add more information here :)
56 |
57 |
72 |
76 |
77 | Copyright 2009 XL2S Entertainment
78 |
79 |
80 |
--------------------------------------------------------------------------------
/old/miz/decrunchers/datas_depacker.asm:
--------------------------------------------------------------------------------
1 | ; -------------------------------------------------------
2 | ; MSX-O-Mizer v1.5f datas depacker
3 | ; Improved from Metalbrain's z80 version.
4 | ; -------------------------------------------------------
5 | ; source in hl
6 | ; dest in de
7 |
8 | ; 328 bytes which must be aligned on 8 bits boundary
9 | mom_map_bits = 0xe000
10 |
11 | mom_depack: push de
12 | ld iy, mom_map_bits + 0xf0
13 | ld b, 52
14 | mom_init_bits: ld a, iyl
15 | and 15
16 | jr nz, mom_node
17 | ld de, 1
18 | mom_node: rrd
19 | ld (iy), a
20 | ld (iy + 36), e
21 | ld (iy + 72), d
22 | inc iyl
23 | inc a
24 | push hl
25 | ld hl, 0
26 | scf
27 | mom_set_bit: adc hl, hl
28 | dec a
29 | jr nz, mom_set_bit
30 | add hl, de
31 | ex de, hl
32 | pop hl
33 | bit 0, b
34 | jr z, mom_wait_step
35 | inc hl
36 | mom_wait_step: djnz mom_init_bits
37 | ld a, (hl)
38 | inc hl
39 | ld ixh, a
40 | pop de
41 | mom_lit_copy: ldi
42 | mom_main_loop: call mom_get_bit
43 | jr c, mom_lit_copy
44 | ld c, -17
45 | mom_get_index: call mom_get_bit
46 | inc c
47 | jr nc, mom_get_index
48 | ld a, c
49 | ret z
50 | push de
51 | call mom_get_pair
52 | push bc
53 | jr nz, mom_out_range
54 | ld de, 0x0220
55 | dec c
56 | jr z, mom_go_for_it
57 | ld de, 0x0410
58 | dec c
59 | jr z, mom_go_for_it
60 | mom_out_range: ld de, 0x0400
61 | mom_go_for_it: pop af
62 | ex af, af'
63 | call mom_get_bits
64 | add a, e
65 | call mom_get_pair
66 | pop de
67 | push hl
68 | ld h, d
69 | ld l, e
70 | sbc hl, bc
71 | ex af, af'
72 | push af
73 | pop bc
74 | ldir
75 | pop hl
76 | jr mom_main_loop
77 | mom_get_pair: ld iyl, a
78 | ld d, (iy)
79 | call mom_get_bits
80 | add (iy + 36)
81 | ld c, a
82 | ld a, b
83 | adc (iy + 72)
84 | ld b, a
85 | ret
86 | mom_get_bits: ld bc, 0
87 | mom_getting_bits: dec d
88 | ld a, c
89 | ret m
90 | call mom_get_bit
91 | rl c
92 | rl b
93 | jr mom_getting_bits
94 | mom_get_bit: ld a, ixh
95 | add a
96 | jr nz, mom_byte_done
97 | ld a, (hl)
98 | inc hl
99 | rla
100 | mom_byte_done: ld ixh, a
101 | ret
102 |
--------------------------------------------------------------------------------
/sjasm/sjasmman8.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
File handling
37 |
Sjasm can include files as text or as binary. If you include the file as text it will be processed as if it was part of the source file. If you include the file as binary it will be put in to the output without any processing.
38 |
Binary include
39 |
With INCBIN you can include any file. The file is not processed in any way, and directly put into the output as-is. You can specify the offset and the length, if you don't the whole file will be included.
40 |
41 | incbin gfx.plet6 ; include the whole file
42 | incbin boe.bin,7 ; include boe.bin but skip the first 7 bytes
43 | incbin rantab,,1024 ; include the first 1024 bytes
44 | incbin a.bat,1,2 ; include the second and the third byte
45 |
46 |
You can use INCBIN.LIST instead of just INCBIN to list the included data in the list file.
47 |
Source include
48 |
You can use INCLUDE to include another source file into the current.
49 |
50 | include more.i
51 | include "more.i"
52 |
53 |
If the file cannot be found in the current directory (the current directory is the directory the current file comes from), the file will be searched for in the directories specified at the command line or specified with INCDIR. When angle brackets are used, the command line directories are searched before the current directory:
54 |
55 | include <vdp.i>
56 |
57 |
you can specify the directories to look in at the command line, or with the INCDIR command:
58 |
59 | incdir sourcedir
60 |
61 |
62 |
77 |
81 |
82 | Copyright 2009 XL2S Entertainment
83 |
84 |
85 |
--------------------------------------------------------------------------------
/sjasm/sjasmman10.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Loops
39 |
Sjasm supports two loop statements: REPEAT and WHILE. You can use the REPEAT and WHILE statements to repeat a block of statements a number of times.
40 |
Repeat
41 |
REPEAT repeats the block of statements between REPEAT and ENDREPEAT the given number of times. @# Will contain the number of iterations, starting with 0.
42 |
43 | repeat 3
44 | byte @#
45 | endrepeat
46 |
47 |
expands to:
48 |
49 | byte 0
50 | byte 1
51 | byte 2
52 |
53 |
While
54 |
WHILE repeats the block as long as its argument is not zero. Again, @# contains the number of iterations and the block should end with ENDWHILE.
55 |
56 | counter:=3
57 | while counter
58 | byte counter,@#
59 | counter:=counter-1
60 | endwhile
61 |
62 |
expands to:
63 |
64 | byte 3,0
65 | byte 2,1
66 | byte 1,2
67 |
68 |
Nested loops
69 |
Loops can be nested and you can use @@#, @@@# and so on the access the number of iterations of the outer loops:
70 |
71 | repeat 2
72 | repeat 3
73 | byte @#,@@#
74 | endrepeat
75 | endrepeat
76 |
77 |
expands to:
78 |
79 | byte 0,0
80 | byte 1,0
81 | byte 2,0
82 | byte 0,1
83 | byte 1,1
84 | byte 2,1
85 |
86 |
Exit and continue
87 |
To exit a loop, use BREAK. You could use this to exit an endless loop:
88 |
89 | while 1
90 | l:=l+1
91 | if l=3
92 | break
93 | endif
94 | endwhile
95 |
96 |
To continue with the next iteration, use CONTINUE:
97 |
98 | repeat 5
99 | if @#<3
100 | continue
101 | endif
102 | byte @#
103 | endrepeat
104 |
105 |
this outputs:
106 |
107 | byte 3
108 | byte 4
109 |
110 |
111 |
126 |
130 |
131 | Copyright 2009 XL2S Entertainment
132 |
133 |
134 |
--------------------------------------------------------------------------------
/old/miz/decrunchers/datas_depacker_rom.asm:
--------------------------------------------------------------------------------
1 | ; -------------------------------------------------------
2 | ; MSX-O-Mizer v1.5f datas depacker *ROM based version*
3 | ; Improved from Metalbrain's z80 version.
4 | ; -------------------------------------------------------
5 | ; source in hl
6 | ; dest in de
7 |
8 | ; 328 bytes which must be aligned on 8 bits boundary
9 | mom_map_bits_rom = 0xe000
10 | ; 26 bytes located in ram
11 | mom_offset_table = 0xe000 + 328
12 |
13 | mom_depack_rom: push de
14 | ld bc, mom_offset_table
15 | push bc
16 | ld de, bc
17 | ld bc, 26
18 | ldir
19 | push hl
20 | pop af
21 | pop hl
22 | push af
23 | ld iy, mom_map_bits_rom + 0xf0
24 | ld b, 52
25 | mom_init_bits_rom: ld a, iyl
26 | and 15
27 | jr nz, mom_node_rom
28 | ld de, 1
29 | mom_node_rom: rrd
30 | ld (iy), a
31 | ld (iy + 36), e
32 | ld (iy + 72), d
33 | inc iyl
34 | inc a
35 | push hl
36 | ld hl, 0
37 | scf
38 | mom_set_bit_rom: adc hl, hl
39 | dec a
40 | jr nz, mom_set_bit_rom
41 | add hl, de
42 | ex de, hl
43 | pop hl
44 | bit 0, b
45 | jr z, mom_wait_step_rom
46 | inc hl
47 | mom_wait_step_rom: djnz mom_init_bits_rom
48 | pop hl
49 | ld a, (hl)
50 | inc hl
51 | ld ixh, a
52 | pop de
53 | mom_lit_copy_rom: ldi
54 | mom_main_loop_rom: call mom_get_bit_rom
55 | jr c, mom_lit_copy_rom
56 | ld c, -17
57 | mom_get_index_rom: call mom_get_bit_rom
58 | inc c
59 | jr nc, mom_get_index_rom
60 | ld a, c
61 | ret z
62 | push de
63 | call mom_get_pair_rom
64 | push bc
65 | jr nz, mom_out_range_rom
66 | ld de, 0x0220
67 | dec c
68 | jr z, mom_go_for_it_rom
69 | ld de, 0x0410
70 | dec c
71 | jr z, mom_go_for_it_rom
72 | mom_out_range_rom: ld de, 0x0400
73 | mom_go_for_it_rom: pop af
74 | ex af, af'
75 | call mom_get_bits_rom
76 | add a, e
77 | call mom_get_pair_rom
78 | pop de
79 | push hl
80 | ld h, d
81 | ld l, e
82 | sbc hl, bc
83 | ex af, af'
84 | push af
85 | pop bc
86 | ldir
87 | pop hl
88 | jr mom_main_loop_rom
89 | mom_get_pair_rom: ld iyl, a
90 | ld d, (iy)
91 | call mom_get_bits_rom
92 | add (iy + 36)
93 | ld c, a
94 | ld a, b
95 | adc (iy + 72)
96 | ld b, a
97 | ret
98 | mom_get_bits_rom: ld bc, 0
99 | mom_getting_bits_rom:
100 | dec d
101 | ld a, c
102 | ret m
103 | call mom_get_bit_rom
104 | rl c
105 | rl b
106 | jr mom_getting_bits_rom
107 | mom_get_bit_rom: ld a, ixh
108 | add a
109 | jr nz, mom_byte_done_rom
110 | ld a, (hl)
111 | inc hl
112 | rla
113 | mom_byte_done_rom: ld ixh, a
114 | ret
115 |
--------------------------------------------------------------------------------
/sccaudio.asm:
--------------------------------------------------------------------------------
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 | ;
3 | ; Mapper Konami 5 (mapper + scc)
4 | ;
5 | ; Bank 1: 5000h - 57FFh (5000h used)
6 | ; Bank 2: 7000h - 77FFh (7000h used)
7 | ; Bank 3: 9000h - 97FFh (9000h used)
8 | ; Bank 4: B000h - B7FFh (B000h used)
9 |
10 | Bank1 equ 0x5000
11 | Bank2 equ 0x7000
12 | Bank3 equ 0x9000
13 | Bank4 equ 0xB000
14 |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 | ;
17 |
18 | ; Audio_init_code:
19 |
20 | ; ; some ayFX init
21 |
22 | ; call ayFX_SETUP
23 |
24 | ; ; some PT3 init
25 |
26 | ; call PT3_MUTE
27 |
28 | ; ; some scc init
29 |
30 | ; call _SCC_PSG_Volume_balance
31 | ; ret
32 |
33 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34 | ;
35 | ; compute SCC/PSG Volume balance
36 | ;
37 |
38 |
39 | _SCC_PSG_Volume_balance:
40 |
41 | ld a,(_psg_vol_fix)
42 | add a,15
43 | jr nz,1f
44 | inc a
45 | 1:
46 | add a,a ; a:=a*2
47 | add a,a ; a:=a*4
48 | add a,a ; a:=a*8
49 | add a,a ; a:=a*16
50 | ld e,a ; e:=a
51 | ld d,0 ; de:=a
52 | ld hl,VT_ ; hl:=PT3 volume table
53 | add hl,de ; hl is a pointer to the relative volume table
54 |
55 | ld (_psg_vol_balance),hl
56 |
57 | ld a,(_scc_vol_fix)
58 | add a,15
59 | jr nz,1f
60 | inc a
61 | 1:
62 | add a,a ; a:=a*2
63 | add a,a ; a:=a*4
64 | add a,a ; a:=a*8
65 | add a,a ; a:=a*16
66 | ld e,a ; e:=a
67 | ld d,0 ; de:=a
68 | ld hl,VT_ ; hl:=PT3 volume table
69 | add hl,de ; hl is a pointer to the relative volume table
70 |
71 | ld (_scc_vol_balance),hl
72 | ret
73 |
74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
75 | ;
76 | ; Interrupt handler
77 | ;
78 |
79 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
80 | ; Audio I/O
81 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
82 |
83 | ; --- Place this instruction on interrupt ---
84 | ; --- or after HALT instruction to synchronize music ---
85 | no_music:
86 | xor a
87 | LD H,A
88 | LD L,A
89 | LD ( AYREGS+AR_AmplA),A
90 | LD ( AYREGS_CPY+AR_AmplA),A
91 | LD ( AYREGS+AR_AmplB),HL
92 | LD ( AYREGS_CPY+AR_AmplB),HL
93 | ld a,010111111B
94 | ld (AYREGS+AR_Mixer),a
95 | ld (AYREGS_CPY+AR_Mixer),a
96 | jp ayFX_FRAME ; Calculates PSG values for next frame
97 |
98 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
99 | ; Audio Internal code
100 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
101 | Audio_Internal_code:
102 |
103 | ; Only if musics are in ROM
104 | ld a,(music_flag)
105 | and a
106 | jr z,no_music
107 |
108 | ld a,010111111B
109 | ld (AYREGS+7),a
110 |
111 | ex af,af' ; preserve af'
112 | push af
113 | call PT3_PLAY ; Calculates PSG values for next frame
114 | pop af
115 | ex af,af'
116 |
117 | ld hl,AYREGS
118 | ld de,AYREGS_CPY
119 | ld bc,13
120 | ldir ; save a copy of AY register to avoid that SCCROUT get affected by AYFX
121 | 1:
122 | ; --- PSG/SCC volume balance
123 | ; psg attenuation - only for music
124 |
125 | ld de,(_psg_vol_balance)
126 |
127 | ld hl,(AYREGS+8)
128 | ld b,h
129 | ld h,0
130 | add hl,de
131 | ld c,(hl)
132 |
133 | ld l,b
134 | ld h,0
135 | add hl,de
136 | ld b,(hl)
137 | ld (AYREGS+8),bc
138 |
139 | ld a,(AYREGS+10)
140 | ld l,a
141 | ld h,0
142 | add hl,de
143 | ld a,(hl)
144 | ld (AYREGS+10),a
145 |
146 |
147 | ; --- PSG/SCC volume balance
148 | ; scc attenuation - only for music
149 |
150 | ld de,(_scc_vol_balance)
151 |
152 | ld hl,(AYREGS_CPY+8)
153 | ld b,h
154 | ld h,0
155 | add hl,de
156 | ld c,(hl)
157 |
158 | ld l,b
159 | ld h,0
160 | add hl,de
161 | ld b,(hl)
162 | ld (AYREGS_CPY+8),bc
163 |
164 | ld a,(AYREGS_CPY+10)
165 | ld l,a
166 | ld h,0
167 | add hl,de
168 | ld a,(hl)
169 | ld (AYREGS_CPY+10),a
170 |
171 | ; ayFX player section
172 |
173 | ; --- To speed up VDP writes you can place this instruction after all of them, but before next INT ---
174 | jp ayFX_FRAME ; Calculates PSG values for next frame
175 |
176 |
177 | ;-------------------------------------
178 |
179 | PT3_ROUT:
180 | XOR A
181 |
182 | LD HL,AYREGS+7
183 | set 7,(hl) ; --- FIXES BITS 6 AND 7 OF MIXER ---
184 | res 6,(hl) ; --- FIXES BITS 6 AND 7 OF MIXER ---
185 |
186 | LD C,0xA0
187 | LD HL,AYREGS
188 | _LOUT:
189 | OUT (C),A
190 | INC C
191 | OUTI
192 | DEC C
193 | INC A
194 | CP 13
195 | JR NZ,_LOUT
196 | RET
197 |
198 |
199 |
200 |
201 | ;-------------------------------------
202 |
203 |
204 |
205 |
206 |
--------------------------------------------------------------------------------
/sjasm/sjasmman5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Z80 Assembly syntax
39 |
In general Sjasm follows the original Zilog notation for the instructions.
40 |
Differences with Z80 mnemonics:
41 |
You can use S and NS (sign/no sign) instead of the M and P conditions.
42 | You can use JP HL, JP IX and JP IY instead of JP (HL) and so on.
43 | You can use brackets instead of parenthesis for indirection. So LD A,[HL] is the same as LD A,(HL). You can enforce the use of brackets with a command line option.
44 | The A register is optional as operand with some instructions. ADD 3 and ADD A,3 are the same.
45 |
46 |
Undocumented instructions
47 |
As you probably know the Z80 recognizes more instructions than just the official ones. Sjasm recognizes all undocumented instructions, so you can use:
48 |
ixl, ixh, iyl and iyh registers
49 | sll or sli
50 | out (c),0
51 | in (c) or in f,(c)
52 | rlc (ix+0),b and friends
53 |
54 |
R800 CPU
55 |
For some reason the designers of the R800 did not implement all of the Z80 instructions. Because of this none of the undocumented instructions of the Z80 work on the R800, except the use of the ixl, ixh, iyl and iyh registers.
56 |
Sjasm does not understand the official R800 mnemonics, so you should use the corresponding Z80 ones. MULUB and MULUW are of course recognized.
57 |
Extended instructions
58 |
In the best Sjasm tradition, in addition to the real undocumented instructions some fake extended instructions have been added.
59 |
In all places where a 16 bit register pair is used as an indirection, you can add a ++ increment or a -- decrement operator. There should be no space between the register and the operator. Both pre and post increment and decrement are supported.
60 |
Examples:
61 |
62 | ld a,(hl++) ; ld a,(hl)\ inc hl
63 | ld a,(++bc) ; inc bc\ ld a,(bc)
64 | ld (iy++ +5),b ; ld (iy+5),b\ inc iy
65 | add a,(--ix) ; dec ix\ add a,(ix+0)
66 | bit 1,(hl--) ; bit 1,(hl)\ dec hl
67 |
68 |
This does not work with the stack pointer, so EX (SP++),HL does not work.
69 |
Some jump instructions have also been 'improved'. If you use DJNZ. (with dot) instead of DJNZ, Sjasm will use DEC B\ JP NZ,x if the jump target is out of range. Similarly, JP. and JR. use JR where possible, and JP if not.
70 |
Z80 instruction set
71 |
72 |
87 |
91 |
92 | Copyright 2009 XL2S Entertainment
93 |
94 |
95 |
--------------------------------------------------------------------------------
/mothership_sequence.asm:
--------------------------------------------------------------------------------
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 | ; initialize the level assuming tiles and colours in place
3 | just_level_init:
4 | xor a
5 | ld (anispeed),a
6 | xor a
7 | ld (aniframe),a
8 | ld (anispeed),a
9 | ld (ms_state),a
10 | ld a,8
11 | ld (dxmap),a
12 |
13 | ld hl,0
14 | ld (xmap),hl
15 | ld bc,xship_rel
16 | add hl,bc
17 | ld (xship),hl
18 | ld a,64+64-8
19 | ld (yship),a
20 |
21 | call ms_ctrl.intro
22 | call put_ms_sprt
23 | call npc_init
24 | call plot_enemy
25 |
26 |
27 | call enpage2
28 | ei
29 | ld a,(next_level)
30 | call levelinit
31 | call enpage3
32 |
33 | ld a,-1
34 | ld (joystick),a ;prevent fake commands
35 | ei
36 | ret
37 |
38 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39 | ; initialize the mother ship sequence
40 | ; and exit from mother ship
41 | ;
42 | intro_anim:
43 | di
44 | call disscr
45 |
46 | xor a
47 | ld (ingame),a
48 |
49 | xor a
50 | ld (anispeed),a
51 | ld a,-2
52 | ld (dxmap),a
53 | ld a,ms_fly__left
54 | ld (ms_state),a
55 | ld a,16
56 | ld (aniframe),a
57 |
58 | ld hl,2
59 | ld (xmap),hl
60 | ld bc,xship_rel-18
61 | add hl,bc
62 | ld (xship),hl
63 |
64 | ld hl,dummy
65 | ld de,0x1C00+8*3*32
66 | call print_strf
67 |
68 | call enpage2
69 | ei
70 | xor a
71 | ld (cur_level),a
72 | call levelinit
73 | call enpage3
74 | ei
75 |
76 | call shuttle_init
77 |
78 | ld a,192
79 | ld (yship),a
80 | call put_ms_sprt
81 | call npc_init
82 | call plot_enemy
83 |
84 | call ayFX_SETUP
85 |
86 | ld a,-1
87 | ld (joystick),a ;prevent fake commands
88 | ld a,1
89 | ld (reverse_sat),a
90 | ld a,-1
91 | ld (ingame),a
92 | call _sat_update
93 | call enascr
94 | ei
95 | halt
96 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,
97 |
98 | ld a,7 ; start level sound
99 | call AFXPLAY
100 |
101 | call exit_sequence
102 |
103 | ld hl,2
104 | ld (xmap),hl
105 | ld bc,xship_rel
106 | add hl,bc
107 | ld (xship),hl
108 |
109 | fake_main:
110 |
111 | call test_lev1
112 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
113 | ; run ms FSM and place its sprites in the SAT in RAM
114 | call ms_ctrl.intro
115 |
116 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
117 | ; test for game restart
118 | ld a,(ms_state)
119 | cp ms_reset
120 | ret z
121 |
122 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
123 | ; place MS in the SAT and test for collision
124 | call put_ms_sprt
125 |
126 | ld hl,JIFFY
127 | xor a
128 | 1:
129 | cp (hl)
130 | jr z,1b
131 | ld (hl),a
132 |
133 | ld a,(dxmap)
134 | cp 9
135 | jr z,1f
136 | inc a
137 | ld (dxmap),a
138 | 1:
139 | ld hl,(xmap)
140 | ld a,(dxmap)
141 | [2] sra a
142 | ld e,a
143 | add a,a
144 | sbc a,a
145 | ld d,a
146 | add hl,de
147 | ld (xmap),hl
148 |
149 | ld bc,xship_rel
150 | add hl,bc
151 | ld (xship),hl
152 |
153 | jr fake_main
154 |
155 |
156 | test_lev1:
157 | ld ix,runways
158 | ld e,(ix+obj_data.x)
159 | ld d,(ix+obj_data.x+1)
160 | ld c,(ix+obj_data.xsize)
161 |
162 | ld hl,(xship)
163 | ld b,16
164 |
165 | call CalcCollision
166 | ret nc
167 |
168 | ld hl,warping
169 | ld de,0x1C00+8*3*32
170 | call print_strf
171 |
172 | ; set stripes instead of stars
173 | call warp_tile
174 |
175 | ld a,20 ; warping sound
176 | call AFXPLAY
177 |
178 | call enpage2
179 | ei
180 | ld a,(next_level)
181 | call levelinit
182 |
183 | call enpage3
184 | ei
185 |
186 | call tile_init
187 |
188 | ld a,ms_reset
189 | ld (ms_state),a
190 | ret
191 |
192 | warp_tile:
193 | ld de,0x0800+255*8+0x4000
194 | call 1f
195 | ld de,0x1000+255*8+0x4000
196 | ; call 1f
197 | ; ret
198 |
199 | 1:
200 | di
201 | ld a,e
202 | out (0x99),a
203 | ld a,d
204 | out (0x99),a
205 |
206 | ld bc,0x398
207 | ld a,-1
208 | 1: out (c),a
209 | nop
210 | djnz 1b
211 | ei
212 | ret
213 |
214 | exit_sequence:
215 | ld ix,enemies
216 | ld de,enemy_data
217 |
218 | ld (ix+enemy_data.status),1
219 | ld (ix+enemy_data.frame),2*4
220 | ld (ix+enemy_data.kind),254
221 | ld (ix+enemy_data.color),4
222 | ld (ix+enemy_data.y),56+64-1
223 | ld (ix+enemy_data.x),104-2
224 | ld (ix+enemy_data.x+1),0
225 | add ix,de
226 | ld (ix+enemy_data.status),1
227 | ld (ix+enemy_data.frame),2*4
228 | ld (ix+enemy_data.kind),254
229 | ld (ix+enemy_data.color),5
230 | ld (ix+enemy_data.y),56+64-1
231 | ld (ix+enemy_data.x),104-8-2
232 | ld (ix+enemy_data.x+1),0
233 |
234 | ld a,64+64-8
235 | ld (yship),a
236 |
237 | ld hl,(xmap)
238 | ld de,xship_rel-18
239 | add hl,de
240 | ld (xship),hl
241 |
242 | ld b,18
243 | 1: ld hl,(xmap)
244 | add hl,de
245 | ld (xship),hl
246 | inc de
247 | exx
248 | ld b,64
249 | call put_ms_sprt.landing
250 | [6] call 99f
251 | exx
252 | djnz 1b
253 |
254 | ld ix,enemies
255 | ld (ix+enemy_data.status),0
256 | ld (ix+enemy_data+enemy_data.status),0
257 | call test_runway.fakemain
258 | ret
259 |
260 | 99: call test_runway.fakemain
261 | di
262 | _setvdpwvram (0x3800+2*32)
263 | ld b,32
264 | ld a,-1
265 | 2: out (0x98),a
266 | nop
267 | djnz 2b
268 | ei
269 | ret
270 |
271 |
272 |
--------------------------------------------------------------------------------
/old/miz/decrunchers/datas_depacker_vram.asm:
--------------------------------------------------------------------------------
1 | ; -------------------------------------------------------
2 | ; MSX-O-Mizer v1.5f datas depacker *VRAM version*
3 | ; Improved from Metalbrain's z80 version.
4 | ; -------------------------------------------------------
5 | ; source in hl
6 | ; dest (in vram) in de
7 | ; (interrupts better be disabled during the depacking)
8 |
9 | ; 328 bytes which must be aligned on 8 bits boundary
10 | mom_map_bits_vram = 0xe000
11 |
12 | mom_depack_vram: push de
13 | ld iy, mom_map_bits_vram + 0xf0
14 | ld b, 52
15 | mom_init_bits_vram: ld a, iyl
16 | and 15
17 | jr nz, mom_node_vram
18 | ld de, 1
19 | mom_node_vram: rrd
20 | ld (iy), a
21 | ld (iy + 36), e
22 | ld (iy + 72), d
23 | inc iyl
24 | inc a
25 | push hl
26 | ld hl, 0
27 | scf
28 | mom_set_bit_vram: adc hl, hl
29 | dec a
30 | jr nz, mom_set_bit_vram
31 | add hl, de
32 | ex de, hl
33 | pop hl
34 | bit 0, b
35 | jr z, mom_wait_step_vram
36 | inc hl
37 | mom_wait_step_vram: djnz mom_init_bits_vram
38 | ld a, (hl)
39 | inc hl
40 | ld ixh, a
41 | pop de
42 | mom_lit_copy_vram: ld a, (hl)
43 | inc hl
44 | call mom_write_byte_vram
45 | mom_main_loop_vram: call mom_get_bit_vram
46 | jr c, mom_lit_copy_vram
47 | ld c, -17
48 | mom_get_index_vram: call mom_get_bit_vram
49 | inc c
50 | jr nc, mom_get_index_vram
51 | ld a, c
52 | ret z
53 | push de
54 | call mom_get_pair_vram
55 | push bc
56 | jr nz, mom_out_range_vram
57 | ld de, 0x0220
58 | dec c
59 | jr z, mom_go_for_it_vram
60 | ld de, 0x0410
61 | dec c
62 | jr z, mom_go_for_it_vram
63 | mom_out_range_vram: ld de, 0x0400
64 | mom_go_for_it_vram: pop af
65 | ex af, af'
66 | call mom_get_bits_vram
67 | add a, e
68 | call mom_get_pair_vram
69 | pop de
70 | push hl
71 | ld h, d
72 | ld l, e
73 | sbc hl, bc
74 | ex af, af'
75 | push af
76 | pop bc
77 | mom_copy_bytes_to_vram:
78 | ld a, l
79 | out (0x99), a
80 | ld a, h
81 | nop
82 | out (0x99), a
83 | inc hl
84 | in a, (0x98)
85 | call mom_write_byte_vram
86 | dec bc
87 | ld a, b
88 | or c
89 | jr nz, mom_copy_bytes_to_vram
90 | pop hl
91 | jr mom_main_loop_vram
92 | mom_get_pair_vram: ld iyl, a
93 | ld d, (iy)
94 | call mom_get_bits_vram
95 | add (iy + 36)
96 | ld c, a
97 | ld a, b
98 | adc (iy + 72)
99 | ld b, a
100 | ret
101 | mom_get_bits_vram: ld bc, 0
102 | mom_getting_bits_vram:
103 | dec d
104 | ld a, c
105 | ret m
106 | call mom_get_bit_vram
107 | rl c
108 | rl b
109 | jr mom_getting_bits_vram
110 | mom_get_bit_vram: ld a, ixh
111 | add a
112 | jr nz, mom_byte_done_vram
113 | ld a, (hl)
114 | inc hl
115 | rla
116 | mom_byte_done_vram: ld ixh, a
117 | ret
118 | mom_write_byte_vram:
119 | push af
120 | ld a, e
121 | out (0x99), a
122 | ld a, d
123 | or 0x40
124 | out (0x99), a
125 | pop af
126 | inc de
127 | out (0x98), a
128 | ret
129 |
--------------------------------------------------------------------------------
/ms_bllts.asm:
--------------------------------------------------------------------------------
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 | ; activate ms bullets
3 | ;
4 | max_bullet_rate equ 5
5 |
6 | ms_shoot:
7 | ld a,(bullet_rate)
8 | and a
9 | jp z,.book_bullet
10 | dec a
11 | ld (bullet_rate),a
12 | ret
13 | .book_bullet:
14 | ld a,max_bullet_rate
15 | ld (bullet_rate),a
16 |
17 | ld ix,ms_bullets
18 | ld b,max_bullets
19 | ld de,enemy_data
20 | 1: bit 0,(ix+enemy_data.status)
21 | jr z,.activate_this
22 | add ix,de
23 | djnz 1b
24 | ret
25 |
26 | .activate_this:
27 | xor a ; ms bullet
28 | call AFXPLAY
29 |
30 | ld a,(ms_state) ; in states 0-3 ms faces right
31 | and 0x04
32 | jr nz,.shootsx
33 | .shootdx
34 | ld (ix+enemy_data.status),1
35 | ld hl,8
36 | jp 1f
37 |
38 | .shootsx
39 | ld (ix+enemy_data.status),1 + 64
40 | ld hl,-8
41 | 1:
42 | ld a,(aniframe)
43 | and 7
44 | add a,8
45 | add a,a
46 | add a,a
47 | ld (ix+enemy_data.frame),a
48 |
49 | call set_size ; set xoff,yoff,xsize,ysize for sprite collision
50 |
51 | ld a,(dxmap)
52 | [2] sra a
53 | ld e,a
54 | rla
55 | sbc a,a
56 | ld d,a
57 |
58 | add hl,de
59 | ld (ix+enemy_data.speed),l
60 | ld (ix+enemy_data.speed+1),h
61 |
62 | ld hl,(xship)
63 | ld (ix+enemy_data.x),l
64 | ld (ix+enemy_data.x+1),h
65 |
66 | ld a,(yship)
67 | ld (ix+enemy_data.y),a
68 | ld (ix+enemy_data.cntr),17
69 | ret
70 |
71 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
72 | ; manage active ms bullets
73 | ;
74 |
75 | bullet_loop:
76 | ld ix,ms_bullets
77 |
78 | repeat max_bullets
79 | bit 0,(ix+enemy_data.status)
80 | jr z,1f
81 |
82 | ; move right or left
83 |
84 | ld l,(ix+enemy_data.x)
85 | ld h,(ix+enemy_data.x+1)
86 | ld e,(ix+enemy_data.speed)
87 | ld d,(ix+enemy_data.speed+1)
88 | add hl,de
89 | ld (ix+enemy_data.x),l
90 | ld (ix+enemy_data.x+1),h
91 |
92 | call .test_obstacles
93 |
94 | dec (ix+enemy_data.cntr)
95 | jr nz,1f
96 | res 0,(ix+enemy_data.status)
97 | 1:
98 | ld de,enemy_data
99 | add ix,de
100 | endrepeat
101 | ret
102 |
103 |
104 | .test_obstacles:
105 | ld e,(ix+enemy_data.frame)
106 | ld d,0
107 | ld iy,ms_bllts_col_win-32
108 | add iy,de ; here iy points to the collision window of the current frame of the bullet
109 |
110 | bit 7,(ix+enemy_data.speed+1)
111 | jr z,2f ;.x_positive
112 |
113 | ld e,(iy+0) ;.x_negative:
114 | jp 3f
115 |
116 | 2: ld e,(iy+1) ;.x_positive:
117 |
118 | 3:
119 | ld l,(ix+enemy_data.x)
120 | ld h,(ix+enemy_data.x+1)
121 | add hl,de
122 | ld a,(ix+enemy_data.y)
123 | add a,(iy+2)
124 | push hl
125 | push af
126 | call .tst_block
127 | pop de
128 | pop hl
129 | ret z ; skip the rest if already hit
130 | ld a,d
131 | and 0xF8
132 | ld d,a
133 | ld a,(ix+enemy_data.y)
134 | add a,(iy+3)
135 | and 0xF8
136 | cp d
137 | ret z ; avoid testing twice the same tile
138 | jp .tst_block
139 |
140 |
141 | .tst_block:
142 | call test_obstacles.meta_tile_peek
143 | ld e,a
144 | dec a ; deal with space apart
145 | cp nblock-1
146 |
147 | jp nc,.no_blocking ; a>22
148 |
149 | .blocking:
150 | res 0,(ix+enemy_data.status)
151 | ld a,10 ; hit solid wall
152 | call AFXPLAY
153 | xor a
154 | ret ; obstacle found - return Z
155 |
156 | .no_blocking:
157 | cp nblock+n_d2x1-1
158 | jp nc,.no_2x1 ; a>26
159 |
160 | cp nblock+1
161 | jr c,.left2x1 ; two 2x1 items
162 |
163 | .right2x1:
164 | ld a,(hl)
165 | add a,n_d2x1
166 | ld (hl),a
167 | dec hl
168 | jr 1f
169 |
170 | .left2x1:
171 | ld a,(hl)
172 | add a,n_d2x1
173 | ld (hl),a
174 | inc hl
175 | 1: ld a,(hl)
176 | add a,n_d2x1
177 | ld (hl),a
178 |
179 | res 0,(ix+enemy_data.status)
180 | ld a,11 ; destroy small ground item
181 | call AFXPLAY
182 | ld bc,5 ; score for destruction of a small ground item
183 | call add_bc_score_bin
184 |
185 | call land_now_test ; make LAND NOW arrive sooner
186 | ret
187 |
188 | .no_2x1:
189 |
190 | cp nblock+n_d2x1*2-1
191 | jr z,.left_up3x2
192 | cp nblock+n_d2x1*2+0
193 | jr z,.left_dw3x2
194 | cp nblock+n_d2x1*2+1
195 | jr z,.left_up3x2
196 | cp nblock+n_d2x1*2+2
197 | jr z,.left_dw3x2
198 |
199 | cp nblock+n_d2x1*2+7
200 | jr z,.right_up3x2
201 | cp nblock+n_d2x1*2+8
202 | jr z,.right_dw3x2
203 | cp nblock+n_d2x1*2+9
204 | jr z,.right_up3x2
205 | cp nblock+n_d2x1*2+10
206 | jr z,.right_dw3x2
207 |
208 | ret ; obstacle not found - return NZ
209 |
210 | .left_dw3x2:
211 | ld bc,-LvlWidth
212 | add hl,bc
213 | jr .left_up3x2
214 |
215 | .right_up3x2:
216 | [2] dec hl
217 | jr .left_up3x2
218 |
219 | .right_dw3x2:
220 | ld bc,-LvlWidth-2
221 | add hl,bc
222 |
223 | .left_up3x2:
224 | repeat 3
225 | ld a,(hl)
226 | add a,n_d3x2
227 | ld (hl),a
228 | inc hl
229 | endrepeat
230 | ld bc,LvlWidth-3
231 | add hl,bc
232 | repeat 3
233 | ld a,(hl)
234 | add a,n_d3x2
235 | ld (hl),a
236 | inc hl
237 | endrepeat
238 |
239 | res 0,(ix+enemy_data.status)
240 | ld a,12 ; destroy large ground item
241 | call AFXPLAY
242 | ld bc,50 ; score for destruction of a large ground item
243 | call add_bc_score_bin
244 |
245 | call land_now_test ; make LAND NOW arrive sooner
246 | ret
247 |
248 |
249 |
--------------------------------------------------------------------------------
/show_instructions.asm:
--------------------------------------------------------------------------------
1 |
2 |
3 | instruct:
4 | db 0x99+' ',0x9A+' '," Avoid barriers and other",13
5 | db 0x9B+' ',0x9C+' '," tall obstacles",13
6 | db 0x9D+' ',0x9E+' ',13
7 | db 0x84+' ',0x86+' '," Press up/down + X to spin",13
8 | db 0x85+' ',0x87+' '," and pass between barriers",13
9 | db 0x80+' ',0x82+' '," Use looping to avoid",13
10 | db 0x81+' ',0x83+' '," enemy bullets",13
11 | db 0x88+' ',0x89+' ',0x88+' ',13
12 | db 0x8B+' ',0x8C+' ',0x8B+' '," Destroy ground targets",13
13 | db 0x8D+' ',0x8E+' ',0x8F+' '," to weaken Dreadnought's",13
14 | db 0x90+' ',0x91+' ',0x92+' '," defense",13
15 | db 0x88+' ',0x93+' ',0x94+' ',13
16 | db 0x88+' ',0x95+' ',0x96+' ',13
17 | db "Land on the main runway of",13
18 | db "each Dreadnought and activate",13
19 | db "its self destruction system",13
20 |
21 |
22 | show_instructions:
23 | call cls
24 | call _color_set
25 | call _destr_set
26 |
27 | ld de,instruct
28 | ld hl,0x1800+32*1+2
29 | call prstr
30 | ld hl,0x1800+32*2+2
31 | call prstr
32 | ld hl,0x1800+32*3+2
33 | call prstr
34 |
35 | ld hl,0x1800+32*5+2
36 | call prstr
37 | ld hl,0x1800+32*6+2
38 | call prstr
39 |
40 | ld hl,0x1800+32*8+2
41 | call prstr
42 | ld hl,0x1800+32*9+2
43 | call prstr
44 |
45 | ld hl,0x1800+32*11+2
46 | call prstr
47 | ld hl,0x1800+32*12+2
48 | call prstr
49 | ld hl,0x1800+32*13+2
50 | call prstr
51 | ld hl,0x1800+32*14+2
52 | call prstr
53 | ld hl,0x1800+32*15+2
54 | call prstr
55 | ld hl,0x1800+32*16+2
56 | call prstr
57 |
58 | ld hl,0x1800+32*18+2
59 | call prstr
60 | ld hl,0x1800+32*19+2
61 | call prstr
62 | ld hl,0x1800+32*20+2
63 | call prstr
64 |
65 | ld de,0x1800+32*22+8
66 | call setwrtvram
67 | ld bc,0x1098
68 | 1: ld hl,runway_map
69 | outi
70 | nop
71 | nop
72 | outi
73 | jr nz,1b
74 | ld hl,runway_map
75 | outi
76 |
77 | ld de,0x1800+32*23+8
78 | call setwrtvram
79 | ld bc,0x1098
80 | 1: ld hl,runway_map+2
81 | outi
82 | nop
83 | nop
84 | outi
85 | jr nz,1b
86 | ld hl,runway_map+2
87 | outi
88 |
89 | ei
90 |
91 | 3:
92 | xor a
93 | ld (aniframe),a
94 |
95 | 2: halt
96 | call plot_spt_char_anim
97 | ld b,10
98 | 1: halt
99 | djnz 1b
100 |
101 | ld a,(aniframe)
102 | inc a
103 | ld (aniframe),a
104 | cp 32
105 | jr z,3b
106 |
107 | call joy_read
108 | and 0x13 ; up/down/fire
109 | jp nz,return
110 |
111 | jr 2b
112 |
113 |
114 | plot_spt_char_anim:
115 | setvdpwvram 0x0400
116 | ld a,(aniframe)
117 | and 7
118 | call 1f
119 | setvdpwvram 0x0C00
120 | ld a,(aniframe)
121 | and 7
122 | call 1f
123 | ; setvdpwvram 0x1400
124 | ; ld a,(aniframe)
125 | ; and 7
126 | ; call 1f
127 |
128 | setvdpwvram 0x0420
129 | ld a,(aniframe)
130 | and 15
131 | add a,32
132 | call 1f
133 | setvdpwvram 0x0C20
134 | ld a,(aniframe)
135 | and 15
136 | add a,32
137 | ; call 1f
138 | ; setvdpwvram 0x1420
139 | ; ld a,(aniframe)
140 | ; and 15
141 | ; add a,32
142 | ; call 1f
143 | ; ret
144 |
145 | 1: ld hl,ms_ani
146 | ld c,a
147 | ld b,0
148 | add hl,bc
149 | ld l,(hl)
150 | ld h,b
151 | add hl,hl
152 | add hl,hl
153 | add hl,hl
154 | add hl,hl
155 | add hl,hl
156 | ld e,l
157 | ld d,h
158 | add hl,hl
159 | add hl,de
160 | ld de,ms_spt
161 | add hl,de
162 | ld bc,0x2098
163 | 1: outi
164 | jr nz,1b
165 | ret
166 |
167 | ; set colours
168 | _color_set
169 | setvdpwvram (0x2000+128*8)
170 | call 1f
171 | setvdpwvram (0x2800+128*8)
172 | call 1f
173 | setvdpwvram (0x3000+128*8)
174 | 1: ld b,8*8
175 | 1: ld a,0xF1
176 | out (0x98),a
177 | djnz 1b
178 | ret
179 |
180 | _destr_set:
181 | halt
182 | setvdpwvram (0x0000+136*8)
183 | call 2f
184 | setvdpwvram (0x0800+136*8)
185 | call 2f
186 | setvdpwvram (0x1000+136*8)
187 | call 2f
188 |
189 | setvdpwvram (0x2000+136*8)
190 | call 1f
191 | setvdpwvram (0x2800+136*8)
192 | call 1f
193 | setvdpwvram (0x3000+136*8)
194 | 1:
195 | ld hl,destruct_colors
196 | ld bc,23*8*256+0x98
197 | 11: outi
198 | jr nz,11b
199 | ret
200 | 2:
201 | ld hl,destruct_tiles
202 | ld bc,23*8*256+0x98
203 | 11: outi
204 | jr nz,11b
205 | ret
206 |
207 |
208 | destruct_tiles:
209 | incbin destr_shape.bin
210 | runway_shape:
211 | db 0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x01
212 | db 0x01,0x07,0xC0,0x00,0x00,0x00,0x00,0xFF
213 | barrier_shape:
214 | db 0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40 ;
215 | db 0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02 ;
216 | db 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 ;
217 | db 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 ;
218 | db 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80 ;
219 | db 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01 ;
220 |
221 | destruct_colors:
222 | incbin destr_col.bin
223 | runway_col:
224 | db 0x55,0x44,0x44,0x44,0x44,0xA4,0x4A,0x4A
225 | db 0x4A,0x4A,0xA4,0x44,0x44,0x44,0x44,0x11
226 | barrier_col:
227 | db 0x4C,0xC4,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C
228 | db 0x1C,0xC1,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C
229 | db 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C
230 | db 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C
231 | db 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0xC4,0x4C
232 | db 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xC1,0x1C
233 |
234 |
235 | ; destruct_map
236 | ; db 0x00,0x01,0x00
237 | ; db 0x03,0x04,0x03
238 | ; db 0x05,0x06,0x07
239 | ; db 0x08,0x09,0x0A
240 | ; db 0x00,0x0B,0x0C
241 | ; db 0x00,0x0D,0x0E
242 | runway_map:
243 | db 0x8D,0x97
244 | db 0x90,0x98
245 |
--------------------------------------------------------------------------------
/intro.asm:
--------------------------------------------------------------------------------
1 |
2 |
3 | text:
4 | db "HEWSON & Trilobyte",13
5 | db "presents",13
6 | db 127,128,129,130,131,132,133,134,13
7 | db 135,136,137,138,136,139,140,141,13
8 | db "@ Graftgold Ltd.",13
9 | db "Original C64 design:",13
10 | db "Andrew Braybrook",13
11 | db "MSX remake:",13
12 | db "ARTRAG - code",13
13 | db "Toni Galvez - graphic & sfx",13
14 | db "John Hassink - music",13
15 | db "Eric Boez - cover & testing",13
16 | db "Bieno Marti - testing",13
17 |
18 |
19 |
20 |
21 | prstr:
22 | ex de,hl
23 | call setwrtvram
24 | ex de,hl
25 | 1: ld a,(de)
26 | inc de
27 | cp 13
28 | ret z
29 | add a,-'!'+1
30 | out (0x98),a
31 | jr 1b
32 |
33 | cls:
34 | _setvdpwvram 0x1800
35 | xor a
36 | ld b,192
37 | 1: call set4
38 | djnz 1b
39 | ret
40 |
41 | print_page:
42 | di
43 | call cls
44 |
45 | ld de,text
46 | ld hl,0x1800+32*1+7
47 | call prstr
48 | ld hl,0x1800+32*3+12
49 | call prstr
50 | ld hl,0x1800+32*5+12
51 | call prstr
52 | ld hl,0x1800+32*6+12
53 | call prstr
54 | ld hl,0x1800+32*8+8
55 | call prstr
56 | ld hl,0x1800+32*10+1
57 | call prstr
58 | ld hl,0x1800+32*11+9
59 | call prstr
60 | ld hl,0x1800+32*13+1
61 | call prstr
62 | ld hl,0x1800+32*14+8
63 | call prstr
64 | ld hl,0x1800+32*15+3
65 | call prstr
66 | ld hl,0x1800+32*16+2
67 | call prstr
68 | ld hl,0x1800+32*17+5
69 | call prstr
70 | ld hl,0x1800+32*18+3
71 | call prstr
72 | ret
73 |
74 | ; ld a,(victory)
75 | ; and a
76 | ; ret z
77 |
78 | ; _setvdpwvram (0x1800+32*10)
79 | ; xor a
80 | ; ld (victory),a ; avoid greetings if you play another time and die
81 | ; ld b,a
82 | ; 1: out (0x98),a
83 | ; djnz 1b
84 | ; ld b,32
85 | ; 1: out (0x98),a
86 | ; djnz 1b
87 |
88 | ; ld de,greetings
89 | ; ld hl,0x1800+32*10+5
90 | ; call prstr
91 | ; ld hl,0x1800+32*12+3
92 | ; call prstr
93 | ; ld hl,0x1800+32*13+2
94 | ; call prstr
95 | ; ld hl,0x1800+32*14+7
96 | ; call prstr
97 | ; ld hl,0x1800+32*15+8
98 | ; call prstr
99 | ; ld hl,0x1800+32*16+8
100 | ; call prstr
101 | ; ld hl,0x1800+32*17+6
102 | ; call prstr
103 | ; ld hl,0x1800+32*18+8
104 | ; call prstr
105 |
106 | ; ret
107 |
108 |
109 |
110 | set4:
111 | repeat 4
112 | out (0x98),a
113 | push af
114 | pop af
115 | endrepeat
116 | ret
117 |
118 | plot_title_screen:
119 | di
120 | call disscr
121 |
122 | ; set shapes
123 | _setvdpwvram 0x0000
124 | repeat 3
125 | ld hl,ram_tileset
126 | call write_256
127 | endrepeat
128 |
129 | ; set colours
130 | _setvdpwvram 0x2000
131 | ld bc,0x0003
132 | 1: ld a,0x51
133 | call set4
134 | ld a,0x41
135 | call set4
136 | djnz 1b
137 | dec c
138 | jr nz,1b
139 |
140 | _setvdpwvram (0x2000+95*8)
141 | ld b,8*8
142 | ld a,0x60
143 | 1: out (0x98),a
144 | djnz 1b
145 | ld b,7*8
146 | ld a,0xD0
147 | 1: out (0x98),a
148 | djnz 1b
149 |
150 | xor a
151 | ld (toshiba_switch),a
152 |
153 | ; ld a,(victory)
154 | ; and a
155 | ; push af
156 | ; call z,intro_music
157 | ; pop af
158 | ; call nz,ending_music
159 |
160 | call intro_music
161 |
162 | call menu0
163 |
164 | 1: ld a,(ayFX_PRIORITY)
165 | inc a
166 | jr nz,1b ; wait for last sfx
167 |
168 | call PT3_MUTE
169 | ret
170 |
171 |
172 |
173 | ;Ln B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
174 | ; 0 "7" "6" "5" "4" "3" "2" "1" "0"
175 | ; 1 ";" "]" "[" "\" "=" "-" "9" "8"
176 | ; 2 "B" "A" ??? "/" "." "," "'" "`"
177 | ; 3 "J" "I" "H" "G" "F" "E" "D" "C"
178 | ; 4 "R" "Q" "P" "O" "N" "M" "L" "K"
179 | ; 5 "Z" "Y" "X" "W" "V" "U" "T" "S"
180 | ; 6 F3 F2 F1 CODE CAP GRAPH CTR SHIFT
181 | ; 7 RET SEL BS STOP TAB ESC F5 F4
182 | ; 8 RIGHT DOWN UP LEFT DEL INS HOME SPACE
183 |
184 | ;;;;;;;;;;;;;;;;;;;;
185 | ; Keyboard testing
186 | ayFX_test:
187 |
188 | ld a,(ayFX_PRIORITY)
189 | cp 255
190 | ret nz ; play only if no sfx is active
191 |
192 | ld e,3 ; 3 "J" "I" "H" "G" "F" "E" "D" "C"
193 | call checkkbd
194 | ld b,8
195 | ld c,a
196 | 1:
197 | ld a,b
198 | dec a
199 | ld l,a
200 | ld a,c
201 | add a,a
202 | ld c,a
203 | push bc
204 | ld a,l
205 | call nc,_ayFX_INIT
206 | pop bc
207 | djnz 1B
208 |
209 | ld e,4 ; 4 "R" "Q" "P" "O" "N" "M" "L" "K"
210 | call checkkbd
211 | ld b,8
212 | ld c,a
213 | 1:
214 | ld a,b
215 | dec a
216 | add a,8
217 | ld l,a
218 | ld a,c
219 | add a,a
220 | ld c,a
221 | push bc
222 | ld a,l
223 | call nc,_ayFX_INIT
224 | pop bc
225 | djnz 1B
226 |
227 | ld e,5 ; 5 "Z" "Y" "X" "W" "V" "U" "T" "S"
228 | call checkkbd
229 | ld b,8
230 | ld c,a
231 | 1:
232 | ld a,b
233 | dec a
234 | add a,16
235 | ld l,a
236 | ld a,c
237 | add a,a
238 | ld c,a
239 | push bc
240 | ld a,l
241 | call nc,_ayFX_INIT
242 | pop bc
243 | djnz 1B
244 | ret
245 | _ayFX_INIT:
246 | cp n_sfx+1
247 | ret nc
248 | jp AFXPLAY
249 |
250 | intro_music:
251 | di
252 | call enpage3
253 | ld hl,mus_intro-100+16
254 | call PT3_INIT
255 | ld hl,mus_intro
256 | call wavemap_init
257 | call ayFX_SETUP
258 | call enpage2
259 | ei
260 | ret
261 | ending_music:
262 | di
263 | call enpage3
264 | ld hl,mus_end-100+16
265 | call PT3_INIT
266 | ld hl,mus_end
267 | call wavemap_init
268 | call ayFX_SETUP
269 | call enpage2
270 | ei
271 | ret
--------------------------------------------------------------------------------
/rominit64.asm:
--------------------------------------------------------------------------------
1 |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 | ; set pages and subslot
4 | ;
5 |
6 |
7 | ENASLT: equ 024h
8 | RSLREG: equ 0138h
9 | EXPTBL: equ 0FCC1h ; Bios Slot / Expansion Slot
10 |
11 |
12 | ; ----------------------------
13 | ; pre-set main slot for page 3
14 | ; and set sub-slot for page 3
15 | ; ----------------------------
16 | macro mainslot_setup n
17 | and 3
18 | [2] rrca
19 | and 0xC0
20 | ld c,a
21 | ld a,d
22 | and 0x3F
23 | or c
24 | ld c,a ; Primary slot value with main slot in page 3
25 |
26 | ld a,b
27 | and 0x0C
28 | [2] rrca
29 | and 3
30 | ld b,a ; B = Expanded slot in page 3
31 | ld a,c
32 | out (0A8h),a ; Slot : Main Slot, xx, xx, Main slot
33 | ld a,(0FFFFh)
34 | cpl
35 | if (n<=4)
36 | [n] RLCA
37 | else
38 | [8-n] RRCA
39 | endif
40 | and 0xFC
41 | or b
42 | if (n<=4)
43 | [n] RRCA
44 | else
45 | [8-n] RLCA
46 | endif
47 | ld (0FFFFh),a ; Expanded slot selected
48 | ld b,a ; save for later
49 | endmacro
50 |
51 |
52 | ; ------------------------------
53 | ; SEARCH_SLOT
54 | ; look for the slot of our rom
55 | ; active in page 1
56 | ; ------------------------------
57 |
58 | search_slot:
59 | call RSLREG
60 | [2] rrca
61 | and 3
62 | ld c,a
63 | ld b,0
64 | ld hl,EXPTBL
65 | add hl,bc
66 | ld a,(hl)
67 | and 080h
68 | or c
69 | ld c,a
70 | [4] inc hl
71 | ld a,(hl)
72 | and 0Ch
73 | or c
74 | ld (slotvar),a
75 | ret
76 |
77 | ; ------------------------------
78 | ; look for the slot of ram
79 | ; active in page 3
80 | ; ------------------------------
81 |
82 | search_slotram:
83 | di
84 | call RSLREG
85 | [2] rlca
86 | and 3
87 | ld c,a
88 | ld b,0
89 | ld hl,EXPTBL
90 | add hl,bc
91 | ld a,(hl)
92 | and 080h
93 | jr z,search_slotram0
94 | or c
95 | ld c,a
96 | [4] inc hl
97 | ld a,(hl)
98 | [4] rlca
99 | and 0Ch
100 | search_slotram0:
101 | or c
102 | ld (slotram),a
103 | ret
104 |
105 | ; ------------------------------
106 | ; SETROMPAGE0
107 | ; Set the chart in
108 | ; Page 0
109 | ; -----------------------------
110 |
111 | setrompage0:
112 | ld a,(slotvar)
113 | jp setslotpage0
114 |
115 | setrompage2:
116 | ld a,(slotvar)
117 | jp setslotpage2
118 |
119 | setrampage2:
120 | ld a,(slotram)
121 | jp setslotpage2
122 |
123 | setrompage3:
124 | ld a,(slotvar)
125 | jp setslotpage3
126 |
127 | setrampage3:
128 | ld a,(slotram)
129 | jp setslotpage3
130 |
131 | ; ------------------------------
132 | ; RECBIOS
133 | ; set the bios ROM
134 | ; -------------------------------
135 | recbios:
136 | ld a,(EXPTBL)
137 |
138 | ; ---------------------------
139 | ; SETSLOTPAGE0
140 | ; Set the slot passed in A
141 | ; at page 0 in the Z80 address space
142 | ; A: Format FxxxSSPP
143 | ; ----------------------------
144 |
145 | setslotpage0:
146 | di
147 | ld b,a ; B = Slot param in FxxxSSPP format
148 | in a,(0A8h)
149 | and 0xFC
150 | ld d,a ; D = Primary slot value
151 | ld a,b
152 | and 3
153 | or d
154 | ld d,a ; D = Final Value for primary slot
155 | ld a,b ; Check if expanded
156 | bit 7,a
157 | jr z,1f ; Not Expanded
158 | mainslot_setup 0
159 | 1: ld a,d ; A = Final value
160 | out (0A8h),a ; Slot Final. Ram, rom c, rom c, Main
161 | ret
162 |
163 | ; ---------------------------
164 | ; SETSLOTPAGE1
165 | ; Set the slot passed in A
166 | ; at page 1 in the Z80 address space
167 | ; A: Format FxxxSSPP
168 | ; ----------------------------
169 |
170 | setslotpage1:
171 | di
172 | ld b,a ; B = Slot param in FxxxSSPP format
173 | in a,(0A8h)
174 | [2] RRCA
175 | and 0xFC
176 | ld d,a ; D = Primary slot value
177 | ld a,b
178 | and 3
179 | or d
180 | [2] RLCA
181 | ld d,a ; D = Final Value for primary slot
182 | ld a,b ; Check if expanded
183 | bit 7,a
184 | jr z,1f ; Not Expanded
185 | mainslot_setup 6
186 | 1: ld a,d ; A = Final value
187 | out (0A8h),a ; Slot Final. Ram, rom c, rom c, Main
188 | ret
189 |
190 |
191 | ; ---------------------------
192 | ; SETSLOTPAGE2
193 | ; Set the slot passed in A
194 | ; at page 2 in the Z80 address space
195 | ; A: Format FxxxSSPP
196 | ; ----------------------------
197 |
198 | setslotpage2:
199 | di
200 | ld b,a ; B = Slot param in FxxxSSPP format
201 | in a,(0A8h)
202 | [4] RLCA
203 | and 0xFC
204 | ld d,a ; D = Primary slot value
205 | ld a,b
206 | and 3
207 | or d
208 | [4] RRCA
209 | ld d,a ; D = Final Value for primary slot
210 | ld a,b ; Check if expanded
211 | bit 7,a
212 | jr z,1f ; Not Expanded
213 | mainslot_setup 4
214 | 1: ld a,d ; A = Final value
215 | out (0A8h),a ; Slot Final. Ram, rom c, rom c, Main
216 | ret
217 |
218 | ; ---------------------------
219 | ; SETSLOTPAGE3
220 | ; Set the slot passed in A
221 | ; at page 3 in the Z80 address space
222 | ; A: Format FxxxSSPP
223 | ; ----------------------------
224 |
225 | setslotpage3:
226 | di
227 | ld b,a ; B = Slot param in FxxxSSPP format
228 | in a,(0A8h)
229 | [2] RLCA
230 | and 0xFC
231 | ld d,a ; D = Primary slot value
232 | ld a,b
233 | and 3
234 | or d
235 | [2] RRCA
236 | ld d,a ; D = Final Value for primary slot
237 | ld a,b ; Check if expanded
238 | bit 7,a
239 | jr z,1f ; Not Expanded
240 | mainslot_setup 2
241 | 1: ld a,d ; A = Final value
242 | out (0A8h),a ; Slot Final. Ram, rom c, rom c, Main
243 | ret
244 |
--------------------------------------------------------------------------------
/scorebar.asm:
--------------------------------------------------------------------------------
1 | test_1up:
2 | and a
3 | sbc hl,de
4 | ret nc
5 | add hl,de ; hl = score
6 | add hl,bc ; hl = score + newpts
7 | and a
8 | sbc hl,de
9 | ret c ; if newscore < 20.000 returns
10 | exx
11 | ld a,18 ; one up
12 | call AFXPLAY
13 | ld c,1 ; show lives on screen
14 | call add_c_lives_bin
15 | exx
16 | ret
17 |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 | ; in BC the score to be added
20 | ;
21 | add_bc_score_bin:
22 | ld hl,(score_bin)
23 | ld de,0x4E20 ; 20.000 points
24 | call test_1up
25 | ld hl,(score_bin)
26 | ld de,0x9C40 ; 40.000 points
27 | call test_1up
28 | ld hl,(score_bin)
29 | ld de,0xEA60 ; 60.000 points
30 | call test_1up
31 |
32 |
33 | ld hl,(score_bin)
34 | add hl,bc
35 | ld (score_bin),hl
36 | ld e,l
37 | ld d,h
38 | ld hl,(score_bin+2)
39 | ld bc,0
40 | adc hl,bc
41 | ld (score_bin+2),hl
42 |
43 | ld bc,score-4
44 | call long2ascii
45 |
46 | ; ld a,13 ; CR
47 | ; ld (de),a
48 |
49 | ld hl,score
50 | ld de,0x1C08+9*32
51 | jp print_str
52 |
53 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54 | ; in C the lives to be added
55 | add_c_lives_bin:
56 | ld a,(lives_bin)
57 | add a,c
58 | jr 1f
59 | sub_c_lives_bin:
60 | ld a,(lives_bin)
61 | sub a,c
62 | 1: daa
63 | ld (lives_bin),a
64 | ld e,a
65 | ld hl,lives
66 | [4] rrca
67 | and $0f
68 | add a,'0'
69 | ld (hl),a
70 | inc hl
71 | ld a,e
72 | and $0f
73 | add a,'0'
74 | ld (hl),a
75 | ; inc hl
76 | ; ld a,13 ; CR
77 | ; ld (hl),a
78 |
79 | ld hl,lives ; show lives on screen
80 | ld de,0x1C08+8*32
81 | jp print_str
82 |
83 |
84 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
85 |
86 | line1:
87 | db "Score ",13
88 | line2:
89 | db "00",13
90 |
91 |
92 | print_str:
93 | ; in hl = string terminated by 13
94 | ; in de = vram position
95 | 1:
96 | ld a,(hl)
97 | cp 13
98 | ret z
99 | call print
100 | inc hl
101 | ld a,16
102 | add a,e
103 | ld e,a
104 | ld a,d
105 | adc a,0
106 | ld d,a
107 | jp 1b
108 |
109 |
110 |
111 | print:
112 | ; in A = char
113 | ; in de = vram position
114 | push hl
115 | push de
116 | push af
117 |
118 | add a,1-'!'
119 |
120 | ld l,a
121 | ld h,0
122 | [3] add hl,hl
123 | ld bc,ram_tileset
124 | add hl,bc
125 |
126 | ld bc,0x0498
127 | call plot_tile
128 |
129 | ld a,4*32
130 | add a,e
131 | ld e,a
132 | ld a,d
133 | adc a,0
134 | ld d,a
135 |
136 | ld bc,0x0498
137 | call plot_tile
138 |
139 | pop af
140 | pop de
141 | pop hl
142 | ret
143 |
144 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
145 |
146 | land_now:
147 | db "Land now",13
148 | dummy:
149 | db " ",13
150 | warping:
151 | db " Warping",13
152 | defeated:
153 | db "Defeated",13
154 | GameOver:
155 | db "GameOver",13
156 | levelnames:
157 | db " Zinc ",13
158 | db " Lead ",13
159 | db " Copper ",13
160 | db " Silver ",13
161 | db " Iron ",13
162 | db " Gold ",13
163 | db "Platinum",13
164 | db "Tungsten",13
165 | db " Iridon ",13
166 | db "Kallisto",13
167 | db "TriAlloy",13
168 | db "Quadmium",13
169 | db "Ergonite",13
170 | db "Galactus",13
171 | db "Uridium ",13
172 |
173 |
174 | print_strf:
175 | ; in hl = string terminated by 13
176 | ; in de = vram position
177 | 1:
178 | ld a,(hl)
179 | cp 13
180 | ret z
181 | call printf
182 | inc hl
183 | ld a,16
184 | add a,e
185 | ld e,a
186 | ld a,d
187 | adc a,0
188 | ld d,a
189 | jp 1b
190 |
191 | printf:
192 | ; in A = char
193 | ; in de = vram position
194 | push hl
195 | push de
196 | push af
197 |
198 | add a,1-'!'
199 |
200 | ld l,a
201 | ld h,0
202 | [3] add hl,hl
203 | ld bc,ram_tileset
204 | add hl,bc
205 |
206 | ld bc,0x0898
207 | call plot_tile
208 |
209 | pop af
210 | pop de
211 | pop hl
212 | ret
213 |
214 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
215 |
216 | plot_tile:
217 | di
218 | ld a,e
219 | out (0x99),a
220 | ld a,d
221 | or 0x40
222 | out (0x99),a
223 |
224 | ld c,0x98
225 | xor a
226 | 1: outi
227 | nop
228 | nop
229 | nop
230 | out (c),a
231 | jp nz,1b
232 | ei
233 | ret
234 |
235 |
236 |
237 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
238 | ; IN HL:DE INPUT
239 | ; BC POINTS TO OUTPUT
240 |
241 | long2ascii:
242 | ; HL = HIGH WORD
243 | PUSH DE
244 | EXX
245 | POP HL ; HL' = LOW WORD
246 | EXX
247 |
248 | LD E,C
249 | LD D,B
250 |
251 | LD BC,-1000000000/0x10000 -1
252 | EXX
253 | LD BC,-1000000000&0xFFFF
254 | EXX
255 | CALL NUM1
256 |
257 | LD BC,-100000000/0x10000 -1
258 | EXX
259 | LD BC,-100000000&0xFFFF
260 | EXX
261 | CALL NUM1
262 |
263 | LD BC,-10000000/0x10000 -1
264 | EXX
265 | LD BC,-10000000&0xFFFF
266 | EXX
267 | CALL NUM1
268 |
269 | LD BC,-1000000/0x10000 -1
270 | EXX
271 | LD BC,-1000000&0xFFFF
272 | EXX
273 | CALL NUM1
274 |
275 | LD BC,-100000/0x10000 -1
276 | EXX
277 | LD BC,-100000&0xFFFF
278 | EXX
279 | CALL NUM1
280 |
281 | LD BC,-10000/0x10000 -1
282 | EXX
283 | LD BC,-10000&0xFFFF
284 | EXX
285 | CALL NUM1
286 |
287 | LD BC,-1000/0x10000 -1
288 | EXX
289 | LD BC,-1000&0xFFFF
290 | EXX
291 | CALL NUM1
292 |
293 | LD BC,-100/0x10000 -1
294 | EXX
295 | LD BC,-100&0xFFFF
296 | EXX
297 | CALL NUM1
298 |
299 | LD BC,-10/0x10000 -1
300 | EXX
301 | LD BC,-10&0xFFFF
302 | EXX
303 | CALL NUM1
304 |
305 | LD BC,-1/0x10000 -1
306 | EXX
307 | LD BC,-1&0xFFFF
308 | EXX
309 |
310 | NUM1:
311 | LD A,'0'-1 ; '0' IN THE TILESET
312 |
313 | 1:
314 | INC A
315 | EXX
316 | add HL,BC ; low word
317 | EXX
318 | ADC HL,BC ; high word
319 | jp C,1b
320 |
321 | EXX
322 | SBC HL,BC ; low word
323 | EXX
324 | SBC HL,BC ; high word
325 |
326 | LD (DE),A
327 | INC DE
328 | RET
329 |
--------------------------------------------------------------------------------
/sjasm/sjasmman9.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Conditional assembly
34 |
35 |
With the conditional commands you can test a condition and assemble the following block of statements or skip it, based on the condition. The condition is only checked in the first pass.
36 |
All conditional commands follow the same syntax:
37 |
38 | IF <condition>
39 | <statements>
40 | ELSEIF <condition>
41 | <statements>
42 | ELSE
43 | <statements>
44 | ENDIF
45 |
46 |
The statements following the IF command are processed when the condition is true or non-zero. The ELSEIF block is optional, and is processed when the IF condition and the previous ELSEIF conditions were not met. You can use as much ELSEIF blocks as you like. The ELSE block is also optional and can be used only once. If none of the IF and ELSEIF conditions was met, the statements following the ELSE command are processed. An if block should end with ENDIF.
47 |
Sjasm recognises the following conditional commands:
48 |
The ELSEIF variants can be constructed by placing ELSE before the IF command, for example: ELSEIFNNUM, ELSEIF, ELSEIFIN, etc.
49 |
IF <expression>
50 |
The following statements are processed if the expression evaluates to a non-zero value.
51 |
IFB <argument>
52 |
The following statements are processed if the argument is empty.
53 |
IFDEF <identifier>
54 |
The following statements are processed if the identifier is a text macro.
55 |
IFDIF <argument1>,<argument2>
56 |
The following statements are processed if argument1 is different from
57 |
argument2.
58 |
IFDIFI <argument1>,<argument2>
59 |
The case-insensitive version of IFDIF.
60 |
IFEXISTS <filename>
61 |
The following statements are processed if the file exists.
62 |
IFID <argument>
63 |
The following statements are processed if the argument could be a label.
64 |
IFIDN <argument1>,<argument2>
65 |
The following statements are processed if argument1 is identical to argument2.
66 |
IFIDNI <argument1>,<argument2>
67 |
The case-insensitive version of IFIDN.
68 |
IFIN <argument>,<list>
69 |
The following statements are processed if the argument exists in the list.
70 |
IFINI <argument>,<list>
71 |
The case-insensitive version of IFIN.
72 |
IFNUM <argument>
73 |
The following statements are processed if the argument could be a number.
74 |
IFSTR <argument>
75 |
The following statements are processed if the argument could be a string.
76 |
IFNB <argument>
77 |
The following statements are processed if the argument is not empty.
78 |
IFNDEF <identifier>
79 |
The following statements are processed if the identifier is not a text macro.
80 |
IFNEXISTS <filename>
81 |
The following statements are processed if the file does not exist.
82 |
IFNID <argument>
83 |
The following statements are processed if the argument could not be a label.
84 |
IFNNUM <argument>
85 |
The following statements are processed if the argument could not be a number.
86 |
IFNSTR <argument>
87 |
The following statements are processed if the argument could not be a string.
88 |
89 |
104 |
108 |
109 | Copyright 2009 XL2S Entertainment
110 |
111 |
112 |
--------------------------------------------------------------------------------
/sjasm/sjasmman4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Expressions
39 |
Expressions consist of labels, constants and operators.
40 |
Numeric constants
41 |
Numeric constants should always start with a digit or $, # or %. The following formats are supported:
42 |
43 | 12 decimal
44 | 12d decimal
45 | 0ch hexadecimal
46 | 0xc hexadecimal
47 | $c hexadecimal
48 | #c hexadecimal
49 | 1100b binary
50 | %1100 binary
51 | 14q octal
52 | 14o octal
53 |
54 |
All these constants can have underscores in them to group bits, nibbles, thousands or bytes and so on:
55 |
56 | 1100_001_1b ; same as 11000011b
57 | 1_200 ; same as 1200
58 |
59 |
Character constants
60 |
Character constants are single characters surrounded by single or double quotes. When double quotes are used, the following escape sequences are recognized:
61 |
62 | \\ 92
63 | \? 63
64 | \' 39
65 | \" 34
66 | \A 7
67 | \B 8
68 | \D 127
69 | \E 27
70 | \F 12
71 | \N 10
72 | \R 13
73 | \T 9
74 | \V 11
75 |
76 |
Character constants can be used in expressions. Examples would be: 'p', "\v" and '"'.
77 |
String constants
78 |
String constants are two or more characters surrounded by single or double quotes and cannot be used in expressions. When double quotes are used the same escape sequences are recognized as with character constants surrounded by double quotes. Some examples:
79 |
80 | "it's fun to be here"
81 | 'how much "fun" do you want?'
82 | "hoppa\n"
83 |
84 |
Operators
85 |
The following operators may be used in expressions:
86 |
87 | () (x) change the operator precedence
88 |
89 | $ $ current program location
90 | # # current page
91 | % % current repeat iteration
92 | : :label page of label
93 | :: ::page highest address in page
94 |
95 | ! !x logical not
96 | ~ ~x complement
97 | + +x does nothing
98 | - -x minus
99 | low low x low 8 bits of 16 bit value
100 | high high x high 8 bits of 16 bit value
101 | not not x logical not
102 |
103 | ** x**y power
104 |
105 | * x*y multiplication
106 | / x/y division
107 | % x%y modulo
108 | mod x mod y modulo
109 |
110 | + x+y addition
111 | - x-y subtraction
112 |
113 | << x<<y shift left
114 | >> x>>y shift right signed
115 | >>> x>>>y shift right unsigned
116 | shl x shl y shift left
117 | shr x shr y shift right signed
118 |
119 | <? x<?y minimum
120 | >? x>?y maximum
121 |
122 | < x<y less than
123 | > x>y greater than
124 | <= x<=y equal or less than
125 | >= x>=y equal or greater than
126 |
127 | = x=y equal
128 | == x==y equal
129 | != x!=y not equal
130 |
131 | & x&y bitwise and
132 | and x and y bitwise and
133 |
134 | ^ x^y bitwise xor
135 | xor x xor y bitwise xor
136 |
137 | | x|y bitwise or
138 | or x or y bitwise or
139 |
140 | : x:y x*256+y
141 |
142 |
Here are some examples of valid expressions:
143 |
144 | 3<<2 ; 12
145 | 1+1 ; 2
146 | high (8000h+(3&1)) ; 80h
147 | 3>?5 ; 5
148 |
149 |
Sjasm ignores overflow.
150 |
151 |
166 |
170 |
171 | Copyright 2009 XL2S Entertainment
172 |
173 |
174 |
--------------------------------------------------------------------------------
/sccwaves.asm:
--------------------------------------------------------------------------------
1 |
2 |
3 | ;--------------------------------------------------------
4 | _WAVESSCC: ; 15 instruments
5 |
6 |
7 |
8 |
9 | ds 32; empty
10 | db 242,235,234,209,219,213,219,205,202,238,225,6,4,10,17,26,8,254,8,255,5,21,27,27,53,54,31,46,38,7,254,240 ; 01_piano.wav
11 | db 43,30,15,11,250,248,236,234,237,251,2,248,3,248,237,242,239,231,253,246,14,11,0,8,239,223,240,229,1,33,47,58 ; 02_harpsch.wav
12 | db 59,59,50,38,25,15,254,234,218,205,209,223,228,233,245,3,23,45,58,57,40,13,245,223,208,200,193,199,224,254,27,49 ; 03_harp.wav
13 | ; db 210,195,203,222,255,21,33,25,20,16,0,251,245,238,253,20,27,29,22,14,9,0,246,236,232,237,2,25,33,24,253,230 ; 04_strgs.wav
14 | ; db 204,194,205,226,255,23,39,52,34,16,1,239,232,247,1,21,39,41,23,15,5,254,248,244,231,242,11,15,24,18,246,215 ; 05_slwstr.wav
15 | ; db 49,42,33,25,18,5,238,213,196,195,214,243,10,20,16,2,245,239,239,244,250,255,2,2,254,249,244,245,255,19,40,51 ; 06_flute.wav
16 | incbin "sccwavestouse\04_ldtrump.bin"
17 | incbin "sccwavestouse\05_lead.bin"
18 | incbin "sccwavestouse\06_orgue.bin"
19 | db 59,63,60,47,30,16,10,8,4,0,250,244,240,242,246,248,247,240,232,225,219,215,208,203,206,217,234,255,17,33,46,55 ; 07_fltvib.wav
20 | db 0,0,254,255,1,3,6,4,255,250,240,228,219,220,250,41,192,35,1,3,4,5,0,252,252,255,2,1,248,245,248,253 ; 08_trmpt.wav
21 | db 243,4,27,23,16,23,20,22,22,4,254,231,213,215,216,230,243,1,27,43,58,58,38,23,5,236,221,224,224,222,226,229 ; 09_strpzz.wav
22 | db 240,7,23,31,46,35,43,24,14,5,230,228,214,207,215,221,239,3,13,32,35,45,43,32,26,0,247,228,212,214,209,221 ; 10_clst.wav
23 | db 254,214,193,203,221,228,221,211,209,210,212,219,229,232,233,246,10,16,0,249,12,32,32,32,46,52,37,19,13,15,7,243 ; 11_mrmb.wav
24 | db 6,216,0,15,241,219,239,3,12,46,245,23,20,229,6,21,212,228,211,211,18,1,245,49,19,246,37,32,15,19,223,244 ; 12_vln.wav
25 | ; db 242,194,210,213,212,210,236,5,15,38,40,30,26,26,20,24,250,243,245,235,243,234,220,237,246,252,30,47,28,38,43,29 ; 13_vlnvb.wav
26 | ; db 58,63,62,57,51,47,44,43,45,49,54,58,59,60,59,59,58,58,57,57,56,56,56,55,55,54,54,54,53,53,52,52 ; 14_snrdr.wav
27 | ; db 38,209,31,234,227,231,255,13,34,44,23,248,228,255,23,34,18,8,4,2,255,254,255,246,238,237,245,243,226,215,213,17 ; 15_aaaaaaa.wav
28 | incbin "sccwavestouse\13_bass1.bin"
29 | incbin "sccwavestouse\14_scbass.bin"
30 | incbin "sccwavestouse\15_venbass.bin"
31 |
32 |
33 |
34 | ;-------------------------------------
35 | ; scc eches for PT3
36 | ;-------------------------------------
37 | SCC_REG EQU 009880h ;SCC ADDRESS FUNCTION
38 |
39 | SCCROUT:
40 | ;Frequencies
41 |
42 | ; call en_scc
43 | ; ret z
44 | ld a,03Fh
45 | ld (Bank3),a
46 |
47 | LD HL,(AYREGS_CPY+0) ; A-> ch 1
48 | LD (SCC_REG+0),HL
49 | LD HL,(AYREGS_CPY+2) ; C-> ch 2
50 | LD (SCC_REG+2),HL
51 | LD HL,(AYREGS_CPY+4) ; B-> ch 3
52 | LD (SCC_REG+4),HL
53 |
54 | ;VOLUMES
55 |
56 | ld a,(AYREGS_CPY+8)
57 | ld (SCC_REG+0x0A),a ; A-> ch 1
58 | ld a,(AYREGS_CPY+9)
59 | LD (SCC_REG+0x0B),A ; C-> ch 2
60 | ld a,(AYREGS_CPY+10)
61 | LD (SCC_REG+0x0C),A ; B-> ch 3
62 |
63 | ;MIXER
64 |
65 | ld a,(AYREGS_CPY+7)
66 | xor 7
67 | and 7
68 | ld (SCC_REG+0x0F),a
69 |
70 | ; call en_slot
71 | RET
72 |
73 |
74 | ;-------------------------------------
75 | ; A-> ch 1
76 | ; B-> ch 2
77 | ; C-> ch 3
78 |
79 |
80 | ; setsccwaves:
81 | ; di
82 | ; call en_scc
83 | ; ret z
84 |
85 | ; ld a,3fh
86 | ; ld (Bank3),a
87 |
88 | ; ld de,0x09800
89 | ; ld a,(wchA) ; A->ch1
90 | ; call sccchan
91 |
92 | ; ld a,(wchB) ; B->ch2
93 | ; call sccchan
94 |
95 | ; ld a,(wchC) ; C->ch3
96 | ; call sccchan
97 |
98 | ; call en_slot
99 | ; ret
100 |
101 |
102 | probewavechanges:
103 | ; call en_scc
104 | ; ret z
105 | exx
106 | push hl
107 | push de
108 |
109 | ld hl,OSmplA
110 |
111 | ld a,(ChanA+29)
112 | cp (hl)
113 | call nz,changeA
114 |
115 | inc hl
116 | ld a,(ChanB+29)
117 | cp (hl)
118 | call nz,changeB
119 |
120 | inc hl
121 | ld a,(ChanC+29)
122 | cp (hl)
123 | call nz,changeC
124 |
125 | pop de
126 | pop hl
127 | exx
128 |
129 | ; call en_slot
130 | ret
131 |
132 |
133 | changeA:
134 | ld (hl),a
135 | call samp2wav
136 | ld (wchA),a
137 | ld de,0x09800 ; A->ch1
138 | jp 1f
139 |
140 | changeB:
141 | ld (hl),a
142 | call samp2wav
143 | ld (wchB),a
144 | ld de,0x09800+32*1 ; B->ch2
145 | jp 1f
146 |
147 | changeC:
148 | ld (hl),a
149 | call samp2wav
150 | ld (wchC),a
151 | ld de,0x09800+32*2 ; C->ch3
152 |
153 | 1:
154 | ld c,a
155 | ld a,3fh
156 | ld (Bank3),a
157 | ld a,c
158 |
159 | sccchan:
160 | push hl
161 | ld l,a
162 | ld h,0
163 | [4] add hl,hl
164 | ld bc, _WAVESSCC
165 | add hl,bc
166 | ld bc,32
167 | ldir
168 | pop hl
169 | ret
170 |
171 |
172 |
173 |
174 | samp2wav:
175 | exx
176 | ld hl,_waves
177 | rrca
178 | ld e,a
179 | ld d,0
180 | add hl,de
181 | ld a,(hl)
182 | add a,a
183 | exx
184 | ret
185 |
186 | en_scc:
187 | ld a,[SCC]
188 | inc a
189 | ret z ; no scc
190 | in a,(0xA8) ; Leemos el registro principal de slots
191 | ld (curslot),a ; save it
192 | ld e,a
193 | ld a,(SCC)
194 | and 0x03 ; Nos fijamos en el slot primario
195 | [4] add a,a
196 | ld d,a
197 | ld a,e ; registro principal de slots
198 | and 11001111b
199 | or d
200 | out (0xA8),a
201 | ret
202 |
203 | en_slot:
204 | ld a,(curslot)
205 | out (0xA8),a
206 | ret
207 |
--------------------------------------------------------------------------------
/sjasm/sjasmman2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Source Format
39 |
In general, the format of a source line is as follows:
40 |
41 | [label[:]] [repeat] [operation [operands]] [comment]
42 |
43 |
The fields should be separated by spaces or tabs.
44 |
Labels should start in the first column and are case-sensitive: 'Start' is different from 'start'. The : (colon) is ignored.
45 |
In general, labels must not be used with assembler commands. Putting a label before IF, IFDEF, DEFINE, MACRO, WHILE, REPEAT, ENDMACRO, ENDWHILE, INCLUDE and so on will make Sjasm not recognize the command.
46 |
The repeat field is used to specify how many times the operation should be executed and should be specified within square brackets ('[' and ']'). The default is one time. Most assembler commands do not allow a repeat count.
47 |
The operation is an instruction mnemonic or an assembler command and must not start in the first column. The operation should be in the same case: 'add' and 'ADD' are recognized, but 'Add' is not.
48 |
Most instructions and commands operate on one or more operands, which should be separated by commas in most of the times.
49 |
The following example uses all fields:
50 |
51 | Maal8: [3] add a, a ; a=a*8
52 |
53 |
Comments
54 |
The assembler ignores comments. Sjasm supports two kinds of comments: line based and block based. A line based comment starts with a ; (semicolon) or a C++-like // (double slash) and ends at the end of the line. A comment may start anywhere on the source line, also on column one:
55 |
56 | ; comment
57 | ld a,7 // comment
58 |
59 |
The C-like block comment uses /* to indicate the start and */ to indicate the end of a comment. These block comments may be nested and expanded over more lines. Block comments are replaced with a space character. Some examples:
60 |
61 | ld /* comment */ a,80
62 |
63 | /*
64 | /* nested comment */
65 | */
66 |
67 | ld/*
68 | this will be ld a,3
69 | */a,3
70 |
71 |
Multi statement lines
72 |
The \ (backslash) is used as line operator. If it is placed at the end of a line (but before the comment field), the next line extends the current line:
73 |
74 | Maal8: \
75 | [3] \
76 | add \ ; backslash at the end of a line, as comments are ignored
77 | a, a ; a=a*8
78 |
79 |
When the \ is used in the middle of a line, it indicates the start of a new line:
80 |
81 | Maal8: add a,a\ add a,a\ add a,a ; a=a*8
82 |
83 |
Note the space after the backslash; it is needed here because the operation field must not start in column one.
84 |
White space killer
85 |
The >< operator removes any spaces or tabs:
86 |
87 | l >< d a,3
88 |
89 |
becomes:
90 |
91 | ld a,3
92 |
93 |
To use this operator inside strings, precede the string with a @ (at):
94 |
95 | byte @'hi >< mom!'
96 |
97 |
becomes:
98 |
99 | byte 'himom!'
100 |
101 |
This is useful for use in macros, to generate label names.
102 |
Repeat count
103 |
When you want to repeat an instruction a couple of times, you can specify how many times the instruction should be executed within square brackets ('[' and ']').
104 |
So instead of this:
105 |
106 | inc hl
107 | inc hl
108 | add a,a
109 | add a,a
110 | add a,a
111 | add a,a
112 |
113 |
you could program this:
114 |
115 | [2] inc hl
116 | [4] add a,a
117 |
118 |
You can use % to get the current iteration, starting with 0.
119 |
So
120 |
121 | [4] add a,%
122 |
123 |
is the same as:
124 |
125 | add a,0
126 | add a,1
127 | add a,2
128 | add a,3
129 |
130 |
% Might be more useful when you use it to define data.
131 |
You can repeat the repeat field, and use %%, %%% and so on the get the repeat count of the outer loops:
132 |
133 | [2][3]byte %,%%
134 |
135 |
is the same as:
136 |
137 | byte 0,0
138 | byte 1,0
139 | byte 2,0
140 | byte 0,1
141 | byte 1,1
142 | byte 2,1
143 |
144 |
145 |
160 |
164 |
165 | Copyright 2009 XL2S Entertainment
166 |
167 |
168 |
--------------------------------------------------------------------------------
/isr.asm:
--------------------------------------------------------------------------------
1 |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 | ; Interrupt service routine
4 | ;
5 |
6 | code @ 0x0038
7 | isr:
8 | push hl
9 | push de
10 | push bc
11 | push af
12 | push iy
13 | push ix
14 |
15 | ld a,(ingame)
16 | and a
17 | jp nz,1f
18 | in a,(0x99) ; exit from isr
19 | jp Music_only
20 | 1:
21 | _setVdp 5,0x37 ; SAT at 0x1b80
22 | _setVdp 6,0x03 ; SPT at 0x1800 (used from 0x1C00 to 0x1FF only 32 sprites 16x16)
23 | ; _setVdp 7,0x04
24 |
25 | call _sat_update
26 | call _plot_spt
27 |
28 | ld a,(toshiba_switch) ; Toshiba
29 | and a
30 | jr nz,.compatibilty
31 |
32 | ld a,(xmap) ; TMS
33 | and 2
34 | jp z,.other_page
35 |
36 | call disp_page0
37 |
38 | jp .this_page
39 |
40 | .other_page:
41 |
42 | call disp_page1
43 |
44 | .this_page:
45 |
46 | _setvdpwvram 0x1900
47 | call _plot_pnt
48 | jp 1f
49 |
50 | .compatibilty:
51 |
52 | _setvdpwvram 0x1900
53 | call _plot_pnt_toshiba
54 | 1:
55 | call _plot_strs
56 |
57 | ; Write values on PSG registers
58 | call PT3_ROUT
59 | call en_scc
60 | jr z,1f
61 | call probewavechanges
62 | call SCCROUT
63 | call en_slot
64 | 1:
65 |
66 | _setVdp 7,0x00
67 |
68 | 1: in a,(0x99)
69 | and 0x5F
70 | cp 0x5C ; plane 28 =0x1C
71 | jp nz,1b
72 |
73 | _setVdp 5,0x36 ; SAT at 0x1b00
74 | _setVdp 6,0x07 ; SPT at 0x3800 (64 sprites 16x16)
75 |
76 | ; _setVdp 7,0x06
77 |
78 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
79 | ld a,(vsf)
80 | and a
81 | jp nz,.PAL ; if PAL call at any interrupt
82 |
83 | .NTSC:
84 | ld hl,cnt ; if NTSC call 5 times out of 6
85 | dec (hl)
86 | jp nz,.PAL ; skip one tic out of 6 when at 60hz
87 | ld (hl),6 ; reset the tic counter
88 | jp .skip_audio ; continue
89 |
90 | .PAL: ; Calculates PSG values for next frame
91 | in a,(0xA8) ; Read the main slot register
92 | push af ; save it
93 | call enpage3
94 | call Audio_Internal_code
95 | pop af
96 | out (0xA8),a
97 | .skip_audio:
98 |
99 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
100 |
101 | 99:
102 | ld hl,JIFFY
103 | inc (hl) ; 8 bit JIFFY
104 |
105 | ; _setVdp 7,0x00
106 |
107 | pop ix
108 | pop iy
109 | pop af
110 | pop bc
111 | pop de
112 | pop hl
113 | ei
114 | ret
115 | ;;;;;;;;;;;;;;;;;;;;;;;;;;
116 | ; used in title screen
117 |
118 | Music_only:
119 | call PT3_ROUT
120 |
121 | call en_scc
122 | jr z,1f
123 | call probewavechanges
124 | call SCCROUT
125 | call en_slot
126 | 1:
127 | ;;;;;;;;;;;;;;;;;;;;;;;;;;
128 | ld a,(vsf)
129 | and a
130 | jp nz,.PAL ; if PAL call at any interrupt
131 |
132 | .NTSC:
133 | ld hl,cnt ; if NTSC call 5 times out of 6
134 | dec (hl)
135 | jp nz,.PAL ; skip one tic out of 6 when at 60hz
136 | ld (hl),6 ; reset the tic counter
137 | jp .skip_audio ; continue
138 |
139 | .PAL: ; Calculates PSG values for next frame
140 | in a,(0xA8) ; Read the main slot register
141 | push af ; save it
142 | call enpage3
143 | call Audio_Internal_code
144 | pop af
145 | out (0xA8),a
146 | .skip_audio:
147 | jp 99b
148 |
149 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150 | ; PLOT FAR STARFIELD
151 | ; input : none
152 | ;
153 | _plot_strs:
154 | ld hl,(xmap) ; x position in pixels
155 | srl h
156 | rr l
157 | srl h
158 | rr l
159 | srl h
160 | rr l
161 |
162 | ld de,level_buffer
163 | add hl,de
164 |
165 | ld de,x_stars
166 | ld ix,0x1900 + 0x4000
167 |
168 | repeat 8
169 | 2: ex de,hl
170 | ld c,(hl)
171 | inc hl
172 | ld b,(hl)
173 | inc hl
174 | ex de,hl
175 | add hl,bc
176 | add ix,bc
177 |
178 | ld a,(hl)
179 | and a
180 | jr nz,1f
181 |
182 | ld a,ixl
183 | out (0x99),a
184 | ld a,ixh
185 | out (0x99),a
186 |
187 | ld a,255
188 | out (0x98),a
189 | 1:
190 | ld bc,2*LvlWidth-2*32
191 | add hl,bc
192 | endrepeat
193 |
194 | ret
195 | x_stars:
196 | defw 28, 3-28+64,19-3+64,29-19+64,18-29+64, 5-18+64,14-5+64,26-14+64
197 | ; defw 1-18+32, 28-1+32,4-28+32,29- 4+32,20-29+32, 3-20+32, 8-3+32,26- 8+32
198 |
199 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200 | ; PLOT PNT
201 | ; input : xmap
202 | ;
203 | _plot_pnt_toshiba:
204 | ld hl,(xmap) ; x position in pixels
205 | ld a,l
206 | rrca
207 | and 0x2
208 | jp 1f
209 |
210 | _plot_pnt:
211 | ld hl,(xmap) ; x position in pixels
212 | ld a,l
213 | rrca
214 | and 0x3
215 | 1:
216 | add a,meta_pnt_table_u/256
217 | ld ixl,a
218 |
219 | srl h
220 | rr l
221 | srl h
222 | rr l
223 | srl h
224 | rr l
225 |
226 | ld de,level_buffer
227 | add hl,de
228 |
229 | ex de,hl
230 |
231 | call half_screen
232 |
233 | ld a,ixl
234 | add a,meta_pnt_table_d/256-meta_pnt_table_u/256
235 | ld ixl,a
236 |
237 | half_screen:
238 | ld c,0x98
239 | ld ixh,8
240 | 1:
241 | ld a,ixl
242 | ld h,a
243 | ld a,e
244 | add a,32
245 | jp nc,.fast_loop
246 |
247 | .slow_loop:
248 | repeat 32
249 | ld a,(de)
250 | ld l,a
251 | outi
252 | inc de
253 | endrepeat
254 |
255 | ld hl,LvlWidth-32
256 | add hl,de
257 | ex de,hl
258 |
259 | dec ixh
260 | jp nz,1b
261 |
262 | ret
263 |
264 | .fast_loop:
265 | repeat 32
266 | ld a,(de)
267 | ld l,a
268 | outi
269 | inc e
270 | endrepeat
271 |
272 | ld hl,LvlWidth-32
273 | add hl,de
274 | ex de,hl
275 |
276 | dec ixh
277 | jp nz,1b
278 |
279 | ret
280 |
281 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
282 | ;
283 | ; sprite multiplexing
284 | ;
285 |
286 | _sat_update:
287 | ld a,(reverse_sat)
288 | xor 1
289 | ld (reverse_sat),a
290 | jp nz,_reverse_sat
291 |
292 | _directsat:
293 | ld a,(visible_sprts)
294 | and 0xFC
295 | ret z
296 | ld b,a
297 | ld c,0x98
298 | ld hl,ram_sat
299 | _setvdpwvram 0x1b00
300 | 1: outi
301 | outi
302 | outi
303 | outi
304 | jp nz,1b
305 | ld a,0xD0
306 | out (0x98),a
307 | ret
308 |
309 | _reverse_sat:
310 | ld a,(visible_sprts)
311 | and 0xFC
312 | ret z
313 | ld b,a
314 | ld c,0x98
315 | ld hl,ram_sat-4+8
316 |
317 | ld e,b
318 | ld d,0
319 | add hl,de
320 | ld de,-8
321 |
322 | _setvdpwvram 0x1b00
323 | 1: add hl,de
324 | outi
325 | outi
326 | outi
327 | outi
328 | jp nz,1b
329 | ld a,0xD0
330 | out (0x98),a
331 | ret
332 |
333 |
334 |
335 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
336 | ; update main ship
337 | ;
338 |
339 | _plot_spt:
340 | ld hl,(aniframe)
341 | ld a,l
342 | cp h
343 | ret z
344 | ld (old_aniframe),a
345 | ld hl,ms_ani
346 | ld c,a
347 | ld b,0
348 | add hl,bc
349 | ld l,(hl)
350 | ld h,b
351 | add hl,hl
352 | add hl,hl
353 | add hl,hl
354 | add hl,hl
355 | add hl,hl
356 | ld e,l
357 | ld d,h
358 | add hl,hl
359 | add hl,de
360 | ld de,ms_spt
361 | add hl,de
362 | _setvdpwvram 0x3800
363 | ld c,0x98
364 | [96] outi
365 | ret
366 |
--------------------------------------------------------------------------------
/tileinit.asm:
--------------------------------------------------------------------------------
1 |
2 | ;
3 | ; load tile sets in vram
4 | tile_init:
5 |
6 | ld a,(next_level)
7 | ld l,a
8 | ld h,0
9 | add hl,hl
10 | ld bc,clr_tab
11 | add hl,bc
12 | ld c,(hl)
13 | inc hl
14 | ld b,(hl)
15 | ld (clr_table),bc
16 |
17 | l1_15_init:
18 | ; set meta pnt tables
19 | ld hl,meta_pnt_table_u_miz
20 | ld de,meta_pnt_table_u
21 | call mom_depack_rom
22 |
23 | ld hl,meta_pnt_table_d_miz
24 | ld de,meta_pnt_table_d
25 | call mom_depack_rom
26 |
27 | ; fake meta-tile for explosion
28 | ld hl,meta_pnt_table_u+254
29 | ld b,8
30 | 1: ld (hl),254
31 | inc h
32 | djnz 1b
33 |
34 | ld a,(toshiba_switch)
35 | and a
36 | jp nz,toshiba_vram_layout
37 |
38 | ; TMS
39 | ld hl,chr_tileset1_common
40 | ld de,miz_buffer
41 | call mom_depack_rom
42 | ld hl,chr_tileset1_up
43 | ld de,miz_buffer+n_common_tiles1*8
44 | call mom_depack_rom
45 | ld de,0x0800
46 | call write_2k
47 | ld hl,chr_tileset1_dw
48 | ld de,miz_buffer+n_common_tiles1*8
49 | call mom_depack_rom
50 | ld de,0x1000
51 | call write_2k
52 |
53 | ld de,0x0800+255*8
54 | call set_star_shape
55 | ld de,0x1000+255*8
56 | call set_star_shape
57 |
58 | ld hl,chr_tileset2_common
59 | ld de,miz_buffer
60 | call mom_depack_rom
61 | ld hl,chr_tileset2_up
62 | ld de,miz_buffer+n_common_tiles2*8
63 | call mom_depack_rom
64 | ld de,0x2800
65 | call write_2k
66 | ld hl,chr_tileset2_dw
67 | ld de,miz_buffer+n_common_tiles2*8
68 | call mom_depack_rom
69 | ld de,0x3000
70 | call write_2k
71 |
72 | ld de,0x2800+255*8
73 | call set_star_shape
74 | ld de,0x3000+255*8
75 | call set_star_shape
76 |
77 | ld hl,clr_tileset2_common
78 | ld de,miz_buffer
79 | call mom_depack_rom
80 | ld hl,clr_tileset2
81 | ld de,miz_buffer+n_common_tiles2*8
82 | call mom_depack_rom
83 | call clr_map
84 | ld de,0x0000
85 | call write_2k
86 |
87 | ld de,0x0000+255*8
88 | call set_star_color
89 |
90 | ld hl,clr_tileset1_common
91 | ld de,miz_buffer
92 | call mom_depack_rom
93 | ld hl,clr_tileset1
94 | ld de,miz_buffer+n_common_tiles1*8
95 | call mom_depack_rom
96 | call clr_map
97 | ld de,0x2000
98 | call write_2k
99 |
100 | ld de,0x2000+255*8
101 | call set_star_color
102 |
103 | ret
104 |
105 | toshiba_vram_layout:
106 |
107 | ; Toshiba
108 | ld hl,chr_tileset1_common
109 | ld de,miz_buffer
110 | call mom_depack_rom
111 | ld hl,chr_tileset1_up
112 | ld de,miz_buffer+n_common_tiles1*8
113 | call mom_depack_rom
114 | ld de,0x0800
115 | call write_2k
116 | ld hl,chr_tileset1_dw
117 | ld de,miz_buffer+n_common_tiles1*8
118 | call mom_depack_rom
119 | ld de,0x1000
120 | call write_2k
121 |
122 | ld de,0x0800+255*8
123 | call set_star_shape
124 | ld de,0x1000+255*8
125 | call set_star_shape
126 |
127 | ld hl,clr_tileset1_common
128 | ld de,miz_buffer
129 | call mom_depack_rom
130 | ld hl,clr_tileset1
131 | ld de,miz_buffer+n_common_tiles1*8
132 | call mom_depack_rom
133 | call clr_map
134 | ld de,0x2800
135 | call write_2k
136 | ld de,0x3000
137 | call write_2k
138 |
139 | ld de,0x2800+255*8
140 | call set_star_color
141 | ld de,0x3000+255*8
142 | call set_star_color
143 | ret
144 |
145 | shuttle_init:
146 | ; set meta pnt tables
147 | ld hl,meta_pnt_table_u_ms_miz
148 | ld de,meta_pnt_table_u
149 | call mom_depack_rom
150 |
151 | ld hl,meta_pnt_table_d_ms_miz
152 | ld de,meta_pnt_table_d
153 | call mom_depack_rom
154 |
155 | ; fake meta-tile for explosion
156 |
157 | ld hl,meta_pnt_table_u+254
158 | ld b,8
159 | 1: ld (hl),254
160 | inc h
161 | djnz 1b
162 |
163 | ; set patterns
164 | ld hl,chr_tileset0_u_ms
165 | ld de,miz_buffer
166 | call mom_depack_rom
167 | ld de,0x0800
168 | call write_2k
169 |
170 | ld hl,chr_tileset0_d_ms
171 | ld de,miz_buffer
172 | call mom_depack_rom
173 | ld de,0x1000
174 | call write_2k
175 |
176 | ld hl,chr_tileset1_u_ms
177 | ld de,miz_buffer
178 | call mom_depack_rom
179 | ld de,0x2800
180 | call write_2k
181 |
182 | ld hl,chr_tileset1_d_ms
183 | ld de,miz_buffer
184 | call mom_depack_rom
185 | ld de,0x3000
186 | call write_2k
187 |
188 | ; set colours
189 | ld hl,clr_table1
190 | ld (clr_table),hl
191 |
192 | ld hl,clr_tileset1_ms
193 | ld de,miz_buffer
194 | call mom_depack_rom
195 | call clr_map
196 | ld de,0x0000
197 | call write_2k
198 | ld de,0x0000+255*8
199 | call set_star_color
200 |
201 | ld hl,clr_tileset0_ms
202 | ld de,miz_buffer
203 | call mom_depack_rom
204 | call clr_map
205 | ld de,0x2000
206 | call write_2k
207 | ld de,0x2000+255*8
208 | call set_star_color
209 |
210 | ld a,(toshiba_switch)
211 | and a
212 | jp z,1f
213 |
214 | ; Toshiba
215 | ld de,0x2800
216 | call write_2k
217 | ld de,0x3000
218 | call write_2k
219 |
220 | ld de,0x2800+255*8
221 | call set_star_color
222 | ld de,0x3000+255*8
223 | call set_star_color
224 | 1:
225 |
226 | ld de,0x0800+255*8
227 | call set_star_shape
228 | ld de,0x1000+255*8
229 | call set_star_shape
230 |
231 | ld a,(toshiba_switch)
232 | and a
233 | ret nz
234 |
235 | ld de,0x2800+255*8
236 | call set_star_shape
237 | ld de,0x3000+255*8
238 | call set_star_shape
239 | ret
240 | _out:
241 | out (c),a
242 | ret
243 | set_star_shape:
244 | di
245 | ld a,e
246 | out (0x99),a
247 | ld a,d
248 | or 0x40
249 | out (0x99),a
250 |
251 | ld c,0x98
252 | ld a,2
253 | call _out
254 | ld a,7
255 | call _out
256 | ld a,2
257 | call _out
258 | xor a
259 | [5] call _out
260 | ei
261 | ret
262 |
263 | set_star_color:
264 | di
265 | ld a,e
266 | out (0x99),a
267 | ld a,d
268 | or 0x40
269 | out (0x99),a
270 |
271 | ld c,0x98
272 | ld a,0x70
273 | call _out
274 | ld a,0xf0
275 | call _out
276 | ld a,0x70
277 | call _out
278 | xor a
279 | [5] call _out
280 | ei
281 | ret
282 |
283 |
284 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
285 | ; *** tile set data in rom ***
286 | chr_tileset1_common:
287 | incbin chr1_common.miz
288 | chr_tileset2_common:
289 | incbin chr2_common.miz
290 |
291 | clr_tileset1_common:
292 | incbin clr1_common.miz
293 | clr_tileset2_common:
294 | incbin clr2_common.miz
295 |
296 | chr_tileset1_up:
297 | incbin chr1_up.miz
298 | chr_tileset1_dw:
299 | incbin chr1_dw.miz
300 | clr_tileset1:
301 | incbin clr1_ud.miz
302 |
303 | chr_tileset2_up:
304 | incbin chr2_up.miz
305 | chr_tileset2_dw:
306 | incbin chr2_dw.miz
307 | clr_tileset2:
308 | incbin clr2_ud.miz
309 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
310 |
311 | ; *** shuttle tile set data in rom ***
312 | ;code page 0,1
313 | chr_tileset0_u_ms:
314 | incbin chr_plain1u_ms.miz
315 | ;code page 0,1
316 | chr_tileset0_d_ms:
317 | incbin chr_plain1d_ms.miz
318 | ;code page 0,1
319 | chr_tileset1_u_ms:
320 | incbin chr_plain2u_ms.miz
321 | ;code page 0,1
322 | chr_tileset1_d_ms:
323 | incbin chr_plain2d_ms.miz
324 |
325 | ;code page 0,1
326 | clr_tileset0_ms:
327 | incbin clr_plain1_ms.miz
328 | ;code page 0,1
329 | clr_tileset1_ms:
330 | incbin clr_plain2_ms.miz
331 |
332 | ;code page 0,1
333 | meta_pnt_table_u_miz:
334 | incbin meta_pnt_table_u.miz
335 | ;code page 0,1
336 | meta_pnt_table_d_miz:
337 | incbin meta_pnt_table_d.miz
338 |
339 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
340 |
341 | ;code page 0,1
342 | meta_pnt_table_u_ms_miz:
343 | incbin meta_pnt_table_u_ms.miz
344 | ;code page 0,1
345 | meta_pnt_table_d_ms_miz:
346 | incbin meta_pnt_table_d_ms.miz
347 |
--------------------------------------------------------------------------------
/sjasm/sjasmman0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sjasm 0.42 manual - XL2S Entertainment
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
XL2S Entertainment
13 |
17 |
32 |
33 |
Introduction
40 |
Sjasm 0.4 is still not quite finished yet, and neither is this manual. Although Sjasm can do more than described here, everything that is in here should work as advertised.
41 |
New in Sjasm 0.42b8
42 |
Nothing is new, just removed some comments ~8^)
43 |
44 |
New in Sjasm 0.4 BETA 7
45 |
Fixed XOR HL,HL. This should generate an error message.
46 | Hacked EX AF,AF'.
47 | Added DEFB, DEFW and friends.
48 |
49 |
New in Sjasm 0.4 BETA 6
50 |
Fixed 'unexpected' ascmap error.
51 | Fixed error reports without list file.
52 | Fixed more small bugs.
53 | Added page range to PAGE command.
54 | Added incbin.list, jr., djnz. and jp.
55 |
56 |
New in Sjasm 0.4 BETA 5
57 |
Fixed Sjasm endless loop.
58 | Changed :: operator.
59 | Added ## code part align option.
60 | Added more text to this manual.
61 |
62 |
New in Sjasm 0.4 BETA 4
63 |
Fixed Sjasm crash while using structures.
64 | Added more flexible code part page specification.
65 |
66 |
New in Sjasm 0.4 BETA 3
67 |
Fixed WHILE loops.
68 | Improved code part sort.
69 | Added check on negative page numbers.
70 |
71 |
New in Sjasm 0.4 BETA 2
72 |
Fixed UPDATE command.
73 | Fixed jumps to numbered labels.
74 | Fixed INCBIN file length check.
75 | Added ERROR command.
76 | Added CODE! overlay code parts.
77 | Added more text to this manual.
78 |
79 |
New in Sjasm 0.4 BETA 1
80 |
Everything was new ~8^)
81 |
82 |
Differences with SjASM version 0.3
83 |
Sjasm version 0.4 is largely rewritten, and in some places the syntax and meaning of commands and operators has changed compared to previous versions of Sjasm. Some differences:
84 |
New name: Sjasm instead of SjASM.
85 | DC, DZ, ABYTEC and so on only accept strings.
86 | Character constants are 8 bit. No LD HL,'ab' anymore.
87 | Structures cannot be nested.
88 | The "16 bit fake instructions" like LD HL,DE or LDI A,(HL) have been replaced or removed.
89 | PUSH and POP can have only one operand.
90 | The way to update files has changed.
91 | Commands cannot start with a dot.
92 | Command line options have changed.
93 |
94 |
You can work your way around some of the differences by writing some macros.
95 |
Known bugs
96 |
Sjasm is still prototype-experimental-beta-like, so there may be some bugs.
97 |
If you encounter a bug, we would like to hear it. Please make sure it is a bug (in Sjasm or in this manual), and give a (small) source example if possible. Use info@xl2s.tk to contact us. Even if the bug you found is listed above, your report may be useful by giving some more information on solving the issue.
98 |
To do
99 |
In random order:
100 |
Fix the known bugs :)
101 | Make the error system look more intelligent
102 | Make the code part placement more intelligent
103 | Add command line options
104 | Maybe add some predefined functions like random, sine and such
105 | Improve this manual
106 | Make Sjasm more SjASM compatible
107 | Add timing information to the listing?
108 |
109 |
The assembling process
110 |
Sjasm will process your code a couple of times. Conceptually you could say Sjasm uses four passes:
111 |
Pass 1
112 | Pass 2
113 | Pass 3
114 | Pass 4
115 |
116 |
The first pass is the pre-processor pass. The pre-processor does the following in this order:
117 |
Remove all comments
118 | Concatenate lines you split up
119 | Process define commands
120 | Replace text macros and macro functions
121 | Process the white space killer
122 | Process other pre-processor commands like if, macro, while and struct
123 | Cut multiple statement lines in pieces
124 | Expand procedure macros
125 |
126 |
In the first pass you can only use (or reference) labels that are defined before you use them.
127 |
In the second pass Sjasm tries to figure out what values all labels should get, and in which order it should place all the code parts. It is not that difficult to make it impossible for Sjasm to do this, and make Sjasm take literally forever to complete this pass.
128 |
When all labels have the right values Sjasm generates the output in the third pass. After that, Sjasm goes over the whole code again to generate the listing file, and to see if it can generate some more error messages.
129 |
130 |
145 |
149 |
150 | Copyright 2009 XL2S Entertainment
151 |
152 |
153 |
--------------------------------------------------------------------------------
/MSX_ShiruAFX-Play_v3.asm:
--------------------------------------------------------------------------------
1 | ;;;;;;;;;;;;;;;;based on Shiru's, modified by Artrag in April 6 2014
2 | ; map 0C000h
3 | ; DATA_AREA: #
4 | ; afxNoisePeriod # 1
5 | ; afxBnkAdr # 2
6 | ; AYREGS: # 14
7 |
8 |
9 | ; descriptors channels 11 bytes to the channel:
10 | ; 0 (2) the current address (the channel is free, if the high byte = # 00)
11 | ; 2 (2) Time effect
12 | ; 4 (1) the volume
13 | ; 5 (1) bits of the mixer
14 | ; 6 (2) pitch period
15 | ; 8 (1) looping effect if != #00
16 | ; 9 (2) starting point if looping
17 |
18 | ; afxChData # 3*11
19 | ; END_DATA_AREA: #
20 | ; endmap
21 |
22 | TonA EQU 0
23 | TonB EQU 2
24 | TonC EQU 4
25 | Noise EQU 6
26 | Mixer EQU 7
27 | AmplA EQU 8
28 | AmplB EQU 9
29 | AmplC EQU 10
30 |
31 |
32 |
33 |
34 | loopingsfx equ 0 ; sfx with # up to loopingsfx (excluded) will loop, the higher # will go once
35 |
36 | ; ------------------------------------------------- ------------- ;
37 | ; Initialization player effects. ;
38 | ; Turns off all channels , sets variables . ;
39 | ; ------------------------------------------------- ------------- ;
40 |
41 | AFXINIT
42 |
43 | ld hl, sfxBank_miz
44 | ld de,miz_buffer
45 | call mom_depack_rom
46 |
47 | AFXSTOP
48 | LD HL,DATA_AREA
49 | LD (HL),0
50 | LD DE,DATA_AREA+1
51 | LD BC,END_DATA_AREA-DATA_AREA+1
52 | LDIR
53 |
54 | ld hl,miz_buffer
55 | inc hl
56 | ld (afxBnkAdr), hl; reserve table address offsets
57 |
58 | xor a
59 | ld (afxNoisePeriod), a
60 |
61 | ld hl, afxChData; mark all channels as empty
62 | ld de, #00ff
63 | ld b, 3
64 | afxInit0
65 | ld (hl), d
66 | inc hl
67 | ld (hl), d
68 | inc hl
69 | ld (hl), e
70 | inc hl
71 | ld (hl), e
72 | inc hl
73 | ld (hl), d
74 | inc hl
75 | ld (hl), e
76 | inc hl
77 | ld (hl), d
78 | inc hl
79 | ld (hl), d
80 | inc hl
81 | ld (hl), d
82 | inc hl
83 | ld (hl), d
84 | inc hl
85 | ld (hl), d
86 | inc hl
87 | djnz afxInit0
88 | ret
89 |
90 | ; ------------------------------------------------- ------------- ;
91 | ; Playback of the current frame . ;
92 | ; With no parameters . ;
93 | ; ------------------------------------------------- ------------- ;
94 |
95 | AFXFRAME
96 | ld ix, afxChData
97 | ld b, 3
98 | afxFrameLoop
99 | ld a, (ix +1) ; significant byte addresses effect
100 | or a ; if 0, the channel is not active
101 | jr z, afxFrameChSkip
102 | ld h, a
103 | ld l, (ix +0) ; low byte address effect
104 |
105 | ld a, (hl) ; read information bytes
106 | inc hl
107 |
108 | ld c, a
109 | ld (ix +5), a ; remember bits mixer
110 | and 15
111 | ld (ix +4), a ; remember volume
112 |
113 | bit 5 , c ; changing pitch period
114 | jr z, afxFrameNoTone
115 |
116 | ld a, (hl) ; remember period
117 | inc hl
118 | ld (ix +6), a
119 | ld a, (hl)
120 | inc hl
121 | ld (ix +7), a
122 |
123 | afxFrameNoTone
124 | bit 6 , c ; period change noise
125 | jr z, afxFrameNoNoise
126 | ld a, (hl) ; period obtain
127 | cp #20 ; if it is more than 31 , the effect is over
128 | jr c, afxFrameNoise
129 |
130 | ld a,(ix+ 8)
131 | and a
132 | jr z,1f
133 | ; looping effect
134 | ld l,(ix+ 9) ; restart the effect from the beginning
135 | ld h,(ix+ 10)
136 |
137 | ld (ix +0), l ; remember address
138 | ld (ix +1), h
139 |
140 | inc (ix +2) ; increment the playing time
141 | jr nz, afxFrameLoop
142 | inc (ix +3)
143 | jr afxFrameLoop
144 |
145 | 1: ; no loop
146 | xor a ; vanishes high byte address and the volume
147 | ld (ix +1), a
148 | ld (ix +4), a
149 | jr afxFrameChSkip
150 |
151 | afxFrameNoise
152 | inc hl ; remember period noise
153 | ld (afxNoisePeriod), a
154 |
155 | afxFrameNoNoise
156 |
157 | ld (ix +0), l ; remember address
158 | ld (ix +1), h
159 |
160 | inc (ix +2) ; increment the playing time
161 | jr nz, afxFrameChSkip
162 | inc (ix +3)
163 |
164 | afxFrameChSkip
165 | ld de, 11 ; the next channel
166 | add ix, de
167 | djnz afxFrameLoop
168 |
169 | ; ld a, (AYREGS + AmplA)
170 | ; ld c, a
171 | ld a, (afxChData +0 * 11 +4)
172 | ; cp c
173 | ; jr c, afxSkipCh0
174 | ld (AYREGS + AmplA), a
175 | ld a, (afxChData +0 * 11 + 6 )
176 | ld (AYREGS + TonA +0), a
177 | ld a, (afxChData +0 * 11 +7 )
178 | ld (AYREGS + TonA +1), a
179 |
180 | ld a, (AYREGS + Mixer)
181 | and %11110110
182 | ld c, a
183 | ld a, (afxChData +0 * 11 + 5 )
184 | rra
185 | rra
186 | rra
187 | rra
188 | and %00001001
189 | or c
190 | ld (AYREGS + Mixer), a
191 |
192 | afxSkipCh0
193 |
194 | ; ld a, (AYREGS + AmplB)
195 | ; ld c, a
196 | ld a, (afxChData +1 * 11 +4)
197 | ; cp c
198 | ; jr c, afxSkipCh1
199 | ld (AYREGS + AmplB), a
200 | ld a, (afxChData +1 * 11 + 6 )
201 | ld (AYREGS + TonB +0), a
202 | ld a, (afxChData +1 * 11 +7 )
203 | ld (AYREGS + TonB +1), a
204 |
205 | ld a, (AYREGS + Mixer)
206 | and %11101101
207 | ld c, a
208 | ld a, (afxChData +1 * 11 + 5 )
209 | rra
210 | rra
211 | rra
212 | and %00010010
213 | or c
214 | ld (AYREGS + Mixer), a
215 |
216 | afxSkipCh1
217 |
218 | ; ld a, (AYREGS + AmplC)
219 | ; ld c, a
220 | ld a, (afxChData +2 * 11 +4)
221 | ; cp c
222 | ; jr c, afxSkipCh2
223 | ld (AYREGS + AmplC), a
224 | ld a, (afxChData +2 * 11 + 6 )
225 | ld (AYREGS + TonC +0), a
226 | ld a, (afxChData +2 * 11 +7 )
227 | ld (AYREGS + TonC +1), a
228 |
229 | ld a, (AYREGS + Mixer)
230 | and %11011011
231 | ld c, a
232 | ld a, (afxChData +2 * 11 + 5 )
233 | rra
234 | rra
235 | and %00100100
236 | or c
237 | ld (AYREGS + Mixer), a
238 |
239 | afxSkipCh2
240 |
241 | ld ix, afxChData
242 | ld a,(ix +0 * 11 +5)
243 | and (ix +1 * 11 +5)
244 | and (ix +2 * 11 +5)
245 | rla
246 | jr c, afxNoNoise
247 | ld a, (afxNoisePeriod)
248 | ld (AYREGS + Noise), a
249 | afxNoNoise
250 |
251 | ret
252 |
253 | ; ------------------------------------------------- ------------- ;
254 | ; Running effect on the free channel. In the absence ;
255 | ; free channels selects the most long -sounding . ;
256 | ; Input : A = number of effect 0 .. 255 ;
257 | ; ------------------------------------------------- ------------- ;
258 | AFXPLAY
259 | push ix
260 | push iy
261 | ex af,af'
262 |
263 | ld ix, afxChData ; empty channel search
264 | ld de,11
265 | ld b,3
266 | 1: ld a,(ix +1)
267 | or a
268 | jr z,freechan
269 | add ix,de
270 | djnz 1b
271 | ; no free channels
272 |
273 | ld iy, afxChData ; search the channel that plays from more time
274 | ld ix, afxChData ; in case of 3 looping channels use channel A
275 | ld de, 0 ; in de the longest time while searching
276 | ld bc,11
277 | ld a, 3
278 | afxPlay0
279 | inc (iy+8)
280 | dec (iy+8)
281 | jr nz, afxPlay1 ; skip channels with looping effects
282 | ld l, (iy+2) ; compare time channel with the highest
283 | ld h, (iy+3)
284 | sbc hl,de
285 | jr c, afxPlay1
286 | add hl,de ; remember the longest time
287 | ex de,hl
288 | push iy ; remember the address of the channel in ix
289 | pop ix
290 | afxPlay1
291 | add iy,bc
292 | dec a
293 | jr nz,afxPlay0
294 | ; expect to address the effect
295 | freechan
296 | ld h, a
297 | ex af,af'
298 | ld l, a
299 | add hl, hl
300 | ld bc, (afxBnkAdr) ; address offset table effects
301 | add hl, bc
302 | ld c, (hl)
303 | inc hl
304 | ld b, (hl)
305 | add hl, bc ; effect address obtained in hl
306 |
307 | ld (ix+0), l ; record in the channel descriptor
308 | ld (ix+1), h
309 | ld (ix+2), 0 ; reset execution Time
310 | ld (ix+3), 0
311 |
312 | ld (ix+8), 0 ; reset looping flag
313 |
314 | cp loopingsfx ; up to sfx #loopingsfx-1 will loop
315 | jr nc,1f
316 |
317 | ld (ix+ 8), -1 ; set looping flag
318 | ld (ix+ 9), l ; record in the channel descriptor for later use
319 | ld (ix+10), h
320 |
321 | 1:
322 | pop iy
323 | pop ix
324 | ret
325 |
326 | ROUT:
327 | xor A ; --- FIXES BITS 6 AND 7 OF MIXER ---
328 | LD HL,AYREGS+Mixer
329 | set 7,( hl)
330 | res 6,( hl)
331 |
332 | LD C,0xA1
333 | LD HL,AYREGS
334 | 1: OUT (0xA0),A
335 | INC A
336 | OUTI
337 | CP 13
338 | JR NZ,1b
339 | RET
340 |
--------------------------------------------------------------------------------