Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
import Apple2IO from 'js/apple2io';
|
|
|
|
import MMU from '../../js/mmu';
|
2023-11-22 16:28:40 -08:00
|
|
|
import { CPU6502 } from '@whscullin/cpu6502';
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
import { HiresPage, LoresPage, VideoModes, VideoPage } from 'js/videomodes';
|
|
|
|
import Apple2eROM from '../../js/roms/system/apple2e';
|
|
|
|
import { MemoryPages } from 'js/types';
|
|
|
|
|
|
|
|
function newFakeMemoryPages() {
|
|
|
|
return {} as unknown as MemoryPages;
|
|
|
|
}
|
|
|
|
|
|
|
|
function newFakeVideoPage(): VideoPage {
|
|
|
|
const bank0Pages = newFakeMemoryPages();
|
|
|
|
const bank1Pages = newFakeMemoryPages();
|
|
|
|
return {
|
|
|
|
bank0() {
|
|
|
|
return bank0Pages;
|
|
|
|
},
|
|
|
|
bank1() {
|
|
|
|
return bank1Pages;
|
|
|
|
},
|
|
|
|
} as unknown as VideoPage;
|
|
|
|
}
|
|
|
|
|
|
|
|
function newFakeLoresPage(): LoresPage {
|
|
|
|
return newFakeVideoPage() as unknown as LoresPage;
|
|
|
|
}
|
|
|
|
|
|
|
|
function newFakeHiresPage(): HiresPage {
|
|
|
|
return newFakeVideoPage() as unknown as HiresPage;
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('MMU', () => {
|
|
|
|
const fakeVideoModes = {} as unknown as VideoModes;
|
|
|
|
const fakeCPU = {} as unknown as CPU6502;
|
|
|
|
const fakeLoResPage1 = newFakeLoresPage();
|
|
|
|
const fakeLoResPage2 = newFakeLoresPage();
|
|
|
|
const fakeHiResPage1 = newFakeHiresPage();
|
|
|
|
const fakeHiResPage2 = newFakeHiresPage();
|
|
|
|
const fakeApple2IO = {} as unknown as Apple2IO;
|
|
|
|
|
|
|
|
it('is constructable', () => {
|
2023-11-24 06:45:55 -08:00
|
|
|
const mmu = new MMU(
|
|
|
|
fakeCPU,
|
|
|
|
fakeVideoModes,
|
|
|
|
fakeLoResPage1,
|
|
|
|
fakeLoResPage2,
|
|
|
|
fakeHiResPage1,
|
|
|
|
fakeHiResPage2,
|
|
|
|
fakeApple2IO,
|
|
|
|
new Apple2eROM()
|
|
|
|
);
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
expect(mmu).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('requires prewrite to write to bank1', () => {
|
2023-11-24 06:45:55 -08:00
|
|
|
const mmu = new MMU(
|
|
|
|
fakeCPU,
|
|
|
|
fakeVideoModes,
|
|
|
|
fakeLoResPage1,
|
|
|
|
fakeLoResPage2,
|
|
|
|
fakeHiResPage1,
|
|
|
|
fakeHiResPage2,
|
|
|
|
fakeApple2IO,
|
|
|
|
new Apple2eROM()
|
|
|
|
);
|
2023-11-22 16:28:40 -08:00
|
|
|
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
// From https://github.com/whscullin/apple2js/issues/187
|
|
|
|
// Action descriptions from Sather, Table 5.5, p. 5-24, UtAIIe:
|
2023-11-24 06:45:55 -08:00
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE
|
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE (write enabled)
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
mmu._access(0x89, 0x00); // WRTCOUNT = 0, READ DISABLE (write still enabled)
|
2023-11-24 06:45:55 -08:00
|
|
|
mmu._access(0x89); // WRTCOUNT = WRITCOUNT + 1, READ DISABLE (write still enabled)
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
mmu.write(0xd0, 0x00, 0xa1);
|
2023-11-24 06:45:55 -08:00
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE (write still enabled)
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
expect(mmu.read(0xd0, 0x00)).toBe(0xa1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('prewrite is reset on write access before write', () => {
|
2023-11-24 06:45:55 -08:00
|
|
|
const mmu = new MMU(
|
|
|
|
fakeCPU,
|
|
|
|
fakeVideoModes,
|
|
|
|
fakeLoResPage1,
|
|
|
|
fakeLoResPage2,
|
|
|
|
fakeHiResPage1,
|
|
|
|
fakeHiResPage2,
|
|
|
|
fakeApple2IO,
|
|
|
|
new Apple2eROM()
|
|
|
|
);
|
2023-11-22 16:28:40 -08:00
|
|
|
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
// Action descriptions from Sather, Table 5.5, p. 5-24, UtAIIe:
|
|
|
|
mmu._access(0x89, 0x00); // WRTCOUNT = 0, READ DISABLE
|
2023-11-24 06:45:55 -08:00
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE (write not enabled yet)
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
mmu._access(0x8b, 0x00); // WRTCOUNT = 0, READ ENABLE (write still not enabled)
|
|
|
|
const oldValue = mmu.read(0xd0, 0x00);
|
|
|
|
mmu.write(0xd0, 0x00, 0xa1); // writes to the void
|
|
|
|
expect(mmu.read(0xd0, 0x00)).toBe(oldValue); // reads old value
|
|
|
|
});
|
|
|
|
|
|
|
|
it('write stays active with overzealous switching', () => {
|
2023-11-24 06:45:55 -08:00
|
|
|
const mmu = new MMU(
|
|
|
|
fakeCPU,
|
|
|
|
fakeVideoModes,
|
|
|
|
fakeLoResPage1,
|
|
|
|
fakeLoResPage2,
|
|
|
|
fakeHiResPage1,
|
|
|
|
fakeHiResPage2,
|
|
|
|
fakeApple2IO,
|
|
|
|
new Apple2eROM()
|
|
|
|
);
|
2023-11-22 16:28:40 -08:00
|
|
|
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
// Action descriptions from Sather, Table 5.5, p. 5-24, UtAIIe:
|
2023-11-24 06:45:55 -08:00
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE
|
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE (write enabled)
|
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE (write enabled)
|
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE (write enabled)
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
mmu.write(0xd0, 0x00, 0xa1);
|
2023-11-24 06:45:55 -08:00
|
|
|
mmu._access(0x8b); // WRTCOUNT = WRTCOUNT + 1, READ ENABLE (write still enabled)
|
Fix issue #187 (and upgrade jest) (#188)
* Update jest to v29.5.0
This updates jest to the latest version (29.5.0) and fixes everything
that the upgrade breaks. One of the biggest differences is that the
mock types changed and I'm once again confused as to the "proper" way
to create mocks in jest. Whatever.
* Fix issue #187 were bank writing was not working correctly
Before, `mmu.ts` would deactivate writing to the language card if
`prewrite` was reset. However, it is totally possible to reset
`prewrite` and leave writing enabled, as shown my Sather in
_Understanding the Apple IIe_, table 5.5, p. 5-24. For example:
```assembly_x86
sta $c08a ; WRITE DISABLE; READ DISABLE
lda $c08b ; PRE-WRITE set
lda $c08b ; WRITE enabled
sta $c08a ; PRE-WRITE reset; WRITE still enabled!
lda $c08b ; PRE-WRITE set; WRITE still enabled!
```
would not work correctly because the last line would clear `_writebsr`
before setting `_prewrite`, which is incorrect.
Now, `_writebsr` is only set when `_prewrite` is set and thus only
cleared when `writeSwitch` is false. This matches Table 5.5.
* Fix pre-write for the language card
This is the same issue as the `MMU`, namely that `langcard.ts` would
deactivate writing to the language card if `prewrite` was reset.
However, it is totally possible to reset `prewrite` and leave writing
enabled, as shown my Sather in _Understanding the Apple II_, table
5.4, p. 5-30. See the previous commit for an example.
This change also adds a test for the `LanguageCard` class.
2023-07-08 20:18:38 +02:00
|
|
|
expect(mmu.read(0xd0, 0x00)).toBe(0xa1);
|
|
|
|
});
|
2023-11-22 16:28:40 -08:00
|
|
|
});
|