Changed 16-bit value syntax from using > and < in addresses to using +1.

This was recomended by dicander and duunqnd because  A =$ABAC
looks like one address and not 2 zero-page addresses.
This commit is contained in:
hugova 2025-04-28 12:56:52 +02:00
parent 594218d485
commit 7f56f90613
15 changed files with 150 additions and 158 deletions

View file

@ -58,15 +58,15 @@ ORA Screen_RAM_settings
STA Screen_RAM_settings STA Screen_RAM_settings
;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM ;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM
Mov_16 >B_start, <B_start, #<VIC_bank, #>VIC_bank Mov_16 B_start, B_start + 1, #<VIC_bank, #>VIC_bank
Mov_16 >B_end, <B_end, #<$5f3f, #>$5f3f Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f
LDA #$00 LDA #$00
jsr memset jsr memset
;;Sets the screen color to black and white ;;Sets the screen color to black and white
Mov_16 >B_start, <B_start, #<Screen_RAM, #>Screen_RAM Mov_16 B_start, B_start + 1, #<Screen_RAM, #>Screen_RAM
Mov_16 >B_end, <B_end, #<Screen_RAM_end, #>Screen_RAM_end Mov_16 B_end, B_end + 1, #<Screen_RAM_end, #>Screen_RAM_end
LDA #%11110000 LDA #%11110000
jsr memset jsr memset
SEI ;Disable interups (not all) SEI ;Disable interups (not all)

View file

@ -5,13 +5,13 @@
Y_end = $F0 Y_end = $F0
dx = $F3 dx = $F3
dy = $F1 dy = $F1
dy_2 = $F1F2 dy_2 = $F1 ; 16-bit value (uses F2)
dx_2 = $F3F4 dx_2 = $F3 ; 16-bit value (uses F4)
V = $EDEE V = $ED ; 16-bit value (uses EE)
D = $EBEC D = $EB ; 16-bit value (uses EC)
;;These come from mem.inc ;; These come from mem.inc
;; Takes up FF - F5 ;; Takes up FF - F5
X_pos = $FC X_pos = $FC
Y_pos = $FB Y_pos = $FB
byte_to_paint = $FE ;Byte with one 1 that corisponds to a pixel. byte_to_paint = $FE ; Byte with one 1 that corisponds to a pixel.
btp_mem_pos =$F9FA; byte to paint memory position ;Position of byte on screen btp_mem_pos =$F9 ; 16-bit value (uses FA), byte to paint memory position

View file

@ -2,8 +2,6 @@
.proc line; X_pos =< X_end skall alltid gälla .proc line; X_pos =< X_end skall alltid gälla
.include "line.inc" .include "line.inc"
; dx_ = $0c
; dy_ = $06
;;dx ;;dx
SEC SEC
LDA X_end LDA X_end

View file

