Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Compile and assemble with:
- * wcc -0 -d0 -s -wx -zl -zu main.c
- * wlink FILE main.o FORMAT RAW BIN NAME main.com OPTION NODEFAULTLIBS
- */
- #include <stdint.h>
- void main(void);
- extern void start_main(void);
- extern void end_main(void);
- #pragma aux _cstart aborts;
- /* _cstart does any required initialization and calls main */
- void _cstart (void)
- {
- #pragma aux start_main = \
- "cld"
- #pragma aux end_main = \
- "cli" \
- "hlt"
- start_main();
- main();
- end_main();
- }
- void bios_video_int (uint16_t ax, uint16_t bx);
- #pragma aux bios_video_int = \
- "int 0x10" \
- parm [ax] [bx] \
- modify exact [];
- #define WHITE_ON_BLACK 0x07
- void write(uint8_t far *s, uint16_t len)
- {
- int i;
- for (i=0; i<len; i++)
- bios_video_int ((0x0e<<8) | s[i], WHITE_ON_BLACK);
- }
- /* Write a NUL(0) terminated string to the console on page 0 */
- void write_str(uint8_t far *s)
- {
- while (*s)
- bios_video_int ((0x0e<<8) | *s++, WHITE_ON_BLACK);
- }
- uint8_t ch = 0;
- void main(void)
- {
- uint8_t hexchars[] = {'0','1','2','3','4','5','6','7','8','9','A','B',
- 'C','D','E','F'};
- char brownfox[] = "The quick brown fox jumps over the lazy dog";
- uint8_t i = 0;
- ch = hexchars[i];
- write (&ch, 1);
- write (&hexchars, sizeof(hexchars));
- write_str (brownfox);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement