Skip to content

Commit

Permalink
Temporary state
Browse files Browse the repository at this point in the history
  • Loading branch information
rmsk2 committed Dec 21, 2022
1 parent 03d7954 commit 0b9bdb3
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arith16.a
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ USE_MUL_TABLE = 1
; the immediate value given in .value.
;
; Z flag is set in case these values are equal. Carry is set
; if .value is greater or equal than the value store at .memAddr
; if .value is greater or equal than the value stored at .memAddr
; --------------------------------------------------
!macro cmp16BitImmediate .value, .memAddr {
lda #>.value
Expand Down
13 changes: 13 additions & 0 deletions arith32.a
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
; --------------------------------------------------


; --------------------------------------------------
; This subroutine expects its operand in the zero page pointer ADDR_OPER_LEFT and clears
; it, i.e. sets its value tp +0
; --------------------------------------------------
clear32Bit
ldy #4
lda #0
.loopClear
sta (ADDR_OPER_LEFT), y
dey
bpl .loopClear
rts

; --------------------------------------------------
; This subroutine expects it operands in the zero page pointers ADDR_OPER_LEFT and ADDR_OPER_RIGHT
; and adds them. This routine ignores the sign byte.
Expand Down
12 changes: 11 additions & 1 deletion main.a
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

RES_X = 320
RES_Y = 240
MAX_ZOOM_LEVEL = 17

ENTRY_POINT
jmp progStart
Expand Down Expand Up @@ -37,7 +38,7 @@ NUM_ITER
!byte 0

; **************************************************
; The following 4 values have to be contiguously laid out
; The following 5 values have to be contiguously laid out
; in memory. The load and save routines expect this.

; x offset to move in complex plane for next point
Expand All @@ -55,6 +56,9 @@ INIT_REAL
; imaginary part of upper left point of picture
INIT_IMAG
!byte 0, 0, 0, $25, 1

ZOOM_LEVEL
!byte 0
; **************************************************

; Number of points (resolution) in x direction
Expand Down Expand Up @@ -306,6 +310,12 @@ mandelLoop
; --------------------------------------------------
progStart
jsr initArithmetic

;jsr bitMapOn
jsr drawZoomRect
jsr waitForKey
jsr drawZoomRect

jsr bitMapOn
jsr mandelLoop
lda .INTERRUPTED
Expand Down
8 changes: 7 additions & 1 deletion mandelhelp.a
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ resetParametersHires
+callFunc move32Bit, DEFAULT_STEP_X, STEP_X
+callFunc move32Bit, DEFAULT_STEP_Y, STEP_Y
+callFunc move32Bit, DEFAULT_INIT_REAL, INIT_REAL
+callFunc move32Bit, DEFAULT_INIT_IMAG, INIT_IMAG
+callFunc move32Bit, DEFAULT_INIT_IMAG, INIT_IMAG
stz ZOOM_LEVEL
rts

; --------------------------------------------------
Expand All @@ -19,8 +20,13 @@ resetParametersHires
; increaseZoomLevel has no return value.
; --------------------------------------------------
increaseZoomLevel
lda ZOOM_LEVEL
cmp #MAX_ZOOM_LEVEL
bcs .zoomDone
inc ZOOM_LEVEL
+callFuncMono halve32Bit, STEP_X
+callFuncMono halve32Bit, STEP_Y
.zoomDone
rts

.TEMP_X
Expand Down
74 changes: 73 additions & 1 deletion vera.a
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ VERA_DATA_0 = $9F23
CINT = $FF81
screen_mode = $FF5F


; --------------------------------------------------
; This routine set the next point in a colour defined by
; NUM_ITER.
Expand Down Expand Up @@ -52,4 +51,77 @@ bitMapOn
; --------------------------------------------------
bitMapOff
jsr CINT
rts

ZOOM_DIFF
!byte 0

REV_X
!byte 0, 0
REV_Y
!byte 0

TEMP_32_X
!byte 0, 0, 0, 0, 0

TEMP_32_Y
!byte 0, 0, 0, 0, 0

reversePixel
; calculate Video RAM address
+callFuncMono clear32Bit, TEMP_32_X
+callFuncMono clear32Bit, TEMP_32_Y
lda REV_Y
sta TEMP_32_Y + 1
+move16Bit REV_X, TEMP_32_X + 1
+callFunc mul32BitUnsignedInt, TEMP_32_Y, TEMP_32_X
+printFixedPoint TEMP_32_X

; select data port 0
lda #%11111110
and VERA_CTRL
sta VERA_CTRL

; copy video RAM addresses
lda TEMP_32_X
sta VERA
lda TEMP_32_X + 1
sta VERA + 1
lda TEMP_32_X + 2
sta VERA + 2 ; also set increment to 0 and no decrement
; modify video RAM
lda VERA_DATA_0
eor #$FF
sta VERA_DATA_0

rts

ZOOM_X_SIZE
!byte $40, $01
ZOOM_Y_SIZE
!byte 240

ZOOM_X_POS
!byte 0,0
ZOOM_Y_POS
!byte 0
; --------------------------------------------------
; This routine draws a rectangle on the bitmap screen which symbolizes the
; zoom level.
;
; drawZoomRect has no return value
; --------------------------------------------------
drawZoomRect
+move16Bit ZOOM_X_POS, REV_X
lda ZOOM_Y_POS
sta REV_Y
.loopZoomX
jsr reversePixel
+inc16Bit REV_X
+cmp16BitImmediate RES_X, REV_X
; php
; +printByteLN REV_X
; plp
bne .loopZoomX

rts

0 comments on commit 0b9bdb3

Please sign in to comment.