PR4 ROM LISTING -- PAGE 5

0119+ E09A A9 10 LDA #ROM_VERSION

0120+ E09C 20 36 E8 JSR VOICE_OUTPUT_HEX

0121+ E09F

0122+ E09F ;Check if there's an existing task to return to.

0123+ E09F A5 1C LDA ZP_BATRAM_SET0 ;Can't have an existing task if the battery-capable RAM isn't even set up.

0124+ E0A1 C9 AA CMP #$AA

0125+ E0A3 D0 1F BNE _NO_EXISTING_MODEL

0126+ E0A5 A5 1D LDA ZP_BATRAM_SET1

0127+ E0A7 C9 55 CMP #$55

0128+ E0A9 D0 19 BNE _NO_EXISTING_MODEL

0129+ E0AB

0130+ E0AB A5 1A LDA ZP_OS_STATA

0131+ E0AD 89 10 BIT #OS_STAT_TASK_ACTIVE

0132+ E0AF F0 03 BEQ _NO_EXISTING_TASK

0133+ E0B1 6C 18 40 JMP (TASK_MAIN_ENTRY)

0134+ E0B4

0135+ E0B4 _NO_TASK:

0136+ E0B4 _NO_EXISTING_TASK:

0137+ E0B4 89 04 BIT #OS_STAT_MODEL_PRESENT ;Or a model task to load up.

0138+ E0B6 F0 0C BEQ _NO_EXISTING_MODEL

0139+ E0B8

0140+ E0B8 20 3A E6 JSR TASK_RELOAD_FROM_MODEL ;Attempt to load the task...

0141+ E0BB

0142+ E0BB A9 40 LDA #OS_STAT_ERROR ;Did it load properly?

0143+ E0BD 14 1A TRB ZP_OS_STATA

0144+ E0BF D0 03 BNE _NO_EXISTING_MODEL;Branch if it didn't load properly.

0145+ E0C1

0146+ E0C1 6C 18 40 JMP (TASK_MAIN_ENTRY)

0147+ E0C4

0148+ E0C4 _NO_EXISTING_MODEL:

0149+ E0C4 ;Initialize OS STAT by clearing it. RAM tests will handle the bank information.

0150+ E0C4 64 1A STZ ZP_OS_STATA

0151+ E0C6 A9 AA LDA #$AA

0152+ E0C8 85 1C STA ZP_BATRAM_SET0

0153+ E0CA 46 00 LSR ;$AA>>1 = $55

0154+ E0CC 85 1D STA ZP_BATRAM_SET1

0155+ E0CE

0156+ E0CE A9 FD SAY(msg_test_mem)

0156+ E0D0 85 11

0156+ E0D2 A9 9B

0156+ E0D4 85 10