;---------------------------------------------------------------- ; EX6A.ASM ; Writing a string to a port. ; ASM Code for the DECE Microprocessor. ; C.P. Diduch, 2001. ;---------------------------------------------------------------- .EQU OPORT 0x0002 ; #define OPORT 0x0002 .EQU K R1 ; #define K R1 .EQU SENTINEL 0x0000 ; #define SENTINEL R1 .EQU TMP R0 ; #define TMP R0 ; ; ; void main() { .ORG 0x8020 ; DATA: .DW 'A string', SENTINEL ; unsigned DATA[] = 'A string', SENTINEL ; .ORG 0x8000 ; ADDL K, NULL, 0 ; K = 0; M0: DLOADM TMP, DATA(K) ; while (DATA[K] != SENTINEL) { SUBL NULL, TMP, SENTINEL ; JMPZ M1 ; DLOADM TMP, DATA(K) ; outportb(OPORT, DATA[K]); STOREP OPORT, TMP ; ADDL K, K, 1 ; K = K + 1; JMP M0 ; } M1: JMP M1 ; } // Graceful termination.