[ゲーム][PC] SYSTEM-7c~MZ-700上で動作するウィンドウシステム
「SYSTEM-7c」
■MZ-700でウィンドウシステム
MZ-700で無茶苦茶な事をしでかすのが好きというわけではありませんが、何とSYSTEM-7cはMZ-700上で動作するウィンドウシステムです。
今ではメモリが16MB必要だとかハードディスクが1GBくらいいるぞとかいう世界ですが、このSYSTEM-7cは48KBのメモリで十分に動作します。またフロッピーディスクも使いません。なんと言ってもカセットですから(笑)。
SYSTEM-7cはゲーム用として使用されるのを前提に制作されていますので「高速かつ省メモリ」です。そのために、いくつか工夫がなされています。以下にその工夫した点を挙げてみます。
・機能単位でブロック分割ができる(使用しない機能は省ける)
・横256文字のZ80-8bit CPUとしては最高速の仮想画面設計
・なるべくハードウェアに依存しないようにしてある
・コンパクトかつ多機能
・ゲームで使用される機能、System-7Bで使用頻度の高かったものを改良
■SYSTEM-7c
SYSTEM-7cの最大の目的は「手軽にゲームを制作できる環境/ツールを制作」する事にあります。が、結果的にそれはかないませんでした。おまけに制作後、MacroMind Director (現在はMacromedia Director)というソフトと出会ってしまったのが運のツキでした。そのためMacで制作したゲームは、すべてMacromedia Directorを使用しています。つまり、SYSTEM-7cでめざした方向と、そのツールがDirectorというMacのソフトに近かったという事です。ただしVersion 3までは。Version 4になって、もっと私の理想に近くなるかと思ったのですが、あらぬ方向へと向かってしまいました。そう、オーサリングツールとしてDirectorを使う人が多くなり、マルチメディアブームにのって、さらにその傾向が濃くなってしまったのです。
■NeXTSTEP
最初に作ろうと考えていたゲーム制作ツールは、DirectorのインターフェースにNeXTSTEPのインターフェースビルダーのように、あらかじめ作ってある敵の移動アルゴリズムや表示方法などを選択するというものでした。Directorは一度作成したプログラムは、あまり流用できないのが現状です。確かにオブジェクト指向だし、コピーすればそのまま使えない事もありません。また、ハイブリッドフォーマットになっていてMacでもWindowsでも作成したデータは一応、そのまま使用することができます。これは、確かに私の理想に近いのですが、やっぱり違います。私はゲームが作りたいのであって、そのためにASCII/LOGINの提供しているXXツクールなどではなくDirectorのように汎用に使用でき、他機種でも使用できるフォーマット(言語)を書き出せるものが、欲しいのです。
■共通ゲーム言語
以前OpenSpaceというサークルを主催している時に「共通ゲーム言語は必要か?」というテーマを投げかけた事があります。が、結果的にはいらないという答えでした。なぜ、こんな共通ゲーム言語などというものを考えたかというと、「移植作業の無駄」を知っているからです。移植作業のために半年も3箇月もかかっていては駄目だ、そう思ってPostScriptのようなゲーム制作の土台となるような言語が必要だと思ったのです。
最近Internetの普及、JAVAの普及によって状況が変化しました。JAVAは機種依存しないバイトコードを生成しますから、これを土台にして手軽にゲームを作れるツールを制作しようと考えています。また、Mac/Windowsの普及のおかげでグラフィックやサウンド、そしてフォーマットなどがだいぶ整備されつつあります。またツールを作成しても今までは流通の問題がありましたが、Internetの普及によって、それもだいぶクリアされつつあります。
「もっと手軽にゲームを作れるツールを!」
これが私の目標です。
■おわりに
SYSTEM-7cは幸いにしてソースリストが残っています。
以下にソースリスト(一部文字化けしています)を掲載しておきますので、参考にしたい人はどうぞ。
転載流用自由ですが、使い道はないと思います。エミュレータでも作成すれば別ですが(笑)。
MZ Museum
http://www.shiojiri.ne.jp/~openspc/mz700/SYSTEM7c.html
http://www.shiojiri.ne.jp/~openspc/mz700/SRF.html
http://www.shiojiri.ne.jp/~openspc/mz700/MC.html
http://www.shiojiri.ne.jp/~openspc/mz700/FR.html
http://www.shiojiri.ne.jp/~openspc/mz700/SH.html
http://www.shiojiri.ne.jp/~openspc/mz700/SBFZ.html
http://www.shiojiri.ne.jp/~openspc/mz700/XEVIOUS.html
http://may.csse.muroran-it.ac.jp/~ogawa/MZMuseum/
http://www.shiojiri.ne.jp/~openspc/
SYSTEM-7c Source List / Z80 Assembler (EDASM or ZEDA)
Jump Table
--------------------- OS KERNEL ----------------------
0 ・ INIT (Initialize all subroutines)
1 ・ Version (Get Version Number)
2 ・ Check 700/1500 (Machine Check)
3 ・ Close I/O (V-RAM Close)
4 ・ Open I/O (V-RAM Open)
5 ・ Set.KVRAM.address (High-order Set)
6 ・ Read.KRAM.address (High-order Read)
7 ・ TDXY (Calculate X, Y -> KVRAM address)
8 ・ VTDXY (Calculate X, Y -> V-RAM address)
9 ・ GET.XY of KVRAM (Calculate V-RAM address -> X, Y)
10 ・ Trans40xy (Trans KVRAM -> V-RAM)
11 ・ Dual Trans40xy (Trans KVRAM -> V-RAM)
12 ・ Laster Print (High-speed 40chr Write)
13 ・ Color convert (Color Convert OLD.BF -> NEW.BF)
14 ・ SET.GET.BF (Use Polygon Fill)
15 ・ Read.GET.BF (Use Polygon Fill)
16 ・ STTM (Start Line, Enemy Beam)
17 ・ MVTM (Execute Line, Enemy Beam)
18 ・ Print Score (Print Score to KVRAM or V-RAM)
19 ・ Score Plus (Add the Score Buffer and BC-reg )
20 ・ SGN8Bit (Get Sign of A-reg)
21 ・ SET.PAUSE.MESSAGE (Pause Message Process Address Set)
22
23 ・ PAUSE (Graph key to Pause, any key to Restart)
24 ・ SET.Key.Table (Key Matrix -> Asc convert Table set)
25 ・ Read.Key.Table (Key Matrix -> Asc convert Table read)
26 ・ SET.KEY.MASK (Key Matrix Port Data Mask Table Set)
27 ・ READ.KEY.MASK (Key Matrix Port Data Mask Table Read)
28 ・ GET.Key (Get Key, ASCII Code)
29 ・ GET.Key.Port (Key Port Direct Read)
30 ・ Read.Key.BF (Key Buffer Direct Read)
31 ・ Set GAME Key (Left Hand or Right Hand Select)
32 ・ Read GAME Key (Left or Right Hand ? Data Read)
33 ・ GAME.Key (Read GAME Keys)
34 ・ Move.Fighter (Move.Fighter by GAME Key Code)
35 ・ Hantei (Check 2 Rectangle Match)
36 ・ Hantei2 (Check 1 point AREA)
37 ・ SET.Random.Value (Random Value Set)
38
39 ・ Random (16 bit Random value)
40 ・ XYCood (Swap if X1>X2 or Y1>Y2)
41 ・ XY.len (X2-X1+1, Y2-Y1+1)
42 ・ Bit.Map.OBJ (Convert Bit Map to Pixel Map)
43
44 ・ PRESS.GRAPHIC.DATA (Graphics Data Press, Run Length)
45 ・ OBJECT.DATA (Object Data)
46
47
48 ・ GET.HEX.ASC (BIN to ASC,HL=Value,DE=Buf5Byte)
49 ・ GET.DEC.ASC (BIN to ASC,HL=Value,DE=Buf5Byte)
50 ・ ZAHYO (Use Font Manager)
51 ・ COLOR.ZAHYO (Use Font Manager)
52 ・ SET.VRAM.SW (Use Font Manager)
53 ・ READ.VRAM.SW (Use Font Manager)
54
55
56 ・ Multi 8x8=16
57 ・ Division 16/8=8...8
58 ・ Multi16x16=32
59 ・ Division 32/16=32...16
60 ・ GET.VALUE.DEC (In Event Manager)
61 ・ GET.VALUE.HEX (In Event Manager)
62 ・ GAME.KEY.JUMP.ADDRESS (HAND>2)
63 ・ SET.TASK.RECORD
64 ・ READ.TASK.RECORD
65 ・ Request TASK
66 ・
--------------------- SOUND ROUTINE Ver11 ---------------------- (1B00H)
67 ・ SET.SOUND.RECORD (Set Sound Record)
68 ・ READ.SOUND.RECORD (Read Sound Record)
69 ・ SOUND.SWITCH (0=Sound Off, 1=Sound On)
70 ・ SOUND.INTERRUPT (Interrupt Call Address, A=n)
71 ・
72 ・
73 ・
--------------------- SPACE GRAPHICS ---------------------- (1E00H)
74 ・ SET.PEN.STYLE (Graphic Pen Address Style set)
75 ・ READ.PEN.STYLE (Graphic Pen Address Style read)
76 ・ SET.PEN.Put.Large&Small; (Put LS Pen Style Address set)
77 ・ READ.PEN.Put.Large&Small; (Put LS Pen Style Address read)
78
79
80 ・ PRINT.GAGE (Dot Gage Display)
81
82 ・ GET (Get Data KVRAM to Memory)
83 ・ Put.chr (Put Character data only)
84 ・ Put.over.chr (Put Character data & Mask)
85 ・ Put.atb (Pair Put.chr)
86 ・ Put.atb.cpl (Put Color data Reverse)
87 ・ Put.over.atb (Put Color data & Mask)
88 ・ Put.over.atb.cpl (Put Color data reverse & Mask)
89 ・ Put.hyp (High-speed Put)
90 ・ Put.Large&Small; (Put Resize data)
91 ・ Box.Normal (Box write by direct code)
92 ・ Box.Color (Box write by color modify)
93 ・ Box.chr (Alart Box)
94
95 ・ Box.Fill (Box.Fill by direct code)
96 ・ Box.PEN (Use PEN)
97 ・ Box.Fill.PEN (Use PEN)
98 ・ SCROLL UP (Ring Scroll Up)
99 ・ SCROLL DOWN (Ring Scroll Down)
100 ・ SCROLL LEFT (Ring Scroll Left)
101 ・ SCROLL RIGHT (Ring Scroll Right)
102 ・ Line (Use PEN)
103 ・ Circle (Use PEN)
104 ・ Circle.Fill (Use PEN)
105 ・ Polygon (Polygon, frame only)
106 ・ Polygon.Fill (Polygon.Fill)
107 ・ SUPER.Fill (Scan Line data)
108 ・ Screen.Effect (User Screen effect)
109 ・ PSET.PEN (Point Set)
110 ・ DRAW
111 ・ DRAW Jump Address
112 ・
113 ・
114 ・
115 ・
--------------------- FONT MANAGER ---------------------- (2400H)
116 ・ MESSAGE.LEFT (Message Left -> Right)
117 ・ MESSAGE.RIGHT (Message Right -> Left)
118 ・ MESSAGE.CENTER (Message Centering)
119 ・ PRINT.ONE.CHR (1 character print)
120 ・ MESSAGE
121 ・ MESSAGE.LENGTH
122 ・ SET.FONT.RECORD (Font record set)
123 ・ READ.FONT.RECORD (font record read)
124 ・ SET.XY (X, Y set to current Record)
125 ・ READ.XY (Read X, Y current record)
126 ・ CR0A (Line Feed)
127 ・ CR0D (Return)
128 ・
129 ・
130 ・
131 ・
--------------------- PICTURE DRIVER II ---------------------- (2C00H)
--------------------- EVENT MANAGER ---------------------- (3000H)
132 ・ GAME.KEY.REPEAT (GAME.Key, Repeat process)
133 ・ GET.CLICK.STATUS (read Click Status)
134 ・ KEY.REPEAT (1 Key Repeat process)
135 ・ SET.EVENT.RECORD (Event record set)
136 ・ READ.EVENT.RECORD (Event record read)
137 ・ SAVE.CURSOR (KVRAM character save)
138 ・ LOAD.CURSOR (KVRAM character read)
139 ・ FLASH.CURSOR (Flash cursor)
140 ・ MODIFY.KEY (Modify Key Read)
141 ・ SET.KEY.X (Asc Table Set)
142 ・ TEXT.EDIT.LINE (Text Edit of 1 Line)
143 ・ BEEP (Bell)
--------------------- MEMORY MANAGER ---------------------- (2E00H)
144 ・ MEMORY.COPY (Memory Copy, Move)
145 ・ MEMORY.SWAP (Memory Swap)
146 ・ MEMORY.COPY2 (Memory External Copy)
147 ・
--------------------- WINDOW MANAGER ----------------- (3400H)
148 ・ SET.WINDOW.RECORD (Window record set)
149 ・ READ.WINDOW.RECORD (Window record read)
150 ・ SET.WINDOW.RECORD.EXT (Extend Window Record set)
151 ・ READ.WINDOW.RECORD.EXT (Extend Window Record read)
152 ・ PRINT.WINDOW.ONE (Print KVRAM, Window one)
153 ・ PRINT.WINDOW.BUFFER (Print KVRAM, Window buffer)
154 ・ PRINT.BG (Print Back Ground Pattern)
155 ・ PRINT.SCREEN (Print KVRAM -> V-RAM)
156 ・ CHECK.XY.IN.SCRN (Check xy in Screen)
157 ・ CHECK.XY.IN.WINDOW (Check xy in Window)
158 ・ CHECK.CLICK.POINT.BF (Check click point where)
159 ・ ID.JUMP (To Subroutine by Item.ID)
160 ・ FUNCTIONS (Low-level function process)
--------------------- Load and Save Routine ----------------- (4600H)
161 ・ LOAD&SAVE.MODULE; (File Save and Load)
--------------------- WINDOW MANAGER ----------------- (4800H)
162 ・ SERVICE ROUTINE (Service call)
--------------------- SUB.FUNCTION NO. --------------------
0 ・ QUIT (Application End Call)
1 ・ EVENT.LOOP (System Event Loop)
2 ・ ACTIVE.WINDOW (Inactive to Active)
3 ・ INACTIVE.WINDOW (Active to Inactive)
4 ・ WAIT.ON.EVENT (Wait any Event)
5 ・ MOVE.CURSOR (Move Cursor in Screen)
6 ・ WINDOW.XY+SCREEN.XY (Window X, Y + Screen X, Y)
7 ・ PRIORITY (Priority Change)
8 ・ FLASH.ITEM (Flashing Select Item)
9 ・ DRAG (Drag by DRAG Record)
10 ・ VIEW.CLIP.CHR (CLIP.SCREEN.RECT)
11 ・ VIEW.CLIP.ATB (CLIP.SCREEN.RECT)
12
13 ・ NEW.WINDOW (New Window Set)
14 ・ CLOSE.WINDOW (Window Close)
15 ・ ALWAYS.WINDOW.ACTIVE (Window Active)
16 ・ SET.DUMMY (System.ITEM.Dummy.Mode)
17 ・ PLUS.ITEM.XY
18 ・ PLUS.nXY&WXY;
19 ・ SUB.ITEM.XY
20 ・ SERCH.ITEM.TYPE
21 ・ SERCH.ITEM
22 ・ SERCH.DATA
23 ・ BIN.TO.DEC
24 ・ BIN.TO.HEX
25 ・ SERCH.HEADER2
26 ・ GET.SYSTEM.STACK
27 ・ SET.QUIT.ADRS
KERNEL
;
; SYSTEM-7C
; (JUMP TABLE)
;
ADRS EQU $1200
OFFSET $A000-ADRS
ORG ADRS
JP.TABLE
JP $00AD ;$E804
JP VERSION
JP CHECK
JP CLOSE.IO
JP OPEN.IO
JP ADRS.CONV
JP READ.KVRAM.ADRS
JP TDXY
JP VTDXY
JP GET.XY
JP TRANS40XY
JP TRANS40XY.DUAL
JP LASTER.PRINT
JP COLOR.CONVERT
JP SET.GET.BF
JP READ.GET.BF
JP STTM
JP MVTM
JP SCORE.PRINT
JP SCORE.PLUS
JP SGN8BIT
JP SET.PAUSE.MSG
JP 0
JP PAUSE
JP SET.KEY.TABLE
JP READ.KEY.TABLE
JP SET.KEY.MASK
JP READ.KEY.MASK
JP GET.KEY
JP GET.KEY.PORT
JP READ.KEY.BF
JP SET.GAME.KEY
JP READ.GAME.KEY
JP GAME.KEY
JP MOVE.FIGHTER
JP HANTEI
JP CHECK.AREA
JP INIT.RANDOM
JP 0
JP RANDOM
JP XYCOOD
JP XYLEN
JP BIT.MAP.OBJ
JP BIT.MAP.OBJ.PLUS
JP PRESS
JP OBJECT
JP 0
JP 0
JP 0
JP 0
JP ZAHYO
JP COLOR.ZAHYO
JP SET.VRAM.SW
JP READ.VRAM.SW
JP 0
JP 0
JP MULTI8
JP DIVISION8
JP MULTI16
JP DIVISION16
JP 0
JP 0
HAND.JUMP
JP 0
; --- HIKOUKAI ---
JP SET.TASK.RECORD
JP READ.TASK.RECORD
JP CMS
QQ
;----------------------
;
;
; SUPER SYSTEM-7C
; ( OS KERNEL)
;
KERNEL EQU 200*3+ADRS
VER EQU 1
ORG KERNEL
;
; MZ-700 / 1500 CHECK
;
; MZ-700 タ A = 1
; MZ-1500 タ A = 0
;
CHECK
CALL OPEN.IO
LD A,($FFFF)
SUB $A5
JR Z,CHK
LD A,1
CHK
;
; CLOSE I/O
;
CLOSE.IO
LD HL,(STACK.IO)
DEC (HL)
DEC HL
LD (STACK.IO),HL
RET NZ
OUT ($E1),A
RET
;
; OPEN I/O
; BANK = VRAM,I/O
;
OPEN.IO
LD HL,$FFFF
LD A,(HL)
LD (HL),$76
CP (HL)
LD (HL),A
LD A,1
JR Z,OPN
XOR A
OPN
LD HL,(STACK.IO)
LD (HL),A
INC HL
LD (STACK.IO),HL
OUT ($E3),A
RET
STACK.IO DW STACK
STACK DS 4
;
; ADDRESS SETTING
;
; A = ADDRESS HIGH
;
ADRS.CONV
LD (ADRS1+1),A
LD (ADRS2+1),A
;
; READ KVRAM ADRS
;
; EXIT:
; A = KVRAM ADRS
;
READ.KVRAM.ADRS
LD A,(ADRS1+1)
RET
;
; CONVERT ADRS タ KVRAM X,Y
;
; HL = ADDRESS OF KVRAM
;
; EXIT:
; H = X
; L = Y
;
GET.XY
LD A,H
ADRS2
SUB $B0
LD H,L
LD L,A
RET
;
; ATDXY
; TDXY
;
; H = X
; L = Y
; ?
; HL = KVRAM ADRS
;
TDXY
LD A,L
LD L,H
ADRS1
ADD A,$B0
LD H,A
RET
;
; ZAHYOU KEISAN2
;
; VRAM.SW=0 --- KVRAM
; =1 --- VRAM
;
; H = X
; L = Y
;
; EXIT: HL = ADDRESS
;
ZAHYO
LD A,(VRAM.SW)
OR A
JR Z,TDXY
;
; VIDEO RAM TDXY
;
; H = X
; L = Y (0 TO 25)
;
VTDXY
PUSH BC
PUSH DE
LD E,H
LD D,0
LD H,D
RLC L
RLC L
RLC L
LD C,L
LD B,D
ADD HL,HL
ADD HL,HL
ADD HL,BC
ADD HL,DE
LD BC,$D000
ADD HL,BC
POP DE
POP BC
RET
VRAM.SW DB 0
;
; COLOR ZAHYOU KEISAN
;
; HL = ADDRESS
;
COLOR.ZAHYO
LD A,(VRAM.SW)
OR A
JR Z,COLZ
SET 3,H
RET
COLZ
SET 7,L
RET
;
; SET VRAM SWITCH
;
; A = 0 --- KVRAM
; = 1 --- VRAM
;
SET.VRAM.SW
LD (VRAM.SW),A
;
; READ VRAM SWITCH
;
; EXIT:
; A = 0 --- KVRAM
; = 1 --- VRAM
;
READ.VRAM.SW
LD A,(VRAM.SW)
RET
;
; A = VALUE
; ?
; IF A = 0 タ A = 0
; IF A < 0 タ A = -1
; IF A > 0 タ A = 1
;
SGN8BIT
OR A
RET Z
LD A,1
RET P
LD A,-1
RET
;
; HANTEI
; E: D: C: B:
; HL = MEM(LY-1,LX-1,LY-1,LX-1)
; DE = X1,Y1
; BC = X2,Y2 ミ珥珥ホ
; ? ミ?珥珥ホ
; CY = 1 タ OFF ? DE?? ?
; CY = 0 タ HIT ? ?? BC ?
; ヘ珥瓔ン ?
; ヘ珥珥珎
HANTEI
LD A,E
ADD A,(HL)
CP C
RET C
INC HL
LD A,D
ADD A,(HL)
CP B
RET C
INC HL
LD A,C
ADD A,(HL)
CP E
RET C
INC HL
LD A,B
ADD A,(HL)
CP D
RET
;
; CHECK AREA
;
; HL=(X1,Y1)
; DE=(X2,Y2)
; BC=(CHECK.X, CHECK.Y)
;
; CAUTION!
; H 0 --- NOT CALLED GAME.KEY
;
; ?
;
; C = CONDITION (1=ON, 0=OFF)
; BIT 0 = RIGHT ON
; BIT 1 = LEFT ON
; BIT 2 = DOWN ON
; BIT 3 = UP ON
;
MOVE.FIGHTER
OR A
PUSH DE
PUSH HL
CALL Z,GAME.KEY
POP HL
POP DE
LD C,0
LD B,A
LD A,E
BIT 5,B
JP Z,MVF1
SET 3,C
CP (HL)
JP Z,MVF1
DEC E
MVF1
LD A,D
INC HL
BIT 2,B
JP Z,MVF2
SET 1,C
CP (HL)
JP Z,MVF2
DEC D
MVF2
INC HL
LD A,E
BIT 4,B
JP Z,MVF3
SET 2,C
CP (HL)
JP Z,MVF3
INC E
MVF3
INC HL
LD A,D
BIT 3,B
RET Z
SET 0,C
CP (HL)
RET Z
INC D
RET
;
; H = N
; E = N
;
; HL= N*M
;
MULTI8
LD D,0
LD L,D
LD B,8
TI8
ADD HL,HL
JR NC,TI8X
ADD HL,DE
TI8X
DJNZ TI8
RET
;
; HL = M
; E = N
;
; L = M/N
; H = M MOD N
;
DIVISION8
LD B,8
XOR A
DV8A
ADC HL,HL
LD A,H
JR C,DV8B
CP E
JR C,DV8C
DV8B
SUB E
LD H,A
XOR A
DV8C
CCF
DJNZ DV8A
RL L
RET
;
; HL = M
; DE = N
;
; HLDE = HL*DE
;
MULTI16
PUSH DE
EXX
LD HL,0
LD DE,0
POP BC
EXX
LD A,16
TI16
EXX
EX DE,HL
ADD HL,HL
EX DE,HL
ADC HL,HL
EXX
ADD HL,HL
JR NC,TI16C
EXX
EX DE,HL
ADD HL,BC
EX DE,HL
JR NC,TI16B
INC HL
TI16B EXX
TI16C DEC A
JR NZ,TI16
EXX
RET
;
; 32/16 BIT
;
; DEHL = HIJYOSU
; BC = JYOSU
;
; ?
; DEHL = SYOU
; BC = AMARI
;
DIVISION16
PUSH BC
EXX
POP BC
LD HL,0
EXX
LD B,32
DIV1
ADD HL,HL
EX DE,HL
ADC HL,HL
EX DE,HL
EXX
ADC HL,HL
JR C,DIV3
SBC HL,BC
JR NC,DIV4
ADD HL,BC
EXX
DJNZ DIV1
DIV2
EXX
PUSH HL
EXX
POP BC
RET
DIV3
OR A
SBC HL,BC
DIV4
EXX
INC L
DJNZ DIV1
JR DIV2
;
; H = X1
; L = Y1
; D = X2
; E = Y2
; H < D & L < E
;
; B = D - H + 1
; C = E - L + 1
;
XYLEN
LD A,D
SUB H
LD B,A
LD A,E
SUB L
LD C,A
INC C
INC B
RET
;
; HL = SCORE BUFFER TOP
; DE = PRINT ADDRESS
; A = MODE
; (0 = 00123456
; 1 = 123456
; 2 = 123456
; 3 = RESERVE)
;
SCORE.PRINT
DEC A
JP M,SCORE0
JR Z,ZERO.SUP2
PUSH DE
LD DE,ZPBF
CALL SCORE0
POP DE
LD HL,ZPBF
LD B,8
ZSP1A
LD A,(HL)
CP $20
JR NZ,ZSP1X
INC HL
DJNZ ZSP1A
LD A,$20
LD (DE),A
RET
ZSP1X
LD C,B
LD B,0
LDIR
RET
ZERO.SUP2
PUSH DE
LD DE,ZPBF
CALL SCORE0
POP DE
LD HL,ZPBF
LD B,8
ZSP2A
LD A,(HL)
CP $20
JR NZ,ZSP1X
INC HL INC DE
DJNZ ZSP2A
LD A,$20 DEC DE
LD (DE),A
RET
SCORE0
LD A,$20
LD B,4
?SC1
RLD
LD (DE),A
INC DE
RLD
LD (DE),A
INC DE
RLD
INC HL
DJNZ ?SC1
RET
ZPBF DS 8
;
; HL = SCORE BUFFER
; IY = HIGH SCORE BUFFER
; BC = PLUS VALUE LOW
; DE = PLUS VALUE HIGH
;
SCORE.PLUS
INC HL
INC HL
INC HL
LD (SCPR+1),IY
LD A,C
ADD A,(HL)
DAA
LD (HL),A
DEC HL
LD A,B
ADC A,(HL)
DAA
LD (HL),A
DEC HL
LD A,E
ADC A,(HL)
DAA
LD (HL),A
DEC HL
LD A,D
ADC A,(HL)
DAA
LD (HL),A
LD (SCPX+1),HL
LD B,4
SCPA
LD A,(IY)
CP (HL)
JR C,SCPX
RET NZ
INC IY
INC HL
DJNZ SCPA
RET
SCPX
LD HL,0
SCPR
LD DE,0
LD BC,4
LDIR
RET
;
; CMS!
;
;
; H = X
; L = Y
; DE= CMS DATA ADRS
; C = READ STATUS (0,1)
;
; EXIT:
; H = NEW X
; L = NEW Y
; DE= NEW CMS DATA ADRS
; C = NEW STATUS (0,1)
; CY= 0 (OK!)
; = 1 #TRAP ON! :(X,Y=OLD XY)
; (#TRAP ON WHEN Y=0)
;
; NOTE:
; (DATA) = [X,Y,X,Y]....
;
CMS
LD A,(DE)
BIT 0,C
JR Z,CMS1
AND $F0
RRCA
RRCA
RRCA
RRCA
INC DE
CMS1
AND $0F
LD B,A
INC C
AND 3
SCF
RET Z
SUB 2
ADD A,L
LD L,A
LD A,B
AND $0C
SCF
RET Z
RRCA
RRCA
SUB 2
ADD A,H
LD H,A
OR A
RET
;
; MULTI TASK MAIN
;
; ALL REGISTER SAVED
;
MULTI.TASK
DI
PUSH AF
PUSH BC
PUSH DE
PUSH HL
PUSH IX
PUSH IY
CALL OPEN.IO
LD HL,$E007
LD (HL),$B0
LD (HL),$74
DEC L
LD (HL),2
LD (HL),0
DEC L
TIMER
LD (HL),40 ;120/3
LD (HL),0
;
; TASK CALL
;
TSS
LD A,0
INC A
AND 3
LD (TSS+1),A
ADD A,A
LD E,A
LD D,0
LD HL,TASK.TBL
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
LD A,L
OR H
JP Z,TASK.PASS
LD DE,TASK.PASS
PUSH DE
JP (HL)
TASK.PASS
CALL CLOSE.IO
POP IY
POP IX
POP HL
POP DE
POP BC
POP AF
EI
RET
;
; SET JUMP TABLE OF INT.
;
; HL = JUMP ADRS TBL
;
SET.TASK.RECORD
DI
EX DE,HL
LD A,$C3
LD HL,MULTI.TASK
LD ($1038),A
LD ($1039),HL
OUT ($E0),A
LD ($38),A
LD ($39),HL
OUT ($E2),A
EX DE,HL
LD DE,TASK.TBL
LD BC,8
LDIR
JP MULTI.TASK
;
; READ INT. TABLE
;
; DE = BUFFER
;
READ.TASK.RECORD
LD HL,TASK.TBL
RC
LD BC,8
LDIR
RET
TASK.TBL DW 0:0:0:0
;
; OBJ-PRESS SUB
;
;
; PRESS
;
; IX = MOTO ADDRESS
; HL = SAKI ADDRESS
; BC = DATA LENGTH
;
; EXIT:
; CY = 0 --- PRESS OK
; CY = 1 --- NOT PRESS
; A = PASS CODE
; HL = LAST ADDRESS +1
;
; OBJECT
;
; IX = MOTO ASYUKU DATA ADDERSS
; HL = TENKAISAKI ADDRESS
; BC = ASYUKU DATA LENGTH
; A = PASS CODE
;
; EXIT:
; HL = TENKAI SAKI ADRS +1
;
PRESS
PUSH IX
PUSH HL
PUSH IX
POP HL
XOR A
LPA
PUSH BC
PUSH HL
CPIR
POP HL
POP BC
JP PO,SET.V
INC A
JP NZ,LPA
SCF
POP HL
POP IX
RET
SET.V
LD (PASS),A ;PASS CODE
LD (PASS1+1),A
POP HL
POP IX
CALL PRESS.X
LD A,(PASS)
OR A
RET
PRESS.X
LD A,(IX)
LD (HL),A
INC IX
CPI
RET PO
CP (IX)
JR NZ,PRESS.X
CP (IX+1)
JR NZ,PRESS.X
PASS1
LD (HL),-1
INC HL
LD (HL),0
PLA
CPI
RET PO
DEC HL
INC IX
INC (HL)
JR Z,PRESSX
LD A,(IX-1)
CP (IX)
JR Z,PLA
PRESSX
INC HL
JR PRESS.X
OBJECT
LD (PASS2+1),A
OBJECT.X
LD A,(IX)
LD (HL),A
INC IX
CPI
RET PO
LD A,(IX)
PASS2
CP 0000
JP NZ,OBJECT.X
LD E,(IX-1)
INC IX
CPI
RET PO
DEC HL
LD D,(IX)
INC IX
CPI
RET PO
DEC HL
OB
LD (HL),E
INC HL
DEC D
JP NZ,OB
JP OBJECT.X
PASS DB 1
SPACE GRAPHIC
ORG $9000
;
;
; SUPER SYSTEM-7C
; (SPACE GRAPHICS)
;
BUFR EQU $DF00
KERNEL EQU $1200
ADRS EQU KERNEL+$C00
COLOR EQU $11FF
;
; OS KERNEL CALL
;
TDXY EQU 7*3+KERNEL
XYLEN EQU 41*3+KERNEL
XYCOOD EQU 40*3+KERNEL
STTM EQU 16*3+KERNEL
MVTM EQU 17*3+KERNEL
TRANS40XY EQU 10*3+KERNEL
SGN8BIT EQU 20*3+KERNEL
SET.GET.BF EQU 14*3+KERNEL
PEN EQU 109*3+KERNEL
OFFSET $A000-ADRS
ORG ADRS
;
; GET CHARACTER
;
; H = X
; L = Y
; B = LX
; C = LY
; DE= GET MEMORY ADDRESS
;
GET
CALL TDXY
LD A,L
LD (GT1+1),A
LD A,B
OR A
RET Z
LD A,C
OR A
RET Z
LD C,B
LD B,0
GT0
PUSH BC
LDIR
GT1
LD L,0
INC H
POP BC
DEC A
JR NZ,GT0
RET
;
; CHR(+ATB) PUT
;
; H = X
; L = Y
; DE = DATA ADDRESS
; B = LENGTH OF CHR.X
; C = LENGTH OF CHR.Y
;
;
PUT.CHR
CALL TDXY
LD A,L
LD (PTL1+1),A
LD A,B
LD (PTB1+1),A
PTB1
LD B,0
PTA1
LD A,(DE)
OR A
JR Z,PTA2
LD (HL),A
PTA2
INC L
INC DE
DJNZ PTA1
PTL1
LD L,0
INC H
DEC C
JP NZ,PTB1
RET
;
; CHR(+ATB) PUT OVER (BIT3=1 PAS)
;
; H = X
; L = Y
; DE = DATA ADDRESS
; B = LX
; C = LY
;
PUT.OVER.CHR
CALL TDXY
LD A,L
LD (PTOCL1+1),A
LD A,B
LD (PTOCB1+1),A
PTOCB1
LD B,0
PTOCA1
LD A,(DE)
OR A
JR Z,PTOCA2
SET 7,L
BIT 3,(HL)
RES 7,L
JR NZ,PTOCA2
LD (HL),A
PTOCA2
INC L
INC DE
DJNZ PTOCA1
PTOCL1
LD L,0
INC H
DEC C
JP NZ,PTOCB1
RET
;
; (CHR+)ATB PUT
;
PUT.ATB
CALL TDXY
LD A,B
LD (PTB2+1),A
LD A,L
LD (PTL2+1),A
PTB2
LD B,0
PTA3
LD A,(DE)
BIT 3,A
JR NZ,PTA5
OR A
JP P,PTA4
RRD
AND $7F
PTA4
LD (HL),A
PTA5
INC L
INC DE
DJNZ PTA3
PTL2
LD L,0
INC H
DEC C
JP NZ,PTB2
RET
;
; (CHR+)ATB PUT
;
PUT.OVER.ATB
CALL TDXY
LD A,B
LD (PTOAB2+1),A
LD A,L
LD (PTOAL2+1),A
PTOAB2
LD B,0
PTOAA3
BIT 3,(HL)
JR NZ,PTOAA5
LD A,(DE)
BIT 3,A
JR NZ,PTOAA5
OR A
JP P,PTOAA4
RRD
AND $7F
PTOAA4
LD (HL),A
PTOAA5
INC L
INC DE
DJNZ PTOAA3
PTOAL2
LD L,0
INC H
DEC C
JP NZ,PTOAB2
RET
;
; PUT HYPER
;
PUT.HYP
CALL TDXY
EX DE,HL
LD A,E
LD (PHY2+1),A
LD A,B
LD (PHY1+1),A
LD A,C
LD B,0
PHY1
LD C,0
LDIR
PHY2
LD E,0
INC D
DEC A
JP NZ,PHY1
RET
;
; LARGE & SMALL PUT
;
; H = X
; L = Y
; DE = DATA ADDRESS
; B = LX
; C = LY
; H' = PRINT LX
; L' = PRINT LY
;
PUT.LS
CALL TDXY
PUSH BC
EXX
POP DE
LD C,0
EXX
LD A,B
LD (WRITE.X+1),A
LD (WRYF+1),A
LD A,L
LD (WRYC+1),A
LD (WRYE+1),A
;
WRITE.Y
WRYA
EXX
LD A,C
ADD A,L
WRYB
LD C,A
CP E
EXX
JR C,WRYF
JR Z,WRYD
CALL WRITE.X
WRYC
LD L,0
INC H
EXX
LD A,C
SUB E
JP WRYB
WRYD
EXX
LD C,0
EXX
CALL WRITE.X
WRYE
LD L,0
INC H
WRYF
LD A,0
ADD A,E
LD E,A
LD A,0
ADC A,D
LD D,A
;
DEC C
JP NZ,WRYA
RET
WRITE.X
LD B,0
EXX
LD B,0
EXX
PUSH DE
WRXA
EXX
LD A,B
ADD A,H
WRXB
LD B,A
CP D
EXX
JR C,WRXF
JR Z,WRXD
LSS1 CALL PEN.LS
INC L
EXX
LD A,B
SUB D
JP WRXB
WRXD
EXX
LD B,0
EXX
LSS2 CALL PEN.LS
INC L
WRXF
INC DE
DJNZ WRXA
;
POP DE
RET
PEN.LS
LD A,(DE)
OR A
RET M
LD (HL),A
RET
;
; SET PUT.LS PEN
;
; HL = PEN ADDRESS
; (DE = DATA ADDRESS
; HL = KVRAM ADDRESS)
;
; DON'T BREAK ALL REGISTER IN SUB
;
;
SET.PEN.LS
LD (LSS1+1),HL
LD (LSS2+1),HL
;
; READ PEN PUT.LS
;
; EXIT:HL = ADDRESS
;
READ.PEN.LS
LD HL,(LSS1+1)
RET
;
; ATB CPL PUT
;
; H = X
; L = Y
; DE= DATA ADDRESS
; B = LX
; C = LY
;
PUT.CPL
CALL TDXY
LD A,L
LD (PCL+1),A
LD A,B
LD (PCB+1),A
PCB LD B,0
PCA LD A,(DE)
CPL
LD (HL),A
PCX INC L
INC DE
DJNZ PCA
PCL LD L,0
INC H
DEC C
JP NZ,PCB
RET
;
; ATB CPL PUT OVER
;
; H = X
; L = Y
; DE= DATA ADDRESS
; B = LX
; C = LY
;
PUT.OVER.CPL
CALL TDXY
LD A,L
LD (POL+1),A
LD A,B
LD (POB+1),A
POB LD B,0
POA
BIT 3,(HL)
JR NZ,POX
LD A,(DE)
CPL
LD (HL),A
POX INC L
INC DE
DJNZ POA
POL LD L,0
INC H
DEC C
JP NZ,POB
RET
;
; SCREEN EFFECT
;
; H = X1
; L = Y1
; D = X2
; E = Y2
; BC = EFFECT OPERATION ADRS
; (HL=KVRAM ADDRESS)
;
SCREEN.EFFECT
LD (SCRN.CALL+1),BC
SCREEN.EFFECT2
CALL XYCOOD
CALL XYLEN
CALL TDXY
LD E,L
LD D,B
SCRN.CALL
CALL 0
INC L
DJNZ SCRN.CALL
LD L,E
INC H
LD B,D
DEC C
JP NZ,SCRN.CALL
RET
;
; BOX.CHR
;
; IX = ミ ホ ? ン ヘ ?
; H = X1
; L = Y1
; D = X2
; E = Y2
;
BOX.CHR
XOR A
JP BOXA
;
; BOX.ATB
;
; IX = "ミ ホ ? ン ヘ ?" _ ゥ 鵡-
; H = X1
; L = Y1
; D = X2
; E = Y2
;
BOX.ATB
LD A,5
BOXA
LD (CPORT1+1),A
;
; WRITING BOX
;
CALL XYCOOD
CALL XYLEN
CALL TDXY
EX DE,HL
CALL TDXY
BXA1
LD A,(IX+5)
CALL CPORT1
LD A,(IX+1)
EX DE,HL CALL CPORT1 EX DE,HL
INC E
DEC L
DJNZ BXA1
DEC E
INC L
LD B,C
BXA2
LD A,(IX+7)
CALL CPORT1
LD A,(IX+3)
EX DE,HL CALL CPORT1 EX DE,HL
INC D
DEC H
DJNZ BXA2
DEC D
INC H
;
LD A,(IX)
CALL CPORT1
LD A,(IX+4)
EX DE,HL CALL CPORT1 EX DE,HL
LD A,L
LD L,E
LD E,A
LD A,(IX+6)
EX DE,HL CALL CPORT1 EX DE,HL
LD A,(IX+2)
;
CPORT1
JR GPORT1
CP $F0
RET Z
LD (HL),A
RET
GPORT1
BIT 3,A
RET NZ
OR A
JP P,GP1
RRD
AND $7F
GP1
LD (HL),A
RET
;
; BOX FILL
;
; H = X1
; L = Y1
; D = X2
; E = Y2
; A = COLOR OR CHARACTER
;
BOX.FILL
EX AF,AF'
CALL XYCOOD
CALL XYLEN
EX AF,AF'
BOX.FILL2
;
; BOX.FILL2
;
; H = X
; L = Y
; B = LX
; C = LY
; A = COLOR OR CHARACTER
;
LD (BXF1+1),A
CALL TDXY
LD D,L
LD E,B
BXF1
LD A,0
BXF2
LD (HL),A
INC L
DJNZ BXF2
LD L,D
LD B,E
INC H
DEC C
JP NZ,BXF2
RET
;
; BOX FILL (USE PEN)
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
BOX.FILL.PEN
CALL XYCOOD
CALL XYLEN
BOX.FILL2.PEN
;
; BOX.FILL2 (USE PEN)
;
; H = X
; L = Y
; B = LX
; C = LY
;
LD D,H
LD E,B
BXFP
CALL PEN
INC H
DJNZ BXFP
LD H,D
LD B,E
INC L
DEC C
JP NZ,BXFP
RET
;
; BOX NORMAL
;
; H = X1
; L = Y1
; D = X2
; E = Y2
; A = COLOR OR CHARACTER
;
BOX.NORMAL
EX AF,AF'
CALL XYCOOD
CALL XYLEN
CALL TDXY
EX DE,HL
CALL TDXY
EX AF,AF'
;
BXNA
LD (HL),A
LD (DE),A
INC E
DEC L
DJNZ BXNA
DEC E
INC L
LD B,C
BXNB
LD (HL),A
LD (DE),A
DEC H
INC D
DJNZ BXNB
RET
;
; BOX COLOR TYPE
;
; H = X1
; L = Y1
; D = X2
; E = Y2
; A = COLOR (BIT 7=1 タ BG OR)
; (BIT 3=1 タ CPL )
BOX.COLOR
EX AF,AF'
CALL XYCOOD
CALL XYLEN
CALL TDXY
EX DE,HL
CALL TDXY
EX AF,AF'
;
BCLA
CALL ATB.SET
INC E
DEC L
DJNZ BCLA
DEC E
INC L
CALL ATB.SET
LD B,C
BCLB
CALL ATB.SET
DEC H
INC D
DJNZ BCLB
INC H
DEC D
;
ATB.SET
OR A
JP P,ATBX
PUSH BC
LD C,A
RRD
AND $7F
LD (HL),A
EX DE,HL
LD A,C
RRD
LD (HL),A
EX DE,HL
LD A,C
POP BC
RET
ATBX
BIT 3,A
JR NZ,ATB.CPL
LD (HL),A
LD (DE),A
RET
ATB.CPL
EX AF,AF'
LD A,(HL)
CPL
LD (HL),A
LD A,(DE)
CPL
LD (DE),A
EX AF,AF'
RET
;
; BOX (USE PEN)
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
BOX.PEN
CALL XYCOOD
CALL XYLEN
BXNAP
CALL PEN
EX DE,HL
CALL PEN
EX DE,HL
INC H
DEC D
DJNZ BXNAP
DEC H
INC D
LD B,C
BXNBP
CALL PEN
EX DE,HL
CALL PEN
EX DE,HL
INC L
DEC E
DJNZ BXNBP
RET
;
; LINE
;
; LINE ( DE タ HL )
;
; D = X1
; E = Y1
; H = X2
; L = Y2
;
LINE
LD (LNB+1),HL
PUSH DE
CALL STTM
LD E,$3E
LD (XYFLAG),DE
POP DE
EX DE,HL
LNA
EX AF,AF'
LNCALL
CALL PEN
PUSH DE
PUSH HL
LNB
LD DE,0
SUB HL,DE
POP HL
POP DE
RET Z
XYFLAG
LD A,0
CALL MVTM
JP LNA
;
; CIRCLE
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
CIRCLE
CALL XYCOOD
CALL XYLEN
SRL B
LD D,B
LD A,B
ADD A,H
LD H,A
LD A,B
ADD A,L
LD L,A
EX DE,HL
;
; CIRCLE (1/4|)
;
; H = R (HANKEI)
; D = X
; E = Y
;
;
CIRCLE.X
INC H
DEC H
JR Z,ENX
; INC D --- FILL
LD A,1
SUB H
LD L,0
ENLP
EX AF,AF'
PEN.EN
CALL PEN.CIRCLE
EX AF,AF'
OR A
JP M,ENA
DEC H
RET Z
SUB H
JP ENLP
ENA
INC L
ADD A,L
JP ENLP
ENX
EX DE,HL
JP PEN
;
; USE CIRCLE
; PEN PATTERN
;
; H = X
; L = Y
;
PEN.CIRCLE
LD BC,HL
LD A,D ADD A,H LD H,A
LD A,E ADD A,L LD L,A
CALL PEN
LD HL,BC
LD A,D ADD A,H LD H,A
LD A,E SUB L LD L,A INC L
CALL PEN
LD HL,BC
LD A,D SUB H LD H,A INC H
LD A,E SUB L LD L,A INC L
CALL PEN
LD HL,BC
LD A,D SUB H LD H,A INC H
LD A,E ADD A,L LD L,A
CALL PEN
LD HL,BC
RET
;
; CIRCLE.FILL
;
; H = R (HANKEI)
; D = X
; E = Y
;
;
CIRCLE.FILL
EXX
LD DE,(PEN.EN+1)
LD HL,PEN.CIRCLE.FILL
LD (PEN.EN+1),HL
EXX
CALL CIRCLE
EXX
LD (PEN.EN+1),DE
RET
;
; USE CIRCLE.FILL
; PEN PATTERN
;
; H = X
; L = Y
;
PEN.CIRCLE.FILL
PUSH DE
PUSH HL
LD A,H
ADD A,A
JR Z,CFX
LD B,A
LD C,A
LD A,D
SUB H
LD H,A
LD D,A
LD A,E
ADD A,L
PUSH AF
LD A,E
SUB L
INC A
LD E,A
POP AF
LD L,A
CFL
CALL PEN
EX DE,HL
CALL PEN
EX DE,HL
INC H
INC D
DJNZ CFL
POP HL
POP DE
RET
CFX
CALL PEN
POP HL
POP DE
RET
;
; SET PEN.CIRCLE
;
; HL = ADDRESS
;
SET.PEN.CIRCLE
LD (PEN.EN+1),HL
;
; READ PEN.CIRCLE
;
; EXIT: HL = PEN ADDRESS
;
READ.PEN.CIRCLE
LD HL,(PEN.EN+1)
RET
;
; KVRAM SCROLL UP
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
SCRL.UP
CALL XYCOOD
CALL XYLEN
CALL TDXY
PUSH BC
PUSH HL
LD DE,BUFR
LD C,B
LD B,0
LDIR
POP HL
POP BC
LD A,L
LD (SRUL+1),A
LD A,B
LD (SRUC+1),A
LD B,0
EX AF,AF'
LD A,C
SRUA
LD DE,HL
INC H
SRUC
LD C,0
LDIR
SRUL
LD L,0
DEC A
JP NZ,SRUA
DEC H
EX DE,HL
EX AF,AF'
LD C,A
LD HL,BUFR
LDIR
RET
;
; SCROLL DOWN
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
SCRL.DOWN
CALL XYCOOD
CALL XYLEN
EX DE,HL
CALL TDXY
PUSH BC
PUSH HL
LD DE,BUFR+255
LD C,B
LD B,0
LDDR
POP HL
POP BC
;LD A,L
;LD (SRDL+1),A
LD A,B
LD (SRDC+1),A
LD B,0
EX AF,AF'
LD A,C
SRDA
LD DE,HL
DEC H
SRDC
LD C,0
PUSH HL
LDDR
POP HL
SRDL
;LD L,0
DEC A
JP NZ,SRDA
INC H
EX DE,HL
EX AF,AF'
LD C,A
LD HL,BUFR+255
LDDR
RET
;
; SCROLL LEFT
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
SCRL.LEFT
CALL XYCOOD
CALL XYLEN
CALL TDXY
LD A,L
LD (SRLL+1),A
LD A,B
LD (SRLC+1),A
LD B,0
LD A,C
SRLL
LD L,0
LD DE,HL
INC L
EX AF,AF'
LD A,(DE)
SRLC
LD C,0
LDIR
DEC DE
LD (DE),A
INC H
EX AF,AF'
DEC A
JP NZ,SRLL
RET
;
; SCROLL RIGHT
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
SCRL.RIGHT
CALL XYCOOD
LD A,D
EX AF,AF'
CALL XYLEN
EX AF,AF'
LD H,A
CALL TDXY
LD A,B
LD (SRRC+1),A
LD B,0
LD A,C
SRRL
PUSH HL
LD DE,HL
DEC L
EX AF,AF'
LD A,(DE)
SRRC
LD C,0
LDDR
INC DE
LD (DE),A
POP HL
INC H
EX AF,AF'
DEC A
JP NZ,SRRL
RET
;
; POLYGON
;
;
; IX = YX DATA BUFFER
; (END CODE _ Y=-1)
;
POLYGON
LD E,(IX)
LD D,(IX+1)
LD L,(IX+2)
LD H,(IX+3)
INC E
RET Z
INC L
RET Z
DEC L
DEC E
CALL LINE
INC IX
INC IX
JP POLYGON
;
; POLYGON FILL
;
; IY = WORK AREA (ABOUT 512?)
; IX = YX DATA BUFFER
; (END CODE _ Y=-1)
;
POLYGON.FILL
PUSH IX
CALL POLYGON
POP IX
LD (TOP),IX
LD (WORK),IY
LD HL,SET.XYBF
CALL SET.GET.BF
CALL GET.DATA.LEN.IX
LD E,0
INC IX
INC IX
DEC BC
PUSH BC
POLYA
LD A,(IX)
SUB (IX-2)
INC IX
INC IX
CALL SGN8BIT
OR A
JR Z,POLYB
LD E,A
POLYB
DEC BC
LD A,B
OR C
JP NZ,POLYA
;
LD A,E
LD (F1),A
POP BC
LD IX,(TOP)
POLYD
LD E,(IX)
LD D,(IX+1)
LD L,(IX+2)
LD H,(IX+3)
PUSH BC
CALL GET.LINE.XY
POP BC
INC IX
INC IX
DEC BC
LD A,B
OR C
JR NZ,POLYD
LD (IY),-1 ;ENDCODE
LD IY,(WORK)
CALL XYSORT
CALL SUPER.FILL
;
LD HL,RETURN
JP SET.GET.BF
SET.XYBF
LD (IY),L
LD (IY+1),H
INC IY
INC IY
RETURN
RET
SET.GBF
LD HL,SET.XYBF
JP SET.GET.BF
GET.LINE.XY
LD A,L
SUB E
RET Z
CALL SGN8BIT
LD (F2),A
LD C,A
OR A
JR Z,GTLA
LD A,(F1)
OR A
JR Z,GTLA
ADD A,C
EX DE,HL
CALL Z,SET.XYBF
EX DE,HL
GTLA
LINE.POLY
LD (LNPB+1),HL
PUSH DE
CALL STTM
LD E,$3E
LD (LNPXYFLAG),DE
POP DE
EX DE,HL
LNPA
EX AF,AF'
PUSH DE
PUSH HL
LNPB
LD DE,0
OR A
SBC HL,DE
POP HL
POP DE
JR Z,LNPC
LNPXYFLAG
LD A,0
CALL MVTM
JP LNPA
LNPC
LD A,(F2)
LD (F1),A
RET
TOP DS 2
WORK DS 2
F2 DS 1
F1 DS 1
;
; GET IY DATA LENGTH
;
; IY = YX DATA POINTER
;
GET.DATA.LEN
PUSH IY
LD BC,0
GDA
LD A,(IY)
INC A
JR Z,GDB
INC BC
INC IY
INC IY
JP GDA
GDB
POP IY
RET
;
; GET IX DATA LENGTH
;
; IX = YX DATA POINTER
;
GET.DATA.LEN.IX
PUSH IX
LD BC,0
GDAX
LD A,(IX)
INC A
JR Z,GDBX
INC BC
INC IX
INC IX
JP GDAX
GDBX
POP IX
RET
;
;
; SUPER FILL
;
; IY=DATA ADDRESS (-1=ENDCODE)
;
; DATA= Y,X,Y,X,...,-1(Y)
;
SUPER.FILL
LD L,(IY)
INC L
RET Z
DEC L
LD A,(IY+3)
SUB (IY+1)
INC A
LD B,A
LD H,(IY+1)
;
CALL PEN.FILL
;
LD BC,4
ADD IY,BC
JP SUPER.FILL
PEN.FILL
CALL PEN
INC H
DJNZ PEN.FILL
RET
;
; GRAPHICS PEN!
;
; H = X
; L = Y
;
; COLOR DATA = COLOR ADDRESS
;
; CAUTION!: DON'T BREAK REGISTER
;
PEN.DEF
PUSH HL
CALL TDXY
LD A,(COLOR)
LD (HL),A
POP HL
RET
;
; SET PEN STYLE
;
; HL = PEN EXEC. ADRS
;
; DON'T BREAK ALL REGISTERS
;
; PARA: H=X, L=Y ONLY
;
SET.PEN.STYLE
LD (PEN+1),HL
;
; READ PEN STYLE (ADDRESS)
;
; EXIT:
;
; HL = PEN EXEC. ADDRESS
;
READ.PEN.STYLE
LD HL,(PEN+1)
RET
;
; YX SORT
;
; IY = DATA
;
XYSORT
CALL GET.DATA.LEN
LD A,B
OR C
RET Z
PUSH IY
PUSH BC
PUSH IY
SORTA
PUSH BC
CALL SORT.SUB
POP BC
INC IY
INC IY
DEC BC
LD A,B
OR C
JP NZ,SORTA
POP IY
POP BC
SORTB
PUSH BC
CALL SORT.SUB2
POP BC
INC IY
INC IY
DEC BC
LD A,B
OR C
JP NZ,SORTB
POP IY
RET
SORT.SUB
PUSH IY
POP HL
;
SRTA
LD A,(IY)
CP (HL)
JR C,SRTB
LD E,(HL)
LD (HL),A
LD (IY),E
INC HL
LD A,(IY+1)
LD E,(HL)
LD (HL),A
LD (IY+1),E
DEC HL
SRTB
INC HL
CPI
JP PE,SRTA
RET
SORT.SUB2
PUSH IY
POP HL
INC HL
SRTA2
DEC HL
LD A,(HL)
INC HL
CP (IY)
JR NZ,SRTB2
LD A,(IY+1)
CP (HL)
JR C,SRTB2
LD E,(HL)
LD (HL),A
LD (IY+1),E
DEC HL
LD E,(HL)
LD A,(IY)
LD (HL),A
LD (IY),E
INC HL
SRTB2
INC HL
CPI
JP PE,SRTA2
RET
;
; DE=PRINT ADRS CHR
; HL=PRINT ADRS COLOR
; A = PRINT DOT VALUE
; C = COLOR
;
?GAGE
LD B,8
?GA1
EX DE,HL
LD (HL),$43 ;'ネ'
EX DE,HL
LD (HL),C
INC DE
INC HL
SUB B
JR NC,?GA1
ADD A,B
DEC DE
DEC HL
PUSH DE
LD C,A
LD B,0
LD DE,TBLG
EX DE,HL
ADD HL,BC
EX DE,HL
LD A,(DE)
POP DE
OR A
RES 7,A
LD (DE),A
RET P
LD A,(HL)
RRD
RET
TBLG
DB 0:$71:$37:$37
DB $7B:$FF:$BF:$BD
;
; INSTALL ROUTINE
;
INSTALL
LD HL,COPY.TBL
LD DE,74*3+$1200
LD BC,COPY.END-COPY.TBL
LDIR
JP $AD
COPY.TBL
JP SET.PEN.STYLE
JP READ.PEN.STYLE
JP SET.PEN.LS
JP READ.PEN.LS
JP SET.PEN.CIRCLE
JP READ.PEN.CIRCLE
JP ?GAGE
JP 0
JP GET
JP PUT.CHR
JP PUT.OVER.CHR
JP PUT.ATB
JP PUT.CPL
JP PUT.OVER.ATB
JP PUT.OVER.CPL
JP PUT.HYP
JP PUT.LS
JP BOX.NORMAL
JP BOX.COLOR
JP BOX.CHR
JP BOX.ATB
JP BOX.FILL
JP BOX.PEN
JP BOX.FILL.PEN
JP SCRL.UP
JP SCRL.DOWN
JP SCRL.LEFT
JP SCRL.RIGHT
JP LINE
JP CIRCLE
JP CIRCLE.FILL
JP POLYGON
JP POLYGON.FILL
JP SUPER.FILL
JP SCREEN.EFFECT
JP PEN.DEF ;PSET PEN
COPY.END
FONT MANAGER
;%%%%%%%%%%%%%%%%%%%
;
; FONT MANAGER V ER3.0
;
KERNEL EQU $1200
ADRS EQU KERNEL+$1300
TRANS EQU 10*3+KERNEL
MULTI8 EQU 56*3+KERNEL
DIVISION32 EQU 59*3+KERNEL
MULTI16 EQU 58*3+KERNEL
CHECK.AREA EQU 36*3+KERNEL
SET.VRAM.SW EQU 52*3+KERNEL
ZAHYO EQU 50*3+KERNEL
COLOR.ZAHYO EQU 51*3+KERNEL
BIT.MAP.OBJ EQU 42*3+KERNEL
GET.XY EQU 9*3+KERNEL
SET.PUT.LS.PEN EQU 76*3+KERNEL
READ.PUT.LS.PEN EQU 77*3+KERNEL
PUT.LS EQU 90*3+KERNEL
WORK16 EQU $D500
WORK.BF EQU $D600
COLOR.BF EQU $D400
FONT.BF EQU $DC00
BIT.MAP.BF EQU $D400
OFFSET $A000-ADRS
ORG ADRS
;%%%%%%%%%%%%%%%%%%%%%%%%
;
; BIT.MAP.BF = 4*19
; COLOR.BF = 32*19
; WORK.BF = 4*19
;
;%%%%%%%%%%%%%%%%%%%%%%%%
;
; MESSAGE NORMAL
;
MESSAGE
CALL END.CODE
RET Z
CALL PRINT.ONE.CHR
JP MESSAGE
;
; MESSAGE LENGTH
;
MESSAGE.LENGTH
CALL END.CODE
RET Z
PUSH BC
CALL PRINT.ONE.CHR
POP BC
DEC BC
LD A,B
OR C
JP NZ,MESSAGE.LENGTH
RET
;
; MESSAGE LEFT (UP)
;
MESSAGE.LEFT
CALL SET.LC
LD A,(TATE)
DEC A
JP NZ,MESSAGE
LD A,1
LD (UN.CR),A
ML1
CALL GET.CR.LEN
JR NC,ML2
MLA
CALL MESSAGE.LENGTH
JP ML1
ML2
LD A,B
OR C
JR NZ,ML3
CALL END.CODE
JR Z,XXXX
SCF
CALL CTRL.JP
JP ML1
ML3
LD A,(DEST.TBL+1)
ADD A,E
DEC A
LD (XY+1),A
JP MLA
XXXX
XOR A
LD (UN.CR),A
RET
;
; MESSAGE RIGHT (DOWN)
;
MESSAGE.RIGHT
CALL SET.LC
LD A,(TATE)
DEC A
JP Z,MESSAGE
LD A,1
LD (UN.CR),A
MR1
CALL GET.CR.LEN
JR NC,MR2
MRA
PUSH BC
CALL MESSAGE.LENGTH
POP DE
LD HL,DEST.TBL+2
LD A,(TATE)
CP 2
JR Z,MRA1
INC HL
MRA1
LD A,(HL)
DEC HL
DEC HL
SUB (HL)
INC A
LD L,A
LD H,0
EX DE,HL
SUB HL,DE
CALL NC,CRX
JP MR1
MR2
LD A,B
OR C
JR NZ,MR3
CALL END.CODE
JR Z,XXXX
SCF
CALL CTRL.JP
JP MR1
MR3
LD A,(TATE)
CP 2
JR Z,MRT
LD A,(DEST.TBL+3)
SUB E
INC A
LD (XY+1),A
JP MRA
MRT
LD A,(DEST.TBL+2)
SUB E
INC A
LD (XY),A
JP MRA
;
; MESSAGE CENTER
;
MESSAGE.CENTER
CALL SET.LC
MC1
CALL GET.CR.LEN
JR NC,MC2
MCA
CALL MESSAGE.LENGTH
JP MC1
MC2
LD A,B
OR C
JR NZ,MC3
CALL END.CODE
RET Z
SCF
CALL CTRL.JP
JP MC1
MC3
LD A,(TATE)
DEC A
JR Z,MCR
JP P,MCT
LD A,(LC)
SUB E
SRA A
LD HL,(DEST.TBL)
ADD A,H
LD (XY+1),A
JP MCA
MCR
LD A,(LC)
SUB E
SRA A
LD L,A
LD A,(DEST.TBL+3)
SUB L
LD (XY+1),A
JP MCA
MCT
LD A,(LC)
SUB E
SRA A
LD HL,(DEST.TBL)
ADD A,L
LD (XY),A
JP MCA
;
; LC SETTING
;
SET.LC
LD A,(TATE)
CP 2
JR Z,SLC
LD HL,(DEST.TBL)
LD A,(DEST.TBL+3)
SUB H
INC A
LD (LC),A
RET
SLC
LD HL,(DEST.TBL)
LD A,(DEST.TBL+2)
SUB L
INC A
LD (LC),A
RET
PS.CODE
LD A,(IX)
CP 13 RET Z
CP $0A RET Z
END.CODE
LD A,(IX)
CP $1A RET Z
OR A
RET
;
; TATE WRAP.
;
TWRAP?
LD A,(TATE)
CP 2
JR NZ,TW
LD A,(TATE.WRAP.FLAG)
OR A
RET Z
LD A,(IX)
CP $BE
JR C,TW
CP $C0
RET
TW
OR A
RET
;
; JIKAN GET
;
GET.JIKAN
EXX
CALL SET.PXY
EXX
LD A,(TATE)
DEC A
JP M,GJ0F
JP Z,GJ0F
LD HL,(PXY)
JR GJ1F
GJ0F
LD HL,(PXY+1)
GJ1F
LD H,0
ADD HL,DE
EX DE,HL
INC BC
RET
;
; PASS CODE LENGTH GETTING
;
GET.CR.LEN
LD BC,0
LD DE,0
PUSH IX
GCL
CALL PS.CODE
JR Z,GCRX
LD A,(IX)
CP 5
JR Z,SKIPX
CP 21
JR Z,SKIPX
CP $1B
JR Z,SKIPQ
CALL TWRAP?
CALL NC,GET.JIKAN
CALL CHECKL
JR C,GCRX
INC IX
JR GCL
GCRX
POP IX
RET
SKIPQ
INC IX
INC IX
SKIPX
INC IX
INC BC
JR GCL
CHECKL
LD HL,(LC)
OR A
SBC HL,DE
RET NC
EX DE,HL
DEC BC
LD A,B
OR C
SCF
RET NZ
INC BC
RET
;
; PRINT ONE CHR
;
PRINT.ONE.CHR
CALL CONTROL? ;REWRITE
CTRL.JP
JP C,CONTROL ;REWRITE
LD HL,(XY)
LD (OLD.XY),HL
CALL FONT
CALL TATE.TRAP
CALL SET.PXY
INC IX
LD HL,(XY)
LD A,(TATE)
DEC A
JR Z,?YOKO
JP P,?TATE
LD A,(PXY+1)
ADD A,H
LD (XY+1),A
EX AF,AF'
LD A,(UN.CR)
OR A
RET NZ
EX AF,AF'
JP C,CRX
LD H,A
LD A,(DEST.TBL+3) ;RIGHT
CP H
RET NC
JP CRX
?YOKO
LD A,(XY+1)
LD HL,(PXY)
SUB H
LD (XY+1),A
EX AF,AF'
LD A,(UN.CR)
OR A
RET NZ
EX AF,AF'
JP C,CRX ; 0 - UNDER
LD HL,(DEST.TBL)
CP H
RET NC
JP CRX
?TATE
LD A,(PXY)
ADD A,L
LD (XY),A
LD H,A
LD A,(UN.CR)
OR A
RET NZ
LD A,(DEST.TBL+2) ;DOWN
CP H
RET NC
JP CRX
;
; CONTROL CODE CHECK
;
CONTROL?
LD A,(IX)
CP " "
RETURN RET
;
; CONTROL OPERATION
;
CONTROL
LD A,(IX)
INC IX
CP $1B
JR Z,ESC
OR A JR Z,CREQ
CP $1A JR Z,CREQ
CP 5 JP Z,SWITCH.COLOR
CP 10 JP Z,CR0A
CP 13 JP Z,CR0D
CP 21
RET NZ
;
; HOME CONTROL
;
HOME
LD HL,(DEST.TBL)
LD (XY),HL
RET
CREQ
DEC IX
RET
ESC
LD A,(IX)
INC IX
DEC A JP M,SET.COLOR
JP Z,SET.COLOR.EF
DEC A JP Z,SET.X
DEC A RET NZ
;
; SET Y COORDINATE
;
SET.Y
LD A,(IX)
LD (XY),A
INC IX
RET
SET.X
LD A,(IX)
LD (XY+1),A
INC IX
RET
SET.COLOR
LD A,(IX)
LD (COLOR),A
INC IX
RET
SET.COLOR.EF
LD A,(IX)
LD (COLOR.EF),A
INC IX
RET
SWITCH.COLOR
LD A,(COLOR)
XOR $80
LD (COLOR),A
RET
;
; $0A OPERATION
;
CR0A
LD A,(TATE)
DEC A
JR Z,CR.RIGHT
JP P,CR.UP
LD A,(DEST.TBL+1)
LD (XY+1),A
RET
CR.RIGHT
LD A,(DEST.TBL+3)
LD (XY+1),A
RET
CR.UP
LD A,(DEST.TBL)
LD (XY),A
RET
;
; $0D OPERATION
;
CRX
CALL CR0A
JR CRA
CR0D
LD A,(MZ.CR)
OR A
CALL Z,CR0A ;0=MZ
CRA
CALL GET.CR.PITCH
LD A,(TATE)
CP 2
JR Z,CR.TATE
LD A,(CR.PITCH)
LD HL,(XY)
ADD A,L
LD (XY),A
LD HL,(DEST.TBL+2)
SUB L
RET C
RET Z
CRW
LD B,A
LD HL,FONT.RECORD
SCRL.X
JP RETURN ;SCROLL JUMP
CR.TATE
LD HL,(CR.PITCH)
LD A,(XY+1)
SUB L
JR C,CRT
LD (XY+1),A
LD HL,(DEST.TBL)
SUB H
RET NC
CRT
NEG
JR CRW
;
; JIKAN,GYOKAN,CR PITCH
;
SET.PXY
LD A,(FONT.TYPE)
OR A
JR NZ,STPA
LD HL,(FONT.LY)
LD (PXY),HL
RET
STPA
LD A,(PROP.FLAG)
OR A
JR Z,STP
CALL GET.PITCH.X
LD A,D
LD (PXY+1),A
CALL GET.PITCH.Y
LD A,D
LD (PXY),A
RET
STP
LD HL,(?FONT.LY)
LD (PXY),HL
RET
;
; CR PITCH
;
GET.CR.PITCH
LD A,(CR.FLAG)
OR A
LD A,(CR.LEN)
JR NZ,GCPX
LD HL,(PXY)
LD A,(TATE)
CP 2
LD A,L
JR NZ,GCPX
LD A,H
GCPX
LD (CR.PITCH),A
RET
;
; PITCH X,Y WO MOTOMERU
;
GET.PITCH.X
LD BC,(FONT.LX)
LD A,(?FONT.LX)
LD (?WFLX+1),A
JR PITCH
GET.PITCH.Y
LD BC,(FONT.LY)
LD A,(?FONT.LY)
LD (?WFLX+1),A
PITCH
LD E,(IX)
LD D,0
LD HL,(PROP.TBL)
ADD HL,DE
LD L,(HL) ;CALL $3BA CALL 12
LD H,D
PUSH HL
?WFLX
LD H,0
LD E,D
LD B,D
LD L,D
CALL DIVISION32 ;CALL $3BA
POP DE ;CALL 12
CALL MULTI16 ;D=PLXY
RET
;
; TATE WORD WRAPAROUND
;
; WORD = セ & ソ
;
TATE.TRAP
LD A,(TATE)
CP 2
RET NZ
LD A,(FONT.TYPE)
OR A
RET NZ
LD A,(TATE.WRAP.FLAG)
OR A
RET Z
LD A,(IX+1)
CP $BE
RET C
CP $C0
RET NC
LD HL,(XY)
LD (STORE.XY),HL
LD HL,(OLD.XY)
INC H
LD (XY),HL
INC IX
CALL FONT
LD HL,(STORE.XY)
LD (XY),HL
RET
STORE.XY DS 2
OLD.XY DS 2
;
; FONT RECORD TABLE
;
FONT.RECORD
VERSION DB 0
XY DB 0
DB 0:0
DEST.TBL DB 0:0:24:39
VIEW.TBL DB 0:0:24:39
VRAM.SW DB 0
TATE DB 0
MZ.ASC DB 0
CONTROL.ADRS DW CONTROL
CONTROL?.ADRS DW CONTROL?
SCRL.JP DW RETURN
TAB.TBL DW 0000 ;RESERVE
PROP.FLAG DB 0
PROP.TBL DW 0
ASC.TBL DW $0A92
FONT.TBL DW 0000
FONT.TYPE DB 0
FONT.STYLE DW 0
COLOR DB $70
COLOR.EF DB 0
FONT.LY DB 1
FONT.LX DB 1
?FONT.LY DB 1
?FONT.LX DB 1
FONT.CHR DB $5A
BG.PAT.ADRS DW 0
BG.PAT.LX DB 0
FONT.PAT.ADRS DW 0
FONT.PAT.LX DB 0
SHADOW.COLOR DB $11
STRIKE.COLOR DB $22
UNDER.COLOR DB $33
UPPER.COLOR DB $44
TATE.WRAP.FLAG DB 0
JIKAN DB 0
CR.FLAG DB 0
CR.LEN DB 1
MZ.CR DB 0
FONT.TBL.END
;--------- INTERNAL WORK ----
CR.PITCH DB 0
PXY DB 0:0
LC DW 0
UN.CR DB 0
;--------- RECORD END -------
;
; FONT PRINT
;
FONT
LD A,(FONT.TYPE)
OR A
JP NZ,BIT.MAP.FONT
CALL CHECK.VIEW
RET C
LD L,(IX)
LD H,0
LD DE,(ASC.TBL)
ADD HL,DE
LD A,(HL)
EX AF,AF'
LD HL,(XY)
CALL ZAHYO
EX AF,AF'
LD (HL),A
CALL COLOR.ZAHYO
EF
LD A,(COLOR.EF)
DEC A
JP M,EF0
JR Z,EF1
SUB 2
JP M,EF2
RET Z
;
; BIT7 EFFECT
;
EF4
LD A,(IX)
CP $61
RET C
CP $7B
RET NC
SET 7,(HL)
RET
EF0
LD A,(COLOR)
LD (HL),A
RET
EF1
LD A,(COLOR)
RRD
LD (HL),A
RET
EF2
LD A,(COLOR)
NEG
LD (HL),A
RET
BIT.MAP.FONT
LD A,(VRAM.SW)
OR A
RET NZ
LD HL,(FONT.LY)
LD (STORE.FONT.LY),HL
LD HL,(?FONT.LY)
LD (STORE.?FONT.LY),HL
LD A,H
OR A
RET Z
LD A,L
OR A
RET Z
;
LD HL,(XY)
LD A,(VIEW.TBL+2) ;DOWN
CP L
RET C
;
CALL INIT.FONT
CALL FONT.OBJ
;LD A,(FONT.STYLE)
;BIT 0,A
;CALL NZ,REVERSE.UD
;LD A,(FONT.STYLE)
;BIT 1,A
;CALL NZ,REVERSE.LR
LD A,(FONT.STYLE)
BIT 2,A
CALL NZ,BOLD
LD A,(FONT.STYLE)
BIT 3,A
CALL NZ,ITALIC
LD A,(FONT.STYLE)
BIT 4,A
CALL NZ,OUTLINE
;
CALL COPY.TO.FONT.BF
;
LD A,(FONT.STYLE)
BIT 5,A
CALL NZ,BIT.REVERSE
LD A,(FONT.STYLE)
BIT 6,A
CALL NZ,STRIKE
LD A,(FONT.STYLE)
BIT 7,A
CALL NZ,UNDER.LINE
LD A,(FONT.STYLE+1)
BIT 0,A
CALL NZ,UPPER.LINE
LD A,(FONT.STYLE+1)
BIT 1,A
CALL NZ,BG.PATTERN
LD A,(FONT.STYLE+1)
BIT 2,A
CALL NZ,SHADOW
LD A,(FONT.STYLE+1)
BIT 3,A
CALL NZ,FONT.PATTERN
;
CALL GOSEI.FONT
LD A,(FONT.STYLE)
BIT 0,A
CALL NZ,REVERSE.UD
LD A,(FONT.STYLE)
BIT 1,A
CALL NZ,REVERSE.LR
;
CALL READ.PUT.LS.PEN
PUSH HL
LD HL,PRINT.LSX
CALL SET.PUT.LS.PEN
LD HL,(XY)
LD DE,FONT.BF
LD BC,(FONT.LY)
EXX
LD HL,(?FONT.LY)
EXX
CALL PUT.LS
POP HL
CALL SET.PUT.LS.PEN
;
LD HL,(STORE.FONT.LY)
LD (FONT.LY),HL
LD HL,(STORE.?FONT.LY)
LD (?FONT.LY),HL
RET
STORE.FONT.LY DS 2
STORE.?FONT.LY DS 2
;
; PUT.LS.PEN
;
PRINT.LSX
LD A,(DE)
INC A
RET Z
LD A,(FONT.STYLE+1)
BIT 4,A
JR Z,PLSX
SET 7,L
BIT 3,(HL)
RES 7,L
RET NZ
PLSX
PUSH BC
PUSH DE
PUSH HL
CALL GET.XY
LD BC,HL
RES 7,H
CALL CHECK.VIEW2
POP HL
POP DE
POP BC
RET C
SET 7,L
LD A,(DE)
LD (HL),A
RES 7,L
LD A,(FONT.CHR)
LD (HL),A
RET
;
; VIEW AREA CHECK!
;
CHECK.VIEW
LD BC,(XY)
CHECK.VIEW2
LD HL,(VIEW.TBL)
LD DE,(VIEW.TBL+2)
JP CHECK.AREA
;
;
; BIT MAP FONT EFFECT SUB
;
;
;
; UP <-> DOWN
;
REVERSE.UD
LD HL,(FONT.LY)
LD E,L
DEC E
CALL MULTI8
LD DE,FONT.BF
ADD HL,DE
LD BC,(FONT.LY)
SRA C
RET Z
RUD1
PUSH BC
RUD2
LD A,(DE)
LD C,(HL)
LD (HL),A
LD A,C
LD (DE),A
INC DE
INC HL
DJNZ RUD2
LD BC,(FONT.LX)
LD B,0
OR A
SBC HL,BC
SBC HL,BC
POP BC
DEC C
JR NZ,RUD1
RET
;
; LEFT <-> RIGHT
;
REVERSE.LR
LD BC,(FONT.LX)
LD B,0
DEC C
RET Z
LD DE,FONT.BF
LD HL,DE
ADD HL,BC
LD BC,(FONT.LY)
SRA B
RET Z
RLR1
PUSH BC
PUSH DE
PUSH HL
RLR2
LD A,(DE)
LD C,(HL)
LD (HL),A
LD A,C
LD (DE),A
INC DE
DEC HL
DJNZ RLR2
POP HL
POP DE
LD BC,(FONT.LX)
LD B,0
ADD HL,BC
EX DE,HL
ADD HL,BC
EX DE,HL
POP BC
DEC C
JR NZ,RLR1
RET
;
; BOLD
;
BOLD
LD HL,BIT.MAP.BF
LD C,16
BL0
LD B,4
XOR A
BL1
LD A,(HL)
RR (HL)
PUSH AF
OR (HL)
LD (HL),A
POP AF
INC HL
DJNZ BL1
DEC C
JR NZ,BL0
;
LD HL,FONT.LX
INC (HL)
LD HL,?FONT.LX
INC (HL)
RET
;
; ITALIC
;
ITALIC
LD A,(FONT.LY) ;FONT HEIGHT
LD C,A
ADD A,A
ADD A,A ;*4
LD E,A
LD D,0
LD HL,BIT.MAP.BF
ADD HL,DE
DEC HL
ITA1
BIT 0,C
JR Z,ITAX
PUSH HL
LD B,C
ITAQ
DEC HL
DEC HL
DEC HL
SRL (HL)
INC HL
RR (HL)
INC HL
RR (HL)
INC HL
RR (HL)
DEC HL
DEC HL
DEC HL
DEC HL
DJNZ ITAQ
POP HL
ITAX
DEC HL
DEC HL
DEC HL
DEC HL
DEC C
JR NZ,ITA1
;
LD A,(FONT.LY)
SRA A
LD C,A
LD HL,(FONT.LX)
ADD A,L
LD (FONT.LX),A
LD A,(?FONT.LX)
ADD A,C
LD (?FONT.LX),A
RET
OUTLINE
LD HL,WORK.BF
LD DE,WORK.BF+1
LD BC,4*19-1
LD (HL),B
LDIR
LD HL,BIT.MAP.BF
LD DE,WORK.BF
LD BC,4*19
LDIR
LD HL,WORK.BF
LD B,4*19
XOR A
OL0
LD A,(HL)
RR (HL)
PUSH AF
OR (HL)
LD (HL),A
POP AF
INC HL
DJNZ OL0
;
LD HL,WORK.BF
LD B,4*19
XOR A
OL1
LD A,(HL)
RR (HL)
PUSH AF
OR (HL)
LD (HL),A
POP AF
INC HL
DJNZ OL1
;
LD HL,4*19-1+WORK.BF
LD DE,4*18-1+WORK.BF
LD B,18*4
OL2
LD A,(DE)
OR (HL)
LD (HL),A
DEC DE
DEC HL
DJNZ OL2
;
LD HL,4*19-1+WORK.BF
LD DE,4*18-1+WORK.BF
LD B,18*4
OL3
LD A,(DE)
OR (HL)
LD (HL),A
DEC DE
DEC HL
DJNZ OL3
;
LD HL,BIT.MAP.BF
LD B,4*19
XOR A
OL4
RR (HL)
INC HL
DJNZ OL4
;
LD DE,BIT.MAP.BF
LD HL,WORK.BF+4
LD B,19*4
OL5
LD A,(DE)
CPL
AND (HL)
LD (HL),A
INC DE
INC HL
DJNZ OL5
;
LD HL,WORK.BF
LD DE,BIT.MAP.BF
LD BC,4*19
LDIR
;
LD HL,(FONT.LY)
INC H
INC H
INC L
INC L
LD (FONT.LY),HL
LD HL,(?FONT.LY)
INC H
INC H
INC L
INC L
LD (?FONT.LY),HL
RET
;
; BIT REVERSE
;
BIT.REVERSE
LD HL,FONT.BF
LD BC,(FONT.LY)
LD A,(COLOR)
LD D,A
LD A,B
LD (BR1+1),A
LD A,32
SUB B
LD (BRC+1),A
BR1
LD B,0
BR2
LD A,(HL)
INC A
LD A,D
JR Z,BR3
LD A,-1
BR3
LD (HL),A
INC HL
DJNZ BR2
LD A,C
BRC
LD C,0
ADD HL,BC
LD C,A
DEC C
JR NZ,BR1
RET
;
; STRIKE THROUGH
;
STRIKE
LD A,(FONT.LY)
SRA A
RET Z
LD BC,(STRIKE.COLOR)
JR UD0
;
; UNDER LINE
;
UNDER.LINE
LD A,(FONT.LY)
LD BC,(UNDER.COLOR)
DEC A
UD0
ADD A,A
ADD A,A
ADD A,A
LD L,A
LD H,0
ADD HL,HL
ADD HL,HL
LD DE,COLOR.BF
ADD HL,DE
JR UP
;
; UPPER LINE
;
UPPER.LINE
LD HL,COLOR.BF
LD BC,(UPPER.COLOR)
UP
LD A,(FONT.LX)
LD B,A
UP1
LD (HL),C
INC HL
DJNZ UP1
RET
;
; BIT.MAP.BF -> FONT.BF
;
COPY.TO.FONT.BF
LD HL,BIT.MAP.BF
LD DE,FONT.BF
LD C,4*19
LD A,-1
EX AF,AF'
LD A,(COLOR)
EX AF,AF'
CALL BIT.MAP.OBJ
LD HL,COLOR.BF
LD DE,COLOR.BF+1
LD BC,32*19
LD (HL),-1
LDIR
RET
;
; FONT.BF+COLOR.BF->COLOR.BF
;
GOSEI.FONT
LD HL,FONT.BF
LD DE,COLOR.BF
LD BC,32*19
GFA
LD A,(HL)
CP -1
JR Z,GFX
LD (DE),A
GFX
INC DE
CPI
JP PE,GFA
CONPRESS
LD HL,(FONT.LY)
LD A,32
SUB H
LD (CPC+1),A
LD C,L
LD A,H
LD (CPB+1),A
LD HL,COLOR.BF
LD DE,FONT.BF
CPB
LD B,0
CP1
LD A,(HL)
LD (DE),A
INC DE
INC HL
DJNZ CP1
LD A,C
CPC
LD C,0
ADD HL,BC
LD C,A
DEC C
JR NZ,CPB
RET
;
; BG PATTERN -> COLOR.BF
;
BG.PATTERN
LD HL,(FONT.LY)
LD A,(BG.PAT.LX)
SUB H ;BG.LX-LX
LD (BGL+1),A
LD HL,(BG.PAT.ADRS)
LD DE,COLOR.BF
LD A,(FONT.LX)
LD (BGB+1),A
LD C,A
LD A,32
SUB C
LD (BGC+1),A
LD A,(FONT.LY)
BGB
LD BC,0
LDIR
BGL
LD C,0
ADD HL,BC
EX DE,HL
BGC
LD BC,0
ADD HL,BC
EX DE,HL
DEC A
JR NZ,BGB
RET
;
; FONT PATTERN
;
FONT.PATTERN
LD HL,(FONT.LY)
LD A,32
SUB H
LD (FPB+1),A
LD A,(FONT.PAT.LX)
SUB H
LD (FPL+1),A
LD A,H
LD (FPA+1),A
LD C,L
LD DE,(FONT.PAT.ADRS)
LD HL,FONT.BF
FPA
LD B,0
FPBL
LD A,(HL)
INC A
JR Z,FPX
LD A,(DE)
LD (HL),A
FPX
INC DE
INC HL
DJNZ FPBL
LD A,C
FPB
LD C,0
ADD HL,BC
EX DE,HL
FPL
LD C,0
ADD HL,BC
EX DE,HL
LD C,A
DEC C
JR NZ,FPA
RET
;
; FONT INIT
;
INIT.FONT
LD HL,BIT.MAP.BF
LD DE,BIT.MAP.BF+1
LD BC,4*19-1
LD (HL),B
LDIR
LD HL,FONT.BF
LD DE,FONT.BF+1
LD BC,32*19-1
LD (HL),-1
LDIR
RET
;
; FONT MEM -> BIT.MAP.BF
;
FONT.OBJ
LD A,(FONT.LX)
LD BC,$202
CP 9
JR NC,FO1
INC C
DEC B
FO1
LD A,C
LD (FOC+1),A
LD A,B
LD (FOB+1),A
LD L,(IX)
LD H,0
ADD HL,HL
LD DE,(FONT.TBL)
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
LD HL,BIT.MAP.BF
LD BC,(FONT.LY)
FOB
LD B,0
FO2
LD A,(DE)
LD (HL),A
INC DE
INC HL
DJNZ FO2
LD A,C
FOC
LD C,0
ADD HL,BC
LD C,A
DEC C
JR NZ,FOB
RET
;
; SHADOW!
;
SHADOW
LD HL,FONT.BF
LD DE,COLOR.BF+32+1
LD BC,18*32-1
SHA
LD A,(HL)
INC A
JR Z,SHX
LD A,(SHADOW.COLOR)
LD (DE),A
SHX
INC DE
CPI
JP PE,SHA
;
LD HL,(FONT.LY)
INC L
INC H
LD (FONT.LY),HL
LD HL,(?FONT.LY)
INC L
INC H
LD (?FONT.LY),HL
RET
;
;
; SET FONT RECORD
;
;
SET.FONT.RECORD
OR A
JR NZ,SET.FONT.RECORD2
XFONT
LD DE,FONT.RECORD
LD BC,FONT.TBL.END-FONT.RECORD
LDIR
;
LD A,(VRAM.SW)
CALL SET.VRAM.SW
LD HL,(SCRL.JP)
LD (SCRL.X+1),HL
LD A,(MZ.ASC)
OR A
RET Z
LD HL,(CONTROL.ADRS)
LD (CTRL.JP+1),HL
LD HL,(CONTROL?.ADRS)
LD (PRINT.ONE.CHR+1),HL
RET
;
; CHR FONT REC.SET
;
; HL = FONT.RECORD
;
SET.FONT.RECORD2
LD DE,!FONT+1
LD BC,11
LDIR
LD A,(HL)
LD (!COLOR),A
INC HL
LD A,(HL)
LD (!EF),A
LD HL,!FONT
JR XFONT
;
; READ FONT RECORD
;
READ.FONT.RECORD
LD HL,FONT.RECORD
LD BC,FONT.TBL.END-FONT.RECORD
LDIR
RET
;
; SET X,Y
;
SET.XY
LD (XY),HL
RET
;
; READ.XY
;
READ.XY
LD HL,(XY)
RET
!FONT
DB 0
!XY DB 0
DB 0:0
DB 0:0:24:39
DB 0:0:24:39
DB 0
DB 0
DB 0
DW CONTROL
DW CONTROL?
DW RETURN
DW 0000 ;RESERVE
DB 0
DW 0
DW $0A92
DW 0000
DB 0
DW 0
!COLOR DB $70
!EF DB 0
DB 1
DB 1
DB 1
DB 1
DB 0
DW 0
DB 0
DW 0
DB 0
DB 0
DB 0
DB 0
DB 0
DB 0
DB 0
DB 0
DB 1
DB 0
;
;
; SYSTEM INSTALL
;
;
INSTALL
LD HL,INIT.TBL
LD DE,3*116+KERNEL
LD BC,INIT.TBL.END-INIT.TBL
LDIR
JP $AD
INIT.TBL
JP MESSAGE.LEFT
JP MESSAGE.RIGHT
JP MESSAGE.CENTER
JP PRINT.ONE.CHR
JP MESSAGE
JP MESSAGE.LENGTH
JP SET.FONT.RECORD
JP READ.FONT.RECORD
JP SET.XY
JP READ.XY
JP CR0A
JP CR0D
INIT.TBL.END
EVENT MANAGER
ORG $9000
;
; SYSTEM-7C
; (EVENT MANAGER)
;
ROM.DA EQU $0BCE
#ROM EQU $E0
#RAM EQU $E2
KC EQU $0C00
;DISPLAY CODE -> ASC
KERNEL EQU $1200
ADRS EQU KERNEL+$1E00
GET.KEY EQU 28*3+KERNEL
VTDXY EQU 8*3+KERNEL
ZAHYO EQU 50*3+KERNEL
COLOR.ZAHYO EQU 51*3+KERNEL
SET.VRAM.SW EQU 52*3+KERNEL
GAME.KEY EQU 33*3+KERNEL
SET.GAME.KEY EQU 31*3+KERNEL
READ.GAME.KEY EQU 32*3+KERNEL
READ.SWITCH EQU 54*3+KERNEL
READ.STICK EQU 55*3+KERNEL
SET.KEY.TABLE EQU 24*3+KERNEL
SET.KEY.MASK EQU 26*3+KERNEL
PRINT.SCORE EQU 18*3+KERNEL
SCORE.PLUS EQU 19*3+KERNEL
X.LIMIT EQU $4D ;$52
Y.LIMIT EQU $4D ;$61
OFFSET $A000-ADRS
ORG ADRS ;$3000-
;
; TEXT EDIT
;
; HL = EDIT.RECORD
;
TEXT.EDIT
LD DE,EDIT.RECORD
LD BC,EDIT.END-EDIT.RECORD
LDIR
LD HL,(#PRINT)
LD (PRINT+1),HL
LD HL,(EDIT.BF)
LD DE,(TEXT.BF)
LD BC,256
LDIR
LD HL,(EDIT.REPEAT.TIME)
LD (REPT.TIME),HL
LD (TM.WORK),HL
EDIT.LOOP
LD DE,(TEXT.BF)
LD HL,(XY)
LD A,(ASC.CODE)
PRINT
CALL 0
LD A,$F8
LD ($E000),A
LD A,($E001)
AND $81
JP Z,INIT.EVENT ;UNDO&RET;
OUT (#ROM),A
CALL KEY.REPEAT
OUT (#RAM),A
OR A
JR Z,EDIT.LOOP
LD (ASC.CODE),A
LD HL,EDIT.LOOP
PUSH HL
CP " "
JR Z,LEFT.KEY
CP " "
JR Z,RIGHT.KEY
CP " "
JR Z,UP.KEY
CP " "
JR Z,DOWN.KEY
CP 13
JR Z,CR.KEY
LD DE,(MAXL) ;E=X MAX L
LD A,(XY+1)
SUB E
LD E,A
LD D,0
LD HL,(TEXT.BF)
ADD HL,DE
LD A,(ASC.CODE)
LD (HL),A
;JR RIGHT.KEY
RIGHT.KEY
LD A,(MAXR)
LD C,A
LD A,(XY+1)
CP C
RET Z
INC A
LD (XY+1),A
RET
;
LEFT.KEY
LD A,(MAXL)
LD C,A
LD A,(XY+1)
CP C
RET Z
DEC A
LD (XY+1),A
RET
UP.KEY
LD A,(MAXL)
LD (XY+1),A
RET
DOWN.KEY
LD A,(MAXR)
LD (XY+1),A
RET
CR.KEY
POP AF
;
LD HL,(TEXT.BF)
LD DE,(EDIT.BF)
TGW
LD A,(HL)
LD (DE),A
OR A
JR Z,INIT.EVENT
CP $1A
JR Z,INIT.EVENT
INC DE
INC HL
JR TGW
EDIT.RECORD
XY DB 0:0
MAXL DB 0
MAXR DB 39
EDIT.BF DW 0
#PRINT DW 0
EDIT.END
ASC.CODE DS 1
;
; SET EVENT RECORD
;
; HL = EVENT TABLE ADRS
; A = SET.RECORD
; A <> 0 --- TO INIT.EVENT
;
SET.EVENT.RECORD
OR A
JR Z,INIT.EVENT
LD DE,EVENT.RECORD
LD BC,EVENT.END-EVENT.RECORD
LDIR
INIT.EVENT
LD HL,(KEY.REPEAT.TIME)
LD (REPT.TIME),HL
LD (TM.WORK),HL
RET
;
; READ EVENT RECORD
;
; DE = READ ADRS
;
READ.EVENT.RECORD
LD HL,EVENT.RECORD
LD BC,EVENT.END-EVENT.RECORD
LDIR
RET
EVENT.RECORD
CSR.CHR1 DB $33
CSR.COLOR1 DB $26
CSR.CHR2 DB $33
CSR.COLOR2 DB $26
FLASH.TYPE DB 0
KEY.REPEAT.TIME DW 12
EDIT.REPEAT.TIME DW 16
TEXT.BF DW $D400
NORMAL.KEY.TBL DW KC
SFT.KEY.TBL DW 64+KC
KANA.KEY.TBL DW 64*2+KC
SFT.KANA.KEY.TBL DW 64*3+KC
GRAPHIC.KEY.TBL DW 64*4+KC
SFT.GRAPH.TBL DW 64*5+KC
EVENT.END
KEY.MODE DB 0
;
; 0 = ENGLISH
; 1 = KANA
; 2 = GRAPHIC
;
;
; KEY REPEAT !
;
; EXIT:
; A = 0 --- NO KEY
; A <> 0 --- KEY IN & ASC CODE
;
KEY.REPEAT
CALL MODE.SET
CALL GET.KEY
JR NC,KRP1
LD HL,(REPT.TIME)
LD (TM.WORK),HL
XOR A
JR KRPX
KRP1
LD C,A
LD A,(KEY.CODE)
SUB C
JR NZ,KRP3
LD HL,(TM.WORK) ;0-32767
BIT 7,H
JR NZ,KRP2
DEC HL
LD (TM.WORK),HL
RET
KRP3
LD HL,(REPT.TIME)
LD (TM.WORK),HL
KRP2
LD A,C
KRPX
LD (KEY.CODE),A
RET
;
; KEY MODE SET
;
MODE.SET
CALL MODIFY
RRCA
LD BC,$0100
JR NC,MSR1
INC C
MSR1
XOR A
LD ($E000),A ;KEY PORT
LD A,($E001)
RLCA
JR NC,MSR2
INC B
RLCA
JR NC,MSR2
RLCA
RLCA
LD B,0
JR NC,MSR2
LD A,(KEY.MODE)
JR MSR3
MSR2
LD A,B
LD (KEY.MODE),A
MSR3
ADD A,A
ADD A,C ;MODE+SHIFT*2
;
; KEY TABLE SET
;
; A = 0 --- ENGLISH NORMAL
; A = 1 --- ENGLISH SHIFT
; A = 2 --- KANA KEY
; A = 3 --- SHIFT.KANA.KEY
; A = 4 --- GRAPHICS KEY
;
SET.KEY.X
EX AF,AF'
LD HL,MASK.TBL
CALL SET.KEY.MASK
EX AF,AF'
LD HL,NORMAL.KEY.TBL
ADD A,A
LD E,A
LD D,0
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
JP SET.KEY.TABLE
MASK.TBL
DB $27:$F8:-1:-1:-1
DB -1:-1:-1:0:0
;
; GAME KEY REPEAT !
;
; EXIT:
; A = 0 --- NO GAME KEY
; A <> 0 --- KEY IN CODE
;
GAME.KEY.REPEAT
CALL GAME.KEY
AND $3C
JR Z,GRP1
LD B,A
LD A,(KEY.CODE)
SUB B
JR NZ,GRP3
LD HL,(TM.WORK) ;0-32767
BIT 7,H
JR NZ,GRP2
DEC HL
LD (TM.WORK),HL
RET
GRP3
LD HL,(REPT.TIME)
LD (TM.WORK),HL
GRP2
LD A,B
GRP1
LD (KEY.CODE),A
RET
REPT.TIME DW 10
TM.WORK DS 2
KEY.CODE DS 1
;
; BEEP
;
BEEP
PUSH HL
LD HL,$E004 ;FREQ OUT
LD (HL),L
LD (HL),6
LD L,8
LD (HL),1
LD H,$34
BPL
DEC HL
LD A,H
OR L
JR NZ,BPL
LD ($E008),A ;STOP SOUND
POP HL
RET
;
; GET N CLICK
;
; EXIT:
;
; A = 0 --- NOTHING
; 1 --- MOVE POINTER ONLY
; 2 --- DRAG
; 3 --- SINGLE CLICK
; C = BIT CONDITION
; BIT 0 --- B BUTTON
; BIT 2 --- LEFT
; BIT 3 --- RIGHT
; BIT 4 --- DOWN
; BIT 5 --- UP
; BIT 6 --- A BUTTON
;
GET.POINTER
CALL GAME.KEY
AND $3C
JR Z,GPA
LD A,1
BIT 6,C
RET Z
INC A
RET
GPA
XOR A
LD (KEY.CODE),A
BIT 6,C
RET Z
LD A,3 ;SINGLE
RET
;
; SAVE CURSOR CHR&COLOR;
;
; H = X
; L = Y
;
SAVE.CSR
LD (STORE.XY),HL
CALL ZAHYO
LD A,(HL)
LD (STORE.CHR),A
CALL COLOR.ZAHYO
LD A,(HL)
LD (STORE.COLOR),A
RET
;
; LOAD CURSOR CHR&COLOR;
;
LOAD.CSR
LD HL,(STORE.XY)
CALL ZAHYO
LD A,(STORE.CHR)
LD (HL),A
CALL COLOR.ZAHYO
LD A,(STORE.COLOR)
LD (HL),A
RET
STORE.XY DS 2
STORE.CHR DB $33
STORE.COLOR DB $26
;
; FLASHING CURSOR
; C = 0 --- 0 VALUE1 _タ VALUE2
; C = 1 --- 1 VALUE _タ SAVE.CHR
;
FLASH.CSR
LD A,(FLASH.TYPE)
LD C,A
LD HL,(STORE.XY)
CALL ZAHYO
PUSH HL
CALL COLOR.ZAHYO
POP DE
LD A,($E002) ;BLNK COUNT
AND $40
JR NZ,FCSRA
LD A,(CSR.CHR1)
LD (DE),A
LD A,(CSR.COLOR1)
LD (HL),A
RET
FCSRA
LD A,C
OR A
JR NZ,FCSRB
LD A,(CSR.CHR2)
LD (DE),A
LD A,(CSR.COLOR2)
LD (HL),A
RET
FCSRB
LD A,(STORE.CHR)
LD (DE),A
LD A,(STORE.COLOR)
LD (HL),A
RET
;
; GET VALUE DECIMAL
;
; IX = ASCII CODE TEXT ADRS
;
; EXIT:
; CY = 1 --- ERROR
; CY = 0 --- HL = VALUE
;
GET.VALUE10
LD HL,0
LD D,L
LD A,(IX)
CP "9"+1
JR NC,ERROR
SUB "0"
RET C
G10
ADD HL,HL
LD BC,HL
ADD HL,HL
ADD HL,HL
ADD HL,BC
LD E,A
ADD HL,DE
INC IX
LD A,(IX)
CP "9"+1
RET NC
SUB "0"
JR NC,G10
ERROR
CCF
RET
;
; GET VALUE HEXADECIMAL
;
; IX = ASCII TEXT VALUE
;
; EXIT:
; CY = 1 --- ERROR
; CY = 0 --- HL = VALUE
;
GET.VALUE16
LD HL,0
LD D,L
CALL GET.HEX
RET C
LD L,A
RD16
INC IX
CALL GET.HEX
CCF
RET NC
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD E,A
ADD HL,DE
JR RD16
GET.HEX
LD A,(IX)
CP "F"+1
CCF
RET C
CP "0"
RET C
CP "9"+1
JR NC,GETH
SUB "0"
RET
GETH
SUB "A"
RET C
ADD A,10
RET
;
; BIN TO ASC CONVERT
;
; IN: HL = $0000 - $FFFF
; DE = RETURN BF (8 BYTES)
;
; OUT:
; RETURN BF = ASC
;
GETASC
EXX
LD HL,GABF
LD DE,GABF+1
LD BC,7
LD (HL),B
LDIR
EXX
LD (GAW+1),DE
LD IX,GATBL
LD B,16
GAA
PUSH BC
ADD HL,HL
JR NC,GAX
PUSH HL
LD C,(IX+2)
LD B,(IX+1)
LD E,(IX+0)
LD D,0
LD IY,DUMY
LD HL,GABF
CALL SCORE.PLUS
POP HL
GAX
LD DE,3
ADD IX,DE
POP BC
DJNZ GAA
LD HL,GABF
LD DE,?GABF
XOR A
CALL PRINT.SCORE
LD HL,?GABF
LD B,8
GAB
SET 4,(HL)
INC HL
DJNZ GAB
LD HL,?GABF
GAW
LD DE,0
LD BC,8
LDIR
RET
GABF DS 4
?GABF DS 4
DUMY DS 4
GATBL
DB 3:$27:$68
DB 1:$63:$84
DB 0:$81:$92
DB 0:$40:$96
DB 0:$20:$48
DB 0:$10:$24
DB 0:5:$12
DB 0:2:$56
DB 0:1:$28
DB 0:0:$64
DB 0:0:$32
DB 0:0:$16
DB 0:0:8
DB 0:0:4
DB 0:0:2
DB 0:0:1
;
; MODIFY KEY GET
;
; EXIT:
; A = BIT 7 (BREAK)
; 6 (CTRL)
; 0 (SHIFT)
;
; (1=ON,0=OFF)
;
MODIFY
LD A,$F8
LD ($E000),A
LD A,($E001)
CPL
RET
;
; MEMORY MANAGER
;
MEMORY.COPY
LD DE,COPY.TBL
LD BC,COPY.END-COPY.TBL
LDIR
LD HL,(COPY.BYTE)
LD A,H
OR L
RET Z
LD HL,(COPY.MOTO)
LD DE,(MEM.TOP)
OR A
SBC HL,DE
RET C
LD DE,(COPY.MOTO)
LD HL,(MEM.END)
OR A
SBC HL,DE
RET C ;CY=1---ERR
LD HL,(COPY.SAKI)
LD DE,(MEM.TOP)
OR A
SBC HL,DE
RET C
LD DE,(COPY.SAKI)
LD HL,(MEM.END)
OR A
SBC HL,DE
RET C
LD HL,(COPY.SAKI)
LD DE,(COPY.BYTE)
ADD HL,DE
EX DE,HL
LD HL,(MEM.END)
OR A
SBC HL,DE
RET C
;
LD HL,(COPY.MOTO)
LD DE,(COPY.SAKI)
LD BC,(COPY.BYTE)
PUSH HL
OR A
SBC HL,DE
POP HL
RET Z
JR C,MCB
LDIR
RET
MCB
DEC BC
ADD HL,BC
EX DE,HL
ADD HL,BC
EX DE,HL
INC BC
LDDR
OR A
RET
COPY.TBL
MEM.TOP DW 0
MEM.END DW 0
COPY.MOTO DW 0
COPY.SAKI DW 0
COPY.BYTE DW 0
COPY.END
;
; SWAP MEMORY
;
MEMORY.SWAP
LD A,(DE)
EX AF,AF'
LD A,(HL)
LD (DE),A
EX AF,AF'
LD (HL),A
INC DE
CPI
JP PE,MEMORY.SWAP
RET
;
;%%%%%%%%%%%%%%%%%%%%%%%%
;
; INSTALLER
;
; NO = 148 TO 172
;
INSTALL
LD HL,TABLE
LD DE,132*3+KERNEL
LD BC,TBL.END-TABLE
LDIR
LD A,$C3
LD HL,GET.VALUE10
LD (60*3+KERNEL),A
LD (60*3+KERNEL+1),HL
LD HL,GET.VALUE16
LD (61*3+KERNEL),A
LD (61*3+KERNEL+1),HL
LD HL,GETASC
LD (49*3+KERNEL),A
LD (49*3+KERNEL+1),HL
JP $00AD
TABLE
JP GAME.KEY.REPEAT
JP GET.POINTER
JP KEY.REPEAT
JP SET.EVENT.RECORD
JP READ.EVENT.RECORD
JP SAVE.CSR
JP LOAD.CSR
JP FLASH.CSR
JP MODIFY
JP SET.KEY.X
JP TEXT.EDIT
JP BEEP
JP MEMORY.COPY
JP MEMORY.SWAP
TBL.END
;
;
;
;
WINDOW MANAGER
;;
;
; SUPER SYSTEM-7C
; (WINDOW MANAGER)
;
KERNEL EQU $1200
ADRS EQU $3400
ITEM.LEN EQU 16 ;ITEM BF LEN
;
; OS KERNEL CALL
;
TDXY EQU 7*3+KERNEL
VTDXY EQU 8*3+KERNEL
SET.PEN.STYLE EQU 74*3+KERNEL
READ.PEN.STYLE EQU 75*3+KERNEL
BOX.FILL EQU 95*3+KERNEL
BOXFILL.PEN EQU 97*3+KERNEL
CIRCLE.FILL EQU 104*3+KERNEL
BOX.COLOR EQU 92*3+KERNEL
LINE EQU 102*3+KERNEL
CIRCLE EQU 103*3+KERNEL
BOX.PEN EQU 96*3+KERNEL
PEN EQU 109*3+KERNEL
XYCOOD EQU 40*3+KERNEL
CHECK.AREA EQU 36*3+KERNEL
TRANS40XY.DUAL EQU 11*3+KERNEL
GAME.KEY EQU 33*3+KERNEL
MOVE.FIGHTER EQU 34*3+KERNEL
MESSAGE.LEFT EQU 116*3+KERNEL
MESSAGE.CENTER EQU 118*3+KERNEL
MESSAGE.RIGHT EQU 117*3+KERNEL
SET.FONT.RECORD EQU 122*3+KERNEL
READ.FONT.RECORD EQU 123*3+KERNEL
SET.XY EQU 124*3+KERNEL
XYLEN EQU 41*3+KERNEL
LOAD.CSR EQU 138*3+KERNEL
SAVE.CSR EQU 137*3+KERNEL
FLASH.CSR EQU 139*3+KERNEL
GET.CLICK.STATUS EQU 133*3+KERNEL
GAME.KEY.REPEAT EQU 132*3+KERNEL
CHECK.700.1500 EQU 2*3+KERNEL
TEXT.EDIT.LINE EQU 142*3+KERNEL
SET.EVENT.RECORD EQU 135*3+KERNEL
BEEP EQU 143*3+KERNEL
MULTI8 EQU 56*3+KERNEL
DIV16 EQU 59*3+KERNEL
GET.KEY EQU 28*3+KERNEL
MODIFY EQU 140*3+KERNEL
WINDOW.LEN EQU 20
ITEM.Z.MAX EQU 63
OFFSET $B000-ADRS
ORG ADRS
;
; BOX CLIPING
;
; H = X1,L=Y1
; D = X2,E=Y2
;
; EXIT:
; A = -1 : NO DISPLAY
; A <>-1 : DISPLAY
; X1=Y1 !!!
;
;
DRAG
PUSH IY
LD IY,DRAG.RECORD
PUSH HL
LD DE,DRAG.RECORD
LD BC,12
LDIR
LD HL,(DR.CALL)
LD (DRAG.CALL+1),HL
LD HL,(DY1)
SET 7,H
LD (DY1),HL
LD HL,(DY2)
SET 7,H
LD (DY2),HL
CALL DRAG.SUB
RES 7,H
RES 7,D
LD (DY1),HL
LD (DY2),DE
LD (RET.DXY),BC
POP DE
LD HL,DRAG.RECORD
LD BC,10
LDIR
POP IY
RET
;
; DRAG SUBROUTINE
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
; EXIT:
; H = NEW X1
; L = NEW Y1
; D = NEW X2
; E = NEW Y2
; B = DX (NEW X2 - OLD X2)
; C = DY (NEW Y2 - OLD Y2)
;
DRAG.SUB
LD HL,(DY1)
LD DE,(DY2)
LD (MY1),HL
LD (MY2),DE
DRL0
DRAG.CALL
CALL RETURN
LD HL,(DY1)
LD DE,(DY2)
CALL CPL.OPERATION
LD HL,(#XY)
CALL SAVE.CSR
LD C,0
CALL FLASH.CSR
CALL PRINT.SCREEN
CALL LOAD.CSR
DRL1
CALL GAME.KEY
BIT 0,A
JR NZ,DRL1
BIT 6,A
JP Z,DRAG.OFF
AND $3C
JR Z,DRL1
LD (A.STORE),A
LD HL,(DY1)
LD DE,(DY2)
CALL CPL.OPERATION
LD A,(A.STORE)
LD HL,LIMIT.TBL
LD DE,(#XY)
CALL MOVE.FIGHTER
LD HL,(#XY)
LD (#XY),DE
CALL GET.DXY
LD DE,(DY2)
LD HL,(DY1)
CALL PLUS.DXY
LD (DY2),DE
LD A,(RESIZE)
OR A
JR NZ,DRL0
LD (DY1),HL
JR DRL0
DRAG.OFF
LD HL,(DY1)
LD DE,(DY2)
CALL CPL.OPERATION
CALL PRINT.SCREEN
LD HL,(MY2)
LD DE,(DY2)
CALL GET.DXY
LD HL,(DY1)
RETURN
RET
;
; GET DXY
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
; EXIT:
; B = DX (X2-X1)
; C = DY (Y2-Y1)
;
GET.DXY
LD A,D
SUB H
LD B,A
LD A,E
SUB L
LD C,A
RET
;
; PLUS DXY
;
; H = X1
; L = Y1
; D = X2
; E = Y2
; B = DX
; C = DY
;
; EXIT:
; H = H + B
; L = L + C
; D = D + B
; E = E + C
;
PLUS.DXY
LD A,B
ADD A,H
LD H,A
LD A,C
ADD A,L
LD L,A
LD A,B
ADD A,D
LD D,A
LD A,C
ADD A,E
LD E,A
RET
;
; CPL OPERATION
;
CPL.OPERATION
EXX
CALL READ.PEN.STYLE
PUSH HL
LD HL,PEN.CPL
CALL SET.PEN.STYLE
LD HL,(CPL.TYPE)
LD H,0
ADD HL,HL
LD DE,CPL.TBL
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
LD (CPLJP+1),DE
EXX
CPLJP
CALL 0
POP HL
JP SET.PEN.STYLE
CPL.TBL
DW LINE:BOX.CPL
DW CIRCLE:BOXFILL.PEN
DW CIRCLE.FILL
;
; BOX.CPL
;
; H = X1
; L = Y1
; D = X2
; E = Y2
;
BOX.CPL
LD (BXY1),HL
LD (BXY2),DE
CALL BOX.PEN
LD HL,(BXY1)
CALL PEN
LD HL,(BXY2)
CALL PEN
LD HL,(BXY1)
LD A,(BXY2+1)
LD H,A
CALL PEN
LD HL,(BXY1)
LD A,(BXY2)
LD L,A
JP PEN
;
; PEN.CPL
;
;
;
PEN.CPL
PUSH BC
PUSH DE
PUSH HL
PUSH HL
LD BC,HL
LD HL,(WXY1C)
LD DE,(WXY2C)
CALL CHECK.AREA
POP HL
JR C,PENX
CALL TDXY
LD A,(HL)
CPL
LD (HL),A
PENX
POP HL
POP DE
POP BC
RET
;
; PRINT SCREEN (TRANS)
;
; PARAMETER NOTHING..
;
PRINT.SCREEN
LD HL,(?XY)
LD DE,(VRAM.ADRS)
LD A,(?LY)
LD B,A
EXX
LD B,A
LD HL,(?XY)
SET 7,H
LD DE,(VRAM.ADRS)
SET 3,D
JP TRANS40XY.DUAL
;
; PRINT BG..
;
; PARAMETER NOTHING..
;
PRINT.BG
LD HL,(WY1)
LD DE,(WY2)
LD A,(BG.CHR)
CALL BOX.FILL
LD HL,(WY1C)
LD DE,(WY2C)
LD A,(BG.COLOR)
JP BOX.FILL
;
; SUB FUNCTION CALL
;
; A = FUNCTION NO.
;
FUNCTION
PUSH DE
PUSH HL
ADD A,A
LD E,A
LD D,0
LD HL,FUNC.TBL
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
LD (FJP+1),DE
POP HL
POP DE
FJP JP 0
FUNC.TBL
DW QUIT:EVENT.LOOP:ACTIVE
DW INACTIVE:WAIT.ON.EVENT
DW MOVE.CSR:WSET.FUNC
DW PRIORITY:FLASH.ITEM:DRAG
DW VIEW.CLIP.CHR:VIEW.CLIP.ATB
DW $0000:NEW.WINDOW
DW CLOSEBOX:AW.ACTIVE
DW SET.DUMY:PLUS.WXY:PLUS.NXY
DW WSET3:SERCH.TYPE
DW SERCH.GP&ID.ITEM;
DW SERCH.HEADER
DW BIN.ASC:BIN.HEX
DW SERCH.HEADER2
DW GET.STACK:SET.QUIT
;
; SYSTEM DUMY MODE
;
; IN: C = CONDITION
; HL = DUMY EXEC ADRS
;
SET.DUMY
LD A,C
LD (DUMY.MODE),A
LD (DUMY.JP+1),HL
RET
;
; QUIT ROUTINE
;
QUIT
LD A,(QFLG)
OR A
JR Z,QX
LD HL,(QJP)
JP (HL)
QX
LD HL,$D000
LD DE,$D001
LD BC,1000
LD (HL),L
LDIR
LD HL,$D800
LD DE,$D801
LD BC,1000
LD (HL),$71
LDIR
CALL GET.STACK
LD SP,HL
CALL CHECK.700.1500
OR A
JP NZ,$00AD
JP $E804
QFLG DB 0
QJP DW QX
SET.QUIT
LD A,C ;CONDITION
LD (QFLG),A
LD (QJP),HL
RET
GET.STACK
LD HL,$10F0 ;MZ STACK
RET
;
; EVENT LOOP
;
; EXIT:
; CY = 1 --- THEN EXT.EVENT
;
EVENT.LOOP
CALL PRINT.BG
CALL PRINT.WINDOW.BF
ELOOP2
CALL WAIT.ON.EVENT
RET C ;EXT.EVENT->RET&A;=CODE
CP -1
JR Z,EXA
DEC A
JR Z,EMOVE
DEC A
JR Z,DRAG.MX
CALL CHECK.CLICK.POINT.BF
JR C,EMOVE
CALL ACTIVE
EXA
CALL ID.JUMP
JR EVENT.LOOP
EMOVE
CALL MOVE.CSR
JR ELOOP2
DRAG.MX
CALL CHECK.CLICK.POINT.BF
JR C,EMOVE
CALL ACTIVE
CALL ID.JUMP
CALL MOVE.CSR
JR EVENT.LOOP
;
; EVENT WAITING
;
; EXIT:
; A = CLICK STATUS
;
WAIT.ON.EVENT
LD HL,(USER.XY)
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
CALL SAVE.CSR
LOOPA
CALL EXTERNAL
RET C ;A=CODE
CALL FLASH.CSR
CALL PRINT.SCREEN
CALL LOAD.CSR
CALL SHORT.CUT
LD A,-1
RET NC
CALL GET.CLICK.STATUS
OR A
JR Z,LOOPA
RET
EXTERNAL
LD HL,(EXT.CALL)
JP JPHL
;
; MOVE CSR XY
;
MOVE.CSR
CALL GAME.KEY.REPEAT
OR A
RET Z
LD HL,(USER.XY)
LD E,(HL)
INC HL
LD D,(HL)
LD HL,LIMIT.TBL
CALL MOVE.FIGHTER
LD HL,(USER.XY)
LD (HL),E
INC HL
LD (HL),D
RET
;
; WXY+SCRN.XY FUNCTION
;
; IN:IX = WINDOW.BF
;
; EXIT:H=X1,L=Y1,D=X2,E=Y2
;
WSET.FUNC
CALL WSET
LD HL,(#WY1)
LD DE,(#WY2)
RET
;
; IX = WINDOW XY
; HL=X,Y + WXY
;
PLUS.NXY
PUSH HL
CALL WSET.FUNC
POP DE
LD A,D
ADD A,H
LD H,A
LD A,E
ADD A,L
LD D,A
RET
;
; KEY BOARD SHORT CUT
;
SHORT.CUT
LD HL,(COMMAND.KEY)
LD A,H
OR L
SCF
RET Z
CALL MODIFY
BIT 6,A
SCF
RET Z
OUT ($E0),A
CALL GET.KEY
OUT ($E2),A
RET C
LD C,A
LD IX,(COMMAND.KEY)
LD DE,4
SHCA
LD A,(IX)
OR A
SCF
RET Z
CP C
JR Z,SHCB
ADD IX,DE
JR SHCA
SHCB
LD C,(IX+1)
LD E,(IX+2)
LD D,(IX+3)
PUSH DE
CALL SERCH.WTYPE
POP DE
RET C
PUSH DE
CALL SERCH.TYPE
POP DE
RET C
JP SERCH.GP&ID.ITEM;
SERCH.WTYPE
LD IX,(WINDOW.BF)
LD DE,20
SERW
LD A,(IX)
INC A
SCF
RET Z
LD A,C
CP (IX+13)
RET Z
ADD IX,DE
JR SERW
%XY DS 2
BXY1 DS 2
BXY2 DS 2
WVIEW.ATB
WXY1C
WY1C DB 0
WX1C DB 64+128
WXY2C
WY2C DB 24
WX2C DB 39+64+128
W.RECORD ;WINDOW RECORD
VERSION DB 0
USER.XY DW 0
WVIEW
LIMIT.TBL
WY1 DB 0
WX1 DB 64
WY2 DB 24
WX2 DB 39+64
WINDOW.BF DW 0
ITEM.BF DW 0
DATA.BF DW 0
?XY DB 0:0
VRAM DB 0:0
?LY DB 25
EXT.CALL DW 0
ZERO.JP DW 0
COMMAND.KEY DW 0
W.RECORD.END
W.STORE DS 24
VRAM.ADRS DW 0
W.RECORD.EXT
SCRNXY DB 0:44
BG.CHR DB $5A
BG.COLOR DB $45
W.EN.COLOR DB $70
W.DIS.COLOR DB $15
W.RECT DB $00
W.RIGHT DB $37
W.DOWN DB $36
W.COLOR DB $07
W.SHADOW DB $90
FLASH.KAISU DB 2
CHECKMARK DB $AC
CHECKCOLOR DB $71
RADIO.MARK DB $47
W.RECORD.EXT.END
DRAG.RECORD
#XY DS 2
DY1 DS 2
DY2 DS 2
CPL.TYPE DB 0
RESIZE DB 1
RET.DXY DS 2
DR.CALL DW RETURN
MY1 DS 2
MY2 DS 2
A.STORE DS 1
;
COUNT DS 1
%ID DS 2
FLAG.ONF DS 1
STR DS 40
DB $1A
;
;
; SYSTEM INSTALL
;
;
INSTALL
LD HL,INST.TBL
LD DE,148*3+KERNEL
LD BC,TBL.END-INST.TBL
LDIR
JP $AD
INST.TBL
JP SET.WINDOW.RECORD
JP READ.WINDOW.RECORD
JP SET.WINDOW.RECORD.EXT
JP READ.WINDOW.RECORD.EXT
JP PRINT.WINDOW.ONE
JP PRINT.WINDOW.BF
JP PRINT.BG
JP PRINT.SCREEN
JP CHECK.XY.CHR
JP CHECK.XY.WIN
JP CHECK.CLICK.POINT.BF
JP ID.JUMP
JP FUNCTION
JP $4600
JP $4800
JP BEEP
TBL.END
SERVICE ROUTINE
; ;
; SYSTEM-7C ENTRY
;
KERNEL EQU $1200
SET.EVENT.RECORD EQU 135*3+KERNEL
SET.W.RECORD EQU 148*3+KERNEL
READ.W.RECORD EQU 149*3+KERNEL
PRINT.SCREEN EQU 155*3+KERNEL
PRINT.WINDOW.ONE EQU 152*3+KERNEL
CHECK.CLICK.POINT EQU 158*3+KERNEL
ID.JUMP EQU 159*3+KERNEL
FUNCTION EQU 160*3+KERNEL
LOAD&SAVE.MODULE; EQU 161*3+KERNEL
MULTI16 EQU 58*3+KERNEL
XYLEN EQU 41*3+KERNEL
XYCOOD EQU 40*3+KERNEL
ESC EQU $1B
OFFSET $C000-$4800
ORG $4800
;
; FILE SERVISE ROUTINE
;
MAIN
PUSH IX
PUSH IY
CALL FILE
POP IY
POP IX
RET
FILE
PUSH DE
PUSH HL
ADD A,A
LD E,A
LD D,0
LD HL,JPTBL
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
LD (JPX+1),DE
POP HL
POP DE
JPX JP 0000 ;REWRITE
JPTBL
DW LOAD&SAVE.MODULE;
DW FILE1:FILE2:FILE3
DW OK1:OK2:RETURN
DW RETURN:RETURN
DW RETURN ;9
DW RETURN ;10
DW RETURN:RETURN
DW RETURN:RETURN
DW RETURN
;
DW MAIN.EF
DW SET.DEF
DW XTDXY
DW GET.EF
DW SET.EF2
DW MEM.TO.SCRN
DW SCRN.TO.MEM
DW OFFSCRN.PUT
DW SERCH.AFTER.END
DW SERCH.AFTER.CR
DW SET.EFFECT
MAIN.EF
CALL SET.EF
LD A,B
LD (N),A
CALL XYCOOD
CALL XYLEN
CALL XTDXY
MEF1
PUSH BC
PUSH HL
MEF2
PUSH BC
PUSH HL
LD A,(N)
EFCALL
CALL 0
POP HL
POP BC
INC HL
DJNZ MEF2
POP HL
LD DE,(LX)
ADD HL,DE
POP BC
DEC C
JR NZ,MEF1
RET
SET.DEF
LD (LX),HL
LD (ADDRESS),DE
RET
XTDXY
PUSH BC
PUSH DE
PUSH HL
LD H,0
LD DE,(LX)
CALL MULTI16
LD HL,(ADDRESS)
ADD HL,DE
POP DE
LD E,D
LD D,0
ADD HL,DE
POP DE
POP BC
RET
ADDRESS DS 2
LX DS 2
N DS 1
SET.EF
PUSH BC
PUSH HL
LD B,0
RLC C
LD HL,SET.TBL
ADD HL,BC
LD C,(HL)
INC HL
LD B,(HL)
LD (EFCALL+1),BC
POP HL
POP BC
RET
SET.EFFECT
LD (EFCALL+1),HL
RET
SET.EF2
PUSH HL
LD B,0
RLC C
LD HL,SET.TBL
ADD HL,BC
LD C,(HL)
INC HL
LD B,(HL)
POP HL
RET
SET.TBL
DW EF1:EF2:EF3:EF4
DW EF5:EF6:EF7:EF8
DW EF9:EF10:EF11:EF12
DW EF13:EF14:EF15
GET.EF
LD HL,(EFCALL+1)
RET
;
; EFFECT ROUTINES
;
; ADD N
EF4
ADD A,(HL)
LD (HL),A
RET
; SUB N
EF5
SUB (HL)
LD (HL),A
RET
;COLOR PLUS
EF12
LD A,(HL)
AND $F0
CP $F0
JR Z,EF3A
LD A,(HL)
ADD A,$10
LD (HL),A
EF3A
LD A,(HL)
AND $0F
CP $0F
RET Z
INC (HL)
RET
;COLOR MINUS
EF13
LD A,(HL)
AND $F0
JR Z,EF4A
LD A,(HL)
SUB $10
LD (HL),A
EF4A
LD A,(HL)
AND $0F
RET Z
DEC (HL)
RET
; RLC
EF8
RLC (HL)
RET
; RRC
EF9
RRC (HL)
RET
; 2 VALUE
EF15
LD DE,0
LD A,(HL)
AND $70
CP 4
JR C,EF7A
LD D,7
EF7A
LD A,(HL)
AND 7
CP 4
JR C,EF7B
LD E,7
EF7B
LD A,D
OR E
LD (HL),A
RET
; SRA
EF10
SRA (HL)
RET
; SLA
EF11
SLA (HL)
RET
; CPL
EF6
LD A,(HL)
CPL
LD (HL),A
RET
; NEGATIVE
EF7
LD A,(HL)
NEG
LD (HL),A
RET
; AND N
EF1
AND (HL)
LD (HL),A
RET
; OR N
EF2
OR (HL)
LD (HL),A
RET
; XOR N
EF3
XOR (HL)
LD (HL),A
RET
; H_タL
EF14
RLC (HL)
RLC (HL)
RLC (HL)
RLC (HL)
RET
;
; OFFSCRN PUT ROUTINE
;
; HL = XY
; DE = DATA
; BC = LXY
; HL'= OPERATION ADRS
;
OFFSCRN.PUT
EXX
LD (FPC+1),HL
EXX
LPA
PUSH BC
PUSH HL
FPA
PUSH BC
PUSH DE
PUSH HL
FPC
CALL 0000
POP HL
POP DE
POP BC
INC H
INC DE
DJNZ FPA
POP HL
POP BC
INC L
DEC C
JR NZ,LPA
RET
;
; HL = TEXT
; BC = COUNTER
;
; EXIT:
; CY = 0 --- ARI
; CY = 1 --- MOJI NASI
;
SERCH.AFTER.END
LD A,(HL)
OR A
SCF
RET Z
CP $1A
SCF
RET Z
CP " "+1
RET NC
CPI
JP PE,SERCH.AFTER.END
RET
;
; HL = TEXT
; BC = COUNTER
;
; EXIT:
; CY = 0 --- ARI
; CY = 1 --- MOJI NASI
;
SERCH.AFTER.CR
LD A,(HL)
OR A
SCF
RET Z
CP $1A
SCF
RET Z
CP 13
SCF
RET Z
CP 10
SCF
RET Z
CP " "+1
RET NC
CPI
JP PE,SERCH.AFTER.CR
RET
;
; MEM TO OFFSCRN MEM
;
; HL=OFFSCRN X,Y
; DE=MEMORY ADDRESS
; BC=TRANS LX,LY
;
;
MEM.TO.SCRN
PUSH BC
PUSH HL
LD HL,(LX)
LD C,B
LD B,0
SUB HL,BC
LD A,L
LD (MTSC+1),A
POP HL
POP BC
CALL XTDXY
EX DE,HL
LD A,B
LD (MTSB+1),A
LD A,C
LD B,0
MTSB
LD C,0
LDIR
EX DE,HL
MTSC
LD C,0
ADD HL,BC
EX DE,HL
DEC A
JR NZ,MTSB
RET
;
; OFFSCRN TO MEMORY
; HL=OFFSCRN X,Y
; DE=MEMORY
; BC=TRANS LX,LY
;
SCRN.TO.MEM
PUSH BC
PUSH HL
LD HL,(LX)
LD C,B
LD B,0
SUB HL,BC
LD A,L
LD (STMC+1),A
POP HL
POP BC
CALL XTDXY
LD A,B
LD (STMB+1),A
LD A,C
LD B,0
STMB
LD C,0
LDIR
STMC
LD C,0
ADD HL,BC
DEC A
JR NZ,STMB
RET
;
; ALART WINDOW DISPLAY
;
; HL = TEXT DATA ADRS
; BC = TEXT DTA LENGHTH
;
OK1
LD DE,@61
LDIR
LD A,1
LD IX,WINDOW6.BF
CALL W.SET
LD HL,W.REC2
CALL SET.W.RECORD
XOR A
LD (FLAG),A
;
LD IX,WINDOW6.BF
CALL EVENT.LOOP
CALL W.REQ
XOR A
RETURN
RET
;
; YES/NO WINDOW DISPLAY
;
; HL = TEXT DATA ADRS
; BC = TEXT DTA LENGHTH
;
OK2
LD DE,@61
LDIR
LD A,1
LD IX,WINDOW7.BF
CALL W.SET
LD HL,W.REC2
CALL SET.W.RECORD
XOR A
LD (FLAG),A
;
LD IX,WINDOW7.BF
CALL EVENT.LOOP
CALL W.REQ
LD A,(FLAG)
DEC A
RET Z
SCF
RET
;
; INPUT FILENAME
;
; HL = FILE.RECORD ADDRESS
;
FILE1
LD (MOTO),HL
LD IX,WINDOW1.BF
CALL W.SET
LD A,1
LD HL,W.REC2
CALL SET.W.RECORD
XOR A
LD (FLAG),A
;
LD IX,WINDOW1.BF
FSW1
CALL EVENT.LOOP
CALL W.REQ
SCF
RET NZ
LD HL,FNAME
LD DE,FILE.NAME
LD BC,15
LDIR
LD HL,FILE.RECORD
LD DE,(MOTO)
LD BC,FILE.END-FILE.RECORD
LDIR
XOR A
RET
MOTO DS 2
FLAG DB 1
BTN.OK
LD A,1
LD (FLAG),A
RET
BTN.CANSEL
LD A,2
LD (FLAG),A
RET
;------------------
FILE2
LD (MOTO),HL
LD IX,WINDOW4.BF
CALL W.SET
LD HL,W.REC2
CALL SET.W.RECORD
LD IX,WINDOW2.BF
CALL PRINT.WINDOW.ONE
CALL PRINT.SCREEN
LD HL,(MOTO)
CALL LOAD&SAVE.MODULE;
CALL W.REQ
RET NC
LD HL,W.REC2
CALL SET.W.RECORD
XOR A
LD (FLAG),A
LD IX,WINDOW4.BF
CALL EVENT.LOOP
CALL W.REQ
SCF
RET
BTN.OK2
LD A,1
LD (FLAG),A
RET
FILE3
LD (MOTO),HL
LD IX,WINDOW5.BF
CALL W.SET
LD HL,W.REC2
CALL SET.W.RECORD
LD IX,WINDOW3.BF
CALL PRINT.WINDOW.ONE
CALL PRINT.SCREEN
LD HL,(MOTO)
CALL LOAD&SAVE.MODULE;
CALL W.REQ
RET NC
LD HL,W.REC2
CALL SET.W.RECORD
XOR A
LD (FLAG),A
LD IX,WINDOW5.BF
CALL EVENT.LOOP
CALL W.REQ
SCF
RET
EVENT.LOOP
CALL PRINT.WINDOW.ONE
CALL PRINT.SCREEN
EVL1
LD A,4
CALL FUNCTION
DEC A
JR Z,MOVE#
DEC A
JR Z,MOVE#
LD HL,(USER.XY)
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
CALL CHECK.CLICK.POINT
JR C,EVL1
CALL ID.JUMP
LD A,(FLAG) ;1=OK,2=CANSEL
DEC A
JP M,EVL1
RET
MOVE#
LD A,5
CALL FUNCTION
JR EVL1
W.SET
LD DE,FILE.RECORD
LD BC,FILE.END-FILE.RECORD
LDIR
LD DE,W.REC.SAVE
CALL READ.W.RECORD
LD HL,W.REC.SAVE
LD DE,W.REC2
LD BC,W.REC.SAVE.END-W.REC.SAVE
LDIR
LD HL,ITEM1.BF
LD (ITEM%),HL
LD HL,DATA.BF
LD (DATA%),HL
LD (WIND%),IX
RET
W.REQ
EX AF,AF'
LD A,1
LD HL,W.REC.SAVE
CALL SET.W.RECORD
EX AF,AF'
RET
W.REC.SAVE
DB 0
DS 2
DS 4
DS 2
DW 0
DW 0
SCRN.XY DS 2
DS 2
DB 1
DW 0
DW 0
DW 0
W.REC.SAVE.END
W.REC2
DB 0
USER.XY DS 2
DS 4
WIND% DW 0
ITEM% DW 0
DATA% DW 0
DS 2
DS 2
DS 1
DW 0
DW 0
DW 0
FILE.RECORD
DB 0:5:0
DW 0 ;SIZE
DW $C000 ;DUMMY TOP
DW $00AD ;EXEC
DW $C000
DM " "
DM " "
FILE.NAME
DS 15
DB 13
DS 16 ;COMMENT
FILE.END
DS 8
WINDOW1.BF
DB 1:1:1:0
DB 4:4:4+8:4+18
DB 0:0:0:0
DB 1:1
DW 0:CODE1
DS 2
DB -1
WINDOW2.BF
DB 1:1:1:0
DB 4:4:4+6:4+23
DB 0:0:0:0
DB 1:2
DW 0:CODE1
DS 2
DB -1
WINDOW3.BF
DB 1:1:1:0
DB 4:4:4+6:4+23
DB 0:0:0:0
DB 1:3
DW 0:CODE1
DS 2
DB -1
WINDOW4.BF
DB 1:1:1:0
DB 4:4:4+6:4+23
DB 0:0:0:0
DB 1:4
DW 0:CODE4
DS 2
DB -1
WINDOW5.BF
DB 1:1:1:0
DB 4:4:4+6:4+23
DB 0:0:0:0
DB 1:5
DW 0:CODE4
DS 2
DB -1
WINDOW6.BF
DB 1:1:1:0
DB 5:12:5+8:12+16
DB 0:0:0:0
DB 1:6
DW 0:CODE6
DS 2
DB -1
WINDOW7.BF
DB 1:1:1:0
DB 5:11:5+8:12+14
DB 0:0:0:0
DB 1:7
DW 0:CODE7
DS 2
DB -1
DB -1
CODE1
DW 0:RETURN:RETURN
DW BTN.OK:BTN.CANSEL
CODE4
DW 0:RETURN:BTN.OK2
CODE6
DW 0:BTN.OK:0:0
CODE7
DW 0:BTN.OK:BTN.CANSEL
ITEM1.BF
DB 1
;MSG
DB 1:1:2:1:2:16
DB 1:1
DB 1:1
DS 6
;TEXT
DB 1:0:4:2:4:16
DW FNAME
DB 1:-4
DS 6
;OK
DB 1:1:7:1:7:8
DB 1:3
DB 1:3
DS 6
;CANSEL
DB 1:1:7:10:7:17
DB 1:4
DB 1:4
DS 6
DB -1
;----- WINDOW 2 -----
DB 2
;MSG
DB 1:1:2:2:5:22
DB 2:1
DB 2:1
DS 6
DB -1
;----- WINDOW 3 -----
DB 3
;MSG
DB 1:1:2:2:5:22
DB 3:1
DB 3:1
DS 6
DB -1
;----- WINDOW 4 -----
DB 4
;MSG
DB 1:1:2:5:2:28
DB 4:1
DB 4:1
DS 6
;BTN.OK
DB 1:1:5:9:5:16
DB 1:3
DB 4:2
DS 6
DB -1
;----- WINDOW 5 -----
;MSG
DB 5
DB 1:1:2:5:2:28
DB 5:1
DB 5:1
DS 6
;BTN.OK
DB 1:1:5:9:5:16
DB 1:3
DB 5:2
DS 6
DB -1
;----- WINDOW 6 -----
;MSG
DB 6
DB 1:1:2:1:5:14
DB 6:1
DB 1:2
DS 6
;BTN.OK
DB 1:1:7:4:7:11
DB 1:3
DB 1:1
DS 6
DB -1
;----- WINDOW 7 -----
;MSG
DB 7
DB 1:1:2:1:5:14
DB 6:1
DB 1:0
DS 6
;BTN.YES
DB 1:1:7:2:7:6
DB 7:1
DB 1:1
DS 6
;BTN.NO
DB 1:1:7:9:7:13
DB 7:2
DB 1:2
DS 6
DB -1
DB -1 :-1
FNAME DS 16
DATA.BF
;------ GP = 1 ------
DB 1:1
DW @11E-@11S
@11S
DM "ャケィ-ア コ」丐セ將 "
DB 0
@11E
DB 1:3
DW @12E-@12S
@12S
DB ESC:0:$70:ESC:1:0
DM " OK "
DB 0
@12E
DB 1:4
DW @13E-@13S
@13S
DB ESC:0:$70:ESC:1:0
DM " 洛ス椹 "
DB 0
@13E
;---- GP 2 ---------
DB 2:1
DW @21E-@21S
@21S
DM "ャケ 履ス」セ脹"
DB 13:13
DM "悽、+ャセコ-」セ 洛ス椹 」セ留"
DB 0
@21E
;---- GP 3 ---------
DB 3:1
DW @31E-@31S
@31S
DM "ャケ ー埒」セ脹"
DB 13:13
DM "悽、+ャセコ-」セ 洛ス椹 」セ留"
DB 0
@31E
;---- GP 4 ---------
DB 4:1
DW @41E-@41S
@41S
DM "ャケ 履イッ椰」セ悛 "
DB 0
@41E
;---- GP 5 ---------
DB 5:1
DW @51E-@51S
@51S
DM "ャケ ー坿ッ椰」セ悛 "
DB 0
@51E
;---- GP 7 ---------
DB 7:1
DW @71E-@71S
@71S
DB ESC:0:$70:ESC:1:0
DM " ェ "
DB 0
@71E
DB 7:2
DW @72E-@72S
@72S
DB ESC:0:$70:ESC:1:0
DM " 鋳 "
DB 0
@72E
;---- GP 6 ---------
DB 6:1
DW 4*14+16
@61
DS 4*14+14
DB -1
;
; PROGRAMINSTALL
;
INSTALL
LD A,$C3
LD (3*162+KERNEL),A
LD HL,MAIN
LD (3*162+KERNEL+1),HL
JP $00AD
LOAD & SAVE MODULE
;
; MZ-700 CASETTE
; LOAD & SAVE MODULE
;
; IN: HL = BF ADDRESS
; VERSION 1 BYTE
; LS FLAG 1 BYTE
; FORMAT 1 BYTE
; SIZE 2 BYTE
; TOP ADRS 2 BYTES
; EXEC ADRS 2 BYTES
; OFST ADRS 2 BYTES
; FNAME ADRS 16 BYTES
; COMMENT 16 BYTES
;
; LS FLAG:
; 0 = LOAD HEADER
; 1 = LOAD MAIN
; 2 = LOAD HEADER & MAIN
; 3 = SAVE HEADER
; 4 = SAVE MAIN
; 5 = SAVE HEADER & MAIN
;
OFFSET $A000-$4600
ORG $4600
;
MAIN
LD (MOTO+1),HL
LD DE,LS.RECORD
LD BC,LS.END-LS.RECORD
LDIR
;
LD A,(LS.FLAG)
DEC A
JP M,MW0
JR Z,MW1
DEC A
JR Z,MW2
DEC A
JP Z,SAVE.HEADER
DEC A
JR Z,MW4
;
CALL SAVE.HEADER
MW4
JP SAVE.MAIN
MW0
CALL LOAD.HEADER
JR MWL
MW2
CALL LOAD.HEADER
MW1
CALL LOAD.MAIN
MWL
MOTO
LD DE,0
LD HL,LS.RECORD
LD BC,LS.END-LS.RECORD
LDIR
RET
;
; RECORD
;
LS.RECORD
VERSION DB 0
LS.FLAG DB 0
FORMAT DB 0
SIZE DW 0
TOP DW 0
EXEC DW 0
OFST DW 0
RES.TYPE DS 8
CREAT DS 8
FNAME DS 16
COMMENT DS 16
LS.END
CKSUM EQU $071A
'OTOR EQU $069F
WRT.INFO EQU $045E ;$0021
WRT.DATA EQU $0024
READ.INFO EQU $0027
READ.DATA EQU $002A
?RDI
DI
PUSH DE
PUSH BC
PUSH HL
LD D,$D2
LD E,$CC
LD BC,$80
LD HL,$10F0
RD1
CALL MOTOR'
JP C,$0572
CALL $065B
JP C,$0572
CALL $050E
JP $0554
?RDD
DI
PUSH DE
PUSH BC
PUSH HL
LD D,$D2
LD E,$53
LD BC,($1102)
LD HL,($1104)
LD A,B
OR C
JP Z,$0554
JR RD1
LOAD.HEADER
CALL ?RDI
RET C
LD HL,$10F1
LD DE,FNAME
LD BC,16
LDIR
LD HL,$1102
LD DE,SIZE
LD C,6
LDIR
LD HL,$1108
LD DE,RES.TYPE
LD C,8*2
LDIR
LD HL,$1118
LD DE,COMMENT
LD C,16
LDIR
RET
LOAD.MAIN
XOR A
LD ($E008),A
LD HL,(OFST)
LD ($1104),HL
JP ?RDD
;
; SAVE...
;
SAVE.HEADER
LD HL,SIZE
LD DE,$1102
LD BC,6
LDIR
LD HL,FNAME
LD DE,$10F1
LD C,16
LDIR
LD HL,RES.TYPE
LD DE,$1108
LD C,8*2
LDIR
LD HL,COMMENT
LD DE,$1118
LD C,16
LDIR
LD A,1
LD ($10F0),A
DI
PUSH DE
PUSH BC
PUSH HL
LD D,$D7
LD E,$CC
LD HL,$10F0
LD BC,$80
WRT.DATA'
CALL CKSUM
CALL MOTOR'
JP NC,WRT.INFO
POP HL
POP BC
POP DE
RET
SAVE.MAIN
LD HL,(OFST)
LD ($1104),HL
DI
PUSH DE
PUSH BC
PUSH HL
LD BC,($1102)
LD HL,($1104)
LD D,$D7
LD E,$53
LD A,B
OR C
JP Z,$04D2
JP WRT.DATA'
MOTOR'
PUSH BC
PUSH DE
PUSH HL
LD B,10
MOT1
LD A,($E002)
AND $10
JR Z,MOT4
MOT2
LD B,$FF
MOT2'
CALL $09A6 ;DLY12
DJNZ MOT2'
XOR A
JP $069B ;RET3
MOT4
LD A,6
LD HL,$E003
LD (HL),A
INC A
LD (HL),A
DJNZ MOT1
JP $06D8 ;MOT5
KERNEL EQU $1200
;
;
; INSTALLER
;
;
INSTALL
LD A,$C3
LD HL,MAIN
LD (161*3+KERNEL),A
LD (161*3+KERNEL+1),HL
JP $AD
PICTURE DRIVER
;
; ORG $A0000
;
ADRS EQU $2E00
OFFSET $A000-$2E00
ORG $2E00
KERNEL EQU $1200
;/////// NO.0 /////////
SET.Z
LD A,(IY+1)
LD (DRAW+1),A
RET
;
; SYSTEM-7C ONLY
;
; PICTURE DRIVER
;
; IY = DATA ADDRESS
;
DRAW
LD A,32
LD (WORKZ),A
DRAW.LP1 PUSH IY
DRAW.LP2
LD A,(IY)
OR A
JP M,DRAW.NEXT
LD A,(WORKZ)
CP (IY+1) ;Z COORDINATE
JR NZ,DRAW.X
LD HL,(GXY)
LD A,(IY)
CP 64
JP NC,111*3+KERNEL
LD D,0
ADD A,A
LD E,A
LD HL,DRAW.TBL
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
LD DE,DRAW.X
PUSH DE
JP (HL)
DRAW.X
LD E,(IY)
LD D,0
LD HL,DRAW.N.TBL
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
ADD IY,DE
JR DRAW.LP2
DRAW.NEXT
POP IY
LD HL,WORKZ
DEC (HL)
JP P,DRAW.LP1
RET
DRAW.TBL
DW SET.Z:SET.XY:SET.PEN:SET.PEN.LS
DW NO.4:NO.5:NO.6:NO.7
DW NO.8:NO.9:NO.10:NO.11
DW NO.12:NO.13:NO.14:NO.15
DW NO.16:NO.17:NO.18:NO.19
DW NO.20:NO.21:NO.22:NO.23
DW NO.24:NO.25
DRAW.N.TBL
DB 2:4:4:4
DB 8:8:8:8
DB 8:8:8:10
DB 6:7:7:7
DB 6:6:6:6
DB 6:6:6:6
DB 4:4
;
; FUNCTIONS
;
;/////// NO.1 /////////
SET.XY
LD L,(IY+2)
LD H,(IY+3)
LD (GXY),HL
RET
;/////// NO.2 /////////
SET.PEN
LD L,(IY+2)
LD H,(IY+3)
JP 74*3+KERNEL
;/////// NO.3 /////////
SET.PEN.LS
LD L,(IY+2)
LD H,(IY+3)
JP 76*3+KERNEL
;//////////////////////
;
; NO.4 -> NO.11
;
;//////////////////////
NO.4 LD HL,83*3+KERNEL JR #PUT
NO.5 LD HL,84*3+KERNEL JR #PUT
NO.6 LD HL,85*3+KERNEL JR #PUT
NO.7 LD HL,86*3+KERNEL JR #PUT
NO.8 LD HL,87*3+KERNEL JR #PUT
NO.9 LD HL,88*3+KERNEL JR #PUT
NO.10 LD HL,89*3+KERNEL JR #PUT
NO.11
EXX
LD H,(IY+8)
LD L,(IY+9)
EXX
LD HL,90*3+KERNEL
;///// NO.4 - NO.11 /////
#PUT
LD (JPX+1),HL
LD HL,(GXY)
LD A,(IY+2)
ADD A,H
LD H,A
LD A,(IY+3)
ADD A,L
LD L,A
LD B,(IY+4)
LD C,(IY+5)
LD E,(IY+6)
LD D,(IY+7)
JPX JP 0
;////////////////////////
;
; NO.12 -> NO.21
;
;////////////////////////
NO.12 LD HL,102*3+KERNEL JR #BOX
NO.13 LD HL,91*3+KERNEL JR #BOX
NO.14 LD HL,92*3+KERNEL JR #BOX
NO.15 LD HL,95*3+KERNEL JR #BOX
NO.16 LD HL,96*3+KERNEL JR #BOX
NO.17 LD HL,97*3+KERNEL JR #BOX
NO.18 LD HL,98*3+KERNEL JR #BOX
NO.19 LD HL,99*3+KERNEL JR #BOX
NO.20 LD HL,100*3+KERNEL JR #BOX
NO.21 LD HL,101*3+KERNEL JR #BOX
NO.22 LD HL,103*3+KERNEL JR #BOX
NO.23 LD HL,104*3+KERNEL
;///// NO.12 - NO.23 //////
#BOX
LD (JPB+1),HL
LD HL,(GXY)
LD A,(IY+4)
ADD A,H
LD H,A
LD A,(IY+5)
ADD A,L
LD L,A
EX DE,HL
LD HL,(GXY)
LD A,(IY+2)
ADD A,H
LD H,A
LD A,(IY+3)
ADD A,L
LD L,A
LD A,(IY+6)
JPB JP 0
;/////////////////////////
;
; NO.24 -> NO.25
;
;/////////////////////////
NO.24 LD HL,105*3+KERNEL JR #POLY
NO.25 LD HL,106*3+KERNEL
;////// NO.24 - NO.25 ////
#POLY
PUSH IX
PUSH IY
LD (JPP+1),HL
LD L,(IY+2)
LD H,(IY+3)
PUSH HL
POP IX
LD L,(IY+4)
LD H,(IY+5)
PUSH HL
POP IY
JPP CALL 0000
POP IY
POP IX
RET
GXY DS 2
WORKZ DS 1
;
;
; INSTALLER
;
;
INSTALL
LD HL,TBL
LD DE,110*3+KERNEL
LD BC,TBL.END-TBL
LDIR
JP $00AD
TBL
JP DRAW
TBL.END