i regret my decisions

This commit is contained in:
Yuvia 2025-09-10 14:08:33 +00:00
parent eea8ef5513
commit d14c260889
14 changed files with 2 additions and 170 deletions

BIN
6.out

Binary file not shown.

BIN
a.out

Binary file not shown.

BIN
cpu.6

Binary file not shown.

3
fns.h
View file

@ -8,6 +8,3 @@ extern u8int pop8(void);
extern u16int pop16(void);
extern u8int fetch8(void);
extern u16int fetch16(void);
extern void in(void*);
extern void out(void*);

BIN
in.6

Binary file not shown.

22
in.c
View file

@ -1,22 +0,0 @@
#include <u.h>
#include <libc.h>
#include <ctype.h>
#include "dat.h"
#include "fns.h"
void
in(void*)
{
int c;
for(;;){
if(memread(0x7005) == 1){
memwrite(0x7004, 1);
read(0, &c, 1);
c = toupper(c);
memwrite(0x7003, c);
memwrite(0x7004, 0);
memwrite(0x7005, 0);
}
}
}

BIN
main.6

Binary file not shown.

5
main.c
View file

@ -1,6 +1,5 @@
#include <u.h>
#include <libc.h>
#include <thread.h>
#include "dat.h"
#include "fns.h"
@ -36,7 +35,7 @@ openprog(char *f)
}
void
threadmain(int argc, char **argv)
main(int argc, char **argv)
{
int c;
vlong t, t2, t3;
@ -65,8 +64,6 @@ threadmain(int argc, char **argv)
rP = 0x34;
pc = 0xFFFC;
pc = fetch16();
threadcreate(in, nil, mainstacksize);
threadcreate(out, nil, mainstacksize);
for(;;){
c = step();
while(c >= 0){

BIN
mem.6

Binary file not shown.

2
mkfile
View file

@ -3,7 +3,7 @@
BIN=/$objtype/bin
TARG=scemu
OFILES=main.$O cpu.$O mem.$O in.$O out.$O
OFILES=main.$O cpu.$O mem.$O
UPDATE=mkfile prog.s ${OFILES:%.$O=%.c}
default:V: $O.out

BIN
out.6

Binary file not shown.

19
out.c
View file

@ -1,19 +0,0 @@
#include <u.h>
#include <libc.h>
#include "dat.h"
#include "fns.h"
void
out(void*)
{
int c;
for(;;)
if(memread(0x7002) == 1){ /* ready to be fiddled */
memwrite(0x7001, 1); /* we are busy */
c = memread(0x7000);
print("%c", c);
memwrite(0x7002, 0);
memwrite(0x7001, 0);
}
}

24
test.s
View file

@ -1,24 +0,0 @@
.org $8000
reset:
lda #$01
sta $7005
loop:
lda $7004
bne loop
lda $7003
sta $7000
lda #$01
sta $7002
waiting:
nop
nop
nop
nop
lda $7001
bne waiting
.byte $ff
.org $fffa
.word $8000
.word $8000
.word $8000

View file

@ -1,97 +0,0 @@
xaml = $24
xamh = $25
l = $28
h = $29
ysav = $2a
mode = $2b
asav = $2c
curchar = $2d
.org $fe00
reset:
cld
cli
lda #$03
notcr:
cmp #$03 ; is etx, subst. for esc
beq escape
iny
bpl nextchar
escape:
lda #$5c
jsr echo
getline:
lda #$0a
jsr echo
setstor:
asl
setmode:
sta mode
blskip:
nextchar:
ldy #1
sty $7005
nextcharl:
lda $7004 ; have next char?
beq nextcharl
lda $7003
sta curchar
cmp #$2e ; .
bcc blskip
beq setmode
cmp #$3a ; :
beq setstor
cmp #$52 ; R
beq run
stx l
stx h
sty ysav
nexthex:
lda curchar
eor #$b0
cmp #$0a
bcc dig
adc #$b9
cmp #$fa
bcc nothex
dig:
asl
asl
asl
asl
ldx #$04
hexshift:
asl
rol l
rol h
dex
bne hexshift
bne nexthex
nothex:
cpy ysav
beq escape
bit mode
jmp nextchar
run:
jmp (xaml)
echo:
sta asav
txa
pha
lda asav
tax
echol:
lda $7001
cmp #$01
beq echol
stx $7000
lda #$01
sta $7002
pla
tax
rts
.org $fffa
.word $f000
.word reset
.word $0000