@ -14,19 +14,19 @@
;;We need to clear this memory ;;We need to clear this memory
LDA #$00 LDA #$00
STA <V STA V +1
STA <dy_2 STA dy_2 +1
STA $FD ; for pixel_draw STA $FD ; for pixel_draw
;; V = 2*(dx -dy) ;; V = 2*(dx -dy)
SEC SEC
LDA dx LDA dx
SBC dy SBC dy
STA >V STA V
Mult_16 >V, <V Mult_16 V, V +1
;dy_2 = dy*2 ;dy_2 = dy*2
Mult_16 >dy_2, <dy_2 ;>dy_2 = dy (same address) Mult_16 dy_2, dy_2 +1 ;>dy_2 = dy (same address)
;; This is an Bresenham's line algorithm, se wikipedia bellow. ;; This is an Bresenham's line algorithm, se wikipedia bellow.
;;https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm ;;https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
@ -39,9 +39,9 @@
;; and to its branch logic later in the loop. ;; and to its branch logic later in the loop.
;;D = 2*dy - dx + 2*255 ;;D = 2*dy - dx + 2*255
Mov_16 >D, <D, >dy_2, <dy_2 Mov_16 D, D + 1, dy_2, dy_2 +1
Add_16 >D, <D, #$ff, #$01, ! Add_16 D, D + 1, #$ff, #$01, !
Sub_16 >D, <D, dx, #$00 Sub_16 D, D + 1, dx, #$00
selfmod: selfmod:
;; Self modifying code. Makes LDA and SBC instructions each take 1 cycle less. ;; Self modifying code. Makes LDA and SBC instructions each take 1 cycle less.
@ -50,17 +50,17 @@ selfmod:
;address that needs to be modified ;address that needs to be modified
;; dy_2 ;; dy_2
;; Modifies LDA >dy_2 ;; Modifies LDA >dy_2
LDA >dy_2 LDA dy_2
STA case_2 +1 STA case_2 +1
;; Modifies LDA <dy_2 ;; Modifies LDA <dy_2
LDA <dy_2 LDA dy_2 + 1
STA case_2 +7 STA case_2 +7
;; V ;; V
;;Modidies SBC >V ;;Modidies SBC >V
LDA >V LDA V
STA case_1 +1 STA case_1 +1
;; Modifies SBC <V ;; Modifies SBC <V
LDA <V LDA V +1
STA case_1 +7 STA case_1 +7
end_selfmod: end_selfmod:
JSR pixel_draw ;;only used first pixel. after this relative position is abused JSR pixel_draw ;;only used first pixel. after this relative position is abused
@ -71,8 +71,8 @@ for_x:
;; Paints A to address in |btp_mem_pos* + Y| ;; Paints A to address in |btp_mem_pos* + Y|
;; Y is pixel position in the chunk. Therefor it may be that Y = 0, 1, 2, 3, 4, ,5 ,6 ,7. ;; Y is pixel position in the chunk. Therefor it may be that Y = 0, 1, 2, 3, 4, ,5 ,6 ,7.
LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk. LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk.
ORA (>btp_mem_pos), Y ORA (btp_mem_pos), Y
STA (>btp_mem_pos), Y STA (btp_mem_pos), Y
increment_pixel_x: increment_pixel_x:
LSR byte_to_paint ; Rotates the pixel one bit to the left ON THE SCREEN. LSR byte_to_paint ; Rotates the pixel one bit to the left ON THE SCREEN.
BCC increment_pixel_x_end; We need to move to the next chunk BCC increment_pixel_x_end; We need to move to the next chunk
@ -80,7 +80,7 @@ move_8px_left:
;; Next chunk is 8 addresses away. Look in pixel_draw for more detail. ;; Next chunk is 8 addresses away. Look in pixel_draw for more detail.
;; -8. ;; -8.
;; C = 1 therefore you se 07 ;; C = 1 therefore you se 07
Add_16 >btp_mem_pos, <btp_mem_pos, #$07, #$00, ! Add_16 btp_mem_pos, btp_mem_pos +1, #$07, #$00, !
;; Restores byte to paint ;; Restores byte to paint
LDA #%10000000 LDA #%10000000
STA byte_to_paint STA byte_to_paint
@ -89,13 +89,13 @@ increment_pixel_x_end:
BEQ end ;We keep track on when to stop line draw with the X registry. BEQ end ;We keep track on when to stop line draw with the X registry.
;;If D < %00000010 00000000: case_2 ;;If D < %00000010 00000000: case_2
;;else case 1. ;;else case 1.
Lag_16 >D, <D, #$00, #$02, case_2 Lag_16 D, D + 1, #$00, #$02, case_2
case_1: case_1:
;; D = D - V ;; D = D - V
;; Because Lag_16: ;; Because Lag_16:
;; C =1 so we can use ! ;; C =1 so we can use !
;; A = >D ;; A = >D
Sub_16_A >D, <D, #>V, #<V, ! Sub_16_A D, D + 1, #>V, #<V, !
increment_y_pos: increment_y_pos:
INY ; Increment Y pos inside the buffer INY ; Increment Y pos inside the buffer
CPY #$08 CPY #$08
@ -105,11 +105,11 @@ move_8px_down: ; Z=1 --> C=1
;; Switch to chunk bellow ;; Switch to chunk bellow
; C = 1 ; C = 1
; So we subtract #$3F, #$01 +C ; So we subtract #$3F, #$01 +C
Add_16 >btp_mem_pos, <btp_mem_pos, #$3F, #$01, !; +320 Add_16 btp_mem_pos, btp_mem_pos +1, #$3F, #$01, !; +320
JMP for_x JMP for_x
increment_y_pos_end: increment_y_pos_end:
case_2: case_2:
Add_16 >D, <D, #>dy_2, #<dy_2, ! ;D = D + 2*dy Add_16 D, D + 1, #>dy_2, #<dy_2, ! ;D = D + 2*dy
JMP for_x JMP for_x
end: end:
RTS RTS

