Template
- DATA and RODATA segments added to computer.cfg - RAM memory configuration now starts at to not overwrite the cpu stack - hardware.inc added to handle hardware related constants - constants removed from via.s - constants removed from serial.s - serial_delay from serial.s is now dynamic, dependant on CPU_HZ and baud rate - serial_baud_* functions added to setup 19200 and 9600 baud - mem_copy.s added. data copy functions are to be implemented here - copy_data (mem_copy.s) implemented to copy the DATA segment from ROM to RAM - propper system setup in main.s - Makefile now generates a .map file with the memory map information
72 lines
1.7 KiB
ArmAsm
72 lines
1.7 KiB
ArmAsm
.import serial_setup, serial_print_char, serial_recv_char
|
|
.import copy_data
|
|
|
|
; ---------------
|
|
; ZP
|
|
; ---------------
|
|
.zeropage
|
|
; Zero-page variables ($0000 - $00ff)
|
|
|
|
; ---------------
|
|
; BSS
|
|
; ---------------
|
|
.bss
|
|
; RAM variables ($0200 - $7fff)
|
|
|
|
; ---------------
|
|
; DATA
|
|
; ---------------
|
|
.data
|
|
; Initialized RAM variables ($0200 - $7fff)
|
|
|
|
; ---------------
|
|
; CODE
|
|
; ---------------
|
|
.code
|
|
; Actual program code ($c000 - $fff9)
|
|
reset: ; Program starts here
|
|
; System setup
|
|
sei ; disable interrupts while setting things up
|
|
cld ; clear BCD mode flag (undefined on NMOS 6502, auto cleared on 65C02)
|
|
ldx #$ff
|
|
txs ; Reset stack pointer
|
|
|
|
jsr copy_data ; copy data variables from ROM to RAM
|
|
|
|
jsr serial_setup ; setup serial interface (65C51N). 19200 baud set as default
|
|
|
|
print_hello_world:
|
|
ldx #0
|
|
@loop:
|
|
lda str_hello_world,x ; get char
|
|
beq @end ; IF char is 0, done
|
|
jsr serial_print_char ; send char to console
|
|
inx ; increment x (next char)
|
|
jmp @loop
|
|
@end:
|
|
jmp @end
|
|
|
|
|
|
irq_handler: ; IRQ Handler
|
|
rti ; Do nothing
|
|
|
|
nmi_handler: ; NMI handler
|
|
rti ; Do nothing
|
|
|
|
|
|
; ---------------
|
|
; RODATA
|
|
; ---------------
|
|
.rodata
|
|
; Constants
|
|
str_hello_world: .asciiz "Hello, World!"
|
|
|
|
|
|
; ---------------
|
|
; VECTORS
|
|
; ---------------
|
|
.segment "VECTORS"
|
|
; NMI, RESET and IRQ vectors
|
|
.word nmi_handler
|
|
.word reset
|
|
.word irq_handler
|