Skip to content

Commit

Permalink
Merge pull request #298 from Gampyg28/d_DisableInterrupts
Browse files Browse the repository at this point in the history
Disabled Interrupts, Replaced bra.w with jmp, Removed Mode36Fail.
  • Loading branch information
antuspcm committed Apr 18, 2023
2 parents 829079f + 4ba3c6f commit c6bedea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
14 changes: 8 additions & 6 deletions Kernels/Kernel.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
|.equ Mode_36 | Moved to Common-Assembly.s

start:
ori #0x700, %sr | Disable Interrupts

move.b #0x03, (J1850_Command).l | Flush frame except for completion code
move.b #0x00, (J1850_TX_FIFO).l | Initiate transfer

Expand Down Expand Up @@ -150,7 +152,7 @@ ProcessKernelID:
#endif
move.l #9, %d0 | It's 9 bytes long
bsr.w VPWSend | Send it
bra.w MainLoop | Return to MainLoop
jmp MainLoop | Return to MainLoop

| =============== S U B R O U T I N E =======================================
|
Expand All @@ -172,7 +174,7 @@ ProcessOsID:
move.l (%a1), 5(%a0) | Move OsID into buffer
move.l #9, %d0 | It's 9 bytes long
bsr.w VPWSend | Send it
bra.w MainLoop | Return to MainLoop
jmp MainLoop | Return to MainLoop

| =============== S U B R O U T I N E =======================================
ProcessFlashID:
Expand Down Expand Up @@ -224,7 +226,7 @@ ProcessFlashIDFound:
movea.l #FlashIDReply, %a0 | Move address of FlashIDReply to a0
move.l #9, %d0 | It's 9 bytes long
bsr.w VPWSend | Send it
bra.w MainLoop
jmp MainLoop

| =============== S U B R O U T I N E =======================================
ProcessCRC:
Expand Down Expand Up @@ -275,7 +277,7 @@ ProcessCRCMainLoopCheck:
move.l %d0, 0xB(%a0) | Move long CRC value to reply buffer
move.l #0x0F, %d0 | It's 15 bytes long (6C F0 10 7D 02 01 00 00 01 00 00 67 86 6E C2)
bsr.w VPWSend | Send it
bra.w MainLoop | Return to MainLoop
jmp MainLoop | Return to MainLoop

ProcessCRCPolynomial:
eori.l #POLYNOMIAL, %d0 | ^ POLYNOMIAL;
Expand All @@ -289,7 +291,7 @@ ProcessMode34:
movea.l #Mode34Reply, %a0 | Move address of Mode34Reply to a0
move.l #6, %d0 | It's 6 bytes long
bsr.w VPWSend | Send it
bra.w MainLoop
jmp MainLoop

| =============== S U B R O U T I N E =======================================
ProcessMode35:
Expand All @@ -305,7 +307,7 @@ ProcessMode35:
lsl.l #8, %d0 | Logical Shift Left
or.b MessageBuffer + 6, %d0 | Second length byte
bsr.w VPWSendBlock | Send the actual data
bra.w MainLoop | Back to main
jmp MainLoop | Back to main

| =============== S U B R O U T I N E =======================================
ProcessMode36:
Expand Down
21 changes: 9 additions & 12 deletions Kernels/Loader.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
|.equ Mode_36 | Moved to Common-Assembly.s

start:
ori #0x700, %sr | Disable Interrupts

#if defined P12
movea.l #Mode36Reply, %a0 | Reply Success to mode 3680, only P12 needs this.
move.l #6, %d0 | It's 6 bytes long
Expand Down Expand Up @@ -105,15 +107,15 @@ ProcessKernelID:
#endif
move.l #9, %d0 | It's 9 bytes long
bsr.w VPWSend | Send it
bra.w MainLoop | Return to MainLoop
jmp MainLoop | Return to MainLoop

| =============== S U B R O U T I N E =======================================
ProcessMode34:
| TODO: Add rejections
movea.l #Mode34Reply, %a0 | Move address of Mode34Reply to a0
move.l #6, %d0 | It's 6 bytes long
bsr.w VPWSend | Send it
bra.w MainLoop
jmp MainLoop

| =============== S U B R O U T I N E =======================================
| The packet is in the buffer when this function is called
Expand Down Expand Up @@ -154,18 +156,14 @@ ProcessMode36NextSum:
cmp.l %d3, %d4 | Is the sum OK?
beq.s ProcessMode36MemCopy | Do it


| Process Mode36 Response Fail
|
| TODO: Merge with Mode36Reply
|Mode36Fail: .byte 0x6C, toolid, pcmid, 0x7F, 0x36, 0x00
|
movea.l #Mode36Fail, %a0 | Mode 36 reply
move.b MessageBuffer + 4, %d4 | Submode to d4
move.b %d4, Mode36Fail + 5 | Copy submode byte to the response, and keep it in d4 for the execute test
movea.l #Mode36Reply, %a0 | Mode 36 reply
move.b #0x7F, 3(%a0) | 7F Failure
move.b MessageBuffer + 3, 4(%a0) | Mode
move.b MessageBuffer + 4, 5(%a0) | Submode
move.l #6, %d0 | Message is 6 bytes long
bsr.w VPWSend | Send it
bra.w MainLoop | Return to main loop
jmp MainLoop | Return to main loop

ProcessMode36MemCopy:
move.b (%a0)+, (%a1)+ | Move a byte from A0 to A1, increment pointers
Expand Down Expand Up @@ -279,7 +277,6 @@ Mode34Reply: .byte 0x6C, toolid, pcmid, 0x74, 0x00, 0x00

| Mode36 Reply, 6 bytes - 6C F0 10 76 00 00
Mode36Reply: .byte 0x6C, toolid, pcmid, 0x76, 0x00, 0x00
Mode36Fail: .byte 0x6C, toolid, pcmid, 0x7F, 0x36, 0x00

| Halt Kernel Reply, 4 bytes
Mode60Reply: .byte 0x6C, toolid, pcmid, 0x60
Expand Down

0 comments on commit c6bedea

Please sign in to comment.