View file

@ -12,65 +12,65 @@
.include "line.inc"; Defines memory positions, ex X_pos .include "line.inc"; Defines memory positions, ex X_pos
LDA #$00 LDA #$00
STA <V STA V + 1
STA <dx_2 STA dx_2 + 1
STA $FD STA $FD
SEC SEC
LDA dy LDA dy
SBC dx SBC dx
STA >V STA V
Mult_16 >V, <V Mult_16 V, V + 1
Mult_16 >dx_2, <dx_2 Mult_16 dx_2, dx_2 + 1
Mov_16 >D, <D, >dx_2, <dx_2 Mov_16 D, D + 1, dx_2, dx_2 + 1
Add_16 >D, <D, #$ff, #$01, ! Add_16 D, D + 1, #$ff, #$01, !
Sub_16 >D, <D, dy, #$00 Sub_16 D, D + 1, dy, #$00
selfmod: selfmod:
LDA >dx_2 LDA dx_2
STA case_2 +1 STA case_2 + 1
LDA <dx_2 LDA dx_2 + 1
STA case_2 +7 STA case_2 + 7
LDA >V LDA V
STA case_1 +1 STA case_1 + 1
LDA <V LDA V + 1
STA case_1 +7 STA case_1 + 7
end_selfmod: end_selfmod:
jsr pixel_draw jsr pixel_draw
LDY #$00 LDY #$00
LDX dy LDX dy
for_y: for_y:
LDA byte_to_paint LDA byte_to_paint
ORA (>btp_mem_pos), Y ORA (btp_mem_pos), Y
STA (>btp_mem_pos), Y STA (btp_mem_pos), Y
increment_y_pos: increment_y_pos:
INY INY
CPY #$08 CPY #$08
BNE increment_y_pos_end BNE increment_y_pos_end
move_8px_down: move_8px_down:
LDY #$00 LDY #$00
Add_16 >btp_mem_pos, <btp_mem_pos, #$3F ,#$01, ! Add_16 btp_mem_pos, btp_mem_pos + 1, #$3F ,#$01, !
increment_y_pos_end: increment_y_pos_end:
DEX DEX
;CPX Y_end ;CPX Y_end
BEQ end BEQ end
Lag_16 >D, <D, #$00, #$02, case_2 Lag_16 D, D + 1, #$00, #$02, case_2
case_1: case_1:
Sub_16_A >D, <D, #>V, #<V, ! Sub_16_A D, D + 1, #>V, #<V, !
increment_pixel_x: increment_pixel_x:
LDA byte_to_paint LDA byte_to_paint
LSR byte_to_paint LSR byte_to_paint
BCC for_y BCC for_y
move_8px_left: move_8px_left:
Add_16 >btp_mem_pos, <btp_mem_pos, #$07, #$00, ! Add_16 btp_mem_pos, btp_mem_pos + 1, #$07, #$00, !
LDA #%10000000 LDA #%10000000
STA byte_to_paint STA byte_to_paint
JMP for_y JMP for_y
case_2: case_2:
Add_16 >D, <D, #>dx_2, #<dx_2, ! ;D = D + 2*dx Add_16 D, D + 1, #>dx_2, #<dx_2, ! ;D = D + 2*dx
JMP for_y JMP for_y
end: end:
RTS RTS

