Minor changes to the asm syntax
This commit is contained in:
parent
cda02143cd
commit
8574d62a61
|
@ -42,12 +42,12 @@ evaluxn(u, u->vframe); /* Each frame
|
||||||
- `( comment )`, toggle parsing on/off.
|
- `( comment )`, toggle parsing on/off.
|
||||||
- `|0010`, move to position in the program.
|
- `|0010`, move to position in the program.
|
||||||
- `"hello`, push literal bytes for word "hello".
|
- `"hello`, push literal bytes for word "hello".
|
||||||
- `#04`, a zero-page address, equivalent to `,0004`.
|
|
||||||
|
|
||||||
### Operator modes
|
### Operator modes
|
||||||
|
|
||||||
- `,1234 ,0001 ADD^`, 16-bits operators have the short flag `^`.
|
- `,1234 ,0001 ADD2`, 16-bits operators have the short flag `2`.
|
||||||
- `,12 ,11 GTH JMP?`, conditional operators have the cond flag `?`.
|
- `,12 ,11 GTH JMP?`, conditional operators have the cond flag `?`.
|
||||||
|
- `+21 -03 MULS`, signed operators have the cond flag `S`.
|
||||||
|
|
||||||
```
|
```
|
||||||
( hello world )
|
( hello world )
|
||||||
|
|
|
@ -101,8 +101,8 @@ findoperator(char *s)
|
||||||
if(o[0] != s[0] || o[1] != s[1] || o[2] != s[2])
|
if(o[0] != s[0] || o[1] != s[1] || o[2] != s[2])
|
||||||
continue;
|
continue;
|
||||||
while(s[3 + m]) {
|
while(s[3 + m]) {
|
||||||
if(s[3 + m] == '^') i |= (1 << 5); /* mode: 16 bits */
|
if(s[3 + m] == '2') i |= (1 << 5); /* mode: short */
|
||||||
if(s[3 + m] == '!') i |= (1 << 6); /* mode: signed */
|
if(s[3 + m] == 'S') i |= (1 << 6); /* mode: signed */
|
||||||
if(s[3 + m] == '?') i |= (1 << 7); /* mode: conditional */
|
if(s[3 + m] == '?') i |= (1 << 7); /* mode: conditional */
|
||||||
m++;
|
m++;
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,8 @@ makelabel(char *name, Uint16 addr)
|
||||||
return error("Label duplicate", name);
|
return error("Label duplicate", name);
|
||||||
if(sihx(name))
|
if(sihx(name))
|
||||||
return error("Label name is hex number", name);
|
return error("Label name is hex number", name);
|
||||||
|
if(findoperator(name))
|
||||||
|
return error("Label name is invalid", name);
|
||||||
l = &labels[labelslen++];
|
l = &labels[labelslen++];
|
||||||
l->addr = addr;
|
l->addr = addr;
|
||||||
scpy(name, l->name, 64);
|
scpy(name, l->name, 64);
|
||||||
|
@ -178,7 +180,6 @@ pass1(FILE *f)
|
||||||
switch(w[0]) {
|
switch(w[0]) {
|
||||||
case '|': addr = shex(w + 1); break;
|
case '|': addr = shex(w + 1); break;
|
||||||
case '"': addr += slen(w + 1) + 2; break;
|
case '"': addr += slen(w + 1) + 2; break;
|
||||||
case '#': addr += 4; break;
|
|
||||||
case '.': addr += 2; break;
|
case '.': addr += 2; break;
|
||||||
case '+': /* signed positive */
|
case '+': /* signed positive */
|
||||||
case '-': /* signed negative */
|
case '-': /* signed negative */
|
||||||
|
@ -213,7 +214,6 @@ pass2(FILE *f)
|
||||||
else if(w[0] == '-' && sihx(w + 1) && slen(w + 1) == 2) pushbyte((Sint8)(shex(w + 1) * -1), 1);
|
else if(w[0] == '-' && sihx(w + 1) && slen(w + 1) == 2) pushbyte((Sint8)(shex(w + 1) * -1), 1);
|
||||||
else if(w[0] == '-' && sihx(w + 1) && slen(w + 1) == 4) pushshort((Sint16)(shex(w + 1) * -1), 1);
|
else if(w[0] == '-' && sihx(w + 1) && slen(w + 1) == 4) pushshort((Sint16)(shex(w + 1) * -1), 1);
|
||||||
else if(w[0] == '"') pushtext(w + 1);
|
else if(w[0] == '"') pushtext(w + 1);
|
||||||
else if(w[0] == '#') pushshort(shex(w + 1) & 0xff, 1);
|
|
||||||
else if((l = findlabel(w + 1))) pushshort(l->addr, w[0] == ',');
|
else if((l = findlabel(w + 1))) pushshort(l->addr, w[0] == ',');
|
||||||
else if((op = findoperator(w)) || scmp(w, "BRK")) pushbyte(op, 0);
|
else if((op = findoperator(w)) || scmp(w, "BRK")) pushbyte(op, 0);
|
||||||
else if(sihx(w + 1) && slen(w + 1) == 2) pushbyte(shex(w + 1), w[0] == ',');
|
else if(sihx(w + 1) && slen(w + 1) == 2) pushbyte(shex(w + 1), w[0] == ',');
|
||||||
|
|
|
@ -13,25 +13,25 @@
|
||||||
,12 ,13 LTH #07 STR
|
,12 ,13 LTH #07 STR
|
||||||
|
|
||||||
( arithmetic 16-bit )
|
( arithmetic 16-bit )
|
||||||
,1234 ,2345 ADD^ ,3579 EQU^ #08 STR
|
,1234 ,2345 ADD2 ,3579 EQU2 #08 STR
|
||||||
,1234 ,0123 SUB^ ,1111 EQU^ #09 STR
|
,1234 ,0123 SUB2 ,1111 EQU2 #09 STR
|
||||||
,1234 ,0102 MUL^ ,5868 EQU^ #0a STR
|
,1234 ,0102 MUL2 ,5868 EQU2 #0a STR
|
||||||
,5678 ,0100 DIV^ ,0056 EQU^ #0b STR
|
,5678 ,0100 DIV2 ,0056 EQU2 #0b STR
|
||||||
,1234 ,1234 EQU^ #0c STR
|
,1234 ,1234 EQU2 #0c STR
|
||||||
,1234 ,0123 NEQ^ #0d STR
|
,1234 ,0123 NEQ2 #0d STR
|
||||||
,1234 ,1233 GTH^ #0e STR
|
,1234 ,1233 GTH2 #0e STR
|
||||||
,1234 ,1235 LTH^ #0f STR
|
,1234 ,1235 LTH2 #0f STR
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@diff8 ( result of abs sub )
|
@diff8 ( result of abs sub )
|
||||||
OVR OVR GTH ,diff8sub ROT JMP? POP^
|
OVR OVR GTH ,diff8sub ROT JMP? POP2
|
||||||
SWP @diff8sub SUB
|
SWP @diff8sub SUB
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@diff16 ( result of abs sub16 )
|
@diff16 ( result of abs sub16 )
|
||||||
OVR^ OVR^ GTH^ ,diff16sub ROT JMP? POP^
|
OVR2 OVR2 GTH2 ,diff16sub ROT JMP? POP2
|
||||||
SWP^ @diff16sub SUB^
|
SWP2 @diff16sub SUB2
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|c000 @FRAME BRK
|
|c000 @FRAME BRK
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|0100 @RESET
|
|0100 @RESET
|
||||||
|
|
||||||
,06 ,05 GTH ,there ROT JMP? POP^
|
,06 ,05 GTH ,there ROT JMP? POP2
|
||||||
|
|
||||||
@here ( when lesser or equal )
|
@here ( when lesser or equal )
|
||||||
,ee
|
,ee
|
||||||
|
|
|
@ -42,18 +42,18 @@
|
||||||
|
|
||||||
( positive )
|
( positive )
|
||||||
,01 ,color STR
|
,01 ,color STR
|
||||||
+0030 ,x0 STR^ +0040 ,y0 STR^
|
+0030 ,x0 STR2 +0040 ,y0 STR2
|
||||||
+0100 ,x1 STR^ +0060 ,y1 STR^
|
+0100 ,x1 STR2 +0060 ,y1 STR2
|
||||||
,line JSR
|
,line JSR
|
||||||
|
|
||||||
,02 ,color STR
|
,02 ,color STR
|
||||||
+0020 ,x0 STR^ +0010 ,y0 STR^
|
+0020 ,x0 STR2 +0010 ,y0 STR2
|
||||||
+0090 ,x1 STR^ +0070 ,y1 STR^
|
+0090 ,x1 STR2 +0070 ,y1 STR2
|
||||||
,line JSR
|
,line JSR
|
||||||
|
|
||||||
,03 ,color STR
|
,03 ,color STR
|
||||||
+0010 ,x0 STR^ +0040 ,y0 STR^
|
+0010 ,x0 STR2 +0040 ,y0 STR2
|
||||||
+0070 ,x1 STR^ +0060 ,y1 STR^
|
+0070 ,x1 STR2 +0060 ,y1 STR2
|
||||||
,line JSR
|
,line JSR
|
||||||
|
|
||||||
,redraw JSR
|
,redraw JSR
|
||||||
|
@ -61,68 +61,68 @@
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@fillrect
|
@fillrect
|
||||||
,h STR^ ,w STR^ ,y STR^ ,x STR^
|
,h STR2 ,w STR2 ,y STR2 ,x STR2
|
||||||
,x LDR^ ,x_ STR^ ,y LDR^ ,y_ STR^
|
,x LDR2 ,x_ STR2 ,y LDR2 ,y_ STR2
|
||||||
@fillrectrow
|
@fillrectrow
|
||||||
,x LDR^ ,x_ STR^
|
,x LDR2 ,x_ STR2
|
||||||
@fillrectcol
|
@fillrectcol
|
||||||
( draw ) ,x_ LDR^ ,y_ LDR^ ,putpixel JSR
|
( draw ) ,x_ LDR2 ,y_ LDR2 ,putpixel JSR
|
||||||
,x_ LDR^ ,0001 ADD^ ,x_ STR^
|
,x_ LDR2 ,0001 ADD2 ,x_ STR2
|
||||||
,x_ LDR^ ,w LDR^ ,x LDR^ ADD^ LTH^ ,fillrectcol ROT JMP? POP^
|
,x_ LDR2 ,w LDR2 ,x LDR2 ADD2 LTH2 ,fillrectcol ROT JMP? POP2
|
||||||
,y_ LDR^ ,0001 ADD^ ,y_ STR^
|
,y_ LDR2 ,0001 ADD2 ,y_ STR2
|
||||||
,y_ LDR^ ,h LDR^ ,y LDR^ ADD^ LTH^ ,fillrectrow ROT JMP? POP^
|
,y_ LDR2 ,h LDR2 ,y LDR2 ADD2 LTH2 ,fillrectrow ROT JMP? POP2
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@linerect
|
@linerect
|
||||||
,h STR^ ,w STR^ ,y STR^ ,x STR^
|
,h STR2 ,w STR2 ,y STR2 ,x STR2
|
||||||
,x LDR^ ,x_ STR^ ,y LDR^ ,y_ STR^
|
,x LDR2 ,x_ STR2 ,y LDR2 ,y_ STR2
|
||||||
@linerectcol
|
@linerectcol
|
||||||
( draw ) ,x LDR^ ,y_ LDR^ ,putpixel JSR
|
( draw ) ,x LDR2 ,y_ LDR2 ,putpixel JSR
|
||||||
( draw ) ,x LDR^ ,w LDR^ ADD^ ,y_ LDR^ ,putpixel JSR
|
( draw ) ,x LDR2 ,w LDR2 ADD2 ,y_ LDR2 ,putpixel JSR
|
||||||
,y_ LDR^ ,0001 ADD^ ,y_ STR^
|
,y_ LDR2 ,0001 ADD2 ,y_ STR2
|
||||||
,y_ LDR^ ,h LDR^ ,y LDR^ ADD^ LTH^ ,linerectcol ROT JMP? POP^
|
,y_ LDR2 ,h LDR2 ,y LDR2 ADD2 LTH2 ,linerectcol ROT JMP? POP2
|
||||||
@linerectrow
|
@linerectrow
|
||||||
( draw ) ,x_ LDR^ ,y LDR^ ,putpixel JSR
|
( draw ) ,x_ LDR2 ,y LDR2 ,putpixel JSR
|
||||||
( draw ) ,x_ LDR^ ,y LDR^ ,h LDR^ ADD^ ,putpixel JSR
|
( draw ) ,x_ LDR2 ,y LDR2 ,h LDR2 ADD2 ,putpixel JSR
|
||||||
,x_ LDR^ ,0001 ADD^ ,x_ STR^
|
,x_ LDR2 ,0001 ADD2 ,x_ STR2
|
||||||
,x_ LDR^ ,w LDR^ ,x LDR^ ADD^ ,0001 ADD^ LTH^ ,linerectrow ROT JMP? POP^
|
,x_ LDR2 ,w LDR2 ,x LDR2 ADD2 ,0001 ADD2 LTH2 ,linerectrow ROT JMP? POP2
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@line
|
@line
|
||||||
,x0 LDR^ ,x_ STR^ ,y0 LDR^ ,y_ STR^ ( start at x0,y0 )
|
,x0 LDR2 ,x_ STR2 ,y0 LDR2 ,y_ STR2 ( start at x0,y0 )
|
||||||
,x1 LDR^ ,x0 LDR^ ,diff16sub JSR ,dx STR^ ( int dx = abs[x1 - x0] )
|
,x1 LDR2 ,x0 LDR2 ,diff16sub JSR ,dx STR2 ( int dx = abs[x1 - x0] )
|
||||||
,y1 LDR^ ,y0 LDR^ ,diff16sub JSR -0001 MUL!^ ,dy STR^ ( int dy = -abs[y1 - y0] )
|
,y1 LDR2 ,y0 LDR2 ,diff16sub JSR -0001 MULS2 ,dy STR2 ( int dy = -abs[y1 - y0] )
|
||||||
,dx LDR^ ,dy LDR^ ADD!^ ,err1 STR^ ( int err1 = dx + dy, e2; )
|
,dx LDR2 ,dy LDR2 ADDS2 ,err1 STR2 ( int err1 = dx + dy, e2; )
|
||||||
@lineloop
|
@lineloop
|
||||||
,x_ LDR^ ,y_ LDR^ ,putpixel JSR ( draw )
|
,x_ LDR2 ,y_ LDR2 ,putpixel JSR ( draw )
|
||||||
@line-x
|
@line-x
|
||||||
,err1 LDR^ +0002 MUL!^ ,err2 STR^ ( e2 = 2 * err; )
|
,err1 LDR2 +0002 MULS2 ,err2 STR2 ( e2 = 2 * err; )
|
||||||
,err2 LDR^ ,dy LDR^ LTH!^ ,line-y ROT JMP? POP^ ( e2 >= dy )
|
,err2 LDR2 ,dy LDR2 LTHS2 ,line-y ROT JMP? POP2 ( e2 >= dy )
|
||||||
,err1 LDR^ ,dy LDR^ ADD!^ ,err1 STR^ ( err1 += dy; )
|
,err1 LDR2 ,dy LDR2 ADDS2 ,err1 STR2 ( err1 += dy; )
|
||||||
,x_ LDR^ +0001 ADD!^ ,x_ STR^ ( y0 += y0 < y1 ? 1 : -1; )
|
,x_ LDR2 +0001 ADDS2 ,x_ STR2 ( y0 += y0 < y1 ? 1 : -1; )
|
||||||
@line-y
|
@line-y
|
||||||
,err2 LDR^ ,dx LDR^ GTH!^ ,line-end ROT JMP? POP^ ( e2 <= dx )
|
,err2 LDR2 ,dx LDR2 GTHS2 ,line-end ROT JMP? POP2 ( e2 <= dx )
|
||||||
,err1 LDR^ ,dx LDR^ ADD!^ ,err1 STR^ ( err1 += dx; )
|
,err1 LDR2 ,dx LDR2 ADDS2 ,err1 STR2 ( err1 += dx; )
|
||||||
,y_ LDR^ +0001 ADD!^ ,y_ STR^ ( y0 += y0 < y1 ? 1 : -1; )
|
,y_ LDR2 +0001 ADDS2 ,y_ STR2 ( y0 += y0 < y1 ? 1 : -1; )
|
||||||
@line-end
|
@line-end
|
||||||
,x_ LDR^ ,x1 LDR^ NEQ!^ ,lineloop ROT JMP? POP^ ( loop )
|
,x_ LDR2 ,x1 LDR2 NEQS2 ,lineloop ROT JMP? POP2 ( loop )
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@diff16
|
@diff16
|
||||||
OVR^ OVR^ GTH^ ,diff16sub ROT JMP? POP^
|
OVR2 OVR2 GTH2 ,diff16sub ROT JMP? POP2
|
||||||
SWP^ @diff16sub SUB^
|
SWP2 @diff16sub SUB2
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@redraw
|
@redraw
|
||||||
,0000 IOW^
|
,0000 IOW2
|
||||||
,0000 IOW^
|
,0000 IOW2
|
||||||
,00 IOW
|
,00 IOW
|
||||||
,01 IOW
|
,01 IOW
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@putpixel
|
@putpixel
|
||||||
IOW^ ( y short )
|
IOW2 ( y short )
|
||||||
IOW^ ( x short )
|
IOW2 ( x short )
|
||||||
,color LDR IOW ( color byte )
|
,color LDR IOW ( color byte )
|
||||||
,00 IOW ( redraw byte )
|
,00 IOW ( redraw byte )
|
||||||
RTS
|
RTS
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@strlen ,0001 ADD^ LDR RTS
|
@strlen ,0001 ADD2 LDR RTS
|
||||||
@incr ,i LDR ,01 ADD ,i STR RTS
|
@incr ,i LDR ,01 ADD ,i STR RTS
|
||||||
|
|
||||||
|c000 @FRAME BRK
|
|c000 @FRAME BRK
|
||||||
|
|
|
@ -13,66 +13,66 @@
|
||||||
|
|
||||||
( positive )
|
( positive )
|
||||||
,01 ,color STR
|
,01 ,color STR
|
||||||
+0030 ,x0 STR^ +0040 ,y0 STR^
|
+0030 ,x0 STR2 +0040 ,y0 STR2
|
||||||
+0100 ,x1 STR^ +0060 ,y1 STR^
|
+0100 ,x1 STR2 +0060 ,y1 STR2
|
||||||
,line JSR
|
,line JSR
|
||||||
|
|
||||||
,02 ,color STR
|
,02 ,color STR
|
||||||
+0020 ,x0 STR^ +0010 ,y0 STR^
|
+0020 ,x0 STR2 +0010 ,y0 STR2
|
||||||
+0090 ,x1 STR^ +0070 ,y1 STR^
|
+0090 ,x1 STR2 +0070 ,y1 STR2
|
||||||
,line JSR
|
,line JSR
|
||||||
|
|
||||||
,03 ,color STR
|
,03 ,color STR
|
||||||
+0010 ,x0 STR^ +0040 ,y0 STR^
|
+0010 ,x0 STR2 +0040 ,y0 STR2
|
||||||
+0070 ,x1 STR^ +0060 ,y1 STR^
|
+0070 ,x1 STR2 +0060 ,y1 STR2
|
||||||
,line JSR
|
,line JSR
|
||||||
|
|
||||||
( draw control points )
|
( draw control points )
|
||||||
,02 ,color STR
|
,02 ,color STR
|
||||||
,x0 LDR^ ,y0 LDR^ ,putpixel JSR
|
,x0 LDR2 ,y0 LDR2 ,putpixel JSR
|
||||||
,x1 LDR^ ,y1 LDR^ ,putpixel JSR
|
,x1 LDR2 ,y1 LDR2 ,putpixel JSR
|
||||||
|
|
||||||
,redraw JSR
|
,redraw JSR
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@line
|
@line
|
||||||
,x0 LDR^ ,x_ STR^ ,y0 LDR^ ,y_ STR^ ( start at x0,y0 )
|
,x0 LDR2 ,x_ STR2 ,y0 LDR2 ,y_ STR2 ( start at x0,y0 )
|
||||||
,x1 LDR^ ,x0 LDR^ ,diff16sub JSR ,dx STR^ ( int dx = abs[x1 - x0] )
|
,x1 LDR2 ,x0 LDR2 ,diff16sub JSR ,dx STR2 ( int dx = abs[x1 - x0] )
|
||||||
,y1 LDR^ ,y0 LDR^ ,diff16sub JSR -0001 MUL!^ ,dy STR^ ( int dy = -abs[y1 - y0] )
|
,y1 LDR2 ,y0 LDR2 ,diff16sub JSR -0001 MULS2 ,dy STR2 ( int dy = -abs[y1 - y0] )
|
||||||
,dx LDR^ ,dy LDR^ ADD!^ ,err1 STR^ ( int err1 = dx + dy, e2; )
|
,dx LDR2 ,dy LDR2 ADDS2 ,err1 STR2 ( int err1 = dx + dy, e2; )
|
||||||
@lineloop
|
@lineloop
|
||||||
,x_ LDR^ ,y_ LDR^ ,putpixel JSR ( draw )
|
,x_ LDR2 ,y_ LDR2 ,putpixel JSR ( draw )
|
||||||
@line-x
|
@line-x
|
||||||
,err1 LDR^ +0002 MUL!^ ,err2 STR^ ( e2 = 2 * err; )
|
,err1 LDR2 +0002 MULS2 ,err2 STR2 ( e2 = 2 * err; )
|
||||||
,err2 LDR^ ,dy LDR^ LTH!^ ,line-y ROT JMP? POP^ ( e2 >= dy )
|
,err2 LDR2 ,dy LDR2 LTHS2 ,line-y ROT JMP? POP2 ( e2 >= dy )
|
||||||
,err1 LDR^ ,dy LDR^ ADD!^ ,err1 STR^ ( err1 += dy; )
|
,err1 LDR2 ,dy LDR2 ADDS2 ,err1 STR2 ( err1 += dy; )
|
||||||
,x_ LDR^ +0001 ADD!^ ,x_ STR^ ( y0 += y0 < y1 ? 1 : -1; )
|
,x_ LDR2 +0001 ADDS2 ,x_ STR2 ( y0 += y0 < y1 ? 1 : -1; )
|
||||||
@line-y
|
@line-y
|
||||||
,err2 LDR^ ,dx LDR^ GTH!^ ,line-end ROT JMP? POP^ ( e2 <= dx )
|
,err2 LDR2 ,dx LDR2 GTHS2 ,line-end ROT JMP? POP2 ( e2 <= dx )
|
||||||
,err1 LDR^ ,dx LDR^ ADD!^ ,err1 STR^ ( err1 += dx; )
|
,err1 LDR2 ,dx LDR2 ADDS2 ,err1 STR2 ( err1 += dx; )
|
||||||
,y_ LDR^ +0001 ADD!^ ,y_ STR^ ( y0 += y0 < y1 ? 1 : -1; )
|
,y_ LDR2 +0001 ADDS2 ,y_ STR2 ( y0 += y0 < y1 ? 1 : -1; )
|
||||||
@line-end
|
@line-end
|
||||||
,x_ LDR^ ,x1 LDR^ NEQ!^ ,lineloop ROT JMP? POP^ ( loop )
|
,x_ LDR2 ,x1 LDR2 NEQS2 ,lineloop ROT JMP? POP2 ( loop )
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@redraw
|
@redraw
|
||||||
,0000 IOW^
|
,0000 IOW2
|
||||||
,0000 IOW^
|
,0000 IOW2
|
||||||
,00 IOW
|
,00 IOW
|
||||||
,01 IOW
|
,01 IOW
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@putpixel
|
@putpixel
|
||||||
IOW^ ( y short )
|
IOW2 ( y short )
|
||||||
IOW^ ( x short )
|
IOW2 ( x short )
|
||||||
,color LDR IOW ( color byte )
|
,color LDR IOW ( color byte )
|
||||||
,00 IOW ( redraw byte )
|
,00 IOW ( redraw byte )
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@diff16
|
@diff16
|
||||||
OVR^ OVR^ GTH^ ,diff16sub ROT JMP? POP^
|
OVR2 OVR2 GTH2 ,diff16sub ROT JMP? POP2
|
||||||
SWP^ @diff16sub SUB^
|
SWP2 @diff16sub SUB2
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|c000 @FRAME BRK
|
|c000 @FRAME BRK
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
|
|
||||||
@loop1
|
@loop1
|
||||||
,01 ADD DUP
|
,01 ADD DUP
|
||||||
,ff NEQ ,loop1 ROT JMP? POP^
|
,ff NEQ ,loop1 ROT JMP? POP2
|
||||||
|
|
||||||
( increment value in memory )
|
( increment value in memory )
|
||||||
|
|
||||||
@loop2
|
@loop2
|
||||||
#00 LDR ,01 ADD #00 STR
|
#00 LDR ,01 ADD #00 STR
|
||||||
#00 LDR
|
#00 LDR
|
||||||
,ff NEQ ,loop2 ROT JMP? POP^
|
,ff NEQ ,loop2 ROT JMP? POP2
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,13 @@ BRK
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@getmouse
|
@getmouse
|
||||||
,00 IOR^ ( get mouse x )
|
,00 IOR2 ( get mouse x )
|
||||||
,02 IOR^ ( get mouse y )
|
,02 IOR2 ( get mouse y )
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@putpixel
|
@putpixel
|
||||||
IOW^ ( y short )
|
IOW2 ( y short )
|
||||||
IOW^ ( x short )
|
IOW2 ( x short )
|
||||||
IOW ( color byte )
|
IOW ( color byte )
|
||||||
IOW ( redraw byte )
|
IOW ( redraw byte )
|
||||||
RTS
|
RTS
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
|
|
||||||
,01 ,dev/w STR
|
,01 ,dev/w STR
|
||||||
|
|
||||||
,0020 ,x STR^ ( set x-pos )
|
,0020 ,x STR2 ( set x-pos )
|
||||||
,0030 ,y STR^ ( set y-pos )
|
,0030 ,y STR2 ( set y-pos )
|
||||||
|
|
||||||
( IOW will now send to screen )
|
( IOW will now send to screen )
|
||||||
|
|
||||||
,y LDR^ IOW^ ( y-pos )
|
,y LDR2 IOW2 ( y-pos )
|
||||||
,x LDR^ IOW^ ( x-pos )
|
,x LDR2 IOW2 ( x-pos )
|
||||||
,02 IOW ( color )
|
,02 IOW ( color )
|
||||||
,01 IOW ( redraw )
|
,01 IOW ( redraw )
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
,01 ,dev/w STR ( set dev/write to screen )
|
,01 ,dev/w STR ( set dev/write to screen )
|
||||||
,01 ,color STR ( set color )
|
,01 ,color STR ( set color )
|
||||||
,0020 ,x STR^ ( set x-pos )
|
,0020 ,x STR2 ( set x-pos )
|
||||||
,0030 ,y STR^ ( set y-pos )
|
,0030 ,y STR2 ( set y-pos )
|
||||||
,01 ,alive STR ( set alive = true )
|
,01 ,alive STR ( set alive = true )
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
@ -18,25 +18,25 @@ BRK
|
||||||
|c000 @FRAME
|
|c000 @FRAME
|
||||||
|
|
||||||
,alive LDR ,00 EQU BRK?
|
,alive LDR ,00 EQU BRK?
|
||||||
,01 ,color LDR ,x LDR^ ,y LDR^ ,putpixel JSR
|
,01 ,color LDR ,x LDR2 ,y LDR2 ,putpixel JSR
|
||||||
,move JSR
|
,move JSR
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@move
|
@move
|
||||||
,x LDR^ ,0001 ADD^ ,x STR^ ( incr x )
|
,x LDR2 ,0001 ADD2 ,x STR2 ( incr x )
|
||||||
,x LDR^ ,0040 LTH^ RTS? ( if x > 60 )
|
,x LDR2 ,0040 LTH2 RTS? ( if x > 60 )
|
||||||
,0020 ,x STR^ ( x = 0x0020 )
|
,0020 ,x STR2 ( x = 0x0020 )
|
||||||
,y LDR^ ,0001 ADD^ ,y STR^ ( incr y )
|
,y LDR2 ,0001 ADD2 ,y STR2 ( incr y )
|
||||||
|
|
||||||
,y LDR^ ,0050 LTH^ RTS? ( y > 50 )
|
,y LDR2 ,0050 LTH2 RTS? ( y > 50 )
|
||||||
,00 ,alive STR ( alive = 0 )
|
,00 ,alive STR ( alive = 0 )
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@putpixel
|
@putpixel
|
||||||
IOW^ ( y short )
|
IOW2 ( y short )
|
||||||
IOW^ ( x short )
|
IOW2 ( x short )
|
||||||
IOW ( color byte )
|
IOW ( color byte )
|
||||||
IOW ( redraw byte )
|
IOW ( redraw byte )
|
||||||
RTS
|
RTS
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
,01 DUP ,dev/r STR ,dev/w STR
|
,01 DUP ,dev/r STR ,dev/w STR
|
||||||
|
|
||||||
( load screen size )
|
( load screen size )
|
||||||
,00 IOR^ ,width STR^
|
,00 IOR2 ,width STR2
|
||||||
,02 IOR^ ,height STR^
|
,02 IOR2 ,height STR2
|
||||||
|
|
||||||
( draw pixel at screen center )
|
( draw pixel at screen center )
|
||||||
|
|
||||||
,0101
|
,0101
|
||||||
,width LDR^ ,0002 DIV^
|
,width LDR2 ,0002 DIV2
|
||||||
,height LDR^ ,0002 DIV^
|
,height LDR2 ,0002 DIV2
|
||||||
,putpixel JSR
|
,putpixel JSR
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
@ -26,8 +26,8 @@ BRK
|
||||||
|c000 @FRAME BRK
|
|c000 @FRAME BRK
|
||||||
|
|
||||||
@putpixel
|
@putpixel
|
||||||
IOW^ ( y short )
|
IOW2 ( y short )
|
||||||
IOW^ ( x short )
|
IOW2 ( x short )
|
||||||
IOW ( color byte )
|
IOW ( color byte )
|
||||||
IOW ( redraw byte )
|
IOW ( redraw byte )
|
||||||
RTS
|
RTS
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
,00 ,dev/w STR ( set dev/write to console )
|
,00 ,dev/w STR ( set dev/write to console )
|
||||||
|
|
||||||
+1234 -0012 ADD^!
|
+1234 -0012 ADDS2
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue