summaryrefslogtreecommitdiff
path: root/assembly/rrxing2
diff options
context:
space:
mode:
Diffstat (limited to 'assembly/rrxing2')
-rw-r--r--assembly/rrxing2/rrxing2.S6
-rw-r--r--assembly/rrxing2/ui.S6
2 files changed, 11 insertions, 1 deletions
diff --git a/assembly/rrxing2/rrxing2.S b/assembly/rrxing2/rrxing2.S
index f2ab068..c94edc0 100644
--- a/assembly/rrxing2/rrxing2.S
+++ b/assembly/rrxing2/rrxing2.S
@@ -90,6 +90,11 @@ and t2,t2,t3
li t3,0x00007463 # 'ct\0\0'
bne t2,t3,1f # not the detector
+la t0,traincounter
+lw t1,0(t0)
+addi t1,t1,1 # Increment train counter
+sw t1,0(t0)
+
la t0,currstate
lb t0,0(t0) # Read current state from RAM
andi t0,t0,0xf # Mask out the country
@@ -357,6 +362,7 @@ country: .byte 0 # 0 = DE, 1 = UK, 2 = US
gatedroptime: .byte 3
activetime: .byte 15
extensiontime: .byte 25
+traincounter: .word 0
uiunimplementedtrap: .asciz "Unimplemented trap!\nmcause: "
channelbuf: .skip 16
diff --git a/assembly/rrxing2/ui.S b/assembly/rrxing2/ui.S
index d6c8cd0..3096105 100644
--- a/assembly/rrxing2/ui.S
+++ b/assembly/rrxing2/ui.S
@@ -717,6 +717,10 @@ call hexdump
la a0,uistatistics+57
rdinstret a1
call hexdump
+la a0,uistatistics+75
+la a1,traincounter
+lw a1,0(a1)
+call hexdump
la a0,uistatistics
li a7,4
ecall
@@ -851,7 +855,7 @@ uilighttest: .asciz "\nROAD SIGNAL TEST\n1: Off | 2: Red\n3: Yellow | 4: Green\n
uisignaltest: .asciz "\nRAIL SIGNAL TEST\n1: Off | 2: Red\n3: Yellow | 4: Green\n5: Flash Red\n6: Flash Yellow\n0: Back"
uibelltest: .asciz "\nBELL TEST\n1: Off\n2: On\n\n\n0: Back"
uigatetest: .asciz "\nGATE TEST\n1: Up\n2: Down\n\n\n0: Back"
-uistatistics: .asciz "\nSTATISTICS\n cycle: XXXXXXXX\n time: XXXXXXXX\ninstret: XXXXXXXX\n\n0: Back"
+uistatistics: .asciz "\nSTATISTICS\n cycle: XXXXXXXX\n time: XXXXXXXX\ninstret: XXXXXXXX\n trains: XXXXXXXX\n0: Back"
uiabout1: .asciz "\nABOUT\nRailroad Crossing 2\nfor RVController\n\n\n1: Next | 0: Exit"
uiabout2: .asciz "\nA product of\nScheiße & Broken\nSignalling Systems,\na Cheapie Systems\ncompany\n1: Next | 0: Exit"
uiabout3: .asciz "\nThis is free and\nunencumbered\nsoftware released\ninto the public\ndomain\n1: Next | 0: Exit"