View file

@ -46,13 +46,13 @@ end__:
end: end:
;;Long lines ;;Long lines
;;Lets cleer bitmap ;;Lets cleer bitmap
B_start = $FCFD B_start = $FC ;16-bit value (uses FD)
B_end = $FEFF B_end = $FE ;16-bit value (uses FF)
VIC_bank = $4000 VIC_bank = $4000
VIC_bank_end = VIC_bank + $3FFF VIC_bank_end = VIC_bank + $3FFF
;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM ;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM
Mov_16 >B_start, <B_start, #<VIC_bank, #>VIC_bank Mov_16 B_start, B_start + 1, #<VIC_bank, #>VIC_bank
Mov_16 >B_end, <B_end, #<$5f3f, #>$5f3f Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f
LDA #$00 LDA #$00
jsr memset jsr memset

View file

@ -33,17 +33,14 @@
jmp @loop jmp @loop
end__: end__:
;;Lets cleer bitmap ;;Lets cleer bitmap
B_start = $FCFD B_start = $FCFD ;16-bit value (uses FD)
B_end = $FEFF B_end = $FEFF ;16-bit value (uses FF)
VIC_bank = $4000 VIC_bank = $4000
VIC_bank_end = VIC_bank + $3FFF VIC_bank_end = VIC_bank + $3FFF
;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM ;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM
Mov_16 >B_start, <B_start, #<VIC_bank, #>VIC_bank Mov_16 B_start, B_start + 1, #<VIC_bank, #>VIC_bank
Mov_16 >B_end, <B_end, #<$5f3f, #>$5f3f Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f
LDA #$00 LDA #$00
jsr memset jsr memset
jmp exit jmp exit
.endscope .endscope

View file

@ -14,64 +14,64 @@
.include "line.inc"; Defines memory positions, ex X_pos .include "line.inc"; Defines memory positions, ex X_pos
LDA #$00 LDA #$00
STA <V STA V + 1
STA <dy_2 STA dy_2 + 1
STA $FD STA $FD
SEC SEC
LDA dx LDA dx
SBC dy SBC dy
STA >V STA V
Mult_16 >V, <V Mult_16 V, V + 1
Mult_16 >dy_2, <dy_2 Mult_16 dy_2, dy_2 + 1
Mov_16 >D, <D, >dy_2, <dy_2 Mov_16 D, D + 1, dy_2, dy_2 + 1
Add_16 >D, <D, #$ff, #$01, ! Add_16 D, D + 1, #$ff, #$01, !
Sub_16 >D, <D, dx, #$00 Sub_16 D, D + 1, dx, #$00
selfmod: selfmod:
LDA >dy_2 LDA dy_2
STA case_2 +1 STA case_2 + 1
LDA <dy_2 LDA dy_2 + 1
STA case_2 +7 STA case_2 + 7
LDA >V LDA V
STA case_1 +1 STA case_1 + 1
LDA <V LDA V + 1
STA case_1 +7 STA case_1 + 7
end_selfmod: end_selfmod:
jsr pixel_draw jsr pixel_draw
Sub_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00 ;; Y has always a offset of at least 1 Sub_16 btp_mem_pos, btp_mem_pos + 1, #$01, #$00 ;; Y has always a offset of at least 1
LDY #$01 LDY #$01
LDX dx LDX dx
for_x: for_x:
LDA byte_to_paint LDA byte_to_paint
ORA (>btp_mem_pos), Y ORA (btp_mem_pos), Y
STA (>btp_mem_pos), Y STA (btp_mem_pos), Y
increment_pixel_x: increment_pixel_x:
LSR byte_to_paint LSR byte_to_paint
BCC increment_pixel_x_end BCC increment_pixel_x_end
move_8px_left: move_8px_left:
Add_16 >btp_mem_pos, <btp_mem_pos, #$07, #$00,! Add_16 btp_mem_pos, btp_mem_pos + 1, #$07, #$00,!
LDA #%10000000 LDA #%10000000
STA byte_to_paint STA byte_to_paint
increment_pixel_x_end: increment_pixel_x_end:
DEX DEX
;CPX X_end ;CPX X_end
BEQ end BEQ end
Lag_16 >D, <D, #$00, #$02, case_2 Lag_16 D, D + 1, #$00, #$02, case_2
case_1: case_1:
Sub_16_A >D, <D, #>V, #<V,! Sub_16_A D, D + 1, #>V, #<V,!
decrement_y_pos: decrement_y_pos:
DEY DEY
BNE for_x BNE for_x
move_8px_up: move_8px_up:
LDY #$08 LDY #$08
Sub_16 >btp_mem_pos, <btp_mem_pos, #$40, #$01, ! Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01, !
jmp for_x jmp for_x
decrement_y_pos_end: decrement_y_pos_end:
case_2: case_2:
Add_16 >D, <D, #>dy_2, #<dy_2,! Add_16 D, D + 1, #>dy_2, #<dy_2,!
JMP for_x JMP for_x
end: end:
RTS RTS

