The first version of the Hello World program in bare metal 65C02 assembler was 342 bytes long. That's quite a lot for such a simple assembler program. We can certainly do better. Since the RAM is not yet fitted subroutines are not yet an option. But we can do loops:
.pc02
.listbytes 16
.pagelength 66
.case -
.macpack generic
.include "VIA.inc"
.include "LCD.inc"
.segment "RODATA"
Message: .byte "Hello World!"
Message_Len = * - Message
.segment "CODE"
Do_RES: LDX #$FF
TXS
Set_A #%11100000 ; Set top 3 pin as output
Set_B #%11111111 ; Set all pins as output
Control_LCD #%00111000 ; Set 8-bit mode; 2 line display; 5×8 font
Control_LCD #%00001110 ; Display in; cursor on; blink off
Control_LCD #%00000110 ; Increment and shift cursor; don't shift display
Control_LCD #%00000001 ; Clear Display
LDX #$00
Loop: Data_LCD {Message,X} ; Write next character to Display
INX
CPX #(Message_Len) ; Repeat loop until X ≥ message lenght
BLT Loop
STP ; Stop Processor
Do_NMI: RTI
Do_IRQ: RTI
.segment "HEADER"
.word Do_NMI
.word Do_RES
.word Do_IRQ
A lot shorter. So what did I do?
The result: The program is down to 135 bytes.
You find the source code for the program with makefile, linker configuration file, include files and assembler source code on GitLab: 6502Tutorial — Tools/Create_LED.