c64-livecoding/wip-hugo/routines/text/text.s

53 lines
1.6 KiB
ArmAsm

;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
;; petski: https://www.c64-wiki.com/wiki/File:ASCII-Codes.gif
;;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
X_pos = $FA
Y_pos = $F9
charset = $FB
code = $FE
petski_position = $FEFF ;reuses code:s memory
screen_position = $FCFD
;#### TEMP INIT DATA ####
LDA #$10
STA code
LDA #$10
STA X_pos
STA Y_pos
;We first need to clear some memory
LDA #$00
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
.endproc