OpenCores
URL https://opencores.org/ocsvn/lattice6502/lattice6502/trunk

Subversion Repositories lattice6502

[/] [lattice6502/] [ghdl/] [usrcode.asm] - Rev 2

Go to most recent revision | Compare with Previous | Blame | View Log

;
        cpu 6502
PAGE 40,120
;       ****************************************************************************************
;       This is intended to be the template for the user code
;       ****************************************************************************************

*       =       $290    ;user code starts at $290
return  equ     $fff6   ;jump to fcoo to return control and restart
sendtxt equ     $fff0
hex2txt equ     $fff3


main    ldy     #$55
        ldx     #$aa
        lda     #$7e
        clc
        adc     #$6     ;9-3=6 carry=0
        php
        pha
        txa
        pha
        tya
        pha

        lda     #"Y"    ;Display Y register     
        jsr     sendtxt
        lda     #"="
        jsr     sendtxt
        pla
        jsr     hex2txt
        lda     #" "
        jsr     sendtxt

        lda     #"X"    ;Display X register     
        jsr     sendtxt
        lda     #"="
        jsr     sendtxt
        pla
        jsr     hex2txt
        lda     #" "
        jsr     sendtxt

        lda     #"A"    ;Display A register     
        jsr     sendtxt
        lda     #"="
        jsr     sendtxt
        pla
        jsr     hex2txt
        lda     #" "
        jsr     sendtxt

        lda     #"C"    ;Display carry
        jsr     sendtxt
        lda     #"="
        jsr     sendtxt
        plp
        php
        bcc     clear1
        lda     #"1"
        jmp     cont1
clear1  lda     #"0"
cont1   jsr     sendtxt
        lda     #" "
        jsr     sendtxt

        lda     #"V"    ;Display overflow
        jsr     sendtxt
        lda     #"="
        jsr     sendtxt
        plp
        php
        bvc     clear2
        lda     #"1"
        jmp     cont2
clear2  lda     #"0"
cont2   jsr     sendtxt 
        lda     #" "
        jsr     sendtxt

        lda     #"Z"    ;Display zero
        jsr     sendtxt
        lda     #"="
        jsr     sendtxt
        plp
        php
        beq     clear3
        lda     #"1"
        jmp     cont3
clear3  lda     #"0"
cont3   jsr     sendtxt
        lda     #" "
        jsr     sendtxt

        lda     #"M"    ;Display minus
        jsr     sendtxt
        lda     #"="
        jsr     sendtxt
        plp
        bpl     clear4
        lda     #"1"
        jmp     cont4
clear4  lda     #"0"
cont4   jsr     sendtxt


        lda     #"\r"
        jsr     sendtxt
        jmp     (return)

;       end of program

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.