Will make the indenting better. Also it will properly use dubble ; for comment blocks

This commit is contained in:
hugova 2025-02-28 18:22:07 +01:00
parent 864b0e659b
commit 9c86b570ed
5 changed files with 106 additions and 143 deletions

View file

@ -1,23 +1,17 @@
;Settings positions
;;Settings positions
CR1 = $d011; ;Grafic settings
VIC_bank_settings = $DD00 ; Vic position
Screen_RAM_settings =$D018 ;Screan ram position relative to vic
;;########## VIC_BANK ################
;;# BITMAP | $4000 -$5F3F
;;# Unused? | $5F3F - $6000
;;# SCREAN RAM (color) | $6000 -$63E7
;;# Unused? | $63E8 - $7FFF
;;#
;;####################################
;########## VIC_BANK ################
;# BITMAP | $4000 -$5F3F
;# Unused? | $5F3F - $6000
;# SCREAN RAM (color) | $6000 -$63E7
;# Unused? | $63E8 - $7FFF
;#
;####################################
;Memory positions
;;Memory positions
VIC_bank = $4000
VIC_bank_end = VIC_bank + $3FFF
@ -27,14 +21,11 @@ Bitmap_end = $5F3F
Screen_RAM = $2000 + VIC_bank
Screen_RAM_end = Screen_RAM + $03E7
;Free upp memory
;https://www.c64-wiki.com/wiki/Bank_Switching
;
;
;Sets grafic mode [Standard bitmap mode]
;https://www.c64-wiki.com/wiki/Standard_Bitmap_Mode
;;Free upp memory
;;https://www.c64-wiki.com/wiki/Bank_Switching
;;
;;Sets grafic mode [Standard bitmap mode]
;;https://www.c64-wiki.com/wiki/Standard_Bitmap_Mode
LDA #%10111111 ; ECM = False
AND CR1
STA CR1
@ -43,9 +34,8 @@ LDA #%00100000; BMM = True
ORA CR1
STA CR1
; Set VIC bank to bank 1
;https://www.c64-wiki.com/wiki/VIC_bank
;;Set VIC bank to bank 1
;;https://www.c64-wiki.com/wiki/VIC_bank
LDA #%11111110 ;bit_0 = False
AND VIC_bank_settings
STA VIC_bank_settings
@ -54,7 +44,7 @@ LDA #%00000010; bit_1 = True
ORA VIC_bank_settings
STA VIC_bank_settings
;Set Scren-RAM to offset 8 ;https://www.c64-wiki.com/wiki/53272 (offset is 8k byte = 1024*8-ich)
;;Set Scren-RAM to offset 8 ;https://www.c64-wiki.com/wiki/53272 (offset is 8k byte = 1024*8-ich)
LDA #%10001111 ; bit_6 =bit_5=bit_4 = Falsw
AND Screen_RAM_settings
STA Screen_RAM_settings
@ -64,8 +54,7 @@ ORA 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
LDA #>VIC_bank
STA $FC
LDA #<VIC_bank
@ -79,7 +68,7 @@ STA $FD
LDA #$0
jsr memory_rec
;Sets the screen color to black and white
;;Sets the screen color to black and white
LDA #>Screen_RAM
STA $FC
LDA #<Screen_RAM
@ -93,7 +82,7 @@ STA $FD
LDA #%11110000
jsr memory_rec
;Converting basic ROM to RAM mohahah
;;Converting basic ROM to RAM mohahah
LDA #$36 ; 00110110
STA $0001
CLI ;Disable interups (not all)

View file

@ -1,15 +1,15 @@
;drawing line from 2 cordinates
;;drawing line from 2 cordinates
.proc line
testing:
;# (X_pos, Y_pos) #
;# * #
;# * #
;# * #
;# (X_end, Y_end) #
;
; NOTE THAT X_pos <= X_end and line is going downwords max 45deg!
;;# (X_pos, Y_pos) #
;;# * #
;;# * #
;;# * #
;;# (X_end, Y_end) #
;;
;;NOTE THAT X_pos <= X_end and line is going downwords max 45deg!
;Not values but register position in memory
;;Not values but register position in memory
X_end = $04
Y_end = $05
X_pos = $FC
@ -18,12 +18,11 @@ testing:
dx = $07
D = $08
;Set values
;;Set values
LDA #$00
STA $FD ; for pixel_draw
;example values ~~~~~ SHOULD BE PRECOMPILED
;;example values ~~~~~ SHOULD BE PRECOMPILED
LDA #$00
STA X_pos
STA Y_pos
@ -36,46 +35,42 @@ testing:
STA dy
LDA #($40 + $40 - $50 )
STA D ; = 2*dy - dx
; ~~~~~~~
;; ~~~~~~~
for_x:
jsr pixel_draw
;;LDY D ; FOR DEBUG
;;If D <= 0 then: skipp
LDX D;
DEX
BMI case_2
case_1:
INC Y_pos
for_x:
jsr pixel_draw
LDY D ; FOR DEBUG
; If D <= 0 then: skipp
LDX D;
DEX
BMI case_2
case_1:
INC Y_pos
;D = D_before -2*dx
LDA dx
ROL A
TAX
LDA D
STX D ; D = -2*dx, A = D_before
SEC
SBC D ; A = D_before -2*dx
STA D;
jmp last
case_2:
;D = D + 2*dx
LDA dx
ROL
CLC
ADC D
STA D
last:
CMP #$00
; increment x untill x == large
INC X_pos
LDA X_pos
CMP #199
BEQ end
JMP for_x
end:
;;D = D_before -2*dx
LDA dx
ROL A
TAX
LDA D
STX D ; D = -2*dx, A = D_before
SEC
SBC D ; A = D_before -2*dx
STA D;
jmp last
case_2:
;;D = D + 2*dx
LDA dx
ROL
CLC
ADC D
STA D
last:
CMP #$00
;;increment x untill x == large
INC X_pos
LDA X_pos
CMP #199
BEQ end
JMP for_x
end:
jmp testing
.endproc

View file

@ -1,22 +1,19 @@
;##### HANDLES BIG MEMORY MANAGMENTS ############
;recursive write to memory.
;;##### HANDLES BIG MEMORY MANAGMENTS ############
;;recursive write to memory.
.proc memory_rec
;;Writes data in A
;;Adress start: $FC, $FB
;;Adress end: $FE, $FD
;Writes data in A
;Adress start: $FC, $FB
;Adress end: $FE, $FD
;;Example [ $FC =$44, $FB =$00, $FE =$45, $FD =$01, A =0]
;;writes zeros in memory from $4400 to $4501.
; Example [ $FC =$44, $FB =$00, $FE =$45, $FD =$01, A =0]
; writes zeros in memory from $4400 to $4501.
;put what to recursive write in Y.
;;put what to recursive write in Y.
LDX #$0
TAY
loop:
;write to byte
loop:
;;write to byte
TYA
STA ($FB ,X)
TAY
@ -28,21 +25,15 @@
BEQ test_1
jmp loop
test_1:
test_1:
LDA $FC
CMP $FE
BEQ test_2
jmp loop
test_2:
;Dont forget to rewrite last byte
test_2:
;;Dont forget to rewrite last byte
TYA
STA ($FB, X)
RTS
.endproc

View file

@ -1,37 +1,33 @@
; Screen print. Draws a pixel at a specified position.
;;Screen print. Draws a pixel at a specified position.
.proc pixel_draw; Draws a pixel at [Y = FB , X = FC, FD]. Y = 0 - 320, X= 0 - 200
;write_byte = 00010000,
;;write_byte = 00010000,
LDA $FC ; X (mod 8)
AND #%00000111
;Store pixel in byte
;;Store pixel in byte
TAX
LDA #%10000000
INX
tt:
tt:
DEX
BEQ end__;Y=0 end this
CLC
CLC
ROR A
jmp tt
end__:
end__:
STA $FE
;FIND THE POSITION IN MEMORY TO WRITE PIXEL
; + + + + + > X
; +
; +
;\/
; Y
;
; Let be this position in memory be stored in [$49, $4A] temporaraly
; pos = x_offset
;;FIND THE POSITION IN MEMORY TO WRITE PIXEL
;; + + + + + > X
;; +
;; +
;;\/
;; Y
;;
;; Let be this position in memory be stored in [$49, $4A] temporaraly
;;pos = x_offset
LDA #%11111000
AND $FC
STA $49
@ -39,35 +35,33 @@
LDA $FD
STA $4A
; y_offset because chuncks aka y_offset_bc
;;y_offset because chuncks aka y_offset_bc
LDA #%00000111 ; A = y (mod 8)
AND $FB
; pos += y_offset_bc
CLC
;;pos += y_offset_bc
CLC
ADC $49
STA $49
LDA #$00
ADC $4A
STA $4A
LDY $FB
LDA #$00
STA $4B
; y =8 translates to 320 bytes.
;;y =8 translates to 320 bytes.
LDA #%11111000 ; A = y - [y (mod 8)]
AND $FB
STA $FB
;We need to A = A*40 =A * 2^3 * 5
; A = A*2^3
;;We need to A = A*40 =A * 2^3 * 5
;;A = A*2^3
mult_16 $FB, $4B
mult_16 $FB, $4B
mult_16 $FB, $4B
; *5
;;*5
Add_16 $49, $4A, $FB, $4B
Add_16 $49, $4A, $FB, $4B
Add_16 $49, $4A, $FB, $4B
@ -76,15 +70,13 @@
STY $FB
;; add offset for where bitmap is
;;add offset for where bitmap is
Add_16 $49, $4A, #<Bitmap, #>Bitmap
;;Let draw some stuff
LDX #$00
LDA $FE
LDA $FE
ORA ($49, X)
STA ($49, X)
RTS
.endproc
.endproc

View file

@ -1,13 +1,9 @@
.include "STARTUP.s"
.include "macros/16aritmatic.s"
.include "routines/memory/line_up.s"
.include "routines/memory/line_down.s"
loop_:
jmp loop_
.include "routines/memory/memory_rec.s"
.include "routines/memory/pixel_draw.s"
;.include "routines/memory/memory.s"