Output in ProgressWriter's name: Stacey Rosenberg Most recent update Date: 12/3/2008 Credits: I used Thomas' test code Brief description: Output code Inputs: and Preconditions: Don't Use I use: - Globals:
- PipeH
- PipeV
- Squares(Is it Squares or Square?)
- cols
- rows
- . . . Other(Those with R before are variables, those with R after are pointers)
- ROutput
- RPipeHOn
- RPipeVOn
- RVertJ
- RHorzJ
- RSquaJ
- ROffsJ
- RStar
- RVert
- RHorz
- RNMSpace
- RLfeed
- Rvcols
- Rhcols
- Rvoffset
- Rhoffset
- HCase0R
- HCase1R
- HCOutR
- VCase00R
- VCase01R
- VsCaseOR
- VCase0R
- VCase1R
- VCOutR
- SCase0R
- SCase1R
- SCOutR
- OCaseHR
- OHForR
- OCHOutR
- OCaseVR
- OVForR
- OCVOutR
- MainC1R
- MainC2R
- OHBackR
- HDoR
- HBackR
- HWhile1R
- HWhile2R
- MainC3R
- MainC4R
- EO1ForR
- MainC5R
- OVBackR
- VDoR
- SBackR
- VBackR
- VWhile1R
- VWhile2R
- MainC6R
- EO2ForR
- MainC7R
(All are now specific to my code) - Preconditions, other: I expect what to be true?
- I am working under the assumption that we are using numbers
- Vertically from 10-49, (offset: asl + 10)
- Horizontally from 50-99, (offset: asl + 50)
- Square numbers correspond to the north pipe
- The assumption that output screen be font courier, on my computer font size 8 works, on the lab computer, it has to be 7 to fit
Outputs and Postconditions: The board I Change in computer: - Return value in register ( ): I do use the registers to check various values
- Postcondition I leave things in what state? I change the A and X registers
Procedure(s) I call: I don't call anything in my procedure, I do branch to my various sections Routine(s) that call me: Main Status: CLEAN and DONE(Top level, written but not tested, buggy, CLEAN AND DONE) Internal documentation: ROutput: BR MainC1R ;branch to start
;****Thomas test code Start****
Thomas' test code goes here
;*****Thomas test code End*****
;****VariablesStart****
RPipeHOn: .BLOCK 2 ;the horizontal number output
RPipeVOn: .BLOCK 2 ;the vertical number output
RVertJ: .BLOCK 2 ;vertical line count
RHorzJ: .BLOCK 2 ;horizontal line count
RSquaJ: .BLOCK 2 ;square count
ROffsJ: .BLOCK 2 ;offset count
RStar: .EQUATE 0x002A ;star output
RVert: .EQUATE 0x007C ;vertical output
RHorz: .EQUATE 0x003D ;equal output
RNMSpace: .EQUATE 0x0020 ;space output
RLfeed: .EQUATE 0x000A ;new line
Rvcols: .WORD 0 ;when to get a new line for horizontal
Rhcols: .WORD 0 ;when to get a new line for vertical
Rvoffset: .WORD 0 ;vertical offset
Rhoffset: .WORD 0 ;horizontal offset
;*****VariablesEnd*****
;****CasesStart****
;**Horizontal Cases**
HCase0R: CHARO RNMSpace,i ;output single space
DECO RPipeHOn,d ;unused
CHARO RNMSpace,i ;output single space
BR HCOutR
HCase1R: CHARO RNMSpace,i ;used
CHARO RHorz,i
CHARO RHorz,i
CHARO RNMSpace,i
HCOutR: LDA RPipeHOn,d ;load the pipe that is being output
ADDA 1,i ;increment the pipe that is being output
STA RPipeHOn,d ;restore the pipe that is being output
CHARO RNMSpace,i
CHARO RStar,i ;output first star
CHARO RStar,i
CHARO RNMSpace,i ;output star
BR HBackR ;branch to procedure
;**Special Verticle Cases**
VCase00R: DECO RPipeVOn,d ;unused
BR VsCaseOR
VCase01R: CHARO RVert,i
CHARO RVert,i ;used
VsCaseOR: LDA RPipeVOn,d ;load the pipe that is being output
ADDA 1,i ;increment the pipe that is being output
STA RPipeVOn,d ;restore the pipe that is being output
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
BR VDoR ;branch to procedure
;**Verticle Cases**
VCase0R: DECO RPipeVOn,d ;unused
BR VCOutR
VCase1R: CHARO RVert,i
CHARO RVert,i ;used
VCOutR: LDA RPipeVOn,d ;load the pipe that is being output
ADDA 1,i ;increment the pipe that is being output
STA RPipeVOn,d ;restore the pipe that is being output
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
BR VBackR ;branch to procedure
;**Square Cases**
SCase0R: CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i ;output NMSpace
BR SCOutR
SCase1R: STBYTEA -2,s ;store the char from the A register onto the stack
CHARO " ",i
CHARO -2,s ;output the character
SCOutR: CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i ;output NMSpace
BR SBackR
;**Offset Cases**
OCaseHR: LDA cols,d
STA Rhcols,d ;initialize Max horizontal output
LDA 0x0000,i
STA ROffsJ,d ;initialize the count
STA RSquaJ,d ;initialize the squares count
CPA RVertJ,d ;compare count to the current vertical line
OHForR: BREQ OCHOutR ;if equal, branch out
ADDA 1,i
STA ROffsJ,d ;else add one to count
LDA Rhcols,d
ADDA Rhoffset,d
STA Rhcols,d ;add the offset to the number to get a new line
LDA ROffsJ,d ;load count
CPA RVertJ,d ;compare count to vertical line
BR OHForR ;branch to for
OCHOutR: LDA Rhcols,d
SUBA Rhoffset,d ;subtract the offset from the start count
STA ROffsJ,d
STA RSquaJ,d
BR OHBackR ;branch to main program
OCaseVR: LDA cols,d
STA Rvcols,d ;initialize Max vertical output
LDA 0x0000,i
STA ROffsJ,d ;initialize the count
CPA RVertJ,d ;compare count to the current vertical line
OVForR: BREQ OCVOutR ;if equal, branch out
ADDA 1,i
STA ROffsJ,d ;else add one to count
LDA Rvcols,d
ADDA Rvoffset,d
STA Rvcols,d ;add the offset to the number to get a new line
LDA ROffsJ,d ;load count
CPA RVertJ,d ;compare count to vertical line
BR OVForR ;branch to for
OCVOutR: LDA Rvcols,d
SUBA Rhoffset,d
STA ROffsJ,d ;subtract the offset from the start count
BR OVBackR ;branch to main program
;*****CasesEnd*****
;****StartStart****
MainC1R: LDA 0x0000,i
STA RVertJ,d
STA RHorzJ,d
STA RSquaJ,d
STA ROffsJ,d
LDA 10,i
STA RPipeHOn,d ;initialize Horizontal pipe
LDA 50,i
STA RPipeVOn,d ;initialize Verticle pipe
LDA cols,d
STA Rhoffset,d ;initialize horizontal offset
ADDA 1,i
STA Rvoffset,d ;initialize vertical offset
BR MainC2R ;branch to horizontal line output
;*****StartEnd*****
;****HorzLineStart****
MainC2R: CHARO RLfeed,i ;output new line
CHARO RStar,i ;output first star
CHARO RStar,i
CHARO RNMSpace,i
BR OCaseHR
OHBackR: LDX ROffsJ,d ;check it gets back
HDoR:ASLX ;offset step 1
LDA PipeH,x ;Load PipeH[x]
CPA 0x0000,i ;check if unused
BREQ HCase0R ;if unused, break to Case 0
BR HCase1R ;else break to Case 1
HBackR: LDX ROffsJ,d
ADDX 1,i ;increment horizontal count
STX ROffsJ,d ;restore horizontal count
HWhile1R: CPX Rhcols,d ;compare to max dots across
HWhile2R: BRLT HDoR ;If less than, do
CHARO RLfeed,i ;output new line
BR MainC3R ;else break to next procedure
;*****HorzLineEnd*****
;****DoneCheckStart****
MainC3R: LDA RVertJ,d
CPA rows,d ;compare to max dots down
BREQ MainC7R ;else, go to last procedure
BR MainC4R ;if less than, go to next procedure
;*****DoneCheckEnd*****
;****ExtraOut1Start****
MainC4R: LDX 0x0000,i
STX ROffsJ,d ;initialize horizontal count
CPX cols,d ;compare to max dots across
EO1ForR: BRGT MainC5R ;if greater than, break to next procedure
CHARO RVert,i
CHARO RVert,i ;else, output the vertLine
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
ADDX 1,i ;increment horizontal count
STX ROffsJ,d ;restore horizontal count
CPX cols,d ;compare to max dots across
BR EO1ForR ;branch to for loop
;*****ExtraOut1End*****
;****VertLineStart****
MainC5R: CHARO RLfeed,i ;output new line
BR OCaseVR
OVBackR: LDX ROffsJ,d ;check it gets back
ASLX ;offset step 1
LDA PipeV,x ;Load PipeV[x]
CPA 0x0000,i ;check if unused
BREQ VCase00R ;if unused, break to Case 0
BR VCase01R ;else break to Case 1
LDA 0x0000,i ;reset A register
VDoR: LDX RSquaJ,d
ASLX
LDBYTEA Squares,x ;load the upper byte of squares[x] into A
CPA 0x0000,i ;check if unused
BREQ SCase0R ;if unused, break to Case 0
BR SCase1R ;else break to Case 1
SBackR: LDX RSquaJ,d
ADDX 1,i ;increment horizontal count
STX RSquaJ,d ;restore horizontal count
LDX ROffsJ,d
ADDX 1,i
STX ROffsJ,d
ASLX ;offset step 1
LDA PipeV,x ;Load PipeH[x]
CPA 0x0000,i ;check if unused
BREQ VCase0R ;if unused, break to Case 0
BR VCase1R ;else break to Case 1
VBackR: LDX ROffsJ,d
ADDX 1,i ;increment horizontal count
STX RHorzJ,d ;restore horizontal count
VWhile1R: CPX Rvcols,d ;compare to max dots across
VWhile2R: BRLE VDoR ;If less than, do
LDA RVertJ,d
ADDA 1,i
STA RVertJ,d
BR MainC6R ;else break to next procedure
;*****VertLineEnd*****
;****ExtraOut2Start****
MainC6R: CHARO RLfeed,i ;output new line
LDX 0x0000,i
STX ROffsJ,d ;initialize horizontal count
CPX cols,d ;compare to max dots across
EO2ForR: BRGT MainC2R ;if greater than, break to next procedure
CHARO RVert,i
CHARO RVert,i ;else, output the vertLine
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
CHARO RNMSpace,i ;output NMSpace
CHARO RNMSpace,i
ADDX 1,i ;increment horizontal count
STX ROffsJ,d ;restore horizontal count
CPX cols,d ;compare to max dots across
BR EO2ForR ;branch to for loop
;*****ExtraOut2End*****
;****EndStart****
MainC7R: STOP
.END
;RET0 Return to Main procedure
;*****EndEnd***** Outputs For Thomas' Test Code 1: all unfilled
** 10 ** 11 ** 12 ** 13 **
!! !! !! !! !!
50 51 52 53 54
!! !! !! !! !!
** 14 ** 15 ** 16 ** 17 **
!! !! !! !! !!
55 56 57 58 59
!! !! !! !! !!
** 18 ** 19 ** 20 ** 21 **
!! !! !! !! !!
60 61 62 63 64
!! !! !! !! !!
** 22 ** 23 ** 24 ** 25 **
_
For Thomas' Test Code 2: some unfilled some filled
** == ** == ** == ** == **
!! !! !! !! !!
50 !! A !! 53 !!
!! !! !! !! !!
** 14 ** == ** 16 ** == **
!! !! !! !! !!
!! 56 57 !! B !!
!! !! !! !! !!
** == ** 19 ** 20 ** == **
!! !! !! !! !!
60 !! 62 63 !!
!! !! !! !! !!
** 22 ** 23 ** 24 ** == ** Funkiness Fixed For Thomas' Test Code 3: all but one filled
** == ** == ** == ** == **
!! !! !! !! !!
!! B !! A !! B !! A !!
!! !! !! !! !!
** == ** == ** == ** == **
!! !! !! !! !!
!! A !! A !! B !! B !!
!! !! !! !! !!
** == ** == ** == ** == **
!! !! !! !! !!
!! A !! !! A !! B !!
!! !! !! !! !!
** == ** 23 ** == ** == **
_
For all filled in
** == ** == ** == ** == **
!! !! !! !! !!
!! B !! A !! B !! A !!
!! !! !! !! !!
** == ** == ** == ** == **
!! !! !! !! !!
!! A !! A !! B !! B !!
!! !! !! !! !!
** == ** == ** == ** == **
!! !! !! !! !!
!! A !! A !! A !! B !!
!! !! !! !! !!
** == ** == ** == ** == **
_
Everything lines up now and it runs in about 1 second --- --- Stacey Rosenberg--- --- --- Wednesday December 3 2008 ---
|