mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-04 18:43:25 +08:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9aa36a0f96 | ||
|
|
9bb71ea5ce | ||
|
|
f8b2930281 | ||
|
|
c462063e0b | ||
|
|
dade193e1f | ||
|
|
670d454b4e | ||
|
|
6ee187a190 | ||
|
|
7d59920a37 | ||
|
|
b308a9e295 | ||
|
|
a28136d3de | ||
|
|
438eeb5135 | ||
|
|
d9d034cf43 | ||
|
|
c8be7ff36f | ||
|
|
140774a293 | ||
|
|
7c2fc66927 | ||
|
|
636c1a8c3d | ||
|
|
c177821913 | ||
|
|
febac10ebf | ||
|
|
0e31ff06ca | ||
|
|
08d19d7512 | ||
|
|
b2d31a8e54 | ||
|
|
72532c8cd7 | ||
|
|
3871740126 | ||
|
|
70b335278d | ||
|
|
2c262f986d | ||
|
|
6b0457bed6 | ||
|
|
0adab9385e | ||
|
|
73b7421cf2 | ||
|
|
203dd63152 | ||
|
|
9df2b90ad3 | ||
|
|
633089d320 | ||
|
|
41a0252634 | ||
|
|
5a064e20c2 | ||
|
|
d925a8d992 | ||
|
|
7497159026 | ||
|
|
fcd87ee302 | ||
|
|
ac8b6b1411 | ||
|
|
86791cd7f4 | ||
|
|
9231ce4a38 | ||
|
|
7b5d69c7c8 | ||
|
|
1bcf500c14 | ||
|
|
6bd4307e95 | ||
|
|
c65ca780b3 | ||
|
|
f025b0083f | ||
|
|
a1129763dd | ||
|
|
d63b8acd91 | ||
|
|
575c4ffce8 | ||
|
|
f3f9a6c178 | ||
|
|
01bbd98aa8 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
*.hrb
|
||||
*.lst
|
||||
*.map
|
||||
*.bim
|
||||
*.hrb
|
||||
@@ -12,15 +12,15 @@
|
||||
DW 224 ; 根目录大小(一般为224项)
|
||||
DW 2880 ; 该磁盘大小(必须为2880扇区1440*1024/512)
|
||||
DB 0xf0 ; 磁盘类型(必须为0xf0)
|
||||
DW 9 ; FAT的长度(必??9扇区)
|
||||
DW 9 ; FAT的长度(必须是9扇区)
|
||||
DW 18 ; 一个磁道(track)有几个扇区(必须为18)
|
||||
DW 2 ; 磁头数(必??2)
|
||||
DW 2 ; 磁头数(必须是2)
|
||||
DD 0 ; 不使用分区,必须是0
|
||||
DD 2880 ; 重写一次磁盘大小
|
||||
DB 0,0,0x29 ; 意义不明(固定)
|
||||
DD 0xffffffff ; (可能是)卷标号码
|
||||
DB "HELLO-OS " ; 磁盘的名称(必须为11字?,不足填空格)
|
||||
DB "FAT12 " ; 磁盘格式名称(必??8字?,不足填空格)
|
||||
DB "HELLO-OS " ; 磁盘的名称(必须为11字节,不足填空格)
|
||||
DB "FAT12 " ; 磁盘格式名称(必须是8字节,不足填空格)
|
||||
RESB 18 ; 先空出18字节
|
||||
|
||||
; 程序主体
|
||||
@@ -47,4 +47,4 @@
|
||||
DB 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
RESB 4600
|
||||
DB 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
RESB 1469432
|
||||
RESB 1469432
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
; 标准FAT12格式软盘专用的代码 Stand FAT12 format floppy code
|
||||
|
||||
JMP entry
|
||||
DB 0xeb, 0x4e, 0x90
|
||||
DB 0x90
|
||||
DB "HELLOIPL" ; 启动扇区名称(8字节)
|
||||
DW 512 ; 每个扇区(sector)大小(必须512字节)
|
||||
DB 1 ; 簇(cluster)大小(必须为1个扇区)
|
||||
|
||||
@@ -53,7 +53,7 @@ retry:
|
||||
MOV BX,0
|
||||
MOV DL,0x00 ; A驱动器
|
||||
INT 0x13 ; 调用磁盘BIOS
|
||||
JNC next ; 没出错则跳转到fin
|
||||
JNC next ; 没出错则跳转到next
|
||||
ADD SI,1 ; 往SI加1
|
||||
CMP SI,5 ; 比较SI与5
|
||||
JAE error ; SI >= 5 跳转到error
|
||||
|
||||
@@ -15,7 +15,7 @@ VRAM EQU 0x0ff8 ; 图像缓冲区的起始地址
|
||||
|
||||
ORG 0xc200 ; 这个的程序要被装载的内存地址
|
||||
|
||||
; 画面モードを設定
|
||||
; 设置画面模式
|
||||
|
||||
MOV AL,0x13 ; VGA显卡,320x200x8bit
|
||||
MOV AH,0x00
|
||||
|
||||
324
27_day/Makefile
324
27_day/Makefile
@@ -1,232 +1,142 @@
|
||||
OBJS_BOOTPACK = bootpack.obj naskfunc.obj hankaku.obj graphic.obj dsctbl.obj \
|
||||
int.obj fifo.obj keyboard.obj mouse.obj memory.obj sheet.obj timer.obj \
|
||||
mtask.obj window.obj console.obj file.obj
|
||||
|
||||
TOOLPATH = ../z_tools/
|
||||
INCPATH = ../z_tools/haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
NASK = $(TOOLPATH)nask.exe
|
||||
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
|
||||
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
|
||||
OBJ2BIM = $(TOOLPATH)obj2bim.exe
|
||||
MAKEFONT = $(TOOLPATH)makefont.exe
|
||||
BIN2OBJ = $(TOOLPATH)bin2obj.exe
|
||||
BIM2HRB = $(TOOLPATH)bim2hrb.exe
|
||||
RULEFILE = $(TOOLPATH)haribote/haribote.rul
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
IMGTOL = $(TOOLPATH)imgtol.com
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
# 默认动作
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) img
|
||||
|
||||
# 镜像文件生成
|
||||
|
||||
ipl10.bin : ipl10.nas Makefile
|
||||
$(NASK) ipl10.nas ipl10.bin ipl10.lst
|
||||
|
||||
asmhead.bin : asmhead.nas Makefile
|
||||
$(NASK) asmhead.nas asmhead.bin asmhead.lst
|
||||
|
||||
hankaku.bin : hankaku.txt Makefile
|
||||
$(MAKEFONT) hankaku.txt hankaku.bin
|
||||
|
||||
hankaku.obj : hankaku.bin Makefile
|
||||
$(BIN2OBJ) hankaku.bin hankaku.obj _hankaku
|
||||
|
||||
bootpack.bim : $(OBJS_BOOTPACK) Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \
|
||||
$(OBJS_BOOTPACK)
|
||||
# 3MB+64KB=3136KB
|
||||
|
||||
bootpack.hrb : bootpack.bim Makefile
|
||||
$(BIM2HRB) bootpack.bim bootpack.hrb 0
|
||||
|
||||
haribote.sys : asmhead.bin bootpack.hrb Makefile
|
||||
copy /B asmhead.bin+bootpack.hrb haribote.sys
|
||||
|
||||
hello.hrb : hello.nas Makefile
|
||||
$(NASK) hello.nas hello.hrb hello.lst
|
||||
|
||||
hello2.hrb : hello2.nas Makefile
|
||||
$(NASK) hello2.nas hello2.hrb hello2.lst
|
||||
|
||||
a.bim : a.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:a.bim map:a.map a.obj a_nask.obj
|
||||
|
||||
a.hrb : a.bim Makefile
|
||||
$(BIM2HRB) a.bim a.hrb 0
|
||||
|
||||
hello3.bim : hello3.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:hello3.bim map:hello3.map hello3.obj a_nask.obj
|
||||
|
||||
hello3.hrb : hello3.bim Makefile
|
||||
$(BIM2HRB) hello3.bim hello3.hrb 0
|
||||
|
||||
hello4.bim : hello4.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:hello4.bim stack:1k map:hello4.map \
|
||||
hello4.obj a_nask.obj
|
||||
|
||||
hello4.hrb : hello4.bim Makefile
|
||||
$(BIM2HRB) hello4.bim hello4.hrb 0
|
||||
|
||||
hello5.bim : hello5.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:hello5.bim stack:1k map:hello5.map hello5.obj
|
||||
|
||||
hello5.hrb : hello5.bim Makefile
|
||||
$(BIM2HRB) hello5.bim hello5.hrb 0
|
||||
|
||||
winhelo.bim : winhelo.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:winhelo.bim stack:1k map:winhelo.map \
|
||||
winhelo.obj a_nask.obj
|
||||
|
||||
winhelo.hrb : winhelo.bim Makefile
|
||||
$(BIM2HRB) winhelo.bim winhelo.hrb 0
|
||||
|
||||
winhelo2.bim : winhelo2.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:winhelo2.bim stack:1k map:winhelo2.map \
|
||||
winhelo2.obj a_nask.obj
|
||||
|
||||
winhelo2.hrb : winhelo2.bim Makefile
|
||||
$(BIM2HRB) winhelo2.bim winhelo2.hrb 0
|
||||
|
||||
winhelo3.bim : winhelo3.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:winhelo3.bim stack:1k map:winhelo3.map \
|
||||
winhelo3.obj a_nask.obj
|
||||
|
||||
winhelo3.hrb : winhelo3.bim Makefile
|
||||
$(BIM2HRB) winhelo3.bim winhelo3.hrb 40k
|
||||
|
||||
star1.bim : star1.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:star1.bim stack:1k map:star1.map \
|
||||
star1.obj a_nask.obj
|
||||
|
||||
star1.hrb : star1.bim Makefile
|
||||
$(BIM2HRB) star1.bim star1.hrb 47k
|
||||
|
||||
stars.bim : stars.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:stars.bim stack:1k map:stars.map \
|
||||
stars.obj a_nask.obj
|
||||
|
||||
stars.hrb : stars.bim Makefile
|
||||
$(BIM2HRB) stars.bim stars.hrb 47k
|
||||
|
||||
stars2.bim : stars2.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:stars2.bim stack:1k map:stars2.map \
|
||||
stars2.obj a_nask.obj
|
||||
|
||||
stars2.hrb : stars2.bim Makefile
|
||||
$(BIM2HRB) stars2.bim stars2.hrb 47k
|
||||
|
||||
lines.bim : lines.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:lines.bim stack:1k map:lines.map \
|
||||
lines.obj a_nask.obj
|
||||
|
||||
lines.hrb : lines.bim Makefile
|
||||
$(BIM2HRB) lines.bim lines.hrb 48k
|
||||
|
||||
walk.bim : walk.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:walk.bim stack:1k map:walk.map \
|
||||
walk.obj a_nask.obj
|
||||
|
||||
walk.hrb : walk.bim Makefile
|
||||
$(BIM2HRB) walk.bim walk.hrb 48k
|
||||
|
||||
noodle.bim : noodle.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:noodle.bim stack:1k map:noodle.map \
|
||||
noodle.obj a_nask.obj
|
||||
|
||||
noodle.hrb : noodle.bim Makefile
|
||||
$(BIM2HRB) noodle.bim noodle.hrb 40k
|
||||
|
||||
beepdown.bim : beepdown.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:beepdown.bim stack:1k map:beepdown.map \
|
||||
beepdown.obj a_nask.obj
|
||||
|
||||
beepdown.hrb : beepdown.bim Makefile
|
||||
$(BIM2HRB) beepdown.bim beepdown.hrb 40k
|
||||
|
||||
color.bim : color.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:color.bim stack:1k map:color.map \
|
||||
color.obj a_nask.obj
|
||||
|
||||
color.hrb : color.bim Makefile
|
||||
$(BIM2HRB) color.bim color.hrb 56k
|
||||
|
||||
color2.bim : color2.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:color2.bim stack:1k map:color2.map \
|
||||
color2.obj a_nask.obj
|
||||
|
||||
color2.hrb : color2.bim Makefile
|
||||
$(BIM2HRB) color2.bim color2.hrb 56k
|
||||
|
||||
haribote.img : ipl10.bin haribote.sys Makefile \
|
||||
hello.hrb hello2.hrb a.hrb hello3.hrb hello4.hrb hello5.hrb \
|
||||
winhelo.hrb winhelo2.hrb winhelo3.hrb star1.hrb stars.hrb stars2.hrb \
|
||||
lines.hrb walk.hrb noodle.hrb beepdown.hrb color.hrb color2.hrb
|
||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||
wbinimg src:ipl10.bin len:512 from:0 to:0 \
|
||||
copy from:haribote.sys to:@: \
|
||||
copy from:ipl10.nas to:@: \
|
||||
copy from:make.bat to:@: \
|
||||
copy from:hello.hrb to:@: \
|
||||
copy from:hello2.hrb to:@: \
|
||||
copy from:a.hrb to:@: \
|
||||
copy from:hello3.hrb to:@: \
|
||||
copy from:hello4.hrb to:@: \
|
||||
copy from:hello5.hrb to:@: \
|
||||
copy from:winhelo.hrb to:@: \
|
||||
copy from:winhelo2.hrb to:@: \
|
||||
copy from:winhelo3.hrb to:@: \
|
||||
copy from:star1.hrb to:@: \
|
||||
copy from:stars.hrb to:@: \
|
||||
copy from:stars2.hrb to:@: \
|
||||
copy from:lines.hrb to:@: \
|
||||
copy from:walk.hrb to:@: \
|
||||
copy from:noodle.hrb to:@: \
|
||||
copy from:beepdown.hrb to:@: \
|
||||
copy from:color.hrb to:@: \
|
||||
copy from:color2.hrb to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
# 其他指令
|
||||
|
||||
%.gas : %.c bootpack.h Makefile
|
||||
$(CC1) -o $*.gas $*.c
|
||||
|
||||
%.nas : %.gas Makefile
|
||||
$(GAS2NASK) $*.gas $*.nas
|
||||
|
||||
%.obj : %.nas Makefile
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
# 运行程序
|
||||
|
||||
img :
|
||||
$(MAKE) haribote.img
|
||||
|
||||
#文件生成规则
|
||||
|
||||
haribote.img : haribote/ipl10.bin haribote/haribote.sys Makefile \
|
||||
a/a.hrb hello3/hello3.hrb hello4/hello4.hrb hello5/hello5.hrb \
|
||||
winhelo/winhelo.hrb winhelo2/winhelo2.hrb winhelo3/winhelo3.hrb \
|
||||
star1/star1.hrb stars/stars.hrb stars2/stars2.hrb \
|
||||
lines/lines.hrb walk/walk.hrb noodle/noodle.hrb \
|
||||
beepdown/beepdown.hrb color/color.hrb color2/color2.hrb
|
||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||
wbinimg src:haribote/ipl10.bin len:512 from:0 to:0 \
|
||||
copy from:haribote/haribote.sys to:@: \
|
||||
copy from:haribote/ipl10.nas to:@: \
|
||||
copy from:make.bat to:@: \
|
||||
copy from:a/a.hrb to:@: \
|
||||
copy from:hello3/hello3.hrb to:@: \
|
||||
copy from:hello4/hello4.hrb to:@: \
|
||||
copy from:hello5/hello5.hrb to:@: \
|
||||
copy from:winhelo/winhelo.hrb to:@: \
|
||||
copy from:winhelo2/winhelo2.hrb to:@: \
|
||||
copy from:winhelo3/winhelo3.hrb to:@: \
|
||||
copy from:star1/star1.hrb to:@: \
|
||||
copy from:stars/stars.hrb to:@: \
|
||||
copy from:stars2/stars2.hrb to:@: \
|
||||
copy from:lines/lines.hrb to:@: \
|
||||
copy from:walk/walk.hrb to:@: \
|
||||
copy from:noodle/noodle.hrb to:@: \
|
||||
copy from:beepdown/beepdown.hrb to:@: \
|
||||
copy from:color/color.hrb to:@: \
|
||||
copy from:color2/color2.hrb to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
#命令
|
||||
|
||||
run :
|
||||
$(MAKE) img
|
||||
$(MAKE) haribote.img
|
||||
$(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin
|
||||
$(MAKE) -C ../z_tools/qemu
|
||||
|
||||
install :
|
||||
$(MAKE) img
|
||||
$(MAKE) haribote.img
|
||||
$(IMGTOL) w a: haribote.img
|
||||
|
||||
full :
|
||||
$(MAKE) -C haribote
|
||||
$(MAKE) -C apilib
|
||||
$(MAKE) -C a
|
||||
$(MAKE) -C hello3
|
||||
$(MAKE) -C hello4
|
||||
$(MAKE) -C hello5
|
||||
$(MAKE) -C winhelo
|
||||
$(MAKE) -C winhelo2
|
||||
$(MAKE) -C winhelo3
|
||||
$(MAKE) -C star1
|
||||
$(MAKE) -C stars
|
||||
$(MAKE) -C stars2
|
||||
$(MAKE) -C lines
|
||||
$(MAKE) -C walk
|
||||
$(MAKE) -C noodle
|
||||
$(MAKE) -C beepdown
|
||||
$(MAKE) -C color
|
||||
$(MAKE) -C color2
|
||||
$(MAKE) haribote.img
|
||||
|
||||
run_full :
|
||||
$(MAKE) full
|
||||
$(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin
|
||||
$(MAKE) -C ../z_tools/qemu
|
||||
|
||||
install_full :
|
||||
$(MAKE) full
|
||||
$(IMGTOL) w a: haribote.img
|
||||
|
||||
run_os :
|
||||
$(MAKE) -C haribote
|
||||
$(MAKE) run
|
||||
|
||||
clean :
|
||||
-$(DEL) *.bin
|
||||
-$(DEL) *.lst
|
||||
-$(DEL) *.obj
|
||||
-$(DEL) bootpack.map
|
||||
-$(DEL) bootpack.bim
|
||||
-$(DEL) bootpack.hrb
|
||||
-$(DEL) haribote.sys
|
||||
#不执行任何操作
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) haribote.img
|
||||
|
||||
clean_full :
|
||||
$(MAKE) -C haribote clean
|
||||
$(MAKE) -C apilib clean
|
||||
$(MAKE) -C a clean
|
||||
$(MAKE) -C hello3 clean
|
||||
$(MAKE) -C hello4 clean
|
||||
$(MAKE) -C hello5 clean
|
||||
$(MAKE) -C winhelo clean
|
||||
$(MAKE) -C winhelo2 clean
|
||||
$(MAKE) -C winhelo3 clean
|
||||
$(MAKE) -C star1 clean
|
||||
$(MAKE) -C stars clean
|
||||
$(MAKE) -C stars2 clean
|
||||
$(MAKE) -C lines clean
|
||||
$(MAKE) -C walk clean
|
||||
$(MAKE) -C noodle clean
|
||||
$(MAKE) -C beepdown clean
|
||||
$(MAKE) -C color clean
|
||||
$(MAKE) -C color2 clean
|
||||
|
||||
src_only_full :
|
||||
$(MAKE) -C haribote src_only
|
||||
$(MAKE) -C apilib src_only
|
||||
$(MAKE) -C a src_only
|
||||
$(MAKE) -C hello3 src_only
|
||||
$(MAKE) -C hello4 src_only
|
||||
$(MAKE) -C hello5 src_only
|
||||
$(MAKE) -C winhelo src_only
|
||||
$(MAKE) -C winhelo2 src_only
|
||||
$(MAKE) -C winhelo3 src_only
|
||||
$(MAKE) -C star1 src_only
|
||||
$(MAKE) -C stars src_only
|
||||
$(MAKE) -C stars2 src_only
|
||||
$(MAKE) -C lines src_only
|
||||
$(MAKE) -C walk src_only
|
||||
$(MAKE) -C noodle src_only
|
||||
$(MAKE) -C beepdown src_only
|
||||
$(MAKE) -C color src_only
|
||||
$(MAKE) -C color2 src_only
|
||||
-$(DEL) haribote.img
|
||||
|
||||
refresh :
|
||||
$(MAKE) full
|
||||
$(MAKE) clean_full
|
||||
-$(DEL) haribote.img
|
||||
|
||||
1
27_day/a/!cons_9x.bat
Normal file
1
27_day/a/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/a/!cons_nt.bat
Normal file
1
27_day/a/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/a/Makefile
Normal file
5
27_day/a/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = a
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
@@ -1,5 +1,4 @@
|
||||
void api_putchar(int c);
|
||||
void api_end(void);
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
1
27_day/a/make.bat
Normal file
1
27_day/a/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
@@ -1,230 +0,0 @@
|
||||
[FORMAT "WCOFF"] ; 生成对象文件的模式
|
||||
[INSTRSET "i486p"] ; 表示使用486兼容指令集
|
||||
[BITS 32] ; 生成32位模式机器语言
|
||||
[FILE "a_nask.nas"] ; 源文件名信息
|
||||
|
||||
GLOBAL _api_putchar
|
||||
GLOBAL _api_putstr0
|
||||
GLOBAL _api_end
|
||||
GLOBAL _api_openwin
|
||||
GLOBAL _api_putstrwin
|
||||
GLOBAL _api_boxfilwin
|
||||
GLOBAL _api_initmalloc
|
||||
GLOBAL _api_malloc
|
||||
GLOBAL _api_free
|
||||
GLOBAL _api_point
|
||||
GLOBAL _api_refreshwin
|
||||
GLOBAL _api_linewin
|
||||
GLOBAL _api_closewin
|
||||
GLOBAL _api_getkey
|
||||
GLOBAL _api_alloctimer
|
||||
GLOBAL _api_inittimer
|
||||
GLOBAL _api_settimer
|
||||
GLOBAL _api_freetimer
|
||||
GLOBAL _api_beep
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putchar: ; void api_putchar(int c);
|
||||
MOV EDX,1
|
||||
MOV AL,[ESP+4] ; c
|
||||
INT 0x40
|
||||
RET
|
||||
|
||||
_api_putstr0: ; void api_putstr0(char *s);
|
||||
PUSH EBX
|
||||
MOV EDX,2
|
||||
MOV EBX,[ESP+8] ; s
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_end: ; void api_end(void);
|
||||
MOV EDX,4
|
||||
INT 0x40
|
||||
|
||||
_api_openwin: ; int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,5
|
||||
MOV EBX,[ESP+16] ; buf
|
||||
MOV ESI,[ESP+20] ; xsiz
|
||||
MOV EDI,[ESP+24] ; ysiz
|
||||
MOV EAX,[ESP+28] ; col_inv
|
||||
MOV ECX,[ESP+32] ; title
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_api_putstrwin: ; void api_putstrwin(int win, int x, int y, int col, int len, char *str);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,6
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV ESI,[ESP+24] ; x
|
||||
MOV EDI,[ESP+28] ; y
|
||||
MOV EAX,[ESP+32] ; col
|
||||
MOV ECX,[ESP+36] ; len
|
||||
MOV EBP,[ESP+40] ; str
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_api_boxfilwin: ; void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,7
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV EAX,[ESP+24] ; x0
|
||||
MOV ECX,[ESP+28] ; y0
|
||||
MOV ESI,[ESP+32] ; x1
|
||||
MOV EDI,[ESP+36] ; y1
|
||||
MOV EBP,[ESP+40] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_api_initmalloc: ; void api_initmalloc(void);
|
||||
PUSH EBX
|
||||
MOV EDX,8
|
||||
MOV EBX,[CS:0x0020] ; malloc内存空间的地址
|
||||
MOV EAX,EBX
|
||||
ADD EAX,32*1024 ; 加上32KB
|
||||
MOV ECX,[CS:0x0000] ; 数据段的大小
|
||||
SUB ECX,EAX
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_malloc: ; char *api_malloc(int size);
|
||||
PUSH EBX
|
||||
MOV EDX,9
|
||||
MOV EBX,[CS:0x0020]
|
||||
MOV ECX,[ESP+8] ; size
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_free: ; void api_free(char *addr, int size);
|
||||
PUSH EBX
|
||||
MOV EDX,10
|
||||
MOV EBX,[CS:0x0020]
|
||||
MOV EAX,[ESP+ 8] ; addr
|
||||
MOV ECX,[ESP+12] ; size
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_point: ; void api_point(int win, int x, int y, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,11
|
||||
MOV EBX,[ESP+16] ; win
|
||||
MOV ESI,[ESP+20] ; x
|
||||
MOV EDI,[ESP+24] ; y
|
||||
MOV EAX,[ESP+28] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_api_refreshwin: ; void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,12
|
||||
MOV EBX,[ESP+16] ; win
|
||||
MOV EAX,[ESP+20] ; x0
|
||||
MOV ECX,[ESP+24] ; y0
|
||||
MOV ESI,[ESP+28] ; x1
|
||||
MOV EDI,[ESP+32] ; y1
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_api_linewin: ; void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,13
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV EAX,[ESP+24] ; x0
|
||||
MOV ECX,[ESP+28] ; y0
|
||||
MOV ESI,[ESP+32] ; x1
|
||||
MOV EDI,[ESP+36] ; y1
|
||||
MOV EBP,[ESP+40] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_api_closewin: ; void api_closewin(int win);
|
||||
PUSH EBX
|
||||
MOV EDX,14
|
||||
MOV EBX,[ESP+8] ; win
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_getkey: ; int api_getkey(int mode);
|
||||
MOV EDX,15
|
||||
MOV EAX,[ESP+4] ; mode
|
||||
INT 0x40
|
||||
RET
|
||||
|
||||
_api_alloctimer: ; int api_alloctimer(void);
|
||||
MOV EDX,16
|
||||
INT 0x40
|
||||
RET
|
||||
|
||||
_api_inittimer: ; void api_inittimer(int timer, int data);
|
||||
PUSH EBX
|
||||
MOV EDX,17
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
MOV EAX,[ESP+12] ; data
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_settimer: ; void api_settimer(int timer, int time);
|
||||
PUSH EBX
|
||||
MOV EDX,18
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
MOV EAX,[ESP+12] ; time
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_freetimer: ; void api_freetimer(int timer);
|
||||
PUSH EBX
|
||||
MOV EDX,19
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
|
||||
_api_beep: ; void api_beep(int tone);
|
||||
MOV EDX,20
|
||||
MOV EAX,[ESP+4] ; tone
|
||||
INT 0x40
|
||||
RET
|
||||
20
27_day/apilib.h
Normal file
20
27_day/apilib.h
Normal file
@@ -0,0 +1,20 @@
|
||||
void api_putchar(int c);
|
||||
void api_putstr0(char *s);
|
||||
void api_putstr1(char *s, int l);
|
||||
void api_end(void);
|
||||
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
void api_putstrwin(int win, int x, int y, int col, int len, char *str);
|
||||
void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
void api_initmalloc(void);
|
||||
char *api_malloc(int size);
|
||||
void api_free(char *addr, int size);
|
||||
void api_point(int win, int x, int y, int col);
|
||||
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
void api_closewin(int win);
|
||||
int api_getkey(int mode);
|
||||
int api_alloctimer(void);
|
||||
void api_inittimer(int timer, int data);
|
||||
void api_settimer(int timer, int time);
|
||||
void api_freetimer(int timer);
|
||||
void api_beep(int tone);
|
||||
1
27_day/apilib/!cons_9x.bat
Normal file
1
27_day/apilib/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/apilib/!cons_nt.bat
Normal file
1
27_day/apilib/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
47
27_day/apilib/Makefile
Normal file
47
27_day/apilib/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
OBJS_API = api001.obj api002.obj api003.obj api004.obj api005.obj api006.obj \
|
||||
api007.obj api008.obj api009.obj api010.obj api011.obj api012.obj \
|
||||
api013.obj api014.obj api015.obj api016.obj api017.obj api018.obj \
|
||||
api019.obj api020.obj
|
||||
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
NASK = $(TOOLPATH)nask.exe
|
||||
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
|
||||
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
|
||||
OBJ2BIM = $(TOOLPATH)obj2bim.exe
|
||||
MAKEFONT = $(TOOLPATH)makefont.exe
|
||||
BIN2OBJ = $(TOOLPATH)bin2obj.exe
|
||||
BIM2HRB = $(TOOLPATH)bim2hrb.exe
|
||||
RULEFILE = ../haribote.rul
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
IMGTOL = $(TOOLPATH)imgtol.com
|
||||
GOLIB = $(TOOLPATH)golib00.exe
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) apilib.lib
|
||||
|
||||
#库生成规则
|
||||
|
||||
apilib.lib : Makefile $(OBJS_API)
|
||||
$(GOLIB) $(OBJS_API) out:apilib.lib
|
||||
|
||||
#文件生成规则
|
||||
|
||||
%.obj : %.nas Makefile
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
#命令
|
||||
|
||||
clean :
|
||||
-$(DEL) *.lst
|
||||
-$(DEL) *.obj
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) apilib.lib
|
||||
14
27_day/apilib/api001.nas
Normal file
14
27_day/apilib/api001.nas
Normal file
@@ -0,0 +1,14 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api001.nas"]
|
||||
|
||||
GLOBAL _api_putchar
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putchar: ; void api_putchar(int c);
|
||||
MOV EDX,1
|
||||
MOV AL,[ESP+4] ; c
|
||||
INT 0x40
|
||||
RET
|
||||
16
27_day/apilib/api002.nas
Normal file
16
27_day/apilib/api002.nas
Normal file
@@ -0,0 +1,16 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api002.nas"]
|
||||
|
||||
GLOBAL _api_putstr0
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putstr0: ; void api_putstr0(char *s);
|
||||
PUSH EBX
|
||||
MOV EDX,2
|
||||
MOV EBX,[ESP+8] ; s
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
17
27_day/apilib/api003.nas
Normal file
17
27_day/apilib/api003.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api003.nas"]
|
||||
|
||||
GLOBAL _api_putstr1
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putstr1: ; void api_putstr1(char *s, int l);
|
||||
PUSH EBX
|
||||
MOV EDX,3
|
||||
MOV EBX,[ESP+ 8] ; s
|
||||
MOV ECX,[ESP+12] ; l
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
12
27_day/apilib/api004.nas
Normal file
12
27_day/apilib/api004.nas
Normal file
@@ -0,0 +1,12 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api004.nas"]
|
||||
|
||||
GLOBAL _api_end
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_end: ; void api_end(void);
|
||||
MOV EDX,4
|
||||
INT 0x40
|
||||
24
27_day/apilib/api005.nas
Normal file
24
27_day/apilib/api005.nas
Normal file
@@ -0,0 +1,24 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api005.nas"]
|
||||
|
||||
GLOBAL _api_openwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_openwin: ; int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,5
|
||||
MOV EBX,[ESP+16] ; buf
|
||||
MOV ESI,[ESP+20] ; xsiz
|
||||
MOV EDI,[ESP+24] ; ysiz
|
||||
MOV EAX,[ESP+28] ; col_inv
|
||||
MOV ECX,[ESP+32] ; title
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
27
27_day/apilib/api006.nas
Normal file
27
27_day/apilib/api006.nas
Normal file
@@ -0,0 +1,27 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api006.nas"]
|
||||
|
||||
GLOBAL _api_putstrwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putstrwin: ; void api_putstrwin(int win, int x, int y, int col, int len, char *str);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,6
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV ESI,[ESP+24] ; x
|
||||
MOV EDI,[ESP+28] ; y
|
||||
MOV EAX,[ESP+32] ; col
|
||||
MOV ECX,[ESP+36] ; len
|
||||
MOV EBP,[ESP+40] ; str
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
27
27_day/apilib/api007.nas
Normal file
27
27_day/apilib/api007.nas
Normal file
@@ -0,0 +1,27 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api007.nas"]
|
||||
|
||||
GLOBAL _api_boxfilwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_boxfilwin: ; void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,7
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV EAX,[ESP+24] ; x0
|
||||
MOV ECX,[ESP+28] ; y0
|
||||
MOV ESI,[ESP+32] ; x1
|
||||
MOV EDI,[ESP+36] ; y1
|
||||
MOV EBP,[ESP+40] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
20
27_day/apilib/api008.nas
Normal file
20
27_day/apilib/api008.nas
Normal file
@@ -0,0 +1,20 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api008.nas"]
|
||||
|
||||
GLOBAL _api_initmalloc
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_initmalloc: ; void api_initmalloc(void);
|
||||
PUSH EBX
|
||||
MOV EDX,8
|
||||
MOV EBX,[CS:0x0020] ; malloc内存空间的地址
|
||||
MOV EAX,EBX
|
||||
ADD EAX,32*1024 ; 加上32KB
|
||||
MOV ECX,[CS:0x0000] ; 数据段的大小
|
||||
SUB ECX,EAX
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
17
27_day/apilib/api009.nas
Normal file
17
27_day/apilib/api009.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api009.nas"]
|
||||
|
||||
GLOBAL _api_malloc
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_malloc: ; char *api_malloc(int size);
|
||||
PUSH EBX
|
||||
MOV EDX,9
|
||||
MOV EBX,[CS:0x0020]
|
||||
MOV ECX,[ESP+8] ; size
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
18
27_day/apilib/api010.nas
Normal file
18
27_day/apilib/api010.nas
Normal file
@@ -0,0 +1,18 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api010.nas"]
|
||||
|
||||
GLOBAL _api_free
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_free: ; void api_free(char *addr, int size);
|
||||
PUSH EBX
|
||||
MOV EDX,10
|
||||
MOV EBX,[CS:0x0020]
|
||||
MOV EAX,[ESP+ 8] ; addr
|
||||
MOV ECX,[ESP+12] ; size
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
23
27_day/apilib/api011.nas
Normal file
23
27_day/apilib/api011.nas
Normal file
@@ -0,0 +1,23 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api011.nas"]
|
||||
|
||||
GLOBAL _api_point
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_point: ; void api_point(int win, int x, int y, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,11
|
||||
MOV EBX,[ESP+16] ; win
|
||||
MOV ESI,[ESP+20] ; x
|
||||
MOV EDI,[ESP+24] ; y
|
||||
MOV EAX,[ESP+28] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
24
27_day/apilib/api012.nas
Normal file
24
27_day/apilib/api012.nas
Normal file
@@ -0,0 +1,24 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api012.nas"]
|
||||
|
||||
GLOBAL _api_refreshwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_refreshwin: ; void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,12
|
||||
MOV EBX,[ESP+16] ; win
|
||||
MOV EAX,[ESP+20] ; x0
|
||||
MOV ECX,[ESP+24] ; y0
|
||||
MOV ESI,[ESP+28] ; x1
|
||||
MOV EDI,[ESP+32] ; y1
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
27
27_day/apilib/api013.nas
Normal file
27
27_day/apilib/api013.nas
Normal file
@@ -0,0 +1,27 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api013.nas"]
|
||||
|
||||
GLOBAL _api_linewin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_linewin: ; void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,13
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV EAX,[ESP+24] ; x0
|
||||
MOV ECX,[ESP+28] ; y0
|
||||
MOV ESI,[ESP+32] ; x1
|
||||
MOV EDI,[ESP+36] ; y1
|
||||
MOV EBP,[ESP+40] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
16
27_day/apilib/api014.nas
Normal file
16
27_day/apilib/api014.nas
Normal file
@@ -0,0 +1,16 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api014.nas"]
|
||||
|
||||
GLOBAL _api_closewin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_closewin: ; void api_closewin(int win);
|
||||
PUSH EBX
|
||||
MOV EDX,14
|
||||
MOV EBX,[ESP+8] ; win
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
14
27_day/apilib/api015.nas
Normal file
14
27_day/apilib/api015.nas
Normal file
@@ -0,0 +1,14 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api015.nas"]
|
||||
|
||||
GLOBAL _api_getkey
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_getkey: ; int api_getkey(int mode);
|
||||
MOV EDX,15
|
||||
MOV EAX,[ESP+4] ; mode
|
||||
INT 0x40
|
||||
RET
|
||||
13
27_day/apilib/api016.nas
Normal file
13
27_day/apilib/api016.nas
Normal file
@@ -0,0 +1,13 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api016.nas"]
|
||||
|
||||
GLOBAL _api_alloctimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_alloctimer: ; int api_alloctimer(void);
|
||||
MOV EDX,16
|
||||
INT 0x40
|
||||
RET
|
||||
17
27_day/apilib/api017.nas
Normal file
17
27_day/apilib/api017.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api017.nas"]
|
||||
|
||||
GLOBAL _api_inittimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_inittimer: ; void api_inittimer(int timer, int data);
|
||||
PUSH EBX
|
||||
MOV EDX,17
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
MOV EAX,[ESP+12] ; data
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
17
27_day/apilib/api018.nas
Normal file
17
27_day/apilib/api018.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api018.nas"]
|
||||
|
||||
GLOBAL _api_settimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_settimer: ; void api_settimer(int timer, int time);
|
||||
PUSH EBX
|
||||
MOV EDX,18
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
MOV EAX,[ESP+12] ; time
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
16
27_day/apilib/api019.nas
Normal file
16
27_day/apilib/api019.nas
Normal file
@@ -0,0 +1,16 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api019.nas"]
|
||||
|
||||
GLOBAL _api_freetimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_freetimer: ; void api_freetimer(int timer);
|
||||
PUSH EBX
|
||||
MOV EDX,19
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
14
27_day/apilib/api020.nas
Normal file
14
27_day/apilib/api020.nas
Normal file
@@ -0,0 +1,14 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api020.nas"]
|
||||
|
||||
GLOBAL _api_beep
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_beep: ; void api_beep(int tone);
|
||||
MOV EDX,20
|
||||
MOV EAX,[ESP+4] ; tone
|
||||
INT 0x40
|
||||
RET
|
||||
1
27_day/apilib/make.bat
Normal file
1
27_day/apilib/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
79
27_day/app_make.txt
Normal file
79
27_day/app_make.txt
Normal file
@@ -0,0 +1,79 @@
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
APILIBPATH = ../apilib/
|
||||
HARIBOTEPATH = ../haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
NASK = $(TOOLPATH)nask.exe
|
||||
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -I../ -Os -Wall -quiet
|
||||
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
|
||||
OBJ2BIM = $(TOOLPATH)obj2bim.exe
|
||||
MAKEFONT = $(TOOLPATH)makefont.exe
|
||||
BIN2OBJ = $(TOOLPATH)bin2obj.exe
|
||||
BIM2HRB = $(TOOLPATH)bim2hrb.exe
|
||||
RULEFILE = ../haribote.rul
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
IMGTOL = $(TOOLPATH)imgtol.com
|
||||
GOLIB = $(TOOLPATH)golib00.exe
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) $(APP).hrb
|
||||
|
||||
#文件生成规则
|
||||
|
||||
$(APP).bim : $(APP).obj $(APILIBPATH)apilib.lib Makefile ../app_make.txt
|
||||
$(OBJ2BIM) @$(RULEFILE) out:$(APP).bim map:$(APP).map stack:$(STACK) \
|
||||
$(APP).obj $(APILIBPATH)apilib.lib
|
||||
|
||||
$(APP).hrb : $(APP).bim Makefile ../app_make.txt
|
||||
$(BIM2HRB) $(APP).bim $(APP).hrb $(MALLOC)
|
||||
|
||||
haribote.img : ../haribote/ipl10.bin ../haribote/haribote.sys $(APP).hrb \
|
||||
Makefile ../app_make.txt
|
||||
$(EDIMG) imgin:../../z_tools/fdimg0at.tek \
|
||||
wbinimg src:../haribote/ipl10.bin len:512 from:0 to:0 \
|
||||
copy from:../haribote/haribote.sys to:@: \
|
||||
copy from:$(APP).hrb to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
#一般规则
|
||||
|
||||
%.gas : %.c ../apilib.h Makefile ../app_make.txt
|
||||
$(CC1) -o $*.gas $*.c
|
||||
|
||||
%.nas : %.gas Makefile ../app_make.txt
|
||||
$(GAS2NASK) $*.gas $*.nas
|
||||
|
||||
%.obj : %.nas Makefile ../app_make.txt
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
#命令
|
||||
|
||||
run :
|
||||
$(MAKE) haribote.img
|
||||
$(COPY) haribote.img ..\..\z_tools\qemu\fdimage0.bin
|
||||
$(MAKE) -C ../../z_tools/qemu
|
||||
|
||||
full :
|
||||
$(MAKE) -C $(APILIBPATH)
|
||||
$(MAKE) $(APP).hrb
|
||||
|
||||
run_full :
|
||||
$(MAKE) -C $(APILIBPATH)
|
||||
$(MAKE) -C ../haribote
|
||||
$(MAKE) run
|
||||
|
||||
clean :
|
||||
-$(DEL) *.lst
|
||||
-$(DEL) *.obj
|
||||
-$(DEL) *.map
|
||||
-$(DEL) *.bim
|
||||
-$(DEL) haribote.img
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) $(APP).hrb
|
||||
1
27_day/beepdown/!cons_9x.bat
Normal file
1
27_day/beepdown/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/beepdown/!cons_nt.bat
Normal file
1
27_day/beepdown/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/beepdown/Makefile
Normal file
5
27_day/beepdown/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = beepdown
|
||||
STACK = 1k
|
||||
MALLOC = 40k
|
||||
|
||||
include ../app_make.txt
|
||||
@@ -1,9 +1,4 @@
|
||||
void api_end(void);
|
||||
int api_getkey(int mode);
|
||||
int api_alloctimer(void);
|
||||
void api_inittimer(int timer, int data);
|
||||
void api_settimer(int timer, int time);
|
||||
void api_beep(int tone);
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
1
27_day/beepdown/make.bat
Normal file
1
27_day/beepdown/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
27_day/color/!cons_9x.bat
Normal file
1
27_day/color/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/color/!cons_nt.bat
Normal file
1
27_day/color/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/color/Makefile
Normal file
5
27_day/color/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = color
|
||||
STACK = 1k
|
||||
MALLOC = 56k
|
||||
|
||||
include ../app_make.txt
|
||||
@@ -1,10 +1,4 @@
|
||||
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
void api_initmalloc(void);
|
||||
char *api_malloc(int size);
|
||||
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
int api_getkey(int mode);
|
||||
void api_end(void);
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
1
27_day/color/make.bat
Normal file
1
27_day/color/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
27_day/color2/!cons_9x.bat
Normal file
1
27_day/color2/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/color2/!cons_nt.bat
Normal file
1
27_day/color2/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/color2/Makefile
Normal file
5
27_day/color2/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = color2
|
||||
STACK = 1k
|
||||
MALLOC = 56k
|
||||
|
||||
include ../app_make.txt
|
||||
@@ -1,10 +1,4 @@
|
||||
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
void api_initmalloc(void);
|
||||
char *api_malloc(int size);
|
||||
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
int api_getkey(int mode);
|
||||
void api_end(void);
|
||||
#include "apilib.h"
|
||||
|
||||
unsigned char rgb2pal(int r, int g, int b, int x, int y);
|
||||
|
||||
@@ -21,7 +15,7 @@ void HariMain(void)
|
||||
}
|
||||
}
|
||||
api_refreshwin(win, 8, 28, 136, 156);
|
||||
api_getkey(1); /*等待按下任意键*/
|
||||
api_getkey(1); /* <20>Ă<EFBFBD><C482>Ƃ<EFBFBD><C682>ȃL<C883>[<5B><><EFBFBD>͂<EFBFBD>҂<EFBFBD> */
|
||||
api_end();
|
||||
}
|
||||
|
||||
1
27_day/color2/make.bat
Normal file
1
27_day/color2/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
10
27_day/haribote.rul
Normal file
10
27_day/haribote.rul
Normal file
@@ -0,0 +1,10 @@
|
||||
format:
|
||||
code(align:1, logic:0x24, file:0x24);
|
||||
data(align:4, logic:stack_end, file:code_end);
|
||||
|
||||
file:
|
||||
../../z_tools/haribote/harilibc.lib;
|
||||
../../z_tools/haribote/golibc.lib;
|
||||
|
||||
label:
|
||||
_HariStartup;
|
||||
1
27_day/haribote/!cons_9x.bat
Normal file
1
27_day/haribote/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/haribote/!cons_nt.bat
Normal file
1
27_day/haribote/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
79
27_day/haribote/Makefile
Normal file
79
27_day/haribote/Makefile
Normal file
@@ -0,0 +1,79 @@
|
||||
OBJS_BOOTPACK = bootpack.obj naskfunc.obj hankaku.obj graphic.obj dsctbl.obj \
|
||||
int.obj fifo.obj keyboard.obj mouse.obj memory.obj sheet.obj timer.obj \
|
||||
mtask.obj window.obj console.obj file.obj
|
||||
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
NASK = $(TOOLPATH)nask.exe
|
||||
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
|
||||
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
|
||||
OBJ2BIM = $(TOOLPATH)obj2bim.exe
|
||||
MAKEFONT = $(TOOLPATH)makefont.exe
|
||||
BIN2OBJ = $(TOOLPATH)bin2obj.exe
|
||||
BIM2HRB = $(TOOLPATH)bim2hrb.exe
|
||||
RULEFILE = ../haribote.rul
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
IMGTOL = $(TOOLPATH)imgtol.com
|
||||
GOLIB = $(TOOLPATH)golib00.exe
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) ipl10.bin
|
||||
$(MAKE) haribote.sys
|
||||
|
||||
# 镜像文件生成
|
||||
|
||||
ipl10.bin : ipl10.nas Makefile
|
||||
$(NASK) ipl10.nas ipl10.bin ipl10.lst
|
||||
|
||||
asmhead.bin : asmhead.nas Makefile
|
||||
$(NASK) asmhead.nas asmhead.bin asmhead.lst
|
||||
|
||||
hankaku.bin : hankaku.txt Makefile
|
||||
$(MAKEFONT) hankaku.txt hankaku.bin
|
||||
|
||||
hankaku.obj : hankaku.bin Makefile
|
||||
$(BIN2OBJ) hankaku.bin hankaku.obj _hankaku
|
||||
|
||||
bootpack.bim : $(OBJS_BOOTPACK) Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \
|
||||
$(OBJS_BOOTPACK)
|
||||
# 3MB+64KB=3136KB
|
||||
|
||||
bootpack.hrb : bootpack.bim Makefile
|
||||
$(BIM2HRB) bootpack.bim bootpack.hrb 0
|
||||
|
||||
haribote.sys : asmhead.bin bootpack.hrb Makefile
|
||||
copy /B asmhead.bin+bootpack.hrb haribote.sys
|
||||
|
||||
# 其他指令
|
||||
|
||||
%.gas : %.c bootpack.h Makefile
|
||||
$(CC1) -o $*.gas $*.c
|
||||
|
||||
%.nas : %.gas Makefile
|
||||
$(GAS2NASK) $*.gas $*.nas
|
||||
|
||||
%.obj : %.nas Makefile
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
# 运行程序
|
||||
|
||||
clean :
|
||||
-$(DEL) asmhead.bin
|
||||
-$(DEL) hankaku.bin
|
||||
-$(DEL) *.lst
|
||||
-$(DEL) *.obj
|
||||
-$(DEL) *.map
|
||||
-$(DEL) *.bim
|
||||
-$(DEL) *.hrb
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) ipl10.bin
|
||||
-$(DEL) haribote.sys
|
||||
@@ -46,7 +46,7 @@ void HariMain(void)
|
||||
};
|
||||
int key_shift = 0, key_leds = (binfo->leds >> 4) & 7, keycmd_wait = -1;
|
||||
int j, x, y, mmx = -1, mmy = -1, mmx2 = 0;
|
||||
struct SHEET *sht = 0, *key_win;
|
||||
struct SHEET *sht = 0, *key_win, *sht2;
|
||||
|
||||
init_gdtidt();
|
||||
init_pic();
|
||||
@@ -195,8 +195,8 @@ void HariMain(void)
|
||||
io_cli(); /*强制结束处理时禁止任务切换*/
|
||||
task->tss.eax = (int) &(task->tss.esp0);
|
||||
task->tss.eip = (int) asm_end_app;
|
||||
task_run(task, -1, 0); /*为了确实执行结束处理,如果处于休眠状态则唤醒*/
|
||||
io_sti();
|
||||
task_run(task, -1, 0); /*为了确实执行结束处理,如果处于休眠状态则唤醒*/
|
||||
}
|
||||
}
|
||||
if (i == 256 + 0x3c && key_shift != 0) { /* Shift+F2 */
|
||||
@@ -267,10 +267,14 @@ void HariMain(void)
|
||||
io_cli(); /*强制结束处理时禁止任务切换*/
|
||||
task->tss.eax = (int) &(task->tss.esp0);
|
||||
task->tss.eip = (int) asm_end_app;
|
||||
task_run(task, -1, 0);
|
||||
io_sti();
|
||||
task_run(task, -1, 0);
|
||||
} else { /*命令行窗口*/
|
||||
task = sht->task;
|
||||
sheet_updown(sht, -1); /*暂且隐藏该图层*/
|
||||
keywin_off(key_win);
|
||||
key_win = shtctl->sheets[shtctl->top - 1];
|
||||
keywin_on(key_win);
|
||||
io_cli();
|
||||
fifo32_put(&task->fifo, 4);
|
||||
io_sti();
|
||||
@@ -301,6 +305,10 @@ void HariMain(void)
|
||||
close_console(shtctl->sheets0 + (i - 768));
|
||||
} else if (1024 <= i && i <= 2023) {
|
||||
close_constask(taskctl->tasks0 + (i - 1024));
|
||||
} else if (2024 <= i && i <= 2279) { /*只关闭命令行窗口*/
|
||||
sht2 = shtctl->sheets0 + (i - 2024);
|
||||
memman_free_4k(memman, (int) sht2->buf, 256 * 165);
|
||||
sheet_free(sht2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,15 +88,16 @@ struct GATE_DESCRIPTOR {
|
||||
void init_gdtidt(void);
|
||||
void set_segmdesc(struct SEGMENT_DESCRIPTOR *sd, unsigned int limit, int base, int ar);
|
||||
void set_gatedesc(struct GATE_DESCRIPTOR *gd, int offset, int selector, int ar);
|
||||
#define ADR_IDT 0x0026f800
|
||||
#define LIMIT_IDT 0x000007ff
|
||||
#define ADR_GDT 0x00270000
|
||||
#define LIMIT_GDT 0x0000ffff
|
||||
#define ADR_IDT 0x0026f800
|
||||
#define LIMIT_IDT 0x000007ff
|
||||
#define ADR_GDT 0x00270000
|
||||
#define LIMIT_GDT 0x0000ffff
|
||||
#define ADR_BOTPAK 0x00280000
|
||||
#define LIMIT_BOTPAK 0x0007ffff
|
||||
#define AR_DATA32_RW 0x4092
|
||||
#define AR_CODE32_ER 0x409a
|
||||
#define AR_TSS32 0x0089
|
||||
#define AR_LDT 0x0082
|
||||
#define AR_TSS32 0x0089
|
||||
#define AR_INTGATE32 0x008e
|
||||
|
||||
/* int.c */
|
||||
@@ -210,6 +211,7 @@ struct TASK {
|
||||
int level, priority; /* 优先级 */
|
||||
struct FIFO32 fifo;
|
||||
struct TSS32 tss;
|
||||
struct SEGMENT_DESCRIPTOR ldt[2];
|
||||
struct CONSOLE *cons;
|
||||
int ds_base, cons_stack;
|
||||
};
|
||||
@@ -17,7 +17,7 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
cons.cur_c = -1;
|
||||
task->cons = &cons;
|
||||
|
||||
if (sheet != 0) {
|
||||
if (cons.sht != 0) {
|
||||
cons.timer = timer_alloc();
|
||||
timer_init(cons.timer, &task->fifo, 1);
|
||||
timer_settime(cons.timer, 50);
|
||||
@@ -35,7 +35,7 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
} else {
|
||||
i = fifo32_get(&task->fifo);
|
||||
io_sti();
|
||||
if (i <= 1) { /*光标用定时器*/
|
||||
if (i <= 1 && cons.sht != 0) { /*光标用定时器*/
|
||||
if (i != 0) {
|
||||
timer_init(cons.timer, &task->fifo, 0); /*下次置0 */
|
||||
if (cons.cur_c >= 0) {
|
||||
@@ -53,7 +53,10 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
cons.cur_c = COL8_FFFFFF;
|
||||
}
|
||||
if (i == 3) { /*光标OFF */
|
||||
boxfill8(sheet->buf, sheet->bxsize, COL8_000000, cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15);
|
||||
if (cons.sht != 0) {
|
||||
boxfill8(cons.sht->buf, cons.sht->bxsize, COL8_000000,
|
||||
cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15);
|
||||
}
|
||||
cons.cur_c = -1;
|
||||
}
|
||||
if (i == 4) { /*点击命令行窗口的“×”按钮*/
|
||||
@@ -74,7 +77,7 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
cmdline[cons.cur_x / 8 - 2] = 0;
|
||||
cons_newline(&cons);
|
||||
cons_runcmd(cmdline, &cons, fat, memtotal); /*运行命令*/
|
||||
if (sheet == 0) {
|
||||
if (cons.sht == 0) {
|
||||
cmd_exit(&cons, fat);
|
||||
}
|
||||
/*显示提示符*/
|
||||
@@ -89,11 +92,12 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
}
|
||||
}
|
||||
/*重新显示光标*/
|
||||
if (sheet != 0) {
|
||||
if (cons.sht != 0) {
|
||||
if (cons.cur_c >= 0) {
|
||||
boxfill8(sheet->buf, sheet->bxsize, cons.cur_c, cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15);
|
||||
boxfill8(cons.sht->buf, cons.sht->bxsize, cons.cur_c,
|
||||
cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15);
|
||||
}
|
||||
sheet_refresh(sheet, cons.cur_x, cons.cur_y, cons.cur_x + 8, cons.cur_y + 16);
|
||||
sheet_refresh(cons.sht, cons.cur_x, cons.cur_y, cons.cur_x + 8, cons.cur_y + 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,8 +112,8 @@ void cons_putchar(struct CONSOLE *cons, int chr, char move)
|
||||
for (;;) {
|
||||
if (cons->sht != 0) {
|
||||
putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, " ", 1);
|
||||
cons->cur_x += 8;
|
||||
}
|
||||
cons->cur_x += 8;
|
||||
if (cons->cur_x == 8 + 240) {
|
||||
cons_newline(cons);
|
||||
}
|
||||
@@ -194,8 +198,8 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal)
|
||||
} else if (strncmp(cmdline, "start ", 6) == 0) {
|
||||
cmd_start(cons, cmdline, memtotal);
|
||||
} else if (strncmp(cmdline, "ncst ", 5) == 0) {
|
||||
cmd_ncst(cons, cmdline, memtotal);
|
||||
}else if (cmdline[0] != 0) {
|
||||
cmd_ncst(cons, cmdline, memtotal);
|
||||
} else if (cmdline[0] != 0) {
|
||||
if (cmd_app(cons, fat, cmdline) == 0) {
|
||||
/*不是命令,不是应用程序,也不是空行*/
|
||||
cons_putstr0(cons, "Bad command.\n\n");
|
||||
@@ -369,12 +373,12 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
|
||||
dathrb = *((int *) (p + 0x0014));
|
||||
q = (char *) memman_alloc_4k(memman, segsiz);
|
||||
task->ds_base = (int) q;
|
||||
set_segmdesc(gdt + task->sel / 8 + 1000, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60);
|
||||
set_segmdesc(gdt + task->sel / 8 + 2000, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
|
||||
set_segmdesc(task->ldt + 0, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60);
|
||||
set_segmdesc(task->ldt + 1, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
|
||||
for (i = 0; i < datsiz; i++) {
|
||||
q[esp + i] = p[dathrb + i];
|
||||
}
|
||||
start_app(0x1b, task->sel + 1000 * 8, esp, task->sel + 2000 * 8, &(task->tss.esp0));
|
||||
start_app(0x1b, 0 * 8 + 4, esp, 1 * 8 + 4, &(task->tss.esp0));
|
||||
shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
|
||||
for (i = 0; i < MAX_SHEETS; i++) {
|
||||
sht = &(shtctl->sheets0[i]);
|
||||
@@ -403,6 +407,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
struct CONSOLE *cons = task->cons;
|
||||
struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
|
||||
struct SHEET *sht;
|
||||
struct FIFO32 *sys_fifo = (struct FIFO32 *) *((int *) 0x0fec);
|
||||
int *reg = &eax + 1; /* eax后面的地址*/
|
||||
/*强行改写通过PUSHAD保存的值*/
|
||||
/* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */
|
||||
@@ -490,6 +495,13 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
if (i == 3) { /*光标OFF */
|
||||
cons->cur_c = -1;
|
||||
}
|
||||
if (i == 4) { /*只关闭命令行窗口*/
|
||||
timer_cancel(cons->timer);
|
||||
io_cli();
|
||||
fifo32_put(sys_fifo, cons->sht - shtctl->sheets0 + 2024); /*2024~2279*/
|
||||
cons->sht = 0;
|
||||
io_sti();
|
||||
}
|
||||
if (i >= 256) { /*键盘数据(通过任务A)等*/
|
||||
reg[7] = i - 256;
|
||||
return 0;
|
||||
1
27_day/haribote/make.bat
Normal file
1
27_day/haribote/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
@@ -82,7 +82,9 @@ struct TASK *task_init(struct MEMMAN *memman)
|
||||
for (i = 0; i < MAX_TASKS; i++) {
|
||||
taskctl->tasks0[i].flags = 0;
|
||||
taskctl->tasks0[i].sel = (TASK_GDT0 + i) * 8;
|
||||
taskctl->tasks0[i].tss.ldtr = (TASK_GDT0 + MAX_TASKS + i) * 8;
|
||||
set_segmdesc(gdt + TASK_GDT0 + i, 103, (int) &taskctl->tasks0[i].tss, AR_TSS32);
|
||||
set_segmdesc(gdt + TASK_GDT0 + MAX_TASKS + i, 15, (int) taskctl->tasks0[i].ldt, AR_LDT);
|
||||
}
|
||||
for (i = 0; i < MAX_TASKLEVELS; i++) {
|
||||
taskctl->level[i].running = 0;
|
||||
@@ -133,7 +135,6 @@ struct TASK *task_alloc(void)
|
||||
task->tss.ds = 0;
|
||||
task->tss.fs = 0;
|
||||
task->tss.gs = 0;
|
||||
task->tss.ldtr = 0;
|
||||
task->tss.iomap = 0x40000000;
|
||||
task->tss.ss0 = 0;
|
||||
return task;
|
||||
@@ -1,16 +0,0 @@
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
MOV ECX,msg
|
||||
MOV EDX,1
|
||||
putloop:
|
||||
MOV AL,[CS:ECX]
|
||||
CMP AL,0
|
||||
JE fin
|
||||
INT 0x40
|
||||
ADD ECX,1
|
||||
JMP putloop
|
||||
fin:
|
||||
MOV EDX,4
|
||||
INT 0x40
|
||||
msg:
|
||||
DB "hello",0
|
||||
@@ -1,9 +0,0 @@
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
MOV EDX,2
|
||||
MOV EBX,msg
|
||||
INT 0x40
|
||||
MOV EDX,4
|
||||
INT 0x40
|
||||
msg:
|
||||
DB "hello",0
|
||||
1
27_day/hello3/!cons_9x.bat
Normal file
1
27_day/hello3/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/hello3/!cons_nt.bat
Normal file
1
27_day/hello3/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/hello3/Makefile
Normal file
5
27_day/hello3/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = hello3
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
@@ -1,5 +1,4 @@
|
||||
void api_putchar(int c);
|
||||
void api_end(void);
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
1
27_day/hello3/make.bat
Normal file
1
27_day/hello3/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
27_day/hello4/!cons_9x.bat
Normal file
1
27_day/hello4/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/hello4/!cons_nt.bat
Normal file
1
27_day/hello4/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/hello4/Makefile
Normal file
5
27_day/hello4/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = hello4
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
@@ -1,5 +1,4 @@
|
||||
void api_putstr0(char *s);
|
||||
void api_end(void);
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
1
27_day/hello4/make.bat
Normal file
1
27_day/hello4/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
27_day/hello5/!cons_9x.bat
Normal file
1
27_day/hello5/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/hello5/!cons_nt.bat
Normal file
1
27_day/hello5/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/hello5/Makefile
Normal file
5
27_day/hello5/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = hello5
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
1
27_day/hello5/make.bat
Normal file
1
27_day/hello5/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
27_day/lines/!cons_9x.bat
Normal file
1
27_day/lines/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
27_day/lines/!cons_nt.bat
Normal file
1
27_day/lines/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
27_day/lines/Makefile
Normal file
5
27_day/lines/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = lines
|
||||
STACK = 1k
|
||||
MALLOC = 48k
|
||||
|
||||
include ../app_make.txt
|
||||
@@ -1,11 +1,4 @@
|
||||
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
void api_initmalloc(void);
|
||||
char *api_malloc(int size);
|
||||
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
void api_closewin(int win);
|
||||
int api_getkey(int mode);
|
||||
void api_end(void);
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
1
27_day/lines/make.bat
Normal file
1
27_day/lines/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
27_day/noodle/!cons_9x.bat
Normal file
1
27_day/noodle/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user