@@ -226,7 +226,7 @@ static inline uint16_t rgb565(uint8_t r, uint8_t g, uint8_t b) {
226226
227227typedef unsigned int addr_t ; // 32-bit
228228
229- static inline void fillSpan16 (volatile uint16_t *dst, int count, uint16_t color)
229+ void fillSpan16 (volatile uint16_t *dst, int count, uint16_t color)
230230{
231231 __asm__ __volatile__ (
232232 " cld\n\t "
@@ -257,13 +257,41 @@ void fillRect16_fast(int x, int y, int w, int h, uint16_t color565)
257257 row8 += lfb_pitch; // pitch ist BYTES!
258258 }
259259}
260+
261+ typedef struct {
262+ int w, h;
263+ uint32_t pitch; // bytes per row
264+ uint16_t * pixels; // RGB565
265+ } sprite565_t2;
266+
267+ void check_iso_mount ()
268+ {
269+ if (check_atapi () == 0 ) {
270+ // ATAPI (IDE) gefunden
271+ printformat (" ATAPI: OK.\n " );
272+ fillRect16_fast (100 ,10 ,130 ,130 ,rgb565 (250 ,255 ,0 ));
273+ } else {
274+ printformat (" ATAPI: NOK\n " );
275+ check_ahci ();
276+ }
277+ /*
278+ if (iso_mount() != 0) {
279+ //printformat("ISO mount Error.\n");
280+
281+ } else {
282+
283+ //printformat("ISO mount successfully.\n");
284+ }*/
285+ }
260286extern " C" int ami_main ()
261287{
288+ graph_mode = 4 ;
289+
262290 idt_init ();
263291
264292 paging_init ();
265293 kheap_init ();
266-
294+
267295 // detect_memory(); // setzt max_mem
268296
269297 uint32_t stack_top = kernel_stack_top;
@@ -272,42 +300,42 @@ extern "C" int ami_main()
272300 uint32_t reserved = ((uint32_t )&__end + 0xFFF ) & ~0xFFF ;
273301 if (reserved < kernel_stack_top) reserved = kernel_stack_top; // Stack schützen
274302 page_init (reserved);
275-
303+
276304 // 3) aktuellen Stack als esp0 für TSS verwenden
277305 uint32_t esp;
278- __asm__ volatile (" mov %%esp, %0" : " =r" (esp));
306+ // __asm__ volatile("mov %%esp, %0" : "=r"(esp));
279307 gdt_init ();
280-
281308 isr_init ();
282309 irq_init ();
283-
310+
284311 syscall_init ();
285312 tasking_init ();
286313
287- const vbe_info_t * mi = ((const vbe_info_t *)0x00002000 );
288-
289- lfb_base = mi->phys_base ;
290- lfb_pitch = mi->pitch ;
291- lfb_bpp = mi->bpp ;
292-
293- lfb_xres = mi->xres ;
294- lfb_yres = mi->yres ;
314+ // ------------------------------
315+ // vesa 0x114: 800 x 600 x 16bpp
316+ // ------------------------------
317+ gfx_init ();
295318
296- size_t fb_bytes = (size_t )lfb_pitch * (size_t )lfb_yres;
297-
298- // WICHTIG: phys -> virt mappen
299- uintptr_t lfb_virt = (uintptr_t )mmio_map (lfb_base, (uint32_t )fb_bytes);
300-
301- // Ab jetzt IMMER die virtuelle Adresse zum Schreiben benutzen!
302- lfb_base = (uint32_t )lfb_virt;
319+ // ------------------------------
320+ // global c++ constructor's init.
321+ // ------------------------------
322+ call_global_ctors ();
323+ check_iso_mount ();
303324
325+ __asm__ volatile (" sti" );
326+ enter_usermode ();
304327
305- fillRect16_fast (0 ,0 ,lfb_xres,lfb_yres,rgb565 (255 ,255 ,255 ));
306- for (;;);
328+ // Hierher kommt man normalerweise nicht mehr zurück
329+ for (;;) {
330+ asm volatile (" hlt" );
331+ }
332+ return 0 ;
307333}
334+
308335// c64 kernel
309336extern " C" int c64_main ()
310337{
338+ graph_mode = 3 ;
311339 idt_init ();
312340
313341 paging_init ();
@@ -401,6 +429,8 @@ extern "C" int txt_main()
401429
402430 settextcolor (14 ,0 );
403431
432+ check_iso_mount ();
433+ /*
404434 if (check_atapi() == 0) {
405435 // ATAPI (IDE) gefunden
406436 printformat("ATAPI: OK.\n");
@@ -413,7 +443,7 @@ extern "C" int txt_main()
413443 printformat("ISO mount Error.\n");
414444 } else {
415445 printformat("ISO mount successfully.\n");
416- }
446+ }*/
417447
418448 __asm__ volatile (" sti" );
419449
@@ -492,6 +522,8 @@ extern "C" int vid_main()
492522
493523 settextcolor (14 ,0 );
494524
525+ check_iso_mount ();
526+ /*
495527 if (check_atapi() == 0) {
496528 // ATAPI (IDE) gefunden
497529 gfx_printf("ATAPI: OK.\n");
@@ -504,7 +536,7 @@ extern "C" int vid_main()
504536 gfx_printf("ISO mount Error.\n");
505537 } else {
506538 gfx_printf("ISO mount successfully.\n");
507- }
539+ }*/
508540
509541 __asm__ volatile (" sti" );
510542
0 commit comments