Annotation of hatari/tests/dbmsg/dbmsg.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Tester for Hatari's implementation of Atari debugger
                      3:  * XBIOS Dbmsg() API
                      4:  * 
                      5:  * Test:
                      6:  *   hatari --bios-intercept --trace xbios dbmsg.tos
                      7:  * 
                      8:  * See:
                      9:  * - http://dev-docs.atariforge.org/files/Atari_Debugger_1-24-1990.pdf
                     10:  * - http://toshyp.atari.org/en/004012.html#Dbmsg
                     11:  */
                     12: #include "stdint.h"
                     13: #include "assert.h"
                     14: #include "tos.h"
                     15: 
                     16: #define DB_APP_CMD    0x0000
                     17: #define DB_COMMAND    0xF100
                     18: #define DB_NULLSTRING 0xF000
                     19: /* len should be: 1-255 */
                     20: #define DB_STRING(len) (DB_NULLSTRING + ((len) & 0xFF))
                     21: 
                     22: static void Dbmsg(int16_t reserved, uint16_t msg_num, uint32_t msg_arg)
                     23: {
                     24:        /* other 'reserved' values than 5 are undefined */
                     25:        xbios(11, reserved, msg_num, msg_arg);
                     26: }
                     27: 
                     28: int main()
                     29: {
                     30:        const char str[] = "Halting STRING";
                     31: 
                     32:        /* Print NULL-terminated string */
                     33:        Dbmsg(5, DB_NULLSTRING, (uint32_t)"Please print NULLSTRING");
                     34: 
                     35:        /* Print give string (which lenght is encoded to msg_num),
                     36:         * and invoking debugger / halt
                     37:         */
                     38:        Dbmsg(5, DB_STRING(sizeof(str)-1), (uint32_t)str);
                     39: 
                     40:        /* Print given value and invoke debugger */
                     41:        Dbmsg(5, DB_APP_CMD, (uint32_t)0xDEADBEEF);
                     42: 
                     43:        /* Give command for debugger to execute.
                     44:         * In Hatari case this is currently same as DB_NULLSTRING.
                     45:         */
                     46:        Dbmsg(5, DB_COMMAND, (uint32_t)"echo 'Debugging message';");
                     47: 
                     48:        return 0;
                     49: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.