flagtest.pwp


// PicoWeb Project File

#define BANNER "\r\nTest PicoWeb Application\r\n"
#define EEPROM_IP                /* use file "ip" for IP address */
#define ENABLE_WATCHDOG
//#define DEBUGGER

// HTML and images

// CGI routines
cgi00.cgi             // iu00

// Assembly language
//cgi.asm

//------------------ included AVR assembly language follows ---------------
#avr_asm

.eseg
;
#define CGI_BEGIN(X) X##:
#define CGI_END(X) X##_end:
#define putchar_serial .dw pmovbi,putc_b,0
#define putchar_net    .dw pmovbi,putc_b,1
#define serial_binary  .dw pser_mode,1
#define serial_normal  .dw pser_mode,0
#define showword(x)    .dw pprintv|XX,0,WORD(x)
#define BAUD           (UBRR+0x20)  /* mem addr of baud rate divisor */
#define B2400           207
#define B4800           103
#define B9600           51
#define B19200          25
#define SERTEST_BAUD    B9600
#define SER_TMO         800


CGI_BEGIN(
    cgi00
)
#define T1 buf+8
#define T2 T1+2
#define T3 T2+2
;
; arithmetic tester.
;
    pjump foo
foo:
txt_hdr:    .string "HTTP/1.0 200\nContent-type: text/html\n\n"

    pprint txt_hdr
    pmovbi putcok,1
    pcrlf
#include "flagtest.tmp"

    pret

show_flags:
    pmovb T1,pcode_sreg             ; get pcode copy of sreg
    pmovb T3,T1                     ; save it
    pprintv "\r\n\t\t\tbuf=",[buf]
    pputc ' '
    pputc 'C'
    pcall show_bit
    pputc 'Z'
    pcall show_bit
    pputc 'N'
    pcall show_bit
    pcrlf
    pmovb pcode_sreg,T3             ; restore flags
    pret
show_bit:
    pputc '='
    pmovwi T2,[T1]
    pandwi T2,1
    paddwi T2,'0'
    pputc [T2]
    pshnw T1,-1
    pputc ' '
    pret
.eseg
CGI_END(cgi00)

Back