Repurposed samples/wgt41.c to demo printf functionality

This commit is contained in:
Adam Greenwood-Byrne 2021-04-21 11:17:22 +01:00
parent 6be60a6de4
commit ff5746c230
2 changed files with 11 additions and 35 deletions

View file

@ -35,20 +35,11 @@ bin/invaderspr.o: bin/invader.spr
bin/mousespr.o: bin/mouse.spr bin/mousespr.o: bin/mouse.spr
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@ $(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
bin/littlewfn.o: bin/little.wfn
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
bin/mediumwfn.o: bin/medium.wfn
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
bin/systemwfn.o: bin/system.wfn
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
%.o: %.c %.o: %.c
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@ $(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
kernel8.img: boot/boot.o $(OFILES) bin/BCM4345C0.o bin/wgt1pal.o bin/wgt1blk.o bin/wgt2blk.o bin/lettersspr.o bin/spacespr.o bin/invaderspr.o bin/mousespr.o bin/breakspr.o bin/littlewfn.o bin/mediumwfn.o bin/systemwfn.o kernel8.img: boot/boot.o $(OFILES) bin/BCM4345C0.o bin/wgt1pal.o bin/wgt1blk.o bin/wgt2blk.o bin/lettersspr.o bin/spacespr.o bin/invaderspr.o bin/mousespr.o bin/breakspr.o
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot/boot.o $(OFILES) bin/BCM4345C0.o bin/wgt1pal.o bin/wgt1blk.o bin/wgt2blk.o bin/lettersspr.o bin/spacespr.o bin/invaderspr.o bin/mousespr.o bin/breakspr.o bin/littlewfn.o bin/mediumwfn.o bin/systemwfn.o -T boot/link.ld -o kernel8.elf $(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot/boot.o $(OFILES) bin/BCM4345C0.o bin/wgt1pal.o bin/wgt1blk.o bin/wgt2blk.o bin/lettersspr.o bin/spacespr.o bin/invaderspr.o bin/mousespr.o bin/breakspr.o -T boot/link.ld -o kernel8.elf
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img $(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
clean: clean:

View file

@ -59,37 +59,22 @@ void wgt41()
message[11] = '!'; message[11] = '!';
message[12] = '\0'; message[12] = '\0';
wgtfont little;
wgtfont medium;
extern unsigned char _binary_bin_little_wfn_start[];
little = &(_binary_bin_little_wfn_start[0]);
extern unsigned char _binary_bin_medium_wfn_start[];
medium = &(_binary_bin_medium_wfn_start[0]);
wtextcolor (vgapal[15]); wtextcolor (vgapal[15]);
wgtprintf (0, 0, NULL, "%.15s", little);
wgtprintf (0, 8, NULL, "%.15s", medium);
wouttextxy (0, 50, medium, "Nice to see you");
wouttextxy (0, 100, little, "Goodbye cruel world!");
/*
wgtprintf (0, 0, NULL, "%s", message); wgtprintf (0, 0, NULL, "%s", message);
wgtprintf (0, 8, NULL, "String width : %i pixels", wgettextwidth (message, NULL)); wgtprintf (0, 8, NULL, "String width : %i pixels", wgettextwidth (message, NULL));
wgtprintf (0, 16, NULL, "String height: %i pixels", wgettextheight (message, NULL)); wgtprintf (0, 16, NULL, "String height: %i pixels", wgettextheight (message, NULL));
wgtprintf (0, 50, medium, "%s", message); wgtprintf(0, 32, NULL, "The color: %s", "blue");
wgtprintf (0, 66, NULL, "String width : %i pixels", wgettextwidth (message, medium)); wgtprintf(0, 40, NULL, "First number: %d", 12345);
wgtprintf (0, 74, NULL, "String height: %i pixels", wgettextheight (message, medium)); wgtprintf(0, 48, NULL, "Second number: %04d", 25);
wgtprintf(0, 56, NULL, "Third number: %i", 1234);
wgtprintf(0, 64, NULL, "Hexadecimal: %x", 255);
wgtprintf(0, 72, NULL, "Octal: %o", 255);
wgtprintf(0, 80, NULL, "Unsigned value: %u", 150);
wgtprintf(0, 88, NULL, "Just print the percentage sign %%", 10);
wgtprintf (0, 100, little, "%s", message); free(message);
wgtprintf (0, 116, NULL, "String width : %i pixels", wgettextwidth (message, little));
wgtprintf (0, 124, NULL, "String height: %i pixels", wgettextheight (message, little));
*/
getch ();
free (message);
} }
void main() void main()