View file

@ -13,63 +13,63 @@
.include "line.inc"; Defines memory positions, ex X_pos .include "line.inc"; Defines memory positions, ex X_pos
LDA #$00 LDA #$00
STA <V STA V + 1
STA <dx_2 STA dx_2 + 1
STA $FD STA $FD
SEC SEC
LDA dy LDA dy
SBC dx SBC dx
STA >V STA V
Mult_16 >V, <V Mult_16 V, V + 1
Mult_16 >dx_2, <dx_2 Mult_16 dx_2, dx_2 + 1
Mov_16 >D, <D, >dx_2, <dx_2 Mov_16 D, D + 1, dx_2, dx_2 + 1
Add_16 >D, <D, #$ff, #$01, ! Add_16 D, D + 1, #$ff, #$01, !
Sub_16 >D, <D, dy, #$00 Sub_16 D, D + 1, dy, #$00
selfmod: selfmod:
LDA >dx_2 LDA dx_2
STA case_2 +1 STA case_2 + 1
LDA <dx_2 LDA dx_2 + 1
STA case_2 +7 STA case_2 + 7
LDA >V LDA V
STA case_1 +1 STA case_1 + 1
LDA <V LDA V + 1
STA case_1 +7 STA case_1 + 7
end_selfmod: end_selfmod:
jsr pixel_draw jsr pixel_draw
LDY #$00 LDY #$00
LDX dy LDX dy
for_y: for_y:
LDA byte_to_paint LDA byte_to_paint
ORA (>btp_mem_pos), Y ORA (btp_mem_pos), Y
STA (>btp_mem_pos), Y STA (btp_mem_pos), Y
decrement_y_pos: decrement_y_pos:
DEY DEY
CPY #$ff CPY #$ff
BNE decrement_y_pos_end BNE decrement_y_pos_end
move_8px_up: move_8px_up:
LDY #$07 LDY #$07
Sub_16>btp_mem_pos, <btp_mem_pos,#$40 , #$01, ! Sub_16 btp_mem_pos, btp_mem_pos + 1,#$40 , #$01, !
decrement_y_pos_end: decrement_y_pos_end:
DEX DEX
BEQ end BEQ end
Lag_16 >D, <D, #$00, #$02, case_2 Lag_16 D, D + 1, #$00, #$02, case_2
case_1: case_1:
Sub_16_A >D, <D, #>V, #<V, ! Sub_16_A D, D + 1, #>V, #<V, !
increment_pixel_x: increment_pixel_x:
LDA byte_to_paint LDA byte_to_paint
LSR byte_to_paint LSR byte_to_paint
BCC for_y BCC for_y
move_8px_left: move_8px_left:
Add_16 >btp_mem_pos, <btp_mem_pos, #$07, #$00,! Add_16 btp_mem_pos, btp_mem_pos + 1, #$07, #$00,!
LDA #%10000000 LDA #%10000000
STA byte_to_paint STA byte_to_paint
JMP for_y JMP for_y
case_2: case_2:
Add_16 >D, <D, #>dx_2, #<dx_2, ! Add_16 D, D + 1, #>dx_2, #<dx_2, !
JMP for_y JMP for_y
end: end:
RTS RTS

