mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 00:32:44 +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/a2osx.i
|
||||
*--------------------------------------
|
||||
STAR .EQ '*'
|
||||
BLANK .EQ '_'
|
||||
MAX .EQ 30
|
||||
*--------------------------------------
|
||||
* Zero Page Segment, up to 32 bytes
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
@ -30,6 +34,9 @@ ZS.START
|
||||
ZPPtr1 .BS 2 ; address pointer (used in arg parsing)
|
||||
ArgIndex .BS 1 ; index offset for argument parsing
|
||||
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
|
||||
*--------------------------------------
|
||||
* 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
|
||||
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
|
||||
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?
|
||||
bmi CS.RUN.Sapling
|
||||
bcc CS.RUN.Sapling
|
||||
|
||||
lda #'Y'
|
||||
>SYSCALL PutChar
|
||||
jsr CS.RUN.Newline
|
||||
rts
|
||||
|
||||
CS.RUN.Sapling lda #'|'
|
||||
>SYSCALL PutChar
|
||||
jsr CS.RUN.Newline
|
||||
@ -130,24 +131,28 @@ CS.RUN.Sapling lda #'|'
|
||||
CS.RUN.Start lda #2 ; start from row 2
|
||||
sta ROW
|
||||
lda #MAX ; calculate margin chop
|
||||
sbc bSize
|
||||
sec ; SEC before SBC !!!
|
||||
sbc bSize
|
||||
sta MARGIN
|
||||
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
|
||||
sbc ROW
|
||||
sec
|
||||
sbc ROW
|
||||
sbc MARGIN
|
||||
tax ; put into x register
|
||||
lda BLANK ; load blank character
|
||||
lda #BLANK ; load blank character
|
||||
jsr CS.RUN.Disp ; display ́x ́ blanks
|
||||
|
||||
CS.RUN.Stars lda ROW ; calculate number of stars to display
|
||||
rol
|
||||
asl ; ASL not ROL !!!
|
||||
tax ; put into x register and -2
|
||||
dex
|
||||
dex
|
||||
lda STAR ; load star character
|
||||
lda #STAR ; load star character
|
||||
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
|
||||
inx
|
||||
stx ROW
|
||||
@ -155,35 +160,41 @@ CS.RUN.Next
|
||||
bne CS.RUN.Blanks
|
||||
jsr CS.RUN.Stump ; display a stump...
|
||||
rts ; ...and we ́re done
|
||||
|
||||
CS.RUN.Stump lda #MAX-2 ; calculate number of blanks to place stump
|
||||
sbc MARGIN
|
||||
sec
|
||||
sbc MARGIN
|
||||
tax
|
||||
lda BLANK
|
||||
lda #BLANK
|
||||
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,
|
||||
cpy #3 ; then give it a much skinnier stump
|
||||
bne .2
|
||||
|
||||
lda #'|' ; <-- skinny stump
|
||||
|
||||
.2 >SYSCALL PutChar
|
||||
jsr CS.RUN.Newline
|
||||
rts
|
||||
CS.RUN.Disp
|
||||
pha
|
||||
|
||||
CS.RUN.Disp cpx #0
|
||||
beq .9
|
||||
|
||||
.1 pha
|
||||
phx
|
||||
>SYSCALL PutChar
|
||||
plx
|
||||
pla
|
||||
dex
|
||||
CS.RUN.Disp1 cpx #0 ; loop until we decrement X to 0
|
||||
bne CS.RUN.Disp
|
||||
rts
|
||||
dex ; loop until we decrement X to 0
|
||||
bne .1
|
||||
|
||||
.9 rts
|
||||
|
||||
CS.RUN.Newline >PUSHW L.MSG.NEWLINE
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
rts
|
||||
|
||||
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user