-
Notifications
You must be signed in to change notification settings - Fork 1
/
diff.txt
2052 lines (1932 loc) · 81.6 KB
/
diff.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/0_1_build_userland.bat b/0_1_build_userland.bat
index 461e6fd..c53d4ca 100644
--- a/0_1_build_userland.bat
+++ b/0_1_build_userland.bat
@@ -13,6 +13,7 @@ set AFLAGS=
echo compile userland apps
if not exist obj mkdir obj
if not exist bin mkdir bin
+if not exist bin\utils mkdir bin\utils
if not exist bin\userland mkdir bin\userland
if not exist bin\sys mkdir bin\sys
@@ -31,4 +32,16 @@ for /d %%j in (userland\apps\*.*) do (
echo building FASM
%ASSEMBLER% userland/FASM/main.asm bin/fasm.bin
+
+echo building utilities
+for /d %%j in (userland\utils\*.*) do (
+ if exist userland\utils\%%~nj\main.bas echo %COMPILER% %CFLAGS% userland/utils/%%~nj/main.bas -o obj/%%~nj.o
+ if exist userland\utils\%%~nj\main.bas %COMPILER% %CFLAGS% userland/utils/%%~nj/main.bas -o obj/%%~nj.o
+ if exist userland\utils\%%~nj\main.bas echo %LINKER% obj/userland_header.o obj/%%~nj.o -T userland/userland.ld -o bin/utils/%%~nj.bin
+ if exist userland\utils\%%~nj\main.bas %LINKER% obj/userland_header.o obj/%%~nj.o -T userland/userland.ld -o bin/utils/%%~nj.bin
+
+ if exist userland\utils\%%~nj\main.asm echo %ASSEMBLER% userland/utils/%%~nj/main.asm bin/utils/%%~nj.bin
+ if exist userland\utils\%%~nj\main.asm %ASSEMBLER% userland/utils/%%~nj/main.asm bin/utils/%%~nj.bin
+
+)
pause
\ No newline at end of file
diff --git a/2_install.bat b/2_install.bat
index 35b11b9..4666267 100644
--- a/2_install.bat
+++ b/2_install.bat
@@ -30,6 +30,7 @@ for /d %%i in (userland\apps\*.*) do (
)
+
echo install keymaps
copy bin\keymaps\*.* %Drive%\keys
@@ -48,6 +49,10 @@ copy bin\res\mousecur.bin %Drive%\res
echo Instal System bin
copy bin\sys\*.* %Drive%\sys
+
+echo Instal Utilities
+copy bin\utils\*.* %Drive%\bin
+
copy bin\*.bin %Drive%\bin
echo Install config
diff --git a/4_startQemu.bat b/4_startQemu.bat
index 5068c23..a3d8d8f 100644
--- a/4_startQemu.bat
+++ b/4_startQemu.bat
@@ -1,4 +1,4 @@
set mypath=%cd%
cd qemu
-qemu-system-i386.exe -m 128 -hda ..\hd.img -device sb16 -D con
+qemu-system-i386.exe -m 1G -hda ..\hd.img -device sb16 -D con
pause
\ No newline at end of file
diff --git a/kernel.map b/kernel.map
index eb805a6..64a8247 100644
--- a/kernel.map
+++ b/kernel.map
@@ -11,7 +11,7 @@ LOAD obj/Interrupts.o
LOAD obj/main.o
0x00100000 . = 0x100000
-.text 0x00100000 0xa3d4
+.text 0x00100000 0xa764
0x00100000 _KERNEL_START = .
*(.text)
.text 0x00100000 0x1cf obj/0Start.o
@@ -22,258 +22,256 @@ LOAD obj/main.o
*fill* 0x001001cf 0x1 00
.text 0x001001d0 0x1214 obj/Interrupts.o
0x00100fe4 _INTERRUPT_TAB@0
- .text 0x001013e4 0x8ff0 obj/main.o
- 0x00108314 __ZN15THREADSCHEDULER17SETTHREADREALTIMEEP6THREADm@12
- 0x00101884 _KTSS_SET_CR3@4
- 0x001025a4 _GET_RTC_UPDATE_IN_PROGRESS_FLAG@0
- 0x00102cf4 __ZN11VIRTCONSOLE8ACTIVATEEv@4
- 0x00109c54 __ZN11IPCENDPOINT10CREATENAMEEPhP6THREADmm@16
- 0x00102524 _PIC_INIT@0
- 0x00109e54 __ZN11IPCENDPOINTD1Ev
- 0x00108074 __ZN11THREADQUEUE10RTCDEQUEUEEv@4
- 0x00109674 __ZN14USERMODEDEVICE4FINDEPh@4
- 0x00103e94 _STRLASTINDEXOF@8
- 0x00103c04 _STRTRIM@4
- 0x00106284 _IRQ_ENABLE@4
- 0x00105f54 _KALLOC@4
- 0x00104554 _STRCAT@8
- 0x00103684 _CONSOLECLEAR@0
- 0x00101c14 _VMM_KERNEL_AUTOMAP@12
- 0x00106e14 __ZN7PROCESSD1Ev
- 0x00107b64 _KERNEL_IDLE@4
- 0x00107ae4 __ZN6THREAD11INITMANAGEREv@0
- 0x00103b24 _STRLEN@4
- 0x001071c4 __ZN7PROCESS9DOLOADELFEv@4
- 0x00103b64 _STRWLEN@4
- 0x00109b04 _IPC_INIT@0
- 0x00107b44 __ZN6THREAD5READYEv@0
- 0x00109494 _XAPPSIGNAL2PARAMETERS@16
- 0x00102dd4 __ZN11VIRTCONSOLE7PRINTOKEv@4
- 0x00103f64 _STRNCMP@12
- 0x00107014 __ZN7PROCESS13CREATECONSOLEEv@4
- 0x00103bb4 _STRDLEN@4
- 0x00103244 __ZN11VIRTCONSOLE9WRITELINEEPh@8
- 0x00105e64 __ZN4SLAB11ISVALIDADDREPv@8
- 0x00106f34 __ZN7PROCESS16FINDADDRESSSPACEEm@8
- 0x00109514 _XAPPSIGNAL6PARAMETERS@32
- 0x00107754 __ZN7PROCESS16REQUESTTERMINATEEPS_@4
- 0x00107d04 __ZN6THREAD6CREATEEP7PROCESSm@8
- 0x00105784 _PMM_STRIPE@8
- 0x00103994 _SQRT@8
- 0x00109ba4 __ZN11IPCENDPOINT10FINDBYNAMEEPh@4
- 0x00103584 _CONSOLEWRITESIGNED@4
- 0x00109964 __ZN9SEMAPHORED1Ev
- 0x00106364 _IRQ_ATTACH_HANDLER@8
- 0x00109834 __ZN6SIGNAL4WAITEP6THREAD@8
- 0x00105204 _ATOF@4
- 0x001055d4 _PMM_GET_FREEPAGES_COUNT@0
- 0x001016b4 _DOREALMODEACTIONREG@32
- 0x00104b14 _ULONGTOSTR@8
- 0x001095d4 _UDEV_INIT@0
- 0x00106ec4 __ZN7PROCESS18CREATEADDRESSSPACEEm@8
- 0x00104064 _STRWCMP@8
- 0x00101d84 __ZN10VMMCONTEXT10INITIALIZEEv@4
- 0x00106c94 __ZN7PROCESSC1Ev
- 0x00103db4 _STRINDEXOF@8
- 0x00102d14 __ZN11VIRTCONSOLE7PUTCHAREa@8
- 0x001083d4 __ZN15THREADSCHEDULER8SCHEDULEEv@4
- 0x00102c14 _CONSOLEINIT@0
- 0x00103494 _CONSOLEWRITETEXTANDHEX@12
- 0x001081f4 __ZN15THREADSCHEDULER12REMOVETHREADEP6THREAD@8
- 0x001021b4 __ZN10VMMCONTEXT8MAP_PAGEEPvS0_m@16
- 0x00101fb4 __ZN10VMMCONTEXT14FREE_PAGETABLEEPm@8
- 0x00103ae4 _FSIN@4
- 0x00108624 _SYSCALL30HANDLER@4
- 0x00103454 _CONSOLESETBACKGROUND@4
- 0x001083a4 __ZN15THREADSCHEDULER14SETTHREADREADYEP6THREAD@8
- 0x00105964 _SLABINIT@0
- 0x00105ec4 _KMM_ALLOCPAGE@0
- 0x00106434 _PANICEXCEPTION@8
- 0x00107aa4 _ENTERCRITICAL@0
- 0x00105bf4 __ZN4SLABD1Ev
- 0x00101bb4 _VMM_EXIT@0
- 0x00107cc4 __ZN6THREAD7ISVALIDEv@4
- 0x001025e4 _GET_RTC_REGISTER@4
- 0x001054c4 _ATOLHEX@4
- 0x00104cf4 _UINTTOSTR@8
- 0x00103474 _CONSOLEWRITELINE@4
- 0x00107c14 __ZN6THREADD1Ev
- 0x001069c4 _VESAPROBE@0
- 0x00106924 _VESAGETMODEINFO@4
- 0x001055a4 _ABSOLUTE@4
- 0x0010a204 _IPCSEND@40
- 0x00101584 _DOREALMODEACTION@4
- 0x001023a4 __ZN10VMMCONTEXT10UNMAP_PAGEEPv@8
+ .text 0x001013e4 0x9380 obj/main.o
+ 0x00108384 __ZN15THREADSCHEDULER17SETTHREADREALTIMEEP6THREADm@12
+ 0x00101874 _KTSS_SET_CR3@4
+ 0x00102544 _GET_RTC_UPDATE_IN_PROGRESS_FLAG@0
+ 0x00107b24 _STD_READ@4
+ 0x00109ff4 __ZN11IPCENDPOINT10CREATENAMEEPhP6THREADmm@16
+ 0x001024c4 _PIC_INIT@0
+ 0x0010a1f4 __ZN11IPCENDPOINTD1Ev
+ 0x00108114 __ZN11THREADQUEUE10RTCDEQUEUEEv@4
+ 0x00109a14 __ZN14USERMODEDEVICE4FINDEPh@4
+ 0x00103dd4 _STRLASTINDEXOF@8
+ 0x00103b44 _STRTRIM@4
+ 0x001061c4 _IRQ_ENABLE@4
+ 0x00105e94 _KALLOC@4
+ 0x00104494 _STRCAT@8
+ 0x00103364 _CONSOLECLEAR@0
+ 0x00101bf4 _VMM_KERNEL_AUTOMAP@12
+ 0x00106d14 __ZN7PROCESSD1Ev
+ 0x00107c04 _KERNEL_IDLE@4
+ 0x00107b84 __ZN6THREAD11INITMANAGEREv@0
+ 0x00103a64 _STRLEN@4
+ 0x00106f84 __ZN7PROCESS9DOLOADELFEv@4
+ 0x00103aa4 _STRWLEN@4
+ 0x00109ea4 _IPC_INIT@0
+ 0x00107be4 __ZN6THREAD5READYEv@0
+ 0x00109834 _XAPPSIGNAL2PARAMETERS@16
+ 0x00103ea4 _STRNCMP@12
+ 0x00103af4 _STRDLEN@4
+ 0x00105da4 __ZN4SLAB11ISVALIDADDREPv@8
+ 0x00106e34 __ZN7PROCESS16FINDADDRESSSPACEEm@8
+ 0x001098b4 _XAPPSIGNAL6PARAMETERS@32
+ 0x00107504 __ZN7PROCESS16REQUESTTERMINATEEPS_@4
+ 0x00107da4 __ZN6THREAD6CREATEEP7PROCESSm@8
+ 0x001056c4 _PMM_STRIPE@8
+ 0x001038d4 _SQRT@8
+ 0x00109f44 __ZN11IPCENDPOINT10FINDBYNAMEEPh@4
+ 0x001034f4 _CONSOLEWRITESIGNED@4
+ 0x00109d04 __ZN9SEMAPHORED1Ev
+ 0x001062a4 _IRQ_ATTACH_HANDLER@8
+ 0x00109bd4 __ZN6SIGNAL4WAITEP6THREAD@8
+ 0x00105144 _ATOF@4
+ 0x00105514 _PMM_GET_FREEPAGES_COUNT@0
+ 0x001016a4 _DOREALMODEACTIONREG@32
+ 0x00107414 __ZN7PROCESS6CREATEEP17EXECUTABLE_HEADERmPhP8STD_PIPES4_@20
+ 0x00104a54 _ULONGTOSTR@8
+ 0x00109974 _UDEV_INIT@0
+ 0x00106dc4 __ZN7PROCESS18CREATEADDRESSSPACEEm@8
+ 0x00103fa4 _STRWCMP@8
+ 0x00101d24 __ZN10VMMCONTEXT10INITIALIZEEv@4
+ 0x00106bb4 __ZN7PROCESSC1Ev
+ 0x00103cf4 _STRINDEXOF@8
+ 0x00108444 __ZN15THREADSCHEDULER8SCHEDULEEv@4
+ 0x00102bb4 _CONSOLEINIT@0
+ 0x00103404 _CONSOLEWRITETEXTANDHEX@12
+ 0x00108294 __ZN15THREADSCHEDULER12REMOVETHREADEP6THREAD@8
+ 0x00102154 __ZN10VMMCONTEXT8MAP_PAGEEPvS0_m@16
+ 0x00101f54 __ZN10VMMCONTEXT14FREE_PAGETABLEEPm@8
+ 0x00103a24 _FSIN@4
+ 0x00108694 _SYSCALL30HANDLER@4
+ 0x001033e4 _CONSOLESETBACKGROUND@4
+ 0x00108414 __ZN15THREADSCHEDULER14SETTHREADREADYEP6THREAD@8
+ 0x001058a4 _SLABINIT@0
+ 0x00105e04 _KMM_ALLOCPAGE@0
+ 0x00106374 _PANICEXCEPTION@8
+ 0x00107b44 _ENTERCRITICAL@0
+ 0x00105b34 __ZN4SLABD1Ev
+ 0x00101ba4 _VMM_EXIT@0
+ 0x00107d64 __ZN6THREAD7ISVALIDEv@4
+ 0x00102584 _GET_RTC_REGISTER@4
+ 0x00105404 _ATOLHEX@4
+ 0x00104c34 _UINTTOSTR@8
+ 0x00103164 _CONSOLEWRITELINE@4
+ 0x00107cb4 __ZN6THREADD1Ev
+ 0x001068f4 _VESAPROBE@0
+ 0x00106854 _VESAGETMODEINFO@4
+ 0x001054e4 _ABSOLUTE@4
+ 0x0010a5a4 _IPCSEND@40
+ 0x00101574 _DOREALMODEACTION@4
+ 0x00102344 __ZN10VMMCONTEXT10UNMAP_PAGEEPv@8
0x001013e4 _MAIN@4
- 0x00105b94 __ZN12SLABMETADATA11ISVALIDADDREPv@8
- 0x00104ed4 _STRCPY@8
- 0x00101ad4 _VMM_INIT@0
- 0x00101c54 _VMM_KERNEL_UNMAP@8
- 0x00105f04 _KMM_FREEPAGE@4
- 0x00103fd4 _STRCMP@8
- 0x00104f34 _memcpy
- 0x00103694 _CONSOLEUPDATECURSOR@0
- 0x00109d74 __ZN11IPCENDPOINT12CREATECOMMONEPS_P6THREADmm@16
- 0x00105074 _memset
- 0x00107674 __ZN7PROCESS6CREATEEP17EXECUTABLE_HEADERmPh@12
- 0x00105304 _ATOIHEX@4
- 0x00107b84 _INT20HANDLER@4
- 0x00109c14 __ZN11IPCENDPOINT5NEWIDEv@0
+ 0x00105ad4 __ZN12SLABMETADATA11ISVALIDADDREPv@8
+ 0x00104e14 _STRCPY@8
+ 0x00107674 __ZN7PROCESS7GET_OUTEP8STD_PIPE@8
+ 0x00101ac4 _VMM_INIT@0
+ 0x00101c34 _VMM_KERNEL_UNMAP@8
+ 0x00105e44 _KMM_FREEPAGE@4
+ 0x00103f14 _STRCMP@8
+ 0x00104e74 _memcpy
+ 0x00103574 _CONSOLEUPDATECURSOR@0
+ 0x0010a114 __ZN11IPCENDPOINT12CREATECOMMONEPS_P6THREADmm@16
+ 0x00104fb4 _memset
+ 0x00105244 _ATOIHEX@4
+ 0x00107c24 _INT20HANDLER@4
+ 0x00109fb4 __ZN11IPCENDPOINT5NEWIDEv@0
0x001014c4 _KERNEL_ERROR@8
- 0x00106b34 _VESASETMODE@4
- 0x001035c4 _CONSOLEWRITEUNUMBER@8
- 0x00109b44 __ZN11IPCENDPOINT8FINDBYIDEm@4
- 0x001058f4 _GETSMALLESTPOWEROFTWOO@4
- 0x00107fa4 __ZN11THREADQUEUE11ENQUEUETAILEP6THREAD@8
- 0x001023c4 __ZN10VMMCONTEXT11UNMAP_RANGEEPvm@12
- 0x001060d4 _INT_HANDLER@4
- 0x00101824 _KTSS_SET@16
- 0x001050b4 _MEMSET32@12
- 0x00104f54 _MEMCPY16@12
- 0x00102114 __ZN10VMMCONTEXT7AUTOMAPEPvmmmm@24
- 0x00101a24 _LDT_SET_GATE@20
- 0x00101ef4 __ZN10VMMCONTEXT13GET_PAGETABLEEm@8
- 0x00107f14 __ZN11THREADQUEUEC1Ev
- 0x00109fa4 __ZN11IPCENDPOINT7DEQUEUEEv@4
- 0x00105dd4 __ZN4SLAB4FREEEPv@8
- 0x001062f4 _IRQ_DISABLE@4
- 0x00101fe4 __ZN10VMMCONTEXT15FIND_FREE_PAGESEmmm@16
- 0x00106c74 __ZN7PROCESS10INITENGINEEv@0
- 0x00105fa4 _INTERRUPTSMANAGER_INIT@0
- 0x00109f54 __ZN11IPCENDPOINT7ENQUEUEEP10IPCMESSAGE@8
- 0x0010a004 __ZN11IPCENDPOINT14PROCESSRECEIVEEv@4
- 0x001019f4 _GDT_SET_GATE@20
- 0x001063a4 _IRQ_SEND_ACK@4
- 0x00103aa4 _FCOS@4
- 0x00104294 _STRTOUPPER@4
- 0x00106384 _IRQ_DETACH_HANDLER@4
- 0x00103a54 _DSIN@8
- 0x001050d4 _ATOI@4
- 0x00107ea4 __ZN6THREAD6DOWAITEP9IRQ_STACK@8
- 0x00103a04 _DCOS@8
- 0x001057d4 _PMM_ALLOCPAGE@0
- 0x00103624 _CONSOLEPRINTOK@0
- 0x00107a04 __ZN17ADDRESSSPACEENTRY8COPYFROMEPvm@12
- 0x00108174 __ZN15THREADSCHEDULERC1Ev
- 0x00102334 __ZN10VMMCONTEXT9MAP_RANGEEPvS0_S0_m@20
- 0x0010a1a4 _IPCSENDBODY@12
- 0x001036a4 _MODULES_INIT@4
- 0x00101534 _REALMODE_INIT@0
- 0x00104624 _FTOA@12
- 0x00101bf4 _VMM_GET_CURRENT_CONTEXT@0
- 0x00107724 __ZN7PROCESS9ADDTHREADEPv@8
- 0x001059d4 __ZN12SLABMETADATA6KALLOCEm@8
- 0x00109394 _SYSCALL31HANDLER@4
- 0x00109a84 __ZN9SEMAPHORE9SEMUNLOCKEP6THREAD@8
- 0x00104834 _FLOATTOSTR@4
- 0x00107944 __ZN17ADDRESSSPACEENTRYD1Ev
- 0x00102744 _GETTIMEBCD@0
- 0x00104354 _STRTOLOWER@4
- 0x00102cc4 __ZN11VIRTCONSOLED1Ev
- 0x00105c24 __ZN4SLAB4INITEt@8
- 0x00103834 _MODULES_PRE_INIT@4
- 0x001049a4 _DOUBLETOSTR@8
- 0x001034c4 _CONSOLEWRITETEXTANDDEC@12
- 0x00104414 _SUBSTRING@12
- 0x001024b4 _SET_TIMER_FREQ@4
- 0x00102bb4 __ZN8SPINLOCK7ACQUIREEv@4
- 0x00103434 _CONSOLESETFOREGROUND@4
- 0x00105094 _MEMSET16@12
- 0x00108004 __ZN11THREADQUEUE7DEQUEUEEv@4
- 0x00101e54 __ZN10VMMCONTEXT4SYNCEv@4
- 0x00103634 _CONSOLEPRINTFAIL@0
- 0x001044e4 _STRENDSWITH@8
- 0x00104104 _STRREV@4
- 0x00105d14 __ZN4SLAB5ALLOCEm@8
- 0x001055f4 _PMM_INIT@4
- 0x00102624 _GETDATEBCD@0
- 0x00104dd4 _INTTOSTR@8
- 0x001073d4 __ZN7PROCESS14PARSEARGUMENTSEv@4
- 0x00102bf4 __ZN8SPINLOCK7RELEASEEv@4
- 0x001095e4 __ZN14USERMODEDEVICE6CREATEEPhP6THREADmm@16
- 0x00102fc4 __ZN11VIRTCONSOLE9PRINTFAILEv@4
- 0x00104204 _STRTOLOWERFIX@4
- 0x00101724 _KTSS_INIT@0
- 0x00103354 __ZN11VIRTCONSOLE7NEWLINEEv@4
- 0x00105ad4 __ZN12SLABMETADATA5KFREEEPv@8
- 0x00105f84 _KFREE@4
- 0x00104ff4 _MEMCPY64@12
- 0x001035e4 _CONSOLEWRITENUMBER@8
- 0x00107ac4 _EXITCRITICAL@0
- 0x001099c4 __ZN9SEMAPHORE7SEMLOCKEP6THREAD@8
- 0x00106524 _EXCEPTIONHANDLER@4
- 0x001070a4 __ZN7PROCESS11FREECONSOLEEv@4
- 0x00108234 __ZN15THREADSCHEDULER6SWITCHEP9IRQ_STACKP6THREAD@12
- 0x00103674 _CONSOLENEWLINE@0
- 0x001077a4 __ZN7PROCESS9TERMINATEEPS_@4
- 0x00103604 _CONSOLEPUTCHAR@4
- 0x001053e4 _ATOL@4
- 0x001096d4 __ZN14USERMODEDEVICE6INVOKEEmP6THREADmmmm@24
- 0x001080e4 __ZN11THREADQUEUE6REMOVEEP6THREAD@8
- 0x00107f44 __ZN11THREADQUEUE11ENQUEUEHEADEP6THREAD@8
- 0x001031c4 __ZN11VIRTCONSOLE9BACKSPACEEv@4
- 0x00103644 _CONSOLEBACKSPACE@0
- 0x00109894 __ZN6SIGNAL3SETEv@4
- 0x00109904 __ZN9SEMAPHOREC1Ev
- 0x001084d4 _NEXTRANDOMNUMBER@8
- 0x00106f84 __ZN7PROCESS18REMOVEADDRESSSPACEEm@8
- 0x001072f4 __ZN7PROCESS6DOLOADEv@4
- 0x00103384 __ZN11VIRTCONSOLE6SCROLLEv@4
- 0x00104bf4 _LONGTOSTR@8
- 0x00109cd4 __ZN11IPCENDPOINT8CREATEIDEmP6THREADmm@16
- 0x001034f4 _CONSOLEWRITETEXTANDSIZE@12
- 0x001033e4 __ZN11VIRTCONSOLE5CLEAREv@4
- 0x001068b4 _VESAGETINFO@0
- 0x001063c4 _IRQ_THREAD_TERMINATED@4
- 0x00104f94 _MEMCPY512@12
- 0x00109774 __ZN6SIGNALC1Ev
- 0x00109e14 __ZN10IPCMESSAGED1Ev
- 0x00108374 __ZN15THREADSCHEDULER17SETTHREADREADYNOWEP6THREAD@8
- 0x00104194 _STRTOUPPERFIX@4
- 0x00105864 _PMM_FREEPAGE@4
- 0x00104f74 _MEMCPY32@12
- 0x00107e84 __ZN6THREAD9ADDTOLISTEv@4
- 0x001018a4 _GDT_INIT@0
- 0x00102414 __ZN10VMMCONTEXT7RESOLVEEPv@8
- 0x00106c54 _VESARESETSCREEN@0
- 0x00103264 __ZN11VIRTCONSOLE5WRITEEPh@8
- 0x00101c84 _VMM_INIT_LOCAL@0
- 0x00107834 __ZN17ADDRESSSPACEENTRY4SBRKEm@8
- 0x00102b94 __ZN8SPINLOCK4INITEv@4
- 0x00102b14 _PIC_IS_SPURIOUS@4
- 0x00102584 _MASK_IRQ@0
- 0x001097d4 __ZN6SIGNALD1Ev
- 0x00102564 _UNMASK_IRQ@0
- 0x00106074 _SET_IDT@12
- 0x00101ea4 __ZN10VMMCONTEXT8ACTIVATEEv@4
- 0x00103654 _CONSOLEWRITE@4
- 0x00101d14 __ZN10VMMCONTEXTD1Ev
- 0x00107154 __ZN7PROCESS10DOLOADFLATEv@4
- 0x00102824 _READ_RTC@0
- 0x00103d94 _STRCONTAINS@8
+ 0x00106a64 _VESASETMODE@4
+ 0x00103534 _CONSOLEWRITEUNUMBER@8
+ 0x00109ee4 __ZN11IPCENDPOINT8FINDBYIDEm@4
+ 0x00105834 _GETSMALLESTPOWEROFTWOO@4
+ 0x00108044 __ZN11THREADQUEUE11ENQUEUETAILEP6THREAD@8
+ 0x00102364 __ZN10VMMCONTEXT11UNMAP_RANGEEPvm@12
+ 0x00106014 _INT_HANDLER@4
+ 0x00101814 _KTSS_SET@16
+ 0x00104ff4 _MEMSET32@12
+ 0x00104e94 _MEMCPY16@12
+ 0x001020b4 __ZN10VMMCONTEXT7AUTOMAPEPvmmmm@24
+ 0x00101a14 _LDT_SET_GATE@20
+ 0x00101e94 __ZN10VMMCONTEXT13GET_PAGETABLEEm@8
+ 0x00107fb4 __ZN11THREADQUEUEC1Ev
+ 0x0010a344 __ZN11IPCENDPOINT7DEQUEUEEv@4
+ 0x00105d14 __ZN4SLAB4FREEEPv@8
+ 0x00106234 _IRQ_DISABLE@4
+ 0x00101f84 __ZN10VMMCONTEXT15FIND_FREE_PAGESEmmm@16
+ 0x00107a54 _VIRT_IO_READ@4
+ 0x00106b94 __ZN7PROCESS10INITENGINEEv@0
+ 0x00105ee4 _INTERRUPTSMANAGER_INIT@0
+ 0x0010a2f4 __ZN11IPCENDPOINT7ENQUEUEEP10IPCMESSAGE@8
+ 0x0010a3a4 __ZN11IPCENDPOINT14PROCESSRECEIVEEv@4
+ 0x001019e4 _GDT_SET_GATE@20
+ 0x001062e4 _IRQ_SEND_ACK@4
+ 0x001039e4 _FCOS@4
+ 0x001041d4 _STRTOUPPER@4
+ 0x001062c4 _IRQ_DETACH_HANDLER@4
+ 0x00103994 _DSIN@8
+ 0x00105014 _ATOI@4
+ 0x001079a4 _VIRT_STDIO_CREATE@0
+ 0x00107f44 __ZN6THREAD6DOWAITEP9IRQ_STACK@8
+ 0x00103944 _DCOS@8
+ 0x00105714 _PMM_ALLOCPAGE@0
+ 0x00102d24 _CONSOLEPRINTOK@0
+ 0x001078b4 __ZN17ADDRESSSPACEENTRY8COPYFROMEPvm@12
+ 0x00108214 __ZN15THREADSCHEDULERC1Ev
+ 0x001022d4 __ZN10VMMCONTEXT9MAP_RANGEEPvS0_S0_m@20
+ 0x0010a544 _IPCSENDBODY@12
+ 0x001035e4 _MODULES_INIT@4
+ 0x00101524 _REALMODE_INIT@0
+ 0x00104564 _FTOA@12
+ 0x00101bd4 _VMM_GET_CURRENT_CONTEXT@0
+ 0x001074d4 __ZN7PROCESS9ADDTHREADEPv@8
+ 0x00105914 __ZN12SLABMETADATA6KALLOCEm@8
+ 0x00109474 _SYSCALL31HANDLER@4
+ 0x00109e24 __ZN9SEMAPHORE9SEMUNLOCKEP6THREAD@8
+ 0x00104774 _FLOATTOSTR@4
+ 0x001077f4 __ZN17ADDRESSSPACEENTRYD1Ev
+ 0x001026e4 _GETTIMEBCD@0
+ 0x00104294 _STRTOLOWER@4
+ 0x00105b64 __ZN4SLAB4INITEt@8
+ 0x00103774 _MODULES_PRE_INIT@4
+ 0x001048e4 _DOUBLETOSTR@8
+ 0x00103434 _CONSOLEWRITETEXTANDDEC@12
+ 0x00104354 _SUBSTRING@12
+ 0x00107ad4 _INIT_STD_PIPE@0
+ 0x00102454 _SET_TIMER_FREQ@4
+ 0x00102b54 __ZN8SPINLOCK7ACQUIREEv@4
+ 0x001033c4 _CONSOLESETFOREGROUND@4
+ 0x00104fd4 _MEMSET16@12
+ 0x001080a4 __ZN11THREADQUEUE7DEQUEUEEv@4
+ 0x00101df4 __ZN10VMMCONTEXT4SYNCEv@4
+ 0x00102f04 _CONSOLEPRINTFAIL@0
+ 0x00104424 _STRENDSWITH@8
+ 0x00104044 _STRREV@4
+ 0x00105c54 __ZN4SLAB5ALLOCEm@8
+ 0x00105534 _PMM_INIT@4
+ 0x001025c4 _GETDATEBCD@0
+ 0x00104d14 _INTTOSTR@8
+ 0x00107174 __ZN7PROCESS14PARSEARGUMENTSEv@4
+ 0x00107a14 _VIRT_IO_WRITE@8
+ 0x00102b94 __ZN8SPINLOCK7RELEASEEv@4
+ 0x00109984 __ZN14USERMODEDEVICE6CREATEEPhP6THREADmm@16
+ 0x00104144 _STRTOLOWERFIX@4
+ 0x00101714 _KTSS_INIT@0
+ 0x00105a14 __ZN12SLABMETADATA5KFREEEPv@8
+ 0x001032d4 _CONSOLESCROLL@0
+ 0x00105ec4 _KFREE@4
+ 0x00104f34 _MEMCPY64@12
+ 0x00107b04 _STD_WRITE@8
+ 0x00103554 _CONSOLEWRITENUMBER@8
+ 0x00107b64 _EXITCRITICAL@0
+ 0x00109d64 __ZN9SEMAPHORE7SEMLOCKEP6THREAD@8
+ 0x00106464 _EXCEPTIONHANDLER@4
+ 0x001082d4 __ZN15THREADSCHEDULER6SWITCHEP9IRQ_STACKP6THREAD@12
+ 0x00103294 _CONSOLENEWLINE@0
+ 0x00107554 __ZN7PROCESS9TERMINATEEPS_@4
+ 0x00102c44 _CONSOLEPUTCHAR@4
+ 0x00105324 _ATOL@4
+ 0x00109a74 __ZN14USERMODEDEVICE6INVOKEEmP6THREADmmmm@24
+ 0x00108184 __ZN11THREADQUEUE6REMOVEEP6THREAD@8
+ 0x00107fe4 __ZN11THREADQUEUE11ENQUEUEHEADEP6THREAD@8
+ 0x00107604 __ZN7PROCESS6GET_INEP8STD_PIPE@8
+ 0x001030d4 _CONSOLEBACKSPACE@0
+ 0x00109c34 __ZN6SIGNAL3SETEv@4
+ 0x00109ca4 __ZN9SEMAPHOREC1Ev
+ 0x00108544 _NEXTRANDOMNUMBER@8
+ 0x00107984 __ZN8STD_PIPE5WRITEEh@8
+ 0x00106e84 __ZN7PROCESS18REMOVEADDRESSSPACEEm@8
+ 0x001070b4 __ZN7PROCESS6DOLOADEv@4
+ 0x00104b34 _LONGTOSTR@8
+ 0x0010a074 __ZN11IPCENDPOINT8CREATEIDEmP6THREADmm@16
+ 0x00103464 _CONSOLEWRITETEXTANDSIZE@12
+ 0x001067e4 _VESAGETINFO@0
+ 0x00106304 _IRQ_THREAD_TERMINATED@4
+ 0x00104ed4 _MEMCPY512@12
+ 0x00109b14 __ZN6SIGNALC1Ev
+ 0x0010a1b4 __ZN10IPCMESSAGED1Ev
+ 0x001083e4 __ZN15THREADSCHEDULER17SETTHREADREADYNOWEP6THREAD@8
+ 0x001040d4 _STRTOUPPERFIX@4
+ 0x001057a4 _PMM_FREEPAGE@4
+ 0x00104eb4 _MEMCPY32@12
+ 0x00107f24 __ZN6THREAD9ADDTOLISTEv@4
+ 0x00101894 _GDT_INIT@0
+ 0x001023b4 __ZN10VMMCONTEXT7RESOLVEEPv@8
+ 0x00106b74 _VESARESETSCREEN@0
+ 0x00101c64 _VMM_INIT_LOCAL@0
+ 0x001076e4 __ZN17ADDRESSSPACEENTRY4SBRKEm@8
+ 0x00102b34 __ZN8SPINLOCK4INITEv@4
+ 0x00102ab4 _PIC_IS_SPURIOUS@4
+ 0x00102524 _MASK_IRQ@0
+ 0x00109b74 __ZN6SIGNALD1Ev
+ 0x00102504 _UNMASK_IRQ@0
+ 0x00105fb4 _SET_IDT@12
+ 0x00101e44 __ZN10VMMCONTEXT8ACTIVATEEv@4
+ 0x00103184 _CONSOLEWRITE@4
+ 0x00101cb4 __ZN10VMMCONTEXTD1Ev
+ 0x00106f14 __ZN7PROCESS10DOLOADFLATEv@4
+ 0x00107954 __ZN8STD_PIPE4READEv@4
+ 0x001027c4 _READ_RTC@0
+ 0x00103cd4 _STRCONTAINS@8
.rodata
*(.rodata)
-.data 0x0010b000 0x670
+.data 0x0010b000 0x650
*(.data)
- .data 0x0010b000 0x670 obj/main.o
+ .data 0x0010b000 0x650 obj/main.o
-.ctors 0x0010b670 0x8
- .ctors 0x0010b670 0x8 obj/main.o
+.ctors 0x0010b650 0x8
+ .ctors 0x0010b650 0x8 obj/main.o
-.dtors 0x0010b678 0x4
- .dtors 0x0010b678 0x4 obj/main.o
+.dtors 0x0010b658 0x4
+ .dtors 0x0010b658 0x4 obj/main.o
-.bss 0x0010b67c 0x2029b0
- 0x0010b67c SBSS = .
+.bss 0x0010b65c 0x2029b8
+ 0x0010b65c SBSS = .
*(COMMON)
*(.bss)
- .bss 0x0010b67c 0x100000 obj/0Start.o
- .bss 0x0020b67c 0x1029b0 obj/main.o
- 0x0030e02c EBSS = .
- 0x0030e02c _KERNEL_END = .
+ .bss 0x0010b65c 0x100000 obj/0Start.o
+ .bss 0x0020b65c 0x1029b8 obj/main.o
+ 0x0030e014 EBSS = .
+ 0x0030e014 _KERNEL_END = .
OUTPUT(bin/kernel.elf elf32-i386)
-.rel.dyn 0x0030e02c 0x0
+.rel.dyn 0x0030e014 0x0
.rel.text 0x00000000 0x0 obj/0Start.o
diff --git a/kernel/include/console.bi b/kernel/include/console.bi
index d0491a4..d12c5e1 100644
--- a/kernel/include/console.bi
+++ b/kernel/include/console.bi
@@ -1,32 +1,7 @@
-Type VirtConsole
- CursorX as integer
- CursorY as integer
- Foreground as byte
- Background as byte
- PHYS as byte ptr
- VIRT as byte ptr
- declare sub PutChar (c as byte)
- declare sub PrintOK()
- declare sub PrintFAIL()
- declare sub BackSpace()
- declare sub Write(src as unsigned byte ptr)
- declare sub WriteLine(src as unsigned byte ptr)
- declare sub NewLine()
- declare sub Scroll()
- declare sub Clear()
-
- declare destructor()
-
- declare sub Activate()
-end type
-
declare sub ConsoleInit()
DECLARE sub ConsoleClear()
declare sub ConsoleSetBackground(c as byte)
declare sub ConsoleSetForeground(c as byte)
-
-
-
declare sub ConsoleWriteTextAndHex(src as unsigned byte ptr,n as unsigned integer,newline as boolean)
declare sub ConsoleWriteTextAndSize(src as unsigned byte ptr,s as unsigned integer,newline as boolean)
declare sub ConsoleWriteTextAndDec(src as unsigned byte ptr,n as unsigned integer,newline as boolean)
@@ -42,7 +17,11 @@ declare sub ConsoleUpdateCursor()
declare sub ConsolePrintOK()
declare sub ConsolePrintFAIL()
declare sub ConsolePutChar (c as byte)
-dim shared CurrentConsole as VirtConsole ptr
-dim shared SYSCONSOLE as VirtConsole
-dim shared VIRT_CONSOLE_MEM as unsigned byte ptr
-dim shared PHYS_CONSOLE_MEM as unsigned byte ptr
\ No newline at end of file
+dim shared CONSOLE_MEM as unsigned byte ptr
+dim shared consoleWidth as integer
+dim shared consoleHeight as integer
+dim shared consoleCursorX as integer
+dim shared consoleCursorY as integer
+dim shared consoleLineOffset as integer
+dim shared consoleBackground as unsigned byte
+dim shared consoleForeground as unsigned byte
\ No newline at end of file
diff --git a/kernel/include/process.bi b/kernel/include/process.bi
index ffb85e6..817e0dd 100644
--- a/kernel/include/process.bi
+++ b/kernel/include/process.bi
@@ -22,8 +22,6 @@ TYPE Process field =1
VMM_Context as VMMContext
TmpArgs as unsigned byte ptr
- VIRT_CONSOLE as VirtConsole ptr
-
ServerChannels as any ptr
ClientChannels as any ptr
@@ -32,12 +30,16 @@ TYPE Process field =1
CodeAddressSpace as AddressSpaceEntry ptr
StackAddressSpace as AddressSpaceEntry ptr
+ STD_IN as STD_PIPE ptr
+ STD_OUT as STD_PIPE ptr
+ WaitingThread as any ptr
+
declare function CreateAddressSpace(virt as unsigned integer) as AddressSpaceEntry ptr
declare function FindAddressSpace(virt as unsigned integer) as AddressSpaceEntry ptr
declare sub RemoveAddressSpace(virt as unsigned integer)
declare static sub InitEngine()
- declare static function Create(image as EXECUTABLE_HEADER ptr,size as unsigned integer,args as unsigned byte ptr) as Process ptr
+ declare static function Create(image as EXECUTABLE_HEADER ptr,size as unsigned integer,args as unsigned byte ptr,stdIn as STD_PIPE ptr,stdOut as STD_PIPE ptr) as Process ptr
declare static sub Terminate(app as Process ptr)
declare static sub RequestTerminate(app as Process ptr)
@@ -50,8 +52,8 @@ TYPE Process field =1
declare function DoLoadElf() as unsigned integer
declare sub ParseArguments()
- declare sub FreeConsole()
- declare sub CreateConsole()
+ declare function GET_IN(pip as STD_PIPE ptr) as STD_PIPE ptr
+ declare function GET_OUT(pip as STD_PIPE ptr) as STD_PIPE ptr
end type
diff --git a/kernel/include/thread.bi b/kernel/include/thread.bi
index 4c6afe3..ca7493d 100644
--- a/kernel/include/thread.bi
+++ b/kernel/include/thread.bi
@@ -9,6 +9,7 @@ enum ThreadState
WaitingDialog = 7
WaitingReply = 8
WaitingSendChannel = 9
+ WaitingForProcess=10
Terminating = 127
end enum
diff --git a/kernel/src/arch/x86/vmm.bas b/kernel/src/arch/x86/vmm.bas
index f57e25a..270c9b6 100644
--- a/kernel/src/arch/x86/vmm.bas
+++ b/kernel/src/arch/x86/vmm.bas
@@ -23,8 +23,8 @@ sub VMM_INIT()
kernel_context.map_range(KSTART, KSTART, KEND, VMM_FLAGS_KERNEL_DATA)
- 'map video memory 1:1
- kernel_context.map_page(cptr(any ptr, &hB8000), cptr(any ptr, &hB8000), VMM_FLAGS_USER_DATA)
+ 'map text video memory
+ kernel_context.map_page(CONSOLE_MEM,CONSOLE_MEM, VMM_FLAGS_USER_DATA)
'map the page tables
kernel_context.v_dir = cptr(uinteger ptr, (VMM_PAGETABLES_VIRT_START shr 22)*4096*1024 + (VMM_PAGETABLES_VIRT_START shr 22)*4096)
@@ -51,8 +51,8 @@ sub VMM_EXIT()
and ebx, &h7FFFFFFF
mov cr0,ebx
end asm
- SysConsole.VIRT = cptr(any ptr, &hB8000)
paging_active = 0
+
end sub
function vmm_get_current_context () as VMMContext ptr
@@ -71,7 +71,6 @@ end sub
'' loads the pagedir into cr3 and activates paging
sub vmm_init_local ()
- ConsoleWrite(@"Enabling paging")
dim pagedir as uinteger ptr = kernel_context.p_dir
asm
'' load the page directory address
@@ -90,13 +89,6 @@ sub vmm_init_local ()
end asm
KTSS_SET_CR3(cuint(pagedir))
paging_active = 1
-
- current_context->unmap_page(SysConsole.VIRT)
- SysConsole.Virt = cptr(unsigned byte ptr, ProcessConsoleAddress)
- current_context->map_page(SysConsole.VIRT,SysConsole.PHYS, VMM_FLAGS_USER_DATA)
-
- ConsolePrintOK()
- ConsoleNewLine()
end sub
destructor VMMContext()
diff --git a/kernel/src/console.bas b/kernel/src/console.bas
index e0a6da6..e346c16 100644
--- a/kernel/src/console.bas
+++ b/kernel/src/console.bas
@@ -2,25 +2,17 @@
#include once "stdlib.bi"
-const consoleWidth=80
-const consoleHeight=25
-
-
sub ConsoleInit()
- VIRT_CONSOLE_MEM = cptr(unsigned byte ptr,&HB8000)
- PHYS_CONSOLE_MEM = cptr(unsigned byte ptr,&HB8000)
+ CONSOLE_MEM = cptr(unsigned byte ptr,&HB8000)
- SYSCONSOLE.CursorX = 0
- SYSCONSOLE.CursorY = 0
- SYSCONSOLE.Foreground = 7
- SYSCONSOLE.BACKGROUND = 1
- SYSCONSOLE.PHYS = PHYS_CONSOLE_MEM
- SYSCONSOLE.VIRT = VIRT_CONSOLE_MEM
- CurrentConsole = @SYSCONSOLE
-
- ConsoleSetForeground(7)
- ConsoleSetBackground(0)
+ consoleWidth = 80
+ consoleHeight = 25
+ consoleLineOffset = 0
+ consoleCursorX = 0
+ consoleCursorY = 0
+ consoleForeground = 7
+ consoleBackground = 0
ConsoleClear()
ConsoleUpdateCursor()
@@ -28,153 +20,150 @@ sub ConsoleInit()
ConsoleWrite(@KERNEL_NAME)
ConsoleWrite(@" ")
ConsoleWrite(@KERNEL_VERSION)
+ ConsoleWriteLine(@" startup ...")
ConsoleSetForeground(7)
- ConsoleWriteLine(@" ... System startup")
-
+ ConsoleNewLine
end sub
-destructor VirtConsole()
- if (PHYS<>PHYS_CONSOLE_MEM) then
- PMM_FREEPAGE(PHYS)
- end if
-end destructor
-
-sub VirtConsole.Activate()
- CurrentConsole=@this
-end sub
-
-sub VirtConsole.PutChar(c as byte)
+sub ConsolePutChar(c as byte)
if (c=13) then return
if (c=10) then
- NewLine()
+ ConsoleNewLine()
return
end if
if (c=8) then
- BackSpace()
+ ConsoleBackSpace()
return
end if
if (c=9) then
- CursorX=CursorX+5
+ consoleCursorX += 5-(consoleCursorX mod 5)
+ if (consoleCursorX>=consoleWidth) then ConsoleNewLine()
else
- VIRT[(CursorY*consoleWidth+CursorX)*2]=c
- VIRT[(CursorY*consoleWidth+CursorX)*2+1]=(Background* 16 +Foreground)
- CursorX=CursorX+1
+ CONSOLE_MEM[(consoleLineOffset+consoleCursorX)*2]=c
+ CONSOLE_MEM[(consoleLineOffset+consoleCursorX)*2+1]=((consoleBackground* 16) +consoleForeground)
+ consoleCursorX=consoleCursorX+1
end if
- if (CursorX>=consoleWidth) then
- NewLine()
+ if (consoleCursorX>=consoleWidth) then
+ ConsoleNewLine()
end if
+ ConsoleUpdateCursor()
end sub
-sub VirtConsole.PrintOK()
- VIRT[(CursorY*consoleWidth+consoleWidth-7)*2]=91 '['
- VIRT[(CursorY*consoleWidth+consoleWidth-6)*2]=32 ' '
- VIRT[(CursorY*consoleWidth+consoleWidth-5)*2]=79 'O'
- VIRT[(CursorY*consoleWidth+consoleWidth-4)*2]=75 'K'
- VIRT[(CursorY*consoleWidth+consoleWidth-3)*2]=32 ' '
- VIRT[(CursorY*consoleWidth+consoleWidth-2)*2]=93 ']'
- VIRT[(CursorY*consoleWidth+consoleWidth-1)*2]=32 ' '
+sub ConsolePrintOK()
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-7)*2]=91 '['
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-6)*2]=32 ' '
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-5)*2]=79 'O'
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-4)*2]=75 'K'
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-3)*2]=32 ' '
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-2)*2]=93 ']'
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-1)*2]=32 ' '
- VIRT[(CursorY*consoleWidth+consoleWidth-7)*2+1]=(Background* 16 +10)
- VIRT[(CursorY*consoleWidth+consoleWidth-6)*2+1]=(Background* 16 +10)
- VIRT[(CursorY*consoleWidth+consoleWidth-5)*2+1]=(Background* 16 +9)
- VIRT[(CursorY*consoleWidth+consoleWidth-4)*2+1]=(Background* 16 +9)
- VIRT[(CursorY*consoleWidth+consoleWidth-3)*2+1]=(Background* 16 +10)
- VIRT[(CursorY*consoleWidth+consoleWidth-2)*2+1]=(Background* 16 +10)
- VIRT[(CursorY*consoleWidth+consoleWidth-1)*2+1]=(Background* 16 +10)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-7)*2+1]=(consoleBackground* 16 + 9)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-6)*2+1]=(consoleBackground* 16 + consoleForeground)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-5)*2+1]=(consoleBackground* 16 + 10)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-4)*2+1]=(consoleBackground* 16 + 10)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-3)*2+1]=(consoleBackground* 16 + consoleForeground)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-2)*2+1]=(consoleBackground* 16 + 9)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-1)*2+1]=(consoleBackground* 16 + consoleForeground)
end sub
-sub VirtConsole.PrintFAIL()
+sub ConsolePrintFAIL()
- VIRT[(CursorY*consoleWidth+consoleWidth-7)*2]=asc("[")
- VIRT[(CursorY*consoleWidth+consoleWidth-6)*2]=asc("F")
- VIRT[(CursorY*consoleWidth+consoleWidth-5)*2]=asc("A")
- VIRT[(CursorY*consoleWidth+consoleWidth-4)*2]=asc("I")
- VIRT[(CursorY*consoleWidth+consoleWidth-3)*2]=asc("L")
- VIRT[(CursorY*consoleWidth+consoleWidth-2)*2]=asc("]")
- VIRT[(CursorY*consoleWidth+consoleWidth-1)*2]=asc(" ")
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-7)*2]=asc("[")
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-6)*2]=asc("F")
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-5)*2]=asc("A")
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-4)*2]=asc("I")
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-3)*2]=asc("L")
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-2)*2]=asc("]")
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-1)*2]=asc(" ")
- VIRT[(CursorY*consoleWidth+consoleWidth-7)*2+1]=(Background* 16 +Foreground)
- VIRT[(CursorY*consoleWidth+consoleWidth-6)*2+1]=(Background* 16 +12)
- VIRT[(CursorY*consoleWidth+consoleWidth-5)*2+1]=(Background* 16 +12)
- VIRT[(CursorY*consoleWidth+consoleWidth-4)*2+1]=(Background* 16 +12)
- VIRT[(CursorY*consoleWidth+consoleWidth-3)*2+1]=(Background* 16 +12)
- VIRT[(CursorY*consoleWidth+consoleWidth-2)*2+1]=(Background* 16 +Foreground)
- VIRT[(CursorY*consoleWidth+consoleWidth-1)*2+1]=(Background* 16 +Foreground)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-7)*2+1]=(consoleBackground* 16 + 9)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-6)*2+1]=(consoleBackground* 16 + 12)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-5)*2+1]=(consoleBackground* 16 + 12)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-4)*2+1]=(consoleBackground* 16 + 12)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-3)*2+1]=(consoleBackground* 16 + 12)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-2)*2+1]=(consoleBackground* 16 + 9)
+ CONSOLE_MEM[(consoleLineOffset+consoleWidth-1)*2+1]=(consoleBackground* 16 + consoleForeground)
end sub
-sub VirtConsole.BackSpace()
- if (CursorX=0) then
- if (CursorY>0) then
- CursorX=consoleWidth-1
- CursorY-=1
+sub ConsoleBackSpace()
+ if (consoleCursorX=0) then
+ if (consoleCursorY>0) then
+ consoleCursorX=consoleWidth-1
+ consoleCursorY-=1
end if
else
- CursorX-=1
+ consoleCursorX-=1
end if
- VIRT[(CursorY*consoleWidth+CursorX)*2]=0
- VIRT[(CursorY*consoleWidth+CursorX)*2+1]=(Background* 16 +Foreground)
+ consoleLineOffset = consoleCursorY * consoleWidth
+ CONSOLE_MEM[(consoleLineOffset+consoleCursorX)*2]=0
+ CONSOLE_MEM[(consoleLineOffset+consoleCursorX)*2+1]=(consoleBackground* 16 +consoleForeground)
+
+ ConsoleUpdateCursor()
end sub
-sub VirtConsole.WriteLine(src as unsigned byte ptr)
- this.Write(src)
- this.NewLine()
+
+sub ConsoleWriteLine(src as unsigned byte ptr)
+ ConsoleWrite(src)
+ ConsoleNewLine()
+
+ ConsoleUpdateCursor()
end sub
-sub VirtConsole.Write(src as unsigned byte ptr)
+sub ConsoleWrite(src as unsigned byte ptr)
dim cpt as integer
cpt=0
WHILE src[cpt] <> 0
if (src[cpt]=10) then
- NewLine()
+ ConsoleNewLine()
elseif(src[cpt]=9) then
- CursorX=CursorX+5
- if (CursorX>=consoleWidth) then NewLine()
+ consoleCursorX += 5-(consoleCursorX mod 5)
+ if (consoleCursorX>=consoleWidth) then ConsoleNewLine()
elseif(src[cpt]=13) then
else
- VIRT[(CursorY*consoleWidth+CursorX)*2]=src[cpt]
- VIRT[(CursorY*consoleWidth+CursorX)*2+1]=(Background* 16 +Foreground)
- CursorX=CursorX+1
- if (CursorX>=consoleWidth) then NewLine()
+ CONSOLE_MEM[(consoleLineOffset+consoleCursorX)*2]=src[cpt]
+ CONSOLE_MEM[(consoleLineOffset+consoleCursorX)*2+1]=(consoleBackground* 16 +consoleForeground)
+ consoleCursorX=consoleCursorX+1
+ if (consoleCursorX>=consoleWidth) then ConsoleNewLine()
end if
cpt=cpt+1
WEND
end sub
-sub VirtConsole.NewLine()
- CursorX=0
- CursorY=CursorY+1
- if (CursorY>=consoleHeight) then Scroll()
+sub ConsoleNewLine()
+ consoleCursorX=0
+ consoleCursorY=consoleCursorY+1
+ if (consoleCursorY>=consoleHeight) then ConsoleScroll()
+ consoleLineOffset = consoleCursorY*ConsoleWidth
end sub
-sub VirtConsole.Scroll()
- memcpy16(cptr(unsigned short ptr,cuint(VIRT)),cptr(unsigned short ptr,cuint(VIRT)+(consoleWidth*2)),consoleWidth*(consoleHeight-1))
- memset16(cptr(unsigned short ptr,cuint(VIRT)+consoleWidth*(consoleHeight-1)*2),(Background* 16 +Foreground) shl 8,consoleWidth)
+sub ConsoleScroll()
+ memcpy16(cptr(unsigned short ptr,cuint(CONSOLE_MEM)),cptr(unsigned short ptr,cuint(CONSOLE_MEM)+(consoleWidth*2)),consoleWidth*(consoleHeight-1))
+ memset16(cptr(unsigned short ptr,cuint(CONSOLE_MEM)+consoleWidth*(consoleHeight-1)*2),(consoleBackground* 16 +consoleForeground) shl 8,consoleWidth)
- CursorY=CursorY-1
+ consoleCursorY=consoleCursorY-1
+ consoleLineOffset = consoleCursorY*ConsoleWidth
end sub
-sub VirtConsole.Clear()
- memset16(cptr(unsigned short ptr,cuint(VIRT)),(Background* 16 +Foreground) shl 8,consoleWidth*consoleHeight)
- CursorX = 0
- CursorY = 0
+sub ConsoleClear()
+ memset16(cptr(unsigned short ptr,cuint(CONSOLE_MEM)),(consoleBackground* 16 +consoleForeground) shl 8,consoleWidth*consoleHeight)
+ consoleCursorX = 0
+ consoleCursorY = 0
+ consoleLineOffset = consoleCursorY*ConsoleWidth
end sub
sub ConsoleSetForeground(c as byte)
- CurrentConsole->Foreground=c
+ consoleForeground=c
end sub
sub ConsoleSetBackground(c as byte)
- CurrentConsole->Background=c
-end sub