mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-24 15:31:17 +00:00
Tested and debugged library memio
This commit is contained in:
parent
4dbeeb5274
commit
33118c0222
@ -124,8 +124,9 @@ MPUTC: JSR MERRON ;Save Argumebts & Check Memory Pointer
|
|||||||
;Sets: TEMP0 = Memory Pointer
|
;Sets: TEMP0 = Memory Pointer
|
||||||
; TEMP1 = Number of characters read
|
; TEMP1 = Number of characters read
|
||||||
;Affects: N,Z reflect Accumulator
|
;Affects: N,Z reflect Accumulator
|
||||||
;Returns: A,Y = 255 if invalid Memory Pointer
|
;Returns: A = 255 if invalid Memory Pointer
|
||||||
; otherwise length of string read
|
; otherwise length of string read
|
||||||
|
; Y = Last character in string
|
||||||
; X = Zero Page Memory Pointer
|
; X = Zero Page Memory Pointer
|
||||||
MGETS: JSR SETDST ;Set String Address as Destination
|
MGETS: JSR SETDST ;Set String Address as Destination
|
||||||
JSR MERROM ;Save Memory Pointer & Check Memory Pointer
|
JSR MERROM ;Save Memory Pointer & Check Memory Pointer
|
||||||
@ -136,14 +137,13 @@ MGETS: JSR SETDST ;Set String Address as Destination
|
|||||||
STA SRCHI ;to Source Pointer MSB
|
STA SRCHI ;to Source Pointer MSB
|
||||||
MGETSL: LDA (SRCLO),Y ;Get Character from Memory
|
MGETSL: LDA (SRCLO),Y ;Get Character from Memory
|
||||||
BEQ MGETSX ;If Not NUL (End of File)
|
BEQ MGETSX ;If Not NUL (End of File)
|
||||||
CMP #$0A ; If Control Character
|
CMP #32 ; Check for Control Character
|
||||||
BNE MGETSS
|
MGETSS: STA (DSTLO),Y ; Store Character in String
|
||||||
INY ; Increment Past Carriage Return
|
INY ; increment offset and
|
||||||
BNE MGETSX ; Else
|
BCC MGETSX ; If Not Control character
|
||||||
MGETSS: STA (DSTLO),Y ; Store Character in String
|
|
||||||
INY ; increment offset and
|
|
||||||
BPL MGETSL ; loop if less than 128
|
BPL MGETSL ; loop if less than 128
|
||||||
MGETSX: LDA #$00 ;Terminate String
|
MGETSX: TAX ;Copy Final Character to X
|
||||||
|
LDA #$00 ;Terminate String
|
||||||
STA (DSTLO),Y ;
|
STA (DSTLO),Y ;
|
||||||
BEQ MPUTSX ;Update Memory Pointer and Return String Length
|
BEQ MPUTSX ;Update Memory Pointer and Return String Length
|
||||||
|
|
||||||
@ -153,8 +153,9 @@ MGETSX: LDA #$00 ;Terminate String
|
|||||||
;Sets: TEMP0 = Memory Pointer
|
;Sets: TEMP0 = Memory Pointer
|
||||||
; TEMP1 = Number of characters written
|
; TEMP1 = Number of characters written
|
||||||
;Affects: N,Z reflect Accumulator
|
;Affects: N,Z reflect Accumulator
|
||||||
;Returns: A,Y = 255 if invalid Memory Pointer
|
;Returns: A = 255 if invalid Memory Pointer
|
||||||
; otherwise length of string written
|
; otherwise length of string written
|
||||||
|
; Y = Last character in string
|
||||||
; X = Zero Page Memory Pointer
|
; X = Zero Page Memory Pointer
|
||||||
MPUTS: JSR SETSRC ;Set Source Pointer
|
MPUTS: JSR SETSRC ;Set Source Pointer
|
||||||
JSR MERROM ;Save Memory Pointer & Check Memory Pointer
|
JSR MERROM ;Save Memory Pointer & Check Memory Pointer
|
||||||
@ -165,12 +166,15 @@ MPUTS: JSR SETSRC ;Set Source Pointer
|
|||||||
STA DSTHI ;to Source Pointer MSB
|
STA DSTHI ;to Source Pointer MSB
|
||||||
MPUTSL: LDA (SRCLO),Y ;Get Character from Memory
|
MPUTSL: LDA (SRCLO),Y ;Get Character from Memory
|
||||||
BEQ MPUTSX ;If Not End of String
|
BEQ MPUTSX ;If Not End of String
|
||||||
STA (DSTLO),Y ; Store Character in Memory
|
STA (DSTLO),Y ; Store Character in Memory
|
||||||
INY ; increment offset and
|
TAX ; and copy into X Register
|
||||||
BPL MPUTSL ; loop if less than 128
|
INY ; Increment offset and
|
||||||
MPUTSX: LDX TEMP0 ;Retrieve Memory Pointer
|
BPL MPUTSL ; loop if less than 128
|
||||||
STY TEMP1 ;Copy String Length to Accumulator
|
MPUTSX: TXA ;Copy Final Character into Accumulator
|
||||||
MPUTSY: LDA 0,X ;Get to Memory Pointer LSB
|
LDX TEMP0 ;Retrieve Memory Pointer
|
||||||
|
STY TEMP1 ;Save String Length in TEMP1
|
||||||
|
TAY ;Copy Final Character into Y-Register
|
||||||
|
MPUTSY: LDA 0,X ;Get Memory Pointer LSB
|
||||||
CLC
|
CLC
|
||||||
ADC TEMP1 ;Add String Length
|
ADC TEMP1 ;Add String Length
|
||||||
STA 0,X
|
STA 0,X
|
||||||
@ -180,7 +184,7 @@ MGETSZ: LDA TEMP1 ;Load String Length and Set Flags
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
;char mputln(&s) - Write Line to Memory File
|
;char mputln(&s) - Write Line to Memory File
|
||||||
MPUTLN: JSR PUTS ;Write string to screen
|
MPUTLN: JSR MPUTS ;Write String to Memory File
|
||||||
LDA TEMP0 ;Retrieve Memory Pointer
|
LDA TEMP0 ;Retrieve Memory Pointer
|
||||||
LDY #RTNKEY ;Load Carriage Return
|
LDY #RTNKEY ;Load Carriage Return
|
||||||
JMP MPUTC ;Write to Memory File
|
JMP MPUTC ;Write to Memory File
|
||||||
@ -188,9 +192,6 @@ MPUTLN: JSR PUTS ;Write string to screen
|
|||||||
;mdst(&a) - Set Destination Array for mread()
|
;mdst(&a) - Set Destination Array for mread()
|
||||||
MDST EQU SETDST
|
MDST EQU SETDST
|
||||||
|
|
||||||
;msrc(&a) - Set Source Array for mwrite()
|
|
||||||
MSRC EQU SETSRC
|
|
||||||
|
|
||||||
;char mread(mp, n) - Read from Memory File into Array
|
;char mread(mp, n) - Read from Memory File into Array
|
||||||
;Args: A = Zero Page Memory Pointer
|
;Args: A = Zero Page Memory Pointer
|
||||||
; Y = Number of Bytes to Read
|
; Y = Number of Bytes to Read
|
||||||
@ -206,7 +207,7 @@ MREAD: JSR MERRON ;Save Argumebts & Check Memory Pointer
|
|||||||
STA SRCLO ;to Source Pointer LSB
|
STA SRCLO ;to Source Pointer LSB
|
||||||
LDA 1,X ;Copy Memory Pointer MSB
|
LDA 1,X ;Copy Memory Pointer MSB
|
||||||
STA SRCHI ;to Source Pointer MSB
|
STA SRCHI ;to Source Pointer MSB
|
||||||
BNE MWRITC ;Execute Copy
|
BNE MWRITL ;Execute Copy
|
||||||
|
|
||||||
;msrc(&a) - Set Source Array for mwrite()
|
;msrc(&a) - Set Source Array for mwrite()
|
||||||
MSRC EQU SETSRC
|
MSRC EQU SETSRC
|
||||||
@ -226,9 +227,9 @@ MWRITE: JSR MERRON ;Save Argumebts & Check Memory Pointer
|
|||||||
STA DSTLO ;to Destination Pointer LSB
|
STA DSTLO ;to Destination Pointer LSB
|
||||||
LDA 1,X ;Copy Memory Pointer MSB
|
LDA 1,X ;Copy Memory Pointer MSB
|
||||||
STA DSTHI ;to Destination Pointer MSB
|
STA DSTHI ;to Destination Pointer MSB
|
||||||
MWRITC: LDY TEMP1 ;Set Index to Number of Bytes to Read
|
MWRITL: LDA (SRCLO),Y ;Read Byte from Memory
|
||||||
MWRITL: DEY ;Decrement Index
|
|
||||||
BEQ MPUTSY ;If Zero, Update Memory Pointer and Return
|
|
||||||
LDA (SRCLO),Y ;Read Byte from Memory
|
|
||||||
STA (DSTLO),Y ;Write Byte to Array
|
STA (DSTLO),Y ;Write Byte to Array
|
||||||
JMP MWRITL ;and Loop
|
INY ;Increment Index
|
||||||
|
CPY TEMP1 ;If Not Equal to Number of Bytes to Read
|
||||||
|
BNE MWRITL ; Loop
|
||||||
|
BEQ MPUTSY ;Else Update Memory Pointer
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/******************************************
|
/*****************+*************************
|
||||||
* memio - Functions to read/write memory *
|
* memio - Functions to read/write memory *
|
||||||
******************************************/
|
******************************************/
|
||||||
|
|
||||||
/* Return Memory File Pointer Contents *
|
/* Return Memory File Pointer Contents *
|
||||||
* Args: mp - memory file pointer *
|
* Args: mp - memory file pointer *
|
||||||
* Returns: address contained in pointer *
|
* Returns: Tuple *
|
||||||
LSB, MSB as a tuple */
|
memory pointer address LSB *
|
||||||
char mclose();
|
memory pointer address MSB */
|
||||||
|
char maddr();
|
||||||
|
|
||||||
/* Open Memory File *
|
/* Open Memory File *
|
||||||
* Sets starting address to read/write *
|
* Sets starting address to read/write *
|
||||||
@ -66,8 +66,10 @@ char mputc();
|
|||||||
* until C/R or EOF is found *
|
* until C/R or EOF is found *
|
||||||
* Args: mp - memory file pointer *
|
* Args: mp - memory file pointer *
|
||||||
* &s - string read from memory *
|
* &s - string read from memory *
|
||||||
* Returns: length of string *
|
* Returns: Tuple *
|
||||||
* 255 if error during read */
|
* length of string *
|
||||||
|
* (255 if error during read) *
|
||||||
|
* last character read */
|
||||||
char mgets();
|
char mgets();
|
||||||
|
|
||||||
/* Write String to Memory File *
|
/* Write String to Memory File *
|
||||||
@ -102,7 +104,6 @@ char mread();
|
|||||||
* Args: &a - Source array */
|
* Args: &a - Source array */
|
||||||
void msrc();
|
void msrc();
|
||||||
|
|
||||||
|
|
||||||
/* Write Bytes to Memory File *
|
/* Write Bytes to Memory File *
|
||||||
* Args: mp - memory file pointer *
|
* Args: mp - memory file pointer *
|
||||||
* n - number of bytes to write *
|
* n - number of bytes to write *
|
||||||
|
122
py65/testmem.c02
122
py65/testmem.c02
@ -1,122 +1,8 @@
|
|||||||
/*******************************************
|
/****************************************
|
||||||
* TESTMEM - Test Array Handling Functions *
|
* TESTMIO - Test Memory File Functions *
|
||||||
*******************************************/
|
****************************************/
|
||||||
|
|
||||||
#include <py65.h02>
|
#include <py65.h02>
|
||||||
#include <stdio.h02>
|
#include <stdio.h02>
|
||||||
#include <memory.h02>
|
#include <mio.h02>
|
||||||
|
|
||||||
char TRUE = $FF, FALSE = 0;
|
|
||||||
char c, d, f, i, n, p;
|
|
||||||
char rlen, rcmp, rpos;
|
|
||||||
char byts[255];
|
|
||||||
char lttr[255];
|
|
||||||
char nmbr[255];
|
|
||||||
char temp[255];
|
|
||||||
char dest[255];
|
|
||||||
char less = "less";
|
|
||||||
char more = "more";
|
|
||||||
char most = "most";
|
|
||||||
char fail = " Fail ";
|
|
||||||
char pass = " Pass ";
|
|
||||||
|
|
||||||
void prtemp() {
|
|
||||||
puts("temp: ");
|
|
||||||
for (i=0; i<255; i++) {
|
|
||||||
prbyte(temp[i]);
|
|
||||||
//putchr(' ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main:
|
|
||||||
|
|
||||||
//Populate arrays
|
|
||||||
i = 0; c = 'a'; d = '0';
|
|
||||||
do {
|
|
||||||
byts[i] = i;
|
|
||||||
lttr[i] = c;
|
|
||||||
c++; if (c>'z') c = 'a';
|
|
||||||
nmbr[i] = d;
|
|
||||||
d++; if (d>'9') d = '0';
|
|
||||||
i++;
|
|
||||||
} while (i>0);
|
|
||||||
|
|
||||||
//Test memchr()
|
|
||||||
putln("memdst(&byts);"); memdst(&byts);
|
|
||||||
puts("memchr(i, 255);");
|
|
||||||
p = TRUE;
|
|
||||||
for (i=0; i<255; i++) {
|
|
||||||
//prbyte(i); prchr('='); prbyte(byts[i]); prchr(',');
|
|
||||||
c = memchr(i,255);
|
|
||||||
//prbyte(c); prchr(' '); prchr(' ');
|
|
||||||
if (c <> i) p = FALSE;
|
|
||||||
}
|
|
||||||
if (p) putln(&pass); else putln(&fail);
|
|
||||||
newlin();
|
|
||||||
|
|
||||||
//Test memcmp()
|
|
||||||
puts("less="); puts(&less);
|
|
||||||
puts(" more="); puts(&more);
|
|
||||||
puts(" most="); putln(&most);
|
|
||||||
|
|
||||||
putln("memdst(&more);");
|
|
||||||
memdst(&more);
|
|
||||||
|
|
||||||
puts("memcmp(2, &most):");
|
|
||||||
rcmp = memcmp(2, &most);
|
|
||||||
if (!rcmp) puts(&pass); else puts(&fail);
|
|
||||||
|
|
||||||
puts("memcmp(4, &most):");
|
|
||||||
rcmp = memcmp(4, &most);
|
|
||||||
if (rcmp :-) putln(&pass); else putln(&fail);
|
|
||||||
|
|
||||||
puts("memcmp(3, &more):");
|
|
||||||
rcmp = memcmp(3, &more);
|
|
||||||
if (!rcmp) puts(&pass); else puts(&fail);
|
|
||||||
|
|
||||||
puts("memcmp(3, &less):");
|
|
||||||
rcmp = memcmp(3, &less);
|
|
||||||
if (rcmp > 0) putln(&pass); else putln(&fail);
|
|
||||||
newlin();
|
|
||||||
|
|
||||||
//Test memset() and memcpy()
|
|
||||||
putln("memdst(&temp);");
|
|
||||||
memdst(&temp);
|
|
||||||
|
|
||||||
puts("memset(0,20); ");
|
|
||||||
memset(0,20);
|
|
||||||
|
|
||||||
puts("temp=");
|
|
||||||
putln(&temp);
|
|
||||||
|
|
||||||
puts("memset('@',20); ");
|
|
||||||
memset('@',20);
|
|
||||||
|
|
||||||
puts("temp=");
|
|
||||||
putln(&temp);
|
|
||||||
|
|
||||||
puts("memcpy(10, <tr); ");
|
|
||||||
memcpy(10, <tr);
|
|
||||||
|
|
||||||
puts("temp=");
|
|
||||||
putln(&temp);
|
|
||||||
|
|
||||||
puts("memcmp(10, <tr);");
|
|
||||||
rcmp = memcmp(10, <tr);
|
|
||||||
if (!rcmp) putln(&pass); else putln(&fail);
|
|
||||||
|
|
||||||
puts("memcmp(11, <tr);");
|
|
||||||
rcmp = memcmp(11, <tr);
|
|
||||||
if (rcmp > 0) putln(&pass); else putln(&fail);
|
|
||||||
newlin();
|
|
||||||
|
|
||||||
memdst(&temp); memcpy("ABCDEF");
|
|
||||||
memdst(&dest); memcpy("123456");
|
|
||||||
puts("memdst(&dest);memswp(3,&temp);");
|
|
||||||
memswp(3,&temp);
|
|
||||||
rcmp = memcmp(6,"ABC456");
|
|
||||||
memdst(&temp); rcmp = memcmp(6,"123DEF") | rcmp;
|
|
||||||
if (rcmp) putln(&fail); else putln(&pass);
|
|
||||||
goto exit;
|
|
||||||
|
|
||||||
|
|
||||||
|
146
py65/testmio.c02
146
py65/testmio.c02
@ -6,12 +6,22 @@
|
|||||||
#include <stdlib.h02>
|
#include <stdlib.h02>
|
||||||
#include <stdio.h02>
|
#include <stdio.h02>
|
||||||
#include <stdiox.h02>
|
#include <stdiox.h02>
|
||||||
|
#include <memory.h02>
|
||||||
#include <memio.h02>
|
#include <memio.h02>
|
||||||
|
#include <string.h02>
|
||||||
|
|
||||||
char zp = $80; //Zero Page Location for Memory Pointer
|
char zp = $80; //Zero Page Location for Memory Pointer
|
||||||
char lsb, msb; //Memory Pointer Contents
|
char lsb, msb; //Memory Pointer Contents
|
||||||
char passed; //Flags
|
char passed; //Flags
|
||||||
char c, e, i, mp, s[128];
|
char f[255]; //Array to use as file
|
||||||
|
char fp,mp,op; //Memory File Pointers
|
||||||
|
char c, e, i; //Testing Variables
|
||||||
|
char s[128]; //Array for String Read/Writes
|
||||||
|
char digits = "0123456789";
|
||||||
|
char upcase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
char locase = "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
|
alias char outfil = $9000; //Output File
|
||||||
|
|
||||||
main:
|
main:
|
||||||
|
|
||||||
@ -37,20 +47,136 @@ e = merror(mp);
|
|||||||
prbyte(e);
|
prbyte(e);
|
||||||
if (e) { puts(" Yes"); fail(); }
|
if (e) { puts(" Yes"); fail(); }
|
||||||
else { puts(" No "); pass(); }
|
else { puts(" No "); pass(); }
|
||||||
|
|
||||||
newlin();
|
newlin();
|
||||||
|
|
||||||
putln("Reading File using mgetc()");
|
putln("Reading File using mgetc()");
|
||||||
do {
|
while (!meof(mp)) {
|
||||||
lsb, msb = maddr(mp);
|
|
||||||
c = mgetc(mp);
|
c = mgetc(mp);
|
||||||
e = meof(mp);
|
if (c < 32 ) c = 32;
|
||||||
prbyte(msb); prbyte(lsb); puts(": ");
|
putc(c);
|
||||||
prbyte(c); putc(' ');
|
}
|
||||||
if (c>' ') putc(c); else putc(' ');
|
newlin();
|
||||||
puts(" EOF: "); prbyte(e); newlin();
|
|
||||||
} while (!e);
|
anykey();
|
||||||
|
|
||||||
|
putln("Reading File using mgets()");
|
||||||
|
mp = mopen(zp, &$8000);
|
||||||
|
while (!meof(mp)) {
|
||||||
|
lsb, msb = maddr(mp);
|
||||||
|
prbyte(msb); prbyte(lsb);
|
||||||
|
i, c = mgets(mp, &s);
|
||||||
|
printf(i, " %r");
|
||||||
|
printf(c, " %h: ");
|
||||||
|
puts(&s);
|
||||||
|
if (c <> $0A) newlin();
|
||||||
|
}
|
||||||
|
|
||||||
|
anykey();
|
||||||
|
|
||||||
|
/* Test mputc() with mopen() to array */
|
||||||
|
|
||||||
|
putln("Opening array f as memory file");
|
||||||
|
fp = mopen(zp+2, &f);
|
||||||
|
puts(" Memory pointer: "); prbyte(fp);
|
||||||
|
if (merror(fp)) fail(); else pass();
|
||||||
|
|
||||||
|
putln("Writing file using mgetc()");
|
||||||
|
for (i=32; i<127; i++) {putc(i); mputc(fp,i);}
|
||||||
|
newlin(); mputc(fp, 13); //Carriage Return
|
||||||
|
|
||||||
|
putln("Checking Array Contents");
|
||||||
|
passed = 1;
|
||||||
|
for (i=0; i<95; i++) {c = f[i]; putc(c); if (i+32<>c) passed = 0;}
|
||||||
|
newlin(); //if (f[95]<>13) passed = 0;
|
||||||
|
if (passed) pass(); else fail();
|
||||||
|
|
||||||
|
anykey();
|
||||||
|
|
||||||
|
/* Test mputs(), mputln(), and mclose() with mopen() to alias */
|
||||||
|
|
||||||
|
putln("Filling memory area outfil");
|
||||||
|
for (i = 0; i<255; i++) outfil[i] = '@';
|
||||||
|
|
||||||
|
putln("Opening location outfil as memory file");
|
||||||
|
op = mopen(zp+4, &outfil);
|
||||||
|
puts(" Memory pointer: "); prbyte(op);
|
||||||
|
if (merror(op)) fail(); else pass();
|
||||||
|
|
||||||
|
puts("Writing upcase to file using mputln():");
|
||||||
|
mputln(op, &upcase);
|
||||||
|
if (merror(op)) fail(); else pass();
|
||||||
|
|
||||||
|
puts("Writing locase to file using mputln():");
|
||||||
|
mputln(op, &locase);
|
||||||
|
if (merror(op)) fail(); else pass();
|
||||||
|
|
||||||
|
puts("Writing digits to file using mputs():");
|
||||||
|
mputs(op, &digits);
|
||||||
|
if (merror(op)) fail(); else pass();
|
||||||
|
|
||||||
|
puts("Flushing file:");
|
||||||
|
if (mflush(op)) fail(); else pass();
|
||||||
|
|
||||||
|
anykey();
|
||||||
|
|
||||||
|
/* Test mgetc(), and mgets() with mopen() to alias */
|
||||||
|
|
||||||
|
putln("Opening location outfil as memory file");
|
||||||
|
op = mopen(zp+4, &outfil);
|
||||||
|
puts(" Memory pointer: "); prbyte(op);
|
||||||
|
if (merror(op)) fail(); else pass();
|
||||||
|
|
||||||
|
puts("Reading from file using mgetc(): ");
|
||||||
|
i=0; while () {c=mgetc(op);s[i]=c;if (c<' ') break; i++;} s[i]=0;
|
||||||
|
puts(&s); strdst(&upcase); if (strcmp(&s)) fail(); else pass();
|
||||||
|
|
||||||
|
puts("Reading from file using mgets(): ");
|
||||||
|
i,c = mgets(op, &s); putln(&s);
|
||||||
|
printf(i, " Characters read: %d"); if (strlen(&locase)+1 == i) pass(); else fail();
|
||||||
|
printf(c, " Last char read: %h"); if (c == 13) pass(); else fail();
|
||||||
|
|
||||||
|
puts("Reading from file using mgets(): ");
|
||||||
|
i,c = mgets(op, &s); putln(&s);
|
||||||
|
printf(i, " Characters read: %d"); if (strlen(&digits) == i) pass(); else fail();
|
||||||
|
printf(c, " Last char read: %h"); if (c) fail(); else pass();
|
||||||
|
|
||||||
|
puts("Checking for End of File: ");
|
||||||
|
e = meof(op); putdec(e); if (e) pass(); else fail();
|
||||||
|
|
||||||
|
puts("Closing File:");
|
||||||
|
mclose(op); if (merror(op)) pass(); else fail();
|
||||||
|
|
||||||
|
anykey();
|
||||||
|
|
||||||
|
putln("Clearing memory at $9000.");
|
||||||
|
memdst(&$9000);
|
||||||
|
memset(0, 255);
|
||||||
|
|
||||||
|
mp = 0; //Initialize Memory Pointer
|
||||||
|
|
||||||
|
putln("Opening memory file at $9000.");
|
||||||
|
mp = mopen(zp, &$9000);
|
||||||
|
|
||||||
|
putln("Writing to memory file using mwrite()");
|
||||||
|
msrc(&digits); mwrite(mp, 10);
|
||||||
|
msrc(&upcase); mwrite(mp, 26);
|
||||||
|
msrc(&locase); mwrite(mp, 26);
|
||||||
|
newlin();
|
||||||
|
|
||||||
|
putln("Opening memory file at $9000.");
|
||||||
|
mp = mopen(zp, &$9000);
|
||||||
|
|
||||||
|
putln("Reading from memory file using mread()");
|
||||||
|
iarray(&s); mread(mp, 10); puts(&s); putc(':'); if (strcmp(&digits)) pass(); else fail();
|
||||||
|
iarray(&s); mread(mp, 26); puts(&s); putc(':'); if (strcmp(&upcase)) pass(); else fail();
|
||||||
|
iarray(&s); mread(mp, 26); puts(&s); putc(':'); if (strcmp(&locase)) pass(); else fail();
|
||||||
|
mread(mp,0); putdec(s); putc(':'); if (s) fail(); else pass();
|
||||||
|
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
void anykey() {newlin(); putln("Press any key..."); getc(); newlin();}
|
||||||
|
|
||||||
void pass() { putln(" Passed"); }
|
void pass() { putln(" Passed"); }
|
||||||
void fail() { putln(" Failed"); }
|
void fail() { putln(" Failed"); }
|
||||||
|
|
||||||
|
void iarray() { memdst(); memset(0, 255); }
|
||||||
|
Loading…
Reference in New Issue
Block a user