mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 02:49:54 +00:00
XMASTREE:Telnet fixed, but still bus in algorithm :-)
This commit is contained in:
parent
cdd2a24149
commit
7aa3860a58
@ -22,6 +22,10 @@ NEW
|
|||||||
.INB inc/macros.i
|
.INB inc/macros.i
|
||||||
.INB inc/a2osx.i
|
.INB inc/a2osx.i
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
STAR .EQ '*'
|
||||||
|
BLANK .EQ '_'
|
||||||
|
MAX .EQ 30
|
||||||
|
*--------------------------------------
|
||||||
* Zero Page Segment, up to 32 bytes
|
* Zero Page Segment, up to 32 bytes
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DUMMY
|
.DUMMY
|
||||||
@ -30,6 +34,9 @@ ZS.START
|
|||||||
ZPPtr1 .BS 2 ; address pointer (used in arg parsing)
|
ZPPtr1 .BS 2 ; address pointer (used in arg parsing)
|
||||||
ArgIndex .BS 1 ; index offset for argument parsing
|
ArgIndex .BS 1 ; index offset for argument parsing
|
||||||
bSize .BS 2 ; arg variable - size of the tree, though we only use first byte
|
bSize .BS 2 ; arg variable - size of the tree, though we only use first byte
|
||||||
|
ROW .BS 1 ; current row
|
||||||
|
MARGIN .BS 1 ; number of blanks to chop from margin
|
||||||
|
|
||||||
ZS.END .ED
|
ZS.END .ED
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* File Header (16 Bytes)
|
* File Header (16 Bytes)
|
||||||
@ -104,24 +111,18 @@ CS.DOEVENT sec ; we don't use this since we don't have
|
|||||||
CS.QUIT clc ; nothing to do on exit except clear carry and return
|
CS.QUIT clc ; nothing to do on exit except clear carry and return
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
STAR .da #'*'
|
|
||||||
BLANK .da #' '
|
|
||||||
MAX .da #30
|
|
||||||
|
|
||||||
* storage
|
|
||||||
|
|
||||||
ROW .bs 1 ; current row
|
|
||||||
MARGIN .bs 1 ; number of blanks to chop from margin
|
|
||||||
|
|
||||||
CS.RUN.Tree lda bSize
|
CS.RUN.Tree lda bSize
|
||||||
cmp #3 ; did they specify a size of 2?
|
cmp #3 ; did they specify a size of 2?
|
||||||
bpl CS.RUN.Start ; if not, go normal tree drawing
|
bcs CS.RUN.Start ; if not, go normal tree drawing
|
||||||
|
|
||||||
cmp #2 ; did they specify a size of 2?
|
cmp #2 ; did they specify a size of 2?
|
||||||
bmi CS.RUN.Sapling
|
bcc CS.RUN.Sapling
|
||||||
|
|
||||||
lda #'Y'
|
lda #'Y'
|
||||||
>SYSCALL PutChar
|
>SYSCALL PutChar
|
||||||
jsr CS.RUN.Newline
|
jsr CS.RUN.Newline
|
||||||
rts
|
rts
|
||||||
|
|
||||||
CS.RUN.Sapling lda #'|'
|
CS.RUN.Sapling lda #'|'
|
||||||
>SYSCALL PutChar
|
>SYSCALL PutChar
|
||||||
jsr CS.RUN.Newline
|
jsr CS.RUN.Newline
|
||||||
@ -130,24 +131,28 @@ CS.RUN.Sapling lda #'|'
|
|||||||
CS.RUN.Start lda #2 ; start from row 2
|
CS.RUN.Start lda #2 ; start from row 2
|
||||||
sta ROW
|
sta ROW
|
||||||
lda #MAX ; calculate margin chop
|
lda #MAX ; calculate margin chop
|
||||||
|
sec ; SEC before SBC !!!
|
||||||
sbc bSize
|
sbc bSize
|
||||||
sta MARGIN
|
sta MARGIN
|
||||||
jsr CS.RUN.Stump ; display a stump first since same as top of tree
|
jsr CS.RUN.Stump ; display a stump first since same as top of tree
|
||||||
|
|
||||||
CS.RUN.Blanks lda #MAX ; calculate number of blanks to tab
|
CS.RUN.Blanks lda #MAX ; calculate number of blanks to tab
|
||||||
|
sec
|
||||||
sbc ROW
|
sbc ROW
|
||||||
sbc MARGIN
|
sbc MARGIN
|
||||||
tax ; put into x register
|
tax ; put into x register
|
||||||
lda BLANK ; load blank character
|
lda #BLANK ; load blank character
|
||||||
jsr CS.RUN.Disp ; display ́x ́ blanks
|
jsr CS.RUN.Disp ; display ́x ́ blanks
|
||||||
|
|
||||||
CS.RUN.Stars lda ROW ; calculate number of stars to display
|
CS.RUN.Stars lda ROW ; calculate number of stars to display
|
||||||
rol
|
asl ; ASL not ROL !!!
|
||||||
tax ; put into x register and -2
|
tax ; put into x register and -2
|
||||||
dex
|
dex
|
||||||
dex
|
dex
|
||||||
lda STAR ; load star character
|
lda #STAR ; load star character
|
||||||
jsr CS.RUN.Disp ; display ́x ́ stars
|
jsr CS.RUN.Disp ; display ́x ́ stars
|
||||||
CS.RUN.Next
|
|
||||||
jsr CS.RUN.Newline
|
CS.RUN.Next jsr CS.RUN.Newline
|
||||||
ldx ROW ; increment row
|
ldx ROW ; increment row
|
||||||
inx
|
inx
|
||||||
stx ROW
|
stx ROW
|
||||||
@ -155,35 +160,41 @@ CS.RUN.Next
|
|||||||
bne CS.RUN.Blanks
|
bne CS.RUN.Blanks
|
||||||
jsr CS.RUN.Stump ; display a stump...
|
jsr CS.RUN.Stump ; display a stump...
|
||||||
rts ; ...and we ́re done
|
rts ; ...and we ́re done
|
||||||
|
|
||||||
CS.RUN.Stump lda #MAX-2 ; calculate number of blanks to place stump
|
CS.RUN.Stump lda #MAX-2 ; calculate number of blanks to place stump
|
||||||
|
sec
|
||||||
sbc MARGIN
|
sbc MARGIN
|
||||||
tax
|
tax
|
||||||
lda BLANK
|
lda #BLANK
|
||||||
jsr CS.RUN.Disp ; display ́x ́ blanks
|
jsr CS.RUN.Disp ; display ́x ́ blanks
|
||||||
lda STAR ; display star as a stump
|
lda #STAR ; display star as a stump
|
||||||
ldy ROW ; unless the tree is only 3 rows tall,
|
ldy ROW ; unless the tree is only 3 rows tall,
|
||||||
cpy #3 ; then give it a much skinnier stump
|
cpy #3 ; then give it a much skinnier stump
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
lda #'|' ; <-- skinny stump
|
lda #'|' ; <-- skinny stump
|
||||||
|
|
||||||
.2 >SYSCALL PutChar
|
.2 >SYSCALL PutChar
|
||||||
jsr CS.RUN.Newline
|
jsr CS.RUN.Newline
|
||||||
rts
|
rts
|
||||||
CS.RUN.Disp
|
|
||||||
pha
|
CS.RUN.Disp cpx #0
|
||||||
|
beq .9
|
||||||
|
|
||||||
|
.1 pha
|
||||||
phx
|
phx
|
||||||
>SYSCALL PutChar
|
>SYSCALL PutChar
|
||||||
plx
|
plx
|
||||||
pla
|
pla
|
||||||
dex
|
dex ; loop until we decrement X to 0
|
||||||
CS.RUN.Disp1 cpx #0 ; loop until we decrement X to 0
|
bne .1
|
||||||
bne CS.RUN.Disp
|
|
||||||
rts
|
.9 rts
|
||||||
|
|
||||||
CS.RUN.Newline >PUSHW L.MSG.NEWLINE
|
CS.RUN.Newline >PUSHW L.MSG.NEWLINE
|
||||||
>PUSHBI 0
|
>PUSHBI 0
|
||||||
>SYSCALL PrintF
|
>SYSCALL PrintF
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.END
|
CS.END
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user