View file

@ -1,13 +1,13 @@
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- ;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
;;In use of in memcpy and memset ;;In use of in memcpy and memset
A_start = $FAFB A_start = $FA ; 16-bit value (uses FB)
B_start = $FCFD B_start = $FC ; 16-bit value (uses FD)
B_end = $FEFF B_end = $FE ; 16-bit value (uses FF)
;;In use of by pixel_draw ;;In use of by pixel_draw
Y_pos = $FB Y_pos = $FB
X_pos = $FCFD X_pos = $FCFD
byte_to_paint = $FE byte_to_paint = $FE
btp_mem_pos = $F9FA; byte to paint memory position btp_mem_pos = $F9 ; 16-bit value (uses FA), byte to paint memory position
C = $F7F8 C = $F7 ; 16-bit value (uses F8)
B = $F5F6 B = $F5 ; 16-bit value (uses F6)

View file

@ -8,16 +8,16 @@
;; Let Y + A_start lower nibble represent A_start ;; Let Y + A_start lower nibble represent A_start
;; therefor: A_start = Y - A_start ;; therefor: A_start = Y - A_start
;; With Y we mean what Y will represent later aka >B_start ;; With Y we mean what Y will represent later aka >B_start
Sub_16 >A_start, <A_start, >B_start, #$00 Sub_16 A_start, A_start + 1, B_start, #$00
;;Lets move B_start lover-nibble to Y ;;Lets move B_start lover-nibble to Y
LDY >B_start LDY B_start
LDA #$00 LDA #$00
STA >B_start STA B_start
loop: loop:
Lag_16 >B_end, <B_end, A, <B_start, end_loop Lag_16 B_end, B_end + 1, A, B_start, end_loop
LDA (>B_start), Y LDA (B_start), Y
STA (>A_start), Y STA (A_start), Y
;Tip save time by counting downward, fast to check if Y ==0 // hugo ;Tip save time by counting downward, fast to check if Y ==0 // hugo
INY INY
TYA TYA
@ -25,8 +25,8 @@ loop:
BNE loop BNE loop
;; Fix overflow ;; Fix overflow
LDY #$00 LDY #$00
INC <A_start INC A_start + 1
INC <B_start INC B_start + 1
JMP loop JMP loop
end_loop: end_loop:
RTS RTS

View file

@ -3,13 +3,12 @@
.scope memcpy_test .scope memcpy_test
charset = $FB charset = $FB
code = $FE code = $FE
petski_position = $FEFF ;reuses code:s memory petski_position = $FE ;16-bit value (uses FF), reuses code:s memory
screen_position = $FCFD screen_position = $FC ;16-bit value (uses FD)
Mov_16 B_start, B_start + 1, #<$D000, #>$D000
Mov_16 >B_start, <B_start, #<$D000, #>$D000
;#### TEMP INIT DATA #### ;#### TEMP INIT DATA ####
Mov_16 >B_end, <B_end, #<($D000+$1F3F), #>($D000 +$1F3F) Mov_16 B_end, B_end + 1, #<($D000+$1F3F), #>($D000 +$1F3F)
LDA #$10 LDA #$10
STA code STA code
LDA #$10 LDA #$10
@ -18,11 +17,9 @@
VIC_bank = $4000 VIC_bank = $4000
VIC_bank_end = VIC_bank + $3FFF VIC_bank_end = VIC_bank + $3FFF
Mov_16 >A_start, <A_start, #<VIC_bank, #>VIC_bank Mov_16 A_start, A_start + 1, #<VIC_bank, #>VIC_bank
;We first need to clear some memory
;Mov_16 >A_end, >A_end, #<(VIC_bank+100), #>(VIC_bank +100)
LDA #$00 LDA #$00
JSR memcpy JSR memcpy
STA <petski_position STA petski_position
jmp exit jmp exit
.endscope .endscope

