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

View file

@ -1,15 +1,15 @@
;drawing line from 2 cordinates ;;drawing line from 2 cordinates
.proc line .proc line
testing: testing:
;# (X_pos, Y_pos) # ;;# (X_pos, Y_pos) #
;# * # ;;# * #
;# * # ;;# * #
;# * # ;;# * #
;# (X_end, Y_end) # ;;# (X_end, Y_end) #
; ;;
; NOTE THAT X_pos <= X_end and line is going downwords max 45deg! ;;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 X_end = $04
Y_end = $05 Y_end = $05
X_pos = $FC X_pos = $FC
@ -18,12 +18,11 @@ testing:
dx = $07 dx = $07
D = $08 D = $08
;;Set values
;Set values
LDA #$00 LDA #$00
STA $FD ; for pixel_draw STA $FD ; for pixel_draw
;example values ~~~~~ SHOULD BE PRECOMPILED ;;example values ~~~~~ SHOULD BE PRECOMPILED
LDA #$00 LDA #$00
STA X_pos STA X_pos
STA Y_pos STA Y_pos
@ -36,21 +35,18 @@ testing:
STA dy STA dy
LDA #($40 + $40 - $50 ) LDA #($40 + $40 - $50 )
STA D ; = 2*dy - dx STA D ; = 2*dy - dx
; ~~~~~~~ ;; ~~~~~~~
for_x: for_x:
jsr pixel_draw jsr pixel_draw
LDY D ; FOR DEBUG ;;LDY D ; FOR DEBUG
;;If D <= 0 then: skipp
; If D <= 0 then: skipp
LDX D; LDX D;
DEX DEX
BMI case_2 BMI case_2
case_1: case_1:
INC Y_pos INC Y_pos
;;D = D_before -2*dx
;D = D_before -2*dx
LDA dx LDA dx
ROL A ROL A
TAX TAX
@ -61,7 +57,7 @@ testing:
STA D; STA D;
jmp last jmp last
case_2: case_2:
;D = D + 2*dx ;;D = D + 2*dx
LDA dx LDA dx
ROL ROL
CLC CLC
@ -69,7 +65,7 @@ testing:
STA D STA D
last: last:
CMP #$00 CMP #$00
; increment x untill x == large ;;increment x untill x == large
INC X_pos INC X_pos
LDA X_pos LDA X_pos
CMP #199 CMP #199
@ -77,5 +73,4 @@ testing:
JMP for_x JMP for_x
end: end:
jmp testing jmp testing
.endproc .endproc

View file

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

View file

@ -1,11 +1,10 @@
; 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 .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) LDA $FC ; X (mod 8)
AND #%00000111 AND #%00000111
;Store pixel in byte ;;Store pixel in byte
TAX TAX
LDA #%10000000 LDA #%10000000
INX INX
@ -19,19 +18,16 @@
STA $FE STA $FE
;FIND THE POSITION IN MEMORY TO WRITE PIXEL ;;FIND THE POSITION IN MEMORY TO WRITE PIXEL
;; + + + + + > X
; + + + + + > X ;; +
; + ;; +
; + ;;\/
;\/ ;; Y
; Y ;;
; ;; Let be this position in memory be stored in [$49, $4A] temporaraly
; Let be this position in memory be stored in [$49, $4A] temporaraly
; pos = x_offset
;;pos = x_offset
LDA #%11111000 LDA #%11111000
AND $FC AND $FC
STA $49 STA $49
@ -39,11 +35,11 @@
LDA $FD LDA $FD
STA $4A STA $4A
; y_offset because chuncks aka y_offset_bc ;;y_offset because chuncks aka y_offset_bc
LDA #%00000111 ; A = y (mod 8) LDA #%00000111 ; A = y (mod 8)
AND $FB AND $FB
; pos += y_offset_bc ;;pos += y_offset_bc
CLC CLC
ADC $49 ADC $49
STA $49 STA $49
@ -51,23 +47,21 @@
ADC $4A ADC $4A
STA $4A STA $4A
LDY $FB LDY $FB
LDA #$00 LDA #$00
STA $4B STA $4B
; y =8 translates to 320 bytes. ;;y =8 translates to 320 bytes.
LDA #%11111000 ; A = y - [y (mod 8)] LDA #%11111000 ; A = y - [y (mod 8)]
AND $FB AND $FB
STA $FB STA $FB
;We need to A = A*40 =A * 2^3 * 5 ;;We need to A = A*40 =A * 2^3 * 5
;;A = A*2^3
; A = A*2^3
mult_16 $FB, $4B mult_16 $FB, $4B
mult_16 $FB, $4B 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 Add_16 $49, $4A, $FB, $4B
Add_16 $49, $4A, $FB, $4B Add_16 $49, $4A, $FB, $4B
@ -79,12 +73,10 @@
;;add offset for where bitmap is ;;add offset for where bitmap is
Add_16 $49, $4A, #<Bitmap, #>Bitmap Add_16 $49, $4A, #<Bitmap, #>Bitmap
;;Let draw some stuff ;;Let draw some stuff
LDX #$00 LDX #$00
LDA $FE LDA $FE
ORA ($49, X) ORA ($49, X)
STA ($49, X) STA ($49, X)
RTS RTS
.endproc .endproc

View file

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