Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! Prints "Hello, world!\n" in the msgarea.
- ! SRCTools version: vph 6/29/00, updated rez 4/16/02
- ! ARCTools version: mww converted 6/17/05
- .begin
- BASE .equ 0x3fffc0 !Starting point of the memory mapped region
- COUT .equ 0x0 !0xffff0000 Console Data Port
- COSTAT .equ 0x4 !0xffff0004 Console Status Port.
- one: 0 !Day one
- two: 0 !Day two
- three: 0 !Day three
- total: -1 !Total days rained
- const1: 1
- const2: 2
- String2: 0x4e, 0
- String: 0x59, 0
- .org 2048
- !---- Loading stuff into registers and adding them
- ld [one], %g5
- ld [two], %g6
- ld [three], %g7
- ld [total], %g9
- ld [const1], %g10
- ld [const2], %g11
- add %g5, %g9, %g9
- add %g6, %g9, %g9
- add %g7, %g9, %g9
- sethi BASE, %r4
- !-- if statement start --------------------------------------------
- cmp %g11, %g9 !-- it rained 3 times
- bge else
- nop
- Loop: ld [%r2 + String], %r3 !Load next char into r3
- addcc %r3,%r0,%r3
- be End ! stop if null.
- Wait: ldub [%r4+COSTAT], %r1
- andcc %r1, 0x80, %r1
- be Wait
- stb %r3, [%r4+COUT] !Print to console
- add %r2, 4, %r2 !increment String offset (r2)
- ba Loop
- and %g8, %g0, %g8
- add %g8, 1, %g8
- ba next
- nop
- !-- else statement start ------------------------------------------
- else: cmp %g9, 1 !--- it rained 2 times
- bge else2
- nop
- Loop2: ld [%r2 + String], %r3 !Load next char into r3
- addcc %r3,%r0,%r3
- be End ! stop if null.
- Wait2: ldub [%r4+COSTAT], %r1
- andcc %r1, 0x80, %r1
- be Wait
- stb %r3, [%r4+COUT] !Print to console
- add %r2, 4, %r2 !increment String offset (r2)
- ba Loop
- and %g8, %g0, %g8
- add %g8, 1, %g8
- ba next
- nop
- !-- rained less than 2 times so turn on
- else2: mov 0, %g8
- Loop3: ld [%r2 + String2], %r3 !Load next char into r3
- addcc %r3,%r0,%r3
- be End ! stop if null.
- Wait3: ldub [%r4+COSTAT], %r1
- andcc %r1, 0x80, %r1
- be Wait
- stb %r3, [%r4+COUT] !Print to console
- add %r2, 4, %r2 !increment String offset (r2)
- ba Loop
- next: or %g8, 42, %g8
- End: halt
- .org 3000
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement