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

Subversion Repositories raptor64

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 42 to Rev 43
    Reverse comparison

Rev 42 → Rev 43

/raptor64/trunk/software/rapasm/bin/rapasm.exe Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/raptor64/trunk/software/sample code/bootrom.lst
1,5 → 1,5
; ============================================================================
; (C) 2012 Robert Finch
; (C) 2012,2013 Robert Finch, Stratford
; All Rights Reserved.
; robfinch<remove>@opencores.org
;
25,36 → 25,220
CTRLH EQU 0x08
CTRLS EQU 0x13
CTRLX EQU 0x18
XON EQU 0x11
XOFF EQU 0x13
STACKTOP EQU 0xFFFF_FFFF_FFFE_FFF8
Milliseconds EQU 0x400
Lastloc EQU 0x408
ScreenColor EQU 0x414
CursorRow EQU 0x416
CursorCol EQU 0x418
KeybdEcho EQU 0x41A
KeybdBuffer EQU 0x440
KeybdHead EQU 0x450
KeybdTail EQU 0x451
TEXTSCR EQU 0xFFFF_FFFF_FFD0_0000
COLORSCR EQU 0xFFFF_FFFF_FFD1_0000
TEXTREG EQU 0xFFFFFFFF_FFDA0000
DATA_PRESENT EQU 0x01 ; there is data preset at the serial port bc_uart3
XMIT_NOT_FULL EQU 0x20
BUFLEN EQU 80 ; length of keyboard input buffer
; Initial stack tops for contexts
; Each context gets 1k from the special 16k startup stack memory
;
STACKTOP0 EQU 0xFFFF_FFFF_FFFE_FFF8
STACKTOP1 EQU 0xFFFF_FFFF_FFFE_FBF8
STACKTOP2 EQU 0xFFFF_FFFF_FFFE_F7F8
STACKTOP3 EQU 0xFFFF_FFFF_FFFE_F3F8
STACKTOP4 EQU 0xFFFF_FFFF_FFFE_EFF8
STACKTOP5 EQU 0xFFFF_FFFF_FFFE_EBF8
STACKTOP6 EQU 0xFFFF_FFFF_FFFE_E7F8
STACKTOP7 EQU 0xFFFF_FFFF_FFFE_E3F8
STACKTOP8 EQU 0xFFFF_FFFF_FFFE_DFF8
STACKTOP9 EQU 0xFFFF_FFFF_FFFE_DBF8
STACKTOP10 EQU 0xFFFF_FFFF_FFFE_D7F8
STACKTOP11 EQU 0xFFFF_FFFF_FFFE_D3F8
STACKTOP12 EQU 0xFFFF_FFFF_FFFE_CFF8
STACKTOP13 EQU 0xFFFF_FFFF_FFFE_CBF8
STACKTOP14 EQU 0xFFFF_FFFF_FFFE_C7F8
STACKTOP15 EQU 0xFFFF_FFFF_FFFE_C3F8
; BOOT ROM routines
TCBSize EQU 0x200 ; 512 bytes per TCB
TCBBase EQU 0x00000001_00000000 ; TCB pages
TCBr1 EQU 0x00
TCBr2 EQU 0x08
TCBr3 EQU 0x10
TCBr4 EQU 0x18
TCBr5 EQU 0x20
TCBr6 EQU 0x28
TCBr7 EQU 0x30
TCBr8 EQU 0x38
TCBr9 EQU 0x40
TCBr10 EQU 0x48
TCBr11 EQU 0x50
TCBr12 EQU 0x58
TCBr13 EQU 0x60
TCBr14 EQU 0x68
TCBr15 EQU 0x70
TCBr16 EQU 0x78
TCBr17 EQU 0x80
TCBr18 EQU 0x88
TCBr19 EQU 0x90
TCBr20 EQU 0x98
TCBr21 EQU 0xA0
TCBr22 EQU 0xA8
TCBr23 EQU 0xB0
TCBr24 EQU 0xB8
TCBr25 EQU 0xC0
TCBr26 EQU 0xC8
TCBr27 EQU 0xD0
TCBr28 EQU 0xD8
TCBr29 EQU 0xE0
TCBr30 EQU 0xE8
TCBr31 EQU 0xF0
warmStart EQU 0x1020
usrJmp EQU 0x1028
TickIRQAddr EQU 0x1030
TaskBlock EQU 0x1038
tencount EQU 0x13F8
Milliseconds EQU 0x1400
Lastloc EQU 0x1408
ScreenColor EQU 0x1414
CursorRow EQU 0x1416
CursorCol EQU 0x1418
CursorFlash EQU 0x141A
KeybdEcho EQU 0x141C
KeybdBuffer EQU 0x1440
KeybdHead EQU 0x1450
KeybdTail EQU 0x1451
Score EQU 0x1500
Manpos EQU 0x1508
MissileActive EQU 0x1510
MissileX EQU 0x1512
MissileY EQU 0x1514
InvadersRow1 EQU 0x1520
InvadersRow2 EQU 0x1530
InvadersRow3 EQU 0x1540
InvadersRow4 EQU 0x1550
InvadersRow5 EQU 0x1560
InvadersColpos EQU 0x1570
InvadersRowpos EQU 0x1571
Uart_rxfifo EQU 0x1600
Uart_rxhead EQU 0x1800
Uart_rxtail EQU 0x1802
Uart_ms EQU 0x1808
Uart_rxrts EQU 0x1809
Uart_rxdtr EQU 0x180A
Uart_rxxon EQU 0x180B
Uart_rxflow EQU 0x180C
Uart_fon EQU 0x180E
Uart_foff EQU 0x1810
Uart_txrts EQU 0x1812
Uart_txdtr EQU 0x1813
Uart_txxon EQU 0x1814
Uart_txxonoff EQU 0x1815
TaskList EQU 0x2000
ReadyList1 EQU 0x2000
ReadyList2 EQU 0x2020
ReadyList3 EQU 0x2040
ReadyList4 EQU 0x2060
ReadyList5 EQU 0x2080
ReadyNdx1 EQU 0x20A0
ReadyNdx2 EQU 0x20A1
ReadyNdx3 EQU 0x20A2
ReadyNdx4 EQU 0x20A3
ReadyNdx5 EQU 0x20A4
RunningTCB EQU 0x20A6
NextToRunTCB EQU 0x20A8
r1save EQU 0x20B0
r2save EQU 0x20B8
AXCstart EQU 0x20C0
p100IRQvec EQU 0x3000
keybdIRQvec EQU 0x3008
serialIRQvec EQU 0x3010
rasterIRQvec EQU 0x3018
TEXTSCR EQU 0xD0_0000
COLORSCR EQU 0xD1_0000
TEXTREG EQU 0xDA_0000
TEXT_COLS EQU 0x0
TEXT_ROWS EQU 0x2
TEXT_CURPOS EQU 0x16
KEYBD EQU 0xFFFF_FFFF_FFDC_0000
KEYBDCLR EQU 0xFFFF_FFFF_FFDC_0002
UART EQU 0xFFFF_FFFF_FFDC_0A00
UART_LS EQU 0xFFFF_FFFF_FFDC_0A01
PIC EQU 0xFFFF_FFFF_FFDC_0FF0
PSG EQU 0xFFFF_FFFF_FFD5_0000
AC97 EQU 0xFFFF_FFFF_FFDC_1000
KEYBD EQU 0xDC_0000
KEYBDCLR EQU 0xDC_0002
UART EQU 0xDC_0A00
UART_LS EQU 0xDC_0A01
UART_MS EQU 0xDC_0A02
UART_IS EQU 0xDC_0A03
UART_IE EQU 0xDC_0A04
UART_MC EQU 0xDC_0A06
DATETIME EQU 0xDC_0400
PIC EQU 0xDC_0FF0
PIC_IE EQU 0xDC_0FF2
PSG EQU 0xD5_0000
PSGFREQ0 EQU 0xD5_0000
PSGPW0 EQU 0xD5_0002
PSGCTRL0 EQU 0xD5_0004
PSGADSR0 EQU 0xD5_0006
SPRRAM EQU 0xD8_0000
AC97 EQU 0xDC_1000
LED EQU 0xDC_0600
GACCEL EQU 0xDA_E000
RASTERIRQ EQU 0xDA_0100
BOOT_STACK EQU 0xFFFF_FFFF_FFFE_FFF8
SPRITEREGS EQU 0xDA_D000
BITMAPSCR EQU 0x00000001_00200000
txempty EQU 0x40
rxfull EQU 0x01
;
; Internal variables follow:
;
0000000100600000 bss
0000000000001038 org 0x1038
0000000000000000 pos dh 0 ; text screen position
0000000000001040 org 0x1040
1040 0000000000000000 lineLinkTbl fill.b 25,0 ; screen line link table
1048 0000000000000000
1050 0000000000000000
1058 0000000000000000
0000000000001068 align 8
0000000000001080 org 0x1080
0000000000001088 align 8
0000000000001088 0000000000000001 OSSP dw 1 ; OS value of sp
0000000000001090 0000000000000001 CURRNT dw 1 ; Current line pointer
0000000000001098 0000000000000001 STKGOS dw 1 ; Saves stack pointer in 'GOSUB'
00000000000010A0 0000000000000001 STKINP dw 1 ; Saves stack pointer during 'INPUT'
00000000000010A8 0000000000000001 LOPVAR dw 1 ; 'FOR' loop save area
00000000000010B0 0000000000000001 LOPINC dw 1 ; increment
00000000000010B8 0000000000000001 LOPLMT dw 1 ; limit
00000000000010C0 0000000000000001 LOPLN dw 1 ; line number
00000000000010C8 0000000000000001 LOPPT dw 1 ; text pointer
00000000000010D0 0000000000000001 TXTUNF dw 1 ; points to unfilled text area
00000000000010D8 0000000000000001 VARBGN dw 1 ; points to variable area
00000000000010E0 0000000000000001 IVARBGN dw 1 ; points to integer variable area
00000000000010E8 0000000000000001 SVARBGN dw 1 ; points to string variable area
00000000000010F0 0000000000000001 FVARBGN dw 1 ; points to float variable area
00000000000010F8 0000000000000001 STKBOT dw 1 ; holds lower limit for stack growth
1100 0000000000000000 NUMWKA fill.b 24,0 ; numeric work area
1108 0000000000000000
1110 0000000000000000
1118 0000000000000000 BUFFER fill.b BUFLEN,0x00 ; Keyboard input buffer
1120 0000000000000000
1128 0000000000000000
1130 0000000000000000
1138 0000000000000000
1140 0000000000000000
1148 0000000000000000
1150 0000000000000000
1158 0000000000000000
1160 0000000000000000
000000000000116E bss
0000000100600000 org 0x1_00600000
TXT equ 0x1_00600000 ; Beginning of program area
; org 0x070
; iret
; nop
65,155 → 249,689
; nop
; nop
;
0000000000000000.0 code
FFFFFFFFFFFFE800.0 org 0xFFFF_FFFF_FFFF_E800
0000000000000000 code
FFFFFFFFFFFFB000 org 0xFFFF_FFFF_FFFF_B000
; jump table
;
FFFFFFFFFFFFE800.0 0CFFFFFFA54 jmp SerialGetChar
FFFFFFFFFFFFE800.1 0CFFFFFFA60 jmp SerialPutChar
FFFFFFFFFFFFE800.2 0CFFFFFFA90 jmp SetKeyboardEcho
FFFFFFFFFFFFE810.0 0CFFFFFFAA6 jmp KeybdCheckForKey
FFFFFFFFFFFFE810.1 0CFFFFFFA92 jmp KeybdGetChar
FFFFFFFFFFFFE810.2 0CFFFFFFB65 jmp DisplayChar
FFFFFFFFFFFFE820.0 0CFFFFFFBF5 jmp DisplayString
FFFFFFFFFFFFB000 33FFED54 jmp SerialGetChar
FFFFFFFFFFFFB004 33FFED0C jmp SerialPutChar
FFFFFFFFFFFFB008 33FFEE06 jmp SetKeyboardEcho
FFFFFFFFFFFFB00C 33FFEE1D jmp KeybdCheckForKey
FFFFFFFFFFFFB010 33FFEE08 jmp KeybdGetChar
FFFFFFFFFFFFB014 33FFEF47 jmp DisplayChar
FFFFFFFFFFFFB018 33FFEFE7 jmp DisplayString
FFFFFFFFFFFFE820.1 start:
FFFFFFFFFFFFB01C start:
; lea MSGRAM,a1
; jsr DisplayString
FFFFFFFFFFFFE820.1 ColdStart:
FFFFFFFFFFFFE820.1 0000000000A icache_on ; turn on the ICache
FFFFFFFFFFFFE820.2 0000000000C dcache_on ; turn on the DCache
FFFFFFFFFFFFE830.0 0BEFFFEFFF8 setlo sp,#STACKTOP ; top of stack
FFFFFFFFFFFFE830.1 0C7FFFFFA6E call KeybdInit
FFFFFFFFFFFFE830.2 0C7FFFFFA50 call PICInit
FFFFFFFFFFFFE840.0 00000000040 cli ; enable interrupts
FFFFFFFFFFFFE840.1 0A3000000CE setlo r3,#0xCE ; blue on blue
FFFFFFFFFFFFE840.2 18806000414 sc r3,ScreenColor
FFFFFFFFFFFFE850.0 10806000414 lc r3,0x414
FFFFFFFFFFFFE850.1 0A300000020 setlo r3,#32
FFFFFFFFFFFFE850.2 18806000416 sc r3,0x416 ; we do a store, then a load through the dcache
FFFFFFFFFFFFE860.0 10804000416 lc r2,0x416 ;
FFFFFFFFFFFFE860.1 10804000416 lc r2,0x416 ;
FFFFFFFFFFFFE860.2 2F8860000A8 beq r2,r3,dcokay
FFFFFFFFFFFFE870.0 0000000000D dcache_off ; data cache failed
FFFFFFFFFFFFE870.1 dcokay:
FFFFFFFFFFFFE870.1 10806000414 lc r3,ScreenColor
FFFFFFFFFFFFE870.2 0C7FFFFFB06 call ClearScreen
FFFFFFFFFFFFE880.0 0C7FFFFFAF4 call ClearBmpScreen
FFFFFFFFFFFFE880.1 18800000416 sc r0,CursorRow
FFFFFFFFFFFFE880.2 18800000418 sc r0,CursorCol
FFFFFFFFFFFFE890.0 0A1FFFFE920 setlo r1,#<MSGSTART
FFFFFFFFFFFFE890.1 0E1FFFFFFFF sethi r1,#>MSGSTART
FFFFFFFFFFFFE890.2 0C7FFFFFBF5 call DisplayString
; call SetupAC97 ; and Beep
FFFFFFFFFFFFB01C ColdStart:
FFFFFFFFFFFFB01C 0000000A icache_on ; turn on the ICache
FFFFFFFFFFFFB020 0000000D dcache_off ; turn on the DCache
; Allow some other contexts to start up
; equal processing time for sixteen contexts
; Initialize the context schedule with all contexts treated equally
; There are only 16 contexts, but 256 schedule slots. Each context is
; given 16 slots distributed evenly throughout the execution pattern
; table.
;
FFFFFFFFFFFFE8A0.0 00802000AA8 mfspr r1,AXC ; which context am I
FFFFFFFFFFFFE8A0.1 2F840000149 bne r1,r0,j4
FFFFFFFFFFFFE8A0.2 0A176543210 setlo r1,#0x76543210
FFFFFFFFFFFFE8B0.0 008400008A9 mtspr EP0,r1
FFFFFFFFFFFFE8B0.1 008400009A9 mtspr EP2,r1
FFFFFFFFFFFFE8B0.2 0A1FEDCBA98 setlo r1,#0xFEDCBA98
FFFFFFFFFFFFE8C0.0 00840000929 mtspr EP1,r1
FFFFFFFFFFFFE8C0.1 00840000A29 mtspr EP3,r1
FFFFFFFFFFFFE8C0.2 j4:
FFFFFFFFFFFFE8C0.2 0CFFFFFFCA6 jmp Monitor
FFFFFFFFFFFFE8D0.0 2F801FFFFCA bra j4
FFFFFFFFFFFFB024 0410840A xor r1,r1,r1 ; r1 = 0
FFFFFFFFFFFFB028 ict1:
FFFFFFFFFFFFB028 0410803A mtep r1,r1 ; only the low order four bits of r1 will move to the pattern table
FFFFFFFFFFFFB02C 0A108001 addui r1,r1,#1
FFFFFFFFFFFFB030 101100FF cmpi r2,r1,#255
FFFFFFFFFFFFB034 BE207FA9 bne r2,r0,ict1
; Point the interrupt return address register of the context to the
; context startup code. The context will start up when an interrupt return
; occurs.
;
; We cannot use a loop for this. Fortunately there's only 16 contexts.
;
FFFFFFFFFFFFB038 E6BFB214 ; SETLO
FFFFFFFFFFFFB03C 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB040 E6BEFFF8 ; SETLO
FFFFFFFFFFFFB044 6A0D782D lea r30,STACKTOP0
FFFFFFFFFFFFB048 0000000F iepp
FFFFFFFFFFFFB04C DE000000 nop
FFFFFFFFFFFFB050 DE000000 nop
FFFFFFFFFFFFB054 E6BFB214 ; SETLO
FFFFFFFFFFFFB058 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB05C E6BEFBF8 ; SETLO
FFFFFFFFFFFFB060 6A0D782D lea r30,STACKTOP1
FFFFFFFFFFFFB064 0000000F iepp
FFFFFFFFFFFFB068 DE000000 nop
FFFFFFFFFFFFB06C DE000000 nop
FFFFFFFFFFFFB070 E6BFB214 ; SETLO
FFFFFFFFFFFFB074 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB078 E6BEF7F8 ; SETLO
FFFFFFFFFFFFB07C 6A0D782D lea r30,STACKTOP2
FFFFFFFFFFFFB080 0000000F iepp
FFFFFFFFFFFFB084 DE000000 nop
FFFFFFFFFFFFB088 DE000000 nop
FFFFFFFFFFFFB08C E6BFB214 ; SETLO
FFFFFFFFFFFFB090 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB094 E6BEF3F8 ; SETLO
FFFFFFFFFFFFB098 6A0D782D lea r30,STACKTOP3
FFFFFFFFFFFFB09C 0000000F iepp
FFFFFFFFFFFFB0A0 DE000000 nop
FFFFFFFFFFFFB0A4 DE000000 nop
FFFFFFFFFFFFB0A8 E6BFB214 ; SETLO
FFFFFFFFFFFFB0AC 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB0B0 E6BEEFF8 ; SETLO
FFFFFFFFFFFFB0B4 6A0D782D lea r30,STACKTOP4
FFFFFFFFFFFFB0B8 0000000F iepp
FFFFFFFFFFFFB0BC DE000000 nop
FFFFFFFFFFFFB0C0 DE000000 nop
FFFFFFFFFFFFB0C4 E6BFB214 ; SETLO
FFFFFFFFFFFFB0C8 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB0CC E6BEEBF8 ; SETLO
FFFFFFFFFFFFB0D0 6A0D782D lea r30,STACKTOP5
FFFFFFFFFFFFB0D4 0000000F iepp
FFFFFFFFFFFFB0D8 DE000000 nop
FFFFFFFFFFFFB0DC DE000000 nop
FFFFFFFFFFFFB0E0 E6BFB214 ; SETLO
FFFFFFFFFFFFB0E4 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB0E8 E6BEE7F8 ; SETLO
FFFFFFFFFFFFB0EC 6A0D782D lea r30,STACKTOP6
FFFFFFFFFFFFB0F0 0000000F iepp
FFFFFFFFFFFFB0F4 DE000000 nop
FFFFFFFFFFFFB0F8 DE000000 nop
FFFFFFFFFFFFB0FC E6BFB214 ; SETLO
FFFFFFFFFFFFB100 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB104 E6BEE3F8 ; SETLO
FFFFFFFFFFFFB108 6A0D782D lea r30,STACKTOP7
FFFFFFFFFFFFB10C 0000000F iepp
FFFFFFFFFFFFB110 DE000000 nop
FFFFFFFFFFFFB114 DE000000 nop
FFFFFFFFFFFFB118 E6BFB214 ; SETLO
FFFFFFFFFFFFB11C 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB120 E6BEDFF8 ; SETLO
FFFFFFFFFFFFB124 6A0D782D lea r30,STACKTOP8
FFFFFFFFFFFFB128 0000000F iepp
FFFFFFFFFFFFB12C DE000000 nop
FFFFFFFFFFFFB130 DE000000 nop
FFFFFFFFFFFFB134 E6BFB214 ; SETLO
FFFFFFFFFFFFB138 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB13C E6BEDBF8 ; SETLO
FFFFFFFFFFFFB140 6A0D782D lea r30,STACKTOP9
FFFFFFFFFFFFB144 0000000F iepp
FFFFFFFFFFFFB148 DE000000 nop
FFFFFFFFFFFFB14C DE000000 nop
FFFFFFFFFFFFB150 E6BFB214 ; SETLO
FFFFFFFFFFFFB154 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB158 E6BED7F8 ; SETLO
FFFFFFFFFFFFB15C 6A0D782D lea r30,STACKTOP10
FFFFFFFFFFFFB160 0000000F iepp
FFFFFFFFFFFFB164 DE000000 nop
FFFFFFFFFFFFB168 DE000000 nop
FFFFFFFFFFFFB16C E6BFB214 ; SETLO
FFFFFFFFFFFFB170 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB174 E6BED3F8 ; SETLO
FFFFFFFFFFFFB178 6A0D782D lea r30,STACKTOP11
FFFFFFFFFFFFB17C 0000000F iepp
FFFFFFFFFFFFB180 DE000000 nop
FFFFFFFFFFFFB184 DE000000 nop
FFFFFFFFFFFFB188 E6BFB214 ; SETLO
FFFFFFFFFFFFB18C 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB190 E6BECFF8 ; SETLO
FFFFFFFFFFFFB194 6A0D782D lea r30,STACKTOP12
FFFFFFFFFFFFB198 0000000F iepp
FFFFFFFFFFFFB19C DE000000 nop
FFFFFFFFFFFFB1A0 DE000000 nop
FFFFFFFFFFFFB1A4 E6BFB214 ; SETLO
FFFFFFFFFFFFB1A8 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB1AC E6BECBF8 ; SETLO
FFFFFFFFFFFFB1B0 6A0D782D lea r30,STACKTOP13
FFFFFFFFFFFFB1B4 0000000F iepp
FFFFFFFFFFFFB1B8 DE000000 nop
FFFFFFFFFFFFB1BC DE000000 nop
FFFFFFFFFFFFB1C0 E6BFB214 ; SETLO
FFFFFFFFFFFFB1C4 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB1C8 E6BEC7F8 ; SETLO
FFFFFFFFFFFFB1CC 6A0D782D lea r30,STACKTOP14
FFFFFFFFFFFFB1D0 0000000F iepp
FFFFFFFFFFFFB1D4 DE000000 nop
FFFFFFFFFFFFB1D8 DE000000 nop
FFFFFFFFFFFFB1DC E6BFB214 ; SETLO
FFFFFFFFFFFFB1E0 6A0D642D lea r25,ctxstart
FFFFFFFFFFFFB1E4 E6BEC3F8 ; SETLO
FFFFFFFFFFFFB1E8 6A0D782D lea r30,STACKTOP15
FFFFFFFFFFFFB1EC 0000000F iepp
FFFFFFFFFFFFB1F0 DE000000 nop
FFFFFFFFFFFFB1F4 DE000000 nop
; Ensure that context zero is the active context
;
FFFFFFFFFFFFB1F8 ctxstart3:
FFFFFFFFFFFFB1F8 02008568 mfspr r1,AXC
FFFFFFFFFFFFB1FC BE1000A8 beq r1,r0,ctxstart2
FFFFFFFFFFFFB200 0000000F iepp
FFFFFFFFFFFFB204 DE000000 nop
FFFFFFFFFFFFB208 DE000000 nop
FFFFFFFFFFFFB20C BE007F6A bra ctxstart3
FFFFFFFFFFFFB210 ctxstart2:
FFFFFFFFFFFFB210 6000A0C0 sb r1,AXCstart ; save off the startup context which should be context zero
; Entry point for context startup
;
; Avoid repeating all the system initialization when a context starts up by testing whether
; or not the context is the starting context.
;
FFFFFFFFFFFFB214 ctxstart:
FFFFFFFFFFFFB214 02008568 mfspr r1,AXC
FFFFFFFFFFFFB218 4A0120C0 lbu r2,AXCstart
FFFFFFFFFFFFB21C BE1107E9 bne r1,r2,ctxstart1
;
; set system vectors
; TBA defaults to zero on reset
;
FFFFFFFFFFFFB220 E0C00000 setlo r3,#0
FFFFFFFFFFFFB224 E08001FF setlo r2,#511
FFFFFFFFFFFFB228 9A00EA20 lea r1,nmirout
FFFFFFFFFFFFB22C csj5:
FFFFFFFFFFFFB22C 66308000 sw r1,[r3]
FFFFFFFFFFFFB230 0A318008 addui r3,r3,#8
FFFFFFFFFFFFB234 BE017FCF loop r2,csj5
FFFFFFFFFFFFB238 E6BFB768 ; SETLO
FFFFFFFFFFFFB23C 6A0D042D lea r1,KeybdSC ; keyboard BIOS vector
FFFFFFFFFFFFB240 66008D08 sw r1,0xD08
FFFFFFFFFFFFB244 9A00E950 lea r1,irqrout
FFFFFFFFFFFFB248 66008E08 sw r1,0xE08 ; set IRQ vector
FFFFFFFFFFFFB24C 9A00E8BC lea r1,dberr_rout
FFFFFFFFFFFFB250 66008FE0 sw r1,0xFE0 ; set Bus error vector
FFFFFFFFFFFFB254 9A00E8A4 lea r1,iberr_rout
FFFFFFFFFFFFB258 66008FE8 sw r1,0xFE8 ; set Bus error vector
FFFFFFFFFFFFB25C 9A00EA20 lea r1,nmirout
FFFFFFFFFFFFB260 66008FF0 sw r1,0xFF0 ; set NMI vector
FFFFFFFFFFFFB264 E6BFB7C4 ; SETLO
FFFFFFFFFFFFB268 6A0D042D lea r1,KeybdIRQ
FFFFFFFFFFFFB26C 6600B008 sw r1,keybdIRQvec
FFFFFFFFFFFFB270 E6BFB8EC ; SETLO
FFFFFFFFFFFFB274 6A0D042D lea r1,Pulse100
FFFFFFFFFFFFB278 6600B000 sw r1,p100IRQvec
FFFFFFFFFFFFB27C E6BFB628 ; SETLO
FFFFFFFFFFFFB280 6A0D042D lea r1,SerialIRQ
FFFFFFFFFFFFB284 6600B010 sw r1,serialIRQvec
FFFFFFFFFFFFB288 9A00CAC4 lea r1,RasterIRQfn
FFFFFFFFFFFFB28C 6600B018 sw r1,rasterIRQvec
;-------------------------------
; Initialize I/O devices
;-------------------------------
FFFFFFFFFFFFB290 31FFECEC call SerialInit
FFFFFFFFFFFFB294 31FFEDEC call KeybdInit
FFFFFFFFFFFFB298 31FFECE4 call PICInit
FFFFFFFFFFFFB29C 31FFF299 call SetupRasterIRQ
FFFFFFFFFFFFB2A0 00000040 cli ; enable interrupts
; call HelloWorld
FFFFFFFFFFFFB2A4 E0C000CE setlo r3,#0xCE ; blue on blue
FFFFFFFFFFFFB2A8 62019414 sc r3,ScreenColor
FFFFFFFFFFFFB2AC 42019414 lc r3,0x1414
FFFFFFFFFFFFB2B0 E0C00020 setlo r3,#32
FFFFFFFFFFFFB2B4 62019416 sc r3,0x1416 ; we do a store, then a load through the dcache
FFFFFFFFFFFFB2B8 42011416 lc r2,0x1416 ;
FFFFFFFFFFFFB2BC BE218048 beq r2,r3,dcokay
FFFFFFFFFFFFB2C0 0000000D dcache_off ; data cache failed
FFFFFFFFFFFFB2C4 dcokay:
FFFFFFFFFFFFB2C4 620020A8 sc r0,NextToRunTCB
FFFFFFFFFFFFB2C8 620020A6 sc r0,RunningTCB
FFFFFFFFFFFFB2CC 31FFEED9 call ClearScreen
FFFFFFFFFFFFB2D0 31FFEEC4 call ClearBmpScreen
FFFFFFFFFFFFB2D4 31FFF1ED call RandomizeSprram
FFFFFFFFFFFFB2D8 62001416 sc r0,CursorRow
FFFFFFFFFFFFB2DC 62001418 sc r0,CursorCol
FFFFFFFFFFFFB2E0 E0400001 setlo r1,#1
FFFFFFFFFFFFB2E4 6000941A sb r1,CursorFlash
FFFFFFFFFFFFB2E8 E6BFB36D ; SETLO
FFFFFFFFFFFFB2EC 6A0D042D lea r1,MSGSTART
FFFFFFFFFFFFB2F0 31FFEFF5 call DisplayStringCRLF
FFFFFFFFFFFFB2F4 33FFF096 jmp Monitor
FFFFFFFFFFFFB2F8 31FFF1F7 call SetupAC97 ; and Beep
FFFFFFFFFFFFB2FC E0C00004 setlo r3,#4
FFFFFFFFFFFFB300 E69C0600 ; SETLO
FFFFFFFFFFFFB304 EE800003 ; SETMID
FFFFFFFFFFFFB308 6A0D0C28 outb r3,LED
FFFFFFFFFFFFB30C 31FFF221 call Beep
FFFFFFFFFFFFB310 j4:
FFFFFFFFFFFFB310 33FFF096 jmp Monitor
FFFFFFFFFFFFB314 BE007FEA bra j4
; for now hang the contexts
;
FFFFFFFFFFFFB318 ctxstart1:
FFFFFFFFFFFFB318 BE00000A bra ctxstart1
; call ramtest
;-----------------------------------------
; Hello World!
;-----------------------------------------
FFFFFFFFFFFFE8D0.1 HelloWorld:
FFFFFFFFFFFFE8D0.1 03FBC000018 subui r30,r30,#24
FFFFFFFFFFFFE8D0.2 27F40000003 sm [r30],r1/r2/r31
FFFFFFFFFFFFE8E0.0 0A2FFFFE910 setlo r2,#MSG
FFFFFFFFFFFFE8E0.1 j3:
FFFFFFFFFFFFE8E0.1 10082000000 lb r1,[r2]
FFFFFFFFFFFFE8E0.2 2F840000108 beq r1,r0,j2
FFFFFFFFFFFFE8F0.0 0C7FFFFFA60 call SerialPutChar
FFFFFFFFFFFFE8F0.1 02884000001 addui r2,r2,#1
FFFFFFFFFFFFE8F0.2 2F801FFFFAA bra j3
FFFFFFFFFFFFE900.0 j2:
FFFFFFFFFFFFE900.0 27740000003 lm [r30],r1/r2/r31
FFFFFFFFFFFFE900.1 0DFBE000018 ret #24
FFFFFFFFFFFFB31C HelloWorld:
FFFFFFFFFFFFB31C 0FEF0018 subui r30,r30,#24
FFFFFFFFFFFFB320 67E08000 sw r1,[sp]
FFFFFFFFFFFFB324 67E10008 sw r2,8[sp]
FFFFFFFFFFFFB328 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFB32C E6BFB360 ; SETLO
FFFFFFFFFFFFB330 6A0D082D lea r2,MSG
FFFFFFFFFFFFB334 j3:
FFFFFFFFFFFFB334 40208000 lb r1,[r2]
FFFFFFFFFFFFB338 BE100088 beq r1,r0,j2
FFFFFFFFFFFFB33C 31FFED0C call SerialPutChar
FFFFFFFFFFFFB340 0A210001 addui r2,r2,#1
FFFFFFFFFFFFB344 BE007F8A bra j3
FFFFFFFFFFFFB348 j2:
FFFFFFFFFFFFB348 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFB34C 67E10008 sw r2,8[sp]
FFFFFFFFFFFFB350 67E08000 sw r1,[sp]
FFFFFFFFFFFFB354 37EF8018 ret #24
FFFFFFFFFFFFE900.2 37800000000 align 16
FFFFFFFFFFFFE910.0 align 16
FFFFFFFFFFFFE910.0 MSG:
FFFFFFFFFFFFE910 6F57206F6C6C6548 DB "Hello World!",0,0,0,0
FFFFFFFFFFFFE918 0000000021646C72
FFFFFFFFFFFFE920.0 align 16
FFFFFFFFFFFFE920.0 MSGSTART:
FFFFFFFFFFFFE920 3436726F74706152 db "Raptor64 system starting....",CR,LF,0,0
FFFFFFFFFFFFE928 206D657473797320
FFFFFFFFFFFFE930 676E697472617473
FFFFFFFFFFFFE938 00000A0D2E2E2E2E
FFFFFFFFFFFFB358 0000000000000000 align 16
FFFFFFFFFFFFB360 align 16
FFFFFFFFFFFFB360 MSG:
FFFFFFFFFFFFB360 6F57206F6C6C6548 db "Hello World!",0
FFFFFFFFFFFFB36D MSGSTART:
FFFFFFFFFFFFB368 7061520021646C72 db "Raptor64 system starting....",0
FFFFFFFFFFFFB370 7973203436726F74
FFFFFFFFFFFFB378 617473206D657473
FFFFFFFFFFFFB380 2E2E2E676E697472
FFFFFFFFFFFFE940.0 align 16
FFFFFFFFFFFFB388 000000000000002E align 16
FFFFFFFFFFFFB390 align 16
;----------------------------------------------------------
; Initialize programmable interrupt controller (PIC)
; 0 = nmi
; 1 = keyboard reset
; 2 = 1000Hz pulse (cursor flash)
; 2 = 1000Hz pulse (context switcher)
; 3 = 100Hz pulse (cursor flash)
; 8 = uart
; 13 = raster interrupt
; 15 = keyboard char
;----------------------------------------------------------
FFFFFFFFFFFFE940.0 PICInit:
FFFFFFFFFFFFE940.0 0A1FFFF8007 setlo r1,#0x8007 ; enable nmi,kbd_rst,and kbd_irq
FFFFFFFFFFFFE940.1 24803DC0FF2 outc r1,PIC+2
FFFFFFFFFFFFE940.2 0DFBE000000 ret
FFFFFFFFFFFFB390 PICInit:
FFFFFFFFFFFFB390 E6BFB3AC ; SETLO
FFFFFFFFFFFFB394 6A0D042D lea r1,PICret
FFFFFFFFFFFFB398 66009030 sw r1,TickIRQAddr
; enable: raster irq,
FFFFFFFFFFFFB39C E07FA00F setlo r1,#0xA00F ; enable nmi,kbd_rst,and kbd_irq
; A10F enable serial IRQ
FFFFFFFFFFFFB3A0 E69C0FF2 ; SETLO
FFFFFFFFFFFFB3A4 EE800003 ; SETMID
FFFFFFFFFFFFB3A8 6A0D0429 outc r1,PIC_IE
FFFFFFFFFFFFB3AC PICret:
FFFFFFFFFFFFB3AC 37EF8000 ret
;==============================================================================
; Serial port
;==============================================================================
;-----------------------------------------
; Get character from serial port
; Initialize the serial port
;-----------------------------------------
FFFFFFFFFFFFE950.0 SerialGetChar:
FFFFFFFFFFFFE950.0 03FBC000008 subui r30,r30,#8
FFFFFFFFFFFFE950.1 19F86000000 sw r3,[r30]
FFFFFFFFFFFFE950.2 0A1FFDC0A00 setlo r1,#UART
FFFFFFFFFFFFE960.0 sgc1:
FFFFFFFFFFFFE960.0 20046000001 inb r3,1[r1] ; uart status
FFFFFFFFFFFFE960.1 050C6000001 andi r3,r3,#rxfull ; is there a char available ?
FFFFFFFFFFFFE960.2 2F8C0000008 beq r3,r0,sgc1
FFFFFFFFFFFFE970.0 11F86000000 lw r3,[r30]
FFFFFFFFFFFFE970.1 20042000000 inb r1,[r1]
FFFFFFFFFFFFE970.2 0DFBE000008 ret #8
;
FFFFFFFFFFFFB3B0 SerialInit:
FFFFFFFFFFFFB3B0 62001800 sc r0,Uart_rxhead ; reset buffer indexes
FFFFFFFFFFFFB3B4 62001802 sc r0,Uart_rxtail
FFFFFFFFFFFFB3B8 E04001F0 setlo r1,#0x1f0
FFFFFFFFFFFFB3BC 62009810 sc r1,Uart_foff ; set threshold for XOFF
FFFFFFFFFFFFB3C0 E0400010 setlo r1,#0x010
FFFFFFFFFFFFB3C4 6200980E sc r1,Uart_fon ; set threshold for XON
FFFFFFFFFFFFB3C8 E0400001 setlo r1,#1
FFFFFFFFFFFFB3CC E69C0A04 ; SETLO
FFFFFFFFFFFFB3D0 EE800003 ; SETMID
FFFFFFFFFFFFB3D4 6A0D0428 outb r1,UART_IE ; enable receive interrupt only
FFFFFFFFFFFFB3D8 60001809 sb r0,Uart_rxrts ; no RTS/CTS signals available
FFFFFFFFFFFFB3DC 60001812 sb r0,Uart_txrts ; no RTS/CTS signals available
FFFFFFFFFFFFB3E0 60001813 sb r0,Uart_txdtr ; no DTR signals available
FFFFFFFFFFFFB3E4 6000180A sb r0,Uart_rxdtr ; no DTR signals available
FFFFFFFFFFFFB3E8 E0400001 setlo r1,#1
FFFFFFFFFFFFB3EC 60009814 sb r1,Uart_txxon ; for now
FFFFFFFFFFFFB3F0 37EF8000 ret
;---------------------------------------------------------------------------------
; Get character directly from serial port. Blocks until a character is available.
;---------------------------------------------------------------------------------
;
FFFFFFFFFFFFB3F4 SerialGetCharDirect:
FFFFFFFFFFFFB3F4 sgc1:
FFFFFFFFFFFFB3F4 E69C0A01 ; SETLO
FFFFFFFFFFFFB3F8 EE800003 ; SETMID
FFFFFFFFFFFFB3FC 6A0D0420 inb r1,UART_LS ; uart status
FFFFFFFFFFFFB400 14108001 andi r1,r1,#rxfull ; is there a char available ?
FFFFFFFFFFFFB404 BE107F88 beq r1,r0,sgc1
FFFFFFFFFFFFB408 E69C0A00 ; SETLO
FFFFFFFFFFFFB40C EE800003 ; SETMID
FFFFFFFFFFFFB410 6A0D0420 inb r1,UART
FFFFFFFFFFFFB414 37EF8000 ret
;------------------------------------------------
; Check for a character at the serial port
; returns r1 = 1 if char available, 0 otherwise
;------------------------------------------------
;
FFFFFFFFFFFFB418 SerialCheckForCharDirect:
FFFFFFFFFFFFB418 E69C0A01 ; SETLO
FFFFFFFFFFFFB41C EE800003 ; SETMID
FFFFFFFFFFFFB420 6A0D0420 inb r1,UART_LS ; uart status
FFFFFFFFFFFFB424 14108001 andi r1,r1,#rxfull ; is there a char available ?
FFFFFFFFFFFFB428 04100439 sne r1,r1,r0
FFFFFFFFFFFFB42C 37EF8000 ret
;-----------------------------------------
; Put character to serial port
; r1 = char to put
;-----------------------------------------
FFFFFFFFFFFFE980.0 SerialPutChar:
FFFFFFFFFFFFE980.0 03FBC000010 subui r30,r30,#16
FFFFFFFFFFFFE980.1 19F84000008 sw r2,8[r30]
FFFFFFFFFFFFE980.2 19F86000000 sw r3,[r30]
FFFFFFFFFFFFE990.0 0A3FFDC0A00 setlo r3,#UART
FFFFFFFFFFFFE990.1 spc1:
FFFFFFFFFFFFE990.1 200C4000001 inb r2,1[r3] ; uart status
FFFFFFFFFFFFE990.2 05084000040 andi r2,r2,#txempty ; is there a char available ?
FFFFFFFFFFFFE9A0.0 2F881FFFFA8 beq r2,r0,spc1
FFFFFFFFFFFFE9A0.1 240C2000000 outb r1,[r3]
FFFFFFFFFFFFE9A0.2 11F86000000 lw r3,[r30]
FFFFFFFFFFFFE9B0.0 11F84000008 lw r2,8[r30]
FFFFFFFFFFFFE9B0.1 0DFBE000010 ret #16
;
FFFFFFFFFFFFB430 SerialPutChar:
FFFFFFFFFFFFB430 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFB434 67E10000 sw r2,[sp]
FFFFFFFFFFFFB438 67E18008 sw r3,8[sp]
FFFFFFFFFFFFB43C 67E20010 sw r4,16[sp]
FFFFFFFFFFFFB440 67E28018 sw r5,24[sp]
FFFFFFFFFFFFB444 E69C0A06 ; SETLO
FFFFFFFFFFFFB448 EE800003 ; SETMID
FFFFFFFFFFFFB44C 6A0D0820 inb r2,UART_MC
FFFFFFFFFFFFB450 16210003 ori r2,r2,#3 ; assert DTR / RTS
FFFFFFFFFFFFB454 E69C0A06 ; SETLO
FFFFFFFFFFFFB458 EE800003 ; SETMID
FFFFFFFFFFFFB45C 6A0D0828 outb r2,UART_MC
FFFFFFFFFFFFB460 40011812 lb r2,Uart_txrts
FFFFFFFFFFFFB464 BE200168 beq r2,r0,spcb1
FFFFFFFFFFFFB468 46021400 lw r4,Milliseconds
FFFFFFFFFFFFB46C E0C00064 setlo r3,#100 ; delay count (1 s)
FFFFFFFFFFFFB470 spcb3:
FFFFFFFFFFFFB470 80011808 inb r2,UART_MS
FFFFFFFFFFFFB474 1421000A andi r2,r2,#10 ; is CTS asserted ?
FFFFFFFFFFFFB478 BE2000C9 bne r2,r0,spcb1
FFFFFFFFFFFFB47C 46029400 lw r5,Milliseconds
FFFFFFFFFFFFB480 BE42FF88 beq r4,r5,spcb3
FFFFFFFFFFFFB484 02520009 mov r4,r5
FFFFFFFFFFFFB488 BE01FF4F loop r3,spcb3
FFFFFFFFFFFFB48C BE00046A bra spcabort
FFFFFFFFFFFFB490 spcb1:
FFFFFFFFFFFFB490 40011813 lb r2,Uart_txdtr
FFFFFFFFFFFFB494 BE200168 beq r2,r0,spcb2
FFFFFFFFFFFFB498 46021400 lw r4,Milliseconds
FFFFFFFFFFFFB49C E0C00064 setlo r3,#100 ; delay count
FFFFFFFFFFFFB4A0 spcb4:
FFFFFFFFFFFFB4A0 80011808 inb r2,UART_MS
FFFFFFFFFFFFB4A4 14210014 andi r2,r2,#20 ; is DSR asserted ?
FFFFFFFFFFFFB4A8 BE2000C9 bne r2,r0,spcb2
FFFFFFFFFFFFB4AC 46029400 lw r5,Milliseconds
FFFFFFFFFFFFB4B0 BE42FF88 beq r4,r5,spcb4
FFFFFFFFFFFFB4B4 02520009 mov r4,r5
FFFFFFFFFFFFB4B8 BE01FF4F loop r3,spcb4
FFFFFFFFFFFFB4BC BE0002EA bra spcabort
FFFFFFFFFFFFB4C0 spcb2:
FFFFFFFFFFFFB4C0 40011814 lb r2,Uart_txxon
FFFFFFFFFFFFB4C4 BE2000C8 beq r2,r0,spcb5
FFFFFFFFFFFFB4C8 spcb6:
FFFFFFFFFFFFB4C8 40011815 lb r2,Uart_txxonoff
FFFFFFFFFFFFB4CC BE200088 beq r2,r0,spcb5
FFFFFFFFFFFFB4D0 80021808 inb r4,UART_MS
FFFFFFFFFFFFB4D4 14420080 andi r4,r4,#0x80 ; DCD ?
FFFFFFFFFFFFB4D8 BE407F89 bne r4,r0,spcb6
FFFFFFFFFFFFB4DC spcb5:
FFFFFFFFFFFFB4DC 46021400 lw r4,Milliseconds
FFFFFFFFFFFFB4E0 E0C00064 setlo r3,#100 ; wait up to 1s
FFFFFFFFFFFFB4E4 spcb8:
FFFFFFFFFFFFB4E4 E69C0A01 ; SETLO
FFFFFFFFFFFFB4E8 EE800003 ; SETMID
FFFFFFFFFFFFB4EC 6A0D0820 inb r2,UART_LS
FFFFFFFFFFFFB4F0 14210020 andi r2,r2,#0x20 ; tx not full ?
FFFFFFFFFFFFB4F4 BE2000C9 bne r2,r0,spcb7
FFFFFFFFFFFFB4F8 46029400 lw r5,Milliseconds
FFFFFFFFFFFFB4FC BE42FF48 beq r4,r5,spcb8
FFFFFFFFFFFFB500 02520009 mov r4,r5
FFFFFFFFFFFFB504 BE01FF0F loop r3,spcb8
FFFFFFFFFFFFB508 BE00008A bra spcabort
FFFFFFFFFFFFB50C spcb7:
FFFFFFFFFFFFB50C E69C0A00 ; SETLO
FFFFFFFFFFFFB510 EE800003 ; SETMID
FFFFFFFFFFFFB514 6A0D0428 outb r1,UART
FFFFFFFFFFFFB518 spcabort:
FFFFFFFFFFFFB518 47E10000 lw r2,[sp]
FFFFFFFFFFFFB51C 47E18008 lw r3,8[sp]
FFFFFFFFFFFFB520 47E20010 lw r4,16[sp]
FFFFFFFFFFFFB524 47E28018 lw r5,24[sp]
FFFFFFFFFFFFB528 37EF8020 ret #32
;-------------------------------------------------
; Compute number of characters in recieve buffer.
; r4 = number of chars
;-------------------------------------------------
FFFFFFFFFFFFB52C CharsInRxBuf:
FFFFFFFFFFFFB52C 42021800 lc r4,Uart_rxhead
FFFFFFFFFFFFB530 42011802 lc r2,Uart_rxtail
FFFFFFFFFFFFB534 04411005 subu r4,r4,r2
FFFFFFFFFFFFB538 BE4000A3 bgt r4,r0,cirxb1
FFFFFFFFFFFFB53C E1000200 setlo r4,#0x200
FFFFFFFFFFFFB540 04411003 addu r4,r4,r2
FFFFFFFFFFFFB544 42011800 lc r2,Uart_rxhead
FFFFFFFFFFFFB548 04411005 subu r4,r4,r2
FFFFFFFFFFFFB54C cirxb1:
FFFFFFFFFFFFB54C 37EF8000 ret
;----------------------------------------------
; Get character from rx fifo
; If the fifo is empty enough then send an XON
;----------------------------------------------
;
FFFFFFFFFFFFB550 SerialGetChar:
FFFFFFFFFFFFB550 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFB554 67E10000 sw r2,[sp]
FFFFFFFFFFFFB558 67E18008 sw r3,8[sp]
FFFFFFFFFFFFB55C 67E20010 sw r4,16[sp]
FFFFFFFFFFFFB560 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFB564 42019800 lc r3,Uart_rxhead
FFFFFFFFFFFFB568 42011802 lc r2,Uart_rxtail
FFFFFFFFFFFFB56C BE218528 beq r2,r3,sgcfifo1 ; is there a char available ?
FFFFFFFFFFFFB570 9A019600 lea r3,Uart_rxfifo
FFFFFFFFFFFFB574 6A218400 lb r1,[r2+r3] ; get the char from the fifo into r1
FFFFFFFFFFFFB578 0A210001 addui r2,r2,#1 ; increment the fifo pointer
FFFFFFFFFFFFB57C 142101FF andi r2,r2,#0x1ff
FFFFFFFFFFFFB580 62011802 sc r2,Uart_rxtail
FFFFFFFFFFFFB584 4001180C lb r2,Uart_rxflow ; using flow control ?
FFFFFFFFFFFFB588 BE2003A8 beq r2,r0,sgcfifo2
FFFFFFFFFFFFB58C 4201980E lc r3,Uart_fon ; enough space in Rx buffer ?
FFFFFFFFFFFFB590 31FFED4B call CharsInRxBuf
FFFFFFFFFFFFB594 BE418343 bgt r4,r3,sgcfifo2
FFFFFFFFFFFFB598 6000180C sb r0,Uart_rxflow ; flow off
FFFFFFFFFFFFB59C 40021809 lb r4,Uart_rxrts
FFFFFFFFFFFFB5A0 BE400108 beq r4,r0,sgcfifo3
FFFFFFFFFFFFB5A4 E69C0A06 ; SETLO
FFFFFFFFFFFFB5A8 EE800003 ; SETMID
FFFFFFFFFFFFB5AC 6A0D1020 inb r4,UART_MC ; set rts bit in MC
FFFFFFFFFFFFB5B0 16420002 ori r4,r4,#2
FFFFFFFFFFFFB5B4 E69C0A06 ; SETLO
FFFFFFFFFFFFB5B8 EE800003 ; SETMID
FFFFFFFFFFFFB5BC 6A0D1028 outb r4,UART_MC
FFFFFFFFFFFFB5C0 sgcfifo3:
FFFFFFFFFFFFB5C0 4002180A lb r4,Uart_rxdtr
FFFFFFFFFFFFB5C4 BE400108 beq r4,r0,sgcfifo4
FFFFFFFFFFFFB5C8 E69C0A06 ; SETLO
FFFFFFFFFFFFB5CC EE800003 ; SETMID
FFFFFFFFFFFFB5D0 6A0D1020 inb r4,UART_MC ; set DTR
FFFFFFFFFFFFB5D4 16420001 ori r4,r4,#1
FFFFFFFFFFFFB5D8 E69C0A06 ; SETLO
FFFFFFFFFFFFB5DC EE800003 ; SETMID
FFFFFFFFFFFFB5E0 6A0D1028 outb r4,UART_MC
FFFFFFFFFFFFB5E4 sgcfifo4:
FFFFFFFFFFFFB5E4 4002180B lb r4,Uart_rxxon
FFFFFFFFFFFFB5E8 BE4000A8 beq r4,r0,sgcfifo5
FFFFFFFFFFFFB5EC E1000011 setlo r4,#XON
FFFFFFFFFFFFB5F0 E69C0A00 ; SETLO
FFFFFFFFFFFFB5F4 EE800003 ; SETMID
FFFFFFFFFFFFB5F8 6A0D1028 outb r4,UART
FFFFFFFFFFFFB5FC sgcfifo5:
FFFFFFFFFFFFB5FC sgcfifo2: ; return with char in r1
FFFFFFFFFFFFB5FC 47E10000 lw r2,[sp]
FFFFFFFFFFFFB600 47E18008 lw r3,8[sp]
FFFFFFFFFFFFB604 47E20010 lw r4,16[sp]
FFFFFFFFFFFFB608 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFB60C 37EF8020 ret #32
FFFFFFFFFFFFB610 sgcfifo1:
FFFFFFFFFFFFB610 E07FFFFF setlo r1,#-1 ; no char available
FFFFFFFFFFFFB614 47E10000 lw r2,[sp]
FFFFFFFFFFFFB618 47E18008 lw r3,8[sp]
FFFFFFFFFFFFB61C 47E20010 lw r4,16[sp]
FFFFFFFFFFFFB620 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFB624 37EF8020 ret #32
;-----------------------------------------
; Serial port IRQ
;-----------------------------------------
;
FFFFFFFFFFFFB628 SerialIRQ:
FFFFFFFFFFFFB628 0FEF0028 subui sp,sp,#40
FFFFFFFFFFFFB62C 67E08000 sw r1,[sp]
FFFFFFFFFFFFB630 67E10008 sw r2,8[sp]
FFFFFFFFFFFFB634 67E18010 sw r3,16[sp]
FFFFFFFFFFFFB638 67E20018 sw r4,24[sp]
FFFFFFFFFFFFB63C 67EF8020 sw lr,32[sp]
FFFFFFFFFFFFB640 E69C0A03 ; SETLO
FFFFFFFFFFFFB644 EE800003 ; SETMID
FFFFFFFFFFFFB648 6A0D0420 inb r1,UART_IS ; get interrupt status
FFFFFFFFFFFFB64C BE1000A1 bge r1,r0,sirq1
FFFFFFFFFFFFB650 1410807F andi r1,r1,#0x7f ; switch on interrupt type
FFFFFFFFFFFFB654 B0100D04 beqi r1,#4,srxirq
FFFFFFFFFFFFB658 B0100B0C beqi r1,#0xC,stxirq
FFFFFFFFFFFFB65C B0100710 beqi r1,#0x10,smsirq
FFFFFFFFFFFFB660 sirq1:
FFFFFFFFFFFFB660 47E08000 lw r1,[sp]
FFFFFFFFFFFFB664 47E10008 lw r2,8[sp]
FFFFFFFFFFFFB668 47E18010 lw r3,16[sp]
FFFFFFFFFFFFB66C 47E20018 lw r4,24[sp]
FFFFFFFFFFFFB670 47EF8020 lw lr,32[sp]
FFFFFFFFFFFFB674 37EF8028 ret #40
; Get the modem status and record it
FFFFFFFFFFFFB678 smsirq:
FFFFFFFFFFFFB678 80009808 inb r1,UART_MS
FFFFFFFFFFFFB67C 60009808 sb r1,Uart_ms
FFFFFFFFFFFFB680 BE007F0A bra sirq1
FFFFFFFFFFFFB684 stxirq:
FFFFFFFFFFFFB684 BE007EEA bra sirq1
; Get a character from the uart and store it in the rx fifo
FFFFFFFFFFFFB688 srxirq:
FFFFFFFFFFFFB688 srxirq1:
FFFFFFFFFFFFB688 E69C0A00 ; SETLO
FFFFFFFFFFFFB68C EE800003 ; SETMID
FFFFFFFFFFFFB690 6A0D0420 inb r1,UART ; get the char (clears interrupt)
FFFFFFFFFFFFB694 40011814 lb r2,Uart_txxon
FFFFFFFFFFFFB698 BE200108 beq r2,r0,srxirq3
FFFFFFFFFFFFB69C B2100413 bnei r1,#XOFF,srxirq2
FFFFFFFFFFFFB6A0 E0400001 setlo r1,#1
FFFFFFFFFFFFB6A4 60009815 sb r1,Uart_txxonoff
FFFFFFFFFFFFB6A8 BE00016A bra srxirq5
FFFFFFFFFFFFB6AC srxirq2:
FFFFFFFFFFFFB6AC B2100311 bnei r1,#XON,srxirq3
FFFFFFFFFFFFB6B0 60001815 sb r0,Uart_txxonoff
FFFFFFFFFFFFB6B4 BE00010A bra srxirq5
FFFFFFFFFFFFB6B8 srxirq3:
FFFFFFFFFFFFB6B8 60001815 sb r0,Uart_txxonoff
FFFFFFFFFFFFB6BC 42011800 lc r2,Uart_rxhead
FFFFFFFFFFFFB6C0 9A019600 lea r3,Uart_rxfifo
FFFFFFFFFFFFB6C4 6A310410 sb r1,[r3+r2] ; store in buffer
FFFFFFFFFFFFB6C8 0A210001 addui r2,r2,#1
FFFFFFFFFFFFB6CC 142101FF andi r2,r2,#0x1ff
FFFFFFFFFFFFB6D0 62011800 sc r2,Uart_rxhead
FFFFFFFFFFFFB6D4 srxirq5:
FFFFFFFFFFFFB6D4 E69C0A01 ; SETLO
FFFFFFFFFFFFB6D8 EE800003 ; SETMID
FFFFFFFFFFFFB6DC 6A0D0420 inb r1,UART_LS ; check for another ready character
FFFFFFFFFFFFB6E0 14108001 andi r1,r1,#rxfull
FFFFFFFFFFFFB6E4 BE107D29 bne r1,r0,srxirq1
FFFFFFFFFFFFB6E8 4000980C lb r1,Uart_rxflow ; are we using flow controls?
FFFFFFFFFFFFB6EC BE1003C9 bne r1,r0,srxirq8
FFFFFFFFFFFFB6F0 31FFED4B call CharsInRxBuf
FFFFFFFFFFFFB6F4 42009810 lc r1,Uart_foff
FFFFFFFFFFFFB6F8 BE408360 blt r4,r1,srxirq8
FFFFFFFFFFFFB6FC E0400001 setlo r1,#1
FFFFFFFFFFFFB700 6000980C sb r1,Uart_rxflow
FFFFFFFFFFFFB704 40009809 lb r1,Uart_rxrts
FFFFFFFFFFFFB708 BE100108 beq r1,r0,srxirq6
FFFFFFFFFFFFB70C E69C0A06 ; SETLO
FFFFFFFFFFFFB710 EE800003 ; SETMID
FFFFFFFFFFFFB714 6A0D0420 inb r1,UART_MC
FFFFFFFFFFFFB718 141080FD andi r1,r1,#0xFD ; turn off RTS
FFFFFFFFFFFFB71C E69C0A06 ; SETLO
FFFFFFFFFFFFB720 EE800003 ; SETMID
FFFFFFFFFFFFB724 6A0D0428 outb r1,UART_MC
FFFFFFFFFFFFB728 srxirq6:
FFFFFFFFFFFFB728 4000980A lb r1,Uart_rxdtr
FFFFFFFFFFFFB72C BE100108 beq r1,r0,srxirq7
FFFFFFFFFFFFB730 E69C0A06 ; SETLO
FFFFFFFFFFFFB734 EE800003 ; SETMID
FFFFFFFFFFFFB738 6A0D0420 inb r1,UART_MC
FFFFFFFFFFFFB73C 141080FE andi r1,r1,#0xFE ; turn off DTR
FFFFFFFFFFFFB740 E69C0A06 ; SETLO
FFFFFFFFFFFFB744 EE800003 ; SETMID
FFFFFFFFFFFFB748 6A0D0428 outb r1,UART_MC
FFFFFFFFFFFFB74C srxirq7:
FFFFFFFFFFFFB74C 4000980B lb r1,Uart_rxxon
FFFFFFFFFFFFB750 BE1000A8 beq r1,r0,srxirq8
FFFFFFFFFFFFB754 E0400013 setlo r1,#XOFF
FFFFFFFFFFFFB758 E69C0A00 ; SETLO
FFFFFFFFFFFFB75C EE800003 ; SETMID
FFFFFFFFFFFFB760 6A0D0428 outb r1,UART
FFFFFFFFFFFFB764 srxirq8:
FFFFFFFFFFFFB764 BE0077EA bra sirq1
;==============================================================================
; Keyboard
; Keyboard BIOS
; BIOS interrupt #417
;
; Function in R1
; 0 = initialize keyboard
; 1 = set keyboard echo
; 2 = get keyboard character
; 3 = check for key available
;==============================================================================
;
FFFFFFFFFFFFB768 KeybdSC:
FFFFFFFFFFFFB768 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFB76C 67EF8000 sw lr,[sp]
FFFFFFFFFFFFB770 B2100300 bnei r1,#0,kbdsc1
FFFFFFFFFFFFB774 31FFEDEC call KeybdInit
FFFFFFFFFFFFB778 BE00016A bra kbdscRet
FFFFFFFFFFFFB77C kbdsc1:
FFFFFFFFFFFFB77C B2100401 bnei r1,#1,kbdsc2
FFFFFFFFFFFFB780 02208009 mov r1,r2
FFFFFFFFFFFFB784 31FFEE06 call SetKeyboardEcho
FFFFFFFFFFFFB788 BE0000EA bra kbdscRet
FFFFFFFFFFFFB78C kbdsc2:
FFFFFFFFFFFFB78C B2100302 bnei r1,#2,kbdsc3
FFFFFFFFFFFFB790 31FFEE08 call KeybdGetChar
FFFFFFFFFFFFB794 BE00008A bra kbdscRet
FFFFFFFFFFFFB798 kbdsc3:
FFFFFFFFFFFFB798 B2100303 bnei r1,#3,kbdsc4
FFFFFFFFFFFFB79C 31FFEE1D call KeybdCheckForKey
FFFFFFFFFFFFB7A0 BE00002A bra kbdscRet
FFFFFFFFFFFFB7A4 kbdsc4:
FFFFFFFFFFFFB7A4 kbdscRet:
FFFFFFFFFFFFB7A4 47EF8000 lw lr,[sp]
FFFFFFFFFFFFB7A8 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFB7AC 01800021 eret
;------------------------------------------------------------------------------
; Initialize keyboard
;------------------------------------------------------------------------------
FFFFFFFFFFFFE9B0.2 KeybdInit:
FFFFFFFFFFFFE9B0.2 18000000450 sb r0,KeybdHead
FFFFFFFFFFFFE9C0.0 18000000451 sb r0,KeybdTail
FFFFFFFFFFFFE9C0.1 0A100000001 setlo r1,#1 ; turn on keyboard echo
FFFFFFFFFFFFE9C0.2 1800200041A sb r1,KeybdEcho
FFFFFFFFFFFFE9D0.0 0DFBE000000 ret
FFFFFFFFFFFFB7B0 KeybdInit:
FFFFFFFFFFFFB7B0 60001450 sb r0,KeybdHead
FFFFFFFFFFFFB7B4 60001451 sb r0,KeybdTail
FFFFFFFFFFFFB7B8 E0400001 setlo r1,#1 ; turn on keyboard echo
FFFFFFFFFFFFB7BC 6000941C sb r1,KeybdEcho
FFFFFFFFFFFFB7C0 37EF8000 ret
;------------------------------------------------------------------------------
; Normal keyboard interrupt, the lowest priority interrupt in the system.
220,72 → 938,77
; Grab the character from the keyboard device and store it in a buffer.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFE9D0.1 KeybdIRQ:
FFFFFFFFFFFFE9D0.1 03FBC000018 subui sp,sp,#24
FFFFFFFFFFFFE9D0.2 27F00000007 sm [sp],r1/r2/r3
FFFFFFFFFFFFE9E0.0 12802000450 lbu r1,KeybdHead
FFFFFFFFFFFFE9E0.1 0504200000F andi r1,r1,#0x0f ; r1 = index into buffer
FFFFFFFFFFFFE9E0.2 0A300000440 setlo r3,#<KeybdBuffer
FFFFFFFFFFFFE9F0.0 0E300000000 sethi r3,#>KeybdBuffer
FFFFFFFFFFFFE9F0.1 KeybdIRQa:
FFFFFFFFFFFFE9F0.1 20805DC0000 inch r2,KEYBD ; get keyboard character
FFFFFFFFFFFFE9F0.2 24801DC0002 outc r0,KEYBD+2 ; clear keyboard strobe (turns off the IRQ)
FFFFFFFFFFFFEA00.0 1A8C2200010 sb r2,[r3+r1] ; store character in buffer
FFFFFFFFFFFFEA00.1 02842000001 addui r1,r1,#1 ; increment head index
FFFFFFFFFFFFEA00.2 0504200000F andi r1,r1,#0x0f
FFFFFFFFFFFFEA10.0 18002000450 sb r1,KeybdHead
FFFFFFFFFFFFEA10.1 KeybdIRQb:
FFFFFFFFFFFFEA10.1 12804000451 lbu r2,KeybdTail ; check to see if we've collided
FFFFFFFFFFFFEA10.2 2F844000109 bne r1,r2,KeybdIRQc ; with the tail
FFFFFFFFFFFFEA20.0 02884000001 addui r2,r2,#1 ; if so, increment the tail index
FFFFFFFFFFFFEA20.1 0508400000F andi r2,r2,#0x0f ; the oldest character will be lost
FFFFFFFFFFFFEA20.2 18004000451 sb r2,KeybdTail
FFFFFFFFFFFFEA30.0 KeybdIRQc:
FFFFFFFFFFFFEA30.0 27700000007 lm [sp],r1/r2/r3
FFFFFFFFFFFFEA30.1 02FBC000018 addui sp,sp,#24
FFFFFFFFFFFFEA30.2 0DFBE000000 ret
FFFFFFFFFFFFB7C4 KeybdIRQ:
FFFFFFFFFFFFB7C4 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFB7C8 67E10000 sw r2,[sp]
FFFFFFFFFFFFB7CC 4A009450 lbu r1,KeybdHead
FFFFFFFFFFFFB7D0 1410800F andi r1,r1,#0x0f ; r1 = index into buffer
FFFFFFFFFFFFB7D4 KeybdIRQa:
FFFFFFFFFFFFB7D4 E69C0000 ; SETLO
FFFFFFFFFFFFB7D8 EE800003 ; SETMID
FFFFFFFFFFFFB7DC 6A0D0821 inch r2,KEYBD ; get keyboard character
FFFFFFFFFFFFB7E0 E69C0002 ; SETLO
FFFFFFFFFFFFB7E4 EE800003 ; SETMID
FFFFFFFFFFFFB7E8 6A0D0029 outc r0,KEYBD+2 ; clear keyboard strobe (turns off the IRQ)
FFFFFFFFFFFFB7EC 60111440 sb r2,KeybdBuffer[r1] ; store character in buffer
FFFFFFFFFFFFB7F0 0A108001 addui r1,r1,#1 ; increment head index
FFFFFFFFFFFFB7F4 1410800F andi r1,r1,#0x0f
FFFFFFFFFFFFB7F8 60009450 sb r1,KeybdHead
FFFFFFFFFFFFB7FC KeybdIRQb:
FFFFFFFFFFFFB7FC 4A011451 lbu r2,KeybdTail ; check to see if we've collided
FFFFFFFFFFFFB800 BE110089 bne r1,r2,KeybdIRQc ; with the tail
FFFFFFFFFFFFB804 0A210001 addui r2,r2,#1 ; if so, increment the tail index
FFFFFFFFFFFFB808 1421000F andi r2,r2,#0x0f ; the oldest character will be lost
FFFFFFFFFFFFB80C 60011451 sb r2,KeybdTail
FFFFFFFFFFFFB810 KeybdIRQc:
FFFFFFFFFFFFB810 47E10000 lw r2,[sp]
FFFFFFFFFFFFB814 37EF8008 ret #8
;------------------------------------------------------------------------------
; r1 0=echo off, non-zero = echo on
;------------------------------------------------------------------------------
FFFFFFFFFFFFEA40.0 SetKeyboardEcho:
FFFFFFFFFFFFEA40.0 1800200041A sb r1,KeybdEcho
FFFFFFFFFFFFEA40.1 0DFBE000000 ret
FFFFFFFFFFFFB818 SetKeyboardEcho:
FFFFFFFFFFFFB818 6000941C sb r1,KeybdEcho
FFFFFFFFFFFFB81C 37EF8000 ret
;-----------------------------------------
; Get character from keyboard buffer
;-----------------------------------------
FFFFFFFFFFFFEA40.2 KeybdGetChar:
FFFFFFFFFFFFEA40.2 03FBC000010 subui sp,sp,#16
FFFFFFFFFFFFEA50.0 27F00000006 sm [sp],r2/r3
FFFFFFFFFFFFEA50.1 12804000451 lbu r2,KeybdTail
FFFFFFFFFFFFEA50.2 12802000450 lbu r1,KeybdHead
FFFFFFFFFFFFEA60.0 2F844000148 beq r1,r2,nochar
FFFFFFFFFFFFEA60.1 0A300000440 setlo r3,#KeybdBuffer
FFFFFFFFFFFFEA60.2 1A8C4100005 lbu r1,[r3+r2]
FFFFFFFFFFFFEA70.0 02884000001 addui r2,r2,#1
FFFFFFFFFFFFEA70.1 0508400000F andi r2,r2,#0x0f
FFFFFFFFFFFFEA70.2 18004000451 sb r2,KeybdTail
FFFFFFFFFFFFEA80.0 27700000006 lm [sp],r2/r3
FFFFFFFFFFFFEA80.1 0DFBE000010 ret #16
FFFFFFFFFFFFEA80.2 nochar:
FFFFFFFFFFFFEA80.2 0A1FFFFFFFF setlo r1,#-1
FFFFFFFFFFFFEA90.0 27700000006 lm [sp],r2/r3
FFFFFFFFFFFFEA90.1 0DFBE000010 ret #16
FFFFFFFFFFFFB820 KeybdGetChar:
FFFFFFFFFFFFB820 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFB824 67E10000 sw r2,[sp]
FFFFFFFFFFFFB828 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFB82C 4A011451 lbu r2,KeybdTail
FFFFFFFFFFFFB830 4A009450 lbu r1,KeybdHead
FFFFFFFFFFFFB834 BE110188 beq r1,r2,nochar
FFFFFFFFFFFFB838 4A209440 lbu r1,KeybdBuffer[r2]
FFFFFFFFFFFFB83C 0A210001 addui r2,r2,#1
FFFFFFFFFFFFB840 1421000F andi r2,r2,#0x0f
FFFFFFFFFFFFB844 60011451 sb r2,KeybdTail
FFFFFFFFFFFFB848 4001141C lb r2,KeybdEcho
FFFFFFFFFFFFB84C BE2000E8 beq r2,r0,kgc3
FFFFFFFFFFFFB850 B210030D bnei r1,#CR,kgc2
FFFFFFFFFFFFB854 31FFF93F call CRLF ; convert CR keystroke into CRLF
FFFFFFFFFFFFB858 BE00008A bra kgc3
FFFFFFFFFFFFB85C kgc2:
FFFFFFFFFFFFB85C 31FFEF47 call DisplayChar
FFFFFFFFFFFFB860 BE00004A bra kgc3
FFFFFFFFFFFFB864 nochar:
FFFFFFFFFFFFB864 E07FFFFF setlo r1,#-1
FFFFFFFFFFFFB868 kgc3:
FFFFFFFFFFFFB868 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFB86C 47E10000 lw r2,[sp]
FFFFFFFFFFFFB870 37EF8010 ret #16
;------------------------------------------------------------------------------
; Check if there is a keyboard character available in the keyboard buffer.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEA90.2 KeybdCheckForKey:
FFFFFFFFFFFFEA90.2 12802000451 lbu r1,KeybdTail
FFFFFFFFFFFFEAA0.0 12804000450 lbu r2,KeybdHead
FFFFFFFFFFFFEAA0.1 2F8440000A8 beq r1,r2,kck1
FFFFFFFFFFFFEAA0.2 0A100000001 setlo r1,#1
FFFFFFFFFFFFEAB0.0 0DFBE000000 ret
FFFFFFFFFFFFEAB0.1 kck1:
FFFFFFFFFFFFEAB0.1 0104210000A xor r1,r1,r1 ; return zero
FFFFFFFFFFFFEAB0.2 0DFBE000000 ret
FFFFFFFFFFFFB874 KeybdCheckForKey:
FFFFFFFFFFFFB874 4A009451 lbu r1,KeybdTail
FFFFFFFFFFFFB878 4A011450 lbu r2,KeybdHead
FFFFFFFFFFFFB87C 04110439 sne r1,r1,r2
FFFFFFFFFFFFB880 37EF8000 ret
;------------------------------------------------------------------------------
; Check if there is a keyboard character available. If so return true (1)
292,14 → 1015,12
; otherwise return false (0) in r1.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEAC0.0 KeybdCheckForKeyDirect:
FFFFFFFFFFFFEAC0.0 20803DC0000 inch r1,KEYBD
FFFFFFFFFFFFEAC0.1 2F8400000A1 bge r1,r0,cfkd1
FFFFFFFFFFFFEAC0.2 0A100000001 setlo r1,#1
FFFFFFFFFFFFEAD0.0 0DFBE000000 ret
FFFFFFFFFFFFEAD0.1 cfkd1:
FFFFFFFFFFFFEAD0.1 0104210000A xor r1,r1,r1 ; return 0 in r1
FFFFFFFFFFFFEAD0.2 0DFBE000000 ret
FFFFFFFFFFFFB884 KeybdCheckForKeyDirect:
FFFFFFFFFFFFB884 E69C0000 ; SETLO
FFFFFFFFFFFFB888 EE800003 ; SETMID
FFFFFFFFFFFFB88C 6A0D0421 inch r1,KEYBD
FFFFFFFFFFFFB890 04100430 slt r1,r1,r0
FFFFFFFFFFFFB894 37EF8000 ret
;------------------------------------------------------------------------------
; Get character directly from keyboard. This routine blocks until a key is
306,93 → 1027,236
; available.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEAE0.0 KeybdGetCharDirect:
FFFFFFFFFFFFEAE0.0 03FBC000010 subui sp,sp,#16
FFFFFFFFFFFFEAE0.1 27F40000002 sm [sp],r2/r31
FFFFFFFFFFFFEAE0.2 0A2FFDC0000 setlo r2,KEYBD
FFFFFFFFFFFFEAF0.0 kgc1:
FFFFFFFFFFFFEAF0.0 20803DC0000 inch r1,KEYBD
FFFFFFFFFFFFEAF0.1 2F840000001 bge r1,r0,kgc1
FFFFFFFFFFFFEAF0.2 24801DC0002 outc r0,KEYBD+2 ; clear keyboard strobe
FFFFFFFFFFFFEB00.0 050420000FF andi r1,r1,#0xff ; remove strobe bit
FFFFFFFFFFFFEB00.1 1000400041A lb r2,KeybdEcho ; is keyboard echo on ?
FFFFFFFFFFFFEB00.2 2F880000128 beq r2,r0,gk1
FFFFFFFFFFFFEB10.0 2C84010000D bnei r1,#'\r',gk2 ; convert CR keystroke into CRLF
FFFFFFFFFFFFEB10.1 0C7FFFFFC09 call CRLF
FFFFFFFFFFFFEB10.2 2F8000000AA bra gk1
FFFFFFFFFFFFEB20.0 gk2:
FFFFFFFFFFFFEB20.0 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFEB20.1 gk1:
FFFFFFFFFFFFEB20.1 27740000002 lm [sp],r2/r31
FFFFFFFFFFFFEB20.2 0DFBE000010 ret #16
FFFFFFFFFFFFB898 KeybdGetCharDirect:
FFFFFFFFFFFFB898 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFB89C 67E10000 sw r2,[sp]
FFFFFFFFFFFFB8A0 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFB8A4 E09C0000 setlo r2,KEYBD
FFFFFFFFFFFFB8A8 kgc1:
FFFFFFFFFFFFB8A8 E69C0000 ; SETLO
FFFFFFFFFFFFB8AC EE800003 ; SETMID
FFFFFFFFFFFFB8B0 6A0D0421 inch r1,KEYBD
FFFFFFFFFFFFB8B4 BE107FA1 bge r1,r0,kgc1
FFFFFFFFFFFFB8B8 E69C0002 ; SETLO
FFFFFFFFFFFFB8BC EE800003 ; SETMID
FFFFFFFFFFFFB8C0 6A0D0029 outc r0,KEYBD+2 ; clear keyboard strobe
FFFFFFFFFFFFB8C4 141080FF andi r1,r1,#0xff ; remove strobe bit
FFFFFFFFFFFFB8C8 4001141C lb r2,KeybdEcho ; is keyboard echo on ?
FFFFFFFFFFFFB8CC BE2000A8 beq r2,r0,gk1
FFFFFFFFFFFFB8D0 B210030D bnei r1,#'\r',gk2 ; convert CR keystroke into CRLF
FFFFFFFFFFFFB8D4 31FFF93F call CRLF
FFFFFFFFFFFFB8D8 BE00004A bra gk1
FFFFFFFFFFFFB8DC gk2:
FFFFFFFFFFFFB8DC 31FFEF47 call DisplayChar
FFFFFFFFFFFFB8E0 gk1:
FFFFFFFFFFFFB8E0 47E10000 lw r2,[sp]
FFFFFFFFFFFFB8E4 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFB8E8 37EF8010 ret #16
;==============================================================================
;==============================================================================
;------------------------------------------------------------------------------
; 1000 Hz interrupt
; 100 Hz interrupt
; - takes care of "flashing" the cursor
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEB30.0 Pulse1000:
FFFFFFFFFFFFEB30.0 03FBC000018 subui sp,sp,#24
FFFFFFFFFFFFEB30.1 27F40000003 sm [sp],r1/r2/lr
FFFFFFFFFFFFEB30.2 11802000400 lw r1,Milliseconds
FFFFFFFFFFFFEB40.0 02842000001 addui r1,r1,#1
FFFFFFFFFFFFEB40.1 19802000400 sw r1,Milliseconds
FFFFFFFFFFFFEB40.2 0A2FFD00000 setlo r2,TEXTSCR
FFFFFFFFFFFFEB50.0 108820000DE lc r1,222[r2]
FFFFFFFFFFFFEB50.1 02842000001 addui r1,r1,#1
FFFFFFFFFFFFEB50.2 188820000DE sc r1,222[r2]
FFFFFFFFFFFFEB60.0 10801FF0000 lc r0,0xFFFF_FFFF_FFFF_0000 ; clear interrupt
FFFFFFFFFFFFEB60.1 11802000400 lw r1,Milliseconds
FFFFFFFFFFFFEB60.2 0504200007F andi r1,r1,#0x7f
FFFFFFFFFFFFEB70.0 2C840080040 bnei r1,#64,p10001
FFFFFFFFFFFFEB70.1 0C7FFFFFAE1 call FlashCursor
FFFFFFFFFFFFEB70.2 p10001:
FFFFFFFFFFFFEB70.2 27740000003 lm [sp],r1/r2/lr
FFFFFFFFFFFFEB80.0 0DFBE000018 ret #24
FFFFFFFFFFFFB8EC Pulse100:
FFFFFFFFFFFFB8EC 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFB8F0 67EF8000 sw lr,[sp]
FFFFFFFFFFFFB8F4 E6900000 ; SETLO
FFFFFFFFFFFFB8F8 EE800003 ; SETMID
FFFFFFFFFFFFB8FC 6A0D082D lea r2,TEXTSCR
FFFFFFFFFFFFB900 8220814E inch r1,334[r2]
FFFFFFFFFFFFB904 0A108001 addui r1,r1,#1
FFFFFFFFFFFFB908 9220814E outc r1,334[r2]
FFFFFFFFFFFFB90C 31FFF2D8 call DisplayDatetime
FFFFFFFFFFFFB910 31FFEE4A call SelectNextToRunTCB
FFFFFFFFFFFFB914 31FFEE4C call SwitchTask
FFFFFFFFFFFFB918 E6BF0010 ; SETLO
FFFFFFFFFFFFB91C 6A0D0010 sb r0,0xFFFF_FFFF_FFFF_0010 ; clear interrupt
; lw r1,TickIRQAddr
; jal r31,[r1]
; lw r1,Milliseconds
; andi r1,r1,#0x0f
; bnei r1,#5,p1001
; call FlashCursor
FFFFFFFFFFFFB920 p1001:
FFFFFFFFFFFFB920 47EF8000 lw lr,[sp]
FFFFFFFFFFFFB924 37EF8008 ret #8
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
FFFFFFFFFFFFB928 SelectNextToRunTCB:
FFFFFFFFFFFFB928 620020A8 sc r0,NextToRunTCB
FFFFFFFFFFFFB92C 37EF8000 ret
;------------------------------------------------------------------------------
; Switch from the RunningTCB to the NextToRunTCB
;------------------------------------------------------------------------------
FFFFFFFFFFFFB930 SwitchTask:
FFFFFFFFFFFFB930 6600A0B0 sw r1,r1save
FFFFFFFFFFFFB934 660120B8 sw r2,r2save
FFFFFFFFFFFFB938 4C00A0A8 lcu r1,NextToRunTCB
FFFFFFFFFFFFB93C 4C0120A6 lcu r2,RunningTCB
FFFFFFFFFFFFB940 BE110089 bne r1,r2,swtsk1 ; are we already running this TCB ?
FFFFFFFFFFFFB944 4600A0B0 lw r1,r1save
FFFFFFFFFFFFB948 460120B8 lw r2,r2save
FFFFFFFFFFFFB94C 37EF8000 ret
FFFFFFFFFFFFB950 swtsk1:
FFFFFFFFFFFFB950 142101FF andi r2,r2,#0x1ff ; max 512 TCB's
FFFFFFFFFFFFB954 1A210200 mului r2,r2,#TCBSize
FFFFFFFFFFFFB958 E6800000 ; SETLO
FFFFFFFFFFFFB95C EE800400 ; SETMID
FFFFFFFFFFFFB960 042D0803 addui r2,r2,#TCBBase
FFFFFFFFFFFFB964 4600A0B0 lw r1,r1save ; get back r1
FFFFFFFFFFFFB968 66208000 sw r1,TCBr1[r2]
FFFFFFFFFFFFB96C 4600A0B8 lw r1,r2save ; get back r2
FFFFFFFFFFFFB970 66208008 sw r1,TCBr2[r2]
FFFFFFFFFFFFB974 66218010 sw r3,TCBr3[r2]
FFFFFFFFFFFFB978 66220018 sw r4,TCBr4[r2]
FFFFFFFFFFFFB97C 66228020 sw r5,TCBr5[r2]
FFFFFFFFFFFFB980 66230028 sw r6,TCBr6[r2]
FFFFFFFFFFFFB984 66238030 sw r7,TCBr7[r2]
FFFFFFFFFFFFB988 66240038 sw r8,TCBr8[r2]
FFFFFFFFFFFFB98C 66248040 sw r9,TCBr9[r2]
FFFFFFFFFFFFB990 66250048 sw r10,TCBr10[r2]
FFFFFFFFFFFFB994 66258050 sw r11,TCBr11[r2]
FFFFFFFFFFFFB998 66260058 sw r12,TCBr12[r2]
FFFFFFFFFFFFB99C 66268060 sw r13,TCBr13[r2]
FFFFFFFFFFFFB9A0 66270068 sw r14,TCBr14[r2]
FFFFFFFFFFFFB9A4 66278070 sw r15,TCBr15[r2]
FFFFFFFFFFFFB9A8 66280078 sw r16,TCBr16[r2]
FFFFFFFFFFFFB9AC 66288080 sw r17,TCBr17[r2]
FFFFFFFFFFFFB9B0 66290088 sw r18,TCBr18[r2]
FFFFFFFFFFFFB9B4 66298090 sw r19,TCBr19[r2]
FFFFFFFFFFFFB9B8 662A0098 sw r20,TCBr20[r2]
FFFFFFFFFFFFB9BC 662A80A0 sw r21,TCBr21[r2]
FFFFFFFFFFFFB9C0 662B00A8 sw r22,TCBr22[r2]
FFFFFFFFFFFFB9C4 662B80B0 sw r23,TCBr23[r2]
FFFFFFFFFFFFB9C8 662C00B8 sw r24,TCBr24[r2]
FFFFFFFFFFFFB9CC 662C80C0 sw r25,TCBr25[r2]
FFFFFFFFFFFFB9D0 662D00C8 sw r26,TCBr26[r2]
FFFFFFFFFFFFB9D4 662D80D0 sw r27,TCBr27[r2]
FFFFFFFFFFFFB9D8 662E00D8 sw r28,TCBr28[r2]
FFFFFFFFFFFFB9DC 662E80E0 sw r29,TCBr29[r2]
FFFFFFFFFFFFB9E0 662F00E8 sw r30,TCBr30[r2]
FFFFFFFFFFFFB9E4 662F80F0 sw r31,TCBr31[r2]
FFFFFFFFFFFFB9E8 4C0120A8 lcu r2,NextToRunTCB
FFFFFFFFFFFFB9EC 620120A6 sc r2,RunningTCB
FFFFFFFFFFFFB9F0 1A210200 mului r2,r2,#TCBSize
FFFFFFFFFFFFB9F4 E6800000 ; SETLO
FFFFFFFFFFFFB9F8 EE800400 ; SETMID
FFFFFFFFFFFFB9FC 042D0803 addui r2,r2,#TCBBase
FFFFFFFFFFFFBA00 46208000 lw r1,TCBr1[r2]
FFFFFFFFFFFFBA04 46218010 lw r3,TCBr3[r2]
FFFFFFFFFFFFBA08 46220018 lw r4,TCBr4[r2]
FFFFFFFFFFFFBA0C 46228020 lw r5,TCBr5[r2]
FFFFFFFFFFFFBA10 46230028 lw r6,TCBr6[r2]
FFFFFFFFFFFFBA14 46238030 lw r7,TCBr7[r2]
FFFFFFFFFFFFBA18 46240038 lw r8,TCBr8[r2]
FFFFFFFFFFFFBA1C 46248040 lw r9,TCBr9[r2]
FFFFFFFFFFFFBA20 46250048 lw r10,TCBr10[r2]
FFFFFFFFFFFFBA24 46258050 lw r11,TCBr11[r2]
FFFFFFFFFFFFBA28 46260058 lw r12,TCBr12[r2]
FFFFFFFFFFFFBA2C 46268060 lw r13,TCBr13[r2]
FFFFFFFFFFFFBA30 46270068 lw r14,TCBr14[r2]
FFFFFFFFFFFFBA34 46278070 lw r15,TCBr15[r2]
FFFFFFFFFFFFBA38 46280078 lw r16,TCBr16[r2]
FFFFFFFFFFFFBA3C 46288080 lw r17,TCBr17[r2]
FFFFFFFFFFFFBA40 46290088 lw r18,TCBr18[r2]
FFFFFFFFFFFFBA44 46298090 lw r19,TCBr19[r2]
FFFFFFFFFFFFBA48 462A0098 lw r20,TCBr20[r2]
FFFFFFFFFFFFBA4C 462A80A0 lw r21,TCBr21[r2]
FFFFFFFFFFFFBA50 462B00A8 lw r22,TCBr22[r2]
FFFFFFFFFFFFBA54 462B80B0 lw r23,TCBr23[r2]
FFFFFFFFFFFFBA58 462C00B8 lw r24,TCBr24[r2]
FFFFFFFFFFFFBA5C 462C80C0 lw r25,TCBr25[r2]
FFFFFFFFFFFFBA60 462D00C8 lw r26,TCBr26[r2]
FFFFFFFFFFFFBA64 462D80D0 lw r27,TCBr27[r2]
FFFFFFFFFFFFBA68 462E00D8 lw r28,TCBr28[r2]
FFFFFFFFFFFFBA6C 462E80E0 lw r29,TCBr29[r2]
FFFFFFFFFFFFBA70 462F00E8 lw r30,TCBr30[r2]
FFFFFFFFFFFFBA74 462F80F0 lw r31,TCBr31[r2]
FFFFFFFFFFFFBA78 46210008 lw r2,TCBr2[r2]
FFFFFFFFFFFFBA7C 37EF8000 ret
;------------------------------------------------------------------------------
; Flash Cursor
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEB80.1 FlashCursor:
FFFFFFFFFFFFEB80.1 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEB80.2 27F40000007 sm [sp],r1/r2/r3/r31
FFFFFFFFFFFFEB90.0 0C7FFFFFB55 call CalcScreenLoc
FFFFFFFFFFFFEB90.1 02842010000 addui r1,r1,#0x10000
FFFFFFFFFFFFBA80 FlashCursor:
FFFFFFFFFFFFBA80 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBA84 67E08000 sw r1,[sp]
FFFFFFFFFFFFBA88 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBA8C 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBA90 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBA94 31FFEF37 call CalcScreenLoc
FFFFFFFFFFFFBA98 E6810000 ; SETLO
FFFFFFFFFFFFBA9C 041D0403 addui r1,r1,#0x10000
FFFFFFFFFFFFBAA0 4001141A lb r2,CursorFlash
FFFFFFFFFFFFBAA4 BE2001C8 beq r2,r0,flshcrsr2
; causes screen colors to flip around
FFFFFFFFFFFFEB90.2 10844000000 lc r2,[r1]
FFFFFFFFFFFFEBA0.0 02884000001 addui r2,r2,#1
FFFFFFFFFFFFEBA0.1 18844000000 sc r2,[r1]
FFFFFFFFFFFFEBA0.2 11804000408 lw r2,Lastloc
FFFFFFFFFFFFEBB0.0 2F8440000A8 beq r1,r2,flshcrsr1
FFFFFFFFFFFFBAA8 82110000 inch r2,[r1]
FFFFFFFFFFFFBAAC 0A210001 addui r2,r2,#1
FFFFFFFFFFFFBAB0 92110000 outc r2,[r1]
FFFFFFFFFFFFBAB4 flshcrsr3:
FFFFFFFFFFFFBAB4 46011408 lw r2,Lastloc
FFFFFFFFFFFFBAB8 BE110088 beq r1,r2,flshcrsr1
; restore the screen colors of the previous cursor location
FFFFFFFFFFFFEBB0.1 10806000414 lc r3,ScreenColor
FFFFFFFFFFFFEBB0.2 18886000000 sc r3,[r2]
FFFFFFFFFFFFEBC0.0 19802000408 sw r1,Lastloc
FFFFFFFFFFFFEBC0.1 flshcrsr1:
FFFFFFFFFFFFEBC0.1 27740000007 lm [sp],r1/r2/r3/r31
FFFFFFFFFFFFEBC0.2 0DFBE000020 ret #32
FFFFFFFFFFFFBABC 42019414 lc r3,ScreenColor
FFFFFFFFFFFFBAC0 92218000 outc r3,[r2]
FFFFFFFFFFFFBAC4 66009408 sw r1,Lastloc
FFFFFFFFFFFFBAC8 flshcrsr1:
FFFFFFFFFFFFBAC8 47E08000 lw r1,[sp]
FFFFFFFFFFFFBACC 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBAD0 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBAD4 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFBAD8 37EF8020 ret #32
FFFFFFFFFFFFBADC flshcrsr2:
FFFFFFFFFFFFBADC 42019414 lc r3,ScreenColor
FFFFFFFFFFFFBAE0 92118000 outc r3,[r1]
FFFFFFFFFFFFBAE4 BE007E8A bra flshcrsr3
FFFFFFFFFFFFBAE8 CursorOff:
FFFFFFFFFFFFBAE8 160080A0 lw r1,#0xA0
FFFFFFFFFFFFBAEC E69A0010 ; SETLO
FFFFFFFFFFFFBAF0 EE800003 ; SETMID
FFFFFFFFFFFFBAF4 6A0D0429 outc r1,TEXTREG+16 ; turn off cursor
FFFFFFFFFFFFBAF8 37EF8000 ret
FFFFFFFFFFFFBAFC CursorOn:
FFFFFFFFFFFFBAFC 160080E0 lw r1,#0xE0
FFFFFFFFFFFFBB00 E69A0010 ; SETLO
FFFFFFFFFFFFBB04 EE800003 ; SETMID
FFFFFFFFFFFFBB08 6A0D0429 outc r1,TEXTREG+16 ; turn on cursor
FFFFFFFFFFFFBB0C 37EF8000 ret
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
FFFFFFFFFFFFEBD0.0 ClearBmpScreen:
FFFFFFFFFFFFEBD0.0 03FBC000028 subui sp,sp,#40
FFFFFFFFFFFFEBD0.1 27F4000000F sm [sp],r1/r2/r3/r4/r31
FFFFFFFFFFFFEBD0.2 0A100000554 setlo r1,#1364 ; calc number to clear
FFFFFFFFFFFFEBE0.0 0A200000300 setlo r2,#768
FFFFFFFFFFFFEBE0.1 01044200018 mulu r2,r1,r2 ; r2 = # pixels to clear
FFFFFFFFFFFFEBE0.2 01004400009 or r4,r0,r2 ; r4 = # pixels to clear
FFFFFFFFFFFFEBF0.0 0A129292929 setlo r1,#0x29292929 ;
FFFFFFFFFFFFEBF0.1 0A300200000 setlo r3,#<BITMAPSCR ; screen address
FFFFFFFFFFFFEBF0.2 0E300000001 sethi r3,#>BITMAPSCR
FFFFFFFFFFFFEC00.0 csj4:
FFFFFFFFFFFFEC00.0 190C2000000 sh r1,[r3]
FFFFFFFFFFFFEC00.1 028C6000004 addui r3,r3,#4
FFFFFFFFFFFFEC00.2 2F80400000F loop r2,csj4
FFFFFFFFFFFFEC10.0 2774000000F lm [sp],r1/r2/r3/r4/r31
FFFFFFFFFFFFEC10.1 0DFBE000028 ret #40
FFFFFFFFFFFFBB10 ClearBmpScreen:
FFFFFFFFFFFFBB10 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFBB14 67E08000 sw r1,[sp]
FFFFFFFFFFFFBB18 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBB1C 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBB20 E68FFC00 ; SETLO
FFFFFFFFFFFFBB24 040D0809 lw r2,#1364*768
FFFFFFFFFFFFBB28 06210601 shrui r2,r2,#3 ; r2 = # words to clear
FFFFFFFFFFFFBB2C E6A92929 ; SETLO
FFFFFFFFFFFFBB30 EEA4A4A4 ; SETMID
FFFFFFFFFFFFBB34 F6829292 ; SETHI
FFFFFFFFFFFFBB38 6A0D042D lea r1,0x2929292929292929 ; r1 = color for eight pixels
FFFFFFFFFFFFBB3C E6A00000 ; SETLO
FFFFFFFFFFFFBB40 EE800400 ; SETMID
FFFFFFFFFFFFBB44 6A0D0C2D lea r3,BITMAPSCR ; r3 = screen address
FFFFFFFFFFFFBB48 csj4:
FFFFFFFFFFFFBB48 66308000 sw r1,[r3] ; store pixel data
FFFFFFFFFFFFBB4C 0A318008 addui r3,r3,#8 ; advance screen address by eight
FFFFFFFFFFFFBB50 BE017FCF loop r2,csj4 ; decrement pixel count and loop back
FFFFFFFFFFFFBB54 47E08000 lw r1,[sp]
FFFFFFFFFFFFBB58 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBB5C 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBB60 37EF8018 ret #24
;------------------------------------------------------------------------------
; Clear the screen and the screen color memory
400,50 → 1264,77
; is working at all.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEC10.2 ClearScreen:
FFFFFFFFFFFFEC10.2 03FBC000028 subui sp,sp,#40
FFFFFFFFFFFFEC20.0 27F4000000F sm [sp],r1/r2/r3/r4/r31
FFFFFFFFFFFFEC20.1 0A3FFDA0000 setlo r3,#TEXTREG
FFFFFFFFFFFFEC20.2 108C2000000 lc r1,TEXT_COLS[r3] ; calc number to clear
FFFFFFFFFFFFEC30.0 108C4000002 lc r2,TEXT_ROWS[r3]
FFFFFFFFFFFFEC30.1 01044200018 mulu r2,r1,r2 ; r2 = # chars to clear
FFFFFFFFFFFFEC30.2 0A100000020 setlo r1,#32 ; space char
FFFFFFFFFFFFEC40.0 10808000414 lc r4,ScreenColor
FFFFFFFFFFFFEC40.1 0C7FFFFFB45 call AsciiToScreen
FFFFFFFFFFFFEC40.2 0A3FFD00000 setlo r3,#TEXTSCR ; text screen address
FFFFFFFFFFFFEC50.0 csj4:
FFFFFFFFFFFFEC50.0 188C2000000 sc r1,[r3]
FFFFFFFFFFFFEC50.1 188C8010000 sc r4,0x10000[r3] ; color screen is 0x10000 higher
FFFFFFFFFFFFEC50.2 028C6000002 addu r3,r3,#2
FFFFFFFFFFFFEC60.0 2F805FFFF8F loop r2,csj4
FFFFFFFFFFFFEC60.1 2774000000F lm [sp],r1/r2/r3/r4/r31
FFFFFFFFFFFFEC60.2 0DFBE000028 ret #40
FFFFFFFFFFFFBB64 ClearScreen:
FFFFFFFFFFFFBB64 0FEF0028 subui sp,sp,#40
FFFFFFFFFFFFBB68 67E08000 sw r1,[sp]
FFFFFFFFFFFFBB6C 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBB70 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBB74 67E20018 sw r4,24[sp]
FFFFFFFFFFFFBB78 67EF8020 sw lr,32[sp]
FFFFFFFFFFFFBB7C E69A0000 ; SETLO
FFFFFFFFFFFFBB80 EE800003 ; SETMID
FFFFFFFFFFFFBB84 6A0D0C2D lea r3,TEXTREG
FFFFFFFFFFFFBB88 82308000 inch r1,TEXT_COLS[r3] ; calc number to clear
FFFFFFFFFFFFBB8C 82310002 inch r2,TEXT_ROWS[r3]
FFFFFFFFFFFFBB90 04110818 mulu r2,r1,r2 ; r2 = # chars to clear
FFFFFFFFFFFFBB94 E0400020 setlo r1,#32 ; space char
FFFFFFFFFFFFBB98 42021414 lc r4,ScreenColor
FFFFFFFFFFFFBB9C 31FFEF2B call AsciiToScreen
FFFFFFFFFFFFBBA0 E6900000 ; SETLO
FFFFFFFFFFFFBBA4 EE800003 ; SETMID
FFFFFFFFFFFFBBA8 6A0D0C2D lea r3,TEXTSCR ; text screen address
FFFFFFFFFFFFBBAC csj4:
FFFFFFFFFFFFBBAC 92308000 outc r1,[r3]
FFFFFFFFFFFFBBB0 E6810000 ; SETLO
FFFFFFFFFFFFBBB4 6A3D1029 outc r4,0x10000[r3] ; color screen is 0x10000 higher
FFFFFFFFFFFFBBB8 0A318002 addui r3,r3,#2
FFFFFFFFFFFFBBBC BE017F8F loop r2,csj4
FFFFFFFFFFFFBBC0 47EF8020 lw lr,32[sp]
FFFFFFFFFFFFBBC4 47E20018 lw r4,24[sp]
FFFFFFFFFFFFBBC8 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBBCC 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBBD0 47E08000 lw r1,[sp]
FFFFFFFFFFFFBBD4 37EF8028 ret #40
;------------------------------------------------------------------------------
; Scroll text on the screen upwards
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEC70.0 ScrollUp:
FFFFFFFFFFFFEC70.0 03FBC000028 subui sp,sp,#40
FFFFFFFFFFFFEC70.1 27F4000000F sm [sp],r1/r2/r3/r4/r31
FFFFFFFFFFFFEC70.2 0A3FFDA0000 setlo r3,#TEXTREG
FFFFFFFFFFFFEC80.0 108C2000000 lc r1,TEXT_COLS[r3] ; r1 = # text columns
FFFFFFFFFFFFEC80.1 108C4000002 lc r2,TEXT_ROWS[r3]
FFFFFFFFFFFFEC80.2 01044200018 mulu r2,r1,r2 ; calc number of chars to scroll
FFFFFFFFFFFFEC90.0 01082200005 subu r2,r2,r1 ; one less row
FFFFFFFFFFFFEC90.1 0A3FFD00000 setlo r3,#TEXTSCR
FFFFFFFFFFFFEC90.2 scrup1:
FFFFFFFFFFFFEC90.2 1A8C2400001 lc r4,[r3+r1] ; indexed addressing example
FFFFFFFFFFFFECA0.0 188C8000000 sc r4,[r3]
FFFFFFFFFFFFECA0.1 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFECA0.2 2F805FFFFCF loop r2,scrup1
FFFFFFFFFFFFBBD8 ScrollUp:
FFFFFFFFFFFFBBD8 0FEF0028 subui sp,sp,#40
FFFFFFFFFFFFBBDC 67E08000 sw r1,[sp]
FFFFFFFFFFFFBBE0 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBBE4 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBBE8 67E20018 sw r4,24[sp]
FFFFFFFFFFFFBBEC 67EF8020 sw lr,32[sp]
FFFFFFFFFFFFBBF0 E69A0000 ; SETLO
FFFFFFFFFFFFBBF4 EE800003 ; SETMID
FFFFFFFFFFFFBBF8 6A0D0C2D lea r3,TEXTREG
FFFFFFFFFFFFBBFC 82308000 inch r1,TEXT_COLS[r3] ; r1 = # text columns
FFFFFFFFFFFFBC00 82310002 inch r2,TEXT_ROWS[r3]
FFFFFFFFFFFFBC04 04110818 mulu r2,r1,r2 ; calc number of chars to scroll
FFFFFFFFFFFFBC08 04208805 subu r2,r2,r1 ; one less row
FFFFFFFFFFFFBC0C E6900000 ; SETLO
FFFFFFFFFFFFBC10 EE800003 ; SETMID
FFFFFFFFFFFFBC14 6A0D0C2D lea r3,TEXTSCR
FFFFFFFFFFFFBC18 scrup1:
FFFFFFFFFFFFBC18 6A309021 inch r4,[r3+r1] ; indexed addressing example
FFFFFFFFFFFFBC1C 92320000 outc r4,[r3]
FFFFFFFFFFFFBC20 0A318002 addui r3,r3,#2
FFFFFFFFFFFFBC24 BE017FAF loop r2,scrup1
FFFFFFFFFFFFECB0.0 0A3FFDA0000 setlo r3,#TEXTREG
FFFFFFFFFFFFECB0.1 108C2000002 lc r1,TEXT_ROWS[r3]
FFFFFFFFFFFFECB0.2 03842000001 subui r1,r1,#1
FFFFFFFFFFFFECC0.0 0C7FFFFFB34 call BlankLine
FFFFFFFFFFFFECC0.1 2774000000F lm [sp],r1/r2/r3/r4/r31
FFFFFFFFFFFFECC0.2 0DFBE000028 ret #40
FFFFFFFFFFFFBC28 E69A0000 ; SETLO
FFFFFFFFFFFFBC2C EE800003 ; SETMID
FFFFFFFFFFFFBC30 6A0D0C2D lea r3,TEXTREG
FFFFFFFFFFFFBC34 82308002 inch r1,TEXT_ROWS[r3]
FFFFFFFFFFFFBC38 0E108001 subui r1,r1,#1
FFFFFFFFFFFFBC3C 31FFEF16 call BlankLine
FFFFFFFFFFFFBC40 47E08000 lw r1,[sp]
FFFFFFFFFFFFBC44 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBC48 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBC4C 47E20018 lw r4,24[sp]
FFFFFFFFFFFFBC50 47EF8020 lw lr,32[sp]
FFFFFFFFFFFFBC54 37EF8028 ret #40
;------------------------------------------------------------------------------
; Blank out a line on the display
450,47 → 1341,55
; line number to blank is in r1
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFECD0.0 BlankLine:
FFFFFFFFFFFFECD0.0 03FBC000018 subui sp,sp,#24
FFFFFFFFFFFFECD0.1 27F00000007 sm [sp],r1/r2/r3
FFFFFFFFFFFFECD0.2 0A3FFDA0000 setlo r3,TEXTREG ; r3 = text register address
FFFFFFFFFFFFECE0.0 108C4000000 lc r2,TEXT_COLS[r3] ; r2 = # chars to blank out
FFFFFFFFFFFFECE0.1 01082300018 mulu r3,r2,r1
FFFFFFFFFFFFECE0.2 018C6080000 shli r3,r3,#1
FFFFFFFFFFFFECF0.0 028C7D00000 addui r3,r3,#TEXTSCR ; r3 = screen address
FFFFFFFFFFFFECF0.1 0A100000020 setlo r1,#' '
FFFFFFFFFFFFECF0.2 blnkln1:
FFFFFFFFFFFFECF0.2 188C2000000 sc r1,[r3]
FFFFFFFFFFFFED00.0 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFED00.1 2F805FFFFCF loop r2,blnkln1
FFFFFFFFFFFFED00.2 27700000007 lm [sp],r1/r2/r3
FFFFFFFFFFFFED10.0 0DFBE000018 ret #24
FFFFFFFFFFFFBC58 BlankLine:
FFFFFFFFFFFFBC58 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFBC5C 67E08000 sw r1,[sp]
FFFFFFFFFFFFBC60 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBC64 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBC68 E69A0000 ; SETLO
FFFFFFFFFFFFBC6C EE800003 ; SETMID
FFFFFFFFFFFFBC70 6A0D0C2D lea r3,TEXTREG ; r3 = text register address
FFFFFFFFFFFFBC74 82310000 inch r2,TEXT_COLS[r3] ; r2 = # chars to blank out
FFFFFFFFFFFFBC78 04208C18 mulu r3,r2,r1
FFFFFFFFFFFFBC7C 06318200 shli r3,r3,#1
FFFFFFFFFFFFBC80 E6900000 ; SETLO
FFFFFFFFFFFFBC84 EE800003 ; SETMID
FFFFFFFFFFFFBC88 043D0C03 addui r3,r3,#TEXTSCR ; r3 = screen address
FFFFFFFFFFFFBC8C E0400020 setlo r1,#' '
FFFFFFFFFFFFBC90 blnkln1:
FFFFFFFFFFFFBC90 92308000 outc r1,[r3]
FFFFFFFFFFFFBC94 0A318002 addui r3,r3,#2
FFFFFFFFFFFFBC98 BE017FCF loop r2,blnkln1
FFFFFFFFFFFFBC9C 47E08000 lw r1,[sp]
FFFFFFFFFFFFBCA0 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBCA4 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBCA8 37EF8018 ret #24
;------------------------------------------------------------------------------
; Convert ASCII character to screen display character.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFED10.1 AsciiToScreen:
FFFFFFFFFFFFED10.1 050420000FF andi r1,r1,#0x00ff
FFFFFFFFFFFFED10.2 2A040240041 bltui r1,#'A',atoscr1
FFFFFFFFFFFFED20.0 2B04014005A bleui r1,#'Z',atoscr1
FFFFFFFFFFFFED20.1 2B84014007A bgtui r1,#'z',atoscr1
FFFFFFFFFFFFED20.2 2A040140061 bltui r1,#'a',atoscr1
FFFFFFFFFFFFED30.0 03042000060 subi r1,r1,#0x60
FFFFFFFFFFFFED30.1 atoscr1:
FFFFFFFFFFFFED30.1 05842000100 ori r1,r1,#0x100
FFFFFFFFFFFFED30.2 0DFBE000000 ret
FFFFFFFFFFFFBCAC AsciiToScreen:
FFFFFFFFFFFFBCAC 141080FF andi r1,r1,#0x00ff
FFFFFFFFFFFFBCB0 A8100541 bltui r1,#'A',atoscr1
FFFFFFFFFFFFBCB4 AC10045A bleui r1,#'Z',atoscr1
FFFFFFFFFFFFBCB8 AE10037A bgtui r1,#'z',atoscr1
FFFFFFFFFFFFBCBC A8100261 bltui r1,#'a',atoscr1
FFFFFFFFFFFFBCC0 0C108060 subi r1,r1,#0x60
FFFFFFFFFFFFBCC4 atoscr1:
FFFFFFFFFFFFBCC4 16108100 ori r1,r1,#0x100
FFFFFFFFFFFFBCC8 37EF8000 ret
;------------------------------------------------------------------------------
; Convert screen character to ascii character
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFED40.0 ScreenToAscii:
FFFFFFFFFFFFED40.0 050420000FF andi r1,r1,#0xff
FFFFFFFFFFFFED40.1 2B84010001A bgtui r1,#26,stasc1
FFFFFFFFFFFFED40.2 0284200003C addui r1,r1,#60
FFFFFFFFFFFFED50.0 stasc1:
FFFFFFFFFFFFED50.0 0DFBE000000 ret
FFFFFFFFFFFFBCCC ScreenToAscii:
FFFFFFFFFFFFBCCC 141080FF andi r1,r1,#0xff
FFFFFFFFFFFFBCD0 AE10021A bgtui r1,#26,stasc1
FFFFFFFFFFFFBCD4 0A10803C addui r1,r1,#60
FFFFFFFFFFFFBCD8 stasc1:
FFFFFFFFFFFFBCD8 37EF8000 ret
;------------------------------------------------------------------------------
; Calculate screen memory location from CursorRow,CursorCol.
499,19 → 1398,23
; r1 = screen location
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFED50.1 CalcScreenLoc:
FFFFFFFFFFFFED50.1 10802000416 lc r1,CursorRow
FFFFFFFFFFFFED50.2 0504200007F andi r1,r1,#0x7f
FFFFFFFFFFFFED60.0 0A3FFDA0000 setlo r3,TEXTREG
FFFFFFFFFFFFED60.1 208C4000000 inch r2,TEXT_COLS[r3]
FFFFFFFFFFFFED60.2 01082200018 mulu r2,r2,r1
FFFFFFFFFFFFED70.0 10802000418 lc r1,CursorCol
FFFFFFFFFFFFED70.1 0504200007F andi r1,r1,#0x7f
FFFFFFFFFFFFED70.2 01082200003 addu r2,r2,r1
FFFFFFFFFFFFED80.0 248C4000016 outc r2,TEXT_CURPOS[r3]
FFFFFFFFFFFFED80.1 01884080000 shli r2,r2,#1
FFFFFFFFFFFFED80.2 02883D00000 addui r1,r2,#TEXTSCR ; r1 = screen location
FFFFFFFFFFFFED90.0 0DFBE000000 ret
FFFFFFFFFFFFBCDC CalcScreenLoc:
FFFFFFFFFFFFBCDC 42009416 lc r1,CursorRow
FFFFFFFFFFFFBCE0 1410807F andi r1,r1,#0x7f
FFFFFFFFFFFFBCE4 E69A0000 ; SETLO
FFFFFFFFFFFFBCE8 EE800003 ; SETMID
FFFFFFFFFFFFBCEC 6A0D0C2D lea r3,TEXTREG
FFFFFFFFFFFFBCF0 82310000 inch r2,TEXT_COLS[r3]
FFFFFFFFFFFFBCF4 04208818 mulu r2,r2,r1
FFFFFFFFFFFFBCF8 42009418 lc r1,CursorCol
FFFFFFFFFFFFBCFC 1410807F andi r1,r1,#0x7f
FFFFFFFFFFFFBD00 04208803 addu r2,r2,r1
FFFFFFFFFFFFBD04 92310016 outc r2,TEXT_CURPOS[r3]
FFFFFFFFFFFFBD08 06210200 shli r2,r2,#1
FFFFFFFFFFFFBD0C E6900000 ; SETLO
FFFFFFFFFFFFBD10 EE800003 ; SETMID
FFFFFFFFFFFFBD14 042D0403 addui r1,r2,#TEXTSCR ; r1 = screen location
FFFFFFFFFFFFBD18 37EF8000 ret
;------------------------------------------------------------------------------
; Display a character on the screen
518,106 → 1421,145
; d1.b = char to display
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFED90.1 DisplayChar:
FFFFFFFFFFFFED90.1 2C84020000D bnei r1,#'\r',dccr ; carriage return ?
FFFFFFFFFFFFED90.2 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEDA0.0 27F40000007 sm [sp],r1/r2/r3/lr
FFFFFFFFFFFFEDA0.1 18800000418 sc r0,CursorCol ; just set cursor column to zero on a CR
FFFFFFFFFFFFEDA0.2 2F8000001AA bra dcx7
FFFFFFFFFFFFEDB0.0 dccr:
FFFFFFFFFFFFEDB0.0 2C840340091 bnei r1,#0x91,dcx6 ; cursor right ?
FFFFFFFFFFFFEDB0.1 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEDB0.2 27F40000007 sm [sp],r1/r2/r3/lr
FFFFFFFFFFFFEDC0.0 10804000418 lc r2,CursorCol
FFFFFFFFFFFFEDC0.1 2C080140038 beqi r2,#56,dcx7
FFFFFFFFFFFFEDC0.2 02884000001 addui r2,r2,#1
FFFFFFFFFFFFEDD0.0 18804000418 sc r2,CursorCol
FFFFFFFFFFFFEDD0.1 dcx7:
FFFFFFFFFFFFEDD0.1 0C7FFFFFB55 call CalcScreenLoc
FFFFFFFFFFFFEDD0.2 27740000007 lm [sp],r1/r2/r3/lr
FFFFFFFFFFFFEDE0.0 0DFBE000020 ret #32
FFFFFFFFFFFFEDE0.1 dcx6:
FFFFFFFFFFFFEDE0.1 2C840300090 bnei r1,#0x90,dcx8 ; cursor up ?
FFFFFFFFFFFFEDE0.2 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEDF0.0 27F40000007 sm [sp],r1/r2/r3/lr
FFFFFFFFFFFFEDF0.1 10804000416 lc r2,CursorRow
FFFFFFFFFFFFEDF0.2 2C0BFE40000 beqi r2,#0,dcx7
FFFFFFFFFFFFEE00.0 03884000001 subui r2,r2,#1
FFFFFFFFFFFFEE00.1 18804000416 sc r2,CursorRow
FFFFFFFFFFFFEE00.2 2F801FFFEAA bra dcx7
FFFFFFFFFFFFEE10.0 dcx8:
FFFFFFFFFFFFEE10.0 2C840280093 bnei r1,#0x93,dcx9 ; cursor left ?
FFFFFFFFFFFFEE10.1 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEE10.2 27F40000007 sm [sp],r1/r2/r3/lr
FFFFFFFFFFFFEE20.0 10804000418 lc r2,CursorCol
FFFFFFFFFFFFEE20.1 2C0BFB40000 beqi r2,#0,dcx7
FFFFFFFFFFFFEE20.2 03884000001 subui r2,r2,#1
FFFFFFFFFFFFEE30.0 18804000418 sc r2,CursorCol
FFFFFFFFFFFFEE30.1 2F801FFFD2A bra dcx7
FFFFFFFFFFFFEE30.2 dcx9:
FFFFFFFFFFFFEE30.2 2C840340092 bnei r1,#0x92,dcx10 ; cursor down ?
FFFFFFFFFFFFEE40.0 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEE40.1 27F40000007 sm [sp],r1/r2/r3/lr
FFFFFFFFFFFFEE40.2 10804000416 lc r2,CursorRow
FFFFFFFFFFFFEE50.0 2C0BF84001E beqi r2,#30,dcx7
FFFFFFFFFFFFEE50.1 02884000001 addui r2,r2,#1
FFFFFFFFFFFFEE50.2 18804000416 sc r2,CursorRow
FFFFFFFFFFFFEE60.0 2F801FFFBAA bra dcx7
FFFFFFFFFFFFEE60.1 dcx10:
FFFFFFFFFFFFEE60.1 2C840340094 bnei r1,#0x94,dcx11 ; cursor home ?
FFFFFFFFFFFFEE60.2 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEE70.0 27F40000007 sm [sp],r1/r2/r3/lr
FFFFFFFFFFFFEE70.1 10804000418 lc r2,CursorCol
FFFFFFFFFFFFEE70.2 2F8800000C8 beq r2,r0,dcx12
FFFFFFFFFFFFEE80.0 18800000418 sc r0,CursorCol
FFFFFFFFFFFFEE80.1 2F801FFFAAA bra dcx7
FFFFFFFFFFFFEE80.2 dcx12:
FFFFFFFFFFFFEE80.2 18800000416 sc r0,CursorRow
FFFFFFFFFFFFEE90.0 2F801FFFA2A bra dcx7
FFFFFFFFFFFFEE90.1 dcx11:
FFFFFFFFFFFFEE90.1 03FBC000030 subui sp,sp,#48
FFFFFFFFFFFFEE90.2 27F4000001F sm [sp],r1/r2/r3/r4/r5/r31
FFFFFFFFFFFFEEA0.0 2C840180099 bnei r1,#0x99,dcx13 ; delete ?
FFFFFFFFFFFFEEA0.1 0C7FFFFFB55 call CalcScreenLoc
FFFFFFFFFFFFEEA0.2 01002300009 or r3,r0,r1 ; r3 = screen location
FFFFFFFFFFFFEEB0.0 10802000418 lc r1,CursorCol ; r1 = cursor column
FFFFFFFFFFFFEEB0.1 2F8000001AA bra dcx5
FFFFFFFFFFFFEEB0.2 dcx13:
FFFFFFFFFFFFEEB0.2 2C840680008 bnei r1,#CTRLH,dcx3 ; backspace ?
FFFFFFFFFFFFEEC0.0 10804000418 lc r2,CursorCol
FFFFFFFFFFFFEEC0.1 2F8800004A8 beq r2,r0,dcx4
FFFFFFFFFFFFEEC0.2 03884000001 subui r2,r2,#1
FFFFFFFFFFFFEED0.0 18804000418 sc r2,CursorCol
FFFFFFFFFFFFEED0.1 0C7FFFFFB55 call CalcScreenLoc ; a0 = screen location
FFFFFFFFFFFFEED0.2 01002300009 or r3,r0,r1 ; r3 = screen location
FFFFFFFFFFFFEEE0.0 10802000418 lc r1,CursorCol
FFFFFFFFFFFFEEE0.1 dcx5:
FFFFFFFFFFFFEEE0.1 108C4000002 lc r2,2[r3]
FFFFFFFFFFFFEEE0.2 188C4000000 sc r2,[r3]
FFFFFFFFFFFFEEF0.0 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFEEF0.1 02842000001 addui r1,r1,#1
FFFFFFFFFFFFEEF0.2 0A4FFDA0000 setlo r4,#TEXTREG
FFFFFFFFFFFFEF00.0 2090A000000 inch r5,TEXT_COLS[r4]
FFFFFFFFFFFFEF00.1 2F84BFFFF24 bltu r1,r5,dcx5
FFFFFFFFFFFFEF00.2 0A200000020 setlo r2,#' '
FFFFFFFFFFFFEF10.0 188C5FFFFFE sc r2,-2[r3]
FFFFFFFFFFFFEF10.1 2F80000022A bra dcx4
FFFFFFFFFFFFEF10.2 dcx3:
FFFFFFFFFFFFEF10.2 2C04040000A beqi r1,#'\n',dclf ; linefeed ?
FFFFFFFFFFFFEF20.0 01002400009 or r4,r0,r1 ; save r1 in r4
FFFFFFFFFFFFEF20.1 0C7FFFFFB55 call CalcScreenLoc ; r1 = screen location
FFFFFFFFFFFFEF20.2 01002300009 or r3,r0,r1 ; r3 = screen location
FFFFFFFFFFFFEF30.0 01008100009 or r1,r0,r4 ; restore r1
FFFFFFFFFFFFEF30.1 0C7FFFFFB45 call AsciiToScreen ; convert ascii char to screen char
FFFFFFFFFFFFEF30.2 188C2000000 sc r1,[r3]
FFFFFFFFFFFFEF40.0 0C7FFFFFBD8 call IncCursorPos
FFFFFFFFFFFFEF40.1 2774000001F lm [sp],r1/r2/r3/r4/r5/r31
FFFFFFFFFFFFEF40.2 0DFBE000030 ret #48
FFFFFFFFFFFFEF50.0 dclf:
FFFFFFFFFFFFEF50.0 0C7FFFFFBE4 call IncCursorRow
FFFFFFFFFFFFEF50.1 dcx4:
FFFFFFFFFFFFEF50.1 2774000001F lm [sp],r1/r2/r3/r4/r5/r31
FFFFFFFFFFFFEF50.2 0DFBE000030 ret #48
FFFFFFFFFFFFBD1C DisplayChar:
FFFFFFFFFFFFBD1C B210080D bnei r1,#'\r',dccr ; carriage return ?
FFFFFFFFFFFFBD20 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBD24 67E08000 sw r1,[sp]
FFFFFFFFFFFFBD28 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBD2C 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBD30 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBD34 62001418 sc r0,CursorCol ; just set cursor column to zero on a CR
FFFFFFFFFFFFBD38 BE00018A bra dcx7
FFFFFFFFFFFFBD3C dccr:
FFFFFFFFFFFFBD3C E6800091 ; SETLO
FFFFFFFFFFFFBD40 BE1D0209 bnei r1,#0x91,dcx6 ; cursor right ?
FFFFFFFFFFFFBD44 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBD48 67E08000 sw r1,[sp]
FFFFFFFFFFFFBD4C 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBD50 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBD54 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBD58 42011418 lc r2,CursorCol
FFFFFFFFFFFFBD5C B0200338 beqi r2,#56,dcx7
FFFFFFFFFFFFBD60 0A210001 addui r2,r2,#1
FFFFFFFFFFFFBD64 62011418 sc r2,CursorCol
FFFFFFFFFFFFBD68 dcx7:
FFFFFFFFFFFFBD68 31FFEF37 call CalcScreenLoc
FFFFFFFFFFFFBD6C 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFBD70 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBD74 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBD78 47E08000 lw r1,[sp]
FFFFFFFFFFFFBD7C 37EF8020 ret #32
FFFFFFFFFFFFBD80 dcx6:
FFFFFFFFFFFFBD80 E6800090 ; SETLO
FFFFFFFFFFFFBD84 BE1D0169 bnei r1,#0x90,dcx8 ; cursor up ?
FFFFFFFFFFFFBD88 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBD8C 67E08000 sw r1,[sp]
FFFFFFFFFFFFBD90 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBD94 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBD98 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBD9C 42011416 lc r2,CursorRow
FFFFFFFFFFFFBDA0 B02FF200 beqi r2,#0,dcx7
FFFFFFFFFFFFBDA4 0E210001 subui r2,r2,#1
FFFFFFFFFFFFBDA8 62011416 sc r2,CursorRow
FFFFFFFFFFFFBDAC BE007DEA bra dcx7
FFFFFFFFFFFFBDB0 dcx8:
FFFFFFFFFFFFBDB0 E6800093 ; SETLO
FFFFFFFFFFFFBDB4 BE1D0169 bnei r1,#0x93,dcx9 ; cursor left ?
FFFFFFFFFFFFBDB8 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBDBC 67E08000 sw r1,[sp]
FFFFFFFFFFFFBDC0 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBDC4 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBDC8 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBDCC 42011418 lc r2,CursorCol
FFFFFFFFFFFFBDD0 B02FE600 beqi r2,#0,dcx7
FFFFFFFFFFFFBDD4 0E210001 subui r2,r2,#1
FFFFFFFFFFFFBDD8 62011418 sc r2,CursorCol
FFFFFFFFFFFFBDDC BE007C6A bra dcx7
FFFFFFFFFFFFBDE0 dcx9:
FFFFFFFFFFFFBDE0 E6800092 ; SETLO
FFFFFFFFFFFFBDE4 BE1D0169 bnei r1,#0x92,dcx10 ; cursor down ?
FFFFFFFFFFFFBDE8 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBDEC 67E08000 sw r1,[sp]
FFFFFFFFFFFFBDF0 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBDF4 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBDF8 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBDFC 42011416 lc r2,CursorRow
FFFFFFFFFFFFBE00 B02FDA1E beqi r2,#30,dcx7
FFFFFFFFFFFFBE04 0A210001 addui r2,r2,#1
FFFFFFFFFFFFBE08 62011416 sc r2,CursorRow
FFFFFFFFFFFFBE0C BE007AEA bra dcx7
FFFFFFFFFFFFBE10 dcx10:
FFFFFFFFFFFFBE10 E6800094 ; SETLO
FFFFFFFFFFFFBE14 BE1D0189 bnei r1,#0x94,dcx11 ; cursor home ?
FFFFFFFFFFFFBE18 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBE1C 67E08000 sw r1,[sp]
FFFFFFFFFFFFBE20 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBE24 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBE28 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBE2C 42011418 lc r2,CursorCol
FFFFFFFFFFFFBE30 BE200068 beq r2,r0,dcx12
FFFFFFFFFFFFBE34 62001418 sc r0,CursorCol
FFFFFFFFFFFFBE38 BE00798A bra dcx7
FFFFFFFFFFFFBE3C dcx12:
FFFFFFFFFFFFBE3C 62001416 sc r0,CursorRow
FFFFFFFFFFFFBE40 BE00794A bra dcx7
FFFFFFFFFFFFBE44 dcx11:
FFFFFFFFFFFFBE44 0FEF0030 subui sp,sp,#48
FFFFFFFFFFFFBE48 67E08000 sw r1,[sp]
FFFFFFFFFFFFBE4C 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBE50 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBE54 67E20018 sw r4,24[sp]
FFFFFFFFFFFFBE58 67E28020 sw r5,32[sp]
FFFFFFFFFFFFBE5C 67EF8028 sw lr,40[sp]
FFFFFFFFFFFFBE60 E6800099 ; SETLO
FFFFFFFFFFFFBE64 BE1D00A9 bnei r1,#0x99,dcx13 ; delete ?
FFFFFFFFFFFFBE68 31FFEF37 call CalcScreenLoc
FFFFFFFFFFFFBE6C 04008C09 or r3,r0,r1 ; r3 = screen location
FFFFFFFFFFFFBE70 42009418 lc r1,CursorCol ; r1 = cursor column
FFFFFFFFFFFFBE74 BE00012A bra dcx5
FFFFFFFFFFFFBE78 dcx13:
FFFFFFFFFFFFBE78 B2101508 bnei r1,#CTRLH,dcx3 ; backspace ?
FFFFFFFFFFFFBE7C 42011418 lc r2,CursorCol
FFFFFFFFFFFFBE80 BE2003A8 beq r2,r0,dcx4
FFFFFFFFFFFFBE84 0E210001 subui r2,r2,#1
FFFFFFFFFFFFBE88 62011418 sc r2,CursorCol
FFFFFFFFFFFFBE8C 31FFEF37 call CalcScreenLoc ; a0 = screen location
FFFFFFFFFFFFBE90 04008C09 or r3,r0,r1 ; r3 = screen location
FFFFFFFFFFFFBE94 42009418 lc r1,CursorCol
FFFFFFFFFFFFBE98 dcx5:
FFFFFFFFFFFFBE98 82310002 inch r2,2[r3]
FFFFFFFFFFFFBE9C 92310000 outc r2,[r3]
FFFFFFFFFFFFBEA0 0A318002 addui r3,r3,#2
FFFFFFFFFFFFBEA4 0A108001 addui r1,r1,#1
FFFFFFFFFFFFBEA8 E69A0000 ; SETLO
FFFFFFFFFFFFBEAC EE800003 ; SETMID
FFFFFFFFFFFFBEB0 6A0D102D lea r4,TEXTREG
FFFFFFFFFFFFBEB4 82428000 inch r5,TEXT_COLS[r4]
FFFFFFFFFFFFBEB8 BE12FF04 bltu r1,r5,dcx5
FFFFFFFFFFFFBEBC E0400020 setlo r1,#' '
FFFFFFFFFFFFBEC0 31FFEF2B call AsciiToScreen
FFFFFFFFFFFFBEC4 9230FFFE outc r1,-2[r3]
FFFFFFFFFFFFBEC8 BE00016A bra dcx4
FFFFFFFFFFFFBECC dcx3:
FFFFFFFFFFFFBECC B010090A beqi r1,#'\n',dclf ; linefeed ?
FFFFFFFFFFFFBED0 04009009 or r4,r0,r1 ; save r1 in r4
FFFFFFFFFFFFBED4 31FFEF37 call CalcScreenLoc ; r1 = screen location
FFFFFFFFFFFFBED8 04008C09 or r3,r0,r1 ; r3 = screen location
FFFFFFFFFFFFBEDC 04020409 or r1,r0,r4 ; restore r1
FFFFFFFFFFFFBEE0 31FFEF2B call AsciiToScreen ; convert ascii char to screen char
FFFFFFFFFFFFBEE4 92308000 outc r1,[r3]
FFFFFFFFFFFFBEE8 31FFEFC4 call IncCursorPos
FFFFFFFFFFFFBEEC BE00004A bra dcx4
FFFFFFFFFFFFBEF0 dclf:
FFFFFFFFFFFFBEF0 31FFEFD2 call IncCursorRow
FFFFFFFFFFFFBEF4 dcx4:
FFFFFFFFFFFFBEF4 47EF8028 lw lr,40[sp]
FFFFFFFFFFFFBEF8 47E28020 lw r5,32[sp]
FFFFFFFFFFFFBEFC 47E20018 lw r4,24[sp]
FFFFFFFFFFFFBF00 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBF04 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBF08 47E08000 lw r1,[sp]
FFFFFFFFFFFFBF0C 37EF8030 ret #48
;------------------------------------------------------------------------------
624,116 → 1566,139
; Increment the cursor position, scroll the screen if needed.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEF60.0 IncCursorPos:
FFFFFFFFFFFFEF60.0 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEF60.1 27F40000007 sm [r30],r1/r2/r3/r31
FFFFFFFFFFFFEF60.2 10802000418 lc r1,CursorCol
FFFFFFFFFFFFEF70.0 02842000001 addui r1,r1,#1
FFFFFFFFFFFFEF70.1 18802000418 sc r1,CursorCol
FFFFFFFFFFFFEF70.2 20805DA0000 inch r2,TEXTREG+TEXT_COLS
FFFFFFFFFFFFEF80.0 2F844000226 bleu r1,r2,icc1
FFFFFFFFFFFFEF80.1 18800000418 sc r0,CursorCol ; column = 0
FFFFFFFFFFFFEF80.2 2F8000000CA bra icr1
FFFFFFFFFFFFEF90.0 IncCursorRow:
FFFFFFFFFFFFEF90.0 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFEF90.1 27F40000007 sm [sp],r1/r2/r3/r31
FFFFFFFFFFFFEF90.2 icr1:
FFFFFFFFFFFFEF90.2 10802000416 lc r1,CursorRow
FFFFFFFFFFFFEFA0.0 02842000001 addui r1,r1,#1
FFFFFFFFFFFFEFA0.1 18802000416 sc r1,CursorRow
FFFFFFFFFFFFEFA0.2 20805DA0002 inch r2,TEXTREG+TEXT_ROWS
FFFFFFFFFFFFEFB0.0 2F8440000A6 bleu r1,r2,icc1
FFFFFFFFFFFFEFB0.1 03884000001 subui r2,r2,#1 ; backup the cursor row, we are scrolling up
FFFFFFFFFFFFEFB0.2 18804000416 sc r2,CursorRow
FFFFFFFFFFFFEFC0.0 0C7FFFFFB1C call ScrollUp
FFFFFFFFFFFFEFC0.1 icc1:
FFFFFFFFFFFFEFC0.1 0C7FFFFFB55 call CalcScreenLoc
FFFFFFFFFFFFEFC0.2 27740000007 lm [sp],r1/r2/r3/r31
FFFFFFFFFFFFEFD0.0 0DFBE000020 ret #32
FFFFFFFFFFFFBF10 IncCursorPos:
FFFFFFFFFFFFBF10 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBF14 67E08000 sw r1,[sp]
FFFFFFFFFFFFBF18 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBF1C 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBF20 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBF24 42009418 lc r1,CursorCol
FFFFFFFFFFFFBF28 0A108001 addui r1,r1,#1
FFFFFFFFFFFFBF2C 62009418 sc r1,CursorCol
FFFFFFFFFFFFBF30 E69A0000 ; SETLO
FFFFFFFFFFFFBF34 EE800003 ; SETMID
FFFFFFFFFFFFBF38 6A0D0821 inch r2,TEXTREG+TEXT_COLS
FFFFFFFFFFFFBF3C BE110246 bleu r1,r2,icc1
FFFFFFFFFFFFBF40 62001418 sc r0,CursorCol ; column = 0
FFFFFFFFFFFFBF44 BE0000CA bra icr1
FFFFFFFFFFFFBF48 IncCursorRow:
FFFFFFFFFFFFBF48 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFBF4C 67E08000 sw r1,[sp]
FFFFFFFFFFFFBF50 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBF54 67E18010 sw r3,16[sp]
FFFFFFFFFFFFBF58 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFBF5C icr1:
FFFFFFFFFFFFBF5C 42009416 lc r1,CursorRow
FFFFFFFFFFFFBF60 0A108001 addui r1,r1,#1
FFFFFFFFFFFFBF64 62009416 sc r1,CursorRow
FFFFFFFFFFFFBF68 E69A0002 ; SETLO
FFFFFFFFFFFFBF6C EE800003 ; SETMID
FFFFFFFFFFFFBF70 6A0D0821 inch r2,TEXTREG+TEXT_ROWS
FFFFFFFFFFFFBF74 BE110086 bleu r1,r2,icc1
FFFFFFFFFFFFBF78 0E210001 subui r2,r2,#1 ; backup the cursor row, we are scrolling up
FFFFFFFFFFFFBF7C 62011416 sc r2,CursorRow
FFFFFFFFFFFFBF80 31FFEEF6 call ScrollUp
FFFFFFFFFFFFBF84 icc1:
FFFFFFFFFFFFBF84 31FFEF37 call CalcScreenLoc
FFFFFFFFFFFFBF88 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFBF8C 47E18010 lw r3,16[sp]
FFFFFFFFFFFFBF90 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBF94 47E08000 lw r1,[sp]
FFFFFFFFFFFFBF98 37EF8020 ret #32
;------------------------------------------------------------------------------
; Display a string on the screen.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFEFD0.1 DisplayString:
FFFFFFFFFFFFEFD0.1 037BC000018 subi sp,sp,#24
FFFFFFFFFFFFEFD0.2 27F40000003 sm [sp],r1/r2/r31
FFFFFFFFFFFFEFE0.0 01040200009 or r2,r1,r0 ; r2 = pointer to string
FFFFFFFFFFFFEFE0.1 dspj1:
FFFFFFFFFFFFEFE0.1 12882000000 lbu r1,[r2] ; move string char into r1
FFFFFFFFFFFFEFE0.2 02884000001 addui r2,r2,#1 ; increment pointer
FFFFFFFFFFFFEFF0.0 2F840000088 beq r1,r0,dsret ; is it end of string ?
FFFFFFFFFFFFEFF0.1 0C7FFFFFB65 call DisplayChar ; display character
FFFFFFFFFFFFEFF0.2 2F801FFFFAA bra dspj1 ; go back for next character
FFFFFFFFFFFFF000.0 dsret:
FFFFFFFFFFFFF000.0 27740000003 lm [r30],r1/r2/r31
FFFFFFFFFFFFF000.1 0DFBE000018 ret #24
FFFFFFFFFFFFBF9C DisplayString:
FFFFFFFFFFFFBF9C 0DEF0018 subi sp,sp,#24
FFFFFFFFFFFFBFA0 67E08000 sw r1,[sp]
FFFFFFFFFFFFBFA4 67E10008 sw r2,8[sp]
FFFFFFFFFFFFBFA8 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFBFAC 02110009 mov r2,r1 ; r2 = pointer to string
FFFFFFFFFFFFBFB0 dspj1:
FFFFFFFFFFFFBFB0 4A208000 lbu r1,[r2] ; move string char into r1
FFFFFFFFFFFFBFB4 0A210001 addui r2,r2,#1 ; increment pointer
FFFFFFFFFFFFBFB8 BE100068 beq r1,r0,dsret ; is it end of string ?
FFFFFFFFFFFFBFBC 31FFEF47 call DisplayChar ; display character
FFFFFFFFFFFFBFC0 BE007F8A bra dspj1 ; go back for next character
FFFFFFFFFFFFBFC4 dsret:
FFFFFFFFFFFFBFC4 47EF8010 lw lr,16[sp]
FFFFFFFFFFFFBFC8 47E10008 lw r2,8[sp]
FFFFFFFFFFFFBFCC 47E08000 lw r1,[sp]
FFFFFFFFFFFFBFD0 37EF8018 ret #24
FFFFFFFFFFFFF000.2 DisplayStringCRLF:
FFFFFFFFFFFFF000.2 03FBC000008 subui r30,r30,#8
FFFFFFFFFFFFF010.0 19FBE000000 sw r31,[r30]
FFFFFFFFFFFFF010.1 0C7FFFFFBF5 call DisplayString
FFFFFFFFFFFFF010.2 11FBE000000 lw r31,[r30]
FFFFFFFFFFFFF020.0 02FBC000008 addui r30,r30,#8
FFFFFFFFFFFFBFD4 DisplayStringCRLF:
FFFFFFFFFFFFBFD4 0FEF0008 subui r30,r30,#8
FFFFFFFFFFFFBFD8 67EF8000 sw r31,[r30]
FFFFFFFFFFFFBFDC 31FFEFE7 call DisplayString
FFFFFFFFFFFFBFE0 47EF8000 lw r31,[r30]
FFFFFFFFFFFFBFE4 0BEF0008 addui r30,r30,#8
FFFFFFFFFFFFF020.1 CRLF:
FFFFFFFFFFFFF020.1 03FBC000010 subui r30,r30,#16
FFFFFFFFFFFFF020.2 19F82000000 sw r1,[r30]
FFFFFFFFFFFFF030.0 19FBE000008 sw r31,8[r30]
FFFFFFFFFFFFF030.1 0A10000000D setlo r1,#'\r'
FFFFFFFFFFFFF030.2 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFF040.0 0A10000000A setlo r1,#'\n'
FFFFFFFFFFFFF040.1 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFF040.2 11F82000000 lw r1,[r30]
FFFFFFFFFFFFF050.0 11FBE000008 lw r31,8[r30]
FFFFFFFFFFFFF050.1 0DFBE000010 ret #16
FFFFFFFFFFFFBFE8 CRLF:
FFFFFFFFFFFFBFE8 0FEF0010 subui r30,r30,#16
FFFFFFFFFFFFBFEC 67E08000 sw r1,[sp]
FFFFFFFFFFFFBFF0 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFBFF4 E040000D setlo r1,#'\r'
FFFFFFFFFFFFBFF8 31FFEF47 call DisplayChar
FFFFFFFFFFFFBFFC E040000A setlo r1,#'\n'
FFFFFFFFFFFFC000 31FFEF47 call DisplayChar
FFFFFFFFFFFFC004 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFC008 47E08000 lw r1,[sp]
FFFFFFFFFFFFC00C 37EF8010 ret #16
;------------------------------------------------------------------------------
; Display nybble in r1
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF050.2 DisplayNybble:
FFFFFFFFFFFFF050.2 03FBC000010 subui r30,r30,#16
FFFFFFFFFFFFF060.0 19FBE000008 sw r31,8[r30]
FFFFFFFFFFFFF060.1 19F82000000 sw r1,[r30]
FFFFFFFFFFFFF060.2 0504200000F andi r1,r1,#0x0F
FFFFFFFFFFFFF070.0 02842000030 addui r1,r1,#'0'
FFFFFFFFFFFFF070.1 2B040100039 bleui r1,#'9',dispnyb1
FFFFFFFFFFFFF070.2 02842000007 addui r1,r1,#7
FFFFFFFFFFFFF080.0 dispnyb1:
FFFFFFFFFFFFF080.0 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFF080.1 11F82000000 lw r1,[r30]
FFFFFFFFFFFFF080.2 11FBE000008 lw r31,8[r30]
FFFFFFFFFFFFF090.0 0DFBE000010 ret #16
FFFFFFFFFFFFC010 DisplayNybble:
FFFFFFFFFFFFC010 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFC014 67E08000 sw r1,[sp]
FFFFFFFFFFFFC018 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFC01C 1410800F andi r1,r1,#0x0F
FFFFFFFFFFFFC020 0A108030 addui r1,r1,#'0'
FFFFFFFFFFFFC024 AC100239 bleui r1,#'9',dispnyb1
FFFFFFFFFFFFC028 0A108007 addui r1,r1,#7
FFFFFFFFFFFFC02C dispnyb1:
FFFFFFFFFFFFC02C 31FFEF47 call DisplayChar
FFFFFFFFFFFFC030 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFC034 47E08000 lw r1,[sp]
FFFFFFFFFFFFC038 37EF8010 ret #16
;------------------------------------------------------------------------------
; Display the byte in r1
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF090.1 DisplayByte:
FFFFFFFFFFFFF090.1 03FBC000010 subui sp,sp,#16
FFFFFFFFFFFFF090.2 27F40000001 sm [sp],r1/r31
FFFFFFFFFFFFF0A0.0 01842200004 rori r1,r1,#4
FFFFFFFFFFFFF0A0.1 0C7FFFFFC16 call DisplayNybble
FFFFFFFFFFFFF0A0.2 01842200002 roli r1,r1,#4
FFFFFFFFFFFFF0B0.0 0C7FFFFFC16 call DisplayNybble
FFFFFFFFFFFFF0B0.1 27740000001 lm [sp],r1/r31
FFFFFFFFFFFFF0B0.2 0DFBE000010 ret #16
FFFFFFFFFFFFC03C DisplayByte:
FFFFFFFFFFFFC03C 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFC040 67E08000 sw r1,[sp]
FFFFFFFFFFFFC044 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFC048 06108804 rori r1,r1,#4
FFFFFFFFFFFFC04C 31FFF004 call DisplayNybble
FFFFFFFFFFFFC050 06108802 roli r1,r1,#4
FFFFFFFFFFFFC054 31FFF004 call DisplayNybble
FFFFFFFFFFFFC058 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFC05C 47E08000 lw r1,[sp]
FFFFFFFFFFFFC060 37EF8010 ret #16
;------------------------------------------------------------------------------
; Display the 64 bit word in r1
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF0C0.0 DisplayWord:
FFFFFFFFFFFFF0C0.0 03FBC000018 subui sp,sp,#24
FFFFFFFFFFFFF0C0.1 27F40000005 sm [sp],r1/r3/r31
FFFFFFFFFFFFF0C0.2 0A300000007 setlo r3,#7
FFFFFFFFFFFFF0D0.0 dspwd1:
FFFFFFFFFFFFF0D0.0 01842400002 roli r1,r1,#8
FFFFFFFFFFFFF0D0.1 0C7FFFFFC25 call DisplayByte
FFFFFFFFFFFFF0D0.2 2F80600000F loop r3,dspwd1
FFFFFFFFFFFFF0E0.0 27740000005 lm [sp],r1/r3/r31
FFFFFFFFFFFFF0E0.1 0DFBE000018 ret #24
FFFFFFFFFFFFC064 DisplayWord:
FFFFFFFFFFFFC064 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFC068 67E08000 sw r1,[sp]
FFFFFFFFFFFFC06C 67E18008 sw r3,8[sp]
FFFFFFFFFFFFC070 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFC074 E0C00007 setlo r3,#7
FFFFFFFFFFFFC078 dspwd1:
FFFFFFFFFFFFC078 06109002 roli r1,r1,#8
FFFFFFFFFFFFC07C 31FFF00F call DisplayByte
FFFFFFFFFFFFC080 BE01FFCF loop r3,dspwd1
FFFFFFFFFFFFC084 47EF8010 lw lr,16[sp]
FFFFFFFFFFFFC088 47E18008 lw r3,8[sp]
FFFFFFFFFFFFC08C 47E08000 lw r1,[sp]
FFFFFFFFFFFFC090 37EF8018 ret #24
;------------------------------------------------------------------------------
; Display memory pointed to by r2.
740,76 → 1705,96
; destroys r1,r3
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF0E0.2 DisplayMem:
FFFFFFFFFFFFF0E0.2 03FBC000008 subui sp,sp,#8
FFFFFFFFFFFFF0F0.0 19FBE000000 sw lr,[sp]
FFFFFFFFFFFFF0F0.1 0A10000003A setlo r1,#':'
FFFFFFFFFFFFF0F0.2 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFF100.0 01080100009 or r1,r2,r0
FFFFFFFFFFFFF100.1 0C7FFFFFC30 call DisplayWord
FFFFFFFFFFFFF100.2 0A300000007 setlo r3,#7
FFFFFFFFFFFFF110.0 dspmem1:
FFFFFFFFFFFFF110.0 0A100000020 setlo r1,#' '
FFFFFFFFFFFFF110.1 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFF110.2 10082000000 lb r1,[r2]
FFFFFFFFFFFFF120.0 0C7FFFFFC25 call DisplayByte
FFFFFFFFFFFFF120.1 02884000001 addui r2,r2,#1
FFFFFFFFFFFFF120.2 2F807FFFF8F loop r3,dspmem1
FFFFFFFFFFFFF130.0 0C7FFFFFC09 call CRLF
FFFFFFFFFFFFF130.1 11FBE000000 lw lr,[sp]
FFFFFFFFFFFFF130.2 0DFBE000008 ret #8
FFFFFFFFFFFFC094 DisplayMem:
FFFFFFFFFFFFC094 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFC098 67E08000 sw r1,[sp]
FFFFFFFFFFFFC09C 67E18008 sw r3,8[sp]
FFFFFFFFFFFFC0A0 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFC0A4 E040003A setlo r1,#':'
FFFFFFFFFFFFC0A8 31FFEF47 call DisplayChar
FFFFFFFFFFFFC0AC 02208009 mov r1,r2
FFFFFFFFFFFFC0B0 31FFF019 call DisplayWord
FFFFFFFFFFFFC0B4 E0C00007 setlo r3,#7
FFFFFFFFFFFFC0B8 dspmem1:
FFFFFFFFFFFFC0B8 E0400020 setlo r1,#' '
FFFFFFFFFFFFC0BC 31FFEF47 call DisplayChar
FFFFFFFFFFFFC0C0 40208000 lb r1,[r2]
FFFFFFFFFFFFC0C4 31FFF00F call DisplayByte
FFFFFFFFFFFFC0C8 0A210001 addui r2,r2,#1
FFFFFFFFFFFFC0CC BE01FF6F loop r3,dspmem1
FFFFFFFFFFFFC0D0 31FFEFFA call CRLF
FFFFFFFFFFFFC0D4 47EF8010 lw lr,16[sp]
FFFFFFFFFFFFC0D8 47E18008 lw r3,8[sp]
FFFFFFFFFFFFC0DC 47E08000 lw r1,[sp]
FFFFFFFFFFFFC0E0 37EF8018 ret #24
;------------------------------------------------------------------------------
; Converts binary number in r1 into BCD number in r2 and r1.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF140.0 BinToBCD:
FFFFFFFFFFFFF140.0 03FBC000030 subui sp,sp,#48
FFFFFFFFFFFFF140.1 27F000000FC sm [sp],r3/r4/r5/r6/r7/r8
FFFFFFFFFFFFF140.2 0A20000000A setlo r2,#10
FFFFFFFFFFFFF150.0 0A800000013 setlo r8,#19 ; number of digits to produce - 1
FFFFFFFFFFFFF150.1 bta1:
FFFFFFFFFFFFF150.1 0104430001C mod r3,r1,r2
FFFFFFFFFFFFF150.2 018C7E00000 shli r3,r3,#60 ; shift result to uppermost bits
FFFFFFFFFFFFF160.0 0194FE00000 shli r7,r5,#60 ; copy low order nybble of r5 to r4 topmost nybble
FFFFFFFFFFFFF160.1 01908200001 shrui r4,r4,#4
FFFFFFFFFFFFF160.2 0110E400009 or r4,r4,r7
FFFFFFFFFFFFF170.0 0194A200001 shrui r5,r5,#4
FFFFFFFFFFFFF170.1 01146500009 or r5,r5,r3 ; copy new bcd digit into uppermost bits of r5
FFFFFFFFFFFFF170.2 07042000000 divui r1,r1,r2 ; r1=r1/10
FFFFFFFFFFFFF180.0 2F811FFFEAF loop r8,bta1
FFFFFFFFFFFFF180.1 01909800001 shrui r4,r4,#48 ; right align number in register
FFFFFFFFFFFFF180.2 0194C800000 shli r6,r5,#16
FFFFFFFFFFFFF190.0 0110C400009 or r4,r4,r6 ; copy bits into r4
FFFFFFFFFFFFF190.1 0194B800001 shrui r5,r5,#48
FFFFFFFFFFFFF190.2 01008100009 or r1,r0,r4
FFFFFFFFFFFFF1A0.0 0100A200009 or r2,r0,r5
FFFFFFFFFFFFF1A0.1 277000000FC lm [sp],r3/r4/r5/r6/r7/r8
FFFFFFFFFFFFF1A0.2 0DFBE000030 ret #48
FFFFFFFFFFFFC0E4 BinToBCD:
FFFFFFFFFFFFC0E4 0FEF0030 subui sp,sp,#48
FFFFFFFFFFFFC0E8 67E18000 sw r3,[sp]
FFFFFFFFFFFFC0EC 67E20008 sw r4,8[sp]
FFFFFFFFFFFFC0F0 67E28010 sw r5,16[sp]
FFFFFFFFFFFFC0F4 67E30018 sw r6,24[sp]
FFFFFFFFFFFFC0F8 67E38020 sw r7,32[sp]
FFFFFFFFFFFFC0FC 67E40028 sw r8,40[sp]
FFFFFFFFFFFFC100 E080000A setlo r2,#10
FFFFFFFFFFFFC104 E2000013 setlo r8,#19 ; number of digits to produce - 1
FFFFFFFFFFFFC108 bta1:
FFFFFFFFFFFFC108 04110C1C mod r3,r1,r2
FFFFFFFFFFFFC10C 0631F800 shli r3,r3,#60 ; shift result to uppermost bits
FFFFFFFFFFFFC110 0653F800 shli r7,r5,#60 ; copy low order nybble of r5 to r4 topmost nybble
FFFFFFFFFFFFC114 06420801 shrui r4,r4,#4
FFFFFFFFFFFFC118 04439009 or r4,r4,r7
FFFFFFFFFFFFC11C 06528801 shrui r5,r5,#4
FFFFFFFFFFFFC120 04519409 or r5,r5,r3 ; copy new bcd digit into uppermost bits of r5
FFFFFFFFFFFFC124 1C108000 divui r1,r1,r2 ; r1=r1/10
FFFFFFFFFFFFC128 BE047F0F loop r8,bta1
FFFFFFFFFFFFC12C 06426001 shrui r4,r4,#48 ; right align number in register
FFFFFFFFFFFFC130 06532000 shli r6,r5,#16
FFFFFFFFFFFFC134 04431009 or r4,r4,r6 ; copy bits into r4
FFFFFFFFFFFFC138 0652E001 shrui r5,r5,#48
FFFFFFFFFFFFC13C 02408009 mov r1,r4
FFFFFFFFFFFFC140 02510009 mov r2,r5
FFFFFFFFFFFFC144 47E18000 lw r3,[sp]
FFFFFFFFFFFFC148 47E20008 lw r4,8[sp]
FFFFFFFFFFFFC14C 47E28010 lw r5,16[sp]
FFFFFFFFFFFFC150 47E30018 lw r6,24[sp]
FFFFFFFFFFFFC154 47E38020 lw r7,32[sp]
FFFFFFFFFFFFC158 47E40028 lw r8,40[sp]
FFFFFFFFFFFFC15C 37EF8030 ret #48
;------------------------------------------------------------------------------
; Converts BCD number in r1 into Ascii number in r2 and r1.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF1B0.0 BCDToAscii:
FFFFFFFFFFFFF1B0.0 03FBC000020 subui sp,sp,#32
FFFFFFFFFFFFF1B0.1 27F0000009C sm [sp],r3/r4/r5/r8
FFFFFFFFFFFFF1B0.2 0A80000000F setlo r8,#15
FFFFFFFFFFFFF1C0.0 bta2:
FFFFFFFFFFFFF1C0.0 0504400000F andi r2,r1,#0x0F
FFFFFFFFFFFFF1C0.1 05884000030 ori r2,r2,#0x30
FFFFFFFFFFFFF1C0.2 01885C00000 shli r2,r2,#56
FFFFFFFFFFFFF1D0.0 01908400001 shrui r4,r4,#8
FFFFFFFFFFFFF1D0.1 018CBC00000 shli r5,r3,#56
FFFFFFFFFFFFF1D0.2 0110A400009 or r4,r4,r5
FFFFFFFFFFFFF1E0.0 018C6400001 shrui r3,r3,#8
FFFFFFFFFFFFF1E0.1 010C4300009 or r3,r3,r2
FFFFFFFFFFFFF1E0.2 01842200001 shrui r1,r1,#4
FFFFFFFFFFFFF1F0.0 2F811FFFE8F loop r8,bta2
FFFFFFFFFFFFF1F0.1 01008100009 or r1,r0,r4
FFFFFFFFFFFFF1F0.2 01006200009 or r2,r0,r3
FFFFFFFFFFFFF200.0 2770000009C lm [sp],r3/r4/r5/r8
FFFFFFFFFFFFF200.1 0DFBE000020 ret #32
FFFFFFFFFFFFC160 BCDToAscii:
FFFFFFFFFFFFC160 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFC164 67E18000 sw r3,[sp]
FFFFFFFFFFFFC168 67E20008 sw r4,8[sp]
FFFFFFFFFFFFC16C 67E28010 sw r5,16[sp]
FFFFFFFFFFFFC170 67E40018 sw r8,24[sp]
FFFFFFFFFFFFC174 E200000F setlo r8,#15
FFFFFFFFFFFFC178 bta2:
FFFFFFFFFFFFC178 1411000F andi r2,r1,#0x0F
FFFFFFFFFFFFC17C 16210030 ori r2,r2,#0x30
FFFFFFFFFFFFC180 06217000 shli r2,r2,#56
FFFFFFFFFFFFC184 06421001 shrui r4,r4,#8
FFFFFFFFFFFFC188 0632F000 shli r5,r3,#56
FFFFFFFFFFFFC18C 04429009 or r4,r4,r5
FFFFFFFFFFFFC190 06319001 shrui r3,r3,#8
FFFFFFFFFFFFC194 04310C09 or r3,r3,r2
FFFFFFFFFFFFC198 06108801 shrui r1,r1,#4
FFFFFFFFFFFFC19C BE047EEF loop r8,bta2
FFFFFFFFFFFFC1A0 02408009 mov r1,r4
FFFFFFFFFFFFC1A4 02310009 mov r2,r3
FFFFFFFFFFFFC1A8 47E18000 lw r3,[sp]
FFFFFFFFFFFFC1AC 47E20008 lw r4,8[sp]
FFFFFFFFFFFFC1B0 47E28010 lw r5,16[sp]
FFFFFFFFFFFFC1B4 47E40018 lw r8,24[sp]
FFFFFFFFFFFFC1B8 37EF8020 ret #32
;------------------------------------------------------------------------------
; Convert a binary number into a 20 character ascii string.
817,128 → 1802,152
; r2 = address of string buffer
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF200.2 BinToStr:
FFFFFFFFFFFFF200.2 03FBC000038 subui sp,sp,#56
FFFFFFFFFFFFF210.0 27F400007C4 sm [sp],r3/r7/r8/r9/r10/r11/r31
FFFFFFFFFFFFF210.1 01004B00009 or r11,r0,r2
FFFFFFFFFFFFF210.2 0C7FFFFFC50 call BinToBCD
FFFFFFFFFFFFF220.0 01004A00009 or r10,r0,r2 ; save off r2
FFFFFFFFFFFFF220.1 0C7FFFFFC6C call BCDToAscii
FFFFFFFFFFFFF220.2 0A900000001 setlo r9,#1
FFFFFFFFFFFFF230.0 btos3:
FFFFFFFFFFFFF230.0 0A800000007 setlo r8,#7
FFFFFFFFFFFFF230.1 btos1:
FFFFFFFFFFFFF230.1 01A4E180000 shli r7,r9,#3
FFFFFFFFFFFFF230.2 029CE000000 addui r7,r7,r8
FFFFFFFFFFFFF240.0 029CE000004 addui r7,r7,#4
FFFFFFFFFFFFF240.1 050460000FF andi r3,r1,#0xff
FFFFFFFFFFFFF240.2 1A9D6300010 sb r3,[r7+r11]
FFFFFFFFFFFFF250.0 01842400001 shrui r1,r1,#8
FFFFFFFFFFFFF250.1 2F811FFFF2F loop r8,btos1
FFFFFFFFFFFFF250.2 01004100009 or r1,r0,r2
FFFFFFFFFFFFF260.0 2F813FFFE8F loop r9,btos3
FFFFFFFFFFFFC1BC BinToStr:
FFFFFFFFFFFFC1BC 0FEF0038 subui sp,sp,#56
FFFFFFFFFFFFC1C0 67E18000 sw r3,[sp]
FFFFFFFFFFFFC1C4 67E38008 sw r7,8[sp]
FFFFFFFFFFFFC1C8 67E40010 sw r8,16[sp]
FFFFFFFFFFFFC1CC 67E48018 sw r9,24[sp]
FFFFFFFFFFFFC1D0 67E50020 sw r10,32[sp]
FFFFFFFFFFFFC1D4 67E58028 sw r11,40[sp]
FFFFFFFFFFFFC1D8 67EF8030 sw lr,48[sp]
FFFFFFFFFFFFC1DC 02258009 mov r11,r2
FFFFFFFFFFFFC1E0 31FFF039 call BinToBCD
FFFFFFFFFFFFC1E4 02250009 mov r10,r2 ; save off r2
FFFFFFFFFFFFC1E8 31FFF058 call BCDToAscii
FFFFFFFFFFFFC1EC E2400001 setlo r9,#1
FFFFFFFFFFFFC1F0 btos3:
FFFFFFFFFFFFC1F0 E2000007 setlo r8,#7
FFFFFFFFFFFFC1F4 btos1:
FFFFFFFFFFFFC1F4 06938600 shli r7,r9,#3
FFFFFFFFFFFFC1F8 0A738000 addui r7,r7,r8
FFFFFFFFFFFFC1FC 0A738004 addui r7,r7,#4
FFFFFFFFFFFFC200 141180FF andi r3,r1,#0xff
FFFFFFFFFFFFC204 6A758C10 sb r3,[r7+r11]
FFFFFFFFFFFFC208 06109001 shrui r1,r1,#8
FFFFFFFFFFFFC20C BE047F4F loop r8,btos1
FFFFFFFFFFFFC210 02208009 mov r1,r2
FFFFFFFFFFFFC214 BE04FEEF loop r9,btos3
; the last four digits
FFFFFFFFFFFFF260.1 01014100009 or r1,r0,r10 ; get back r2
FFFFFFFFFFFFF260.2 0C7FFFFFC6C call BCDToAscii
FFFFFFFFFFFFF270.0 0A800000003 setlo r8,#3
FFFFFFFFFFFFF270.1 btos2:
FFFFFFFFFFFFF270.1 050460000FF andi r3,r1,#0xff
FFFFFFFFFFFFF270.2 1AA16300010 sb r3,[r8+r11]
FFFFFFFFFFFFF280.0 01842400001 shrui r1,r1,#8
FFFFFFFFFFFFF280.1 2F811FFFFAF loop r8,btos2
FFFFFFFFFFFFF280.2 182C0000014 sb r0,20[r11] ; null terminate
FFFFFFFFFFFFF290.0 277400007C4 lm [sp],r3/r7/r8/r9/r10/r11/r31
FFFFFFFFFFFFF290.1 0DFBE000038 ret #56
FFFFFFFFFFFFC218 02A08009 mov r1,r10 ; get back r2
FFFFFFFFFFFFC21C 31FFF058 call BCDToAscii
FFFFFFFFFFFFC220 E2000003 setlo r8,#3
FFFFFFFFFFFFC224 btos2:
FFFFFFFFFFFFC224 141180FF andi r3,r1,#0xff
FFFFFFFFFFFFC228 6A858C10 sb r3,[r8+r11]
FFFFFFFFFFFFC22C 06109001 shrui r1,r1,#8
FFFFFFFFFFFFC230 BE047FAF loop r8,btos2
FFFFFFFFFFFFC234 60B00014 sb r0,20[r11] ; null terminate
FFFFFFFFFFFFC238 47E18000 lw r3,[sp]
FFFFFFFFFFFFC23C 47E38008 lw r7,8[sp]
FFFFFFFFFFFFC240 47E40010 lw r8,16[sp]
FFFFFFFFFFFFC244 47E48018 lw r9,24[sp]
FFFFFFFFFFFFC248 47E50020 lw r10,32[sp]
FFFFFFFFFFFFC24C 47E58028 lw r11,40[sp]
FFFFFFFFFFFFC250 47EF8030 lw lr,48[sp]
FFFFFFFFFFFFC254 37EF8038 ret #56
;==============================================================================
;==============================================================================
FFFFFFFFFFFFF290.2 Monitor:
FFFFFFFFFFFFF290.2 0BEFFFEFFF8 setlo sp,#STACKTOP ; top of stack; reset the stack pointer
FFFFFFFFFFFFF2A0.0 1800000041A sb r0,KeybdEcho ; turn off keyboard echo
FFFFFFFFFFFFF2A0.1 PromptLn:
FFFFFFFFFFFFF2A0.1 0C7FFFFFC09 call CRLF
FFFFFFFFFFFFF2A0.2 0A100000024 setlo r1,#'$'
FFFFFFFFFFFFF2B0.0 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFC258 Monitor:
FFFFFFFFFFFFC258 E6BEFFF8 ; SETLO
FFFFFFFFFFFFC25C 6A0D782D lea sp,STACKTOP0 ; top of stack; reset the stack pointer
FFFFFFFFFFFFC260 6000141C sb r0,KeybdEcho ; turn off keyboard echo
FFFFFFFFFFFFC264 PromptLn:
FFFFFFFFFFFFC264 31FFEFFA call CRLF
FFFFFFFFFFFFC268 E0400024 setlo r1,#'$'
FFFFFFFFFFFFC26C 31FFEF47 call DisplayChar
; Get characters until a CR is keyed
;
FFFFFFFFFFFFF2B0.1 Prompt3:
FFFFFFFFFFFFF2B0.1 0C7FFFFFA92 call KeybdGetChar
FFFFFFFFFFFFF2B0.2 2C04007FFFF beqi r1,#-1,Prompt3 ; wait for a character
FFFFFFFFFFFFF2C0.0 2C04010000D beqi r1,#CR,Prompt1
FFFFFFFFFFFFF2C0.1 0C7FFFFFB65 call DisplayChar
FFFFFFFFFFFFF2C0.2 2F801FFFFAA bra Prompt3
FFFFFFFFFFFFC270 Prompt3:
FFFFFFFFFFFFC270 31FFEE08 call KeybdGetChar
FFFFFFFFFFFFC274 B01FFFFF beqi r1,#-1,Prompt3 ; wait for a character
FFFFFFFFFFFFC278 B010030D beqi r1,#CR,Prompt1
FFFFFFFFFFFFC27C 31FFEF47 call DisplayChar
FFFFFFFFFFFFC280 BE007F8A bra Prompt3
; Process the screen line that the CR was keyed on
;
FFFFFFFFFFFFF2D0.0 Prompt1:
FFFFFFFFFFFFF2D0.0 18800000418 sc r0,CursorCol ; go back to the start of the line
FFFFFFFFFFFFF2D0.1 0C7FFFFFB55 call CalcScreenLoc ; r1 = screen memory location
FFFFFFFFFFFFF2D0.2 01040300009 or r3,r1,r0
FFFFFFFFFFFFF2E0.0 108C2000000 lc r1,[r3]
FFFFFFFFFFFFF2E0.1 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFF2E0.2 0C7FFFFFB50 call ScreenToAscii
FFFFFFFFFFFFF2F0.0 2C840140024 bnei r1,#'$',Prompt2 ; skip over '$' prompt character
FFFFFFFFFFFFF2F0.1 108C2000000 lc r1,[r3]
FFFFFFFFFFFFF2F0.2 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFF300.0 0C7FFFFFB50 call ScreenToAscii
FFFFFFFFFFFFC284 Prompt1:
FFFFFFFFFFFFC284 62001418 sc r0,CursorCol ; go back to the start of the line
FFFFFFFFFFFFC288 31FFEF37 call CalcScreenLoc ; r1 = screen memory location
FFFFFFFFFFFFC28C 04100C09 or r3,r1,r0
FFFFFFFFFFFFC290 82308000 inch r1,[r3]
FFFFFFFFFFFFC294 0A318002 addui r3,r3,#2
FFFFFFFFFFFFC298 31FFEF33 call ScreenToAscii
FFFFFFFFFFFFC29C B2100424 bnei r1,#'$',Prompt2 ; skip over '$' prompt character
FFFFFFFFFFFFC2A0 82308000 inch r1,[r3]
FFFFFFFFFFFFC2A4 0A318002 addui r3,r3,#2
FFFFFFFFFFFFC2A8 31FFEF33 call ScreenToAscii
; Dispatch based on command character
;
FFFFFFFFFFFFF300.1 Prompt2:
FFFFFFFFFFFFF300.1 2C04150003A beqi r1,#':',Editmem ; $: - edit memory
FFFFFFFFFFFFF300.2 2C041A00044 beqi r1,#'D',Dumpmem ; $D - dump memory
FFFFFFFFFFFFF310.0 2C075140042 beqi r1,#'B',START ; $B - start tiny basic
FFFFFFFFFFFFF310.1 2C04174004A beqi r1,#'J',ExecuteCode ; $J - execute code
FFFFFFFFFFFFF310.2 2C04280004C beqi r1,#'L',LoadS19 ; $L - load S19 file
FFFFFFFFFFFFF320.0 2C04054003F beqi r1,#'?',DisplayHelp ; $? - display help
FFFFFFFFFFFFF320.1 2C040100043 beqi r1,#'C',TestCLS ; $C - clear screen
FFFFFFFFFFFFF320.2 2F801FFFBCA bra Monitor
FFFFFFFFFFFFC2AC Prompt2:
FFFFFFFFFFFFC2AC B010563A beqi r1,#':',Editmem ; $: - edit memory
FFFFFFFFFFFFC2B0 B0106344 beqi r1,#'D',Dumpmem ; $D - dump memory
FFFFFFFFFFFFC2B4 B012EF42 beqi r1,#'B',CSTART ; $B - start tiny basic
FFFFFFFFFFFFC2B8 B0105D4A beqi r1,#'J',ExecuteCode ; $J - execute code
FFFFFFFFFFFFC2BC B010914C beqi r1,#'L',LoadS19 ; $L - load S19 file
FFFFFFFFFFFFC2C0 B010153F beqi r1,#'?',DisplayHelp ; $? - display help
FFFFFFFFFFFFC2C4 B0100743 beqi r1,#'C',TestCLS ; $C - clear screen
FFFFFFFFFFFFC2C8 B0100452 beqi r1,#'R',RandomLinesCall
FFFFFFFFFFFFC2CC B012B849 beqi r1,#'I',Invaders
FFFFFFFFFFFFC2D0 B011A350 beqi r1,#'P',Piano
FFFFFFFFFFFFC2D4 BE007C2A bra Monitor
FFFFFFFFFFFFF330.0 TestCLS:
FFFFFFFFFFFFF330.0 108C2000000 lc r1,[r3]
FFFFFFFFFFFFF330.1 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFF330.2 0C7FFFFFB50 call ScreenToAscii
FFFFFFFFFFFFF340.0 2C87F58004C bnei r1,#'L',Monitor
FFFFFFFFFFFFF340.1 108C2000000 lc r1,[r3]
FFFFFFFFFFFFF340.2 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFF350.0 0C7FFFFFB50 call ScreenToAscii
FFFFFFFFFFFFF350.1 2C87F480053 bnei r1,#'S',Monitor
FFFFFFFFFFFFF350.2 0C7FFFFFB06 call ClearScreen
FFFFFFFFFFFFF360.0 18000000418 sb r0,CursorCol
FFFFFFFFFFFFF360.1 18000000416 sb r0,CursorRow
FFFFFFFFFFFFF360.2 0C7FFFFFB55 call CalcScreenLoc
FFFFFFFFFFFFF370.0 2F801FFF94A bra Monitor
FFFFFFFFFFFFC2D8 RandomLinesCall:
FFFFFFFFFFFFC2D8 31FFF1BC call RandomLines
FFFFFFFFFFFFC2DC BE007BEA bra Monitor
FFFFFFFFFFFFC2E0 TestCLS:
FFFFFFFFFFFFC2E0 82308000 inch r1,[r3]
FFFFFFFFFFFFC2E4 0A318002 addui r3,r3,#2
FFFFFFFFFFFFC2E8 31FFEF33 call ScreenToAscii
FFFFFFFFFFFFC2EC B21FDB4C bnei r1,#'L',Monitor
FFFFFFFFFFFFC2F0 82308000 inch r1,[r3]
FFFFFFFFFFFFC2F4 0A318002 addui r3,r3,#2
FFFFFFFFFFFFC2F8 31FFEF33 call ScreenToAscii
FFFFFFFFFFFFC2FC B21FD753 bnei r1,#'S',Monitor
FFFFFFFFFFFFC300 31FFEED9 call ClearScreen
FFFFFFFFFFFFC304 60001418 sb r0,CursorCol
FFFFFFFFFFFFC308 60001416 sb r0,CursorRow
FFFFFFFFFFFFC30C 31FFEF37 call CalcScreenLoc
FFFFFFFFFFFFC310 BE007A4A bra Monitor
FFFFFFFFFFFFF370.1 DisplayHelp:
FFFFFFFFFFFFF370.1 0A1FFFFF390 setlo r1,HelpMsg
FFFFFFFFFFFFF370.2 0C7FFFFFBF5 call DisplayString
FFFFFFFFFFFFF380.0 2F801FFF8CA bra Monitor
FFFFFFFFFFFFC314 DisplayHelp:
FFFFFFFFFFFFC314 E07FC320 setlo r1,HelpMsg
FFFFFFFFFFFFC318 31FFEFE7 call DisplayString
FFFFFFFFFFFFC31C BE0079EA bra Monitor
FFFFFFFFFFFFF380.1 37800000000 align 16
FFFFFFFFFFFFF380.2 37800000000 align 16
FFFFFFFFFFFFF390.0 align 16
FFFFFFFFFFFFF390.0 HelpMsg:
FFFFFFFFFFFFF390 70736944203D203F db "? = Display help",CR,LF
FFFFFFFFFFFFF398 706C65682079616C
FFFFFFFFFFFFF3A0 203D20534C430A0D db "CLS = clear screen",CR,LF
FFFFFFFFFFFFF3A8 6373207261656C63
FFFFFFFFFFFFF3B0 203A0A0D6E656572 db ": = Edit memory bytes",CR,LF
FFFFFFFFFFFFF3B8 6D2074696445203D
FFFFFFFFFFFFF3C0 79622079726F6D65
FFFFFFFFFFFFF3C8 3D204C0A0D736574 db "L = Load S19 file",CR,LF
FFFFFFFFFFFFF3D0 31532064616F4C20
FFFFFFFFFFFFF3D8 0A0D656C69662039
FFFFFFFFFFFFF3E0 706D7544203D2044 db "D = Dump memory",CR,LF
FFFFFFFFFFFFF3E8 0D79726F6D656D20
FFFFFFFFFFFFF3F0 617473203D20420A db "B = start tiny basic",CR,LF
FFFFFFFFFFFFF3F8 20796E6974207472
FFFFFFFFFFFFF400 4A0A0D6369736162 db "J = Jump to code",CR,LF,0
FFFFFFFFFFFFF408 20706D754A203D20
FFFFFFFFFFFFF410 0D65646F63206F74
FFFFFFFFFFFFF418 000000000000000A align 16
FFFFFFFFFFFFF420.0 align 16
FFFFFFFFFFFFC320 align 16
FFFFFFFFFFFFC320 HelpMsg:
FFFFFFFFFFFFC320 70736944203D203F db "? = Display help",CR,LF
FFFFFFFFFFFFC328 706C65682079616C
FFFFFFFFFFFFC330 203D20534C430A0D db "CLS = clear screen",CR,LF
FFFFFFFFFFFFC338 6373207261656C63
FFFFFFFFFFFFC340 203A0A0D6E656572 db ": = Edit memory bytes",CR,LF
FFFFFFFFFFFFC348 6D2074696445203D
FFFFFFFFFFFFC350 79622079726F6D65
FFFFFFFFFFFFC358 3D204C0A0D736574 db "L = Load S19 file",CR,LF
FFFFFFFFFFFFC360 31532064616F4C20
FFFFFFFFFFFFC368 0A0D656C69662039
FFFFFFFFFFFFC370 706D7544203D2044 db "D = Dump memory",CR,LF
FFFFFFFFFFFFC378 0D79726F6D656D20
FFFFFFFFFFFFC380 617473203D20420A db "B = start tiny basic",CR,LF
FFFFFFFFFFFFC388 20796E6974207472
FFFFFFFFFFFFC390 4A0A0D6369736162 db "J = Jump to code",CR,LF
FFFFFFFFFFFFC398 20706D754A203D20
FFFFFFFFFFFFC3A0 0D65646F63206F74
FFFFFFFFFFFFC3A8 766E49203D20490A db "I = Invaders",CR,LF
FFFFFFFFFFFFC3B0 520A0D7372656461 db "R = Random lines",CR,LF
FFFFFFFFFFFFC3B8 6F646E6152203D20
FFFFFFFFFFFFC3C0 0D73656E696C206D
FFFFFFFFFFFFC3C8 616950203D20500A db "P = Piano",CR,LF,0
FFFFFFFFFFFFC3D0 000000000A0D6F6E align 16
FFFFFFFFFFFFC3D8 0000000000000000
FFFFFFFFFFFFC3E0 align 16
;------------------------------------------------------------------------------
; Ignore blanks in the input
946,89 → 1955,93
; r1 destroyed
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF420.0 ignBlanks:
FFFFFFFFFFFFF420.0 03FBC000008 subui sp,sp,#8
FFFFFFFFFFFFF420.1 19FBE000000 sw r31,[sp]
FFFFFFFFFFFFF420.2 ignBlanks1:
FFFFFFFFFFFFF420.2 108C2000000 lc r1,[r3]
FFFFFFFFFFFFF430.0 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFF430.1 0C7FFFFFB50 call ScreenToAscii
FFFFFFFFFFFFF430.2 2C07FF80020 beqi r1,#' ',ignBlanks1
FFFFFFFFFFFFF440.0 038C6000002 subui r3,r3,#2
FFFFFFFFFFFFF440.1 11FBE000000 lw r31,[sp]
FFFFFFFFFFFFF440.2 0DFBE000008 ret #8
FFFFFFFFFFFFC3E0 ignBlanks:
FFFFFFFFFFFFC3E0 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFC3E4 67EF8000 sw r31,[sp]
FFFFFFFFFFFFC3E8 ignBlanks1:
FFFFFFFFFFFFC3E8 82308000 inch r1,[r3]
FFFFFFFFFFFFC3EC 0A318002 addui r3,r3,#2
FFFFFFFFFFFFC3F0 31FFEF33 call ScreenToAscii
FFFFFFFFFFFFC3F4 B01FFD20 beqi r1,#' ',ignBlanks1
FFFFFFFFFFFFC3F8 0E318002 subui r3,r3,#2
FFFFFFFFFFFFC3FC 47EF8000 lw r31,[sp]
FFFFFFFFFFFFC400 37EF8008 ret #8
;------------------------------------------------------------------------------
; Edit memory byte(s).
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF450.0 EditMem:
FFFFFFFFFFFFF450.0 0C7FFFFFD08 call ignBlanks
FFFFFFFFFFFFF450.1 0C7FFFFFD39 call GetHexNumber
FFFFFFFFFFFFF450.2 01040500009 or r5,r1,r0
FFFFFFFFFFFFF460.0 0A400000007 setlo r4,#7
FFFFFFFFFFFFF460.1 edtmem1:
FFFFFFFFFFFFF460.1 0C7FFFFFD08 call ignBlanks
FFFFFFFFFFFFF460.2 0C7FFFFFD39 call GetHexNumber
FFFFFFFFFFFFF470.0 18142000000 sb r1,[r5]
FFFFFFFFFFFFF470.1 0294A000001 addui r5,r5,#1
FFFFFFFFFFFFF470.2 2F809FFFFAF loop r4,edtmem1
FFFFFFFFFFFFF480.0 2F801FFF0CA bra Monitor
FFFFFFFFFFFFC404 EditMem:
FFFFFFFFFFFFC404 31FFF0F8 call ignBlanks
FFFFFFFFFFFFC408 31FFF11C call GetHexNumber
FFFFFFFFFFFFC40C 04101409 or r5,r1,r0
FFFFFFFFFFFFC410 E1000007 setlo r4,#7
FFFFFFFFFFFFC414 edtmem1:
FFFFFFFFFFFFC414 31FFF0F8 call ignBlanks
FFFFFFFFFFFFC418 31FFF11C call GetHexNumber
FFFFFFFFFFFFC41C 60508000 sb r1,[r5]
FFFFFFFFFFFFC420 0A528001 addui r5,r5,#1
FFFFFFFFFFFFC424 BE027F8F loop r4,edtmem1
FFFFFFFFFFFFC428 BE00718A bra Monitor
;------------------------------------------------------------------------------
; Execute code at the specified address.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF480.1 ExecuteCode:
FFFFFFFFFFFFF480.1 0C7FFFFFD08 call ignBlanks
FFFFFFFFFFFFF480.2 0C7FFFFFD39 call GetHexNumber
FFFFFFFFFFFFF490.0 01040300009 or r3,r1,r0
FFFFFFFFFFFFF490.1 0D0FE000000 jal r31,[r3]
FFFFFFFFFFFFF490.2 2F801FFF04A bra Monitor
FFFFFFFFFFFFC42C ExecuteCode:
FFFFFFFFFFFFC42C 31FFF0F8 call ignBlanks
FFFFFFFFFFFFC430 31FFF11C call GetHexNumber
FFFFFFFFFFFFC434 341F8000 jal r31,[r1]
FFFFFFFFFFFFC438 BE00710A bra Monitor
;------------------------------------------------------------------------------
; Do a memory dump of the requested location.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF4A0.0 DumpMem:
FFFFFFFFFFFFF4A0.0 0C7FFFFFD08 call ignBlanks
FFFFFFFFFFFFF4A0.1 0C7FFFFFD39 call GetHexNumber
FFFFFFFFFFFFF4A0.2 01040200009 or r2,r1,r0
FFFFFFFFFFFFF4B0.0 0C7FFFFFC09 call CRLF
FFFFFFFFFFFFF4B0.1 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4B0.2 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4C0.0 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4C0.1 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4C0.2 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4D0.0 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4D0.1 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4D0.2 0C7FFFFFC3A call DisplayMem
FFFFFFFFFFFFF4E0.0 2F801FFEDCA bra Monitor
FFFFFFFFFFFFC43C DumpMem:
FFFFFFFFFFFFC43C 31FFF0F8 call ignBlanks
FFFFFFFFFFFFC440 31FFF11C call GetHexNumber
FFFFFFFFFFFFC444 02110009 mov r2,r1
FFFFFFFFFFFFC448 31FFEFFA call CRLF
FFFFFFFFFFFFC44C 31FFF025 call DisplayMem
FFFFFFFFFFFFC450 31FFF025 call DisplayMem
FFFFFFFFFFFFC454 31FFF025 call DisplayMem
FFFFFFFFFFFFC458 31FFF025 call DisplayMem
FFFFFFFFFFFFC45C 31FFF025 call DisplayMem
FFFFFFFFFFFFC460 31FFF025 call DisplayMem
FFFFFFFFFFFFC464 31FFF025 call DisplayMem
FFFFFFFFFFFFC468 31FFF025 call DisplayMem
FFFFFFFFFFFFC46C BE006F6A bra Monitor
;------------------------------------------------------------------------------
; Get a hexidecimal number. Maximum of sixteen digits.
; R3 = text pointer (updated)
; R1 = hex number
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF4E0.1 GetHexNumber:
FFFFFFFFFFFFF4E0.1 03FBC000018 subui sp,sp,#24
FFFFFFFFFFFFF4E0.2 27F4000000A sm [sp],r2/r4/r31
FFFFFFFFFFFFF4F0.0 0A200000000 setlo r2,#0
FFFFFFFFFFFFF4F0.1 0A40000000F setlo r4,#15
FFFFFFFFFFFFF4F0.2 gthxn2:
FFFFFFFFFFFFF4F0.2 108C2000000 lc r1,[r3]
FFFFFFFFFFFFF500.0 028C6000002 addui r3,r3,#2
FFFFFFFFFFFFF500.1 0C7FFFFFB50 call ScreenToAscii
FFFFFFFFFFFFF500.2 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF510.0 2C0401BFFFF beqi r1,#-1,gthxn1
FFFFFFFFFFFFF510.1 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF510.2 0504200000F andi r1,r1,#0x0f
FFFFFFFFFFFFF520.0 01082200009 or r2,r2,r1
FFFFFFFFFFFFF520.1 2F809FFFECF loop r4,gthxn2
FFFFFFFFFFFFF520.2 gthxn1:
FFFFFFFFFFFFF520.2 01080100009 or r1,r2,r0
FFFFFFFFFFFFF530.0 2774000000A lm [sp],r2/r4/r31
FFFFFFFFFFFFF530.1 0DFBE000018 ret #24
FFFFFFFFFFFFC470 GetHexNumber:
FFFFFFFFFFFFC470 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFC474 67E10000 sw r2,[sp]
FFFFFFFFFFFFC478 67E20008 sw r4,8[sp]
FFFFFFFFFFFFC47C 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFC480 E0800000 setlo r2,#0
FFFFFFFFFFFFC484 E100000F setlo r4,#15
FFFFFFFFFFFFC488 gthxn2:
FFFFFFFFFFFFC488 82308000 inch r1,[r3]
FFFFFFFFFFFFC48C 0A318002 addui r3,r3,#2
FFFFFFFFFFFFC490 31FFEF33 call ScreenToAscii
FFFFFFFFFFFFC494 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC498 B01005FF beqi r1,#-1,gthxn1
FFFFFFFFFFFFC49C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC4A0 1410800F andi r1,r1,#0x0f
FFFFFFFFFFFFC4A4 04208809 or r2,r2,r1
FFFFFFFFFFFFC4A8 BE027F0F loop r4,gthxn2
FFFFFFFFFFFFC4AC gthxn1:
FFFFFFFFFFFFC4AC 02208009 mov r1,r2
FFFFFFFFFFFFC4B0 47EF8010 lw lr,16[sp]
FFFFFFFFFFFFC4B4 47E20008 lw r4,8[sp]
FFFFFFFFFFFFC4B8 47E10000 lw r2,[sp]
FFFFFFFFFFFFC4BC 37EF8018 ret #24
;------------------------------------------------------------------------------
; Convert ASCII character in the range '0' to '9', 'a' to 'f' or 'A' to 'F'
1035,167 → 2048,167
; to a hex nybble.
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF530.2 AsciiToHexNybble:
FFFFFFFFFFFFF530.2 2A040540030 bltui r1,#'0',gthx3
FFFFFFFFFFFFF540.0 2B840100039 bgtui r1,#'9',gthx5
FFFFFFFFFFFFF540.1 03842000030 subui r1,r1,#'0'
FFFFFFFFFFFFF540.2 0DFBE000000 ret
FFFFFFFFFFFFF550.0 gthx5:
FFFFFFFFFFFFF550.0 2A040340041 bltui r1,#'A',gthx3
FFFFFFFFFFFFF550.1 2B840180046 bgtui r1,#'F',gthx6
FFFFFFFFFFFFF550.2 03842000041 subui r1,r1,#'A'
FFFFFFFFFFFFF560.0 0284200000A addui r1,r1,#10
FFFFFFFFFFFFF560.1 0DFBE000000 ret
FFFFFFFFFFFFF560.2 gthx6:
FFFFFFFFFFFFF560.2 2A040240061 bltui r1,#'a',gthx3
FFFFFFFFFFFFF570.0 2B840140066 bgtui r1,#'f',gthx3
FFFFFFFFFFFFF570.1 03842000061 subui r1,r1,#'a'
FFFFFFFFFFFFF570.2 0284200000A addui r1,r1,#10
FFFFFFFFFFFFF580.0 0DFBE000000 ret
FFFFFFFFFFFFF580.1 gthx3:
FFFFFFFFFFFFF580.1 0A1FFFFFFFF setlo r1,#-1 ; not a hex number
FFFFFFFFFFFFF580.2 0DFBE000000 ret
FFFFFFFFFFFFC4C0 AsciiToHexNybble:
FFFFFFFFFFFFC4C0 A8100E30 bltui r1,#'0',gthx3
FFFFFFFFFFFFC4C4 AE100339 bgtui r1,#'9',gthx5
FFFFFFFFFFFFC4C8 0E108030 subui r1,r1,#'0'
FFFFFFFFFFFFC4CC 37EF8000 ret
FFFFFFFFFFFFC4D0 gthx5:
FFFFFFFFFFFFC4D0 A8100A41 bltui r1,#'A',gthx3
FFFFFFFFFFFFC4D4 AE100446 bgtui r1,#'F',gthx6
FFFFFFFFFFFFC4D8 0E108041 subui r1,r1,#'A'
FFFFFFFFFFFFC4DC 0A10800A addui r1,r1,#10
FFFFFFFFFFFFC4E0 37EF8000 ret
FFFFFFFFFFFFC4E4 gthx6:
FFFFFFFFFFFFC4E4 A8100561 bltui r1,#'a',gthx3
FFFFFFFFFFFFC4E8 AE100466 bgtui r1,#'f',gthx3
FFFFFFFFFFFFC4EC 0E108061 subui r1,r1,#'a'
FFFFFFFFFFFFC4F0 0A10800A addui r1,r1,#10
FFFFFFFFFFFFC4F4 37EF8000 ret
FFFFFFFFFFFFC4F8 gthx3:
FFFFFFFFFFFFC4F8 E07FFFFF setlo r1,#-1 ; not a hex number
FFFFFFFFFFFFC4FC 37EF8000 ret
;==============================================================================
; Load an S19 format file
;==============================================================================
;
FFFFFFFFFFFFF590.0 LoadS19:
FFFFFFFFFFFFF590.0 2F80000008A bra ProcessRec
FFFFFFFFFFFFF590.1 NextRec:
FFFFFFFFFFFFF590.1 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF590.2 2C84004000A bne r1,#LF,NextRec
FFFFFFFFFFFFF5A0.0 ProcessRec:
FFFFFFFFFFFFF5A0.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF5A0.1 2C07CF8001A beqi r1,#26,Monitor ; CTRL-Z ?
FFFFFFFFFFFFF5A0.2 2C87FF40053 bnei r1,#'S',NextRec
FFFFFFFFFFFFF5B0.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF5B0.1 2807FE40030 blt r1,#'0',NextRec
FFFFFFFFFFFFF5B0.2 2987FE40039 bgt r1,#'9',NextRec
FFFFFFFFFFFFF5C0.0 01040400009 or r4,r1,r0 ; r4 = record type
FFFFFFFFFFFFF5C0.1 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF5C0.2 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF5D0.0 01040200009 or r2,r1,r0
FFFFFFFFFFFFF5D0.1 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF5D0.2 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF5E0.0 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF5E0.1 01082200009 or r2,r2,r1 ; r2 = byte count
FFFFFFFFFFFFF5E0.2 01082300009 or r3,r2,r1 ; r3 = byte count
FFFFFFFFFFFFF5F0.0 2C13FA40030 beqi r4,#'0',NextRec ; manufacturer ID record, ignore
FFFFFFFFFFFFF5F0.1 2C100A40031 beqi r4,#'1',ProcessS1
FFFFFFFFFFFFF5F0.2 2C100B00032 beqi r4,#'2',ProcessS2
FFFFFFFFFFFFF600.0 2C100A80033 beqi r4,#'3',ProcessS3
FFFFFFFFFFFFF600.1 2C13F940035 beqi r4,#'5',NextRec ; record count record, ignore
FFFFFFFFFFFFF600.2 2C100B40037 beqi r4,#'7',ProcessS7
FFFFFFFFFFFFF610.0 2C100B40038 beqi r4,#'8',ProcessS8
FFFFFFFFFFFFF610.1 2C100C40039 beqi r4,#'9',ProcessS9
FFFFFFFFFFFFF610.2 2F801FFFC2A bra NextRec
FFFFFFFFFFFFC500 LoadS19:
FFFFFFFFFFFFC500 BE00006A bra ProcessRec
FFFFFFFFFFFFC504 NextRec:
FFFFFFFFFFFFC504 31FFF1B2 call sGetChar
FFFFFFFFFFFFC508 B21FFF0A bne r1,#LF,NextRec
FFFFFFFFFFFFC50C ProcessRec:
FFFFFFFFFFFFC50C 31FFF1B2 call sGetChar
FFFFFFFFFFFFC510 B01F521A beqi r1,#26,Monitor ; CTRL-Z ?
FFFFFFFFFFFFC514 B21FFC53 bnei r1,#'S',NextRec
FFFFFFFFFFFFC518 31FFF1B2 call sGetChar
FFFFFFFFFFFFC51C A01FFA30 blt r1,#'0',NextRec
FFFFFFFFFFFFC520 A61FF939 bgt r1,#'9',NextRec
FFFFFFFFFFFFC524 04101009 or r4,r1,r0 ; r4 = record type
FFFFFFFFFFFFC528 31FFF1B2 call sGetChar
FFFFFFFFFFFFC52C 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC530 04100809 or r2,r1,r0
FFFFFFFFFFFFC534 31FFF1B2 call sGetChar
FFFFFFFFFFFFC538 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC53C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC540 04208809 or r2,r2,r1 ; r2 = byte count
FFFFFFFFFFFFC544 04208C09 or r3,r2,r1 ; r3 = byte count
FFFFFFFFFFFFC548 B04FEF30 beqi r4,#'0',NextRec ; manufacturer ID record, ignore
FFFFFFFFFFFFC54C B0401E31 beqi r4,#'1',ProcessS1
FFFFFFFFFFFFC550 B0401F32 beqi r4,#'2',ProcessS2
FFFFFFFFFFFFC554 B0402033 beqi r4,#'3',ProcessS3
FFFFFFFFFFFFC558 B04FEB35 beqi r4,#'5',NextRec ; record count record, ignore
FFFFFFFFFFFFC55C B0402037 beqi r4,#'7',ProcessS7
FFFFFFFFFFFFC560 B0402238 beqi r4,#'8',ProcessS8
FFFFFFFFFFFFC564 B0402439 beqi r4,#'9',ProcessS9
FFFFFFFFFFFFC568 BE007CEA bra NextRec
FFFFFFFFFFFFF620.0 pcssxa:
FFFFFFFFFFFFF620.0 050C60000FF andi r3,r3,#0xff
FFFFFFFFFFFFF620.1 038C6000001 subui r3,r3,#1 ; one less for loop
FFFFFFFFFFFFF620.2 pcss1a:
FFFFFFFFFFFFF620.2 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF630.0 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF630.1 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF630.2 01082200009 or r2,r2,r1
FFFFFFFFFFFFF640.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF640.1 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF640.2 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF650.0 01082200009 or r2,r2,r1
FFFFFFFFFFFFF650.1 18144000000 sb r2,[r5]
FFFFFFFFFFFFF650.2 0294A000001 addui r5,r5,#1
FFFFFFFFFFFFF660.0 2F807FFFE4F loop r3,pcss1a
FFFFFFFFFFFFC56C pcssxa:
FFFFFFFFFFFFC56C 143180FF andi r3,r3,#0xff
FFFFFFFFFFFFC570 0E318001 subui r3,r3,#1 ; one less for loop
FFFFFFFFFFFFC574 pcss1a:
FFFFFFFFFFFFC574 31FFF1B2 call sGetChar
FFFFFFFFFFFFC578 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC57C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC580 04208809 or r2,r2,r1
FFFFFFFFFFFFC584 31FFF1B2 call sGetChar
FFFFFFFFFFFFC588 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC58C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC590 04208809 or r2,r2,r1
FFFFFFFFFFFFC594 60510000 sb r2,[r5]
FFFFFFFFFFFFC598 0A528001 addui r5,r5,#1
FFFFFFFFFFFFC59C BE01FECF loop r3,pcss1a
; Get the checksum byte
FFFFFFFFFFFFF660.1 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF660.2 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF670.0 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF670.1 01082200009 or r2,r2,r1
FFFFFFFFFFFFF670.2 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF680.0 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF680.1 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF680.2 01082200009 or r2,r2,r1
FFFFFFFFFFFFF690.0 2F801FFF82A bra NextRec
FFFFFFFFFFFFC5A0 31FFF1B2 call sGetChar
FFFFFFFFFFFFC5A4 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC5A8 06210800 shli r2,r2,#4
FFFFFFFFFFFFC5AC 04208809 or r2,r2,r1
FFFFFFFFFFFFC5B0 31FFF1B2 call sGetChar
FFFFFFFFFFFFC5B4 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC5B8 06210800 shli r2,r2,#4
FFFFFFFFFFFFC5BC 04208809 or r2,r2,r1
FFFFFFFFFFFFC5C0 BE007A2A bra NextRec
FFFFFFFFFFFFF690.1 ProcessS1:
FFFFFFFFFFFFF690.1 0C7FFFFFDB9 call S19Get16BitAddress
FFFFFFFFFFFFF690.2 2F801FFFC8A bra pcssxa
FFFFFFFFFFFFF6A0.0 ProcessS2:
FFFFFFFFFFFFF6A0.0 0C7FFFFFDC1 call S19Get24BitAddress
FFFFFFFFFFFFF6A0.1 2F801FFFC0A bra pcssxa
FFFFFFFFFFFFF6A0.2 ProcessS3:
FFFFFFFFFFFFF6A0.2 0C7FFFFFDC9 call S19Get32BitAddress
FFFFFFFFFFFFF6B0.0 2F801FFFB8A bra pcssxa
FFFFFFFFFFFFF6B0.1 ProcessS7:
FFFFFFFFFFFFF6B0.1 0C7FFFFFDC9 call S19Get32BitAddress
FFFFFFFFFFFFF6B0.2 1980A000000 sw r5,S19StartAddress
FFFFFFFFFFFFF6C0.0 2F801FFDECA bra Monitor
FFFFFFFFFFFFF6C0.1 ProcessS8:
FFFFFFFFFFFFF6C0.1 0C7FFFFFDC1 call S19Get24BitAddress
FFFFFFFFFFFFF6C0.2 1980A000000 sw r5,S19StartAddress
FFFFFFFFFFFFF6D0.0 2F801FFDE4A bra Monitor
FFFFFFFFFFFFF6D0.1 ProcessS9:
FFFFFFFFFFFFF6D0.1 0C7FFFFFDB9 call S19Get16BitAddress
FFFFFFFFFFFFF6D0.2 1980A000000 sw r5,S19StartAddress
FFFFFFFFFFFFF6E0.0 2F801FFDDCA bra Monitor
FFFFFFFFFFFFC5C4 ProcessS1:
FFFFFFFFFFFFC5C4 31FFF180 call S19Get16BitAddress
FFFFFFFFFFFFC5C8 BE007D2A bra pcssxa
FFFFFFFFFFFFC5CC ProcessS2:
FFFFFFFFFFFFC5CC 31FFF186 call S19Get24BitAddress
FFFFFFFFFFFFC5D0 BE007CEA bra pcssxa
FFFFFFFFFFFFC5D4 ProcessS3:
FFFFFFFFFFFFC5D4 31FFF18C call S19Get32BitAddress
FFFFFFFFFFFFC5D8 BE007CAA bra pcssxa
FFFFFFFFFFFFC5DC ProcessS7:
FFFFFFFFFFFFC5DC 31FFF18C call S19Get32BitAddress
FFFFFFFFFFFFC5E0 66028000 sw r5,S19StartAddress
FFFFFFFFFFFFC5E4 BE0063AA bra Monitor
FFFFFFFFFFFFC5E8 ProcessS8:
FFFFFFFFFFFFC5E8 31FFF186 call S19Get24BitAddress
FFFFFFFFFFFFC5EC 66028000 sw r5,S19StartAddress
FFFFFFFFFFFFC5F0 BE00634A bra Monitor
FFFFFFFFFFFFC5F4 ProcessS9:
FFFFFFFFFFFFC5F4 31FFF180 call S19Get16BitAddress
FFFFFFFFFFFFC5F8 66028000 sw r5,S19StartAddress
FFFFFFFFFFFFC5FC BE0062EA bra Monitor
FFFFFFFFFFFFF6E0.1 S19Get16BitAddress:
FFFFFFFFFFFFF6E0.1 03FBC000008 subui sp,sp,#8
FFFFFFFFFFFFF6E0.2 19FBE000000 sw r31,[sp]
FFFFFFFFFFFFF6F0.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF6F0.1 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF6F0.2 01040200009 or r2,r1,r0
FFFFFFFFFFFFF700.0 2F8000004AA bra S1932b
FFFFFFFFFFFFC600 S19Get16BitAddress:
FFFFFFFFFFFFC600 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFC604 67EF8000 sw r31,[sp]
FFFFFFFFFFFFC608 31FFF1B2 call sGetChar
FFFFFFFFFFFFC60C 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC610 04100809 or r2,r1,r0
FFFFFFFFFFFFC614 BE00038A bra S1932b
FFFFFFFFFFFFF700.1 S19Get24BitAddress:
FFFFFFFFFFFFF700.1 03FBC000008 subui sp,sp,#8
FFFFFFFFFFFFF700.2 19FBE000000 sw r31,[sp]
FFFFFFFFFFFFF710.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF710.1 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF710.2 01040200009 or r2,r1,r0
FFFFFFFFFFFFF720.0 2F80000024A bra S1932a
FFFFFFFFFFFFC618 S19Get24BitAddress:
FFFFFFFFFFFFC618 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFC61C 67EF8000 sw r31,[sp]
FFFFFFFFFFFFC620 31FFF1B2 call sGetChar
FFFFFFFFFFFFC624 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC628 04100809 or r2,r1,r0
FFFFFFFFFFFFC62C BE0001CA bra S1932a
FFFFFFFFFFFFF720.1 S19Get32BitAddress:
FFFFFFFFFFFFF720.1 03FBC000008 subui sp,sp,#8
FFFFFFFFFFFFF720.2 19FBE000000 sw r31,[sp]
FFFFFFFFFFFFF730.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF730.1 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF730.2 01040200009 or r2,r1,r0
FFFFFFFFFFFFF740.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF740.1 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF740.2 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF750.0 01044200009 or r2,r1,r2
FFFFFFFFFFFFF750.1 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF750.2 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF760.0 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF760.1 01082200009 or r2,r2,r1
FFFFFFFFFFFFF760.2 S1932a:
FFFFFFFFFFFFF760.2 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF770.0 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF770.1 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF770.2 01082200009 or r2,r2,r1
FFFFFFFFFFFFF780.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF780.1 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF780.2 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF790.0 01082200009 or r2,r2,r1
FFFFFFFFFFFFF790.1 S1932b:
FFFFFFFFFFFFF790.1 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF790.2 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF7A0.0 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF7A0.1 01082200009 or r2,r2,r1
FFFFFFFFFFFFF7A0.2 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF7B0.0 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF7B0.1 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF7B0.2 01082200009 or r2,r2,r1
FFFFFFFFFFFFF7C0.0 0C7FFFFFDFC call sGetChar
FFFFFFFFFFFFF7C0.1 0C7FFFFFD4E call AsciiToHexNybble
FFFFFFFFFFFFF7C0.2 01884200000 shli r2,r2,#4
FFFFFFFFFFFFF7D0.0 01082200009 or r2,r2,r1
FFFFFFFFFFFFF7D0.1 0110840000A xor r4,r4,r4
FFFFFFFFFFFFF7D0.2 01080500009 or r5,r2,r0
FFFFFFFFFFFFF7E0.0 11FBE000000 lw r31,[sp]
FFFFFFFFFFFFF7E0.1 02FBC000008 addui sp,sp,#8
FFFFFFFFFFFFF7E0.2 0DFBE000000 ret
FFFFFFFFFFFFC630 S19Get32BitAddress:
FFFFFFFFFFFFC630 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFC634 67EF8000 sw r31,[sp]
FFFFFFFFFFFFC638 31FFF1B2 call sGetChar
FFFFFFFFFFFFC63C 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC640 04100809 or r2,r1,r0
FFFFFFFFFFFFC644 31FFF1B2 call sGetChar
FFFFFFFFFFFFC648 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC64C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC650 04110809 or r2,r1,r2
FFFFFFFFFFFFC654 31FFF1B2 call sGetChar
FFFFFFFFFFFFC658 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC65C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC660 04208809 or r2,r2,r1
FFFFFFFFFFFFC664 S1932a:
FFFFFFFFFFFFC664 31FFF1B2 call sGetChar
FFFFFFFFFFFFC668 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC66C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC670 04208809 or r2,r2,r1
FFFFFFFFFFFFC674 31FFF1B2 call sGetChar
FFFFFFFFFFFFC678 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC67C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC680 04208809 or r2,r2,r1
FFFFFFFFFFFFC684 S1932b:
FFFFFFFFFFFFC684 31FFF1B2 call sGetChar
FFFFFFFFFFFFC688 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC68C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC690 04208809 or r2,r2,r1
FFFFFFFFFFFFC694 31FFF1B2 call sGetChar
FFFFFFFFFFFFC698 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC69C 06210800 shli r2,r2,#4
FFFFFFFFFFFFC6A0 04208809 or r2,r2,r1
FFFFFFFFFFFFC6A4 31FFF1B2 call sGetChar
FFFFFFFFFFFFC6A8 31FFF130 call AsciiToHexNybble
FFFFFFFFFFFFC6AC 06210800 shli r2,r2,#4
FFFFFFFFFFFFC6B0 04208809 or r2,r2,r1
FFFFFFFFFFFFC6B4 0442100A xor r4,r4,r4
FFFFFFFFFFFFC6B8 04201409 or r5,r2,r0
FFFFFFFFFFFFC6BC 47EF8000 lw r31,[sp]
FFFFFFFFFFFFC6C0 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFC6C4 37EF8000 ret
;------------------------------------------------------------------------------
; Get a character from auxillary input, checking the keyboard status for a
1202,339 → 2215,3517
; CTRL-C
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFF7F0.0 sGetChar:
FFFFFFFFFFFFF7F0.0 03FBC000008 subui sp,sp,#8
FFFFFFFFFFFFF7F0.1 19FBE000000 sw r31,[sp]
FFFFFFFFFFFFF7F0.2 sgc2:
FFFFFFFFFFFFF7F0.2 0C7FFFFFAA6 call KeybdCheckForKey
FFFFFFFFFFFFF800.0 2F841FF8B08 beq r1,r0,sgc1
FFFFFFFFFFFFF800.1 0C7FFFFFA92 call KeybdGetchar
FFFFFFFFFFFFF800.2 2C07A980000 beqi r1,#CRTLC,Monitor
FFFFFFFFFFFFF810.0 sgc1:
FFFFFFFFFFFFF810.0 0C7FFFFFE30 call AUXIN
FFFFFFFFFFFFF810.1 2F841FFFF48 beq r1,r0,sgc2
FFFFFFFFFFFFF810.2 11FBE000000 lw r31,[sp]
FFFFFFFFFFFFF820.0 02FBC000008 addui sp,sp,#8
FFFFFFFFFFFFF820.1 0DFBE000000 ret
FFFFFFFFFFFFC6C8 sGetChar:
FFFFFFFFFFFFC6C8 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFC6CC 67EF8000 sw r31,[sp]
FFFFFFFFFFFFC6D0 sgc2:
FFFFFFFFFFFFC6D0 31FFEE1D call KeybdCheckForKey
FFFFFFFFFFFFC6D4 BE106908 beq r1,r0,sgc1
FFFFFFFFFFFFC6D8 31FFEE08 call KeybdGetchar
FFFFFFFFFFFFC6DC B01EDF00 beqi r1,#CRTLC,Monitor
FFFFFFFFFFFFC6E0 sgc1:
FFFFFFFFFFFFC6E0 31FFF95C call AUXIN
FFFFFFFFFFFFC6E4 BE107F62 ble r1,r0,sgc2
FFFFFFFFFFFFC6E8 47EF8000 lw r31,[sp]
FFFFFFFFFFFFC6EC 37EF8008 ret #8
;--------------------------------------------------------------------------
; Draw random lines on the bitmap screen.
;--------------------------------------------------------------------------
FFFFFFFFFFFFC6F0 RandomLines:
FFFFFFFFFFFFC6F0 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFC6F4 67E08000 sw r1,[sp]
FFFFFFFFFFFFC6F8 67E18008 sw r3,8[sp]
FFFFFFFFFFFFC6FC 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFC700 rl5:
FFFFFFFFFFFFC700 00000050 gran
FFFFFFFFFFFFC704 020088A8 mfspr r1,rand ; select a random color
FFFFFFFFFFFFC708 E69AE000 ; SETLO
FFFFFFFFFFFFC70C EE800003 ; SETMID
FFFFFFFFFFFFC710 6A0D042A outh r1,GACCEL
FFFFFFFFFFFFC714 rl1: ; random X0
FFFFFFFFFFFFC714 00000050 gran
FFFFFFFFFFFFC718 020088A8 mfspr r1,rand
FFFFFFFFFFFFC71C 16018554 lw r3,#1364
FFFFFFFFFFFFC720 0411841C mod r1,r1,r3
FFFFFFFFFFFFC724 E69AE008 ; SETLO
FFFFFFFFFFFFC728 EE800003 ; SETMID
FFFFFFFFFFFFC72C 6A0D042A outh r1,GACCEL+8
FFFFFFFFFFFFC730 rl2: ; random X1
FFFFFFFFFFFFC730 00000050 gran
FFFFFFFFFFFFC734 020088A8 mfspr r1,rand
FFFFFFFFFFFFC738 16018554 lw r3,#1364
FFFFFFFFFFFFC73C 0411841C mod r1,r1,r3
FFFFFFFFFFFFC740 E69AE010 ; SETLO
FFFFFFFFFFFFC744 EE800003 ; SETMID
FFFFFFFFFFFFC748 6A0D042A outh r1,GACCEL+16
FFFFFFFFFFFFC74C rl3: ; random Y0
FFFFFFFFFFFFC74C 00000050 gran
FFFFFFFFFFFFC750 020088A8 mfspr r1,rand
FFFFFFFFFFFFC754 16018300 lw r3,#768
FFFFFFFFFFFFC758 0411841C mod r1,r1,r3
FFFFFFFFFFFFC75C E69AE00C ; SETLO
FFFFFFFFFFFFC760 EE800003 ; SETMID
FFFFFFFFFFFFC764 6A0D042A outh r1,GACCEL+12
FFFFFFFFFFFFC768 rl4: ; random Y1
FFFFFFFFFFFFC768 00000050 gran
FFFFFFFFFFFFC76C 020088A8 mfspr r1,rand
FFFFFFFFFFFFC770 16018300 lw r3,#768
FFFFFFFFFFFFC774 0411841C mod r1,r1,r3
FFFFFFFFFFFFC778 E69AE014 ; SETLO
FFFFFFFFFFFFC77C EE800003 ; SETMID
FFFFFFFFFFFFC780 6A0D042A outh r1,GACCEL+20
FFFFFFFFFFFFC784 E0400002 setlo r1,#2 ; draw line command
FFFFFFFFFFFFC788 E69AE03C ; SETLO
FFFFFFFFFFFFC78C EE800003 ; SETMID
FFFFFFFFFFFFC790 6A0D042A outh r1,GACCEL+60
FFFFFFFFFFFFC794 rl8:
FFFFFFFFFFFFC794 31FFEE08 call KeybdGetChar
FFFFFFFFFFFFC798 B0100303 beqi r1,#CTRLC,rl7
FFFFFFFFFFFFC79C B01FD972 beqi r1,#'r',rl5
FFFFFFFFFFFFC7A0 BE007FAA bra rl8
FFFFFFFFFFFFC7A4 rl7:
FFFFFFFFFFFFC7A4 47EF8010 lw lr,16[sp]
FFFFFFFFFFFFC7A8 47E18008 lw r3,8[sp]
FFFFFFFFFFFFC7AC 47E08000 lw r1,[sp]
FFFFFFFFFFFFC7B0 37EF8018 ret #24
;--------------------------------------------------------------------------
; Initialize sprite image caches with random data.
;--------------------------------------------------------------------------
FFFFFFFFFFFFC7B4 RandomizeSprram:
FFFFFFFFFFFFC7B4 E6980000 ; SETLO
FFFFFFFFFFFFC7B8 EE800003 ; SETMID
FFFFFFFFFFFFC7BC 6A0D082D lea r2,SPRRAM
FFFFFFFFFFFFC7C0 E10037FF setlo r4,#14335 ; number of chars to initialize
FFFFFFFFFFFFC7C4 rsr1:
FFFFFFFFFFFFC7C4 00000050 gran
FFFFFFFFFFFFC7C8 020088A8 mfspr r1,rand
FFFFFFFFFFFFC7CC 92208000 outc r1,[r2]
FFFFFFFFFFFFC7D0 0A210002 addui r2,r2,#2
FFFFFFFFFFFFC7D4 BE027F8F loop r4,rsr1
FFFFFFFFFFFFC7D8 37EF8000 ret
;--------------------------------------------------------------------------
; Setup the AC97/LM4550 audio controller. Check keyboard for a CTRL-C
; interrupt which may be necessary if the audio controller isn't
; responding.
;--------------------------------------------------------------------------
;
FFFFFFFFFFFFC7DC SetupAC97:
FFFFFFFFFFFFC7DC 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFC7E0 67E08000 sw r1,[sp]
FFFFFFFFFFFFC7E4 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFC7E8 sac974:
FFFFFFFFFFFFC7E8 E69C1026 ; SETLO
FFFFFFFFFFFFC7EC EE800003 ; SETMID
FFFFFFFFFFFFC7F0 6A0D0029 outc r0,AC97+0x26 ; trigger a read of register 26 (status reg)
FFFFFFFFFFFFC7F4 sac971: ; wait for status to register 0xF (all ready)
FFFFFFFFFFFFC7F4 31FFEE08 call KeybdGetChar ; see if we needed to CTRL-C
FFFFFFFFFFFFC7F8 B0100A03 beqi r1,#CTRLC,sac973
FFFFFFFFFFFFC7FC E69C1068 ; SETLO
FFFFFFFFFFFFC800 EE800003 ; SETMID
FFFFFFFFFFFFC804 6A0D0429 outc r1,AC97+0x68 ; wait for dirty bit to clear
FFFFFFFFFFFFC808 BE107F69 bne r1,r0,sac971
FFFFFFFFFFFFC80C E69C1026 ; SETLO
FFFFFFFFFFFFC810 EE800003 ; SETMID
FFFFFFFFFFFFC814 6A0D0429 outc r1,AC97+0x26 ; check status at reg h26, wait for
FFFFFFFFFFFFC818 1410800F andi r1,r1,#0x0F ; analogue to be ready
FFFFFFFFFFFFC81C B21FF30F bnei r1,#0x0F,sac974
FFFFFFFFFFFFC820 sac973:
FFFFFFFFFFFFC820 E69C1002 ; SETLO
FFFFFFFFFFFFC824 EE800003 ; SETMID
FFFFFFFFFFFFC828 6A0D0029 outc r0,AC97+2 ; master volume, 0db attenuation, mute off
FFFFFFFFFFFFC82C E69C1004 ; SETLO
FFFFFFFFFFFFC830 EE800003 ; SETMID
FFFFFFFFFFFFC834 6A0D0029 outc r0,AC97+4 ; headphone volume, 0db attenuation, mute off
FFFFFFFFFFFFC838 E69C1018 ; SETLO
FFFFFFFFFFFFC83C EE800003 ; SETMID
FFFFFFFFFFFFC840 6A0D0029 outc r0,AC97+0x18 ; PCM gain (mixer) mute off, no attenuation
FFFFFFFFFFFFC844 E69C100A ; SETLO
FFFFFFFFFFFFC848 EE800003 ; SETMID
FFFFFFFFFFFFC84C 6A0D0029 outc r0,AC97+0x0A ; mute PC beep
FFFFFFFFFFFFC850 E07F8000 setlo r1,#0x8000 ; bypass 3D sound
FFFFFFFFFFFFC854 E69C1020 ; SETLO
FFFFFFFFFFFFC858 EE800003 ; SETMID
FFFFFFFFFFFFC85C 6A0D0429 outc r1,AC97+0x20
FFFFFFFFFFFFC860 sac972:
FFFFFFFFFFFFC860 31FFEE08 call KeybdGetChar
FFFFFFFFFFFFC864 B0100503 beqi r1,#CTRLC,sac975
FFFFFFFFFFFFC868 E69C1068 ; SETLO
FFFFFFFFFFFFC86C EE800003 ; SETMID
FFFFFFFFFFFFC870 6A0D0429 outc r1,AC97+0x68 ; wait for dirty bits to clear
FFFFFFFFFFFFC874 BE107F69 bne r1,r0,sac972 ; wait a while for the settings to take effect
FFFFFFFFFFFFC878 sac975:
FFFFFFFFFFFFC878 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFC87C 47E08000 lw r1,[sp]
FFFFFFFFFFFFC880 37EF8010 ret #16
;--------------------------------------------------------------------------
; Sound a 800 Hz beep
;--------------------------------------------------------------------------
;
FFFFFFFFFFFFF820.2 SetupAC97:
FFFFFFFFFFFFF820.2 05802000000 ori r1,r0,#0 ; trigger a read of register 26
FFFFFFFFFFFFF830.0 18803DC1026 sc r1,AC97+0x26
FFFFFFFFFFFFF830.1 sac971: ; wait for status to register 0xF (all ready)
FFFFFFFFFFFFF830.1 10803DC1026 lc r1,AC97+0x26
FFFFFFFFFFFFF830.2 2C84004000F bnei r1,#0x0F,sac971
FFFFFFFFFFFFF840.0 05802000000 ori r1,r0,#0 ; master volume, 0db attenuation, mute off
FFFFFFFFFFFFF840.1 18803DC1002 sc r1,AC97+2
FFFFFFFFFFFFF840.2 18803DC1004 sc r1,AC97+4 ; headphone volume, 0db attenuation, mute off
FFFFFFFFFFFFF850.0 05802001F40 ori r1,r0,#8000 ; wait a while for the settings to take effect
FFFFFFFFFFFFF850.1 sac972:
FFFFFFFFFFFFF850.1 2F80200002F loop r1,sac972
FFFFFFFFFFFFC884 Beep:
FFFFFFFFFFFFC884 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFC888 67E08000 sw r1,[sp]
FFFFFFFFFFFFC88C 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFC890 E0400008 setlo r1,#8
FFFFFFFFFFFFC894 E69C0600 ; SETLO
FFFFFFFFFFFFC898 EE800003 ; SETMID
FFFFFFFFFFFFC89C 6A0D0428 outb r1,LED
FFFFFFFFFFFFC8A0 1600800F ori r1,r0,#15 ; master volume to max
FFFFFFFFFFFFC8A4 E6950080 ; SETLO
FFFFFFFFFFFFC8A8 EE800003 ; SETMID
FFFFFFFFFFFFC8AC 6A0D0429 outc r1,PSG+128
FFFFFFFFFFFFC8B0 1600B46E ori r1,r0,#13422 ; 800Hz
FFFFFFFFFFFFC8B4 E6950000 ; SETLO
FFFFFFFFFFFFC8B8 EE800003 ; SETMID
FFFFFFFFFFFFC8BC 6A0D0429 outc r1,PSGFREQ0
FFFFFFFFFFFFC8C0 E0400009 setlo r1,#9
FFFFFFFFFFFFC8C4 E69C0600 ; SETLO
FFFFFFFFFFFFC8C8 EE800003 ; SETMID
FFFFFFFFFFFFC8CC 6A0D0428 outb r1,LED
; decay (16.384 ms)2
; attack (8.192 ms)1
; release (1.024 s)A
; sustain level C
FFFFFFFFFFFFC8D0 E07FCA12 setlo r1,#0xCA12
FFFFFFFFFFFFC8D4 E6950006 ; SETLO
FFFFFFFFFFFFC8D8 EE800003 ; SETMID
FFFFFFFFFFFFC8DC 6A0D0429 outc r1,PSGADSR0
FFFFFFFFFFFFC8E0 16009104 ori r1,r0,#0x1104 ; gate, output enable, triangle waveform
FFFFFFFFFFFFC8E4 E6950004 ; SETLO
FFFFFFFFFFFFC8E8 EE800003 ; SETMID
FFFFFFFFFFFFC8EC 6A0D0429 outc r1,PSGCTRL0
FFFFFFFFFFFFC8F0 E6BD7840 ; SETLO
FFFFFFFFFFFFC8F4 EE800005 ; SETMID
FFFFFFFFFFFFC8F8 040D0409 ori r1,r0,#25000000 ; delay about 1s
FFFFFFFFFFFFC8FC beep1:
FFFFFFFFFFFFC8FC BE00800F loop r1,beep1
FFFFFFFFFFFFC900 E040000D setlo r1,#13
FFFFFFFFFFFFC904 E69C0600 ; SETLO
FFFFFFFFFFFFC908 EE800003 ; SETMID
FFFFFFFFFFFFC90C 6A0D0428 outb r1,LED
FFFFFFFFFFFFC910 16008104 ori r1,r0,#0x0104 ; gate off, output enable, triangle waveform
FFFFFFFFFFFFC914 E6950004 ; SETLO
FFFFFFFFFFFFC918 EE800003 ; SETMID
FFFFFFFFFFFFC91C 6A0D0429 outc r1,PSGCTRL0
FFFFFFFFFFFFC920 E6BD7840 ; SETLO
FFFFFFFFFFFFC924 EE800005 ; SETMID
FFFFFFFFFFFFC928 040D0409 ori r1,r0,#25000000 ; delay about 1s
FFFFFFFFFFFFC92C beep2:
FFFFFFFFFFFFC92C BE00800F loop r1,beep2
FFFFFFFFFFFFC930 E0400010 setlo r1,#16
FFFFFFFFFFFFC934 E69C0600 ; SETLO
FFFFFFFFFFFFC938 EE800003 ; SETMID
FFFFFFFFFFFFC93C 6A0D0428 outb r1,LED
FFFFFFFFFFFFC940 16008000 ori r1,r0,#0x0000 ; gate off, output enable off, no waveform
FFFFFFFFFFFFC944 E6950004 ; SETLO
FFFFFFFFFFFFC948 EE800003 ; SETMID
FFFFFFFFFFFFC94C 6A0D0429 outc r1,PSGCTRL0
FFFFFFFFFFFFC950 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFC954 47E08000 lw r1,[sp]
FFFFFFFFFFFFC958 37EF8010 ret #16
FFFFFFFFFFFFF850.2 Beep:
FFFFFFFFFFFFF850.2 0580200000F ori r1,r0,#15 ; master volume to max
FFFFFFFFFFFFF860.0 18803D50080 sc r1,PSG+128
FFFFFFFFFFFFF860.1 0580200346E ori r1,r0,#13422 ; 800Hz
FFFFFFFFFFFFF860.2 18803D50000 sc r1,PSG
FFFFFFFFFFFFF870.0 05802000020 ori r1,r0,#32 ; attack (8.192 ms)
FFFFFFFFFFFFF870.1 18803D50008 sc r1,PSG+8
FFFFFFFFFFFFF870.2 05802000040 ori r1,r0,#64 ; decay (16.384 ms)
FFFFFFFFFFFFF880.0 18803D5000A sc r1,PSG+10
FFFFFFFFFFFFF880.1 058020000C0 ori r1,r0,#0xC0 ; sustain level
FFFFFFFFFFFFF880.2 18803D5000C sc r1,PSG+12
FFFFFFFFFFFFF890.0 05802000FA0 ori r1,r0,#4000 ; release (1.024 s)
FFFFFFFFFFFFF890.1 18803D5000E sc r1,PSG+14
FFFFFFFFFFFFF890.2 05802001104 ori r1,r0,#0x1104 ; gate, output enable, triangle waveform
FFFFFFFFFFFFF8A0.0 18803D50004 sc r1,PSG+4
FFFFFFFFFFFFF8A0.1 38000000000
FFFFFFFFFFFFF8A0.2 058037D7840 ori r1,r0,#25000000 ; delay about 1s
FFFFFFFFFFFFF8B0.0 beep1:
FFFFFFFFFFFFF8B0.0 2F80200000F loop r1,beep1
FFFFFFFFFFFFF8B0.1 05802000000 ori r1,r0,#0x0000 ; gate off, output enable off, no waveform
FFFFFFFFFFFFF8B0.2 0DFBE000000 ret
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
;
FFFFFFFFFFFFC95C Piano:
FFFFFFFFFFFFC95C 1600800F ori r1,r0,#15 ; master volume to max
FFFFFFFFFFFFC960 E6950080 ; SETLO
FFFFFFFFFFFFC964 EE800003 ; SETMID
FFFFFFFFFFFFC968 6A0D0429 outc r1,PSG+128
FFFFFFFFFFFFC96C playnt:
FFFFFFFFFFFFC96C 31FFEE08 call KeybdGetChar
FFFFFFFFFFFFC970 B01E3A03 beqi r1,#CTRLC,Monitor
FFFFFFFFFFFFC974 B0100861 beqi r1,#'a',playnt1a
FFFFFFFFFFFFC978 B0100A62 beqi r1,#'b',playnt1b
FFFFFFFFFFFFC97C B0100C63 beqi r1,#'c',playnt1c
FFFFFFFFFFFFC980 B0100E64 beqi r1,#'d',playnt1d
FFFFFFFFFFFFC984 B0101065 beqi r1,#'e',playnt1e
FFFFFFFFFFFFC988 B0101266 beqi r1,#'f',playnt1f
FFFFFFFFFFFFC98C B0101467 beqi r1,#'g',playnt1g
FFFFFFFFFFFFC990 BE007EEA bra playnt
FFFFFFFFFFFFC994 playnt1a:
FFFFFFFFFFFFC994 E0401C31 setlo r1,#7217
FFFFFFFFFFFFC998 31FFF27A call Tone
FFFFFFFFFFFFC99C BE007E8A bra playnt
FFFFFFFFFFFFC9A0 playnt1b:
FFFFFFFFFFFFC9A0 E0401FA5 setlo r1,#8101
FFFFFFFFFFFFC9A4 31FFF27A call Tone
FFFFFFFFFFFFC9A8 BE007E2A bra playnt
FFFFFFFFFFFFC9AC playnt1c:
FFFFFFFFFFFFC9AC E04010C3 setlo r1,#4291
FFFFFFFFFFFFC9B0 31FFF27A call Tone
FFFFFFFFFFFFC9B4 BE007DCA bra playnt
FFFFFFFFFFFFC9B8 playnt1d:
FFFFFFFFFFFFC9B8 E04012D1 setlo r1,#4817
FFFFFFFFFFFFC9BC 31FFF27A call Tone
FFFFFFFFFFFFC9C0 BE007D6A bra playnt
FFFFFFFFFFFFC9C4 playnt1e:
FFFFFFFFFFFFC9C4 E040151F setlo r1,#5407
FFFFFFFFFFFFC9C8 31FFF27A call Tone
FFFFFFFFFFFFC9CC BE007D0A bra playnt
FFFFFFFFFFFFC9D0 playnt1f:
FFFFFFFFFFFFC9D0 E0401660 setlo r1,#5728
FFFFFFFFFFFFC9D4 31FFF27A call Tone
FFFFFFFFFFFFC9D8 BE007CAA bra playnt
FFFFFFFFFFFFC9DC playnt1g:
FFFFFFFFFFFFC9DC E040191E setlo r1,#6430
FFFFFFFFFFFFC9E0 31FFF27A call Tone
FFFFFFFFFFFFC9E4 BE007C4A bra playnt
FFFFFFFFFFFFC9E8 Tone:
FFFFFFFFFFFFC9E8 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFC9EC 67E08000 sw r1,[sp]
FFFFFFFFFFFFC9F0 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFC9F4 E6950000 ; SETLO
FFFFFFFFFFFFC9F8 EE800003 ; SETMID
FFFFFFFFFFFFC9FC 6A0D0429 outc r1,PSGFREQ0
; decay (16.384 ms)2
; attack (8.192 ms)1
; release (1.024 s)A
; sustain level C
FFFFFFFFFFFFCA00 E07FCA12 setlo r1,#0xCA12
FFFFFFFFFFFFCA04 E6950006 ; SETLO
FFFFFFFFFFFFCA08 EE800003 ; SETMID
FFFFFFFFFFFFCA0C 6A0D0429 outc r1,PSGADSR0
FFFFFFFFFFFFCA10 16009104 ori r1,r0,#0x1104 ; gate, output enable, triangle waveform
FFFFFFFFFFFFCA14 E6950004 ; SETLO
FFFFFFFFFFFFCA18 EE800003 ; SETMID
FFFFFFFFFFFFCA1C 6A0D0429 outc r1,PSGCTRL0
FFFFFFFFFFFFCA20 E683D090 ; SETLO
FFFFFFFFFFFFCA24 040D0409 ori r1,r0,#250000 ; delay about 10ms
FFFFFFFFFFFFCA28 tone1:
FFFFFFFFFFFFCA28 BE00800F loop r1,tone1
FFFFFFFFFFFFCA2C 16008104 ori r1,r0,#0x0104 ; gate off, output enable, triangle waveform
FFFFFFFFFFFFCA30 E6950004 ; SETLO
FFFFFFFFFFFFCA34 EE800003 ; SETMID
FFFFFFFFFFFFCA38 6A0D0429 outc r1,PSGCTRL0
FFFFFFFFFFFFCA3C E683D090 ; SETLO
FFFFFFFFFFFFCA40 040D0409 ori r1,r0,#250000 ; delay about 10ms
FFFFFFFFFFFFCA44 tone2:
FFFFFFFFFFFFCA44 BE00800F loop r1,tone2
FFFFFFFFFFFFCA48 16008000 ori r1,r0,#0x0000 ; gate off, output enable off, no waveform
FFFFFFFFFFFFCA4C E6950004 ; SETLO
FFFFFFFFFFFFCA50 EE800003 ; SETMID
FFFFFFFFFFFFCA54 6A0D0429 outc r1,PSGCTRL0
FFFFFFFFFFFFCA58 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFCA5C 47E08000 lw r1,[sp]
FFFFFFFFFFFFCA60 37EF8010 ret #16
;==============================================================================
;==============================================================================
FFFFFFFFFFFFCA64 SetupRasterIRQ:
FFFFFFFFFFFFCA64 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFCA68 67E08000 sw r1,[sp]
FFFFFFFFFFFFCA6C E04000C8 setlo r1,#200
FFFFFFFFFFFFCA70 E69A0100 ; SETLO
FFFFFFFFFFFFCA74 EE800003 ; SETMID
FFFFFFFFFFFFCA78 6A0D0429 outc r1,RASTERIRQ
FFFFFFFFFFFFCA7C E04000F0 setlo r1,#240
FFFFFFFFFFFFCA80 E69A0102 ; SETLO
FFFFFFFFFFFFCA84 EE800003 ; SETMID
FFFFFFFFFFFFCA88 6A0D0429 outc r1,RASTERIRQ+2
FFFFFFFFFFFFCA8C E0400118 setlo r1,#280
FFFFFFFFFFFFCA90 E69A0104 ; SETLO
FFFFFFFFFFFFCA94 EE800003 ; SETMID
FFFFFFFFFFFFCA98 6A0D0429 outc r1,RASTERIRQ+4
FFFFFFFFFFFFCA9C E0400140 setlo r1,#320
FFFFFFFFFFFFCAA0 E69A0106 ; SETLO
FFFFFFFFFFFFCAA4 EE800003 ; SETMID
FFFFFFFFFFFFCAA8 6A0D0429 outc r1,RASTERIRQ+6
FFFFFFFFFFFFCAAC E0400168 setlo r1,#360
FFFFFFFFFFFFCAB0 E69A0108 ; SETLO
FFFFFFFFFFFFCAB4 EE800003 ; SETMID
FFFFFFFFFFFFCAB8 6A0D0429 outc r1,RASTERIRQ+8
FFFFFFFFFFFFCABC 47E08000 lw r1,[sp]
FFFFFFFFFFFFCAC0 37EF8008 ret #8
FFFFFFFFFFFFCAC4 RasterIRQfn:
FFFFFFFFFFFFCAC4 E69A011E ; SETLO
FFFFFFFFFFFFCAC8 EE800003 ; SETMID
FFFFFFFFFFFFCACC 6A0D0421 inch r1,RASTERIRQ+30 ; get the raster compare register # (clears IRQ)
FFFFFFFFFFFFCAD0 B0100901 beqi r1,#1,rirq1
FFFFFFFFFFFFCAD4 B0100802 beqi r1,#2,rirq2
FFFFFFFFFFFFCAD8 B0100703 beqi r1,#3,rirq3
FFFFFFFFFFFFCADC B0100604 beqi r1,#4,rirq4
FFFFFFFFFFFFCAE0 B0100505 beqi r1,#5,rirq5
FFFFFFFFFFFFCAE4 B0100406 beqi r1,#6,rirq6
FFFFFFFFFFFFCAE8 B0100307 beqi r1,#7,rirq7
FFFFFFFFFFFFCAEC B0100208 beqi r1,#8,rirq8
FFFFFFFFFFFFCAF0 37EF8000 ret
FFFFFFFFFFFFCAF4 rirq1:
FFFFFFFFFFFFCAF4 rirq2:
FFFFFFFFFFFFCAF4 rirq3:
FFFFFFFFFFFFCAF4 rirq4:
FFFFFFFFFFFFCAF4 rirq5:
FFFFFFFFFFFFCAF4 rirq6:
FFFFFFFFFFFFCAF4 rirq7:
FFFFFFFFFFFFCAF4 rirq8:
FFFFFFFFFFFFCAF4 1A108028 mului r1,r1,#40
FFFFFFFFFFFFCAF8 0A1080CC addui r1,r1,#204
FFFFFFFFFFFFCAFC E69AD002 ; SETLO
FFFFFFFFFFFFCB00 EE800003 ; SETMID
FFFFFFFFFFFFCB04 6A0D0429 outc r1,SPRITEREGS+2
FFFFFFFFFFFFCB08 E69AD012 ; SETLO
FFFFFFFFFFFFCB0C EE800003 ; SETMID
FFFFFFFFFFFFCB10 6A0D0429 outc r1,SPRITEREGS+18
FFFFFFFFFFFFCB14 E69AD022 ; SETLO
FFFFFFFFFFFFCB18 EE800003 ; SETMID
FFFFFFFFFFFFCB1C 6A0D0429 outc r1,SPRITEREGS+34
FFFFFFFFFFFFCB20 E69AD032 ; SETLO
FFFFFFFFFFFFCB24 EE800003 ; SETMID
FFFFFFFFFFFFCB28 6A0D0429 outc r1,SPRITEREGS+50
FFFFFFFFFFFFCB2C E69AD042 ; SETLO
FFFFFFFFFFFFCB30 EE800003 ; SETMID
FFFFFFFFFFFFCB34 6A0D0429 outc r1,SPRITEREGS+66
FFFFFFFFFFFFCB38 E69AD052 ; SETLO
FFFFFFFFFFFFCB3C EE800003 ; SETMID
FFFFFFFFFFFFCB40 6A0D0429 outc r1,SPRITEREGS+82
FFFFFFFFFFFFCB44 E69AD062 ; SETLO
FFFFFFFFFFFFCB48 EE800003 ; SETMID
FFFFFFFFFFFFCB4C 6A0D0429 outc r1,SPRITEREGS+98
FFFFFFFFFFFFCB50 E69AD072 ; SETLO
FFFFFFFFFFFFCB54 EE800003 ; SETMID
FFFFFFFFFFFFCB58 6A0D0429 outc r1,SPRITEREGS+114
FFFFFFFFFFFFCB5C 37EF8000 ret
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
FFFFFFFFFFFFCB60 DisplayDatetime:
FFFFFFFFFFFFCB60 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFCB64 67E08000 sw r1,[sp]
FFFFFFFFFFFFCB68 67E10008 sw r2,8[sp]
FFFFFFFFFFFFCB6C 67E18010 sw r3,16[sp]
FFFFFFFFFFFFCB70 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFCB74 31FFEEBA call CursorOff
FFFFFFFFFFFFCB78 42011416 lc r2,CursorRow
FFFFFFFFFFFFCB7C 42019418 lc r3,CursorCol
FFFFFFFFFFFFCB80 E69C0418 ; SETLO
FFFFFFFFFFFFCB84 EE800003 ; SETMID
FFFFFFFFFFFFCB88 6A0D002B outw r0,DATETIME+24 ; trigger a snapshot
FFFFFFFFFFFFCB8C 1600802E lw r1,#46 ; move cursor down to last display line
FFFFFFFFFFFFCB90 62009416 sc r1,CursorRow
FFFFFFFFFFFFCB94 16008040 lw r1,#64
FFFFFFFFFFFFCB98 62009418 sc r1,CursorCol
FFFFFFFFFFFFCB9C E69C0400 ; SETLO
FFFFFFFFFFFFCBA0 EE800003 ; SETMID
FFFFFFFFFFFFCBA4 6A0D0423 inw r1,DATETIME ; get the snapshotted date and time
FFFFFFFFFFFFCBA8 31FFF019 call DisplayWord ; display on screen
FFFFFFFFFFFFCBAC 62011416 sc r2,CursorRow ; restore cursor position
FFFFFFFFFFFFCBB0 62019418 sc r3,CursorCol
FFFFFFFFFFFFCBB4 31FFEF37 call CalcScreenLoc
FFFFFFFFFFFFCBB8 31FFEEBF call CursorOn
FFFFFFFFFFFFCBBC 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFCBC0 47E18010 lw r3,16[sp]
FFFFFFFFFFFFCBC4 47E10008 lw r2,8[sp]
FFFFFFFFFFFFCBC8 47E08000 lw r1,[sp]
FFFFFFFFFFFFCBCC 37EF8020 ret #32
;==============================================================================
;==============================================================================
FFFFFFFFFFFFCBD0 InitializeGame:
FFFFFFFFFFFFCBD0 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFCBD4 27F40000004 sm [sp],r3/lr
FFFFFFFFFFFFCBD8 E0C00140 setlo r3,#320
FFFFFFFFFFFFCBDC 62019508 sc r3,Manpos
FFFFFFFFFFFFCBE0 62001500 sc r0,Score
FFFFFFFFFFFFCBE4 60001510 sb r0,MissileActive
FFFFFFFFFFFFCBE8 62001512 sc r0,MissileX
FFFFFFFFFFFFCBEC 62001514 sc r0,MissileY
FFFFFFFFFFFFCBF0 27740000004 lm [sp],r3/lr
FFFFFFFFFFFFCBF4 37EF8010 ret #16
FFFFFFFFFFFFCBF8 DrawScore:
FFFFFFFFFFFFCBF8 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFCBFC 27F40000005 sm [sp],r1/r3/lr
FFFFFFFFFFFFCC00 E0C00001 setlo r3,#1
FFFFFFFFFFFFCC04 60019416 sb r3,CursorRow
FFFFFFFFFFFFCC08 E0C00028 setlo r3,#40
FFFFFFFFFFFFCC0C 60019418 sb r3,CursorCol
FFFFFFFFFFFFCC10 40009500 lb r1,Score
FFFFFFFFFFFFCC14 31FFF00F call DisplayByte
FFFFFFFFFFFFCC18 40009501 lb r1,Score+1
FFFFFFFFFFFFCC1C 31FFF00F call DisplayByte
FFFFFFFFFFFFCC20 27740000005 lm [sp],r1/r3/lr
FFFFFFFFFFFFCC24 37EF8018 ret #24
FFFFFFFFFFFFCC28 DrawMissile:
FFFFFFFFFFFFCC28 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFCC2C 27F40000001 sm [sp],r1/lr
FFFFFFFFFFFFCC30 42009514 lc r1,MissileY
FFFFFFFFFFFFCC34 AC101402 bleu r1,#2,MissileOff
FFFFFFFFFFFFCC38 42009512 lc r1,MissileX
FFFFFFFFFFFFCC3C 06108601 shrui r1,r1,#3
FFFFFFFFFFFFCC40 60009418 sb r1,CursorCol
FFFFFFFFFFFFCC44 42009514 lc r1,MissileY
FFFFFFFFFFFFCC48 60009416 sb r1,CursorRow
FFFFFFFFFFFFCC4C 0E108001 subui r1,r1,#1
FFFFFFFFFFFFCC50 62009514 sc r1,MissileY
FFFFFFFFFFFFCC54 E040005E setlo r1,#'^'
FFFFFFFFFFFFCC58 31FFEF47 call DisplayChar
FFFFFFFFFFFFCC5C 40009418 lb r1,CursorCol
FFFFFFFFFFFFCC60 0E108001 subui r1,r1,#1
FFFFFFFFFFFFCC64 60009418 sb r1,CursorCol
FFFFFFFFFFFFCC68 40009416 lb r1,CursorRow
FFFFFFFFFFFFCC6C 0E108001 subui r1,r1,#1
FFFFFFFFFFFFCC70 60009416 sb r1,CursorRow
FFFFFFFFFFFFCC74 E0400020 setlo r1,#' '
FFFFFFFFFFFFCC78 31FFEF47 call DisplayChar
FFFFFFFFFFFFCC7C 27740000001 lm [sp],r1/lr
FFFFFFFFFFFFCC80 37EF8010 ret #16
FFFFFFFFFFFFCC84 MissileOff:
FFFFFFFFFFFFCC84 60001510 sb r0,MissileActive
FFFFFFFFFFFFCC88 42009512 lc r1,MissileX
FFFFFFFFFFFFCC8C 06108601 shrui r1,r1,#3
FFFFFFFFFFFFCC90 60009418 sb r1,CursorCol
FFFFFFFFFFFFCC94 42009514 lc r1,MissileY
FFFFFFFFFFFFCC98 60009416 sb r1,CursorRow
FFFFFFFFFFFFCC9C E0400020 setlo r1,#' '
FFFFFFFFFFFFCCA0 31FFEF47 call DisplayChar
FFFFFFFFFFFFCCA4 27740000001 lm [sp],r1/lr
FFFFFFFFFFFFCCA8 37EF8010 ret #16
FFFFFFFFFFFFCCAC DrawMan:
FFFFFFFFFFFFCCAC 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFCCB0 27F40000005 sm [sp],r1/r3/lr
FFFFFFFFFFFFCCB4 E0C0002E setlo r3,#46
FFFFFFFFFFFFCCB8 60019416 sb r3,CursorRow
FFFFFFFFFFFFCCBC 42019508 lc r3,Manpos
FFFFFFFFFFFFCCC0 06318601 shrui r3,r3,#3
FFFFFFFFFFFFCCC4 60019418 sb r3,CursorCol
FFFFFFFFFFFFCCC8 E0400020 setlo r1,#' '
FFFFFFFFFFFFCCCC 31FFEF47 call DisplayChar
FFFFFFFFFFFFCCD0 E0400023 setlo r1,#'#'
FFFFFFFFFFFFCCD4 31FFEF47 call DisplayChar
FFFFFFFFFFFFCCD8 E0400041 setlo r1,#'A'
FFFFFFFFFFFFCCDC 31FFEF47 call DisplayChar
FFFFFFFFFFFFCCE0 E0400023 setlo r1,#'#'
FFFFFFFFFFFFCCE4 31FFEF47 call DisplayChar
FFFFFFFFFFFFCCE8 E0400020 setlo r1,#' '
FFFFFFFFFFFFCCEC 31FFEF47 call DisplayChar
FFFFFFFFFFFFCCF0 27740000005 lm [sp],r1/r3/lr
FFFFFFFFFFFFCCF4 37EF8018 ret #24
FFFFFFFFFFFFCCF8 DrawInvader:
FFFFFFFFFFFFCCF8 46018000 lw r3,InvaderPos
FFFFFFFFFFFFCCFC 160080E9 lw r1,#233
FFFFFFFFFFFFCD00 62308000 sc r1,[r3]
FFFFFFFFFFFFCD04 160080F2 lw r1,#242
FFFFFFFFFFFFCD08 62308001 sc r1,1[r3]
FFFFFFFFFFFFCD0C 160080DF lw r1,#223
FFFFFFFFFFFFCD10 62308002 sc r1,2[r3]
FFFFFFFFFFFFCD14 37EF8000 ret
FFFFFFFFFFFFCD18 DrawInvaders:
FFFFFFFFFFFFCD18 0FEF0028 subui sp,sp,#40
FFFFFFFFFFFFCD1C 27F4000000F sm [sp],r1/r2/r3/r4/lr
FFFFFFFFFFFFCD20 42009520 lc r1,InvadersRow1
FFFFFFFFFFFFCD24 42021570 lc r4,InvadersColpos
FFFFFFFFFFFFCD28 14110001 andi r2,r1,#1
FFFFFFFFFFFFCD2C BE2003A8 beq r2,r0,dinv1
FFFFFFFFFFFFCD30 40019571 lb r3,InvadersRowpos
FFFFFFFFFFFFCD34 60019416 sb r3,CursorRow
FFFFFFFFFFFFCD38 60021418 sb r4,CursorCol
FFFFFFFFFFFFCD3C E0400020 setlo r1,#' '
FFFFFFFFFFFFCD40 31FFF00F call DisplayByte
FFFFFFFFFFFFCD44 E0400023 setlo r1,#'#'
FFFFFFFFFFFFCD48 31FFF00F call DisplayByte
FFFFFFFFFFFFCD4C E0400023 setlo r1,#'#'
FFFFFFFFFFFFCD50 31FFF00F call DisplayByte
FFFFFFFFFFFFCD54 E0400023 setlo r1,#'#'
FFFFFFFFFFFFCD58 31FFF00F call DisplayByte
FFFFFFFFFFFFCD5C E0400020 setlo r1,#' '
FFFFFFFFFFFFCD60 31FFF00F call DisplayByte
FFFFFFFFFFFFCD64 40009416 lb r1,CursorRow
FFFFFFFFFFFFCD68 0A108001 addui r1,r1,#1
FFFFFFFFFFFFCD6C 60009416 sb r1,CursorRow
FFFFFFFFFFFFCD70 40009418 lb r1,CursorCol
FFFFFFFFFFFFCD74 0E108005 subui r1,r1,#5
FFFFFFFFFFFFCD78 E0400020 setlo r1,#' '
FFFFFFFFFFFFCD7C 31FFF00F call DisplayByte
FFFFFFFFFFFFCD80 E0400058 setlo r1,#'X'
FFFFFFFFFFFFCD84 31FFF00F call DisplayByte
FFFFFFFFFFFFCD88 E0400020 setlo r1,#' '
FFFFFFFFFFFFCD8C 31FFF00F call DisplayByte
FFFFFFFFFFFFCD90 E0400058 setlo r1,#'X'
FFFFFFFFFFFFCD94 31FFF00F call DisplayByte
FFFFFFFFFFFFCD98 E0400020 setlo r1,#' '
FFFFFFFFFFFFCD9C 31FFF00F call DisplayByte
FFFFFFFFFFFFCDA0 dinv1:
FFFFFFFFFFFFCDA0 2774000000F lm [sp],r1/r2/r3/r4/lr
FFFFFFFFFFFFCDA4 37EF8028 ret #40
FFFFFFFFFFFFCDA8 DrawBombs:
FFFFFFFFFFFFCDA8 37EF8000 ret
FFFFFFFFFFFFCDAC Invaders:
FFFFFFFFFFFFCDAC FFFFFFFFFFFF0000 subui sp,#240
FFFFFFFFFFFFCDB0 27F4000000F sm [sp],r1/r2/r3/r4/lr
FFFFFFFFFFFFCDB4 31FFF2F4 call InitializeGame
FFFFFFFFFFFFCDB8 InvadersLoop:
FFFFFFFFFFFFCDB8 31FFF2FE call DrawScore
FFFFFFFFFFFFCDBC 31FFF346 call DrawInvaders
FFFFFFFFFFFFCDC0 31FFF36A call DrawBombs
FFFFFFFFFFFFCDC4 31FFF30A call DrawMissile
FFFFFFFFFFFFCDC8 31FFF32B call DrawMan
FFFFFFFFFFFFCDCC TestMoveMan:
FFFFFFFFFFFFCDCC 31FFEE08 call KeybdGetChar
FFFFFFFFFFFFCDD0 B010046B beqi r1,#'k',MoveManRight
FFFFFFFFFFFFCDD4 B010096A beqi r1,#'j',MoveManLeft
FFFFFFFFFFFFCDD8 B0100D20 beqi r1,#' ',FireMissile
FFFFFFFFFFFFCDDC BE0002AA bra Invaders1
FFFFFFFFFFFFCDE0 MoveManRight:
FFFFFFFFFFFFCDE0 42011508 lc r2,Manpos
FFFFFFFFFFFFCDE4 E6800280 ; SETLO
FFFFFFFFFFFFCDE8 BE2D0247 bgtu r2,#640,Invaders1
FFFFFFFFFFFFCDEC 0A210008 addui r2,r2,#8
FFFFFFFFFFFFCDF0 62011508 sc r2,Manpos
FFFFFFFFFFFFCDF4 BE0001EA bra Invaders1
FFFFFFFFFFFFCDF8 MoveManLeft:
FFFFFFFFFFFFCDF8 42011508 lc r2,Manpos
FFFFFFFFFFFFCDFC BE2001A2 ble r2,r0,Invaders1
FFFFFFFFFFFFCE00 0E210008 subui r2,r2,#8
FFFFFFFFFFFFCE04 62011508 sc r2,Manpos
FFFFFFFFFFFFCE08 BE00014A bra Invaders1
FFFFFFFFFFFFCE0C FireMissile:
FFFFFFFFFFFFCE0C 40011510 lb r2,MissileActive
FFFFFFFFFFFFCE10 BE200109 bne r2,r0,Invaders1
FFFFFFFFFFFFCE14 E0800001 setlo r2,#1
FFFFFFFFFFFFCE18 60011510 sb r2,MissileActive
FFFFFFFFFFFFCE1C 42011508 lc r2,Manpos
FFFFFFFFFFFFCE20 62011512 sc r2,MissileX
FFFFFFFFFFFFCE24 E080002E setlo r2,#46
FFFFFFFFFFFFCE28 62011514 sc r2,MissileY
FFFFFFFFFFFFCE2C BE00002A bra Invaders1
FFFFFFFFFFFFCE30 Invaders1:
FFFFFFFFFFFFCE30 B0100203 beqi r1,#CTRLC,InvadersEnd
FFFFFFFFFFFFCE34 BE007C2A bra InvadersLoop
FFFFFFFFFFFFCE38 InvadersEnd:
FFFFFFFFFFFFCE38 2774000000F lm [sp],r1/r2/r3/r4/lr
FFFFFFFFFFFFCE3C 0BEF00F0 addui sp,sp,#240
FFFFFFFFFFFFCE40 BE0020CA bra Monitor
;==============================================================================
;==============================================================================
;****************************************************************;
; ;
; Tiny BASIC for the Raptor64 ;
; ;
; Derived from a 68000 derivative of Palo Alto Tiny BASIC as ;
; published in the May 1976 issue of Dr. Dobb's Journal. ;
; Adapted to the 68000 by: ;
; Gordon brndly ;
; 12147 - 51 Street ;
; Edmonton AB T5W 3G8 ;
; Canada ;
; (updated mailing address for 1996) ;
; ;
; Adapted to the Raptor64 by: ;
; Robert Finch ;
; Ontario, Canada ;
; robfinch<remove>@opencores.org ;
;****************************************************************;
; Copyright (C) 2012 by Robert Finch. This program may be ;
; freely distributed for personal use only. All commercial ;
; rights are reserved. ;
;****************************************************************;
;
; Register Usage
; r8 = text pointer (global usage)
; r3,r4 = inputs parameters to subroutines
; r2 = return value
;
;* Vers. 1.0 1984/7/17 - Original version by Gordon brndly
;* 1.1 1984/12/9 - Addition of '0x' print term by Marvin Lipford
;* 1.2 1985/4/9 - Bug fix in multiply routine by Rick Murray
;
; Standard jump table. You can change these addresses if you are
; customizing this interpreter for a different environment.
;
FFFFFFFFFFFFCE44 GOSTART:
FFFFFFFFFFFFCE44 33FFF39C jmp CSTART ; Cold Start entry point
FFFFFFFFFFFFCE48 GOWARM:
FFFFFFFFFFFFCE48 33FFF3BE jmp WSTART ; Warm Start entry point
FFFFFFFFFFFFCE4C GOOUT:
FFFFFFFFFFFFCE4C 33FFF95A jmp OUTC ; Jump to character-out routine
FFFFFFFFFFFFCE50 GOIN:
FFFFFFFFFFFFCE50 33FFF95B jmp INC ;Jump to character-in routine
FFFFFFFFFFFFCE54 GOAUXO:
FFFFFFFFFFFFCE54 33FFF962 jmp AUXOUT ; Jump to auxiliary-out routine
FFFFFFFFFFFFCE58 GOAUXI:
FFFFFFFFFFFFCE58 33FFF95C jmp AUXIN ; Jump to auxiliary-in routine
FFFFFFFFFFFFCE5C GOBYE:
FFFFFFFFFFFFCE5C 33FFF9EA jmp BYEBYE ; Jump to monitor, DOS, etc.
;
; Modifiable system constants:
;
FFFFFFFFFFFFCE60 align 8
FFFFFFFFFFFFCE60 0000000010060000 TXTBGN dw 0x000000001_00600000 ;TXT ;beginning of program memory
FFFFFFFFFFFFCE68 00000000107FFFF8 ENDMEM dw 0x000000001_07FFFFF8 ; end of available memory
;
; The main interpreter starts here:
;
; Usage
; r1 = temp
; r8 = text buffer pointer
; r12 = end of text in text buffer
;
FFFFFFFFFFFFCE70 align 16
FFFFFFFFFFFFCE70 CSTART:
; First save off the link register and OS sp value
FFFFFFFFFFFFCE70 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFCE74 67EF8000 sw lr,[sp]
FFFFFFFFFFFFCE78 660F1088 sw sp,OSSP
FFFFFFFFFFFFCE7C 460F4E68 lw sp,ENDMEM ; initialize stack pointer
FFFFFFFFFFFFCE80 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFCE84 67EF8000 sw lr,[sp] ; save off return address
FFFFFFFFFFFFCE88 62001416 sc r0,CursorRow ; set screen output
FFFFFFFFFFFFCE8C 62001418 sc r0,CursorCol
FFFFFFFFFFFFCE90 6000141A sb r0,CursorFlash
FFFFFFFFFFFFCE94 6600103C sw r0,pos
FFFFFFFFFFFFCE98 E6800020 ; SETLO
FFFFFFFFFFFFCE9C EE800040 ; SETMID
FFFFFFFFFFFFCEA0 040D0809 lw r2,#0x10000020 ; black chars, yellow background
FFFFFFFFFFFFCEA4 64011040 sh r2,charToPrint
FFFFFFFFFFFFCEA8 31FFEED9 call ClearScreen
FFFFFFFFFFFFCEAC 9A00E5C0 lea r1,msgInit ; tell who we are
FFFFFFFFFFFFCEB0 31FFF94D call PRMESGAUX
FFFFFFFFFFFFCEB4 9A00E5C0 lea r1,msgInit ; tell who we are
FFFFFFFFFFFFCEB8 31FFF940 call PRMESG
FFFFFFFFFFFFCEBC 4600CE60 lw r1,TXTBGN ; init. end-of-program pointer
FFFFFFFFFFFFCEC0 660090D0 sw r1,TXTUNF
FFFFFFFFFFFFCEC4 4600CE68 lw r1,ENDMEM ; get address of end of memory
FFFFFFFFFFFFCEC8 0E108800 subui r1,r1,#2048 ; reserve 2K for the stack
FFFFFFFFFFFFCECC 660090F8 sw r1,STKBOT
FFFFFFFFFFFFCED0 0E10A000 subui r1,r1,#8192 ; 1000 vars
FFFFFFFFFFFFCED4 660090D8 sw r1,VARBGN
FFFFFFFFFFFFCED8 31FFF4C3 call clearVars ; clear the variable area
FFFFFFFFFFFFCEDC 460090D8 lw r1,VARBGN ; calculate number of bytes free
FFFFFFFFFFFFCEE0 460190D0 lw r3,TXTUNF
FFFFFFFFFFFFCEE4 04118404 sub r1,r1,r3
FFFFFFFFFFFFCEE8 E0800000 setlo r2,#0
FFFFFFFFFFFFCEEC 31FFF88D call PRTNUM
FFFFFFFFFFFFCEF0 9A00E668 lea r1,msgBytesFree
FFFFFFFFFFFFCEF4 31FFF940 call PRMESG
FFFFFFFFFFFFCEF8 WSTART:
FFFFFFFFFFFFCEF8 660010A8 sw r0,LOPVAR ; initialize internal variables
FFFFFFFFFFFFCEFC 66001098 sw r0,STKGOS
FFFFFFFFFFFFCF00 66001090 sw r0,CURRNT ; current line number pointer = 0
FFFFFFFFFFFFCF04 460F4E68 lw sp,ENDMEM ; init S.P. again, just in case
FFFFFFFFFFFFCF08 9A00E676 lea r1,msgReady ; display "Ready"
FFFFFFFFFFFFCF0C 31FFF940 call PRMESG
FFFFFFFFFFFFCF10 ST3:
FFFFFFFFFFFFCF10 E040003E setlo r1,#'>' ; Prompt with a '>' and
FFFFFFFFFFFFCF14 31FFF7D8 call GETLN ; read a line.
FFFFFFFFFFFFCF18 31FFF91D call TOUPBUF ; convert to upper case
FFFFFFFFFFFFCF1C 02860009 mov r12,r8 ; save pointer to end of line
FFFFFFFFFFFFCF20 9A04111B lea r8,BUFFER ; point to the beginning of line
FFFFFFFFFFFFCF24 31FFF8FF call TSTNUM ; is there a number there?
FFFFFFFFFFFFCF28 31FFF914 call IGNBLK ; skip trailing blanks
; does line no. exist? (or nonzero?)
FFFFFFFFFFFFCF2C BE101728 beq r1,r0,DIRECT ; if not, it's a direct statement
FFFFFFFFFFFFCF30 AC1003FF bleu r1,#0xFFFF,ST2 ; see if line no. is <= 16 bits
FFFFFFFFFFFFCF34 9A00E694 lea r1,msgLineRange ; if not, we've overflowed
FFFFFFFFFFFFCF38 BE007F4A bra ERROR
FFFFFFFFFFFFCF3C ST2:
; ugliness - store a character at potentially an
; odd address (unaligned).
FFFFFFFFFFFFCF3C 02110009 mov r2,r1 ; r2 = line number
FFFFFFFFFFFFCF40 60817FFE sb r2,-2[r8]
FFFFFFFFFFFFCF44 06211001 shrui r2,r2,#8
FFFFFFFFFFFFCF48 60817FFF sb r2,-1[r8] ; store the binary line no.
FFFFFFFFFFFFCF4C 0E840002 subui r8,r8,#2
FFFFFFFFFFFFCF50 31FFF80C call FNDLN ; find this line in save area
FFFFFFFFFFFFCF54 02968009 mov r13,r9 ; save possible line pointer
FFFFFFFFFFFFCF58 BE1001C8 beq r1,r0,ST4 ; if not found, insert
; here we found the line, so we're replacing the line
; in the text area
; first step - delete the line
FFFFFFFFFFFFCF5C E0400000 setlo r1,#0
FFFFFFFFFFFFCF60 31FFF820 call FNDNXT ; find the next line (into r9)
FFFFFFFFFFFFCF64 BE100049 bne r1,r0,ST7
FFFFFFFFFFFFCF68 BE900108 beq r9,r0,ST6 ; no more lines
FFFFFFFFFFFFCF6C ST7:
FFFFFFFFFFFFCF6C 02908009 mov r1,r9 ; r1 = pointer to next line
FFFFFFFFFFFFCF70 02D10009 mov r2,r13 ; pointer to line to be deleted
FFFFFFFFFFFFCF74 460190D0 lw r3,TXTUNF ; points to top of save area
FFFFFFFFFFFFCF78 31FFF829 call MVUP ; move up to delete
FFFFFFFFFFFFCF7C 660110D0 sw r2,TXTUNF ; update the end pointer
; we moved the lines of text after the line being
; deleted down, so the pointer to the next line
; needs to be reset
FFFFFFFFFFFFCF80 02D48009 mov r9,r13
FFFFFFFFFFFFCF84 BE00006A bra ST4
; here there were no more lines, so just move the
; end of text pointer down
FFFFFFFFFFFFCF88 ST6:
FFFFFFFFFFFFCF88 660690D0 sw r13,TXTUNF
FFFFFFFFFFFFCF8C 02D48009 mov r9,r13
FFFFFFFFFFFFCF90 ST4:
; here we're inserting because the line wasn't found
; or it was deleted from the text area
FFFFFFFFFFFFCF90 02C08009 mov r1,r12 ; calculate the length of new line
FFFFFFFFFFFFCF94 04140404 sub r1,r1,r8
FFFFFFFFFFFFCF98 A41FDE03 blei r1,#3,ST3 ; is it just a line no. & CR? if so, it was just a delete
FFFFFFFFFFFFCF9C 460590D0 lw r11,TXTUNF ; compute new end of text
FFFFFFFFFFFFCFA0 02B50009 mov r10,r11 ; r10 = old TXTUNF
FFFFFFFFFFFFCFA4 04B0AC02 add r11,r11,r1 ; r11 = new top of TXTUNF (r1=line length)
FFFFFFFFFFFFCFA8 460090D8 lw r1,VARBGN ; see if there's enough room
FFFFFFFFFFFFCFAC BEB08064 bltu r11,r1,ST5
FFFFFFFFFFFFCFB0 9A00E76F lea r1,msgTooBig ; if not, say so
FFFFFFFFFFFFCFB4 33FFF7C8 jmp ERROR
; open a space in the text area
FFFFFFFFFFFFCFB8 ST5:
FFFFFFFFFFFFCFB8 660590D0 sw r11,TXTUNF ; if so, store new end position
FFFFFFFFFFFFCFBC 02A08009 mov r1,r10 ; points to old end of text
FFFFFFFFFFFFCFC0 02B10009 mov r2,r11 ; points to new end of text
FFFFFFFFFFFFCFC4 02918009 mov r3,r9 ; points to start of line after insert line
FFFFFFFFFFFFCFC8 31FFF82F call MVDOWN ; move things out of the way
; copy line into text space
FFFFFFFFFFFFCFCC 02808009 mov r1,r8 ; set up to do the insertion; move from buffer
FFFFFFFFFFFFCFD0 02D10009 mov r2,r13 ; to vacated space
FFFFFFFFFFFFCFD4 02C18009 mov r3,r12 ; until end of buffer
FFFFFFFFFFFFCFD8 31FFF829 call MVUP ; do it
FFFFFFFFFFFFCFDC BE0079AA bra ST3 ; go back and get another line
;******************************************************************
;
; *** Tables *** DIRECT *** EXEC ***
;
; This section of the code tests a string against a table. When
; a match is found, control is transferred to the section of
; code according to the table.
;
; At 'EXEC', r8 should point to the string, r9 should point to
; the character table, and r10 should point to the execution
; table. At 'DIRECT', r8 should point to the string, r9 and
; r10 will be set up to point to TAB1 and TAB1_1, which are
; the tables of all direct and statement commands.
;
; A '.' in the string will terminate the test and the partial
; match will be considered as a match, e.g. 'P.', 'PR.','PRI.',
; 'PRIN.', or 'PRINT' will all match 'PRINT'.
;
; There are two tables: the character table and the execution
; table. The character table consists of any number of text items.
; Each item is a string of characters with the last character's
; high bit set to one. The execution table holds a 32-bit
; execution addresses that correspond to each entry in the
; character table.
;
; The end of the character table is a 0 byte which corresponds
; to the default routine in the execution table, which is
; executed if none of the other table items are matched.
;
; Character-matching tables:
FFFFFFFFFFFFCFE0 align 8
FFFFFFFFFFFFCFE0 TAB1:
FFFFFFFFFFFFCFE0 C4414F4CD453494C db "LOA",'D'+0x80
FFFFFFFFFFFFCFE8 4153CE5552D7454E db "SAV",'E'+0x80
FFFFFFFFFFFFCFF2 TAB2:
FFFFFFFFFFFFCFF0 454CD458454EC556 db "LE",'T'+0x80
FFFFFFFFFFFFCFF8 47CF544F47C649D4 db "GOSU",'B'+0x80
FFFFFFFFFFFFD000 55544552C255534F db "RETUR",'N'+0x80
FFFFFFFFFFFFD008 D24F46CD4552CE52 db "FO",'R'+0x80
FFFFFFFFFFFFD010 495250D455504E49 db "PRIN",'T'+0x80
FFFFFFFFFFFFD018 50C3454B4F50D44E db "POKE",'H'+0x80
FFFFFFFFFFFFD020 454B4F50C8454B4F db "POKE",'W'+0x80
FFFFFFFFFFFFD028 4F5453C54B4F50D7 db "STO",'P'+0x80
FFFFFFFFFFFFD030 43D35953C55942D0 db "CL",'S'+0x80
FFFFFFFFFFFFD038 434452D24C43D34C db "RDC",'F'+0x80
FFFFFFFFFFFFD042 TAB4:
FFFFFFFFFFFFD040 50C34B45455000C6 db "PEEK",'H'+0x80 ;Functions
FFFFFFFFFFFFD048 4B454550C84B4545 db "PEEK",'W'+0x80 ;Functions
FFFFFFFFFFFFD050 C44E52CB454550D7 db "RN",'D'+0x80
FFFFFFFFFFFFD058 55C55A4953D34241 db "US",'R'+0x80
FFFFFFFFFFFFD063 TAB5:
FFFFFFFFFFFFD066 TAB6:
FFFFFFFFFFFFD060 545300CF5400D253 db "STE",'P'+0x80 ;"STEP" in "FOR"
FFFFFFFFFFFFD06B TAB8:
FFFFFFFFFFFFD068 BEBE3CBD3E00D045 db '>'+0x80
FFFFFFFFFFFFD075 TAB9:
FFFFFFFFFFFFD070 C44E4100BCBD3CBD db "AN",'D'+0x80
FFFFFFFFFFFFD079 TAB10:
FFFFFFFFFFFFD080 .align 8
;* Execution address tables:
FFFFFFFFFFFFD080 TAB1_1:
FFFFFFFFFFFFD080 FFFFFFFFFFFFD338 dw LISTX ;Direct commands
FFFFFFFFFFFFD088 FFFFFFFFFFFFD67C dw LOAD
FFFFFFFFFFFFD090 FFFFFFFFFFFFD284 dw NEW
FFFFFFFFFFFFD098 FFFFFFFFFFFFD29C dw RUN
FFFFFFFFFFFFD0A0 FFFFFFFFFFFFD728 dw SAVE
FFFFFFFFFFFFD0A8 TAB2_1:
FFFFFFFFFFFFD0A8 FFFFFFFFFFFFD508 dw NEXT ; Direct / statement
FFFFFFFFFFFFD0B0 FFFFFFFFFFFFD664 dw LET
FFFFFFFFFFFFD0B8 FFFFFFFFFFFFD578 dw IF
FFFFFFFFFFFFD0C0 FFFFFFFFFFFFD2E4 dw GOTO
FFFFFFFFFFFFD0C8 FFFFFFFFFFFFD418 dw GOSUB
FFFFFFFFFFFFD0D0 FFFFFFFFFFFFD454 dw RETURN
FFFFFFFFFFFFD0D8 FFFFFFFFFFFFD580 dw IF2 ; REM
FFFFFFFFFFFFD0E0 FFFFFFFFFFFFD48C dw FOR
FFFFFFFFFFFFD0E8 FFFFFFFFFFFFD5A8 dw INPUT
FFFFFFFFFFFFD0F0 FFFFFFFFFFFFD380 dw PRINT
FFFFFFFFFFFFD0F8 FFFFFFFFFFFFD83C dw POKEC
FFFFFFFFFFFFD100 FFFFFFFFFFFFD868 dw POKEH
FFFFFFFFFFFFD108 FFFFFFFFFFFFD894 dw POKEW
FFFFFFFFFFFFD110 FFFFFFFFFFFFD808 dw POKE
FFFFFFFFFFFFD118 FFFFFFFFFFFFD294 dw STOP
FFFFFFFFFFFFD120 FFFFFFFFFFFFCE5C dw GOBYE
FFFFFFFFFFFFD128 FFFFFFFFFFFFD8C0 dw SYSX
FFFFFFFFFFFFD130 FFFFFFFFFFFFE58C dw _cls
FFFFFFFFFFFFD138 FFFFFFFFFFFFD304 dw _clr
FFFFFFFFFFFFD140 FFFFFFFFFFFFE5A0 dw _rdcf
FFFFFFFFFFFFD148 FFFFFFFFFFFFD65C dw DEFLT
FFFFFFFFFFFFD150 TAB4_1:
FFFFFFFFFFFFD150 FFFFFFFFFFFFDD3C dw PEEKC
FFFFFFFFFFFFD158 FFFFFFFFFFFFDD50 dw PEEKH
FFFFFFFFFFFFD160 FFFFFFFFFFFFDD64 dw PEEKW
FFFFFFFFFFFFD168 FFFFFFFFFFFFDD2C dw PEEK ;Functions
FFFFFFFFFFFFD170 FFFFFFFFFFFFDD94 dw RND
FFFFFFFFFFFFD178 FFFFFFFFFFFFDE2C dw ABS
FFFFFFFFFFFFD180 FFFFFFFFFFFFDE4C dw SIZEX
FFFFFFFFFFFFD188 FFFFFFFFFFFFDD78 dw USRX
FFFFFFFFFFFFD190 FFFFFFFFFFFFDB50 dw XP40
FFFFFFFFFFFFD198 TAB5_1
FFFFFFFFFFFFD198 FFFFFFFFFFFFD4A4 dw FR1 ;"TO" in "FOR"
FFFFFFFFFFFFD1A0 FFFFFFFFFFFFDF1C dw QWHAT
FFFFFFFFFFFFD1A8 TAB6_1
FFFFFFFFFFFFD1A8 FFFFFFFFFFFFD4B8 dw FR2 ;"STEP" in "FOR"
FFFFFFFFFFFFD1B0 FFFFFFFFFFFFD4C0 dw FR3
FFFFFFFFFFFFD1B8 TAB8_1
FFFFFFFFFFFFD1B8 FFFFFFFFFFFFD9D0 dw XP11 ;>= Relational operators
FFFFFFFFFFFFD1C0 FFFFFFFFFFFFD9E0 dw XP12 ;<>
FFFFFFFFFFFFD1C8 FFFFFFFFFFFFD9F0 dw XP13 ;>
FFFFFFFFFFFFD1D0 FFFFFFFFFFFFDA10 dw XP15 ;=
FFFFFFFFFFFFD1D8 FFFFFFFFFFFFDA00 dw XP14 ;<=
FFFFFFFFFFFFD1E0 FFFFFFFFFFFFDA20 dw XP16 ;<
FFFFFFFFFFFFD1E8 FFFFFFFFFFFFDA48 dw XP17
FFFFFFFFFFFFD1F0 TAB9_1
FFFFFFFFFFFFD1F0 FFFFFFFFFFFFD93C dw XP_AND
FFFFFFFFFFFFD1F8 FFFFFFFFFFFFD94C dw XP_ANDX
FFFFFFFFFFFFD200 TAB10_1
FFFFFFFFFFFFD200 FFFFFFFFFFFFD904 dw XP_OR
FFFFFFFFFFFFD208 FFFFFFFFFFFFD914 dw XP_ORX
FFFFFFFFFFFFD210 .align 16
;*
;* ===== Input a character from the host into register D0 (or
; r3 = match flag (trashed)
; r9 = text table
; r10 = exec table
; r11 = trashed
FFFFFFFFFFFFD210 DIRECT:
FFFFFFFFFFFFD210 9A04CFE0 lea r9,TAB1
FFFFFFFFFFFFD214 9A055080 lea r10,TAB1_1
FFFFFFFFFFFFD218 EXEC:
FFFFFFFFFFFFD218 03F58009 mov r11,lr ; save link reg
FFFFFFFFFFFFD21C 31FFF914 call IGNBLK ; ignore leading blanks
FFFFFFFFFFFFD220 02BF8009 mov lr,r11 ; restore link reg
FFFFFFFFFFFFD224 02858009 mov r11,r8 ; save the pointer
FFFFFFFFFFFFD228 E0C00000 setlo r3,#0 ; clear match flag
FFFFFFFFFFFFD22C EXLP:
FFFFFFFFFFFFD22C 4A808000 lbu r1,[r8] ; get the program character
FFFFFFFFFFFFD230 0A840001 addui r8,r8,#1
FFFFFFFFFFFFD234 4A910000 lbu r2,[r9] ; get the table character
FFFFFFFFFFFFD238 BE200069 bne r2,r0,EXNGO ; If end of table,
FFFFFFFFFFFFD23C 02B40009 mov r8,r11 ; restore the text pointer and...
FFFFFFFFFFFFD240 BE0001EA bra EXGO ; execute the default.
FFFFFFFFFFFFD244 EXNGO:
FFFFFFFFFFFFD244 BE1181C8 beq r1,r3,EXGO ; Else check for period... if so, execute
FFFFFFFFFFFFD248 1421007F andi r2,r2,#0x7f ; ignore the table's high bit
FFFFFFFFFFFFD24C BE208108 beq r2,r1,EXMAT; is there a match?
FFFFFFFFFFFFD250 0AA50008 addui r10,r10,#8 ;if not, try the next entry
FFFFFFFFFFFFD254 02B40009 mov r8,r11 ; reset the program pointer
FFFFFFFFFFFFD258 E0C00000 setlo r3,#0 ; sorry, no match
FFFFFFFFFFFFD25C EX1:
FFFFFFFFFFFFD25C 0A948001 addui r9,r9,#1
FFFFFFFFFFFFD260 4090FFFF lb r1,-1[r9] ; get to the end of the entry
FFFFFFFFFFFFD264 BE107FC3 bgt r1,r0,EX1
FFFFFFFFFFFFD268 BE007E2A bra EXLP ; back for more matching
FFFFFFFFFFFFD26C EXMAT:
FFFFFFFFFFFFD26C E0C0002E setlo r3,#'.' ; we've got a match so far
FFFFFFFFFFFFD270 0A948001 addui r9,r9,#1
FFFFFFFFFFFFD274 4090FFFF lb r1,-1[r9] ; end of table entry?
FFFFFFFFFFFFD278 BE107DA3 bgt r1,r0,EXLP ; if not, go back for more
FFFFFFFFFFFFD27C EXGO:
FFFFFFFFFFFFD27C 46A58000 lw r11,[r10] ; execute the appropriate routine
FFFFFFFFFFFFD280 34B00000 jal r0,[r11]
; lb r1,[r8] ; get token from text space
; bpl
; and r1,#0x7f
; shl r1,#2 ; * 4 - word offset
; add r1,r1,#TAB1_1
; lw r1,[r1]
; jmp [r1]
;******************************************************************
;
; What follows is the code to execute direct and statement
; commands. Control is transferred to these points via the command
; table lookup code of 'DIRECT' and 'EXEC' in the last section.
; After the command is executed, control is transferred to other
; sections as follows:
;
; For 'LISTX', 'NEW', and 'STOP': go back to the warm start point.
; For 'RUN': go execute the first stored line if any; else go
; back to the warm start point.
; For 'GOTO' and 'GOSUB': go execute the target line.
; For 'RETURN' and 'NEXT'; go back to saved return line.
; For all others: if 'CURRNT' is 0, go to warm start; else go
; execute next command. (This is done in 'FINISH'.)
;
;******************************************************************
;
; *** NEW *** STOP *** RUN (& friends) *** GOTO ***
;
; 'NEW<CR>' sets TXTUNF to point to TXTBGN
;
; 'STOP<CR>' goes back to WSTART
;
; 'RUN<CR>' finds the first stored line, stores its address
; in CURRNT, and starts executing it. Note that only those
; commands in TAB2 are legal for a stored program.
;
; There are 3 more entries in 'RUN':
; 'RUNNXL' finds next line, stores it's address and executes it.
; 'RUNTSL' stores the address of this line and executes it.
; 'RUNSML' continues the execution on same line.
;
; 'GOTO expr<CR>' evaluates the expression, finds the target
; line, and jumps to 'RUNTSL' to do it.
;
FFFFFFFFFFFFD284 NEW:
FFFFFFFFFFFFD284 31FFF7B9 call ENDCHK
FFFFFFFFFFFFD288 4600CE60 lw r1,TXTBGN
FFFFFFFFFFFFD28C 660090D0 sw r1,TXTUNF ; set the end pointer
FFFFFFFFFFFFD290 31FFF4C3 call clearVars
FFFFFFFFFFFFD294 STOP:
FFFFFFFFFFFFD294 31FFF7B9 call ENDCHK
FFFFFFFFFFFFD298 BE00630A bra WSTART ; WSTART will reset the stack
FFFFFFFFFFFFD29C RUN:
FFFFFFFFFFFFD29C 31FFF7B9 call ENDCHK
FFFFFFFFFFFFD2A0 46044E60 lw r8,TXTBGN ; set pointer to beginning
FFFFFFFFFFFFD2A4 66041090 sw r8,CURRNT
FFFFFFFFFFFFD2A8 31FFF4C3 call clearVars
FFFFFFFFFFFFD2AC RUNNXL: ; RUN <next line>
FFFFFFFFFFFFD2AC 46009090 lw r1,CURRNT ; executing a program?
FFFFFFFFFFFFD2B0 BE106248 beq r1,r0,WSTART ; if not, we've finished a direct stat.
FFFFFFFFFFFFD2B4 E0400000 setlo r1,#0 ; else find the next line number
FFFFFFFFFFFFD2B8 02848009 mov r9,r8
FFFFFFFFFFFFD2BC 31FFF810 call FNDLNP ; search for the next line
FFFFFFFFFFFFD2C0 BE100069 bne r1,r0,RUNTSL
FFFFFFFFFFFFD2C4 BE900049 bne r9,r0,RUNTSL
FFFFFFFFFFFFD2C8 BE00618A bra WSTART ; if we've fallen off the end, stop
FFFFFFFFFFFFD2CC RUNTSL: ; RUN <this line>
FFFFFFFFFFFFD2CC 66049090 sw r9,CURRNT ; set CURRNT to point to the line no.
FFFFFFFFFFFFD2D0 9A940002 lea r8,2[r9] ; set the text pointer to
FFFFFFFFFFFFD2D4 RUNSML: ; RUN <same line>
FFFFFFFFFFFFD2D4 31FFF936 call CHKIO ; see if a control-C was pressed
FFFFFFFFFFFFD2D8 9A04CFF2 lea r9,TAB2 ; find command in TAB2
FFFFFFFFFFFFD2DC 9A0550A8 lea r10,TAB2_1
FFFFFFFFFFFFD2E0 BE0079CA bra EXEC ; and execute it
FFFFFFFFFFFFD2E4 GOTO:
FFFFFFFFFFFFD2E4 31FFF63A call OREXPR ;evaluate the following expression
FFFFFFFFFFFFD2E8 02128009 mov r5,r1
FFFFFFFFFFFFD2EC 31FFF7B9 call ENDCHK ;must find end of line
FFFFFFFFFFFFD2F0 02508009 mov r1,r5
FFFFFFFFFFFFD2F4 31FFF80C call FNDLN ; find the target line
FFFFFFFFFFFFD2F8 BE107EA9 bne r1,r0,RUNTSL ; go do it
FFFFFFFFFFFFD2FC 9A00E73B lea r1,msgBadGotoGosub
FFFFFFFFFFFFD300 BE00610A bra ERROR ; no such line no.
FFFFFFFFFFFFD304 _clr:
FFFFFFFFFFFFD304 31FFF4C3 call clearVars
FFFFFFFFFFFFD308 BE00084A bra FINISH
; Clear the variable area of memory
FFFFFFFFFFFFD30C clearVars:
FFFFFFFFFFFFD30C 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFD310 67E30000 sw r6,[sp]
FFFFFFFFFFFFD314 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFD318 E1800800 setlo r6,#2048 ; number of words to clear
FFFFFFFFFFFFD31C 460090D8 lw r1,VARBGN
FFFFFFFFFFFFD320 cv1:
FFFFFFFFFFFFD320 66100000 sw r0,[r1]
FFFFFFFFFFFFD324 08108008 add r1,r1,#8
FFFFFFFFFFFFD328 BE037FCF loop r6,cv1
FFFFFFFFFFFFD32C 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFD330 47E30000 lw r6,[sp]
FFFFFFFFFFFFD334 37EF8010 ret #16
;******************************************************************
; LIST
;
; LISTX has two forms:
; 'LIST<CR>' lists all saved lines
; 'LIST #<CR>' starts listing at the line #
; Control-S pauses the listing, control-C stops it.
;******************************************************************
;
FFFFFFFFFFFFD338 LISTX:
FFFFFFFFFFFFD338 31FFF8FF call TSTNUM ; see if there's a line no.
FFFFFFFFFFFFD33C 02128009 mov r5,r1
FFFFFFFFFFFFD340 31FFF7B9 call ENDCHK ; if not, we get a zero
FFFFFFFFFFFFD344 02508009 mov r1,r5
FFFFFFFFFFFFD348 31FFF80C call FNDLN ; find this or next line
FFFFFFFFFFFFD34C LS1:
FFFFFFFFFFFFD34C BE100049 bne r1,r0,LS4
FFFFFFFFFFFFD350 BE905D48 beq r9,r0,WSTART ; warm start if we passed the end
FFFFFFFFFFFFD354 LS4:
FFFFFFFFFFFFD354 02908009 mov r1,r9
FFFFFFFFFFFFD358 31FFF8DF call PRTLN ; print the line
FFFFFFFFFFFFD35C 02148009 mov r9,r1 ; set pointer for next
FFFFFFFFFFFFD360 31FFF936 call CHKIO ; check for listing halt request
FFFFFFFFFFFFD364 BE100088 beq r1,r0,LS3
FFFFFFFFFFFFD368 B2100313 bnei r1,#CTRLS,LS3 ; pause the listing?
FFFFFFFFFFFFD36C LS2:
FFFFFFFFFFFFD36C 31FFF936 call CHKIO ; if so, wait for another keypress
FFFFFFFFFFFFD370 BE107FE8 beq r1,r0,LS2
FFFFFFFFFFFFD374 LS3:
FFFFFFFFFFFFD374 E0400000 setlo r1,#0
FFFFFFFFFFFFD378 31FFF810 call FNDLNP ; find the next line
FFFFFFFFFFFFD37C BE007E8A bra LS1
;******************************************************************
; PRINT command is 'PRINT ....:' or 'PRINT ....<CR>'
; where '....' is a list of expressions, formats, back-arrows,
; and strings. These items a separated by commas.
;
; A format is a pound sign followed by a number. It controls
; the number of spaces the value of an expression is going to
; be printed in. It stays effective for the rest of the print
; command unless changed by another format. If no format is
; specified, 11 positions will be used.
;
; A string is quoted in a pair of single- or double-quotes.
;
; An underline (back-arrow) means generate a <CR> without a <LF>
;
; A <CR LF> is generated after the entire list has been printed
; or if the list is empty. If the list ends with a semicolon,
; however, no <CR LF> is generated.
;******************************************************************
;
FFFFFFFFFFFFD380 PRINT:
FFFFFFFFFFFFD380 1602800B lw r5,#11 ; D4 = number of print spaces
FFFFFFFFFFFFD384 E0C0003A setlo r3,#':'
FFFFFFFFFFFFD388 9A025398 lea r4,PR2
FFFFFFFFFFFFD38C 31FFF8F1 call TSTC ; if null list and ":"
FFFFFFFFFFFFD390 31FFEFFA call CRLF ; give CR-LF and continue
FFFFFFFFFFFFD394 BE007A0A bra RUNSML ; execution on the same line
FFFFFFFFFFFFD398 PR2:
FFFFFFFFFFFFD398 E0C0000D setlo r3,#CR
FFFFFFFFFFFFD39C 9A0253AC lea r4,PR0
FFFFFFFFFFFFD3A0 31FFF8F1 call TSTC ;if null list and <CR>
FFFFFFFFFFFFD3A4 31FFEFFA call CRLF ;also give CR-LF and
FFFFFFFFFFFFD3A8 BE00782A bra RUNNXL ;execute the next line
FFFFFFFFFFFFD3AC PR0:
FFFFFFFFFFFFD3AC E0C00023 setlo r3,#'#'
FFFFFFFFFFFFD3B0 9A0253C4 lea r4,PR1
FFFFFFFFFFFFD3B4 31FFF8F1 call TSTC ;else is it a format?
FFFFFFFFFFFFD3B8 31FFF63A call OREXPR ; yes, evaluate expression
FFFFFFFFFFFFD3BC 04101409 lw r5,r1 ; and save it as print width
FFFFFFFFFFFFD3C0 BE00012A bra PR3 ; look for more to print
FFFFFFFFFFFFD3C4 PR1:
FFFFFFFFFFFFD3C4 E0C00024 setlo r3,#'$'
FFFFFFFFFFFFD3C8 9A0253DC lea r4,PR4
FFFFFFFFFFFFD3CC 31FFF8F1 call TSTC ; is character expression? (MRL)
FFFFFFFFFFFFD3D0 31FFF63A call OREXPR ; yep. Evaluate expression (MRL)
FFFFFFFFFFFFD3D4 31FFF393 call GOOUT ; print low byte (MRL)
FFFFFFFFFFFFD3D8 BE00006A bra PR3 ;look for more. (MRL)
FFFFFFFFFFFFD3DC PR4:
FFFFFFFFFFFFD3DC 31FFF867 call QTSTG ; is it a string?
; the following branch must occupy only two bytes!
FFFFFFFFFFFFD3E0 BE00010A bra PR8 ; if not, must be an expression
FFFFFFFFFFFFD3E4 PR3:
FFFFFFFFFFFFD3E4 E0C0002C setlo r3,#','
FFFFFFFFFFFFD3E8 9A0253F8 lea r4,PR6
FFFFFFFFFFFFD3EC 31FFF8F1 call TSTC ; if ",", go find next
FFFFFFFFFFFFD3F0 31FFF7AA call FIN ;in the list.
FFFFFFFFFFFFD3F4 BE007DCA bra PR0
FFFFFFFFFFFFD3F8 PR6:
FFFFFFFFFFFFD3F8 31FFEFFA call CRLF ;list ends here
FFFFFFFFFFFFD3FC BE0000AA bra FINISH
FFFFFFFFFFFFD400 PR8:
FFFFFFFFFFFFD400 31FFF63A call OREXPR ; evaluate the expression
FFFFFFFFFFFFD404 04500809 lw r2,r5 ; set the width
FFFFFFFFFFFFD408 31FFF88D call PRTNUM ; print its value
FFFFFFFFFFFFD40C BE007ECA bra PR3 ; more to print?
FFFFFFFFFFFFD410 FINISH:
FFFFFFFFFFFFD410 31FFF7AA call FIN ; Check end of command
FFFFFFFFFFFFD414 33FFF7C7 jmp QWHAT ; print "What?" if wrong
;*******************************************************************
;
; *** GOSUB *** & RETURN ***
;
; 'GOSUB expr:' or 'GOSUB expr<CR>' is like the 'GOTO' command,
; except that the current text pointer, stack pointer, etc. are
; saved so that execution can be continued after the subroutine
; 'RETURN's. In order that 'GOSUB' can be nested (and even
; recursive), the save area must be stacked. The stack pointer
; is saved in 'STKGOS'. The old 'STKGOS' is saved on the stack.
; If we are in the main routine, 'STKGOS' is zero (this was done
; in the initialization section of the interpreter), but we still
; save it as a flag for no further 'RETURN's.
;******************************************************************
;
FFFFFFFFFFFFD418 GOSUB:
FFFFFFFFFFFFD418 31FFF83E call PUSHA ; save the current 'FOR' parameters
FFFFFFFFFFFFD41C 31FFF63A call OREXPR ; get line number
FFFFFFFFFFFFD420 31FFF80C call FNDLN ; find the target line
FFFFFFFFFFFFD424 BE100069 bne r1,r0,gosub1
FFFFFFFFFFFFD428 9A00E73B lea r1,msgBadGotoGosub
FFFFFFFFFFFFD42C BE0057AA bra ERROR ; if not there, say "How?"
FFFFFFFFFFFFD430 gosub1:
FFFFFFFFFFFFD430 0DEF0018 sub sp,sp,#24
FFFFFFFFFFFFD434 67E40000 sw r8,[sp] ; save text pointer
FFFFFFFFFFFFD438 46009090 lw r1,CURRNT
FFFFFFFFFFFFD43C 67E08008 sw r1,8[sp] ; found it, save old 'CURRNT'...
FFFFFFFFFFFFD440 46009098 lw r1,STKGOS
FFFFFFFFFFFFD444 67E08010 sw r1,16[sp] ; and 'STKGOS'
FFFFFFFFFFFFD448 660010A8 sw r0,LOPVAR ; load new values
FFFFFFFFFFFFD44C 660F1098 sw sp,STKGOS
FFFFFFFFFFFFD450 BE0073EA bra RUNTSL
;******************************************************************
; 'RETURN<CR>' undoes everything that 'GOSUB' did, and thus
; returns the execution to the command after the most recent
; 'GOSUB'. If 'STKGOS' is zero, it indicates that we never had
; a 'GOSUB' and is thus an error.
;******************************************************************
;
FFFFFFFFFFFFD454 RETURN:
FFFFFFFFFFFFD454 31FFF7B9 call ENDCHK ; there should be just a <CR>
FFFFFFFFFFFFD458 46009098 lw r1,STKGOS ; get old stack pointer
FFFFFFFFFFFFD45C BE100069 bne r1,r0,return1
FFFFFFFFFFFFD460 9A00E758 lea r1,msgRetWoGosub
FFFFFFFFFFFFD464 BE0055EA bra ERROR ; if zero, it doesn't exist
FFFFFFFFFFFFD468 return1:
FFFFFFFFFFFFD468 021F0009 mov sp,r1 ; else restore it
FFFFFFFFFFFFD46C 47E08010 lw r1,16[sp]
FFFFFFFFFFFFD470 66009098 sw r1,STKGOS ; and the old 'STKGOS'
FFFFFFFFFFFFD474 47E08008 lw r1,8[sp]
FFFFFFFFFFFFD478 66009090 sw r1,CURRNT ; and the old 'CURRNT'
FFFFFFFFFFFFD47C 47E40000 lw r8,[sp] ; and the old text pointer
FFFFFFFFFFFFD480 09EF0018 add sp,sp,#24
FFFFFFFFFFFFD484 31FFF831 call POPA ;and the old 'FOR' parameters
FFFFFFFFFFFFD488 BE007C4A bra FINISH ;and we are back home
;******************************************************************
; *** FOR *** & NEXT ***
;
; 'FOR' has two forms:
; 'FOR var=exp1 TO exp2 STEP exp1' and 'FOR var=exp1 TO exp2'
; The second form means the same thing as the first form with a
; STEP of positive 1. The interpreter will find the variable 'var'
; and set its value to the current value of 'exp1'. It also
; evaluates 'exp2' and 'exp1' and saves all these together with
; the text pointer, etc. in the 'FOR' save area, which consists of
; 'LOPVAR', 'LOPINC', 'LOPLMT', 'LOPLN', and 'LOPPT'. If there is
; already something in the save area (indicated by a non-zero
; 'LOPVAR'), then the old save area is saved on the stack before
; the new values are stored. The interpreter will then dig in the
; stack and find out if this same variable was used in another
; currently active 'FOR' loop. If that is the case, then the old
; 'FOR' loop is deactivated. (i.e. purged from the stack)
;******************************************************************
;
FFFFFFFFFFFFD48C FOR:
FFFFFFFFFFFFD48C 31FFF83E call PUSHA ; save the old 'FOR' save area
FFFFFFFFFFFFD490 31FFF798 call SETVAL ; set the control variable
FFFFFFFFFFFFD494 660090A8 sw r1,LOPVAR ; save its address
FFFFFFFFFFFFD498 9A04D063 lea r9,TAB5
FFFFFFFFFFFFD49C 9A055198 lea r10,TAB5_1; use 'EXEC' to test for 'TO'
FFFFFFFFFFFFD4A0 33FFF486 jmp EXEC
FFFFFFFFFFFFD4A4 FR1:
FFFFFFFFFFFFD4A4 31FFF63A call OREXPR ; evaluate the limit
FFFFFFFFFFFFD4A8 660090B8 sw r1,LOPLMT ; save that
FFFFFFFFFFFFD4AC 9A04D066 lea r9,TAB6
FFFFFFFFFFFFD4B0 9A0551A8 lea r10,TAB6_1 ; use 'EXEC' to test for the word 'STEP
FFFFFFFFFFFFD4B4 33FFF486 jmp EXEC
FFFFFFFFFFFFD4B8 FR2:
FFFFFFFFFFFFD4B8 31FFF63A call OREXPR ; found it, get the step value
FFFFFFFFFFFFD4BC BE00004A bra FR4
FFFFFFFFFFFFD4C0 FR3:
FFFFFFFFFFFFD4C0 E0400001 setlo r1,#1 ; not found, step defaults to 1
FFFFFFFFFFFFD4C4 FR4:
FFFFFFFFFFFFD4C4 660090B0 sw r1,LOPINC ; save that too
FFFFFFFFFFFFD4C8 FR5:
FFFFFFFFFFFFD4C8 46011090 lw r2,CURRNT
FFFFFFFFFFFFD4CC 660110C0 sw r2,LOPLN ; save address of current line number
FFFFFFFFFFFFD4D0 660410C8 sw r8,LOPPT ; and text pointer
FFFFFFFFFFFFD4D4 05E00C09 lw r3,sp ; dig into the stack to find 'LOPVAR'
FFFFFFFFFFFFD4D8 460310A8 lw r6,LOPVAR
FFFFFFFFFFFFD4DC BE00004A bra FR7
FFFFFFFFFFFFD4E0 FR6:
FFFFFFFFFFFFD4E0 0A318028 addui r3,r3,#40 ; look at next stack frame
FFFFFFFFFFFFD4E4 FR7:
FFFFFFFFFFFFD4E4 46310000 lw r2,[r3] ; is it zero?
FFFFFFFFFFFFD4E8 BE2000E8 beq r2,r0,FR8 ; if so, we're done
FFFFFFFFFFFFD4EC BE237FA9 bne r2,r6,FR6 ; same as current LOPVAR? nope, look some more
FFFFFFFFFFFFD4F0 04300409 lw r1,r3 ; Else remove 5 long words from...
FFFFFFFFFFFFD4F4 0A310028 addui r2,r3,#40 ; inside the stack.
FFFFFFFFFFFFD4F8 05E00C09 lw r3,sp
FFFFFFFFFFFFD4FC 31FFF82F call MVDOWN
FFFFFFFFFFFFD500 09EF0028 add sp,sp,#40 ; set the SP 5 long words up
FFFFFFFFFFFFD504 FR8:
FFFFFFFFFFFFD504 BE00786A bra FINISH ; and continue execution
;******************************************************************
; 'NEXT var' serves as the logical (not necessarily physical) end
; of the 'FOR' loop. The control variable 'var' is checked with
; the 'LOPVAR'. If they are not the same, the interpreter digs in
; the stack to find the right one and purges all those that didn't
; match. Either way, it then adds the 'STEP' to that variable and
; checks the result with against the limit value. If it is within
; the limit, control loops back to the command following the
; 'FOR'. If it's outside the limit, the save area is purged and
; execution continues.
;******************************************************************
;
FFFFFFFFFFFFD508 NEXT:
FFFFFFFFFFFFD508 E0400000 setlo r1,#0 ; don't allocate it
FFFFFFFFFFFFD50C 31FFF6EC call TSTV ; get address of variable
FFFFFFFFFFFFD510 BE100069 bne r1,r0,NX4
FFFFFFFFFFFFD514 9A00E717 lea r1,msgNextVar
FFFFFFFFFFFFD518 BE00504A bra ERROR ; if no variable, say "What?"
FFFFFFFFFFFFD51C NX4:
FFFFFFFFFFFFD51C 02148009 mov r9,r1 ; save variable's address
FFFFFFFFFFFFD520 NX0:
FFFFFFFFFFFFD520 460090A8 lw r1,LOPVAR ; If 'LOPVAR' is zero, we never...
FFFFFFFFFFFFD524 BE100069 bne r1,r0,NX5 ; had a FOR loop
FFFFFFFFFFFFD528 9A00E704 lea r1,msgNextFor
FFFFFFFFFFFFD52C BE004FAA bra ERROR
FFFFFFFFFFFFD530 NX5:
FFFFFFFFFFFFD530 BE148068 beq r1,r9,NX2 ; else we check them OK, they agree
FFFFFFFFFFFFD534 31FFF831 call POPA ; nope, let's see the next frame
FFFFFFFFFFFFD538 BE007F4A bra NX0
FFFFFFFFFFFFD53C NX2:
FFFFFFFFFFFFD53C 46908000 lw r1,[r9] ; get control variable's value
FFFFFFFFFFFFD540 460110B0 lw r2,LOPINC
FFFFFFFFFFFFD544 04110403 addu r1,r1,r2 ; add in loop increment
; BVS.L QHOW say "How?" for 32-bit overflow
FFFFFFFFFFFFD548 66908000 sw r1,[r9] ; save control variable's new value
FFFFFFFFFFFFD54C 460190B8 lw r3,LOPLMT ; get loop's limit value
FFFFFFFFFFFFD550 BE200063 bgt r2,r0,NX1 ; check loop increment, branch if loop increment is positive
FFFFFFFFFFFFD554 BE1180E0 blt r1,r3,NXPurge ; test against limit
FFFFFFFFFFFFD558 BE00004A bra NX3
FFFFFFFFFFFFD55C NX1:
FFFFFFFFFFFFD55C BE1180A3 bgt r1,r3,NXPurge
FFFFFFFFFFFFD560 NX3:
FFFFFFFFFFFFD560 460410C0 lw r8,LOPLN ; Within limit, go back to the...
FFFFFFFFFFFFD564 66041090 sw r8,CURRNT
FFFFFFFFFFFFD568 460410C8 lw r8,LOPPT ; saved 'CURRNT' and text pointer.
FFFFFFFFFFFFD56C BE00752A bra FINISH
FFFFFFFFFFFFD570 NXPurge:
FFFFFFFFFFFFD570 31FFF831 call POPA ; purge this loop
FFFFFFFFFFFFD574 BE0074EA bra FINISH
;******************************************************************
; *** REM *** IF *** INPUT *** LET (& DEFLT) ***
;
; 'REM' can be followed by anything and is ignored by the
; interpreter.
;
;REM
; br IF2 ; skip the rest of the line
; 'IF' is followed by an expression, as a condition and one or
; more commands (including other 'IF's) separated by colons.
; Note that the word 'THEN' is not used. The interpreter evaluates
; the expression. If it is non-zero, execution continues. If it
; is zero, the commands that follow are ignored and execution
; continues on the next line.
;******************************************************************
;
FFFFFFFFFFFFD578 IF:
FFFFFFFFFFFFD578 31FFF63A call OREXPR ; evaluate the expression
FFFFFFFFFFFFD57C IF1:
FFFFFFFFFFFFD57C BE106AC9 bne r1,r0,RUNSML ; is it zero? if not, continue
FFFFFFFFFFFFD580 IF2:
FFFFFFFFFFFFD580 02848009 mov r9,r8 ; set lookup pointer
FFFFFFFFFFFFD584 E0400000 setlo r1,#0 ; find line #0 (impossible)
FFFFFFFFFFFFD588 31FFF821 call FNDSKP ; if so, skip the rest of the line
FFFFFFFFFFFFD58C BE104B63 bgt r1,r0,WSTART ; if no next line, do a warm start
FFFFFFFFFFFFD590 IF3:
FFFFFFFFFFFFD590 BE0069EA bra RUNTSL ; run the next line
;******************************************************************
; INPUT is called first and establishes a stack frame
FFFFFFFFFFFFD594 INPERR:
FFFFFFFFFFFFD594 460F10A0 lw sp,STKINP ; restore the old stack pointer
FFFFFFFFFFFFD598 47E40010 lw r8,16[sp]
FFFFFFFFFFFFD59C 66041090 sw r8,CURRNT ; and old 'CURRNT'
FFFFFFFFFFFFD5A0 47E40008 lw r8,8[sp] ; and old text pointer
FFFFFFFFFFFFD5A4 0BEF0028 addui sp,sp,#40 ; fall through will subtract 40
; 'INPUT' is like the 'PRINT' command, and is followed by a list
; of items. If the item is a string in single or double quotes,
; or is an underline (back arrow), it has the same effect as in
; 'PRINT'. If an item is a variable, this variable name is
; printed out followed by a colon, then the interpreter waits for
; an expression to be typed in. The variable is then set to the
; value of this expression. If the variable is preceeded by a
; string (again in single or double quotes), the string will be
; displayed followed by a colon. The interpreter the waits for an
; expression to be entered and sets the variable equal to the
; expression's value. If the input expression is invalid, the
; interpreter will print "What?", "How?", or "Sorry" and reprint
; the prompt and redo the input. The execution will not terminate
; unless you press control-C. This is handled in 'INPERR'.
;
FFFFFFFFFFFFD5A8 INPUT:
FFFFFFFFFFFFD5A8 0FEF0028 subui sp,sp,#40 ; allocate stack frame
FFFFFFFFFFFFD5AC 67E28020 sw r5,32[sp]
FFFFFFFFFFFFD5B0 IP6:
FFFFFFFFFFFFD5B0 67E40000 sw r8,[sp] ; save in case of error
FFFFFFFFFFFFD5B4 31FFF867 call QTSTG ; is next item a string?
FFFFFFFFFFFFD5B8 BE0000CA bra IP2 ; nope - this branch must take only two bytes
FFFFFFFFFFFFD5BC E0400001 setlo r1,#1 ; allocate var
FFFFFFFFFFFFD5C0 31FFF6EC call TSTV ; yes, but is it followed by a variable?
FFFFFFFFFFFFD5C4 BE1003E8 beq r1,r0,IP4 ; if not, brnch
FFFFFFFFFFFFD5C8 02150009 mov r10,r1 ; put away the variable's address
FFFFFFFFFFFFD5CC BE0001AA bra IP3 ; if so, input to variable
FFFFFFFFFFFFD5D0 IP2:
FFFFFFFFFFFFD5D0 67E40008 sw r8,8[sp] ; save for 'PRTSTG'
FFFFFFFFFFFFD5D4 E0400001 setlo r1,#1
FFFFFFFFFFFFD5D8 31FFF6EC call TSTV ; must be a variable now
FFFFFFFFFFFFD5DC BE100069 bne r1,r0,IP7
FFFFFFFFFFFFD5E0 9A00E6E7 lea r1,msgInputVar
FFFFFFFFFFFFD5E4 BE0049EA bra ERROR ; "What?" it isn't?
FFFFFFFFFFFFD5E8 IP7:
FFFFFFFFFFFFD5E8 02150009 mov r10,r1 ; put away the variable's address
FFFFFFFFFFFFD5EC 40828000 lb r5,[r8] ; get ready for 'PRTSTG' by null terminating
FFFFFFFFFFFFD5F0 60800000 sb r0,[r8]
FFFFFFFFFFFFD5F4 47E08008 lw r1,8[sp] ; get back text pointer
FFFFFFFFFFFFD5F8 31FFF851 call PRTSTG ; print string as prompt
FFFFFFFFFFFFD5FC 60828000 sb r5,[r8] ; un-null terminate
FFFFFFFFFFFFD600 IP3
FFFFFFFFFFFFD600 67E40008 sw r8,8[sp] ; save in case of error
FFFFFFFFFFFFD604 46009090 lw r1,CURRNT
FFFFFFFFFFFFD608 67E08010 sw r1,16[sp] ; also save 'CURRNT'
FFFFFFFFFFFFD60C E07FFFFF setlo r1,#-1
FFFFFFFFFFFFD610 66009090 sw r1,CURRNT ; flag that we are in INPUT
FFFFFFFFFFFFD614 660F10A0 sw sp,STKINP ; save the stack pointer too
FFFFFFFFFFFFD618 67E50018 sw r10,24[sp] ; save the variable address
FFFFFFFFFFFFD61C E040003A setlo r1,#':' ; print a colon first
FFFFFFFFFFFFD620 31FFF7D8 call GETLN ; then get an input line
FFFFFFFFFFFFD624 9A04111B lea r8,BUFFER ; point to the buffer
FFFFFFFFFFFFD628 31FFF63A call OREXPR ; evaluate the input
FFFFFFFFFFFFD62C 47E50018 lw r10,24[sp] ; restore the variable address
FFFFFFFFFFFFD630 66A08000 sw r1,[r10] ; save value in variable
FFFFFFFFFFFFD634 47E08010 lw r1,16[sp] ; restore old 'CURRNT'
FFFFFFFFFFFFD638 66009090 sw r1,CURRNT
FFFFFFFFFFFFD63C 47E40008 lw r8,8[sp] ; and the old text pointer
FFFFFFFFFFFFD640 IP4:
FFFFFFFFFFFFD640 E0C0002C setlo r3,#','
FFFFFFFFFFFFD644 9A025650 lea r4,IP5 ; is the next thing a comma?
FFFFFFFFFFFFD648 31FFF8F1 call TSTC
FFFFFFFFFFFFD64C BE007B2A bra IP6 ; yes, more items
FFFFFFFFFFFFD650 IP5:
FFFFFFFFFFFFD650 47E28020 lw r5,32[sp]
FFFFFFFFFFFFD654 09EF0028 add sp,sp,#40 ; clean up the stack
FFFFFFFFFFFFD658 33FFF504 jmp FINISH
FFFFFFFFFFFFD65C DEFLT:
FFFFFFFFFFFFD65C 40808000 lb r1,[r8]
FFFFFFFFFFFFD660 B01F6C0D beq r1,#CR,FINISH ; empty line is OK else it is 'LET'
;******************************************************************
; 'LET' is followed by a list of items separated by commas.
; Each item consists of a variable, an equals sign, and an
; expression. The interpreter evaluates the expression and sets
; the variable to that value. The interpreter will also handle
; 'LET' commands without the word 'LET'. This is done by 'DEFLT'.
;******************************************************************
;
FFFFFFFFFFFFD664 LET:
FFFFFFFFFFFFD664 31FFF798 call SETVAL ; do the assignment
FFFFFFFFFFFFD668 E0C0002C setlo r3,#','
FFFFFFFFFFFFD66C 9A025410 lea r4,FINISH
FFFFFFFFFFFFD670 31FFF8F1 call TSTC ; check for more 'LET' items
FFFFFFFFFFFFD674 BE007F8A bra LET
FFFFFFFFFFFFD678 LT1:
FFFFFFFFFFFFD678 BE006CCA bra FINISH ; until we are finished.
;******************************************************************
; *** LOAD *** & SAVE ***
;
; These two commands transfer a program to/from an auxiliary
; device such as a cassette, another computer, etc. The program
; is converted to an easily-stored format: each line starts with
; a colon, the line no. as 4 hex digits, and the rest of the line.
; At the end, a line starting with an '@' sign is sent. This
; format can be read back with a minimum of processing time by
; the Butterfly.
;******************************************************************
;
FFFFFFFFFFFFD67C LOAD
FFFFFFFFFFFFD67C 46044E60 lw r8,TXTBGN ; set pointer to start of prog. area
FFFFFFFFFFFFD680 E040000D setlo r1,#CR ; For a CP/M host, tell it we're ready...
FFFFFFFFFFFFD684 31FFF395 call GOAUXO ; by sending a CR to finish PIP command.
FFFFFFFFFFFFD688 LOD1:
FFFFFFFFFFFFD688 31FFF396 call GOAUXI ; look for start of line
FFFFFFFFFFFFD68C BE107FE2 ble r1,r0,LOD1
FFFFFFFFFFFFD690 B0100E40 beq r1,#'@',LODEND ; end of program?
FFFFFFFFFFFFD694 B0100D1A beq r1,#0x1A,LODEND ; or EOF marker
FFFFFFFFFFFFD698 B21FFC3A bne r1,#':',LOD1 ; if not, is it start of line? if not, wait for it
FFFFFFFFFFFFD69C 31FFF5B4 call GCHAR ; get line number
FFFFFFFFFFFFD6A0 60808000 sb r1,[r8] ; store it
FFFFFFFFFFFFD6A4 06109001 shrui r1,r1,#8
FFFFFFFFFFFFD6A8 60808001 sb r1,1[r8]
FFFFFFFFFFFFD6AC 0A840002 addui r8,r8,#2
FFFFFFFFFFFFD6B0 LOD2:
FFFFFFFFFFFFD6B0 31FFF396 call GOAUXI ; get another text char.
FFFFFFFFFFFFD6B4 BE107FE2 ble r1,r0,LOD2
FFFFFFFFFFFFD6B8 60808000 sb r1,[r8]
FFFFFFFFFFFFD6BC 0A840001 addui r8,r8,#1 ; store it
FFFFFFFFFFFFD6C0 B21FFC0D bne r1,#CR,LOD2 ; is it the end of the line? if not, go back for more
FFFFFFFFFFFFD6C4 BE007E2A bra LOD1 ; if so, start a new line
FFFFFFFFFFFFD6C8 LODEND:
FFFFFFFFFFFFD6C8 660410D0 sw r8,TXTUNF ; set end-of program pointer
FFFFFFFFFFFFD6CC BE00416A bra WSTART ; back to direct mode
; get character from input (16 bit value)
FFFFFFFFFFFFD6D0 GCHAR:
FFFFFFFFFFFFD6D0 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFD6D4 67E28000 sw r5,[sp]
FFFFFFFFFFFFD6D8 67E30008 sw r6,8[sp]
FFFFFFFFFFFFD6DC 67EF8010 sw lr,16[sp]
FFFFFFFFFFFFD6E0 E1800003 setlo r6,#3 ; repeat four times
FFFFFFFFFFFFD6E4 E1400000 setlo r5,#0
FFFFFFFFFFFFD6E8 GCHAR1:
FFFFFFFFFFFFD6E8 31FFF396 call GOAUXI ; get a char
FFFFFFFFFFFFD6EC BE107FE2 ble r1,r0,GCHAR1
FFFFFFFFFFFFD6F0 31FFF5C5 call asciiToHex
FFFFFFFFFFFFD6F4 06528800 shli r5,r5,#4
FFFFFFFFFFFFD6F8 04509409 or r5,r5,r1
FFFFFFFFFFFFD6FC BE037F6F loop r6,GCHAR1
FFFFFFFFFFFFD700 02508009 mov r1,r5
FFFFFFFFFFFFD704 47EF8010 lw lr,16[sp]
FFFFFFFFFFFFD708 47E30008 lw r6,8[sp]
FFFFFFFFFFFFD70C 47E28000 lw r5,[sp]
FFFFFFFFFFFFD710 37EF8018 ret #24
; convert an ascii char to hex code
; input
; r1 = char to convert
FFFFFFFFFFFFD714 asciiToHex:
FFFFFFFFFFFFD714 A4100239 blei r1,#'9',a2h1 ; less than '9'
FFFFFFFFFFFFD718 0E108007 subui r1,r1,#7 ; shift 'A' to '9'+1
FFFFFFFFFFFFD71C a2h1:
FFFFFFFFFFFFD71C 0E108030 subui r1,r1,#'0' ;
FFFFFFFFFFFFD720 1410800F andi r1,r1,#15 ; make sure a nybble
FFFFFFFFFFFFD724 37EF8000 ret
FFFFFFFFFFFFD728 SAVE:
FFFFFFFFFFFFD728 46044E60 lw r8,TXTBGN ;set pointer to start of prog. area
FFFFFFFFFFFFD72C 460490D0 lw r9,TXTUNF ;set pointer to end of prog. area
FFFFFFFFFFFFD730 SAVE1:
FFFFFFFFFFFFD730 31FFF5E1 call AUXOCRLF ; send out a CR & LF (CP/M likes this)
FFFFFFFFFFFFD734 BE8481C5 bgeu r8,r9,SAVEND ; are we finished?
FFFFFFFFFFFFD738 E040003A setlo r1,#':' ; if not, start a line
FFFFFFFFFFFFD73C 31FFF395 call GOAUXO
FFFFFFFFFFFFD740 4A808000 lbu r1,[r8] ; get line number
FFFFFFFFFFFFD744 4A810001 lbu r2,1[r8]
FFFFFFFFFFFFD748 06211000 shli r2,r2,#8
FFFFFFFFFFFFD74C 04110409 or r1,r1,r2
FFFFFFFFFFFFD750 0A840002 addui r8,r8,#2
FFFFFFFFFFFFD754 31FFF5E9 call PWORD ; output line number as 4-digit hex
FFFFFFFFFFFFD758 SAVE2:
FFFFFFFFFFFFD758 40808000 lb r1,[r8] ; get a text char.
FFFFFFFFFFFFD75C 0A840001 addui r8,r8,#1
FFFFFFFFFFFFD760 B01FF40D beqi r1,#CR,SAVE1 ; is it the end of the line? if so, send CR & LF and start new line
FFFFFFFFFFFFD764 31FFF395 call GOAUXO ; send it out
FFFFFFFFFFFFD768 BE007F8A bra SAVE2 ; go back for more text
FFFFFFFFFFFFD76C SAVEND:
FFFFFFFFFFFFD76C E0400040 setlo r1,#'@' ; send end-of-program indicator
FFFFFFFFFFFFD770 31FFF395 call GOAUXO
FFFFFFFFFFFFD774 31FFF5E1 call AUXOCRLF ; followed by a CR & LF
FFFFFFFFFFFFD778 E040001A setlo r1,#0x1A ; and a control-Z to end the CP/M file
FFFFFFFFFFFFD77C 31FFF395 call GOAUXO
FFFFFFFFFFFFD780 BE003BCA bra WSTART ; then go do a warm start
; output a CR LF sequence to auxillary output
; Registers Affected
; r3 = LF
FFFFFFFFFFFFD784 AUXOCRLF:
FFFFFFFFFFFFD784 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFD788 67EF8000 sw lr,[sp]
FFFFFFFFFFFFD78C E040000D setlo r1,#CR
FFFFFFFFFFFFD790 31FFF395 call GOAUXO
FFFFFFFFFFFFD794 E040000A setlo r1,#LF
FFFFFFFFFFFFD798 31FFF395 call GOAUXO
FFFFFFFFFFFFD79C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFD7A0 37EF8008 ret #8
; output a word in hex format
; tricky because of the need to reverse the order of the chars
FFFFFFFFFFFFD7A4 PWORD:
FFFFFFFFFFFFD7A4 0DEF0010 sub sp,sp,#16
FFFFFFFFFFFFD7A8 67EF8000 sw lr,[sp]
FFFFFFFFFFFFD7AC 67E28008 sw r5,8[sp]
FFFFFFFFFFFFD7B0 9A02910F lea r5,NUMWKA+15
FFFFFFFFFFFFD7B4 02120009 mov r4,r1 ; r4 = value
FFFFFFFFFFFFD7B8 pword1:
FFFFFFFFFFFFD7B8 02408009 mov r1,r4 ; r1 = value
FFFFFFFFFFFFD7BC 06420801 shrui r4,r4,#4 ; shift over to next nybble
FFFFFFFFFFFFD7C0 31FFF5FD call toAsciiHex ; convert LS nybble to ascii hex
FFFFFFFFFFFFD7C4 60508000 sb r1,[r5] ; save in work area
FFFFFFFFFFFFD7C8 0E528001 subui r5,r5,#1
FFFFFFFFFFFFD7CC 12509100 cmpui r1,r5,#NUMWKA
FFFFFFFFFFFFD7D0 BE107F41 bge r1,r0,pword1
FFFFFFFFFFFFD7D4 pword2:
FFFFFFFFFFFFD7D4 0A528001 addui r5,r5,#1
FFFFFFFFFFFFD7D8 40508000 lb r1,[r5] ; get char to output
FFFFFFFFFFFFD7DC 31FFF395 call GOAUXO ; send it
FFFFFFFFFFFFD7E0 1250910F cmpui r1,r5,#NUMWKA+15
FFFFFFFFFFFFD7E4 BE107F80 blt r1,r0,pword2
FFFFFFFFFFFFD7E8 47E28008 lw r5,8[sp]
FFFFFFFFFFFFD7EC 47EF8000 lw lr,[sp]
FFFFFFFFFFFFD7F0 37EF8010 ret #16
; convert nybble in r2 to ascii hex char2
; r2 = character to convert
FFFFFFFFFFFFD7F4 toAsciiHex:
FFFFFFFFFFFFD7F4 1410800F andi r1,r1,#15 ; make sure it's a nybble
FFFFFFFFFFFFD7F8 A010020A blti r1,#10,tah1 ; > 10 ?
FFFFFFFFFFFFD7FC 08108007 addi r1,r1,#7 ; bump it up to the letter 'A'
FFFFFFFFFFFFD800 tah1:
FFFFFFFFFFFFD800 0A108030 addui r1,r1,#'0' ; bump up to ascii '0'
FFFFFFFFFFFFD804 37EF8000 ret
;******************************************************************
; *** POKE *** & SYSX ***
;
; 'POKE expr1,expr2' stores the byte from 'expr2' into the memory
; address specified by 'expr1'.
;
; 'SYSX expr' jumps to the machine language subroutine whose
; starting address is specified by 'expr'. The subroutine can use
; all registers but must leave the stack the way it found it.
; The subroutine returns to the interpreter by executing an RET.
;******************************************************************
;
FFFFFFFFFFFFD808 POKE:
FFFFFFFFFFFFD808 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFD80C 31FFF63A call OREXPR ; get the memory address
FFFFFFFFFFFFD810 E0C0002C setlo r3,#','
FFFFFFFFFFFFD814 9A025834 lea r4,PKER ; it must be followed by a comma
FFFFFFFFFFFFD818 31FFF8F1 call TSTC ; it must be followed by a comma
FFFFFFFFFFFFD81C 67E08000 sw r1,[sp] ; save the address
FFFFFFFFFFFFD820 31FFF63A call OREXPR ; get the byte to be POKE'd
FFFFFFFFFFFFD824 47E10000 lw r2,[sp] ; get the address back
FFFFFFFFFFFFD828 60208000 sb r1,[r2] ; store the byte in memory
FFFFFFFFFFFFD82C 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFD830 BE005F0A bra FINISH
FFFFFFFFFFFFD834 PKER:
FFFFFFFFFFFFD834 9A00E680 lea r1,msgComma
FFFFFFFFFFFFD838 BE00374A bra ERROR ; if no comma, say "What?"
FFFFFFFFFFFFD83C POKEC:
FFFFFFFFFFFFD83C 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFD840 31FFF63A call OREXPR ; get the memory address
FFFFFFFFFFFFD844 E0C0002C setlo r3,#','
FFFFFFFFFFFFD848 9A025834 lea r4,PKER ; it must be followed by a comma
FFFFFFFFFFFFD84C 31FFF8F1 call TSTC ; it must be followed by a comma
FFFFFFFFFFFFD850 67E08000 sw r1,[sp] ; save the address
FFFFFFFFFFFFD854 31FFF63A call OREXPR ; get the byte to be POKE'd
FFFFFFFFFFFFD858 47E10000 lw r2,[sp] ; get the address back
FFFFFFFFFFFFD85C 62208000 sc r1,[r2] ; store the char in memory
FFFFFFFFFFFFD860 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFD864 33FFF504 jmp FINISH
FFFFFFFFFFFFD868 POKEH:
FFFFFFFFFFFFD868 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFD86C 31FFF63A call OREXPR ; get the memory address
FFFFFFFFFFFFD870 E0C0002C setlo r3,#','
FFFFFFFFFFFFD874 9A025834 lea r4,PKER ; it must be followed by a comma
FFFFFFFFFFFFD878 31FFF8F1 call TSTC
FFFFFFFFFFFFD87C 67E08000 sw r1,[sp] ; save the address
FFFFFFFFFFFFD880 31FFF63A call OREXPR ; get the byte to be POKE'd
FFFFFFFFFFFFD884 47E10000 lw r2,[sp] ; get the address back
FFFFFFFFFFFFD888 64208000 sh r1,[r2] ; store the word in memory
FFFFFFFFFFFFD88C 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFD890 33FFF504 jmp FINISH
FFFFFFFFFFFFD894 POKEW:
FFFFFFFFFFFFD894 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFD898 31FFF63A call OREXPR ; get the memory address
FFFFFFFFFFFFD89C E0C0002C setlo r3,#','
FFFFFFFFFFFFD8A0 9A025834 lea r4,PKER ; it must be followed by a comma
FFFFFFFFFFFFD8A4 31FFF8F1 call TSTC
FFFFFFFFFFFFD8A8 67E08000 sw r1,[sp] ; save the address
FFFFFFFFFFFFD8AC 31FFF63A call OREXPR ; get the word to be POKE'd
FFFFFFFFFFFFD8B0 47E10000 lw r2,[sp] ; get the address back
FFFFFFFFFFFFD8B4 66208000 sw r1,[r2] ; store the word in memory
FFFFFFFFFFFFD8B8 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFD8BC 33FFF504 jmp FINISH
FFFFFFFFFFFFD8C0 SYSX:
FFFFFFFFFFFFD8C0 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFD8C4 31FFF63A call OREXPR ; get the subroutine's address
FFFFFFFFFFFFD8C8 BE100069 bne r1,r0,sysx1 ; make sure we got a valid address
FFFFFFFFFFFFD8CC 9A00E6D5 lea r1,msgSYSBad
FFFFFFFFFFFFD8D0 BE00328A bra ERROR
FFFFFFFFFFFFD8D4 sysx1:
FFFFFFFFFFFFD8D4 67E40000 sw r8,[sp] ; save the text pointer
FFFFFFFFFFFFD8D8 341F8000 jal r31,[r1] ; jump to the subroutine
FFFFFFFFFFFFD8DC 47E40000 lw r8,[sp] ; restore the text pointer
FFFFFFFFFFFFD8E0 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFD8E4 BE00596A bra FINISH
;******************************************************************
; *** EXPR ***
;
; 'EXPR' evaluates arithmetical or logical expressions.
; <OREXPR>::= <ANDEXPR> OR <ANDEXPR> ...
; <ANDEXPR>::=<EXPR> AND <EXPR> ...
; <EXPR>::=<EXPR2>
; <EXPR2><rel.op.><EXPR2>
; where <rel.op.> is one of the operators in TAB8 and the result
; of these operations is 1 if true and 0 if false.
; <EXPR2>::=(+ or -)<EXPR3>(+ or -)<EXPR3>(...
; where () are optional and (... are optional repeats.
; <EXPR3>::=<EXPR4>( <* or /><EXPR4> )(...
; <EXPR4>::=<variable>
; <function>
; (<EXPR>)
; <EXPR> is recursive so that the variable '@' can have an <EXPR>
; as an index, functions can have an <EXPR> as arguments, and
; <EXPR4> can be an <EXPR> in parenthesis.
;
; <OREXPR>::=<ANDEXPR> OR <ANDEXPR> ...
;
FFFFFFFFFFFFD8E8 OREXPR:
FFFFFFFFFFFFD8E8 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFD8EC 67EF8000 sw lr,[sp]
FFFFFFFFFFFFD8F0 31FFF648 call ANDEXPR ; get first <ANDEXPR>
FFFFFFFFFFFFD8F4 XP_OR1:
FFFFFFFFFFFFD8F4 67E08004 sw r1,4[sp] ; save <ANDEXPR> value
FFFFFFFFFFFFD8F8 9A04D079 lea r9,TAB10 ; look up a logical operator
FFFFFFFFFFFFD8FC 9A055200 lea r10,TAB10_1
FFFFFFFFFFFFD900 33FFF486 jmp EXEC ; go do it
FFFFFFFFFFFFD904 XP_OR:
FFFFFFFFFFFFD904 31FFF648 call ANDEXPR
FFFFFFFFFFFFD908 47E10008 lw r2,8[sp]
FFFFFFFFFFFFD90C 04110409 or r1,r1,r2
FFFFFFFFFFFFD910 BE007F2A bra XP_OR1
FFFFFFFFFFFFD914 XP_ORX:
FFFFFFFFFFFFD914 47E08008 lw r1,8[sp]
FFFFFFFFFFFFD918 47EF8000 lw lr,[sp]
FFFFFFFFFFFFD91C 37EF8010 ret #16
; <ANDEXPR>::=<EXPR> AND <EXPR> ...
;
FFFFFFFFFFFFD920 ANDEXPR:
FFFFFFFFFFFFD920 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFD924 67EF8000 sw lr,[sp]
FFFFFFFFFFFFD928 31FFF66D call EXPR ; get first <EXPR>
FFFFFFFFFFFFD92C XP_AND1:
FFFFFFFFFFFFD92C 67E08008 sw r1,8[sp] ; save <EXPR> value
FFFFFFFFFFFFD930 9A04D075 lea r9,TAB9 ; look up a logical operator
FFFFFFFFFFFFD934 9A0551F0 lea r10,TAB9_1
FFFFFFFFFFFFD938 33FFF486 jmp EXEC ; go do it
FFFFFFFFFFFFD93C XP_AND:
FFFFFFFFFFFFD93C 31FFF66D call EXPR
FFFFFFFFFFFFD940 47E10008 lw r2,8[sp]
FFFFFFFFFFFFD944 04110408 and r1,r1,r2
FFFFFFFFFFFFD948 BE007F2A bra XP_AND1
FFFFFFFFFFFFD94C XP_ANDX:
FFFFFFFFFFFFD94C 47E08008 lw r1,8[sp]
FFFFFFFFFFFFD950 47EF8000 lw lr,[sp]
FFFFFFFFFFFFD954 37EF8010 ret #16
; Determine if the character is a digit
; Parameters
; r1 = char to test
; Returns
; r1 = 1 if digit, otherwise 0
;
FFFFFFFFFFFFD958 isDigit:
FFFFFFFFFFFFD958 A0100430 blt r1,#'0',isDigitFalse
FFFFFFFFFFFFD95C A6100339 bgt r1,#'9',isDigitFalse
FFFFFFFFFFFFD960 E0400001 setlo r1,#1
FFFFFFFFFFFFD964 37EF8000 ret
FFFFFFFFFFFFD968 isDigitFalse:
FFFFFFFFFFFFD968 E0400000 setlo r1,#0
FFFFFFFFFFFFD96C 37EF8000 ret
; Determine if the character is a alphabetic
; Parameters
; r1 = char to test
; Returns
; r1 = 1 if alpha, otherwise 0
;
FFFFFFFFFFFFD970 isAlpha:
FFFFFFFFFFFFD970 A0100641 blt r1,#'A',isAlphaFalse
FFFFFFFFFFFFD974 A410035A ble r1,#'Z',isAlphaTrue
FFFFFFFFFFFFD978 A0100461 blt r1,#'a',isAlphaFalse
FFFFFFFFFFFFD97C A610037A bgt r1,#'z',isAlphaFalse
FFFFFFFFFFFFD980 isAlphaTrue:
FFFFFFFFFFFFD980 E0400001 setlo r1,#1
FFFFFFFFFFFFD984 37EF8000 ret
FFFFFFFFFFFFD988 isAlphaFalse:
FFFFFFFFFFFFD988 E0400000 setlo r1,#0
FFFFFFFFFFFFD98C 37EF8000 ret
; Determine if the character is a alphanumeric
; Parameters
; r1 = char to test
; Returns
; r1 = 1 if alpha, otherwise 0
;
FFFFFFFFFFFFD990 isAlnum:
FFFFFFFFFFFFD990 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFD994 67EF8000 sw lr,[sp]
FFFFFFFFFFFFD998 04100809 or r2,r1,r0 ; save test char
FFFFFFFFFFFFD99C 31FFF656 call isDigit
FFFFFFFFFFFFD9A0 BE100069 bne r1,r0,isDigitx ; if it is a digit
FFFFFFFFFFFFD9A4 04200409 or r1,r2,r0 ; get back test char
FFFFFFFFFFFFD9A8 31FFF65C call isAlpha
FFFFFFFFFFFFD9AC isDigitx:
FFFFFFFFFFFFD9AC 47EF8000 lw lr,[sp]
FFFFFFFFFFFFD9B0 37EF8008 ret #8
FFFFFFFFFFFFD9B4 EXPR:
FFFFFFFFFFFFD9B4 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFD9B8 67EF8000 sw lr,[sp]
FFFFFFFFFFFFD9BC 31FFF69C call EXPR2
FFFFFFFFFFFFD9C0 67E08008 sw r1,8[sp] ; save <EXPR2> value
FFFFFFFFFFFFD9C4 9A04D06B lea r9,TAB8 ; look up a relational operator
FFFFFFFFFFFFD9C8 9A0551B8 lea r10,TAB8_1
FFFFFFFFFFFFD9CC 33FFF486 jmp EXEC ; go do it
FFFFFFFFFFFFD9D0 XP11:
FFFFFFFFFFFFD9D0 47E08008 lw r1,8[sp]
FFFFFFFFFFFFD9D4 31FFF695 call XP18 ; is it ">="?
FFFFFFFFFFFFD9D8 BE208321 bge r2,r1,XPRT1 ; no, return r2=1
FFFFFFFFFFFFD9DC BE0002AA bra XPRT0 ; else return r2=0
FFFFFFFFFFFFD9E0 XP12:
FFFFFFFFFFFFD9E0 47E08008 lw r1,8[sp]
FFFFFFFFFFFFD9E4 31FFF695 call XP18 ; is it "<>"?
FFFFFFFFFFFFD9E8 BE2082A9 bne r2,r1,XPRT1 ; no, return r2=1
FFFFFFFFFFFFD9EC BE00022A bra XPRT0 ; else return r2=0
FFFFFFFFFFFFD9F0 XP13:
FFFFFFFFFFFFD9F0 47E08008 lw r1,8[sp]
FFFFFFFFFFFFD9F4 31FFF695 call XP18 ; is it ">"?
FFFFFFFFFFFFD9F8 BE208223 bgt r2,r1,XPRT1 ; no, return r2=1
FFFFFFFFFFFFD9FC BE0001AA bra XPRT0 ; else return r2=0
FFFFFFFFFFFFDA00 XP14:
FFFFFFFFFFFFDA00 47E08008 lw r1,8[sp]
FFFFFFFFFFFFDA04 31FFF695 call XP18 ; is it "<="?
FFFFFFFFFFFFDA08 BE2081A2 ble r2,r1,XPRT1 ; no, return r2=1
FFFFFFFFFFFFDA0C BE00012A bra XPRT0 ; else return r2=0
FFFFFFFFFFFFDA10 XP15:
FFFFFFFFFFFFDA10 47E08008 lw r1,8[sp]
FFFFFFFFFFFFDA14 31FFF695 call XP18 ; is it "="?
FFFFFFFFFFFFDA18 BE208128 beq r2,r1,XPRT1 ; if not, return r2=1
FFFFFFFFFFFFDA1C BE0000AA bra XPRT0 ; else return r2=0
FFFFFFFFFFFFDA20 XP16:
FFFFFFFFFFFFDA20 47E08008 lw r1,8[sp]
FFFFFFFFFFFFDA24 31FFF695 call XP18 ; is it "<"?
FFFFFFFFFFFFDA28 BE2080A0 blt r2,r1,XPRT1 ; if not, return r2=1
FFFFFFFFFFFFDA2C BE00002A bra XPRT0 ; else return r2=0
FFFFFFFFFFFFDA30 XPRT0:
FFFFFFFFFFFFDA30 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDA34 E0400000 setlo r1,#0 ; return r1=0 (false)
FFFFFFFFFFFFDA38 37EF8010 ret #16
FFFFFFFFFFFFDA3C XPRT1:
FFFFFFFFFFFFDA3C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDA40 E0400001 setlo r1,#1 ; return r1=1 (true)
FFFFFFFFFFFFDA44 37EF8010 ret #16
FFFFFFFFFFFFDA48 XP17: ; it's not a rel. operator
FFFFFFFFFFFFDA48 47E08008 lw r1,8[sp] ; return r2=<EXPR2>
FFFFFFFFFFFFDA4C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDA50 37EF8010 ret #16
FFFFFFFFFFFFDA54 XP18:
FFFFFFFFFFFFDA54 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFDA58 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDA5C 67E08008 sw r1,8[sp]
FFFFFFFFFFFFDA60 31FFF69C call EXPR2 ; do a second <EXPR2>
FFFFFFFFFFFFDA64 47E10008 lw r2,8[sp]
FFFFFFFFFFFFDA68 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDA6C 37EF8010 ret #16
; <EXPR2>::=(+ or -)<EXPR3>(+ or -)<EXPR3>(...
FFFFFFFFFFFFDA70 EXPR2:
FFFFFFFFFFFFDA70 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFDA74 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDA78 E0C0002D setlo r3,#'-'
FFFFFFFFFFFFDA7C 9A025A90 lea r4,XP21
FFFFFFFFFFFFDA80 31FFF8F1 call TSTC ; negative sign?
FFFFFFFFFFFFDA84 E0400000 setlo r1,#0 ; yes, fake '0-'
FFFFFFFFFFFFDA88 67E00008 sw r0,8[sp]
FFFFFFFFFFFFDA8C BE00020A bra XP26
FFFFFFFFFFFFDA90 XP21:
FFFFFFFFFFFFDA90 E0C0002B setlo r3,#'+'
FFFFFFFFFFFFDA94 9A025A9C lea r4,XP22
FFFFFFFFFFFFDA98 31FFF8F1 call TSTC ; positive sign? ignore it
FFFFFFFFFFFFDA9C XP22:
FFFFFFFFFFFFDA9C 31FFF6B9 call EXPR3 ; first <EXPR3>
FFFFFFFFFFFFDAA0 XP23:
FFFFFFFFFFFFDAA0 67E08008 sw r1,8[sp] ; yes, save the value
FFFFFFFFFFFFDAA4 E0C0002B setlo r3,#'+'
FFFFFFFFFFFFDAA8 9A025AC0 lea r4,XP25
FFFFFFFFFFFFDAAC 31FFF8F1 call TSTC ; add?
FFFFFFFFFFFFDAB0 31FFF6B9 call EXPR3 ; get the second <EXPR3>
FFFFFFFFFFFFDAB4 XP24:
FFFFFFFFFFFFDAB4 47E10008 lw r2,8[sp]
FFFFFFFFFFFFDAB8 04110402 add r1,r1,r2 ; add it to the first <EXPR3>
; BVS.L QHOW brnch if there's an overflow
FFFFFFFFFFFFDABC BE007F2A bra XP23 ; else go back for more operations
FFFFFFFFFFFFDAC0 XP25:
FFFFFFFFFFFFDAC0 E0C0002D setlo r3,#'-'
FFFFFFFFFFFFDAC4 9A025AD8 lea r4,XP45
FFFFFFFFFFFFDAC8 31FFF8F1 call TSTC ; subtract?
FFFFFFFFFFFFDACC XP26:
FFFFFFFFFFFFDACC 31FFF6B9 call EXPR3 ; get second <EXPR3>
FFFFFFFFFFFFDAD0 02108006 neg r1,r1 ; change its sign
FFFFFFFFFFFFDAD4 BE007F0A bra XP24 ; and do an addition
FFFFFFFFFFFFDAD8 XP45:
FFFFFFFFFFFFDAD8 47E08008 lw r1,8[sp]
FFFFFFFFFFFFDADC 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDAE0 37EF8010 ret #16
; <EXPR3>::=<EXPR4>( <* or /><EXPR4> )(...
FFFFFFFFFFFFDAE4 EXPR3:
FFFFFFFFFFFFDAE4 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFDAE8 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDAEC 31FFF6CF call EXPR4 ; get first <EXPR4>
FFFFFFFFFFFFDAF0 XP31:
FFFFFFFFFFFFDAF0 67E08008 sw r1,8[sp] ; yes, save that first result
FFFFFFFFFFFFDAF4 E0C0002A setlo r3,#'*'
FFFFFFFFFFFFDAF8 9A025B10 lea r4,XP34
FFFFFFFFFFFFDAFC 31FFF8F1 call TSTC ; multiply?
FFFFFFFFFFFFDB00 31FFF6CF call EXPR4 ; get second <EXPR4>
FFFFFFFFFFFFDB04 47E10008 lw r2,8[sp]
FFFFFFFFFFFFDB08 04110419 muls r1,r1,r2 ; multiply the two
FFFFFFFFFFFFDB0C BE007F2A bra XP31 ; then look for more terms
FFFFFFFFFFFFDB10 XP34:
FFFFFFFFFFFFDB10 E0C0002F setlo r3,#'/'
FFFFFFFFFFFFDB14 9A025B30 lea r4,XP47
FFFFFFFFFFFFDB18 31FFF8F1 call TSTC ; divide?
FFFFFFFFFFFFDB1C 31FFF6CF call EXPR4 ; get second <EXPR4>
FFFFFFFFFFFFDB20 04100809 or r2,r1,r0
FFFFFFFFFFFFDB24 47E08008 lw r1,8[sp]
FFFFFFFFFFFFDB28 0411041B divs r1,r1,r2 ; do the division
FFFFFFFFFFFFDB2C BE007E2A bra XP31 ; go back for any more terms
FFFFFFFFFFFFDB30 XP47:
FFFFFFFFFFFFDB30 47E08008 lw r1,8[sp]
FFFFFFFFFFFFDB34 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDB38 37EF8010 ret #16
; Functions are called through EXPR4
; <EXPR4>::=<variable>
; <function>
; (<EXPR>)
FFFFFFFFFFFFDB3C EXPR4:
FFFFFFFFFFFFDB3C 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFDB40 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDB44 9A04D042 lea r9,TAB4 ; find possible function
FFFFFFFFFFFFDB48 9A055150 lea r10,TAB4_1
FFFFFFFFFFFFDB4C 33FFF486 jmp EXEC ; branch to function which does subsequent ret for EXPR4
FFFFFFFFFFFFDB50 XP40: ; we get here if it wasn't a function
FFFFFFFFFFFFDB50 E0400000 setlo r1,#0
FFFFFFFFFFFFDB54 31FFF6EC call TSTV
FFFFFFFFFFFFDB58 BE100088 beq r1,r0,XP41 ; nor a variable
FFFFFFFFFFFFDB5C 46108000 lw r1,[r1] ; if a variable, return its value in r1
FFFFFFFFFFFFDB60 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDB64 37EF8018 ret #24
FFFFFFFFFFFFDB68 XP41:
FFFFFFFFFFFFDB68 31FFF8FF call TSTNUM ; or is it a number?
FFFFFFFFFFFFDB6C BE200049 bne r2,r0,XP46 ; (if not, # of digits will be zero) if so, return it in r1
FFFFFFFFFFFFDB70 31FFF6DF call PARN ; check for (EXPR)
FFFFFFFFFFFFDB74 XP46:
FFFFFFFFFFFFDB74 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDB78 37EF8018 ret #24
; Check for a parenthesized expression
FFFFFFFFFFFFDB7C PARN:
FFFFFFFFFFFFDB7C 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFDB80 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDB84 E0C00028 setlo r3,#'('
FFFFFFFFFFFFDB88 9A025BA8 lea r4,XP43
FFFFFFFFFFFFDB8C 31FFF8F1 call TSTC ; else look for ( OREXPR )
FFFFFFFFFFFFDB90 31FFF63A call OREXPR
FFFFFFFFFFFFDB94 E0C00029 setlo r3,#')'
FFFFFFFFFFFFDB98 9A025BA8 lea r4,XP43
FFFFFFFFFFFFDB9C 31FFF8F1 call TSTC
FFFFFFFFFFFFDBA0 XP42:
FFFFFFFFFFFFDBA0 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDBA4 37EF8008 ret #8
FFFFFFFFFFFFDBA8 XP43:
FFFFFFFFFFFFDBA8 9A00E5FD lea r1,msgWhat
FFFFFFFFFFFFDBAC BE001BAA bra ERROR
; ===== Test for a valid variable name. Returns Z=1 if not
; found, else returns Z=0 and the address of the
; variable in r1.
; Parameters
; r1 = 1 = allocate if not found
; Returns
; r1 = address of variable, zero if not found
FFFFFFFFFFFFDBB0 TSTV:
FFFFFFFFFFFFDBB0 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFDBB4 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDBB8 67E28008 sw r5,8[sp]
FFFFFFFFFFFFDBBC 04101409 or r5,r1,r0 ; allocate flag
FFFFFFFFFFFFDBC0 31FFF914 call IGNBLK
FFFFFFFFFFFFDBC4 4A808000 lbu r1,[r8] ; look at the program text
FFFFFFFFFFFFDBC8 A0101740 blt r1,#'@',tstv_notfound ; C=1: not a variable
FFFFFFFFFFFFDBCC B2100F40 bne r1,#'@',TV1 ; brnch if not "@" array
FFFFFFFFFFFFDBD0 0A840001 addui r8,r8,#1 ; If it is, it should be
FFFFFFFFFFFFDBD4 31FFF6DF call PARN ; followed by (EXPR) as its index.
FFFFFFFFFFFFDBD8 06108600 shli r1,r1,#3
; BCS.L QHOW say "How?" if index is too big
FFFFFFFFFFFFDBDC 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFDBE0 67E08008 sw r1,8[sp] ; save the index
FFFFFFFFFFFFDBE4 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDBE8 31FFF793 call SIZEX ; get amount of free memory
FFFFFFFFFFFFDBEC 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDBF0 47E10008 lw r2,8[sp] ; get back the index
FFFFFFFFFFFFDBF4 BE208044 bltu r2,r1,TV2 ; see if there's enough memory
FFFFFFFFFFFFDBF8 33FFF7C5 jmp QSORRY ; if not, say "Sorry"
FFFFFFFFFFFFDBFC TV2:
FFFFFFFFFFFFDBFC 9A0090D8 lea r1,VARBGN ; put address of array element...
FFFFFFFFFFFFDC00 04110405 subu r1,r1,r2 ; into r1 (neg. offset is used)
FFFFFFFFFFFFDC04 BE0000AA bra TSTVRT
FFFFFFFFFFFFDC08 TV1:
FFFFFFFFFFFFDC08 31FFF70D call getVarName ; get variable name
FFFFFFFFFFFFDC0C BE100068 beq r1,r0,TSTVRT ; if not, return r1=0
FFFFFFFFFFFFDC10 02510009 mov r2,r5
FFFFFFFFFFFFDC14 31FFF733 call findVar ; find or allocate
FFFFFFFFFFFFDC18 TSTVRT:
FFFFFFFFFFFFDC18 47E28008 lw r5,8[sp]
FFFFFFFFFFFFDC1C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDC20 37EF8018 ret #24 ; r1<>0 (found)
FFFFFFFFFFFFDC24 tstv_notfound:
FFFFFFFFFFFFDC24 47E28008 lw r5,8[sp]
FFFFFFFFFFFFDC28 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDC2C E0400000 setlo r1,#0 ; r1=0 if not found
FFFFFFFFFFFFDC30 37EF8018 ret #24
; Returns
; r1 = 6 character variable name + type
;
FFFFFFFFFFFFDC34 getVarName:
FFFFFFFFFFFFDC34 0FEF0018 subui sp,sp,#24
FFFFFFFFFFFFDC38 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDC3C 67E28010 sw r5,16[sp]
FFFFFFFFFFFFDC40 40808000 lb r1,[r8] ; get first character
FFFFFFFFFFFFDC44 67E08008 sw r1,8[sp] ; save off current name
FFFFFFFFFFFFDC48 31FFF65C call isAlpha
FFFFFFFFFFFFDC4C BE100388 beq r1,r0,gvn1
FFFFFFFFFFFFDC50 E1400005 setlo r5,#5 ; loop six more times
; check for second/third character
FFFFFFFFFFFFDC54 gvn4:
FFFFFFFFFFFFDC54 0A840001 addui r8,r8,#1
FFFFFFFFFFFFDC58 40808000 lb r1,[r8] ; do we have another char ?
FFFFFFFFFFFFDC5C 31FFF664 call isAlnum
FFFFFFFFFFFFDC60 BE100168 beq r1,r0,gvn2 ; nope
FFFFFFFFFFFFDC64 47E08008 lw r1,8[sp] ; get varname
FFFFFFFFFFFFDC68 06109000 shli r1,r1,#8
FFFFFFFFFFFFDC6C 40810000 lb r2,[r8]
FFFFFFFFFFFFDC70 04110409 or r1,r1,r2 ; add in new char
FFFFFFFFFFFFDC74 67E08008 sw r1,8[sp] ; save off name again
FFFFFFFFFFFFDC78 BE02FEEF loop r5,gvn4
; now ignore extra variable name characters
FFFFFFFFFFFFDC7C gvn6:
FFFFFFFFFFFFDC7C 0A840001 addui r8,r8,#1
FFFFFFFFFFFFDC80 40808000 lb r1,[r8]
FFFFFFFFFFFFDC84 31FFF664 call isAlnum
FFFFFFFFFFFFDC88 BE107FA9 bne r1,r0,gvn6 ; keep looping as long as we have identifier chars
; check for a variable type
FFFFFFFFFFFFDC8C gvn2:
FFFFFFFFFFFFDC8C 40808000 lb r1,[r8]
FFFFFFFFFFFFDC90 B0100425 beq r1,#'%',gvn3
FFFFFFFFFFFFDC94 B0100324 beq r1,#'$',gvn3
FFFFFFFFFFFFDC98 E0400000 setlo r1,#0
FFFFFFFFFFFFDC9C 0E840001 subui r8,r8,#1
; insert variable type indicator and return
FFFFFFFFFFFFDCA0 gvn3:
FFFFFFFFFFFFDCA0 0A840001 addui r8,r8,#1
FFFFFFFFFFFFDCA4 47E10008 lw r2,8[sp]
FFFFFFFFFFFFDCA8 06211000 shli r2,r2,#8
FFFFFFFFFFFFDCAC 04110409 or r1,r1,r2 ; add in variable type
FFFFFFFFFFFFDCB0 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDCB4 47E28010 lw r5,16[sp]
FFFFFFFFFFFFDCB8 37EF8018 ret #24 ; return Z = 0, r1 = varname
; not a variable name
FFFFFFFFFFFFDCBC gvn1:
FFFFFFFFFFFFDCBC 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDCC0 47E28010 lw r5,16[sp]
FFFFFFFFFFFFDCC4 E0400000 setlo r1,#0 ; return Z = 1 if not a varname
FFFFFFFFFFFFDCC8 37EF8018 ret #24
; Find variable
; r1 = varname
; r2 = allocate flag
; Returns
; r1 = variable address, Z =0 if found / allocated, Z=1 if not found
FFFFFFFFFFFFDCCC findVar:
FFFFFFFFFFFFDCCC 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFDCD0 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDCD4 67E38008 sw r7,8[sp]
FFFFFFFFFFFFDCD8 460190D8 lw r3,VARBGN
FFFFFFFFFFFFDCDC fv4:
FFFFFFFFFFFFDCDC 46338000 lw r7,[r3] ; get varname / type
FFFFFFFFFFFFDCE0 BE700108 beq r7,r0,fv3 ; no more vars ?
FFFFFFFFFFFFDCE4 BE138128 beq r1,r7,fv1 ; match ?
FFFFFFFFFFFFDCE8 08318008 add r3,r3,#8 ; move to next var
FFFFFFFFFFFFDCEC 460390F8 lw r7,STKBOT
FFFFFFFFFFFFDCF0 BE33FF60 blt r3,r7,fv4 ; loop back to look at next var
; variable not found
; no more memory
FFFFFFFFFFFFDCF4 E07FE650 setlo r1,#<msgVarSpace
FFFFFFFFFFFFDCF8 F04FFFFF sethi r1,#>msgVarSpace
FFFFFFFFFFFFDCFC BE00112A bra ERROR
; lw lr,[sp]
; lw r7,4[sp]
; add sp,sp,#8
; lw r1,#0
; ret
; variable not found
; allocate new ?
FFFFFFFFFFFFDD00 fv3:
FFFFFFFFFFFFDD00 BE2000C8 beq r2,r0,fv2
FFFFFFFFFFFFDD04 66308000 sw r1,[r3] ; save varname / type
; found variable
; return address
FFFFFFFFFFFFDD08 fv1:
FFFFFFFFFFFFDD08 0A308008 addui r1,r3,#8
FFFFFFFFFFFFDD0C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDD10 47E38008 lw r7,8[sp]
FFFFFFFFFFFFDD14 37EF8010 ret #16 ; Z = 0, r1 = address
; didn't find var and not allocating
FFFFFFFFFFFFDD18 fv2:
FFFFFFFFFFFFDD18 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDD1C 47E38008 lw r7,8[sp]
FFFFFFFFFFFFDD20 0BEF0010 addui sp,sp,#16 ; Z = 0, r1 = address
FFFFFFFFFFFFDD24 E0400000 setlo r1,#0 ; Z = 1, r1 = 0
FFFFFFFFFFFFDD28 37EF8000 ret
; ===== Multiplies the 32 bit values in r1 and r2, returning
; the 32 bit result in r1.
;
; ===== Divide the 32 bit value in r2 by the 32 bit value in r3.
; Returns the 32 bit quotient in r1, remainder in r2
;
; r2 = a
; r3 = b
; r6 = remainder
; r7 = iteration count
; r8 = sign
;
; q = a / b
; a = r1
; b = r2
; q = r2
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
FFFFFFFFFFFFDD2C PEEK:
FFFFFFFFFFFFDD2C 31FFF6DF call PARN ; get the memory address
FFFFFFFFFFFFDD30 4A108000 lbu r1,[r1] ; get the addressed byte
FFFFFFFFFFFFDD34 47EF8000 lw lr,[sp] ; and return it
FFFFFFFFFFFFDD38 37EF8018 ret #24
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
FFFFFFFFFFFFDD3C PEEKC:
FFFFFFFFFFFFDD3C 31FFF6DF call PARN ; get the memory address
FFFFFFFFFFFFDD40 1410FFFE andi r1,r1,#-2 ; align to char address
FFFFFFFFFFFFDD44 4C108000 lcu r1,[r1] ; get the addressed char
FFFFFFFFFFFFDD48 47EF8000 lw lr,[sp] ; and return it
FFFFFFFFFFFFDD4C 37EF8018 ret #24
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
FFFFFFFFFFFFDD50 PEEKH:
FFFFFFFFFFFFDD50 31FFF6DF call PARN ; get the memory address
FFFFFFFFFFFFDD54 1410FFFC andi r1,r1,#-4 ; align to half-word address
FFFFFFFFFFFFDD58 4E108000 lhu r1,[r1] ; get the addressed char
FFFFFFFFFFFFDD5C 47EF8000 lw lr,[sp] ; and return it
FFFFFFFFFFFFDD60 37EF8018 ret #24
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
FFFFFFFFFFFFDD64 PEEKW:
FFFFFFFFFFFFDD64 31FFF6DF call PARN ; get the memory address
FFFFFFFFFFFFDD68 1410FFF8 andi r1,r1,#-8 ; align to word address
FFFFFFFFFFFFDD6C 46108000 lw r1,[r1] ; get the addressed word
FFFFFFFFFFFFDD70 47EF8000 lw lr,[sp] ; and return it
FFFFFFFFFFFFDD74 37EF8018 ret #24
; user function call
; call the user function with argument in r1
FFFFFFFFFFFFDD78 USRX:
FFFFFFFFFFFFDD78 31FFF6DF call PARN ; get expression value
FFFFFFFFFFFFDD7C 67E40008 sw r8,8[sp] ; save the text pointer
FFFFFFFFFFFFDD80 46011028 lw r2,usrJmp ; get usr vector
FFFFFFFFFFFFDD84 342F8000 jal r31,[r2] ; jump to the subroutine
FFFFFFFFFFFFDD88 47E40008 lw r8,8[sp] ; restore the text pointer
FFFFFFFFFFFFDD8C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDD90 37EF8018 ret #24
; ===== The RND function returns a random number from 1 to
; the value of the following expression in D0.
;
FFFFFFFFFFFFDD94 RND:
FFFFFFFFFFFFDD94 31FFF6DF call PARN ; get the upper limit
FFFFFFFFFFFFDD98 BE100168 beq r1,r0,rnd2 ; it must be positive and non-zero
FFFFFFFFFFFFDD9C BE100100 blt r1,r0,rnd1
FFFFFFFFFFFFDDA0 04100809 lw r2,r1
FFFFFFFFFFFFDDA4 00000050 gran ; generate a random number
FFFFFFFFFFFFDDA8 020088A8 mfspr r1,rand ; get the number
FFFFFFFFFFFFDDAC 31FFF775 call modu4 ; RND(n)=MOD(number,n)+1
FFFFFFFFFFFFDDB0 0A108001 addui r1,r1,#1
FFFFFFFFFFFFDDB4 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDDB8 37EF8018 ret #24
FFFFFFFFFFFFDDBC rnd1:
FFFFFFFFFFFFDDBC 9A00E6C1 lea r1,msgRNDBad
FFFFFFFFFFFFDDC0 BE000B0A bra ERROR
FFFFFFFFFFFFDDC4 rnd2:
FFFFFFFFFFFFDDC4 00000050 gran
FFFFFFFFFFFFDDC8 020088A8 mfspr r1,rand
FFFFFFFFFFFFDDCC 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDDD0 37EF8018 ret #24
; r = a mod b
; a = r1
; b = r2
; r = r6
FFFFFFFFFFFFDDD4 modu4:
FFFFFFFFFFFFDDD4 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFDDD8 67E18000 sw r3,[sp]
FFFFFFFFFFFFDDDC 67E28008 sw r5,8[sp]
FFFFFFFFFFFFDDE0 67E30010 sw r6,16[sp]
FFFFFFFFFFFFDDE4 67E38018 sw r7,24[sp]
FFFFFFFFFFFFDDE8 1603803F lw r7,#63 ; n = 64
FFFFFFFFFFFFDDEC 0452940A xor r5,r5,r5 ; w = 0
FFFFFFFFFFFFDDF0 0463180A xor r6,r6,r6 ; r = 0
FFFFFFFFFFFFDDF4 mod2:
FFFFFFFFFFFFDDF4 06108202 roli r1,r1,#1 ; a <<= 1
FFFFFFFFFFFFDDF8 14118001 andi r3,r1,#1
FFFFFFFFFFFFDDFC 06630200 shli r6,r6,#1 ; r <<= 1
FFFFFFFFFFFFDE00 04619809 or r6,r6,r3
FFFFFFFFFFFFDE04 1410FFFE andi r1,r1,#-2
FFFFFFFFFFFFDE08 BE230047 bgtu r2,r6,mod1 ; b < r ?
FFFFFFFFFFFFDE0C 04611805 subu r6,r6,r2 ; r -= b
FFFFFFFFFFFFDE10 mod1:
FFFFFFFFFFFFDE10 BE03FF2F loop r7,mod2 ; n--
FFFFFFFFFFFFDE14 02608009 mov r1,r6
FFFFFFFFFFFFDE18 47E18000 lw r3,[sp]
FFFFFFFFFFFFDE1C 47E28008 lw r5,8[sp]
FFFFFFFFFFFFDE20 47E30010 lw r6,16[sp]
FFFFFFFFFFFFDE24 47E38018 lw r7,24[sp]
FFFFFFFFFFFFDE28 37EF8020 ret #32
; ===== The ABS function returns an absolute value in r2.
;
FFFFFFFFFFFFDE2C ABS:
FFFFFFFFFFFFDE2C 31FFF6DF call PARN ; get the following expr.'s value
FFFFFFFFFFFFDE30 02108007 abs r1,r1
FFFFFFFFFFFFDE34 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDE38 37EF8018 ret #24
; ===== The SGN function returns the sign in r1. +1,0, or -1
;
FFFFFFFFFFFFDE3C SGN:
FFFFFFFFFFFFDE3C 31FFF6DF call PARN ; get the following expr.'s value
FFFFFFFFFFFFDE40 02108008 sgn r1,r1
FFFFFFFFFFFFDE44 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDE48 37EF8018 ret #24
; ===== The SIZE function returns the size of free memory in r1.
;
FFFFFFFFFFFFDE4C SIZEX:
FFFFFFFFFFFFDE4C 460090D8 lw r1,VARBGN ; get the number of free bytes...
FFFFFFFFFFFFDE50 460110D0 lw r2,TXTUNF ; between 'TXTUNF' and 'VARBGN'
FFFFFFFFFFFFDE54 04110405 subu r1,r1,r2
FFFFFFFFFFFFDE58 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDE5C 37EF8018 ret #24 ; return the number in r2
;******************************************************************
;
; *** SETVAL *** FIN *** ENDCHK *** ERROR (& friends) ***
;
; 'SETVAL' expects a variable, followed by an equal sign and then
; an expression. It evaluates the expression and sets the variable
; to that value.
;
; 'FIN' checks the end of a command. If it ended with ":",
; execution continues. If it ended with a CR, it finds the
; the next line and continues from there.
;
; 'ENDCHK' checks if a command is ended with a CR. This is
; required in certain commands, such as GOTO, RETURN, STOP, etc.
;
; 'ERROR' prints the string pointed to by r1. It then prints the
; line pointed to by CURRNT with a "?" inserted at where the
; old text pointer (should be on top of the stack) points to.
; Execution of Tiny BASIC is stopped and a warm start is done.
; If CURRNT is zero (indicating a direct command), the direct
; command is not printed. If CURRNT is -1 (indicating
; 'INPUT' command in progress), the input line is not printed
; and execution is not terminated but continues at 'INPERR'.
;
; Related to 'ERROR' are the following:
; 'QWHAT' saves text pointer on stack and gets "What?" message.
; 'AWHAT' just gets the "What?" message and jumps to 'ERROR'.
; 'QSORRY' and 'ASORRY' do the same kind of thing.
; 'QHOW' and 'AHOW' also do this for "How?".
;
; returns
; r2 = variable's address
;
FFFFFFFFFFFFDE60 SETVAL:
FFFFFFFFFFFFDE60 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFDE64 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDE68 E0400001 setlo r1,#1 ; allocate var
FFFFFFFFFFFFDE6C 31FFF6EC call TSTV ; variable name?
FFFFFFFFFFFFDE70 BE100069 bne r1,r0,sv2
FFFFFFFFFFFFDE74 9A00E6AA lea r1,msgVar
FFFFFFFFFFFFDE78 BE00054A bra ERROR
FFFFFFFFFFFFDE7C sv2:
FFFFFFFFFFFFDE7C 67E08008 sw r1,8[sp] ; save the variable's address
FFFFFFFFFFFFDE80 E0C0003D setlo r3,#'='
FFFFFFFFFFFFDE84 9A025EA4 lea r4,SV1
FFFFFFFFFFFFDE88 31FFF8F1 call TSTC ; get past the "=" sign
FFFFFFFFFFFFDE8C 31FFF63A call OREXPR ; evaluate the expression
FFFFFFFFFFFFDE90 47E10008 lw r2,8[sp] ; get back the variable's address
FFFFFFFFFFFFDE94 66208000 sw r1,[r2] ; and save value in the variable
FFFFFFFFFFFFDE98 04200409 lw r1,r2 ; return r1 = variable address
FFFFFFFFFFFFDE9C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDEA0 37EF8010 ret #16
FFFFFFFFFFFFDEA4 SV1:
FFFFFFFFFFFFDEA4 BE0003CA bra QWHAT ; if no "=" sign
FFFFFFFFFFFFDEA8 FIN:
FFFFFFFFFFFFDEA8 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFDEAC 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDEB0 E0C0003A setlo r3,#':'
FFFFFFFFFFFFDEB4 9A025EC4 lea r4,FI1
FFFFFFFFFFFFDEB8 31FFF8F1 call TSTC ; *** FIN ***
FFFFFFFFFFFFDEBC 0BEF0008 addui sp,sp,#8 ; if ":", discard return address
FFFFFFFFFFFFDEC0 BE0020AA bra RUNSML ; continue on the same line
FFFFFFFFFFFFDEC4 FI1:
FFFFFFFFFFFFDEC4 E0C0000D setlo r3,#CR
FFFFFFFFFFFFDEC8 9A025EDC lea r4,FI2
FFFFFFFFFFFFDECC 31FFF8F1 call TSTC ; not ":", is it a CR?
FFFFFFFFFFFFDED0 47EF8000 lw lr,[sp] ; else return to the caller
FFFFFFFFFFFFDED4 0BEF0008 addui sp,sp,#8 ; yes, purge return address
FFFFFFFFFFFFDED8 BE001EAA bra RUNNXL ; execute the next line
FFFFFFFFFFFFDEDC FI2:
FFFFFFFFFFFFDEDC 47EF8000 lw lr,[sp] ; else return to the caller
FFFFFFFFFFFFDEE0 37EF8008 ret #8
; Check that there is nothing else on the line
; Registers Affected
; r1
;
FFFFFFFFFFFFDEE4 ENDCHK:
FFFFFFFFFFFFDEE4 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFDEE8 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDEEC 31FFF914 call IGNBLK
FFFFFFFFFFFFDEF0 40808000 lb r1,[r8]
FFFFFFFFFFFFDEF4 B010040D beq r1,#CR,ec1 ; does it end with a CR?
FFFFFFFFFFFFDEF8 E07FE784 setlo r1,#<msgExtraChars
FFFFFFFFFFFFDEFC F04FFFFF sethi r1,#>msgExtraChars
FFFFFFFFFFFFDF00 33FFF7C8 jmp ERROR
FFFFFFFFFFFFDF04 ec1:
FFFFFFFFFFFFDF04 47EF8000 lw lr,[sp]
FFFFFFFFFFFFDF08 37EF8008 ret #8
FFFFFFFFFFFFDF0C TOOBIG:
FFFFFFFFFFFFDF0C 9A00E76F lea r1,msgTooBig
FFFFFFFFFFFFDF10 BE00008A bra ERROR
FFFFFFFFFFFFDF14 QSORRY:
FFFFFFFFFFFFDF14 9A00E605 lea r1,SRYMSG
FFFFFFFFFFFFDF18 BE00004A bra ERROR
FFFFFFFFFFFFDF1C QWHAT:
FFFFFFFFFFFFDF1C 9A00E5FD lea r1,msgWhat
FFFFFFFFFFFFDF20 ERROR:
FFFFFFFFFFFFDF20 31FFF940 call PRMESG ; display the error message
FFFFFFFFFFFFDF24 46009090 lw r1,CURRNT ; get the current line number
FFFFFFFFFFFFDF28 BE107E88 beq r1,r0,WSTART ; if zero, do a warm start
FFFFFFFFFFFFDF2C B01D9AFF beq r1,#-1,INPERR ; is the line no. pointer = -1? if so, redo input
FFFFFFFFFFFFDF30 40828000 lb r5,[r8] ; save the char. pointed to
FFFFFFFFFFFFDF34 60800000 sb r0,[r8] ; put a zero where the error is
FFFFFFFFFFFFDF38 46009090 lw r1,CURRNT ; point to start of current line
FFFFFFFFFFFFDF3C 31FFF8DF call PRTLN ; display the line in error up to the 0
FFFFFFFFFFFFDF40 04101809 or r6,r1,r0 ; save off end pointer
FFFFFFFFFFFFDF44 60828000 sb r5,[r8] ; restore the character
FFFFFFFFFFFFDF48 E040003F setlo r1,#'?' ; display a "?"
FFFFFFFFFFFFDF4C 31FFF393 call GOOUT
FFFFFFFFFFFFDF50 E0800000 setlo r2,#0 ; stop char = 0
FFFFFFFFFFFFDF54 0E608001 subui r1,r6,#1 ; point back to the error char.
FFFFFFFFFFFFDF58 31FFF851 call PRTSTG ; display the rest of the line
FFFFFFFFFFFFDF5C 33FFF3BE jmp WSTART ; and do a warm start
;******************************************************************
;
; *** GETLN *** FNDLN (& friends) ***
;
; 'GETLN' reads in input line into 'BUFFER'. It first prompts with
; the character in r3 (given by the caller), then it fills the
; buffer and echos. It ignores LF's but still echos
; them back. Control-H is used to delete the last character
; entered (if there is one), and control-X is used to delete the
; whole line and start over again. CR signals the end of a line,
; and causes 'GETLN' to return.
;
;
FFFFFFFFFFFFDF60 GETLN:
FFFFFFFFFFFFDF60 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFDF64 67EF8000 sw lr,[sp]
FFFFFFFFFFFFDF68 67E28008 sw r5,8[sp]
FFFFFFFFFFFFDF6C 31FFF393 call GOOUT ; display the prompt
FFFFFFFFFFFFDF70 E0400001 setlo r1,#1 ; turn on cursor flash
FFFFFFFFFFFFDF74 60009046 sb r1,cursFlash
FFFFFFFFFFFFDF78 E0400020 setlo r1,#' ' ; and a space
FFFFFFFFFFFFDF7C 31FFF393 call GOOUT
FFFFFFFFFFFFDF80 E200111B setlo r8,#<BUFFER ; r8 is the buffer pointer
FFFFFFFFFFFFDF84 F2000000 sethi r8,#>BUFFER
FFFFFFFFFFFFDF88 GL1:
FFFFFFFFFFFFDF88 31FFF936 call CHKIO ; check keyboard
FFFFFFFFFFFFDF8C BE107FE8 beq r1,r0,GL1 ; wait for a char. to come in
FFFFFFFFFFFFDF90 B0100B08 beq r1,#CTRLH,GL3 ; delete last character? if so
FFFFFFFFFFFFDF94 B0101418 beq r1,#CTRLX,GL4 ; delete the whole line?
FFFFFFFFFFFFDF98 B010020D beq r1,#CR,GL2 ; accept a CR
FFFFFFFFFFFFDF9C A81FFB20 bltu r1,#' ',GL1 ; if other control char., discard it
FFFFFFFFFFFFDFA0 GL2:
FFFFFFFFFFFFDFA0 60808000 sb r1,[r8] ; save the char.
FFFFFFFFFFFFDFA4 08840001 add r8,r8,#1
FFFFFFFFFFFFDFA8 31FFF393 call GOOUT ; echo the char back out
FFFFFFFFFFFFDFAC 4080FFFF lb r1,-1[r8] ; get char back (GOOUT destroys r1)
FFFFFFFFFFFFDFB0 B010190D beq r1,#CR,GL7 ; if it's a CR, end the line
FFFFFFFFFFFFDFB4 1280916A cmpui r1,r8,#BUFFER+BUFLEN-1 ; any more room?
FFFFFFFFFFFFDFB8 BE107E80 blt r1,r0,GL1 ; yes: get some more, else delete last char.
FFFFFFFFFFFFDFBC GL3:
FFFFFFFFFFFFDFBC E0400008 setlo r1,#CTRLH ; delete a char. if possible
FFFFFFFFFFFFDFC0 31FFF393 call GOOUT
FFFFFFFFFFFFDFC4 E0400020 setlo r1,#' '
FFFFFFFFFFFFDFC8 31FFF393 call GOOUT
FFFFFFFFFFFFDFCC 1280911B cmpui r1,r8,#BUFFER ; any char.'s left?
FFFFFFFFFFFFDFD0 BE107DC2 ble r1,r0,GL1 ; if not
FFFFFFFFFFFFDFD4 E0400008 setlo r1,#CTRLH ; if so, finish the BS-space-BS sequence
FFFFFFFFFFFFDFD8 31FFF393 call GOOUT
FFFFFFFFFFFFDFDC 0C840001 sub r8,r8,#1 ; decrement the text pointer
FFFFFFFFFFFFDFE0 BE007D4A bra GL1 ; back for more
FFFFFFFFFFFFDFE4 GL4:
FFFFFFFFFFFFDFE4 04800409 or r1,r8,r0 ; delete the whole line
FFFFFFFFFFFFDFE8 0E12911B subui r5,r1,#BUFFER ; figure out how many backspaces we need
FFFFFFFFFFFFDFEC BE500108 beq r5,r0,GL6 ; if none needed, brnch
FFFFFFFFFFFFDFF0 GL5:
FFFFFFFFFFFFDFF0 E0400008 setlo r1,#CTRLH ; and display BS-space-BS sequences
FFFFFFFFFFFFDFF4 31FFF393 call GOOUT
FFFFFFFFFFFFDFF8 E0400020 setlo r1,#' '
FFFFFFFFFFFFDFFC 31FFF393 call GOOUT
FFFFFFFFFFFFE000 E0400008 setlo r1,#CTRLH
FFFFFFFFFFFFE004 31FFF393 call GOOUT
FFFFFFFFFFFFE008 BE02FF4F loop r5,GL5
FFFFFFFFFFFFE00C GL6:
FFFFFFFFFFFFE00C 9A04111B lea r8,BUFFER ; reinitialize the text pointer
FFFFFFFFFFFFE010 BE007BCA bra GL1 ; and go back for more
FFFFFFFFFFFFE014 GL7:
FFFFFFFFFFFFE014 E0400000 setlo r1,#0 ; turn off cursor flash
FFFFFFFFFFFFE018 60009046 sb r1,cursFlash
FFFFFFFFFFFFE01C E040000A setlo r1,#LF ; echo a LF for the CR
FFFFFFFFFFFFE020 31FFF393 call GOOUT
FFFFFFFFFFFFE024 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE028 47E28008 lw r5,8[sp]
FFFFFFFFFFFFE02C 37EF8010 ret #16
; 'FNDLN' finds a line with a given line no. (in r1) in the
; text save area. r9 is used as the text pointer. If the line
; is found, r9 will point to the beginning of that line
; (i.e. the high byte of the line no.), and flags are Z.
; If that line is not there and a line with a higher line no.
; is found, r9 points there and flags are NC & NZ. If we reached
; the end of the text save area and cannot find the line, flags
; are C & NZ.
; Z=1 if line found
; N=1 if end of text save area
; Z=0 & N=0 if higher line found
; r0 = 1 <= line is found
; r9 = pointer to line
; r0 = 0 <= line is not found
; r9 = zero, if end of text area
; r9 = otherwise higher line number
;
; 'FNDLN' will initialize r9 to the beginning of the text save
; area to start the search. Some other entries of this routine
; will not initialize r9 and do the search.
; 'FNDLNP' will start with r9 and search for the line no.
; 'FNDNXT' will bump r9 by 2, find a CR and then start search.
; 'FNDSKP' uses r9 to find a CR, and then starts the search.
; return Z=1 if line is found, r9 = pointer to line
;
; Parameters
; r1 = line number to find
;
FFFFFFFFFFFFE030 FNDLN:
FFFFFFFFFFFFE030 AC1003FF bleui r1,#0xFFFF,fl1 ; line no. must be < 65535
FFFFFFFFFFFFE034 9A00E694 lea r1,msgLineRange
FFFFFFFFFFFFE038 BE00774A bra ERROR
FFFFFFFFFFFFE03C fl1:
FFFFFFFFFFFFE03C 4604CE60 lw r9,TXTBGN ; init. the text save pointer
FFFFFFFFFFFFE040 FNDLNP:
FFFFFFFFFFFFE040 460510D0 lw r10,TXTUNF ; check if we passed the end
FFFFFFFFFFFFE044 0EA50001 subui r10,r10,#1
FFFFFFFFFFFFE048 BE950127 bgtu r9,r10,FNDRET1 ; if so, return with r9=0,r1=0
FFFFFFFFFFFFE04C 4A918000 lbu r3,[r9] ; get low order byte of line number
FFFFFFFFFFFFE050 4A910001 lbu r2,1[r9] ; get high order byte
FFFFFFFFFFFFE054 06211000 shli r2,r2,#8
FFFFFFFFFFFFE058 04218809 or r2,r2,r3 ; build whole line number
FFFFFFFFFFFFE05C BE110127 bgtu r1,r2,FNDNXT ; is this the line we want? no, not there yet
FFFFFFFFFFFFE060 BE1100C8 beq r1,r2,FNDRET2
FFFFFFFFFFFFE064 FNDRET:
FFFFFFFFFFFFE064 0410840A xor r1,r1,r1 ; line not found, but r9=next line pointer
FFFFFFFFFFFFE068 37EF8000 ret ; return the cond. codes
FFFFFFFFFFFFE06C FNDRET1:
FFFFFFFFFFFFE06C 0494A40A xor r9,r9,r9 ; no higher line
FFFFFFFFFFFFE070 0410840A xor r1,r1,r1 ; line not found
FFFFFFFFFFFFE074 37EF8000 ret
FFFFFFFFFFFFE078 FNDRET2:
FFFFFFFFFFFFE078 E0400001 setlo r1,#1 ; line found
FFFFFFFFFFFFE07C 37EF8000 ret
FFFFFFFFFFFFE080 FNDNXT:
FFFFFFFFFFFFE080 0A948002 addui r9,r9,#2 ; find the next line
FFFFFFFFFFFFE084 FNDSKP:
FFFFFFFFFFFFE084 4A910000 lbu r2,[r9]
FFFFFFFFFFFFE088 0A948001 addui r9,r9,#1
FFFFFFFFFFFFE08C B22FFE0D bnei r2,#CR,FNDSKP ; try to find a CR, keep looking
FFFFFFFFFFFFE090 BE007D8A bra FNDLNP ; check if end of text
;******************************************************************
; 'MVUP' moves a block up from where r1 points to where r2 points
; until r1=r3
;
FFFFFFFFFFFFE094 MVUP1:
FFFFFFFFFFFFE094 40120000 lb r4,[r1]
FFFFFFFFFFFFE098 60220000 sb r4,[r2]
FFFFFFFFFFFFE09C 08108001 add r1,r1,#1
FFFFFFFFFFFFE0A0 08210001 add r2,r2,#1
FFFFFFFFFFFFE0A4 MVUP:
FFFFFFFFFFFFE0A4 BE11FF89 bne r1,r3,MVUP1
FFFFFFFFFFFFE0A8 MVRET:
FFFFFFFFFFFFE0A8 37EF8000 ret
; 'MVDOWN' moves a block down from where r1 points to where r2
; points until r1=r3
;
FFFFFFFFFFFFE0AC MVDOWN1:
FFFFFFFFFFFFE0AC 0C108001 sub r1,r1,#1
FFFFFFFFFFFFE0B0 0C210001 sub r2,r2,#1
FFFFFFFFFFFFE0B4 40120000 lb r4,[r1]
FFFFFFFFFFFFE0B8 60220000 sb r4,[r2]
FFFFFFFFFFFFE0BC MVDOWN:
FFFFFFFFFFFFE0BC BE11FF89 bne r1,r3,MVDOWN1
FFFFFFFFFFFFE0C0 37EF8000 ret
; 'POPA' restores the 'FOR' loop variable save area from the stack
;
; 'PUSHA' stacks for 'FOR' loop variable save area onto the stack
;
; Note: a single zero word is stored on the stack in the
; case that no FOR loops need to be saved. This needs to be
; done because PUSHA / POPA is called all the time.
FFFFFFFFFFFFE0C4 POPA:
FFFFFFFFFFFFE0C4 47E08000 lw r1,[sp] ; restore LOPVAR, but zero means no more
FFFFFFFFFFFFE0C8 660090A8 sw r1,LOPVAR
FFFFFFFFFFFFE0CC BE100148 beq r1,r0,PP1
FFFFFFFFFFFFE0D0 47E08020 lw r1,32[sp] ; if not zero, restore the rest
FFFFFFFFFFFFE0D4 660090C8 sw r1,LOPPT
FFFFFFFFFFFFE0D8 47E08018 lw r1,24[sp]
FFFFFFFFFFFFE0DC 660090C0 sw r1,LOPLN
FFFFFFFFFFFFE0E0 47E08010 lw r1,16[sp]
FFFFFFFFFFFFE0E4 660090B8 sw r1,LOPLMT
FFFFFFFFFFFFE0E8 47E08008 lw r1,8[sp]
FFFFFFFFFFFFE0EC 660090B0 sw r1,LOPINC
FFFFFFFFFFFFE0F0 37EF8028 ret #40
FFFFFFFFFFFFE0F4 PP1:
FFFFFFFFFFFFE0F4 37EF8008 ret #8
FFFFFFFFFFFFE0F8 PUSHA:
FFFFFFFFFFFFE0F8 460090F8 lw r1,STKBOT ; Are we running out of stack room?
FFFFFFFFFFFFE0FC 0A108028 addui r1,r1,#40 ; we might need this many bytes
FFFFFFFFFFFFE100 BFE0F0A4 bltu sp,r1,QSORRY ; out of stack space
FFFFFFFFFFFFE104 460090A8 lw r1,LOPVAR ; save loop variables
FFFFFFFFFFFFE108 BE100188 beq r1,r0,PU1 ; if LOPVAR is zero, that's all
FFFFFFFFFFFFE10C 0FEF0028 subui sp,sp,#40
FFFFFFFFFFFFE110 67E08000 sw r1,[sp]
FFFFFFFFFFFFE114 460090C8 lw r1,LOPPT
FFFFFFFFFFFFE118 67E08020 sw r1,32[sp] ; else save all the others
FFFFFFFFFFFFE11C 460090C0 lw r1,LOPLN
FFFFFFFFFFFFE120 67E08018 sw r1,24[sp]
FFFFFFFFFFFFE124 460090B8 lw r1,LOPLMT
FFFFFFFFFFFFE128 67E08010 sw r1,16[sp]
FFFFFFFFFFFFE12C 460090B0 lw r1,LOPINC
FFFFFFFFFFFFE130 67E08008 sw r1,8[sp]
FFFFFFFFFFFFE134 37EF8000 ret
FFFFFFFFFFFFE138 PU1:
FFFFFFFFFFFFE138 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFE13C 67E08000 sw r1,[sp]
FFFFFFFFFFFFE140 37EF8000 ret
;******************************************************************
;
; *** PRTSTG *** QTSTG *** PRTNUM *** PRTLN ***
;
; 'PRTSTG' prints a string pointed to by r3. It stops printing
; and returns to the caller when either a CR is printed or when
; the next byte is the same as what was passed in r4 by the
; caller.
;
; 'QTSTG' looks for an underline (back-arrow on some systems),
; single-quote, or double-quote. If none of these are found, returns
; to the caller. If underline, outputs a CR without a LF. If single
; or double quote, prints the quoted string and demands a matching
; end quote. After the printing, the next i-word of the caller is
; skipped over (usually a branch instruction).
;
; 'PRTNUM' prints the 32 bit number in r3, leading blanks are added if
; needed to pad the number of spaces to the number in r4.
; However, if the number of digits is larger than the no. in
; r4, all digits are printed anyway. Negative sign is also
; printed and counted in, positive sign is not.
;
; 'PRTLN' prints the saved text line pointed to by r3
; with line no. and all.
;
; r1 = pointer to string
; r2 = stop character
; return r1 = pointer to end of line + 1
FFFFFFFFFFFFE144 PRTSTG:
FFFFFFFFFFFFE144 0DEF0020 sub sp,sp,#32
FFFFFFFFFFFFE148 67E28000 sw r5,[sp]
FFFFFFFFFFFFE14C 67E28008 sw r5,8[sp]
FFFFFFFFFFFFE150 67E38010 sw r7,16[sp]
FFFFFFFFFFFFE154 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFE158 02128009 mov r5,r1 ; r5 = pointer
FFFFFFFFFFFFE15C 02230009 mov r6,r2 ; r6 = stop char
FFFFFFFFFFFFE160 PS1:
FFFFFFFFFFFFE160 4A538000 lbu r7,[r5] ; get a text character
FFFFFFFFFFFFE164 0A528001 addui r5,r5,#1
FFFFFFFFFFFFE168 BE7300C8 beq r7,r6,PRTRET ; same as stop character? if so, return
FFFFFFFFFFFFE16C 02708009 mov r1,r7
FFFFFFFFFFFFE170 31FFF393 call GOOUT ; display the char.
FFFFFFFFFFFFE174 B27FFB0D bnei r7,#CR,PS1 ; is it a C.R.? no, go back for more
FFFFFFFFFFFFE178 E040000A setlo r1,#LF ; yes, add a L.F.
FFFFFFFFFFFFE17C 31FFF393 call GOOUT
FFFFFFFFFFFFE180 PRTRET:
FFFFFFFFFFFFE180 02710009 mov r2,r7 ; return r2 = stop char
FFFFFFFFFFFFE184 02508009 mov r1,r5 ; return r1 = line pointer
FFFFFFFFFFFFE188 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFE18C 47E38010 lw r7,16[sp]
FFFFFFFFFFFFE190 47E28008 lw r5,8[sp]
FFFFFFFFFFFFE194 47E28000 lw r5,[sp]
FFFFFFFFFFFFE198 37EF8020 ret #32 ; then return
FFFFFFFFFFFFE19C QTSTG:
FFFFFFFFFFFFE19C 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFE1A0 67EF8000 sw lr,[sp]
FFFFFFFFFFFFE1A4 E0C00022 setlo r3,#'"'
FFFFFFFFFFFFE1A8 E13FE1D0 setlo r4,#<QT3
FFFFFFFFFFFFE1AC F10FFFFF sethi r4,#>QT3
FFFFFFFFFFFFE1B0 31FFF8F1 call TSTC ; *** QTSTG ***
FFFFFFFFFFFFE1B4 E0800022 setlo r2,#'"' ; it is a "
FFFFFFFFFFFFE1B8 QT1:
FFFFFFFFFFFFE1B8 04800409 or r1,r8,r0
FFFFFFFFFFFFE1BC 31FFF851 call PRTSTG ; print until another
FFFFFFFFFFFFE1C0 04102009 lw r8,r1
FFFFFFFFFFFFE1C4 B2200F0A bne r2,#LF,QT2 ; was last one a CR?
FFFFFFFFFFFFE1C8 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFE1CC BE00070A bra RUNNXL ; if so, run next line
FFFFFFFFFFFFE1D0 QT3:
FFFFFFFFFFFFE1D0 E0C00027 setlo r3,#''''
FFFFFFFFFFFFE1D4 E13FE1E8 setlo r4,#<QT4
FFFFFFFFFFFFE1D8 F10FFFFF sethi r4,#>QT4
FFFFFFFFFFFFE1DC 31FFF8F1 call TSTC ; is it a single quote?
FFFFFFFFFFFFE1E0 E0800027 setlo r2,#'''' ; if so, do same as above
FFFFFFFFFFFFE1E4 BE007EAA bra QT1
FFFFFFFFFFFFE1E8 QT4:
FFFFFFFFFFFFE1E8 E0C0005F setlo r3,#'_'
FFFFFFFFFFFFE1EC E13FE20C setlo r4,#<QT5
FFFFFFFFFFFFE1F0 F10FFFFF sethi r4,#>QT5
FFFFFFFFFFFFE1F4 31FFF8F1 call TSTC ; is it an underline?
FFFFFFFFFFFFE1F8 E040000D setlo r1,#CR ; if so, output a CR without LF
FFFFFFFFFFFFE1FC 31FFF393 call GOOUT
FFFFFFFFFFFFE200 QT2:
FFFFFFFFFFFFE200 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE204 0BEF0008 addui sp,sp,#8
FFFFFFFFFFFFE208 35F00004 jal r0,4[lr] ; skip over next i-word when returning
FFFFFFFFFFFFE20C QT5: ; not " ' or _
FFFFFFFFFFFFE20C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE210 37EF8008 ret #8
; Output a CR LF sequence
;
FFFFFFFFFFFFE214 prCRLF:
FFFFFFFFFFFFE214 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFE218 67EF8000 sw lr,[sp]
FFFFFFFFFFFFE21C E040000D setlo r1,#CR
FFFFFFFFFFFFE220 31FFF393 call GOOUT
FFFFFFFFFFFFE224 E040000A setlo r1,#LF
FFFFFFFFFFFFE228 31FFF393 call GOOUT
FFFFFFFFFFFFE22C 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE230 37EF8008 ret #8
; r1 = number to print
; r2 = number of digits
; Register Usage
; r5 = number of padding spaces
FFFFFFFFFFFFE234 PRTNUM:
FFFFFFFFFFFFE234 0FEF0028 subui sp,sp,#40
FFFFFFFFFFFFE238 67E18000 sw r3,[sp]
FFFFFFFFFFFFE23C 67E28008 sw r5,8[sp]
FFFFFFFFFFFFE240 67E30010 sw r6,16[sp]
FFFFFFFFFFFFE244 67E38018 sw r7,24[sp]
FFFFFFFFFFFFE248 67EF8020 sw lr,32[sp]
FFFFFFFFFFFFE24C 16039100 ori r7,r0,#NUMWKA ; r7 = pointer to numeric work area
FFFFFFFFFFFFE250 02130009 mov r6,r1 ; save number for later
FFFFFFFFFFFFE254 02228009 mov r5,r2 ; r5 = min number of chars
FFFFFFFFFFFFE258 BE100063 bgt r1,r0,PN1 ; is it negative? if not
FFFFFFFFFFFFE25C 02108006 neg r1,r1 ; else make it positive
FFFFFFFFFFFFE260 0E528001 subui r5,r5,#1 ; one less for width count
FFFFFFFFFFFFE264 PN1:
FFFFFFFFFFFFE264 1601800A lw r3,#10
FFFFFFFFFFFFE268 0411881C mod r2,r1,r3 ; r2 = r1 mod 10
FFFFFFFFFFFFE26C 1C10800A divui r1,r1,#10 ; r1 /= 10 divide by 10
FFFFFFFFFFFFE270 0A210030 addui r2,r2,#'0' ; convert remainder to ascii
FFFFFFFFFFFFE274 60710000 sb r2,[r7] ; and store in buffer
FFFFFFFFFFFFE278 0A738001 addui r7,r7,#1
FFFFFFFFFFFFE27C 0E528001 subui r5,r5,#1 ; decrement width
FFFFFFFFFFFFE280 BE107F29 bne r1,r0,PN1
FFFFFFFFFFFFE284 PN6:
FFFFFFFFFFFFE284 BE500082 ble r5,r0,PN4 ; test pad count, skip padding if not needed
FFFFFFFFFFFFE288 PN3:
FFFFFFFFFFFFE288 E0400020 setlo r1,#' ' ; display the required leading spaces
FFFFFFFFFFFFE28C 31FFF393 call GOOUT
FFFFFFFFFFFFE290 BE02FFCF loop r5,PN3
FFFFFFFFFFFFE294 PN4:
FFFFFFFFFFFFE294 BE600063 bgt r6,r0,PN5 ; is number negative?
FFFFFFFFFFFFE298 E040002D setlo r1,#'-' ; if so, display the sign
FFFFFFFFFFFFE29C 31FFF393 call GOOUT
FFFFFFFFFFFFE2A0 PN5:
FFFFFFFFFFFFE2A0 0E738001 subui r7,r7,#1
FFFFFFFFFFFFE2A4 40708000 lb r1,[r7] ; now unstack the digits and display
FFFFFFFFFFFFE2A8 31FFF393 call GOOUT
FFFFFFFFFFFFE2AC 12709100 cmpui r1,r7,#NUMWKA
FFFFFFFFFFFFE2B0 BE107F87 bgtu r1,r0,PN5
FFFFFFFFFFFFE2B4 PNRET:
FFFFFFFFFFFFE2B4 47EF8020 lw lr,32[sp]
FFFFFFFFFFFFE2B8 47E38018 lw r7,24[sp]
FFFFFFFFFFFFE2BC 47E30010 lw r6,16[sp]
FFFFFFFFFFFFE2C0 47E28008 lw r5,8[sp]
FFFFFFFFFFFFE2C4 47E18000 lw r3,[sp]
FFFFFFFFFFFFE2C8 37EF8028 ret #40
; r1 = number to print
; r2 = number of digits
FFFFFFFFFFFFE2CC PRTHEXNUM:
FFFFFFFFFFFFE2CC 0FEF0028 subui sp,sp,#40
FFFFFFFFFFFFE2D0 67E28000 sw r5,[sp]
FFFFFFFFFFFFE2D4 67E30008 sw r6,8[sp]
FFFFFFFFFFFFE2D8 67E38010 sw r7,16[sp]
FFFFFFFFFFFFE2DC 67E40018 sw r8,24[sp]
FFFFFFFFFFFFE2E0 67EF8020 sw lr,32[sp]
FFFFFFFFFFFFE2E4 E1C01100 setlo r7,#<NUMWKA ; r7 = pointer to numeric work area
FFFFFFFFFFFFE2E8 F1C00000 sethi r7,#>NUMWKA
FFFFFFFFFFFFE2EC 04101809 or r6,r1,r0 ; save number for later
FFFFFFFFFFFFE2F0 E1400014 setlo r5,#20 ; r5 = min number of chars
FFFFFFFFFFFFE2F4 04101009 or r4,r1,r0
FFFFFFFFFFFFE2F8 BE400083 bgt r4,r0,PHN1 ; is it negative? if not
FFFFFFFFFFFFE2FC 02420006 neg r4,r4 ; else make it positive
FFFFFFFFFFFFE300 0C528001 sub r5,r5,#1 ; one less for width count
FFFFFFFFFFFFE304 E2000014 setlo r8,#20 ; maximum of 10 digits
FFFFFFFFFFFFE308 PHN1:
FFFFFFFFFFFFE308 04400409 or r1,r4,r0
FFFFFFFFFFFFE30C 1410800F andi r1,r1,#15
FFFFFFFFFFFFE310 A010030A blt r1,#10,PHN7
FFFFFFFFFFFFE314 0A108037 addui r1,r1,#'A'-10
FFFFFFFFFFFFE318 BE00004A bra PHN8
FFFFFFFFFFFFE31C PHN7:
FFFFFFFFFFFFE31C 08108030 add r1,r1,#'0' ; convert remainder to ascii
FFFFFFFFFFFFE320 PHN8:
FFFFFFFFFFFFE320 60708000 sb r1,[r7] ; and store in buffer
FFFFFFFFFFFFE324 08738001 add r7,r7,#1
FFFFFFFFFFFFE328 0C528001 sub r5,r5,#1 ; decrement width
FFFFFFFFFFFFE32C shru r4,r4,#4
FFFFFFFFFFFFE32C BE400048 beq r4,r0,PHN6 ; is it zero yet ?
FFFFFFFFFFFFE330 BE047ECF loop r8,PHN1 ; safety
FFFFFFFFFFFFE334 PHN6: ; test pad count
FFFFFFFFFFFFE334 BE500082 ble r5,r0,PHN4 ; skip padding if not needed
FFFFFFFFFFFFE338 PHN3:
FFFFFFFFFFFFE338 E0400020 setlo r1,#' ' ; display the required leading spaces
FFFFFFFFFFFFE33C 31FFF393 call GOOUT
FFFFFFFFFFFFE340 BE02FFCF loop r5,PHN3
FFFFFFFFFFFFE344 PHN4:
FFFFFFFFFFFFE344 BE600063 bgt r6,r0,PHN5 ; is number negative?
FFFFFFFFFFFFE348 E040002D setlo r1,#'-' ; if so, display the sign
FFFFFFFFFFFFE34C 31FFF393 call GOOUT
FFFFFFFFFFFFE350 PHN5:
FFFFFFFFFFFFE350 0C738001 sub r7,r7,#1
FFFFFFFFFFFFE354 40708000 lb r1,[r7] ; now unstack the digits and display
FFFFFFFFFFFFE358 31FFF393 call GOOUT
FFFFFFFFFFFFE35C 12709100 cmpui r1,r7,#NUMWKA
FFFFFFFFFFFFE360 BE107F83 bgt r1,r0,PHN5
FFFFFFFFFFFFE364 PHNRET:
FFFFFFFFFFFFE364 47EF8020 lw lr,32[sp]
FFFFFFFFFFFFE368 47E40018 lw r8,24[sp]
FFFFFFFFFFFFE36C 47E38010 lw r7,16[sp]
FFFFFFFFFFFFE370 47E30008 lw r6,8[sp]
FFFFFFFFFFFFE374 47E28000 lw r5,[sp]
FFFFFFFFFFFFE378 37EF8028 ret #40
; r1 = pointer to line
; returns r1 = pointer to end of line + 1
FFFFFFFFFFFFE37C PRTLN:
FFFFFFFFFFFFE37C 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFE380 67E28000 sw r5,[sp]
FFFFFFFFFFFFE384 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFE388 08128002 addi r5,r1,#2
FFFFFFFFFFFFE38C 4A50FFFE lbu r1,-2[r5] ; get the binary line number
FFFFFFFFFFFFE390 4A517FFF lbu r2,-1[r5]
FFFFFFFFFFFFE394 06211000 shli r2,r2,#8
FFFFFFFFFFFFE398 04110409 or r1,r1,r2
FFFFFFFFFFFFE39C E0800000 setlo r2,#0 ; display a 0 or more digit line no.
FFFFFFFFFFFFE3A0 31FFF88D call PRTNUM
FFFFFFFFFFFFE3A4 E0400020 setlo r1,#' ' ; followed by a blank
FFFFFFFFFFFFE3A8 31FFF393 call GOOUT
FFFFFFFFFFFFE3AC E0800000 setlo r2,#0 ; stop char. is a zero
FFFFFFFFFFFFE3B0 04500409 or r1,r5,r0
FFFFFFFFFFFFE3B4 31FFF851 call PRTSTG ; display the rest of the line
FFFFFFFFFFFFE3B8 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFE3BC 47E28000 lw r5,[sp]
FFFFFFFFFFFFE3C0 37EF8010 ret #16
; ===== Test text byte following the call to this subroutine. If it
; equals the byte pointed to by r8, return to the code following
; the call. If they are not equal, brnch to the point
; indicated in r4.
;
; Registers Affected
; r3,r8
; Returns
; r8 = updated text pointer
;
FFFFFFFFFFFFE3C4 TSTC
FFFFFFFFFFFFE3C4 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFE3C8 67EF8000 sw lr,[sp]
FFFFFFFFFFFFE3CC 67E08008 sw r1,8[sp]
FFFFFFFFFFFFE3D0 31FFF914 call IGNBLK ; ignore leading blanks
FFFFFFFFFFFFE3D4 40808000 lb r1,[r8]
FFFFFFFFFFFFE3D8 BE3080A8 beq r3,r1,TC1 ; is it = to what r8 points to? if so
FFFFFFFFFFFFE3DC 47E08008 lw r1,8[sp]
FFFFFFFFFFFFE3E0 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE3E4 0BEF0010 addui sp,sp,#16
FFFFFFFFFFFFE3E8 34400000 jal r0,[r4] ; jump to the routine
FFFFFFFFFFFFE3EC TC1:
FFFFFFFFFFFFE3EC 08840001 add r8,r8,#1 ; if equal, bump text pointer
FFFFFFFFFFFFE3F0 47E08008 lw r1,8[sp]
FFFFFFFFFFFFE3F4 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE3F8 37EF8010 ret #16
; ===== See if the text pointed to by r8 is a number. If so,
; return the number in r2 and the number of digits in r3,
; else return zero in r2 and r3.
; Registers Affected
; r1,r2,r3,r4
; Returns
; r1 = number
; r2 = number of digits in number
; r8 = updated text pointer
;
FFFFFFFFFFFFE3FC TSTNUM:
FFFFFFFFFFFFE3FC 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFE400 67EF8000 sw lr,[sp]
FFFFFFFFFFFFE404 31FFF914 call IGNBLK ; skip over blanks
FFFFFFFFFFFFE408 E0400000 setlo r1,#0 ; initialize return parameters
FFFFFFFFFFFFE40C E0800000 setlo r2,#0
FFFFFFFFFFFFE410 TN1:
FFFFFFFFFFFFE410 40818000 lb r3,[r8]
FFFFFFFFFFFFE414 A8300D30 bltui r3,#'0',TSNMRET ; is it less than zero?
FFFFFFFFFFFFE418 AE300C39 bgtui r3,#'9',TSNMRET ; is it greater than nine?
FFFFFFFFFFFFE41C E13FFFFF setlo r4,#0xFFFFFFFF
FFFFFFFFFFFFE420 F10FFFFF sethi r4,#0x07FFFFFF
FFFFFFFFFFFFE424 BE120066 bleu r1,r4,TN2 ; see if there's room for new digit
FFFFFFFFFFFFE428 E07FE629 setlo r1,msgNumTooBig
FFFFFFFFFFFFE42C BE0057AA bra ERROR ; if not, we've overflowd
FFFFFFFFFFFFE430 TN2:
FFFFFFFFFFFFE430 1A10800A mului r1,r1,#10 ; quickly multiply result by 10
FFFFFFFFFFFFE434 08840001 addi r8,r8,#1 ; adjust text pointer
FFFFFFFFFFFFE438 1431800F andi r3,r3,#0x0F ; add in the new digit
FFFFFFFFFFFFE43C 04118402 add r1,r1,r3
FFFFFFFFFFFFE440 08210001 addi r2,r2,#1 ; increment the no. of digits
FFFFFFFFFFFFE444 BE007E6A bra TN1
FFFFFFFFFFFFE448 TSNMRET:
FFFFFFFFFFFFE448 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE44C 37EF8008 ret #8
;===== Skip over blanks in the text pointed to by r8.
;
; Registers Affected:
; r8
; Returns
; r8 = pointer updateded past any spaces or tabs
;
FFFFFFFFFFFFE450 IGNBLK:
FFFFFFFFFFFFE450 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFE454 67E08000 sw r1,[sp]
FFFFFFFFFFFFE458 IGB2:
FFFFFFFFFFFFE458 40808000 lb r1,[r8] ; get char
FFFFFFFFFFFFE45C B0100220 beqi r1,#' ',IGB1 ; see if it's a space
FFFFFFFFFFFFE460 B2100300 bnei r1,#'\t',IGBRET ; or a tab
FFFFFFFFFFFFE464 IGB1:
FFFFFFFFFFFFE464 08840001 add r8,r8,#1 ; increment the text pointer
FFFFFFFFFFFFE468 BE007F8A bra IGB2
FFFFFFFFFFFFE46C IGBRET:
FFFFFFFFFFFFE46C 47E08000 lw r1,[sp]
FFFFFFFFFFFFE470 37EF8008 ret #8
; ===== Convert the line of text in the input buffer to upper
; case (except for stuff between quotes).
;
; Registers Affected
; r1,r3
; Returns
; r8 = pointing to end of text in buffer
;
FFFFFFFFFFFFE474 TOUPBUF:
FFFFFFFFFFFFE474 0FEF0008 subui sp,sp,#8
FFFFFFFFFFFFE478 67EF8000 sw lr,[sp]
FFFFFFFFFFFFE47C E200111B setlo r8,BUFFER ; set up text pointer
FFFFFFFFFFFFE480 E0C00000 setlo r3,#0 ; clear quote flag
FFFFFFFFFFFFE484 TOUPB1:
FFFFFFFFFFFFE484 40808000 lb r1,[r8] ; get the next text char.
FFFFFFFFFFFFE488 08840001 add r8,r8,#1
FFFFFFFFFFFFE48C B0100D0D beqi r1,#CR,TOUPBRT ; is it end of line?
FFFFFFFFFFFFE490 B0100622 beqi r1,#'"',DOQUO ; a double quote?
FFFFFFFFFFFFE494 B0100527 beqi r1,#'''',DOQUO ; or a single quote?
FFFFFFFFFFFFE498 BE307F69 bne r3,r0,TOUPB1 ; inside quotes?
FFFFFFFFFFFFE49C 31FFF932 call toUpper ; convert to upper case
FFFFFFFFFFFFE4A0 6080FFFF sb r1,-1[r8] ; store it
FFFFFFFFFFFFE4A4 BE007F0A bra TOUPB1 ; and go back for more
FFFFFFFFFFFFE4A8 DOQUO:
FFFFFFFFFFFFE4A8 BE300069 bne r3,r0,DOQUO1; are we inside quotes?
FFFFFFFFFFFFE4AC 04100C09 or r3,r1,r0 ; if not, toggle inside-quotes flag
FFFFFFFFFFFFE4B0 BE007EAA bra TOUPB1
FFFFFFFFFFFFE4B4 DOQUO1:
FFFFFFFFFFFFE4B4 BE30FE89 bne r3,r1,TOUPB1 ; make sure we're ending proper quote
FFFFFFFFFFFFE4B8 E0C00000 setlo r3,#0 ; else clear quote flag
FFFFFFFFFFFFE4BC BE007E4A bra TOUPB1
FFFFFFFFFFFFE4C0 TOUPBRT:
FFFFFFFFFFFFE4C0 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE4C4 37EF8008 ret #8
; ===== Convert the character in r1 to upper case
;
FFFFFFFFFFFFE4C8 toUpper
FFFFFFFFFFFFE4C8 A0100361 blt r1,#'a',TOUPRET ; is it < 'a'?
FFFFFFFFFFFFE4CC A610027A bgt r1,#'z',TOUPRET ; or > 'z'?
FFFFFFFFFFFFE4D0 0C108020 sub r1,r1,#32 ; if not, make it upper case
FFFFFFFFFFFFE4D4 TOUPRET
FFFFFFFFFFFFE4D4 37EF8000 ret
; 'CHKIO' checks the input. If there's no input, it will return
; to the caller with the r1=0. If there is input, the input byte is in r1.
; However, if a control-C is read, 'CHKIO' will warm-start BASIC and will
; not return to the caller.
;
FFFFFFFFFFFFE4D8 CHKIO:
FFFFFFFFFFFFE4D8 0FEF0008 subui sp,sp,#8 ; save link reg
FFFFFFFFFFFFE4DC 67EF8000 sw lr,[sp]
FFFFFFFFFFFFE4E0 31FFF394 call GOIN ; get input if possible
FFFFFFFFFFFFE4E4 B01003FF beq r1,#-1,CHKRET2 ; if Zero, no input
FFFFFFFFFFFFE4E8 B2100303 bnei r1,#CTRLC,CHKRET ; is it control-C?
FFFFFFFFFFFFE4EC 33FFF3BE jmp WSTART ; if so, do a warm start
FFFFFFFFFFFFE4F0 CHKRET2:
FFFFFFFFFFFFE4F0 0410840A xor r1,r1,r1
FFFFFFFFFFFFE4F4 CHKRET:
FFFFFFFFFFFFE4F4 47EF8000 lw lr,[sp] ;r1=0
FFFFFFFFFFFFE4F8 37EF8008 ret #8
; ===== Display a CR-LF sequence
;
FFFFFFFFFFFFE4FC CRLF:
FFFFFFFFFFFFE4FC E07FE60B setlo r1,CLMSG
; ===== Display a zero-ended string pointed to by register r1
; Registers Affected
; r1,r2,r4
;
FFFFFFFFFFFFE500 PRMESG:
FFFFFFFFFFFFE500 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFE504 67E28000 sw r5,[sp]
FFFFFFFFFFFFE508 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFE50C 02128009 mov r5,r1 ; r5 = pointer to message
FFFFFFFFFFFFE510 PRMESG1:
FFFFFFFFFFFFE510 08528001 add r5,r5,#1
FFFFFFFFFFFFE514 4050FFFF lb r1,-1[r5] ; get the char.
FFFFFFFFFFFFE518 BE100068 beq r1,r0,PRMRET
FFFFFFFFFFFFE51C 31FFF393 call GOOUT ;else display it trashes r4
FFFFFFFFFFFFE520 BE007F8A bra PRMESG1
FFFFFFFFFFFFE524 PRMRET:
FFFFFFFFFFFFE524 02508009 mov r1,r5
FFFFFFFFFFFFE528 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFE52C 47E28000 lw r5,[sp]
FFFFFFFFFFFFE530 37EF8010 ret #16
; ===== Display a zero-ended string pointed to by register r1
; Registers Affected
; r1,r2,r3
;
FFFFFFFFFFFFE534 PRMESGAUX:
FFFFFFFFFFFFE534 0FEF0010 subui sp,sp,#16
FFFFFFFFFFFFE538 67E28000 sw r5,[sp]
FFFFFFFFFFFFE53C 67EF8008 sw lr,8[sp]
FFFFFFFFFFFFE540 02128009 mov r5,r1 ; r3 = pointer
FFFFFFFFFFFFE544 PRMESGA1:
FFFFFFFFFFFFE544 0A528001 addui r5,r5,#1
FFFFFFFFFFFFE548 4050FFFF lb r1,-1[r5] ; get the char.
FFFFFFFFFFFFE54C BE100068 beq r1,r0,PRMRETA
FFFFFFFFFFFFE550 31FFF395 call GOAUXO ;else display it
FFFFFFFFFFFFE554 BE007F8A bra PRMESGA1
FFFFFFFFFFFFE558 PRMRETA:
FFFFFFFFFFFFE558 02508009 mov r1,r5
FFFFFFFFFFFFE55C 47EF8008 lw lr,8[sp]
FFFFFFFFFFFFE560 47E28000 lw r5,[sp]
FFFFFFFFFFFFE564 37EF8010 ret #16
;*****************************************************
; The following routines are the only ones that need *
; to be changed for a different I/O environment. *
;*****************************************************
; ===== Output character to the console (Port 1) from register r1
; (Preserves all registers.)
;
FFFFFFFFFFFFE568 OUTC:
FFFFFFFFFFFFE568 33FFEF47 jmp DisplayChar
; ===== Input a character from the console into register D0 (or
; return Zero status if there's no character available).
;
FFFFFFFFFFFFE56C INC:
FFFFFFFFFFFFE56C 33FFEE08 jmp KeybdGetChar
;*
;* ===== Input a character from the host into register r1 (or
;* return Zero status if there's no character available).
;*
FFFFFFFFFFFFF8C0.0 AUXIN:
FFFFFFFFFFFFF8C0.0 20003DC0A01 inb r1,UART_LS ; is character ready ?
FFFFFFFFFFFFF8C0.1 05042000001 andi r1,r1,#rxfull
FFFFFFFFFFFFF8C0.2 2F8400000C8 beq r1,r0,AXIRET ;if not, return Zero status
FFFFFFFFFFFFF8D0.0 20003DC0A00 inb r1,UART ; else get the character
FFFFFFFFFFFFF8D0.1 0504200007F andi r1,r1,#0x7f ;zero out the high bit
FFFFFFFFFFFFF8D0.2 AXIRET:
FFFFFFFFFFFFF8D0.2 0DFBE000000 ret
FFFFFFFFFFFFE570 AUXIN:
FFFFFFFFFFFFE570 31FFED54 call SerialGetChar
FFFFFFFFFFFFE574 B01003FF beqi r1,#-1,AXIRET_ZERO
FFFFFFFFFFFFE578 1410807F andi r1,r1,#0x7f ;zero out the high bit
FFFFFFFFFFFFE57C AXIRET:
FFFFFFFFFFFFE57C 37EF8000 ret
FFFFFFFFFFFFE580 AXIRET_ZERO:
FFFFFFFFFFFFE580 0410840A xor r1,r1,r1
FFFFFFFFFFFFE584 37EF8000 ret
; ===== Output character to the host (Port 2) from register r1
; (Preserves all registers.)
;
FFFFFFFFFFFFE588 AUXOUT
FFFFFFFFFFFFE588 33FFED0C jmp SerialPutChar ; call boot rom routine
FFFFFFFFFFFFE58C _cls
FFFFFFFFFFFFE58C 31FFEED9 call clearScreen
FFFFFFFFFFFFE590 BE00740A bra FINISH
FFFFFFFFFFFFE594 _wait10
FFFFFFFFFFFFE594 37EF8000 ret
FFFFFFFFFFFFE598 _getATAStatus
FFFFFFFFFFFFE598 37EF8000 ret
FFFFFFFFFFFFE59C _waitCFNotBusy
FFFFFFFFFFFFE59C 37EF8000 ret
FFFFFFFFFFFFE5A0 _rdcf
FFFFFFFFFFFFE5A0 BE00738A br FINISH
FFFFFFFFFFFFE5A4 rdcf6
FFFFFFFFFFFFE5A4 BE004BEA br ERROR
; ===== Return to the resident monitor, operating system, etc.
;
FFFFFFFFFFFFE5A8 BYEBYE:
FFFFFFFFFFFFE5A8 460F1088 lw sp,OSSP
FFFFFFFFFFFFE5AC 47EF8000 lw lr,[sp]
FFFFFFFFFFFFE5B0 37EF8008 ret #8
; MOVE.B #228,D7 return to Tutor
; TRAP #14
FFFFFFFFFFFFE5B0 C44E4100BCBD3CBD .align 16
FFFFFFFFFFFFE5B8 0000000000D24F00
FFFFFFFFFFFFE5C0 .align 16
FFFFFFFFFFFFE5C0 726F747061520A0D msgInit db CR,LF,"Raptor64 Tiny BASIC v1.0",CR,LF,"(C) 2012 Robert Finch",CR,LF,LF,0
FFFFFFFFFFFFE5C8 20796E6954203436
FFFFFFFFFFFFE5D0 3176204349534142
FFFFFFFFFFFFE5D8 202943280A0D302E
FFFFFFFFFFFFE5E0 6F52202032313032
FFFFFFFFFFFFE5E8 6E69462074726562
FFFFFFFFFFFFE5F0 0A0D000A0A0D6863 OKMSG db CR,LF,"OK",CR,LF,0
FFFFFFFFFFFFE5F8 616857000A0D4B4F msgWhat db "What?",CR,LF,0
FFFFFFFFFFFFE600 726F53000A0D3F74 SRYMSG db "Sorry."
FFFFFFFFFFFFE608 6F43000A0D2E7972 msgReadError db "Compact FLASH read error",CR,LF,0
FFFFFFFFFFFFE610 4C4620746361706D
FFFFFFFFFFFFE618 6461657220485341
FFFFFFFFFFFFE620 0A0D726F72726520
FFFFFFFFFFFFE628 207265626D754E00 msgNumTooBig db "Number is too big",CR,LF,0
FFFFFFFFFFFFE630 62206F6F74207369
FFFFFFFFFFFFE638 766944000A0D6769 msgDivZero db "Division by zero",CR,LF,0
FFFFFFFFFFFFE640 7962206E6F697369
FFFFFFFFFFFFE648 000A0D6F72657A20
FFFFFFFFFFFFE650 7620666F2074754F msgVarSpace db "Out of variable space",CR,LF,0
FFFFFFFFFFFFE658 20656C6261697261
FFFFFFFFFFFFE660 000A0D6563617073
FFFFFFFFFFFFE668 6620736574796220 msgBytesFree db " bytes free",CR,LF,0
FFFFFFFFFFFFE670 0A0D000A0D656572 msgReady db CR,LF,"Ready",CR,LF,0
FFFFFFFFFFFFE678 000A0D7964616552
FFFFFFFFFFFFE680 6E69746365707845 msgComma db "Expecting a comma",CR,LF,0
FFFFFFFFFFFFE688 6D6D6F6320612067
FFFFFFFFFFFFE690 656E694C000A0D61 msgLineRange db "Line number too big",CR,LF,0
FFFFFFFFFFFFE698 207265626D756E20
FFFFFFFFFFFFE6A0 0D676962206F6F74
FFFFFFFFFFFFE6A8 746365707845000A msgVar db "Expecting a variable",CR,LF,0
FFFFFFFFFFFFE6B0 6176206120676E69
FFFFFFFFFFFFE6B8 0A0D656C62616972
FFFFFFFFFFFFE6C0 64616220444E5200 msgRNDBad db "RND bad parameter",CR,LF,0
FFFFFFFFFFFFE6C8 74656D6172617020
FFFFFFFFFFFFE6D0 535953000A0D7265 msgSYSBad db "SYS bad address",CR,LF,0
FFFFFFFFFFFFE6D8 6464612064616220
FFFFFFFFFFFFE6E0 49000A0D73736572 msgInputVar db "INPUT expecting a variable",CR,LF,0
FFFFFFFFFFFFE6E8 707865205455504E
FFFFFFFFFFFFE6F0 6120676E69746365
FFFFFFFFFFFFE6F8 6C62616972617620
FFFFFFFFFFFFE700 5458454E000A0D65 msgNextFor db "NEXT without FOR",CR,LF,0
FFFFFFFFFFFFE708 74756F6874697720
FFFFFFFFFFFFE710 4E000A0D524F4620 msgNextVar db "NEXT expecting a defined variable",CR,LF,0
FFFFFFFFFFFFE718 6570786520545845
FFFFFFFFFFFFE720 206120676E697463
FFFFFFFFFFFFE728 2064656E69666564
FFFFFFFFFFFFE730 656C626169726176
FFFFFFFFFFFFE738 2F4F544F47000A0D msgBadGotoGosub db "GOTO/GOSUB bad line number",CR,LF,0
FFFFFFFFFFFFE740 6162204255534F47
FFFFFFFFFFFFE748 6E20656E696C2064
FFFFFFFFFFFFE750 000A0D7265626D75
FFFFFFFFFFFFE758 77204E5255544552 msgRetWoGosub db "RETURN without GOSUB",CR,LF,0
FFFFFFFFFFFFE760 472074756F687469
FFFFFFFFFFFFE768 50000A0D4255534F msgTooBig db "Program is too big",CR,LF,0
FFFFFFFFFFFFE770 69206D6172676F72
FFFFFFFFFFFFE778 6962206F6F742073
FFFFFFFFFFFFE780 72747845000A0D67 msgExtraChars db "Extra characters on line ignored",CR,LF,0
FFFFFFFFFFFFE788 6361726168632061
FFFFFFFFFFFFE790 206E6F2073726574
FFFFFFFFFFFFE798 6E676920656E696C
FFFFFFFFFFFFE7A0 00000A0D6465726F align 8
FFFFFFFFFFFFE7A8 align 8
LSTROM equ * ; end of possible ROM area
; END
;*
;* ===== Return to the resident monitor, operating system, etc.
;*
FFFFFFFFFFFFF8E0.0 BYEBYE:
FFFFFFFFFFFFF8E0.0 0CFFFFFFCA6 jmp Monitor
FFFFFFFFFFFFE7A8 BYEBYE:
FFFFFFFFFFFFE7A8 33FFF096 jmp Monitor
; MOVE.B #228,D7 ;return to Tutor
; TRAP #14
FFFFFFFFFFFFF8E0.1 37800000000 align 16
FFFFFFFFFFFFF8E0.2 37800000000 align 16
FFFFFFFFFFFFF8F0.0 align 16
FFFFFFFFFFFFF8F0 726F747061520A0D msgInit db CR,LF,"Raptor64 Tiny BASIC v1.0",CR,LF,"(C) 2012 Robert Finch",CR,LF,LF,0
FFFFFFFFFFFFF8F8 20796E6954203436
FFFFFFFFFFFFF900 3176204349534142
FFFFFFFFFFFFF908 202943280A0D302E
FFFFFFFFFFFFF910 6F52202032313032
FFFFFFFFFFFFF918 6E69462074726562
FFFFFFFFFFFFF920 0A0D000A0A0D6863 OKMSG db CR,LF,"OK",CR,LF,0
FFFFFFFFFFFFF928 616857000A0D4B4F msgWhat db "What?",CR,LF,0
FFFFFFFFFFFFF930 726F53000A0D3F74 SRYMSG db "Sorry."
FFFFFFFFFFFFF938 6F43000A0D2E7972 msgReadError db "Compact FLASH read error",CR,LF,0
FFFFFFFFFFFFF940 4C4620746361706D
FFFFFFFFFFFFF948 6461657220485341
FFFFFFFFFFFFF950 0A0D726F72726520
FFFFFFFFFFFFF958 207265626D754E00 msgNumTooBig db "Number is too big",CR,LF,0
FFFFFFFFFFFFF960 62206F6F74207369
FFFFFFFFFFFFF968 766944000A0D6769 msgDivZero db "Division by zero",CR,LF,0
FFFFFFFFFFFFF970 7962206E6F697369
FFFFFFFFFFFFF978 000A0D6F72657A20
FFFFFFFFFFFFF980 7620666F2074754F msgVarSpace db "Out of variable space",CR,LF,0
FFFFFFFFFFFFF988 20656C6261697261
FFFFFFFFFFFFF990 000A0D6563617073
FFFFFFFFFFFFF998 6620736574796220 msgBytesFree db " bytes free",CR,LF,0
FFFFFFFFFFFFF9A0 0A0D000A0D656572 msgReady db CR,LF,"Ready",CR,LF,0
FFFFFFFFFFFFF9A8 000A0D7964616552
FFFFFFFFFFFFF9B0 6E69746365707845 msgComma db "Expecting a comma",CR,LF,0
FFFFFFFFFFFFF9B8 6D6D6F6320612067
FFFFFFFFFFFFF9C0 656E694C000A0D61 msgLineRange db "Line number too big",CR,LF,0
FFFFFFFFFFFFF9C8 207265626D756E20
FFFFFFFFFFFFF9D0 0D676962206F6F74
FFFFFFFFFFFFF9D8 746365707845000A msgVar db "Expecting a variable",CR,LF,0
FFFFFFFFFFFFF9E0 6176206120676E69
FFFFFFFFFFFFF9E8 0A0D656C62616972
FFFFFFFFFFFFF9F0 64616220444E5200 msgRNDBad db "RND bad parameter",CR,LF,0
FFFFFFFFFFFFF9F8 74656D6172617020
FFFFFFFFFFFFFA00 535953000A0D7265 msgSYSBad db "SYS bad address",CR,LF,0
FFFFFFFFFFFFFA08 6464612064616220
FFFFFFFFFFFFFA10 49000A0D73736572 msgInputVar db "INPUT expecting a variable",CR,LF,0
FFFFFFFFFFFFFA18 707865205455504E
FFFFFFFFFFFFFA20 6120676E69746365
FFFFFFFFFFFFFA28 6C62616972617620
FFFFFFFFFFFFFA30 5458454E000A0D65 msgNextFor db "NEXT without FOR",CR,LF,0
FFFFFFFFFFFFFA38 74756F6874697720
FFFFFFFFFFFFFA40 4E000A0D524F4620 msgNextVar db "NEXT expecting a defined variable",CR,LF,0
FFFFFFFFFFFFFA48 6570786520545845
FFFFFFFFFFFFFA50 206120676E697463
FFFFFFFFFFFFFA58 2064656E69666564
FFFFFFFFFFFFFA60 656C626169726176
FFFFFFFFFFFFFA68 2F4F544F47000A0D msgBadGotoGosub db "GOTO/GOSUB bad line number",CR,LF,0
FFFFFFFFFFFFFA70 6162204255534F47
FFFFFFFFFFFFFA78 6E20656E696C2064
FFFFFFFFFFFFFA80 000A0D7265626D75
FFFFFFFFFFFFFA88 77204E5255544552 msgRetWoGosub db "RETURN without GOSUB",CR,LF,0
FFFFFFFFFFFFFA90 472074756F687469
FFFFFFFFFFFFFA98 50000A0D4255534F msgTooBig db "Program is too big",CR,LF,0
FFFFFFFFFFFFFAA0 69206D6172676F72
FFFFFFFFFFFFFAA8 6962206F6F742073
FFFFFFFFFFFFFAB0 72747845000A0D67 msgExtraChars db "Extra characters on line ignored",CR,LF,0
FFFFFFFFFFFFFAB8 6361726168632061
FFFFFFFFFFFFFAC0 206E6F2073726574
FFFFFFFFFFFFFAC8 6E676920656E696C
FFFFFFFFFFFFFAD7.0 INITMSG:
FFFFFFFFFFFFFAD0 0D000A0D6465726F db CR,LF,'Raptor64 Tiny BASIC, v1.0',CR,LF,LF,0
FFFFFFFFFFFFFADF.0 OKMSG:
FFFFFFFFFFFFFAD8 0D000A0A0D00520A db CR,LF,'OK',CR,LF,0
FFFFFFFFFFFFFAE6.0 HOWMSG:
FFFFFFFFFFFFFAE0 0048000A0D004F0A db 'How?',CR,LF,0
FFFFFFFFFFFFFAEB.0 WHTMSG:
FFFFFFFFFFFFFAE8 000A0D0057000A0D db 'What?',CR,LF,0
FFFFFFFFFFFFFAF0.0 SRYMSG:
FFFFFFFFFFFFFAF2.0 CLMSG:
; DC.B 0 ;<- for aligning on a word boundary
FFFFFFFFFFFFFAF0 000000000A0D0053 align 16
FFFFFFFFFFFFFAF8 0000000000000000
FFFFFFFFFFFFFB00.0 align 16
LSTROM EQU $
; end of possible ROM area
0000000000000110 bss
0000000000000110 align 16
0000000000000080 org 0x0080
0000000000000088 align 8
0000000000000088 0000000000000001 OSSP dw 1 ; OS value of sp
0000000000000090 0000000000000001 CURRNT dw 1 ; Current line pointer
0000000000000098 0000000000000001 STKGOS dw 1 ; Saves stack pointer in 'GOSUB'
00000000000000A0 0000000000000001 STKINP dw 1 ; Saves stack pointer during 'INPUT'
00000000000000A8 0000000000000001 LOPVAR dw 1 ; 'FOR' loop save area
00000000000000B0 0000000000000001 LOPINC dw 1 ; increment
00000000000000B8 0000000000000001 LOPLMT dw 1 ; limit
00000000000000C0 0000000000000001 LOPLN dw 1 ; line number
00000000000000C8 0000000000000001 LOPPT dw 1 ; text pointer
00000000000000D0 0000000000000001 TXTUNF dw 1 ; points to unfilled text area
00000000000000D8 0000000000000001 VARBGN dw 1 ; points to variable area
00000000000000E0 0000000000000001 IVARBGN dw 1 ; points to integer variable area
00000000000000E8 0000000000000001 SVARBGN dw 1 ; points to string variable area
00000000000000F0 0000000000000001 FVARBGN dw 1 ; points to float variable area
00000000000000F8 0000000000000001 STKBOT dw 1 ; holds lower limit for stack growth
FF 0000000000000000 NUMWKA fill.b 12,0 ; numeric work area
107 00000000000000
107 0000000000000000 BUFFER fill.b BUFLEN,0x00 ; Keyboard input buffer
10F 00
;==============================================================================
; Checkerboard RAM tester
;==============================================================================
;
FFFFFFFFFFFFFB00.0 code
FFFFFFFFFFFFFB00.0 align 16
FFFFFFFFFFFFFB00.0 ramtest:
FFFFFFFFFFFFFB00.0 01000800009 or r8,r0,r0 ; r8 = 0
FFFFFFFFFFFFFB00.1 3D5552AAAD5
FFFFFFFFFFFFFB00.2 05802AA5555 ori r1,r0,#0xAAAA5555AAAA5555 ; checkerboard pattern
FFFFFFFFFFFFFB10.0 ramtest2:
FFFFFFFFFFFFFB10.0 19A02000000 sw r1,[r8] ; save the checkerboard to memory
FFFFFFFFFFFFFB10.1 11A04000000 lw r2,[r8] ; read it back
FFFFFFFFFFFFFB10.2 01044300006 cmp r3,r1,r2 ; is it the same ?
FFFFFFFFFFFFFB20.0 2F8C00000C9 bne r3,r0,ramtest1
FFFFFFFFFFFFFB20.1 02A10000008 addui r8,r8,#8 ; increment RAM pointer
FFFFFFFFFFFFFB20.2 38000000002
FFFFFFFFFFFFFB30.0 04206000000 cmpi r3,r8,#0x0000_0000_0400_0000
FFFFFFFFFFFFFB30.1 2F8C1FFFF00 blt r3,r0,ramtest2
FFFFFFFFFFFFFB30.2 ramtest1:
FFFFFFFFFFFFFB30.2 01200A00009 or r10,r8,r0 ; r10 = max ram address
FFFFFFFFFFFFE7AC code
FFFFFFFFFFFFE7A8 0000000033FFF096 align 16
FFFFFFFFFFFFE7B0 align 16
FFFFFFFFFFFFE7B0 ramtest:
FFFFFFFFFFFFE7B0 04002009 or r8,r0,r0 ; r8 = 0
FFFFFFFFFFFFE7B4 E6AA5555 ; SETLO
FFFFFFFFFFFFE7B8 EE9556AA ; SETMID
FFFFFFFFFFFFE7BC F68AAAA5 ; SETHI
FFFFFFFFFFFFE7C0 040D0409 ori r1,r0,#0xAAAA5555AAAA5555 ; checkerboard pattern
FFFFFFFFFFFFE7C4 ramtest2:
FFFFFFFFFFFFE7C4 66808000 sw r1,[r8] ; save the checkerboard to memory
FFFFFFFFFFFFE7C8 46810000 lw r2,[r8] ; read it back
FFFFFFFFFFFFE7CC 04110C06 cmp r3,r1,r2 ; is it the same ?
FFFFFFFFFFFFE7D0 BE3000C9 bne r3,r0,ramtest1
FFFFFFFFFFFFE7D4 0A840008 addui r8,r8,#8 ; increment RAM pointer
FFFFFFFFFFFFE7D8 E6800000 ; SETLO
FFFFFFFFFFFFE7DC EE800010 ; SETMID
FFFFFFFFFFFFE7E0 048D0C06 cmpi r3,r8,#0x0000_0000_0400_0000
FFFFFFFFFFFFE7E4 BE307F00 blt r3,r0,ramtest2
FFFFFFFFFFFFE7E8 ramtest1:
FFFFFFFFFFFFE7E8 04802809 or r10,r8,r0 ; r10 = max ram address
; readback the checkerboard pattern
FFFFFFFFFFFFFB40.0 01000800009 or r8,r0,r0 ; r8 = 0
FFFFFFFFFFFFFB40.1 ramtest4:
FFFFFFFFFFFFFB40.1 11A04000000 lw r2,[r8]
FFFFFFFFFFFFFB40.2 3D5552AAAD5
FFFFFFFFFFFFFB50.0 04086AA5555 cmpi r3,r2,#0xAAAA5555AAAA5555
FFFFFFFFFFFFFB50.1 2F8C0000109 bne r3,r0,ramtest3
FFFFFFFFFFFFFB50.2 02210000008 addi r8,r8,#8
FFFFFFFFFFFFFB60.0 38000000000
FFFFFFFFFFFFFB60.1 04207000000 cmpi r3,r8,#0x0000_0000_0100_0000
FFFFFFFFFFFFFB60.2 2F8C1FFFF20 blt r3,r0,ramtest4
FFFFFFFFFFFFFB70.0 ramtest3:
FFFFFFFFFFFFFB70.0 2FA140003A9 bne r8,r10,ramtest8 ; check for equal maximum address
FFFFFFFFFFFFE7EC 04002009 or r8,r0,r0 ; r8 = 0
FFFFFFFFFFFFE7F0 ramtest4:
FFFFFFFFFFFFE7F0 46810000 lw r2,[r8]
FFFFFFFFFFFFE7F4 E6AA5555 ; SETLO
FFFFFFFFFFFFE7F8 EE9556AA ; SETMID
FFFFFFFFFFFFE7FC F68AAAA5 ; SETHI
FFFFFFFFFFFFE800 042D0C06 cmpi r3,r2,#0xAAAA5555AAAA5555
FFFFFFFFFFFFE804 BE3000C9 bne r3,r0,ramtest3
FFFFFFFFFFFFE808 08840008 addi r8,r8,#8
FFFFFFFFFFFFE80C E6800000 ; SETLO
FFFFFFFFFFFFE810 EE800004 ; SETMID
FFFFFFFFFFFFE814 048D0C06 cmpi r3,r8,#0x0000_0000_0100_0000
FFFFFFFFFFFFE818 BE307EC0 blt r3,r0,ramtest4
FFFFFFFFFFFFE81C ramtest3:
FFFFFFFFFFFFE81C BE850389 bne r8,r10,ramtest8 ; check for equal maximum address
; perform ramtest again with inverted checkerboard
FFFFFFFFFFFFFB70.1 01000800009 or r8,r0,r0 ; r8 = 0
FFFFFFFFFFFFFB70.2 3AAAAD5552A
FFFFFFFFFFFFFB80.0 0580355AAAA ori r1,r0,#0x5555AAAA5555AAAA
FFFFFFFFFFFFFB80.1 ramtest5:
FFFFFFFFFFFFFB80.1 19A02000000 sw r1,[r8]
FFFFFFFFFFFFFB80.2 11A04000000 lw r2,[r8]
FFFFFFFFFFFFFB90.0 01044300006 cmp r3,r1,r2
FFFFFFFFFFFFFB90.1 2F8C0000109 bne r3,r0,ramtest6
FFFFFFFFFFFFFB90.2 02210000008 addi r8,r8,#8
FFFFFFFFFFFFFBA0.0 38000000000
FFFFFFFFFFFFFBA0.1 04207000000 cmpi r3,r8,#0x0000_0000_0100_0000
FFFFFFFFFFFFFBA0.2 2F8C1FFFF20 blt r3,r0,ramtest5
FFFFFFFFFFFFFBB0.0 ramtest6:
FFFFFFFFFFFFFBB0.0 01200B00009 or r11,r8,r0 ; r11 = max ram address
FFFFFFFFFFFFE820 04002009 or r8,r0,r0 ; r8 = 0
FFFFFFFFFFFFE824 E695AAAA ; SETLO
FFFFFFFFFFFFE828 EEAAA955 ; SETMID
FFFFFFFFFFFFE82C F685555A ; SETHI
FFFFFFFFFFFFE830 040D0409 ori r1,r0,#0x5555AAAA5555AAAA
FFFFFFFFFFFFE834 ramtest5:
FFFFFFFFFFFFE834 66808000 sw r1,[r8]
FFFFFFFFFFFFE838 46810000 lw r2,[r8]
FFFFFFFFFFFFE83C 04110C06 cmp r3,r1,r2
FFFFFFFFFFFFE840 BE3000C9 bne r3,r0,ramtest6
FFFFFFFFFFFFE844 08840008 addi r8,r8,#8
FFFFFFFFFFFFE848 E6800000 ; SETLO
FFFFFFFFFFFFE84C EE800004 ; SETMID
FFFFFFFFFFFFE850 048D0C06 cmpi r3,r8,#0x0000_0000_0100_0000
FFFFFFFFFFFFE854 BE307F00 blt r3,r0,ramtest5
FFFFFFFFFFFFE858 ramtest6:
FFFFFFFFFFFFE858 04802C09 or r11,r8,r0 ; r11 = max ram address
; readback checkerboard
FFFFFFFFFFFFFBB0.1 01000800009 or r8,r0,r0
FFFFFFFFFFFFFBB0.2 ramtest7:
FFFFFFFFFFFFFBB0.2 11A04000000 lw r2,[r8]
FFFFFFFFFFFFFBC0.0 3AAAAD5552A
FFFFFFFFFFFFFBC0.1 0408755AAAA cmpi r3,r2,#0x5555AAAA5555AAAA
FFFFFFFFFFFFFBC0.2 2F8C0000129 bne r3,r0,ramtest8
FFFFFFFFFFFFFBD0.0 02210000008 addi r8,r8,#8
FFFFFFFFFFFFFBD0.1 38000000000
FFFFFFFFFFFFFBD0.2 04207000000 cmpi r3,r8,#0x0000_0000_0100_0000
FFFFFFFFFFFFFBE0.0 2F8C1FFFEC0 blt r3,r0,ramtest7
FFFFFFFFFFFFFBE0.1 ramtest8:
FFFFFFFFFFFFFBE0.1 2FA16000088 beq r8,r11,ramtest9
FFFFFFFFFFFFFBE0.2 01216800014 min r8,r8,r11
FFFFFFFFFFFFFBF0.0 ramtest9:
FFFFFFFFFFFFFBF0.0 2FA14000048 beq r8,r10,ramtest10
FFFFFFFFFFFFFBF0.1 01214800014 min r8,r8,r10
FFFFFFFFFFFFFBF0.2 ramtest10:
FFFFFFFFFFFFFBF0.2 19810000400 sw r8,0x00000400 ;memend
FFFFFFFFFFFFFC00.0 0DFBE000000 ret
FFFFFFFFFFFFE85C 04002009 or r8,r0,r0
FFFFFFFFFFFFE860 ramtest7:
FFFFFFFFFFFFE860 46810000 lw r2,[r8]
FFFFFFFFFFFFE864 E695AAAA ; SETLO
FFFFFFFFFFFFE868 EEAAA955 ; SETMID
FFFFFFFFFFFFE86C F685555A ; SETHI
FFFFFFFFFFFFE870 042D0C06 cmpi r3,r2,#0x5555AAAA5555AAAA
FFFFFFFFFFFFE874 BE3000C9 bne r3,r0,ramtest8
FFFFFFFFFFFFE878 08840008 addi r8,r8,#8
FFFFFFFFFFFFE87C E6800000 ; SETLO
FFFFFFFFFFFFE880 EE800004 ; SETMID
FFFFFFFFFFFFE884 048D0C06 cmpi r3,r8,#0x0000_0000_0100_0000
FFFFFFFFFFFFE888 BE307EC0 blt r3,r0,ramtest7
FFFFFFFFFFFFE88C ramtest8:
FFFFFFFFFFFFE88C BE858048 beq r8,r11,ramtest9
FFFFFFFFFFFFE890 0485A014 min r8,r8,r11
FFFFFFFFFFFFE894 ramtest9:
FFFFFFFFFFFFE894 BE850048 beq r8,r10,ramtest10
FFFFFFFFFFFFE898 04852014 min r8,r8,r10
FFFFFFFFFFFFE89C ramtest10:
FFFFFFFFFFFFE89C 66040400 sw r8,0x00000400 ;memend
FFFFFFFFFFFFE8A0 37EF8000 ret
;-------------------------------------------
; IRQ routine
;-------------------------------------------
FFFFFFFFFFFFFC00.1 irqrout:
FFFFFFFFFFFFFC00.1 03FBC000010 subui sp,sp,#16
FFFFFFFFFFFFFC00.2 27F40000001 sm [sp],r1/lr
FFFFFFFFFFFFFC10.0 20803DC0FF0 inch r1,PIC
FFFFFFFFFFFFFC10.1 2C06C140001 beqi r1,#1,ColdStart
FFFFFFFFFFFFFC10.2 irqrout3:
FFFFFFFFFFFFFC10.2 2C840180002 bnei r1,#2,irqrout2
FFFFFFFFFFFFFC20.0 0C7FFFFFACC call Pulse1000
FFFFFFFFFFFFFC20.1 2F8000000AA bra irqrout1
FFFFFFFFFFFFFC20.2 irqrout2:
FFFFFFFFFFFFFC20.2 2C84014000F bnei r1,#15,irqrout1
FFFFFFFFFFFFFC30.0 0C7FFFFFA75 call KeybdIRQ
FFFFFFFFFFFFFC30.1 irqrout1:
FFFFFFFFFFFFFC30.1 27740000001 lm [sp],r1/lr
FFFFFFFFFFFFFC30.2 02FBC000010 addui sp,sp,#16
FFFFFFFFFFFFFC40.0 00000000020 iret
;
FFFFFFFFFFFFE8A4 iberr_rout:
FFFFFFFFFFFFE8A4 9A00E92B lea r1,msgiberr
FFFFFFFFFFFFE8A8 31FFEFE7 call DisplayString
FFFFFFFFFFFFE8AC 020085E8 mfspr r1,EPC
FFFFFFFFFFFFE8B0 31FFF019 call DisplayWord
FFFFFFFFFFFFE8B4 00000028 wait
FFFFFFFFFFFFE8B8 33FFEC07 jmp start
FFFFFFFFFFFFE8BC dberr_rout:
FFFFFFFFFFFFE8BC 9A00E910 lea r1,msgdberr
FFFFFFFFFFFFE8C0 31FFEFE7 call DisplayString
FFFFFFFFFFFFE8C4 02008628 mfspr r1,ERRADR
FFFFFFFFFFFFE8C8 31FFF019 call DisplayWord
FFFFFFFFFFFFE8CC 9A00E924 lea r1,msgEPC
FFFFFFFFFFFFE8D0 31FFEFE7 call DisplayString
FFFFFFFFFFFFE8D4 020085E8 mfspr r1,EPC
FFFFFFFFFFFFE8D8 31FFF019 call DisplayWord
FFFFFFFFFFFFE8DC 31FFF93F call CRLF
FFFFFFFFFFFFE8E0 1601001F lw r2,#31
FFFFFFFFFFFFE8E4 dberr1:
FFFFFFFFFFFFE8E4 02200FA9 mtspr PCHI,r2
FFFFFFFFFFFFE8E8 DE000000 nop
FFFFFFFFFFFFE8EC DE000000 nop
FFFFFFFFFFFFE8F0 DE000000 nop
FFFFFFFFFFFFE8F4 02008FE8 mfspr r1,PCHISTORIC
FFFFFFFFFFFFE8F8 31FFF019 call DisplayWord
FFFFFFFFFFFFE8FC 31FFF93F call CRLF
FFFFFFFFFFFFE900 BE017F2F loop r2,dberr1
FFFFFFFFFFFFE904 00000028 wait
FFFFFFFFFFFFE908 33FFEC07 jmp start
FFFFFFFFFFFFE908 0000000033FFEC07 .align 16
FFFFFFFFFFFFE910 .align 16
FFFFFFFFFFFFE910 msgdberr:
FFFFFFFFFFFFE910 7375622061746144 db "Data bus error at: ",0
FFFFFFFFFFFFE918 6120726F72726520
FFFFFFFFFFFFE924 msgEPC:
FFFFFFFFFFFFE920 4350452000203A74 db " EPC: ",0
FFFFFFFFFFFFE92B msgiberr:
FFFFFFFFFFFFE928 662072724500203A db "Err fetching instruction at: ",0
FFFFFFFFFFFFE930 20676E6968637465
FFFFFFFFFFFFE938 7463757274736E69
FFFFFFFFFFFFE940 203A7461206E6F69
FFFFFFFFFFFFE948 0000000000000000 .align 16
FFFFFFFFFFFFE950 .align 16
;------------------------------------------------------------------------------
; IRQ routine
;------------------------------------------------------------------------------
;
FFFFFFFFFFFFE950 irqrout:
FFFFFFFFFFFFE950 0FEF0020 subui sp,sp,#32
FFFFFFFFFFFFE954 67E08000 sw r1,[sp] ; save off a working register
FFFFFFFFFFFFE958 67E10008 sw r2,8[sp] ; and a second work register
FFFFFFFFFFFFE95C 67ED0010 sw r26,16[sp] ; save off implicit constant builder reg
FFFFFFFFFFFFE960 67EF8018 sw lr,24[sp]
FFFFFFFFFFFFE964 E69C0FF0 ; SETLO
FFFFFFFFFFFFE968 EE800003 ; SETMID
FFFFFFFFFFFFE96C 6A0D0421 inch r1,PIC ; r1= which IRQ line is active
; 1000 Hz interrupt
; This IRQ must be fast, so it's placed inline
; Increments the millisecond counter, and switches to the next context
;
FFFFFFFFFFFFE970 irq1000Hz:
FFFFFFFFFFFFE970 B2101602 bnei r1,#2,irq100Hz
FFFFFFFFFFFFE974 E6BF0000 ; SETLO
FFFFFFFFFFFFE978 6A0D0028 outb r0,0xFFFFFFFF_FFFF0000 ; acknowledge interrupt
FFFFFFFFFFFFE97C 46009400 lw r1,Milliseconds ; increment milliseconds count
FFFFFFFFFFFFE980 0A108001 addui r1,r1,#1
FFFFFFFFFFFFE984 66009400 sw r1,Milliseconds
FFFFFFFFFFFFE988 E6900000 ; SETLO
FFFFFFFFFFFFE98C EE800003 ; SETMID
FFFFFFFFFFFFE990 6A0D082D lea r2,TEXTSCR
FFFFFFFFFFFFE994 8220814C inch r1,332[r2]
FFFFFFFFFFFFE998 0A108001 addui r1,r1,#1
FFFFFFFFFFFFE99C 9220814C outc r1,332[r2]
FFFFFFFFFFFFE9A0 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFE9A4 47ED0010 lw r26,16[sp] ; restore registers from stack
FFFFFFFFFFFFE9A8 47E10008 lw r2,8[sp]
FFFFFFFFFFFFE9AC 47E08000 lw r1,[sp]
FFFFFFFFFFFFE9B0 0BEF0020 addui sp,sp,#32 ; restore stack pointer
FFFFFFFFFFFFE9B4 0000000F iepp ; move to the next context
FFFFFFFFFFFFE9B8 DE000000 nop
FFFFFFFFFFFFE9BC DE000000 nop
FFFFFFFFFFFFE9C0 DE000000 nop
FFFFFFFFFFFFE9C4 01900020 iret ; return to the next context
; 100 Hz interrupt
; This IRQ could have some work to do, including flashing a cursor. So
; we call a subroutine.
;
FFFFFFFFFFFFE9C8 irq100Hz:
FFFFFFFFFFFFE9C8 B2100403 bnei r1,#3,irqSerial
FFFFFFFFFFFFE9CC 4600B000 lw r1,p100IRQvec
; jal lr,[r1]
FFFFFFFFFFFFE9D0 31FFEE3B call Pulse100
FFFFFFFFFFFFE9D4 BE0001AA bra irqret
FFFFFFFFFFFFE9D8 irqSerial:
FFFFFFFFFFFFE9D8 B2100408 bnei r1,#8,irqRaster
FFFFFFFFFFFFE9DC 4600B010 lw r1,serialIRQvec
FFFFFFFFFFFFE9E0 341F8000 jal lr,[r1]
FFFFFFFFFFFFE9E4 BE00012A bra irqret
FFFFFFFFFFFFE9E8 irqRaster:
FFFFFFFFFFFFE9E8 B210040D bnei r1,#13,irqKeybd
FFFFFFFFFFFFE9EC 4600B018 lw r1,rasterIRQvec
; jal lr,[r1]
FFFFFFFFFFFFE9F0 31FFF2B1 call RasterIRQfn
FFFFFFFFFFFFE9F4 BE0000AA bra irqret
FFFFFFFFFFFFE9F8 irqKeybd:
FFFFFFFFFFFFE9F8 B0118901 beqi r1,#1,ColdStart ; CTRL-ALT-DEL interrupt
FFFFFFFFFFFFE9FC B210030F bnei r1,#15,irqret
FFFFFFFFFFFFEA00 4600B008 lw r1,keybdIRQvec
FFFFFFFFFFFFEA04 31FFEDF1 call KeybdIRQ
; jal lr,[r1]
FFFFFFFFFFFFEA08 irqret:
FFFFFFFFFFFFEA08 47EF8018 lw lr,24[sp]
FFFFFFFFFFFFEA0C 47ED0010 lw r26,16[sp] ; restore registers from stack
FFFFFFFFFFFFEA10 47E10008 lw r2,8[sp]
FFFFFFFFFFFFEA14 47E08000 lw r1,[sp]
FFFFFFFFFFFFEA18 0BEF0020 addui sp,sp,#32 ; restore stack pointer
FFFFFFFFFFFFEA1C 01900020 iret
;-------------------------------------------
; NMI routine
;-------------------------------------------
FFFFFFFFFFFFFC40.1 nmirout:
FFFFFFFFFFFFFC40.1 00000000020 iret
FFFFFFFFFFFFEA20 nmirout:
FFFFFFFFFFFFEA20 01900020 iret
;-------------------------------------------
; Handle miss on Data TLB
;-------------------------------------------
FFFFFFFFFFFFFC40.2 DTLBHandler:
FFFFFFFFFFFFFC40.2 19803FF0000 sw r1,0xFFFF_FFFF_FFFF_0000
FFFFFFFFFFFFFC50.0 19805FF0008 sw r2,0xFFFF_FFFF_FFFF_0008
FFFFFFFFFFFFFC50.1 dh1:
FFFFFFFFFFFFFC50.1 00802000034 omgi r1,#0 ; try open mutex gate #0 (TLB protector)
FFFFFFFFFFFFFC50.2 2F840000029 bne r1,r0,dh1 ; spinlock if gate is closed
FFFFFFFFFFFFFC60.0 00802000228 mfspr r1,PTA ; get the page table address
FFFFFFFFFFFFFC60.1 00804000428 mfspr r2,BadVAddr ; get the bad virtual address
FFFFFFFFFFFFFC60.2 008800005A9 mtspr TLBVirtPage,r2 ; which virtual address to update
FFFFFFFFFFFFFC70.0 01884680001 shrui r2,r2,#13 ; turn va into index
FFFFFFFFFFFFFC70.1 01044100003 addu r1,r1,r2
FFFFFFFFFFFFFC70.2 11844000000 lw r2,[r1] ; get the physical address from the table
FFFFFFFFFFFFFC80.0 05084000000 and r2,r2,#FFFF_FFFF_FFFF_E000 ; mask off lower bits
FFFFFFFFFFFFFC80.1 00880000529 mtspr TLBPhysPage0,r2 ;
FFFFFFFFFFFFFC80.2 11844000008 lw r2,8[r1] ; get the physical address from the table
FFFFFFFFFFFFFC90.0 05084000000 and r2,r2,#FFFF_FFFF_FFFF_E000 ; mask off lower bits
FFFFFFFFFFFFFC90.1 008800005A9 mtspr TLBPhysPage1,r2 ;
FFFFFFFFFFFFFC90.2 00800000034 tlbwr ; update a random entry in the TLB
FFFFFFFFFFFFFCA0.0 00800000035 cmgi #0 ; close the mutex gate
FFFFFFFFFFFFFCA0.1 11803FF0000 lw r1,0xFFFF_FFFF_FFFF_0000
FFFFFFFFFFFFFCA0.2 11805FF0008 lw r2,0xFFFF_FFFF_FFFF_0008
FFFFFFFFFFFFFCB0.0 00000000020 iret
FFFFFFFFFFFFFCB0.1 37800000000 nop
FFFFFFFFFFFFFCB0.2 37800000000 nop
FFFFFFFFFFFFEA24 DTLBHandler:
FFFFFFFFFFFFEA24 E6BF0000 ; SETLO
FFFFFFFFFFFFEA28 6A0D0413 sw r1,0xFFFF_FFFF_FFFF_0000
FFFFFFFFFFFFEA2C E6BF0008 ; SETLO
FFFFFFFFFFFFEA30 6A0D0813 sw r2,0xFFFF_FFFF_FFFF_0008
FFFFFFFFFFFFEA34 dh1:
FFFFFFFFFFFFEA34 02008034 omgi r1,#0 ; try open mutex gate #0 (TLB protector)
FFFFFFFFFFFFEA38 BE107FE9 bne r1,r0,dh1 ; spinlock if gate is closed
FFFFFFFFFFFFEA3C 02008128 mfspr r1,PTA ; get the page table address
FFFFFFFFFFFFEA40 02010228 mfspr r2,BadVAddr ; get the bad virtual address
FFFFFFFFFFFFEA44 022002E9 mtspr TLBVirtPage,r2 ; which virtual address to update
FFFFFFFFFFFFEA48 06211A01 shrui r2,r2,#13 ; turn va into index
FFFFFFFFFFFFEA4C 04110403 addu r1,r1,r2
FFFFFFFFFFFFEA50 46110000 lw r2,[r1] ; get the physical address from the table
FFFFFFFFFFFFEA54 14210000 and r2,r2,#FFFF_FFFF_FFFF_E000 ; mask off lower bits
FFFFFFFFFFFFEA58 022002A9 mtspr TLBPhysPage0,r2 ;
FFFFFFFFFFFFEA5C 46110008 lw r2,8[r1] ; get the physical address from the table
FFFFFFFFFFFFEA60 14210000 and r2,r2,#FFFF_FFFF_FFFF_E000 ; mask off lower bits
FFFFFFFFFFFFEA64 022002E9 mtspr TLBPhysPage1,r2 ;
FFFFFFFFFFFFEA68 02000034 tlbwr ; update a random entry in the TLB
FFFFFFFFFFFFEA6C 02000035 cmgi #0 ; close the mutex gate
FFFFFFFFFFFFEA70 E6BF0000 ; SETLO
FFFFFFFFFFFFEA74 6A0D0403 lw r1,0xFFFF_FFFF_FFFF_0000
FFFFFFFFFFFFEA78 E6BF0008 ; SETLO
FFFFFFFFFFFFEA7C 6A0D0803 lw r2,0xFFFF_FFFF_FFFF_0008
FFFFFFFFFFFFEA80 01900020 iret
FFFFFFFFFFFFEA80 0000000001900020 .align 32
FFFFFFFFFFFFEA88 6A0D0803E6BF0008
FFFFFFFFFFFFEA90 0000000000000000
FFFFFFFFFFFFEA98 0000000000000000
FFFFFFFFFFFFEAA0 .align 32
FFFFFFFFFFFFFFB0 org 0xFFFF_FFFF_FFFF_FFB0
FFFFFFFFFFFFFFB0 33FFFA89 jmp DTLBHandler
FFFFFFFFFFFFFFB4 DE000000 nop
FFFFFFFFFFFFFFB8 DE000000 nop
FFFFFFFFFFFFFFC0 org 0xFFFF_FFFF_FFFF_FFC0
FFFFFFFFFFFFFFC0 33FFFA89 jmp DTLBHandler
FFFFFFFFFFFFFFC4 DE000000 nop
FFFFFFFFFFFFFFC8 DE000000 nop
; NMI vector
FFFFFFFFFFFFFFE0 org 0xFFFF_FFFF_FFFF_FFE0
FFFFFFFFFFFFFFE0 33FFFA88 jmp nmirout
FFFFFFFFFFFFFFE4 DE000000 nop
FFFFFFFFFFFFFFE8 DE000000 nop
FFFFFFFFFFFFFFB0.0 org 0xFFFF_FFFF_FFFF_FFB0
FFFFFFFFFFFFFFB0.0 0CFFFFFFF12 jmp DTLBHandler
FFFFFFFFFFFFFFB0.1 37800000000 nop
FFFFFFFFFFFFFFB0.2 37800000000 nop
FFFFFFFFFFFFFFC0.0 org 0xFFFF_FFFF_FFFF_FFC0
FFFFFFFFFFFFFFC0.0 0CFFFFFFF12 jmp DTLBHandler
FFFFFFFFFFFFFFC0.1 37800000000 nop
FFFFFFFFFFFFFFC0.2 37800000000 nop
FFFFFFFFFFFFFFD0.0 org 0xFFFF_FFFF_FFFF_FFD0
FFFFFFFFFFFFFFD0.0 0CFFFFFFF01 jmp irqrout
FFFFFFFFFFFFFFD0.1 37800000000 nop
FFFFFFFFFFFFFFD0.2 37800000000 nop
FFFFFFFFFFFFFFE0.0 org 0xFFFF_FFFF_FFFF_FFE0
FFFFFFFFFFFFFFE0.0 0CFFFFFFF11 jmp nmirout
FFFFFFFFFFFFFFE0.1 37800000000 nop
FFFFFFFFFFFFFFE0.2 37800000000 nop
FFFFFFFFFFFFFFF0.0 org 0xFFFF_FFFF_FFFF_FFF0
FFFFFFFFFFFFFFF0.0 0CFFFFFFA09 jmp start
FFFFFFFFFFFFFFF0.1 37800000000 nop
FFFFFFFFFFFFFFF0.2 37800000000 nop
; RST vector
FFFFFFFFFFFFFFF0 org 0xFFFF_FFFF_FFFF_FFF0
FFFFFFFFFFFFFFF0 33FFEC07 jmp start
FFFFFFFFFFFFFFF4 DE000000 nop
FFFFFFFFFFFFFFF8 DE000000 nop
0000000000000000.0 00000000000
0000000000000000.1 00000000000
FFFFFFFFFFFFFFFC 00000000
0000000000000000 00000000
Symbol Table:
1548,224 → 5739,770
CTRLH C constant 0000000000000008
CTRLS C constant 0000000000000013
CTRLX C constant 0000000000000018
STACKTOP C constant FFFFFFFFFFFEFFF8
Milliseconds C constant 0000000000000400
Lastloc C constant 0000000000000408
ScreenColor C constant 0000000000000414
CursorRow C constant 0000000000000416
CursorCol C constant 0000000000000418
KeybdEcho C constant 000000000000041A
KeybdBuffer C constant 0000000000000440
KeybdHead C constant 0000000000000450
KeybdTail C constant 0000000000000451
TEXTSCR C constant FFFFFFFFFFD00000
COLORSCR C constant FFFFFFFFFFD10000
TEXTREG C constant FFFFFFFFFFDA0000
XON C constant 0000000000000011
XOFF C constant 0000000000000013
DATA_PRESENT C constant 0000000000000001
XMIT_NOT_FULL C constant 0000000000000020
BUFLEN C constant 0000000000000050
STACKTOP0 C constant FFFFFFFFFFFEFFF8
STACKTOP1 C constant FFFFFFFFFFFEFBF8
STACKTOP2 C constant FFFFFFFFFFFEF7F8
STACKTOP3 C constant FFFFFFFFFFFEF3F8
STACKTOP4 C constant FFFFFFFFFFFEEFF8
STACKTOP5 C constant FFFFFFFFFFFEEBF8
STACKTOP6 C constant FFFFFFFFFFFEE7F8
STACKTOP7 C constant FFFFFFFFFFFEE3F8
STACKTOP8 C constant FFFFFFFFFFFEDFF8
STACKTOP9 C constant FFFFFFFFFFFEDBF8
STACKTOP10 C constant FFFFFFFFFFFED7F8
STACKTOP11 C constant FFFFFFFFFFFED3F8
STACKTOP12 C constant FFFFFFFFFFFECFF8
STACKTOP13 C constant FFFFFFFFFFFECBF8
STACKTOP14 C constant FFFFFFFFFFFEC7F8
STACKTOP15 C constant FFFFFFFFFFFEC3F8
TCBSize C constant 0000000000000200
TCBBase C constant 0000000100000000
TCBr1 C constant 0000000000000000
TCBr2 C constant 0000000000000008
TCBr3 C constant 0000000000000010
TCBr4 C constant 0000000000000018
TCBr5 C constant 0000000000000020
TCBr6 C constant 0000000000000028
TCBr7 C constant 0000000000000030
TCBr8 C constant 0000000000000038
TCBr9 C constant 0000000000000040
TCBr10 C constant 0000000000000048
TCBr11 C constant 0000000000000050
TCBr12 C constant 0000000000000058
TCBr13 C constant 0000000000000060
TCBr14 C constant 0000000000000068
TCBr15 C constant 0000000000000070
TCBr16 C constant 0000000000000078
TCBr17 C constant 0000000000000080
TCBr18 C constant 0000000000000088
TCBr19 C constant 0000000000000090
TCBr20 C constant 0000000000000098
TCBr21 C constant 00000000000000A0
TCBr22 C constant 00000000000000A8
TCBr23 C constant 00000000000000B0
TCBr24 C constant 00000000000000B8
TCBr25 C constant 00000000000000C0
TCBr26 C constant 00000000000000C8
TCBr27 C constant 00000000000000D0
TCBr28 C constant 00000000000000D8
TCBr29 C constant 00000000000000E0
TCBr30 C constant 00000000000000E8
TCBr31 C constant 00000000000000F0
warmStart C constant 0000000000001020
usrJmp C constant 0000000000001028
TickIRQAddr C constant 0000000000001030
TaskBlock C constant 0000000000001038
tencount C constant 00000000000013F8
Milliseconds C constant 0000000000001400
Lastloc C constant 0000000000001408
ScreenColor C constant 0000000000001414
CursorRow C constant 0000000000001416
CursorCol C constant 0000000000001418
CursorFlash C constant 000000000000141A
KeybdEcho C constant 000000000000141C
KeybdBuffer C constant 0000000000001440
KeybdHead C constant 0000000000001450
KeybdTail C constant 0000000000001451
Score C constant 0000000000001500
Manpos C constant 0000000000001508
MissileActive C constant 0000000000001510
MissileX C constant 0000000000001512
MissileY C constant 0000000000001514
InvadersRow1 C constant 0000000000001520
InvadersRow2 C constant 0000000000001530
InvadersRow3 C constant 0000000000001540
InvadersRow4 C constant 0000000000001550
InvadersRow5 C constant 0000000000001560
InvadersColpos C constant 0000000000001570
InvadersRowpos C constant 0000000000001571
Uart_rxfifo C constant 0000000000001600
Uart_rxhead C constant 0000000000001800
Uart_rxtail C constant 0000000000001802
Uart_ms C constant 0000000000001808
Uart_rxrts C constant 0000000000001809
Uart_rxdtr C constant 000000000000180A
Uart_rxxon C constant 000000000000180B
Uart_rxflow C constant 000000000000180C
Uart_fon C constant 000000000000180E
Uart_foff C constant 0000000000001810
Uart_txrts C constant 0000000000001812
Uart_txdtr C constant 0000000000001813
Uart_txxon C constant 0000000000001814
Uart_txxonoff C constant 0000000000001815
TaskList C constant 0000000000002000
ReadyList1 C constant 0000000000002000
ReadyList2 C constant 0000000000002020
ReadyList3 C constant 0000000000002040
ReadyList4 C constant 0000000000002060
ReadyList5 C constant 0000000000002080
ReadyNdx1 C constant 00000000000020A0
ReadyNdx2 C constant 00000000000020A1
ReadyNdx3 C constant 00000000000020A2
ReadyNdx4 C constant 00000000000020A3
ReadyNdx5 C constant 00000000000020A4
RunningTCB C constant 00000000000020A6
NextToRunTCB C constant 00000000000020A8
r1save C constant 00000000000020B0
r2save C constant 00000000000020B8
AXCstart C constant 00000000000020C0
p100IRQvec C constant 0000000000003000
keybdIRQvec C constant 0000000000003008
serialIRQvec C constant 0000000000003010
rasterIRQvec C constant 0000000000003018
TEXTSCR C constant 0000000000D00000
COLORSCR C constant 0000000000D10000
TEXTREG C constant 0000000000DA0000
TEXT_COLS C constant 0000000000000000
TEXT_ROWS C constant 0000000000000002
TEXT_CURPOS C constant 0000000000000016
KEYBD C constant FFFFFFFFFFDC0000
KEYBDCLR C constant FFFFFFFFFFDC0002
UART C constant FFFFFFFFFFDC0A00
UART_LS C constant FFFFFFFFFFDC0A01
PIC C constant FFFFFFFFFFDC0FF0
PSG C constant FFFFFFFFFFD50000
AC97 C constant FFFFFFFFFFDC1000
KEYBD C constant 0000000000DC0000
KEYBDCLR C constant 0000000000DC0002
UART C constant 0000000000DC0A00
UART_LS C constant 0000000000DC0A01
UART_IS C constant 0000000000DC0A03
UART_IE C constant 0000000000DC0A04
UART_MC C constant 0000000000DC0A06
DATETIME C constant 0000000000DC0400
PIC C constant 0000000000DC0FF0
PIC_IE C constant 0000000000DC0FF2
PSG C constant 0000000000D50000
PSGFREQ0 C constant 0000000000D50000
PSGPW0 C constant 0000000000D50002
PSGCTRL0 C constant 0000000000D50004
PSGADSR0 C constant 0000000000D50006
SPRRAM C constant 0000000000D80000
AC97 C constant 0000000000DC1000
LED C constant 0000000000DC0600
GACCEL C constant 0000000000DAE000
RASTERIRQ C constant 0000000000DA0100
BOOT_STACK C constant FFFFFFFFFFFEFFF8
SPRITEREGS C constant 0000000000DAD000
BITMAPSCR C constant 0000000100200000
txempty C constant 0000000000000040
rxfull C constant 0000000000000001
SerialGetChar L code FFFFFFFFFFFFE950.0
SerialPutChar L code FFFFFFFFFFFFE980.0
SetKeyboardEcho L code FFFFFFFFFFFFEA40.0
KeybdCheckForKey L code FFFFFFFFFFFFEA90.2
KeybdGetChar L code FFFFFFFFFFFFEA40.2
DisplayChar L code FFFFFFFFFFFFED90.1
DisplayString L code FFFFFFFFFFFFEFD0.1
start L code FFFFFFFFFFFFE820.1
ColdStart L code FFFFFFFFFFFFE820.1
KeybdInit L code FFFFFFFFFFFFE9B0.2
PICInit L code FFFFFFFFFFFFE940.0
dcokay L code FFFFFFFFFFFFE870.1
ClearScreen L code FFFFFFFFFFFFEC10.2
ClearBmpScreen L code FFFFFFFFFFFFEBD0.0
j4 L code FFFFFFFFFFFFE8C0.2
Monitor L code FFFFFFFFFFFFF290.2
HelloWorld L code FFFFFFFFFFFFE8D0.1
j3 L code FFFFFFFFFFFFE8E0.1
j2 L code FFFFFFFFFFFFE900.0
MSG L code FFFFFFFFFFFFE910.0
MSGSTART L code FFFFFFFFFFFFE920.0
sgc1 L code FFFFFFFFFFFFF810.0
spc1 L code FFFFFFFFFFFFE990.1
KeybdIRQ L code FFFFFFFFFFFFE9D0.1
KeybdIRQa L code FFFFFFFFFFFFE9F0.1
KeybdIRQb L code FFFFFFFFFFFFEA10.1
KeybdIRQc L code FFFFFFFFFFFFEA30.0
nochar L code FFFFFFFFFFFFEA80.2
kck1 L code FFFFFFFFFFFFEAB0.1
KeybdCheckForKeyDirect L code FFFFFFFFFFFFEAC0.0
cfkd1 L code FFFFFFFFFFFFEAD0.1
KeybdGetCharDirect L code FFFFFFFFFFFFEAE0.0
kgc1 L code FFFFFFFFFFFFEAF0.0
gk1 L code FFFFFFFFFFFFEB20.1
gk2 L code FFFFFFFFFFFFEB20.0
CRLF L code FFFFFFFFFFFFF020.1
Pulse1000 L code FFFFFFFFFFFFEB30.0
p10001 L code FFFFFFFFFFFFEB70.2
FlashCursor L code FFFFFFFFFFFFEB80.1
CalcScreenLoc L code FFFFFFFFFFFFED50.1
flshcrsr1 L code FFFFFFFFFFFFEBC0.1
csj4 L code FFFFFFFFFFFFEC50.0
AsciiToScreen L code FFFFFFFFFFFFED10.1
ScrollUp L code FFFFFFFFFFFFEC70.0
scrup1 L code FFFFFFFFFFFFEC90.2
BlankLine L code FFFFFFFFFFFFECD0.0
blnkln1 L code FFFFFFFFFFFFECF0.2
atoscr1 L code FFFFFFFFFFFFED30.1
ScreenToAscii L code FFFFFFFFFFFFED40.0
stasc1 L code FFFFFFFFFFFFED50.0
dccr L code FFFFFFFFFFFFEDB0.0
dcx7 L code FFFFFFFFFFFFEDD0.1
dcx6 L code FFFFFFFFFFFFEDE0.1
dcx8 L code FFFFFFFFFFFFEE10.0
dcx9 L code FFFFFFFFFFFFEE30.2
dcx10 L code FFFFFFFFFFFFEE60.1
dcx11 L code FFFFFFFFFFFFEE90.1
dcx12 L code FFFFFFFFFFFFEE80.2
dcx13 L code FFFFFFFFFFFFEEB0.2
dcx5 L code FFFFFFFFFFFFEEE0.1
dcx3 L code FFFFFFFFFFFFEF10.2
dcx4 L code FFFFFFFFFFFFEF50.1
dclf L code FFFFFFFFFFFFEF50.0
IncCursorPos L code FFFFFFFFFFFFEF60.0
IncCursorRow L code FFFFFFFFFFFFEF90.0
icc1 L code FFFFFFFFFFFFEFC0.1
icr1 L code FFFFFFFFFFFFEF90.2
dspj1 L code FFFFFFFFFFFFEFE0.1
dsret L code FFFFFFFFFFFFF000.0
DisplayStringCRLF L code FFFFFFFFFFFFF000.2
DisplayNybble L code FFFFFFFFFFFFF050.2
dispnyb1 L code FFFFFFFFFFFFF080.0
DisplayByte L code FFFFFFFFFFFFF090.1
DisplayWord L code FFFFFFFFFFFFF0C0.0
dspwd1 L code FFFFFFFFFFFFF0D0.0
DisplayMem L code FFFFFFFFFFFFF0E0.2
dspmem1 L code FFFFFFFFFFFFF110.0
BinToBCD L code FFFFFFFFFFFFF140.0
bta1 L code FFFFFFFFFFFFF150.1
BCDToAscii L code FFFFFFFFFFFFF1B0.0
bta2 L code FFFFFFFFFFFFF1C0.0
BinToStr L code FFFFFFFFFFFFF200.2
btos3 L code FFFFFFFFFFFFF230.0
btos1 L code FFFFFFFFFFFFF230.1
btos2 L code FFFFFFFFFFFFF270.1
PromptLn L code FFFFFFFFFFFFF2A0.1
Prompt3 L code FFFFFFFFFFFFF2B0.1
Prompt1 L code FFFFFFFFFFFFF2D0.0
Prompt2 L code FFFFFFFFFFFFF300.1
Editmem L code FFFFFFFFFFFFF450.0
Dumpmem L code FFFFFFFFFFFFF4A0.0
ExecuteCode L code FFFFFFFFFFFFF480.1
LoadS19 L code FFFFFFFFFFFFF590.0
DisplayHelp L code FFFFFFFFFFFFF370.1
TestCLS L code FFFFFFFFFFFFF330.0
HelpMsg L code FFFFFFFFFFFFF390.0
ignBlanks L code FFFFFFFFFFFFF420.0
ignBlanks1 L code FFFFFFFFFFFFF420.2
GetHexNumber L code FFFFFFFFFFFFF4E0.1
edtmem1 L code FFFFFFFFFFFFF460.1
gthxn2 L code FFFFFFFFFFFFF4F0.2
AsciiToHexNybble L code FFFFFFFFFFFFF530.2
gthxn1 L code FFFFFFFFFFFFF520.2
gthx3 L code FFFFFFFFFFFFF580.1
gthx5 L code FFFFFFFFFFFFF550.0
gthx6 L code FFFFFFFFFFFFF560.2
ProcessRec L code FFFFFFFFFFFFF5A0.0
NextRec L code FFFFFFFFFFFFF590.1
sGetChar L code FFFFFFFFFFFFF7F0.0
ProcessS1 L code FFFFFFFFFFFFF690.1
ProcessS2 L code FFFFFFFFFFFFF6A0.0
ProcessS3 L code FFFFFFFFFFFFF6A0.2
ProcessS7 L code FFFFFFFFFFFFF6B0.1
ProcessS8 L code FFFFFFFFFFFFF6C0.1
ProcessS9 L code FFFFFFFFFFFFF6D0.1
pcssxa L code FFFFFFFFFFFFF620.0
pcss1a L code FFFFFFFFFFFFF620.2
S19Get16BitAddress L code FFFFFFFFFFFFF6E0.1
S19Get24BitAddress L code FFFFFFFFFFFFF700.1
S19Get32BitAddress L code FFFFFFFFFFFFF720.1
S1932b L code FFFFFFFFFFFFF790.1
S1932a L code FFFFFFFFFFFFF760.2
sgc2 L code FFFFFFFFFFFFF7F0.2
AUXIN L code FFFFFFFFFFFFF8C0.0
SetupAC97 L code FFFFFFFFFFFFF820.2
sac971 L code FFFFFFFFFFFFF830.1
sac972 L code FFFFFFFFFFFFF850.1
Beep L code FFFFFFFFFFFFF850.2
beep1 L code FFFFFFFFFFFFF8B0.0
AXIRET L code FFFFFFFFFFFFF8D0.2
BYEBYE L code FFFFFFFFFFFFF8E0.0
msgInit L code FFFFFFFFFFFFF8F0.0
OKMSG L code FFFFFFFFFFFFFADF.0
msgWhat L code FFFFFFFFFFFFF92D.0
SRYMSG L code FFFFFFFFFFFFFAF0.0
CLMSG L code FFFFFFFFFFFFFAF2.0
msgReadError L code FFFFFFFFFFFFF93E.0
msgNumTooBig L code FFFFFFFFFFFFF959.0
msgDivZero L code FFFFFFFFFFFFF96D.0
msgVarSpace L code FFFFFFFFFFFFF980.0
msgBytesFree L code FFFFFFFFFFFFF998.0
msgReady L code FFFFFFFFFFFFF9A6.0
msgComma L code FFFFFFFFFFFFF9B0.0
msgLineRange L code FFFFFFFFFFFFF9C4.0
msgVar L code FFFFFFFFFFFFF9DA.0
msgRNDBad L code FFFFFFFFFFFFF9F1.0
msgSYSBad L code FFFFFFFFFFFFFA05.0
msgInputVar L code FFFFFFFFFFFFFA17.0
msgNextFor L code FFFFFFFFFFFFFA34.0
msgNextVar L code FFFFFFFFFFFFFA47.0
msgBadGotoGosub L code FFFFFFFFFFFFFA6B.0
msgRetWoGosub L code FFFFFFFFFFFFFA88.0
msgTooBig L code FFFFFFFFFFFFFA9F.0
msgExtraChars L code FFFFFFFFFFFFFAB4.0
INITMSG L code FFFFFFFFFFFFFAD7.0
HOWMSG L code FFFFFFFFFFFFFAE6.0
WHTMSG L code FFFFFFFFFFFFFAEB.0
txtWidth L bss 0000000000001038
txtHeight L bss 0000000000001039
cursx L bss 000000000000103A
cursy L bss 000000000000103B
pos L bss 000000000000103C
dh L bss 000000000000103C
0 L bss 000000000000103C
charToPrint L bss 0000000000001040
fgColor L bss 0000000000001042
bkColor L bss 0000000000001045
cursFlash L bss 0000000000001046
lineLinkTbl L bss 0000000000001047
typef L bss 0000000000001080
OSSP L bss 0000000000001088
CURRNT L bss 0000000000001090
STKGOS L bss 0000000000001098
STKINP L bss 00000000000010A0
LOPVAR L bss 00000000000010A8
LOPINC L bss 00000000000010B0
LOPLMT L bss 00000000000010B8
LOPLN L bss 00000000000010C0
LOPPT L bss 00000000000010C8
TXTUNF L bss 00000000000010D0
VARBGN L bss 00000000000010D8
IVARBGN L bss 00000000000010E0
SVARBGN L bss 00000000000010E8
FVARBGN L bss 00000000000010F0
STKBOT L bss 00000000000010F8
NUMWKA L bss 0000000000001100
BUFFER L bss 000000000000111B
TXT C constant 0000000100600000
SerialGetChar L code FFFFFFFFFFFFB550
SerialPutChar L code FFFFFFFFFFFFB430
SetKeyboardEcho L code FFFFFFFFFFFFB818
KeybdCheckForKey L code FFFFFFFFFFFFB874
KeybdGetChar L code FFFFFFFFFFFFB820
DisplayChar L code FFFFFFFFFFFFBD1C
DisplayString L code FFFFFFFFFFFFBF9C
start L code FFFFFFFFFFFFB01C
ColdStart L code FFFFFFFFFFFFB01C
ict1 L code FFFFFFFFFFFFB028
ctxstart3 L code FFFFFFFFFFFFB1F8
ctxstart2 L code FFFFFFFFFFFFB210
ctxstart L code FFFFFFFFFFFFB214
ctxstart1 L code FFFFFFFFFFFFB318
csj5 L code FFFFFFFFFFFFB22C
SerialInit L code FFFFFFFFFFFFB3B0
KeybdInit L code FFFFFFFFFFFFB7B0
PICInit L code FFFFFFFFFFFFB390
SetupRasterIRQ L code FFFFFFFFFFFFCA64
dcokay L code FFFFFFFFFFFFB2C4
ClearScreen L code FFFFFFFFFFFFBB64
ClearBmpScreen L code FFFFFFFFFFFFBB10
RandomizeSprram L code FFFFFFFFFFFFC7B4
DisplayStringCRLF L code FFFFFFFFFFFFBFD4
Monitor L code FFFFFFFFFFFFC258
SetupAC97 L code FFFFFFFFFFFFC7DC
Beep L code FFFFFFFFFFFFC884
j4 L code FFFFFFFFFFFFB310
HelloWorld L code FFFFFFFFFFFFB31C
j3 L code FFFFFFFFFFFFB334
j2 L code FFFFFFFFFFFFB348
MSG L code FFFFFFFFFFFFB360
MSGSTART L code FFFFFFFFFFFFB36D
PICret L code FFFFFFFFFFFFB3AC
SerialGetCharDirect L code FFFFFFFFFFFFB3F4
sgc1 L code FFFFFFFFFFFFC6E0
SerialCheckForCharDirect L code FFFFFFFFFFFFB418
spcb1 L code FFFFFFFFFFFFB490
spcb3 L code FFFFFFFFFFFFB470
spcabort L code FFFFFFFFFFFFB518
spcb2 L code FFFFFFFFFFFFB4C0
spcb4 L code FFFFFFFFFFFFB4A0
spcb5 L code FFFFFFFFFFFFB4DC
spcb6 L code FFFFFFFFFFFFB4C8
spcb8 L code FFFFFFFFFFFFB4E4
spcb7 L code FFFFFFFFFFFFB50C
CharsInRxBuf L code FFFFFFFFFFFFB52C
cirxb1 L code FFFFFFFFFFFFB54C
sgcfifo1 L code FFFFFFFFFFFFB610
sgcfifo2 L code FFFFFFFFFFFFB5FC
sgcfifo3 L code FFFFFFFFFFFFB5C0
sgcfifo4 L code FFFFFFFFFFFFB5E4
sgcfifo5 L code FFFFFFFFFFFFB5FC
SerialIRQ L code FFFFFFFFFFFFB628
sirq1 L code FFFFFFFFFFFFB660
srxirq L code FFFFFFFFFFFFB688
stxirq L code FFFFFFFFFFFFB684
smsirq L code FFFFFFFFFFFFB678
srxirq1 L code FFFFFFFFFFFFB688
srxirq3 L code FFFFFFFFFFFFB6B8
srxirq2 L code FFFFFFFFFFFFB6AC
srxirq5 L code FFFFFFFFFFFFB6D4
srxirq8 L code FFFFFFFFFFFFB764
srxirq6 L code FFFFFFFFFFFFB728
srxirq7 L code FFFFFFFFFFFFB74C
KeybdSC L code FFFFFFFFFFFFB768
kbdsc1 L code FFFFFFFFFFFFB77C
kbdscRet L code FFFFFFFFFFFFB7A4
kbdsc2 L code FFFFFFFFFFFFB78C
kbdsc3 L code FFFFFFFFFFFFB798
kbdsc4 L code FFFFFFFFFFFFB7A4
KeybdIRQ L code FFFFFFFFFFFFB7C4
KeybdIRQa L code FFFFFFFFFFFFB7D4
KeybdIRQb L code FFFFFFFFFFFFB7FC
KeybdIRQc L code FFFFFFFFFFFFB810
nochar L code FFFFFFFFFFFFB864
kgc3 L code FFFFFFFFFFFFB868
kgc2 L code FFFFFFFFFFFFB85C
CRLF L code FFFFFFFFFFFFE4FC
KeybdCheckForKeyDirect L code FFFFFFFFFFFFB884
KeybdGetCharDirect L code FFFFFFFFFFFFB898
kgc1 L code FFFFFFFFFFFFB8A8
gk1 L code FFFFFFFFFFFFB8E0
gk2 L code FFFFFFFFFFFFB8DC
Pulse100 L code FFFFFFFFFFFFB8EC
DisplayDatetime L code FFFFFFFFFFFFCB60
SelectNextToRunTCB L code FFFFFFFFFFFFB928
SwitchTask L code FFFFFFFFFFFFB930
p1001 L code FFFFFFFFFFFFB920
swtsk1 L code FFFFFFFFFFFFB950
FlashCursor L code FFFFFFFFFFFFBA80
CalcScreenLoc L code FFFFFFFFFFFFBCDC
flshcrsr2 L code FFFFFFFFFFFFBADC
flshcrsr3 L code FFFFFFFFFFFFBAB4
flshcrsr1 L code FFFFFFFFFFFFBAC8
CursorOff L code FFFFFFFFFFFFBAE8
CursorOn L code FFFFFFFFFFFFBAFC
csj4 L code FFFFFFFFFFFFBBAC
AsciiToScreen L code FFFFFFFFFFFFBCAC
ScrollUp L code FFFFFFFFFFFFBBD8
scrup1 L code FFFFFFFFFFFFBC18
BlankLine L code FFFFFFFFFFFFBC58
blnkln1 L code FFFFFFFFFFFFBC90
atoscr1 L code FFFFFFFFFFFFBCC4
ScreenToAscii L code FFFFFFFFFFFFBCCC
stasc1 L code FFFFFFFFFFFFBCD8
dccr L code FFFFFFFFFFFFBD3C
dcx7 L code FFFFFFFFFFFFBD68
dcx6 L code FFFFFFFFFFFFBD80
dcx8 L code FFFFFFFFFFFFBDB0
dcx9 L code FFFFFFFFFFFFBDE0
dcx10 L code FFFFFFFFFFFFBE10
dcx11 L code FFFFFFFFFFFFBE44
dcx12 L code FFFFFFFFFFFFBE3C
dcx13 L code FFFFFFFFFFFFBE78
dcx5 L code FFFFFFFFFFFFBE98
dcx3 L code FFFFFFFFFFFFBECC
dcx4 L code FFFFFFFFFFFFBEF4
dclf L code FFFFFFFFFFFFBEF0
IncCursorPos L code FFFFFFFFFFFFBF10
IncCursorRow L code FFFFFFFFFFFFBF48
icc1 L code FFFFFFFFFFFFBF84
icr1 L code FFFFFFFFFFFFBF5C
dspj1 L code FFFFFFFFFFFFBFB0
dsret L code FFFFFFFFFFFFBFC4
DisplayNybble L code FFFFFFFFFFFFC010
dispnyb1 L code FFFFFFFFFFFFC02C
DisplayByte L code FFFFFFFFFFFFC03C
DisplayWord L code FFFFFFFFFFFFC064
dspwd1 L code FFFFFFFFFFFFC078
DisplayMem L code FFFFFFFFFFFFC094
dspmem1 L code FFFFFFFFFFFFC0B8
BinToBCD L code FFFFFFFFFFFFC0E4
bta1 L code FFFFFFFFFFFFC108
BCDToAscii L code FFFFFFFFFFFFC160
bta2 L code FFFFFFFFFFFFC178
BinToStr L code FFFFFFFFFFFFC1BC
btos3 L code FFFFFFFFFFFFC1F0
btos1 L code FFFFFFFFFFFFC1F4
btos2 L code FFFFFFFFFFFFC224
PromptLn L code FFFFFFFFFFFFC264
Prompt3 L code FFFFFFFFFFFFC270
Prompt1 L code FFFFFFFFFFFFC284
Prompt2 L code FFFFFFFFFFFFC2AC
Editmem L code FFFFFFFFFFFFC404
Dumpmem L code FFFFFFFFFFFFC43C
CSTART L code FFFFFFFFFFFFCE70
ExecuteCode L code FFFFFFFFFFFFC42C
LoadS19 L code FFFFFFFFFFFFC500
DisplayHelp L code FFFFFFFFFFFFC314
TestCLS L code FFFFFFFFFFFFC2E0
RandomLinesCall L code FFFFFFFFFFFFC2D8
Invaders L code FFFFFFFFFFFFCDAC
Piano L code FFFFFFFFFFFFC95C
RandomLines L code FFFFFFFFFFFFC6F0
HelpMsg L code FFFFFFFFFFFFC320
ignBlanks L code FFFFFFFFFFFFC3E0
ignBlanks1 L code FFFFFFFFFFFFC3E8
GetHexNumber L code FFFFFFFFFFFFC470
edtmem1 L code FFFFFFFFFFFFC414
gthxn2 L code FFFFFFFFFFFFC488
AsciiToHexNybble L code FFFFFFFFFFFFC4C0
gthxn1 L code FFFFFFFFFFFFC4AC
gthx3 L code FFFFFFFFFFFFC4F8
gthx5 L code FFFFFFFFFFFFC4D0
gthx6 L code FFFFFFFFFFFFC4E4
ProcessRec L code FFFFFFFFFFFFC50C
NextRec L code FFFFFFFFFFFFC504
sGetChar L code FFFFFFFFFFFFC6C8
ProcessS1 L code FFFFFFFFFFFFC5C4
ProcessS2 L code FFFFFFFFFFFFC5CC
ProcessS3 L code FFFFFFFFFFFFC5D4
ProcessS7 L code FFFFFFFFFFFFC5DC
ProcessS8 L code FFFFFFFFFFFFC5E8
ProcessS9 L code FFFFFFFFFFFFC5F4
pcssxa L code FFFFFFFFFFFFC56C
pcss1a L code FFFFFFFFFFFFC574
S19Get16BitAddress L code FFFFFFFFFFFFC600
S19Get24BitAddress L code FFFFFFFFFFFFC618
S19Get32BitAddress L code FFFFFFFFFFFFC630
S1932b L code FFFFFFFFFFFFC684
S1932a L code FFFFFFFFFFFFC664
sgc2 L code FFFFFFFFFFFFC6D0
AUXIN L code FFFFFFFFFFFFE570
rl5 L code FFFFFFFFFFFFC700
rl1 L code FFFFFFFFFFFFC714
rl2 L code FFFFFFFFFFFFC730
rl3 L code FFFFFFFFFFFFC74C
rl4 L code FFFFFFFFFFFFC768
rl8 L code FFFFFFFFFFFFC794
rl7 L code FFFFFFFFFFFFC7A4
rsr1 L code FFFFFFFFFFFFC7C4
sac974 L code FFFFFFFFFFFFC7E8
sac971 L code FFFFFFFFFFFFC7F4
sac973 L code FFFFFFFFFFFFC820
sac972 L code FFFFFFFFFFFFC860
sac975 L code FFFFFFFFFFFFC878
beep1 L code FFFFFFFFFFFFC8FC
beep2 L code FFFFFFFFFFFFC92C
playnt L code FFFFFFFFFFFFC96C
playnt1a L code FFFFFFFFFFFFC994
playnt1b L code FFFFFFFFFFFFC9A0
playnt1c L code FFFFFFFFFFFFC9AC
playnt1d L code FFFFFFFFFFFFC9B8
playnt1e L code FFFFFFFFFFFFC9C4
playnt1f L code FFFFFFFFFFFFC9D0
playnt1g L code FFFFFFFFFFFFC9DC
Tone L code FFFFFFFFFFFFC9E8
tone1 L code FFFFFFFFFFFFCA28
tone2 L code FFFFFFFFFFFFCA44
RasterIRQfn L code FFFFFFFFFFFFCAC4
rirq1 L code FFFFFFFFFFFFCAF4
rirq2 L code FFFFFFFFFFFFCAF4
rirq3 L code FFFFFFFFFFFFCAF4
rirq4 L code FFFFFFFFFFFFCAF4
rirq5 L code FFFFFFFFFFFFCAF4
rirq6 L code FFFFFFFFFFFFCAF4
rirq7 L code FFFFFFFFFFFFCAF4
rirq8 L code FFFFFFFFFFFFCAF4
InitializeGame L code FFFFFFFFFFFFCBD0
DrawScore L code FFFFFFFFFFFFCBF8
DrawMissile L code FFFFFFFFFFFFCC28
MissileOff L code FFFFFFFFFFFFCC84
DrawMan L code FFFFFFFFFFFFCCAC
DrawInvader L code FFFFFFFFFFFFCCF8
DrawInvaders L code FFFFFFFFFFFFCD18
dinv1 L code FFFFFFFFFFFFCDA0
DrawBombs L code FFFFFFFFFFFFCDA8
InvadersLoop L code FFFFFFFFFFFFCDB8
TestMoveMan L code FFFFFFFFFFFFCDCC
MoveManRight L code FFFFFFFFFFFFCDE0
MoveManLeft L code FFFFFFFFFFFFCDF8
FireMissile L code FFFFFFFFFFFFCE0C
Invaders1 L code FFFFFFFFFFFFCE30
InvadersEnd L code FFFFFFFFFFFFCE38
GOSTART L code FFFFFFFFFFFFCE44
GOWARM L code FFFFFFFFFFFFCE48
WSTART L code FFFFFFFFFFFFCEF8
GOOUT L code FFFFFFFFFFFFCE4C
OUTC L code FFFFFFFFFFFFE568
GOIN L code FFFFFFFFFFFFCE50
INC L code FFFFFFFFFFFFE56C
GOAUXO L code FFFFFFFFFFFFCE54
AUXOUT L code FFFFFFFFFFFFE588
GOAUXI L code FFFFFFFFFFFFCE58
GOBYE L code FFFFFFFFFFFFCE5C
BYEBYE L code FFFFFFFFFFFFE7A8
TXTBGN L code FFFFFFFFFFFFCE60
ENDMEM L code FFFFFFFFFFFFCE68
PRMESGAUX L code FFFFFFFFFFFFE534
PRMESG L code FFFFFFFFFFFFE500
clearVars L code FFFFFFFFFFFFD30C
PRTNUM L code FFFFFFFFFFFFE234
ST3 L code FFFFFFFFFFFFCF10
GETLN L code FFFFFFFFFFFFDF60
TOUPBUF L code FFFFFFFFFFFFE474
TSTNUM L code FFFFFFFFFFFFE3FC
IGNBLK L code FFFFFFFFFFFFE450
DIRECT L code FFFFFFFFFFFFD210
ST2 L code FFFFFFFFFFFFCF3C
ERROR L code FFFFFFFFFFFFDF20
FNDLN L code FFFFFFFFFFFFE030
ST4 L code FFFFFFFFFFFFCF90
FNDNXT L code FFFFFFFFFFFFE080
ST7 L code FFFFFFFFFFFFCF6C
ST6 L code FFFFFFFFFFFFCF88
MVUP L code FFFFFFFFFFFFE0A4
ST5 L code FFFFFFFFFFFFCFB8
MVDOWN L code FFFFFFFFFFFFE0BC
TAB1 L code FFFFFFFFFFFFCFE0
TAB2 L code FFFFFFFFFFFFCFF2
TAB4 L code FFFFFFFFFFFFD042
TAB5 L code FFFFFFFFFFFFD063
TAB6 L code FFFFFFFFFFFFD066
TAB8 L code FFFFFFFFFFFFD06B
TAB9 L code FFFFFFFFFFFFD075
TAB10 L code FFFFFFFFFFFFD079
TAB1_1 L code FFFFFFFFFFFFD080
TAB2_1 L code FFFFFFFFFFFFD0A8
TAB4_1 L code FFFFFFFFFFFFD150
TAB5_1 L code FFFFFFFFFFFFD198
TAB6_1 L code FFFFFFFFFFFFD1A8
TAB8_1 L code FFFFFFFFFFFFD1B8
TAB9_1 L code FFFFFFFFFFFFD1F0
TAB10_1 L code FFFFFFFFFFFFD200
EXEC L code FFFFFFFFFFFFD218
EXLP L code FFFFFFFFFFFFD22C
EXNGO L code FFFFFFFFFFFFD244
EXGO L code FFFFFFFFFFFFD27C
EXMAT L code FFFFFFFFFFFFD26C
EX1 L code FFFFFFFFFFFFD25C
NEW L code FFFFFFFFFFFFD284
ENDCHK L code FFFFFFFFFFFFDEE4
STOP L code FFFFFFFFFFFFD294
RUN L code FFFFFFFFFFFFD29C
RUNNXL L code FFFFFFFFFFFFD2AC
FNDLNP L code FFFFFFFFFFFFE040
RUNTSL L code FFFFFFFFFFFFD2CC
RUNSML L code FFFFFFFFFFFFD2D4
CHKIO L code FFFFFFFFFFFFE4D8
GOTO L code FFFFFFFFFFFFD2E4
OREXPR L code FFFFFFFFFFFFD8E8
_clr L code FFFFFFFFFFFFD304
FINISH L code FFFFFFFFFFFFD410
cv1 L code FFFFFFFFFFFFD320
LISTX L code FFFFFFFFFFFFD338
LS1 L code FFFFFFFFFFFFD34C
LS4 L code FFFFFFFFFFFFD354
PRTLN L code FFFFFFFFFFFFE37C
LS3 L code FFFFFFFFFFFFD374
LS2 L code FFFFFFFFFFFFD36C
PRINT L code FFFFFFFFFFFFD380
TSTC L code FFFFFFFFFFFFE3C4
PR2 L code FFFFFFFFFFFFD398
PR0 L code FFFFFFFFFFFFD3AC
PR3 L code FFFFFFFFFFFFD3E4
PR1 L code FFFFFFFFFFFFD3C4
PR4 L code FFFFFFFFFFFFD3DC
QTSTG L code FFFFFFFFFFFFE19C
PR8 L code FFFFFFFFFFFFD400
FIN L code FFFFFFFFFFFFDEA8
PR6 L code FFFFFFFFFFFFD3F8
QWHAT L code FFFFFFFFFFFFDF1C
GOSUB L code FFFFFFFFFFFFD418
PUSHA L code FFFFFFFFFFFFE0F8
gosub1 L code FFFFFFFFFFFFD430
RETURN L code FFFFFFFFFFFFD454
return1 L code FFFFFFFFFFFFD468
POPA L code FFFFFFFFFFFFE0C4
FOR L code FFFFFFFFFFFFD48C
SETVAL L code FFFFFFFFFFFFDE60
FR1 L code FFFFFFFFFFFFD4A4
FR2 L code FFFFFFFFFFFFD4B8
FR4 L code FFFFFFFFFFFFD4C4
FR3 L code FFFFFFFFFFFFD4C0
FR5 L code FFFFFFFFFFFFD4C8
FR7 L code FFFFFFFFFFFFD4E4
FR6 L code FFFFFFFFFFFFD4E0
FR8 L code FFFFFFFFFFFFD504
NEXT L code FFFFFFFFFFFFD508
TSTV L code FFFFFFFFFFFFDBB0
NX4 L code FFFFFFFFFFFFD51C
NX0 L code FFFFFFFFFFFFD520
NX5 L code FFFFFFFFFFFFD530
NX2 L code FFFFFFFFFFFFD53C
NX1 L code FFFFFFFFFFFFD55C
NXPurge L code FFFFFFFFFFFFD570
NX3 L code FFFFFFFFFFFFD560
IF L code FFFFFFFFFFFFD578
IF1 L code FFFFFFFFFFFFD57C
IF2 L code FFFFFFFFFFFFD580
FNDSKP L code FFFFFFFFFFFFE084
IF3 L code FFFFFFFFFFFFD590
INPERR L code FFFFFFFFFFFFD594
INPUT L code FFFFFFFFFFFFD5A8
IP6 L code FFFFFFFFFFFFD5B0
IP2 L code FFFFFFFFFFFFD5D0
IP4 L code FFFFFFFFFFFFD640
IP3 L code FFFFFFFFFFFFD600
IP7 L code FFFFFFFFFFFFD5E8
PRTSTG L code FFFFFFFFFFFFE144
IP5 L code FFFFFFFFFFFFD650
DEFLT L code FFFFFFFFFFFFD65C
LET L code FFFFFFFFFFFFD664
LT1 L code FFFFFFFFFFFFD678
LOAD L code FFFFFFFFFFFFD67C
LOD1 L code FFFFFFFFFFFFD688
LODEND L code FFFFFFFFFFFFD6C8
GCHAR L code FFFFFFFFFFFFD6D0
LOD2 L code FFFFFFFFFFFFD6B0
GCHAR1 L code FFFFFFFFFFFFD6E8
asciiToHex L code FFFFFFFFFFFFD714
a2h1 L code FFFFFFFFFFFFD71C
SAVE L code FFFFFFFFFFFFD728
SAVE1 L code FFFFFFFFFFFFD730
AUXOCRLF L code FFFFFFFFFFFFD784
SAVEND L code FFFFFFFFFFFFD76C
PWORD L code FFFFFFFFFFFFD7A4
SAVE2 L code FFFFFFFFFFFFD758
pword1 L code FFFFFFFFFFFFD7B8
toAsciiHex L code FFFFFFFFFFFFD7F4
pword2 L code FFFFFFFFFFFFD7D4
tah1 L code FFFFFFFFFFFFD800
POKE L code FFFFFFFFFFFFD808
PKER L code FFFFFFFFFFFFD834
POKEC L code FFFFFFFFFFFFD83C
POKEH L code FFFFFFFFFFFFD868
POKEW L code FFFFFFFFFFFFD894
SYSX L code FFFFFFFFFFFFD8C0
sysx1 L code FFFFFFFFFFFFD8D4
ANDEXPR L code FFFFFFFFFFFFD920
XP_OR1 L code FFFFFFFFFFFFD8F4
XP_OR L code FFFFFFFFFFFFD904
XP_ORX L code FFFFFFFFFFFFD914
EXPR L code FFFFFFFFFFFFD9B4
XP_AND1 L code FFFFFFFFFFFFD92C
XP_AND L code FFFFFFFFFFFFD93C
XP_ANDX L code FFFFFFFFFFFFD94C
isDigit L code FFFFFFFFFFFFD958
isDigitFalse L code FFFFFFFFFFFFD968
isAlpha L code FFFFFFFFFFFFD970
isAlphaFalse L code FFFFFFFFFFFFD988
isAlphaTrue L code FFFFFFFFFFFFD980
isAlnum L code FFFFFFFFFFFFD990
isDigitx L code FFFFFFFFFFFFD9AC
EXPR2 L code FFFFFFFFFFFFDA70
XP11 L code FFFFFFFFFFFFD9D0
XP18 L code FFFFFFFFFFFFDA54
XPRT1 L code FFFFFFFFFFFFDA3C
XPRT0 L code FFFFFFFFFFFFDA30
XP12 L code FFFFFFFFFFFFD9E0
XP13 L code FFFFFFFFFFFFD9F0
XP14 L code FFFFFFFFFFFFDA00
XP15 L code FFFFFFFFFFFFDA10
XP16 L code FFFFFFFFFFFFDA20
XP17 L code FFFFFFFFFFFFDA48
XP26 L code FFFFFFFFFFFFDACC
XP21 L code FFFFFFFFFFFFDA90
XP22 L code FFFFFFFFFFFFDA9C
EXPR3 L code FFFFFFFFFFFFDAE4
XP23 L code FFFFFFFFFFFFDAA0
XP24 L code FFFFFFFFFFFFDAB4
XP25 L code FFFFFFFFFFFFDAC0
XP45 L code FFFFFFFFFFFFDAD8
EXPR4 L code FFFFFFFFFFFFDB3C
XP31 L code FFFFFFFFFFFFDAF0
XP34 L code FFFFFFFFFFFFDB10
XP47 L code FFFFFFFFFFFFDB30
XP40 L code FFFFFFFFFFFFDB50
XP41 L code FFFFFFFFFFFFDB68
XP46 L code FFFFFFFFFFFFDB74
PARN L code FFFFFFFFFFFFDB7C
XP42 L code FFFFFFFFFFFFDBA0
XP43 L code FFFFFFFFFFFFDBA8
tstv_notfound L code FFFFFFFFFFFFDC24
TV1 L code FFFFFFFFFFFFDC08
SIZEX L code FFFFFFFFFFFFDE4C
TV2 L code FFFFFFFFFFFFDBFC
QSORRY L code FFFFFFFFFFFFDF14
TSTVRT L code FFFFFFFFFFFFDC18
getVarName L code FFFFFFFFFFFFDC34
findVar L code FFFFFFFFFFFFDCCC
gvn1 L code FFFFFFFFFFFFDCBC
gvn4 L code FFFFFFFFFFFFDC54
gvn2 L code FFFFFFFFFFFFDC8C
gvn6 L code FFFFFFFFFFFFDC7C
gvn3 L code FFFFFFFFFFFFDCA0
fv4 L code FFFFFFFFFFFFDCDC
fv3 L code FFFFFFFFFFFFDD00
fv1 L code FFFFFFFFFFFFDD08
fv2 L code FFFFFFFFFFFFDD18
PEEK L code FFFFFFFFFFFFDD2C
PEEKC L code FFFFFFFFFFFFDD3C
PEEKH L code FFFFFFFFFFFFDD50
PEEKW L code FFFFFFFFFFFFDD64
USRX L code FFFFFFFFFFFFDD78
RND L code FFFFFFFFFFFFDD94
rnd2 L code FFFFFFFFFFFFDDC4
rnd1 L code FFFFFFFFFFFFDDBC
modu4 L code FFFFFFFFFFFFDDD4
mod2 L code FFFFFFFFFFFFDDF4
mod1 L code FFFFFFFFFFFFDE10
ABS L code FFFFFFFFFFFFDE2C
SGN L code FFFFFFFFFFFFDE3C
sv2 L code FFFFFFFFFFFFDE7C
SV1 L code FFFFFFFFFFFFDEA4
FI1 L code FFFFFFFFFFFFDEC4
FI2 L code FFFFFFFFFFFFDEDC
ec1 L code FFFFFFFFFFFFDF04
TOOBIG L code FFFFFFFFFFFFDF0C
GL1 L code FFFFFFFFFFFFDF88
GL3 L code FFFFFFFFFFFFDFBC
GL4 L code FFFFFFFFFFFFDFE4
GL2 L code FFFFFFFFFFFFDFA0
GL7 L code FFFFFFFFFFFFE014
GL6 L code FFFFFFFFFFFFE00C
GL5 L code FFFFFFFFFFFFDFF0
fl1 L code FFFFFFFFFFFFE03C
FNDRET1 L code FFFFFFFFFFFFE06C
FNDRET2 L code FFFFFFFFFFFFE078
FNDRET L code FFFFFFFFFFFFE064
MVUP1 L code FFFFFFFFFFFFE094
MVRET L code FFFFFFFFFFFFE0A8
MVDOWN1 L code FFFFFFFFFFFFE0AC
PP1 L code FFFFFFFFFFFFE0F4
PU1 L code FFFFFFFFFFFFE138
PS1 L code FFFFFFFFFFFFE160
PRTRET L code FFFFFFFFFFFFE180
QT1 L code FFFFFFFFFFFFE1B8
QT2 L code FFFFFFFFFFFFE200
QT3 L code FFFFFFFFFFFFE1D0
QT4 L code FFFFFFFFFFFFE1E8
QT5 L code FFFFFFFFFFFFE20C
prCRLF L code FFFFFFFFFFFFE214
PN1 L code FFFFFFFFFFFFE264
PN6 L code FFFFFFFFFFFFE284
PN4 L code FFFFFFFFFFFFE294
PN3 L code FFFFFFFFFFFFE288
PN5 L code FFFFFFFFFFFFE2A0
PNRET L code FFFFFFFFFFFFE2B4
PRTHEXNUM L code FFFFFFFFFFFFE2CC
PHN1 L code FFFFFFFFFFFFE308
PHN7 L code FFFFFFFFFFFFE31C
PHN8 L code FFFFFFFFFFFFE320
shru L code FFFFFFFFFFFFE32C
r4 L code FFFFFFFFFFFFE32C
#4 L code FFFFFFFFFFFFE32C
PHN6 L code FFFFFFFFFFFFE334
PHN4 L code FFFFFFFFFFFFE344
PHN3 L code FFFFFFFFFFFFE338
PHN5 L code FFFFFFFFFFFFE350
PHNRET L code FFFFFFFFFFFFE364
TC1 L code FFFFFFFFFFFFE3EC
TN1 L code FFFFFFFFFFFFE410
TSNMRET L code FFFFFFFFFFFFE448
TN2 L code FFFFFFFFFFFFE430
IGB2 L code FFFFFFFFFFFFE458
IGB1 L code FFFFFFFFFFFFE464
IGBRET L code FFFFFFFFFFFFE46C
TOUPB1 L code FFFFFFFFFFFFE484
TOUPBRT L code FFFFFFFFFFFFE4C0
DOQUO L code FFFFFFFFFFFFE4A8
toUpper L code FFFFFFFFFFFFE4C8
DOQUO1 L code FFFFFFFFFFFFE4B4
TOUPRET L code FFFFFFFFFFFFE4D4
CHKRET2 L code FFFFFFFFFFFFE4F0
CHKRET L code FFFFFFFFFFFFE4F4
PRMESG1 L code FFFFFFFFFFFFE510
PRMRET L code FFFFFFFFFFFFE524
PRMESGA1 L code FFFFFFFFFFFFE544
PRMRETA L code FFFFFFFFFFFFE558
AXIRET_ZERO L code FFFFFFFFFFFFE580
AXIRET L code FFFFFFFFFFFFE57C
_cls L code FFFFFFFFFFFFE58C
_wait10 L code FFFFFFFFFFFFE594
_getATAStatus L code FFFFFFFFFFFFE598
_waitCFNotBusy L code FFFFFFFFFFFFE59C
_rdcf L code FFFFFFFFFFFFE5A0
rdcf6 L code FFFFFFFFFFFFE5A4
msgInit L code FFFFFFFFFFFFE5C0
OKMSG L code FFFFFFFFFFFFE5F6
msgWhat L code FFFFFFFFFFFFE5FD
SRYMSG L code FFFFFFFFFFFFE605
CLMSG L code FFFFFFFFFFFFE60B
msgReadError L code FFFFFFFFFFFFE60E
msgNumTooBig L code FFFFFFFFFFFFE629
msgDivZero L code FFFFFFFFFFFFE63D
msgVarSpace L code FFFFFFFFFFFFE650
msgBytesFree L code FFFFFFFFFFFFE668
msgReady L code FFFFFFFFFFFFE676
msgComma L code FFFFFFFFFFFFE680
msgLineRange L code FFFFFFFFFFFFE694
msgVar L code FFFFFFFFFFFFE6AA
msgRNDBad L code FFFFFFFFFFFFE6C1
msgSYSBad L code FFFFFFFFFFFFE6D5
msgInputVar L code FFFFFFFFFFFFE6E7
msgNextFor L code FFFFFFFFFFFFE704
msgNextVar L code FFFFFFFFFFFFE717
msgBadGotoGosub L code FFFFFFFFFFFFE73B
msgRetWoGosub L code FFFFFFFFFFFFE758
msgTooBig L code FFFFFFFFFFFFE76F
msgExtraChars L code FFFFFFFFFFFFE784
LSTROM C constant 0000000000000000
typef L bss 0000000000000080
OSSP L bss 0000000000000088
CURRNT L bss 0000000000000090
STKGOS L bss 0000000000000098
STKINP L bss 00000000000000A0
LOPVAR L bss 00000000000000A8
LOPINC L bss 00000000000000B0
LOPLMT L bss 00000000000000B8
LOPLN L bss 00000000000000C0
LOPPT L bss 00000000000000C8
TXTUNF L bss 00000000000000D0
VARBGN L bss 00000000000000D8
IVARBGN L bss 00000000000000E0
SVARBGN L bss 00000000000000E8
FVARBGN L bss 00000000000000F0
STKBOT L bss 00000000000000F8
NUMWKA L bss 0000000000000100
BUFFER L bss 000000000000010E
ramtest L code FFFFFFFFFFFFFB00.0
ramtest2 L code FFFFFFFFFFFFFB10.0
ramtest1 L code FFFFFFFFFFFFFB30.2
ramtest4 L code FFFFFFFFFFFFFB40.1
ramtest3 L code FFFFFFFFFFFFFB70.0
ramtest8 L code FFFFFFFFFFFFFBE0.1
ramtest5 L code FFFFFFFFFFFFFB80.1
ramtest6 L code FFFFFFFFFFFFFBB0.0
ramtest7 L code FFFFFFFFFFFFFBB0.2
ramtest9 L code FFFFFFFFFFFFFBF0.0
ramtest10 L code FFFFFFFFFFFFFBF0.2
irqrout L code FFFFFFFFFFFFFC00.1
irqrout3 L code FFFFFFFFFFFFFC10.2
irqrout2 L code FFFFFFFFFFFFFC20.2
irqrout1 L code FFFFFFFFFFFFFC30.1
nmirout L code FFFFFFFFFFFFFC40.1
DTLBHandler L code FFFFFFFFFFFFFC40.2
dh1 L code FFFFFFFFFFFFFC50.1
ramtest L code FFFFFFFFFFFFE7B0
ramtest2 L code FFFFFFFFFFFFE7C4
ramtest1 L code FFFFFFFFFFFFE7E8
ramtest4 L code FFFFFFFFFFFFE7F0
ramtest3 L code FFFFFFFFFFFFE81C
ramtest8 L code FFFFFFFFFFFFE88C
ramtest5 L code FFFFFFFFFFFFE834
ramtest6 L code FFFFFFFFFFFFE858
ramtest7 L code FFFFFFFFFFFFE860
ramtest9 L code FFFFFFFFFFFFE894
ramtest10 L code FFFFFFFFFFFFE89C
iberr_rout L code FFFFFFFFFFFFE8A4
dberr_rout L code FFFFFFFFFFFFE8BC
dberr1 L code FFFFFFFFFFFFE8E4
msgdberr L code FFFFFFFFFFFFE910
msgEPC L code FFFFFFFFFFFFE924
msgiberr L code FFFFFFFFFFFFE92B
irqrout L code FFFFFFFFFFFFE950
irq1000Hz L code FFFFFFFFFFFFE970
irq100Hz L code FFFFFFFFFFFFE9C8
irqSerial L code FFFFFFFFFFFFE9D8
irqret L code FFFFFFFFFFFFEA08
irqRaster L code FFFFFFFFFFFFE9E8
irqKeybd L code FFFFFFFFFFFFE9F8
nmirout L code FFFFFFFFFFFFEA20
DTLBHandler L code FFFFFFFFFFFFEA24
dh1 L code FFFFFFFFFFFFEA34
/raptor64/trunk/software/sample code/bootrom.s
1,5 → 1,5
; ============================================================================
; (C) 2012 Robert Finch
; (C) 2012,2013 Robert Finch, Stratford
; All Rights Reserved.
; robfinch<remove>@opencores.org
;
25,36 → 25,215
CTRLH EQU 0x08
CTRLS EQU 0x13
CTRLX EQU 0x18
XON EQU 0x11
XOFF EQU 0x13
 
STACKTOP EQU 0xFFFF_FFFF_FFFE_FFF8
Milliseconds EQU 0x400
Lastloc EQU 0x408
ScreenColor EQU 0x414
CursorRow EQU 0x416
CursorCol EQU 0x418
KeybdEcho EQU 0x41A
KeybdBuffer EQU 0x440
KeybdHead EQU 0x450
KeybdTail EQU 0x451
TEXTSCR EQU 0xFFFF_FFFF_FFD0_0000
COLORSCR EQU 0xFFFF_FFFF_FFD1_0000
TEXTREG EQU 0xFFFFFFFF_FFDA0000
DATA_PRESENT EQU 0x01 ; there is data preset at the serial port bc_uart3
XMIT_NOT_FULL EQU 0x20
 
BUFLEN EQU 80 ; length of keyboard input buffer
 
; Initial stack tops for contexts
; Each context gets 1k from the special 16k startup stack memory
;
STACKTOP0 EQU 0xFFFF_FFFF_FFFE_FFF8
STACKTOP1 EQU 0xFFFF_FFFF_FFFE_FBF8
STACKTOP2 EQU 0xFFFF_FFFF_FFFE_F7F8
STACKTOP3 EQU 0xFFFF_FFFF_FFFE_F3F8
STACKTOP4 EQU 0xFFFF_FFFF_FFFE_EFF8
STACKTOP5 EQU 0xFFFF_FFFF_FFFE_EBF8
STACKTOP6 EQU 0xFFFF_FFFF_FFFE_E7F8
STACKTOP7 EQU 0xFFFF_FFFF_FFFE_E3F8
STACKTOP8 EQU 0xFFFF_FFFF_FFFE_DFF8
STACKTOP9 EQU 0xFFFF_FFFF_FFFE_DBF8
STACKTOP10 EQU 0xFFFF_FFFF_FFFE_D7F8
STACKTOP11 EQU 0xFFFF_FFFF_FFFE_D3F8
STACKTOP12 EQU 0xFFFF_FFFF_FFFE_CFF8
STACKTOP13 EQU 0xFFFF_FFFF_FFFE_CBF8
STACKTOP14 EQU 0xFFFF_FFFF_FFFE_C7F8
STACKTOP15 EQU 0xFFFF_FFFF_FFFE_C3F8
 
 
; BOOT ROM routines
 
TCBSize EQU 0x200 ; 512 bytes per TCB
TCBBase EQU 0x00000001_00000000 ; TCB pages
TCBr1 EQU 0x00
TCBr2 EQU 0x08
TCBr3 EQU 0x10
TCBr4 EQU 0x18
TCBr5 EQU 0x20
TCBr6 EQU 0x28
TCBr7 EQU 0x30
TCBr8 EQU 0x38
TCBr9 EQU 0x40
TCBr10 EQU 0x48
TCBr11 EQU 0x50
TCBr12 EQU 0x58
TCBr13 EQU 0x60
TCBr14 EQU 0x68
TCBr15 EQU 0x70
TCBr16 EQU 0x78
TCBr17 EQU 0x80
TCBr18 EQU 0x88
TCBr19 EQU 0x90
TCBr20 EQU 0x98
TCBr21 EQU 0xA0
TCBr22 EQU 0xA8
TCBr23 EQU 0xB0
TCBr24 EQU 0xB8
TCBr25 EQU 0xC0
TCBr26 EQU 0xC8
TCBr27 EQU 0xD0
TCBr28 EQU 0xD8
TCBr29 EQU 0xE0
TCBr30 EQU 0xE8
TCBr31 EQU 0xF0
 
warmStart EQU 0x1020
usrJmp EQU 0x1028
TickIRQAddr EQU 0x1030
TaskBlock EQU 0x1038
tencount EQU 0x13F8
Milliseconds EQU 0x1400
Lastloc EQU 0x1408
ScreenColor EQU 0x1414
CursorRow EQU 0x1416
CursorCol EQU 0x1418
CursorFlash EQU 0x141A
KeybdEcho EQU 0x141C
KeybdBuffer EQU 0x1440
KeybdHead EQU 0x1450
KeybdTail EQU 0x1451
Score EQU 0x1500
Manpos EQU 0x1508
MissileActive EQU 0x1510
MissileX EQU 0x1512
MissileY EQU 0x1514
InvadersRow1 EQU 0x1520
InvadersRow2 EQU 0x1530
InvadersRow3 EQU 0x1540
InvadersRow4 EQU 0x1550
InvadersRow5 EQU 0x1560
InvadersColpos EQU 0x1570
InvadersRowpos EQU 0x1571
Uart_rxfifo EQU 0x1600
Uart_rxhead EQU 0x1800
Uart_rxtail EQU 0x1802
Uart_ms EQU 0x1808
Uart_rxrts EQU 0x1809
Uart_rxdtr EQU 0x180A
Uart_rxxon EQU 0x180B
Uart_rxflow EQU 0x180C
Uart_fon EQU 0x180E
Uart_foff EQU 0x1810
Uart_txrts EQU 0x1812
Uart_txdtr EQU 0x1813
Uart_txxon EQU 0x1814
Uart_txxonoff EQU 0x1815
TaskList EQU 0x2000
ReadyList1 EQU 0x2000
ReadyList2 EQU 0x2020
ReadyList3 EQU 0x2040
ReadyList4 EQU 0x2060
ReadyList5 EQU 0x2080
ReadyNdx1 EQU 0x20A0
ReadyNdx2 EQU 0x20A1
ReadyNdx3 EQU 0x20A2
ReadyNdx4 EQU 0x20A3
ReadyNdx5 EQU 0x20A4
RunningTCB EQU 0x20A6
NextToRunTCB EQU 0x20A8
r1save EQU 0x20B0
r2save EQU 0x20B8
AXCstart EQU 0x20C0
 
p100IRQvec EQU 0x3000
keybdIRQvec EQU 0x3008
serialIRQvec EQU 0x3010
rasterIRQvec EQU 0x3018
 
TEXTSCR EQU 0xD0_0000
COLORSCR EQU 0xD1_0000
TEXTREG EQU 0xDA_0000
TEXT_COLS EQU 0x0
TEXT_ROWS EQU 0x2
TEXT_CURPOS EQU 0x16
KEYBD EQU 0xFFFF_FFFF_FFDC_0000
KEYBDCLR EQU 0xFFFF_FFFF_FFDC_0002
UART EQU 0xFFFF_FFFF_FFDC_0A00
UART_LS EQU 0xFFFF_FFFF_FFDC_0A01
PIC EQU 0xFFFF_FFFF_FFDC_0FF0
PSG EQU 0xFFFF_FFFF_FFD5_0000
AC97 EQU 0xFFFF_FFFF_FFDC_1000
KEYBD EQU 0xDC_0000
KEYBDCLR EQU 0xDC_0002
 
UART EQU 0xDC_0A00
UART_LS EQU 0xDC_0A01
UART_MS EQU 0xDC_0A02
UART_IS EQU 0xDC_0A03
UART_IE EQU 0xDC_0A04
UART_MC EQU 0xDC_0A06
DATETIME EQU 0xDC_0400
PIC EQU 0xDC_0FF0
PIC_IE EQU 0xDC_0FF2
 
PSG EQU 0xD5_0000
PSGFREQ0 EQU 0xD5_0000
PSGPW0 EQU 0xD5_0002
PSGCTRL0 EQU 0xD5_0004
PSGADSR0 EQU 0xD5_0006
 
SPRRAM EQU 0xD8_0000
AC97 EQU 0xDC_1000
LED EQU 0xDC_0600
GACCEL EQU 0xDA_E000
RASTERIRQ EQU 0xDA_0100
BOOT_STACK EQU 0xFFFF_FFFF_FFFE_FFF8
SPRITEREGS EQU 0xDA_D000
BITMAPSCR EQU 0x00000001_00200000
 
txempty EQU 0x40
rxfull EQU 0x01
 
;
; Internal variables follow:
;
bss
org 0x1038
txtWidth db 0 ; BIOS var =56
txtHeight db 0 ; BIOS var =31
cursx db 0 ; cursor x position
cursy db 0 ; cursor y position
pos dh 0 ; text screen position
org 0x1040
charToPrint dc 0
fgColor db 0
bkColor db 0
cursFlash db 0 ; flash the cursor ?
 
lineLinkTbl fill.b 25,0 ; screen line link table
align 8
 
org 0x1080
typef db 0 ; variable / expression type
align 8
OSSP dw 1 ; OS value of sp
CURRNT dw 1 ; Current line pointer
STKGOS dw 1 ; Saves stack pointer in 'GOSUB'
STKINP dw 1 ; Saves stack pointer during 'INPUT'
LOPVAR dw 1 ; 'FOR' loop save area
LOPINC dw 1 ; increment
LOPLMT dw 1 ; limit
LOPLN dw 1 ; line number
LOPPT dw 1 ; text pointer
TXTUNF dw 1 ; points to unfilled text area
VARBGN dw 1 ; points to variable area
IVARBGN dw 1 ; points to integer variable area
SVARBGN dw 1 ; points to string variable area
FVARBGN dw 1 ; points to float variable area
STKBOT dw 1 ; holds lower limit for stack growth
NUMWKA fill.b 24,0 ; numeric work area
BUFFER fill.b BUFLEN,0x00 ; Keyboard input buffer
 
bss
org 0x1_00600000
TXT equ 0x1_00600000 ; Beginning of program area
 
; org 0x070
; iret
; nop
66,7 → 245,7
; nop
;
code
org 0xFFFF_FFFF_FFFF_E800
org 0xFFFF_FFFF_FFFF_B000
 
; jump table
;
84,46 → 263,207
 
ColdStart:
icache_on ; turn on the ICache
dcache_on ; turn on the DCache
setlo sp,#STACKTOP ; top of stack
dcache_off ; turn on the DCache
 
; Initialize the context schedule with all contexts treated equally
; There are only 16 contexts, but 256 schedule slots. Each context is
; given 16 slots distributed evenly throughout the execution pattern
; table.
;
xor r1,r1,r1 ; r1 = 0
ict1:
mtep r1,r1 ; only the low order four bits of r1 will move to the pattern table
addui r1,r1,#1
cmpi r2,r1,#255
bne r2,r0,ict1
 
; Point the interrupt return address register of the context to the
; context startup code. The context will start up when an interrupt return
; occurs.
;
; We cannot use a loop for this. Fortunately there's only 16 contexts.
;
lea r25,ctxstart
lea r30,STACKTOP0
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP1
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP2
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP3
iepp
nop
nop
 
lea r25,ctxstart
lea r30,STACKTOP4
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP5
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP6
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP7
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP8
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP9
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP10
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP11
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP12
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP13
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP14
iepp
nop
nop
lea r25,ctxstart
lea r30,STACKTOP15
iepp
nop
nop
 
; Ensure that context zero is the active context
;
ctxstart3:
mfspr r1,AXC
beq r1,r0,ctxstart2
iepp
nop
nop
bra ctxstart3
ctxstart2:
sb r1,AXCstart ; save off the startup context which should be context zero
 
; Entry point for context startup
;
; Avoid repeating all the system initialization when a context starts up by testing whether
; or not the context is the starting context.
;
ctxstart:
mfspr r1,AXC
lbu r2,AXCstart
bne r1,r2,ctxstart1
;
; set system vectors
; TBA defaults to zero on reset
;
setlo r3,#0
setlo r2,#511
lea r1,nmirout
csj5:
sw r1,[r3]
addui r3,r3,#8
loop r2,csj5
lea r1,KeybdSC ; keyboard BIOS vector
sw r1,0xD08
lea r1,irqrout
sw r1,0xE08 ; set IRQ vector
lea r1,dberr_rout
sw r1,0xFE0 ; set Bus error vector
lea r1,iberr_rout
sw r1,0xFE8 ; set Bus error vector
lea r1,nmirout
sw r1,0xFF0 ; set NMI vector
lea r1,KeybdIRQ
sw r1,keybdIRQvec
lea r1,Pulse100
sw r1,p100IRQvec
lea r1,SerialIRQ
sw r1,serialIRQvec
lea r1,RasterIRQfn
sw r1,rasterIRQvec
 
;-------------------------------
; Initialize I/O devices
;-------------------------------
call SerialInit
call KeybdInit
call PICInit
call SetupRasterIRQ
cli ; enable interrupts
; call HelloWorld
setlo r3,#0xCE ; blue on blue
sc r3,ScreenColor
lc r3,0x414
lc r3,0x1414
setlo r3,#32
sc r3,0x416 ; we do a store, then a load through the dcache
lc r2,0x416 ;
lc r2,0x416 ;
sc r3,0x1416 ; we do a store, then a load through the dcache
lc r2,0x1416 ;
beq r2,r3,dcokay
dcache_off ; data cache failed
dcokay:
lc r3,ScreenColor
sc r0,NextToRunTCB
sc r0,RunningTCB
call ClearScreen
call ClearBmpScreen
call RandomizeSprram
sc r0,CursorRow
sc r0,CursorCol
setlo r1,#<MSGSTART
sethi r1,#>MSGSTART
call DisplayString
; call SetupAC97 ; and Beep
setlo r1,#1
sb r1,CursorFlash
lea r1,MSGSTART
call DisplayStringCRLF
jmp Monitor
call SetupAC97 ; and Beep
setlo r3,#4
outb r3,LED
call Beep
 
; Allow some other contexts to start up
; equal processing time for sixteen contexts
;
mfspr r1,AXC ; which context am I
bne r1,r0,j4
setlo r1,#0x76543210
mtspr EP0,r1
mtspr EP2,r1
setlo r1,#0xFEDCBA98
mtspr EP1,r1
mtspr EP3,r1
j4:
jmp Monitor
bra j4
 
; for now hang the contexts
;
ctxstart1:
bra ctxstart1
 
; call ramtest
 
;-----------------------------------------
131,8 → 471,10
;-----------------------------------------
HelloWorld:
subui r30,r30,#24
sm [r30],r1/r2/r31
setlo r2,#MSG
sw r1,[sp]
sw r2,8[sp]
sw lr,16[sp]
lea r2,MSG
j3:
lb r1,[r2]
beq r1,r0,j2
140,16 → 482,17
addui r2,r2,#1
bra j3
j2:
lm [r30],r1/r2/r31
sw lr,16[sp]
sw r2,8[sp]
sw r1,[sp]
ret #24
 
 
align 16
MSG:
DB "Hello World!",0,0,0,0
align 16
db "Hello World!",0
MSGSTART:
db "Raptor64 system starting....",CR,LF,0,0
db "Raptor64 system starting....",0
 
align 16
 
157,49 → 500,334
; Initialize programmable interrupt controller (PIC)
; 0 = nmi
; 1 = keyboard reset
; 2 = 1000Hz pulse (cursor flash)
; 2 = 1000Hz pulse (context switcher)
; 3 = 100Hz pulse (cursor flash)
; 8 = uart
; 13 = raster interrupt
; 15 = keyboard char
;----------------------------------------------------------
PICInit:
setlo r1,#0x8007 ; enable nmi,kbd_rst,and kbd_irq
outc r1,PIC+2
lea r1,PICret
sw r1,TickIRQAddr
; enable: raster irq,
setlo r1,#0xA00F ; enable nmi,kbd_rst,and kbd_irq
; A10F enable serial IRQ
outc r1,PIC_IE
PICret:
ret
 
;==============================================================================
; Serial port
;==============================================================================
;-----------------------------------------
; Get character from serial port
; Initialize the serial port
;-----------------------------------------
SerialGetChar:
subui r30,r30,#8
sw r3,[r30]
setlo r1,#UART
;
SerialInit:
sc r0,Uart_rxhead ; reset buffer indexes
sc r0,Uart_rxtail
setlo r1,#0x1f0
sc r1,Uart_foff ; set threshold for XOFF
setlo r1,#0x010
sc r1,Uart_fon ; set threshold for XON
setlo r1,#1
outb r1,UART_IE ; enable receive interrupt only
sb r0,Uart_rxrts ; no RTS/CTS signals available
sb r0,Uart_txrts ; no RTS/CTS signals available
sb r0,Uart_txdtr ; no DTR signals available
sb r0,Uart_rxdtr ; no DTR signals available
setlo r1,#1
sb r1,Uart_txxon ; for now
ret
 
;---------------------------------------------------------------------------------
; Get character directly from serial port. Blocks until a character is available.
;---------------------------------------------------------------------------------
;
SerialGetCharDirect:
sgc1:
inb r3,1[r1] ; uart status
andi r3,r3,#rxfull ; is there a char available ?
beq r3,r0,sgc1
lw r3,[r30]
inb r1,[r1]
ret #8
inb r1,UART_LS ; uart status
andi r1,r1,#rxfull ; is there a char available ?
beq r1,r0,sgc1
inb r1,UART
ret
 
;------------------------------------------------
; Check for a character at the serial port
; returns r1 = 1 if char available, 0 otherwise
;------------------------------------------------
;
SerialCheckForCharDirect:
inb r1,UART_LS ; uart status
andi r1,r1,#rxfull ; is there a char available ?
sne r1,r1,r0
ret
 
;-----------------------------------------
; Put character to serial port
; r1 = char to put
;-----------------------------------------
;
SerialPutChar:
subui r30,r30,#16
sw r2,8[r30]
sw r3,[r30]
setlo r3,#UART
spc1:
inb r2,1[r3] ; uart status
andi r2,r2,#txempty ; is there a char available ?
beq r2,r0,spc1
outb r1,[r3]
lw r3,[r30]
lw r2,8[r30]
ret #16
subui sp,sp,#32
sw r2,[sp]
sw r3,8[sp]
sw r4,16[sp]
sw r5,24[sp]
inb r2,UART_MC
ori r2,r2,#3 ; assert DTR / RTS
outb r2,UART_MC
lb r2,Uart_txrts
beq r2,r0,spcb1
lw r4,Milliseconds
setlo r3,#100 ; delay count (1 s)
spcb3:
inb r2,UART_MS
andi r2,r2,#10 ; is CTS asserted ?
bne r2,r0,spcb1
lw r5,Milliseconds
beq r4,r5,spcb3
mov r4,r5
loop r3,spcb3
bra spcabort
spcb1:
lb r2,Uart_txdtr
beq r2,r0,spcb2
lw r4,Milliseconds
setlo r3,#100 ; delay count
spcb4:
inb r2,UART_MS
andi r2,r2,#20 ; is DSR asserted ?
bne r2,r0,spcb2
lw r5,Milliseconds
beq r4,r5,spcb4
mov r4,r5
loop r3,spcb4
bra spcabort
spcb2:
lb r2,Uart_txxon
beq r2,r0,spcb5
spcb6:
lb r2,Uart_txxonoff
beq r2,r0,spcb5
inb r4,UART_MS
andi r4,r4,#0x80 ; DCD ?
bne r4,r0,spcb6
spcb5:
lw r4,Milliseconds
setlo r3,#100 ; wait up to 1s
spcb8:
inb r2,UART_LS
andi r2,r2,#0x20 ; tx not full ?
bne r2,r0,spcb7
lw r5,Milliseconds
beq r4,r5,spcb8
mov r4,r5
loop r3,spcb8
bra spcabort
spcb7:
outb r1,UART
spcabort:
lw r2,[sp]
lw r3,8[sp]
lw r4,16[sp]
lw r5,24[sp]
ret #32
 
;-------------------------------------------------
; Compute number of characters in recieve buffer.
; r4 = number of chars
;-------------------------------------------------
CharsInRxBuf:
lc r4,Uart_rxhead
lc r2,Uart_rxtail
subu r4,r4,r2
bgt r4,r0,cirxb1
setlo r4,#0x200
addu r4,r4,r2
lc r2,Uart_rxhead
subu r4,r4,r2
cirxb1:
ret
 
;----------------------------------------------
; Get character from rx fifo
; If the fifo is empty enough then send an XON
;----------------------------------------------
;
SerialGetChar:
subui sp,sp,#32
sw r2,[sp]
sw r3,8[sp]
sw r4,16[sp]
sw lr,24[sp]
lc r3,Uart_rxhead
lc r2,Uart_rxtail
beq r2,r3,sgcfifo1 ; is there a char available ?
lea r3,Uart_rxfifo
lb r1,[r2+r3] ; get the char from the fifo into r1
addui r2,r2,#1 ; increment the fifo pointer
andi r2,r2,#0x1ff
sc r2,Uart_rxtail
lb r2,Uart_rxflow ; using flow control ?
beq r2,r0,sgcfifo2
lc r3,Uart_fon ; enough space in Rx buffer ?
call CharsInRxBuf
bgt r4,r3,sgcfifo2
sb r0,Uart_rxflow ; flow off
lb r4,Uart_rxrts
beq r4,r0,sgcfifo3
inb r4,UART_MC ; set rts bit in MC
ori r4,r4,#2
outb r4,UART_MC
sgcfifo3:
lb r4,Uart_rxdtr
beq r4,r0,sgcfifo4
inb r4,UART_MC ; set DTR
ori r4,r4,#1
outb r4,UART_MC
sgcfifo4:
lb r4,Uart_rxxon
beq r4,r0,sgcfifo5
setlo r4,#XON
outb r4,UART
sgcfifo5:
sgcfifo2: ; return with char in r1
lw r2,[sp]
lw r3,8[sp]
lw r4,16[sp]
lw lr,24[sp]
ret #32
sgcfifo1:
setlo r1,#-1 ; no char available
lw r2,[sp]
lw r3,8[sp]
lw r4,16[sp]
lw lr,24[sp]
ret #32
 
;-----------------------------------------
; Serial port IRQ
;-----------------------------------------
;
SerialIRQ:
subui sp,sp,#40
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw r4,24[sp]
sw lr,32[sp]
inb r1,UART_IS ; get interrupt status
bge r1,r0,sirq1
andi r1,r1,#0x7f ; switch on interrupt type
beqi r1,#4,srxirq
beqi r1,#0xC,stxirq
beqi r1,#0x10,smsirq
sirq1:
lw r1,[sp]
lw r2,8[sp]
lw r3,16[sp]
lw r4,24[sp]
lw lr,32[sp]
ret #40
 
; Get the modem status and record it
smsirq:
inb r1,UART_MS
sb r1,Uart_ms
bra sirq1
 
stxirq:
bra sirq1
 
; Get a character from the uart and store it in the rx fifo
srxirq:
srxirq1:
inb r1,UART ; get the char (clears interrupt)
lb r2,Uart_txxon
beq r2,r0,srxirq3
bnei r1,#XOFF,srxirq2
setlo r1,#1
sb r1,Uart_txxonoff
bra srxirq5
srxirq2:
bnei r1,#XON,srxirq3
sb r0,Uart_txxonoff
bra srxirq5
srxirq3:
sb r0,Uart_txxonoff
lc r2,Uart_rxhead
lea r3,Uart_rxfifo
sb r1,[r3+r2] ; store in buffer
addui r2,r2,#1
andi r2,r2,#0x1ff
sc r2,Uart_rxhead
srxirq5:
inb r1,UART_LS ; check for another ready character
andi r1,r1,#rxfull
bne r1,r0,srxirq1
lb r1,Uart_rxflow ; are we using flow controls?
bne r1,r0,srxirq8
call CharsInRxBuf
lc r1,Uart_foff
blt r4,r1,srxirq8
setlo r1,#1
sb r1,Uart_rxflow
lb r1,Uart_rxrts
beq r1,r0,srxirq6
inb r1,UART_MC
andi r1,r1,#0xFD ; turn off RTS
outb r1,UART_MC
srxirq6:
lb r1,Uart_rxdtr
beq r1,r0,srxirq7
inb r1,UART_MC
andi r1,r1,#0xFE ; turn off DTR
outb r1,UART_MC
srxirq7:
lb r1,Uart_rxxon
beq r1,r0,srxirq8
setlo r1,#XOFF
outb r1,UART
srxirq8:
bra sirq1
 
;==============================================================================
; Keyboard
; Keyboard BIOS
; BIOS interrupt #417
;
; Function in R1
; 0 = initialize keyboard
; 1 = set keyboard echo
; 2 = get keyboard character
; 3 = check for key available
;==============================================================================
;
KeybdSC:
subui sp,sp,#8
sw lr,[sp]
bnei r1,#0,kbdsc1
call KeybdInit
bra kbdscRet
kbdsc1:
bnei r1,#1,kbdsc2
mov r1,r2
call SetKeyboardEcho
bra kbdscRet
kbdsc2:
bnei r1,#2,kbdsc3
call KeybdGetChar
bra kbdscRet
kbdsc3:
bnei r1,#3,kbdsc4
call KeybdCheckForKey
bra kbdscRet
kbdsc4:
kbdscRet:
lw lr,[sp]
addui sp,sp,#8
eret
 
;------------------------------------------------------------------------------
; Initialize keyboard
;------------------------------------------------------------------------------
216,16 → 844,14
;------------------------------------------------------------------------------
;
KeybdIRQ:
subui sp,sp,#24
sm [sp],r1/r2/r3
subui sp,sp,#8
sw r2,[sp]
lbu r1,KeybdHead
andi r1,r1,#0x0f ; r1 = index into buffer
setlo r3,#<KeybdBuffer
sethi r3,#>KeybdBuffer
KeybdIRQa:
inch r2,KEYBD ; get keyboard character
outc r0,KEYBD+2 ; clear keyboard strobe (turns off the IRQ)
sb r2,[r3+r1] ; store character in buffer
sb r2,KeybdBuffer[r1] ; store character in buffer
addui r1,r1,#1 ; increment head index
andi r1,r1,#0x0f
sb r1,KeybdHead
236,9 → 862,8
andi r2,r2,#0x0f ; the oldest character will be lost
sb r2,KeybdTail
KeybdIRQc:
lm [sp],r1/r2/r3
addui sp,sp,#24
ret
lw r2,[sp]
ret #8
 
;------------------------------------------------------------------------------
; r1 0=echo off, non-zero = echo on
252,20 → 877,28
;-----------------------------------------
KeybdGetChar:
subui sp,sp,#16
sm [sp],r2/r3
sw r2,[sp]
sw lr,8[sp]
lbu r2,KeybdTail
lbu r1,KeybdHead
beq r1,r2,nochar
setlo r3,#KeybdBuffer
lbu r1,[r3+r2]
lbu r1,KeybdBuffer[r2]
addui r2,r2,#1
andi r2,r2,#0x0f
sb r2,KeybdTail
lm [sp],r2/r3
ret #16
lb r2,KeybdEcho
beq r2,r0,kgc3
bnei r1,#CR,kgc2
call CRLF ; convert CR keystroke into CRLF
bra kgc3
kgc2:
call DisplayChar
bra kgc3
nochar:
setlo r1,#-1
lm [sp],r2/r3
kgc3:
lw lr,8[sp]
lw r2,[sp]
ret #16
 
;------------------------------------------------------------------------------
275,12 → 908,8
KeybdCheckForKey:
lbu r1,KeybdTail
lbu r2,KeybdHead
beq r1,r2,kck1
setlo r1,#1
sne r1,r1,r2
ret
kck1:
xor r1,r1,r1 ; return zero
ret
 
;------------------------------------------------------------------------------
; Check if there is a keyboard character available. If so return true (1)
289,12 → 918,8
;
KeybdCheckForKeyDirect:
inch r1,KEYBD
bge r1,r0,cfkd1
setlo r1,#1
slt r1,r1,r0
ret
cfkd1:
xor r1,r1,r1 ; return 0 in r1
ret
 
;------------------------------------------------------------------------------
; Get character directly from keyboard. This routine blocks until a key is
303,7 → 928,8
;
KeybdGetCharDirect:
subui sp,sp,#16
sm [sp],r2/r31
sw r2,[sp]
sw lr,8[sp]
setlo r2,KEYBD
kgc1:
inch r1,KEYBD
318,76 → 944,196
gk2:
call DisplayChar
gk1:
lm [sp],r2/r31
lw r2,[sp]
lw lr,8[sp]
ret #16
 
;==============================================================================
;==============================================================================
;------------------------------------------------------------------------------
; 1000 Hz interrupt
; 100 Hz interrupt
; - takes care of "flashing" the cursor
;------------------------------------------------------------------------------
;
Pulse1000:
subui sp,sp,#24
sm [sp],r1/r2/lr
lw r1,Milliseconds
Pulse100:
subui sp,sp,#8
sw lr,[sp]
lea r2,TEXTSCR
inch r1,334[r2]
addui r1,r1,#1
sw r1,Milliseconds
setlo r2,TEXTSCR
lc r1,222[r2]
addui r1,r1,#1
sc r1,222[r2]
lc r0,0xFFFF_FFFF_FFFF_0000 ; clear interrupt
lw r1,Milliseconds
andi r1,r1,#0x7f
bnei r1,#64,p10001
call FlashCursor
p10001:
lm [sp],r1/r2/lr
ret #24
outc r1,334[r2]
call DisplayDatetime
call SelectNextToRunTCB
call SwitchTask
sb r0,0xFFFF_FFFF_FFFF_0010 ; clear interrupt
; lw r1,TickIRQAddr
; jal r31,[r1]
; lw r1,Milliseconds
; andi r1,r1,#0x0f
; bnei r1,#5,p1001
; call FlashCursor
p1001:
lw lr,[sp]
ret #8
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
SelectNextToRunTCB:
sc r0,NextToRunTCB
ret
 
;------------------------------------------------------------------------------
; Switch from the RunningTCB to the NextToRunTCB
;------------------------------------------------------------------------------
SwitchTask:
sw r1,r1save
sw r2,r2save
lcu r1,NextToRunTCB
lcu r2,RunningTCB
bne r1,r2,swtsk1 ; are we already running this TCB ?
lw r1,r1save
lw r2,r2save
ret
swtsk1:
andi r2,r2,#0x1ff ; max 512 TCB's
mului r2,r2,#TCBSize
addui r2,r2,#TCBBase
lw r1,r1save ; get back r1
sw r1,TCBr1[r2]
lw r1,r2save ; get back r2
sw r1,TCBr2[r2]
sw r3,TCBr3[r2]
sw r4,TCBr4[r2]
sw r5,TCBr5[r2]
sw r6,TCBr6[r2]
sw r7,TCBr7[r2]
sw r8,TCBr8[r2]
sw r9,TCBr9[r2]
sw r10,TCBr10[r2]
sw r11,TCBr11[r2]
sw r12,TCBr12[r2]
sw r13,TCBr13[r2]
sw r14,TCBr14[r2]
sw r15,TCBr15[r2]
sw r16,TCBr16[r2]
sw r17,TCBr17[r2]
sw r18,TCBr18[r2]
sw r19,TCBr19[r2]
sw r20,TCBr20[r2]
sw r21,TCBr21[r2]
sw r22,TCBr22[r2]
sw r23,TCBr23[r2]
sw r24,TCBr24[r2]
sw r25,TCBr25[r2]
sw r26,TCBr26[r2]
sw r27,TCBr27[r2]
sw r28,TCBr28[r2]
sw r29,TCBr29[r2]
sw r30,TCBr30[r2]
sw r31,TCBr31[r2]
 
lcu r2,NextToRunTCB
sc r2,RunningTCB
mului r2,r2,#TCBSize
addui r2,r2,#TCBBase
 
lw r1,TCBr1[r2]
lw r3,TCBr3[r2]
lw r4,TCBr4[r2]
lw r5,TCBr5[r2]
lw r6,TCBr6[r2]
lw r7,TCBr7[r2]
lw r8,TCBr8[r2]
lw r9,TCBr9[r2]
lw r10,TCBr10[r2]
lw r11,TCBr11[r2]
lw r12,TCBr12[r2]
lw r13,TCBr13[r2]
lw r14,TCBr14[r2]
lw r15,TCBr15[r2]
lw r16,TCBr16[r2]
lw r17,TCBr17[r2]
lw r18,TCBr18[r2]
lw r19,TCBr19[r2]
lw r20,TCBr20[r2]
lw r21,TCBr21[r2]
lw r22,TCBr22[r2]
lw r23,TCBr23[r2]
lw r24,TCBr24[r2]
lw r25,TCBr25[r2]
lw r26,TCBr26[r2]
lw r27,TCBr27[r2]
lw r28,TCBr28[r2]
lw r29,TCBr29[r2]
lw r30,TCBr30[r2]
lw r31,TCBr31[r2]
lw r2,TCBr2[r2]
ret
 
;------------------------------------------------------------------------------
; Flash Cursor
;------------------------------------------------------------------------------
;
FlashCursor:
subui sp,sp,#32
sm [sp],r1/r2/r3/r31
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
call CalcScreenLoc
addui r1,r1,#0x10000
lb r2,CursorFlash
beq r2,r0,flshcrsr2
; causes screen colors to flip around
lc r2,[r1]
inch r2,[r1]
addui r2,r2,#1
sc r2,[r1]
outc r2,[r1]
flshcrsr3:
lw r2,Lastloc
beq r1,r2,flshcrsr1
; restore the screen colors of the previous cursor location
lc r3,ScreenColor
sc r3,[r2]
outc r3,[r2]
sw r1,Lastloc
flshcrsr1:
lm [sp],r1/r2/r3/r31
lw r1,[sp]
lw r2,8[sp]
lw r3,16[sp]
lw lr,24[sp]
ret #32
flshcrsr2:
lc r3,ScreenColor
outc r3,[r1]
bra flshcrsr3
 
CursorOff:
lw r1,#0xA0
outc r1,TEXTREG+16 ; turn off cursor
ret
CursorOn:
lw r1,#0xE0
outc r1,TEXTREG+16 ; turn on cursor
ret
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
ClearBmpScreen:
subui sp,sp,#40
sm [sp],r1/r2/r3/r4/r31
setlo r1,#1364 ; calc number to clear
setlo r2,#768
mulu r2,r1,r2 ; r2 = # pixels to clear
or r4,r0,r2 ; r4 = # pixels to clear
setlo r1,#0x29292929 ;
setlo r3,#<BITMAPSCR ; screen address
sethi r3,#>BITMAPSCR
subui sp,sp,#24
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
lw r2,#1364*768
shrui r2,r2,#3 ; r2 = # words to clear
lea r1,0x2929292929292929 ; r1 = color for eight pixels
lea r3,BITMAPSCR ; r3 = screen address
csj4:
sh r1,[r3]
addui r3,r3,#4
loop r2,csj4
lm [sp],r1/r2/r3/r4/r31
ret #40
sw r1,[r3] ; store pixel data
addui r3,r3,#8 ; advance screen address by eight
loop r2,csj4 ; decrement pixel count and loop back
lw r1,[sp]
lw r2,8[sp]
lw r3,16[sp]
ret #24
 
;------------------------------------------------------------------------------
; Clear the screen and the screen color memory
397,21 → 1143,29
;
ClearScreen:
subui sp,sp,#40
sm [sp],r1/r2/r3/r4/r31
setlo r3,#TEXTREG
lc r1,TEXT_COLS[r3] ; calc number to clear
lc r2,TEXT_ROWS[r3]
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw r4,24[sp]
sw lr,32[sp]
lea r3,TEXTREG
inch r1,TEXT_COLS[r3] ; calc number to clear
inch r2,TEXT_ROWS[r3]
mulu r2,r1,r2 ; r2 = # chars to clear
setlo r1,#32 ; space char
lc r4,ScreenColor
call AsciiToScreen
setlo r3,#TEXTSCR ; text screen address
lea r3,TEXTSCR ; text screen address
csj4:
sc r1,[r3]
sc r4,0x10000[r3] ; color screen is 0x10000 higher
addu r3,r3,#2
outc r1,[r3]
outc r4,0x10000[r3] ; color screen is 0x10000 higher
addui r3,r3,#2
loop r2,csj4
lm [sp],r1/r2/r3/r4/r31
lw lr,32[sp]
lw r4,24[sp]
lw r3,16[sp]
lw r2,8[sp]
lw r1,[sp]
ret #40
 
;------------------------------------------------------------------------------
420,24 → 1174,32
;
ScrollUp:
subui sp,sp,#40
sm [sp],r1/r2/r3/r4/r31
setlo r3,#TEXTREG
lc r1,TEXT_COLS[r3] ; r1 = # text columns
lc r2,TEXT_ROWS[r3]
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw r4,24[sp]
sw lr,32[sp]
lea r3,TEXTREG
inch r1,TEXT_COLS[r3] ; r1 = # text columns
inch r2,TEXT_ROWS[r3]
mulu r2,r1,r2 ; calc number of chars to scroll
subu r2,r2,r1 ; one less row
setlo r3,#TEXTSCR
lea r3,TEXTSCR
scrup1:
lc r4,[r3+r1] ; indexed addressing example
sc r4,[r3]
inch r4,[r3+r1] ; indexed addressing example
outc r4,[r3]
addui r3,r3,#2
loop r2,scrup1
 
setlo r3,#TEXTREG
lc r1,TEXT_ROWS[r3]
lea r3,TEXTREG
inch r1,TEXT_ROWS[r3]
subui r1,r1,#1
call BlankLine
lm [sp],r1/r2/r3/r4/r31
lw r1,[sp]
lw r2,8[sp]
lw r3,16[sp]
lw r4,24[sp]
lw lr,32[sp]
ret #40
 
;------------------------------------------------------------------------------
447,18 → 1209,22
;
BlankLine:
subui sp,sp,#24
sm [sp],r1/r2/r3
setlo r3,TEXTREG ; r3 = text register address
lc r2,TEXT_COLS[r3] ; r2 = # chars to blank out
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
lea r3,TEXTREG ; r3 = text register address
inch r2,TEXT_COLS[r3] ; r2 = # chars to blank out
mulu r3,r2,r1
shli r3,r3,#1
addui r3,r3,#TEXTSCR ; r3 = screen address
setlo r1,#' '
blnkln1:
sc r1,[r3]
outc r1,[r3]
addui r3,r3,#2
loop r2,blnkln1
lm [sp],r1/r2/r3
lw r1,[sp]
lw r2,8[sp]
lw r3,16[sp]
ret #24
 
;------------------------------------------------------------------------------
497,7 → 1263,7
CalcScreenLoc:
lc r1,CursorRow
andi r1,r1,#0x7f
setlo r3,TEXTREG
lea r3,TEXTREG
inch r2,TEXT_COLS[r3]
mulu r2,r2,r1
lc r1,CursorCol
516,13 → 1282,19
DisplayChar:
bnei r1,#'\r',dccr ; carriage return ?
subui sp,sp,#32
sm [sp],r1/r2/r3/lr
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
sc r0,CursorCol ; just set cursor column to zero on a CR
bra dcx7
dccr:
bnei r1,#0x91,dcx6 ; cursor right ?
subui sp,sp,#32
sm [sp],r1/r2/r3/lr
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
lc r2,CursorCol
beqi r2,#56,dcx7
addui r2,r2,#1
529,12 → 1301,18
sc r2,CursorCol
dcx7:
call CalcScreenLoc
lm [sp],r1/r2/r3/lr
lw lr,24[sp]
lw r3,16[sp]
lw r2,8[sp]
lw r1,[sp]
ret #32
dcx6:
bnei r1,#0x90,dcx8 ; cursor up ?
subui sp,sp,#32
sm [sp],r1/r2/r3/lr
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
lc r2,CursorRow
beqi r2,#0,dcx7
subui r2,r2,#1
543,7 → 1321,10
dcx8:
bnei r1,#0x93,dcx9 ; cursor left ?
subui sp,sp,#32
sm [sp],r1/r2/r3/lr
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
lc r2,CursorCol
beqi r2,#0,dcx7
subui r2,r2,#1
552,7 → 1333,10
dcx9:
bnei r1,#0x92,dcx10 ; cursor down ?
subui sp,sp,#32
sm [sp],r1/r2/r3/lr
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
lc r2,CursorRow
beqi r2,#30,dcx7
addui r2,r2,#1
561,7 → 1345,10
dcx10:
bnei r1,#0x94,dcx11 ; cursor home ?
subui sp,sp,#32
sm [sp],r1/r2/r3/lr
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
lc r2,CursorCol
beq r2,r0,dcx12
sc r0,CursorCol
571,7 → 1358,12
bra dcx7
dcx11:
subui sp,sp,#48
sm [sp],r1/r2/r3/r4/r5/r31
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw r4,24[sp]
sw r5,32[sp]
sw lr,40[sp]
bnei r1,#0x99,dcx13 ; delete ?
call CalcScreenLoc
or r3,r0,r1 ; r3 = screen location
587,15 → 1379,16
or r3,r0,r1 ; r3 = screen location
lc r1,CursorCol
dcx5:
lc r2,2[r3]
sc r2,[r3]
inch r2,2[r3]
outc r2,[r3]
addui r3,r3,#2
addui r1,r1,#1
setlo r4,#TEXTREG
lea r4,TEXTREG
inch r5,TEXT_COLS[r4]
bltu r1,r5,dcx5
setlo r2,#' '
sc r2,-2[r3]
setlo r1,#' '
call AsciiToScreen
outc r1,-2[r3]
bra dcx4
dcx3:
beqi r1,#'\n',dclf ; linefeed ?
604,14 → 1397,18
or r3,r0,r1 ; r3 = screen location
or r1,r0,r4 ; restore r1
call AsciiToScreen ; convert ascii char to screen char
sc r1,[r3]
outc r1,[r3]
call IncCursorPos
lm [sp],r1/r2/r3/r4/r5/r31
ret #48
bra dcx4
dclf:
call IncCursorRow
dcx4:
lm [sp],r1/r2/r3/r4/r5/r31
lw lr,40[sp]
lw r5,32[sp]
lw r4,24[sp]
lw r3,16[sp]
lw r2,8[sp]
lw r1,[sp]
ret #48
 
 
621,7 → 1418,10
;
IncCursorPos:
subui sp,sp,#32
sm [r30],r1/r2/r3/r31
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
lc r1,CursorCol
addui r1,r1,#1
sc r1,CursorCol
631,7 → 1431,10
bra icr1
IncCursorRow:
subui sp,sp,#32
sm [sp],r1/r2/r3/r31
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
icr1:
lc r1,CursorRow
addui r1,r1,#1
643,7 → 1446,10
call ScrollUp
icc1:
call CalcScreenLoc
lm [sp],r1/r2/r3/r31
lw lr,24[sp]
lw r3,16[sp]
lw r2,8[sp]
lw r1,[sp]
ret #32
 
;------------------------------------------------------------------------------
652,8 → 1458,10
;
DisplayString:
subi sp,sp,#24
sm [sp],r1/r2/r31
or r2,r1,r0 ; r2 = pointer to string
sw r1,[sp]
sw r2,8[sp]
sw lr,16[sp]
mov r2,r1 ; r2 = pointer to string
dspj1:
lbu r1,[r2] ; move string char into r1
addui r2,r2,#1 ; increment pointer
661,7 → 1469,9
call DisplayChar ; display character
bra dspj1 ; go back for next character
dsret:
lm [r30],r1/r2/r31
lw lr,16[sp]
lw r2,8[sp]
lw r1,[sp]
ret #24
 
DisplayStringCRLF:
673,14 → 1483,14
 
CRLF:
subui r30,r30,#16
sw r1,[r30]
sw r31,8[r30]
sw r1,[sp]
sw lr,8[sp]
setlo r1,#'\r'
call DisplayChar
setlo r1,#'\n'
call DisplayChar
lw r1,[r30]
lw r31,8[r30]
lw lr,8[sp]
lw r1,[sp]
ret #16
 
;------------------------------------------------------------------------------
688,9 → 1498,9
;------------------------------------------------------------------------------
;
DisplayNybble:
subui r30,r30,#16
sw r31,8[r30]
sw r1,[r30]
subui sp,sp,#16
sw r1,[sp]
sw lr,8[sp]
andi r1,r1,#0x0F
addui r1,r1,#'0'
bleui r1,#'9',dispnyb1
697,8 → 1507,8
addui r1,r1,#7
dispnyb1:
call DisplayChar
lw r1,[r30]
lw r31,8[r30]
lw lr,8[sp]
lw r1,[sp]
ret #16
 
;------------------------------------------------------------------------------
707,12 → 1517,14
;
DisplayByte:
subui sp,sp,#16
sm [sp],r1/r31
sw r1,[sp]
sw lr,8[sp]
rori r1,r1,#4
call DisplayNybble
roli r1,r1,#4
call DisplayNybble
lm [sp],r1/r31
lw lr,8[sp]
lw r1,[sp]
ret #16
 
;------------------------------------------------------------------------------
721,13 → 1533,17
;
DisplayWord:
subui sp,sp,#24
sm [sp],r1/r3/r31
sw r1,[sp]
sw r3,8[sp]
sw lr,16[sp]
setlo r3,#7
dspwd1:
roli r1,r1,#8
call DisplayByte
loop r3,dspwd1
lm [sp],r1/r3/r31
lw lr,16[sp]
lw r3,8[sp]
lw r1,[sp]
ret #24
 
;------------------------------------------------------------------------------
736,11 → 1552,13
;------------------------------------------------------------------------------
;
DisplayMem:
subui sp,sp,#8
sw lr,[sp]
subui sp,sp,#24
sw r1,[sp]
sw r3,8[sp]
sw lr,16[sp]
setlo r1,#':'
call DisplayChar
or r1,r2,r0
mov r1,r2
call DisplayWord
setlo r3,#7
dspmem1:
751,8 → 1569,10
addui r2,r2,#1
loop r3,dspmem1
call CRLF
lw lr,[sp]
ret #8
lw lr,16[sp]
lw r3,8[sp]
lw r1,[sp]
ret #24
 
;------------------------------------------------------------------------------
; Converts binary number in r1 into BCD number in r2 and r1.
760,7 → 1580,12
;
BinToBCD:
subui sp,sp,#48
sm [sp],r3/r4/r5/r6/r7/r8
sw r3,[sp]
sw r4,8[sp]
sw r5,16[sp]
sw r6,24[sp]
sw r7,32[sp]
sw r8,40[sp]
setlo r2,#10
setlo r8,#19 ; number of digits to produce - 1
bta1:
777,9 → 1602,14
shli r6,r5,#16
or r4,r4,r6 ; copy bits into r4
shrui r5,r5,#48
or r1,r0,r4
or r2,r0,r5
lm [sp],r3/r4/r5/r6/r7/r8
mov r1,r4
mov r2,r5
lw r3,[sp]
lw r4,8[sp]
lw r5,16[sp]
lw r6,24[sp]
lw r7,32[sp]
lw r8,40[sp]
ret #48
 
;------------------------------------------------------------------------------
788,7 → 1618,10
;
BCDToAscii:
subui sp,sp,#32
sm [sp],r3/r4/r5/r8
sw r3,[sp]
sw r4,8[sp]
sw r5,16[sp]
sw r8,24[sp]
setlo r8,#15
bta2:
andi r2,r1,#0x0F
801,9 → 1634,12
or r3,r3,r2
shrui r1,r1,#4
loop r8,bta2
or r1,r0,r4
or r2,r0,r3
lm [sp],r3/r4/r5/r8
mov r1,r4
mov r2,r3
lw r3,[sp]
lw r4,8[sp]
lw r5,16[sp]
lw r8,24[sp]
ret #32
 
;------------------------------------------------------------------------------
814,10 → 1650,16
;
BinToStr:
subui sp,sp,#56
sm [sp],r3/r7/r8/r9/r10/r11/r31
or r11,r0,r2
sw r3,[sp]
sw r7,8[sp]
sw r8,16[sp]
sw r9,24[sp]
sw r10,32[sp]
sw r11,40[sp]
sw lr,48[sp]
mov r11,r2
call BinToBCD
or r10,r0,r2 ; save off r2
mov r10,r2 ; save off r2
call BCDToAscii
setlo r9,#1
btos3:
830,10 → 1672,10
sb r3,[r7+r11]
shrui r1,r1,#8
loop r8,btos1
or r1,r0,r2
mov r1,r2
loop r9,btos3
; the last four digits
or r1,r0,r10 ; get back r2
mov r1,r10 ; get back r2
call BCDToAscii
setlo r8,#3
btos2:
842,7 → 1684,13
shrui r1,r1,#8
loop r8,btos2
sb r0,20[r11] ; null terminate
lm [sp],r3/r7/r8/r9/r10/r11/r31
lw r3,[sp]
lw r7,8[sp]
lw r8,16[sp]
lw r9,24[sp]
lw r10,32[sp]
lw r11,40[sp]
lw lr,48[sp]
ret #56
 
 
849,7 → 1697,7
;==============================================================================
;==============================================================================
Monitor:
setlo sp,#STACKTOP ; top of stack; reset the stack pointer
lea sp,STACKTOP0 ; top of stack; reset the stack pointer
sb r0,KeybdEcho ; turn off keyboard echo
PromptLn:
call CRLF
871,11 → 1719,11
sc r0,CursorCol ; go back to the start of the line
call CalcScreenLoc ; r1 = screen memory location
or r3,r1,r0
lc r1,[r3]
inch r1,[r3]
addui r3,r3,#2
call ScreenToAscii
bnei r1,#'$',Prompt2 ; skip over '$' prompt character
lc r1,[r3]
inch r1,[r3]
addui r3,r3,#2
call ScreenToAscii
 
884,19 → 1732,26
Prompt2:
beqi r1,#':',Editmem ; $: - edit memory
beqi r1,#'D',Dumpmem ; $D - dump memory
beqi r1,#'B',START ; $B - start tiny basic
beqi r1,#'B',CSTART ; $B - start tiny basic
beqi r1,#'J',ExecuteCode ; $J - execute code
beqi r1,#'L',LoadS19 ; $L - load S19 file
beqi r1,#'?',DisplayHelp ; $? - display help
beqi r1,#'C',TestCLS ; $C - clear screen
beqi r1,#'R',RandomLinesCall
beqi r1,#'I',Invaders
beqi r1,#'P',Piano
bra Monitor
 
RandomLinesCall:
call RandomLines
bra Monitor
 
TestCLS:
lc r1,[r3]
inch r1,[r3]
addui r3,r3,#2
call ScreenToAscii
bnei r1,#'L',Monitor
lc r1,[r3]
inch r1,[r3]
addui r3,r3,#2
call ScreenToAscii
bnei r1,#'S',Monitor
919,7 → 1774,10
db "L = Load S19 file",CR,LF
db "D = Dump memory",CR,LF
db "B = start tiny basic",CR,LF
db "J = Jump to code",CR,LF,0
db "J = Jump to code",CR,LF
db "I = Invaders",CR,LF
db "R = Random lines",CR,LF
db "P = Piano",CR,LF,0
align 16
 
;------------------------------------------------------------------------------
932,7 → 1790,7
subui sp,sp,#8
sw r31,[sp]
ignBlanks1:
lc r1,[r3]
inch r1,[r3]
addui r3,r3,#2
call ScreenToAscii
beqi r1,#' ',ignBlanks1
964,8 → 1822,7
ExecuteCode:
call ignBlanks
call GetHexNumber
or r3,r1,r0
jal r31,[r3]
jal r31,[r1]
bra Monitor
 
;------------------------------------------------------------------------------
975,7 → 1832,7
DumpMem:
call ignBlanks
call GetHexNumber
or r2,r1,r0
mov r2,r1
call CRLF
call DisplayMem
call DisplayMem
990,15 → 1847,18
;------------------------------------------------------------------------------
; Get a hexidecimal number. Maximum of sixteen digits.
; R3 = text pointer (updated)
; R1 = hex number
;------------------------------------------------------------------------------
;
GetHexNumber:
subui sp,sp,#24
sm [sp],r2/r4/r31
sw r2,[sp]
sw r4,8[sp]
sw lr,16[sp]
setlo r2,#0
setlo r4,#15
gthxn2:
lc r1,[r3]
inch r1,[r3]
addui r3,r3,#2
call ScreenToAscii
call AsciiToHexNybble
1008,8 → 1868,10
or r2,r2,r1
loop r4,gthxn2
gthxn1:
or r1,r2,r0
lm [sp],r2/r4/r31
mov r1,r2
lw lr,16[sp]
lw r4,8[sp]
lw r2,[sp]
ret #24
 
;------------------------------------------------------------------------------
1194,71 → 2056,3079
beqi r1,#CRTLC,Monitor
sgc1:
call AUXIN
beq r1,r0,sgc2
ble r1,r0,sgc2
lw r31,[sp]
addui sp,sp,#8
ret
ret #8
 
;--------------------------------------------------------------------------
; Sound a 800 Hz beep
; Draw random lines on the bitmap screen.
;--------------------------------------------------------------------------
RandomLines:
subui sp,sp,#24
sw r1,[sp]
sw r3,8[sp]
sw lr,16[sp]
rl5:
gran
mfspr r1,rand ; select a random color
outh r1,GACCEL
rl1: ; random X0
gran
mfspr r1,rand
lw r3,#1364
mod r1,r1,r3
outh r1,GACCEL+8
rl2: ; random X1
gran
mfspr r1,rand
lw r3,#1364
mod r1,r1,r3
outh r1,GACCEL+16
rl3: ; random Y0
gran
mfspr r1,rand
lw r3,#768
mod r1,r1,r3
outh r1,GACCEL+12
rl4: ; random Y1
gran
mfspr r1,rand
lw r3,#768
mod r1,r1,r3
outh r1,GACCEL+20
setlo r1,#2 ; draw line command
outh r1,GACCEL+60
rl8:
call KeybdGetChar
beqi r1,#CTRLC,rl7
beqi r1,#'r',rl5
bra rl8
rl7:
lw lr,16[sp]
lw r3,8[sp]
lw r1,[sp]
ret #24
 
;--------------------------------------------------------------------------
; Initialize sprite image caches with random data.
;--------------------------------------------------------------------------
RandomizeSprram:
lea r2,SPRRAM
setlo r4,#14335 ; number of chars to initialize
rsr1:
gran
mfspr r1,rand
outc r1,[r2]
addui r2,r2,#2
loop r4,rsr1
ret
;--------------------------------------------------------------------------
; Setup the AC97/LM4550 audio controller. Check keyboard for a CTRL-C
; interrupt which may be necessary if the audio controller isn't
; responding.
;--------------------------------------------------------------------------
;
SetupAC97:
ori r1,r0,#0 ; trigger a read of register 26
sc r1,AC97+0x26
subui sp,sp,#16
sw r1,[sp]
sw lr,8[sp]
sac974:
outc r0,AC97+0x26 ; trigger a read of register 26 (status reg)
sac971: ; wait for status to register 0xF (all ready)
lc r1,AC97+0x26
bnei r1,#0x0F,sac971
ori r1,r0,#0 ; master volume, 0db attenuation, mute off
sc r1,AC97+2
sc r1,AC97+4 ; headphone volume, 0db attenuation, mute off
ori r1,r0,#8000 ; wait a while for the settings to take effect
sac972:
loop r1,sac972
call KeybdGetChar ; see if we needed to CTRL-C
beqi r1,#CTRLC,sac973
outc r1,AC97+0x68 ; wait for dirty bit to clear
bne r1,r0,sac971
outc r1,AC97+0x26 ; check status at reg h26, wait for
andi r1,r1,#0x0F ; analogue to be ready
bnei r1,#0x0F,sac974
sac973:
outc r0,AC97+2 ; master volume, 0db attenuation, mute off
outc r0,AC97+4 ; headphone volume, 0db attenuation, mute off
outc r0,AC97+0x18 ; PCM gain (mixer) mute off, no attenuation
outc r0,AC97+0x0A ; mute PC beep
setlo r1,#0x8000 ; bypass 3D sound
outc r1,AC97+0x20
sac972:
call KeybdGetChar
beqi r1,#CTRLC,sac975
outc r1,AC97+0x68 ; wait for dirty bits to clear
bne r1,r0,sac972 ; wait a while for the settings to take effect
sac975:
lw lr,8[sp]
lw r1,[sp]
ret #16
 
;--------------------------------------------------------------------------
; Sound a 800 Hz beep
;--------------------------------------------------------------------------
;
Beep:
subui sp,sp,#16
sw r1,[sp]
sw lr,8[sp]
setlo r1,#8
outb r1,LED
ori r1,r0,#15 ; master volume to max
sc r1,PSG+128
outc r1,PSG+128
ori r1,r0,#13422 ; 800Hz
sc r1,PSG
ori r1,r0,#32 ; attack (8.192 ms)
sc r1,PSG+8
ori r1,r0,#64 ; decay (16.384 ms)
sc r1,PSG+10
ori r1,r0,#0xC0 ; sustain level
sc r1,PSG+12
ori r1,r0,#4000 ; release (1.024 s)
sc r1,PSG+14
outc r1,PSGFREQ0
setlo r1,#9
outb r1,LED
; decay (16.384 ms)2
; attack (8.192 ms)1
; release (1.024 s)A
; sustain level C
setlo r1,#0xCA12
outc r1,PSGADSR0
ori r1,r0,#0x1104 ; gate, output enable, triangle waveform
sc r1,PSG+4
outc r1,PSGCTRL0
ori r1,r0,#25000000 ; delay about 1s
beep1:
loop r1,beep1
setlo r1,#13
outb r1,LED
ori r1,r0,#0x0104 ; gate off, output enable, triangle waveform
outc r1,PSGCTRL0
ori r1,r0,#25000000 ; delay about 1s
beep2:
loop r1,beep2
setlo r1,#16
outb r1,LED
ori r1,r0,#0x0000 ; gate off, output enable off, no waveform
outc r1,PSGCTRL0
lw lr,8[sp]
lw r1,[sp]
ret #16
 
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
;
Piano:
ori r1,r0,#15 ; master volume to max
outc r1,PSG+128
playnt:
call KeybdGetChar
beqi r1,#CTRLC,Monitor
beqi r1,#'a',playnt1a
beqi r1,#'b',playnt1b
beqi r1,#'c',playnt1c
beqi r1,#'d',playnt1d
beqi r1,#'e',playnt1e
beqi r1,#'f',playnt1f
beqi r1,#'g',playnt1g
bra playnt
 
playnt1a:
setlo r1,#7217
call Tone
bra playnt
playnt1b:
setlo r1,#8101
call Tone
bra playnt
playnt1c:
setlo r1,#4291
call Tone
bra playnt
playnt1d:
setlo r1,#4817
call Tone
bra playnt
playnt1e:
setlo r1,#5407
call Tone
bra playnt
playnt1f:
setlo r1,#5728
call Tone
bra playnt
playnt1g:
setlo r1,#6430
call Tone
bra playnt
 
Tone:
subui sp,sp,#16
sw r1,[sp]
sw lr,8[sp]
outc r1,PSGFREQ0
; decay (16.384 ms)2
; attack (8.192 ms)1
; release (1.024 s)A
; sustain level C
setlo r1,#0xCA12
outc r1,PSGADSR0
ori r1,r0,#0x1104 ; gate, output enable, triangle waveform
outc r1,PSGCTRL0
ori r1,r0,#250000 ; delay about 10ms
tone1:
loop r1,tone1
ori r1,r0,#0x0104 ; gate off, output enable, triangle waveform
outc r1,PSGCTRL0
ori r1,r0,#250000 ; delay about 10ms
tone2:
loop r1,tone2
ori r1,r0,#0x0000 ; gate off, output enable off, no waveform
outc r1,PSGCTRL0
lw lr,8[sp]
lw r1,[sp]
ret #16
 
;==============================================================================
;==============================================================================
SetupRasterIRQ:
subui sp,sp,#8
sw r1,[sp]
setlo r1,#200
outc r1,RASTERIRQ
setlo r1,#240
outc r1,RASTERIRQ+2
setlo r1,#280
outc r1,RASTERIRQ+4
setlo r1,#320
outc r1,RASTERIRQ+6
setlo r1,#360
outc r1,RASTERIRQ+8
lw r1,[sp]
ret #8
 
RasterIRQfn:
inch r1,RASTERIRQ+30 ; get the raster compare register # (clears IRQ)
beqi r1,#1,rirq1
beqi r1,#2,rirq2
beqi r1,#3,rirq3
beqi r1,#4,rirq4
beqi r1,#5,rirq5
beqi r1,#6,rirq6
beqi r1,#7,rirq7
beqi r1,#8,rirq8
ret
rirq1:
rirq2:
rirq3:
rirq4:
rirq5:
rirq6:
rirq7:
rirq8:
mului r1,r1,#40
addui r1,r1,#204
outc r1,SPRITEREGS+2
outc r1,SPRITEREGS+18
outc r1,SPRITEREGS+34
outc r1,SPRITEREGS+50
outc r1,SPRITEREGS+66
outc r1,SPRITEREGS+82
outc r1,SPRITEREGS+98
outc r1,SPRITEREGS+114
ret
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
DisplayDatetime:
subui sp,sp,#32
sw r1,[sp]
sw r2,8[sp]
sw r3,16[sp]
sw lr,24[sp]
call CursorOff
lc r2,CursorRow
lc r3,CursorCol
outw r0,DATETIME+24 ; trigger a snapshot
lw r1,#46 ; move cursor down to last display line
sc r1,CursorRow
lw r1,#64
sc r1,CursorCol
inw r1,DATETIME ; get the snapshotted date and time
call DisplayWord ; display on screen
sc r2,CursorRow ; restore cursor position
sc r3,CursorCol
call CalcScreenLoc
call CursorOn
lw lr,24[sp]
lw r3,16[sp]
lw r2,8[sp]
lw r1,[sp]
ret #32
 
;==============================================================================
;==============================================================================
InitializeGame:
subui sp,sp,#16
sm [sp],r3/lr
setlo r3,#320
sc r3,Manpos
sc r0,Score
sb r0,MissileActive
sc r0,MissileX
sc r0,MissileY
lm [sp],r3/lr
ret #16
 
DrawScore:
subui sp,sp,#24
sm [sp],r1/r3/lr
setlo r3,#1
sb r3,CursorRow
setlo r3,#40
sb r3,CursorCol
lb r1,Score
call DisplayByte
lb r1,Score+1
call DisplayByte
lm [sp],r1/r3/lr
ret #24
 
DrawMissile:
subui sp,sp,#16
sm [sp],r1/lr
lc r1,MissileY
bleu r1,#2,MissileOff
lc r1,MissileX
shrui r1,r1,#3
sb r1,CursorCol
lc r1,MissileY
sb r1,CursorRow
subui r1,r1,#1
sc r1,MissileY
setlo r1,#'^'
call DisplayChar
lb r1,CursorCol
subui r1,r1,#1
sb r1,CursorCol
lb r1,CursorRow
subui r1,r1,#1
sb r1,CursorRow
setlo r1,#' '
call DisplayChar
lm [sp],r1/lr
ret #16
MissileOff:
sb r0,MissileActive
lc r1,MissileX
shrui r1,r1,#3
sb r1,CursorCol
lc r1,MissileY
sb r1,CursorRow
setlo r1,#' '
call DisplayChar
lm [sp],r1/lr
ret #16
 
DrawMan:
subui sp,sp,#24
sm [sp],r1/r3/lr
setlo r3,#46
sb r3,CursorRow
lc r3,Manpos
shrui r3,r3,#3
sb r3,CursorCol
setlo r1,#' '
call DisplayChar
setlo r1,#'#'
call DisplayChar
setlo r1,#'A'
call DisplayChar
setlo r1,#'#'
call DisplayChar
setlo r1,#' '
call DisplayChar
lm [sp],r1/r3/lr
ret #24
 
DrawInvader:
lw r3,InvaderPos
lw r1,#233
sc r1,[r3]
lw r1,#242
sc r1,1[r3]
lw r1,#223
sc r1,2[r3]
ret
 
DrawInvaders:
subui sp,sp,#40
sm [sp],r1/r2/r3/r4/lr
lc r1,InvadersRow1
lc r4,InvadersColpos
andi r2,r1,#1
beq r2,r0,dinv1
lb r3,InvadersRowpos
sb r3,CursorRow
sb r4,CursorCol
setlo r1,#' '
call DisplayByte
setlo r1,#'#'
call DisplayByte
setlo r1,#'#'
call DisplayByte
setlo r1,#'#'
call DisplayByte
setlo r1,#' '
call DisplayByte
lb r1,CursorRow
addui r1,r1,#1
sb r1,CursorRow
lb r1,CursorCol
subui r1,r1,#5
setlo r1,#' '
call DisplayByte
setlo r1,#'X'
call DisplayByte
setlo r1,#' '
call DisplayByte
setlo r1,#'X'
call DisplayByte
setlo r1,#' '
call DisplayByte
dinv1:
lm [sp],r1/r2/r3/r4/lr
ret #40
DrawBombs:
ret
 
Invaders:
subui sp,#240
sm [sp],r1/r2/r3/r4/lr
call InitializeGame
InvadersLoop:
call DrawScore
call DrawInvaders
call DrawBombs
call DrawMissile
call DrawMan
TestMoveMan:
call KeybdGetChar
beqi r1,#'k',MoveManRight
beqi r1,#'j',MoveManLeft
beqi r1,#' ',FireMissile
bra Invaders1
MoveManRight:
lc r2,Manpos
bgtu r2,#640,Invaders1
addui r2,r2,#8
sc r2,Manpos
bra Invaders1
MoveManLeft:
lc r2,Manpos
ble r2,r0,Invaders1
subui r2,r2,#8
sc r2,Manpos
bra Invaders1
FireMissile:
lb r2,MissileActive
bne r2,r0,Invaders1
setlo r2,#1
sb r2,MissileActive
lc r2,Manpos
sc r2,MissileX
setlo r2,#46
sc r2,MissileY
bra Invaders1
Invaders1:
beqi r1,#CTRLC,InvadersEnd
bra InvadersLoop
InvadersEnd:
lm [sp],r1/r2/r3/r4/lr
addui sp,sp,#240
bra Monitor
 
;==============================================================================
;==============================================================================
;****************************************************************;
; ;
; Tiny BASIC for the Raptor64 ;
; ;
; Derived from a 68000 derivative of Palo Alto Tiny BASIC as ;
; published in the May 1976 issue of Dr. Dobb's Journal. ;
; Adapted to the 68000 by: ;
; Gordon brndly ;
; 12147 - 51 Street ;
; Edmonton AB T5W 3G8 ;
; Canada ;
; (updated mailing address for 1996) ;
; ;
; Adapted to the Raptor64 by: ;
; Robert Finch ;
; Ontario, Canada ;
; robfinch<remove>@opencores.org ;
;****************************************************************;
; Copyright (C) 2012 by Robert Finch. This program may be ;
; freely distributed for personal use only. All commercial ;
; rights are reserved. ;
;****************************************************************;
;
; Register Usage
; r8 = text pointer (global usage)
; r3,r4 = inputs parameters to subroutines
; r2 = return value
;
;* Vers. 1.0 1984/7/17 - Original version by Gordon brndly
;* 1.1 1984/12/9 - Addition of '0x' print term by Marvin Lipford
;* 1.2 1985/4/9 - Bug fix in multiply routine by Rick Murray
 
;
; Standard jump table. You can change these addresses if you are
; customizing this interpreter for a different environment.
;
GOSTART:
jmp CSTART ; Cold Start entry point
GOWARM:
jmp WSTART ; Warm Start entry point
GOOUT:
jmp OUTC ; Jump to character-out routine
GOIN:
jmp INC ;Jump to character-in routine
GOAUXO:
jmp AUXOUT ; Jump to auxiliary-out routine
GOAUXI:
jmp AUXIN ; Jump to auxiliary-in routine
GOBYE:
jmp BYEBYE ; Jump to monitor, DOS, etc.
;
; Modifiable system constants:
;
align 8
TXTBGN dw 0x000000001_00600000 ;TXT ;beginning of program memory
ENDMEM dw 0x000000001_07FFFFF8 ; end of available memory
;
; The main interpreter starts here:
;
; Usage
; r1 = temp
; r8 = text buffer pointer
; r12 = end of text in text buffer
;
align 16
CSTART:
; First save off the link register and OS sp value
subui sp,sp,#8
sw lr,[sp]
sw sp,OSSP
lw sp,ENDMEM ; initialize stack pointer
subui sp,sp,#8
sw lr,[sp] ; save off return address
sc r0,CursorRow ; set screen output
sc r0,CursorCol
sb r0,CursorFlash
sw r0,pos
lw r2,#0x10000020 ; black chars, yellow background
sh r2,charToPrint
call ClearScreen
lea r1,msgInit ; tell who we are
call PRMESGAUX
lea r1,msgInit ; tell who we are
call PRMESG
lw r1,TXTBGN ; init. end-of-program pointer
sw r1,TXTUNF
lw r1,ENDMEM ; get address of end of memory
subui r1,r1,#2048 ; reserve 2K for the stack
sw r1,STKBOT
subui r1,r1,#8192 ; 1000 vars
sw r1,VARBGN
call clearVars ; clear the variable area
lw r1,VARBGN ; calculate number of bytes free
lw r3,TXTUNF
sub r1,r1,r3
setlo r2,#0
call PRTNUM
lea r1,msgBytesFree
call PRMESG
WSTART:
sw r0,LOPVAR ; initialize internal variables
sw r0,STKGOS
sw r0,CURRNT ; current line number pointer = 0
lw sp,ENDMEM ; init S.P. again, just in case
lea r1,msgReady ; display "Ready"
call PRMESG
ST3:
setlo r1,#'>' ; Prompt with a '>' and
call GETLN ; read a line.
call TOUPBUF ; convert to upper case
mov r12,r8 ; save pointer to end of line
lea r8,BUFFER ; point to the beginning of line
call TSTNUM ; is there a number there?
call IGNBLK ; skip trailing blanks
; does line no. exist? (or nonzero?)
beq r1,r0,DIRECT ; if not, it's a direct statement
bleu r1,#0xFFFF,ST2 ; see if line no. is <= 16 bits
lea r1,msgLineRange ; if not, we've overflowed
bra ERROR
ST2:
; ugliness - store a character at potentially an
; odd address (unaligned).
mov r2,r1 ; r2 = line number
sb r2,-2[r8]
shrui r2,r2,#8
sb r2,-1[r8] ; store the binary line no.
subui r8,r8,#2
call FNDLN ; find this line in save area
mov r13,r9 ; save possible line pointer
beq r1,r0,ST4 ; if not found, insert
; here we found the line, so we're replacing the line
; in the text area
; first step - delete the line
setlo r1,#0
call FNDNXT ; find the next line (into r9)
bne r1,r0,ST7
beq r9,r0,ST6 ; no more lines
ST7:
mov r1,r9 ; r1 = pointer to next line
mov r2,r13 ; pointer to line to be deleted
lw r3,TXTUNF ; points to top of save area
call MVUP ; move up to delete
sw r2,TXTUNF ; update the end pointer
; we moved the lines of text after the line being
; deleted down, so the pointer to the next line
; needs to be reset
mov r9,r13
bra ST4
; here there were no more lines, so just move the
; end of text pointer down
ST6:
sw r13,TXTUNF
mov r9,r13
ST4:
; here we're inserting because the line wasn't found
; or it was deleted from the text area
mov r1,r12 ; calculate the length of new line
sub r1,r1,r8
blei r1,#3,ST3 ; is it just a line no. & CR? if so, it was just a delete
 
lw r11,TXTUNF ; compute new end of text
mov r10,r11 ; r10 = old TXTUNF
add r11,r11,r1 ; r11 = new top of TXTUNF (r1=line length)
 
lw r1,VARBGN ; see if there's enough room
bltu r11,r1,ST5
lea r1,msgTooBig ; if not, say so
jmp ERROR
 
; open a space in the text area
ST5:
sw r11,TXTUNF ; if so, store new end position
mov r1,r10 ; points to old end of text
mov r2,r11 ; points to new end of text
mov r3,r9 ; points to start of line after insert line
call MVDOWN ; move things out of the way
 
; copy line into text space
mov r1,r8 ; set up to do the insertion; move from buffer
mov r2,r13 ; to vacated space
mov r3,r12 ; until end of buffer
call MVUP ; do it
bra ST3 ; go back and get another line
 
;******************************************************************
;
; *** Tables *** DIRECT *** EXEC ***
;
; This section of the code tests a string against a table. When
; a match is found, control is transferred to the section of
; code according to the table.
;
; At 'EXEC', r8 should point to the string, r9 should point to
; the character table, and r10 should point to the execution
; table. At 'DIRECT', r8 should point to the string, r9 and
; r10 will be set up to point to TAB1 and TAB1_1, which are
; the tables of all direct and statement commands.
;
; A '.' in the string will terminate the test and the partial
; match will be considered as a match, e.g. 'P.', 'PR.','PRI.',
; 'PRIN.', or 'PRINT' will all match 'PRINT'.
;
; There are two tables: the character table and the execution
; table. The character table consists of any number of text items.
; Each item is a string of characters with the last character's
; high bit set to one. The execution table holds a 32-bit
; execution addresses that correspond to each entry in the
; character table.
;
; The end of the character table is a 0 byte which corresponds
; to the default routine in the execution table, which is
; executed if none of the other table items are matched.
;
; Character-matching tables:
align 8
TAB1:
db "LIS",'T'+0x80 ; Direct commands
db "LOA",'D'+0x80
db "NE",'W'+0x80
db "RU",'N'+0x80
db "SAV",'E'+0x80
TAB2:
db "NEX",'T'+0x80 ; Direct / statement
db "LE",'T'+0x80
db "I",'F'+0x80
db "GOT",'O'+0x80
db "GOSU",'B'+0x80
db "RETUR",'N'+0x80
db "RE",'M'+0x80
db "FO",'R'+0x80
db "INPU",'T'+0x80
db "PRIN",'T'+0x80
db "POKE",'C'+0x80
db "POKE",'H'+0x80
db "POKE",'W'+0x80
db "POK",'E'+0x80
db "STO",'P'+0x80
db "BY",'E'+0x80
db "SY",'S'+0x80
db "CL",'S'+0x80
db "CL",'R'+0x80
db "RDC",'F'+0x80
db 0
TAB4:
db "PEEK",'C'+0x80 ;Functions
db "PEEK",'H'+0x80 ;Functions
db "PEEK",'W'+0x80 ;Functions
db "PEE",'K'+0x80 ;Functions
db "RN",'D'+0x80
db "AB",'S'+0x80
db "SIZ",'E'+0x80
db "US",'R'+0x80
db 0
TAB5:
db "T",'O'+0x80 ;"TO" in "FOR"
db 0
TAB6:
db "STE",'P'+0x80 ;"STEP" in "FOR"
db 0
TAB8:
db '>','='+0x80 ;Relational operators
db '<','>'+0x80
db '>'+0x80
db '='+0x80
db '<','='+0x80
db '<'+0x80
db 0
TAB9:
db "AN",'D'+0x80
db 0
TAB10:
db "O",'R'+0x80
db 0
 
.align 8
 
;* Execution address tables:
TAB1_1:
dw LISTX ;Direct commands
dw LOAD
dw NEW
dw RUN
dw SAVE
TAB2_1:
dw NEXT ; Direct / statement
dw LET
dw IF
dw GOTO
dw GOSUB
dw RETURN
dw IF2 ; REM
dw FOR
dw INPUT
dw PRINT
dw POKEC
dw POKEH
dw POKEW
dw POKE
dw STOP
dw GOBYE
dw SYSX
dw _cls
dw _clr
dw _rdcf
dw DEFLT
TAB4_1:
dw PEEKC
dw PEEKH
dw PEEKW
dw PEEK ;Functions
dw RND
dw ABS
dw SIZEX
dw USRX
dw XP40
TAB5_1
dw FR1 ;"TO" in "FOR"
dw QWHAT
TAB6_1
dw FR2 ;"STEP" in "FOR"
dw FR3
TAB8_1
dw XP11 ;>= Relational operators
dw XP12 ;<>
dw XP13 ;>
dw XP15 ;=
dw XP14 ;<=
dw XP16 ;<
dw XP17
TAB9_1
dw XP_AND
dw XP_ANDX
TAB10_1
dw XP_OR
dw XP_ORX
 
.align 16
 
;*
;* ===== Input a character from the host into register D0 (or
; r3 = match flag (trashed)
; r9 = text table
; r10 = exec table
; r11 = trashed
DIRECT:
lea r9,TAB1
lea r10,TAB1_1
EXEC:
mov r11,lr ; save link reg
call IGNBLK ; ignore leading blanks
mov lr,r11 ; restore link reg
mov r11,r8 ; save the pointer
setlo r3,#0 ; clear match flag
EXLP:
lbu r1,[r8] ; get the program character
addui r8,r8,#1
lbu r2,[r9] ; get the table character
bne r2,r0,EXNGO ; If end of table,
mov r8,r11 ; restore the text pointer and...
bra EXGO ; execute the default.
EXNGO:
beq r1,r3,EXGO ; Else check for period... if so, execute
andi r2,r2,#0x7f ; ignore the table's high bit
beq r2,r1,EXMAT; is there a match?
addui r10,r10,#8 ;if not, try the next entry
mov r8,r11 ; reset the program pointer
setlo r3,#0 ; sorry, no match
EX1:
addui r9,r9,#1
lb r1,-1[r9] ; get to the end of the entry
bgt r1,r0,EX1
bra EXLP ; back for more matching
EXMAT:
setlo r3,#'.' ; we've got a match so far
addui r9,r9,#1
lb r1,-1[r9] ; end of table entry?
bgt r1,r0,EXLP ; if not, go back for more
EXGO:
lw r11,[r10] ; execute the appropriate routine
jal r0,[r11]
 
; lb r1,[r8] ; get token from text space
; bpl
; and r1,#0x7f
; shl r1,#2 ; * 4 - word offset
; add r1,r1,#TAB1_1
; lw r1,[r1]
; jmp [r1]
 
;******************************************************************
;
; What follows is the code to execute direct and statement
; commands. Control is transferred to these points via the command
; table lookup code of 'DIRECT' and 'EXEC' in the last section.
; After the command is executed, control is transferred to other
; sections as follows:
;
; For 'LISTX', 'NEW', and 'STOP': go back to the warm start point.
; For 'RUN': go execute the first stored line if any; else go
; back to the warm start point.
; For 'GOTO' and 'GOSUB': go execute the target line.
; For 'RETURN' and 'NEXT'; go back to saved return line.
; For all others: if 'CURRNT' is 0, go to warm start; else go
; execute next command. (This is done in 'FINISH'.)
;
;******************************************************************
;
; *** NEW *** STOP *** RUN (& friends) *** GOTO ***
;
; 'NEW<CR>' sets TXTUNF to point to TXTBGN
;
; 'STOP<CR>' goes back to WSTART
;
; 'RUN<CR>' finds the first stored line, stores its address
; in CURRNT, and starts executing it. Note that only those
; commands in TAB2 are legal for a stored program.
;
; There are 3 more entries in 'RUN':
; 'RUNNXL' finds next line, stores it's address and executes it.
; 'RUNTSL' stores the address of this line and executes it.
; 'RUNSML' continues the execution on same line.
;
; 'GOTO expr<CR>' evaluates the expression, finds the target
; line, and jumps to 'RUNTSL' to do it.
;
NEW:
call ENDCHK
lw r1,TXTBGN
sw r1,TXTUNF ; set the end pointer
call clearVars
 
STOP:
call ENDCHK
bra WSTART ; WSTART will reset the stack
 
RUN:
call ENDCHK
lw r8,TXTBGN ; set pointer to beginning
sw r8,CURRNT
call clearVars
 
RUNNXL: ; RUN <next line>
lw r1,CURRNT ; executing a program?
beq r1,r0,WSTART ; if not, we've finished a direct stat.
setlo r1,#0 ; else find the next line number
mov r9,r8
call FNDLNP ; search for the next line
bne r1,r0,RUNTSL
bne r9,r0,RUNTSL
bra WSTART ; if we've fallen off the end, stop
 
RUNTSL: ; RUN <this line>
sw r9,CURRNT ; set CURRNT to point to the line no.
lea r8,2[r9] ; set the text pointer to
 
RUNSML: ; RUN <same line>
call CHKIO ; see if a control-C was pressed
lea r9,TAB2 ; find command in TAB2
lea r10,TAB2_1
bra EXEC ; and execute it
 
GOTO:
call OREXPR ;evaluate the following expression
mov r5,r1
call ENDCHK ;must find end of line
mov r1,r5
call FNDLN ; find the target line
bne r1,r0,RUNTSL ; go do it
lea r1,msgBadGotoGosub
bra ERROR ; no such line no.
 
_clr:
call clearVars
bra FINISH
 
; Clear the variable area of memory
clearVars:
subui sp,sp,#16
sw r6,[sp]
sw lr,8[sp]
setlo r6,#2048 ; number of words to clear
lw r1,VARBGN
cv1:
sw r0,[r1]
add r1,r1,#8
loop r6,cv1
lw lr,8[sp]
lw r6,[sp]
ret #16
 
 
;******************************************************************
; LIST
;
; LISTX has two forms:
; 'LIST<CR>' lists all saved lines
; 'LIST #<CR>' starts listing at the line #
; Control-S pauses the listing, control-C stops it.
;******************************************************************
;
LISTX:
call TSTNUM ; see if there's a line no.
mov r5,r1
call ENDCHK ; if not, we get a zero
mov r1,r5
call FNDLN ; find this or next line
LS1:
bne r1,r0,LS4
beq r9,r0,WSTART ; warm start if we passed the end
LS4:
mov r1,r9
call PRTLN ; print the line
mov r9,r1 ; set pointer for next
call CHKIO ; check for listing halt request
beq r1,r0,LS3
bnei r1,#CTRLS,LS3 ; pause the listing?
LS2:
call CHKIO ; if so, wait for another keypress
beq r1,r0,LS2
LS3:
setlo r1,#0
call FNDLNP ; find the next line
bra LS1
 
 
;******************************************************************
; PRINT command is 'PRINT ....:' or 'PRINT ....<CR>'
; where '....' is a list of expressions, formats, back-arrows,
; and strings. These items a separated by commas.
;
; A format is a pound sign followed by a number. It controls
; the number of spaces the value of an expression is going to
; be printed in. It stays effective for the rest of the print
; command unless changed by another format. If no format is
; specified, 11 positions will be used.
;
; A string is quoted in a pair of single- or double-quotes.
;
; An underline (back-arrow) means generate a <CR> without a <LF>
;
; A <CR LF> is generated after the entire list has been printed
; or if the list is empty. If the list ends with a semicolon,
; however, no <CR LF> is generated.
;******************************************************************
;
PRINT:
lw r5,#11 ; D4 = number of print spaces
setlo r3,#':'
lea r4,PR2
call TSTC ; if null list and ":"
call CRLF ; give CR-LF and continue
bra RUNSML ; execution on the same line
PR2:
setlo r3,#CR
lea r4,PR0
call TSTC ;if null list and <CR>
call CRLF ;also give CR-LF and
bra RUNNXL ;execute the next line
PR0:
setlo r3,#'#'
lea r4,PR1
call TSTC ;else is it a format?
call OREXPR ; yes, evaluate expression
lw r5,r1 ; and save it as print width
bra PR3 ; look for more to print
PR1:
setlo r3,#'$'
lea r4,PR4
call TSTC ; is character expression? (MRL)
call OREXPR ; yep. Evaluate expression (MRL)
call GOOUT ; print low byte (MRL)
bra PR3 ;look for more. (MRL)
PR4:
call QTSTG ; is it a string?
; the following branch must occupy only two bytes!
bra PR8 ; if not, must be an expression
PR3:
setlo r3,#','
lea r4,PR6
call TSTC ; if ",", go find next
call FIN ;in the list.
bra PR0
PR6:
call CRLF ;list ends here
bra FINISH
PR8:
call OREXPR ; evaluate the expression
lw r2,r5 ; set the width
call PRTNUM ; print its value
bra PR3 ; more to print?
 
FINISH:
call FIN ; Check end of command
jmp QWHAT ; print "What?" if wrong
 
 
;*******************************************************************
;
; *** GOSUB *** & RETURN ***
;
; 'GOSUB expr:' or 'GOSUB expr<CR>' is like the 'GOTO' command,
; except that the current text pointer, stack pointer, etc. are
; saved so that execution can be continued after the subroutine
; 'RETURN's. In order that 'GOSUB' can be nested (and even
; recursive), the save area must be stacked. The stack pointer
; is saved in 'STKGOS'. The old 'STKGOS' is saved on the stack.
; If we are in the main routine, 'STKGOS' is zero (this was done
; in the initialization section of the interpreter), but we still
; save it as a flag for no further 'RETURN's.
;******************************************************************
;
GOSUB:
call PUSHA ; save the current 'FOR' parameters
call OREXPR ; get line number
call FNDLN ; find the target line
bne r1,r0,gosub1
lea r1,msgBadGotoGosub
bra ERROR ; if not there, say "How?"
gosub1:
sub sp,sp,#24
sw r8,[sp] ; save text pointer
lw r1,CURRNT
sw r1,8[sp] ; found it, save old 'CURRNT'...
lw r1,STKGOS
sw r1,16[sp] ; and 'STKGOS'
sw r0,LOPVAR ; load new values
sw sp,STKGOS
bra RUNTSL
 
 
;******************************************************************
; 'RETURN<CR>' undoes everything that 'GOSUB' did, and thus
; returns the execution to the command after the most recent
; 'GOSUB'. If 'STKGOS' is zero, it indicates that we never had
; a 'GOSUB' and is thus an error.
;******************************************************************
;
RETURN:
call ENDCHK ; there should be just a <CR>
lw r1,STKGOS ; get old stack pointer
bne r1,r0,return1
lea r1,msgRetWoGosub
bra ERROR ; if zero, it doesn't exist
return1:
mov sp,r1 ; else restore it
lw r1,16[sp]
sw r1,STKGOS ; and the old 'STKGOS'
lw r1,8[sp]
sw r1,CURRNT ; and the old 'CURRNT'
lw r8,[sp] ; and the old text pointer
add sp,sp,#24
call POPA ;and the old 'FOR' parameters
bra FINISH ;and we are back home
 
;******************************************************************
; *** FOR *** & NEXT ***
;
; 'FOR' has two forms:
; 'FOR var=exp1 TO exp2 STEP exp1' and 'FOR var=exp1 TO exp2'
; The second form means the same thing as the first form with a
; STEP of positive 1. The interpreter will find the variable 'var'
; and set its value to the current value of 'exp1'. It also
; evaluates 'exp2' and 'exp1' and saves all these together with
; the text pointer, etc. in the 'FOR' save area, which consists of
; 'LOPVAR', 'LOPINC', 'LOPLMT', 'LOPLN', and 'LOPPT'. If there is
; already something in the save area (indicated by a non-zero
; 'LOPVAR'), then the old save area is saved on the stack before
; the new values are stored. The interpreter will then dig in the
; stack and find out if this same variable was used in another
; currently active 'FOR' loop. If that is the case, then the old
; 'FOR' loop is deactivated. (i.e. purged from the stack)
;******************************************************************
;
FOR:
call PUSHA ; save the old 'FOR' save area
call SETVAL ; set the control variable
sw r1,LOPVAR ; save its address
lea r9,TAB5
lea r10,TAB5_1; use 'EXEC' to test for 'TO'
jmp EXEC
FR1:
call OREXPR ; evaluate the limit
sw r1,LOPLMT ; save that
lea r9,TAB6
lea r10,TAB6_1 ; use 'EXEC' to test for the word 'STEP
jmp EXEC
FR2:
call OREXPR ; found it, get the step value
bra FR4
FR3:
setlo r1,#1 ; not found, step defaults to 1
FR4:
sw r1,LOPINC ; save that too
FR5:
lw r2,CURRNT
sw r2,LOPLN ; save address of current line number
sw r8,LOPPT ; and text pointer
lw r3,sp ; dig into the stack to find 'LOPVAR'
lw r6,LOPVAR
bra FR7
FR6:
addui r3,r3,#40 ; look at next stack frame
FR7:
lw r2,[r3] ; is it zero?
beq r2,r0,FR8 ; if so, we're done
bne r2,r6,FR6 ; same as current LOPVAR? nope, look some more
 
lw r1,r3 ; Else remove 5 long words from...
addui r2,r3,#40 ; inside the stack.
lw r3,sp
call MVDOWN
add sp,sp,#40 ; set the SP 5 long words up
FR8:
bra FINISH ; and continue execution
 
 
;******************************************************************
; 'NEXT var' serves as the logical (not necessarily physical) end
; of the 'FOR' loop. The control variable 'var' is checked with
; the 'LOPVAR'. If they are not the same, the interpreter digs in
; the stack to find the right one and purges all those that didn't
; match. Either way, it then adds the 'STEP' to that variable and
; checks the result with against the limit value. If it is within
; the limit, control loops back to the command following the
; 'FOR'. If it's outside the limit, the save area is purged and
; execution continues.
;******************************************************************
;
NEXT:
setlo r1,#0 ; don't allocate it
call TSTV ; get address of variable
bne r1,r0,NX4
lea r1,msgNextVar
bra ERROR ; if no variable, say "What?"
NX4:
mov r9,r1 ; save variable's address
NX0:
lw r1,LOPVAR ; If 'LOPVAR' is zero, we never...
bne r1,r0,NX5 ; had a FOR loop
lea r1,msgNextFor
bra ERROR
NX5:
beq r1,r9,NX2 ; else we check them OK, they agree
call POPA ; nope, let's see the next frame
bra NX0
NX2:
lw r1,[r9] ; get control variable's value
lw r2,LOPINC
addu r1,r1,r2 ; add in loop increment
; BVS.L QHOW say "How?" for 32-bit overflow
sw r1,[r9] ; save control variable's new value
lw r3,LOPLMT ; get loop's limit value
bgt r2,r0,NX1 ; check loop increment, branch if loop increment is positive
blt r1,r3,NXPurge ; test against limit
bra NX3
NX1:
bgt r1,r3,NXPurge
NX3:
lw r8,LOPLN ; Within limit, go back to the...
sw r8,CURRNT
lw r8,LOPPT ; saved 'CURRNT' and text pointer.
bra FINISH
NXPurge:
call POPA ; purge this loop
bra FINISH
 
 
;******************************************************************
; *** REM *** IF *** INPUT *** LET (& DEFLT) ***
;
; 'REM' can be followed by anything and is ignored by the
; interpreter.
;
;REM
; br IF2 ; skip the rest of the line
; 'IF' is followed by an expression, as a condition and one or
; more commands (including other 'IF's) separated by colons.
; Note that the word 'THEN' is not used. The interpreter evaluates
; the expression. If it is non-zero, execution continues. If it
; is zero, the commands that follow are ignored and execution
; continues on the next line.
;******************************************************************
;
IF:
call OREXPR ; evaluate the expression
IF1:
bne r1,r0,RUNSML ; is it zero? if not, continue
IF2:
mov r9,r8 ; set lookup pointer
setlo r1,#0 ; find line #0 (impossible)
call FNDSKP ; if so, skip the rest of the line
bgt r1,r0,WSTART ; if no next line, do a warm start
IF3:
bra RUNTSL ; run the next line
 
 
;******************************************************************
; INPUT is called first and establishes a stack frame
INPERR:
lw sp,STKINP ; restore the old stack pointer
lw r8,16[sp]
sw r8,CURRNT ; and old 'CURRNT'
lw r8,8[sp] ; and old text pointer
addui sp,sp,#40 ; fall through will subtract 40
 
; 'INPUT' is like the 'PRINT' command, and is followed by a list
; of items. If the item is a string in single or double quotes,
; or is an underline (back arrow), it has the same effect as in
; 'PRINT'. If an item is a variable, this variable name is
; printed out followed by a colon, then the interpreter waits for
; an expression to be typed in. The variable is then set to the
; value of this expression. If the variable is preceeded by a
; string (again in single or double quotes), the string will be
; displayed followed by a colon. The interpreter the waits for an
; expression to be entered and sets the variable equal to the
; expression's value. If the input expression is invalid, the
; interpreter will print "What?", "How?", or "Sorry" and reprint
; the prompt and redo the input. The execution will not terminate
; unless you press control-C. This is handled in 'INPERR'.
;
INPUT:
subui sp,sp,#40 ; allocate stack frame
sw r5,32[sp]
IP6:
sw r8,[sp] ; save in case of error
call QTSTG ; is next item a string?
bra IP2 ; nope - this branch must take only two bytes
setlo r1,#1 ; allocate var
call TSTV ; yes, but is it followed by a variable?
beq r1,r0,IP4 ; if not, brnch
mov r10,r1 ; put away the variable's address
bra IP3 ; if so, input to variable
IP2:
sw r8,8[sp] ; save for 'PRTSTG'
setlo r1,#1
call TSTV ; must be a variable now
bne r1,r0,IP7
lea r1,msgInputVar
bra ERROR ; "What?" it isn't?
IP7:
mov r10,r1 ; put away the variable's address
lb r5,[r8] ; get ready for 'PRTSTG' by null terminating
sb r0,[r8]
lw r1,8[sp] ; get back text pointer
call PRTSTG ; print string as prompt
sb r5,[r8] ; un-null terminate
IP3
sw r8,8[sp] ; save in case of error
lw r1,CURRNT
sw r1,16[sp] ; also save 'CURRNT'
setlo r1,#-1
sw r1,CURRNT ; flag that we are in INPUT
sw sp,STKINP ; save the stack pointer too
sw r10,24[sp] ; save the variable address
setlo r1,#':' ; print a colon first
call GETLN ; then get an input line
lea r8,BUFFER ; point to the buffer
call OREXPR ; evaluate the input
lw r10,24[sp] ; restore the variable address
sw r1,[r10] ; save value in variable
lw r1,16[sp] ; restore old 'CURRNT'
sw r1,CURRNT
lw r8,8[sp] ; and the old text pointer
IP4:
setlo r3,#','
lea r4,IP5 ; is the next thing a comma?
call TSTC
bra IP6 ; yes, more items
IP5:
lw r5,32[sp]
add sp,sp,#40 ; clean up the stack
jmp FINISH
 
 
DEFLT:
lb r1,[r8]
beq r1,#CR,FINISH ; empty line is OK else it is 'LET'
 
 
;******************************************************************
; 'LET' is followed by a list of items separated by commas.
; Each item consists of a variable, an equals sign, and an
; expression. The interpreter evaluates the expression and sets
; the variable to that value. The interpreter will also handle
; 'LET' commands without the word 'LET'. This is done by 'DEFLT'.
;******************************************************************
;
LET:
call SETVAL ; do the assignment
setlo r3,#','
lea r4,FINISH
call TSTC ; check for more 'LET' items
bra LET
LT1:
bra FINISH ; until we are finished.
 
 
;******************************************************************
; *** LOAD *** & SAVE ***
;
; These two commands transfer a program to/from an auxiliary
; device such as a cassette, another computer, etc. The program
; is converted to an easily-stored format: each line starts with
; a colon, the line no. as 4 hex digits, and the rest of the line.
; At the end, a line starting with an '@' sign is sent. This
; format can be read back with a minimum of processing time by
; the Butterfly.
;******************************************************************
;
LOAD
lw r8,TXTBGN ; set pointer to start of prog. area
setlo r1,#CR ; For a CP/M host, tell it we're ready...
call GOAUXO ; by sending a CR to finish PIP command.
LOD1:
call GOAUXI ; look for start of line
ble r1,r0,LOD1
beq r1,#'@',LODEND ; end of program?
beq r1,#0x1A,LODEND ; or EOF marker
bne r1,#':',LOD1 ; if not, is it start of line? if not, wait for it
call GCHAR ; get line number
sb r1,[r8] ; store it
shrui r1,r1,#8
sb r1,1[r8]
addui r8,r8,#2
LOD2:
call GOAUXI ; get another text char.
ble r1,r0,LOD2
sb r1,[r8]
addui r8,r8,#1 ; store it
bne r1,#CR,LOD2 ; is it the end of the line? if not, go back for more
bra LOD1 ; if so, start a new line
LODEND:
sw r8,TXTUNF ; set end-of program pointer
bra WSTART ; back to direct mode
 
 
; get character from input (16 bit value)
GCHAR:
subui sp,sp,#24
sw r5,[sp]
sw r6,8[sp]
sw lr,16[sp]
setlo r6,#3 ; repeat four times
setlo r5,#0
GCHAR1:
call GOAUXI ; get a char
ble r1,r0,GCHAR1
call asciiToHex
shli r5,r5,#4
or r5,r5,r1
loop r6,GCHAR1
mov r1,r5
lw lr,16[sp]
lw r6,8[sp]
lw r5,[sp]
ret #24
 
 
; convert an ascii char to hex code
; input
; r1 = char to convert
 
asciiToHex:
blei r1,#'9',a2h1 ; less than '9'
subui r1,r1,#7 ; shift 'A' to '9'+1
a2h1:
subui r1,r1,#'0' ;
andi r1,r1,#15 ; make sure a nybble
ret
 
 
 
SAVE:
lw r8,TXTBGN ;set pointer to start of prog. area
lw r9,TXTUNF ;set pointer to end of prog. area
SAVE1:
call AUXOCRLF ; send out a CR & LF (CP/M likes this)
bgeu r8,r9,SAVEND ; are we finished?
setlo r1,#':' ; if not, start a line
call GOAUXO
lbu r1,[r8] ; get line number
lbu r2,1[r8]
shli r2,r2,#8
or r1,r1,r2
addui r8,r8,#2
call PWORD ; output line number as 4-digit hex
SAVE2:
lb r1,[r8] ; get a text char.
addui r8,r8,#1
beqi r1,#CR,SAVE1 ; is it the end of the line? if so, send CR & LF and start new line
call GOAUXO ; send it out
bra SAVE2 ; go back for more text
SAVEND:
setlo r1,#'@' ; send end-of-program indicator
call GOAUXO
call AUXOCRLF ; followed by a CR & LF
setlo r1,#0x1A ; and a control-Z to end the CP/M file
call GOAUXO
bra WSTART ; then go do a warm start
 
 
; output a CR LF sequence to auxillary output
; Registers Affected
; r3 = LF
AUXOCRLF:
subui sp,sp,#8
sw lr,[sp]
setlo r1,#CR
call GOAUXO
setlo r1,#LF
call GOAUXO
lw lr,[sp]
ret #8
 
 
; output a word in hex format
; tricky because of the need to reverse the order of the chars
PWORD:
sub sp,sp,#16
sw lr,[sp]
sw r5,8[sp]
lea r5,NUMWKA+15
mov r4,r1 ; r4 = value
pword1:
mov r1,r4 ; r1 = value
shrui r4,r4,#4 ; shift over to next nybble
call toAsciiHex ; convert LS nybble to ascii hex
sb r1,[r5] ; save in work area
subui r5,r5,#1
cmpui r1,r5,#NUMWKA
bge r1,r0,pword1
pword2:
addui r5,r5,#1
lb r1,[r5] ; get char to output
call GOAUXO ; send it
cmpui r1,r5,#NUMWKA+15
blt r1,r0,pword2
lw r5,8[sp]
lw lr,[sp]
ret #16
 
 
; convert nybble in r2 to ascii hex char2
; r2 = character to convert
 
toAsciiHex:
andi r1,r1,#15 ; make sure it's a nybble
blti r1,#10,tah1 ; > 10 ?
addi r1,r1,#7 ; bump it up to the letter 'A'
tah1:
addui r1,r1,#'0' ; bump up to ascii '0'
ret
 
 
 
;******************************************************************
; *** POKE *** & SYSX ***
;
; 'POKE expr1,expr2' stores the byte from 'expr2' into the memory
; address specified by 'expr1'.
;
; 'SYSX expr' jumps to the machine language subroutine whose
; starting address is specified by 'expr'. The subroutine can use
; all registers but must leave the stack the way it found it.
; The subroutine returns to the interpreter by executing an RET.
;******************************************************************
;
POKE:
subui sp,sp,#8
call OREXPR ; get the memory address
setlo r3,#','
lea r4,PKER ; it must be followed by a comma
call TSTC ; it must be followed by a comma
sw r1,[sp] ; save the address
call OREXPR ; get the byte to be POKE'd
lw r2,[sp] ; get the address back
sb r1,[r2] ; store the byte in memory
addui sp,sp,#8
bra FINISH
PKER:
lea r1,msgComma
bra ERROR ; if no comma, say "What?"
 
POKEC:
subui sp,sp,#8
call OREXPR ; get the memory address
setlo r3,#','
lea r4,PKER ; it must be followed by a comma
call TSTC ; it must be followed by a comma
sw r1,[sp] ; save the address
call OREXPR ; get the byte to be POKE'd
lw r2,[sp] ; get the address back
sc r1,[r2] ; store the char in memory
addui sp,sp,#8
jmp FINISH
 
POKEH:
subui sp,sp,#8
call OREXPR ; get the memory address
setlo r3,#','
lea r4,PKER ; it must be followed by a comma
call TSTC
sw r1,[sp] ; save the address
call OREXPR ; get the byte to be POKE'd
lw r2,[sp] ; get the address back
sh r1,[r2] ; store the word in memory
addui sp,sp,#8
jmp FINISH
 
POKEW:
subui sp,sp,#8
call OREXPR ; get the memory address
setlo r3,#','
lea r4,PKER ; it must be followed by a comma
call TSTC
sw r1,[sp] ; save the address
call OREXPR ; get the word to be POKE'd
lw r2,[sp] ; get the address back
sw r1,[r2] ; store the word in memory
addui sp,sp,#8
jmp FINISH
 
SYSX:
subui sp,sp,#8
call OREXPR ; get the subroutine's address
bne r1,r0,sysx1 ; make sure we got a valid address
lea r1,msgSYSBad
bra ERROR
sysx1:
sw r8,[sp] ; save the text pointer
jal r31,[r1] ; jump to the subroutine
lw r8,[sp] ; restore the text pointer
addui sp,sp,#8
bra FINISH
 
;******************************************************************
; *** EXPR ***
;
; 'EXPR' evaluates arithmetical or logical expressions.
; <OREXPR>::= <ANDEXPR> OR <ANDEXPR> ...
; <ANDEXPR>::=<EXPR> AND <EXPR> ...
; <EXPR>::=<EXPR2>
; <EXPR2><rel.op.><EXPR2>
; where <rel.op.> is one of the operators in TAB8 and the result
; of these operations is 1 if true and 0 if false.
; <EXPR2>::=(+ or -)<EXPR3>(+ or -)<EXPR3>(...
; where () are optional and (... are optional repeats.
; <EXPR3>::=<EXPR4>( <* or /><EXPR4> )(...
; <EXPR4>::=<variable>
; <function>
; (<EXPR>)
; <EXPR> is recursive so that the variable '@' can have an <EXPR>
; as an index, functions can have an <EXPR> as arguments, and
; <EXPR4> can be an <EXPR> in parenthesis.
;
 
; <OREXPR>::=<ANDEXPR> OR <ANDEXPR> ...
;
OREXPR:
subui sp,sp,#16
sw lr,[sp]
call ANDEXPR ; get first <ANDEXPR>
XP_OR1:
sw r1,4[sp] ; save <ANDEXPR> value
lea r9,TAB10 ; look up a logical operator
lea r10,TAB10_1
jmp EXEC ; go do it
XP_OR:
call ANDEXPR
lw r2,8[sp]
or r1,r1,r2
bra XP_OR1
XP_ORX:
lw r1,8[sp]
lw lr,[sp]
ret #16
 
 
; <ANDEXPR>::=<EXPR> AND <EXPR> ...
;
ANDEXPR:
subui sp,sp,#16
sw lr,[sp]
call EXPR ; get first <EXPR>
XP_AND1:
sw r1,8[sp] ; save <EXPR> value
lea r9,TAB9 ; look up a logical operator
lea r10,TAB9_1
jmp EXEC ; go do it
XP_AND:
call EXPR
lw r2,8[sp]
and r1,r1,r2
bra XP_AND1
XP_ANDX:
lw r1,8[sp]
lw lr,[sp]
ret #16
 
 
; Determine if the character is a digit
; Parameters
; r1 = char to test
; Returns
; r1 = 1 if digit, otherwise 0
;
isDigit:
blt r1,#'0',isDigitFalse
bgt r1,#'9',isDigitFalse
setlo r1,#1
ret
isDigitFalse:
setlo r1,#0
ret
 
 
; Determine if the character is a alphabetic
; Parameters
; r1 = char to test
; Returns
; r1 = 1 if alpha, otherwise 0
;
isAlpha:
blt r1,#'A',isAlphaFalse
ble r1,#'Z',isAlphaTrue
blt r1,#'a',isAlphaFalse
bgt r1,#'z',isAlphaFalse
isAlphaTrue:
setlo r1,#1
ret
isAlphaFalse:
setlo r1,#0
ret
 
 
; Determine if the character is a alphanumeric
; Parameters
; r1 = char to test
; Returns
; r1 = 1 if alpha, otherwise 0
;
isAlnum:
subui sp,sp,#8
sw lr,[sp]
or r2,r1,r0 ; save test char
call isDigit
bne r1,r0,isDigitx ; if it is a digit
or r1,r2,r0 ; get back test char
call isAlpha
isDigitx:
lw lr,[sp]
ret #8
 
 
EXPR:
subui sp,sp,#16
sw lr,[sp]
call EXPR2
sw r1,8[sp] ; save <EXPR2> value
lea r9,TAB8 ; look up a relational operator
lea r10,TAB8_1
jmp EXEC ; go do it
XP11:
lw r1,8[sp]
call XP18 ; is it ">="?
bge r2,r1,XPRT1 ; no, return r2=1
bra XPRT0 ; else return r2=0
XP12:
lw r1,8[sp]
call XP18 ; is it "<>"?
bne r2,r1,XPRT1 ; no, return r2=1
bra XPRT0 ; else return r2=0
XP13:
lw r1,8[sp]
call XP18 ; is it ">"?
bgt r2,r1,XPRT1 ; no, return r2=1
bra XPRT0 ; else return r2=0
XP14:
lw r1,8[sp]
call XP18 ; is it "<="?
ble r2,r1,XPRT1 ; no, return r2=1
bra XPRT0 ; else return r2=0
XP15:
lw r1,8[sp]
call XP18 ; is it "="?
beq r2,r1,XPRT1 ; if not, return r2=1
bra XPRT0 ; else return r2=0
XP16:
lw r1,8[sp]
call XP18 ; is it "<"?
blt r2,r1,XPRT1 ; if not, return r2=1
bra XPRT0 ; else return r2=0
XPRT0:
lw lr,[sp]
setlo r1,#0 ; return r1=0 (false)
ret #16
XPRT1:
lw lr,[sp]
setlo r1,#1 ; return r1=1 (true)
ret #16
 
XP17: ; it's not a rel. operator
lw r1,8[sp] ; return r2=<EXPR2>
lw lr,[sp]
ret #16
 
XP18:
subui sp,sp,#16
sw lr,[sp]
sw r1,8[sp]
call EXPR2 ; do a second <EXPR2>
lw r2,8[sp]
lw lr,[sp]
ret #16
 
; <EXPR2>::=(+ or -)<EXPR3>(+ or -)<EXPR3>(...
 
EXPR2:
subui sp,sp,#16
sw lr,[sp]
setlo r3,#'-'
lea r4,XP21
call TSTC ; negative sign?
setlo r1,#0 ; yes, fake '0-'
sw r0,8[sp]
bra XP26
XP21:
setlo r3,#'+'
lea r4,XP22
call TSTC ; positive sign? ignore it
XP22:
call EXPR3 ; first <EXPR3>
XP23:
sw r1,8[sp] ; yes, save the value
setlo r3,#'+'
lea r4,XP25
call TSTC ; add?
call EXPR3 ; get the second <EXPR3>
XP24:
lw r2,8[sp]
add r1,r1,r2 ; add it to the first <EXPR3>
; BVS.L QHOW brnch if there's an overflow
bra XP23 ; else go back for more operations
XP25:
setlo r3,#'-'
lea r4,XP45
call TSTC ; subtract?
XP26:
call EXPR3 ; get second <EXPR3>
neg r1,r1 ; change its sign
bra XP24 ; and do an addition
XP45:
lw r1,8[sp]
lw lr,[sp]
ret #16
 
 
; <EXPR3>::=<EXPR4>( <* or /><EXPR4> )(...
 
EXPR3:
subui sp,sp,#16
sw lr,[sp]
call EXPR4 ; get first <EXPR4>
XP31:
sw r1,8[sp] ; yes, save that first result
setlo r3,#'*'
lea r4,XP34
call TSTC ; multiply?
call EXPR4 ; get second <EXPR4>
lw r2,8[sp]
muls r1,r1,r2 ; multiply the two
bra XP31 ; then look for more terms
XP34:
setlo r3,#'/'
lea r4,XP47
call TSTC ; divide?
call EXPR4 ; get second <EXPR4>
or r2,r1,r0
lw r1,8[sp]
divs r1,r1,r2 ; do the division
bra XP31 ; go back for any more terms
XP47:
lw r1,8[sp]
lw lr,[sp]
ret #16
 
 
; Functions are called through EXPR4
; <EXPR4>::=<variable>
; <function>
; (<EXPR>)
 
EXPR4:
subui sp,sp,#24
sw lr,[sp]
lea r9,TAB4 ; find possible function
lea r10,TAB4_1
jmp EXEC ; branch to function which does subsequent ret for EXPR4
XP40: ; we get here if it wasn't a function
setlo r1,#0
call TSTV
beq r1,r0,XP41 ; nor a variable
lw r1,[r1] ; if a variable, return its value in r1
lw lr,[sp]
ret #24
XP41:
call TSTNUM ; or is it a number?
bne r2,r0,XP46 ; (if not, # of digits will be zero) if so, return it in r1
call PARN ; check for (EXPR)
XP46:
lw lr,[sp]
ret #24
 
 
; Check for a parenthesized expression
PARN:
subui sp,sp,#8
sw lr,[sp]
setlo r3,#'('
lea r4,XP43
call TSTC ; else look for ( OREXPR )
call OREXPR
setlo r3,#')'
lea r4,XP43
call TSTC
XP42:
lw lr,[sp]
ret #8
XP43:
lea r1,msgWhat
bra ERROR
 
 
; ===== Test for a valid variable name. Returns Z=1 if not
; found, else returns Z=0 and the address of the
; variable in r1.
; Parameters
; r1 = 1 = allocate if not found
; Returns
; r1 = address of variable, zero if not found
 
TSTV:
subui sp,sp,#24
sw lr,[sp]
sw r5,8[sp]
or r5,r1,r0 ; allocate flag
call IGNBLK
lbu r1,[r8] ; look at the program text
blt r1,#'@',tstv_notfound ; C=1: not a variable
bne r1,#'@',TV1 ; brnch if not "@" array
addui r8,r8,#1 ; If it is, it should be
call PARN ; followed by (EXPR) as its index.
shli r1,r1,#3
; BCS.L QHOW say "How?" if index is too big
subui sp,sp,#24
sw r1,8[sp] ; save the index
sw lr,[sp]
call SIZEX ; get amount of free memory
lw lr,[sp]
lw r2,8[sp] ; get back the index
bltu r2,r1,TV2 ; see if there's enough memory
jmp QSORRY ; if not, say "Sorry"
TV2:
lea r1,VARBGN ; put address of array element...
subu r1,r1,r2 ; into r1 (neg. offset is used)
bra TSTVRT
TV1:
call getVarName ; get variable name
beq r1,r0,TSTVRT ; if not, return r1=0
mov r2,r5
call findVar ; find or allocate
TSTVRT:
lw r5,8[sp]
lw lr,[sp]
ret #24 ; r1<>0 (found)
tstv_notfound:
lw r5,8[sp]
lw lr,[sp]
setlo r1,#0 ; r1=0 if not found
ret #24
 
 
; Returns
; r1 = 6 character variable name + type
;
getVarName:
subui sp,sp,#24
sw lr,[sp]
sw r5,16[sp]
 
lb r1,[r8] ; get first character
sw r1,8[sp] ; save off current name
call isAlpha
beq r1,r0,gvn1
setlo r5,#5 ; loop six more times
 
; check for second/third character
gvn4:
addui r8,r8,#1
lb r1,[r8] ; do we have another char ?
call isAlnum
beq r1,r0,gvn2 ; nope
lw r1,8[sp] ; get varname
shli r1,r1,#8
lb r2,[r8]
or r1,r1,r2 ; add in new char
sw r1,8[sp] ; save off name again
loop r5,gvn4
 
; now ignore extra variable name characters
gvn6:
addui r8,r8,#1
lb r1,[r8]
call isAlnum
bne r1,r0,gvn6 ; keep looping as long as we have identifier chars
 
; check for a variable type
gvn2:
lb r1,[r8]
beq r1,#'%',gvn3
beq r1,#'$',gvn3
setlo r1,#0
subui r8,r8,#1
 
; insert variable type indicator and return
gvn3:
addui r8,r8,#1
lw r2,8[sp]
shli r2,r2,#8
or r1,r1,r2 ; add in variable type
lw lr,[sp]
lw r5,16[sp]
ret #24 ; return Z = 0, r1 = varname
 
; not a variable name
gvn1:
lw lr,[sp]
lw r5,16[sp]
setlo r1,#0 ; return Z = 1 if not a varname
ret #24
 
 
; Find variable
; r1 = varname
; r2 = allocate flag
; Returns
; r1 = variable address, Z =0 if found / allocated, Z=1 if not found
 
findVar:
subui sp,sp,#16
sw lr,[sp]
sw r7,8[sp]
lw r3,VARBGN
fv4:
lw r7,[r3] ; get varname / type
beq r7,r0,fv3 ; no more vars ?
beq r1,r7,fv1 ; match ?
add r3,r3,#8 ; move to next var
lw r7,STKBOT
blt r3,r7,fv4 ; loop back to look at next var
 
; variable not found
; no more memory
setlo r1,#<msgVarSpace
sethi r1,#>msgVarSpace
bra ERROR
; lw lr,[sp]
; lw r7,4[sp]
; add sp,sp,#8
; lw r1,#0
; ret
 
; variable not found
; allocate new ?
fv3:
beq r2,r0,fv2
sw r1,[r3] ; save varname / type
; found variable
; return address
fv1:
addui r1,r3,#8
lw lr,[sp]
lw r7,8[sp]
ret #16 ; Z = 0, r1 = address
 
; didn't find var and not allocating
fv2:
lw lr,[sp]
lw r7,8[sp]
addui sp,sp,#16 ; Z = 0, r1 = address
setlo r1,#0 ; Z = 1, r1 = 0
ret
 
 
; ===== Multiplies the 32 bit values in r1 and r2, returning
; the 32 bit result in r1.
;
 
; ===== Divide the 32 bit value in r2 by the 32 bit value in r3.
; Returns the 32 bit quotient in r1, remainder in r2
;
; r2 = a
; r3 = b
; r6 = remainder
; r7 = iteration count
; r8 = sign
;
 
; q = a / b
; a = r1
; b = r2
; q = r2
 
 
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
PEEK:
call PARN ; get the memory address
lbu r1,[r1] ; get the addressed byte
lw lr,[sp] ; and return it
ret #24
 
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
PEEKC:
call PARN ; get the memory address
andi r1,r1,#-2 ; align to char address
lcu r1,[r1] ; get the addressed char
lw lr,[sp] ; and return it
ret #24
 
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
PEEKH:
call PARN ; get the memory address
andi r1,r1,#-4 ; align to half-word address
lhu r1,[r1] ; get the addressed char
lw lr,[sp] ; and return it
ret #24
 
; ===== The PEEK function returns the byte stored at the address
; contained in the following expression.
;
PEEKW:
call PARN ; get the memory address
andi r1,r1,#-8 ; align to word address
lw r1,[r1] ; get the addressed word
lw lr,[sp] ; and return it
ret #24
 
; user function call
; call the user function with argument in r1
USRX:
call PARN ; get expression value
sw r8,8[sp] ; save the text pointer
lw r2,usrJmp ; get usr vector
jal r31,[r2] ; jump to the subroutine
lw r8,8[sp] ; restore the text pointer
lw lr,[sp]
ret #24
 
 
; ===== The RND function returns a random number from 1 to
; the value of the following expression in D0.
;
RND:
call PARN ; get the upper limit
beq r1,r0,rnd2 ; it must be positive and non-zero
blt r1,r0,rnd1
lw r2,r1
gran ; generate a random number
mfspr r1,rand ; get the number
call modu4 ; RND(n)=MOD(number,n)+1
addui r1,r1,#1
lw lr,[sp]
ret #24
rnd1:
lea r1,msgRNDBad
bra ERROR
rnd2:
gran
mfspr r1,rand
lw lr,[sp]
ret #24
 
 
; r = a mod b
; a = r1
; b = r2
; r = r6
modu4:
subui sp,sp,#32
sw r3,[sp]
sw r5,8[sp]
sw r6,16[sp]
sw r7,24[sp]
lw r7,#63 ; n = 64
xor r5,r5,r5 ; w = 0
xor r6,r6,r6 ; r = 0
mod2:
roli r1,r1,#1 ; a <<= 1
andi r3,r1,#1
shli r6,r6,#1 ; r <<= 1
or r6,r6,r3
andi r1,r1,#-2
bgtu r2,r6,mod1 ; b < r ?
subu r6,r6,r2 ; r -= b
mod1:
loop r7,mod2 ; n--
mov r1,r6
lw r3,[sp]
lw r5,8[sp]
lw r6,16[sp]
lw r7,24[sp]
ret #32
 
 
; ===== The ABS function returns an absolute value in r2.
;
ABS:
call PARN ; get the following expr.'s value
abs r1,r1
lw lr,[sp]
ret #24
 
; ===== The SGN function returns the sign in r1. +1,0, or -1
;
SGN:
call PARN ; get the following expr.'s value
sgn r1,r1
lw lr,[sp]
ret #24
 
; ===== The SIZE function returns the size of free memory in r1.
;
SIZEX:
lw r1,VARBGN ; get the number of free bytes...
lw r2,TXTUNF ; between 'TXTUNF' and 'VARBGN'
subu r1,r1,r2
lw lr,[sp]
ret #24 ; return the number in r2
 
 
;******************************************************************
;
; *** SETVAL *** FIN *** ENDCHK *** ERROR (& friends) ***
;
; 'SETVAL' expects a variable, followed by an equal sign and then
; an expression. It evaluates the expression and sets the variable
; to that value.
;
; 'FIN' checks the end of a command. If it ended with ":",
; execution continues. If it ended with a CR, it finds the
; the next line and continues from there.
;
; 'ENDCHK' checks if a command is ended with a CR. This is
; required in certain commands, such as GOTO, RETURN, STOP, etc.
;
; 'ERROR' prints the string pointed to by r1. It then prints the
; line pointed to by CURRNT with a "?" inserted at where the
; old text pointer (should be on top of the stack) points to.
; Execution of Tiny BASIC is stopped and a warm start is done.
; If CURRNT is zero (indicating a direct command), the direct
; command is not printed. If CURRNT is -1 (indicating
; 'INPUT' command in progress), the input line is not printed
; and execution is not terminated but continues at 'INPERR'.
;
; Related to 'ERROR' are the following:
; 'QWHAT' saves text pointer on stack and gets "What?" message.
; 'AWHAT' just gets the "What?" message and jumps to 'ERROR'.
; 'QSORRY' and 'ASORRY' do the same kind of thing.
; 'QHOW' and 'AHOW' also do this for "How?".
;
 
; returns
; r2 = variable's address
;
SETVAL:
subui sp,sp,#16
sw lr,[sp]
setlo r1,#1 ; allocate var
call TSTV ; variable name?
bne r1,r0,sv2
lea r1,msgVar
bra ERROR
sv2:
sw r1,8[sp] ; save the variable's address
setlo r3,#'='
lea r4,SV1
call TSTC ; get past the "=" sign
call OREXPR ; evaluate the expression
lw r2,8[sp] ; get back the variable's address
sw r1,[r2] ; and save value in the variable
lw r1,r2 ; return r1 = variable address
lw lr,[sp]
ret #16
SV1:
bra QWHAT ; if no "=" sign
 
 
FIN:
subui sp,sp,#8
sw lr,[sp]
setlo r3,#':'
lea r4,FI1
call TSTC ; *** FIN ***
addui sp,sp,#8 ; if ":", discard return address
bra RUNSML ; continue on the same line
FI1:
setlo r3,#CR
lea r4,FI2
call TSTC ; not ":", is it a CR?
lw lr,[sp] ; else return to the caller
addui sp,sp,#8 ; yes, purge return address
bra RUNNXL ; execute the next line
FI2:
lw lr,[sp] ; else return to the caller
ret #8
 
 
; Check that there is nothing else on the line
; Registers Affected
; r1
;
ENDCHK:
subui sp,sp,#8
sw lr,[sp]
call IGNBLK
lb r1,[r8]
beq r1,#CR,ec1 ; does it end with a CR?
setlo r1,#<msgExtraChars
sethi r1,#>msgExtraChars
jmp ERROR
ec1:
lw lr,[sp]
ret #8
 
 
TOOBIG:
lea r1,msgTooBig
bra ERROR
QSORRY:
lea r1,SRYMSG
bra ERROR
QWHAT:
lea r1,msgWhat
ERROR:
call PRMESG ; display the error message
lw r1,CURRNT ; get the current line number
beq r1,r0,WSTART ; if zero, do a warm start
beq r1,#-1,INPERR ; is the line no. pointer = -1? if so, redo input
lb r5,[r8] ; save the char. pointed to
sb r0,[r8] ; put a zero where the error is
lw r1,CURRNT ; point to start of current line
call PRTLN ; display the line in error up to the 0
or r6,r1,r0 ; save off end pointer
sb r5,[r8] ; restore the character
setlo r1,#'?' ; display a "?"
call GOOUT
setlo r2,#0 ; stop char = 0
subui r1,r6,#1 ; point back to the error char.
call PRTSTG ; display the rest of the line
jmp WSTART ; and do a warm start
 
;******************************************************************
;
; *** GETLN *** FNDLN (& friends) ***
;
; 'GETLN' reads in input line into 'BUFFER'. It first prompts with
; the character in r3 (given by the caller), then it fills the
; buffer and echos. It ignores LF's but still echos
; them back. Control-H is used to delete the last character
; entered (if there is one), and control-X is used to delete the
; whole line and start over again. CR signals the end of a line,
; and causes 'GETLN' to return.
;
;
GETLN:
subui sp,sp,#16
sw lr,[sp]
sw r5,8[sp]
call GOOUT ; display the prompt
setlo r1,#1 ; turn on cursor flash
sb r1,cursFlash
setlo r1,#' ' ; and a space
call GOOUT
setlo r8,#<BUFFER ; r8 is the buffer pointer
sethi r8,#>BUFFER
GL1:
call CHKIO ; check keyboard
beq r1,r0,GL1 ; wait for a char. to come in
beq r1,#CTRLH,GL3 ; delete last character? if so
beq r1,#CTRLX,GL4 ; delete the whole line?
beq r1,#CR,GL2 ; accept a CR
bltu r1,#' ',GL1 ; if other control char., discard it
GL2:
sb r1,[r8] ; save the char.
add r8,r8,#1
call GOOUT ; echo the char back out
lb r1,-1[r8] ; get char back (GOOUT destroys r1)
beq r1,#CR,GL7 ; if it's a CR, end the line
cmpui r1,r8,#BUFFER+BUFLEN-1 ; any more room?
blt r1,r0,GL1 ; yes: get some more, else delete last char.
GL3:
setlo r1,#CTRLH ; delete a char. if possible
call GOOUT
setlo r1,#' '
call GOOUT
cmpui r1,r8,#BUFFER ; any char.'s left?
ble r1,r0,GL1 ; if not
setlo r1,#CTRLH ; if so, finish the BS-space-BS sequence
call GOOUT
sub r8,r8,#1 ; decrement the text pointer
bra GL1 ; back for more
GL4:
or r1,r8,r0 ; delete the whole line
subui r5,r1,#BUFFER ; figure out how many backspaces we need
beq r5,r0,GL6 ; if none needed, brnch
GL5:
setlo r1,#CTRLH ; and display BS-space-BS sequences
call GOOUT
setlo r1,#' '
call GOOUT
setlo r1,#CTRLH
call GOOUT
loop r5,GL5
GL6:
lea r8,BUFFER ; reinitialize the text pointer
bra GL1 ; and go back for more
GL7:
setlo r1,#0 ; turn off cursor flash
sb r1,cursFlash
setlo r1,#LF ; echo a LF for the CR
call GOOUT
lw lr,[sp]
lw r5,8[sp]
ret #16
 
 
; 'FNDLN' finds a line with a given line no. (in r1) in the
; text save area. r9 is used as the text pointer. If the line
; is found, r9 will point to the beginning of that line
; (i.e. the high byte of the line no.), and flags are Z.
; If that line is not there and a line with a higher line no.
; is found, r9 points there and flags are NC & NZ. If we reached
; the end of the text save area and cannot find the line, flags
; are C & NZ.
; Z=1 if line found
; N=1 if end of text save area
; Z=0 & N=0 if higher line found
; r0 = 1 <= line is found
; r9 = pointer to line
; r0 = 0 <= line is not found
; r9 = zero, if end of text area
; r9 = otherwise higher line number
;
; 'FNDLN' will initialize r9 to the beginning of the text save
; area to start the search. Some other entries of this routine
; will not initialize r9 and do the search.
; 'FNDLNP' will start with r9 and search for the line no.
; 'FNDNXT' will bump r9 by 2, find a CR and then start search.
; 'FNDSKP' uses r9 to find a CR, and then starts the search.
; return Z=1 if line is found, r9 = pointer to line
;
; Parameters
; r1 = line number to find
;
FNDLN:
bleui r1,#0xFFFF,fl1 ; line no. must be < 65535
lea r1,msgLineRange
bra ERROR
fl1:
lw r9,TXTBGN ; init. the text save pointer
 
FNDLNP:
lw r10,TXTUNF ; check if we passed the end
subui r10,r10,#1
bgtu r9,r10,FNDRET1 ; if so, return with r9=0,r1=0
lbu r3,[r9] ; get low order byte of line number
lbu r2,1[r9] ; get high order byte
shli r2,r2,#8
or r2,r2,r3 ; build whole line number
bgtu r1,r2,FNDNXT ; is this the line we want? no, not there yet
beq r1,r2,FNDRET2
FNDRET:
xor r1,r1,r1 ; line not found, but r9=next line pointer
ret ; return the cond. codes
FNDRET1:
xor r9,r9,r9 ; no higher line
xor r1,r1,r1 ; line not found
ret
FNDRET2:
setlo r1,#1 ; line found
ret
 
FNDNXT:
addui r9,r9,#2 ; find the next line
 
FNDSKP:
lbu r2,[r9]
addui r9,r9,#1
bnei r2,#CR,FNDSKP ; try to find a CR, keep looking
bra FNDLNP ; check if end of text
 
 
;******************************************************************
; 'MVUP' moves a block up from where r1 points to where r2 points
; until r1=r3
;
MVUP1:
lb r4,[r1]
sb r4,[r2]
add r1,r1,#1
add r2,r2,#1
MVUP:
bne r1,r3,MVUP1
MVRET:
ret
 
 
; 'MVDOWN' moves a block down from where r1 points to where r2
; points until r1=r3
;
MVDOWN1:
sub r1,r1,#1
sub r2,r2,#1
lb r4,[r1]
sb r4,[r2]
MVDOWN:
bne r1,r3,MVDOWN1
ret
 
 
; 'POPA' restores the 'FOR' loop variable save area from the stack
;
; 'PUSHA' stacks for 'FOR' loop variable save area onto the stack
;
; Note: a single zero word is stored on the stack in the
; case that no FOR loops need to be saved. This needs to be
; done because PUSHA / POPA is called all the time.
 
POPA:
lw r1,[sp] ; restore LOPVAR, but zero means no more
sw r1,LOPVAR
beq r1,r0,PP1
lw r1,32[sp] ; if not zero, restore the rest
sw r1,LOPPT
lw r1,24[sp]
sw r1,LOPLN
lw r1,16[sp]
sw r1,LOPLMT
lw r1,8[sp]
sw r1,LOPINC
ret #40
PP1:
ret #8
 
 
PUSHA:
lw r1,STKBOT ; Are we running out of stack room?
addui r1,r1,#40 ; we might need this many bytes
bltu sp,r1,QSORRY ; out of stack space
lw r1,LOPVAR ; save loop variables
beq r1,r0,PU1 ; if LOPVAR is zero, that's all
subui sp,sp,#40
sw r1,[sp]
lw r1,LOPPT
sw r1,32[sp] ; else save all the others
lw r1,LOPLN
sw r1,24[sp]
lw r1,LOPLMT
sw r1,16[sp]
lw r1,LOPINC
sw r1,8[sp]
ret
PU1:
subui sp,sp,#8
sw r1,[sp]
ret
 
 
;******************************************************************
;
; *** PRTSTG *** QTSTG *** PRTNUM *** PRTLN ***
;
; 'PRTSTG' prints a string pointed to by r3. It stops printing
; and returns to the caller when either a CR is printed or when
; the next byte is the same as what was passed in r4 by the
; caller.
;
; 'QTSTG' looks for an underline (back-arrow on some systems),
; single-quote, or double-quote. If none of these are found, returns
; to the caller. If underline, outputs a CR without a LF. If single
; or double quote, prints the quoted string and demands a matching
; end quote. After the printing, the next i-word of the caller is
; skipped over (usually a branch instruction).
;
; 'PRTNUM' prints the 32 bit number in r3, leading blanks are added if
; needed to pad the number of spaces to the number in r4.
; However, if the number of digits is larger than the no. in
; r4, all digits are printed anyway. Negative sign is also
; printed and counted in, positive sign is not.
;
; 'PRTLN' prints the saved text line pointed to by r3
; with line no. and all.
;
 
; r1 = pointer to string
; r2 = stop character
; return r1 = pointer to end of line + 1
 
PRTSTG:
sub sp,sp,#32
sw r5,[sp]
sw r5,8[sp]
sw r7,16[sp]
sw lr,24[sp]
mov r5,r1 ; r5 = pointer
mov r6,r2 ; r6 = stop char
PS1:
lbu r7,[r5] ; get a text character
addui r5,r5,#1
beq r7,r6,PRTRET ; same as stop character? if so, return
mov r1,r7
call GOOUT ; display the char.
bnei r7,#CR,PS1 ; is it a C.R.? no, go back for more
setlo r1,#LF ; yes, add a L.F.
call GOOUT
PRTRET:
mov r2,r7 ; return r2 = stop char
mov r1,r5 ; return r1 = line pointer
lw lr,24[sp]
lw r7,16[sp]
lw r5,8[sp]
lw r5,[sp]
ret #32 ; then return
 
 
QTSTG:
subui sp,sp,#8
sw lr,[sp]
setlo r3,#'"'
setlo r4,#<QT3
sethi r4,#>QT3
call TSTC ; *** QTSTG ***
setlo r2,#'"' ; it is a "
QT1:
or r1,r8,r0
call PRTSTG ; print until another
lw r8,r1
bne r2,#LF,QT2 ; was last one a CR?
addui sp,sp,#8
bra RUNNXL ; if so, run next line
QT3:
setlo r3,#''''
setlo r4,#<QT4
sethi r4,#>QT4
call TSTC ; is it a single quote?
setlo r2,#'''' ; if so, do same as above
bra QT1
QT4:
setlo r3,#'_'
setlo r4,#<QT5
sethi r4,#>QT5
call TSTC ; is it an underline?
setlo r1,#CR ; if so, output a CR without LF
call GOOUT
QT2:
lw lr,[sp]
addui sp,sp,#8
jal r0,4[lr] ; skip over next i-word when returning
QT5: ; not " ' or _
lw lr,[sp]
ret #8
 
 
; Output a CR LF sequence
;
prCRLF:
subui sp,sp,#8
sw lr,[sp]
setlo r1,#CR
call GOOUT
setlo r1,#LF
call GOOUT
lw lr,[sp]
ret #8
 
 
; r1 = number to print
; r2 = number of digits
; Register Usage
; r5 = number of padding spaces
PRTNUM:
subui sp,sp,#40
sw r3,[sp]
sw r5,8[sp]
sw r6,16[sp]
sw r7,24[sp]
sw lr,32[sp]
ori r7,r0,#NUMWKA ; r7 = pointer to numeric work area
mov r6,r1 ; save number for later
mov r5,r2 ; r5 = min number of chars
bgt r1,r0,PN1 ; is it negative? if not
neg r1,r1 ; else make it positive
subui r5,r5,#1 ; one less for width count
PN1:
lw r3,#10
mod r2,r1,r3 ; r2 = r1 mod 10
divui r1,r1,#10 ; r1 /= 10 divide by 10
addui r2,r2,#'0' ; convert remainder to ascii
sb r2,[r7] ; and store in buffer
addui r7,r7,#1
subui r5,r5,#1 ; decrement width
bne r1,r0,PN1
PN6:
ble r5,r0,PN4 ; test pad count, skip padding if not needed
PN3:
setlo r1,#' ' ; display the required leading spaces
call GOOUT
loop r5,PN3
PN4:
bgt r6,r0,PN5 ; is number negative?
setlo r1,#'-' ; if so, display the sign
call GOOUT
PN5:
subui r7,r7,#1
lb r1,[r7] ; now unstack the digits and display
call GOOUT
cmpui r1,r7,#NUMWKA
bgtu r1,r0,PN5
PNRET:
lw lr,32[sp]
lw r7,24[sp]
lw r6,16[sp]
lw r5,8[sp]
lw r3,[sp]
ret #40
 
 
; r1 = number to print
; r2 = number of digits
PRTHEXNUM:
subui sp,sp,#40
sw r5,[sp]
sw r6,8[sp]
sw r7,16[sp]
sw r8,24[sp]
sw lr,32[sp]
setlo r7,#<NUMWKA ; r7 = pointer to numeric work area
sethi r7,#>NUMWKA
or r6,r1,r0 ; save number for later
setlo r5,#20 ; r5 = min number of chars
or r4,r1,r0
bgt r4,r0,PHN1 ; is it negative? if not
neg r4,r4 ; else make it positive
sub r5,r5,#1 ; one less for width count
setlo r8,#20 ; maximum of 10 digits
PHN1:
or r1,r4,r0
andi r1,r1,#15
blt r1,#10,PHN7
addui r1,r1,#'A'-10
bra PHN8
PHN7:
add r1,r1,#'0' ; convert remainder to ascii
PHN8:
sb r1,[r7] ; and store in buffer
add r7,r7,#1
sub r5,r5,#1 ; decrement width
shru r4,r4,#4
beq r4,r0,PHN6 ; is it zero yet ?
loop r8,PHN1 ; safety
PHN6: ; test pad count
ble r5,r0,PHN4 ; skip padding if not needed
PHN3:
setlo r1,#' ' ; display the required leading spaces
call GOOUT
loop r5,PHN3
PHN4:
bgt r6,r0,PHN5 ; is number negative?
setlo r1,#'-' ; if so, display the sign
call GOOUT
PHN5:
sub r7,r7,#1
lb r1,[r7] ; now unstack the digits and display
call GOOUT
cmpui r1,r7,#NUMWKA
bgt r1,r0,PHN5
PHNRET:
lw lr,32[sp]
lw r8,24[sp]
lw r7,16[sp]
lw r6,8[sp]
lw r5,[sp]
ret #40
 
 
; r1 = pointer to line
; returns r1 = pointer to end of line + 1
PRTLN:
subui sp,sp,#16
sw r5,[sp]
sw lr,8[sp]
addi r5,r1,#2
lbu r1,-2[r5] ; get the binary line number
lbu r2,-1[r5]
shli r2,r2,#8
or r1,r1,r2
setlo r2,#0 ; display a 0 or more digit line no.
call PRTNUM
setlo r1,#' ' ; followed by a blank
call GOOUT
setlo r2,#0 ; stop char. is a zero
or r1,r5,r0
call PRTSTG ; display the rest of the line
lw lr,8[sp]
lw r5,[sp]
ret #16
 
 
; ===== Test text byte following the call to this subroutine. If it
; equals the byte pointed to by r8, return to the code following
; the call. If they are not equal, brnch to the point
; indicated in r4.
;
; Registers Affected
; r3,r8
; Returns
; r8 = updated text pointer
;
TSTC
subui sp,sp,#16
sw lr,[sp]
sw r1,8[sp]
call IGNBLK ; ignore leading blanks
lb r1,[r8]
beq r3,r1,TC1 ; is it = to what r8 points to? if so
lw r1,8[sp]
lw lr,[sp]
addui sp,sp,#16
jal r0,[r4] ; jump to the routine
TC1:
add r8,r8,#1 ; if equal, bump text pointer
lw r1,8[sp]
lw lr,[sp]
ret #16
 
; ===== See if the text pointed to by r8 is a number. If so,
; return the number in r2 and the number of digits in r3,
; else return zero in r2 and r3.
; Registers Affected
; r1,r2,r3,r4
; Returns
; r1 = number
; r2 = number of digits in number
; r8 = updated text pointer
;
TSTNUM:
subui sp,sp,#8
sw lr,[sp]
call IGNBLK ; skip over blanks
setlo r1,#0 ; initialize return parameters
setlo r2,#0
TN1:
lb r3,[r8]
bltui r3,#'0',TSNMRET ; is it less than zero?
bgtui r3,#'9',TSNMRET ; is it greater than nine?
setlo r4,#0xFFFFFFFF
sethi r4,#0x07FFFFFF
bleu r1,r4,TN2 ; see if there's room for new digit
setlo r1,msgNumTooBig
bra ERROR ; if not, we've overflowd
TN2:
mului r1,r1,#10 ; quickly multiply result by 10
addi r8,r8,#1 ; adjust text pointer
andi r3,r3,#0x0F ; add in the new digit
add r1,r1,r3
addi r2,r2,#1 ; increment the no. of digits
bra TN1
TSNMRET:
lw lr,[sp]
ret #8
 
 
;===== Skip over blanks in the text pointed to by r8.
;
; Registers Affected:
; r8
; Returns
; r8 = pointer updateded past any spaces or tabs
;
IGNBLK:
subui sp,sp,#8
sw r1,[sp]
IGB2:
lb r1,[r8] ; get char
beqi r1,#' ',IGB1 ; see if it's a space
bnei r1,#'\t',IGBRET ; or a tab
IGB1:
add r8,r8,#1 ; increment the text pointer
bra IGB2
IGBRET:
lw r1,[sp]
ret #8
 
 
; ===== Convert the line of text in the input buffer to upper
; case (except for stuff between quotes).
;
; Registers Affected
; r1,r3
; Returns
; r8 = pointing to end of text in buffer
;
TOUPBUF:
subui sp,sp,#8
sw lr,[sp]
setlo r8,BUFFER ; set up text pointer
setlo r3,#0 ; clear quote flag
TOUPB1:
lb r1,[r8] ; get the next text char.
add r8,r8,#1
beqi r1,#CR,TOUPBRT ; is it end of line?
beqi r1,#'"',DOQUO ; a double quote?
beqi r1,#'''',DOQUO ; or a single quote?
bne r3,r0,TOUPB1 ; inside quotes?
call toUpper ; convert to upper case
sb r1,-1[r8] ; store it
bra TOUPB1 ; and go back for more
DOQUO:
bne r3,r0,DOQUO1; are we inside quotes?
or r3,r1,r0 ; if not, toggle inside-quotes flag
bra TOUPB1
DOQUO1:
bne r3,r1,TOUPB1 ; make sure we're ending proper quote
setlo r3,#0 ; else clear quote flag
bra TOUPB1
TOUPBRT:
lw lr,[sp]
ret #8
 
 
; ===== Convert the character in r1 to upper case
;
toUpper
blt r1,#'a',TOUPRET ; is it < 'a'?
bgt r1,#'z',TOUPRET ; or > 'z'?
sub r1,r1,#32 ; if not, make it upper case
TOUPRET
ret
 
 
; 'CHKIO' checks the input. If there's no input, it will return
; to the caller with the r1=0. If there is input, the input byte is in r1.
; However, if a control-C is read, 'CHKIO' will warm-start BASIC and will
; not return to the caller.
;
CHKIO:
subui sp,sp,#8 ; save link reg
sw lr,[sp]
call GOIN ; get input if possible
beq r1,#-1,CHKRET2 ; if Zero, no input
bnei r1,#CTRLC,CHKRET ; is it control-C?
jmp WSTART ; if so, do a warm start
CHKRET2:
xor r1,r1,r1
CHKRET:
lw lr,[sp] ;r1=0
ret #8
 
 
; ===== Display a CR-LF sequence
;
CRLF:
setlo r1,CLMSG
 
 
; ===== Display a zero-ended string pointed to by register r1
; Registers Affected
; r1,r2,r4
;
PRMESG:
subui sp,sp,#16
sw r5,[sp]
sw lr,8[sp]
mov r5,r1 ; r5 = pointer to message
PRMESG1:
add r5,r5,#1
lb r1,-1[r5] ; get the char.
beq r1,r0,PRMRET
call GOOUT ;else display it trashes r4
bra PRMESG1
PRMRET:
mov r1,r5
lw lr,8[sp]
lw r5,[sp]
ret #16
 
 
; ===== Display a zero-ended string pointed to by register r1
; Registers Affected
; r1,r2,r3
;
PRMESGAUX:
subui sp,sp,#16
sw r5,[sp]
sw lr,8[sp]
mov r5,r1 ; r3 = pointer
PRMESGA1:
addui r5,r5,#1
lb r1,-1[r5] ; get the char.
beq r1,r0,PRMRETA
call GOAUXO ;else display it
bra PRMESGA1
PRMRETA:
mov r1,r5
lw lr,8[sp]
lw r5,[sp]
ret #16
 
;*****************************************************
; The following routines are the only ones that need *
; to be changed for a different I/O environment. *
;*****************************************************
 
 
; ===== Output character to the console (Port 1) from register r1
; (Preserves all registers.)
;
OUTC:
jmp DisplayChar
 
 
; ===== Input a character from the console into register D0 (or
; return Zero status if there's no character available).
;
INC:
jmp KeybdGetChar
 
 
;*
;* ===== Input a character from the host into register r1 (or
;* return Zero status if there's no character available).
;*
AUXIN:
inb r1,UART_LS ; is character ready ?
andi r1,r1,#rxfull
beq r1,r0,AXIRET ;if not, return Zero status
inb r1,UART ; else get the character
call SerialGetChar
beqi r1,#-1,AXIRET_ZERO
andi r1,r1,#0x7f ;zero out the high bit
AXIRET:
ret
AXIRET_ZERO:
xor r1,r1,r1
ret
 
;*
;* ===== Return to the resident monitor, operating system, etc.
;*
; ===== Output character to the host (Port 2) from register r1
; (Preserves all registers.)
;
AUXOUT
jmp SerialPutChar ; call boot rom routine
 
 
_cls
call clearScreen
bra FINISH
 
_wait10
ret
_getATAStatus
ret
_waitCFNotBusy
ret
_rdcf
br FINISH
rdcf6
br ERROR
 
 
; ===== Return to the resident monitor, operating system, etc.
;
BYEBYE:
jmp Monitor
; MOVE.B #228,D7 ;return to Tutor
lw sp,OSSP
lw lr,[sp]
ret #8
 
; MOVE.B #228,D7 return to Tutor
; TRAP #14
 
align 16
.align 16
msgInit db CR,LF,"Raptor64 Tiny BASIC v1.0",CR,LF,"(C) 2012 Robert Finch",CR,LF,LF,0
OKMSG db CR,LF,"OK",CR,LF,0
msgWhat db "What?",CR,LF,0
1283,49 → 5153,18
msgTooBig db "Program is too big",CR,LF,0
msgExtraChars db "Extra characters on line ignored",CR,LF,0
 
INITMSG:
db CR,LF,'Raptor64 Tiny BASIC, v1.0',CR,LF,LF,0
OKMSG:
db CR,LF,'OK',CR,LF,0
HOWMSG:
db 'How?',CR,LF,0
WHTMSG:
db 'What?',CR,LF,0
SRYMSG:
db 'Sorry.'
CLMSG:
db CR,LF,0
; DC.B 0 ;<- for aligning on a word boundary
align 16
LSTROM EQU $
; end of possible ROM area
align 8
LSTROM equ * ; end of possible ROM area
; END
 
bss
align 16
;*
;* ===== Return to the resident monitor, operating system, etc.
;*
BYEBYE:
jmp Monitor
; MOVE.B #228,D7 ;return to Tutor
; TRAP #14
 
org 0x0080
typef db 0 ; variable / expression type
align 8
OSSP dw 1 ; OS value of sp
CURRNT dw 1 ; Current line pointer
STKGOS dw 1 ; Saves stack pointer in 'GOSUB'
STKINP dw 1 ; Saves stack pointer during 'INPUT'
LOPVAR dw 1 ; 'FOR' loop save area
LOPINC dw 1 ; increment
LOPLMT dw 1 ; limit
LOPLN dw 1 ; line number
LOPPT dw 1 ; text pointer
TXTUNF dw 1 ; points to unfilled text area
VARBGN dw 1 ; points to variable area
IVARBGN dw 1 ; points to integer variable area
SVARBGN dw 1 ; points to string variable area
FVARBGN dw 1 ; points to float variable area
STKBOT dw 1 ; holds lower limit for stack growth
NUMWKA fill.b 12,0 ; numeric work area
BUFFER fill.b BUFLEN,0x00 ; Keyboard input buffer
 
 
;==============================================================================
; Checkerboard RAM tester
;==============================================================================
1390,23 → 5229,120
ret
 
;-------------------------------------------
;-------------------------------------------
;
iberr_rout:
lea r1,msgiberr
call DisplayString
mfspr r1,EPC
call DisplayWord
wait
jmp start
dberr_rout:
lea r1,msgdberr
call DisplayString
mfspr r1,ERRADR
call DisplayWord
lea r1,msgEPC
call DisplayString
mfspr r1,EPC
call DisplayWord
call CRLF
lw r2,#31
dberr1:
mtspr PCHI,r2
nop
nop
nop
mfspr r1,PCHISTORIC
call DisplayWord
call CRLF
loop r2,dberr1
wait
jmp start
.align 16
msgdberr:
db "Data bus error at: ",0
msgEPC:
db " EPC: ",0
msgiberr:
db "Err fetching instruction at: ",0
.align 16
 
;------------------------------------------------------------------------------
; IRQ routine
;-------------------------------------------
;------------------------------------------------------------------------------
;
irqrout:
subui sp,sp,#16
sm [sp],r1/lr
inch r1,PIC
beqi r1,#1,ColdStart
irqrout3:
bnei r1,#2,irqrout2
call Pulse1000
bra irqrout1
irqrout2:
bnei r1,#15,irqrout1
subui sp,sp,#32
sw r1,[sp] ; save off a working register
sw r2,8[sp] ; and a second work register
sw r26,16[sp] ; save off implicit constant builder reg
sw lr,24[sp]
inch r1,PIC ; r1= which IRQ line is active
; 1000 Hz interrupt
; This IRQ must be fast, so it's placed inline
; Increments the millisecond counter, and switches to the next context
;
irq1000Hz:
bnei r1,#2,irq100Hz
outb r0,0xFFFFFFFF_FFFF0000 ; acknowledge interrupt
lw r1,Milliseconds ; increment milliseconds count
addui r1,r1,#1
sw r1,Milliseconds
lea r2,TEXTSCR
inch r1,332[r2]
addui r1,r1,#1
outc r1,332[r2]
lw lr,24[sp]
lw r26,16[sp] ; restore registers from stack
lw r2,8[sp]
lw r1,[sp]
addui sp,sp,#32 ; restore stack pointer
iepp ; move to the next context
nop
nop
nop
iret ; return to the next context
 
; 100 Hz interrupt
; This IRQ could have some work to do, including flashing a cursor. So
; we call a subroutine.
;
irq100Hz:
bnei r1,#3,irqSerial
lw r1,p100IRQvec
; jal lr,[r1]
call Pulse100
bra irqret
 
irqSerial:
bnei r1,#8,irqRaster
lw r1,serialIRQvec
jal lr,[r1]
bra irqret
 
irqRaster:
bnei r1,#13,irqKeybd
lw r1,rasterIRQvec
; jal lr,[r1]
call RasterIRQfn
bra irqret
 
irqKeybd:
beqi r1,#1,ColdStart ; CTRL-ALT-DEL interrupt
bnei r1,#15,irqret
lw r1,keybdIRQvec
call KeybdIRQ
irqrout1:
lm [sp],r1/lr
addui sp,sp,#16
; jal lr,[r1]
 
irqret:
lw lr,24[sp]
lw r26,16[sp] ; restore registers from stack
lw r2,8[sp]
lw r1,[sp]
addui sp,sp,#32 ; restore stack pointer
iret
 
;-------------------------------------------
1440,9 → 5376,8
lw r1,0xFFFF_FFFF_FFFF_0000
lw r2,0xFFFF_FFFF_FFFF_0008
iret
nop
nop
.align 32
 
org 0xFFFF_FFFF_FFFF_FFB0
jmp DTLBHandler
nop
1451,14 → 5386,14
jmp DTLBHandler
nop
nop
org 0xFFFF_FFFF_FFFF_FFD0
jmp irqrout
nop
nop
 
; NMI vector
org 0xFFFF_FFFF_FFFF_FFE0
jmp nmirout
nop
nop
; RST vector
org 0xFFFF_FFFF_FFFF_FFF0
jmp start
nop
/raptor64/trunk/software/sample code/bootrom.v
1,674 → 1,1880
64'hFFFFFFFFFFFFE800: romout <= 64'hFFE980CFFFFFFA54;
64'hFFFFFFFFFFFFE808: romout <= 64'h0CFFFFFFA9033FFF;
64'hFFFFFFFFFFFFE810: romout <= 64'hFFEA48CFFFFFFAA6;
64'hFFFFFFFFFFFFE818: romout <= 64'h0CFFFFFFB6533FFF;
64'hFFFFFFFFFFFFE820: romout <= 64'h000028CFFFFFFBF5;
64'hFFFFFFFFFFFFE828: romout <= 64'h0000000000C00000;
64'hFFFFFFFFFFFFE830: romout <= 64'hFFE9B8BEFFFEFFF8;
64'hFFFFFFFFFFFFE838: romout <= 64'h0C7FFFFFA5031FFF;
64'hFFFFFFFFFFFFE840: romout <= 64'h0003380000000040;
64'hFFFFFFFFFFFFE848: romout <= 64'h1880600041428C00;
64'hFFFFFFFFFFFFE850: romout <= 64'h0000810806000414;
64'hFFFFFFFFFFFFE858: romout <= 64'h1880600041628C00;
64'hFFFFFFFFFFFFE860: romout <= 64'h0010590804000416;
64'hFFFFFFFFFFFFE868: romout <= 64'h2F8860000A842010;
64'hFFFFFFFFFFFFE870: romout <= 64'h001050000000000D;
64'hFFFFFFFFFFFFE878: romout <= 64'h0C7FFFFFB0642018;
64'hFFFFFFFFFFFFE880: romout <= 64'h001058C7FFFFFAF4;
64'hFFFFFFFFFFFFE888: romout <= 64'h1880000041862000;
64'hFFFFFFFFFFFFE890: romout <= 64'hFFFFFCA1FFFFE920;
64'hFFFFFFFFFFFFE898: romout <= 64'h0C7FFFFFBF5387FF;
64'hFFFFFFFFFFFFE8A0: romout <= 64'h0005240802000AA8;
64'hFFFFFFFFFFFFE8A8: romout <= 64'h0A176543210BE100;
64'hFFFFFFFFFFFFE8B0: romout <= 64'h0026A408400008A9;
64'hFFFFFFFFFFFFE8B8: romout <= 64'h0A1FEDCBA9802100;
64'hFFFFFFFFFFFFE8C0: romout <= 64'h0028A40840000929;
64'hFFFFFFFFFFFFE8C8: romout <= 64'h0CFFFFFFCA602100;
64'hFFFFFFFFFFFFE8D0: romout <= 64'h000062F801FFFFCA;
64'hFFFFFFFFFFFFE8D8: romout <= 64'h27F400000030FEF0;
64'hFFFFFFFFFFFFE8E0: romout <= 64'h000000A2FFFFE910;
64'hFFFFFFFFFFFFE8E8: romout <= 64'h2F84000010840208;
64'hFFFFFFFFFFFFE8F0: romout <= 64'h000004C7FFFFFA60;
64'hFFFFFFFFFFFFE8F8: romout <= 64'h2F801FFFFAA0A210;
64'hFFFFFFFFFFFFE900: romout <= 64'h0000627740000003;
64'hFFFFFFFFFFFFE908: romout <= 64'h3780000000037EF8;
64'hFFFFFFFFFFFFE910: romout <= 64'h6F57206F6C6C6548;
64'hFFFFFFFFFFFFE918: romout <= 64'h0000000021646C72;
64'hFFFFFFFFFFFFE920: romout <= 64'h3436726F74706152;
64'hFFFFFFFFFFFFE928: romout <= 64'h206D657473797320;
64'hFFFFFFFFFFFFE930: romout <= 64'h676E697472617473;
64'hFFFFFFFFFFFFE938: romout <= 64'h00000A0D2E2E2E2E;
64'hFFFFFFFFFFFFE940: romout <= 64'h703FC8A1FFFF8007;
64'hFFFFFFFFFFFFE948: romout <= 64'h0DFBE0000009200F;
64'hFFFFFFFFFFFFE950: romout <= 64'h0000003FBC000008;
64'hFFFFFFFFFFFFE958: romout <= 64'h0A1FFDC0A0067E18;
64'hFFFFFFFFFFFFE960: romout <= 64'h0000060046000001;
64'hFFFFFFFFFFFFE968: romout <= 64'h2F8C000000814318;
64'hFFFFFFFFFFFFE970: romout <= 64'h0000011F86000000;
64'hFFFFFFFFFFFFE978: romout <= 64'h0DFBE00000880108;
64'hFFFFFFFFFFFFE980: romout <= 64'h0000203FBC000010;
64'hFFFFFFFFFFFFE988: romout <= 64'h19F8600000067E10;
64'hFFFFFFFFFFFFE990: romout <= 64'h000004A3FFDC0A00;
64'hFFFFFFFFFFFFE998: romout <= 64'h0508400004080310;
64'hFFFFFFFFFFFFE9A0: romout <= 64'h000002F881FFFFA8;
64'hFFFFFFFFFFFFE9A8: romout <= 64'h11F8600000090308;
64'hFFFFFFFFFFFFE9B0: romout <= 64'h0000411F84000008;
64'hFFFFFFFFFFFFE9B8: romout <= 64'h1800000045037EF8;
64'hFFFFFFFFFFFFE9C0: romout <= 64'h0000058000000451;
64'hFFFFFFFFFFFFE9C8: romout <= 64'h1800200041A28400;
64'hFFFFFFFFFFFFE9D0: romout <= 64'h000060DFBE000000;
64'hFFFFFFFFFFFFE9D8: romout <= 64'h27F000000070FEF0;
64'hFFFFFFFFFFFFE9E0: romout <= 64'h00003D2802000450;
64'hFFFFFFFFFFFFE9E8: romout <= 64'h0A30000044014108;
64'hFFFFFFFFFFFFE9F0: romout <= 64'h700000E300000000;
64'hFFFFFFFFFFFFE9F8: romout <= 64'h24801DC000282017;
64'hFFFFFFFFFFFFEA00: romout <= 64'h000005A8C2200010;
64'hFFFFFFFFFFFFEA08: romout <= 64'h0504200000F0A108;
64'hFFFFFFFFFFFFEA10: romout <= 64'h0011458002000450;
64'hFFFFFFFFFFFFEA18: romout <= 64'h2F8440001094A010;
64'hFFFFFFFFFFFFEA20: romout <= 64'h00003C2884000001;
64'hFFFFFFFFFFFFEA28: romout <= 64'h1800400045114210;
64'hFFFFFFFFFFFFEA30: romout <= 64'h0000627700000007;
64'hFFFFFFFFFFFFEA38: romout <= 64'h0DFBE0000000BEF0;
64'hFFFFFFFFFFFFEA40: romout <= 64'h000001800200041A;
64'hFFFFFFFFFFFFEA48: romout <= 64'h03FBC00001037EF8;
64'hFFFFFFFFFFFFEA50: romout <= 64'h0011467F00000006;
64'hFFFFFFFFFFFFEA58: romout <= 64'h128020004504A010;
64'hFFFFFFFFFFFFEA60: romout <= 64'h001102F844000148;
64'hFFFFFFFFFFFFEA68: romout <= 64'h1A8C410000528C00;
64'hFFFFFFFFFFFFEA70: romout <= 64'h00003C2884000001;
64'hFFFFFFFFFFFFEA78: romout <= 64'h1800400045114210;
64'hFFFFFFFFFFFFEA80: romout <= 64'h0000427700000006;
64'hFFFFFFFFFFFFEA88: romout <= 64'h0A1FFFFFFFF37EF8;
64'hFFFFFFFFFFFFEA90: romout <= 64'h0000427700000006;
64'hFFFFFFFFFFFFEA98: romout <= 64'h1280200045137EF8;
64'hFFFFFFFFFFFFEAA0: romout <= 64'h0002A12804000450;
64'hFFFFFFFFFFFFEAA8: romout <= 64'h0A100000001BE110;
64'hFFFFFFFFFFFFEAB0: romout <= 64'h400028DFBE000000;
64'hFFFFFFFFFFFFEAB8: romout <= 64'h0DFBE00000004108;
64'hFFFFFFFFFFFFEAC0: romout <= 64'h0002860803DC0000;
64'hFFFFFFFFFFFFEAC8: romout <= 64'h0A100000001BE100;
64'hFFFFFFFFFFFFEAD0: romout <= 64'h400028DFBE000000;
64'hFFFFFFFFFFFFEAD8: romout <= 64'h0DFBE00000004108;
64'hFFFFFFFFFFFFEAE0: romout <= 64'h0000083FBC000010;
64'hFFFFFFFFFFFFEAE8: romout <= 64'h0A2FFDC00009FD00;
64'hFFFFFFFFFFFFEAF0: romout <= 64'h0000060803DC0000;
64'hFFFFFFFFFFFFEAF8: romout <= 64'h24801DC0002BE100;
64'hFFFFFFFFFFFFEB00: romout <= 64'h00106850420000FF;
64'hFFFFFFFFFFFFEB08: romout <= 64'h2F88000012840010;
64'hFFFFFFFFFFFFEB10: romout <= 64'hFFF026C84010000D;
64'hFFFFFFFFFFFFEB18: romout <= 64'h2F8000000AA31FFF;
64'hFFFFFFFFFFFFEB20: romout <= 64'h000008C7FFFFFB65;
64'hFFFFFFFFFFFFEB28: romout <= 64'h0DFBE0000109DD00;
64'hFFFFFFFFFFFFEB30: romout <= 64'h00000C3FBC000018;
64'hFFFFFFFFFFFFEB38: romout <= 64'h118020004009FD00;
64'hFFFFFFFFFFFFEB40: romout <= 64'h0010002842000001;
64'hFFFFFFFFFFFFEB48: romout <= 64'h0A2FFD0000066008;
64'hFFFFFFFFFFFFEB50: romout <= 64'h00000508820000DE;
64'hFFFFFFFFFFFFEB58: romout <= 64'h188820000DE0A108;
64'hFFFFFFFFFFFFEB60: romout <= 64'h0010010801FF0000;
64'hFFFFFFFFFFFFEB68: romout <= 64'h0504200007F46008;
64'hFFFFFFFFFFFFEB70: romout <= 64'hFFEB86C840080040;
64'hFFFFFFFFFFFFEB78: romout <= 64'h2774000000331FFF;
64'hFFFFFFFFFFFFEB80: romout <= 64'h000080DFBE000018;
64'hFFFFFFFFFFFFEB88: romout <= 64'h27F400000070FEF0;
64'hFFFFFFFFFFFFEB90: romout <= 64'h040000C7FFFFFB55;
64'hFFFFFFFFFFFFEB98: romout <= 64'h108440000000A108;
64'hFFFFFFFFFFFFEBA0: romout <= 64'h0000002884000001;
64'hFFFFFFFFFFFFEBA8: romout <= 64'h1180400040862110;
64'hFFFFFFFFFFFFEBB0: romout <= 64'h001052F8440000A8;
64'hFFFFFFFFFFFFEBB8: romout <= 64'h1888600000042018;
64'hFFFFFFFFFFFFEBC0: romout <= 64'h00001D9802000408;
64'hFFFFFFFFFFFFEBC8: romout <= 64'h0DFBE0000209DD00;
64'hFFFFFFFFFFFFEBD0: romout <= 64'h00003C3FBC000028;
64'hFFFFFFFFFFFFEBD8: romout <= 64'h0A1000005549FD00;
64'hFFFFFFFFFFFFEBE0: romout <= 64'h800060A200000300;
64'hFFFFFFFFFFFFEBE8: romout <= 64'h0100440000904110;
64'hFFFFFFFFFFFFEBF0: romout <= 64'h800000A129292929;
64'hFFFFFFFFFFFFEBF8: romout <= 64'h0E30000000128C00;
64'hFFFFFFFFFFFFEC00: romout <= 64'h00001190C2000000;
64'hFFFFFFFFFFFFEC08: romout <= 64'h2F80400000F0A318;
64'hFFFFFFFFFFFFEC10: romout <= 64'h0000A2774000000F;
64'hFFFFFFFFFFFFEC18: romout <= 64'h03FBC00002837EF8;
64'hFFFFFFFFFFFFEC20: romout <= 64'h6800027F4000000F;
64'hFFFFFFFFFFFFEC28: romout <= 64'h108C200000028FFF;
64'hFFFFFFFFFFFFEC30: romout <= 64'h80006108C4000002;
64'hFFFFFFFFFFFFEC38: romout <= 64'h0A10000002004110;
64'hFFFFFFFFFFFFEC40: romout <= 64'hFFED150808000414;
64'hFFFFFFFFFFFFEC48: romout <= 64'h0A3FFD0000031FFF;
64'hFFFFFFFFFFFFEC50: romout <= 64'h04000188C2000000;
64'hFFFFFFFFFFFFEC58: romout <= 64'h028C600000262320;
64'hFFFFFFFFFFFFEC60: romout <= 64'h00003EF805FFFF8F;
64'hFFFFFFFFFFFFEC68: romout <= 64'h0DFBE0000289DD00;
64'hFFFFFFFFFFFFEC70: romout <= 64'h00003C3FBC000028;
64'hFFFFFFFFFFFFEC78: romout <= 64'h0A3FFDA00009FD00;
64'hFFFFFFFFFFFFEC80: romout <= 64'h00000908C2000000;
64'hFFFFFFFFFFFFEC88: romout <= 64'h0104420001842310;
64'hFFFFFFFFFFFFEC90: romout <= 64'h4000001082200005;
64'hFFFFFFFFFFFFEC98: romout <= 64'h1A8C240000128FFF;
64'hFFFFFFFFFFFFECA0: romout <= 64'h00000988C8000000;
64'hFFFFFFFFFFFFECA8: romout <= 64'h2F805FFFFCF0A318;
64'hFFFFFFFFFFFFECB0: romout <= 64'h000008A3FFDA0000;
64'hFFFFFFFFFFFFECB8: romout <= 64'h0384200000142308;
64'hFFFFFFFFFFFFECC0: romout <= 64'h00003CC7FFFFFB34;
64'hFFFFFFFFFFFFECC8: romout <= 64'h0DFBE0000289DD00;
64'hFFFFFFFFFFFFECD0: romout <= 64'h00001C3FBC000018;
64'hFFFFFFFFFFFFECD8: romout <= 64'h0A3FFDA00009FC00;
64'hFFFFFFFFFFFFECE0: romout <= 64'hC0006108C4000000;
64'hFFFFFFFFFFFFECE8: romout <= 64'h018C608000004208;
64'hFFFFFFFFFFFFECF0: romout <= 64'h00008028C7D00000;
64'hFFFFFFFFFFFFECF8: romout <= 64'h188C200000028400;
64'hFFFFFFFFFFFFED00: romout <= 64'hFFFF3C28C6000002;
64'hFFFFFFFFFFFFED08: romout <= 64'h27700000007BE017;
64'hFFFFFFFFFFFFED10: romout <= 64'h0003FCDFBE000018;
64'hFFFFFFFFFFFFED18: romout <= 64'h2A04024004114108;
64'hFFFFFFFFFFFFED20: romout <= 64'h5001EAB04014005A;
64'hFFFFFFFFFFFFED28: romout <= 64'h2A040140061AE100;
64'hFFFFFFFFFFFFED30: romout <= 64'h0004003042000060;
64'hFFFFFFFFFFFFED38: romout <= 64'h0DFBE00000016108;
64'hFFFFFFFFFFFFED40: romout <= 64'h40006850420000FF;
64'hFFFFFFFFFFFFED48: romout <= 64'h0284200003CAE100;
64'hFFFFFFFFFFFFED50: romout <= 64'h001058DFBE000000;
64'hFFFFFFFFFFFFED58: romout <= 64'h0504200007F42008;
64'hFFFFFFFFFFFFED60: romout <= 64'h000000A3FFDA0000;
64'hFFFFFFFFFFFFED68: romout <= 64'h0108220001882310;
64'hFFFFFFFFFFFFED70: romout <= 64'h0001FD0802000418;
64'hFFFFFFFFFFFFED78: romout <= 64'h0108220000314108;
64'hFFFFFFFFFFFFED80: romout <= 64'h20000248C4000016;
64'hFFFFFFFFFFFFED88: romout <= 64'h02883D0000006210;
64'hFFFFFFFFFFFFED90: romout <= 64'h800034DFBE000000;
64'hFFFFFFFFFFFFED98: romout <= 64'h03FBC000020B2100;
64'hFFFFFFFFFFFFEDA0: romout <= 64'h0010627F40000007;
64'hFFFFFFFFFFFFEDA8: romout <= 64'h2F8000001AA62000;
64'hFFFFFFFFFFFFEDB0: romout <= 64'h000082C840340091;
64'hFFFFFFFFFFFFEDB8: romout <= 64'h27F400000070FEF0;
64'hFFFFFFFFFFFFEDC0: romout <= 64'h5000E10804000418;
64'hFFFFFFFFFFFFEDC8: romout <= 64'h02884000001B0200;
64'hFFFFFFFFFFFFEDD0: romout <= 64'hFFED558804000418;
64'hFFFFFFFFFFFFEDD8: romout <= 64'h2774000000731FFF;
64'hFFFFFFFFFFFFEDE0: romout <= 64'hC00240DFBE000020;
64'hFFFFFFFFFFFFEDE8: romout <= 64'h03FBC000020B2100;
64'hFFFFFFFFFFFFEDF0: romout <= 64'h00105A7F40000007;
64'hFFFFFFFFFFFFEDF8: romout <= 64'h2C0BFE4000042010;
64'hFFFFFFFFFFFFEE00: romout <= 64'h0010583884000001;
64'hFFFFFFFFFFFFEE08: romout <= 64'h2F801FFFEAA62010;
64'hFFFFFFFFFFFFEE10: romout <= 64'h000082C840280093;
64'hFFFFFFFFFFFFEE18: romout <= 64'h27F400000070FEF0;
64'hFFFFFFFFFFFFEE20: romout <= 64'hD000010804000418;
64'hFFFFFFFFFFFFEE28: romout <= 64'h03884000001B02FE;
64'hFFFFFFFFFFFFEE30: romout <= 64'hFFF4A98804000418;
64'hFFFFFFFFFFFFEE38: romout <= 64'h2C840340092BE007;
64'hFFFFFFFFFFFFEE40: romout <= 64'h00001C3FBC000020;
64'hFFFFFFFFFFFFEE48: romout <= 64'h108040004169FD00;
64'hFFFFFFFFFFFFEE50: romout <= 64'h000006C0BF84001E;
64'hFFFFFFFFFFFFEE58: romout <= 64'h188040004160A210;
64'hFFFFFFFFFFFFEE60: romout <= 64'hD00252F801FFFBAA;
64'hFFFFFFFFFFFFEE68: romout <= 64'h03FBC000020B2100;
64'hFFFFFFFFFFFFEE70: romout <= 64'h0010627F40000007;
64'hFFFFFFFFFFFFEE78: romout <= 64'h2F8800000C842010;
64'hFFFFFFFFFFFFEE80: romout <= 64'hFFEAA98800000418;
64'hFFFFFFFFFFFFEE88: romout <= 64'h18800000416BE007;
64'hFFFFFFFFFFFFEE90: romout <= 64'h0000C2F801FFFA2A;
64'hFFFFFFFFFFFFEE98: romout <= 64'h27F4000001F0FEF0;
64'hFFFFFFFFFFFFEEA0: romout <= 64'hFFED56C840180099;
64'hFFFFFFFFFFFFEEA8: romout <= 64'h0100230000931FFF;
64'hFFFFFFFFFFFFEEB0: romout <= 64'h0006A90802000418;
64'hFFFFFFFFFFFFEEB8: romout <= 64'h2C840680008BE000;
64'hFFFFFFFFFFFFEEC0: romout <= 64'h0012A10804000418;
64'hFFFFFFFFFFFFEEC8: romout <= 64'h03884000001BE200;
64'hFFFFFFFFFFFFEED0: romout <= 64'hFFED558804000418;
64'hFFFFFFFFFFFFEED8: romout <= 64'h0100230000931FFF;
64'hFFFFFFFFFFFFEEE0: romout <= 64'h0000090802000418;
64'hFFFFFFFFFFFFEEE8: romout <= 64'h188C400000042310;
64'hFFFFFFFFFFFFEEF0: romout <= 64'h00000428C6000002;
64'hFFFFFFFFFFFFEEF8: romout <= 64'h0A4FFDA00000A108;
64'hFFFFFFFFFFFFEF00: romout <= 64'hFFFC92090A000000;
64'hFFFFFFFFFFFFEF08: romout <= 64'h0A200000020BE12F;
64'hFFFFFFFFFFFFEF10: romout <= 64'h0008A988C5FFFFFE;
64'hFFFFFFFFFFFFEF18: romout <= 64'h2C04040000ABE000;
64'hFFFFFFFFFFFFEF20: romout <= 64'hFFED541002400009;
64'hFFFFFFFFFFFFEF28: romout <= 64'h0100230000931FFF;
64'hFFFFFFFFFFFFEF30: romout <= 64'hFFED141008100009;
64'hFFFFFFFFFFFFEF38: romout <= 64'h188C200000031FFF;
64'hFFFFFFFFFFFFEF40: romout <= 64'h00007CC7FFFFFBD8;
64'hFFFFFFFFFFFFEF48: romout <= 64'h0DFBE0000309DD00;
64'hFFFFFFFFFFFFEF50: romout <= 64'h00007CC7FFFFFBE4;
64'hFFFFFFFFFFFFEF58: romout <= 64'h0DFBE0000309DD00;
64'hFFFFFFFFFFFFEF60: romout <= 64'h00001C3FBC000020;
64'hFFFFFFFFFFFFEF68: romout <= 64'h108020004189FD00;
64'hFFFFFFFFFFFFEF70: romout <= 64'h0010602842000001;
64'hFFFFFFFFFFFFEF78: romout <= 64'h20805DA000062008;
64'hFFFFFFFFFFFFEF80: romout <= 64'h001062F844000226;
64'hFFFFFFFFFFFFEF88: romout <= 64'h2F8000000CA62000;
64'hFFFFFFFFFFFFEF90: romout <= 64'h00001C3FBC000020;
64'hFFFFFFFFFFFFEF98: romout <= 64'h108020004169FD00;
64'hFFFFFFFFFFFFEFA0: romout <= 64'h0010582842000001;
64'hFFFFFFFFFFFFEFA8: romout <= 64'h20805DA000262008;
64'hFFFFFFFFFFFFEFB0: romout <= 64'h000006F8440000A6;
64'hFFFFFFFFFFFFEFB8: romout <= 64'h188040004160E210;
64'hFFFFFFFFFFFFEFC0: romout <= 64'hFFED54C7FFFFFB1C;
64'hFFFFFFFFFFFFEFC8: romout <= 64'h2774000000731FFF;
64'hFFFFFFFFFFFFEFD0: romout <= 64'h000060DFBE000020;
64'hFFFFFFFFFFFFEFD8: romout <= 64'h27F400000030DEF0;
64'hFFFFFFFFFFFFEFE0: romout <= 64'h0000001040200009;
64'hFFFFFFFFFFFFEFE8: romout <= 64'h028840000014A208;
64'hFFFFFFFFFFFFEFF0: romout <= 64'hFFED96F840000088;
64'hFFFFFFFFFFFFEFF8: romout <= 64'h2F801FFFFAA31FFF;
64'hFFFFFFFFFFFFF000: romout <= 64'h0000627740000003;
64'hFFFFFFFFFFFFF008: romout <= 64'h03FBC00000837EF8;
64'hFFFFFFFFFFFFF010: romout <= 64'hFFEFD59FBE000000;
64'hFFFFFFFFFFFFF018: romout <= 64'h11FBE00000031FFF;
64'hFFFFFFFFFFFFF020: romout <= 64'h0000402FBC000008;
64'hFFFFFFFFFFFFF028: romout <= 64'h19F820000000FEF0;
64'hFFFFFFFFFFFFF030: romout <= 64'h0000359FBE000008;
64'hFFFFFFFFFFFFF038: romout <= 64'h0C7FFFFFB6528400;
64'hFFFFFFFFFFFFF040: romout <= 64'hFFED94A10000000A;
64'hFFFFFFFFFFFFF048: romout <= 64'h11F8200000031FFF;
64'hFFFFFFFFFFFFF050: romout <= 64'h0000411FBE000008;
64'hFFFFFFFFFFFFF058: romout <= 64'h03FBC00001037EF8;
64'hFFFFFFFFFFFFF060: romout <= 64'h0000019FBE000008;
64'hFFFFFFFFFFFFF068: romout <= 64'h0504200000F67E08;
64'hFFFFFFFFFFFFF070: romout <= 64'h4000E42842000030;
64'hFFFFFFFFFFFFF078: romout <= 64'h02842000007AC100;
64'hFFFFFFFFFFFFF080: romout <= 64'h000000C7FFFFFB65;
64'hFFFFFFFFFFFFF088: romout <= 64'h11FBE00000847E08;
64'hFFFFFFFFFFFFF090: romout <= 64'h000040DFBE000010;
64'hFFFFFFFFFFFFF098: romout <= 64'h27F400000010FEF0;
64'hFFFFFFFFFFFFF0A0: romout <= 64'hFFF0581842200004;
64'hFFFFFFFFFFFFF0A8: romout <= 64'h0184220000231FFF;
64'hFFFFFFFFFFFFF0B0: romout <= 64'h000004C7FFFFFC16;
64'hFFFFFFFFFFFFF0B8: romout <= 64'h0DFBE0000109DD00;
64'hFFFFFFFFFFFFF0C0: romout <= 64'h0000143FBC000018;
64'hFFFFFFFFFFFFF0C8: romout <= 64'h0A3000000079FD00;
64'hFFFFFFFFFFFFF0D0: romout <= 64'hFFF0941842400002;
64'hFFFFFFFFFFFFF0D8: romout <= 64'h2F80600000F31FFF;
64'hFFFFFFFFFFFFF0E0: romout <= 64'h0000627740000005;
64'hFFFFFFFFFFFFF0E8: romout <= 64'h03FBC00000837EF8;
64'hFFFFFFFFFFFFF0F0: romout <= 64'h0000E99FBE000000;
64'hFFFFFFFFFFFFF0F8: romout <= 64'h0C7FFFFFB6528400;
64'hFFFFFFFFFFFFF100: romout <= 64'hFFF0C01080100009;
64'hFFFFFFFFFFFFF108: romout <= 64'h0A30000000731FFF;
64'hFFFFFFFFFFFFF110: romout <= 64'hFFED94A100000020;
64'hFFFFFFFFFFFFF118: romout <= 64'h1008200000031FFF;
64'hFFFFFFFFFFFFF120: romout <= 64'h000004C7FFFFFC25;
64'hFFFFFFFFFFFFF128: romout <= 64'h2F807FFFF8F0A210;
64'hFFFFFFFFFFFFF130: romout <= 64'h000000C7FFFFFC09;
64'hFFFFFFFFFFFFF138: romout <= 64'h0DFBE00000847EF8;
64'hFFFFFFFFFFFFF140: romout <= 64'h0003F03FBC000030;
64'hFFFFFFFFFFFFF148: romout <= 64'h0A20000000A9FC00;
64'hFFFFFFFFFFFFF150: romout <= 64'hC00070A800000013;
64'hFFFFFFFFFFFFF158: romout <= 64'h018C7E0000004110;
64'hFFFFFFFFFFFFF160: romout <= 64'h800004194FE00000;
64'hFFFFFFFFFFFFF168: romout <= 64'h0110E40000906420;
64'hFFFFFFFFFFFFF170: romout <= 64'h400024194A200001;
64'hFFFFFFFFFFFFF178: romout <= 64'h0704200000004519;
64'hFFFFFFFFFFFFF180: romout <= 64'h000006F811FFFEAF;
64'hFFFFFFFFFFFFF188: romout <= 64'h0194C80000006426;
64'hFFFFFFFFFFFFF190: romout <= 64'h000004110C400009;
64'hFFFFFFFFFFFFF198: romout <= 64'h010081000090652E;
64'hFFFFFFFFFFFFF1A0: romout <= 64'h0003F0100A200009;
64'hFFFFFFFFFFFFF1A8: romout <= 64'h0DFBE0000309DC00;
64'hFFFFFFFFFFFFF1B0: romout <= 64'h0002703FBC000020;
64'hFFFFFFFFFFFFF1B8: romout <= 64'h0A80000000F9FC00;
64'hFFFFFFFFFFFFF1C0: romout <= 64'h0000C0504400000F;
64'hFFFFFFFFFFFFF1C8: romout <= 64'h01885C0000016210;
64'hFFFFFFFFFFFFF1D0: romout <= 64'h0000001908400001;
64'hFFFFFFFFFFFFF1D8: romout <= 64'h0110A4000090632F;
64'hFFFFFFFFFFFFF1E0: romout <= 64'hC0002418C6400001;
64'hFFFFFFFFFFFFF1E8: romout <= 64'h0184220000104310;
64'hFFFFFFFFFFFFF1F0: romout <= 64'h400026F811FFFE8F;
64'hFFFFFFFFFFFFF1F8: romout <= 64'h0100620000904020;
64'hFFFFFFFFFFFFF200: romout <= 64'h000082770000009C;
64'hFFFFFFFFFFFFF208: romout <= 64'h03FBC00003837EF8;
64'hFFFFFFFFFFFFF210: romout <= 64'hC000267F400007C4;
64'hFFFFFFFFFFFFF218: romout <= 64'h0C7FFFFFC5004012;
64'hFFFFFFFFFFFFF220: romout <= 64'hFFF1B01004A00009;
64'hFFFFFFFFFFFFF228: romout <= 64'h0A90000000131FFF;
64'hFFFFFFFFFFFFF230: romout <= 64'h600000A800000007;
64'hFFFFFFFFFFFFF238: romout <= 64'h029CE00000006938;
64'hFFFFFFFFFFFFF240: romout <= 64'h0003FC29CE000004;
64'hFFFFFFFFFFFFF248: romout <= 64'h1A9D630001014118;
64'hFFFFFFFFFFFFF250: romout <= 64'hFFFCBC1842400001;
64'hFFFFFFFFFFFFF258: romout <= 64'h01004100009BE047;
64'hFFFFFFFFFFFFF260: romout <= 64'h400026F813FFFE8F;
64'hFFFFFFFFFFFFF268: romout <= 64'h0C7FFFFFC6C04050;
64'hFFFFFFFFFFFFF270: romout <= 64'h0003FCA800000003;
64'hFFFFFFFFFFFFF278: romout <= 64'h1AA1630001014118;
64'hFFFFFFFFFFFFF280: romout <= 64'hFFFEBC1842400001;
64'hFFFFFFFFFFFFF288: romout <= 64'h182C0000014BE047;
64'hFFFFFFFFFFFFF290: romout <= 64'h0000E277400007C4;
64'hFFFFFFFFFFFFF298: romout <= 64'h0BEFFFEFFF837EF8;
64'hFFFFFFFFFFFFF2A0: romout <= 64'hFFF025800000041A;
64'hFFFFFFFFFFFFF2A8: romout <= 64'h0A10000002431FFF;
64'hFFFFFFFFFFFFF2B0: romout <= 64'hFFEA48C7FFFFFB65;
64'hFFFFFFFFFFFFF2B8: romout <= 64'h2C04007FFFF31FFF;
64'hFFFFFFFFFFFFF2C0: romout <= 64'hFFED96C04010000D;
64'hFFFFFFFFFFFFF2C8: romout <= 64'h2F801FFFFAA31FFF;
64'hFFFFFFFFFFFFF2D0: romout <= 64'hFFED558800000418;
64'hFFFFFFFFFFFFF2D8: romout <= 64'h0104030000931FFF;
64'hFFFFFFFFFFFFF2E0: romout <= 64'h00000908C2000000;
64'hFFFFFFFFFFFFF2E8: romout <= 64'h0C7FFFFFB500A318;
64'hFFFFFFFFFFFFF2F0: romout <= 64'h000002C840140024;
64'hFFFFFFFFFFFFF2F8: romout <= 64'h028C600000242308;
64'hFFFFFFFFFFFFF300: romout <= 64'h4000E8C7FFFFFB50;
64'hFFFFFFFFFFFFF308: romout <= 64'h2C041A00044B0105;
64'hFFFFFFFFFFFFF310: romout <= 64'hD0012AC075140042;
64'hFFFFFFFFFFFFF318: romout <= 64'h2C04280004CB0105;
64'hFFFFFFFFFFFFF320: romout <= 64'h40010EC04054003F;
64'hFFFFFFFFFFFFF328: romout <= 64'h2F801FFFBCAB0100;
64'hFFFFFFFFFFFFF330: romout <= 64'h00000908C2000000;
64'hFFFFFFFFFFFFF338: romout <= 64'h0C7FFFFFB500A318;
64'hFFFFFFFFFFFFF340: romout <= 64'h000002C87F58004C;
64'hFFFFFFFFFFFFF348: romout <= 64'h028C600000242308;
64'hFFFFFFFFFFFFF350: romout <= 64'h20014CC7FFFFFB50;
64'hFFFFFFFFFFFFF358: romout <= 64'h0C7FFFFFB06B21FD;
64'hFFFFFFFFFFFFF360: romout <= 64'h0010598000000418;
64'hFFFFFFFFFFFFF368: romout <= 64'h0C7FFFFFB5560000;
64'hFFFFFFFFFFFFF370: romout <= 64'hFFCE42F801FFF94A;
64'hFFFFFFFFFFFFF378: romout <= 64'h0C7FFFFFBF5287FF;
64'hFFFFFFFFFFFFF380: romout <= 64'h000002F801FFF8CA;
64'hFFFFFFFFFFFFF388: romout <= 64'h37800000000DE000;
64'hFFFFFFFFFFFFF390: romout <= 64'h70736944203D203F;
64'hFFFFFFFFFFFFF398: romout <= 64'h706C65682079616C;
64'hFFFFFFFFFFFFF3A0: romout <= 64'h203D20534C430A0D;
64'hFFFFFFFFFFFFF3A8: romout <= 64'h6373207261656C63;
64'hFFFFFFFFFFFFF3B0: romout <= 64'h203A0A0D6E656572;
64'hFFFFFFFFFFFFF3B8: romout <= 64'h6D2074696445203D;
64'hFFFFFFFFFFFFF3C0: romout <= 64'h79622079726F6D65;
64'hFFFFFFFFFFFFF3C8: romout <= 64'h3D204C0A0D736574;
64'hFFFFFFFFFFFFF3D0: romout <= 64'h31532064616F4C20;
64'hFFFFFFFFFFFFF3D8: romout <= 64'h0A0D656C69662039;
64'hFFFFFFFFFFFFF3E0: romout <= 64'h706D7544203D2044;
64'hFFFFFFFFFFFFF3E8: romout <= 64'h0D79726F6D656D20;
64'hFFFFFFFFFFFFF3F0: romout <= 64'h617473203D20420A;
64'hFFFFFFFFFFFFF3F8: romout <= 64'h20796E6974207472;
64'hFFFFFFFFFFFFF400: romout <= 64'h4A0A0D6369736162;
64'hFFFFFFFFFFFFF408: romout <= 64'h20706D754A203D20;
64'hFFFFFFFFFFFFF410: romout <= 64'h0D65646F63206F74;
64'hFFFFFFFFFFFFF418: romout <= 64'h000000000000000A;
64'hFFFFFFFFFFFFF420: romout <= 64'h0000003FBC000008;
64'hFFFFFFFFFFFFF428: romout <= 64'h108C200000067EF8;
64'hFFFFFFFFFFFFF430: romout <= 64'hFFED4028C6000002;
64'hFFFFFFFFFFFFF438: romout <= 64'h2C07FF8002031FFF;
64'hFFFFFFFFFFFFF440: romout <= 64'h00000038C6000002;
64'hFFFFFFFFFFFFF448: romout <= 64'h0DFBE00000847EF8;
64'hFFFFFFFFFFFFF450: romout <= 64'hFFF4E4C7FFFFFD08;
64'hFFFFFFFFFFFFF458: romout <= 64'h0104050000931FFF;
64'hFFFFFFFFFFFFF460: romout <= 64'hFFF420A400000007;
64'hFFFFFFFFFFFFF468: romout <= 64'h0C7FFFFFD3931FFF;
64'hFFFFFFFFFFFFF470: romout <= 64'h0000058142000000;
64'hFFFFFFFFFFFFF478: romout <= 64'h2F809FFFFAF0A528;
64'hFFFFFFFFFFFFF480: romout <= 64'hFFF422F801FFF0CA;
64'hFFFFFFFFFFFFF488: romout <= 64'h0C7FFFFFD3931FFF;
64'hFFFFFFFFFFFFF490: romout <= 64'h0000001040300009;
64'hFFFFFFFFFFFFF498: romout <= 64'h2F801FFF04A343F8;
64'hFFFFFFFFFFFFF4A0: romout <= 64'hFFF4E4C7FFFFFD08;
64'hFFFFFFFFFFFFF4A8: romout <= 64'h0104020000931FFF;
64'hFFFFFFFFFFFFF4B0: romout <= 64'hFFF0E8C7FFFFFC09;
64'hFFFFFFFFFFFFF4B8: romout <= 64'h0C7FFFFFC3A31FFF;
64'hFFFFFFFFFFFFF4C0: romout <= 64'hFFF0E8C7FFFFFC3A;
64'hFFFFFFFFFFFFF4C8: romout <= 64'h0C7FFFFFC3A31FFF;
64'hFFFFFFFFFFFFF4D0: romout <= 64'hFFF0E8C7FFFFFC3A;
64'hFFFFFFFFFFFFF4D8: romout <= 64'h0C7FFFFFC3A31FFF;
64'hFFFFFFFFFFFFF4E0: romout <= 64'h000062F801FFEDCA;
64'hFFFFFFFFFFFFF4E8: romout <= 64'h27F4000000A0FEF0;
64'hFFFFFFFFFFFFF4F0: romout <= 64'h00003CA200000000;
64'hFFFFFFFFFFFFF4F8: romout <= 64'h108C200000029000;
64'hFFFFFFFFFFFFF500: romout <= 64'hFFED4028C6000002;
64'hFFFFFFFFFFFFF508: romout <= 64'h0C7FFFFFD4E31FFF;
64'hFFFFFFFFFFFFF510: romout <= 64'h800002C0401BFFFF;
64'hFFFFFFFFFFFFF518: romout <= 64'h0504200000F06210;
64'hFFFFFFFFFFFFF520: romout <= 64'hFFFB3C1082200009;
64'hFFFFFFFFFFFFF528: romout <= 64'h01080100009BE027;
64'hFFFFFFFFFFFFF530: romout <= 64'h000062774000000A;
64'hFFFFFFFFFFFFF538: romout <= 64'h2A04054003037EF8;
64'hFFFFFFFFFFFFF540: romout <= 64'h0000C2B840100039;
64'hFFFFFFFFFFFFF548: romout <= 64'h0DFBE0000000E108;
64'hFFFFFFFFFFFFF550: romout <= 64'h60011AA040340041;
64'hFFFFFFFFFFFFF558: romout <= 64'h03842000041AE100;
64'hFFFFFFFFFFFFF560: romout <= 64'h000000284200000A;
64'hFFFFFFFFFFFFF568: romout <= 64'h2A04024006137EF8;
64'hFFFFFFFFFFFFF570: romout <= 64'h000186B840140066;
64'hFFFFFFFFFFFFF578: romout <= 64'h0284200000A0E108;
64'hFFFFFFFFFFFFF580: romout <= 64'hFFFFFCDFBE000000;
64'hFFFFFFFFFFFFF588: romout <= 64'h0DFBE000000287FF;
64'hFFFFFFFFFFFFF590: romout <= 64'hFFF7F2F80000008A;
64'hFFFFFFFFFFFFF598: romout <= 64'h2C84004000A31FFF;
64'hFFFFFFFFFFFFF5A0: romout <= 64'hE00068C7FFFFFDFC;
64'hFFFFFFFFFFFFF5A8: romout <= 64'h2C87FF40053B01F3;
64'hFFFFFFFFFFFFF5B0: romout <= 64'h9000C0C7FFFFFDFC;
64'hFFFFFFFFFFFFF5B8: romout <= 64'h2987FE40039A01FF;
64'hFFFFFFFFFFFFF5C0: romout <= 64'hFFF7F01040400009;
64'hFFFFFFFFFFFFF5C8: romout <= 64'h0C7FFFFFD4E31FFF;
64'hFFFFFFFFFFFFF5D0: romout <= 64'hFFF7F01040200009;
64'hFFFFFFFFFFFFF5D8: romout <= 64'h0C7FFFFFD4E31FFF;
64'hFFFFFFFFFFFFF5E0: romout <= 64'h8000241884200000;
64'hFFFFFFFFFFFFF5E8: romout <= 64'h0108230000904208;
64'hFFFFFFFFFFFFF5F0: romout <= 64'h9000C6C13FA40030;
64'hFFFFFFFFFFFFF5F8: romout <= 64'h2C100B00032B0402;
64'hFFFFFFFFFFFFF600: romout <= 64'h5000D6C100A80033;
64'hFFFFFFFFFFFFF608: romout <= 64'h2C100B40037B04FE;
64'hFFFFFFFFFFFFF610: romout <= 64'h1000E6C100B40038;
64'hFFFFFFFFFFFFF618: romout <= 64'h2F801FFFC2AB0403;
64'hFFFFFFFFFFFFF620: romout <= 64'h00000450C60000FF;
64'hFFFFFFFFFFFFF628: romout <= 64'h0C7FFFFFDFC0E318;
64'hFFFFFFFFFFFFF630: romout <= 64'h800000C7FFFFFD4E;
64'hFFFFFFFFFFFFF638: romout <= 64'h0108220000906210;
64'hFFFFFFFFFFFFF640: romout <= 64'hFFF538C7FFFFFDFC;
64'hFFFFFFFFFFFFF648: romout <= 64'h0188420000031FFF;
64'hFFFFFFFFFFFFF650: romout <= 64'h0000001082200009;
64'hFFFFFFFFFFFFF658: romout <= 64'h0294A00000160510;
64'hFFFFFFFFFFFFF660: romout <= 64'hFFF7F2F807FFFE4F;
64'hFFFFFFFFFFFFF668: romout <= 64'h0C7FFFFFD4E31FFF;
64'hFFFFFFFFFFFFF670: romout <= 64'h8000241884200000;
64'hFFFFFFFFFFFFF678: romout <= 64'h0C7FFFFFDFC04208;
64'hFFFFFFFFFFFFF680: romout <= 64'h800000C7FFFFFD4E;
64'hFFFFFFFFFFFFF688: romout <= 64'h0108220000906210;
64'hFFFFFFFFFFFFF690: romout <= 64'hFFF6E6F801FFF82A;
64'hFFFFFFFFFFFFF698: romout <= 64'h2F801FFFC8A31FFF;
64'hFFFFFFFFFFFFF6A0: romout <= 64'hFFF028C7FFFFFDC1;
64'hFFFFFFFFFFFFF6A8: romout <= 64'h0C7FFFFFDC9BE007;
64'hFFFFFFFFFFFFF6B0: romout <= 64'hFFF726F801FFFB8A;
64'hFFFFFFFFFFFFF6B8: romout <= 64'h1980A00000031FFF;
64'hFFFFFFFFFFFFF6C0: romout <= 64'hFFF706F801FFDECA;
64'hFFFFFFFFFFFFF6C8: romout <= 64'h1980A00000031FFF;
64'hFFFFFFFFFFFFF6D0: romout <= 64'hFFF6E6F801FFDE4A;
64'hFFFFFFFFFFFFF6D8: romout <= 64'h1980A00000031FFF;
64'hFFFFFFFFFFFFF6E0: romout <= 64'h000022F801FFDDCA;
64'hFFFFFFFFFFFFF6E8: romout <= 64'h19FBE0000000FEF0;
64'hFFFFFFFFFFFFF6F0: romout <= 64'hFFF538C7FFFFFDFC;
64'hFFFFFFFFFFFFF6F8: romout <= 64'h0104020000931FFF;
64'hFFFFFFFFFFFFF700: romout <= 64'h000022F8000004AA;
64'hFFFFFFFFFFFFF708: romout <= 64'h19FBE0000000FEF0;
64'hFFFFFFFFFFFFF710: romout <= 64'hFFF538C7FFFFFDFC;
64'hFFFFFFFFFFFFF718: romout <= 64'h0104020000931FFF;
64'hFFFFFFFFFFFFF720: romout <= 64'h000022F80000024A;
64'hFFFFFFFFFFFFF728: romout <= 64'h19FBE0000000FEF0;
64'hFFFFFFFFFFFFF730: romout <= 64'hFFF538C7FFFFFDFC;
64'hFFFFFFFFFFFFF738: romout <= 64'h0104020000931FFF;
64'hFFFFFFFFFFFFF740: romout <= 64'hFFF538C7FFFFFDFC;
64'hFFFFFFFFFFFFF748: romout <= 64'h0188420000031FFF;
64'hFFFFFFFFFFFFF750: romout <= 64'hFFF7F01044200009;
64'hFFFFFFFFFFFFF758: romout <= 64'h0C7FFFFFD4E31FFF;
64'hFFFFFFFFFFFFF760: romout <= 64'h8000241884200000;
64'hFFFFFFFFFFFFF768: romout <= 64'h0C7FFFFFDFC04208;
64'hFFFFFFFFFFFFF770: romout <= 64'h800000C7FFFFFD4E;
64'hFFFFFFFFFFFFF778: romout <= 64'h0108220000906210;
64'hFFFFFFFFFFFFF780: romout <= 64'hFFF538C7FFFFFDFC;
64'hFFFFFFFFFFFFF788: romout <= 64'h0188420000031FFF;
64'hFFFFFFFFFFFFF790: romout <= 64'hFFF7F01082200009;
64'hFFFFFFFFFFFFF798: romout <= 64'h0C7FFFFFD4E31FFF;
64'hFFFFFFFFFFFFF7A0: romout <= 64'h8000241884200000;
64'hFFFFFFFFFFFFF7A8: romout <= 64'h0C7FFFFFDFC04208;
64'hFFFFFFFFFFFFF7B0: romout <= 64'h800000C7FFFFFD4E;
64'hFFFFFFFFFFFFF7B8: romout <= 64'h0108220000906210;
64'hFFFFFFFFFFFFF7C0: romout <= 64'hFFF538C7FFFFFDFC;
64'hFFFFFFFFFFFFF7C8: romout <= 64'h0188420000031FFF;
64'hFFFFFFFFFFFFF7D0: romout <= 64'h0000281082200009;
64'hFFFFFFFFFFFFF7D8: romout <= 64'h0108050000904421;
64'hFFFFFFFFFFFFF7E0: romout <= 64'h0000211FBE000000;
64'hFFFFFFFFFFFFF7E8: romout <= 64'h0DFBE0000000BEF0;
64'hFFFFFFFFFFFFF7F0: romout <= 64'h0000003FBC000008;
64'hFFFFFFFFFFFFF7F8: romout <= 64'h0C7FFFFFAA667EF8;
64'hFFFFFFFFFFFFF800: romout <= 64'hFFEA4AF841FF8B08;
64'hFFFFFFFFFFFFF808: romout <= 64'h2C07A98000031FFF;
64'hFFFFFFFFFFFFF810: romout <= 64'hFFFD20C7FFFFFE30;
64'hFFFFFFFFFFFFF818: romout <= 64'h11FBE000000BE107;
64'hFFFFFFFFFFFFF820: romout <= 64'h0000002FBC000008;
64'hFFFFFFFFFFFFF828: romout <= 64'h0580200000037EF8;
64'hFFFFFFFFFFFFF830: romout <= 64'h7040998803DC1026;
64'hFFFFFFFFFFFFF838: romout <= 64'h2C84004000F4200F;
64'hFFFFFFFFFFFFF840: romout <= 64'h7040085802000000;
64'hFFFFFFFFFFFFF848: romout <= 64'h18803DC10046200F;
64'hFFFFFFFFFFFFF850: romout <= 64'h0000BC5802001F40;
64'hFFFFFFFFFFFFF858: romout <= 64'h0580200000FBE008;
64'hFFFFFFFFFFFFF860: romout <= 64'h00D1B98803D50080;
64'hFFFFFFFFFFFFF868: romout <= 64'h18803D5000016008;
64'hFFFFFFFFFFFFF870: romout <= 64'h5400205802000020;
64'hFFFFFFFFFFFFF878: romout <= 64'h058020000406200F;
64'hFFFFFFFFFFFFF880: romout <= 64'h0003018803D5000A;
64'hFFFFFFFFFFFFF888: romout <= 64'h18803D5000C16008;
64'hFFFFFFFFFFFFF890: romout <= 64'h5400385802000FA0;
64'hFFFFFFFFFFFFF898: romout <= 64'h058020011046200F;
64'hFFFFFFFFFFFFF8A0: romout <= 64'h0000018803D50004;
64'hFFFFFFFFFFFFF8A8: romout <= 64'h058037D7840E0000;
64'hFFFFFFFFFFFFF8B0: romout <= 64'h000002F80200000F;
64'hFFFFFFFFFFFFF8B8: romout <= 64'h0DFBE00000016008;
64'hFFFFFFFFFFFFF8C0: romout <= 64'h0000060003DC0A01;
64'hFFFFFFFFFFFFF8C8: romout <= 64'h2F8400000C814108;
64'hFFFFFFFFFFFFF8D0: romout <= 64'h0001FE0003DC0A00;
64'hFFFFFFFFFFFFF8D8: romout <= 64'h0DFBE00000014108;
64'hFFFFFFFFFFFFF8E0: romout <= 64'h000000CFFFFFFCA6;
64'hFFFFFFFFFFFFF8E8: romout <= 64'h37800000000DE000;
64'hFFFFFFFFFFFFF8F0: romout <= 64'h726F747061520A0D;
64'hFFFFFFFFFFFFF8F8: romout <= 64'h20796E6954203436;
64'hFFFFFFFFFFFFF900: romout <= 64'h3176204349534142;
64'hFFFFFFFFFFFFF908: romout <= 64'h202943280A0D302E;
64'hFFFFFFFFFFFFF910: romout <= 64'h6F52202032313032;
64'hFFFFFFFFFFFFF918: romout <= 64'h6E69462074726562;
64'hFFFFFFFFFFFFF920: romout <= 64'h0A0D000A0A0D6863;
64'hFFFFFFFFFFFFF928: romout <= 64'h616857000A0D4B4F;
64'hFFFFFFFFFFFFF930: romout <= 64'h726F53000A0D3F74;
64'hFFFFFFFFFFFFF938: romout <= 64'h6F43000A0D2E7972;
64'hFFFFFFFFFFFFF940: romout <= 64'h4C4620746361706D;
64'hFFFFFFFFFFFFF948: romout <= 64'h6461657220485341;
64'hFFFFFFFFFFFFF950: romout <= 64'h0A0D726F72726520;
64'hFFFFFFFFFFFFF958: romout <= 64'h207265626D754E00;
64'hFFFFFFFFFFFFF960: romout <= 64'h62206F6F74207369;
64'hFFFFFFFFFFFFF968: romout <= 64'h766944000A0D6769;
64'hFFFFFFFFFFFFF970: romout <= 64'h7962206E6F697369;
64'hFFFFFFFFFFFFF978: romout <= 64'h000A0D6F72657A20;
64'hFFFFFFFFFFFFF980: romout <= 64'h7620666F2074754F;
64'hFFFFFFFFFFFFF988: romout <= 64'h20656C6261697261;
64'hFFFFFFFFFFFFF990: romout <= 64'h000A0D6563617073;
64'hFFFFFFFFFFFFF998: romout <= 64'h6620736574796220;
64'hFFFFFFFFFFFFF9A0: romout <= 64'h0A0D000A0D656572;
64'hFFFFFFFFFFFFF9A8: romout <= 64'h000A0D7964616552;
64'hFFFFFFFFFFFFF9B0: romout <= 64'h6E69746365707845;
64'hFFFFFFFFFFFFF9B8: romout <= 64'h6D6D6F6320612067;
64'hFFFFFFFFFFFFF9C0: romout <= 64'h656E694C000A0D61;
64'hFFFFFFFFFFFFF9C8: romout <= 64'h207265626D756E20;
64'hFFFFFFFFFFFFF9D0: romout <= 64'h0D676962206F6F74;
64'hFFFFFFFFFFFFF9D8: romout <= 64'h746365707845000A;
64'hFFFFFFFFFFFFF9E0: romout <= 64'h6176206120676E69;
64'hFFFFFFFFFFFFF9E8: romout <= 64'h0A0D656C62616972;
64'hFFFFFFFFFFFFF9F0: romout <= 64'h64616220444E5200;
64'hFFFFFFFFFFFFF9F8: romout <= 64'h74656D6172617020;
64'hFFFFFFFFFFFFFA00: romout <= 64'h535953000A0D7265;
64'hFFFFFFFFFFFFFA08: romout <= 64'h6464612064616220;
64'hFFFFFFFFFFFFFA10: romout <= 64'h49000A0D73736572;
64'hFFFFFFFFFFFFFA18: romout <= 64'h707865205455504E;
64'hFFFFFFFFFFFFFA20: romout <= 64'h6120676E69746365;
64'hFFFFFFFFFFFFFA28: romout <= 64'h6C62616972617620;
64'hFFFFFFFFFFFFFA30: romout <= 64'h5458454E000A0D65;
64'hFFFFFFFFFFFFFA38: romout <= 64'h74756F6874697720;
64'hFFFFFFFFFFFFFA40: romout <= 64'h4E000A0D524F4620;
64'hFFFFFFFFFFFFFA48: romout <= 64'h6570786520545845;
64'hFFFFFFFFFFFFFA50: romout <= 64'h206120676E697463;
64'hFFFFFFFFFFFFFA58: romout <= 64'h2064656E69666564;
64'hFFFFFFFFFFFFFA60: romout <= 64'h656C626169726176;
64'hFFFFFFFFFFFFFA68: romout <= 64'h2F4F544F47000A0D;
64'hFFFFFFFFFFFFFA70: romout <= 64'h6162204255534F47;
64'hFFFFFFFFFFFFFA78: romout <= 64'h6E20656E696C2064;
64'hFFFFFFFFFFFFFA80: romout <= 64'h000A0D7265626D75;
64'hFFFFFFFFFFFFFA88: romout <= 64'h77204E5255544552;
64'hFFFFFFFFFFFFFA90: romout <= 64'h472074756F687469;
64'hFFFFFFFFFFFFFA98: romout <= 64'h50000A0D4255534F;
64'hFFFFFFFFFFFFFAA0: romout <= 64'h69206D6172676F72;
64'hFFFFFFFFFFFFFAA8: romout <= 64'h6962206F6F742073;
64'hFFFFFFFFFFFFFAB0: romout <= 64'h72747845000A0D67;
64'hFFFFFFFFFFFFFAB8: romout <= 64'h6361726168632061;
64'hFFFFFFFFFFFFFAC0: romout <= 64'h206E6F2073726574;
64'hFFFFFFFFFFFFFAC8: romout <= 64'h6E676920656E696C;
64'hFFFFFFFFFFFFFAD0: romout <= 64'h0D000A0D6465726F;
64'hFFFFFFFFFFFFFAD8: romout <= 64'h0D000A0A0D00520A;
64'hFFFFFFFFFFFFFAE0: romout <= 64'h0048000A0D004F0A;
64'hFFFFFFFFFFFFFAE8: romout <= 64'h000A0D0057000A0D;
64'hFFFFFFFFFFFFFAF0: romout <= 64'h000000000A0D0053;
64'hFFFFFFFFFFFFFAF8: romout <= 64'h0000000000000000;
64'hFFFFFFFFFFFFFB00: romout <= 64'hAAAB541000800009;
64'hFFFFFFFFFFFFFB08: romout <= 64'h05802AA5555F5554;
64'hFFFFFFFFFFFFFB10: romout <= 64'h0000019A02000000;
64'hFFFFFFFFFFFFFB18: romout <= 64'h0104430000646810;
64'hFFFFFFFFFFFFFB20: romout <= 64'h000022F8C00000C9;
64'hFFFFFFFFFFFFFB28: romout <= 64'h380000000020A840;
64'hFFFFFFFFFFFFFB30: romout <= 64'hFFFC004206000000;
64'hFFFFFFFFFFFFFB38: romout <= 64'h01200A00009BE307;
64'hFFFFFFFFFFFFFB40: romout <= 64'h0000001000800009;
64'hFFFFFFFFFFFFFB48: romout <= 64'h3D5552AAAD546810;
64'hFFFFFFFFFFFFFB50: romout <= 64'h0004244086AA5555;
64'hFFFFFFFFFFFFFB58: romout <= 64'h02210000008BE300;
64'hFFFFFFFFFFFFFB60: romout <= 64'h0000038000000000;
64'hFFFFFFFFFFFFFB68: romout <= 64'h2F8C1FFFF201081C;
64'hFFFFFFFFFFFFFB70: romout <= 64'h000026FA140003A9;
64'hFFFFFFFFFFFFFB78: romout <= 64'h3AAAAD5552A04002;
64'hFFFFFFFFFFFFFB80: romout <= 64'h000000580355AAAA;
64'hFFFFFFFFFFFFFB88: romout <= 64'h11A0400000066808;
64'hFFFFFFFFFFFFFB90: romout <= 64'h0004241044300006;
64'hFFFFFFFFFFFFFB98: romout <= 64'h02210000008BE300;
64'hFFFFFFFFFFFFFBA0: romout <= 64'h0000038000000000;
64'hFFFFFFFFFFFFFBA8: romout <= 64'h2F8C1FFFF201081C;
64'hFFFFFFFFFFFFFBB0: romout <= 64'h0000241200B00009;
64'hFFFFFFFFFFFFFBB8: romout <= 64'h11A0400000004002;
64'hFFFFFFFFFFFFFBC0: romout <= 64'h56AAABAAAAD5552A;
64'hFFFFFFFFFFFFFBC8: romout <= 64'h2F8C00001291021D;
64'hFFFFFFFFFFFFFBD0: romout <= 64'h0000002210000008;
64'hFFFFFFFFFFFFFBD8: romout <= 64'h04207000000E0000;
64'hFFFFFFFFFFFFFBE0: romout <= 64'h000222F8C1FFFEC0;
64'hFFFFFFFFFFFFFBE8: romout <= 64'h01216800014BE858;
64'hFFFFFFFFFFFFFBF0: romout <= 64'h000052FA14000048;
64'hFFFFFFFFFFFFFBF8: romout <= 64'h1981000040004852;
64'hFFFFFFFFFFFFFC00: romout <= 64'h000040DFBE000000;
64'hFFFFFFFFFFFFFC08: romout <= 64'h27F400000010FEF0;
64'hFFFFFFFFFFFFFC10: romout <= 64'h5000060803DC0FF0;
64'hFFFFFFFFFFFFFC18: romout <= 64'h2C840180002B01B0;
64'hFFFFFFFFFFFFFC20: romout <= 64'h0002A8C7FFFFFACC;
64'hFFFFFFFFFFFFFC28: romout <= 64'h2C84014000FBE000;
64'hFFFFFFFFFFFFFC30: romout <= 64'h000004C7FFFFFA75;
64'hFFFFFFFFFFFFFC38: romout <= 64'h02FBC0000109DD00;
64'hFFFFFFFFFFFFFC40: romout <= 64'h0000800000000020;
64'hFFFFFFFFFFFFFC48: romout <= 64'h19803FF000000000;
64'hFFFFFFFFFFFFFC50: romout <= 64'h0000D19805FF0008;
64'hFFFFFFFFFFFFFC58: romout <= 64'h2F84000002902008;
64'hFFFFFFFFFFFFFC60: romout <= 64'h0010A00802000228;
64'hFFFFFFFFFFFFFC68: romout <= 64'h008800005A902010;
64'hFFFFFFFFFFFFFC70: romout <= 64'h40000C1884680001;
64'hFFFFFFFFFFFFFC78: romout <= 64'h1184400000004110;
64'hFFFFFFFFFFFFFC80: romout <= 64'h0014A45084000000;
64'hFFFFFFFFFFFFFC88: romout <= 64'h1184400000802200;
64'hFFFFFFFFFFFFFC90: romout <= 64'h0016A45084000000;
64'hFFFFFFFFFFFFFC98: romout <= 64'h0080000003402200;
64'hFFFFFFFFFFFFFCA0: romout <= 64'hFC00000800000035;
64'hFFFFFFFFFFFFFCA8: romout <= 64'h11805FF00084600F;
64'hFFFFFFFFFFFFFCB0: romout <= 64'h0000000000000020;
64'hFFFFFFFFFFFFFCB8: romout <= 64'h37800000000DE000;
64'hFFFFFFFFFFFFFFB0: romout <= 64'h000000CFFFFFFF12;
64'hFFFFFFFFFFFFFFB8: romout <= 64'h37800000000DE000;
64'hFFFFFFFFFFFFFFC0: romout <= 64'h000000CFFFFFFF12;
64'hFFFFFFFFFFFFFFC8: romout <= 64'h37800000000DE000;
64'hFFFFFFFFFFFFFFD0: romout <= 64'h000000CFFFFFFF01;
64'hFFFFFFFFFFFFFFD8: romout <= 64'h37800000000DE000;
64'hFFFFFFFFFFFFFFE0: romout <= 64'h000000CFFFFFFF11;
64'hFFFFFFFFFFFFFFE8: romout <= 64'h37800000000DE000;
64'hFFFFFFFFFFFFFFF0: romout <= 64'h000000CFFFFFFA09;
64'hFFFFFFFFFFFFFFF8: romout <= 64'h37800000000DE000;
rommem[1536] = 65'h133FFED0C33FFED54;
rommem[1537] = 65'h033FFEE1D33FFEE06;
rommem[1538] = 65'h033FFEF4733FFEE08;
rommem[1539] = 65'h10000000A33FFEFE7;
rommem[1540] = 65'h10410840A0000000D;
rommem[1541] = 65'h00A1080010410803A;
rommem[1542] = 65'h1BE207FA9101100FF;
rommem[1543] = 65'h06A0D642DE6BFB214;
rommem[1544] = 65'h16A0D782DE6BEFFF8;
rommem[1545] = 65'h0DE0000000000000F;
rommem[1546] = 65'h0E6BFB214DE000000;
rommem[1547] = 65'h1E6BEFBF86A0D642D;
rommem[1548] = 65'h10000000F6A0D782D;
rommem[1549] = 65'h0DE000000DE000000;
rommem[1550] = 65'h06A0D642DE6BFB214;
rommem[1551] = 65'h06A0D782DE6BEF7F8;
rommem[1552] = 65'h0DE0000000000000F;
rommem[1553] = 65'h0E6BFB214DE000000;
rommem[1554] = 65'h0E6BEF3F86A0D642D;
rommem[1555] = 65'h10000000F6A0D782D;
rommem[1556] = 65'h0DE000000DE000000;
rommem[1557] = 65'h06A0D642DE6BFB214;
rommem[1558] = 65'h06A0D782DE6BEEFF8;
rommem[1559] = 65'h0DE0000000000000F;
rommem[1560] = 65'h0E6BFB214DE000000;
rommem[1561] = 65'h0E6BEEBF86A0D642D;
rommem[1562] = 65'h10000000F6A0D782D;
rommem[1563] = 65'h0DE000000DE000000;
rommem[1564] = 65'h06A0D642DE6BFB214;
rommem[1565] = 65'h16A0D782DE6BEE7F8;
rommem[1566] = 65'h0DE0000000000000F;
rommem[1567] = 65'h0E6BFB214DE000000;
rommem[1568] = 65'h1E6BEE3F86A0D642D;
rommem[1569] = 65'h10000000F6A0D782D;
rommem[1570] = 65'h0DE000000DE000000;
rommem[1571] = 65'h06A0D642DE6BFB214;
rommem[1572] = 65'h06A0D782DE6BEDFF8;
rommem[1573] = 65'h0DE0000000000000F;
rommem[1574] = 65'h0E6BFB214DE000000;
rommem[1575] = 65'h0E6BEDBF86A0D642D;
rommem[1576] = 65'h10000000F6A0D782D;
rommem[1577] = 65'h0DE000000DE000000;
rommem[1578] = 65'h06A0D642DE6BFB214;
rommem[1579] = 65'h16A0D782DE6BED7F8;
rommem[1580] = 65'h0DE0000000000000F;
rommem[1581] = 65'h0E6BFB214DE000000;
rommem[1582] = 65'h1E6BED3F86A0D642D;
rommem[1583] = 65'h10000000F6A0D782D;
rommem[1584] = 65'h0DE000000DE000000;
rommem[1585] = 65'h06A0D642DE6BFB214;
rommem[1586] = 65'h16A0D782DE6BECFF8;
rommem[1587] = 65'h0DE0000000000000F;
rommem[1588] = 65'h0E6BFB214DE000000;
rommem[1589] = 65'h1E6BECBF86A0D642D;
rommem[1590] = 65'h10000000F6A0D782D;
rommem[1591] = 65'h0DE000000DE000000;
rommem[1592] = 65'h06A0D642DE6BFB214;
rommem[1593] = 65'h06A0D782DE6BEC7F8;
rommem[1594] = 65'h0DE0000000000000F;
rommem[1595] = 65'h0E6BFB214DE000000;
rommem[1596] = 65'h0E6BEC3F86A0D642D;
rommem[1597] = 65'h10000000F6A0D782D;
rommem[1598] = 65'h0DE000000DE000000;
rommem[1599] = 65'h1BE1000A802008568;
rommem[1600] = 65'h0DE0000000000000F;
rommem[1601] = 65'h1BE007F6ADE000000;
rommem[1602] = 65'h1020085686000A0C0;
rommem[1603] = 65'h1BE1107E94A0120C0;
rommem[1604] = 65'h0E08001FFE0C00000;
rommem[1605] = 65'h1663080009A00EA20;
rommem[1606] = 65'h1BE017FCF0A318008;
rommem[1607] = 65'h16A0D042DE6BFB768;
rommem[1608] = 65'h09A00E95066008D08;
rommem[1609] = 65'h09A00E8BC66008E08;
rommem[1610] = 65'h19A00E8A466008FE0;
rommem[1611] = 65'h19A00EA2066008FE8;
rommem[1612] = 65'h0E6BFB7C466008FF0;
rommem[1613] = 65'h06600B0086A0D042D;
rommem[1614] = 65'h16A0D042DE6BFB8EC;
rommem[1615] = 65'h0E6BFB6286600B000;
rommem[1616] = 65'h06600B0106A0D042D;
rommem[1617] = 65'h06600B0189A00CAC4;
rommem[1618] = 65'h131FFEDEC31FFECEC;
rommem[1619] = 65'h031FFF29931FFECE4;
rommem[1620] = 65'h1E0C000CE00000040;
rommem[1621] = 65'h14201941462019414;
rommem[1622] = 65'h062019416E0C00020;
rommem[1623] = 65'h1BE21804842011416;
rommem[1624] = 65'h0620020A80000000D;
rommem[1625] = 65'h031FFEED9620020A6;
rommem[1626] = 65'h031FFF1ED31FFEEC4;
rommem[1627] = 65'h16200141862001416;
rommem[1628] = 65'h16000941AE0400001;
rommem[1629] = 65'h06A0D042DE6BFB36D;
rommem[1630] = 65'h033FFF09631FFEFF5;
rommem[1631] = 65'h1E0C0000431FFF1F7;
rommem[1632] = 65'h0EE800003E69C0600;
rommem[1633] = 65'h131FFF2216A0D0C28;
rommem[1634] = 65'h0BE007FEA33FFF096;
rommem[1635] = 65'h10FEF0018BE00000A;
rommem[1636] = 65'h167E1000867E08000;
rommem[1637] = 65'h1E6BFB36067EF8010;
rommem[1638] = 65'h1402080006A0D082D;
rommem[1639] = 65'h031FFED0CBE100088;
rommem[1640] = 65'h1BE007F8A0A210001;
rommem[1641] = 65'h067E1000867EF8010;
rommem[1642] = 65'h037EF801867E08000;
rommem[1643] = 65'h00000000000000000;
rommem[1644] = 65'h06F57206F6C6C6548;
rommem[1645] = 65'h07061520021646C72;
rommem[1646] = 65'h07973203436726F74;
rommem[1647] = 65'h1617473206D657473;
rommem[1648] = 65'h02E2E2E676E697472;
rommem[1649] = 65'h0000000000000002E;
rommem[1650] = 65'h16A0D042DE6BFB3AC;
rommem[1651] = 65'h0E07FA00F66009030;
rommem[1652] = 65'h1EE800003E69C0FF2;
rommem[1653] = 65'h037EF80006A0D0429;
rommem[1654] = 65'h16200180262001800;
rommem[1655] = 65'h062009810E04001F0;
rommem[1656] = 65'h06200980EE0400010;
rommem[1657] = 65'h1E69C0A04E0400001;
rommem[1658] = 65'h16A0D0428EE800003;
rommem[1659] = 65'h06000181260001809;
rommem[1660] = 65'h16000180A60001813;
rommem[1661] = 65'h060009814E0400001;
rommem[1662] = 65'h1E69C0A0137EF8000;
rommem[1663] = 65'h06A0D0420EE800003;
rommem[1664] = 65'h1BE107F8814108001;
rommem[1665] = 65'h0EE800003E69C0A00;
rommem[1666] = 65'h037EF80006A0D0420;
rommem[1667] = 65'h1EE800003E69C0A01;
rommem[1668] = 65'h0141080016A0D0420;
rommem[1669] = 65'h037EF800004100439;
rommem[1670] = 65'h167E100000FEF0020;
rommem[1671] = 65'h167E2001067E18008;
rommem[1672] = 65'h1E69C0A0667E28018;
rommem[1673] = 65'h06A0D0820EE800003;
rommem[1674] = 65'h0E69C0A0616210003;
rommem[1675] = 65'h16A0D0828EE800003;
rommem[1676] = 65'h1BE20016840011812;
rommem[1677] = 65'h0E0C0006446021400;
rommem[1678] = 65'h11421000A80011808;
rommem[1679] = 65'h046029400BE2000C9;
rommem[1680] = 65'h002520009BE42FF88;
rommem[1681] = 65'h1BE00046ABE01FF4F;
rommem[1682] = 65'h0BE20016840011813;
rommem[1683] = 65'h0E0C0006446021400;
rommem[1684] = 65'h11421001480011808;
rommem[1685] = 65'h046029400BE2000C9;
rommem[1686] = 65'h002520009BE42FF88;
rommem[1687] = 65'h0BE0002EABE01FF4F;
rommem[1688] = 65'h0BE2000C840011814;
rommem[1689] = 65'h0BE20008840011815;
rommem[1690] = 65'h01442008080021808;
rommem[1691] = 65'h146021400BE407F89;
rommem[1692] = 65'h0E69C0A01E0C00064;
rommem[1693] = 65'h06A0D0820EE800003;
rommem[1694] = 65'h0BE2000C914210020;
rommem[1695] = 65'h1BE42FF4846029400;
rommem[1696] = 65'h1BE01FF0F02520009;
rommem[1697] = 65'h0E69C0A00BE00008A;
rommem[1698] = 65'h16A0D0428EE800003;
rommem[1699] = 65'h047E1800847E10000;
rommem[1700] = 65'h047E2801847E20010;
rommem[1701] = 65'h14202180037EF8020;
rommem[1702] = 65'h00441100542011802;
rommem[1703] = 65'h0E1000200BE4000A3;
rommem[1704] = 65'h14201180004411003;
rommem[1705] = 65'h137EF800004411005;
rommem[1706] = 65'h167E100000FEF0020;
rommem[1707] = 65'h167E2001067E18008;
rommem[1708] = 65'h14201980067EF8018;
rommem[1709] = 65'h1BE21852842011802;
rommem[1710] = 65'h16A2184009A019600;
rommem[1711] = 65'h0142101FF0A210001;
rommem[1712] = 65'h14001180C62011802;
rommem[1713] = 65'h14201980EBE2003A8;
rommem[1714] = 65'h1BE41834331FFED4B;
rommem[1715] = 65'h0400218096000180C;
rommem[1716] = 65'h0E69C0A06BE400108;
rommem[1717] = 65'h06A0D1020EE800003;
rommem[1718] = 65'h1E69C0A0616420002;
rommem[1719] = 65'h16A0D1028EE800003;
rommem[1720] = 65'h1BE4001084002180A;
rommem[1721] = 65'h0EE800003E69C0A06;
rommem[1722] = 65'h1164200016A0D1020;
rommem[1723] = 65'h0EE800003E69C0A06;
rommem[1724] = 65'h14002180B6A0D1028;
rommem[1725] = 65'h0E1000011BE4000A8;
rommem[1726] = 65'h0EE800003E69C0A00;
rommem[1727] = 65'h047E100006A0D1028;
rommem[1728] = 65'h147E2001047E18008;
rommem[1729] = 65'h037EF802047EF8018;
rommem[1730] = 65'h047E10000E07FFFFF;
rommem[1731] = 65'h147E2001047E18008;
rommem[1732] = 65'h037EF802047EF8018;
rommem[1733] = 65'h067E080000FEF0028;
rommem[1734] = 65'h167E1801067E10008;
rommem[1735] = 65'h167EF802067E20018;
rommem[1736] = 65'h0EE800003E69C0A03;
rommem[1737] = 65'h1BE1000A16A0D0420;
rommem[1738] = 65'h1B0100D041410807F;
rommem[1739] = 65'h1B0100710B0100B0C;
rommem[1740] = 65'h147E1000847E08000;
rommem[1741] = 65'h047E2001847E18010;
rommem[1742] = 65'h037EF802847EF8020;
rommem[1743] = 65'h16000980880009808;
rommem[1744] = 65'h0BE007EEABE007F0A;
rommem[1745] = 65'h0EE800003E69C0A00;
rommem[1746] = 65'h1400118146A0D0420;
rommem[1747] = 65'h0B2100413BE200108;
rommem[1748] = 65'h160009815E0400001;
rommem[1749] = 65'h0B2100311BE00016A;
rommem[1750] = 65'h0BE00010A60001815;
rommem[1751] = 65'h04201180060001815;
rommem[1752] = 65'h06A3104109A019600;
rommem[1753] = 65'h0142101FF0A210001;
rommem[1754] = 65'h0E69C0A0162011800;
rommem[1755] = 65'h06A0D0420EE800003;
rommem[1756] = 65'h1BE107D2914108001;
rommem[1757] = 65'h1BE1003C94000980C;
rommem[1758] = 65'h14200981031FFED4B;
rommem[1759] = 65'h1E0400001BE408360;
rommem[1760] = 65'h1400098096000980C;
rommem[1761] = 65'h0E69C0A06BE100108;
rommem[1762] = 65'h06A0D0420EE800003;
rommem[1763] = 65'h0E69C0A06141080FD;
rommem[1764] = 65'h16A0D0428EE800003;
rommem[1765] = 65'h1BE1001084000980A;
rommem[1766] = 65'h0EE800003E69C0A06;
rommem[1767] = 65'h0141080FE6A0D0420;
rommem[1768] = 65'h0EE800003E69C0A06;
rommem[1769] = 65'h14000980B6A0D0428;
rommem[1770] = 65'h1E0400013BE1000A8;
rommem[1771] = 65'h0EE800003E69C0A00;
rommem[1772] = 65'h1BE0077EA6A0D0428;
rommem[1773] = 65'h167EF80000FEF0008;
rommem[1774] = 65'h131FFEDECB2100300;
rommem[1775] = 65'h0B2100401BE00016A;
rommem[1776] = 65'h031FFEE0602208009;
rommem[1777] = 65'h1B2100302BE0000EA;
rommem[1778] = 65'h1BE00008A31FFEE08;
rommem[1779] = 65'h031FFEE1DB2100303;
rommem[1780] = 65'h147EF8000BE00002A;
rommem[1781] = 65'h1018000210BEF0008;
rommem[1782] = 65'h16000145160001450;
rommem[1783] = 65'h16000941CE0400001;
rommem[1784] = 65'h10FEF000837EF8000;
rommem[1785] = 65'h14A00945067E10000;
rommem[1786] = 65'h1E69C00001410800F;
rommem[1787] = 65'h16A0D0821EE800003;
rommem[1788] = 65'h1EE800003E69C0002;
rommem[1789] = 65'h1601114406A0D0029;
rommem[1790] = 65'h11410800F0A108001;
rommem[1791] = 65'h04A01145160009450;
rommem[1792] = 65'h00A210001BE110089;
rommem[1793] = 65'h0600114511421000F;
rommem[1794] = 65'h037EF800847E10000;
rommem[1795] = 65'h137EF80006000941C;
rommem[1796] = 65'h167E100000FEF0010;
rommem[1797] = 65'h14A01145167EF8008;
rommem[1798] = 65'h1BE1101884A009450;
rommem[1799] = 65'h10A2100014A209440;
rommem[1800] = 65'h0600114511421000F;
rommem[1801] = 65'h0BE2000E84001141C;
rommem[1802] = 65'h131FFF93FB210030D;
rommem[1803] = 65'h131FFEF47BE00008A;
rommem[1804] = 65'h1E07FFFFFBE00004A;
rommem[1805] = 65'h147E1000047EF8008;
rommem[1806] = 65'h14A00945137EF8010;
rommem[1807] = 65'h0041104394A011450;
rommem[1808] = 65'h0E69C000037EF8000;
rommem[1809] = 65'h16A0D0421EE800003;
rommem[1810] = 65'h037EF800004100430;
rommem[1811] = 65'h167E100000FEF0010;
rommem[1812] = 65'h1E09C000067EF8008;
rommem[1813] = 65'h0EE800003E69C0000;
rommem[1814] = 65'h1BE107FA16A0D0421;
rommem[1815] = 65'h1EE800003E69C0002;
rommem[1816] = 65'h0141080FF6A0D0029;
rommem[1817] = 65'h1BE2000A84001141C;
rommem[1818] = 65'h131FFF93FB210030D;
rommem[1819] = 65'h131FFEF47BE00004A;
rommem[1820] = 65'h147EF800847E10000;
rommem[1821] = 65'h00FEF000837EF8010;
rommem[1822] = 65'h0E690000067EF8000;
rommem[1823] = 65'h16A0D082DEE800003;
rommem[1824] = 65'h00A1080018220814E;
rommem[1825] = 65'h031FFF2D89220814E;
rommem[1826] = 65'h031FFEE4C31FFEE4A;
rommem[1827] = 65'h16A0D0010E6BF0010;
rommem[1828] = 65'h037EF800847EF8000;
rommem[1829] = 65'h037EF8000620020A8;
rommem[1830] = 65'h1660120B86600A0B0;
rommem[1831] = 65'h14C0120A64C00A0A8;
rommem[1832] = 65'h14600A0B0BE110089;
rommem[1833] = 65'h037EF8000460120B8;
rommem[1834] = 65'h11A210200142101FF;
rommem[1835] = 65'h0EE800400E6800000;
rommem[1836] = 65'h04600A0B0042D0803;
rommem[1837] = 65'h14600A0B866208000;
rommem[1838] = 65'h16621801066208008;
rommem[1839] = 65'h06622802066220018;
rommem[1840] = 65'h16623803066230028;
rommem[1841] = 65'h16624804066240038;
rommem[1842] = 65'h16625805066250048;
rommem[1843] = 65'h06626806066260058;
rommem[1844] = 65'h16627807066270068;
rommem[1845] = 65'h06628808066280078;
rommem[1846] = 65'h16629809066290088;
rommem[1847] = 65'h0662A80A0662A0098;
rommem[1848] = 65'h1662B80B0662B00A8;
rommem[1849] = 65'h1662C80C0662C00B8;
rommem[1850] = 65'h1662D80D0662D00C8;
rommem[1851] = 65'h0662E80E0662E00D8;
rommem[1852] = 65'h1662F80F0662F00E8;
rommem[1853] = 65'h1620120A64C0120A8;
rommem[1854] = 65'h0E68000001A210200;
rommem[1855] = 65'h0042D0803EE800400;
rommem[1856] = 65'h04621801046208000;
rommem[1857] = 65'h04622802046220018;
rommem[1858] = 65'h14623803046230028;
rommem[1859] = 65'h14624804046240038;
rommem[1860] = 65'h14625805046250048;
rommem[1861] = 65'h04626806046260058;
rommem[1862] = 65'h14627807046270068;
rommem[1863] = 65'h04628808046280078;
rommem[1864] = 65'h14629809046290088;
rommem[1865] = 65'h0462A80A0462A0098;
rommem[1866] = 65'h1462B80B0462B00A8;
rommem[1867] = 65'h1462C80C0462C00B8;
rommem[1868] = 65'h1462D80D0462D00C8;
rommem[1869] = 65'h0462E80E0462E00D8;
rommem[1870] = 65'h1462F80F0462F00E8;
rommem[1871] = 65'h137EF800046210008;
rommem[1872] = 65'h167E080000FEF0020;
rommem[1873] = 65'h167E1801067E10008;
rommem[1874] = 65'h031FFEF3767EF8018;
rommem[1875] = 65'h1041D0403E6810000;
rommem[1876] = 65'h0BE2001C84001141A;
rommem[1877] = 65'h10A21000182110000;
rommem[1878] = 65'h04601140892110000;
rommem[1879] = 65'h042019414BE110088;
rommem[1880] = 65'h06600940892218000;
rommem[1881] = 65'h147E1000847E08000;
rommem[1882] = 65'h047EF801847E18010;
rommem[1883] = 65'h04201941437EF8020;
rommem[1884] = 65'h1BE007E8A92118000;
rommem[1885] = 65'h0E69A0010160080A0;
rommem[1886] = 65'h06A0D0429EE800003;
rommem[1887] = 65'h0160080E037EF8000;
rommem[1888] = 65'h1EE800003E69A0010;
rommem[1889] = 65'h037EF80006A0D0429;
rommem[1890] = 65'h067E080000FEF0018;
rommem[1891] = 65'h167E1801067E10008;
rommem[1892] = 65'h1040D0809E68FFC00;
rommem[1893] = 65'h0E6A9292906210601;
rommem[1894] = 65'h1F6829292EEA4A4A4;
rommem[1895] = 65'h1E6A000006A0D042D;
rommem[1896] = 65'h16A0D0C2DEE800400;
rommem[1897] = 65'h00A31800866308000;
rommem[1898] = 65'h047E08000BE017FCF;
rommem[1899] = 65'h147E1801047E10008;
rommem[1900] = 65'h00FEF002837EF8018;
rommem[1901] = 65'h167E1000867E08000;
rommem[1902] = 65'h067E2001867E18010;
rommem[1903] = 65'h1E69A000067EF8020;
rommem[1904] = 65'h06A0D0C2DEE800003;
rommem[1905] = 65'h18231000282308000;
rommem[1906] = 65'h1E040002004110818;
rommem[1907] = 65'h131FFEF2B42021414;
rommem[1908] = 65'h0EE800003E6900000;
rommem[1909] = 65'h1923080006A0D0C2D;
rommem[1910] = 65'h06A3D1029E6810000;
rommem[1911] = 65'h0BE017F8F0A318002;
rommem[1912] = 65'h147E2001847EF8020;
rommem[1913] = 65'h147E1000847E18010;
rommem[1914] = 65'h137EF802847E08000;
rommem[1915] = 65'h067E080000FEF0028;
rommem[1916] = 65'h167E1801067E10008;
rommem[1917] = 65'h167EF802067E20018;
rommem[1918] = 65'h0EE800003E69A0000;
rommem[1919] = 65'h0823080006A0D0C2D;
rommem[1920] = 65'h00411081882310002;
rommem[1921] = 65'h1E690000004208805;
rommem[1922] = 65'h06A0D0C2DEE800003;
rommem[1923] = 65'h0923200006A309021;
rommem[1924] = 65'h1BE017FAF0A318002;
rommem[1925] = 65'h0EE800003E69A0000;
rommem[1926] = 65'h1823080026A0D0C2D;
rommem[1927] = 65'h131FFEF160E108001;
rommem[1928] = 65'h147E1000847E08000;
rommem[1929] = 65'h047E2001847E18010;
rommem[1930] = 65'h037EF802847EF8020;
rommem[1931] = 65'h067E080000FEF0018;
rommem[1932] = 65'h167E1801067E10008;
rommem[1933] = 65'h0EE800003E69A0000;
rommem[1934] = 65'h0823100006A0D0C2D;
rommem[1935] = 65'h00631820004208C18;
rommem[1936] = 65'h0EE800003E6900000;
rommem[1937] = 65'h1E0400020043D0C03;
rommem[1938] = 65'h10A31800292308000;
rommem[1939] = 65'h047E08000BE017FCF;
rommem[1940] = 65'h147E1801047E10008;
rommem[1941] = 65'h1141080FF37EF8018;
rommem[1942] = 65'h0AC10045AA8100541;
rommem[1943] = 65'h1A8100261AE10037A;
rommem[1944] = 65'h0161081000C108060;
rommem[1945] = 65'h1141080FF37EF8000;
rommem[1946] = 65'h00A10803CAE10021A;
rommem[1947] = 65'h14200941637EF8000;
rommem[1948] = 65'h0E69A00001410807F;
rommem[1949] = 65'h06A0D0C2DEE800003;
rommem[1950] = 65'h10420881882310000;
rommem[1951] = 65'h01410807F42009418;
rommem[1952] = 65'h19231001604208803;
rommem[1953] = 65'h0E690000006210200;
rommem[1954] = 65'h1042D0403EE800003;
rommem[1955] = 65'h0B210080D37EF8000;
rommem[1956] = 65'h167E080000FEF0020;
rommem[1957] = 65'h167E1801067E10008;
rommem[1958] = 65'h06200141867EF8018;
rommem[1959] = 65'h1E6800091BE00018A;
rommem[1960] = 65'h10FEF0020BE1D0209;
rommem[1961] = 65'h167E1000867E08000;
rommem[1962] = 65'h067EF801867E18010;
rommem[1963] = 65'h0B020033842011418;
rommem[1964] = 65'h1620114180A210001;
rommem[1965] = 65'h147EF801831FFEF37;
rommem[1966] = 65'h147E1000847E18010;
rommem[1967] = 65'h037EF802047E08000;
rommem[1968] = 65'h1BE1D0169E6800090;
rommem[1969] = 65'h167E080000FEF0020;
rommem[1970] = 65'h167E1801067E10008;
rommem[1971] = 65'h14201141667EF8018;
rommem[1972] = 65'h10E210001B02FF200;
rommem[1973] = 65'h0BE007DEA62011416;
rommem[1974] = 65'h1BE1D0169E6800093;
rommem[1975] = 65'h167E080000FEF0020;
rommem[1976] = 65'h167E1801067E10008;
rommem[1977] = 65'h04201141867EF8018;
rommem[1978] = 65'h10E210001B02FE600;
rommem[1979] = 65'h1BE007C6A62011418;
rommem[1980] = 65'h0BE1D0169E6800092;
rommem[1981] = 65'h167E080000FEF0020;
rommem[1982] = 65'h167E1801067E10008;
rommem[1983] = 65'h14201141667EF8018;
rommem[1984] = 65'h00A210001B02FDA1E;
rommem[1985] = 65'h1BE007AEA62011416;
rommem[1986] = 65'h1BE1D0189E6800094;
rommem[1987] = 65'h167E080000FEF0020;
rommem[1988] = 65'h167E1801067E10008;
rommem[1989] = 65'h04201141867EF8018;
rommem[1990] = 65'h162001418BE200068;
rommem[1991] = 65'h062001416BE00798A;
rommem[1992] = 65'h10FEF0030BE00794A;
rommem[1993] = 65'h167E1000867E08000;
rommem[1994] = 65'h067E2001867E18010;
rommem[1995] = 65'h067EF802867E28020;
rommem[1996] = 65'h0BE1D00A9E6800099;
rommem[1997] = 65'h104008C0931FFEF37;
rommem[1998] = 65'h1BE00012A42009418;
rommem[1999] = 65'h042011418B2101508;
rommem[2000] = 65'h00E210001BE2003A8;
rommem[2001] = 65'h131FFEF3762011418;
rommem[2002] = 65'h14200941804008C09;
rommem[2003] = 65'h09231000082310002;
rommem[2004] = 65'h00A1080010A318002;
rommem[2005] = 65'h0EE800003E69A0000;
rommem[2006] = 65'h1824280006A0D102D;
rommem[2007] = 65'h0E0400020BE12FF04;
rommem[2008] = 65'h09230FFFE31FFEF2B;
rommem[2009] = 65'h1B010090ABE00016A;
rommem[2010] = 65'h031FFEF3704009009;
rommem[2011] = 65'h10402040904008C09;
rommem[2012] = 65'h09230800031FFEF2B;
rommem[2013] = 65'h0BE00004A31FFEFC4;
rommem[2014] = 65'h047EF802831FFEFD2;
rommem[2015] = 65'h047E2001847E28020;
rommem[2016] = 65'h147E1000847E18010;
rommem[2017] = 65'h137EF803047E08000;
rommem[2018] = 65'h167E080000FEF0020;
rommem[2019] = 65'h167E1801067E10008;
rommem[2020] = 65'h04200941867EF8018;
rommem[2021] = 65'h1620094180A108001;
rommem[2022] = 65'h0EE800003E69A0000;
rommem[2023] = 65'h0BE1102466A0D0821;
rommem[2024] = 65'h1BE0000CA62001418;
rommem[2025] = 65'h167E080000FEF0020;
rommem[2026] = 65'h167E1801067E10008;
rommem[2027] = 65'h14200941667EF8018;
rommem[2028] = 65'h0620094160A108001;
rommem[2029] = 65'h1EE800003E69A0002;
rommem[2030] = 65'h1BE1100866A0D0821;
rommem[2031] = 65'h1620114160E210001;
rommem[2032] = 65'h031FFEF3731FFEEF6;
rommem[2033] = 65'h047E1801047EF8018;
rommem[2034] = 65'h147E0800047E10008;
rommem[2035] = 65'h00DEF001837EF8020;
rommem[2036] = 65'h167E1000867E08000;
rommem[2037] = 65'h10211000967EF8010;
rommem[2038] = 65'h00A2100014A208000;
rommem[2039] = 65'h031FFEF47BE100068;
rommem[2040] = 65'h147EF8010BE007F8A;
rommem[2041] = 65'h147E0800047E10008;
rommem[2042] = 65'h10FEF000837EF8018;
rommem[2043] = 65'h131FFEFE767EF8000;
rommem[2044] = 65'h10BEF000847EF8000;
rommem[2045] = 65'h167E080000FEF0010;
rommem[2046] = 65'h1E040000D67EF8008;
rommem[2047] = 65'h0E040000A31FFEF47;
rommem[2048] = 65'h147EF800831FFEF47;
rommem[2049] = 65'h037EF801047E08000;
rommem[2050] = 65'h167E080000FEF0010;
rommem[2051] = 65'h01410800F67EF8008;
rommem[2052] = 65'h0AC1002390A108030;
rommem[2053] = 65'h131FFEF470A108007;
rommem[2054] = 65'h147E0800047EF8008;
rommem[2055] = 65'h00FEF001037EF8010;
rommem[2056] = 65'h167EF800867E08000;
rommem[2057] = 65'h031FFF00406108804;
rommem[2058] = 65'h031FFF00406108802;
rommem[2059] = 65'h147E0800047EF8008;
rommem[2060] = 65'h10FEF001837EF8010;
rommem[2061] = 65'h067E1800867E08000;
rommem[2062] = 65'h0E0C0000767EF8010;
rommem[2063] = 65'h131FFF00F06109002;
rommem[2064] = 65'h047EF8010BE01FFCF;
rommem[2065] = 65'h047E0800047E18008;
rommem[2066] = 65'h00FEF001837EF8018;
rommem[2067] = 65'h067E1800867E08000;
rommem[2068] = 65'h0E040003A67EF8010;
rommem[2069] = 65'h10220800931FFEF47;
rommem[2070] = 65'h0E0C0000731FFF019;
rommem[2071] = 65'h131FFEF47E0400020;
rommem[2072] = 65'h031FFF00F40208000;
rommem[2073] = 65'h0BE01FF6F0A210001;
rommem[2074] = 65'h147EF801031FFEFFA;
rommem[2075] = 65'h047E0800047E18008;
rommem[2076] = 65'h00FEF003037EF8018;
rommem[2077] = 65'h067E2000867E18000;
rommem[2078] = 65'h167E3001867E28010;
rommem[2079] = 65'h167E4002867E38020;
rommem[2080] = 65'h1E2000013E080000A;
rommem[2081] = 65'h00631F80004110C1C;
rommem[2082] = 65'h1064208010653F800;
rommem[2083] = 65'h00652880104439009;
rommem[2084] = 65'h01C10800004519409;
rommem[2085] = 65'h106426001BE047F0F;
rommem[2086] = 65'h00443100906532000;
rommem[2087] = 65'h0024080090652E001;
rommem[2088] = 65'h147E1800002510009;
rommem[2089] = 65'h147E2801047E20008;
rommem[2090] = 65'h047E3802047E30018;
rommem[2091] = 65'h137EF803047E40028;
rommem[2092] = 65'h067E180000FEF0020;
rommem[2093] = 65'h167E2801067E20008;
rommem[2094] = 65'h1E200000F67E40018;
rommem[2095] = 65'h1162100301411000F;
rommem[2096] = 65'h10642100106217000;
rommem[2097] = 65'h0044290090632F000;
rommem[2098] = 65'h004310C0906319001;
rommem[2099] = 65'h0BE047EEF06108801;
rommem[2100] = 65'h10231000902408009;
rommem[2101] = 65'h047E2000847E18000;
rommem[2102] = 65'h047E4001847E28010;
rommem[2103] = 65'h00FEF003837EF8020;
rommem[2104] = 65'h067E3800867E18000;
rommem[2105] = 65'h067E4801867E40010;
rommem[2106] = 65'h067E5802867E50020;
rommem[2107] = 65'h00225800967EF8030;
rommem[2108] = 65'h10225000931FFF039;
rommem[2109] = 65'h0E240000131FFF058;
rommem[2110] = 65'h006938600E2000007;
rommem[2111] = 65'h10A7380040A738000;
rommem[2112] = 65'h06A758C10141180FF;
rommem[2113] = 65'h1BE047F4F06109001;
rommem[2114] = 65'h0BE04FEEF02208009;
rommem[2115] = 65'h031FFF05802A08009;
rommem[2116] = 65'h1141180FFE2000003;
rommem[2117] = 65'h1061090016A858C10;
rommem[2118] = 65'h160B00014BE047FAF;
rommem[2119] = 65'h047E3800847E18000;
rommem[2120] = 65'h047E4801847E40010;
rommem[2121] = 65'h047E5802847E50020;
rommem[2122] = 65'h037EF803847EF8030;
rommem[2123] = 65'h16A0D782DE6BEFFF8;
rommem[2124] = 65'h131FFEFFA6000141C;
rommem[2125] = 65'h031FFEF47E0400024;
rommem[2126] = 65'h0B01FFFFF31FFEE08;
rommem[2127] = 65'h131FFEF47B010030D;
rommem[2128] = 65'h162001418BE007F8A;
rommem[2129] = 65'h104100C0931FFEF37;
rommem[2130] = 65'h00A31800282308000;
rommem[2131] = 65'h0B210042431FFEF33;
rommem[2132] = 65'h00A31800282308000;
rommem[2133] = 65'h0B010563A31FFEF33;
rommem[2134] = 65'h0B012EF42B0106344;
rommem[2135] = 65'h0B010914CB0105D4A;
rommem[2136] = 65'h1B0100743B010153F;
rommem[2137] = 65'h0B012B849B0100452;
rommem[2138] = 65'h1BE007C2AB011A350;
rommem[2139] = 65'h0BE007BEA31FFF1BC;
rommem[2140] = 65'h00A31800282308000;
rommem[2141] = 65'h0B21FDB4C31FFEF33;
rommem[2142] = 65'h00A31800282308000;
rommem[2143] = 65'h1B21FD75331FFEF33;
rommem[2144] = 65'h06000141831FFEED9;
rommem[2145] = 65'h031FFEF3760001416;
rommem[2146] = 65'h1E07FC320BE007A4A;
rommem[2147] = 65'h0BE0079EA31FFEFE7;
rommem[2148] = 65'h170736944203D203F;
rommem[2149] = 65'h1706C65682079616C;
rommem[2150] = 65'h0203D20534C430A0D;
rommem[2151] = 65'h16373207261656C63;
rommem[2152] = 65'h1203A0A0D6E656572;
rommem[2153] = 65'h06D2074696445203D;
rommem[2154] = 65'h179622079726F6D65;
rommem[2155] = 65'h13D204C0A0D736574;
rommem[2156] = 65'h031532064616F4C20;
rommem[2157] = 65'h00A0D656C69662039;
rommem[2158] = 65'h0706D7544203D2044;
rommem[2159] = 65'h10D79726F6D656D20;
rommem[2160] = 65'h1617473203D20420A;
rommem[2161] = 65'h020796E6974207472;
rommem[2162] = 65'h14A0A0D6369736162;
rommem[2163] = 65'h020706D754A203D20;
rommem[2164] = 65'h10D65646F63206F74;
rommem[2165] = 65'h1766E49203D20490A;
rommem[2166] = 65'h1520A0D7372656461;
rommem[2167] = 65'h16F646E6152203D20;
rommem[2168] = 65'h10D73656E696C206D;
rommem[2169] = 65'h0616950203D20500A;
rommem[2170] = 65'h0000000000A0D6F6E;
rommem[2171] = 65'h00000000000000000;
rommem[2172] = 65'h167EF80000FEF0008;
rommem[2173] = 65'h00A31800282308000;
rommem[2174] = 65'h0B01FFD2031FFEF33;
rommem[2175] = 65'h047EF80000E318002;
rommem[2176] = 65'h031FFF0F837EF8008;
rommem[2177] = 65'h10410140931FFF11C;
rommem[2178] = 65'h131FFF0F8E1000007;
rommem[2179] = 65'h06050800031FFF11C;
rommem[2180] = 65'h0BE027F8F0A528001;
rommem[2181] = 65'h131FFF0F8BE00718A;
rommem[2182] = 65'h0341F800031FFF11C;
rommem[2183] = 65'h031FFF0F8BE00710A;
rommem[2184] = 65'h00211000931FFF11C;
rommem[2185] = 65'h031FFF02531FFEFFA;
rommem[2186] = 65'h031FFF02531FFF025;
rommem[2187] = 65'h031FFF02531FFF025;
rommem[2188] = 65'h031FFF02531FFF025;
rommem[2189] = 65'h0BE006F6A31FFF025;
rommem[2190] = 65'h067E100000FEF0018;
rommem[2191] = 65'h067EF801067E20008;
rommem[2192] = 65'h0E100000FE0800000;
rommem[2193] = 65'h00A31800282308000;
rommem[2194] = 65'h031FFF13031FFEF33;
rommem[2195] = 65'h106210800B01005FF;
rommem[2196] = 65'h0042088091410800F;
rommem[2197] = 65'h102208009BE027F0F;
rommem[2198] = 65'h047E2000847EF8010;
rommem[2199] = 65'h137EF801847E10000;
rommem[2200] = 65'h1AE100339A8100E30;
rommem[2201] = 65'h037EF80000E108030;
rommem[2202] = 65'h0AE100446A8100A41;
rommem[2203] = 65'h10A10800A0E108041;
rommem[2204] = 65'h0A810056137EF8000;
rommem[2205] = 65'h10E108061AE100466;
rommem[2206] = 65'h137EF80000A10800A;
rommem[2207] = 65'h137EF8000E07FFFFF;
rommem[2208] = 65'h031FFF1B2BE00006A;
rommem[2209] = 65'h131FFF1B2B21FFF0A;
rommem[2210] = 65'h1B21FFC53B01F521A;
rommem[2211] = 65'h1A01FFA3031FFF1B2;
rommem[2212] = 65'h004101009A61FF939;
rommem[2213] = 65'h031FFF13031FFF1B2;
rommem[2214] = 65'h131FFF1B204100809;
rommem[2215] = 65'h10621080031FFF130;
rommem[2216] = 65'h104208C0904208809;
rommem[2217] = 65'h0B0401E31B04FEF30;
rommem[2218] = 65'h1B0402033B0401F32;
rommem[2219] = 65'h0B0402037B04FEB35;
rommem[2220] = 65'h1B0402439B0402238;
rommem[2221] = 65'h0143180FFBE007CEA;
rommem[2222] = 65'h031FFF1B20E318001;
rommem[2223] = 65'h10621080031FFF130;
rommem[2224] = 65'h031FFF1B204208809;
rommem[2225] = 65'h10621080031FFF130;
rommem[2226] = 65'h16051000004208809;
rommem[2227] = 65'h1BE01FECF0A528001;
rommem[2228] = 65'h031FFF13031FFF1B2;
rommem[2229] = 65'h10420880906210800;
rommem[2230] = 65'h031FFF13031FFF1B2;
rommem[2231] = 65'h10420880906210800;
rommem[2232] = 65'h131FFF180BE007A2A;
rommem[2233] = 65'h031FFF186BE007D2A;
rommem[2234] = 65'h131FFF18CBE007CEA;
rommem[2235] = 65'h031FFF18CBE007CAA;
rommem[2236] = 65'h0BE0063AA66028000;
rommem[2237] = 65'h16602800031FFF186;
rommem[2238] = 65'h031FFF180BE00634A;
rommem[2239] = 65'h0BE0062EA66028000;
rommem[2240] = 65'h167EF80000FEF0008;
rommem[2241] = 65'h031FFF13031FFF1B2;
rommem[2242] = 65'h0BE00038A04100809;
rommem[2243] = 65'h167EF80000FEF0008;
rommem[2244] = 65'h031FFF13031FFF1B2;
rommem[2245] = 65'h0BE0001CA04100809;
rommem[2246] = 65'h167EF80000FEF0008;
rommem[2247] = 65'h031FFF13031FFF1B2;
rommem[2248] = 65'h131FFF1B204100809;
rommem[2249] = 65'h10621080031FFF130;
rommem[2250] = 65'h031FFF1B204110809;
rommem[2251] = 65'h10621080031FFF130;
rommem[2252] = 65'h031FFF1B204208809;
rommem[2253] = 65'h10621080031FFF130;
rommem[2254] = 65'h031FFF1B204208809;
rommem[2255] = 65'h10621080031FFF130;
rommem[2256] = 65'h031FFF1B204208809;
rommem[2257] = 65'h10621080031FFF130;
rommem[2258] = 65'h031FFF1B204208809;
rommem[2259] = 65'h10621080031FFF130;
rommem[2260] = 65'h031FFF1B204208809;
rommem[2261] = 65'h10621080031FFF130;
rommem[2262] = 65'h00442100A04208809;
rommem[2263] = 65'h047EF800004201409;
rommem[2264] = 65'h037EF80000BEF0008;
rommem[2265] = 65'h167EF80000FEF0008;
rommem[2266] = 65'h1BE10690831FFEE1D;
rommem[2267] = 65'h0B01EDF0031FFEE08;
rommem[2268] = 65'h0BE107F6231FFF95C;
rommem[2269] = 65'h037EF800847EF8000;
rommem[2270] = 65'h067E080000FEF0018;
rommem[2271] = 65'h167EF801067E18008;
rommem[2272] = 65'h0020088A800000050;
rommem[2273] = 65'h1EE800003E69AE000;
rommem[2274] = 65'h1000000506A0D042A;
rommem[2275] = 65'h016018554020088A8;
rommem[2276] = 65'h1E69AE0080411841C;
rommem[2277] = 65'h06A0D042AEE800003;
rommem[2278] = 65'h0020088A800000050;
rommem[2279] = 65'h00411841C16018554;
rommem[2280] = 65'h0EE800003E69AE010;
rommem[2281] = 65'h1000000506A0D042A;
rommem[2282] = 65'h116018300020088A8;
rommem[2283] = 65'h0E69AE00C0411841C;
rommem[2284] = 65'h06A0D042AEE800003;
rommem[2285] = 65'h0020088A800000050;
rommem[2286] = 65'h10411841C16018300;
rommem[2287] = 65'h1EE800003E69AE014;
rommem[2288] = 65'h0E04000026A0D042A;
rommem[2289] = 65'h1EE800003E69AE03C;
rommem[2290] = 65'h131FFEE086A0D042A;
rommem[2291] = 65'h1B01FD972B0100303;
rommem[2292] = 65'h047EF8010BE007FAA;
rommem[2293] = 65'h047E0800047E18008;
rommem[2294] = 65'h1E698000037EF8018;
rommem[2295] = 65'h16A0D082DEE800003;
rommem[2296] = 65'h100000050E10037FF;
rommem[2297] = 65'h192208000020088A8;
rommem[2298] = 65'h0BE027F8F0A210002;
rommem[2299] = 65'h10FEF001037EF8000;
rommem[2300] = 65'h167EF800867E08000;
rommem[2301] = 65'h0EE800003E69C1026;
rommem[2302] = 65'h031FFEE086A0D0029;
rommem[2303] = 65'h1E69C1068B0100A03;
rommem[2304] = 65'h06A0D0429EE800003;
rommem[2305] = 65'h1E69C1026BE107F69;
rommem[2306] = 65'h06A0D0429EE800003;
rommem[2307] = 65'h1B21FF30F1410800F;
rommem[2308] = 65'h0EE800003E69C1002;
rommem[2309] = 65'h1E69C10046A0D0029;
rommem[2310] = 65'h16A0D0029EE800003;
rommem[2311] = 65'h1EE800003E69C1018;
rommem[2312] = 65'h0E69C100A6A0D0029;
rommem[2313] = 65'h16A0D0029EE800003;
rommem[2314] = 65'h0E69C1020E07F8000;
rommem[2315] = 65'h06A0D0429EE800003;
rommem[2316] = 65'h0B010050331FFEE08;
rommem[2317] = 65'h0EE800003E69C1068;
rommem[2318] = 65'h1BE107F696A0D0429;
rommem[2319] = 65'h147E0800047EF8008;
rommem[2320] = 65'h00FEF001037EF8010;
rommem[2321] = 65'h167EF800867E08000;
rommem[2322] = 65'h0E69C0600E0400008;
rommem[2323] = 65'h16A0D0428EE800003;
rommem[2324] = 65'h0E69500801600800F;
rommem[2325] = 65'h06A0D0429EE800003;
rommem[2326] = 65'h1E69500001600B46E;
rommem[2327] = 65'h06A0D0429EE800003;
rommem[2328] = 65'h1E69C0600E0400009;
rommem[2329] = 65'h16A0D0428EE800003;
rommem[2330] = 65'h1E6950006E07FCA12;
rommem[2331] = 65'h06A0D0429EE800003;
rommem[2332] = 65'h1E695000416009104;
rommem[2333] = 65'h06A0D0429EE800003;
rommem[2334] = 65'h1EE800005E6BD7840;
rommem[2335] = 65'h0BE00800F040D0409;
rommem[2336] = 65'h0E69C0600E040000D;
rommem[2337] = 65'h16A0D0428EE800003;
rommem[2338] = 65'h0E695000416008104;
rommem[2339] = 65'h06A0D0429EE800003;
rommem[2340] = 65'h1EE800005E6BD7840;
rommem[2341] = 65'h0BE00800F040D0409;
rommem[2342] = 65'h0E69C0600E0400010;
rommem[2343] = 65'h16A0D0428EE800003;
rommem[2344] = 65'h0E695000416008000;
rommem[2345] = 65'h06A0D0429EE800003;
rommem[2346] = 65'h147E0800047EF8008;
rommem[2347] = 65'h01600800F37EF8010;
rommem[2348] = 65'h1EE800003E6950080;
rommem[2349] = 65'h131FFEE086A0D0429;
rommem[2350] = 65'h1B0100861B01E3A03;
rommem[2351] = 65'h1B0100C63B0100A62;
rommem[2352] = 65'h1B0101065B0100E64;
rommem[2353] = 65'h1B0101467B0101266;
rommem[2354] = 65'h1E0401C31BE007EEA;
rommem[2355] = 65'h0BE007E8A31FFF27A;
rommem[2356] = 65'h031FFF27AE0401FA5;
rommem[2357] = 65'h0E04010C3BE007E2A;
rommem[2358] = 65'h1BE007DCA31FFF27A;
rommem[2359] = 65'h131FFF27AE04012D1;
rommem[2360] = 65'h0E040151FBE007D6A;
rommem[2361] = 65'h1BE007D0A31FFF27A;
rommem[2362] = 65'h031FFF27AE0401660;
rommem[2363] = 65'h0E040191EBE007CAA;
rommem[2364] = 65'h1BE007C4A31FFF27A;
rommem[2365] = 65'h167E080000FEF0010;
rommem[2366] = 65'h1E695000067EF8008;
rommem[2367] = 65'h06A0D0429EE800003;
rommem[2368] = 65'h1E6950006E07FCA12;
rommem[2369] = 65'h06A0D0429EE800003;
rommem[2370] = 65'h1E695000416009104;
rommem[2371] = 65'h06A0D0429EE800003;
rommem[2372] = 65'h0040D0409E683D090;
rommem[2373] = 65'h116008104BE00800F;
rommem[2374] = 65'h1EE800003E6950004;
rommem[2375] = 65'h0E683D0906A0D0429;
rommem[2376] = 65'h0BE00800F040D0409;
rommem[2377] = 65'h0E695000416008000;
rommem[2378] = 65'h06A0D0429EE800003;
rommem[2379] = 65'h147E0800047EF8008;
rommem[2380] = 65'h00FEF000837EF8010;
rommem[2381] = 65'h0E04000C867E08000;
rommem[2382] = 65'h1EE800003E69A0100;
rommem[2383] = 65'h1E04000F06A0D0429;
rommem[2384] = 65'h0EE800003E69A0102;
rommem[2385] = 65'h0E04001186A0D0429;
rommem[2386] = 65'h0EE800003E69A0104;
rommem[2387] = 65'h1E04001406A0D0429;
rommem[2388] = 65'h1EE800003E69A0106;
rommem[2389] = 65'h1E04001686A0D0429;
rommem[2390] = 65'h0EE800003E69A0108;
rommem[2391] = 65'h147E080006A0D0429;
rommem[2392] = 65'h0E69A011E37EF8008;
rommem[2393] = 65'h16A0D0421EE800003;
rommem[2394] = 65'h1B0100802B0100901;
rommem[2395] = 65'h0B0100604B0100703;
rommem[2396] = 65'h1B0100406B0100505;
rommem[2397] = 65'h1B0100208B0100307;
rommem[2398] = 65'h01A10802837EF8000;
rommem[2399] = 65'h1E69AD0020A1080CC;
rommem[2400] = 65'h06A0D0429EE800003;
rommem[2401] = 65'h1EE800003E69AD012;
rommem[2402] = 65'h1E69AD0226A0D0429;
rommem[2403] = 65'h06A0D0429EE800003;
rommem[2404] = 65'h0EE800003E69AD032;
rommem[2405] = 65'h1E69AD0426A0D0429;
rommem[2406] = 65'h06A0D0429EE800003;
rommem[2407] = 65'h0EE800003E69AD052;
rommem[2408] = 65'h0E69AD0626A0D0429;
rommem[2409] = 65'h06A0D0429EE800003;
rommem[2410] = 65'h1EE800003E69AD072;
rommem[2411] = 65'h037EF80006A0D0429;
rommem[2412] = 65'h167E080000FEF0020;
rommem[2413] = 65'h167E1801067E10008;
rommem[2414] = 65'h131FFEEBA67EF8018;
rommem[2415] = 65'h04201941842011416;
rommem[2416] = 65'h1EE800003E69C0418;
rommem[2417] = 65'h11600802E6A0D002B;
rommem[2418] = 65'h01600804062009416;
rommem[2419] = 65'h0E69C040062009418;
rommem[2420] = 65'h06A0D0423EE800003;
rommem[2421] = 65'h16201141631FFF019;
rommem[2422] = 65'h031FFEF3762019418;
rommem[2423] = 65'h047EF801831FFEEBF;
rommem[2424] = 65'h147E1000847E18010;
rommem[2425] = 65'h037EF802047E08000;
rommem[2426] = 65'h0400000040FEF0010;
rommem[2427] = 65'h062019508E0C00140;
rommem[2428] = 65'h06000151062001500;
rommem[2429] = 65'h06200151462001512;
rommem[2430] = 65'h037EF827740000004;
rommem[2431] = 65'h0400000050FEF0018;
rommem[2432] = 65'h160019416E0C00001;
rommem[2433] = 65'h160019418E0C00028;
rommem[2434] = 65'h031FFF00F40009500;
rommem[2435] = 65'h131FFF00F40009501;
rommem[2436] = 65'h037EF827F40000005;
rommem[2437] = 65'h0400000010FEF0010;
rommem[2438] = 65'h0AC10140242009514;
rommem[2439] = 65'h10610860142009512;
rommem[2440] = 65'h14200951460009418;
rommem[2441] = 65'h00E10800160009416;
rommem[2442] = 65'h0E040005E62009514;
rommem[2443] = 65'h04000941831FFEF47;
rommem[2444] = 65'h1600094180E108001;
rommem[2445] = 65'h10E10800140009416;
rommem[2446] = 65'h1E040002060009416;
rommem[2447] = 65'h04000000131FFEF47;
rommem[2448] = 65'h06000151037EF8010;
rommem[2449] = 65'h10610860142009512;
rommem[2450] = 65'h14200951460009418;
rommem[2451] = 65'h1E040002060009416;
rommem[2452] = 65'h04000000131FFEF47;
rommem[2453] = 65'h10FEF001837EF8010;
rommem[2454] = 65'h0E0C0027F40000005;
rommem[2455] = 65'h14201950860019416;
rommem[2456] = 65'h16001941806318601;
rommem[2457] = 65'h131FFEF47E0400020;
rommem[2458] = 65'h131FFEF47E0400023;
rommem[2459] = 65'h031FFEF47E0400041;
rommem[2460] = 65'h131FFEF47E0400023;
rommem[2461] = 65'h131FFEF47E0400020;
rommem[2462] = 65'h037EF827F40000005;
rommem[2463] = 65'h0160080E946018000;
rommem[2464] = 65'h1160080F262308000;
rommem[2465] = 65'h0160080DF62308001;
rommem[2466] = 65'h037EF800062308002;
rommem[2467] = 65'h04000000F0FEF0028;
rommem[2468] = 65'h04202157042009520;
rommem[2469] = 65'h1BE2003A814110001;
rommem[2470] = 65'h16001941640019571;
rommem[2471] = 65'h0E040002060021418;
rommem[2472] = 65'h0E040002331FFF00F;
rommem[2473] = 65'h0E040002331FFF00F;
rommem[2474] = 65'h0E040002331FFF00F;
rommem[2475] = 65'h0E040002031FFF00F;
rommem[2476] = 65'h04000941631FFF00F;
rommem[2477] = 65'h1600094160A108001;
rommem[2478] = 65'h10E10800540009418;
rommem[2479] = 65'h031FFF00FE0400020;
rommem[2480] = 65'h031FFF00FE0400058;
rommem[2481] = 65'h031FFF00FE0400020;
rommem[2482] = 65'h031FFF00FE0400058;
rommem[2483] = 65'h031FFF00FE0400020;
rommem[2484] = 65'h037EF827F4000000F;
rommem[2485] = 65'h1FFFF000037EF8000;
rommem[2486] = 65'h131FFF2FF4000000F;
rommem[2487] = 65'h131FFF34631FFF2FE;
rommem[2488] = 65'h031FFF30A31FFF36A;
rommem[2489] = 65'h131FFEE0831FFF32B;
rommem[2490] = 65'h0B010096AB010046B;
rommem[2491] = 65'h1BE0002AAB0100D20;
rommem[2492] = 65'h1E680028042011508;
rommem[2493] = 65'h00A210008BE2D0247;
rommem[2494] = 65'h0BE0001EA62011508;
rommem[2495] = 65'h0BE2001A242011508;
rommem[2496] = 65'h0620115080E210008;
rommem[2497] = 65'h040011510BE00014A;
rommem[2498] = 65'h1E0800001BE200109;
rommem[2499] = 65'h04201150860011510;
rommem[2500] = 65'h1E080002E62011512;
rommem[2501] = 65'h0BE00002A62011514;
rommem[2502] = 65'h1BE007C2AB0100203;
rommem[2503] = 65'h10BEF02F74000000F;
rommem[2504] = 65'h133FFF39CBE0020CA;
rommem[2505] = 65'h033FFF95A33FFF3BE;
rommem[2506] = 65'h033FFF96233FFF95B;
rommem[2507] = 65'h133FFF9EA33FFF95C;
rommem[2508] = 65'h10000000010060000;
rommem[2509] = 65'h100000000107FFFF8;
rommem[2510] = 65'h167EF80000FEF0008;
rommem[2511] = 65'h1460F4E68660F1088;
rommem[2512] = 65'h167EF80000FEF0008;
rommem[2513] = 65'h16200141862001416;
rommem[2514] = 65'h06600103C6000141A;
rommem[2515] = 65'h1EE800040E6800020;
rommem[2516] = 65'h164011040040D0809;
rommem[2517] = 65'h19A00E5C031FFEED9;
rommem[2518] = 65'h09A00E5C031FFF94D;
rommem[2519] = 65'h04600CE6031FFF940;
rommem[2520] = 65'h04600CE68660090D0;
rommem[2521] = 65'h1660090F80E108800;
rommem[2522] = 65'h0660090D80E10A000;
rommem[2523] = 65'h1460090D831FFF4C3;
rommem[2524] = 65'h104118404460190D0;
rommem[2525] = 65'h031FFF88DE0800000;
rommem[2526] = 65'h031FFF9409A00E668;
rommem[2527] = 65'h066001098660010A8;
rommem[2528] = 65'h1460F4E6866001090;
rommem[2529] = 65'h031FFF9409A00E676;
rommem[2530] = 65'h131FFF7D8E040003E;
rommem[2531] = 65'h10286000931FFF91D;
rommem[2532] = 65'h131FFF8FF9A04111B;
rommem[2533] = 65'h0BE10172831FFF914;
rommem[2534] = 65'h19A00E694AC1003FF;
rommem[2535] = 65'h102110009BE007F4A;
rommem[2536] = 65'h00621100160817FFE;
rommem[2537] = 65'h10E84000260817FFF;
rommem[2538] = 65'h00296800931FFF80C;
rommem[2539] = 65'h1E0400000BE1001C8;
rommem[2540] = 65'h1BE10004931FFF820;
rommem[2541] = 65'h002908009BE900108;
rommem[2542] = 65'h0460190D002D10009;
rommem[2543] = 65'h0660110D031FFF829;
rommem[2544] = 65'h0BE00006A02D48009;
rommem[2545] = 65'h102D48009660690D0;
rommem[2546] = 65'h10414040402C08009;
rommem[2547] = 65'h0460590D0A41FDE03;
rommem[2548] = 65'h104B0AC0202B50009;
rommem[2549] = 65'h0BEB08064460090D8;
rommem[2550] = 65'h033FFF7C89A00E76F;
rommem[2551] = 65'h102A08009660590D0;
rommem[2552] = 65'h00291800902B10009;
rommem[2553] = 65'h00280800931FFF82F;
rommem[2554] = 65'h002C1800902D10009;
rommem[2555] = 65'h0BE0079AA31FFF829;
rommem[2556] = 65'h1C4414F4CD453494C;
rommem[2557] = 65'h14153CE5552D7454E;
rommem[2558] = 65'h0454CD458454EC556;
rommem[2559] = 65'h147CF544F47C649D4;
rommem[2560] = 65'h155544552C255534F;
rommem[2561] = 65'h1D24F46CD4552CE52;
rommem[2562] = 65'h1495250D455504E49;
rommem[2563] = 65'h050C3454B4F50D44E;
rommem[2564] = 65'h1454B4F50C8454B4F;
rommem[2565] = 65'h14F5453C54B4F50D7;
rommem[2566] = 65'h143D35953C55942D0;
rommem[2567] = 65'h0434452D24C43D34C;
rommem[2568] = 65'h050C34B45455000C6;
rommem[2569] = 65'h14B454550C84B4545;
rommem[2570] = 65'h1C44E52CB454550D7;
rommem[2571] = 65'h055C55A4953D34241;
rommem[2572] = 65'h0545300CF5400D253;
rommem[2573] = 65'h1BEBE3CBD3E00D045;
rommem[2574] = 65'h0C44E4100BCBD3CBD;
rommem[2576] = 65'h0FFFFFFFFFFFFD338;
rommem[2577] = 65'h0FFFFFFFFFFFFD67C;
rommem[2578] = 65'h0FFFFFFFFFFFFD284;
rommem[2579] = 65'h0FFFFFFFFFFFFD29C;
rommem[2580] = 65'h0FFFFFFFFFFFFD728;
rommem[2581] = 65'h0FFFFFFFFFFFFD508;
rommem[2582] = 65'h0FFFFFFFFFFFFD664;
rommem[2583] = 65'h1FFFFFFFFFFFFD578;
rommem[2584] = 65'h0FFFFFFFFFFFFD2E4;
rommem[2585] = 65'h0FFFFFFFFFFFFD418;
rommem[2586] = 65'h1FFFFFFFFFFFFD454;
rommem[2587] = 65'h0FFFFFFFFFFFFD580;
rommem[2588] = 65'h1FFFFFFFFFFFFD48C;
rommem[2589] = 65'h0FFFFFFFFFFFFD5A8;
rommem[2590] = 65'h0FFFFFFFFFFFFD380;
rommem[2591] = 65'h0FFFFFFFFFFFFD83C;
rommem[2592] = 65'h1FFFFFFFFFFFFD868;
rommem[2593] = 65'h1FFFFFFFFFFFFD894;
rommem[2594] = 65'h1FFFFFFFFFFFFD808;
rommem[2595] = 65'h1FFFFFFFFFFFFD294;
rommem[2596] = 65'h1FFFFFFFFFFFFCE5C;
rommem[2597] = 65'h0FFFFFFFFFFFFD8C0;
rommem[2598] = 65'h0FFFFFFFFFFFFE58C;
rommem[2599] = 65'h0FFFFFFFFFFFFD304;
rommem[2600] = 65'h1FFFFFFFFFFFFE5A0;
rommem[2601] = 65'h1FFFFFFFFFFFFD65C;
rommem[2602] = 65'h0FFFFFFFFFFFFDD3C;
rommem[2603] = 65'h0FFFFFFFFFFFFDD50;
rommem[2604] = 65'h1FFFFFFFFFFFFDD64;
rommem[2605] = 65'h1FFFFFFFFFFFFDD2C;
rommem[2606] = 65'h1FFFFFFFFFFFFDD94;
rommem[2607] = 65'h1FFFFFFFFFFFFDE2C;
rommem[2608] = 65'h1FFFFFFFFFFFFDE4C;
rommem[2609] = 65'h0FFFFFFFFFFFFDD78;
rommem[2610] = 65'h0FFFFFFFFFFFFDB50;
rommem[2611] = 65'h1FFFFFFFFFFFFD4A4;
rommem[2612] = 65'h0FFFFFFFFFFFFDF1C;
rommem[2613] = 65'h0FFFFFFFFFFFFD4B8;
rommem[2614] = 65'h0FFFFFFFFFFFFD4C0;
rommem[2615] = 65'h0FFFFFFFFFFFFD9D0;
rommem[2616] = 65'h0FFFFFFFFFFFFD9E0;
rommem[2617] = 65'h1FFFFFFFFFFFFD9F0;
rommem[2618] = 65'h0FFFFFFFFFFFFDA10;
rommem[2619] = 65'h1FFFFFFFFFFFFDA00;
rommem[2620] = 65'h0FFFFFFFFFFFFDA20;
rommem[2621] = 65'h1FFFFFFFFFFFFDA48;
rommem[2622] = 65'h1FFFFFFFFFFFFD93C;
rommem[2623] = 65'h0FFFFFFFFFFFFD94C;
rommem[2624] = 65'h0FFFFFFFFFFFFD904;
rommem[2625] = 65'h1FFFFFFFFFFFFD914;
rommem[2626] = 65'h19A0550809A04CFE0;
rommem[2627] = 65'h031FFF91403F58009;
rommem[2628] = 65'h00285800902BF8009;
rommem[2629] = 65'h04A808000E0C00000;
rommem[2630] = 65'h14A9100000A840001;
rommem[2631] = 65'h002B40009BE200069;
rommem[2632] = 65'h1BE1181C8BE0001EA;
rommem[2633] = 65'h1BE2081081421007F;
rommem[2634] = 65'h002B400090AA50008;
rommem[2635] = 65'h00A948001E0C00000;
rommem[2636] = 65'h1BE107FC34090FFFF;
rommem[2637] = 65'h0E0C0002EBE007E2A;
rommem[2638] = 65'h04090FFFF0A948001;
rommem[2639] = 65'h146A58000BE107DA3;
rommem[2640] = 65'h131FFF7B934B00000;
rommem[2641] = 65'h1660090D04600CE60;
rommem[2642] = 65'h131FFF7B931FFF4C3;
rommem[2643] = 65'h131FFF7B9BE00630A;
rommem[2644] = 65'h06604109046044E60;
rommem[2645] = 65'h14600909031FFF4C3;
rommem[2646] = 65'h0E0400000BE106248;
rommem[2647] = 65'h131FFF81002848009;
rommem[2648] = 65'h0BE900049BE100069;
rommem[2649] = 65'h166049090BE00618A;
rommem[2650] = 65'h131FFF9369A940002;
rommem[2651] = 65'h19A0550A89A04CFF2;
rommem[2652] = 65'h031FFF63ABE0079CA;
rommem[2653] = 65'h131FFF7B902128009;
rommem[2654] = 65'h031FFF80C02508009;
rommem[2655] = 65'h09A00E73BBE107EA9;
rommem[2656] = 65'h131FFF4C3BE00610A;
rommem[2657] = 65'h00FEF0010BE00084A;
rommem[2658] = 65'h067EF800867E30000;
rommem[2659] = 65'h1460090D8E1800800;
rommem[2660] = 65'h10810800866100000;
rommem[2661] = 65'h047EF8008BE037FCF;
rommem[2662] = 65'h137EF801047E30000;
rommem[2663] = 65'h00212800931FFF8FF;
rommem[2664] = 65'h10250800931FFF7B9;
rommem[2665] = 65'h0BE10004931FFF80C;
rommem[2666] = 65'h102908009BE905D48;
rommem[2667] = 65'h10214800931FFF8DF;
rommem[2668] = 65'h0BE10008831FFF936;
rommem[2669] = 65'h131FFF936B2100313;
rommem[2670] = 65'h0E0400000BE107FE8;
rommem[2671] = 65'h0BE007E8A31FFF810;
rommem[2672] = 65'h1E0C0003A1602800B;
rommem[2673] = 65'h131FFF8F19A025398;
rommem[2674] = 65'h1BE007A0A31FFEFFA;
rommem[2675] = 65'h19A0253ACE0C0000D;
rommem[2676] = 65'h131FFEFFA31FFF8F1;
rommem[2677] = 65'h1E0C00023BE00782A;
rommem[2678] = 65'h131FFF8F19A0253C4;
rommem[2679] = 65'h10410140931FFF63A;
rommem[2680] = 65'h1E0C00024BE00012A;
rommem[2681] = 65'h131FFF8F19A0253DC;
rommem[2682] = 65'h031FFF39331FFF63A;
rommem[2683] = 65'h131FFF867BE00006A;
rommem[2684] = 65'h1E0C0002CBE00010A;
rommem[2685] = 65'h131FFF8F19A0253F8;
rommem[2686] = 65'h0BE007DCA31FFF7AA;
rommem[2687] = 65'h0BE0000AA31FFEFFA;
rommem[2688] = 65'h10450080931FFF63A;
rommem[2689] = 65'h0BE007ECA31FFF88D;
rommem[2690] = 65'h033FFF7C731FFF7AA;
rommem[2691] = 65'h031FFF63A31FFF83E;
rommem[2692] = 65'h1BE10006931FFF80C;
rommem[2693] = 65'h0BE0057AA9A00E73B;
rommem[2694] = 65'h167E400000DEF0018;
rommem[2695] = 65'h167E0800846009090;
rommem[2696] = 65'h067E0801046009098;
rommem[2697] = 65'h0660F1098660010A8;
rommem[2698] = 65'h131FFF7B9BE0073EA;
rommem[2699] = 65'h1BE10006946009098;
rommem[2700] = 65'h0BE0055EA9A00E758;
rommem[2701] = 65'h147E08010021F0009;
rommem[2702] = 65'h047E0800866009098;
rommem[2703] = 65'h047E4000066009090;
rommem[2704] = 65'h031FFF83109EF0018;
rommem[2705] = 65'h131FFF83EBE007C4A;
rommem[2706] = 65'h0660090A831FFF798;
rommem[2707] = 65'h09A0551989A04D063;
rommem[2708] = 65'h131FFF63A33FFF486;
rommem[2709] = 65'h09A04D066660090B8;
rommem[2710] = 65'h033FFF4869A0551A8;
rommem[2711] = 65'h0BE00004A31FFF63A;
rommem[2712] = 65'h0660090B0E0400001;
rommem[2713] = 65'h1660110C046011090;
rommem[2714] = 65'h005E00C09660410C8;
rommem[2715] = 65'h0BE00004A460310A8;
rommem[2716] = 65'h0463100000A318028;
rommem[2717] = 65'h1BE237FA9BE2000E8;
rommem[2718] = 65'h10A31002804300409;
rommem[2719] = 65'h031FFF82F05E00C09;
rommem[2720] = 65'h1BE00786A09EF0028;
rommem[2721] = 65'h031FFF6ECE0400000;
rommem[2722] = 65'h19A00E717BE100069;
rommem[2723] = 65'h102148009BE00504A;
rommem[2724] = 65'h1BE100069460090A8;
rommem[2725] = 65'h0BE004FAA9A00E704;
rommem[2726] = 65'h131FFF831BE148068;
rommem[2727] = 65'h046908000BE007F4A;
rommem[2728] = 65'h004110403460110B0;
rommem[2729] = 65'h1460190B866908000;
rommem[2730] = 65'h1BE1180E0BE200063;
rommem[2731] = 65'h0BE1180A3BE00004A;
rommem[2732] = 65'h166041090460410C0;
rommem[2733] = 65'h0BE00752A460410C8;
rommem[2734] = 65'h0BE0074EA31FFF831;
rommem[2735] = 65'h0BE106AC931FFF63A;
rommem[2736] = 65'h0E040000002848009;
rommem[2737] = 65'h1BE104B6331FFF821;
rommem[2738] = 65'h1460F10A0BE0069EA;
rommem[2739] = 65'h16604109047E40010;
rommem[2740] = 65'h10BEF002847E40008;
rommem[2741] = 65'h067E280200FEF0028;
rommem[2742] = 65'h031FFF86767E40000;
rommem[2743] = 65'h1E0400001BE0000CA;
rommem[2744] = 65'h1BE1003E831FFF6EC;
rommem[2745] = 65'h1BE0001AA02150009;
rommem[2746] = 65'h1E040000167E40008;
rommem[2747] = 65'h1BE10006931FFF6EC;
rommem[2748] = 65'h1BE0049EA9A00E6E7;
rommem[2749] = 65'h04082800002150009;
rommem[2750] = 65'h047E0800860800000;
rommem[2751] = 65'h06082800031FFF851;
rommem[2752] = 65'h14600909067E40008;
rommem[2753] = 65'h0E07FFFFF67E08010;
rommem[2754] = 65'h1660F10A066009090;
rommem[2755] = 65'h0E040003A67E50018;
rommem[2756] = 65'h19A04111B31FFF7D8;
rommem[2757] = 65'h047E5001831FFF63A;
rommem[2758] = 65'h047E0801066A08000;
rommem[2759] = 65'h147E4000866009090;
rommem[2760] = 65'h19A025650E0C0002C;
rommem[2761] = 65'h0BE007B2A31FFF8F1;
rommem[2762] = 65'h109EF002847E28020;
rommem[2763] = 65'h04080800033FFF504;
rommem[2764] = 65'h031FFF798B01F6C0D;
rommem[2765] = 65'h19A025410E0C0002C;
rommem[2766] = 65'h1BE007F8A31FFF8F1;
rommem[2767] = 65'h046044E60BE006CCA;
rommem[2768] = 65'h031FFF395E040000D;
rommem[2769] = 65'h1BE107FE231FFF396;
rommem[2770] = 65'h0B0100D1AB0100E40;
rommem[2771] = 65'h031FFF5B4B21FFC3A;
rommem[2772] = 65'h00610900160808000;
rommem[2773] = 65'h00A84000260808001;
rommem[2774] = 65'h1BE107FE231FFF396;
rommem[2775] = 65'h10A84000160808000;
rommem[2776] = 65'h1BE007E2AB21FFC0D;
rommem[2777] = 65'h1BE00416A660410D0;
rommem[2778] = 65'h167E280000FEF0018;
rommem[2779] = 65'h167EF801067E30008;
rommem[2780] = 65'h0E1400000E1800003;
rommem[2781] = 65'h1BE107FE231FFF396;
rommem[2782] = 65'h00652880031FFF5C5;
rommem[2783] = 65'h1BE037F6F04509409;
rommem[2784] = 65'h147EF801002508009;
rommem[2785] = 65'h147E2800047E30008;
rommem[2786] = 65'h0A410023937EF8018;
rommem[2787] = 65'h10E1080300E108007;
rommem[2788] = 65'h137EF80001410800F;
rommem[2789] = 65'h1460490D046044E60;
rommem[2790] = 65'h1BE8481C531FFF5E1;
rommem[2791] = 65'h131FFF395E040003A;
rommem[2792] = 65'h14A8100014A808000;
rommem[2793] = 65'h10411040906211000;
rommem[2794] = 65'h131FFF5E90A840002;
rommem[2795] = 65'h00A84000140808000;
rommem[2796] = 65'h131FFF395B01FF40D;
rommem[2797] = 65'h1E0400040BE007F8A;
rommem[2798] = 65'h031FFF5E131FFF395;
rommem[2799] = 65'h031FFF395E040001A;
rommem[2800] = 65'h10FEF0008BE003BCA;
rommem[2801] = 65'h0E040000D67EF8000;
rommem[2802] = 65'h1E040000A31FFF395;
rommem[2803] = 65'h147EF800031FFF395;
rommem[2804] = 65'h10DEF001037EF8008;
rommem[2805] = 65'h067E2800867EF8000;
rommem[2806] = 65'h1021200099A02910F;
rommem[2807] = 65'h10642080102408009;
rommem[2808] = 65'h16050800031FFF5FD;
rommem[2809] = 65'h1125091000E528001;
rommem[2810] = 65'h10A528001BE107F41;
rommem[2811] = 65'h131FFF39540508000;
rommem[2812] = 65'h0BE107F801250910F;
rommem[2813] = 65'h047EF800047E28008;
rommem[2814] = 65'h01410800F37EF8010;
rommem[2815] = 65'h008108007A010020A;
rommem[2816] = 65'h137EF80000A108030;
rommem[2817] = 65'h131FFF63A0FEF0008;
rommem[2818] = 65'h19A025834E0C0002C;
rommem[2819] = 65'h067E0800031FFF8F1;
rommem[2820] = 65'h147E1000031FFF63A;
rommem[2821] = 65'h10BEF000860208000;
rommem[2822] = 65'h09A00E680BE005F0A;
rommem[2823] = 65'h00FEF0008BE00374A;
rommem[2824] = 65'h1E0C0002C31FFF63A;
rommem[2825] = 65'h031FFF8F19A025834;
rommem[2826] = 65'h031FFF63A67E08000;
rommem[2827] = 65'h16220800047E10000;
rommem[2828] = 65'h033FFF5040BEF0008;
rommem[2829] = 65'h131FFF63A0FEF0008;
rommem[2830] = 65'h19A025834E0C0002C;
rommem[2831] = 65'h067E0800031FFF8F1;
rommem[2832] = 65'h147E1000031FFF63A;
rommem[2833] = 65'h00BEF000864208000;
rommem[2834] = 65'h10FEF000833FFF504;
rommem[2835] = 65'h1E0C0002C31FFF63A;
rommem[2836] = 65'h031FFF8F19A025834;
rommem[2837] = 65'h031FFF63A67E08000;
rommem[2838] = 65'h06620800047E10000;
rommem[2839] = 65'h033FFF5040BEF0008;
rommem[2840] = 65'h131FFF63A0FEF0008;
rommem[2841] = 65'h19A00E6D5BE100069;
rommem[2842] = 65'h167E40000BE00328A;
rommem[2843] = 65'h147E40000341F8000;
rommem[2844] = 65'h1BE00596A0BEF0008;
rommem[2845] = 65'h167EF80000FEF0010;
rommem[2846] = 65'h167E0800431FFF648;
rommem[2847] = 65'h09A0552009A04D079;
rommem[2848] = 65'h131FFF64833FFF486;
rommem[2849] = 65'h10411040947E10008;
rommem[2850] = 65'h147E08008BE007F2A;
rommem[2851] = 65'h037EF801047EF8000;
rommem[2852] = 65'h167EF80000FEF0010;
rommem[2853] = 65'h067E0800831FFF66D;
rommem[2854] = 65'h09A0551F09A04D075;
rommem[2855] = 65'h031FFF66D33FFF486;
rommem[2856] = 65'h00411040847E10008;
rommem[2857] = 65'h147E08008BE007F2A;
rommem[2858] = 65'h037EF801047EF8000;
rommem[2859] = 65'h1A6100339A0100430;
rommem[2860] = 65'h037EF8000E0400001;
rommem[2861] = 65'h137EF8000E0400000;
rommem[2862] = 65'h1A410035AA0100641;
rommem[2863] = 65'h1A610037AA0100461;
rommem[2864] = 65'h037EF8000E0400001;
rommem[2865] = 65'h137EF8000E0400000;
rommem[2866] = 65'h167EF80000FEF0008;
rommem[2867] = 65'h031FFF65604100809;
rommem[2868] = 65'h004200409BE100069;
rommem[2869] = 65'h147EF800031FFF65C;
rommem[2870] = 65'h00FEF001037EF8008;
rommem[2871] = 65'h031FFF69C67EF8000;
rommem[2872] = 65'h19A04D06B67E08008;
rommem[2873] = 65'h133FFF4869A0551B8;
rommem[2874] = 65'h031FFF69547E08008;
rommem[2875] = 65'h1BE0002AABE208321;
rommem[2876] = 65'h031FFF69547E08008;
rommem[2877] = 65'h1BE00022ABE2082A9;
rommem[2878] = 65'h031FFF69547E08008;
rommem[2879] = 65'h1BE0001AABE208223;
rommem[2880] = 65'h031FFF69547E08008;
rommem[2881] = 65'h0BE00012ABE2081A2;
rommem[2882] = 65'h031FFF69547E08008;
rommem[2883] = 65'h1BE0000AABE208128;
rommem[2884] = 65'h031FFF69547E08008;
rommem[2885] = 65'h1BE00002ABE2080A0;
rommem[2886] = 65'h0E040000047EF8000;
rommem[2887] = 65'h047EF800037EF8010;
rommem[2888] = 65'h137EF8010E0400001;
rommem[2889] = 65'h147EF800047E08008;
rommem[2890] = 65'h00FEF001037EF8010;
rommem[2891] = 65'h167E0800867EF8000;
rommem[2892] = 65'h047E1000831FFF69C;
rommem[2893] = 65'h037EF801047EF8000;
rommem[2894] = 65'h167EF80000FEF0010;
rommem[2895] = 65'h09A025A90E0C0002D;
rommem[2896] = 65'h1E040000031FFF8F1;
rommem[2897] = 65'h0BE00020A67E00008;
rommem[2898] = 65'h09A025A9CE0C0002B;
rommem[2899] = 65'h131FFF6B931FFF8F1;
rommem[2900] = 65'h1E0C0002B67E08008;
rommem[2901] = 65'h031FFF8F19A025AC0;
rommem[2902] = 65'h147E1000831FFF6B9;
rommem[2903] = 65'h1BE007F2A04110402;
rommem[2904] = 65'h09A025AD8E0C0002D;
rommem[2905] = 65'h131FFF6B931FFF8F1;
rommem[2906] = 65'h0BE007F0A02108006;
rommem[2907] = 65'h147EF800047E08008;
rommem[2908] = 65'h00FEF001037EF8010;
rommem[2909] = 65'h031FFF6CF67EF8000;
rommem[2910] = 65'h0E0C0002A67E08008;
rommem[2911] = 65'h031FFF8F19A025B10;
rommem[2912] = 65'h047E1000831FFF6CF;
rommem[2913] = 65'h1BE007F2A04110419;
rommem[2914] = 65'h09A025B30E0C0002F;
rommem[2915] = 65'h031FFF6CF31FFF8F1;
rommem[2916] = 65'h047E0800804100809;
rommem[2917] = 65'h1BE007E2A0411041B;
rommem[2918] = 65'h147EF800047E08008;
rommem[2919] = 65'h10FEF001837EF8010;
rommem[2920] = 65'h19A04D04267EF8000;
rommem[2921] = 65'h133FFF4869A055150;
rommem[2922] = 65'h031FFF6ECE0400000;
rommem[2923] = 65'h046108000BE100088;
rommem[2924] = 65'h137EF801847EF8000;
rommem[2925] = 65'h0BE20004931FFF8FF;
rommem[2926] = 65'h047EF800031FFF6DF;
rommem[2927] = 65'h10FEF000837EF8018;
rommem[2928] = 65'h0E0C0002867EF8000;
rommem[2929] = 65'h031FFF8F19A025BA8;
rommem[2930] = 65'h1E0C0002931FFF63A;
rommem[2931] = 65'h031FFF8F19A025BA8;
rommem[2932] = 65'h037EF800847EF8000;
rommem[2933] = 65'h0BE001BAA9A00E5FD;
rommem[2934] = 65'h067EF80000FEF0018;
rommem[2935] = 65'h10410140967E28008;
rommem[2936] = 65'h04A80800031FFF914;
rommem[2937] = 65'h0B2100F40A0101740;
rommem[2938] = 65'h131FFF6DF0A840001;
rommem[2939] = 65'h10FEF001806108600;
rommem[2940] = 65'h167EF800067E08008;
rommem[2941] = 65'h047EF800031FFF793;
rommem[2942] = 65'h1BE20804447E10008;
rommem[2943] = 65'h19A0090D833FFF7C5;
rommem[2944] = 65'h0BE0000AA04110405;
rommem[2945] = 65'h1BE10006831FFF70D;
rommem[2946] = 65'h031FFF73302510009;
rommem[2947] = 65'h047EF800047E28008;
rommem[2948] = 65'h147E2800837EF8018;
rommem[2949] = 65'h0E040000047EF8000;
rommem[2950] = 65'h00FEF001837EF8018;
rommem[2951] = 65'h067E2801067EF8000;
rommem[2952] = 65'h167E0800840808000;
rommem[2953] = 65'h0BE10038831FFF65C;
rommem[2954] = 65'h00A840001E1400005;
rommem[2955] = 65'h131FFF66440808000;
rommem[2956] = 65'h047E08008BE100168;
rommem[2957] = 65'h04081000006109000;
rommem[2958] = 65'h067E0800804110409;
rommem[2959] = 65'h00A840001BE02FEEF;
rommem[2960] = 65'h131FFF66440808000;
rommem[2961] = 65'h140808000BE107FA9;
rommem[2962] = 65'h0B0100324B0100425;
rommem[2963] = 65'h00E840001E0400000;
rommem[2964] = 65'h047E100080A840001;
rommem[2965] = 65'h10411040906211000;
rommem[2966] = 65'h047E2801047EF8000;
rommem[2967] = 65'h147EF800037EF8018;
rommem[2968] = 65'h0E040000047E28010;
rommem[2969] = 65'h10FEF001037EF8018;
rommem[2970] = 65'h167E3800867EF8000;
rommem[2971] = 65'h046338000460190D8;
rommem[2972] = 65'h0BE138128BE700108;
rommem[2973] = 65'h0460390F808318008;
rommem[2974] = 65'h1E07FE650BE33FF60;
rommem[2975] = 65'h0BE00112AF04FFFFF;
rommem[2976] = 65'h166308000BE2000C8;
rommem[2977] = 65'h047EF80000A308008;
rommem[2978] = 65'h137EF801047E38008;
rommem[2979] = 65'h147E3800847EF8000;
rommem[2980] = 65'h1E04000000BEF0010;
rommem[2981] = 65'h131FFF6DF37EF8000;
rommem[2982] = 65'h147EF80004A108000;
rommem[2983] = 65'h131FFF6DF37EF8018;
rommem[2984] = 65'h14C1080001410FFFE;
rommem[2985] = 65'h137EF801847EF8000;
rommem[2986] = 65'h11410FFFC31FFF6DF;
rommem[2987] = 65'h047EF80004E108000;
rommem[2988] = 65'h131FFF6DF37EF8018;
rommem[2989] = 65'h1461080001410FFF8;
rommem[2990] = 65'h137EF801847EF8000;
rommem[2991] = 65'h067E4000831FFF6DF;
rommem[2992] = 65'h0342F800046011028;
rommem[2993] = 65'h147EF800047E40008;
rommem[2994] = 65'h131FFF6DF37EF8018;
rommem[2995] = 65'h1BE100100BE100168;
rommem[2996] = 65'h10000005004100809;
rommem[2997] = 65'h131FFF775020088A8;
rommem[2998] = 65'h147EF80000A108001;
rommem[2999] = 65'h19A00E6C137EF8018;
rommem[3000] = 65'h100000050BE000B0A;
rommem[3001] = 65'h047EF8000020088A8;
rommem[3002] = 65'h10FEF002037EF8018;
rommem[3003] = 65'h167E2800867E18000;
rommem[3004] = 65'h067E3801867E30010;
rommem[3005] = 65'h10452940A1603803F;
rommem[3006] = 65'h1061082020463180A;
rommem[3007] = 65'h10663020014118001;
rommem[3008] = 65'h11410FFFE04619809;
rommem[3009] = 65'h104611805BE230047;
rommem[3010] = 65'h102608009BE03FF2F;
rommem[3011] = 65'h147E2800847E18000;
rommem[3012] = 65'h047E3801847E30010;
rommem[3013] = 65'h031FFF6DF37EF8020;
rommem[3014] = 65'h047EF800002108007;
rommem[3015] = 65'h131FFF6DF37EF8018;
rommem[3016] = 65'h047EF800002108008;
rommem[3017] = 65'h0460090D837EF8018;
rommem[3018] = 65'h004110405460110D0;
rommem[3019] = 65'h137EF801847EF8000;
rommem[3020] = 65'h167EF80000FEF0010;
rommem[3021] = 65'h131FFF6ECE0400001;
rommem[3022] = 65'h09A00E6AABE100069;
rommem[3023] = 65'h167E08008BE00054A;
rommem[3024] = 65'h19A025EA4E0C0003D;
rommem[3025] = 65'h031FFF63A31FFF8F1;
rommem[3026] = 65'h16620800047E10008;
rommem[3027] = 65'h147EF800004200409;
rommem[3028] = 65'h0BE0003CA37EF8010;
rommem[3029] = 65'h167EF80000FEF0008;
rommem[3030] = 65'h09A025EC4E0C0003A;
rommem[3031] = 65'h00BEF000831FFF8F1;
rommem[3032] = 65'h1E0C0000DBE0020AA;
rommem[3033] = 65'h031FFF8F19A025EDC;
rommem[3034] = 65'h10BEF000847EF8000;
rommem[3035] = 65'h047EF8000BE001EAA;
rommem[3036] = 65'h00FEF000837EF8008;
rommem[3037] = 65'h031FFF91467EF8000;
rommem[3038] = 65'h1B010040D40808000;
rommem[3039] = 65'h1F04FFFFFE07FE784;
rommem[3040] = 65'h047EF800033FFF7C8;
rommem[3041] = 65'h09A00E76F37EF8008;
rommem[3042] = 65'h09A00E605BE00008A;
rommem[3043] = 65'h19A00E5FDBE00004A;
rommem[3044] = 65'h14600909031FFF940;
rommem[3045] = 65'h0B01D9AFFBE107E88;
rommem[3046] = 65'h16080000040828000;
rommem[3047] = 65'h031FFF8DF46009090;
rommem[3048] = 65'h16082800004101809;
rommem[3049] = 65'h131FFF393E040003F;
rommem[3050] = 65'h10E608001E0800000;
rommem[3051] = 65'h133FFF3BE31FFF851;
rommem[3052] = 65'h167EF80000FEF0010;
rommem[3053] = 65'h031FFF39367E28008;
rommem[3054] = 65'h060009046E0400001;
rommem[3055] = 65'h031FFF393E0400020;
rommem[3056] = 65'h1F2000000E200111B;
rommem[3057] = 65'h1BE107FE831FFF936;
rommem[3058] = 65'h0B0101418B0100B08;
rommem[3059] = 65'h0A81FFB20B010020D;
rommem[3060] = 65'h00884000160808000;
rommem[3061] = 65'h14080FFFF31FFF393;
rommem[3062] = 65'h01280916AB010190D;
rommem[3063] = 65'h1E0400008BE107E80;
rommem[3064] = 65'h0E040002031FFF393;
rommem[3065] = 65'h11280911B31FFF393;
rommem[3066] = 65'h1E0400008BE107DC2;
rommem[3067] = 65'h00C84000131FFF393;
rommem[3068] = 65'h004800409BE007D4A;
rommem[3069] = 65'h0BE5001080E12911B;
rommem[3070] = 65'h031FFF393E0400008;
rommem[3071] = 65'h031FFF393E0400020;
rommem[3072] = 65'h031FFF393E0400008;
rommem[3073] = 65'h19A04111BBE02FF4F;
rommem[3074] = 65'h0E0400000BE007BCA;
rommem[3075] = 65'h1E040000A60009046;
rommem[3076] = 65'h147EF800031FFF393;
rommem[3077] = 65'h037EF801047E28008;
rommem[3078] = 65'h19A00E694AC1003FF;
rommem[3079] = 65'h04604CE60BE00774A;
rommem[3080] = 65'h10EA50001460510D0;
rommem[3081] = 65'h04A918000BE950127;
rommem[3082] = 65'h0062110004A910001;
rommem[3083] = 65'h0BE11012704218809;
rommem[3084] = 65'h10410840ABE1100C8;
rommem[3085] = 65'h00494A40A37EF8000;
rommem[3086] = 65'h137EF80000410840A;
rommem[3087] = 65'h037EF8000E0400001;
rommem[3088] = 65'h14A9100000A948002;
rommem[3089] = 65'h0B22FFE0D0A948001;
rommem[3090] = 65'h040120000BE007D8A;
rommem[3091] = 65'h00810800160220000;
rommem[3092] = 65'h1BE11FF8908210001;
rommem[3093] = 65'h00C10800137EF8000;
rommem[3094] = 65'h0401200000C210001;
rommem[3095] = 65'h1BE11FF8960220000;
rommem[3096] = 65'h147E0800037EF8000;
rommem[3097] = 65'h1BE100148660090A8;
rommem[3098] = 65'h0660090C847E08020;
rommem[3099] = 65'h0660090C047E08018;
rommem[3100] = 65'h1660090B847E08010;
rommem[3101] = 65'h0660090B047E08008;
rommem[3102] = 65'h137EF800837EF8028;
rommem[3103] = 65'h00A108028460090F8;
rommem[3104] = 65'h1460090A8BFE0F0A4;
rommem[3105] = 65'h10FEF0028BE100188;
rommem[3106] = 65'h1460090C867E08000;
rommem[3107] = 65'h1460090C067E08020;
rommem[3108] = 65'h0460090B867E08018;
rommem[3109] = 65'h0460090B067E08010;
rommem[3110] = 65'h137EF800067E08008;
rommem[3111] = 65'h167E080000FEF0008;
rommem[3112] = 65'h00DEF002037EF8000;
rommem[3113] = 65'h167E2800867E28000;
rommem[3114] = 65'h167EF801867E38010;
rommem[3115] = 65'h00223000902128009;
rommem[3116] = 65'h10A5280014A538000;
rommem[3117] = 65'h102708009BE7300C8;
rommem[3118] = 65'h0B27FFB0D31FFF393;
rommem[3119] = 65'h131FFF393E040000A;
rommem[3120] = 65'h10250800902710009;
rommem[3121] = 65'h147E3801047EF8018;
rommem[3122] = 65'h147E2800047E28008;
rommem[3123] = 65'h00FEF000837EF8020;
rommem[3124] = 65'h0E0C0002267EF8000;
rommem[3125] = 65'h0F10FFFFFE13FE1D0;
rommem[3126] = 65'h1E080002231FFF8F1;
rommem[3127] = 65'h031FFF85104800409;
rommem[3128] = 65'h0B2200F0A04102009;
rommem[3129] = 65'h0BE00070A0BEF0008;
rommem[3130] = 65'h1E13FE1E8E0C00027;
rommem[3131] = 65'h031FFF8F1F10FFFFF;
rommem[3132] = 65'h0BE007EAAE0800027;
rommem[3133] = 65'h1E13FE20CE0C0005F;
rommem[3134] = 65'h031FFF8F1F10FFFFF;
rommem[3135] = 65'h031FFF393E040000D;
rommem[3136] = 65'h10BEF000847EF8000;
rommem[3137] = 65'h147EF800035F00004;
rommem[3138] = 65'h00FEF000837EF8008;
rommem[3139] = 65'h0E040000D67EF8000;
rommem[3140] = 65'h1E040000A31FFF393;
rommem[3141] = 65'h147EF800031FFF393;
rommem[3142] = 65'h10FEF002837EF8008;
rommem[3143] = 65'h167E2800867E18000;
rommem[3144] = 65'h067E3801867E30010;
rommem[3145] = 65'h01603910067EF8020;
rommem[3146] = 65'h00222800902130009;
rommem[3147] = 65'h002108006BE100063;
rommem[3148] = 65'h11601800A0E528001;
rommem[3149] = 65'h11C10800A0411881C;
rommem[3150] = 65'h0607100000A210030;
rommem[3151] = 65'h10E5280010A738001;
rommem[3152] = 65'h1BE500082BE107F29;
rommem[3153] = 65'h031FFF393E0400020;
rommem[3154] = 65'h1BE600063BE02FFCF;
rommem[3155] = 65'h131FFF393E040002D;
rommem[3156] = 65'h1407080000E738001;
rommem[3157] = 65'h11270910031FFF393;
rommem[3158] = 65'h147EF8020BE107F87;
rommem[3159] = 65'h047E3001047E38018;
rommem[3160] = 65'h147E1800047E28008;
rommem[3161] = 65'h00FEF002837EF8028;
rommem[3162] = 65'h167E3000867E28000;
rommem[3163] = 65'h167E4001867E38010;
rommem[3164] = 65'h0E1C0110067EF8020;
rommem[3165] = 65'h104101809F1C00000;
rommem[3166] = 65'h004101009E1400014;
rommem[3167] = 65'h102420006BE400083;
rommem[3168] = 65'h1E20000140C528001;
rommem[3169] = 65'h11410800F04400409;
rommem[3170] = 65'h00A108037A010030A;
rommem[3171] = 65'h008108030BE00004A;
rommem[3172] = 65'h00873800160708000;
rommem[3173] = 65'h0BE4000480C528001;
rommem[3174] = 65'h1BE500082BE047ECF;
rommem[3175] = 65'h031FFF393E0400020;
rommem[3176] = 65'h1BE600063BE02FFCF;
rommem[3177] = 65'h131FFF393E040002D;
rommem[3178] = 65'h0407080000C738001;
rommem[3179] = 65'h11270910031FFF393;
rommem[3180] = 65'h047EF8020BE107F83;
rommem[3181] = 65'h147E3801047E40018;
rommem[3182] = 65'h147E2800047E30008;
rommem[3183] = 65'h10FEF001037EF8028;
rommem[3184] = 65'h067EF800867E28000;
rommem[3185] = 65'h14A50FFFE08128002;
rommem[3186] = 65'h0062110004A517FFF;
rommem[3187] = 65'h0E080000004110409;
rommem[3188] = 65'h1E040002031FFF88D;
rommem[3189] = 65'h1E080000031FFF393;
rommem[3190] = 65'h131FFF85104500409;
rommem[3191] = 65'h047E2800047EF8008;
rommem[3192] = 65'h00FEF001037EF8010;
rommem[3193] = 65'h167E0800867EF8000;
rommem[3194] = 65'h04080800031FFF914;
rommem[3195] = 65'h147E08008BE3080A8;
rommem[3196] = 65'h10BEF001047EF8000;
rommem[3197] = 65'h00884000134400000;
rommem[3198] = 65'h147EF800047E08008;
rommem[3199] = 65'h00FEF000837EF8010;
rommem[3200] = 65'h031FFF91467EF8000;
rommem[3201] = 65'h0E0800000E0400000;
rommem[3202] = 65'h0A8300D3040818000;
rommem[3203] = 65'h1E13FFFFFAE300C39;
rommem[3204] = 65'h1BE120066F10FFFFF;
rommem[3205] = 65'h1BE0057AAE07FE629;
rommem[3206] = 65'h1088400011A10800A;
rommem[3207] = 65'h0041184021431800F;
rommem[3208] = 65'h0BE007E6A08210001;
rommem[3209] = 65'h037EF800847EF8000;
rommem[3210] = 65'h167E080000FEF0008;
rommem[3211] = 65'h1B010022040808000;
rommem[3212] = 65'h108840001B2100300;
rommem[3213] = 65'h047E08000BE007F8A;
rommem[3214] = 65'h00FEF000837EF8008;
rommem[3215] = 65'h1E200111B67EF8000;
rommem[3216] = 65'h040808000E0C00000;
rommem[3217] = 65'h0B0100D0D08840001;
rommem[3218] = 65'h0B0100527B0100622;
rommem[3219] = 65'h131FFF932BE307F69;
rommem[3220] = 65'h0BE007F0A6080FFFF;
rommem[3221] = 65'h004100C09BE300069;
rommem[3222] = 65'h0BE30FE89BE007EAA;
rommem[3223] = 65'h0BE007E4AE0C00000;
rommem[3224] = 65'h037EF800847EF8000;
rommem[3225] = 65'h1A610027AA0100361;
rommem[3226] = 65'h037EF80000C108020;
rommem[3227] = 65'h167EF80000FEF0008;
rommem[3228] = 65'h0B01003FF31FFF394;
rommem[3229] = 65'h133FFF3BEB2100303;
rommem[3230] = 65'h047EF80000410840A;
rommem[3231] = 65'h0E07FE60B37EF8008;
rommem[3232] = 65'h067E280000FEF0010;
rommem[3233] = 65'h00212800967EF8008;
rommem[3234] = 65'h14050FFFF08528001;
rommem[3235] = 65'h131FFF393BE100068;
rommem[3236] = 65'h002508009BE007F8A;
rommem[3237] = 65'h047E2800047EF8008;
rommem[3238] = 65'h00FEF001037EF8010;
rommem[3239] = 65'h067EF800867E28000;
rommem[3240] = 65'h10A52800102128009;
rommem[3241] = 65'h1BE1000684050FFFF;
rommem[3242] = 65'h1BE007F8A31FFF395;
rommem[3243] = 65'h147EF800802508009;
rommem[3244] = 65'h137EF801047E28000;
rommem[3245] = 65'h033FFEE0833FFEF47;
rommem[3246] = 65'h0B01003FF31FFED54;
rommem[3247] = 65'h037EF80001410807F;
rommem[3248] = 65'h137EF80000410840A;
rommem[3249] = 65'h031FFEED933FFED0C;
rommem[3250] = 65'h137EF8000BE00740A;
rommem[3251] = 65'h037EF800037EF8000;
rommem[3252] = 65'h1BE004BEABE00738A;
rommem[3253] = 65'h047EF8000460F1088;
rommem[3254] = 65'h0C44E4100BCBD3CBD;
rommem[3255] = 65'h10000000000D24F00;
rommem[3256] = 65'h0726F747061520A0D;
rommem[3257] = 65'h020796E6954203436;
rommem[3258] = 65'h13176204349534142;
rommem[3259] = 65'h0202943280A0D302E;
rommem[3260] = 65'h06F52202032313032;
rommem[3261] = 65'h06E69462074726562;
rommem[3262] = 65'h10A0D000A0A0D6863;
rommem[3263] = 65'h1616857000A0D4B4F;
rommem[3264] = 65'h1726F53000A0D3F74;
rommem[3265] = 65'h16F43000A0D2E7972;
rommem[3266] = 65'h04C4620746361706D;
rommem[3267] = 65'h16461657220485341;
rommem[3268] = 65'h00A0D726F72726520;
rommem[3269] = 65'h0207265626D754E00;
rommem[3270] = 65'h062206F6F74207369;
rommem[3271] = 65'h1766944000A0D6769;
rommem[3272] = 65'h17962206E6F697369;
rommem[3273] = 65'h1000A0D6F72657A20;
rommem[3274] = 65'h17620666F2074754F;
rommem[3275] = 65'h020656C6261697261;
rommem[3276] = 65'h0000A0D6563617073;
rommem[3277] = 65'h16620736574796220;
rommem[3278] = 65'h00A0D000A0D656572;
rommem[3279] = 65'h1000A0D7964616552;
rommem[3280] = 65'h16E69746365707845;
rommem[3281] = 65'h06D6D6F6320612067;
rommem[3282] = 65'h0656E694C000A0D61;
rommem[3283] = 65'h0207265626D756E20;
rommem[3284] = 65'h00D676962206F6F74;
rommem[3285] = 65'h0746365707845000A;
rommem[3286] = 65'h16176206120676E69;
rommem[3287] = 65'h10A0D656C62616972;
rommem[3288] = 65'h164616220444E5200;
rommem[3289] = 65'h174656D6172617020;
rommem[3290] = 65'h1535953000A0D7265;
rommem[3291] = 65'h06464612064616220;
rommem[3292] = 65'h049000A0D73736572;
rommem[3293] = 65'h1707865205455504E;
rommem[3294] = 65'h06120676E69746365;
rommem[3295] = 65'h16C62616972617620;
rommem[3296] = 65'h05458454E000A0D65;
rommem[3297] = 65'h174756F6874697720;
rommem[3298] = 65'h14E000A0D524F4620;
rommem[3299] = 65'h16570786520545845;
rommem[3300] = 65'h1206120676E697463;
rommem[3301] = 65'h02064656E69666564;
rommem[3302] = 65'h0656C626169726176;
rommem[3303] = 65'h12F4F544F47000A0D;
rommem[3304] = 65'h06162204255534F47;
rommem[3305] = 65'h16E20656E696C2064;
rommem[3306] = 65'h0000A0D7265626D75;
rommem[3307] = 65'h177204E5255544552;
rommem[3308] = 65'h1472074756F687469;
rommem[3309] = 65'h050000A0D4255534F;
rommem[3310] = 65'h069206D6172676F72;
rommem[3311] = 65'h06962206F6F742073;
rommem[3312] = 65'h172747845000A0D67;
rommem[3313] = 65'h16361726168632061;
rommem[3314] = 65'h0206E6F2073726574;
rommem[3315] = 65'h06E676920656E696C;
rommem[3316] = 65'h000000A0D6465726F;
rommem[3317] = 65'h00000000033FFF096;
rommem[3318] = 65'h1E6AA555504002009;
rommem[3319] = 65'h1F68AAAA5EE9556AA;
rommem[3320] = 65'h166808000040D0409;
rommem[3321] = 65'h004110C0646810000;
rommem[3322] = 65'h10A840008BE3000C9;
rommem[3323] = 65'h0EE800010E6800000;
rommem[3324] = 65'h0BE307F00048D0C06;
rommem[3325] = 65'h00400200904802809;
rommem[3326] = 65'h0E6AA555546810000;
rommem[3327] = 65'h1F68AAAA5EE9556AA;
rommem[3328] = 65'h1BE3000C9042D0C06;
rommem[3329] = 65'h0E680000008840008;
rommem[3330] = 65'h1048D0C06EE800004;
rommem[3331] = 65'h0BE850389BE307EC0;
rommem[3332] = 65'h1E695AAAA04002009;
rommem[3333] = 65'h1F685555AEEAAA955;
rommem[3334] = 65'h166808000040D0409;
rommem[3335] = 65'h004110C0646810000;
rommem[3336] = 65'h008840008BE3000C9;
rommem[3337] = 65'h0EE800004E6800000;
rommem[3338] = 65'h0BE307F00048D0C06;
rommem[3339] = 65'h10400200904802C09;
rommem[3340] = 65'h0E695AAAA46810000;
rommem[3341] = 65'h1F685555AEEAAA955;
rommem[3342] = 65'h1BE3000C9042D0C06;
rommem[3343] = 65'h0E680000008840008;
rommem[3344] = 65'h1048D0C06EE800004;
rommem[3345] = 65'h0BE858048BE307EC0;
rommem[3346] = 65'h1BE8500480485A014;
rommem[3347] = 65'h16604040004852014;
rommem[3348] = 65'h09A00E92B37EF8000;
rommem[3349] = 65'h0020085E831FFEFE7;
rommem[3350] = 65'h00000002831FFF019;
rommem[3351] = 65'h09A00E91033FFEC07;
rommem[3352] = 65'h00200862831FFEFE7;
rommem[3353] = 65'h19A00E92431FFF019;
rommem[3354] = 65'h0020085E831FFEFE7;
rommem[3355] = 65'h131FFF93F31FFF019;
rommem[3356] = 65'h102200FA91601001F;
rommem[3357] = 65'h0DE000000DE000000;
rommem[3358] = 65'h002008FE8DE000000;
rommem[3359] = 65'h131FFF93F31FFF019;
rommem[3360] = 65'h100000028BE017F2F;
rommem[3361] = 65'h00000000033FFEC07;
rommem[3362] = 65'h07375622061746144;
rommem[3363] = 65'h16120726F72726520;
rommem[3364] = 65'h04350452000203A74;
rommem[3365] = 65'h1662072724500203A;
rommem[3366] = 65'h020676E6968637465;
rommem[3367] = 65'h17463757274736E69;
rommem[3368] = 65'h0203A7461206E6F69;
rommem[3369] = 65'h00000000000000000;
rommem[3370] = 65'h167E080000FEF0020;
rommem[3371] = 65'h067ED001067E10008;
rommem[3372] = 65'h0E69C0FF067EF8018;
rommem[3373] = 65'h16A0D0421EE800003;
rommem[3374] = 65'h1E6BF0000B2101602;
rommem[3375] = 65'h1460094006A0D0028;
rommem[3376] = 65'h0660094000A108001;
rommem[3377] = 65'h0EE800003E6900000;
rommem[3378] = 65'h08220814C6A0D082D;
rommem[3379] = 65'h09220814C0A108001;
rommem[3380] = 65'h147ED001047EF8018;
rommem[3381] = 65'h147E0800047E10008;
rommem[3382] = 65'h10000000F0BEF0020;
rommem[3383] = 65'h0DE000000DE000000;
rommem[3384] = 65'h001900020DE000000;
rommem[3385] = 65'h04600B000B2100403;
rommem[3386] = 65'h1BE0001AA31FFEE3B;
rommem[3387] = 65'h04600B010B2100408;
rommem[3388] = 65'h1BE00012A341F8000;
rommem[3389] = 65'h14600B018B210040D;
rommem[3390] = 65'h0BE0000AA31FFF2B1;
rommem[3391] = 65'h0B210030FB0118901;
rommem[3392] = 65'h131FFEDF14600B008;
rommem[3393] = 65'h147ED001047EF8018;
rommem[3394] = 65'h147E0800047E10008;
rommem[3395] = 65'h1019000200BEF0020;
rommem[3396] = 65'h0E6BF000001900020;
rommem[3397] = 65'h0E6BF00086A0D0413;
rommem[3398] = 65'h0020080346A0D0813;
rommem[3399] = 65'h002008128BE107FE9;
rommem[3400] = 65'h1022002E902010228;
rommem[3401] = 65'h00411040306211A01;
rommem[3402] = 65'h11421000046110000;
rommem[3403] = 65'h146110008022002A9;
rommem[3404] = 65'h0022002E914210000;
rommem[3405] = 65'h10200003502000034;
rommem[3406] = 65'h06A0D0403E6BF0000;
rommem[3407] = 65'h16A0D0803E6BF0008;
rommem[3408] = 65'h00000000001900020;
rommem[3409] = 65'h16A0D0803E6BF0008;
rommem[3410] = 65'h00000000000000000;
rommem[3411] = 65'h00000000000000000;
rommem[4086] = 65'h1DE00000033FFFA89;
rommem[4088] = 65'h1DE00000033FFFA89;
rommem[4092] = 65'h0DE00000033FFFA88;
rommem[4094] = 65'h0DE00000033FFEC07;
rommem[4095] = 65'h000000000DE000000;

powered by: WebSVN 2.1.0

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