View file

@ -10,22 +10,22 @@
loop: loop:
;;write to byte ;;write to byte
TYA TYA
STA (>B_start ,X) STA (B_start ,X)
Add_16 >B_start, <B_start, #$01, #$00 Add_16 B_start, B_start +1, #$01, #$00
LDA >B_start LDA B_start
CMP >B_end CMP B_end
BEQ test BEQ test
jmp loop jmp loop
test: test:
LDA <B_start LDA B_start +1
CMP <B_end CMP B_end +1
BEQ end BEQ end
jmp loop jmp loop
end: end:
;;Dont forget to rewrite last byte ;;Dont forget to rewrite last byte
TYA TYA
STA (>B_start, X) STA (B_start, X)
RTS RTS
.endproc .endproc

View file

@ -34,10 +34,10 @@ end__:
;;pos = x_offset ;;pos = x_offset
LDA #%11111000 LDA #%11111000
AND >X_pos AND >X_pos
STA >btp_mem_pos STA btp_mem_pos
LDA <X_pos LDA <X_pos
STA <btp_mem_pos STA btp_mem_pos +1
;;The y_pos adds offset because chunk offsets + inside chunk offset. ;;The y_pos adds offset because chunk offsets + inside chunk offset.
;; Adding inside chunk offset ;; Adding inside chunk offset
@ -51,29 +51,29 @@ end__:
CLC CLC
LDA #%11111000 ; A = y - [y (mod 8)] LDA #%11111000 ; A = y - [y (mod 8)]
AND Y_pos AND Y_pos
STA >C STA C
STA >B STA B
LDA #$00 LDA #$00
STA <C STA C+1
STA <B STA B+1
;;We need to calculate C*40. 40 = 2*2*2*(2^2 +1) ;;We need to calculate C*40. 40 = 2*2*2*(2^2 +1)
;; _*2^2 ;; _*2^2
Mult_16 >C, <C Mult_16 C, C+1
Mult_16 >C, <C Mult_16 C, C+1
;; + _*1 ;; + _*1
Add_16 >C, <C, >B, <B, ! Add_16 C, C+1, B, B+1, !
;; *2*2*2 ;; *2*2*2
Mult_16 >C, <C Mult_16 C, C + 1
Mult_16 >C, <C Mult_16 C, C + 1
Mult_16 >C, <C Mult_16 C, C + 1
Add_16 >btp_mem_pos, <btp_mem_pos, >C, <C, ! Add_16 btp_mem_pos, btp_mem_pos + 1, C, C + 1, !
;;add offset for where bitmap is ;;add offset for where bitmap is
Add_16 >btp_mem_pos, <btp_mem_pos, #<Bitmap, #>Bitmap, ! Add_16 btp_mem_pos, btp_mem_pos + 1, #<Bitmap, #>Bitmap, !
;;Let draw some stuff ;;Let draw some stuff
LDA byte_to_paint ;; note that both bytes are used! LDA byte_to_paint ;; note that both bytes are used!

View file

@ -6,7 +6,7 @@
.include "routines/memory/mem.inc" .include "routines/memory/mem.inc"
;;Code to run ;;Code to run
.include "STARTUP.s" .include "STARTUP.s"
.include "routines/line/line_test_time.s" .include "routines/line/line_test.s"
;.include "routines/memory/memcpy_test.s" ;.include "routines/memory/memcpy_test.s"
exit: exit:
jmp exit jmp exit