Partialy implement text writing
This commit is contained in:
parent
eb7b195cd2
commit
1d4efe6725
4 changed files with 60 additions and 41 deletions
|
@ -21,6 +21,8 @@ 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
|
||||||
|
|
||||||
|
Character_generator_ROM = $D000
|
||||||
|
|
||||||
;;Free upp memory
|
;;Free upp memory
|
||||||
;;https://www.c64-wiki.com/wiki/Bank_Switching
|
;;https://www.c64-wiki.com/wiki/Bank_Switching
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
FEATURES {
|
|
||||||
STARTADDRESS: default = $0400;
|
|
||||||
}
|
|
||||||
SYMBOLS {
|
|
||||||
__LOADADDR__: type = import;
|
|
||||||
}
|
|
||||||
MEMORY {
|
|
||||||
ZP: file = "", start = $0002, size = $00FE, define = yes;
|
|
||||||
LOADADDR: file = %O, start = %S - 2, size = $0002;
|
|
||||||
MAIN: file = %O, start = %S, size = $D000 - %S;
|
|
||||||
}
|
|
||||||
SEGMENTS {
|
|
||||||
ZEROPAGE: load = ZP, type = zp, optional = yes;
|
|
||||||
LOADADDR: load = LOADADDR, type = ro;
|
|
||||||
EXEHDR: load = MAIN, type = ro, optional = yes;
|
|
||||||
CODE: load = MAIN, type = rw;
|
|
||||||
RODATA: load = MAIN, type = ro, optional = yes;
|
|
||||||
DATA: load = MAIN, type = rw, optional = yes;
|
|
||||||
BSS: load = MAIN, type = bss, optional = yes, define = yes;
|
|
||||||
}
|
|
|
@ -37,6 +37,18 @@
|
||||||
STA hi
|
STA hi
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
.macro Add_16_A a_low, a_hi, b_hi, fast_unsafe
|
||||||
|
;; IF to run it fast
|
||||||
|
.ifblank fast_unsafe
|
||||||
|
CLC
|
||||||
|
.endif
|
||||||
|
ADC a_low
|
||||||
|
STA a_low
|
||||||
|
LDA b_hi
|
||||||
|
ADC a_hi
|
||||||
|
STA a_hi
|
||||||
|
.endmacro
|
||||||
|
|
||||||
;; Subtraction uses the A register
|
;; Subtraction uses the A register
|
||||||
;; a = a - b
|
;; a = a - b
|
||||||
.macro Sub_16 a_low, a_hi, b_low, b_hi, fast_unsafe
|
.macro Sub_16 a_low, a_hi, b_low, b_hi, fast_unsafe
|
||||||
|
@ -101,17 +113,6 @@
|
||||||
LABEL:
|
LABEL:
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
;.macro Lag_16y a_hi, b_hi,b_low, label
|
|
||||||
; LDA a_hi
|
|
||||||
; CMP b_hi
|
|
||||||
; BCC label
|
|
||||||
; BNE LABEL
|
|
||||||
; ;LDA a_low
|
|
||||||
; CPY b_low
|
|
||||||
; BCC label
|
|
||||||
; LABEL:
|
|
||||||
;.endmacro
|
|
||||||
.macro Lag_16y a_low, a_hi, b_hi, label
|
.macro Lag_16y a_low, a_hi, b_hi, label
|
||||||
LDA a_hi
|
LDA a_hi
|
||||||
CMP b_hi
|
CMP b_hi
|
||||||
|
|
|
@ -1,17 +1,53 @@
|
||||||
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
;; petski: https://www.c64-wiki.com/wiki/File:ASCII-Codes.gif
|
;; petski: https://www.c64-wiki.com/wiki/File:ASCII-Codes.gif
|
||||||
;; d000
|
;;https://www.c64-wiki.com/wiki/Character_set
|
||||||
|
;; Takes in a PETSKI-code in CODE
|
||||||
|
;; And prints it ON X_pos, Y_pos
|
||||||
|
;; Note that this is the real positions divided by 8
|
||||||
.proc text
|
.proc text
|
||||||
;; TESTING OF MEMCPY TEMPERARLY HERE BECAUSE IT WILL USE THAT :)
|
X_pos = $FA
|
||||||
A_start = $FAFB
|
Y_pos = $F9
|
||||||
B_start = $FCFD
|
charset = $FB
|
||||||
B_end = $FEFF
|
code = $FE
|
||||||
|
petski_position = $FEFF ;reuses code:s memory
|
||||||
|
screen_position = $FCFD
|
||||||
|
|
||||||
Mov_16 >B_start, <B_start, #<$D000, #>$D000
|
;#### TEMP INIT DATA ####
|
||||||
Mov_16 >B_end, <B_end, #<($D000+$1F3F), #>($D000 +$1F3F)
|
LDA #$10
|
||||||
|
STA code
|
||||||
|
LDA #$10
|
||||||
|
STA X_pos
|
||||||
|
STA Y_pos
|
||||||
|
|
||||||
Mov_16 >A_start, <A_start, #<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
|
||||||
JSR memcpy
|
STA <petski_position
|
||||||
|
|
||||||
|
;;We need the relative offset for bytes to read and write.
|
||||||
|
;; This is code *10 because 8byte is one character
|
||||||
|
;; *10 = 2*2*2 + 2
|
||||||
|
ASL code ;Will never owerflow 8byte
|
||||||
|
LDY code
|
||||||
|
mult_16 >petski_position, <petski_position ; May overflow 8byte (therefore using 16)
|
||||||
|
mult_16 >petski_position, <petski_position ; May overflow 8byte (therefore using 16)
|
||||||
|
;TYA
|
||||||
|
;Add_16_A >petski_position, <petski_position, #$00
|
||||||
|
|
||||||
|
Add_16 >petski_position, <petski_position, #<Character_generator_ROM , #>Character_generator_ROM
|
||||||
|
|
||||||
|
;;Calculate screen_position to use
|
||||||
|
Mov_16 >screen_position, <screen_position, #<VIC_bank, #>VIC_bank
|
||||||
|
|
||||||
|
;; One character is 8 byte, move these bytes to screen
|
||||||
|
LDY #$07
|
||||||
|
@loop:
|
||||||
|
LDA (>petski_position), Y
|
||||||
|
STA (>screen_position), Y
|
||||||
|
DEY
|
||||||
|
BNE @loop
|
||||||
|
hihi:
|
||||||
|
LDA (>petski_position), Y
|
||||||
|
STA (>screen_position), Y
|
||||||
|
jmp hihi
|
||||||
RTS
|
RTS
|
||||||
.endproc
|
.endproc
|
||||||
|
|
Loading…
Add table
Reference in a new issue