home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 85
/
085.d81
/
plan.s
< prev
next >
Wrap
Text File
|
2022-08-26
|
8KB
|
895 lines
.org 49152
.mem
;.obj "planner.o"
jmp input
jmp inline
jmp box
jmp viewdir
jmp texts
szp = 251
czp = 253
screen = 1024
color = 55296
;open2,8,2,"filename"
;sys49152,length,filenumber
;returns string in first variable defined in prg
input =*
comnum = 47089
chkcom = 44797
getnum = 47006
vartab = 45
clrchn = 65484
chkin = 65478
chrin = 65487
jsr comnum
stx length
jsr comnum
stx filenum
jsr chkin
ldx #0
- jsr chrin
cmp #13
beq +
sta string,x
inx
cpx length
bne -
+ ldy #2
txa
sta (vartab),y
iny
lda <string
sta (vartab),y
iny
lda >string
sta (vartab),y
jsr clrchn
rts
filenum .byte 0
length .byte 0
;sys49152,row,colm,length
;returns string in first variable defined in prg
;comnum = 47089
;chkcom = 44797
;getnum = 47006
;vartab = 45
inline =*
jsr comnum
stx row
jsr comnum
stx colm
jsr comnum
stx len
lda <screen
sta szp
lda >screen
sta szp+1
ldy #255
- jsr add40
iny
cpy row
bne -
+ ldx #0
ldy colm
- lda (szp),y
jsr convert
sta string,x
iny
inx
cpx len
bne -
ldy #2
txa
sta (vartab),y
iny
lda <string
sta (vartab),y
iny
lda >string
sta (vartab),y
rts
add40 =*
clc
lda szp
adc #40
sta szp
lda szp+1
adc #0
sta szp+1
clc
lda czp
adc #40
sta czp
lda czp+1
adc #0
sta czp+1
rts
convert =*
sty ytemp
cmp #0
php
and #127
ldy #4
- dey
cmp upplim,y
bcs -
eor fliptb,y
plp
ldy ytemp
rts
row .byte 0
colm .byte 0
len .byte 0
ytemp .byte 0
upplim .byte 128,96,64,32
fliptb .byte 192,32,0,64
;sys49152,row,colm,row1,colm1,color
box =*
jsr comnum
stx row
jsr comnum
stx colm
jsr comnum
stx row1
jsr comnum
stx colm1
jsr comnum
stx text
lda row
sta counter
lda <screen-40
sta szp
lda >screen-40
sta szp+1
lda <color-40
sta czp
lda >color-40
sta czp+1
ldy #255
- jsr add40
iny
cpy row
bne -
ldy colm
- lda #112
sta (szp),y
lda text
sta (czp),y
iny
- lda #64
sta (szp),y
lda text
sta (czp),y
iny
cpy colm1
bne -
lda #110
sta (szp),y
lda text
sta (czp),y
- jsr add40
inc counter
lda counter
cmp row1
beq +
ldy colm
lda #93
sta (szp),y
lda text
sta (czp),y
iny
- lda #32
sta (szp),y
lda text
sta (czp),y
iny
cpy colm1
bne -
lda #93
sta (szp),y
lda text
sta (czp),y
jmp --
+ ldy colm
lda #109
sta (szp),y
lda text
sta (czp),y
iny
- lda #64
sta (szp),y
lda text
sta (czp),y
iny
cpy colm1
bne -
lda #125
sta (szp),y
lda text
sta (czp),y
rts
row1 .byte 0
colm1 .byte 0
counter .byte 0
;read directory
setlfs = $ffba
setnam = $ffbd
;clrchn = $ffcc
open = $ffc0
chrout = 65490
;chrin = $ffcf
;chkin = $ffc6
chkout = $ffc9
close = $ffc3
outnum = $bdcd
status = 144
viewdir =*
jsr clrchn
lda #2
ldx <filename
ldy >filename
jsr setnam
lda #1
ldx #8
ldy #0
jsr setlfs
jsr open
ldx #1
jsr chkin
jsr chrin
jsr chrin
starts =*
jsr chrin
jsr chrin
lda status
cmp #0
bne ++
jsr indent
jsr chrin:sta high
jsr chrin:sta low
lda low
ldx high
jsr outnum
- jsr chrin
bne +
lda #13
jsr chrout
jmp starts
+ jsr chrout
jmp -
+ lda #1
jsr close
jsr clrchn
rts
indent =*
ldy #0
lda #32
- jsr chrout
iny
cpy #6
bne -
rts
filename .asc "$0"
low .byte 0
high .byte 0
;sys49152,lm,tm,rm,bm,text color
zp = 247
zp1 = 249
;szp = 251
;czp = 253
;screen = 1024
;color = 55296
;chrout = $ffd2
getin = $ffe4
;comnum = 47089
texts =*
jsr comnum
stx lm
jsr comnum
stx tm
jsr comnum
stx rm
jsr comnum
stx bm
jsr comnum
stx text
jsr init
texted =*
- ldy x
lda (szp),y
eor #128
sta (szp),y
ldx speed
jsr delay
ldy x
lda (szp),y
eor #128
sta (szp),y
ldx speed
jsr delay
jsr getin
sta temp
beq -
cmp #133;f1 exit
bne +
rts
+ cmp #147
bne +
jsr clearscreen
jmp -
+ cmp #17
bne +
jsr down
jmp -
+ cmp #29
bne +
jsr right
jmp -
+ cmp #145
bne +
jsr up
jmp -
+ cmp #157
bne +
jsr left
jmp -
+ cmp #20
bne +
jsr delete
jmp -
+ cmp #148
bne +
jsr insert
jmp -
+ cmp #9;control i
bne +
jsr insertline
jmp -
+ cmp #4;control d
bne +
jsr deleteline
jmp -
+ cmp #6;contol f
bne +
jsr eraseend
jmp -
+ cmp #2;control b
bne +
jsr erasestart
jmp -
+ cmp #13
bne +
jsr return
jmp -
+ cmp #19
bne +
jsr home
jmp -
+ cmp #255
bne +
lda #126
jmp writechar
+ cmp #32
bne +
jmp writechar
+ cmp #33
bne +
jmp writechar
+ cmp #35
bcs +
jmp -
+ cmp #64
bcs +
jmp writechar
+ cmp #96
bcs +
sec
sbc #64
jmp writechar
+ cmp #123
bcs +
sec
sbc #32
jmp writechar
+ cmp #193
bcs +
jmp texted
+ cmp #219
bcc +
jmp texted
+ sec
sbc #128
writechar =*
sta char
jsr plotchar
jmp wordcheck
jsr right
jmp texted
plotchar =*
ldy x
lda char
sta (szp),y
lda text
sta (czp),y
rts
wordcheck =*
lda x
cmp rm
beq +
jsr right
jmp texted
+ lda y
cmp bm
bne +
jsr right
jmp texted
+ ldy x
lda (szp),y
cmp #32
bne +
jsr return
jmp texted
+ inc rm
dec lm
ldy x
ldx x
- lda (szp),y
cmp #32
beq +
sta textbuf,y
dey
dex
cpx lm
bne -
+ iny
sty temp
lda #32
- sta (szp),y
iny
cpy rm
bne -
jsr return
ldx temp
inc lm
ldy lm
- lda textbuf,x
sta (szp),y
lda text
sta (czp),y
iny
inx
cpx rm
bne -
;- jsr right
;inc temp
;lda temp
;cmp rm
;bne -
sty x
dec x
dec rm
jsr right
jmp texted
delay =*
ldy #0
- iny
bne -
dex
bne delay
rts
up =*
lda y
cmp tm
bne +
rts
+ jsr sub40
dec y
rts
down =*
lda y
cmp bm
bne +
rts
+ jsr add40
inc y
rts
right =*
lda x
cmp rm
bne +
jsr return
rts
+ inc x
rts
left =*
lda x
cmp lm
bne +
rts
+ dec x
rts
sub40 =*
sec
lda szp
sbc #40
sta szp
lda szp+1
sbc #0
sta szp+1
sec
lda czp
sbc #40
sta czp
lda czp+1
sbc #0
sta czp+1
rts
clearscreen =*
jsr init
inc rm
inc bm
ldx tm
- ldy lm
- lda #32
sta (szp),y
lda text
sta (czp),y
iny
cpy rm
bne -
jsr add40
inx
cpx bm
bne --
dec rm
dec bm
home jsr init
rts
add401 =*
clc
lda zp
adc #40
sta zp
lda zp+1
adc #0
sta zp+1
clc
lda zp1
adc #40
sta zp1
lda zp1+1
adc #0
sta zp1+1
rts
sub401 =*
sec
lda zp
sbc #40
sta zp
lda zp+1
sbc #0
sta zp+1
sec
lda zp1
sbc #40
sta zp1
lda zp1+1
sbc #0
sta zp1+1
rts
insert =*
ldy rm
cpy x
bne +
rts
+ lda (szp),y
cmp #32
beq +
rts
+ ldy rm
- dey
lda (szp),y
iny
sta (szp),y
dey
lda (czp),y
iny
sta (czp),y
dey
cpy x
bne -
ldy x
lda (szp),y
iny
sta (szp),y
dey
lda (czp),y
iny
sta (czp),y
ldy x
lda #32
sta (szp),y
rts
delete =*
ldy x
cpy lm
bne +
rts
+ inc rm
- lda (szp),y
dey
sta (szp),y
iny
lda (czp),y
dey
sta (czp),y
iny
iny
cpy rm
bne -
dey
lda #32
sta (szp),y
jsr left
dec rm
rts
deleteline =*
lda y
cmp bm
bne +
rts
+ lda szp
sta zp
lda szp+1
sta zp+1
lda czp
sta zp1
lda czp+1
sta zp1+1
jsr add401
inc rm
ldx y
- ldy lm
- lda (zp),y
sta temp
jsr sub401
lda temp
sta (zp),y
jsr add401
lda (zp1),y
sta temp
jsr sub401
lda temp
sta (zp1),y
jsr add401
iny
cpy rm
bne -
jsr add401
inx
cpx bm
bne --
jsr sub401
ldy lm
- lda #32
sta (zp),y
iny
cpy rm
bne -
dec rm
rts
insertline =*
lda y
cmp bm
bne +
rts
+ dec y
dec bm
lda <screen
sta zp
lda >screen
sta zp+1
lda <color
sta zp1
lda >color
sta zp1+1
ldx #0
- jsr add401
inx
cpx bm
bne -
inc rm
ldx bm
- ldy lm
- lda (zp),y
sta temp
jsr add401
lda temp
sta (zp),y
jsr sub401
lda (zp1),y
sta temp
jsr add401
lda temp
sta (zp1),y
jsr sub401
iny
cpy rm
bne -
jsr sub401
dex
cpx y
bne --
ldy lm
- lda #32
sta (szp),y
iny
cpy rm
bne -
inc y
dec rm
inc bm
rts
eraseend =*
inc rm
ldy x
- lda #32
sta (szp),y
iny
cpy rm
bne -
dec rm
rts
erasestart =*
dec lm
ldy x
- lda #32
sta (szp),y
dey
cpy lm
bne -
inc lm
rts
return =*
lda y
cmp bm
bne +
rts
+ lda lm
sta x
jsr down
rts
init =*
lda <screen
sta szp
lda >screen
sta szp+1
lda <color
sta czp
lda >color
sta czp+1
ldy tm
beq +
ldy #0
- jsr add40
iny
cpy tm
bne -
+ lda lm
sta x
lda tm
sta y
rts
speed .byte 10
char .byte 0
temp .byte 0
x .byte 0
y .byte 0
text .byte 14
rm .byte 39
lm .byte 0
tm .byte 0
bm .byte 24
textbuf .buf 40
string .byte 0