Skip to content

Commit

Permalink
Improve PETSCII UI
Browse files Browse the repository at this point in the history
  • Loading branch information
rmsk2 committed Jan 3, 2023
1 parent 9ceb5e0 commit 6ee1c02
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 54 deletions.
87 changes: 35 additions & 52 deletions main.a
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,6 @@ mandelLoop
!byte 18
!tx "STEP Y : $"

.TXT_CONTINUE
!byte 56
!byte 13
!tx "PRESS RETURN TO QUIT."
!byte 13
!tx "PRESS ANY OTHER KEY TO CONTINUE."
!byte 13

; --------------------------------------------------
; This routine performs all neccessary steps for selecting
Expand Down Expand Up @@ -420,42 +413,15 @@ VEC_SPECIAL_PRINT
.specialWrapper
jmp (VEC_SPECIAL_PRINT)

; --------------------------------------------------
; This routine prints the upper left corner as real and imaginary part,
; the zoom level and the iteration depth and allows to recreate the picture
; in absence of a save routine.
;
; It does not return any values.
; --------------------------------------------------
.printLastValues
+printStr .TXT_VALUES
+printStr .TXT_REAL_PART
+printFixedPoint INIT_REAL
+printStr .TXT_IMAGINARY_PART
+printFixedPoint INIT_IMAG
+printStr .TXT_ZOOM_LEVEL
+itoa ZOOM_LEVEL, .STR_CONV
+printStr .STR_CONV
jsr printCRLF
+printStr .TXT_ITERATION_DEPTH
+itoa MAX_ITER, .STR_CONV
+printStr .STR_CONV
jsr printCRLF
+printStr .TXT_STEPPING_X
+printFixedPoint STEP_X
+printStr .TXT_STEPPING_Y
+printFixedPoint STEP_Y

!ifdef ITER_COUNT {
+printStr TXT_ITERATIONS
+printFixedPoint ITER_CTR
!macro printLastValuesAt .xpos, .ypos {
lda #.xpos
sta ORIGIN_X
lda #.ypos
sta ORIGIN_Y
jsr printLastValuesAtCall
}

jsr .specialWrapper

rts


.TXT_VALUES_NO_CR
!byte 27
!tx "VALUES USED FOR CALCULATION"
Expand All @@ -464,8 +430,16 @@ ORIGIN_X
!byte 0
ORIGIN_Y
!byte 0

.printLastValuesAt
; --------------------------------------------------
; This routine prints the current values uses for calculation. Output
; begins at the posotion defined by the values stored at ORIGIN_X and
; ORIGIN_Y. The last line of output is generated by a user defined routine
; the address of which has to be stored in the jmp vector VEC_SPECIAL_PRINT
; before calling this routine.
;
; This routine does not return a value.
; --------------------------------------------------
printLastValuesAtCall
+locateAddr ORIGIN_X, ORIGIN_Y
+printStr .TXT_VALUES_NO_CR
inc ORIGIN_Y
Expand Down Expand Up @@ -509,6 +483,8 @@ ORIGIN_Y
+printFixedPoint ITER_CTR
inc ORIGIN_Y
}

+locateAddr ORIGIN_X, ORIGIN_Y
jsr .specialWrapper

rts
Expand Down Expand Up @@ -676,6 +652,13 @@ loadAndShowPicture
CONST_CONTINUE = 1
CONST_FINISH = 0

.TXT_CONTINUE_1
!byte 38
!tx "- PRESS RETURN TO RETURN TO MAIN MENU."
.TXT_CONTINUE_2
!byte 34
!tx "- PRESS ANY OTHER KEY TO CONTINUE."

; --------------------------------------------------
; This routine shows the values used for calculation.
;
Expand All @@ -687,8 +670,12 @@ showCalcParameters
jsr saveHiresData ; save bitmap in banked RAM
showCalcNoSaveHires
jsr bitMapOff
jsr .printLastValues ; print current values
+printStr .TXT_CONTINUE

+printLastValuesAt MAIN_MENU_X + 6, 17
+printStrAt MAIN_MENU_X, MAIN_MENU_Y, .TXT_CONTINUE_1
+printStrAt MAIN_MENU_X, MAIN_MENU_Y + 2, .TXT_CONTINUE_2
+petsciiRect MAIN_MENU_X - 1, MAIN_MENU_Y - 1, MAIN_MENU_WIDTH, 4, RECT_NO_CLEAR
+petsciiRect MAIN_MENU_X - 1, 16, MAIN_MENU_WIDTH, 9, RECT_NO_CLEAR
jsr waitForKey
cmp #13 ; user pressed return?
beq .endShowContinue ; Yes => Tell caller user wants to stop
Expand Down Expand Up @@ -765,7 +752,7 @@ TIMESTAMP_RUNNING
+getTimeStr .TXT_TIMESTAMP, TIMESTAMP_RUNNING
+printStr .TXT_RUNNING_TIME
+printStr .TXT_TIMESTAMP
jsr printCRLF
;jsr printCRLF
rts


Expand All @@ -778,7 +765,7 @@ TIMESTAMP_RUNNING
+getTimeStr .TXT_TIMESTAMP, .TIMESTAMP_END_TEMP
+printStr .TXT_FINISHED_TIME
+printStr .TXT_TIMESTAMP
jsr printCRLF
;jsr printCRLF
rts


Expand Down Expand Up @@ -841,13 +828,9 @@ showMainMenu
+petsciiRect LOAD_FILE_EDIT_POS_X - 1, LOAD_FILE_EDIT_POS_Y - 1, MAIN_MENU_WIDTH, LOAD_FILE_EDIT_HEIGHT, RECT_NO_CLEAR
+petsciiRect SELECT_ITER_POS_X - 1, SELECT_ITER_POS_Y - 1, MAIN_MENU_WIDTH, SELECT_ITER_HEIGHT, RECT_NO_CLEAR

lda #MAIN_MENU_X + 6
sta ORIGIN_X
lda #SELECT_ITER_POS_Y + 5
sta ORIGIN_Y
+load16BitImmediate .printNothing, VEC_SPECIAL_PRINT
jsr .printLastValuesAt
+petsciiRect MAIN_MENU_X - 1, SELECT_ITER_POS_Y + 4, MAIN_MENU_WIDTH, 8, RECT_NO_CLEAR
+printLastValuesAt MAIN_MENU_X + 6, SELECT_ITER_POS_Y + 5
+petsciiRect MAIN_MENU_X - 1, SELECT_ITER_POS_Y + 4, MAIN_MENU_WIDTH, 9, RECT_NO_CLEAR

.mainMenuInputSelect
; Handle inital menu
Expand Down
7 changes: 5 additions & 2 deletions vera.a
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,9 @@ drawOneLine
jsr vpokeInternal
rts

PETSCII_VERA_STATE
!byte 0,0,0

; --------------------------------------------------
; This routine allows to draw a PETSCII Rectangle on the 80x60 text screen.
;
Expand All @@ -719,7 +722,7 @@ drawOneLine
; the number
; --------------------------------------------------
petsciiRectCall
+saveVeraRegisters SAVED_VERA_STATE
+saveVeraRegisters PETSCII_VERA_STATE
+selectDataPort0
+autoIncOff

Expand Down Expand Up @@ -754,5 +757,5 @@ petsciiRectCall
+load16BitImmediate .LOWER_LINE, DRAW_HELP
jsr drawOneLine

+loadVeraRegisters SAVED_VERA_STATE
+loadVeraRegisters PETSCII_VERA_STATE
rts

0 comments on commit 6ee1c02

Please sign in to comment.